@galacean/engine-spine 1.1.0-test.1 → 2.0.0-alpha.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +158 -44
  3. package/dist/browser.js +2139 -1
  4. package/dist/browser.js.map +1 -0
  5. package/dist/browser.min.js +2 -0
  6. package/dist/browser.min.js.map +1 -0
  7. package/dist/main.js +2134 -1
  8. package/dist/main.js.map +1 -1
  9. package/dist/module.js +2117 -1
  10. package/dist/module.js.map +1 -1
  11. package/package.json +30 -55
  12. package/types/SpineAnimation.d.ts +4 -44
  13. package/types/SpineAnimationState.d.ts +32 -0
  14. package/types/SpineAnimationStateData.d.ts +10 -0
  15. package/types/SpineAnimationStateListener.d.ts +20 -0
  16. package/types/SpineBone.d.ts +28 -0
  17. package/types/SpineConstant.d.ts +12 -0
  18. package/types/SpinePhysics.d.ts +17 -0
  19. package/types/SpinePhysicsConstraint.d.ts +22 -0
  20. package/types/SpineSkeleton.d.ts +31 -0
  21. package/types/SpineSkeletonData.d.ts +18 -0
  22. package/types/SpineSkin.d.ts +7 -0
  23. package/types/SpineSlot.d.ts +13 -0
  24. package/types/SpineTrackEntry.d.ts +44 -0
  25. package/types/enums/SpineBlendMode.d.ts +14 -0
  26. package/types/index.d.ts +15 -9
  27. package/types/loader/LoaderUtils.d.ts +1 -0
  28. package/types/loader/SpineLoader.d.ts +21 -0
  29. package/types/loader/SpineResource.d.ts +37 -0
  30. package/types/loader/SpineVersion.d.ts +2 -0
  31. package/types/loader/index.d.ts +2 -0
  32. package/types/renderer/SpineAnimationRenderer.d.ts +142 -0
  33. package/types/renderer/SpineGeometry.d.ts +1 -0
  34. package/types/renderer/SpineMaterial.d.ts +10 -0
  35. package/types/renderer/index.d.ts +2 -0
  36. package/types/runtime/ISpineRuntime.d.ts +4 -0
  37. package/dist/miniprogram.js +0 -1
  38. package/types/SpineLoader.d.ts +0 -33
  39. package/types/SpineMaterial.d.ts +0 -6
  40. package/types/SpineRenderer.d.ts +0 -38
  41. package/types/core/MeshGenerator.d.ts +0 -42
  42. package/types/core/SpineMesh.d.ts +0 -11
  43. package/types/spine-core/Animation.d.ts +0 -378
  44. package/types/spine-core/AnimationState.d.ts +0 -365
  45. package/types/spine-core/AnimationStateData.d.ts +0 -23
  46. package/types/spine-core/AssetManager.d.ts +0 -36
  47. package/types/spine-core/AtlasAttachmentLoader.d.ts +0 -23
  48. package/types/spine-core/BlendMode.d.ts +0 -7
  49. package/types/spine-core/Bone.d.ts +0 -110
  50. package/types/spine-core/BoneData.d.ts +0 -44
  51. package/types/spine-core/ConstraintData.d.ts +0 -7
  52. package/types/spine-core/Event.d.ts +0 -16
  53. package/types/spine-core/EventData.d.ts +0 -13
  54. package/types/spine-core/IkConstraint.d.ts +0 -38
  55. package/types/spine-core/IkConstraintData.d.ts +0 -26
  56. package/types/spine-core/PathConstraint.d.ts +0 -46
  57. package/types/spine-core/PathConstraintData.d.ts +0 -52
  58. package/types/spine-core/SharedAssetManager.d.ts +0 -19
  59. package/types/spine-core/Skeleton.d.ts +0 -134
  60. package/types/spine-core/SkeletonBinary.d.ts +0 -49
  61. package/types/spine-core/SkeletonBounds.d.ts +0 -48
  62. package/types/spine-core/SkeletonClipping.d.ts +0 -22
  63. package/types/spine-core/SkeletonData.d.ts +0 -89
  64. package/types/spine-core/SkeletonJson.d.ts +0 -34
  65. package/types/spine-core/Skin.d.ts +0 -43
  66. package/types/spine-core/Slot.d.ts +0 -42
  67. package/types/spine-core/SlotData.d.ts +0 -23
  68. package/types/spine-core/Texture.d.ts +0 -46
  69. package/types/spine-core/TextureAtlas.d.ts +0 -30
  70. package/types/spine-core/TransformConstraint.d.ts +0 -36
  71. package/types/spine-core/TransformConstraintData.d.ts +0 -34
  72. package/types/spine-core/Triangulator.d.ts +0 -14
  73. package/types/spine-core/Updatable.d.ts +0 -9
  74. package/types/spine-core/Utils.d.ts +0 -124
  75. package/types/spine-core/VertexEffect.d.ts +0 -7
  76. package/types/spine-core/attachments/Attachment.d.ts +0 -43
  77. package/types/spine-core/attachments/AttachmentLoader.d.ts +0 -25
  78. package/types/spine-core/attachments/AttachmentType.d.ts +0 -9
  79. package/types/spine-core/attachments/BoundingBoxAttachment.d.ts +0 -12
  80. package/types/spine-core/attachments/ClippingAttachment.d.ts +0 -14
  81. package/types/spine-core/attachments/MeshAttachment.d.ts +0 -46
  82. package/types/spine-core/attachments/PathAttachment.d.ts +0 -19
  83. package/types/spine-core/attachments/PointAttachment.d.ts +0 -20
  84. package/types/spine-core/attachments/RegionAttachment.d.ts +0 -88
  85. package/types/spine-core/polyfills.d.ts +0 -3
  86. package/types/spine-core/vertexeffects/JitterEffect.d.ts +0 -11
  87. package/types/spine-core/vertexeffects/SwirlEffect.d.ts +0 -16
  88. package/types/types.d.ts +0 -4
package/dist/browser.js CHANGED
@@ -1 +1,2139 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.Spine={}),t.Galacean)}(this,(function(t,e){"use strict";function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function a(t,e,n,r){var a,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var h,u,c=function(){function t(t){this._texture=t}return t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return 9728;case"linear":return 9729;case"mipmap":case"mipmaplinearlinear":return 9987;case"mipmapnearestnearest":return 9984;case"mipmaplinearnearest":return 9985;case"mipmapnearestlinear":return 9986;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return 33648;case"clamptoedge":return 33071;case"repeat":return 10497;default:throw new Error("Unknown texture wrap "+t)}},s(t,[{key:"width",get:function(){return this._texture.width}},{key:"height",get:function(){return this._texture.height}},{key:"texture",get:function(){return this._texture}}]),t}();!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(h||(h={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(u||(u={}));var d=function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.rotate=!1,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0},f=function(t){function e(){return t.apply(this,arguments)}r(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(c),p=function(){function t(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}var e=t.prototype;return e.load=function(t,e){if(null==e)throw new Error("textureLoader cannot be null.");for(var n=new v(t),r=new Array(4),a=null;;){var i=n.readLine();if(null==i)break;if(0==(i=i.trim()).length)a=null;else if(a){var s=new m;s.name=i,s.page=a;var o=n.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,n.readTuple(r);var l=parseInt(r[0]),h=parseInt(r[1]);n.readTuple(r);var d=parseInt(r[0]),f=parseInt(r[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+f)/a.width,s.v2=(h+d)/a.height):(s.u2=(l+d)/a.width,s.v2=(h+f)/a.height),s.x=l,s.y=h,s.width=Math.abs(d),s.height=Math.abs(f),4==n.readTuple(r)&&4==n.readTuple(r)&&n.readTuple(r),s.originalWidth=parseInt(r[0]),s.originalHeight=parseInt(r[1]),n.readTuple(r),s.offsetX=parseInt(r[0]),s.offsetY=parseInt(r[1]),s.index=parseInt(n.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new g).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=c.filterFromString(r[0]),a.magFilter=c.filterFromString(r[1]);var p=n.readValue();a.uWrap=u.ClampToEdge,a.vWrap=u.ClampToEdge,"x"==p?a.uWrap=u.Repeat:"y"==p?a.vWrap=u.Repeat:"xy"==p&&(a.uWrap=a.vWrap=u.Repeat),a.texture=e(i),a.texture.setFilters(a.minFilter,a.magFilter),a.texture.setWraps(a.uWrap,a.vWrap),a.width=a.texture.width,a.height=a.texture.height,this.pages.push(a)}}},e.findRegion=function(t){for(var e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null},e.dispose=function(){for(var t=0;t<this.pages.length;t++)this.pages[t].texture.dispose()},t}(),v=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}var e=t.prototype;return e.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},e.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},e.readTuple=function(t){var e=this.readLine(),n=e.indexOf(":");if(-1==n)throw new Error("Invalid line: "+e);for(var r=0,a=n+1;r<3;r++){var i=e.indexOf(",",a);if(-1==i)break;t[r]=e.substr(a,i-a).trim(),a=i+1}return t[r]=e.substring(a).trim(),r+1},t}(),g=function(){},m=function(t){function e(){return t.apply(this,arguments)}return r(e,t),e}(d),w=function(){function t(t,e,n){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this._engine=t,this.pathPrefix=e||"",this.textureLoader=n}var n=t.prototype;return n.downloadText=function(t,n,r){e.request(t,{type:"text"}).then((function(t){n(t)})).catch((function(t){r(t)}))},n.downloadBinary=function(t,e,n){var r=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status?e(new Uint8Array(r.response)):n(r.status,r.responseText)},r.onerror=function(){n(r.status,r.responseText)},r.send()},n.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},n.loadBinary=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e,a){r.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,n&&n("Couldn't load binary "+t+": status "+status+", "+a),r.onLoad(),r.loaded++}))},n.loadText=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e){r.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),n&&n("Couldn't load text "+t+": "+JSON.stringify(e)),r.onLoad(),r.loaded++}))},n.loadImage=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this,a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(n){r.assets[a]=i,r.onLoad(),r.loaded++,e&&e(t,i)},i.onerror=function(e){r.errors[t]="Couldn't load image "+t,r.onLoad(),r.loaded++,n&&n("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},n.loadTexture=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),e.request(t,{type:"image"}).then((function(e){var r=a.textureLoader(e);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(t,r)})).catch((function(t){r(t)}))},n.loadEngineTexture=function(t,e,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),this.engine.resourceManager.load({url:t,type:e}).then((function(e){var r=a.textureLoader(e);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(t,r)})).catch((function(t){r(t)}))},n.loadTextureAtlas=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(s){var o=function(){var e=d.value,o=!1;a.loadTexture(e,(function(e,l){if(h.count++,h.count==u.length)if(o)a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++;else try{var c=new p(s,(function(t){return a.get(""==i?t:i+"/"+t)}));a.assets[t]=c,n&&n(t,c),a.onLoad(),a.loaded++}catch(e){var d=e;a.errors[t]="Couldn't load texture atlas "+t+": "+d.message,r&&r("Couldn't load texture atlas "+t+": "+d.message),a.onLoad(),a.loaded++}}),(function(e){o=!0,h.count++,h.count==u.length&&(a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++)}))},h={count:0},u=new Array;try{new p(s,(function(t){return u.push(""==i?t:i+"/"+t),new f(new e.Texture2D(a.engine,16,16))}))}catch(e){var c=e;return a.errors[t]="Couldn't load texture atlas "+t+": "+c.message,r&&r("Couldn't load texture atlas "+t+": "+c.message),a.onLoad(),void a.loaded++}for(var d,v=l(u);!(d=v()).done;)o()}),(function(e){a.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),r&&r("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),a.onLoad(),a.loaded++}))},n.get=function(t){return t=this.pathPrefix+t,this.assets[t]},n.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},n.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},n.isLoadingComplete=function(){return 0==this.toLoad},n.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},n.getToLoad=function(){return this.toLoad},n.getLoaded=function(){return this.loaded},n.dispose=function(){this.removeAll()},n.hasErrors=function(){return Object.keys(this.errors).length>0},n.getErrors=function(){return this.errors},s(t,[{key:"engine",get:function(){return this._engine}}]),t}();var y=function(){function t(){this.array=new Array}var e=t.prototype;return e.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},e.contains=function(t){return null!=this.array[0|t]},e.remove=function(t){this.array[0|t]=void 0},e.clear=function(){this.array.length=0},t}(),E=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=n,this.a=r}var e=t.prototype;return e.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},e.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},e.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},e.clamp=function(){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},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t}();E.WHITE=new E(1,1,1,1),E.RED=new E(1,0,0,1),E.GREEN=new E(0,1,0,1),E.BLUE=new E(0,0,1,1),E.MAGENTA=new E(1,0,1,1);var x=function(){function t(){}return t.clamp=function(t,e,n){return t<e?e:t>n?n:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,n){return t.randomTriangularWith(e,n,.5*(e+n))},t.randomTriangularWith=function(t,e,n){var r=Math.random(),a=e-t;return r<=(n-t)/a?t+Math.sqrt(r*a*(n-t)):e-Math.sqrt((1-r)*a*(e-n))},t}();x.PI=3.1415927,x.PI2=2*x.PI,x.radiansToDegrees=180/x.PI,x.radDeg=x.radiansToDegrees,x.degreesToRadians=x.PI/180,x.degRad=x.degreesToRadians;var b=function(){function t(){}return t.arrayCopy=function(t,e,n,r,a){for(var i=e,s=r;i<e+a;i++,s++)n[s]=t[i]},t.setArraySize=function(t,e,n){void 0===n&&(n=0);var r=t.length;if(r==e)return t;if(t.length=e,r<e)for(var a=r;a<e;a++)t[a]=n;return t},t.ensureArrayCapacity=function(e,n,r){return void 0===r&&(r=0),e.length>=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r<t;r++)n[r]=e;return n},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var n=new Array(e),r=0;r<n.length;r++)n[r]=0;return n},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var n=new Array(e),r=0;r<n.length;r++)n[r]=0;return n},t.toFloatArray=function(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e},t.toSinglePrecision=function(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e},t.webkit602BugfixHelper=function(t,e){},t.contains=function(t,e,n){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1},t}();b.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var S=function(){function t(t){this.items=new Array,this.instantiator=t}var e=t.prototype;return e.obtain=function(){return this.items.length>0?this.items.pop():this.instantiator()},e.free=function(t){t.reset&&t.reset(),this.items.push(t)},e.freeAll=function(t){for(var e=0;e<t.length;e++)this.free(t[e])},e.clear=function(){this.items.length=0},t}(),M=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.normalize=function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this},t}(),A=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},R=function(t){function e(n){var r;return(r=t.call(this,n)||this).id=(65535&e.nextID++)<<11,r.worldVerticesLength=0,r.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r),r}r(e,t);var n=e.prototype;return n.computeWorldVertices=function(t,e,n,r,a,i){n=a+(n>>1)*i;var s=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,d=0;d<e;d+=2){var f=h[u];u+=f+1,c+=f}var p=s.bones;if(0==o.length)for(var v=a,g=3*c;v<n;v+=i){var m=0,w=0,y=h[u++];for(y+=u;u<y;u++,g+=3){var E=p[h[u]],x=l[g],b=l[g+1],S=l[g+2];m+=(x*E.a+b*E.b+E.worldX)*S,w+=(x*E.c+b*E.d+E.worldY)*S}r[v]=m,r[v+1]=w}else for(var M=o,A=a,R=3*c,T=c<<1;A<n;A+=i){var I=0,C=0,_=h[u++];for(_+=u;u<_;u++,R+=3,T+=2){var k=p[h[u]],V=l[R]+M[T],P=l[R+1]+M[T+1],F=l[R+2];I+=(V*k.a+P*k.b+k.worldX)*F,C+=(V*k.c+P*k.d+k.worldY)*F}r[A]=I,r[A+1]=C}}else{o.length>0&&(l=o);for(var N=t.bone,B=N.worldX,O=N.worldY,L=N.a,X=N.b,D=N.c,Y=N.d,U=e,W=a;W<n;U+=2,W+=i){var q=l[U],H=l[U+1];r[W]=q*L+H*X+B,r[W+1]=q*D+H*Y+O}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),b.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=b.newFloatArray(this.vertices.length),b.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(A);R.nextID=0;var T=function(t){function e(e){var n;return(n=t.call(this,e)||this).x=0,n.y=0,n.scaleX=1,n.scaleY=1,n.rotation=0,n.width=0,n.height=0,n.color=new E(1,1,1,1),n.offset=b.newFloatArray(8),n.uvs=b.newFloatArray(8),n.tempColor=new E(1,1,1,1),n}r(e,t);var n=e.prototype;return n.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*n,i=r+this.region.width*t,s=a+this.region.height*n,o=this.rotation*Math.PI/180,l=Math.cos(o),h=Math.sin(o),u=r*l+this.x,c=r*h,d=a*l+this.y,f=a*h,p=i*l+this.x,v=i*h,g=s*l+this.y,m=s*h,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-m,w[e.OY2]=g+c,w[e.OX3]=p-m,w[e.OY3]=g+v,w[e.OX4]=p-f,w[e.OY4]=d+v},n.setRegion=function(t){this.region=t;var e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)},n.computeWorldVertices=function(t,n,r,a){var i=this.offset,s=t.worldX,o=t.worldY,l=t.a,h=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX2],f=i[e.OY2],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX3],f=i[e.OY3],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX4],f=i[e.OY4],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o},n.copy=function(){var t=new e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,b.arrayCopy(this.uvs,0,t.uvs,0,8),b.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(A);function I(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}T.OX1=0,T.OY1=1,T.OX2=2,T.OY2=3,T.OX3=4,T.OY3=5,T.OX4=6,T.OY4=7,T.X1=0,T.Y1=1,T.C1R=2,T.C1G=3,T.C1B=4,T.C1A=5,T.U1=6,T.V1=7,T.X2=8,T.Y2=9,T.C2R=10,T.C2G=11,T.C2B=12,T.C2A=13,T.U2=14,T.V2=15,T.X3=16,T.Y3=17,T.C3R=18,T.C3G=19,T.C3B=20,T.C3A=21,T.U3=22,T.V3=23,T.X4=24,T.Y4=25,T.C4R=26,T.C4G=27,T.C4B=28,T.C4A=29,T.U4=30,T.V4=31;var C,_=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(1,1,1,1),n.tempColor=new E(0,0,0,0),n}r(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=b.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(I(this.region,m)){var o=this.region,l=o.texture.width,h=o.texture.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/l,a-=(o.originalWidth-o.offsetX-o.width)/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var u=0;u<n;u+=2)e[u]=r+t[u+1]*i,e[u+1]=a+(1-t[u])*s;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/l,a-=o.offsetY/h,i=o.originalWidth/l,s=o.originalHeight/h;for(var c=0;c<n;c+=2)e[c]=r+(1-t[c])*i,e[c+1]=a+(1-t[c+1])*s;return;case 270:r-=o.offsetY/l,a-=o.offsetX/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var d=0;d<n;d+=2)e[d]=r+(1-t[d+1])*i,e[d+1]=a+t[d]*s;return}r-=o.offsetX/l,a-=(o.originalHeight-o.offsetY-o.height)/h,i=o.originalWidth/l,s=o.originalHeight/h}else null==this.region?(r=a=0,i=s=1):(i=this.region.u2-r,s=this.region.v2-a);for(var f=0;f<n;f+=2)e[f]=r+t[f]*i,e[f+1]=a+t[f+1]*s},n.getParentMesh=function(){return this.parentMesh},n.setParentMesh=function(t){this.parentMesh=t,null!=t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)},n.copy=function(){if(null!=this.parentMesh)return this.newLinkedMesh();var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),b.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),b.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),b.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),b.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},n.newLinkedMesh=function(){var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(null!=this.parentMesh?this.parentMesh:this),t.updateUVs(),t},e}(R),k=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(R),V=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new E(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),b.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(R),P=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(.38,.94,0,1),n.name=e,n}r(e,t);var n=e.prototype;return n.computeWorldPosition=function(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e},n.computeWorldRotation=function(t){var e=x.cosDeg(this.rotation),n=x.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*x.radDeg},n.copy=function(){var t=new e(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t},e}(R),F=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(.2275,.2275,.8078,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(R),N=function(){function t(t){this.atlas=t}var e=t.prototype;return e.newRegionAttachment=function(t,e,n){var r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (region attachment: "+e+")");r.renderObject=r;var a=new T(e);return a.setRegion(r),a},e.newMeshAttachment=function(t,e,n){var r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (mesh attachment: "+e+")");r.renderObject=r;var a=new _(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new k(e)},e.newPathAttachment=function(t,e){return new V(e)},e.newPointAttachment=function(t,e){return new P(e)},e.newClippingAttachment=function(t,e){return new F(e)},t}(),B=function(){function t(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}var e=t.prototype;return e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},e.findSkin=function(t){if(null==t)throw new Error("skinName cannot be null.");for(var e=this.skins,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findEvent=function(t){if(null==t)throw new Error("eventDataName cannot be null.");for(var e=this.events,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findAnimation=function(t){if(null==t)throw new Error("animationName cannot be null.");for(var e=this.animations,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findPathConstraintIndex=function(t){if(null==t)throw new Error("pathConstraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},t}(),O=function(t,e,n){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=0,this.skinRequired=!1,this.color=new E,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=n};!function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(C||(C={}));var L,X,D,Y=function(t,e,n){if(this.color=new E(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n},U=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},W=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return r(e,t),e}(U),q=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.rotateMix=0,n.translateMix=0,n.scaleMix=0,n.shearMix=0,n.offsetRotation=0,n.offsetX=0,n.offsetY=0,n.offsetScaleX=0,n.offsetScaleY=0,n.offsetShearY=0,n.relative=!1,n.local=!1,n}return r(e,t),e}(U),H=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return r(e,t),e}(U);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(L||(L={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(X||(X={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(D||(D={}));var G,j,z,Z=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},Q=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,n){if(null==n)throw new Error("attachment cannot be null.");var r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];null!=c.attachment&&(I(c.attachment,_)?(c.attachment=c.attachment.newLinkedMesh(),this.setAttachment(c.slotIndex,c.name,c.attachment)):(c.attachment=c.attachment.copy(),this.setAttachment(c.slotIndex,c.name,c.attachment)))}},e.getAttachment=function(t,e){var n=this.attachments[t];return n?n[e]:null},e.removeAttachment=function(t,e){var n=this.attachments[t];n&&(n[e]=null)},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var n=this.attachments[e];if(n)for(var r in n){var a=n[r];a&&t.push(new Z(e,r,a))}}return t},e.getAttachmentsForSlot=function(t,e){var n=this.attachments[t];if(n)for(var r in n){var a=n[r];a&&e.push(new Z(t,r,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var n=0,r=0;r<t.slots.length;r++){var a=t.slots[r],i=a.getAttachment();if(i&&n<e.attachments.length){var s=e.attachments[n];for(var o in s){if(i==s[o]){var l=this.getAttachment(n,o);null!=l&&a.setAttachment(l);break}}}n++}},t}(),J=function(t){this.name=t},K=function(){function t(t,e,n){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=n}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,n,r,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(n%=this.duration,e>0&&(e%=this.duration));for(var l=this.timelines,h=0,u=l.length;h<u;h++)l[h].apply(t,e,n,a,i,s,o)},t.binarySearch=function(t,e,n){void 0===n&&(n=1);var r=0,a=t.length/n-2;if(0==a)return n;for(var i=a>>>1;;){if(t[(i+1)*n]<=e?r=i+1:a=i,r==a)return(r+1)*n;i=r+a>>>1}},t.linearSearch=function(t,e,n){for(var r=0,a=t.length-n;r<=a;r+=n)if(t[r]>e)return r;return-1},t}();!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(G||(G={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(j||(j={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(z||(z={}));var $=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=b.newFloatArray((e-1)*t.BEZIER_SIZE)}var e=t.prototype;return e.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},e.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},e.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},e.getCurveType=function(e){var n=e*t.BEZIER_SIZE;if(n==this.curves.length)return t.LINEAR;var r=this.curves[n];return r==t.LINEAR?t.LINEAR:r==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,n,r,a,i){var s=.03*(2*-n+a),o=.03*(2*-r+i),l=.006*(3*(n-a)+1),h=.006*(3*(r-i)+1),u=2*s+l,c=2*o+h,d=.3*n+s+.16666667*l,f=.3*r+o+.16666667*h,p=e*t.BEZIER_SIZE,v=this.curves;v[p++]=t.BEZIER;for(var g=d,m=f,w=p+t.BEZIER_SIZE-1;p<w;p+=2)v[p]=g,v[p+1]=m,d+=u,f+=c,u+=l,c+=h,g+=d,m+=f},e.getCurvePercent=function(e,n){n=x.clamp(n,0,1);var r=this.curves,a=e*t.BEZIER_SIZE,i=r[a];if(i==t.LINEAR)return n;if(i==t.STEPPED)return 0;for(var s=0,o=++a,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=r[a])>=n){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=r[a-2],u=r[a-1]),u+(r[a+1]-u)*(n-h)/(s-h)}var c=r[a-1];return c+(1-c)*(n-s)/(1-s)},t}();$.LINEAR=0,$.STEPPED=1,$.BEZIER=2,$.BEZIER_SIZE=19;var tt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=b.newFloatArray(e<<1),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return 0+this.boneIndex},n.setFrame=function(t,n,r){t<<=1,this.frames[t]=n,this.frames[t+e.ROTATION]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.rotation=h.data.rotation);case 1:var u=h.data.rotation-h.rotation;h.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(r>=l[l.length-e.ENTRIES]){var c=l[l.length+e.PREV_ROTATION];switch(s){case 0:h.rotation=h.data.rotation+c*i;break;case 1:case 2:c+=h.data.rotation-h.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:h.rotation+=c*i}}else{var d=K.binarySearch(l,r,e.ENTRIES),f=l[d+e.PREV_ROTATION],p=l[d],v=this.getCurvePercent((d>>1)-1,1-(r-p)/(l[d+e.PREV_TIME]-p)),g=l[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*v,s){case 0:h.rotation=h.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=h.data.rotation-h.rotation;case 3:h.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}($);tt.ENTRIES=2,tt.PREV_TIME=-2,tt.PREV_ROTATION=-1,tt.ROTATION=1;var et=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(1<<24)+this.boneIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.X]=r,this.frames[t+e.Y]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.x=h.data.x,void(h.y=h.data.y);case 1:h.x+=(h.data.x-h.x)*i,h.y+=(h.data.y-h.y)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.x=h.data.x+u*i,h.y=h.data.y+c*i;break;case 1:case 2:h.x+=(h.data.x+u-h.x)*i,h.y+=(h.data.y+c-h.y)*i;break;case 3:h.x+=u*i,h.y+=c*i}}},e}($);et.ENTRIES=3,et.PREV_TIME=-3,et.PREV_X=-2,et.PREV_Y=-1,et.X=1,et.Y=2;var nt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(2<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case 1:h.scaleX+=(h.data.scaleX-h.scaleX)*i,h.scaleY+=(h.data.scaleY-h.scaleY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X]*h.data.scaleX,c=l[l.length+e.PREV_Y]*h.data.scaleY;else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u=(u+(l[d+e.X]-u)*p)*h.data.scaleX,c=(c+(l[d+e.Y]-c)*p)*h.data.scaleY}if(1==i)3==s?(h.scaleX+=u-h.data.scaleX,h.scaleY+=c-h.data.scaleY):(h.scaleX=u,h.scaleY=c);else{var v=0,g=0;if(1==o)switch(s){case 0:v=h.data.scaleX,g=h.data.scaleY,h.scaleX=v+(Math.abs(u)*x.signum(v)-v)*i,h.scaleY=g+(Math.abs(c)*x.signum(g)-g)*i;break;case 1:case 2:v=h.scaleX,g=h.scaleY,h.scaleX=v+(Math.abs(u)*x.signum(v)-v)*i,h.scaleY=g+(Math.abs(c)*x.signum(g)-g)*i;break;case 3:v=h.scaleX,g=h.scaleY,h.scaleX=v+(Math.abs(u)*x.signum(v)-h.data.scaleX)*i,h.scaleY=g+(Math.abs(c)*x.signum(g)-h.data.scaleY)*i}else switch(s){case 0:v=Math.abs(h.data.scaleX)*x.signum(u),g=Math.abs(h.data.scaleY)*x.signum(c),h.scaleX=v+(u-v)*i,h.scaleY=g+(c-g)*i;break;case 1:case 2:v=Math.abs(h.scaleX)*x.signum(u),g=Math.abs(h.scaleY)*x.signum(c),h.scaleX=v+(u-v)*i,h.scaleY=g+(c-g)*i;break;case 3:v=x.signum(u),g=x.signum(c),h.scaleX=Math.abs(h.scaleX)*v+(u-Math.abs(h.data.scaleX)*v)*i,h.scaleY=Math.abs(h.scaleY)*g+(c-Math.abs(h.data.scaleY)*g)*i}}}},e}(et),rt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(3<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.shearX=h.data.shearX,void(h.shearY=h.data.shearY);case 1:h.shearX+=(h.data.shearX-h.shearX)*i,h.shearY+=(h.data.shearY-h.shearY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.shearX=h.data.shearX+u*i,h.shearY=h.data.shearY+c*i;break;case 1:case 2:h.shearX+=(h.data.shearX+u-h.shearX)*i,h.shearY+=(h.data.shearY+c-h.shearY)*i;break;case 3:h.shearX+=u*i,h.shearY+=c*i}}},e}(et),at=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(5<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return void l.color.setFromColor(l.data.color);case 1:var u=l.color,c=l.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,p=0,v=0;if(r>=h[h.length-e.ENTRIES]){var g=h.length;d=h[g+e.PREV_R],f=h[g+e.PREV_G],p=h[g+e.PREV_B],v=h[g+e.PREV_A]}else{var m=K.binarySearch(h,r,e.ENTRIES);d=h[m+e.PREV_R],f=h[m+e.PREV_G],p=h[m+e.PREV_B],v=h[m+e.PREV_A];var w=h[m],y=this.getCurvePercent(m/e.ENTRIES-1,1-(r-w)/(h[m+e.PREV_TIME]-w));d+=(h[m+e.R]-d)*y,f+=(h[m+e.G]-f)*y,p+=(h[m+e.B]-p)*y,v+=(h[m+e.A]-v)*y}if(1==i)l.color.set(d,f,p,v);else{var E=l.color;0==s&&E.setFromColor(l.data.color),E.add((d-E.r)*i,(f-E.g)*i,(p-E.b)*i,(v-E.a)*i)}}}},e}($);at.ENTRIES=5,at.PREV_TIME=-5,at.PREV_R=-4,at.PREV_G=-3,at.PREV_B=-2,at.PREV_A=-1,at.R=1,at.G=2,at.B=3,at.A=4;var it=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(14<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s,o,l,h){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s,this.frames[t+e.R2]=o,this.frames[t+e.G2]=l,this.frames[t+e.B2]=h},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return l.color.setFromColor(l.data.color),void l.darkColor.setFromColor(l.data.darkColor);case 1:var u=l.color,c=l.darkColor,d=l.data.color,f=l.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var p=0,v=0,g=0,m=0,w=0,y=0,E=0;if(r>=h[h.length-e.ENTRIES]){var x=h.length;p=h[x+e.PREV_R],v=h[x+e.PREV_G],g=h[x+e.PREV_B],m=h[x+e.PREV_A],w=h[x+e.PREV_R2],y=h[x+e.PREV_G2],E=h[x+e.PREV_B2]}else{var b=K.binarySearch(h,r,e.ENTRIES);p=h[b+e.PREV_R],v=h[b+e.PREV_G],g=h[b+e.PREV_B],m=h[b+e.PREV_A],w=h[b+e.PREV_R2],y=h[b+e.PREV_G2],E=h[b+e.PREV_B2];var S=h[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(r-S)/(h[b+e.PREV_TIME]-S));p+=(h[b+e.R]-p)*M,v+=(h[b+e.G]-v)*M,g+=(h[b+e.B]-g)*M,m+=(h[b+e.A]-m)*M,w+=(h[b+e.R2]-w)*M,y+=(h[b+e.G2]-y)*M,E+=(h[b+e.B2]-E)*M}if(1==i)l.color.set(p,v,g,m),l.darkColor.set(w,y,E,1);else{var A=l.color,R=l.darkColor;0==s&&(A.setFromColor(l.data.color),R.setFromColor(l.data.darkColor)),A.add((p-A.r)*i,(v-A.g)*i,(g-A.b)*i,(m-A.a)*i),R.add((w-R.r)*i,(y-R.g)*i,(E-R.b)*i,0)}}}},e}($);it.ENTRIES=8,it.PREV_TIME=-8,it.PREV_R=-7,it.PREV_G=-6,it.PREV_B=-5,it.PREV_A=-4,it.PREV_R2=-3,it.PREV_G2=-2,it.PREV_B2=-1,it.R=1,it.G=2,it.B=3,it.A=4,it.R2=5,it.G2=6,it.B2=7;var st=function(){function t(t){this.frames=b.newFloatArray(t),this.attachmentNames=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return(4<<24)+this.slotIndex},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var l=this.frames;if(n<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=n>=l[l.length-1]?l.length-1:K.binarySearch(l,n,1)-1;var u=this.attachmentNames[h];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,n){e.attachment=null==n?null:t.getAttachment(this.slotIndex,n)},t}(),ot=null,lt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=b.newFloatArray(e),n.frameVertices=new Array(e),null==ot&&(ot=b.newFloatArray(64)),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},n.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},n.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var l=o.getAttachment();if(I(l,R)&&l.deformAttachment==this.attachment){var h=o.deform;0==h.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(n<d[0]){var f=l;switch(i){case 0:return void(h.length=0);case 1:if(1==a){h.length=0;break}var p=b.setArraySize(h,c);if(null==f.bones)for(var v=f.vertices,g=0;g<c;g++)p[g]+=(v[g]-p[g])*a;else{a=1-a;for(g=0;g<c;g++)p[g]*=a}}}else{var m=b.setArraySize(h,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var y=l;if(null==y.bones)for(var E=y.vertices,x=0;x<c;x++)m[x]+=w[x]-E[x];else for(var S=0;S<c;S++)m[S]+=w[S]}else b.arrayCopy(w,0,m,0,c);else switch(i){case 0:var M=l;if(null==M.bones)for(var A=M.vertices,T=0;T<c;T++){var C=A[T];m[T]=C+(w[T]-C)*a}else for(var _=0;_<c;_++)m[_]=w[_]*a;break;case 1:case 2:for(var k=0;k<c;k++)m[k]+=(w[k]-m[k])*a;break;case 3:var V=l;if(null==V.bones)for(var P=V.vertices,F=0;F<c;F++)m[F]+=(w[F]-P[F])*a;else for(var N=0;N<c;N++)m[N]+=w[N]*a}}else{var B=K.binarySearch(d,n),O=u[B-1],L=u[B],X=d[B],D=this.getCurvePercent(B-1,1-(n-X)/(d[B-1]-X));if(1==a)if(3==i){var Y=l;if(null==Y.bones)for(var U=Y.vertices,W=0;W<c;W++){var q=O[W];m[W]+=q+(L[W]-q)*D-U[W]}else for(var H=0;H<c;H++){var G=O[H];m[H]+=G+(L[H]-G)*D}}else for(var j=0;j<c;j++){var z=O[j];m[j]=z+(L[j]-z)*D}else switch(i){case 0:var Z=l;if(null==Z.bones)for(var Q=Z.vertices,J=0;J<c;J++){var $=O[J],tt=Q[J];m[J]=tt+($+(L[J]-$)*D-tt)*a}else for(var et=0;et<c;et++){var nt=O[et];m[et]=(nt+(L[et]-nt)*D)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var at=O[rt];m[rt]+=(at+(L[rt]-at)*D-m[rt])*a}break;case 3:var it=l;if(null==it.bones)for(var st=it.vertices,ot=0;ot<c;ot++){var lt=O[ot];m[ot]+=(lt+(L[ot]-lt)*D-st[ot])*a}else for(var ht=0;ht<c;ht++){var ut=O[ht];m[ht]+=(ut+(L[ht]-ut)*D)*a}}}}}}},e}($),ht=function(){function t(t){this.frames=b.newFloatArray(t),this.events=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 7<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.apply=function(t,e,n,r,a,i,s){if(null!=r){var o=this.frames,l=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(n<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=K.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&n>=o[h];h++)r.push(this.events[h])}}},t}(),ut=function(){function t(t){this.frames=b.newFloatArray(t),this.drawOrders=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 8<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.drawOrder,l=t.slots;if(1!=s){var h=this.frames;if(n<h[0])0!=i&&1!=i||b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=h[h.length-1]?h.length-1:K.binarySearch(h,n)-1;var c=this.drawOrders[u];if(null==c)b.arrayCopy(l,0,o,0,l.length);else for(var d=0,f=c.length;d<f;d++)o[d]=l[c[d]]}}else 0==i&&b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),ct=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},n.setFrame=function(t,n,r,a,i,s,o){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.MIX]=r,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,void(h.stretch=h.data.stretch);case 1:h.mix+=(h.data.mix-h.mix)*i,h.softness+=(h.data.softness-h.softness)*i,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}else if(r>=l[l.length-e.ENTRIES])0==s?(h.mix=h.data.mix+(l[l.length+e.PREV_MIX]-h.data.mix)*i,h.softness=h.data.softness+(l[l.length+e.PREV_SOFTNESS]-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH])):(h.mix+=(l[l.length+e.PREV_MIX]-h.mix)*i,h.softness+=(l[l.length+e.PREV_SOFTNESS]-h.softness)*i,0==o&&(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH]));else{var u=K.binarySearch(l,r,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],p=this.getCurvePercent(u/e.ENTRIES-1,1-(r-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*p-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*p-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH])):(h.mix+=(c+(l[u+e.MIX]-c)*p-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*p-h.softness)*i,0==o&&(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH]))}},e}($);ct.ENTRIES=6,ct.PREV_TIME=-6,ct.PREV_MIX=-5,ct.PREV_SOFTNESS=-4,ct.PREV_BEND_DIRECTION=-3,ct.PREV_COMPRESS=-2,ct.PREV_STRETCH=-1,ct.MIX=1,ct.SOFTNESS=2,ct.BEND_DIRECTION=3,ct.COMPRESS=4,ct.STRETCH=5;var dt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(r<l[0]){var u=h.data;switch(s){case 0:return h.rotateMix=u.rotateMix,h.translateMix=u.translateMix,h.scaleMix=u.scaleMix,void(h.shearMix=u.shearMix);case 1:h.rotateMix+=(u.rotateMix-h.rotateMix)*i,h.translateMix+=(u.translateMix-h.translateMix)*i,h.scaleMix+=(u.scaleMix-h.scaleMix)*i,h.shearMix+=(u.shearMix-h.shearMix)*i}}else{var c=0,d=0,f=0,p=0;if(r>=l[l.length-e.ENTRIES]){var v=l.length;c=l[v+e.PREV_ROTATE],d=l[v+e.PREV_TRANSLATE],f=l[v+e.PREV_SCALE],p=l[v+e.PREV_SHEAR]}else{var g=K.binarySearch(l,r,e.ENTRIES);c=l[g+e.PREV_ROTATE],d=l[g+e.PREV_TRANSLATE],f=l[g+e.PREV_SCALE],p=l[g+e.PREV_SHEAR];var m=l[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(r-m)/(l[g+e.PREV_TIME]-m));c+=(l[g+e.ROTATE]-c)*w,d+=(l[g+e.TRANSLATE]-d)*w,f+=(l[g+e.SCALE]-f)*w,p+=(l[g+e.SHEAR]-p)*w}if(0==s){var y=h.data;h.rotateMix=y.rotateMix+(c-y.rotateMix)*i,h.translateMix=y.translateMix+(d-y.translateMix)*i,h.scaleMix=y.scaleMix+(f-y.scaleMix)*i,h.shearMix=y.shearMix+(p-y.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(p-h.shearMix)*i}},e}($);dt.ENTRIES=5,dt.PREV_TIME=-5,dt.PREV_ROTATE=-4,dt.PREV_TRANSLATE=-3,dt.PREV_SCALE=-2,dt.PREV_SHEAR=-1,dt.ROTATE=1,dt.TRANSLATE=2,dt.SCALE=3,dt.SHEAR=4;var ft=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.VALUE]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.position=h.data.position);case 1:h.position+=(h.data.position-h.position)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=K.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.position=h.data.position+(u-h.data.position)*i:h.position+=(u-h.position)*i}},e}($);ft.ENTRIES=2,ft.PREV_TIME=-2,ft.PREV_VALUE=-1,ft.VALUE=1;var pt,vt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.spacing=h.data.spacing);case 1:h.spacing+=(h.data.spacing-h.spacing)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=K.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.spacing=h.data.spacing+(u-h.data.spacing)*i:h.spacing+=(u-h.spacing)*i}},e}(ft),gt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.rotateMix=h.data.rotateMix,void(h.translateMix=h.data.translateMix);case 1:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*i,h.translateMix+=(h.data.translateMix-h.translateMix)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*p,c+=(l[d+e.TRANSLATE]-c)*p}0==s?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*i,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*i):(h.rotateMix+=(u-h.rotateMix)*i,h.translateMix+=(c-h.translateMix)*i)}},e}($);gt.ENTRIES=3,gt.PREV_TIME=-3,gt.PREV_ROTATE=-2,gt.PREV_TRANSLATE=-1,gt.ROTATE=1,gt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(pt||(pt={}));var mt,wt=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},yt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var n=this.scale,r=new B,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(r.hash=i.hash,r.version=i.spine,"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=i.x,r.y=i.y,r.width=i.width,r.height=i.height,r.fps=i.fps,r.imagesPath=i.images}if(a.bones)for(var s=0;s<a.bones.length;s++){var o=a.bones[s],l=null,h=this.getValue(o,"parent",null);if(null!=h&&null==(l=r.findBone(h)))throw new Error("Parent bone not found: "+h);var u=new O(r.bones.length,o.name,l);u.length=this.getValue(o,"length",0)*n,u.x=this.getValue(o,"x",0)*n,u.y=this.getValue(o,"y",0)*n,u.rotation=this.getValue(o,"rotation",0),u.scaleX=this.getValue(o,"scaleX",1),u.scaleY=this.getValue(o,"scaleY",1),u.shearX=this.getValue(o,"shearX",0),u.shearY=this.getValue(o,"shearY",0),u.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),u.skinRequired=this.getValue(o,"skin",!1),r.bones.push(u)}if(a.slots)for(var c=0;c<a.slots.length;c++){var d=a.slots[c],f=d.name,p=d.bone,v=r.findBone(p);if(null==v)throw new Error("Slot bone not found: "+p);var g=new Y(r.slots.length,f,v),m=this.getValue(d,"color",null);null!=m&&g.color.setFromString(m);var w=this.getValue(d,"dark",null);null!=w&&(g.darkColor=new E(1,1,1,1),g.darkColor.setFromString(w)),g.attachmentName=this.getValue(d,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),r.slots.push(g)}if(a.ik)for(var y=0;y<a.ik.length;y++){var x=a.ik[y],b=new W(x.name);b.order=this.getValue(x,"order",0),b.skinRequired=this.getValue(x,"skin",!1);for(var S=0;S<x.bones.length;S++){var M=x.bones[S],A=r.findBone(M);if(null==A)throw new Error("IK bone not found: "+M);b.bones.push(A)}var R=x.target;if(b.target=r.findBone(R),null==b.target)throw new Error("IK target bone not found: "+R);b.mix=this.getValue(x,"mix",1),b.softness=this.getValue(x,"softness",0)*n,b.bendDirection=this.getValue(x,"bendPositive",!0)?1:-1,b.compress=this.getValue(x,"compress",!1),b.stretch=this.getValue(x,"stretch",!1),b.uniform=this.getValue(x,"uniform",!1),r.ikConstraints.push(b)}if(a.transform)for(var T=0;T<a.transform.length;T++){var I=a.transform[T],C=new q(I.name);C.order=this.getValue(I,"order",0),C.skinRequired=this.getValue(I,"skin",!1);for(var _=0;_<I.bones.length;_++){var k=I.bones[_],V=r.findBone(k);if(null==V)throw new Error("Transform constraint bone not found: "+k);C.bones.push(V)}var P=I.target;if(C.target=r.findBone(P),null==C.target)throw new Error("Transform constraint target bone not found: "+P);C.local=this.getValue(I,"local",!1),C.relative=this.getValue(I,"relative",!1),C.offsetRotation=this.getValue(I,"rotation",0),C.offsetX=this.getValue(I,"x",0)*n,C.offsetY=this.getValue(I,"y",0)*n,C.offsetScaleX=this.getValue(I,"scaleX",0),C.offsetScaleY=this.getValue(I,"scaleY",0),C.offsetShearY=this.getValue(I,"shearY",0),C.rotateMix=this.getValue(I,"rotateMix",1),C.translateMix=this.getValue(I,"translateMix",1),C.scaleMix=this.getValue(I,"scaleMix",1),C.shearMix=this.getValue(I,"shearMix",1),r.transformConstraints.push(C)}if(a.path)for(var F=0;F<a.path.length;F++){var N=a.path[F],D=new H(N.name);D.order=this.getValue(N,"order",0),D.skinRequired=this.getValue(N,"skin",!1);for(var U=0;U<N.bones.length;U++){var G=N.bones[U],j=r.findBone(G);if(null==j)throw new Error("Transform constraint bone not found: "+G);D.bones.push(j)}var z=N.target;if(D.target=r.findSlot(z),null==D.target)throw new Error("Path target slot not found: "+z);D.positionMode=t.positionModeFromString(this.getValue(N,"positionMode","percent")),D.spacingMode=t.spacingModeFromString(this.getValue(N,"spacingMode","length")),D.rotateMode=t.rotateModeFromString(this.getValue(N,"rotateMode","tangent")),D.offsetRotation=this.getValue(N,"rotation",0),D.position=this.getValue(N,"position",0),D.positionMode==L.Fixed&&(D.position*=n),D.spacing=this.getValue(N,"spacing",0),D.spacingMode!=X.Length&&D.spacingMode!=X.Fixed||(D.spacing*=n),D.rotateMix=this.getValue(N,"rotateMix",1),D.translateMix=this.getValue(N,"translateMix",1),r.pathConstraints.push(D)}if(a.skins)for(var Z=0;Z<a.skins.length;Z++){var K=a.skins[Z],$=new Q(K.name);if(K.bones)for(var tt=0;tt<K.bones.length;tt++){var et=r.findBone(K.bones[tt]);if(null==et)throw new Error("Skin bone not found: "+K.bones[Z]);$.bones.push(et)}if(K.ik)for(var nt=0;nt<K.ik.length;nt++){var rt=r.findIkConstraint(K.ik[nt]);if(null==rt)throw new Error("Skin IK constraint not found: "+K.ik[Z]);$.constraints.push(rt)}if(K.transform)for(var at=0;at<K.transform.length;at++){var it=r.findTransformConstraint(K.transform[at]);if(null==it)throw new Error("Skin transform constraint not found: "+K.transform[Z]);$.constraints.push(it)}if(K.path)for(var st=0;st<K.path.length;st++){var ot=r.findPathConstraint(K.path[st]);if(null==ot)throw new Error("Skin path constraint not found: "+K.path[Z]);$.constraints.push(ot)}for(var lt in K.attachments){var ht=r.findSlot(lt);if(null==ht)throw new Error("Slot not found: "+lt);var ut=K.attachments[lt];for(var ct in ut){var dt=this.readAttachment(ut[ct],$,ht.index,ct,r);null!=dt&&$.setAttachment(ht.index,ct,dt)}}r.skins.push($),"default"==$.name&&(r.defaultSkin=$)}for(var ft=0,pt=this.linkedMeshes.length;ft<pt;ft++){var vt=this.linkedMeshes[ft],gt=null==vt.skin?r.defaultSkin:r.findSkin(vt.skin);if(null==gt)throw new Error("Skin not found: "+vt.skin);var mt=gt.getAttachment(vt.slotIndex,vt.parent);if(null==mt)throw new Error("Parent mesh not found: "+vt.parent);vt.mesh.deformAttachment=vt.inheritDeform?mt:vt.mesh,vt.mesh.setParentMesh(mt),vt.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var wt in a.events){var yt=a.events[wt],Et=new J(wt);Et.intValue=this.getValue(yt,"int",0),Et.floatValue=this.getValue(yt,"float",0),Et.stringValue=this.getValue(yt,"string",""),Et.audioPath=this.getValue(yt,"audio",null),null!=Et.audioPath&&(Et.volume=this.getValue(yt,"volume",1),Et.balance=this.getValue(yt,"balance",0)),r.events.push(Et)}if(a.animations)for(var xt in a.animations){var bt=a.animations[xt];this.readAnimation(bt,xt,r)}return r},e.readAttachment=function(t,e,n,r,a){var i=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",r),o=this.attachmentLoader.newRegionAttachment(e,r,s);if(null==o)return null;o.path=s,o.x=this.getValue(t,"x",0)*i,o.y=this.getValue(t,"y",0)*i,o.scaleX=this.getValue(t,"scaleX",1),o.scaleY=this.getValue(t,"scaleY",1),o.rotation=this.getValue(t,"rotation",0),o.width=t.width*i,o.height=t.height*i;var l=this.getValue(t,"color",null);return null!=l&&o.color.setFromString(l),o.updateOffset(),o;case"boundingbox":var h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(null==h)return null;this.readVertices(t,h,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&h.color.setFromString(u),h;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",r),d=this.attachmentLoader.newMeshAttachment(e,r,c);if(null==d)return null;d.path=c;var f=this.getValue(t,"color",null);null!=f&&d.color.setFromString(f),d.width=this.getValue(t,"width",0)*i,d.height=this.getValue(t,"height",0)*i;var p=this.getValue(t,"parent",null);if(null!=p)return this.linkedMeshes.push(new Et(d,this.getValue(t,"skin",null),n,p,this.getValue(t,"deform",!0))),d;var v=t.uvs;return this.readVertices(t,d,v.length),d.triangles=t.triangles,d.regionUVs=v,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var g=this.attachmentLoader.newPathAttachment(e,r);if(null==g)return null;g.closed=this.getValue(t,"closed",!1),g.constantSpeed=this.getValue(t,"constantSpeed",!0);var m=t.vertexCount;this.readVertices(t,g,m<<1);for(var w=b.newArray(m/3,0),y=0;y<t.lengths.length;y++)w[y]=t.lengths[y]*i;g.lengths=w;var E=this.getValue(t,"color",null);return null!=E&&g.color.setFromString(E),g;case"point":var x=this.attachmentLoader.newPointAttachment(e,r);if(null==x)return null;x.x=this.getValue(t,"x",0)*i,x.y=this.getValue(t,"y",0)*i,x.rotation=this.getValue(t,"rotation",0);var S=this.getValue(t,"color",null);return null!=S&&x.color.setFromString(S),x;case"clipping":var M=this.attachmentLoader.newClippingAttachment(e,r);if(null==M)return null;var A=this.getValue(t,"end",null);if(null!=A){var R=a.findSlot(A);if(null==R)throw new Error("Clipping end slot not found: "+A);M.endSlot=R}var T=t.vertexCount;this.readVertices(t,M,T<<1);var I=this.getValue(t,"color",null);return null!=I&&M.color.setFromString(I),M}return null},e.readVertices=function(t,e,n){var r=this.scale;e.worldVerticesLength=n;var a=t.vertices;if(n!=a.length){for(var i=new Array,s=new Array,o=0,l=a.length;o<l;){var h=a[o++];s.push(h);for(var u=o+4*h;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*r),i.push(a[o+2]*r),i.push(a[o+3])}e.bones=s,e.vertices=b.toFloatArray(i)}else{var c=b.toFloatArray(a);if(1!=r)for(var d=0,f=a.length;d<f;d++)c[d]*=r;e.vertices=c}},e.readAnimation=function(t,e,n){var r=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],l=n.findSlotIndex(s);if(-1==l)throw new Error("Slot not found: "+s);for(var h in o){var u=o[h];if("attachment"==h){var c=new st(u.length);c.slotIndex=l;for(var d=0,f=0;f<u.length;f++){var p=u[f];c.setFrame(d++,this.getValue(p,"time",0),p.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==h){var v=new at(u.length);v.slotIndex=l;for(var g=0,m=0;m<u.length;m++){var w=u[m],y=new E;y.setFromString(w.color),v.setFrame(g,this.getValue(w,"time",0),y.r,y.g,y.b,y.a),this.readCurve(w,v,g),g++}a.push(v),i=Math.max(i,v.frames[(v.getFrameCount()-1)*at.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var x=new it(u.length);x.slotIndex=l;for(var S=0,M=0;M<u.length;M++){var A=u[M],R=new E,T=new E;R.setFromString(A.light),T.setFromString(A.dark),x.setFrame(S,this.getValue(A,"time",0),R.r,R.g,R.b,R.a,T.r,T.g,T.b),this.readCurve(A,x,S),S++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*it.ENTRIES])}}}if(t.bones)for(var I in t.bones){var C=t.bones[I],_=n.findBoneIndex(I);if(-1==_)throw new Error("Bone not found: "+I);for(var k in C){var V=C[k];if("rotate"===k){var P=new tt(V.length);P.boneIndex=_;for(var F=0,N=0;N<V.length;N++){var B=V[N];P.setFrame(F,this.getValue(B,"time",0),this.getValue(B,"angle",0)),this.readCurve(B,P,F),F++}a.push(P),i=Math.max(i,P.frames[(P.getFrameCount()-1)*tt.ENTRIES])}else{if("translate"!==k&&"scale"!==k&&"shear"!==k)throw new Error("Invalid timeline type for a bone: "+k+" ("+I+")");var O=null,D=1,Y=0;"scale"===k?(O=new nt(V.length),Y=1):"shear"===k?O=new rt(V.length):(O=new et(V.length),D=r),O.boneIndex=_;for(var U=0,W=0;W<V.length;W++){var q=V[W],H=this.getValue(q,"x",Y),G=this.getValue(q,"y",Y);O.setFrame(U,this.getValue(q,"time",0),H*D,G*D),this.readCurve(q,O,U),U++}a.push(O),i=Math.max(i,O.frames[(O.getFrameCount()-1)*et.ENTRIES])}}}if(t.ik)for(var j in t.ik){var z=t.ik[j],Z=n.findIkConstraint(j),Q=new ct(z.length);Q.ikConstraintIndex=n.ikConstraints.indexOf(Z);for(var J=0,$=0;$<z.length;$++){var ot=z[$];Q.setFrame(J,this.getValue(ot,"time",0),this.getValue(ot,"mix",1),this.getValue(ot,"softness",0)*r,this.getValue(ot,"bendPositive",!0)?1:-1,this.getValue(ot,"compress",!1),this.getValue(ot,"stretch",!1)),this.readCurve(ot,Q,J),J++}a.push(Q),i=Math.max(i,Q.frames[(Q.getFrameCount()-1)*ct.ENTRIES])}if(t.transform)for(var pt in t.transform){var mt=t.transform[pt],yt=n.findTransformConstraint(pt),Et=new dt(mt.length);Et.transformConstraintIndex=n.transformConstraints.indexOf(yt);for(var xt=0,bt=0;bt<mt.length;bt++){var St=mt[bt];Et.setFrame(xt,this.getValue(St,"time",0),this.getValue(St,"rotateMix",1),this.getValue(St,"translateMix",1),this.getValue(St,"scaleMix",1),this.getValue(St,"shearMix",1)),this.readCurve(St,Et,xt),xt++}a.push(Et),i=Math.max(i,Et.frames[(Et.getFrameCount()-1)*dt.ENTRIES])}if(t.path)for(var Mt in t.path){var At=t.path[Mt],Rt=n.findPathConstraintIndex(Mt);if(-1==Rt)throw new Error("Path constraint not found: "+Mt);var Tt=n.pathConstraints[Rt];for(var It in At){var Ct=At[It];if("position"===It||"spacing"===It){var _t=null,kt=1;"spacing"===It?(_t=new vt(Ct.length),Tt.spacingMode!=X.Length&&Tt.spacingMode!=X.Fixed||(kt=r)):(_t=new ft(Ct.length),Tt.positionMode==L.Fixed&&(kt=r)),_t.pathConstraintIndex=Rt;for(var Vt=0,Pt=0;Pt<Ct.length;Pt++){var Ft=Ct[Pt];_t.setFrame(Vt,this.getValue(Ft,"time",0),this.getValue(Ft,It,0)*kt),this.readCurve(Ft,_t,Vt),Vt++}a.push(_t),i=Math.max(i,_t.frames[(_t.getFrameCount()-1)*ft.ENTRIES])}else if("mix"===It){var Nt=new gt(Ct.length);Nt.pathConstraintIndex=Rt;for(var Bt=0,Ot=0;Ot<Ct.length;Ot++){var Lt=Ct[Ot];Nt.setFrame(Bt,this.getValue(Lt,"time",0),this.getValue(Lt,"rotateMix",1),this.getValue(Lt,"translateMix",1)),this.readCurve(Lt,Nt,Bt),Bt++}a.push(Nt),i=Math.max(i,Nt.frames[(Nt.getFrameCount()-1)*gt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Dt=t.deform[Xt],Yt=n.findSkin(Xt);if(null==Yt)throw new Error("Skin not found: "+Xt);for(var Ut in Dt){var Wt=Dt[Ut],qt=n.findSlotIndex(Ut);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var Gt=Wt[Ht],jt=Yt.getAttachment(qt,Ht);if(null==jt)throw new Error("Deform attachment not found: "+Gt.name);var zt=null!=jt.bones,Zt=jt.vertices,Qt=zt?Zt.length/3*2:Zt.length,Jt=new lt(Gt.length);Jt.slotIndex=qt,Jt.attachment=jt;for(var Kt=0,$t=0;$t<Gt.length;$t++){var te=Gt[$t],ee=void 0,ne=this.getValue(te,"vertices",null);if(null==ne)ee=zt?b.newFloatArray(Qt):Zt;else{ee=b.newFloatArray(Qt);var re=this.getValue(te,"offset",0);if(b.arrayCopy(ne,0,ee,re,ne.length),1!=r)for(var ae=re,ie=ae+ne.length;ae<ie;ae++)ee[ae]*=r;if(!zt)for(var se=0;se<Qt;se++)ee[se]+=Zt[se]}Jt.setFrame(Kt,this.getValue(te,"time",0),ee),this.readCurve(te,Jt,Kt),Kt++}a.push(Jt),i=Math.max(i,Jt.frames[Jt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var le=new ut(oe.length),he=n.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,pe=this.getValue(de,"offsets",null);if(null!=pe){fe=b.newArray(he,-1);for(var ve=b.newArray(he-pe.length,0),ge=0,me=0,we=0;we<pe.length;we++){var ye=pe[we],Ee=n.findSlotIndex(ye.slot);if(-1==Ee)throw new Error("Slot not found: "+ye.slot);for(;ge!=Ee;)ve[me++]=ge++;fe[ge+ye.offset]=ge++}for(;ge<he;)ve[me++]=ge++;for(var xe=he-1;xe>=0;xe--)-1==fe[xe]&&(fe[xe]=ve[--me])}le.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(le),i=Math.max(i,le.frames[le.getFrameCount()-1])}if(t.events){for(var be=new ht(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Ae=t.events[Me],Re=n.findEvent(Ae.name);if(null==Re)throw new Error("Event not found: "+Ae.name);var Te=new wt(b.toSinglePrecision(this.getValue(Ae,"time",0)),Re);Te.intValue=this.getValue(Ae,"int",Re.intValue),Te.floatValue=this.getValue(Ae,"float",Re.floatValue),Te.stringValue=this.getValue(Ae,"string",Re.stringValue),null!=Te.data.audioPath&&(Te.volume=this.getValue(Ae,"volume",1),Te.balance=this.getValue(Ae,"balance",0)),be.setFrame(Se++,Te)}a.push(be),i=Math.max(i,be.frames[be.getFrameCount()-1])}if(isNaN(i))throw new Error("Error while parsing animation, duration is NaN");n.animations.push(new K(e,a,i))},e.readCurve=function(t,e,n){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(n);else{var r=t.curve;e.setCurve(n,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,n){return void 0!==t[e]?t[e]:n},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return pt.Normal;if("additive"==t)return pt.Additive;if("multiply"==t)return pt.Multiply;if("screen"==t)return pt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return L.Fixed;if("percent"==t)return L.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return X.Length;if("fixed"==t)return X.Fixed;if("percent"==t)return X.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return D.Tangent;if("chain"==t)return D.Chain;if("chainscale"==t)return D.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return C.Normal;if("onlytranslation"==t)return C.OnlyTranslation;if("norotationorreflection"==t)return C.NoRotationOrReflection;if("noscale"==t)return C.NoScale;if("noscaleorreflection"==t)return C.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Et=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a};!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(mt||(mt={}));var xt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var n=this.scale,r=new B;r.name="";var a=new bt(e);if(r.hash=a.readString(),r.version=a.readString(),"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=a.readFloat(),r.y=a.readFloat(),r.width=a.readFloat(),r.height=a.readFloat();var i=a.readBoolean();i&&(r.fps=a.readFloat(),r.imagesPath=a.readString(),r.audioPath=a.readString());var s=0;s=a.readInt(!0);for(var o=0;o<s;o++)a.strings.push(a.readString());s=a.readInt(!0);for(var l=0;l<s;l++){var h=a.readString(),u=0==l?null:r.bones[a.readInt(!0)],c=new O(l,h,u);c.rotation=a.readFloat(),c.x=a.readFloat()*n,c.y=a.readFloat()*n,c.scaleX=a.readFloat(),c.scaleY=a.readFloat(),c.shearX=a.readFloat(),c.shearY=a.readFloat(),c.length=a.readFloat()*n,c.transformMode=t.TransformModeValues[a.readInt(!0)],c.skinRequired=a.readBoolean(),i&&E.rgba8888ToColor(c.color,a.readInt32()),r.bones.push(c)}s=a.readInt(!0);for(var d=0;d<s;d++){var f=a.readString(),p=r.bones[a.readInt(!0)],v=new Y(d,f,p);E.rgba8888ToColor(v.color,a.readInt32());var g=a.readInt32();-1!=g&&E.rgb888ToColor(v.darkColor=new E,g),v.attachmentName=a.readStringRef(),v.blendMode=t.BlendModeValues[a.readInt(!0)],r.slots.push(v)}s=a.readInt(!0);for(var m,w=0;w<s;w++){var y=new W(a.readString());y.order=a.readInt(!0),y.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var x=0;x<m;x++)y.bones.push(r.bones[a.readInt(!0)]);y.target=r.bones[a.readInt(!0)],y.mix=a.readFloat(),y.softness=a.readFloat()*n,y.bendDirection=a.readByte(),y.compress=a.readBoolean(),y.stretch=a.readBoolean(),y.uniform=a.readBoolean(),r.ikConstraints.push(y)}s=a.readInt(!0);for(var S,M=0;M<s;M++){var A=new q(a.readString());A.order=a.readInt(!0),A.skinRequired=a.readBoolean(),S=a.readInt(!0);for(var R=0;R<S;R++)A.bones.push(r.bones[a.readInt(!0)]);A.target=r.bones[a.readInt(!0)],A.local=a.readBoolean(),A.relative=a.readBoolean(),A.offsetRotation=a.readFloat(),A.offsetX=a.readFloat()*n,A.offsetY=a.readFloat()*n,A.offsetScaleX=a.readFloat(),A.offsetScaleY=a.readFloat(),A.offsetShearY=a.readFloat(),A.rotateMix=a.readFloat(),A.translateMix=a.readFloat(),A.scaleMix=a.readFloat(),A.shearMix=a.readFloat(),r.transformConstraints.push(A)}s=a.readInt(!0);for(var T,I=0;I<s;I++){var C=new H(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),T=a.readInt(!0);for(var _=0;_<T;_++)C.bones.push(r.bones[a.readInt(!0)]);C.target=r.slots[a.readInt(!0)],C.positionMode=t.PositionModeValues[a.readInt(!0)],C.spacingMode=t.SpacingModeValues[a.readInt(!0)],C.rotateMode=t.RotateModeValues[a.readInt(!0)],C.offsetRotation=a.readFloat(),C.position=a.readFloat(),C.positionMode==L.Fixed&&(C.position*=n),C.spacing=a.readFloat(),C.spacingMode!=X.Length&&C.spacingMode!=X.Fixed||(C.spacing*=n),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),r.pathConstraints.push(C)}var k=this.readSkin(a,r,!0,i);null!=k&&(r.defaultSkin=k,r.skins.push(k));var V=r.skins.length;for(b.setArraySize(r.skins,s=V+a.readInt(!0));V<s;V++)r.skins[V]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var P=0;P<s;P++){var F=this.linkedMeshes[P],N=null==F.skin?r.defaultSkin:r.findSkin(F.skin);if(null==N)throw new Error("Skin not found: "+F.skin);var D=N.getAttachment(F.slotIndex,F.parent);if(null==D)throw new Error("Parent mesh not found: "+F.parent);F.mesh.deformAttachment=F.inheritDeform?D:F.mesh,F.mesh.setParentMesh(D),F.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var U=0;U<s;U++){var G=new J(a.readStringRef());G.intValue=a.readInt(!1),G.floatValue=a.readFloat(),G.stringValue=a.readString(),G.audioPath=a.readString(),null!=G.audioPath&&(G.volume=a.readFloat(),G.balance=a.readFloat()),r.events.push(G)}s=a.readInt(!0);for(var j=0;j<s;j++)r.animations.push(this.readAnimation(a,a.readString(),r));return r},e.readSkin=function(t,e,n,r){var a=null,i=0;if(n){if(0==(i=t.readInt(!0)))return null;a=new Q("default")}else{(a=new Q(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var l=0,h=t.readInt(!0);l<h;l++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var p=0;p<i;p++)for(var v=t.readInt(!0),g=0,m=t.readInt(!0);g<m;g++){var w=t.readStringRef(),y=this.readAttachment(t,e,a,v,w,r);null!=y&&a.setAttachment(v,w,y)}return a},e.readAttachment=function(e,n,r,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case mt.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),p=e.readFloat(),v=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readInt32();null==u&&(u=l);var y=this.attachmentLoader.newRegionAttachment(r,l,u);return null==y?null:(y.path=u,y.x=d*o,y.y=f*o,y.scaleX=p,y.scaleY=v,y.rotation=c,y.width=g*o,y.height=m*o,E.rgba8888ToColor(y.color,w),y.updateOffset(),y);case mt.BoundingBox:var x=e.readInt(!0),S=this.readVertices(e,x),M=s?e.readInt32():0,A=this.attachmentLoader.newBoundingBoxAttachment(r,l);return null==A?null:(A.worldVerticesLength=x<<1,A.vertices=S.vertices,A.bones=S.bones,s&&E.rgba8888ToColor(A.color,M),A);case mt.Mesh:var R=e.readStringRef(),T=e.readInt32(),I=e.readInt(!0),C=this.readFloatArray(e,I<<1,1),_=this.readShortArray(e),k=this.readVertices(e,I),V=e.readInt(!0),P=null,F=0,N=0;s&&(P=this.readShortArray(e),F=e.readFloat(),N=e.readFloat()),null==R&&(R=l);var B=this.attachmentLoader.newMeshAttachment(r,l,R);return null==B?null:(B.path=R,E.rgba8888ToColor(B.color,T),B.bones=k.bones,B.vertices=k.vertices,B.worldVerticesLength=I<<1,B.triangles=_,B.regionUVs=C,B.updateUVs(),B.hullLength=V<<1,s&&(B.edges=P,B.width=F*o,B.height=N*o),B);case mt.LinkedMesh:var O=e.readStringRef(),L=e.readInt32(),X=e.readStringRef(),D=e.readStringRef(),Y=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==O&&(O=l);var q=this.attachmentLoader.newMeshAttachment(r,l,O);return null==q?null:(q.path=O,E.rgba8888ToColor(q.color,L),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new St(q,X,a,D,Y)),q);case mt.Path:for(var H=e.readBoolean(),G=e.readBoolean(),j=e.readInt(!0),z=this.readVertices(e,j),Z=b.newArray(j/3,0),Q=0,J=Z.length;Q<J;Q++)Z[Q]=e.readFloat()*o;var K=s?e.readInt32():0,$=this.attachmentLoader.newPathAttachment(r,l);return null==$?null:($.closed=H,$.constantSpeed=G,$.worldVerticesLength=j<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&E.rgba8888ToColor($.color,K),$);case mt.Point:var tt=e.readFloat(),et=e.readFloat(),nt=e.readFloat(),rt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(r,l);return null==at?null:(at.x=et*o,at.y=nt*o,at.rotation=tt,s&&E.rgba8888ToColor(at.color,rt),at);case mt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(r,l);return null==ht?null:(ht.endSlot=n.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&E.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var n=e<<1,r=new Mt,a=this.scale;if(!t.readBoolean())return r.vertices=this.readFloatArray(t,n,a),r;for(var i=new Array,s=new Array,o=0;o<e;o++){var l=t.readInt(!0);s.push(l);for(var h=0;h<l;h++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return r.vertices=b.toFloatArray(i),r.bones=s,r},e.readFloatArray=function(t,e,n){var r=new Array(e);if(1==n)for(var a=0;a<e;a++)r[a]=t.readFloat();else for(var i=0;i<e;i++)r[i]=t.readFloat()*n;return r},e.readShortArray=function(t){for(var e=t.readInt(!0),n=new Array(e),r=0;r<e;r++)n[r]=t.readShort();return n},e.readAnimation=function(e,n,r){for(var a=new Array,i=this.scale,s=0,o=new E,l=new E,h=0,u=e.readInt(!0);h<u;h++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var p=e.readByte(),v=e.readInt(!0);switch(p){case t.SLOT_ATTACHMENT:var g=new st(v);g.slotIndex=c;for(var m=0;m<v;m++)g.setFrame(m,e.readFloat(),e.readStringRef());a.push(g),s=Math.max(s,g.frames[v-1]);break;case t.SLOT_COLOR:var w=new at(v);w.slotIndex=c;for(var y=0;y<v;y++){var x=e.readFloat();E.rgba8888ToColor(o,e.readInt32()),w.setFrame(y,x,o.r,o.g,o.b,o.a),y<v-1&&this.readCurve(e,y,w)}a.push(w),s=Math.max(s,w.frames[(v-1)*at.ENTRIES]);break;case t.SLOT_TWO_COLOR:var S=new it(v);S.slotIndex=c;for(var M=0;M<v;M++){var A=e.readFloat();E.rgba8888ToColor(o,e.readInt32()),E.rgb888ToColor(l,e.readInt32()),S.setFrame(M,A,o.r,o.g,o.b,o.a,l.r,l.g,l.b),M<v-1&&this.readCurve(e,M,S)}a.push(S),s=Math.max(s,S.frames[(v-1)*it.ENTRIES])}}for(var R=0,T=e.readInt(!0);R<T;R++)for(var I=e.readInt(!0),C=0,_=e.readInt(!0);C<_;C++){var k=e.readByte(),V=e.readInt(!0);switch(k){case t.BONE_ROTATE:var P=new tt(V);P.boneIndex=I;for(var F=0;F<V;F++)P.setFrame(F,e.readFloat(),e.readFloat()),F<V-1&&this.readCurve(e,F,P);a.push(P),s=Math.max(s,P.frames[(V-1)*tt.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var N=void 0,B=1;k==t.BONE_SCALE?N=new nt(V):k==t.BONE_SHEAR?N=new rt(V):(N=new et(V),B=i),N.boneIndex=I;for(var O=0;O<V;O++)N.setFrame(O,e.readFloat(),e.readFloat()*B,e.readFloat()*B),O<V-1&&this.readCurve(e,O,N);a.push(N),s=Math.max(s,N.frames[(V-1)*et.ENTRIES])}}for(var D=0,Y=e.readInt(!0);D<Y;D++){var U=e.readInt(!0),W=e.readInt(!0),q=new ct(W);q.ikConstraintIndex=U;for(var H=0;H<W;H++)q.setFrame(H,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),H<W-1&&this.readCurve(e,H,q);a.push(q),s=Math.max(s,q.frames[(W-1)*ct.ENTRIES])}for(var G=0,j=e.readInt(!0);G<j;G++){var z=e.readInt(!0),Z=e.readInt(!0),Q=new dt(Z);Q.transformConstraintIndex=z;for(var J=0;J<Z;J++)Q.setFrame(J,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),J<Z-1&&this.readCurve(e,J,Q);a.push(Q),s=Math.max(s,Q.frames[(Z-1)*dt.ENTRIES])}for(var $=0,ot=e.readInt(!0);$<ot;$++)for(var pt=e.readInt(!0),mt=r.pathConstraints[pt],yt=0,Et=e.readInt(!0);yt<Et;yt++){var xt=e.readByte(),bt=e.readInt(!0);switch(xt){case t.PATH_POSITION:case t.PATH_SPACING:var St=void 0,Mt=1;xt==t.PATH_SPACING?(St=new vt(bt),mt.spacingMode!=X.Length&&mt.spacingMode!=X.Fixed||(Mt=i)):(St=new ft(bt),mt.positionMode==L.Fixed&&(Mt=i)),St.pathConstraintIndex=pt;for(var At=0;At<bt;At++)St.setFrame(At,e.readFloat(),e.readFloat()*Mt),At<bt-1&&this.readCurve(e,At,St);a.push(St),s=Math.max(s,St.frames[(bt-1)*ft.ENTRIES]);break;case t.PATH_MIX:var Rt=new gt(bt);Rt.pathConstraintIndex=pt;for(var Tt=0;Tt<bt;Tt++)Rt.setFrame(Tt,e.readFloat(),e.readFloat(),e.readFloat()),Tt<bt-1&&this.readCurve(e,Tt,Rt);a.push(Rt),s=Math.max(s,Rt.frames[(bt-1)*gt.ENTRIES])}}for(var It=0,Ct=e.readInt(!0);It<Ct;It++)for(var _t=r.skins[e.readInt(!0)],kt=0,Vt=e.readInt(!0);kt<Vt;kt++)for(var Pt=e.readInt(!0),Ft=0,Nt=e.readInt(!0);Ft<Nt;Ft++){var Bt=_t.getAttachment(Pt,e.readStringRef()),Ot=null!=Bt.bones,Lt=Bt.vertices,Xt=Ot?Lt.length/3*2:Lt.length,Dt=e.readInt(!0),Yt=new lt(Dt);Yt.slotIndex=Pt,Yt.attachment=Bt;for(var Ut=0;Ut<Dt;Ut++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=Ot?b.newFloatArray(Xt):Lt;else{qt=b.newFloatArray(Xt);var Gt=e.readInt(!0);if(Ht+=Gt,1==i)for(var jt=Gt;jt<Ht;jt++)qt[jt]=e.readFloat();else for(var zt=Gt;zt<Ht;zt++)qt[zt]=e.readFloat()*i;if(!Ot)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=Lt[Zt]}Yt.setFrame(Ut,Wt,qt),Ut<Dt-1&&this.readCurve(e,Ut,Yt)}a.push(Yt),s=Math.max(s,Yt.frames[Dt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new ut(Jt),$t=r.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=b.newArray($t,0),ae=$t-1;ae>=0;ae--)re[ae]=-1;for(var ie=b.newArray($t-ne,0),se=0,oe=0,le=0;le<ne;le++){for(var he=e.readInt(!0);se!=he;)ie[oe++]=se++;re[se+e.readInt(!0)]=se++}for(;se<$t;)ie[oe++]=se++;for(var ue=$t-1;ue>=0;ue--)-1==re[ue]&&(re[ue]=ie[--oe]);Kt.setFrame(te,ee,re)}a.push(Kt),s=Math.max(s,Kt.frames[Jt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new ht(ce),fe=0;fe<ce;fe++){var pe=e.readFloat(),ve=r.events[e.readInt(!0)],ge=new wt(pe,ve);ge.intValue=e.readInt(!1),ge.floatValue=e.readFloat(),ge.stringValue=e.readBoolean()?e.readString():ve.stringValue,null!=ge.data.audioPath&&(ge.volume=e.readFloat(),ge.balance=e.readFloat()),de.setFrame(fe,ge)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new K(n,a,s)},e.readCurve=function(e,n,r){switch(e.readByte()){case t.CURVE_STEPPED:r.setStepped(n);break;case t.CURVE_BEZIER:this.setCurve(r,n,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat())}},e.setCurve=function(t,e,n,r,a,i){t.setCurve(e,n,r,a,i)},t}();xt.AttachmentTypeValues=[0,1,2,3,4,5,6],xt.TransformModeValues=[C.Normal,C.OnlyTranslation,C.NoRotationOrReflection,C.NoScale,C.NoScaleOrReflection],xt.PositionModeValues=[L.Fixed,L.Percent],xt.SpacingModeValues=[X.Length,X.Fixed,X.Percent],xt.RotateModeValues=[D.Tangent,D.Chain,D.ChainScale],xt.BlendModeValues=[pt.Normal,pt.Additive,pt.Multiply,pt.Screen],xt.BONE_ROTATE=0,xt.BONE_TRANSLATE=1,xt.BONE_SCALE=2,xt.BONE_SHEAR=3,xt.SLOT_ATTACHMENT=0,xt.SLOT_COLOR=1,xt.SLOT_TWO_COLOR=2,xt.PATH_POSITION=0,xt.PATH_SPACING=1,xt.PATH_MIX=2,xt.CURVE_LINEAR=0,xt.CURVE_STEPPED=1,xt.CURVE_BEZIER=2;var bt=function(){function t(t,e,n,r){void 0===e&&(e=new Array),void 0===n&&(n=0),void 0===r&&(r=new DataView(t.buffer)),this.strings=e,this.index=n,this.buffer=r}var e=t.prototype;return e.readByte=function(){return this.buffer.getInt8(this.index++)},e.readShort=function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t},e.readInt32=function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t},e.readInt=function(t){var e=this.readByte(),n=127&e;return 0!=(128&e)&&(n|=(127&(e=this.readByte()))<<7,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<14,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<21,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<28)))),t?n:n>>>1^-(1&n)},e.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},e.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",n=0;n<t;){var r=this.readByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((31&r)<<6|63&this.readByte()),n+=2;break;case 14:e+=String.fromCharCode((15&r)<<12|(63&this.readByte())<<6|63&this.readByte()),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e},e.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},e.readBoolean=function(){return 0!=this.readByte()},t}(),St=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},Mt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function At(){return At=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},At.apply(this,arguments)}var Rt=function(){function t(t,e,n){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=n,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,n,r,a,i,s){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var l=this.skeleton,h=n+90+s,u=l.scaleX,c=l.scaleY;return this.a=x.cosDeg(n+i)*r*u,this.b=x.cosDeg(h)*a*u,this.c=x.sinDeg(n+i)*r*c,this.d=x.sinDeg(h)*a*c,this.worldX=t*u+l.x,void(this.worldY=e*c+l.y)}var d=o.a,f=o.b,p=o.c,v=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=p*t+v*e+o.worldY,this.data.transformMode){case C.Normal:var g=n+90+s,m=x.cosDeg(n+i)*r,w=x.cosDeg(g)*a,y=x.sinDeg(n+i)*r,E=x.sinDeg(g)*a;return this.a=d*m+f*y,this.b=d*w+f*E,this.c=p*m+v*y,void(this.d=p*w+v*E);case C.OnlyTranslation:var b=n+90+s;this.a=x.cosDeg(n+i)*r,this.b=x.cosDeg(b)*a,this.c=x.sinDeg(n+i)*r,this.d=x.sinDeg(b)*a;break;case C.NoRotationOrReflection:var S=d*d+p*p,M=0;S>1e-4?(S=Math.abs(d*v-f*p)/S,d/=this.skeleton.scaleX,f=(p/=this.skeleton.scaleY)*S,v=d*S,M=Math.atan2(p,d)*x.radDeg):(d=0,p=0,M=90-Math.atan2(v,f)*x.radDeg);var A=n+i-M,R=n+s-M+90,T=x.cosDeg(A)*r,I=x.cosDeg(R)*a,_=x.sinDeg(A)*r,k=x.sinDeg(R)*a;this.a=d*T-f*_,this.b=d*I-f*k,this.c=p*T+v*_,this.d=p*I+v*k;break;case C.NoScale:case C.NoScaleOrReflection:var V=x.cosDeg(n),P=x.sinDeg(n),F=(d*V+f*P)/this.skeleton.scaleX,N=(p*V+v*P)/this.skeleton.scaleY,B=Math.sqrt(F*F+N*N);B>1e-5&&(B=1/B),F*=B,N*=B,B=Math.sqrt(F*F+N*N),this.data.transformMode==C.NoScale&&d*v-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(B=-B);var O=Math.PI/2+Math.atan2(N,F),L=Math.cos(O)*B,X=Math.sin(O)*B,D=x.cosDeg(i)*r,Y=x.cosDeg(90+s)*a,U=x.sinDeg(i)*r,W=x.sinDeg(90+s)*a;this.a=F*D+L*U,this.b=F*Y+L*W,this.c=N*D+X*U,this.d=N*Y+X*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var 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},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*x.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*x.radDeg},e.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.updateAppliedTransform=function(){this.appliedValid=!0;var t=this.parent;if(null==t)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*x.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*x.radDeg);var e=t.a,n=t.b,r=t.c,a=t.d,i=1/(e*a-n*r),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*n*i,this.ay=o*e*i-s*r*i;var l=i*a,h=i*e,u=i*n,c=i*r,d=l*this.a-u*this.c,f=l*this.b-u*this.d,p=h*this.c-c*this.a,v=h*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+p*p),this.ascaleX>1e-4){var g=d*v-f*p;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+p*v,g)*x.radDeg,this.arotation=Math.atan2(p,d)*x.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,f)*x.radDeg},e.worldToLocal=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=1/(e*a-n*r),s=t.x-this.worldX,o=t.y-this.worldY;return t.x=s*a*i-o*n*i,t.y=o*e*i-s*r*i,t},e.localToWorld=function(t){var 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},e.worldToLocalRotation=function(t){var e=x.sinDeg(t),n=x.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*x.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=x.sinDeg(t),n=x.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*x.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=x.cosDeg(t),s=x.sinDeg(t);this.a=i*e-s*r,this.b=i*n-s*a,this.c=s*e+i*r,this.d=s*n+i*a,this.appliedValid=!1},t}(),Tt=function(){function t(t,e){if(this.deform=new Array,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new E,this.darkColor=null==t.darkColor?null:new E,this.setToSetupPose()}var e=t.prototype;return e.getSkeleton=function(){return this.bone.skeleton},e.getAttachment=function(){return this.attachment},e.setAttachment=function(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)},e.setAttachmentTime=function(t){this.attachmentTime=this.bone.skeleton.time-t},e.getAttachmentTime=function(){return this.bone.skeleton.time-this.attachmentTime},e.setToSetupPose=function(){this.color.setFromColor(this.data.color),null!=this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),null==this.data.attachmentName?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))},t}(),It=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==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(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var 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)}},e.apply1=function(t,e,n,r,a,i,s){t.appliedValid||t.updateAppliedTransform();var o=t.parent,l=o.a,h=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,p=0;switch(t.data.transformMode){case C.OnlyTranslation:f=e-t.worldX,p=n-t.worldY;break;case C.NoRotationOrReflection:var v=Math.abs(l*c-h*u)/(l*l+u*u),g=l/t.skeleton.scaleX,m=u/t.skeleton.scaleY;h=-m*v*t.skeleton.scaleX,c=g*v*t.skeleton.scaleY,d+=Math.atan2(m,g)*x.radDeg;default:var w=e-o.worldX,y=n-o.worldY,E=l*c-h*u;f=(w*c-y*h)/E-t.ax,p=(y*l-w*u)/E-t.ay}d+=Math.atan2(p,f)*x.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var b=t.ascaleX,S=t.ascaleY;if(r||a){switch(t.data.transformMode){case C.NoScale:case C.NoScaleOrReflection:f=e-t.worldX,p=n-t.worldY}var M=t.data.length*b,A=Math.sqrt(f*f+p*p);if(r&&A<M||a&&A>M&&M>1e-4){var R=(A/M-1)*s+1;b*=R,i&&(S*=R)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,b,S,t.ashearX,t.ashearY)},e.apply2=function(t,e,n,r,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var l=t.ax,h=t.ay,u=t.ascaleX,c=u,d=t.ascaleY,f=e.ascaleX,p=0,v=0,g=0;u<0?(u=-u,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),f<0?(f=-f,v=180):v=0;var m=e.ax,w=0,y=0,E=0,b=t.a,S=t.b,M=t.c,A=t.d,R=Math.abs(u-d)<=1e-4;R?(y=b*m+S*(w=e.ay)+t.worldX,E=M*m+A*w+t.worldY):(w=0,y=b*m+t.worldX,E=M*m+t.worldY);var T=t.parent;b=T.a,S=T.b,M=T.c;var I,C,_=1/(b*(A=T.d)-S*M),k=y-T.worldX,V=E-T.worldY,P=(k*A-V*S)*_-l,F=(V*b-k*M)*_-h,N=Math.sqrt(P*P+F*F),B=e.data.length*f;if(N<1e-4)return this.apply1(t,n,r,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var O=((k=n-T.worldX)*A-(V=r-T.worldY)*S)*_-l,L=(V*b-k*M)*_-h,X=O*O+L*L;if(0!=s){s*=u*(f+1)/2;var D=Math.sqrt(X),Y=D-N-B*u+s;if(Y>0){var U=Math.min(1,Y/(2*s))-1;X=(O-=(U=(Y-s*(1-U*U))/D)*O)*O+(L-=U*L)*L}}t:if(R){var W=(X-N*N-(B*=u)*B)/(2*N*B);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(X)/(N+B)-1)*o+1)),C=Math.acos(W)*a,b=N+B*W,S=B*Math.sin(C),I=Math.atan2(L*b-O*S,O*b+L*S)}else{var q=(b=u*B)*b,H=(S=d*B)*S,G=Math.atan2(L,O),j=-2*H*N,z=H-q;if((A=j*j-4*z*(M=H*N*N+q*X-q*H))>=0){var Z=Math.sqrt(A);j<0&&(Z=-Z);var Q=(Z=-(j+Z)/2)/z,J=M/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){V=Math.sqrt(X-K*K)*a,I=G-Math.atan2(V,K),C=Math.atan2(V/d,(K-N)/u);break t}}var $=x.PI,tt=N-b,et=tt*tt,nt=0,rt=0,at=N+b,it=at*at,st=0;(M=-b*N/(q-H))>=-1&&M<=1&&(M=Math.acos(M),(A=(k=b*Math.cos(M)+N)*k+(V=S*Math.sin(M))*V)<et&&($=M,et=A,tt=k,nt=V),A>it&&(rt=M,it=A,at=k,st=V)),X<=(et+it)/2?(I=G-Math.atan2(nt*a,tt),C=$*a):(I=G-Math.atan2(st*a,at),C=rt*a)}var ot=Math.atan2(w,m)*g,lt=t.arotation;(I=(I-ot)*x.radDeg+p-lt)>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,h,lt+I*o,c,t.ascaleY,0,0),lt=e.arotation,(C=((C+ot)*x.radDeg-e.ashearX)*g+v-lt)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(m,w,lt+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),Ct=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new M,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)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(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()},e.applyAbsoluteWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?x.degRad:-x.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,p=d.length;f<p;f++){var v=d[f],g=!1;if(0!=t){var m=v.a,w=v.b,y=v.c,E=v.d,b=Math.atan2(o,i)-Math.atan2(y,m)+u;b>x.PI?b-=x.PI2:b<-x.PI&&(b+=x.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);v.a=S*m-M*y,v.b=S*w-M*E,v.c=M*m+S*y,v.d=M*w+S*E,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(A.x-v.worldX)*e,v.worldY+=(A.y-v.worldY)*e,g=!0}if(n>0){var R=Math.sqrt(v.a*v.a+v.c*v.c),T=Math.sqrt(i*i+o*o);R>1e-5&&(R=(R+(T-R+this.data.offsetScaleX)*n)/R),v.a*=R,v.c*=R,R=Math.sqrt(v.b*v.b+v.d*v.d),T=Math.sqrt(s*s+l*l),R>1e-5&&(R=(R+(T-R+this.data.offsetScaleY)*n)/R),v.b*=R,v.d*=R,g=!0}if(r>0){var I=v.b,C=v.d,_=Math.atan2(C,I),k=Math.atan2(l,s)-Math.atan2(o,i)-(_-Math.atan2(v.c,v.a));k>x.PI?k-=x.PI2:k<-x.PI&&(k+=x.PI2),k=_+(k+c)*r;var V=Math.sqrt(I*I+C*C);v.b=Math.cos(k)*V,v.d=Math.sin(k)*V,g=!0}g&&(v.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?x.degRad:-x.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,p=d.length;f<p;f++){var v=d[f],g=!1;if(0!=t){var m=v.a,w=v.b,y=v.c,E=v.d,b=Math.atan2(o,i)+u;b>x.PI?b-=x.PI2:b<-x.PI&&(b+=x.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);v.a=S*m-M*y,v.b=S*w-M*E,v.c=M*m+S*y,v.d=M*w+S*E,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),v.worldX+=A.x*e,v.worldY+=A.y*e,g=!0}if(n>0){var R=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;v.a*=R,v.c*=R,R=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*n+1,v.b*=R,v.d*=R,g=!0}if(r>0){var T=Math.atan2(l,s)-Math.atan2(o,i);T>x.PI?T-=x.PI2:T<-x.PI&&(T+=x.PI2);var I=v.b,C=v.d;T=Math.atan2(C,I)+(T-x.PI/2+c)*r;var _=Math.sqrt(I*I+C*C);v.b=Math.cos(T)*_,v.d=Math.sin(T)*_,g=!0}g&&(v.appliedValid=!1)}},e.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;if(0!=t){var u=a.arotation-h+this.data.offsetRotation;h+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=l.ax,d=l.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=l.ascaleX,p=l.ascaleY;0!=n&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*n)/f),p>1e-5&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*n)/p));var v=l.ashearY;if(0!=r){var g=a.ashearY-v+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),l.shearY+=g*r}l.updateWorldTransformWith(c,d,h,f,p,l.ashearX,v)}},e.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;0!=t&&(h+=(a.arotation+this.data.offsetRotation)*t);var u=l.ax,c=l.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=l.ascaleX,f=l.ascaleY;0!=n&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*n+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));var p=l.ashearY;0!=r&&(p+=(a.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,p)}},t}(),_t=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var 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}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(I(e,V)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==X.Percent,o=i.rotateMode,l=o==D.Tangent,h=o==D.ChainScale,u=this.bones.length,c=l?u:u+1,d=this.bones,f=b.setArraySize(this.spaces,c),p=null,v=this.spacing;if(h||!s){h&&(p=b.setArraySize(this.lengths,u));for(var g=i.spacingMode==X.Length,m=0,w=c-1;m<w;){var y=d[m],E=y.data.length;if(E<t.epsilon)h&&(p[m]=0),f[++m]=0;else if(s){if(h){var S=E*y.a,M=E*y.c,A=Math.sqrt(S*S+M*M);p[m]=A}f[++m]=v}else{var R=E*y.a,T=E*y.c,C=Math.sqrt(R*R+T*T);h&&(p[m]=C),f[++m]=(g?E+v:v)*C/E}}}else for(var _=1;_<c;_++)f[_]=v;var k=this.computeWorldPositions(e,c,l,i.positionMode==L.Percent,s),P=k[0],F=k[1],N=i.offsetRotation,B=!1;if(0==N)B=o==D.Chain;else{B=!1;var O=this.target.bone;N*=O.a*O.d-O.b*O.c>0?x.degRad:-x.degRad}for(var Y=0,U=3;Y<u;Y++,U+=3){var W=d[Y];W.worldX+=(P-W.worldX)*r,W.worldY+=(F-W.worldY)*r;var q=k[U],H=k[U+1],G=q-P,j=H-F;if(h){var z=p[Y];if(0!=z){var Z=(Math.sqrt(G*G+j*j)/z-1)*n+1;W.a*=Z,W.c*=Z}}if(P=q,F=H,a){var Q=W.a,J=W.b,K=W.c,$=W.d,tt=0,et=0,nt=0;if(tt=l?k[U-1]:0==f[Y+1]?k[U+2]:Math.atan2(j,G),tt-=Math.atan2(K,Q),B){et=Math.cos(tt),nt=Math.sin(tt);var rt=W.data.length;P+=(rt*(et*Q-nt*K)-G)*n,F+=(rt*(nt*Q+et*K)-j)*n}else tt+=N;tt>x.PI?tt-=x.PI2:tt<-x.PI&&(tt+=x.PI2),tt*=n,et=Math.cos(tt),nt=Math.sin(tt),W.a=et*Q-nt*K,W.b=et*J-nt*$,W.c=nt*Q+et*K,W.d=nt*J+et*$}W.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,l=this.spaces,h=b.setArraySize(this.positions,3*n+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,p=t.NONE;if(!e.constantSpeed){var v=e.lengths,g=v[f-=c?1:2];if(a&&(o*=g),i)for(var m=1;m<n;m++)l[m]*=g;u=b.setArraySize(this.world,8);for(var w=0,y=0,E=0;w<n;w++,y+=3){var x=l[w],S=o+=x;if(c)(S%=g)<0&&(S+=g),E=0;else{if(S<0){p!=t.BEFORE&&(p=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(S,u,0,h,y);continue}if(S>g){p!=t.AFTER&&(p=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(S-g,u,0,h,y);continue}}for(;;E++){var M=v[E];if(!(S>M)){if(0==E)S/=M;else{var A=v[E-1];S=(S-A)/(M-A)}break}}E!=p&&(p=E,c&&E==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*E+2,8,u,0,2)),this.addCurvePosition(S,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,y,r||w>0&&0==x)}return h}c?(d+=2,u=b.setArraySize(this.world,d),e.computeWorldVertices(s,2,d-4,u,0,2),e.computeWorldVertices(s,0,2,u,d-4,2),u[d-2]=u[0],u[d-1]=u[1]):(f--,d-=4,u=b.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var R=b.setArraySize(this.curves,f),T=0,I=u[0],C=u[1],_=0,k=0,V=0,P=0,F=0,N=0,B=0,O=0,L=0,X=0,D=0,Y=0,U=0,W=0,q=0,H=2;q<f;q++,H+=6)_=u[H],k=u[H+1],V=u[H+2],P=u[H+3],D=2*(B=.1875*(I-2*_+V))+(L=.09375*(3*(_-V)-I+(F=u[H+4]))),Y=2*(O=.1875*(C-2*k+P))+(X=.09375*(3*(k-P)-C+(N=u[H+5]))),U=.75*(_-I)+B+.16666667*L,W=.75*(k-C)+O+.16666667*X,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,D+=L,Y+=X,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,T+=Math.sqrt(U*U+W*W),U+=D+L,W+=Y+X,T+=Math.sqrt(U*U+W*W),R[q]=T,I=F,C=N;if(o*=a?T:T/e.lengths[f-1],i)for(var G=1;G<n;G++)l[G]*=T;for(var j=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<n;Z++,Q+=3){var $=l[Z],tt=o+=$;if(c)(tt%=T)<0&&(tt+=T),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>T){this.addAfterPosition(tt-T,u,d-4,h,Q);continue}}for(;;J++){var et=R[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=R[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=p){p=J;var rt=6*J;for(I=u[rt],C=u[rt+1],_=u[rt+2],k=u[rt+3],V=u[rt+4],P=u[rt+5],D=2*(B=.03*(I-2*_+V))+(L=.006*(3*(_-V)-I+(F=u[rt+6]))),Y=2*(O=.03*(C-2*k+P))+(X=.006*(3*(k-P)-C+(N=u[rt+7]))),U=.3*(_-I)+B+.16666667*L,W=.3*(k-C)+O+.16666667*X,z=Math.sqrt(U*U+W*W),j[0]=z,rt=1;rt<8;rt++)U+=D,W+=Y,D+=L,Y+=X,z+=Math.sqrt(U*U+W*W),j[rt]=z;U+=D,W+=Y,z+=Math.sqrt(U*U+W*W),j[8]=z,U+=D+L,W+=Y+X,z+=Math.sqrt(U*U+W*W),j[9]=z,K=0}for(tt*=z;;K++){var at=j[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=j[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,I,C,_,k,V,P,F,N,h,Q,r||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,l=e[n+3]-s,h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],l=s-e[n+1],h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addCurvePosition=function(t,e,n,r,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=n,void(h[u+2]=Math.atan2(a-n,r-e));var d=t*t,f=d*t,p=1-t,v=p*p,g=v*p,m=p*t,w=3*m,y=p*w,E=w*t,x=e*g+r*y+i*E+o*f,b=n*g+a*y+s*E+l*f;h[u]=x,h[u+1]=b,c&&(h[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(b-(n*v+a*m*2+s*d),x-(e*v+r*m*2+i*d)))},t}();_t.NONE=-1,_t.BEFORE=-2,_t.AFTER=-3,_t.epsilon=1e-5;var kt=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var n=t.bones[e],r=void 0;if(null==n.parent)r=new Rt(n,this,null);else{var a=this.bones[n.parent.index];r=new Rt(n,this,a),a.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],l=new Tt(s,o);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(var h=0;h<t.ikConstraints.length;h++){var u=t.ikConstraints[h];this.ikConstraints.push(new It(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new Ct(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var p=t.pathConstraints[f];this.pathConstraints.push(new _t(p,this))}this.color=new E(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){var t=this._updateCache;t.length=0,this.updateCacheReset.length=0;for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];a.sorted=a.data.skinRequired,a.active=!a.sorted}if(null!=this.skin)for(var i=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var l=this.bones[i[s].index];do{l.sorted=!1,l.active=!0,l=l.parent}while(null!=l)}var h=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=h.length,f=u.length,p=c.length,v=d+f+p;t:for(var g=0;g<v;g++){for(var m=0;m<d;m++){var w=h[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var y=0;y<f;y++){var E=u[y];if(E.data.order==g){this.sortTransformConstraint(E);continue t}}for(var x=0;x<p;x++){var b=c[x];if(b.data.order==g){this.sortPathConstraint(b);continue t}}}for(var S=0,M=e.length;S<M;S++)this.sortBone(e[S])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var n=t.bones,r=n[0];if(this.sortBone(r),n.length>1){var a=n[n.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,n=e.data.index,r=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(var a=0,i=this.data.skins.length;a<i;a++)this.sortPathConstraintAttachment(this.data.skins[a],n,r);var s=e.getAttachment();I(s,V)&&this.sortPathConstraintAttachmentWith(s,r);for(var o=t.bones,l=o.length,h=0;h<l;h++)this.sortBone(o[h]);this._updateCache.push(t);for(var u=0;u<l;u++)this.sortReset(o[u].children);for(var c=0;c<l;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,n=e.length;if(t.data.local)for(var r=0;r<n;r++){var a=e[r];this.sortBone(a.parent),this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}else for(var i=0;i<n;i++)this.sortBone(e[i]);this._updateCache.push(t);for(var s=0;s<n;s++)this.sortReset(e[s].children);for(var o=0;o<n;o++)e[o].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,n){var r=t.attachments[e];if(r)for(var a in r)this.sortPathConstraintAttachmentWith(r[a],n)},e.sortPathConstraintAttachmentWith=function(t,e){if(I(t,V)){var n=t.bones;if(null==n)this.sortBone(e);else for(var r=this.bones,a=0;a<n.length;)for(var i=n[a++],s=a+i;a<s;a++){var o=n[a];this.sortBone(r[o])}}},e.sortBone=function(t){if(!t.sorted){var e=t.parent;null!=e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,n=t.length;e<n;e++){var r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,n=t.length;e<n;e++){var r=t[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}for(var a=this._updateCache,i=0,s=a.length;i<s;i++)a[i].update()},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t=this.bones,e=0,n=t.length;e<n;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,a=0,i=r.length;a<i;a++){var s=r[a];s.mix=s.data.mix,s.softness=s.data.softness,s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch}for(var o=this.transformConstraints,l=0,h=o.length;l<h;l++){var u=o[l],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,p=d.length;f<p;f++){var v=d[f],g=v.data;v.position=g.position,v.spacing=g.spacing,v.rotateMix=g.rotateMix,v.translateMix=g.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;b.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,n=t.length;e<n;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(null==e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(null!=t)if(null!=this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(n,i);null!=s&&a.setAttachment(s)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)},e.getAttachment=function(t,e){if(null==e)throw new Error("attachmentName cannot be null.");if(null!=this.skin){var n=this.skin.getAttachment(t,e);if(null!=n)return n}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(null==t)throw new Error("slotName cannot be null.");for(var n=this.slots,r=0,a=n.length;r<a;r++){var i=n[r];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(r,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,n){if(void 0===n&&(n=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==e)throw new Error("size cannot be null.");for(var r=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=0,h=r.length;l<h;l++){var u=r[l];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(I(f,T))c=8,d=b.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(I(f,_)){var p=f;c=p.worldVerticesLength,d=b.setArraySize(n,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var v=0,g=d.length;v<g;v+=2){var m=d[v],w=d[v+1];a=Math.min(a,m),i=Math.min(i,w),s=Math.max(s,m),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),Vt=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Nt(this),this.propertyIDs=new y,this.animationsChanged=!1,this.trackEntryPool=new S((function(){return new Ft})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n<r;n++){var a=e[n];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(n,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)},e.apply=function(e){if(null==e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,r=this.tracks,a=!1,i=0,s=r.length;i<s;i++){var o=r[i];if(!(null==o||o.delay>0)){a=!0;var l=0==i?G.first:o.mixBlend,h=o.alpha;null!=o.mixingFrom?h*=this.applyMixingFrom(o,e,l):o.trackTime>=o.trackEnd&&null==o.next&&(h=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==h||l==G.add)for(var p=0;p<d;p++){b.webkit602BugfixHelper(h,l);var v=f[p];I(v,st)?this.applyAttachmentTimeline(v,e,c,l,!0):v.apply(e,u,c,n,h,l,j.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&b.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,y=0;y<d;y++){var E=f[y],x=g[y]==t.SUBSEQUENT?l:G.setup;I(E,tt)?this.applyRotateTimeline(E,e,c,h,x,w,y<<1,m):I(E,st)?this.applyAttachmentTimeline(E,e,c,l,!0):(b.webkit602BugfixHelper(h,l),E.apply(e,u,c,n,h,x,j.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var S=this.unkeyedState+t.SETUP,M=e.slots,A=0,R=e.slots.length;A<R;A++){var T=M[A];if(T.attachmentState==S){var C=T.data.attachmentName;T.attachment=null==C?null:e.getAttachment(T.data.index,C)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,n,r){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,n,r);var i=0;0==e.mixDuration?(i=1,r==G.first&&(r=G.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=G.first&&(r=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,l=i<a.drawOrderThreshold,h=a.animationLast,u=a.getAnimationTime(),c=a.animation.timelines.length,d=a.animation.timelines,f=a.alpha*e.interruptAlpha,p=f*(1-i);if(r==G.add)for(var v=0;v<c;v++)d[v].apply(n,h,u,s,p,r,j.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&b.setArraySize(a.timelinesRotation,c<<1,null);var y=a.timelinesRotation;a.totalAlpha=0;for(var E=0;E<c;E++){var x=d[E],S=j.mixOut,M=void 0,A=0;switch(g[E]){case t.SUBSEQUENT:if(!l&&I(x,ut))continue;M=r,A=p;break;case t.FIRST:M=G.setup,A=p;break;case t.HOLD_SUBSEQUENT:M=r,A=f;break;case t.HOLD_FIRST:M=G.setup,A=f;break;default:M=G.setup;var R=m[E];A=f*Math.max(0,1-R.mixTime/R.mixDuration)}a.totalAlpha+=A,I(x,tt)?this.applyRotateTimeline(x,n,u,A,M,y,E<<1,w):I(x,st)?this.applyAttachmentTimeline(x,n,u,M,o):(b.webkit602BugfixHelper(A,r),l&&I(x,ut)&&M==G.setup&&(S=j.mixIn),x.apply(n,h,u,s,A,M,S))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,n,r,a,i){var s=n.slots[e.slotIndex];if(s.bone.active){var o,l=e.frames;if(r<l[0])a!=G.setup&&a!=G.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=l[l.length-1]?l.length-1:K.binarySearch(l,r)-1,this.setAttachment(n,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,n,r,a){n.attachment=null==r?null:e.getAttachment(n.data.index,r),a&&(n.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,n,r,a,i,s,o){if(o&&(i[s]=0),1!=r){var l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var c=0,d=0;if(n<h[0])switch(a){case G.setup:u.rotation=u.data.rotation;default:return;case G.first:c=u.rotation,d=u.data.rotation}else if(c=a==G.setup?u.data.rotation:u.rotation,n>=h[h.length-tt.ENTRIES])d=u.data.rotation+h[h.length+tt.PREV_ROTATION];else{var f=K.binarySearch(h,n,tt.ENTRIES),p=h[f+tt.PREV_ROTATION],v=h[f],g=l.getCurvePercent((f>>1)-1,1-(n-v)/(h[f+tt.PREV_TIME]-v));d=h[f+tt.ROTATION]-p,d=p+(d-=360*(16384-(16384.499999999996-d/360|0)))*g+u.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var m=0,w=d-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))m=i[s];else{var y=0,E=0;o?(y=0,E=w):(y=i[s],E=i[s+1]);var b=w>0,S=y>=0;x.signum(E)!=x.signum(w)&&Math.abs(E)<=90&&(Math.abs(y)>180&&(y+=360*x.signum(y)),S=b),m=w+y-y%360,S!=b&&(m+=360*x.signum(y)),i[s]=m}i[s+1]=w,c+=m*r,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,n,null,1,a,j.mixIn)},e.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,s=this.events,o=0,l=s.length;o<l;o++){var h=s[o];if(h.time<i)break;h.time>r||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast<r)&&this.queue.complete(t);o<l;o++){s[o].time<n||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,r=!1):this.disposeNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i},e.addAnimation=function(t,e,n,r){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)},e.addAnimationWith=function(t,e,n,r){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,n,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,r<=0){var s=a.animationEnd-a.animationStart;0!=s?(a.loop?r+=s*(1+(a.trackTime/s|0)):r+=Math.max(s,a.trackTime),r-=this.data.getMix(a.animation,e)):r=a.trackTime}return i.delay=r,i},e.setEmptyAnimation=function(e,n){var r=this.setAnimationWith(e,t.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.addEmptyAnimation=function(e,n,r){r<=0&&(r-=n);var a=this.addAnimationWith(e,t.emptyAnimation,!1,r);return a.mixDuration=n,a.trackEnd=n,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n<r;n++){var a=this.tracks[n];null!=a&&this.setEmptyAnimation(a.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(b.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,n,r){var a=this.trackEntryPool.obtain();return a.trackIndex=t,a.animation=e,a.loop=n,a.holdPrevious=!1,a.eventThreshold=0,a.attachmentThreshold=0,a.drawOrderThreshold=0,a.animationStart=0,a.animationEnd=e.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.interruptAlpha=1,a.mixTime=0,a.mixDuration=null==r?0:this.data.getMix(r.animation,e),a.mixBlend=G.replace,a},e.disposeNext=function(t){for(var e=t.next;null!=e;)this.queue.dispose(e),e=e.next;t.next=null},e._animationsChanged=function(){this.animationsChanged=!1,this.propertyIDs.clear();for(var t=0,e=this.tracks.length;t<e;t++){var n=this.tracks[t];if(null!=n){for(;null!=n.mixingFrom;)n=n.mixingFrom;do{null!=n.mixingFrom&&n.mixBlend==G.add||this.computeHold(n),n=n.mixingTo}while(null!=n)}}},e.computeHold=function(e){var n=e.mixingTo,r=e.animation.timelines,a=e.animation.timelines.length,i=b.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=b.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var l=0;l<a;l++)i[l]=o.add(r[l].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var h=0;h<a;h++){var u=r[h],c=u.getPropertyId();if(o.add(c))if(null==n||I(u,st)||I(u,ut)||I(u,ht)||!n.animation.hasTimeline(c))i[h]=t.FIRST;else{for(var d=n.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[h]=t.HOLD_MIX,s[h]=d;continue t}break}i[h]=t.HOLD_FIRST}else i[h]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Vt.emptyAnimation=new K("<empty>",[],0),Vt.SUBSEQUENT=0,Vt.FIRST=1,Vt.HOLD_SUBSEQUENT=2,Vt.HOLD_FIRST=3,Vt.HOLD_MIX=4,Vt.SETUP=1,Vt.CURRENT=2;var Pt,Ft=function(){function t(){this.mixBlend=G.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.reset=function(){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},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},t}(),Nt=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n<t.length;n+=2){var r=t[n],a=t[n+1];switch(r){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var h=0;h<e.length;h++)e[h].complete&&e[h].complete(a);break;case 5:var u=t[2+n++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Pt||(Pt={}));var Bt=function(){function t(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}var e=t.prototype;return e.setMix=function(t,e,n){var r=this.skeletonData.findAnimation(t);if(null==r)throw new Error("Animation not found: "+t);var a=this.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);this.setMixWith(r,a,n)},e.setMixWith=function(t,e,n){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");var r=t.name+"."+e.name;this.animationToMixTime[r]=n},e.getMix=function(t,e){var n=t.name+"."+e.name,r=this.animationToMixTime[n];return void 0===r?this.defaultMix:r},t}(),Ot=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new S((function(){return new Array})),this.polygonIndicesPool=new S((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var n=e,r=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<r;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,l=r;o<l;++o)s[o]=t.isConcave(o,r,n,a);var h=this.triangles;for(h.length=0;r>3;){for(var u=r-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,p=a[c]<<1,v=a[d]<<1,g=n[f],m=n[f+1],w=n[p],y=n[p+1],E=n[v],x=n[v+1],b=(d+1)%r;b!=u;b=(b+1)%r)if(s[b]){var S=a[b]<<1,M=n[S],A=n[S+1];if(t.positiveArea(E,x,g,m,M,A)&&t.positiveArea(g,m,w,y,M,A)&&t.positiveArea(w,y,E,x,M,A))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%r}h.push(a[(r+c-1)%r]),h.push(a[c]),h.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var R=(--r+c-1)%r,T=c==r?0:c;s[R]=t.isConcave(R,r,n,a),s[T]=t.isConcave(T,r,n,a)}return 3==r&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.decompose=function(e,n){var r=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var l=-1,h=0,u=0,c=n.length;u<c;u+=3){var d=n[u]<<1,f=n[u+1]<<1,p=n[u+2]<<1,v=r[d],g=r[d+1],m=r[f],w=r[f+1],y=r[p],E=r[p+1],x=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],y,E),M=t.winding(y,E,o[0],o[1],o[2],o[3]);S==h&&M==h&&(o.push(y),o.push(E),s.push(p),x=!0)}x||(o.length>0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(v),o.push(g),o.push(m),o.push(w),o.push(y),o.push(E),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(p),h=t.winding(v,g,m,w,y,E),l=d)}o.length>0&&(a.push(o),i.push(s));for(var A=0,R=a.length;A<R;A++)if(0!=(s=i[A]).length)for(var T=s[0],I=s[s.length-1],C=(o=a[A]).length-4,_=o[C],k=o[C+1],V=o[C+2],P=o[C+3],F=o[0],N=o[1],B=o[2],O=o[3],L=t.winding(_,k,V,P,F,N),X=0;X<R;X++)if(X!=A){var D=i[X];if(3==D.length){var Y=D[0],U=D[1],W=D[2],q=a[X],H=q[q.length-2],G=q[q.length-1];if(Y==T&&U==I){var j=t.winding(_,k,V,P,H,G),z=t.winding(H,G,F,N,B,O);j==L&&z==L&&(q.length=0,D.length=0,o.push(H),o.push(G),s.push(W),_=V,k=P,V=H,P=G,X=0)}}}for(var Z=a.length-1;Z>=0;Z--)0==(o=a[Z]).length&&(a.splice(Z,1),this.polygonPool.free(o),s=i[Z],i.splice(Z,1),this.polygonIndicesPool.free(s));return a},t.isConcave=function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,s=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[s],n[s+1])},t.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},t.winding=function(t,e,n,r,a,i){var s=n-t,o=r-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),Lt=function(){function t(){this.triangulator=new Ot,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}var e=t.prototype;return e.clipStart=function(e,n){if(null!=this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,a=b.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(e,0,r,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,l=s.length;o<l;o++){var h=s[o];t.makeClockwise(h),h.push(h[0]),h.push(h[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,n,r,a,i,s,o){var l=this.clipOutput,h=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,p=0;h.length=0,u.length=0;t:for(var v=0;v<r;v+=3)for(var g=n[v]<<1,m=t[g],w=t[g+1],y=a[g],E=a[g+1],x=t[g=n[v+1]<<1],S=t[g+1],M=a[g],A=a[g+1],R=t[g=n[v+2]<<1],T=t[g+1],I=a[g],C=a[g+1],_=0;_<d;_++){var k=h.length;if(!this.clip(m,w,x,S,R,T,c[_],l)){var V=b.setArraySize(h,k+3*f);V[k]=m,V[k+1]=w,V[k+2]=i.r,V[k+3]=i.g,V[k+4]=i.b,V[k+5]=i.a,o?(V[k+6]=y,V[k+7]=E,V[k+8]=s.r,V[k+9]=s.g,V[k+10]=s.b,V[k+11]=s.a,V[k+12]=x,V[k+13]=S,V[k+14]=i.r,V[k+15]=i.g,V[k+16]=i.b,V[k+17]=i.a,V[k+18]=M,V[k+19]=A,V[k+20]=s.r,V[k+21]=s.g,V[k+22]=s.b,V[k+23]=s.a,V[k+24]=R,V[k+25]=T,V[k+26]=i.r,V[k+27]=i.g,V[k+28]=i.b,V[k+29]=i.a,V[k+30]=I,V[k+31]=C,V[k+32]=s.r,V[k+33]=s.g,V[k+34]=s.b,V[k+35]=s.a):(V[k+6]=y,V[k+7]=E,V[k+8]=x,V[k+9]=S,V[k+10]=i.r,V[k+11]=i.g,V[k+12]=i.b,V[k+13]=i.a,V[k+14]=M,V[k+15]=A,V[k+16]=R,V[k+17]=T,V[k+18]=i.r,V[k+19]=i.g,V[k+20]=i.b,V[k+21]=i.a,V[k+22]=I,V[k+23]=C),k=u.length;var P=b.setArraySize(u,k+3);P[k]=p,P[k+1]=p+1,P[k+2]=p+2,p+=3;continue t}var F=l.length;if(0!=F){for(var N=S-T,B=R-x,O=m-R,L=T-w,X=1/(N*O+B*(w-T)),D=F>>1,Y=this.clipOutput,U=b.setArraySize(h,k+D*f),W=0;W<F;W+=2){var q=Y[W],H=Y[W+1];U[k]=q,U[k+1]=H,U[k+2]=i.r,U[k+3]=i.g,U[k+4]=i.b,U[k+5]=i.a;var G=q-R,j=H-T,z=(N*G+B*j)*X,Z=(L*G+O*j)*X,Q=1-z-Z;U[k+6]=y*z+M*Z+I*Q,U[k+7]=E*z+A*Z+C*Q,o&&(U[k+8]=s.r,U[k+9]=s.g,U[k+10]=s.b,U[k+11]=s.a),k+=f}k=u.length;var J=b.setArraySize(u,k+3*(D-2));D--;for(var K=1;K<D;K++)J[k]=p,J[k+1]=p+K,J[k+2]=p+K+1,k+=3;p+=D+1}}},e.clip=function(t,e,n,r,a,i,s,o){var l=o,h=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(a),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,d=s.length-4,f=0;;f+=2){for(var p=c[f],v=c[f+1],g=c[f+2],m=c[f+3],w=p-g,y=v-m,E=u,x=u.length-2,b=o.length,S=0;S<x;S+=2){var M=E[S],A=E[S+1],R=E[S+2],T=E[S+3],I=w*(T-m)-y*(R-g)>0;if(w*(A-m)-y*(M-g)>0){if(I){o.push(R),o.push(T);continue}var C=T-A,_=R-M,k=C*(g-p)-_*(m-v);if(Math.abs(k)>1e-6){var V=(_*(v-A)-C*(p-M))/k;o.push(p+(g-p)*V),o.push(v+(m-v)*V)}else o.push(p),o.push(v)}else if(I){var P=T-A,F=R-M,N=P*(g-p)-F*(m-v);if(Math.abs(N)>1e-6){var B=(F*(v-A)-P*(p-M))/N;o.push(p+(g-p)*B),o.push(v+(m-v)*B)}else o.push(p),o.push(v);o.push(R),o.push(T)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var O=o;(o=u).length=0,u=O}if(l!=o){l.length=0;for(var L=0,X=o.length-2;L<X;L++)l[L]=o[L]}else l.length=l.length-2;return h},t.makeClockwise=function(t){for(var e=t,n=t.length,r=e[n-2]*e[1]-e[0]*e[n-1],a=0,i=0,s=0,o=0,l=n-3;o<l;o+=2)a=e[o],i=e[o+1],s=e[o+2],r+=a*e[o+3]-s*i;if(!(r<0))for(var h=0,u=n-2,c=n>>1;h<c;h+=2){var d=e[h],f=e[h+1],p=u-h;e[h]=e[p],e[h+1]=e[p+1],e[p]=d,e[p+1]=f}},t}(),Xt=function(){function t(){}var n=t.prototype;return n.initialize=function(t,n){var r=this._mesh=new e.BufferMesh(t),a=[new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0),new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0),new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)],i=4*Dt.VERTEX_STRIDE,s=i*n,o=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,s,e.BufferUsage.Dynamic),l=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic);this._indexBuffer=l,this._vertexBuffer=o,r.setVertexBufferBinding(o,i),r.setIndexBufferBinding(l,e.IndexFormat.UInt16),r.setVertexElements(a),r.addSubMesh(0,n)},n.changeBuffer=function(t,n){var r=4*Dt.VERTEX_STRIDE,a=r*n,i=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,a,e.BufferUsage.Dynamic),s=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic),o=this._mesh;this._indexBuffer=s,this._vertexBuffer=i,o.setVertexBufferBinding(i,r),o.setIndexBufferBinding(s,e.IndexFormat.UInt16)},s(t,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),t}(),Dt=function(){function t(t,e){this._clipper=new Lt,this._spineMesh=new Xt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this.separateSlotTextures=new Map,this._engine=t,this._entity=e}var n=t.prototype;return n.initialize=function(n,r){if(n){var a=this._entity.getComponent(e.MeshRenderer);if(a){this._meshRenderer=a,r&&(this._setting=r);for(var i=n.defaultSkin.attachments,s=0,o=t.QUAD_TRIANGLES.length,l=0,h=i.length;l<h;l++){var u=i[l];for(var c in u){var d=u[c];if(d)if(I(d,T))s+=o;else{if(!I(d,_))continue;s+=d.triangles.length}}}this._vertexCount=s,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),a.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},n.buildMesh=function(n){var r=this._setting||{},a=r.useClipping,i=void 0===a||a,s=r.zSpacing,o=void 0===s?.01:s,l=0,h=0,u=n.drawOrder,c=u.length,d=this._clipper,f=this._spineMesh,p=f.mesh,v=this._subMeshItems;v.length=0;var g,m,w=this._vertices,y=0,E=0,x=pt.Normal,b=null;t.tempBlendMode=null;for(var S=0;S<c;++S){var M=u[S];if(M.bone.active){var A=M.getAttachment(),R=null,C=o*S,k=0,V=d.isClipping()?2:t.VERTEX_SIZE;if(I(A,T)){var P=A;R=P.color,w=this._vertices,k=4*V,P.computeWorldVertices(M.bone,w,0,V),g=t.QUAD_TRIANGLES,m=P.uvs,b=P.region.renderObject.texture}else if(I(A,_)){var N=A;R=N.color,w=this._vertices,(k=(N.worldVerticesLength>>1)*V)>w.length&&(w=this._vertices=new Float32Array(k)),N.computeWorldVertices(M,0,N.worldVerticesLength,w,0,V),g=N.triangles,m=N.uvs,b=N.region.renderObject.texture}else if(I(A,F)){if(i){var B=A;d.clipStart(M,B);continue}}else if(i){d.clipEndWithSlot(M);continue}if(null!=b){var O=M.data.name;if(x=M.data.blendMode,null!==t.tempBlendMode&&t.tempBlendMode!==M.data.blendMode&&E>0){var L=new e.SubMesh(y,E);v.push({blendMode:t.tempBlendMode,subMesh:L,texture:b}),y=h,E=0}t.tempBlendMode=M.data.blendMode;var X=void 0,D=void 0,Y=void 0,U=void 0,W=M.bone.skeleton.color,q=M.color,H=W.a*q.a*R.a,G=t.tempColor;if(G.set(W.r*q.r*R.r,W.g*q.g*R.g,W.b*q.b*R.b,H),d.isClipping()){d.clipTriangles(w,k,g,g.length,m,G,null,!1);var j=d.clippedVertices,z=d.clippedTriangles;X=j,D=j.length,Y=z,U=z.length}else{for(var Z=w,Q=2,J=0,K=k;Q<K;Q+=V,J+=2)Z[Q]=G.r,Z[Q+1]=G.g,Z[Q+2]=G.b,Z[Q+3]=G.a,Z[Q+4]=m[J],Z[Q+5]=m[J+1];X=w,D=k,Y=g,U=g.length}for(var $=l/t.VERTEX_STRIDE,tt=this._verticesWithZ,et=l,nt=0;nt<D;)tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=C,tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++];l=et;var rt=this._indices;for(et=h,nt=0;nt<U;et++,nt++)rt[et]=Y[nt]+$;if(this.separateSlots.includes(O)){if(E>0){var at=new e.SubMesh(y,E);v.push({blendMode:t.tempBlendMode,subMesh:at,texture:b}),y=h}var it=this.separateSlotTextures[O];if(it){var st=b.texture;it.filterMode=st.filterMode,it.wrapModeU=st.wrapModeU,it.wrapModeV=st.wrapModeV,b=it}var ot=new e.SubMesh(y,U);v.push({blendMode:x,subMesh:ot,texture:b}),y+=U,E=0}else E+=U;h+=U}d.clipEndWithSlot(M)}else d.clipEndWithSlot(M)}if(d.clipEnd(),E>0){var lt=new e.SubMesh(y,E);v.push({blendMode:x,subMesh:lt,texture:b}),E=0}if(v.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),h>0&&h!==this._vertexCount&&h>this._vertexCount)return this._vertexCount=h,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);p.clearSubMesh();for(var ht=this._meshRenderer,ut=0,ct=v.length;ut<ct;++ut){var dt=v[ut],ft=dt.blendMode;p.addSubMesh(dt.subMesh);var vt=ht.getMaterial(ut);vt||(vt=Ut.getDefaultMaterial(this._engine)),vt.shaderData.setTexture("material_SpineTexture",b.texture),vt._priority=ut,this.setBlendMode(vt,ft),ht.setMaterial(ut,vt)}this._needResize&&(f.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),f.vertexBuffer.setData(this._verticesWithZ),f.indexBuffer.setData(this._indices)},n.addSeparateSlot=function(t){this.separateSlots.push(t)},n.addSeparateSlotTexture=function(t,e){this.separateSlotTextures[t]=new qt(e)},n._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},n.setBlendMode=function(t,n){var r=t.renderState.blendState.targetBlendState;switch(n){case pt.Additive:r.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,r.destinationColorBlendFactor=e.BlendFactor.One,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.One,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add;break;case pt.Multiply:r.sourceColorBlendFactor=e.BlendFactor.DestinationColor,r.destinationColorBlendFactor=e.BlendFactor.Zero,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.Zero,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add;break;case pt.Screen:r.sourceColorBlendFactor=e.BlendFactor.One,r.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceColor,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceColor,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add;break;default:r.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,r.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceAlpha,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceAlpha,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add}},s(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();Dt.QUAD_TRIANGLES=[0,1,2,2,3,0],Dt.VERTEX_SIZE=8,Dt.VERTEX_STRIDE=9,Dt.tempColor=new E,Dt.tempBlendMode=null;var Yt=function(t){function n(r){var a,i=e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",n._spineVS,n._spineFS),s=(a=t.call(this,r,i)||this).renderState,o=s.blendState.targetBlendState;return o.enabled=!0,o.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,o.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.sourceAlphaBlendFactor=e.BlendFactor.One,o.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.colorBlendOperation=o.alphaBlendOperation=e.BlendOperation.Add,s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent,a}return r(n,t),n}(e.Material);Yt._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n ",Yt._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n ";var Ut=function(t){function n(e){var n;return(n=t.call(this,e)||this)._tempOffset=new M,n._tempSize=new M,n._tempArray=[0,0],n.autoUpdateBounds=!1,n.noPause=!1,n._meshGenerator=new Dt(n.engine,e),n}r(n,t);var a=n.prototype;return a.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new kt(t);var n=new Bt(t);this._state=new Vt(n),this._meshGenerator.initialize(t,this.setting)},a.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!"),this.entity.getComponent(e.MeshRenderer)||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)?this._meshGenerator.addSeparateSlot(t):console.warn("Slot: "+t+" not find.")},a.hackSeparateSlotTexture=function(t,e){var n=this._meshGenerator.separateSlots;0!==n.length?n.includes(t)?this._meshGenerator.addSeparateSlotTexture(t,e):console.warn("Slot "+t+" is not separated. You should use addSeparateSlot to separate it"):console.warn("You need add separate slot")},a.onUpdate=function(t){if(this._skeleton&&this.state){var e=this._state,n=this._skeleton;this.noPause&&e.update(t),e.apply(n),n.updateWorldTransform(),this.updateGeometry()}},a.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},a.updateBounds=function(){var t,n=this.entity.getComponent(e.MeshRenderer).bounds,r=this._tempOffset,a=this._tempSize,i=this._tempArray,s=(null==(t=this.setting)?void 0:t.zSpacing)||.01,o=this._skeleton;o.getBounds(r,a,i);var l=o.drawOrder;n.min.set(r.x,r.y,0),n.max.set(r.x+a.x,r.y+a.y,l.length*s)},a._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=At({},this.setting);t.setting=e},a._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},a.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},n.getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new Yt(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},s(n,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),n}(e.Script);a([e.ignoreClone],Ut.prototype,"_skeletonData",void 0),a([e.ignoreClone],Ut.prototype,"_skeleton",void 0),a([e.ignoreClone],Ut.prototype,"_state",void 0),a([e.ignoreClone],Ut.prototype,"_tempOffset",void 0),a([e.ignoreClone],Ut.prototype,"_tempSize",void 0),a([e.ignoreClone],Ut.prototype,"_tempArray",void 0),a([e.ignoreClone],Ut.prototype,"_meshGenerator",void 0),a([e.ignoreClone],Ut.prototype,"setting",void 0);var Wt=function(t){function n(){return t.call(this,!1)}r(n,t);var a=n.prototype;return a.load=function(t,n){var r=this;return new e.AssetPromise((function(e,a){"spine"!==t.type&&a("Asset type must be spine.");var i=null;t.urls?r.handleResource(n,t,i,e,a):r.request(t.url||"",{type:"json"}).then((function(s){s.jsonUrl&&s.atlasUrl&&s.pngUrl?(i=r.getResouceFromUrls([s.jsonUrl,s.atlasUrl,s.pngUrl],s.pngType),r.handleResource(n,t,i,e,a)):r.handleResource(n,t,i,e,a)})).catch((function(s){r.handleResource(n,t,i,e,a)}))}))},a.handleResource=function(t,n,r,a,i){var s=this,o=t.engine;r||(!n.urls&&n.url&&this.checkUrl(n.url)&&(r=this.getResouceFromUrl(n.url)),n.urls&&this.checkUrls(n.urls)&&(r=this.getResouceFromUrls(n.urls)));var l,h=!1;l=new w(o,null,(function(t){return s.createAdaptiveTexture(t)}));var u=r.skeletonFile,c=r.atlasFile,d=r.textureFile;l.onLoadComplete=function(){try{var t;if(h)t=l.get(c);else{var n=l.get(c);t=new p(n,s.textureAssetPicker.bind(s,l,d))}var r=new N(t),f=(s.isBinFile(u)?new xt(r):new yt(r)).readSkeletonData(l.get(u)),v=new e.Entity(o),g=v.addComponent(e.MeshRenderer),m=Ut.getDefaultMaterial(o);g.setMaterial(m),v.addComponent(Ut).setSkeletonData(f),a(v)}catch(t){i(t)}};var f=this.isBinFile(u);u&&c&&d?(f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadText(c,null,i),l.loadEngineTexture(d,r.textureType,null,i)):u&&c&&!d?(h=!0,f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadTextureAtlas(c,null,i)):i("Resouce param error")},a.textureAssetPicker=function(t,e){return t.get(e)},a.createAdaptiveTexture=function(t){return new qt(t)},a.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},a.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},a.getResouceFromUrl=function(t){var e=t,n=t,r=n.indexOf("?");return r>0&&(n=n.substr(0,r)),{skeletonFile:e,atlasFile:n=n.substr(0,n.lastIndexOf("."))+".atlas"}},a.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),n=e.skeletonFile,r=e.atlasFile;return!(!n||!r)||(console.error("Lack "+(n?"":"skeletonFile")+(r?" atlasFile":"")),!1)},a.getResouceFromUrls=function(t,n){var r,a,i;void 0===n&&(n=e.AssetType.Texture2D);for(var s=n,o=0;o<t.length;++o){var l=t[o],h=this.getExtFromUrl(l);"json"!==h&&"bin"!==h||(r=l),"atlas"===h&&(a=l);["png","jpg","webp","jpeg","ktx2"].includes(h)&&(i=l)}return{skeletonFile:r,atlasFile:a,textureFile:i,textureType:s}},a.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},n}(e.Loader);Wt=a([e.resourceLoader("spine",["json","bin"])],Wt);var qt=function(t){function n(e){var n;return(n=t.call(this,e)||this).texture.generateMipmaps(),n}r(n,t);var a=n.prototype;return a.setFilters=function(t,n){t===h.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:n===h.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear},a.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},a.dispose=function(){},n}(c),Ht=function(t){function n(){var e;return(e=t.apply(this,arguments)||this)._priority=0,e._animationName="",e._loop=!0,e._paused=!1,e._autoPlay=!0,e._skinName="",e._scale=1,e._spineAnimation=null,e._animationNames=[],e._skinNames=[],e}r(n,t);var a=n.prototype;return a.onDestroy=function(){this.resource=null},a.play=function(t,e){void 0===t&&(t=""),void 0===e&&(e=!0);var n=this._animationNames;n.length>0?-1!==n.indexOf(t)&&(this._animationName=t,this._loop=e,this._resource&&this._spineAnimation&&this._spineAnimation.state.setAnimation(0,t,e)):this._animationName=t},a._cloneTo=function(t){t.entity.clearChildren(),t.resource=this.resource},a._removeResource=function(){this._resource&&this._spineAnimation&&(this.entity.removeChild(this._resource),this._resource.destroy(),this._resource=null,this._spineAnimation=null,this._animationName="",this._skinName="")},s(n,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this._priority=t,this._resource&&(this._resource.getComponent(e.MeshRenderer).priority=t))}},{key:"resource",get:function(){return this._resource},set:function(t){var n=this._resource;if(t){if(n!==t){this._removeResource(),this._resource=t.clone(),this._resource.getComponent(e.MeshRenderer).priority=this.priority,this.entity.addChild(this._resource),this._spineAnimation=this._resource.getComponent(Ut),this._spineAnimation.scale=this._scale,this._spineAnimation.noPause=!this._paused;var r=this._spineAnimation.skeletonData,a=r.animations,i=r.skins,s=this._animationNames,o=this._skinNames;s.length=0;for(var l=0,h=a.length;l<h;++l)s.push(a[l].name);o.length=0;for(var u=0,c=i.length;u<c;++u)o.push(i[u].name);this.skinName=this._skinName||o[0],this._autoPlay&&s.length>0&&this.play(this._animationName||s[0],this._loop)}}else this._removeResource()}},{key:"animationName",get:function(){return this._animationName},set:function(t){this._animationName!=t&&(this._animationName=t),this._autoPlay&&this._spineAnimation&&this.play(t,this._loop)}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop!==t&&(this._resource&&this._spineAnimation&&(t?this._autoPlay&&this.play(this._animationName,t):this.play(this._animationName,t)),this._loop=t)}},{key:"paused",get:function(){return this._paused},set:function(t){this._paused!==t&&(this._paused=t,this.spineAnimation&&(this.spineAnimation.noPause=!t))}},{key:"autoPlay",get:function(){return this._autoPlay},set:function(t){this._autoPlay!==t&&(t&&this._resource&&this._spineAnimation&&this.play(this._animationName,this._loop),this._autoPlay=t)}},{key:"skinName",get:function(){return this._skinName},set:function(t){if(this._skinName!==t&&(this._skinName=t,this._spineAnimation)){var e=this._spineAnimation.skeleton;e.setSkinByName(t),e.setSlotsToSetupPose()}}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale!==t&&(this._scale=t,this._spineAnimation&&(this._spineAnimation.scale=t))}},{key:"spineAnimation",get:function(){return this._spineAnimation}}]),n}(e.Script);a([e.ignoreClone],Ht.prototype,"_resource",void 0),a([e.assignmentClone],Ht.prototype,"_animationName",void 0),a([e.assignmentClone],Ht.prototype,"_loop",void 0),a([e.assignmentClone],Ht.prototype,"_paused",void 0),a([e.assignmentClone],Ht.prototype,"_autoPlay",void 0),a([e.assignmentClone],Ht.prototype,"_skinName",void 0),a([e.assignmentClone],Ht.prototype,"_scale",void 0),a([e.ignoreClone],Ht.prototype,"_spineAnimation",void 0),a([e.ignoreClone],Ht.prototype,"_animationNames",void 0),a([e.ignoreClone],Ht.prototype,"_skinNames",void 0);var Gt="1.1.0-test.1";e.Loader.registerClass("SpineRenderer",Ht),console.log("Galacean spine version: "+Gt),t.AssetManager=w,t.AtlasAttachmentLoader=N,t.SkeletonBinary=xt,t.SkeletonJson=yt,t.SpineAnimation=Ut,t.SpineRenderer=Ht,t.Texture=c,t.TextureAtlas=p,t.version=Gt,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@galacean/engine')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@galacean/engine'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Galacean = global.Galacean || {}, global.Galacean.Spine = {}), global.Galacean));
5
+ })(this, (function (exports, engine) { 'use strict';
6
+
7
+ function _set_prototype_of(o, p) {
8
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
9
+ o.__proto__ = p;
10
+
11
+ return o;
12
+ };
13
+
14
+ return _set_prototype_of(o, p);
15
+ }
16
+
17
+ function _inherits(subClass, superClass) {
18
+ if (typeof superClass !== "function" && superClass !== null) {
19
+ throw new TypeError("Super expression must either be null or a function");
20
+ }
21
+
22
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
23
+
24
+ if (superClass) _set_prototype_of(subClass, superClass);
25
+ }
26
+
27
+ /******************************************************************************
28
+ Copyright (c) Microsoft Corporation.
29
+
30
+ Permission to use, copy, modify, and/or distribute this software for any
31
+ purpose with or without fee is hereby granted.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
34
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
35
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
36
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
37
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
+ PERFORMANCE OF THIS SOFTWARE.
40
+ ***************************************************************************** */
41
+
42
+ function __decorate(decorators, target, key, desc) {
43
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
46
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
47
+ }
48
+
49
+ function __generator(thisArg, body) {
50
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
51
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
52
+ function verb(n) { return function (v) { return step([n, v]); }; }
53
+ function step(op) {
54
+ if (f) throw new TypeError("Generator is already executing.");
55
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
56
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
57
+ if (y = 0, t) op = [op[0] & 2, t.value];
58
+ switch (op[0]) {
59
+ case 0: case 1: t = op; break;
60
+ case 4: _.label++; return { value: op[1], done: false };
61
+ case 5: _.label++; y = op[1]; op = [0]; continue;
62
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
63
+ default:
64
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
65
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
66
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
67
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
68
+ if (t[2]) _.ops.pop();
69
+ _.trys.pop(); continue;
70
+ }
71
+ op = body.call(thisArg, _);
72
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
73
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
74
+ }
75
+ }
76
+
77
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
78
+ var e = new Error(message);
79
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
80
+ };
81
+
82
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
83
+ try {
84
+ var info = gen[key](arg);
85
+ var value = info.value;
86
+ } catch (error) {
87
+ reject(error);
88
+ return;
89
+ }
90
+ if (info.done) resolve(value);
91
+ else Promise.resolve(value).then(_next, _throw);
92
+ }
93
+ function _async_to_generator(fn) {
94
+ return function() {
95
+ var self = this, args = arguments;
96
+
97
+ return new Promise(function(resolve, reject) {
98
+ var gen = fn.apply(self, args);
99
+
100
+ function _next(value) {
101
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
102
+ }
103
+
104
+ function _throw(err) {
105
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
106
+ }
107
+
108
+ _next(undefined);
109
+ });
110
+ };
111
+ }
112
+
113
+ function _array_like_to_array(arr, len) {
114
+ if (len == null || len > arr.length) len = arr.length;
115
+
116
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
117
+
118
+ return arr2;
119
+ }
120
+
121
+ function _unsupported_iterable_to_array(o, minLen) {
122
+ if (!o) return;
123
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
124
+
125
+ var n = Object.prototype.toString.call(o).slice(8, -1);
126
+
127
+ if (n === "Object" && o.constructor) n = o.constructor.name;
128
+ if (n === "Map" || n === "Set") return Array.from(n);
129
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
130
+ }
131
+
132
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
133
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
134
+
135
+ if (it) return (it = it.call(o)).next.bind(it);
136
+ // Fallback for engines without symbol support
137
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
138
+ if (it) o = it;
139
+
140
+ var i = 0;
141
+
142
+ return function() {
143
+ if (i >= o.length) return { done: true };
144
+
145
+ return { done: false, value: o[i++] };
146
+ };
147
+ }
148
+
149
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
150
+ }
151
+
152
+ /** @internal */ var LoaderUtils = /*#__PURE__*/ function() {
153
+ function LoaderUtils() {}
154
+ LoaderUtils.loadAtlas = function loadAtlas(atlasPath, extraPaths, resourceManager) {
155
+ return _async_to_generator(function() {
156
+ var text, atlas, virtualResources, imagePaths, _virtualResources_atlasPath, dependencies, baseUrl, imageSources, pagePaths, _iterator, _step, page, textures;
157
+ return __generator(this, function(_state) {
158
+ switch(_state.label){
159
+ case 0:
160
+ return [
161
+ 4,
162
+ resourceManager._request(atlasPath, {
163
+ type: "text"
164
+ })
165
+ ];
166
+ case 1:
167
+ text = _state.sent();
168
+ atlas = LoaderUtils._readAtlas(text);
169
+ virtualResources = resourceManager._virtualPathResourceMap;
170
+ imagePaths = extraPaths.filter(function(url) {
171
+ return /\.(png|jpg|webp|jpeg|ktx|ktx2)$/.test(url.split(/[?#]/, 1)[0]);
172
+ });
173
+ if (extraPaths.length === 0) {
174
+ dependencies = (_virtualResources_atlasPath = virtualResources[atlasPath]) == null ? void 0 : _virtualResources_atlasPath.dependentAssetMap;
175
+ if (dependencies) imagePaths = Object.values(dependencies);
176
+ }
177
+ if (imagePaths.length === 0) {
178
+ baseUrl = LoaderUtils.getBaseUrl(atlasPath);
179
+ imagePaths = atlas.pages.map(function(page) {
180
+ return baseUrl + page.name;
181
+ });
182
+ }
183
+ imageSources = imagePaths.map(function(url) {
184
+ return {
185
+ url: url,
186
+ path: url.split(/[?#]/, 1)[0]
187
+ };
188
+ });
189
+ pagePaths = atlas.pages.map(function(page, index) {
190
+ var _this;
191
+ var source = imageSources.find(function(param) {
192
+ var path = param.path;
193
+ return path === page.name || path.endsWith("/" + page.name);
194
+ });
195
+ // Renamed replacement images and exported dependencies can be supplied in atlas page order.
196
+ var url = (_this = source != null ? source : imageSources[index]) == null ? void 0 : _this.url;
197
+ if (!url) throw new Error('Spine atlas page "' + page.name + '" has no texture.');
198
+ return url;
199
+ });
200
+ for(_iterator = _create_for_of_iterator_helper_loose(atlas.pages); !(_step = _iterator()).done;){
201
+ page = _step.value;
202
+ if (page.pma) {
203
+ throw new Error('Spine atlas page "' + page.name + '" uses premultiplied alpha, which is not supported by the linear rendering workflow. ' + 'Re-export with "Premultiply alpha" disabled and "Bleed" enabled.');
204
+ }
205
+ }
206
+ return [
207
+ 4,
208
+ Promise.all(pagePaths.map(/*#__PURE__*/ _async_to_generator(function(url, index) {
209
+ var _exec, _virtualResources_url, extension, _virtualResources_url_type, type, texture;
210
+ return __generator(this, function(_state) {
211
+ switch(_state.label){
212
+ case 0:
213
+ extension = (_exec = /\.(\w+)$/.exec(url.split(/[?#]/, 1)[0])) == null ? void 0 : _exec[1];
214
+ type = (_virtualResources_url_type = (_virtualResources_url = virtualResources[url]) == null ? void 0 : _virtualResources_url.type) != null ? _virtualResources_url_type : extension === "ktx" ? engine.AssetType.KTX : extension === "ktx2" ? engine.AssetType.KTX2 : engine.AssetType.Texture;
215
+ return [
216
+ 4,
217
+ resourceManager.load({
218
+ url: url,
219
+ type: type
220
+ })
221
+ ];
222
+ case 1:
223
+ texture = _state.sent();
224
+ if (!texture.isSRGBColorSpace) {
225
+ throw new Error('Spine atlas page "' + atlas.pages[index].name + '" requires an sRGB texture. ' + "Set isSRGBColorSpace=true before its first load, or enable sRGB in the exported texture.");
226
+ }
227
+ return [
228
+ 2,
229
+ texture
230
+ ];
231
+ }
232
+ });
233
+ })))
234
+ ];
235
+ case 2:
236
+ textures = _state.sent();
237
+ return [
238
+ 2,
239
+ {
240
+ text: atlas.text,
241
+ textures: textures
242
+ }
243
+ ];
244
+ }
245
+ });
246
+ })();
247
+ };
248
+ /** Atlas pages begin a block; regions and their properties remain in the same block. */ LoaderUtils.readAtlasPageNames = function readAtlasPageNames(text) {
249
+ return LoaderUtils._readAtlas(text).pages.map(function(page) {
250
+ return page.name;
251
+ });
252
+ };
253
+ LoaderUtils._readAtlas = function _readAtlas(text) {
254
+ var pages = [];
255
+ var lines = [];
256
+ var pageStart = true;
257
+ var pageHeader = false;
258
+ for(var _iterator = _create_for_of_iterator_helper_loose(text.split(/\r?\n/)), _step; !(_step = _iterator()).done;){
259
+ var line = _step.value;
260
+ var value = line.trim();
261
+ if (!value) {
262
+ pageStart = true;
263
+ pageHeader = false;
264
+ } else if (pageStart) {
265
+ if (!value.includes(":")) {
266
+ pages.push({
267
+ name: value,
268
+ pma: false
269
+ });
270
+ pageStart = false;
271
+ pageHeader = true;
272
+ }
273
+ } else if (pageHeader) {
274
+ var separator = value.indexOf(":");
275
+ if (separator < 0) {
276
+ pageHeader = false;
277
+ } else if (value.substring(0, separator).trim() === "pma") {
278
+ pages[pages.length - 1].pma = value.substring(separator + 1).trim() === "true";
279
+ continue;
280
+ }
281
+ }
282
+ lines.push(line);
283
+ }
284
+ return {
285
+ pages: pages,
286
+ text: lines.join("\n")
287
+ };
288
+ };
289
+ LoaderUtils.getBaseUrl = function getBaseUrl(url) {
290
+ var isLocalPath = !/^(http|https|ftp):\/\/.*/i.test(url);
291
+ if (isLocalPath) {
292
+ var lastSlashIndex = url.lastIndexOf("/");
293
+ if (lastSlashIndex === -1) {
294
+ return "";
295
+ }
296
+ return url.substring(0, lastSlashIndex + 1);
297
+ } else {
298
+ var parsedUrl = new URL(url);
299
+ var basePath = parsedUrl.origin + parsedUrl.pathname;
300
+ return basePath.endsWith("/") ? basePath : basePath.substring(0, basePath.lastIndexOf("/") + 1);
301
+ }
302
+ };
303
+ return LoaderUtils;
304
+ }();
305
+
306
+ /** Read only the export header, before selecting or invoking a version-specific parser. */ function readSpineVersion(data) {
307
+ var _readString, _readString1;
308
+ if (typeof data === "string") {
309
+ var _JSON_parse_skeleton;
310
+ var version = (_JSON_parse_skeleton = JSON.parse(data).skeleton) == null ? void 0 : _JSON_parse_skeleton.spine;
311
+ if (typeof version === "string" && /^\d+\.\d+(?:\.|$)/.test(version)) return version;
312
+ throw new Error("Spine JSON is missing a valid skeleton.spine export version.");
313
+ }
314
+ var bytes = new Uint8Array(data);
315
+ function readString(offset) {
316
+ var count = 0;
317
+ for(var shift = 0; shift < 35; shift += 7){
318
+ if (offset >= bytes.length) return null;
319
+ var byte = bytes[offset++];
320
+ count += (byte & 127) * Math.pow(2, shift);
321
+ if ((byte & 128) === 0) {
322
+ var end = offset + Math.max(0, count - 1);
323
+ if (end > bytes.length) return null;
324
+ return {
325
+ value: new TextDecoder().decode(bytes.subarray(offset, end)),
326
+ end: end
327
+ };
328
+ }
329
+ }
330
+ return null;
331
+ }
332
+ // 3.x stores the hash as a length-prefixed string. 4.x stores an eight-byte hash.
333
+ var hash = readString(0);
334
+ var oldVersion = hash && ((_readString = readString(hash.end)) == null ? void 0 : _readString.value);
335
+ var newVersion = (_readString1 = readString(8)) == null ? void 0 : _readString1.value;
336
+ var candidates = [
337
+ oldVersion && /^3\.\d+\.\d+$/.test(oldVersion) ? oldVersion : null,
338
+ newVersion && /^4\.\d+\.\d+$/.test(newVersion) ? newVersion : null
339
+ ].filter(Boolean);
340
+ if (candidates.length !== 1) {
341
+ throw new Error("Cannot determine Spine binary export version: invalid or ambiguous header.");
342
+ }
343
+ return candidates[0];
344
+ }
345
+
346
+ function _defineProperties(target, props) {
347
+ for (var i = 0; i < props.length; i++) {
348
+ var descriptor = props[i];
349
+ descriptor.enumerable = descriptor.enumerable || false;
350
+ descriptor.configurable = true;
351
+
352
+ if ("value" in descriptor) descriptor.writable = true;
353
+
354
+ Object.defineProperty(target, descriptor.key, descriptor);
355
+ }
356
+ }
357
+ function _create_class(Constructor, protoProps, staticProps) {
358
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
359
+ if (staticProps) _defineProperties(Constructor, staticProps);
360
+
361
+ return Constructor;
362
+ }
363
+
364
+ /** A shared skin belonging to one Spine resource. Create composite skins with SpineResource.createSkin. */ var SpineSkin = /*#__PURE__*/ function() {
365
+ function SpineSkin(native, owner) {
366
+ this._native = native;
367
+ this._owner = owner;
368
+ }
369
+ var _proto = SpineSkin.prototype;
370
+ /** Add all attachments and required bones/constraints from another skin of this resource. */ _proto.addSkin = function addSkin(skin) {
371
+ if (skin._owner !== this._owner) throw new Error("Cannot combine skins from different Spine resources.");
372
+ this._native.addSkin(skin._native);
373
+ };
374
+ /** @internal */ SpineSkin._create = function _create(native, owner) {
375
+ return new SpineSkin(native, owner);
376
+ };
377
+ _create_class(SpineSkin, [
378
+ {
379
+ key: "name",
380
+ get: function get() {
381
+ return this._native.name;
382
+ }
383
+ }
384
+ ]);
385
+ return SpineSkin;
386
+ }();
387
+
388
+ /** Shared asset metadata, animations and skins. Instances retain the same data object. */ var SpineSkeletonData = /*#__PURE__*/ function() {
389
+ function SpineSkeletonData(native) {
390
+ var _this = this;
391
+ this._skins = new WeakMap();
392
+ this._native = native;
393
+ this.animations = Object.freeze(native.animations.map(function(param) {
394
+ var name = param.name, duration = param.duration;
395
+ return Object.freeze({
396
+ name: name,
397
+ duration: duration
398
+ });
399
+ }));
400
+ this.skins = Object.freeze(native.skins.map(function(skin) {
401
+ return _this._wrapSkin(skin);
402
+ }));
403
+ }
404
+ var _proto = SpineSkeletonData.prototype;
405
+ _proto.findSkin = function findSkin(name) {
406
+ return this._wrapSkin(this._native.findSkin(name));
407
+ };
408
+ _proto.findAnimation = function findAnimation(name) {
409
+ var _this_animations_find;
410
+ return (_this_animations_find = this.animations.find(function(animation) {
411
+ return animation.name === name;
412
+ })) != null ? _this_animations_find : null;
413
+ };
414
+ /** @internal */ _proto._wrapSkin = function _wrapSkin(native) {
415
+ if (!native) return null;
416
+ var skin = this._skins.get(native);
417
+ if (!skin) {
418
+ skin = SpineSkin._create(native, this);
419
+ this._skins.set(native, skin);
420
+ }
421
+ return skin;
422
+ };
423
+ /** @internal */ SpineSkeletonData._create = function _create(native) {
424
+ return new SpineSkeletonData(native);
425
+ };
426
+ _create_class(SpineSkeletonData, [
427
+ {
428
+ key: "name",
429
+ get: function get() {
430
+ var _this__native_name;
431
+ return (_this__native_name = this._native.name) != null ? _this__native_name : null;
432
+ }
433
+ },
434
+ {
435
+ key: "version",
436
+ get: function get() {
437
+ var _this__native_version;
438
+ return (_this__native_version = this._native.version) != null ? _this__native_version : null;
439
+ }
440
+ },
441
+ {
442
+ key: "x",
443
+ get: function get() {
444
+ return this._native.x;
445
+ }
446
+ },
447
+ {
448
+ key: "y",
449
+ get: function get() {
450
+ return this._native.y;
451
+ }
452
+ },
453
+ {
454
+ key: "width",
455
+ get: function get() {
456
+ return this._native.width;
457
+ }
458
+ },
459
+ {
460
+ key: "height",
461
+ get: function get() {
462
+ return this._native.height;
463
+ }
464
+ },
465
+ {
466
+ key: "defaultSkin",
467
+ get: function get() {
468
+ return this._wrapSkin(this._native.defaultSkin);
469
+ }
470
+ }
471
+ ]);
472
+ return SpineSkeletonData;
473
+ }();
474
+
475
+ /** Mixing configuration shared by all instances of a resource. */ var SpineAnimationStateData = /*#__PURE__*/ function() {
476
+ function SpineAnimationStateData(native, data) {
477
+ this._native = native;
478
+ this.skeletonData = data;
479
+ }
480
+ var _proto = SpineAnimationStateData.prototype;
481
+ /** Set the transition duration between two named animations. */ _proto.setMix = function setMix(from, to, duration) {
482
+ this._native.setMix(from, to, duration);
483
+ };
484
+ /** @internal */ SpineAnimationStateData._create = function _create(native, data) {
485
+ return new SpineAnimationStateData(native, data);
486
+ };
487
+ _create_class(SpineAnimationStateData, [
488
+ {
489
+ key: "defaultMix",
490
+ get: function get() {
491
+ return this._native.defaultMix;
492
+ },
493
+ set: function set(value) {
494
+ this._native.defaultMix = value;
495
+ }
496
+ }
497
+ ]);
498
+ return SpineAnimationStateData;
499
+ }();
500
+
501
+ function _instanceof(left, right) {
502
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
503
+ return !!right[Symbol.hasInstance](left);
504
+ } else return left instanceof right;
505
+ }
506
+
507
+ /** A bone's local pose and evaluated world transform, owned by one skeleton instance. */ var SpineBone = /*#__PURE__*/ function() {
508
+ function SpineBone(_native) {
509
+ this._native = _native;
510
+ }
511
+ var _proto = SpineBone.prototype;
512
+ _proto.isActive = function isActive() {
513
+ return this._native.isActive();
514
+ };
515
+ _proto.setToSetupPose = function setToSetupPose() {
516
+ this._native.setToSetupPose();
517
+ };
518
+ /** @internal */ SpineBone._create = function _create(native) {
519
+ return new SpineBone(native);
520
+ };
521
+ _create_class(SpineBone, [
522
+ {
523
+ key: "name",
524
+ get: function get() {
525
+ return this._native.data.name;
526
+ }
527
+ },
528
+ {
529
+ key: "x",
530
+ get: function get() {
531
+ return this._native.x;
532
+ },
533
+ set: function set(value) {
534
+ this._native.x = value;
535
+ }
536
+ },
537
+ {
538
+ key: "y",
539
+ get: function get() {
540
+ return this._native.y;
541
+ },
542
+ set: function set(value) {
543
+ this._native.y = value;
544
+ }
545
+ },
546
+ {
547
+ key: "rotation",
548
+ get: function get() {
549
+ return this._native.rotation;
550
+ },
551
+ set: function set(value) {
552
+ this._native.rotation = value;
553
+ }
554
+ },
555
+ {
556
+ key: "scaleX",
557
+ get: function get() {
558
+ return this._native.scaleX;
559
+ },
560
+ set: function set(value) {
561
+ this._native.scaleX = value;
562
+ }
563
+ },
564
+ {
565
+ key: "scaleY",
566
+ get: function get() {
567
+ return this._native.scaleY;
568
+ },
569
+ set: function set(value) {
570
+ this._native.scaleY = value;
571
+ }
572
+ },
573
+ {
574
+ key: "shearX",
575
+ get: function get() {
576
+ return this._native.shearX;
577
+ },
578
+ set: function set(value) {
579
+ this._native.shearX = value;
580
+ }
581
+ },
582
+ {
583
+ key: "shearY",
584
+ get: function get() {
585
+ return this._native.shearY;
586
+ },
587
+ set: function set(value) {
588
+ this._native.shearY = value;
589
+ }
590
+ },
591
+ {
592
+ key: "a",
593
+ get: function get() {
594
+ return this._native.a;
595
+ }
596
+ },
597
+ {
598
+ key: "b",
599
+ get: function get() {
600
+ return this._native.b;
601
+ }
602
+ },
603
+ {
604
+ key: "c",
605
+ get: function get() {
606
+ return this._native.c;
607
+ }
608
+ },
609
+ {
610
+ key: "d",
611
+ get: function get() {
612
+ return this._native.d;
613
+ }
614
+ },
615
+ {
616
+ key: "worldX",
617
+ get: function get() {
618
+ return this._native.worldX;
619
+ }
620
+ },
621
+ {
622
+ key: "worldY",
623
+ get: function get() {
624
+ return this._native.worldY;
625
+ }
626
+ }
627
+ ]);
628
+ return SpineBone;
629
+ }();
630
+
631
+ /** An attachment slot owned by one skeleton instance. */ var SpineSlot = /*#__PURE__*/ function() {
632
+ function SpineSlot(_native, _skeleton, bone) {
633
+ this._native = _native;
634
+ this._skeleton = _skeleton;
635
+ this.bone = bone;
636
+ }
637
+ var _proto = SpineSlot.prototype;
638
+ /** Select an attachment by its skin entry name, or clear the slot with null. */ _proto.setAttachment = function setAttachment(name) {
639
+ this._skeleton.setAttachment(this.name, name);
640
+ };
641
+ /** Restore the setup color and attachment, using the current skin. */ _proto.setToSetupPose = function setToSetupPose() {
642
+ this._native.setToSetupPose();
643
+ };
644
+ /** @internal */ SpineSlot._create = function _create(native, skeleton, bone) {
645
+ return new SpineSlot(native, skeleton, bone);
646
+ };
647
+ _create_class(SpineSlot, [
648
+ {
649
+ key: "name",
650
+ get: function get() {
651
+ return this._native.data.name;
652
+ }
653
+ }
654
+ ]);
655
+ return SpineSlot;
656
+ }();
657
+
658
+ /** The editable pose of one renderer. Bone and slot wrappers are created once and reused. */ var SpineSkeleton = /*#__PURE__*/ function() {
659
+ function SpineSkeleton(_native, data) {
660
+ var _this = this;
661
+ this._native = _native;
662
+ this.data = data;
663
+ this.bones = Object.freeze(_native.bones.map(function(bone) {
664
+ return SpineBone._create(bone);
665
+ }));
666
+ var bones = new Map(_native.bones.map(function(bone, index) {
667
+ return [
668
+ bone,
669
+ _this.bones[index]
670
+ ];
671
+ }));
672
+ this.slots = Object.freeze(_native.slots.map(function(slot) {
673
+ return SpineSlot._create(slot, _native, bones.get(slot.bone));
674
+ }));
675
+ }
676
+ var _proto = SpineSkeleton.prototype;
677
+ _proto.findBone = function findBone(name) {
678
+ var _this_bones_find;
679
+ return (_this_bones_find = this.bones.find(function(bone) {
680
+ return bone.name === name;
681
+ })) != null ? _this_bones_find : null;
682
+ };
683
+ _proto.findSlot = function findSlot(name) {
684
+ var _this_slots_find;
685
+ return (_this_slots_find = this.slots.find(function(slot) {
686
+ return slot.name === name;
687
+ })) != null ? _this_slots_find : null;
688
+ };
689
+ _proto.setSkinByName = function setSkinByName(name) {
690
+ this._native.setSkinByName(name);
691
+ };
692
+ /** Assign a skin from this resource, or clear the current skin. */ _proto.setSkin = function setSkin(skin) {
693
+ if (skin && skin._owner !== this.data) throw new Error("Cannot assign a skin from another Spine resource.");
694
+ var _skin__native;
695
+ this._native.setSkin((_skin__native = skin == null ? void 0 : skin._native) != null ? _skin__native : null);
696
+ };
697
+ _proto.setAttachment = function setAttachment(slotName, attachmentName) {
698
+ this._native.setAttachment(slotName, attachmentName);
699
+ };
700
+ _proto.setToSetupPose = function setToSetupPose() {
701
+ this._native.setToSetupPose();
702
+ };
703
+ _proto.setBonesToSetupPose = function setBonesToSetupPose() {
704
+ this._native.setBonesToSetupPose();
705
+ };
706
+ _proto.setSlotsToSetupPose = function setSlotsToSetupPose() {
707
+ this._native.setSlotsToSetupPose();
708
+ };
709
+ /** @internal */ SpineSkeleton._create = function _create(native, data) {
710
+ return new SpineSkeleton(native, data);
711
+ };
712
+ _create_class(SpineSkeleton, [
713
+ {
714
+ key: "x",
715
+ get: function get() {
716
+ return this._native.x;
717
+ },
718
+ set: function set(value) {
719
+ this._native.x = value;
720
+ }
721
+ },
722
+ {
723
+ key: "y",
724
+ get: function get() {
725
+ return this._native.y;
726
+ },
727
+ set: function set(value) {
728
+ this._native.y = value;
729
+ }
730
+ },
731
+ {
732
+ key: "scaleX",
733
+ get: function get() {
734
+ return this._native.scaleX;
735
+ },
736
+ set: function set(value) {
737
+ this._native.scaleX = value;
738
+ }
739
+ },
740
+ {
741
+ key: "scaleY",
742
+ get: function get() {
743
+ return this._native.scaleY;
744
+ },
745
+ set: function set(value) {
746
+ this._native.scaleY = value;
747
+ }
748
+ },
749
+ {
750
+ key: "skin",
751
+ get: function get() {
752
+ return this.data._wrapSkin(this._native.skin);
753
+ }
754
+ }
755
+ ]);
756
+ return SpineSkeleton;
757
+ }();
758
+
759
+ /**
760
+ * One playback entry. Valid through its dispose callbacks.
761
+ * After disposal, accessing playback properties throws even if the backend reuses its pooled entry.
762
+ */ var SpineTrackEntry = /*#__PURE__*/ function() {
763
+ function SpineTrackEntry(_native, _state) {
764
+ this._native = _native;
765
+ this._state = _state;
766
+ this._listener = null;
767
+ var animation = _native.animation;
768
+ var _state_data_skeletonData_findAnimation;
769
+ this._animation = animation ? (_state_data_skeletonData_findAnimation = _state.data.skeletonData.findAnimation(animation.name)) != null ? _state_data_skeletonData_findAnimation : Object.freeze({
770
+ name: animation.name,
771
+ duration: animation.duration
772
+ }) : null;
773
+ }
774
+ var _proto = SpineTrackEntry.prototype;
775
+ _proto.getAnimationTime = function getAnimationTime() {
776
+ return this._requireNative().getAnimationTime();
777
+ };
778
+ _proto.isComplete = function isComplete() {
779
+ return this._requireNative().isComplete();
780
+ };
781
+ /** @internal */ _proto._invalidate = function _invalidate() {
782
+ this._native = null;
783
+ this._state = null;
784
+ this._listener = null;
785
+ };
786
+ _proto._requireNative = function _requireNative() {
787
+ if (!this._native) throw new Error("This Spine track entry has been disposed.");
788
+ return this._native;
789
+ };
790
+ /** @internal */ SpineTrackEntry._create = function _create(native, state) {
791
+ return new SpineTrackEntry(native, state);
792
+ };
793
+ _create_class(SpineTrackEntry, [
794
+ {
795
+ key: "disposed",
796
+ get: function get() {
797
+ return this._native === null;
798
+ }
799
+ },
800
+ {
801
+ key: "animation",
802
+ get: function get() {
803
+ this._requireNative();
804
+ return this._animation;
805
+ }
806
+ },
807
+ {
808
+ key: "trackIndex",
809
+ get: function get() {
810
+ return this._requireNative().trackIndex;
811
+ }
812
+ },
813
+ {
814
+ key: "next",
815
+ get: function get() {
816
+ return this._state._wrap(this._requireNative().next);
817
+ }
818
+ },
819
+ {
820
+ key: "mixingFrom",
821
+ get: function get() {
822
+ return this._state._wrap(this._requireNative().mixingFrom);
823
+ }
824
+ },
825
+ {
826
+ key: "mixingTo",
827
+ get: function get() {
828
+ return this._state._wrap(this._requireNative().mixingTo);
829
+ }
830
+ },
831
+ {
832
+ key: "listener",
833
+ get: function get() {
834
+ this._requireNative();
835
+ return this._listener;
836
+ },
837
+ set: function set(value) {
838
+ this._requireNative().listener = value ? this._state._relay(value) : null;
839
+ this._listener = value;
840
+ }
841
+ },
842
+ {
843
+ key: "loop",
844
+ get: function get() {
845
+ return this._requireNative().loop;
846
+ },
847
+ set: function set(value) {
848
+ this._requireNative().loop = value;
849
+ }
850
+ },
851
+ {
852
+ key: "delay",
853
+ get: function get() {
854
+ return this._requireNative().delay;
855
+ },
856
+ set: function set(value) {
857
+ this._requireNative().delay = value;
858
+ }
859
+ },
860
+ {
861
+ key: "trackTime",
862
+ get: function get() {
863
+ return this._requireNative().trackTime;
864
+ },
865
+ set: function set(value) {
866
+ this._requireNative().trackTime = value;
867
+ }
868
+ },
869
+ {
870
+ key: "trackEnd",
871
+ get: function get() {
872
+ return this._requireNative().trackEnd;
873
+ },
874
+ set: function set(value) {
875
+ this._requireNative().trackEnd = value;
876
+ }
877
+ },
878
+ {
879
+ key: "timeScale",
880
+ get: function get() {
881
+ return this._requireNative().timeScale;
882
+ },
883
+ set: function set(value) {
884
+ this._requireNative().timeScale = value;
885
+ }
886
+ },
887
+ {
888
+ key: "alpha",
889
+ get: function get() {
890
+ return this._requireNative().alpha;
891
+ },
892
+ set: function set(value) {
893
+ this._requireNative().alpha = value;
894
+ }
895
+ },
896
+ {
897
+ key: "animationStart",
898
+ get: function get() {
899
+ return this._requireNative().animationStart;
900
+ },
901
+ set: function set(value) {
902
+ this._requireNative().animationStart = value;
903
+ }
904
+ },
905
+ {
906
+ key: "animationEnd",
907
+ get: function get() {
908
+ return this._requireNative().animationEnd;
909
+ },
910
+ set: function set(value) {
911
+ this._requireNative().animationEnd = value;
912
+ }
913
+ },
914
+ {
915
+ key: "mixTime",
916
+ get: function get() {
917
+ return this._requireNative().mixTime;
918
+ },
919
+ set: function set(value) {
920
+ this._requireNative().mixTime = value;
921
+ }
922
+ },
923
+ {
924
+ key: "mixDuration",
925
+ get: function get() {
926
+ return this._requireNative().mixDuration;
927
+ },
928
+ set: function set(value) {
929
+ this._requireNative().mixDuration = value;
930
+ }
931
+ }
932
+ ]);
933
+ return SpineTrackEntry;
934
+ }();
935
+
936
+ /** Playback controls for one renderer. Entries and callback arguments have stable public identities. */ var SpineAnimationState = /*#__PURE__*/ function() {
937
+ function SpineAnimationState(_native, data, _runtime) {
938
+ var _this = this;
939
+ this._native = _native;
940
+ this._runtime = _runtime;
941
+ this._entries = new WeakMap();
942
+ this._listeners = new Set();
943
+ this._operationDepth = 0;
944
+ this._disposed = false;
945
+ this.data = data;
946
+ _native.addListener({
947
+ start: function(entry) {
948
+ return _this._dispatch("start", entry);
949
+ },
950
+ interrupt: function(entry) {
951
+ return _this._dispatch("interrupt", entry);
952
+ },
953
+ end: function(entry) {
954
+ return _this._dispatch("end", entry);
955
+ },
956
+ complete: function(entry) {
957
+ return _this._dispatch("complete", entry);
958
+ },
959
+ dispose: function(native) {
960
+ var entry = _this._wrap(native);
961
+ _this._dispatch("dispose", native);
962
+ entry._invalidate();
963
+ _this._entries.delete(native);
964
+ },
965
+ event: function(native, event) {
966
+ if (!_this._listeners.size) return;
967
+ var entry = _this._wrap(native);
968
+ var snapshot = _this._event(event);
969
+ for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(_this._listeners)), _step; !(_step = _iterator()).done;){
970
+ var listener = _step.value;
971
+ listener.event == null ? void 0 : listener.event.call(listener, entry, snapshot);
972
+ }
973
+ }
974
+ });
975
+ }
976
+ var _proto = SpineAnimationState.prototype;
977
+ _proto.setAnimation = function setAnimation(track, name, loop) {
978
+ var _this = this;
979
+ this._validateTrack(track);
980
+ if (!this.data.skeletonData.findAnimation(name)) throw new Error("Animation not found: " + name);
981
+ return this._command(function() {
982
+ return _this._wrap(_this._native.setAnimation(track, name, loop));
983
+ });
984
+ };
985
+ _proto.addAnimation = function addAnimation(track, name, loop, delay) {
986
+ var _this = this;
987
+ this._validateTrack(track);
988
+ if (!this.data.skeletonData.findAnimation(name)) throw new Error("Animation not found: " + name);
989
+ return this._command(function() {
990
+ return _this._wrap(_this._native.addAnimation(track, name, loop, delay));
991
+ });
992
+ };
993
+ _proto.setEmptyAnimation = function setEmptyAnimation(track, mixDuration) {
994
+ var _this = this;
995
+ this._validateTrack(track);
996
+ return this._command(function() {
997
+ return _this._wrap(_this._native.setEmptyAnimation(track, mixDuration));
998
+ });
999
+ };
1000
+ _proto.addEmptyAnimation = function addEmptyAnimation(track, mixDuration, delay) {
1001
+ var _this = this;
1002
+ this._validateTrack(track);
1003
+ return this._command(function() {
1004
+ return _this._wrap(_this._native.addEmptyAnimation(track, mixDuration, delay));
1005
+ });
1006
+ };
1007
+ _proto.setEmptyAnimations = function setEmptyAnimations(mixDuration) {
1008
+ var _this = this;
1009
+ this._command(function() {
1010
+ return _this._native.setEmptyAnimations(mixDuration);
1011
+ });
1012
+ };
1013
+ _proto.getCurrent = function getCurrent(track) {
1014
+ this._validateTrack(track);
1015
+ return this._wrap(this._native.getCurrent(track));
1016
+ };
1017
+ _proto.clearTrack = function clearTrack(track) {
1018
+ var _this = this;
1019
+ this._validateTrack(track);
1020
+ this._command(function() {
1021
+ return _this._native.clearTrack(track);
1022
+ });
1023
+ };
1024
+ _proto.clearTracks = function clearTracks() {
1025
+ var _this = this;
1026
+ this._command(function() {
1027
+ return _this._native.clearTracks();
1028
+ });
1029
+ };
1030
+ _proto.addListener = function addListener(listener) {
1031
+ this._listeners.add(listener);
1032
+ };
1033
+ _proto.removeListener = function removeListener(listener) {
1034
+ this._listeners.delete(listener);
1035
+ };
1036
+ _proto.clearListeners = function clearListeners() {
1037
+ this._listeners.clear();
1038
+ };
1039
+ /** @internal */ _proto._wrap = function _wrap(native) {
1040
+ if (!native) return null;
1041
+ var entry = this._entries.get(native);
1042
+ if (!entry) {
1043
+ entry = SpineTrackEntry._create(native, this);
1044
+ this._entries.set(native, entry);
1045
+ }
1046
+ return entry;
1047
+ };
1048
+ /** @internal */ _proto._relay = function _relay(listener) {
1049
+ var _this = this;
1050
+ return {
1051
+ start: function(entry) {
1052
+ return listener.start == null ? void 0 : listener.start.call(listener, _this._wrap(entry));
1053
+ },
1054
+ interrupt: function(entry) {
1055
+ return listener.interrupt == null ? void 0 : listener.interrupt.call(listener, _this._wrap(entry));
1056
+ },
1057
+ end: function(entry) {
1058
+ return listener.end == null ? void 0 : listener.end.call(listener, _this._wrap(entry));
1059
+ },
1060
+ dispose: function(entry) {
1061
+ return listener.dispose == null ? void 0 : listener.dispose.call(listener, _this._wrap(entry));
1062
+ },
1063
+ complete: function(entry) {
1064
+ return listener.complete == null ? void 0 : listener.complete.call(listener, _this._wrap(entry));
1065
+ },
1066
+ event: function(entry, event) {
1067
+ return listener.event == null ? void 0 : listener.event.call(listener, _this._wrap(entry), _this._event(event));
1068
+ }
1069
+ };
1070
+ };
1071
+ /** @internal */ _proto._dispose = function _dispose() {
1072
+ if (this._disposed) return;
1073
+ this._disposed = true;
1074
+ this._operationDepth++;
1075
+ this._native.clearTracks();
1076
+ this._endOperation();
1077
+ };
1078
+ /** @internal */ _proto._advance = function _advance(skeleton, delta) {
1079
+ this._operationDepth++;
1080
+ this._runtime.advanceState(skeleton, this._native, delta);
1081
+ this._endOperation();
1082
+ };
1083
+ /** @internal */ _proto._apply = function _apply(skeleton) {
1084
+ this._operationDepth++;
1085
+ this._runtime.applyState(skeleton, this._native);
1086
+ this._endOperation();
1087
+ };
1088
+ _proto._validateTrack = function _validateTrack(track) {
1089
+ if (!Number.isInteger(track) || track < 0) throw new Error("Spine track index must be a non-negative integer.");
1090
+ };
1091
+ _proto._command = function _command(command) {
1092
+ if (this._disposed) throw new Error("This Spine animation state has been disposed.");
1093
+ this._operationDepth++;
1094
+ // Bind returned entries before callbacks can release them or recycle their native objects.
1095
+ var result = this._runtime.batchAnimationStateEvents(this._native, command);
1096
+ this._endOperation();
1097
+ return result;
1098
+ };
1099
+ _proto._endOperation = function _endOperation() {
1100
+ if (--this._operationDepth === 0 && this._disposed) {
1101
+ // A clearTracks called from a callback only queues disposal. Keep the bridge until dispatch finishes.
1102
+ this._native.clearListeners();
1103
+ this._listeners.clear();
1104
+ }
1105
+ };
1106
+ _proto._dispatch = function _dispatch(event, native) {
1107
+ var _listener_event;
1108
+ if (!this._listeners.size) return;
1109
+ var entry = this._wrap(native);
1110
+ for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(this._listeners)), _step; !(_step = _iterator()).done;){
1111
+ var listener = _step.value;
1112
+ (_listener_event = listener[event]) == null ? void 0 : _listener_event.call(listener, entry);
1113
+ }
1114
+ };
1115
+ _proto._event = function _event(event) {
1116
+ return Object.freeze({
1117
+ data: Object.freeze({
1118
+ name: event.data.name
1119
+ }),
1120
+ time: event.time,
1121
+ intValue: event.intValue,
1122
+ floatValue: event.floatValue,
1123
+ stringValue: event.stringValue
1124
+ });
1125
+ };
1126
+ /** @internal */ SpineAnimationState._create = function _create(native, data, runtime) {
1127
+ return new SpineAnimationState(native, data, runtime);
1128
+ };
1129
+ _create_class(SpineAnimationState, [
1130
+ {
1131
+ key: "timeScale",
1132
+ get: function get() {
1133
+ return this._native.timeScale;
1134
+ },
1135
+ set: function set(value) {
1136
+ this._native.timeScale = value;
1137
+ }
1138
+ }
1139
+ ]);
1140
+ return SpineAnimationState;
1141
+ }();
1142
+
1143
+ /** An instance's physics constraint. Changes affect only this skeleton. */ var SpinePhysicsConstraint = /*#__PURE__*/ function() {
1144
+ function SpinePhysicsConstraint(_native) {
1145
+ this._native = _native;
1146
+ }
1147
+ var _proto = SpinePhysicsConstraint.prototype;
1148
+ _proto.isActive = function isActive() {
1149
+ return this._native.isActive();
1150
+ };
1151
+ _proto.reset = function reset() {
1152
+ this._native.reset();
1153
+ };
1154
+ /** @internal */ SpinePhysicsConstraint._create = function _create(native) {
1155
+ return new SpinePhysicsConstraint(native);
1156
+ };
1157
+ _create_class(SpinePhysicsConstraint, [
1158
+ {
1159
+ key: "name",
1160
+ get: function get() {
1161
+ return this._native.data.name;
1162
+ }
1163
+ },
1164
+ {
1165
+ key: "inertia",
1166
+ get: function get() {
1167
+ return this._native.inertia;
1168
+ },
1169
+ set: function set(value) {
1170
+ this._native.inertia = value;
1171
+ }
1172
+ },
1173
+ {
1174
+ key: "strength",
1175
+ get: function get() {
1176
+ return this._native.strength;
1177
+ },
1178
+ set: function set(value) {
1179
+ this._native.strength = value;
1180
+ }
1181
+ },
1182
+ {
1183
+ key: "damping",
1184
+ get: function get() {
1185
+ return this._native.damping;
1186
+ },
1187
+ set: function set(value) {
1188
+ this._native.damping = value;
1189
+ }
1190
+ },
1191
+ {
1192
+ key: "massInverse",
1193
+ get: function get() {
1194
+ return this._native.massInverse;
1195
+ },
1196
+ set: function set(value) {
1197
+ this._native.massInverse = value;
1198
+ }
1199
+ },
1200
+ {
1201
+ key: "wind",
1202
+ get: function get() {
1203
+ return this._native.wind;
1204
+ },
1205
+ set: function set(value) {
1206
+ this._native.wind = value;
1207
+ }
1208
+ },
1209
+ {
1210
+ key: "gravity",
1211
+ get: function get() {
1212
+ return this._native.gravity;
1213
+ },
1214
+ set: function set(value) {
1215
+ this._native.gravity = value;
1216
+ }
1217
+ },
1218
+ {
1219
+ key: "mix",
1220
+ get: function get() {
1221
+ return this._native.mix;
1222
+ },
1223
+ set: function set(value) {
1224
+ this._native.mix = value;
1225
+ }
1226
+ }
1227
+ ]);
1228
+ return SpinePhysicsConstraint;
1229
+ }();
1230
+
1231
+ /** Physics controls evaluated by the skeleton's backend. */ var SpinePhysics = /*#__PURE__*/ function() {
1232
+ function SpinePhysics(_native) {
1233
+ this._native = _native;
1234
+ this.physicsConstraints = Object.freeze(_native.physicsConstraints.map(function(c) {
1235
+ return SpinePhysicsConstraint._create(c);
1236
+ }));
1237
+ }
1238
+ var _proto = SpinePhysics.prototype;
1239
+ _proto.physicsTranslate = function physicsTranslate(x, y) {
1240
+ this._native.physicsTranslate(x, y);
1241
+ };
1242
+ _proto.physicsRotate = function physicsRotate(x, y, degrees) {
1243
+ this._native.physicsRotate(x, y, degrees);
1244
+ };
1245
+ /** @internal */ SpinePhysics._create = function _create(capability) {
1246
+ return capability.supported === true ? Object.freeze({
1247
+ supported: true,
1248
+ value: new SpinePhysics(capability.value)
1249
+ }) : Object.freeze({
1250
+ supported: false,
1251
+ reason: capability.reason
1252
+ });
1253
+ };
1254
+ return SpinePhysics;
1255
+ }();
1256
+
1257
+ /**
1258
+ * Material for Spine rendering. Defaults to the built-in `2D/Spine` shader.
1259
+ * Texture and blend inputs are supplied per draw batch; tint is a renderer input.
1260
+ * Inputs use straight alpha; the shader premultiplies its final linear output for the supplied blend factors.
1261
+ */ var SpineMaterial = /*#__PURE__*/ function(Material) {
1262
+ _inherits(SpineMaterial, Material);
1263
+ function SpineMaterial(engine$1, shader) {
1264
+ if (shader === void 0) shader = engine.Shader.find("2D/Spine");
1265
+ return Material.call(this, engine$1, shader) || this;
1266
+ }
1267
+ var _proto = SpineMaterial.prototype;
1268
+ _proto.clone = function clone() {
1269
+ var dest = new SpineMaterial(this.engine, this.shader);
1270
+ this._cloneToAndModifyName(dest);
1271
+ return dest;
1272
+ };
1273
+ return SpineMaterial;
1274
+ }(engine.Material);
1275
+
1276
+ /**
1277
+ * Blend mode of a spine slot.
1278
+ *
1279
+ * @remarks
1280
+ * Version-neutral mirror of spine-core's `BlendMode` enum. The values match spine-core across all
1281
+ * supported runtime versions (3.8 / 4.2), so a core package can pass its `BlendMode` straight through.
1282
+ * Owning it here keeps the shared package free of any runtime spine-core dependency.
1283
+ */ var SpineBlendMode = /*#__PURE__*/ function(SpineBlendMode) {
1284
+ SpineBlendMode[SpineBlendMode["Normal"] = 0] = "Normal";
1285
+ SpineBlendMode[SpineBlendMode["Additive"] = 1] = "Additive";
1286
+ SpineBlendMode[SpineBlendMode["Multiply"] = 2] = "Multiply";
1287
+ SpineBlendMode[SpineBlendMode["Screen"] = 3] = "Screen";
1288
+ return SpineBlendMode;
1289
+ }({});
1290
+
1291
+ /**
1292
+ * Vertex stride (float count per vertex) of the spine vertex layout owned by `SpineAnimationRenderer`.
1293
+ *
1294
+ * - `withoutTint`: [x, y, z, r, g, b, a, u, v] = 9 floats
1295
+ * - `withTint`: [x, y, z, r, g, b, a, u, v, dr, dg, db] = 12 floats
1296
+ *
1297
+ * The renderer supplies the matching stride to backend generators through the geometry contract.
1298
+ */ var SpineVertexStride = {
1299
+ withoutTint: 9,
1300
+ withTint: 12
1301
+ };
1302
+
1303
+ /** @internal */ var SpineGeometry = /*#__PURE__*/ function() {
1304
+ function SpineGeometry(_slotMaterials) {
1305
+ this._slotMaterials = _slotMaterials;
1306
+ this.vertices = new Float32Array();
1307
+ this.indices = new Uint16Array();
1308
+ this.vertexCount = 0;
1309
+ this.indexCount = 0;
1310
+ this.vertexStride = SpineVertexStride.withoutTint;
1311
+ this.zSpacing = 0;
1312
+ this.tintBlack = false;
1313
+ this.defaultMaterial = null;
1314
+ this.bounds = new engine.BoundingBox();
1315
+ this.batches = [];
1316
+ this.batchCount = 0;
1317
+ }
1318
+ var _proto = SpineGeometry.prototype;
1319
+ _proto.reset = function reset(zSpacing, tintBlack, defaultMaterial) {
1320
+ this.zSpacing = zSpacing;
1321
+ this.tintBlack = tintBlack;
1322
+ this.defaultMaterial = defaultMaterial;
1323
+ this.vertexStride = tintBlack ? SpineVertexStride.withTint : SpineVertexStride.withoutTint;
1324
+ this.vertexCount = this.indexCount = this.batchCount = 0;
1325
+ // Release references from inactive batches without discarding reusable batch records.
1326
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.batches), _step; !(_step = _iterator()).done;){
1327
+ var batch = _step.value;
1328
+ batch.texture = null;
1329
+ batch.material = null;
1330
+ }
1331
+ this.bounds.min.set(Infinity, Infinity, Infinity);
1332
+ this.bounds.max.set(-Infinity, -Infinity, -Infinity);
1333
+ };
1334
+ _proto.append = function append(vertices, vertexCount, indices, indexCount, texture, blendMode, drawOrder, slotIndex) {
1335
+ if (!vertexCount || !indexCount) return;
1336
+ var vertexStart = this.vertexCount;
1337
+ var indexStart = this.indexCount;
1338
+ this._ensureCapacity(vertexStart + vertexCount, indexStart + indexCount);
1339
+ var _this = this, targetVertices = _this.vertices, targetIndices = _this.indices, vertexStride = _this.vertexStride, tintBlack = _this.tintBlack;
1340
+ var z = drawOrder * this.zSpacing;
1341
+ var _this_bounds = this.bounds, min = _this_bounds.min, max = _this_bounds.max;
1342
+ var targetOffset = vertexStart * vertexStride;
1343
+ var sourceOffset = 0;
1344
+ for(var vertex = 0; vertex < vertexCount; vertex++){
1345
+ var x = vertices[sourceOffset++];
1346
+ var y = vertices[sourceOffset++];
1347
+ targetVertices[targetOffset++] = x;
1348
+ targetVertices[targetOffset++] = y;
1349
+ targetVertices[targetOffset++] = z;
1350
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // r
1351
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // g
1352
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // b
1353
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // a
1354
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // u
1355
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // v
1356
+ if (tintBlack) {
1357
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // darkR
1358
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // darkG
1359
+ targetVertices[targetOffset++] = vertices[sourceOffset++]; // darkB
1360
+ sourceOffset++; // darkA is derived by the shader, not stored in the vertex buffer.
1361
+ }
1362
+ min.set(Math.min(min.x, x), Math.min(min.y, y), Math.min(min.z, z));
1363
+ max.set(Math.max(max.x, x), Math.max(max.y, y), Math.max(max.z, z));
1364
+ }
1365
+ for(var i = 0; i < indexCount; i++)targetIndices[indexStart + i] = indices[i] + vertexStart;
1366
+ this.vertexCount += vertexCount;
1367
+ this.indexCount += indexCount;
1368
+ var lastBatch = this.batches[this.batchCount - 1];
1369
+ var _this__slotMaterials_get;
1370
+ var material = (_this__slotMaterials_get = this._slotMaterials.get(slotIndex)) != null ? _this__slotMaterials_get : this.defaultMaterial;
1371
+ if (lastBatch && lastBatch.texture === texture && lastBatch.blendMode === blendMode && lastBatch.material === material) {
1372
+ lastBatch.count += indexCount;
1373
+ } else {
1374
+ var index = this.batchCount++;
1375
+ var _this_batches_index;
1376
+ var batch = (_this_batches_index = this.batches[index]) != null ? _this_batches_index : this.batches[index] = {
1377
+ start: 0,
1378
+ count: 0,
1379
+ texture: texture,
1380
+ blendMode: blendMode,
1381
+ material: material
1382
+ };
1383
+ batch.start = indexStart;
1384
+ batch.count = indexCount;
1385
+ batch.texture = texture;
1386
+ batch.blendMode = blendMode;
1387
+ batch.material = material;
1388
+ }
1389
+ };
1390
+ _proto._ensureCapacity = function _ensureCapacity(vertexCount, indexCount) {
1391
+ var length = vertexCount * this.vertexStride;
1392
+ if (length > this.vertices.length) {
1393
+ var vertices = new Float32Array(Math.max(length, this.vertices.length * 2, 64 * this.vertexStride));
1394
+ vertices.set(this.vertices);
1395
+ this.vertices = vertices;
1396
+ }
1397
+ if (indexCount > this.indices.length) {
1398
+ var indices = new Uint16Array(Math.max(indexCount, this.indices.length * 2, 64));
1399
+ indices.set(this.indices);
1400
+ this.indices = indices;
1401
+ }
1402
+ };
1403
+ return SpineGeometry;
1404
+ }();
1405
+
1406
+ /**
1407
+ * Spine animation renderer, capable of rendering spine animations and providing functions for animation and skeleton manipulation.
1408
+ */ var SpineAnimationRenderer = /*#__PURE__*/ function(Renderer) {
1409
+ _inherits(SpineAnimationRenderer, Renderer);
1410
+ function SpineAnimationRenderer(entity) {
1411
+ var _this;
1412
+ _this = Renderer.call(this, entity) || this, /** Called after time advances, before animations are applied. Use to prepare the base pose. */ _this.onBeforeApply = new engine.Signal(), /** Called after animations are applied, before world transforms are solved. Use to edit local bone values. */ _this.onUpdateLocal = new engine.Signal(), /**
1413
+ * Called with evaluated world transforms, before the final constraint and physics solve.
1414
+ * Use to edit local bone values based on world values. A listener enables an additional pose solve;
1415
+ * physics simulation still advances only once per update.
1416
+ */ _this.onUpdateWorld = new engine.Signal(), /** Called after the final bone transforms are solved, before geometry is built. Use to read the final pose. */ _this.onUpdateComplete = new engine.Signal(), /**
1417
+ * Time multiplier for both animation playback and skeleton physics. Defaults to 1.
1418
+ * Zero stops time advancement while still applying the pose and rendering.
1419
+ * AnimationState and TrackEntry time scales multiply animation time independently.
1420
+ */ _this.timeScale = 1, /**
1421
+ * The spacing between z layers in world units.
1422
+ */ _this.zSpacing = 0.001, _this._tintBlack = false, /**
1423
+ * Default state for spine animation.
1424
+ * Contains the default animation name to be played, whether this animation should loop, the default skin name.
1425
+ */ _this.defaultConfig = new SpineAnimationDefaultConfig(), /** @internal */ _this._subPrimitives = [], /** @internal */ _this._needResizeBuffer = false, /** @internal */ _this._resource = null, /** @internal */ _this._localBounds = new engine.BoundingBox(new engine.Vector3(Infinity, Infinity, Infinity), new engine.Vector3(-Infinity, -Infinity, -Infinity)), _this._slotMaterials = new Map(), _this._slotMaterialsDirty = false, _this._geometry = new SpineGeometry(_this._slotMaterials), _this._batchShaderData = [], _this._physics = null, _this._publicSkeleton = null, _this._publicState = null;
1426
+ var defaults = SpineAnimationRenderer._defaultMaterials;
1427
+ var material = defaults.get(_this.engine);
1428
+ if (!material || material.destroyed || material.pendingDestroy) {
1429
+ material = new SpineMaterial(_this.engine);
1430
+ defaults.set(_this.engine, material);
1431
+ }
1432
+ _this.setMaterial(material);
1433
+ var primitive = new engine.Primitive(_this.engine);
1434
+ _this._primitive = primitive;
1435
+ _this._primitive._addReferCount(1);
1436
+ primitive.addVertexElement(SpineAnimationRenderer._positionVertexElement);
1437
+ primitive.addVertexElement(SpineAnimationRenderer._lightColorVertexElement);
1438
+ primitive.addVertexElement(SpineAnimationRenderer._uvVertexElement);
1439
+ primitive.addVertexElement(SpineAnimationRenderer._darkColorVertexElement);
1440
+ return _this;
1441
+ }
1442
+ var _proto = SpineAnimationRenderer.prototype;
1443
+ /** @internal */ _proto._setRuntime = function _setRuntime(runtime) {
1444
+ this._runtime = runtime;
1445
+ };
1446
+ _proto.setMaterial = function setMaterial(indexOrSlotOrMaterial, material) {
1447
+ if (material === void 0) material = null;
1448
+ if (_instanceof(indexOrSlotOrMaterial, SpineSlot)) {
1449
+ var index = this._getSlotIndex(indexOrSlotOrMaterial);
1450
+ var previous = this._slotMaterials.get(index);
1451
+ if (previous === material || !previous && !material) return;
1452
+ if (previous) this._addResourceReferCount(previous, -1);
1453
+ if (material) {
1454
+ this._slotMaterials.set(index, material);
1455
+ this._addResourceReferCount(material, 1);
1456
+ } else {
1457
+ this._slotMaterials.delete(index);
1458
+ }
1459
+ this._slotMaterialsDirty = true;
1460
+ } else if (typeof indexOrSlotOrMaterial === "number") {
1461
+ Renderer.prototype.setMaterial.call(this, indexOrSlotOrMaterial, material);
1462
+ } else {
1463
+ Renderer.prototype.setMaterial.call(this, indexOrSlotOrMaterial);
1464
+ }
1465
+ };
1466
+ _proto.getMaterial = function getMaterial(indexOrSlot) {
1467
+ if (indexOrSlot === void 0) indexOrSlot = 0;
1468
+ var _this__slotMaterials_get;
1469
+ return _instanceof(indexOrSlot, SpineSlot) ? (_this__slotMaterials_get = this._slotMaterials.get(this._getSlotIndex(indexOrSlot))) != null ? _this__slotMaterials_get : Renderer.prototype.getMaterial.call(this) : Renderer.prototype.getMaterial.call(this, indexOrSlot);
1470
+ };
1471
+ /**
1472
+ * @internal
1473
+ */ _proto._onEnable = function _onEnable() {
1474
+ this._applyDefaultConfig();
1475
+ };
1476
+ /**
1477
+ * @internal
1478
+ */ _proto.update = function update(delta) {
1479
+ var _this = this, state = _this._publicState, skeleton = _this._skeleton, runtime = _this._runtime;
1480
+ if (!state || !skeleton) return;
1481
+ state._advance(skeleton, delta * this.timeScale);
1482
+ if (!this._isCurrentState(state)) return;
1483
+ this.onBeforeApply.invoke(this);
1484
+ if (!this._isCurrentState(state)) return;
1485
+ state._apply(skeleton);
1486
+ if (!this._isCurrentState(state)) return;
1487
+ this.onUpdateLocal.invoke(this);
1488
+ if (!this._isCurrentState(state)) return;
1489
+ if (this.onUpdateWorld.listenerCount > 0) {
1490
+ runtime.updateWorldTransform(skeleton, false);
1491
+ this.onUpdateWorld.invoke(this);
1492
+ if (!this._isCurrentState(state)) return;
1493
+ }
1494
+ runtime.updateWorldTransform(skeleton, true);
1495
+ this.onUpdateComplete.invoke(this);
1496
+ if (!this._isCurrentState(state)) return;
1497
+ this._buildGeometry();
1498
+ };
1499
+ _proto._isCurrentState = function _isCurrentState(state) {
1500
+ // A playback or pose callback may end this binding by switching resources or destroying the renderer.
1501
+ return !this.destroyed && this._publicState === state;
1502
+ };
1503
+ /**
1504
+ * @internal
1505
+ */ _proto._render = function _render(context) {
1506
+ var _this = this, _primitive = _this._primitive, _subPrimitives = _this._subPrimitives, _batchShaderData = _this._batchShaderData;
1507
+ // Material selection may change after animation update, including through inherited material APIs.
1508
+ if (this._skeleton && (this._slotMaterialsDirty || this._geometry.defaultMaterial !== this.getMaterial())) {
1509
+ this._buildGeometry();
1510
+ }
1511
+ var engine = this.engine;
1512
+ var priority = this.priority;
1513
+ var distanceForSort = this._distanceForSort;
1514
+ var renderElementPool = engine._renderElementPool;
1515
+ var renderPipeline = context.camera._renderPipeline;
1516
+ for(var i = 0, n = _subPrimitives.length; i < n; i++){
1517
+ var material = this._geometry.batches[i].material;
1518
+ if (!material) continue;
1519
+ if (material.destroyed || material.shader.destroyed) {
1520
+ material = engine._basicResources.meshMagentaMaterial;
1521
+ }
1522
+ var renderElement = renderElementPool.get();
1523
+ renderElement.set(this, material, _primitive, _subPrimitives[i], undefined, undefined, _batchShaderData[i]);
1524
+ renderElement.priority = priority;
1525
+ renderElement.distanceForSort = distanceForSort;
1526
+ renderElement.subDistancePriority = i;
1527
+ renderPipeline.pushRenderElement(context, renderElement);
1528
+ }
1529
+ };
1530
+ /**
1531
+ * @internal
1532
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
1533
+ engine.BoundingBox.transform(this._localBounds, this.entity.transform.worldMatrix, worldBounds);
1534
+ };
1535
+ /**
1536
+ * @internal
1537
+ */ _proto._setSkeleton = function _setSkeleton(skeleton, data) {
1538
+ this._skeleton = skeleton;
1539
+ this._publicSkeleton = SpineSkeleton._create(skeleton, data);
1540
+ this._physics = SpinePhysics._create(this._runtime.getPhysics(skeleton));
1541
+ };
1542
+ /**
1543
+ * @internal
1544
+ */ _proto._setState = function _setState(state, data) {
1545
+ this._state = state;
1546
+ this._publicState = SpineAnimationState._create(state, data, this._runtime);
1547
+ };
1548
+ /**
1549
+ * @internal
1550
+ */ _proto._onClone = function _onClone(target) {
1551
+ target.setMaterials(this._materials);
1552
+ // Each instance binds fresh playback and pose objects to the shared resource data.
1553
+ target.resource = this._resource;
1554
+ for(var _iterator = _create_for_of_iterator_helper_loose(this._slotMaterials), _step; !(_step = _iterator()).done;){
1555
+ var _step_value = _step.value, index = _step_value[0], material = _step_value[1];
1556
+ target.setMaterial(target.skeleton.slots[index], material);
1557
+ }
1558
+ };
1559
+ /**
1560
+ * @internal
1561
+ */ _proto._onDestroy = function _onDestroy() {
1562
+ var _this__publicState, // destroy() is refCount-guarded; the primitive released its buffer references above.
1563
+ _this__vertexBuffer, _this__indexBuffer;
1564
+ this.onBeforeApply.removeAll();
1565
+ this.onUpdateLocal.removeAll();
1566
+ this.onUpdateWorld.removeAll();
1567
+ this.onUpdateComplete.removeAll();
1568
+ (_this__publicState = this._publicState) == null ? void 0 : _this__publicState._dispose();
1569
+ this._clearSlotMaterials();
1570
+ this._geometry = null;
1571
+ this._clearBatchTextures(0);
1572
+ this._batchShaderData.length = 0;
1573
+ this._subPrimitives.length = 0;
1574
+ var primitive = this._primitive;
1575
+ if (primitive) {
1576
+ primitive._addReferCount(-1);
1577
+ primitive.destroy();
1578
+ this._primitive = null;
1579
+ }
1580
+ (_this__vertexBuffer = this._vertexBuffer) == null ? void 0 : _this__vertexBuffer.destroy();
1581
+ (_this__indexBuffer = this._indexBuffer) == null ? void 0 : _this__indexBuffer.destroy();
1582
+ this._vertexBuffer = null;
1583
+ this._indexBuffer = null;
1584
+ if (this._resource) this._addResourceReferCount(this._resource, -1);
1585
+ this._resource = null;
1586
+ this._runtime = null;
1587
+ this._physics = null;
1588
+ this._skeleton = null;
1589
+ this._state = null;
1590
+ this._publicSkeleton = null;
1591
+ this._publicState = null;
1592
+ Renderer.prototype._onDestroy.call(this);
1593
+ };
1594
+ _proto._uploadGeometry = function _uploadGeometry() {
1595
+ var _this__vertexBuffer, _this__indexBuffer;
1596
+ var geometry = this._geometry;
1597
+ var vertices = geometry.vertices, indices = geometry.indices, batches = geometry.batches, batchCount = geometry.batchCount, vertexCount = geometry.vertexCount, indexCount = geometry.indexCount, bounds = geometry.bounds, vertexStride = geometry.vertexStride;
1598
+ var subPrimitives = this._subPrimitives;
1599
+ for(var i = 0; i < batchCount; i++){
1600
+ var batch = batches[i];
1601
+ var _subPrimitives_i;
1602
+ var primitive = (_subPrimitives_i = subPrimitives[i]) != null ? _subPrimitives_i : subPrimitives[i] = new engine.SubPrimitive();
1603
+ primitive.start = batch.start;
1604
+ primitive.count = batch.count;
1605
+ var _this__batchShaderData_i;
1606
+ var data = (_this__batchShaderData_i = this._batchShaderData[i]) != null ? _this__batchShaderData_i : this._batchShaderData[i] = new engine.ShaderData(engine.ShaderDataGroup.RenderElement);
1607
+ data.setTexture(SpineAnimationRenderer._textureProperty, batch.texture);
1608
+ this._setBatchBlend(data, batch.blendMode);
1609
+ }
1610
+ this._clearBatchTextures(batchCount);
1611
+ subPrimitives.length = batchCount;
1612
+ if (!vertexCount) {
1613
+ this._localBounds.min.set(0, 0, 0);
1614
+ this._localBounds.max.set(0, 0, 0);
1615
+ return;
1616
+ }
1617
+ this._localBounds.copyFrom(bounds);
1618
+ if (this._needResizeBuffer || ((_this__vertexBuffer = this._vertexBuffer) == null ? void 0 : _this__vertexBuffer.byteLength) !== vertices.byteLength || ((_this__indexBuffer = this._indexBuffer) == null ? void 0 : _this__indexBuffer.byteLength) !== indices.byteLength) {
1619
+ var oldVertexBuffer = this._vertexBuffer;
1620
+ var oldIndexBuffer = this._indexBuffer;
1621
+ this._vertexBuffer = new engine.Buffer(this.engine, engine.BufferBindFlag.VertexBuffer, vertices, engine.BufferUsage.Dynamic);
1622
+ this._indexBuffer = new engine.Buffer(this.engine, engine.BufferBindFlag.IndexBuffer, indices, engine.BufferUsage.Dynamic);
1623
+ this._primitive.setVertexBufferBinding(0, new engine.VertexBufferBinding(this._vertexBuffer, vertexStride * 4));
1624
+ this._primitive.setIndexBufferBinding(new engine.IndexBufferBinding(this._indexBuffer, engine.IndexFormat.UInt16));
1625
+ oldVertexBuffer == null ? void 0 : oldVertexBuffer.destroy();
1626
+ oldIndexBuffer == null ? void 0 : oldIndexBuffer.destroy();
1627
+ this._needResizeBuffer = false;
1628
+ } else {
1629
+ this._vertexBuffer.setData(vertices, 0, 0, vertexCount * vertexStride);
1630
+ this._indexBuffer.setData(indices, 0, 0, indexCount);
1631
+ }
1632
+ };
1633
+ _proto._getSlotIndex = function _getSlotIndex(slot) {
1634
+ var _this__publicSkeleton;
1635
+ var _this__publicSkeleton_slots_indexOf;
1636
+ var index = (_this__publicSkeleton_slots_indexOf = (_this__publicSkeleton = this._publicSkeleton) == null ? void 0 : _this__publicSkeleton.slots.indexOf(slot)) != null ? _this__publicSkeleton_slots_indexOf : -1;
1637
+ if (index < 0) throw new Error("The Spine slot does not belong to this renderer's current skeleton.");
1638
+ return index;
1639
+ };
1640
+ _proto._clearSlotMaterials = function _clearSlotMaterials() {
1641
+ for(var _iterator = _create_for_of_iterator_helper_loose(this._slotMaterials.values()), _step; !(_step = _iterator()).done;){
1642
+ var material = _step.value;
1643
+ this._addResourceReferCount(material, -1);
1644
+ }
1645
+ this._slotMaterials.clear();
1646
+ this._slotMaterialsDirty = false;
1647
+ };
1648
+ _proto._buildGeometry = function _buildGeometry() {
1649
+ var geometry = this._geometry;
1650
+ geometry.reset(this.zSpacing, this.tintBlack, this.getMaterial());
1651
+ this._runtime.buildGeometry(this._skeleton, geometry);
1652
+ this._uploadGeometry();
1653
+ this._slotMaterialsDirty = false;
1654
+ this._dirtyUpdateFlag |= engine.RendererUpdateFlags.WorldVolume;
1655
+ };
1656
+ _proto._clearBatchTextures = function _clearBatchTextures(start) {
1657
+ for(var i = start; i < this._batchShaderData.length; i++){
1658
+ this._batchShaderData[i].setTexture(SpineAnimationRenderer._textureProperty, null);
1659
+ }
1660
+ };
1661
+ _proto._setBatchBlend = function _setBatchBlend(data, blendMode) {
1662
+ var One = engine.BlendFactor.One, OneMinusSourceAlpha = engine.BlendFactor.OneMinusSourceAlpha, DestinationColor = engine.BlendFactor.DestinationColor, OneMinusSourceColor = engine.BlendFactor.OneMinusSourceColor;
1663
+ var sourceColor = One;
1664
+ var destinationColor = OneMinusSourceAlpha;
1665
+ var destinationAlpha = OneMinusSourceAlpha;
1666
+ switch(blendMode){
1667
+ case SpineBlendMode.Additive:
1668
+ destinationColor = destinationAlpha = One;
1669
+ break;
1670
+ case SpineBlendMode.Multiply:
1671
+ sourceColor = DestinationColor;
1672
+ break;
1673
+ case SpineBlendMode.Screen:
1674
+ sourceColor = One;
1675
+ destinationColor = OneMinusSourceColor;
1676
+ break;
1677
+ }
1678
+ data.setInt(SpineAnimationRenderer._sourceColorProperty, sourceColor);
1679
+ data.setInt(SpineAnimationRenderer._destinationColorProperty, destinationColor);
1680
+ data.setInt(SpineAnimationRenderer._sourceAlphaProperty, One);
1681
+ data.setInt(SpineAnimationRenderer._destinationAlphaProperty, destinationAlpha);
1682
+ };
1683
+ _proto._applyDefaultConfig = function _applyDefaultConfig() {
1684
+ var _this = this, skeleton = _this._publicSkeleton, state = _this._publicState;
1685
+ if (skeleton && state) {
1686
+ var _this_defaultConfig = this.defaultConfig, animationName = _this_defaultConfig.animationName, skinName = _this_defaultConfig.skinName, loop = _this_defaultConfig.loop;
1687
+ if (skinName !== "default") {
1688
+ skeleton.setSkinByName(skinName);
1689
+ skeleton.setToSetupPose();
1690
+ }
1691
+ if (animationName) {
1692
+ state.setAnimation(0, animationName, loop);
1693
+ }
1694
+ }
1695
+ };
1696
+ _create_class(SpineAnimationRenderer, [
1697
+ {
1698
+ key: "tintBlack",
1699
+ get: /**
1700
+ * Whether to enable tint black feature for dark color tinting.
1701
+ *
1702
+ * @remarks Should be enabled when using "Tint Black" feature in Spine editor.
1703
+ */ function get() {
1704
+ return this._tintBlack;
1705
+ },
1706
+ set: function set(value) {
1707
+ if (this._tintBlack !== value) {
1708
+ this._tintBlack = value;
1709
+ this._needResizeBuffer = true;
1710
+ if (value) {
1711
+ this.shaderData.enableMacro("RENDERER_TINT_BLACK");
1712
+ } else {
1713
+ this.shaderData.disableMacro("RENDERER_TINT_BLACK");
1714
+ }
1715
+ }
1716
+ }
1717
+ },
1718
+ {
1719
+ key: "physics",
1720
+ get: /** Physics support for the bound skeleton, or null before an asset is assigned. */ function get() {
1721
+ return this._physics;
1722
+ }
1723
+ },
1724
+ {
1725
+ key: "state",
1726
+ get: /**
1727
+ * The animation playback state of this renderer.
1728
+ * Manage, blend, and transition between multiple simultaneous animations effectively.
1729
+ */ function get() {
1730
+ if (!this._publicState) throw new Error("No Spine resource is bound to this renderer.");
1731
+ return this._publicState;
1732
+ }
1733
+ },
1734
+ {
1735
+ key: "skeleton",
1736
+ get: /**
1737
+ * The skeleton pose of this renderer.
1738
+ * Manipulate bone positions, rotations, scaling
1739
+ * and change spine attachment to customize character appearances dynamically during runtime.
1740
+ */ function get() {
1741
+ if (!this._publicSkeleton) throw new Error("No Spine resource is bound to this renderer.");
1742
+ return this._publicSkeleton;
1743
+ }
1744
+ },
1745
+ {
1746
+ key: "resource",
1747
+ get: /**
1748
+ * Spine resource of this renderer, or null when unbound.
1749
+ */ function get() {
1750
+ return this._resource;
1751
+ },
1752
+ set: /**
1753
+ * Bind a Spine resource, or assign null to clear its pose and playback.
1754
+ *
1755
+ * @param value - The resource to use, or null to unbind
1756
+ */ function set(value) {
1757
+ var _this__publicState;
1758
+ if (this._resource === value) return;
1759
+ (_this__publicState = this._publicState) == null ? void 0 : _this__publicState._dispose();
1760
+ this._clearSlotMaterials();
1761
+ if (this._resource) this._addResourceReferCount(this._resource, -1);
1762
+ this._resource = value;
1763
+ this._state = null;
1764
+ this._skeleton = null;
1765
+ this._runtime = null;
1766
+ this._physics = null;
1767
+ this._publicSkeleton = null;
1768
+ this._publicState = null;
1769
+ this._subPrimitives.length = 0;
1770
+ this._geometry.reset(this.zSpacing, this.tintBlack, this.getMaterial());
1771
+ this._clearBatchTextures(0);
1772
+ this._localBounds.min.set(0, 0, 0);
1773
+ this._localBounds.max.set(0, 0, 0);
1774
+ this._dirtyUpdateFlag |= engine.RendererUpdateFlags.WorldVolume;
1775
+ if (!value) return;
1776
+ this._addResourceReferCount(value, 1);
1777
+ var skeletonData = value.skeletonData, stateData = value.stateData, runtime = value._runtime;
1778
+ this._setRuntime(runtime);
1779
+ this._setSkeleton(runtime.createSkeleton(skeletonData._native), skeletonData);
1780
+ this._setState(runtime.createAnimationState(stateData._native), stateData);
1781
+ this._applyDefaultConfig();
1782
+ }
1783
+ }
1784
+ ]);
1785
+ return SpineAnimationRenderer;
1786
+ }(engine.Renderer);
1787
+ SpineAnimationRenderer._defaultMaterials = new WeakMap();
1788
+ SpineAnimationRenderer._textureProperty = engine.ShaderProperty.getByName("renderElement_SpineTexture");
1789
+ SpineAnimationRenderer._sourceColorProperty = engine.ShaderProperty.getByName("renderElement_SpineSourceColorBlendFactor");
1790
+ SpineAnimationRenderer._destinationColorProperty = engine.ShaderProperty.getByName("renderElement_SpineDestinationColorBlendFactor");
1791
+ SpineAnimationRenderer._sourceAlphaProperty = engine.ShaderProperty.getByName("renderElement_SpineSourceAlphaBlendFactor");
1792
+ SpineAnimationRenderer._destinationAlphaProperty = engine.ShaderProperty.getByName("renderElement_SpineDestinationAlphaBlendFactor");
1793
+ SpineAnimationRenderer._positionVertexElement = new engine.VertexElement("POSITION", 0, engine.VertexElementFormat.Vector3, 0);
1794
+ SpineAnimationRenderer._lightColorVertexElement = new engine.VertexElement("LIGHT_COLOR", 12, engine.VertexElementFormat.Vector4, 0);
1795
+ SpineAnimationRenderer._uvVertexElement = new engine.VertexElement("TEXCOORD_0", 28, engine.VertexElementFormat.Vector2, 0);
1796
+ SpineAnimationRenderer._darkColorVertexElement = new engine.VertexElement("DARK_COLOR", 36, engine.VertexElementFormat.Vector3, 0);
1797
+ __decorate([
1798
+ engine.assignmentClone
1799
+ ], SpineAnimationRenderer.prototype, "timeScale", void 0);
1800
+ __decorate([
1801
+ engine.assignmentClone
1802
+ ], SpineAnimationRenderer.prototype, "zSpacing", void 0);
1803
+ __decorate([
1804
+ engine.assignmentClone
1805
+ ], SpineAnimationRenderer.prototype, "_tintBlack", void 0);
1806
+ __decorate([
1807
+ engine.deepClone
1808
+ ], SpineAnimationRenderer.prototype, "defaultConfig", void 0);
1809
+ __decorate([
1810
+ engine.ignoreClone
1811
+ ], SpineAnimationRenderer.prototype, "_primitive", void 0);
1812
+ __decorate([
1813
+ engine.ignoreClone
1814
+ ], SpineAnimationRenderer.prototype, "_subPrimitives", void 0);
1815
+ __decorate([
1816
+ engine.ignoreClone
1817
+ ], SpineAnimationRenderer.prototype, "_indexBuffer", void 0);
1818
+ __decorate([
1819
+ engine.ignoreClone
1820
+ ], SpineAnimationRenderer.prototype, "_vertexBuffer", void 0);
1821
+ __decorate([
1822
+ engine.ignoreClone
1823
+ ], SpineAnimationRenderer.prototype, "_needResizeBuffer", void 0);
1824
+ __decorate([
1825
+ engine.ignoreClone
1826
+ ], SpineAnimationRenderer.prototype, "_resource", void 0);
1827
+ __decorate([
1828
+ engine.ignoreClone
1829
+ ], SpineAnimationRenderer.prototype, "_localBounds", void 0);
1830
+ __decorate([
1831
+ engine.ignoreClone
1832
+ ], SpineAnimationRenderer.prototype, "_slotMaterials", void 0);
1833
+ __decorate([
1834
+ engine.ignoreClone
1835
+ ], SpineAnimationRenderer.prototype, "_slotMaterialsDirty", void 0);
1836
+ __decorate([
1837
+ engine.ignoreClone
1838
+ ], SpineAnimationRenderer.prototype, "_geometry", void 0);
1839
+ __decorate([
1840
+ engine.ignoreClone
1841
+ ], SpineAnimationRenderer.prototype, "_batchShaderData", void 0);
1842
+ __decorate([
1843
+ engine.ignoreClone
1844
+ ], SpineAnimationRenderer.prototype, "_skeleton", void 0);
1845
+ __decorate([
1846
+ engine.ignoreClone
1847
+ ], SpineAnimationRenderer.prototype, "_state", void 0);
1848
+ __decorate([
1849
+ engine.ignoreClone
1850
+ ], SpineAnimationRenderer.prototype, "_runtime", void 0);
1851
+ __decorate([
1852
+ engine.ignoreClone
1853
+ ], SpineAnimationRenderer.prototype, "_physics", void 0);
1854
+ __decorate([
1855
+ engine.ignoreClone
1856
+ ], SpineAnimationRenderer.prototype, "_publicSkeleton", void 0);
1857
+ __decorate([
1858
+ engine.ignoreClone
1859
+ ], SpineAnimationRenderer.prototype, "_publicState", void 0);
1860
+ /**
1861
+ * Default state for spine animation.
1862
+ * Contains the default animation name to be played, whether this animation should loop,
1863
+ * the default skin name, and the default scale of the skeleton.
1864
+ */ var SpineAnimationDefaultConfig = function SpineAnimationDefaultConfig(/**
1865
+ * Whether the default animation should loop @defaultValue `true. The default animation should loop`
1866
+ */ loop, /**
1867
+ * The name of the default animation @defaultValue `null. Do not play any animation by default`
1868
+ */ animationName, /**
1869
+ * The name of the default skin @defaultValue `default`
1870
+ */ skinName) {
1871
+ if (loop === void 0) loop = true;
1872
+ if (animationName === void 0) animationName = null;
1873
+ if (skinName === void 0) skinName = "default";
1874
+ this.loop = loop;
1875
+ this.animationName = animationName;
1876
+ this.skinName = skinName;
1877
+ };
1878
+
1879
+ /**
1880
+ * Represents a resource that manages Spine animation data, textures, and entity templates for the Galacean engine.
1881
+ *
1882
+ */ var SpineResource = /*#__PURE__*/ function(ReferResource) {
1883
+ _inherits(SpineResource, ReferResource);
1884
+ function SpineResource(engine, runtime, skeletonData, url) {
1885
+ var _this;
1886
+ _this = ReferResource.call(this, engine) || this, _this._texturesInSpineAtlas = [];
1887
+ _this._runtime = runtime;
1888
+ _this.url = url;
1889
+ _this._skeletonData = SpineSkeletonData._create(skeletonData);
1890
+ _this._stateData = SpineAnimationStateData._create(_this._runtime.createAnimationStateData(skeletonData), _this._skeletonData);
1891
+ _this._associationTextureInSkeletonData(skeletonData);
1892
+ _this._createTemplate();
1893
+ return _this;
1894
+ }
1895
+ var _proto = SpineResource.prototype;
1896
+ /**
1897
+ * Create an empty skin for composing skins/attachments from this resource.
1898
+ * The returned skin can be assigned to one or more instances of this resource.
1899
+ */ _proto.createSkin = function createSkin(name) {
1900
+ return this._skeletonData._wrapSkin(this._runtime.createSkin(name));
1901
+ };
1902
+ /** Creates an independent pose and playback state using this resource's shared data. */ _proto.instantiate = function instantiate() {
1903
+ return this._template.clone();
1904
+ };
1905
+ _proto._onDestroy = function _onDestroy() {
1906
+ ReferResource.prototype._onDestroy.call(this);
1907
+ if (this._template) {
1908
+ var _this__template_getComponent_getMaterial;
1909
+ (_this__template_getComponent_getMaterial = this._template.getComponent(SpineAnimationRenderer).getMaterial()) == null ? void 0 : _this__template_getComponent_getMaterial._disassociationSuperResource(this);
1910
+ this._template.destroy();
1911
+ }
1912
+ this._template = null;
1913
+ this._disassociateTextures();
1914
+ this._skeletonData = null;
1915
+ this._stateData = null;
1916
+ };
1917
+ _proto._createTemplate = function _createTemplate() {
1918
+ var name = this._extractFileName(this.url);
1919
+ var spineEntity = new engine.Entity(this.engine, name);
1920
+ spineEntity._markAsTemplate(this);
1921
+ var spineAnimationRenderer = spineEntity.addComponent(SpineAnimationRenderer);
1922
+ spineAnimationRenderer.getMaterial()._associationSuperResource(this);
1923
+ spineAnimationRenderer.resource = this;
1924
+ this._template = spineEntity;
1925
+ };
1926
+ _proto._associationTextureInSkeletonData = function _associationTextureInSkeletonData(skeletonData) {
1927
+ var textures = this._texturesInSpineAtlas = this._runtime.getTextures(skeletonData);
1928
+ for(var _iterator = _create_for_of_iterator_helper_loose(textures), _step; !(_step = _iterator()).done;){
1929
+ var texture = _step.value;
1930
+ texture._associationSuperResource(this);
1931
+ }
1932
+ };
1933
+ _proto._disassociateTextures = function _disassociateTextures() {
1934
+ var textures = this._texturesInSpineAtlas;
1935
+ for(var i = 0, n = textures.length; i < n; i++){
1936
+ textures[i]._disassociationSuperResource(this);
1937
+ }
1938
+ textures.length = 0;
1939
+ };
1940
+ _proto._extractFileName = function _extractFileName(url) {
1941
+ if (!url) return "Spine Entity";
1942
+ var match = url.match(/\/([^\/]+?)(\.[^\/]*)?$/);
1943
+ return match ? match[1] : "Spine Entity";
1944
+ };
1945
+ /** @internal */ SpineResource._create = function _create(engine, runtime, skeletonData, url) {
1946
+ return new SpineResource(engine, runtime, skeletonData, url);
1947
+ };
1948
+ _create_class(SpineResource, [
1949
+ {
1950
+ key: "skeletonData",
1951
+ get: /**
1952
+ * The skeleton data associated with this Spine resource.
1953
+ */ function get() {
1954
+ return this._skeletonData;
1955
+ }
1956
+ },
1957
+ {
1958
+ key: "stateData",
1959
+ get: /**
1960
+ * The animation state data associated with this Spine resource.
1961
+ */ function get() {
1962
+ return this._stateData;
1963
+ }
1964
+ }
1965
+ ]);
1966
+ return SpineResource;
1967
+ }(engine.ReferResource);
1968
+
1969
+ var SpineLoader = /*#__PURE__*/ function(Loader) {
1970
+ _inherits(SpineLoader, Loader);
1971
+ function SpineLoader() {
1972
+ var _this;
1973
+ _this = Loader.apply(this, arguments) || this, _this._runtimes = new WeakMap();
1974
+ return _this;
1975
+ }
1976
+ var _proto = SpineLoader.prototype;
1977
+ _proto.initialize = function initialize(engine, configuration) {
1978
+ if (configuration.spine) {
1979
+ this._registerRuntime(engine, configuration.spine);
1980
+ }
1981
+ };
1982
+ _proto.load = function load(item, resourceManager) {
1983
+ var _this = this;
1984
+ return new engine.AssetPromise(function(resolve, reject) {
1985
+ var spineLoadContext = {
1986
+ skeletonRawData: "",
1987
+ spineAssetPath: {
1988
+ atlasPath: null,
1989
+ skeletonPath: null,
1990
+ extraPaths: []
1991
+ }
1992
+ };
1993
+ var spineAssetPath = spineLoadContext.spineAssetPath;
1994
+ if (!item.urls) {
1995
+ SpineLoader._assignAssetPathsFromUrl(item.url, spineAssetPath, resourceManager);
1996
+ } else {
1997
+ var urls = item.urls;
1998
+ for(var i = 0, len = urls.length; i < len; i += 1){
1999
+ var url = urls[i];
2000
+ SpineLoader._groupAssetsByExtension(url, spineAssetPath);
2001
+ }
2002
+ }
2003
+ var skeletonPath = spineAssetPath.skeletonPath, atlasPath = spineAssetPath.atlasPath;
2004
+ if (!skeletonPath || !atlasPath) {
2005
+ reject(new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included."));
2006
+ return;
2007
+ }
2008
+ resourceManager._request(skeletonPath, {
2009
+ type: "arraybuffer"
2010
+ }).then(function(skeletonRawData) {
2011
+ spineLoadContext.skeletonRawData = skeletonRawData;
2012
+ var skeletonString = SpineLoader._decoder.decode(skeletonRawData).trimStart();
2013
+ if (skeletonString.startsWith("{")) {
2014
+ spineLoadContext.skeletonRawData = skeletonString;
2015
+ }
2016
+ return _this._loadAndCreateSpineResource(spineLoadContext, resourceManager);
2017
+ }).then(resolve).catch(reject);
2018
+ });
2019
+ };
2020
+ /** @internal */ _proto._registerRuntime = function _registerRuntime(engine, runtime) {
2021
+ if (!/^\d+\.\d+$/.test(runtime.version)) {
2022
+ throw new Error("Invalid Spine runtime version: " + runtime.version);
2023
+ }
2024
+ var engineRuntimes = this._runtimes.get(engine);
2025
+ if (engineRuntimes == null ? void 0 : engineRuntimes.has(runtime.version)) {
2026
+ return;
2027
+ }
2028
+ if (!engineRuntimes) {
2029
+ engineRuntimes = new Map();
2030
+ this._runtimes.set(engine, engineRuntimes);
2031
+ }
2032
+ engineRuntimes.set(runtime.version, runtime);
2033
+ };
2034
+ _proto._getRuntime = function _getRuntime(engine, version) {
2035
+ var _exec, _this__runtimes_get;
2036
+ var majorMinor = (_exec = /^(\d+\.\d+)(?:\.|$)/.exec(version != null ? version : "")) == null ? void 0 : _exec[1];
2037
+ var runtime = (_this__runtimes_get = this._runtimes.get(engine)) == null ? void 0 : _this__runtimes_get.get(majorMinor);
2038
+ if (!runtime) {
2039
+ throw new Error('No Spine runtime registered for asset version "' + version + '" on this engine. ' + "Pass a matching backend through the spine option when creating the engine.");
2040
+ }
2041
+ return runtime;
2042
+ };
2043
+ _proto._loadAndCreateSpineResource = function _loadAndCreateSpineResource(spineLoadContext, resourceManager) {
2044
+ var engine = resourceManager.engine;
2045
+ var skeletonRawData = spineLoadContext.skeletonRawData, spineAssetPath = spineLoadContext.spineAssetPath;
2046
+ var skeletonPath = spineAssetPath.skeletonPath, atlasPath = spineAssetPath.atlasPath, extraPaths = spineAssetPath.extraPaths;
2047
+ var runtime = this._getRuntime(engine, readSpineVersion(skeletonRawData));
2048
+ return LoaderUtils.loadAtlas(atlasPath, extraPaths, resourceManager).then(function(atlas) {
2049
+ var textureAtlas = runtime.createTextureAtlas(atlas.text, atlas.textures);
2050
+ var skeletonData = runtime.createSkeletonData(skeletonRawData, textureAtlas, 0.01);
2051
+ return SpineResource._create(engine, runtime, skeletonData, skeletonPath);
2052
+ });
2053
+ };
2054
+ SpineLoader._getUrlExtension = function _getUrlExtension(url) {
2055
+ var match = SpineLoader._getUrlPath(url).match(/\.(\w+)$/);
2056
+ return match ? match[1] : null;
2057
+ };
2058
+ SpineLoader._groupAssetsByExtension = function _groupAssetsByExtension(url, assetPath) {
2059
+ var ext = SpineLoader._getUrlExtension(url);
2060
+ if (!ext) return;
2061
+ if ([
2062
+ "skel",
2063
+ "json",
2064
+ "bin"
2065
+ ].includes(ext)) {
2066
+ assetPath.skeletonPath = url;
2067
+ } else if (ext === "atlas") {
2068
+ assetPath.atlasPath = url;
2069
+ } else {
2070
+ assetPath.extraPaths.push(url);
2071
+ }
2072
+ };
2073
+ SpineLoader._assignAssetPathsFromUrl = function _assignAssetPathsFromUrl(url, assetPath, resourceManager) {
2074
+ var _resourceManager__virtualPathResourceMap_url, _resourceManager__virtualPathResourceMap;
2075
+ var ext = SpineLoader._getUrlExtension(url);
2076
+ if (!ext) return;
2077
+ assetPath.skeletonPath = url;
2078
+ var skeletonDependency = resourceManager == null ? void 0 : (_resourceManager__virtualPathResourceMap = resourceManager._virtualPathResourceMap) == null ? void 0 : (_resourceManager__virtualPathResourceMap_url = _resourceManager__virtualPathResourceMap[url]) == null ? void 0 : _resourceManager__virtualPathResourceMap_url.dependentAssetMap;
2079
+ if (skeletonDependency) {
2080
+ assetPath.atlasPath = skeletonDependency.atlas;
2081
+ } else {
2082
+ var path = SpineLoader._getUrlPath(url);
2083
+ var extensionPattern = /\.(json|bin|skel)$/;
2084
+ if (extensionPattern.test(path)) {
2085
+ assetPath.atlasPath = path.replace(extensionPattern, ".atlas");
2086
+ }
2087
+ }
2088
+ };
2089
+ SpineLoader._getUrlPath = function _getUrlPath(url) {
2090
+ return url.split(/[?#]/, 1)[0];
2091
+ };
2092
+ return SpineLoader;
2093
+ }(engine.Loader);
2094
+ SpineLoader._decoder = new TextDecoder("utf-8");
2095
+ SpineLoader = __decorate([
2096
+ engine.resourceLoader("Spine", [
2097
+ "skel"
2098
+ ])
2099
+ ], SpineLoader);
2100
+
2101
+ var LoaderObject = /*#__PURE__*/Object.freeze({
2102
+ __proto__: null,
2103
+ SpineResource: SpineResource
2104
+ });
2105
+
2106
+ var RendererObject = /*#__PURE__*/Object.freeze({
2107
+ __proto__: null,
2108
+ SpineAnimationRenderer: SpineAnimationRenderer,
2109
+ SpineMaterial: SpineMaterial
2110
+ });
2111
+
2112
+ for(var key in RendererObject){
2113
+ engine.Loader.registerClass(key, RendererObject[key]);
2114
+ }
2115
+ for(var key1 in LoaderObject){
2116
+ engine.Loader.registerClass(key1, LoaderObject[key1]);
2117
+ }
2118
+ var version = "2.0.0-alpha.52";
2119
+ console.log("Galacean spine version: " + version);
2120
+
2121
+ exports.SpineAnimationRenderer = SpineAnimationRenderer;
2122
+ exports.SpineAnimationState = SpineAnimationState;
2123
+ exports.SpineAnimationStateData = SpineAnimationStateData;
2124
+ exports.SpineBone = SpineBone;
2125
+ exports.SpineMaterial = SpineMaterial;
2126
+ exports.SpinePhysics = SpinePhysics;
2127
+ exports.SpinePhysicsConstraint = SpinePhysicsConstraint;
2128
+ exports.SpineResource = SpineResource;
2129
+ exports.SpineSkeleton = SpineSkeleton;
2130
+ exports.SpineSkeletonData = SpineSkeletonData;
2131
+ exports.SpineSkin = SpineSkin;
2132
+ exports.SpineSlot = SpineSlot;
2133
+ exports.SpineTrackEntry = SpineTrackEntry;
2134
+ exports.version = version;
2135
+
2136
+ Object.defineProperty(exports, '__esModule', { value: true });
2137
+
2138
+ }));
2139
+ //# sourceMappingURL=browser.js.map