@galacean/engine-spine 1.1.0-alpha.2 → 1.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/SpineAnimation.d.ts +4 -39
- package/types/SpineRenderer.d.ts +33 -29
- package/types/core/MeshGenerator.d.ts +5 -1
- package/types/index.d.ts +3 -1
- package/types/loader/LoaderUtils.d.ts +18 -0
- package/types/loader/SpineLoader.d.ts +19 -0
- package/types/spine-core/AssetManager.d.ts +1 -1
- package/types/spine-core/Texture.d.ts +3 -6
- package/types/spine-core/TextureAtlas.d.ts +1 -1
- package/dist/miniprogram.js +0 -1
- package/types/SpineLoader.d.ts +0 -32
package/dist/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{request as t,Texture2D as e,BufferMesh as n,VertexElement as r,VertexElementFormat as a,Buffer as i,BufferBindFlag as s,BufferUsage as o,IndexFormat as l,MeshRenderer as h,SubMesh as u,BlendFactor as c,BlendOperation as d,Shader as f,CullMode as v,RenderQueueType as p,Material as m,ignoreClone as g,Script as w,resourceLoader as E,AssetPromise as x,Entity as y,AssetType as b,Loader as S,TextureFilterMode as M,assignmentClone as A}from"@galacean/engine";function R(t,e){return R=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},R(t,e)}function T(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&&R(t,e)}function I(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 C(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 _(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),t}function k(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 V(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 k(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)?k(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 P,F,N=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)}},_(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"}(P||(P={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(F||(F={}));var O=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},B=function(t){function e(){return t.apply(this,arguments)}T(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(N),L=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 X(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 Y;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 u=parseInt(r[0]),c=parseInt(r[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+c)/a.width,s.v2=(h+u)/a.height):(s.u2=(l+u)/a.width,s.v2=(h+c)/a.height),s.x=l,s.y=h,s.width=Math.abs(u),s.height=Math.abs(c),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 D).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=N.filterFromString(r[0]),a.magFilter=N.filterFromString(r[1]);var d=n.readValue();a.uWrap=F.ClampToEdge,a.vWrap=F.ClampToEdge,"x"==d?a.uWrap=F.Repeat:"y"==d?a.vWrap=F.Repeat:"xy"==d&&(a.uWrap=a.vWrap=F.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}(),X=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}(),D=function(){},Y=function(t){function e(){return t.apply(this,arguments)}return T(e,t),e}(O),U=function(){function n(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 r=n.prototype;return r.downloadText=function(e,n,r){t(e,{type:"text"}).then((function(t){n(t)})).catch((function(t){r(t)}))},r.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()},r.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},r.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++}))},r.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++}))},r.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},r.loadTexture=function(e,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=e=this.pathPrefix+e;this.toLoad++,this.rawDataUris[e]&&(e=this.rawDataUris[e]),t(e,{type:"image"}).then((function(t){var r=a.textureLoader(t);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(e,r)})).catch((function(t){r(t)}))},r.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)}))},r.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=c.value,o=!1;a.loadTexture(e,(function(e,u){if(l.count++,l.count==h.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 L(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,l.count++,l.count==h.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++)}))},l={count:0},h=new Array;try{new L(s,(function(t){return h.push(""==i?t:i+"/"+t),new B(new e(a.engine,16,16))}))}catch(e){var u=e;return a.errors[t]="Couldn't load texture atlas "+t+": "+u.message,r&&r("Couldn't load texture atlas "+t+": "+u.message),a.onLoad(),void a.loaded++}for(var c,d=V(h);!(c=d()).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++}))},r.get=function(t){return t=this.pathPrefix+t,this.assets[t]},r.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},r.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},r.isLoadingComplete=function(){return 0==this.toLoad},r.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},r.getToLoad=function(){return this.toLoad},r.getLoaded=function(){return this.loaded},r.dispose=function(){this.removeAll()},r.hasErrors=function(){return Object.keys(this.errors).length>0},r.getErrors=function(){return this.errors},_(n,[{key:"engine",get:function(){return this._engine}}]),n}();var W=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}(),q=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}();q.WHITE=new q(1,1,1,1),q.RED=new q(1,0,0,1),q.GREEN=new q(0,1,0,1),q.BLUE=new q(0,0,1,1),q.MAGENTA=new q(1,0,1,1);var H=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}();H.PI=3.1415927,H.PI2=2*H.PI,H.radiansToDegrees=180/H.PI,H.radDeg=H.radiansToDegrees,H.degreesToRadians=H.PI/180,H.degRad=H.degreesToRadians;var G=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}();G.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var j=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}(),z=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}(),Z=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},Q=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}T(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 v=s.bones;if(0==o.length)for(var p=a,m=3*c;p<n;p+=i){var g=0,w=0,E=h[u++];for(E+=u;u<E;u++,m+=3){var x=v[h[u]],y=l[m],b=l[m+1],S=l[m+2];g+=(y*x.a+b*x.b+x.worldX)*S,w+=(y*x.c+b*x.d+x.worldY)*S}r[p]=g,r[p+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=v[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,O=N.worldX,B=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+O,r[W+1]=q*D+H*Y+B}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),G.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=G.newFloatArray(this.vertices.length),G.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(Z);Q.nextID=0;var J=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 q(1,1,1,1),n.offset=G.newFloatArray(8),n.uvs=G.newFloatArray(8),n.tempColor=new q(1,1,1,1),n}T(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,v=i*l+this.x,p=i*h,m=s*l+this.y,g=s*h,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-g,w[e.OY2]=m+c,w[e.OX3]=v-g,w[e.OY3]=m+p,w[e.OX4]=v-f,w[e.OY4]=d+p},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,G.arrayCopy(this.uvs,0,t.uvs,0,8),G.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(Z);function K(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}J.OX1=0,J.OY1=1,J.OX2=2,J.OY2=3,J.OX3=4,J.OY3=5,J.OX4=6,J.OY4=7,J.X1=0,J.Y1=1,J.C1R=2,J.C1G=3,J.C1B=4,J.C1A=5,J.U1=6,J.V1=7,J.X2=8,J.Y2=9,J.C2R=10,J.C2G=11,J.C2B=12,J.C2A=13,J.U2=14,J.V2=15,J.X3=16,J.Y3=17,J.C3R=18,J.C3G=19,J.C3B=20,J.C3A=21,J.U3=22,J.V3=23,J.X4=24,J.Y4=25,J.C4R=26,J.C4G=27,J.C4B=28,J.C4A=29,J.U4=30,J.V4=31;var $,tt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(1,1,1,1),n.tempColor=new q(0,0,0,0),n}T(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=G.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(K(this.region,Y)){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),G.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),G.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),G.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),G.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}(Q),et=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(1,1,1,1),n}return T(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(Q),nt=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new q(1,1,1,1),n}return T(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),G.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(Q),rt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(.38,.94,0,1),n.name=e,n}T(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=H.cosDeg(this.rotation),n=H.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*H.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}(Q),at=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(.2275,.2275,.8078,1),n}return T(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}(Q),it=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 J(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 tt(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new et(e)},e.newPathAttachment=function(t,e){return new nt(e)},e.newPointAttachment=function(t,e){return new rt(e)},e.newClippingAttachment=function(t,e){return new at(e)},t}(),st=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}(),ot=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 q,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"}($||($={}));var lt,ht,ut,ct=function(t,e,n){if(this.color=new q(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},dt=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},ft=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 T(e,t),e}(dt),vt=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 T(e,t),e}(dt),pt=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return T(e,t),e}(dt);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(lt||(lt={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(ht||(ht={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(ut||(ut={}));var mt,gt,wt,Et=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},xt=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&&(K(c.attachment,tt)?(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 Et(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 Et(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}(),yt=function(t){this.name=t},bt=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"}(mt||(mt={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(gt||(gt={})),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"}(wt||(wt={}));var St=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=G.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,v=e*t.BEZIER_SIZE,p=this.curves;p[v++]=t.BEZIER;for(var m=d,g=f,w=v+t.BEZIER_SIZE-1;v<w;v+=2)p[v]=m,p[v+1]=g,d+=u,f+=c,u+=l,c+=h,m+=d,g+=f},e.getCurvePercent=function(e,n){n=H.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}();St.LINEAR=0,St.STEPPED=1,St.BEZIER=2,St.BEZIER_SIZE=19;var Mt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=G.newFloatArray(e<<1),n}T(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=bt.binarySearch(l,r,e.ENTRIES),f=l[d+e.PREV_ROTATION],v=l[d],p=this.getCurvePercent((d>>1)-1,1-(r-v)/(l[d+e.PREV_TIME]-v)),m=l[d+e.ROTATION]-f;switch(m=f+(m-360*(16384-(16384.499999999996-m/360|0)))*p,s){case 0:h.rotation=h.data.rotation+(m-360*(16384-(16384.499999999996-m/360|0)))*i;break;case 1:case 2:m+=h.data.rotation-h.rotation;case 3:h.rotation+=(m-360*(16384-(16384.499999999996-m/360|0)))*i}}},e}(St);Mt.ENTRIES=2,Mt.PREV_TIME=-2,Mt.PREV_ROTATION=-1,Mt.ROTATION=1;var At=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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=bt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}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}(St);At.ENTRIES=3,At.PREV_TIME=-3,At.PREV_X=-2,At.PREV_Y=-1,At.X=1,At.Y=2;var Rt=function(t){function e(e){return t.call(this,e)}T(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=bt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u=(u+(l[d+e.X]-u)*v)*h.data.scaleX,c=(c+(l[d+e.Y]-c)*v)*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 p=0,m=0;if(1==o)switch(s){case 0:p=h.data.scaleX,m=h.data.scaleY,h.scaleX=p+(Math.abs(u)*H.signum(p)-p)*i,h.scaleY=m+(Math.abs(c)*H.signum(m)-m)*i;break;case 1:case 2:p=h.scaleX,m=h.scaleY,h.scaleX=p+(Math.abs(u)*H.signum(p)-p)*i,h.scaleY=m+(Math.abs(c)*H.signum(m)-m)*i;break;case 3:p=h.scaleX,m=h.scaleY,h.scaleX=p+(Math.abs(u)*H.signum(p)-h.data.scaleX)*i,h.scaleY=m+(Math.abs(c)*H.signum(m)-h.data.scaleY)*i}else switch(s){case 0:p=Math.abs(h.data.scaleX)*H.signum(u),m=Math.abs(h.data.scaleY)*H.signum(c),h.scaleX=p+(u-p)*i,h.scaleY=m+(c-m)*i;break;case 1:case 2:p=Math.abs(h.scaleX)*H.signum(u),m=Math.abs(h.scaleY)*H.signum(c),h.scaleX=p+(u-p)*i,h.scaleY=m+(c-m)*i;break;case 3:p=H.signum(u),m=H.signum(c),h.scaleX=Math.abs(h.scaleX)*p+(u-Math.abs(h.data.scaleX)*p)*i,h.scaleY=Math.abs(h.scaleY)*m+(c-Math.abs(h.data.scaleY)*m)*i}}}},e}(At),Tt=function(t){function e(e){return t.call(this,e)}T(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=bt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}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}(At),It=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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,v=0,p=0;if(r>=h[h.length-e.ENTRIES]){var m=h.length;d=h[m+e.PREV_R],f=h[m+e.PREV_G],v=h[m+e.PREV_B],p=h[m+e.PREV_A]}else{var g=bt.binarySearch(h,r,e.ENTRIES);d=h[g+e.PREV_R],f=h[g+e.PREV_G],v=h[g+e.PREV_B],p=h[g+e.PREV_A];var w=h[g],E=this.getCurvePercent(g/e.ENTRIES-1,1-(r-w)/(h[g+e.PREV_TIME]-w));d+=(h[g+e.R]-d)*E,f+=(h[g+e.G]-f)*E,v+=(h[g+e.B]-v)*E,p+=(h[g+e.A]-p)*E}if(1==i)l.color.set(d,f,v,p);else{var x=l.color;0==s&&x.setFromColor(l.data.color),x.add((d-x.r)*i,(f-x.g)*i,(v-x.b)*i,(p-x.a)*i)}}}},e}(St);It.ENTRIES=5,It.PREV_TIME=-5,It.PREV_R=-4,It.PREV_G=-3,It.PREV_B=-2,It.PREV_A=-1,It.R=1,It.G=2,It.B=3,It.A=4;var Ct=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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 v=0,p=0,m=0,g=0,w=0,E=0,x=0;if(r>=h[h.length-e.ENTRIES]){var y=h.length;v=h[y+e.PREV_R],p=h[y+e.PREV_G],m=h[y+e.PREV_B],g=h[y+e.PREV_A],w=h[y+e.PREV_R2],E=h[y+e.PREV_G2],x=h[y+e.PREV_B2]}else{var b=bt.binarySearch(h,r,e.ENTRIES);v=h[b+e.PREV_R],p=h[b+e.PREV_G],m=h[b+e.PREV_B],g=h[b+e.PREV_A],w=h[b+e.PREV_R2],E=h[b+e.PREV_G2],x=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));v+=(h[b+e.R]-v)*M,p+=(h[b+e.G]-p)*M,m+=(h[b+e.B]-m)*M,g+=(h[b+e.A]-g)*M,w+=(h[b+e.R2]-w)*M,E+=(h[b+e.G2]-E)*M,x+=(h[b+e.B2]-x)*M}if(1==i)l.color.set(v,p,m,g),l.darkColor.set(w,E,x,1);else{var A=l.color,R=l.darkColor;0==s&&(A.setFromColor(l.data.color),R.setFromColor(l.data.darkColor)),A.add((v-A.r)*i,(p-A.g)*i,(m-A.b)*i,(g-A.a)*i),R.add((w-R.r)*i,(E-R.g)*i,(x-R.b)*i,0)}}}},e}(St);Ct.ENTRIES=8,Ct.PREV_TIME=-8,Ct.PREV_R=-7,Ct.PREV_G=-6,Ct.PREV_B=-5,Ct.PREV_A=-4,Ct.PREV_R2=-3,Ct.PREV_G2=-2,Ct.PREV_B2=-1,Ct.R=1,Ct.G=2,Ct.B=3,Ct.A=4,Ct.R2=5,Ct.G2=6,Ct.B2=7;var _t=function(){function t(t){this.frames=G.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:bt.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}(),kt=null,Vt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=G.newFloatArray(e),n.frameVertices=new Array(e),null==kt&&(kt=G.newFloatArray(64)),n}T(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(K(l,Q)&&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 v=G.setArraySize(h,c);if(null==f.bones)for(var p=f.vertices,m=0;m<c;m++)v[m]+=(p[m]-v[m])*a;else{a=1-a;for(m=0;m<c;m++)v[m]*=a}}}else{var g=G.setArraySize(h,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var E=l;if(null==E.bones)for(var x=E.vertices,y=0;y<c;y++)g[y]+=w[y]-x[y];else for(var b=0;b<c;b++)g[b]+=w[b]}else G.arrayCopy(w,0,g,0,c);else switch(i){case 0:var S=l;if(null==S.bones)for(var M=S.vertices,A=0;A<c;A++){var R=M[A];g[A]=R+(w[A]-R)*a}else for(var T=0;T<c;T++)g[T]=w[T]*a;break;case 1:case 2:for(var I=0;I<c;I++)g[I]+=(w[I]-g[I])*a;break;case 3:var C=l;if(null==C.bones)for(var _=C.vertices,k=0;k<c;k++)g[k]+=(w[k]-_[k])*a;else for(var V=0;V<c;V++)g[V]+=w[V]*a}}else{var P=bt.binarySearch(d,n),F=u[P-1],N=u[P],O=d[P],B=this.getCurvePercent(P-1,1-(n-O)/(d[P-1]-O));if(1==a)if(3==i){var L=l;if(null==L.bones)for(var X=L.vertices,D=0;D<c;D++){var Y=F[D];g[D]+=Y+(N[D]-Y)*B-X[D]}else for(var U=0;U<c;U++){var W=F[U];g[U]+=W+(N[U]-W)*B}}else for(var q=0;q<c;q++){var H=F[q];g[q]=H+(N[q]-H)*B}else switch(i){case 0:var j=l;if(null==j.bones)for(var z=j.vertices,Z=0;Z<c;Z++){var J=F[Z],$=z[Z];g[Z]=$+(J+(N[Z]-J)*B-$)*a}else for(var tt=0;tt<c;tt++){var et=F[tt];g[tt]=(et+(N[tt]-et)*B)*a}break;case 1:case 2:for(var nt=0;nt<c;nt++){var rt=F[nt];g[nt]+=(rt+(N[nt]-rt)*B-g[nt])*a}break;case 3:var at=l;if(null==at.bones)for(var it=at.vertices,st=0;st<c;st++){var ot=F[st];g[st]+=(ot+(N[st]-ot)*B-it[st])*a}else for(var lt=0;lt<c;lt++){var ht=F[lt];g[lt]+=(ht+(N[lt]-ht)*B)*a}}}}}}},e}(St),Pt=function(){function t(t){this.frames=G.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=bt.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&n>=o[h];h++)r.push(this.events[h])}}},t}(),Ft=function(){function t(t){this.frames=G.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||G.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=h[h.length-1]?h.length-1:bt.binarySearch(h,n)-1;var c=this.drawOrders[u];if(null==c)G.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&&G.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),Nt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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=bt.binarySearch(l,r,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],v=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)*v-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*v-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)*v-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*v-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}(St);Nt.ENTRIES=6,Nt.PREV_TIME=-6,Nt.PREV_MIX=-5,Nt.PREV_SOFTNESS=-4,Nt.PREV_BEND_DIRECTION=-3,Nt.PREV_COMPRESS=-2,Nt.PREV_STRETCH=-1,Nt.MIX=1,Nt.SOFTNESS=2,Nt.BEND_DIRECTION=3,Nt.COMPRESS=4,Nt.STRETCH=5;var Ot=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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,v=0;if(r>=l[l.length-e.ENTRIES]){var p=l.length;c=l[p+e.PREV_ROTATE],d=l[p+e.PREV_TRANSLATE],f=l[p+e.PREV_SCALE],v=l[p+e.PREV_SHEAR]}else{var m=bt.binarySearch(l,r,e.ENTRIES);c=l[m+e.PREV_ROTATE],d=l[m+e.PREV_TRANSLATE],f=l[m+e.PREV_SCALE],v=l[m+e.PREV_SHEAR];var g=l[m],w=this.getCurvePercent(m/e.ENTRIES-1,1-(r-g)/(l[m+e.PREV_TIME]-g));c+=(l[m+e.ROTATE]-c)*w,d+=(l[m+e.TRANSLATE]-d)*w,f+=(l[m+e.SCALE]-f)*w,v+=(l[m+e.SHEAR]-v)*w}if(0==s){var E=h.data;h.rotateMix=E.rotateMix+(c-E.rotateMix)*i,h.translateMix=E.translateMix+(d-E.translateMix)*i,h.scaleMix=E.scaleMix+(f-E.scaleMix)*i,h.shearMix=E.shearMix+(v-E.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(v-h.shearMix)*i}},e}(St);Ot.ENTRIES=5,Ot.PREV_TIME=-5,Ot.PREV_ROTATE=-4,Ot.PREV_TRANSLATE=-3,Ot.PREV_SCALE=-2,Ot.PREV_SHEAR=-1,Ot.ROTATE=1,Ot.TRANSLATE=2,Ot.SCALE=3,Ot.SHEAR=4;var Bt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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=bt.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}(St);Bt.ENTRIES=2,Bt.PREV_TIME=-2,Bt.PREV_VALUE=-1,Bt.VALUE=1;var Lt,Xt=function(t){function e(e){return t.call(this,e)}T(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=bt.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}(Bt),Dt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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=bt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*v,c+=(l[d+e.TRANSLATE]-c)*v}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}(St);Dt.ENTRIES=3,Dt.PREV_TIME=-3,Dt.PREV_ROTATE=-2,Dt.PREV_TRANSLATE=-1,Dt.ROTATE=1,Dt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Lt||(Lt={}));var Yt,Ut=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},Wt=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 st,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 ot(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,v=d.bone,p=r.findBone(v);if(null==p)throw new Error("Slot bone not found: "+v);var m=new ct(r.slots.length,f,p),g=this.getValue(d,"color",null);null!=g&&m.color.setFromString(g);var w=this.getValue(d,"dark",null);null!=w&&(m.darkColor=new q(1,1,1,1),m.darkColor.setFromString(w)),m.attachmentName=this.getValue(d,"attachment",null),m.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),r.slots.push(m)}if(a.ik)for(var E=0;E<a.ik.length;E++){var x=a.ik[E],y=new ft(x.name);y.order=this.getValue(x,"order",0),y.skinRequired=this.getValue(x,"skin",!1);for(var b=0;b<x.bones.length;b++){var S=x.bones[b],M=r.findBone(S);if(null==M)throw new Error("IK bone not found: "+S);y.bones.push(M)}var A=x.target;if(y.target=r.findBone(A),null==y.target)throw new Error("IK target bone not found: "+A);y.mix=this.getValue(x,"mix",1),y.softness=this.getValue(x,"softness",0)*n,y.bendDirection=this.getValue(x,"bendPositive",!0)?1:-1,y.compress=this.getValue(x,"compress",!1),y.stretch=this.getValue(x,"stretch",!1),y.uniform=this.getValue(x,"uniform",!1),r.ikConstraints.push(y)}if(a.transform)for(var R=0;R<a.transform.length;R++){var T=a.transform[R],I=new vt(T.name);I.order=this.getValue(T,"order",0),I.skinRequired=this.getValue(T,"skin",!1);for(var C=0;C<T.bones.length;C++){var _=T.bones[C],k=r.findBone(_);if(null==k)throw new Error("Transform constraint bone not found: "+_);I.bones.push(k)}var V=T.target;if(I.target=r.findBone(V),null==I.target)throw new Error("Transform constraint target bone not found: "+V);I.local=this.getValue(T,"local",!1),I.relative=this.getValue(T,"relative",!1),I.offsetRotation=this.getValue(T,"rotation",0),I.offsetX=this.getValue(T,"x",0)*n,I.offsetY=this.getValue(T,"y",0)*n,I.offsetScaleX=this.getValue(T,"scaleX",0),I.offsetScaleY=this.getValue(T,"scaleY",0),I.offsetShearY=this.getValue(T,"shearY",0),I.rotateMix=this.getValue(T,"rotateMix",1),I.translateMix=this.getValue(T,"translateMix",1),I.scaleMix=this.getValue(T,"scaleMix",1),I.shearMix=this.getValue(T,"shearMix",1),r.transformConstraints.push(I)}if(a.path)for(var P=0;P<a.path.length;P++){var F=a.path[P],N=new pt(F.name);N.order=this.getValue(F,"order",0),N.skinRequired=this.getValue(F,"skin",!1);for(var O=0;O<F.bones.length;O++){var B=F.bones[O],L=r.findBone(B);if(null==L)throw new Error("Transform constraint bone not found: "+B);N.bones.push(L)}var X=F.target;if(N.target=r.findSlot(X),null==N.target)throw new Error("Path target slot not found: "+X);N.positionMode=t.positionModeFromString(this.getValue(F,"positionMode","percent")),N.spacingMode=t.spacingModeFromString(this.getValue(F,"spacingMode","length")),N.rotateMode=t.rotateModeFromString(this.getValue(F,"rotateMode","tangent")),N.offsetRotation=this.getValue(F,"rotation",0),N.position=this.getValue(F,"position",0),N.positionMode==lt.Fixed&&(N.position*=n),N.spacing=this.getValue(F,"spacing",0),N.spacingMode!=ht.Length&&N.spacingMode!=ht.Fixed||(N.spacing*=n),N.rotateMix=this.getValue(F,"rotateMix",1),N.translateMix=this.getValue(F,"translateMix",1),r.pathConstraints.push(N)}if(a.skins)for(var D=0;D<a.skins.length;D++){var Y=a.skins[D],U=new xt(Y.name);if(Y.bones)for(var W=0;W<Y.bones.length;W++){var H=r.findBone(Y.bones[W]);if(null==H)throw new Error("Skin bone not found: "+Y.bones[D]);U.bones.push(H)}if(Y.ik)for(var G=0;G<Y.ik.length;G++){var j=r.findIkConstraint(Y.ik[G]);if(null==j)throw new Error("Skin IK constraint not found: "+Y.ik[D]);U.constraints.push(j)}if(Y.transform)for(var z=0;z<Y.transform.length;z++){var Z=r.findTransformConstraint(Y.transform[z]);if(null==Z)throw new Error("Skin transform constraint not found: "+Y.transform[D]);U.constraints.push(Z)}if(Y.path)for(var Q=0;Q<Y.path.length;Q++){var J=r.findPathConstraint(Y.path[Q]);if(null==J)throw new Error("Skin path constraint not found: "+Y.path[D]);U.constraints.push(J)}for(var K in Y.attachments){var $=r.findSlot(K);if(null==$)throw new Error("Slot not found: "+K);var tt=Y.attachments[K];for(var et in tt){var nt=this.readAttachment(tt[et],U,$.index,et,r);null!=nt&&U.setAttachment($.index,et,nt)}}r.skins.push(U),"default"==U.name&&(r.defaultSkin=U)}for(var rt=0,at=this.linkedMeshes.length;rt<at;rt++){var it=this.linkedMeshes[rt],ut=null==it.skin?r.defaultSkin:r.findSkin(it.skin);if(null==ut)throw new Error("Skin not found: "+it.skin);var dt=ut.getAttachment(it.slotIndex,it.parent);if(null==dt)throw new Error("Parent mesh not found: "+it.parent);it.mesh.deformAttachment=it.inheritDeform?dt:it.mesh,it.mesh.setParentMesh(dt),it.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var mt in a.events){var gt=a.events[mt],wt=new yt(mt);wt.intValue=this.getValue(gt,"int",0),wt.floatValue=this.getValue(gt,"float",0),wt.stringValue=this.getValue(gt,"string",""),wt.audioPath=this.getValue(gt,"audio",null),null!=wt.audioPath&&(wt.volume=this.getValue(gt,"volume",1),wt.balance=this.getValue(gt,"balance",0)),r.events.push(wt)}if(a.animations)for(var Et in a.animations){var bt=a.animations[Et];this.readAnimation(bt,Et,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 v=this.getValue(t,"parent",null);if(null!=v)return this.linkedMeshes.push(new qt(d,this.getValue(t,"skin",null),n,v,this.getValue(t,"deform",!0))),d;var p=t.uvs;return this.readVertices(t,d,p.length),d.triangles=t.triangles,d.regionUVs=p,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var m=this.attachmentLoader.newPathAttachment(e,r);if(null==m)return null;m.closed=this.getValue(t,"closed",!1),m.constantSpeed=this.getValue(t,"constantSpeed",!0);var g=t.vertexCount;this.readVertices(t,m,g<<1);for(var w=G.newArray(g/3,0),E=0;E<t.lengths.length;E++)w[E]=t.lengths[E]*i;m.lengths=w;var x=this.getValue(t,"color",null);return null!=x&&m.color.setFromString(x),m;case"point":var y=this.attachmentLoader.newPointAttachment(e,r);if(null==y)return null;y.x=this.getValue(t,"x",0)*i,y.y=this.getValue(t,"y",0)*i,y.rotation=this.getValue(t,"rotation",0);var b=this.getValue(t,"color",null);return null!=b&&y.color.setFromString(b),y;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,r);if(null==S)return null;var M=this.getValue(t,"end",null);if(null!=M){var A=a.findSlot(M);if(null==A)throw new Error("Clipping end slot not found: "+M);S.endSlot=A}var R=t.vertexCount;this.readVertices(t,S,R<<1);var T=this.getValue(t,"color",null);return null!=T&&S.color.setFromString(T),S}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=G.toFloatArray(i)}else{var c=G.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 _t(u.length);c.slotIndex=l;for(var d=0,f=0;f<u.length;f++){var v=u[f];c.setFrame(d++,this.getValue(v,"time",0),v.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==h){var p=new It(u.length);p.slotIndex=l;for(var m=0,g=0;g<u.length;g++){var w=u[g],E=new q;E.setFromString(w.color),p.setFrame(m,this.getValue(w,"time",0),E.r,E.g,E.b,E.a),this.readCurve(w,p,m),m++}a.push(p),i=Math.max(i,p.frames[(p.getFrameCount()-1)*It.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var x=new Ct(u.length);x.slotIndex=l;for(var y=0,b=0;b<u.length;b++){var S=u[b],M=new q,A=new q;M.setFromString(S.light),A.setFromString(S.dark),x.setFrame(y,this.getValue(S,"time",0),M.r,M.g,M.b,M.a,A.r,A.g,A.b),this.readCurve(S,x,y),y++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*Ct.ENTRIES])}}}if(t.bones)for(var R in t.bones){var T=t.bones[R],I=n.findBoneIndex(R);if(-1==I)throw new Error("Bone not found: "+R);for(var C in T){var _=T[C];if("rotate"===C){var k=new Mt(_.length);k.boneIndex=I;for(var V=0,P=0;P<_.length;P++){var F=_[P];k.setFrame(V,this.getValue(F,"time",0),this.getValue(F,"angle",0)),this.readCurve(F,k,V),V++}a.push(k),i=Math.max(i,k.frames[(k.getFrameCount()-1)*Mt.ENTRIES])}else{if("translate"!==C&&"scale"!==C&&"shear"!==C)throw new Error("Invalid timeline type for a bone: "+C+" ("+R+")");var N=null,O=1,B=0;"scale"===C?(N=new Rt(_.length),B=1):"shear"===C?N=new Tt(_.length):(N=new At(_.length),O=r),N.boneIndex=I;for(var L=0,X=0;X<_.length;X++){var D=_[X],Y=this.getValue(D,"x",B),U=this.getValue(D,"y",B);N.setFrame(L,this.getValue(D,"time",0),Y*O,U*O),this.readCurve(D,N,L),L++}a.push(N),i=Math.max(i,N.frames[(N.getFrameCount()-1)*At.ENTRIES])}}}if(t.ik)for(var W in t.ik){var H=t.ik[W],j=n.findIkConstraint(W),z=new Nt(H.length);z.ikConstraintIndex=n.ikConstraints.indexOf(j);for(var Z=0,Q=0;Q<H.length;Q++){var J=H[Q];z.setFrame(Z,this.getValue(J,"time",0),this.getValue(J,"mix",1),this.getValue(J,"softness",0)*r,this.getValue(J,"bendPositive",!0)?1:-1,this.getValue(J,"compress",!1),this.getValue(J,"stretch",!1)),this.readCurve(J,z,Z),Z++}a.push(z),i=Math.max(i,z.frames[(z.getFrameCount()-1)*Nt.ENTRIES])}if(t.transform)for(var K in t.transform){var $=t.transform[K],tt=n.findTransformConstraint(K),et=new Ot($.length);et.transformConstraintIndex=n.transformConstraints.indexOf(tt);for(var nt=0,rt=0;rt<$.length;rt++){var at=$[rt];et.setFrame(nt,this.getValue(at,"time",0),this.getValue(at,"rotateMix",1),this.getValue(at,"translateMix",1),this.getValue(at,"scaleMix",1),this.getValue(at,"shearMix",1)),this.readCurve(at,et,nt),nt++}a.push(et),i=Math.max(i,et.frames[(et.getFrameCount()-1)*Ot.ENTRIES])}if(t.path)for(var it in t.path){var st=t.path[it],ot=n.findPathConstraintIndex(it);if(-1==ot)throw new Error("Path constraint not found: "+it);var ut=n.pathConstraints[ot];for(var ct in st){var dt=st[ct];if("position"===ct||"spacing"===ct){var ft=null,vt=1;"spacing"===ct?(ft=new Xt(dt.length),ut.spacingMode!=ht.Length&&ut.spacingMode!=ht.Fixed||(vt=r)):(ft=new Bt(dt.length),ut.positionMode==lt.Fixed&&(vt=r)),ft.pathConstraintIndex=ot;for(var pt=0,mt=0;mt<dt.length;mt++){var gt=dt[mt];ft.setFrame(pt,this.getValue(gt,"time",0),this.getValue(gt,ct,0)*vt),this.readCurve(gt,ft,pt),pt++}a.push(ft),i=Math.max(i,ft.frames[(ft.getFrameCount()-1)*Bt.ENTRIES])}else if("mix"===ct){var wt=new Dt(dt.length);wt.pathConstraintIndex=ot;for(var Et=0,xt=0;xt<dt.length;xt++){var yt=dt[xt];wt.setFrame(Et,this.getValue(yt,"time",0),this.getValue(yt,"rotateMix",1),this.getValue(yt,"translateMix",1)),this.readCurve(yt,wt,Et),Et++}a.push(wt),i=Math.max(i,wt.frames[(wt.getFrameCount()-1)*Dt.ENTRIES])}}}if(t.deform)for(var St in t.deform){var kt=t.deform[St],Lt=n.findSkin(St);if(null==Lt)throw new Error("Skin not found: "+St);for(var Yt in kt){var Wt=kt[Yt],qt=n.findSlotIndex(Yt);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var Gt=Wt[Ht],jt=Lt.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 Vt(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?G.newFloatArray(Qt):Zt;else{ee=G.newFloatArray(Qt);var re=this.getValue(te,"offset",0);if(G.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 Ft(oe.length),he=n.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,ve=this.getValue(de,"offsets",null);if(null!=ve){fe=G.newArray(he,-1);for(var pe=G.newArray(he-ve.length,0),me=0,ge=0,we=0;we<ve.length;we++){var Ee=ve[we],xe=n.findSlotIndex(Ee.slot);if(-1==xe)throw new Error("Slot not found: "+Ee.slot);for(;me!=xe;)pe[ge++]=me++;fe[me+Ee.offset]=me++}for(;me<he;)pe[ge++]=me++;for(var ye=he-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--ge])}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 Pt(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 Ut(G.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 bt(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 Lt.Normal;if("additive"==t)return Lt.Additive;if("multiply"==t)return Lt.Multiply;if("screen"==t)return Lt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return lt.Fixed;if("percent"==t)return lt.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return ht.Length;if("fixed"==t)return ht.Fixed;if("percent"==t)return ht.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return ut.Tangent;if("chain"==t)return ut.Chain;if("chainscale"==t)return ut.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return $.Normal;if("onlytranslation"==t)return $.OnlyTranslation;if("norotationorreflection"==t)return $.NoRotationOrReflection;if("noscale"==t)return $.NoScale;if("noscaleorreflection"==t)return $.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),qt=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"}(Yt||(Yt={}));var Ht=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 st;r.name="";var a=new Gt(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 ot(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&&q.rgba8888ToColor(c.color,a.readInt32()),r.bones.push(c)}s=a.readInt(!0);for(var d=0;d<s;d++){var f=a.readString(),v=r.bones[a.readInt(!0)],p=new ct(d,f,v);q.rgba8888ToColor(p.color,a.readInt32());var m=a.readInt32();-1!=m&&q.rgb888ToColor(p.darkColor=new q,m),p.attachmentName=a.readStringRef(),p.blendMode=t.BlendModeValues[a.readInt(!0)],r.slots.push(p)}s=a.readInt(!0);for(var g,w=0;w<s;w++){var E=new ft(a.readString());E.order=a.readInt(!0),E.skinRequired=a.readBoolean(),g=a.readInt(!0);for(var x=0;x<g;x++)E.bones.push(r.bones[a.readInt(!0)]);E.target=r.bones[a.readInt(!0)],E.mix=a.readFloat(),E.softness=a.readFloat()*n,E.bendDirection=a.readByte(),E.compress=a.readBoolean(),E.stretch=a.readBoolean(),E.uniform=a.readBoolean(),r.ikConstraints.push(E)}s=a.readInt(!0);for(var y,b=0;b<s;b++){var S=new vt(a.readString());S.order=a.readInt(!0),S.skinRequired=a.readBoolean(),y=a.readInt(!0);for(var M=0;M<y;M++)S.bones.push(r.bones[a.readInt(!0)]);S.target=r.bones[a.readInt(!0)],S.local=a.readBoolean(),S.relative=a.readBoolean(),S.offsetRotation=a.readFloat(),S.offsetX=a.readFloat()*n,S.offsetY=a.readFloat()*n,S.offsetScaleX=a.readFloat(),S.offsetScaleY=a.readFloat(),S.offsetShearY=a.readFloat(),S.rotateMix=a.readFloat(),S.translateMix=a.readFloat(),S.scaleMix=a.readFloat(),S.shearMix=a.readFloat(),r.transformConstraints.push(S)}s=a.readInt(!0);for(var A,R=0;R<s;R++){var T=new pt(a.readString());T.order=a.readInt(!0),T.skinRequired=a.readBoolean(),A=a.readInt(!0);for(var I=0;I<A;I++)T.bones.push(r.bones[a.readInt(!0)]);T.target=r.slots[a.readInt(!0)],T.positionMode=t.PositionModeValues[a.readInt(!0)],T.spacingMode=t.SpacingModeValues[a.readInt(!0)],T.rotateMode=t.RotateModeValues[a.readInt(!0)],T.offsetRotation=a.readFloat(),T.position=a.readFloat(),T.positionMode==lt.Fixed&&(T.position*=n),T.spacing=a.readFloat(),T.spacingMode!=ht.Length&&T.spacingMode!=ht.Fixed||(T.spacing*=n),T.rotateMix=a.readFloat(),T.translateMix=a.readFloat(),r.pathConstraints.push(T)}var C=this.readSkin(a,r,!0,i);null!=C&&(r.defaultSkin=C,r.skins.push(C));var _=r.skins.length;for(G.setArraySize(r.skins,s=_+a.readInt(!0));_<s;_++)r.skins[_]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var k=0;k<s;k++){var V=this.linkedMeshes[k],P=null==V.skin?r.defaultSkin:r.findSkin(V.skin);if(null==P)throw new Error("Skin not found: "+V.skin);var F=P.getAttachment(V.slotIndex,V.parent);if(null==F)throw new Error("Parent mesh not found: "+V.parent);V.mesh.deformAttachment=V.inheritDeform?F:V.mesh,V.mesh.setParentMesh(F),V.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var N=0;N<s;N++){var O=new yt(a.readStringRef());O.intValue=a.readInt(!1),O.floatValue=a.readFloat(),O.stringValue=a.readString(),O.audioPath=a.readString(),null!=O.audioPath&&(O.volume=a.readFloat(),O.balance=a.readFloat()),r.events.push(O)}s=a.readInt(!0);for(var B=0;B<s;B++)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 xt("default")}else{(a=new xt(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 v=0;v<i;v++)for(var p=t.readInt(!0),m=0,g=t.readInt(!0);m<g;m++){var w=t.readStringRef(),E=this.readAttachment(t,e,a,p,w,r);null!=E&&a.setAttachment(p,w,E)}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 Yt.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),v=e.readFloat(),p=e.readFloat(),m=e.readFloat(),g=e.readFloat(),w=e.readInt32();null==u&&(u=l);var E=this.attachmentLoader.newRegionAttachment(r,l,u);return null==E?null:(E.path=u,E.x=d*o,E.y=f*o,E.scaleX=v,E.scaleY=p,E.rotation=c,E.width=m*o,E.height=g*o,q.rgba8888ToColor(E.color,w),E.updateOffset(),E);case Yt.BoundingBox:var x=e.readInt(!0),y=this.readVertices(e,x),b=s?e.readInt32():0,S=this.attachmentLoader.newBoundingBoxAttachment(r,l);return null==S?null:(S.worldVerticesLength=x<<1,S.vertices=y.vertices,S.bones=y.bones,s&&q.rgba8888ToColor(S.color,b),S);case Yt.Mesh:var M=e.readStringRef(),A=e.readInt32(),R=e.readInt(!0),T=this.readFloatArray(e,R<<1,1),I=this.readShortArray(e),C=this.readVertices(e,R),_=e.readInt(!0),k=null,V=0,P=0;s&&(k=this.readShortArray(e),V=e.readFloat(),P=e.readFloat()),null==M&&(M=l);var F=this.attachmentLoader.newMeshAttachment(r,l,M);return null==F?null:(F.path=M,q.rgba8888ToColor(F.color,A),F.bones=C.bones,F.vertices=C.vertices,F.worldVerticesLength=R<<1,F.triangles=I,F.regionUVs=T,F.updateUVs(),F.hullLength=_<<1,s&&(F.edges=k,F.width=V*o,F.height=P*o),F);case Yt.LinkedMesh:var N=e.readStringRef(),O=e.readInt32(),B=e.readStringRef(),L=e.readStringRef(),X=e.readBoolean(),D=0,Y=0;s&&(D=e.readFloat(),Y=e.readFloat()),null==N&&(N=l);var U=this.attachmentLoader.newMeshAttachment(r,l,N);return null==U?null:(U.path=N,q.rgba8888ToColor(U.color,O),s&&(U.width=D*o,U.height=Y*o),this.linkedMeshes.push(new jt(U,B,a,L,X)),U);case Yt.Path:for(var W=e.readBoolean(),H=e.readBoolean(),j=e.readInt(!0),z=this.readVertices(e,j),Z=G.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=W,$.constantSpeed=H,$.worldVerticesLength=j<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&q.rgba8888ToColor($.color,K),$);case Yt.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&&q.rgba8888ToColor(at.color,rt),at);case Yt.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&&q.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var n=e<<1,r=new zt,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=G.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 q,l=new q,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 v=e.readByte(),p=e.readInt(!0);switch(v){case t.SLOT_ATTACHMENT:var m=new _t(p);m.slotIndex=c;for(var g=0;g<p;g++)m.setFrame(g,e.readFloat(),e.readStringRef());a.push(m),s=Math.max(s,m.frames[p-1]);break;case t.SLOT_COLOR:var w=new It(p);w.slotIndex=c;for(var E=0;E<p;E++){var x=e.readFloat();q.rgba8888ToColor(o,e.readInt32()),w.setFrame(E,x,o.r,o.g,o.b,o.a),E<p-1&&this.readCurve(e,E,w)}a.push(w),s=Math.max(s,w.frames[(p-1)*It.ENTRIES]);break;case t.SLOT_TWO_COLOR:var y=new Ct(p);y.slotIndex=c;for(var b=0;b<p;b++){var S=e.readFloat();q.rgba8888ToColor(o,e.readInt32()),q.rgb888ToColor(l,e.readInt32()),y.setFrame(b,S,o.r,o.g,o.b,o.a,l.r,l.g,l.b),b<p-1&&this.readCurve(e,b,y)}a.push(y),s=Math.max(s,y.frames[(p-1)*Ct.ENTRIES])}}for(var M=0,A=e.readInt(!0);M<A;M++)for(var R=e.readInt(!0),T=0,I=e.readInt(!0);T<I;T++){var C=e.readByte(),_=e.readInt(!0);switch(C){case t.BONE_ROTATE:var k=new Mt(_);k.boneIndex=R;for(var V=0;V<_;V++)k.setFrame(V,e.readFloat(),e.readFloat()),V<_-1&&this.readCurve(e,V,k);a.push(k),s=Math.max(s,k.frames[(_-1)*Mt.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var P=void 0,F=1;C==t.BONE_SCALE?P=new Rt(_):C==t.BONE_SHEAR?P=new Tt(_):(P=new At(_),F=i),P.boneIndex=R;for(var N=0;N<_;N++)P.setFrame(N,e.readFloat(),e.readFloat()*F,e.readFloat()*F),N<_-1&&this.readCurve(e,N,P);a.push(P),s=Math.max(s,P.frames[(_-1)*At.ENTRIES])}}for(var O=0,B=e.readInt(!0);O<B;O++){var L=e.readInt(!0),X=e.readInt(!0),D=new Nt(X);D.ikConstraintIndex=L;for(var Y=0;Y<X;Y++)D.setFrame(Y,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),Y<X-1&&this.readCurve(e,Y,D);a.push(D),s=Math.max(s,D.frames[(X-1)*Nt.ENTRIES])}for(var U=0,W=e.readInt(!0);U<W;U++){var H=e.readInt(!0),j=e.readInt(!0),z=new Ot(j);z.transformConstraintIndex=H;for(var Z=0;Z<j;Z++)z.setFrame(Z,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),Z<j-1&&this.readCurve(e,Z,z);a.push(z),s=Math.max(s,z.frames[(j-1)*Ot.ENTRIES])}for(var Q=0,J=e.readInt(!0);Q<J;Q++)for(var K=e.readInt(!0),$=r.pathConstraints[K],tt=0,et=e.readInt(!0);tt<et;tt++){var nt=e.readByte(),rt=e.readInt(!0);switch(nt){case t.PATH_POSITION:case t.PATH_SPACING:var at=void 0,it=1;nt==t.PATH_SPACING?(at=new Xt(rt),$.spacingMode!=ht.Length&&$.spacingMode!=ht.Fixed||(it=i)):(at=new Bt(rt),$.positionMode==lt.Fixed&&(it=i)),at.pathConstraintIndex=K;for(var st=0;st<rt;st++)at.setFrame(st,e.readFloat(),e.readFloat()*it),st<rt-1&&this.readCurve(e,st,at);a.push(at),s=Math.max(s,at.frames[(rt-1)*Bt.ENTRIES]);break;case t.PATH_MIX:var ot=new Dt(rt);ot.pathConstraintIndex=K;for(var ut=0;ut<rt;ut++)ot.setFrame(ut,e.readFloat(),e.readFloat(),e.readFloat()),ut<rt-1&&this.readCurve(e,ut,ot);a.push(ot),s=Math.max(s,ot.frames[(rt-1)*Dt.ENTRIES])}}for(var ct=0,dt=e.readInt(!0);ct<dt;ct++)for(var ft=r.skins[e.readInt(!0)],vt=0,pt=e.readInt(!0);vt<pt;vt++)for(var mt=e.readInt(!0),gt=0,wt=e.readInt(!0);gt<wt;gt++){var Et=ft.getAttachment(mt,e.readStringRef()),xt=null!=Et.bones,yt=Et.vertices,St=xt?yt.length/3*2:yt.length,kt=e.readInt(!0),Lt=new Vt(kt);Lt.slotIndex=mt,Lt.attachment=Et;for(var Yt=0;Yt<kt;Yt++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=xt?G.newFloatArray(St):yt;else{qt=G.newFloatArray(St);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(!xt)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=yt[Zt]}Lt.setFrame(Yt,Wt,qt),Yt<kt-1&&this.readCurve(e,Yt,Lt)}a.push(Lt),s=Math.max(s,Lt.frames[kt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new Ft(Jt),$t=r.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=G.newArray($t,0),ae=$t-1;ae>=0;ae--)re[ae]=-1;for(var ie=G.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 Pt(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=r.events[e.readInt(!0)],me=new Ut(ve,pe);me.intValue=e.readInt(!1),me.floatValue=e.readFloat(),me.stringValue=e.readBoolean()?e.readString():pe.stringValue,null!=me.data.audioPath&&(me.volume=e.readFloat(),me.balance=e.readFloat()),de.setFrame(fe,me)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new bt(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}();Ht.AttachmentTypeValues=[0,1,2,3,4,5,6],Ht.TransformModeValues=[$.Normal,$.OnlyTranslation,$.NoRotationOrReflection,$.NoScale,$.NoScaleOrReflection],Ht.PositionModeValues=[lt.Fixed,lt.Percent],Ht.SpacingModeValues=[ht.Length,ht.Fixed,ht.Percent],Ht.RotateModeValues=[ut.Tangent,ut.Chain,ut.ChainScale],Ht.BlendModeValues=[Lt.Normal,Lt.Additive,Lt.Multiply,Lt.Screen],Ht.BONE_ROTATE=0,Ht.BONE_TRANSLATE=1,Ht.BONE_SCALE=2,Ht.BONE_SHEAR=3,Ht.SLOT_ATTACHMENT=0,Ht.SLOT_COLOR=1,Ht.SLOT_TWO_COLOR=2,Ht.PATH_POSITION=0,Ht.PATH_SPACING=1,Ht.PATH_MIX=2,Ht.CURVE_LINEAR=0,Ht.CURVE_STEPPED=1,Ht.CURVE_BEZIER=2;var Gt=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}(),jt=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},zt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function Zt(){return Zt=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},Zt.apply(this,arguments)}var Qt=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=H.cosDeg(n+i)*r*u,this.b=H.cosDeg(h)*a*u,this.c=H.sinDeg(n+i)*r*c,this.d=H.sinDeg(h)*a*c,this.worldX=t*u+l.x,void(this.worldY=e*c+l.y)}var d=o.a,f=o.b,v=o.c,p=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=v*t+p*e+o.worldY,this.data.transformMode){case $.Normal:var m=n+90+s,g=H.cosDeg(n+i)*r,w=H.cosDeg(m)*a,E=H.sinDeg(n+i)*r,x=H.sinDeg(m)*a;return this.a=d*g+f*E,this.b=d*w+f*x,this.c=v*g+p*E,void(this.d=v*w+p*x);case $.OnlyTranslation:var y=n+90+s;this.a=H.cosDeg(n+i)*r,this.b=H.cosDeg(y)*a,this.c=H.sinDeg(n+i)*r,this.d=H.sinDeg(y)*a;break;case $.NoRotationOrReflection:var b=d*d+v*v,S=0;b>1e-4?(b=Math.abs(d*p-f*v)/b,d/=this.skeleton.scaleX,f=(v/=this.skeleton.scaleY)*b,p=d*b,S=Math.atan2(v,d)*H.radDeg):(d=0,v=0,S=90-Math.atan2(p,f)*H.radDeg);var M=n+i-S,A=n+s-S+90,R=H.cosDeg(M)*r,T=H.cosDeg(A)*a,I=H.sinDeg(M)*r,C=H.sinDeg(A)*a;this.a=d*R-f*I,this.b=d*T-f*C,this.c=v*R+p*I,this.d=v*T+p*C;break;case $.NoScale:case $.NoScaleOrReflection:var _=H.cosDeg(n),k=H.sinDeg(n),V=(d*_+f*k)/this.skeleton.scaleX,P=(v*_+p*k)/this.skeleton.scaleY,F=Math.sqrt(V*V+P*P);F>1e-5&&(F=1/F),V*=F,P*=F,F=Math.sqrt(V*V+P*P),this.data.transformMode==$.NoScale&&d*p-f*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(F=-F);var N=Math.PI/2+Math.atan2(P,V),O=Math.cos(N)*F,B=Math.sin(N)*F,L=H.cosDeg(i)*r,X=H.cosDeg(90+s)*a,D=H.sinDeg(i)*r,Y=H.sinDeg(90+s)*a;this.a=V*L+O*D,this.b=V*X+O*Y,this.c=P*L+B*D,this.d=P*X+B*Y}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)*H.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*H.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)*H.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)*H.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,v=h*this.c-c*this.a,p=h*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+v*v),this.ascaleX>1e-4){var m=d*p-f*v;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(d*f+v*p,m)*H.radDeg,this.arotation=Math.atan2(v,d)*H.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,f)*H.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=H.sinDeg(t),n=H.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*H.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=H.sinDeg(t),n=H.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*H.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=H.cosDeg(t),s=H.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}(),Jt=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 q,this.darkColor=null==t.darkColor?null:new q,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}(),Kt=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,v=0;switch(t.data.transformMode){case $.OnlyTranslation:f=e-t.worldX,v=n-t.worldY;break;case $.NoRotationOrReflection:var p=Math.abs(l*c-h*u)/(l*l+u*u),m=l/t.skeleton.scaleX,g=u/t.skeleton.scaleY;h=-g*p*t.skeleton.scaleX,c=m*p*t.skeleton.scaleY,d+=Math.atan2(g,m)*H.radDeg;default:var w=e-o.worldX,E=n-o.worldY,x=l*c-h*u;f=(w*c-E*h)/x-t.ax,v=(E*l-w*u)/x-t.ay}d+=Math.atan2(v,f)*H.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var y=t.ascaleX,b=t.ascaleY;if(r||a){switch(t.data.transformMode){case $.NoScale:case $.NoScaleOrReflection:f=e-t.worldX,v=n-t.worldY}var S=t.data.length*y,M=Math.sqrt(f*f+v*v);if(r&&M<S||a&&M>S&&S>1e-4){var A=(M/S-1)*s+1;y*=A,i&&(b*=A)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,y,b,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,v=0,p=0,m=0;u<0?(u=-u,v=180,m=-1):(v=0,m=1),d<0&&(d=-d,m=-m),f<0?(f=-f,p=180):p=0;var g=e.ax,w=0,E=0,x=0,y=t.a,b=t.b,S=t.c,M=t.d,A=Math.abs(u-d)<=1e-4;A?(E=y*g+b*(w=e.ay)+t.worldX,x=S*g+M*w+t.worldY):(w=0,E=y*g+t.worldX,x=S*g+t.worldY);var R=t.parent;y=R.a,b=R.b,S=R.c;var T,I,C=1/(y*(M=R.d)-b*S),_=E-R.worldX,k=x-R.worldY,V=(_*M-k*b)*C-l,P=(k*y-_*S)*C-h,F=Math.sqrt(V*V+P*P),N=e.data.length*f;if(F<1e-4)return this.apply1(t,n,r,!1,i,!1,o),void e.updateWorldTransformWith(g,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var O=((_=n-R.worldX)*M-(k=r-R.worldY)*b)*C-l,B=(k*y-_*S)*C-h,L=O*O+B*B;if(0!=s){s*=u*(f+1)/2;var X=Math.sqrt(L),D=X-F-N*u+s;if(D>0){var Y=Math.min(1,D/(2*s))-1;L=(O-=(Y=(D-s*(1-Y*Y))/X)*O)*O+(B-=Y*B)*B}}t:if(A){var U=(L-F*F-(N*=u)*N)/(2*F*N);U<-1?U=-1:U>1&&(U=1,i&&(c*=(Math.sqrt(L)/(F+N)-1)*o+1)),I=Math.acos(U)*a,y=F+N*U,b=N*Math.sin(I),T=Math.atan2(B*y-O*b,O*y+B*b)}else{var W=(y=u*N)*y,q=(b=d*N)*b,G=Math.atan2(B,O),j=-2*q*F,z=q-W;if((M=j*j-4*z*(S=q*F*F+W*L-W*q))>=0){var Z=Math.sqrt(M);j<0&&(Z=-Z);var Q=(Z=-(j+Z)/2)/z,J=S/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=L){k=Math.sqrt(L-K*K)*a,T=G-Math.atan2(k,K),I=Math.atan2(k/d,(K-F)/u);break t}}var $=H.PI,tt=F-y,et=tt*tt,nt=0,rt=0,at=F+y,it=at*at,st=0;(S=-y*F/(W-q))>=-1&&S<=1&&(S=Math.acos(S),(M=(_=y*Math.cos(S)+F)*_+(k=b*Math.sin(S))*k)<et&&($=S,et=M,tt=_,nt=k),M>it&&(rt=S,it=M,at=_,st=k)),L<=(et+it)/2?(T=G-Math.atan2(nt*a,tt),I=$*a):(T=G-Math.atan2(st*a,at),I=rt*a)}var ot=Math.atan2(w,g)*m,lt=t.arotation;(T=(T-ot)*H.radDeg+v-lt)>180?T-=360:T<-180&&(T+=360),t.updateWorldTransformWith(l,h,lt+T*o,c,t.ascaleY,0,0),lt=e.arotation,(I=((I+ot)*H.radDeg-e.ashearX)*m+p-lt)>180?I-=360:I<-180&&(I+=360),e.updateWorldTransformWith(g,w,lt+I*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),$t=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new z,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?H.degRad:-H.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],m=!1;if(0!=t){var g=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)-Math.atan2(E,g)+u;y>H.PI?y-=H.PI2:y<-H.PI&&(y+=H.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*g-S*E,p.b=b*w-S*x,p.c=S*g+b*E,p.d=S*w+b*x,m=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(M.x-p.worldX)*e,p.worldY+=(M.y-p.worldY)*e,m=!0}if(n>0){var A=Math.sqrt(p.a*p.a+p.c*p.c),R=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(R-A+this.data.offsetScaleX)*n)/A),p.a*=A,p.c*=A,A=Math.sqrt(p.b*p.b+p.d*p.d),R=Math.sqrt(s*s+l*l),A>1e-5&&(A=(A+(R-A+this.data.offsetScaleY)*n)/A),p.b*=A,p.d*=A,m=!0}if(r>0){var T=p.b,I=p.d,C=Math.atan2(I,T),_=Math.atan2(l,s)-Math.atan2(o,i)-(C-Math.atan2(p.c,p.a));_>H.PI?_-=H.PI2:_<-H.PI&&(_+=H.PI2),_=C+(_+c)*r;var k=Math.sqrt(T*T+I*I);p.b=Math.cos(_)*k,p.d=Math.sin(_)*k,m=!0}m&&(p.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?H.degRad:-H.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],m=!1;if(0!=t){var g=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)+u;y>H.PI?y-=H.PI2:y<-H.PI&&(y+=H.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*g-S*E,p.b=b*w-S*x,p.c=S*g+b*E,p.d=S*w+b*x,m=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=M.x*e,p.worldY+=M.y*e,m=!0}if(n>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;p.a*=A,p.c*=A,A=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*n+1,p.b*=A,p.d*=A,m=!0}if(r>0){var R=Math.atan2(l,s)-Math.atan2(o,i);R>H.PI?R-=H.PI2:R<-H.PI&&(R+=H.PI2);var T=p.b,I=p.d;R=Math.atan2(I,T)+(R-H.PI/2+c)*r;var C=Math.sqrt(T*T+I*I);p.b=Math.cos(R)*C,p.d=Math.sin(R)*C,m=!0}m&&(p.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,v=l.ascaleY;0!=n&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*n)/f),v>1e-5&&(v=(v+(a.ascaleY-v+this.data.offsetScaleY)*n)/v));var p=l.ashearY;if(0!=r){var m=a.ashearY-p+this.data.offsetShearY;m-=360*(16384-(16384.499999999996-m/360|0)),l.shearY+=m*r}l.updateWorldTransformWith(c,d,h,f,v,l.ashearX,p)}},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 v=l.ashearY;0!=r&&(v+=(a.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,v)}},t}(),te=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(K(e,nt)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==ht.Percent,o=i.rotateMode,l=o==ut.Tangent,h=o==ut.ChainScale,u=this.bones.length,c=l?u:u+1,d=this.bones,f=G.setArraySize(this.spaces,c),v=null,p=this.spacing;if(h||!s){h&&(v=G.setArraySize(this.lengths,u));for(var m=i.spacingMode==ht.Length,g=0,w=c-1;g<w;){var E=d[g],x=E.data.length;if(x<t.epsilon)h&&(v[g]=0),f[++g]=0;else if(s){if(h){var y=x*E.a,b=x*E.c,S=Math.sqrt(y*y+b*b);v[g]=S}f[++g]=p}else{var M=x*E.a,A=x*E.c,R=Math.sqrt(M*M+A*A);h&&(v[g]=R),f[++g]=(m?x+p:p)*R/x}}}else for(var T=1;T<c;T++)f[T]=p;var I=this.computeWorldPositions(e,c,l,i.positionMode==lt.Percent,s),C=I[0],_=I[1],k=i.offsetRotation,V=!1;if(0==k)V=o==ut.Chain;else{V=!1;var P=this.target.bone;k*=P.a*P.d-P.b*P.c>0?H.degRad:-H.degRad}for(var F=0,N=3;F<u;F++,N+=3){var O=d[F];O.worldX+=(C-O.worldX)*r,O.worldY+=(_-O.worldY)*r;var B=I[N],L=I[N+1],X=B-C,D=L-_;if(h){var Y=v[F];if(0!=Y){var U=(Math.sqrt(X*X+D*D)/Y-1)*n+1;O.a*=U,O.c*=U}}if(C=B,_=L,a){var W=O.a,q=O.b,j=O.c,z=O.d,Z=0,Q=0,J=0;if(Z=l?I[N-1]:0==f[F+1]?I[N+2]:Math.atan2(D,X),Z-=Math.atan2(j,W),V){Q=Math.cos(Z),J=Math.sin(Z);var $=O.data.length;C+=($*(Q*W-J*j)-X)*n,_+=($*(J*W+Q*j)-D)*n}else Z+=k;Z>H.PI?Z-=H.PI2:Z<-H.PI&&(Z+=H.PI2),Z*=n,Q=Math.cos(Z),J=Math.sin(Z),O.a=Q*W-J*j,O.b=Q*q-J*z,O.c=J*W+Q*j,O.d=J*q+Q*z}O.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,l=this.spaces,h=G.setArraySize(this.positions,3*n+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,v=t.NONE;if(!e.constantSpeed){var p=e.lengths,m=p[f-=c?1:2];if(a&&(o*=m),i)for(var g=1;g<n;g++)l[g]*=m;u=G.setArraySize(this.world,8);for(var w=0,E=0,x=0;w<n;w++,E+=3){var y=l[w],b=o+=y;if(c)(b%=m)<0&&(b+=m),x=0;else{if(b<0){v!=t.BEFORE&&(v=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(b,u,0,h,E);continue}if(b>m){v!=t.AFTER&&(v=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(b-m,u,0,h,E);continue}}for(;;x++){var S=p[x];if(!(b>S)){if(0==x)b/=S;else{var M=p[x-1];b=(b-M)/(S-M)}break}}x!=v&&(v=x,c&&x==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*x+2,8,u,0,2)),this.addCurvePosition(b,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,E,r||w>0&&0==y)}return h}c?(d+=2,u=G.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=G.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var A=G.setArraySize(this.curves,f),R=0,T=u[0],I=u[1],C=0,_=0,k=0,V=0,P=0,F=0,N=0,O=0,B=0,L=0,X=0,D=0,Y=0,U=0,W=0,q=2;W<f;W++,q+=6)C=u[q],_=u[q+1],k=u[q+2],V=u[q+3],X=2*(N=.1875*(T-2*C+k))+(B=.09375*(3*(C-k)-T+(P=u[q+4]))),D=2*(O=.1875*(I-2*_+V))+(L=.09375*(3*(_-V)-I+(F=u[q+5]))),Y=.75*(C-T)+N+.16666667*B,U=.75*(_-I)+O+.16666667*L,R+=Math.sqrt(Y*Y+U*U),Y+=X,U+=D,X+=B,D+=L,R+=Math.sqrt(Y*Y+U*U),Y+=X,U+=D,R+=Math.sqrt(Y*Y+U*U),Y+=X+B,U+=D+L,R+=Math.sqrt(Y*Y+U*U),A[W]=R,T=P,I=F;if(o*=a?R:R/e.lengths[f-1],i)for(var H=1;H<n;H++)l[H]*=R;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%=R)<0&&(tt+=R),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>R){this.addAfterPosition(tt-R,u,d-4,h,Q);continue}}for(;;J++){var et=A[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=A[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=v){v=J;var rt=6*J;for(T=u[rt],I=u[rt+1],C=u[rt+2],_=u[rt+3],k=u[rt+4],V=u[rt+5],X=2*(N=.03*(T-2*C+k))+(B=.006*(3*(C-k)-T+(P=u[rt+6]))),D=2*(O=.03*(I-2*_+V))+(L=.006*(3*(_-V)-I+(F=u[rt+7]))),Y=.3*(C-T)+N+.16666667*B,U=.3*(_-I)+O+.16666667*L,z=Math.sqrt(Y*Y+U*U),j[0]=z,rt=1;rt<8;rt++)Y+=X,U+=D,X+=B,D+=L,z+=Math.sqrt(Y*Y+U*U),j[rt]=z;Y+=X,U+=D,z+=Math.sqrt(Y*Y+U*U),j[8]=z,Y+=X+B,U+=D+L,z+=Math.sqrt(Y*Y+U*U),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,T,I,C,_,k,V,P,F,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,v=1-t,p=v*v,m=p*v,g=v*t,w=3*g,E=v*w,x=w*t,y=e*m+r*E+i*x+o*f,b=n*m+a*E+s*x+l*f;h[u]=y,h[u+1]=b,c&&(h[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(b-(n*p+a*g*2+s*d),y-(e*p+r*g*2+i*d)))},t}();te.NONE=-1,te.BEFORE=-2,te.AFTER=-3,te.epsilon=1e-5;var ee=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 Qt(n,this,null);else{var a=this.bones[n.parent.index];r=new Qt(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 Jt(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 Kt(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new $t(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var v=t.pathConstraints[f];this.pathConstraints.push(new te(v,this))}this.color=new q(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,v=c.length,p=d+f+v;t:for(var m=0;m<p;m++){for(var g=0;g<d;g++){var w=h[g];if(w.data.order==m){this.sortIkConstraint(w);continue t}}for(var E=0;E<f;E++){var x=u[E];if(x.data.order==m){this.sortTransformConstraint(x);continue t}}for(var y=0;y<v;y++){var b=c[y];if(b.data.order==m){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&&G.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&&G.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();K(s,nt)&&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&&G.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(K(t,nt)){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,v=d.length;f<v;f++){var p=d[f],m=p.data;p.position=m.position,p.spacing=m.spacing,p.rotateMix=m.rotateMix,p.translateMix=m.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;G.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(K(f,J))c=8,d=G.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(K(f,tt)){var v=f;c=v.worldVerticesLength,d=G.setArraySize(n,c,0),v.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var p=0,m=d.length;p<m;p+=2){var g=d[p],w=d[p+1];a=Math.min(a,g),i=Math.min(i,w),s=Math.max(s,g),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),ne=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 ie(this),this.propertyIDs=new W,this.animationsChanged=!1,this.trackEntryPool=new j((function(){return new ae})),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?mt.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==mt.add)for(var v=0;v<d;v++){G.webkit602BugfixHelper(h,l);var p=f[v];K(p,_t)?this.applyAttachmentTimeline(p,e,c,l,!0):p.apply(e,u,c,n,h,l,gt.mixIn)}else{var m=o.timelineMode,g=0==o.timelinesRotation.length;g&&G.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,E=0;E<d;E++){var x=f[E],y=m[E]==t.SUBSEQUENT?l:mt.setup;K(x,Mt)?this.applyRotateTimeline(x,e,c,h,y,w,E<<1,g):K(x,_t)?this.applyAttachmentTimeline(x,e,c,l,!0):(G.webkit602BugfixHelper(h,l),x.apply(e,u,c,n,h,y,gt.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var b=this.unkeyedState+t.SETUP,S=e.slots,M=0,A=e.slots.length;M<A;M++){var R=S[M];if(R.attachmentState==b){var T=R.data.attachmentName;R.attachment=null==T?null:e.getAttachment(R.data.index,T)}}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==mt.first&&(r=mt.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=mt.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,v=f*(1-i);if(r==mt.add)for(var p=0;p<c;p++)d[p].apply(n,h,u,s,v,r,gt.mixOut);else{var m=a.timelineMode,g=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&G.setArraySize(a.timelinesRotation,c<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var x=0;x<c;x++){var y=d[x],b=gt.mixOut,S=void 0,M=0;switch(m[x]){case t.SUBSEQUENT:if(!l&&K(y,Ft))continue;S=r,M=v;break;case t.FIRST:S=mt.setup,M=v;break;case t.HOLD_SUBSEQUENT:S=r,M=f;break;case t.HOLD_FIRST:S=mt.setup,M=f;break;default:S=mt.setup;var A=g[x];M=f*Math.max(0,1-A.mixTime/A.mixDuration)}a.totalAlpha+=M,K(y,Mt)?this.applyRotateTimeline(y,n,u,M,S,E,x<<1,w):K(y,_t)?this.applyAttachmentTimeline(y,n,u,S,o):(G.webkit602BugfixHelper(M,r),l&&K(y,Ft)&&S==mt.setup&&(b=gt.mixIn),y.apply(n,h,u,s,M,S,b))}}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!=mt.setup&&a!=mt.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=l[l.length-1]?l.length-1:bt.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 mt.setup:u.rotation=u.data.rotation;default:return;case mt.first:c=u.rotation,d=u.data.rotation}else if(c=a==mt.setup?u.data.rotation:u.rotation,n>=h[h.length-Mt.ENTRIES])d=u.data.rotation+h[h.length+Mt.PREV_ROTATION];else{var f=bt.binarySearch(h,n,Mt.ENTRIES),v=h[f+Mt.PREV_ROTATION],p=h[f],m=l.getCurvePercent((f>>1)-1,1-(n-p)/(h[f+Mt.PREV_TIME]-p));d=h[f+Mt.ROTATION]-v,d=v+(d-=360*(16384-(16384.499999999996-d/360|0)))*m+u.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var g=0,w=d-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))g=i[s];else{var E=0,x=0;o?(E=0,x=w):(E=i[s],x=i[s+1]);var y=w>0,b=E>=0;H.signum(x)!=H.signum(w)&&Math.abs(x)<=90&&(Math.abs(E)>180&&(E+=360*H.signum(E)),b=y),g=w+E-E%360,b!=y&&(g+=360*H.signum(E)),i[s]=g}i[s+1]=w,c+=g*r,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,n,null,1,a,gt.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]:(G.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=mt.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==mt.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=G.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=G.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||K(u,_t)||K(u,Ft)||K(u,Pt)||!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}();ne.emptyAnimation=new bt("<empty>",[],0),ne.SUBSEQUENT=0,ne.FIRST=1,ne.HOLD_SUBSEQUENT=2,ne.HOLD_FIRST=3,ne.HOLD_MIX=4,ne.SETUP=1,ne.CURRENT=2;var re,ae=function(){function t(){this.mixBlend=mt.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}(),ie=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"}(re||(re={}));var se=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}(),oe=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 j((function(){return new Array})),this.polygonIndicesPool=new j((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,v=a[c]<<1,p=a[d]<<1,m=n[f],g=n[f+1],w=n[v],E=n[v+1],x=n[p],y=n[p+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(x,y,m,g,M,A)&&t.positiveArea(m,g,w,E,M,A)&&t.positiveArea(w,E,x,y,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,v=n[u+2]<<1,p=r[d],m=r[d+1],g=r[f],w=r[f+1],E=r[v],x=r[v+1],y=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],E,x),M=t.winding(E,x,o[0],o[1],o[2],o[3]);S==h&&M==h&&(o.push(E),o.push(x),s.push(v),y=!0)}y||(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(p),o.push(m),o.push(g),o.push(w),o.push(E),o.push(x),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(v),h=t.winding(p,m,g,w,E,x),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],O=o[2],B=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,O,B);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}(),le=function(){function t(){this.triangulator=new oe,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=G.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,v=0;h.length=0,u.length=0;t:for(var p=0;p<r;p+=3)for(var m=n[p]<<1,g=t[m],w=t[m+1],E=a[m],x=a[m+1],y=t[m=n[p+1]<<1],b=t[m+1],S=a[m],M=a[m+1],A=t[m=n[p+2]<<1],R=t[m+1],T=a[m],I=a[m+1],C=0;C<d;C++){var _=h.length;if(!this.clip(g,w,y,b,A,R,c[C],l)){var k=G.setArraySize(h,_+3*f);k[_]=g,k[_+1]=w,k[_+2]=i.r,k[_+3]=i.g,k[_+4]=i.b,k[_+5]=i.a,o?(k[_+6]=E,k[_+7]=x,k[_+8]=s.r,k[_+9]=s.g,k[_+10]=s.b,k[_+11]=s.a,k[_+12]=y,k[_+13]=b,k[_+14]=i.r,k[_+15]=i.g,k[_+16]=i.b,k[_+17]=i.a,k[_+18]=S,k[_+19]=M,k[_+20]=s.r,k[_+21]=s.g,k[_+22]=s.b,k[_+23]=s.a,k[_+24]=A,k[_+25]=R,k[_+26]=i.r,k[_+27]=i.g,k[_+28]=i.b,k[_+29]=i.a,k[_+30]=T,k[_+31]=I,k[_+32]=s.r,k[_+33]=s.g,k[_+34]=s.b,k[_+35]=s.a):(k[_+6]=E,k[_+7]=x,k[_+8]=y,k[_+9]=b,k[_+10]=i.r,k[_+11]=i.g,k[_+12]=i.b,k[_+13]=i.a,k[_+14]=S,k[_+15]=M,k[_+16]=A,k[_+17]=R,k[_+18]=i.r,k[_+19]=i.g,k[_+20]=i.b,k[_+21]=i.a,k[_+22]=T,k[_+23]=I),_=u.length;var V=G.setArraySize(u,_+3);V[_]=v,V[_+1]=v+1,V[_+2]=v+2,v+=3;continue t}var P=l.length;if(0!=P){for(var F=b-R,N=A-y,O=g-A,B=R-w,L=1/(F*O+N*(w-R)),X=P>>1,D=this.clipOutput,Y=G.setArraySize(h,_+X*f),U=0;U<P;U+=2){var W=D[U],q=D[U+1];Y[_]=W,Y[_+1]=q,Y[_+2]=i.r,Y[_+3]=i.g,Y[_+4]=i.b,Y[_+5]=i.a;var H=W-A,j=q-R,z=(F*H+N*j)*L,Z=(B*H+O*j)*L,Q=1-z-Z;Y[_+6]=E*z+S*Z+T*Q,Y[_+7]=x*z+M*Z+I*Q,o&&(Y[_+8]=s.r,Y[_+9]=s.g,Y[_+10]=s.b,Y[_+11]=s.a),_+=f}_=u.length;var J=G.setArraySize(u,_+3*(X-2));X--;for(var K=1;K<X;K++)J[_]=v,J[_+1]=v+K,J[_+2]=v+K+1,_+=3;v+=X+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 v=c[f],p=c[f+1],m=c[f+2],g=c[f+3],w=v-m,E=p-g,x=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var M=x[S],A=x[S+1],R=x[S+2],T=x[S+3],I=w*(T-g)-E*(R-m)>0;if(w*(A-g)-E*(M-m)>0){if(I){o.push(R),o.push(T);continue}var C=T-A,_=R-M,k=C*(m-v)-_*(g-p);if(Math.abs(k)>1e-6){var V=(_*(p-A)-C*(v-M))/k;o.push(v+(m-v)*V),o.push(p+(g-p)*V)}else o.push(v),o.push(p)}else if(I){var P=T-A,F=R-M,N=P*(m-v)-F*(g-p);if(Math.abs(N)>1e-6){var O=(F*(p-A)-P*(v-M))/N;o.push(v+(m-v)*O),o.push(p+(g-p)*O)}else o.push(v),o.push(p);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 B=o;(o=u).length=0,u=B}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],v=u-h;e[h]=e[v],e[h+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),he=function(){function t(){}var e=t.prototype;return e.initialize=function(t,e){var h=this._mesh=new n(t),u=[new r("POSITION",0,a.Vector3,0),new r("COLOR_0",12,a.Vector4,0),new r("TEXCOORD_0",28,a.Vector2,0)],c=4*ue.VERTEX_STRIDE,d=c*e,f=new i(t,s.VertexBuffer,d,o.Dynamic),v=new i(t,s.IndexBuffer,2*e,o.Dynamic);this._indexBuffer=v,this._vertexBuffer=f,h.setVertexBufferBinding(f,c),h.setIndexBufferBinding(v,l.UInt16),h.setVertexElements(u),h.addSubMesh(0,e)},e.changeBuffer=function(t,e){var n=4*ue.VERTEX_STRIDE,r=n*e,a=new i(t,s.VertexBuffer,r,o.Dynamic),h=new i(t,s.IndexBuffer,2*e,o.Dynamic),u=this._mesh;this._indexBuffer=h,this._vertexBuffer=a,u.setVertexBufferBinding(a,n),u.setIndexBufferBinding(h,l.UInt16)},_(t,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),t}(),ue=function(){function t(t,e){this._clipper=new le,this._spineMesh=new he,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this.separateSlotTextures=new Map,this._engine=t,this._entity=e}var e=t.prototype;return e.initialize=function(e,n){if(e){var r=this._entity.getComponent(h);if(r){this._meshRenderer=r,n&&(this._setting=n);for(var a=e.defaultSkin.attachments,i=0,s=t.QUAD_TRIANGLES.length,o=0,l=a.length;o<l;o++){var u=a[o];for(var c in u){var d=u[c];if(d)if(K(d,J))i+=s;else{if(!K(d,tt))continue;i+=d.triangles.length}}}this._vertexCount=i,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),r.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},e.buildMesh=function(e){var n=this._setting||{},r=n.useClipping,a=void 0===r||r,i=n.zSpacing,s=void 0===i?.01:i,o=0,l=0,h=e.drawOrder,c=h.length,d=this._clipper,f=this._spineMesh,v=f.mesh,p=this._subMeshItems;p.length=0;var m,g,w=this._vertices,E=0,x=0,y=Lt.Normal,b=null;t.tempBlendMode=null;for(var S=0;S<c;++S){var M=h[S];if(M.bone.active){var A=M.getAttachment(),R=null,T=s*S;console.log("slot name "+M.data.name+" z = "+T);var I=0,C=d.isClipping()?2:t.VERTEX_SIZE;if(K(A,J)){var _=A;R=_.color,w=this._vertices,I=4*C,_.computeWorldVertices(M.bone,w,0,C),m=t.QUAD_TRIANGLES,g=_.uvs,b=_.region.renderObject.texture}else if(K(A,tt)){var k=A;R=k.color,w=this._vertices,(I=(k.worldVerticesLength>>1)*C)>w.length&&(w=this._vertices=new Float32Array(I)),k.computeWorldVertices(M,0,k.worldVerticesLength,w,0,C),m=k.triangles,g=k.uvs,b=k.region.renderObject.texture}else if(K(A,at)){if(a){var V=A;d.clipStart(M,V);continue}}else if(a){d.clipEndWithSlot(M);continue}if(null!=b){var P=M.data.name;if(y=M.data.blendMode,null!==t.tempBlendMode&&t.tempBlendMode!==M.data.blendMode&&x>0){var F=new u(E,x);p.push({blendMode:t.tempBlendMode,subMesh:F,texture:b}),E=l,x=0}t.tempBlendMode=M.data.blendMode;var N=void 0,O=void 0,B=void 0,L=void 0,X=M.bone.skeleton.color,D=M.color,Y=X.a*D.a*R.a,U=t.tempColor;if(U.set(X.r*D.r*R.r,X.g*D.g*R.g,X.b*D.b*R.b,Y),d.isClipping()){d.clipTriangles(w,I,m,m.length,g,U,null,!1);var W=d.clippedVertices,q=d.clippedTriangles;N=W,O=W.length,B=q,L=q.length}else{for(var H=w,G=2,j=0,z=I;G<z;G+=C,j+=2)H[G]=U.r,H[G+1]=U.g,H[G+2]=U.b,H[G+3]=U.a,H[G+4]=g[j],H[G+5]=g[j+1];N=w,O=I,B=m,L=m.length}for(var Z=o/t.VERTEX_STRIDE,Q=this._verticesWithZ,$=o,et=0;et<O;)Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=T,Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++];o=$;var nt=this._indices;for($=l,et=0;et<L;$++,et++)nt[$]=B[et]+Z;if(this.separateSlots.includes(P)){if(x>0){var rt=new u(E,x);p.push({blendMode:t.tempBlendMode,subMesh:rt,texture:b}),E=l}var it=this.separateSlotTextures[P];if(it){var st=b.texture;it.filterMode=st.filterMode,it.wrapModeU=st.wrapModeU,it.wrapModeV=st.wrapModeV,b=it}var ot=new u(E,L);p.push({blendMode:y,subMesh:ot,texture:b}),E+=L,x=0}else x+=L;l+=L}d.clipEndWithSlot(M)}else d.clipEndWithSlot(M)}if(d.clipEnd(),x>0){var lt=new u(E,x);p.push({blendMode:y,subMesh:lt,texture:b}),x=0}if(p.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),l>0&&l!==this._vertexCount&&l>this._vertexCount)return this._vertexCount=l,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);v.clearSubMesh();for(var ht=this._meshRenderer,ut=0,ct=p.length;ut<ct;++ut){var dt=p[ut],ft=dt.blendMode;v.addSubMesh(dt.subMesh);var vt=ht.getMaterial(ut);vt||(vt=de.getDefaultMaterial(this._engine)),vt.shaderData.setTexture("material_SpineTexture",b.texture),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)},e.addSeparateSlot=function(t){this.separateSlots.push(t)},e.addSeparateSlotTexture=function(t,e){this.separateSlotTextures[t]=new ve(e)},e._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},e.setBlendMode=function(t,e){var n=t.renderState.blendState.targetBlendState;switch(e){case Lt.Additive:n.sourceColorBlendFactor=c.SourceAlpha,n.destinationColorBlendFactor=c.One,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.One,n.colorBlendOperation=n.alphaBlendOperation=d.Add;break;case Lt.Multiply:n.sourceColorBlendFactor=c.DestinationColor,n.destinationColorBlendFactor=c.Zero,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.Zero,n.colorBlendOperation=n.alphaBlendOperation=d.Add;break;case Lt.Screen:n.sourceColorBlendFactor=c.One,n.destinationColorBlendFactor=c.OneMinusSourceColor,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.OneMinusSourceColor,n.colorBlendOperation=n.alphaBlendOperation=d.Add;break;default:n.sourceColorBlendFactor=c.SourceAlpha,n.destinationColorBlendFactor=c.OneMinusSourceAlpha,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.OneMinusSourceAlpha,n.colorBlendOperation=n.alphaBlendOperation=d.Add}},_(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();ue.QUAD_TRIANGLES=[0,1,2,2,3,0],ue.VERTEX_SIZE=8,ue.VERTEX_STRIDE=9,ue.tempColor=new q,ue.tempBlendMode=null;var ce=function(t){function e(n){var r,a=f.find("galacean-spine-shader")||f.create("galacean-spine-shader",e._spineVS,e._spineFS),i=(r=t.call(this,n,a)||this).renderState,s=i.blendState.targetBlendState;return s.enabled=!0,s.sourceColorBlendFactor=c.SourceAlpha,s.destinationColorBlendFactor=c.OneMinusSourceAlpha,s.sourceAlphaBlendFactor=c.One,s.destinationAlphaBlendFactor=c.OneMinusSourceAlpha,s.colorBlendOperation=s.alphaBlendOperation=d.Add,i.depthState.writeEnabled=!1,i.rasterState.cullMode=v.Off,i.renderQueueType=p.Transparent,r}return T(e,t),e}(m);ce._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 ",ce._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 de=function(t){function e(e){var n;return(n=t.call(this,e)||this)._tempOffset=new z,n._tempSize=new z,n._tempArray=[0,0],n.autoUpdate=!0,n.autoUpdateBounds=!1,n._meshGenerator=new ue(n.engine,e),n}T(e,t);var n=e.prototype;return n.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new ee(t);var n=new se(t);this._state=new ne(n),this._meshGenerator.initialize(t,this.setting)},n.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!"),this.entity.getComponent(h)||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)?this._meshGenerator.addSeparateSlot(t):console.warn("Slot: "+t+" not find.")},n.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")},n.onUpdate=function(t){this.autoUpdate&&this.updateState(t)},n.updateState=function(t){if(this._skeleton&&this.state){var e=this._state,n=this._skeleton;e.update(t),e.apply(n),n.updateWorldTransform(),this.updateGeometry()}},n.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},n.updateBounds=function(){var t,e=this.entity.getComponent(h).bounds,n=this._tempOffset,r=this._tempSize,a=this._tempArray,i=(null==(t=this.setting)?void 0:t.zSpacing)||.01,s=this._skeleton;s.getBounds(n,r,a);var o=s.drawOrder;e.min.set(n.x,n.y,0),e.max.set(n.x+r.x,n.y+r.y,o.length*i)},n._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=Zt({},this.setting);t.setting=e},n._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},n.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},e.getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new ce(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},_(e,[{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)}}]),e}(w);I([g],de.prototype,"_skeletonData",void 0),I([g],de.prototype,"_skeleton",void 0),I([g],de.prototype,"_state",void 0),I([g],de.prototype,"_tempOffset",void 0),I([g],de.prototype,"_tempSize",void 0),I([g],de.prototype,"_tempArray",void 0),I([g],de.prototype,"_meshGenerator",void 0),I([g],de.prototype,"setting",void 0);var fe=function(t){function e(){return t.apply(this,arguments)}T(e,t);var n=e.prototype;return n.load=function(t,e){var n=this;return new x((function(r,a){"spine"!==t.type&&a("Asset type must be spine.");var i=null;t.urls?n.handleResource(e,t,i,r,a):n.request(t.url||"",{type:"json"}).then((function(s){s.jsonUrl&&s.atlasUrl&&s.pngUrl?(i=n.getResouceFromUrls([s.jsonUrl,s.atlasUrl,s.pngUrl],s.pngType),n.handleResource(e,t,i,r,a)):n.handleResource(e,t,i,r,a)})).catch((function(s){n.handleResource(e,t,i,r,a)}))}))},n.handleResource=function(t,e,n,r,a){var i=this,s=t.engine;n||(!e.urls&&e.url&&this.checkUrl(e.url)&&(n=this.getResouceFromUrl(e.url)),e.urls&&this.checkUrls(e.urls)&&(n=this.getResouceFromUrls(e.urls)));var o,l=!1;o=new U(s,null,(function(t){return i.createAdaptiveTexture(t)}));var u=n.skeletonFile,c=n.atlasFile,d=n.textureFile;o.onLoadComplete=function(){try{var t;if(l)t=o.get(c);else{var e=o.get(c);t=new L(e,i.textureAssetPicker.bind(i,o,d))}var n=new it(t),f=(i.isBinFile(u)?new Ht(n):new Wt(n)).readSkeletonData(o.get(u)),v=new y(s),p=v.addComponent(h),m=de.getDefaultMaterial(s);p.setMaterial(m),v.addComponent(de).setSkeletonData(f),r(v)}catch(t){a(t)}};var f=this.isBinFile(u);u&&c&&d?(f?o.loadBinary(u,null,a):o.loadText(u,null,a),o.loadText(c,null,a),o.loadEngineTexture(d,n.textureType,null,a)):u&&c&&!d?(l=!0,f?o.loadBinary(u,null,a):o.loadText(u,null,a),o.loadTextureAtlas(c,null,a)):a("Resouce param error")},n.textureAssetPicker=function(t,e){return t.get(e)},n.createAdaptiveTexture=function(t){return new ve(t)},n.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},n.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)},n.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"}},n.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)},n.getResouceFromUrls=function(t,e){var n,r,a;void 0===e&&(e=b.Texture2D);for(var i=e,s=0;s<t.length;++s){var o=t[s],l=this.getExtFromUrl(o);"json"!==l&&"bin"!==l||(n=o),"atlas"===l&&(r=o);["png","jpg","webp","jpeg","ktx2"].includes(l)&&(a=o)}return{skeletonFile:n,atlasFile:r,textureFile:a,textureType:i}},n.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},e}(S);fe=I([E("spine",["json","bin"])],fe);var ve=function(t){function e(e){var n;return(n=t.call(this,e)||this).texture.generateMipmaps(),n}T(e,t);var n=e.prototype;return n.setFilters=function(t,e){t===P.Nearest?this.texture.filterMode=M.Point:e===P.MipMapLinearLinear?this.texture.filterMode=M.Trilinear:this.texture.filterMode=M.Bilinear},n.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},n.dispose=function(){},e}(N),pe=function(t){function e(){var e;return(e=t.apply(this,arguments)||this)._animationName="",e._loop=!0,e._autoPlay=!0,e._skinName="",e._scale=1,e._spineAnimation=null,e._animationNames=[],e._skinNames=[],e}T(e,t);var n=e.prototype;return n.onDestroy=function(){this.resource=null},n.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},n._cloneTo=function(t){t.entity.clearChildren(),t.resource=this.resource},n._removeResource=function(){this._resource&&this._spineAnimation&&(this.entity.removeChild(this._resource),this._resource.destroy(),this._resource=null,this._spineAnimation=null,this._animationName="",this._skinName="")},_(e,[{key:"resource",get:function(){return this._resource},set:function(t){var e=this._resource;if(t){if(e!==t){this._removeResource(),this._resource=t.clone(),this.entity.addChild(this._resource),this._spineAnimation=this._resource.getComponent(de),this._spineAnimation.scale=this._scale;var n=this._spineAnimation.skeletonData,r=n.animations,a=n.skins,i=this._animationNames,s=this._skinNames;i.length=0;for(var o=0,l=r.length;o<l;++o)i.push(r[o].name);s.length=0;for(var h=0,u=a.length;h<u;++h)s.push(a[h].name);this.skinName=this._skinName||s[0],this._autoPlay&&i.length>0&&this.play(this._animationName||i[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:"autoPlay",get:function(){return this._autoPlay},set:function(t){this._autoPlay!==t&&(t&&this._resource&&this._spineAnimation&&this._spineAnimation.state.setAnimation(0,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}}]),e}(w);I([g],pe.prototype,"_resource",void 0),I([A],pe.prototype,"_animationName",void 0),I([A],pe.prototype,"_loop",void 0),I([A],pe.prototype,"_autoPlay",void 0),I([A],pe.prototype,"_skinName",void 0),I([A],pe.prototype,"_scale",void 0),I([g],pe.prototype,"_spineAnimation",void 0),I([g],pe.prototype,"_animationNames",void 0),I([g],pe.prototype,"_skinNames",void 0);var me="1.1.0-alpha.2";S.registerClass("SpineRenderer",pe),console.log("Galacean spine version: "+me);export{U as AssetManager,it as AtlasAttachmentLoader,Ht as SkeletonBinary,Wt as SkeletonJson,de as SpineAnimation,pe as SpineRenderer,N as Texture,L as TextureAtlas,me as version};
|
|
1
|
+
import{TextureFilterMode as t,TextureWrapMode as e,AssetType as r,AssetPromise as n,request as a,resourceLoader as i,Loader as s,BufferMesh as o,VertexElement as l,VertexElementFormat as h,Buffer as u,BufferBindFlag as c,BufferUsage as d,IndexFormat as f,MeshRenderer as v,SubMesh as p,BlendFactor as g,BlendOperation as m,Shader as w,CullMode as E,RenderQueueType as x,Material as y,BoundingBox as b,ignoreClone as S,Script as M}from"@galacean/engine";function A(t,e){return A=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},A(t,e)}function T(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&&A(t,e)}function I(t,e,r,n){var a,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function R(t,e){var r,n,a,i,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(s=0)),s;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(a=s.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function C(t,e,r,n,a,i,s){try{var o=t[i](s),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,a)}function V(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(t){C(i,n,a,s,o,"next",t)}function o(t){C(i,n,a,s,o,"throw",t)}s(void 0)}))}}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function P(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return k(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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 _,F,N=function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},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)}},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"}(_||(_={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(F||(F={}));var O=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},B=function(t){function e(){return t.apply(this,arguments)}T(e,t);var r=e.prototype;return r.setFilters=function(t,e){},r.setWraps=function(t,e){},r.dispose=function(){},e}(N),L=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 r=new X(t),n=new Array(4),a=null;;){var i=r.readLine();if(null==i)break;if(0==(i=i.trim()).length)a=null;else if(a){var s=new D;s.name=i,s.page=a;var o=r.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,r.readTuple(n);var l=parseInt(n[0]),h=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+c)/a.width,s.v2=(h+u)/a.height):(s.u2=(l+u)/a.width,s.v2=(h+c)/a.height),s.x=l,s.y=h,s.width=Math.abs(u),s.height=Math.abs(c),4==r.readTuple(n)&&4==r.readTuple(n)&&r.readTuple(n),s.originalWidth=parseInt(n[0]),s.originalHeight=parseInt(n[1]),r.readTuple(n),s.offsetX=parseInt(n[0]),s.offsetY=parseInt(n[1]),s.index=parseInt(r.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new Y).name=i,2==r.readTuple(n)&&(a.width=parseInt(n[0]),a.height=parseInt(n[1]),r.readTuple(n)),r.readTuple(n),a.minFilter=N.filterFromString(n[0]),a.magFilter=N.filterFromString(n[1]);var d=r.readValue();a.uWrap=F.ClampToEdge,a.vWrap=F.ClampToEdge,"x"==d?a.uWrap=F.Repeat:"y"==d?a.vWrap=F.Repeat:"xy"==d&&(a.uWrap=a.vWrap=F.Repeat),a.texture=e(i),a.texture.setFilters(a.minFilter,a.magFilter),a.texture.setWraps(a.uWrap,a.vWrap),a.width=a.texture.getImage().width,a.height=a.texture.getImage().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}(),X=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(),r=e.indexOf(":");if(-1==r)throw new Error("Invalid line: "+e);for(var n=0,a=r+1;n<3;n++){var i=e.indexOf(",",a);if(-1==i)break;t[n]=e.substr(a,i-a).trim(),a=i+1}return t[n]=e.substring(a).trim(),n+1},t}(),Y=function(){},D=function(t){function e(){return t.apply(this,arguments)}return T(e,t),e}(O);var W=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}(),U=function(){function t(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=r,this.a=n}var e=t.prototype;return e.set=function(t,e,r,n){return this.r=t,this.g=e,this.b=r,this.a=n,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,r,n){return this.r+=t,this.g+=e,this.b+=r,this.a+=n,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}();U.WHITE=new U(1,1,1,1),U.RED=new U(1,0,0,1),U.GREEN=new U(0,1,0,1),U.BLUE=new U(0,0,1,1),U.MAGENTA=new U(1,0,1,1);var q=function(){function t(){}return t.clamp=function(t,e,r){return t<e?e:t>r?r: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,r){return t.randomTriangularWith(e,r,.5*(e+r))},t.randomTriangularWith=function(t,e,r){var n=Math.random(),a=e-t;return n<=(r-t)/a?t+Math.sqrt(n*a*(r-t)):e-Math.sqrt((1-n)*a*(e-r))},t}();q.PI=3.1415927,q.PI2=2*q.PI,q.radiansToDegrees=180/q.PI,q.radDeg=q.radiansToDegrees,q.degreesToRadians=q.PI/180,q.degRad=q.degreesToRadians;var H=function(){function t(){}return t.arrayCopy=function(t,e,r,n,a){for(var i=e,s=n;i<e+a;i++,s++)r[s]=t[i]},t.setArraySize=function(t,e,r){void 0===r&&(r=0);var n=t.length;if(n==e)return t;if(t.length=e,n<e)for(var a=n;a<e;a++)t[a]=r;return t},t.ensureArrayCapacity=function(e,r,n){return void 0===n&&(n=0),e.length>=r?e:t.setArraySize(e,r,n)},t.newArray=function(t,e){for(var r=new Array(t),n=0;n<t;n++)r[n]=e;return r},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},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,r){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},t}();H.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var G=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}(),z=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}(),j=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},Z=function(t){function e(r){var n;return(n=t.call(this,r)||this).id=(65535&e.nextID++)<<11,n.worldVerticesLength=0,n.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),n}T(e,t);var r=e.prototype;return r.computeWorldVertices=function(t,e,r,n,a,i){r=a+(r>>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 v=s.bones;if(0==o.length)for(var p=a,g=3*c;p<r;p+=i){var m=0,w=0,E=h[u++];for(E+=u;u<E;u++,g+=3){var x=v[h[u]],y=l[g],b=l[g+1],S=l[g+2];m+=(y*x.a+b*x.b+x.worldX)*S,w+=(y*x.c+b*x.d+x.worldY)*S}n[p]=m,n[p+1]=w}else for(var M=o,A=a,T=3*c,I=c<<1;A<r;A+=i){var R=0,C=0,V=h[u++];for(V+=u;u<V;u++,T+=3,I+=2){var k=v[h[u]],P=l[T]+M[I],_=l[T+1]+M[I+1],F=l[T+2];R+=(P*k.a+_*k.b+k.worldX)*F,C+=(P*k.c+_*k.d+k.worldY)*F}n[A]=R,n[A+1]=C}}else{o.length>0&&(l=o);for(var N=t.bone,O=N.worldX,B=N.worldY,L=N.a,X=N.b,Y=N.c,D=N.d,W=e,U=a;U<r;W+=2,U+=i){var q=l[W],H=l[W+1];n[U]=q*L+H*X+O,n[U+1]=q*Y+H*D+B}}},r.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),H.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=H.newFloatArray(this.vertices.length),H.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(j);Z.nextID=0;var Q=function(t){function e(e){var r;return(r=t.call(this,e)||this).x=0,r.y=0,r.scaleX=1,r.scaleY=1,r.rotation=0,r.width=0,r.height=0,r.color=new U(1,1,1,1),r.offset=H.newFloatArray(8),r.uvs=H.newFloatArray(8),r.tempColor=new U(1,1,1,1),r}T(e,t);var r=e.prototype;return r.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*r,i=n+this.region.width*t,s=a+this.region.height*r,o=this.rotation*Math.PI/180,l=Math.cos(o),h=Math.sin(o),u=n*l+this.x,c=n*h,d=a*l+this.y,f=a*h,v=i*l+this.x,p=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]=v-m,w[e.OY3]=g+p,w[e.OX4]=v-f,w[e.OY4]=d+p},r.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)},r.computeWorldVertices=function(t,r,n,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],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX2],f=i[e.OY2],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX3],f=i[e.OY3],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX4],f=i[e.OY4],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o},r.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,H.arrayCopy(this.uvs,0,t.uvs,0,8),H.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(j);function J(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}Q.OX1=0,Q.OY1=1,Q.OX2=2,Q.OY2=3,Q.OX3=4,Q.OY3=5,Q.OX4=6,Q.OY4=7,Q.X1=0,Q.Y1=1,Q.C1R=2,Q.C1G=3,Q.C1B=4,Q.C1A=5,Q.U1=6,Q.V1=7,Q.X2=8,Q.Y2=9,Q.C2R=10,Q.C2G=11,Q.C2B=12,Q.C2A=13,Q.U2=14,Q.V2=15,Q.X3=16,Q.Y3=17,Q.C3R=18,Q.C3G=19,Q.C3B=20,Q.C3A=21,Q.U3=22,Q.V3=23,Q.X4=24,Q.Y4=25,Q.C4R=26,Q.C4G=27,Q.C4B=28,Q.C4A=29,Q.U4=30,Q.V4=31;var K,$=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new U(1,1,1,1),r.tempColor=new U(0,0,0,0),r}T(e,t);var r=e.prototype;return r.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=H.newFloatArray(t.length));var e=this.uvs,r=this.uvs.length,n=this.region.u,a=this.region.v,i=0,s=0;if(J(this.region,D)){var o=this.region,l=o.texture.getImage().width,h=o.texture.getImage().height;switch(o.degrees){case 90:n-=(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<r;u+=2)e[u]=n+t[u+1]*i,e[u+1]=a+(1-t[u])*s;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/l,a-=o.offsetY/h,i=o.originalWidth/l,s=o.originalHeight/h;for(var c=0;c<r;c+=2)e[c]=n+(1-t[c])*i,e[c+1]=a+(1-t[c+1])*s;return;case 270:n-=o.offsetY/l,a-=o.offsetX/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var d=0;d<r;d+=2)e[d]=n+(1-t[d+1])*i,e[d+1]=a+t[d]*s;return}n-=o.offsetX/l,a-=(o.originalHeight-o.offsetY-o.height)/h,i=o.originalWidth/l,s=o.originalHeight/h}else null==this.region?(n=a=0,i=s=1):(i=this.region.u2-n,s=this.region.v2-a);for(var f=0;f<r;f+=2)e[f]=n+t[f]*i,e[f+1]=a+t[f+1]*s},r.getParentMesh=function(){return this.parentMesh},r.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)},r.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),H.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),H.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),H.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),H.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},r.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}(Z),tt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new U(1,1,1,1),r}return T(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(Z),et=function(t){function e(e){var r;return(r=t.call(this,e)||this).closed=!1,r.constantSpeed=!1,r.color=new U(1,1,1,1),r}return T(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),H.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(Z),rt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new U(.38,.94,0,1),r.name=e,r}T(e,t);var r=e.prototype;return r.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},r.computeWorldRotation=function(t){var e=q.cosDeg(this.rotation),r=q.sinDeg(this.rotation),n=e*t.a+r*t.b,a=e*t.c+r*t.d;return Math.atan2(a,n)*q.radDeg},r.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}(Z),nt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new U(.2275,.2275,.8078,1),r}return T(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}(Z),at=function(){function t(t){this.atlas=t}var e=t.prototype;return e.newRegionAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (region attachment: "+e+")");n.renderObject=n;var a=new Q(e);return a.setRegion(n),a},e.newMeshAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+e+")");n.renderObject=n;var a=new $(e);return a.region=n,a},e.newBoundingBoxAttachment=function(t,e){return new tt(e)},e.newPathAttachment=function(t,e){return new et(e)},e.newPointAttachment=function(t,e){return new rt(e)},e.newClippingAttachment=function(t,e){return new nt(e)},t}(),it=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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSkin=function(t){if(null==t)throw new Error("skinName cannot be null.");for(var e=this.skins,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},t}(),st=function(t,e,r){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 U,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=r};!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"}(K||(K={}));var ot,lt,ht,ut=function(t,e,r){if(this.color=new U(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==r)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=r},ct=function(t,e,r){this.name=t,this.order=e,this.skinRequired=r},dt=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.bendDirection=1,r.compress=!1,r.stretch=!1,r.uniform=!1,r.mix=1,r.softness=0,r}return T(e,t),e}(ct),ft=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.rotateMix=0,r.translateMix=0,r.scaleMix=0,r.shearMix=0,r.offsetRotation=0,r.offsetX=0,r.offsetY=0,r.offsetScaleX=0,r.offsetScaleY=0,r.offsetShearY=0,r.relative=!1,r.local=!1,r}return T(e,t),e}(ct),vt=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r}return T(e,t),e}(ct);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ot||(ot={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(lt||(lt={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(ht||(ht={}));var pt,gt,mt,wt=function(t,e,r){this.slotIndex=t,this.name=e,this.attachment=r},Et=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,r){if(null==r)throw new Error("attachment cannot be null.");var n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=r},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}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 r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}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&&(J(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 r=this.attachments[t];return r?r[e]:null},e.removeAttachment=function(t,e){var r=this.attachments[t];r&&(r[e]=null)},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var r=this.attachments[e];if(r)for(var n in r){var a=r[n];a&&t.push(new wt(e,n,a))}}return t},e.getAttachmentsForSlot=function(t,e){var r=this.attachments[t];if(r)for(var n in r){var a=r[n];a&&e.push(new wt(t,n,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var r=0,n=0;n<t.slots.length;n++){var a=t.slots[n],i=a.getAttachment();if(i&&r<e.attachments.length){var s=e.attachments[r];for(var o in s){if(i==s[o]){var l=this.getAttachment(r,o);null!=l&&a.setAttachment(l);break}}}r++}},t}(),xt=function(t){this.name=t},yt=function(){function t(t,e,r){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 n=0;n<e.length;n++)this.timelineIds[e[n].getPropertyId()]=!0;this.duration=r}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,r,n,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");n&&0!=this.duration&&(r%=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,r,a,i,s,o)},t.binarySearch=function(t,e,r){void 0===r&&(r=1);var n=0,a=t.length/r-2;if(0==a)return r;for(var i=a>>>1;;){if(t[(i+1)*r]<=e?n=i+1:a=i,n==a)return(n+1)*r;i=n+a>>>1}},t.linearSearch=function(t,e,r){for(var n=0,a=t.length-r;n<=a;n+=r)if(t[n]>e)return n;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"}(pt||(pt={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(gt||(gt={})),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"}(mt||(mt={}));var bt=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=H.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 r=e*t.BEZIER_SIZE;if(r==this.curves.length)return t.LINEAR;var n=this.curves[r];return n==t.LINEAR?t.LINEAR:n==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,r,n,a,i){var s=.03*(2*-r+a),o=.03*(2*-n+i),l=.006*(3*(r-a)+1),h=.006*(3*(n-i)+1),u=2*s+l,c=2*o+h,d=.3*r+s+.16666667*l,f=.3*n+o+.16666667*h,v=e*t.BEZIER_SIZE,p=this.curves;p[v++]=t.BEZIER;for(var g=d,m=f,w=v+t.BEZIER_SIZE-1;v<w;v+=2)p[v]=g,p[v+1]=m,d+=u,f+=c,u+=l,c+=h,g+=d,m+=f},e.getCurvePercent=function(e,r){r=q.clamp(r,0,1);var n=this.curves,a=e*t.BEZIER_SIZE,i=n[a];if(i==t.LINEAR)return r;if(i==t.STEPPED)return 0;for(var s=0,o=++a,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=n[a])>=r){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=n[a-2],u=n[a-1]),u+(n[a+1]-u)*(r-h)/(s-h)}var c=n[a-1];return c+(1-c)*(r-s)/(1-s)},t}();bt.LINEAR=0,bt.STEPPED=1,bt.BEZIER=2,bt.BEZIER_SIZE=19;var St=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=H.newFloatArray(e<<1),r}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return 0+this.boneIndex},r.setFrame=function(t,r,n){t<<=1,this.frames[t]=r,this.frames[t+e.ROTATION]=n},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<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(n>=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=yt.binarySearch(l,n,e.ENTRIES),f=l[d+e.PREV_ROTATION],v=l[d],p=this.getCurvePercent((d>>1)-1,1-(n-v)/(l[d+e.PREV_TIME]-v)),g=l[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*p,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}(bt);St.ENTRIES=2,St.PREV_TIME=-2,St.PREV_ROTATION=-1,St.ROTATION=1;var Mt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=H.newFloatArray(r*e.ENTRIES),n}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(1<<24)+this.boneIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.X]=n,this.frames[t+e.Y]=a},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<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(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=yt.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}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}(bt);Mt.ENTRIES=3,Mt.PREV_TIME=-3,Mt.PREV_X=-2,Mt.PREV_Y=-1,Mt.X=1,Mt.Y=2;var At=function(t){function e(e){return t.call(this,e)}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(2<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<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(n>=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=yt.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u=(u+(l[d+e.X]-u)*v)*h.data.scaleX,c=(c+(l[d+e.Y]-c)*v)*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 p=0,g=0;if(1==o)switch(s){case 0:p=h.data.scaleX,g=h.data.scaleY,h.scaleX=p+(Math.abs(u)*q.signum(p)-p)*i,h.scaleY=g+(Math.abs(c)*q.signum(g)-g)*i;break;case 1:case 2:p=h.scaleX,g=h.scaleY,h.scaleX=p+(Math.abs(u)*q.signum(p)-p)*i,h.scaleY=g+(Math.abs(c)*q.signum(g)-g)*i;break;case 3:p=h.scaleX,g=h.scaleY,h.scaleX=p+(Math.abs(u)*q.signum(p)-h.data.scaleX)*i,h.scaleY=g+(Math.abs(c)*q.signum(g)-h.data.scaleY)*i}else switch(s){case 0:p=Math.abs(h.data.scaleX)*q.signum(u),g=Math.abs(h.data.scaleY)*q.signum(c),h.scaleX=p+(u-p)*i,h.scaleY=g+(c-g)*i;break;case 1:case 2:p=Math.abs(h.scaleX)*q.signum(u),g=Math.abs(h.scaleY)*q.signum(c),h.scaleX=p+(u-p)*i,h.scaleY=g+(c-g)*i;break;case 3:p=q.signum(u),g=q.signum(c),h.scaleX=Math.abs(h.scaleX)*p+(u-Math.abs(h.data.scaleX)*p)*i,h.scaleY=Math.abs(h.scaleY)*g+(c-Math.abs(h.data.scaleY)*g)*i}}}},e}(Mt),Tt=function(t){function e(e){return t.call(this,e)}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(3<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<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(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=yt.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}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}(Mt),It=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=H.newFloatArray(r*e.ENTRIES),n}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(5<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},r.apply=function(t,r,n,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<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,v=0,p=0;if(n>=h[h.length-e.ENTRIES]){var g=h.length;d=h[g+e.PREV_R],f=h[g+e.PREV_G],v=h[g+e.PREV_B],p=h[g+e.PREV_A]}else{var m=yt.binarySearch(h,n,e.ENTRIES);d=h[m+e.PREV_R],f=h[m+e.PREV_G],v=h[m+e.PREV_B],p=h[m+e.PREV_A];var w=h[m],E=this.getCurvePercent(m/e.ENTRIES-1,1-(n-w)/(h[m+e.PREV_TIME]-w));d+=(h[m+e.R]-d)*E,f+=(h[m+e.G]-f)*E,v+=(h[m+e.B]-v)*E,p+=(h[m+e.A]-p)*E}if(1==i)l.color.set(d,f,v,p);else{var x=l.color;0==s&&x.setFromColor(l.data.color),x.add((d-x.r)*i,(f-x.g)*i,(v-x.b)*i,(p-x.a)*i)}}}},e}(bt);It.ENTRIES=5,It.PREV_TIME=-5,It.PREV_R=-4,It.PREV_G=-3,It.PREV_B=-2,It.PREV_A=-1,It.R=1,It.G=2,It.B=3,It.A=4;var Rt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=H.newFloatArray(r*e.ENTRIES),n}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(14<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s,o,l,h){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,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},r.apply=function(t,r,n,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<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 v=0,p=0,g=0,m=0,w=0,E=0,x=0;if(n>=h[h.length-e.ENTRIES]){var y=h.length;v=h[y+e.PREV_R],p=h[y+e.PREV_G],g=h[y+e.PREV_B],m=h[y+e.PREV_A],w=h[y+e.PREV_R2],E=h[y+e.PREV_G2],x=h[y+e.PREV_B2]}else{var b=yt.binarySearch(h,n,e.ENTRIES);v=h[b+e.PREV_R],p=h[b+e.PREV_G],g=h[b+e.PREV_B],m=h[b+e.PREV_A],w=h[b+e.PREV_R2],E=h[b+e.PREV_G2],x=h[b+e.PREV_B2];var S=h[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(n-S)/(h[b+e.PREV_TIME]-S));v+=(h[b+e.R]-v)*M,p+=(h[b+e.G]-p)*M,g+=(h[b+e.B]-g)*M,m+=(h[b+e.A]-m)*M,w+=(h[b+e.R2]-w)*M,E+=(h[b+e.G2]-E)*M,x+=(h[b+e.B2]-x)*M}if(1==i)l.color.set(v,p,g,m),l.darkColor.set(w,E,x,1);else{var A=l.color,T=l.darkColor;0==s&&(A.setFromColor(l.data.color),T.setFromColor(l.data.darkColor)),A.add((v-A.r)*i,(p-A.g)*i,(g-A.b)*i,(m-A.a)*i),T.add((w-T.r)*i,(E-T.g)*i,(x-T.b)*i,0)}}}},e}(bt);Rt.ENTRIES=8,Rt.PREV_TIME=-8,Rt.PREV_R=-7,Rt.PREV_G=-6,Rt.PREV_B=-5,Rt.PREV_A=-4,Rt.PREV_R2=-3,Rt.PREV_G2=-2,Rt.PREV_B2=-1,Rt.R=1,Rt.G=2,Rt.B=3,Rt.A=4,Rt.R2=5,Rt.G2=6,Rt.B2=7;var Ct=function(){function t(t){this.frames=H.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,r){this.frames[t]=e,this.attachmentNames[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var l=this.frames;if(r<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=r>=l[l.length-1]?l.length-1:yt.binarySearch(l,r,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,r){e.attachment=null==r?null:t.getAttachment(this.slotIndex,r)},t}(),Vt=null,kt=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=H.newFloatArray(e),r.frameVertices=new Array(e),null==Vt&&(Vt=H.newFloatArray(64)),r}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},r.setFrame=function(t,e,r){this.frames[t]=e,this.frameVertices[t]=r},r.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var l=o.getAttachment();if(J(l,Z)&&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(r<d[0]){var f=l;switch(i){case 0:return void(h.length=0);case 1:if(1==a){h.length=0;break}var v=H.setArraySize(h,c);if(null==f.bones)for(var p=f.vertices,g=0;g<c;g++)v[g]+=(p[g]-v[g])*a;else{a=1-a;for(g=0;g<c;g++)v[g]*=a}}}else{var m=H.setArraySize(h,c);if(r>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var E=l;if(null==E.bones)for(var x=E.vertices,y=0;y<c;y++)m[y]+=w[y]-x[y];else for(var b=0;b<c;b++)m[b]+=w[b]}else H.arrayCopy(w,0,m,0,c);else switch(i){case 0:var S=l;if(null==S.bones)for(var M=S.vertices,A=0;A<c;A++){var T=M[A];m[A]=T+(w[A]-T)*a}else for(var I=0;I<c;I++)m[I]=w[I]*a;break;case 1:case 2:for(var R=0;R<c;R++)m[R]+=(w[R]-m[R])*a;break;case 3:var C=l;if(null==C.bones)for(var V=C.vertices,k=0;k<c;k++)m[k]+=(w[k]-V[k])*a;else for(var P=0;P<c;P++)m[P]+=w[P]*a}}else{var _=yt.binarySearch(d,r),F=u[_-1],N=u[_],O=d[_],B=this.getCurvePercent(_-1,1-(r-O)/(d[_-1]-O));if(1==a)if(3==i){var L=l;if(null==L.bones)for(var X=L.vertices,Y=0;Y<c;Y++){var D=F[Y];m[Y]+=D+(N[Y]-D)*B-X[Y]}else for(var W=0;W<c;W++){var U=F[W];m[W]+=U+(N[W]-U)*B}}else for(var q=0;q<c;q++){var G=F[q];m[q]=G+(N[q]-G)*B}else switch(i){case 0:var z=l;if(null==z.bones)for(var j=z.vertices,Q=0;Q<c;Q++){var K=F[Q],$=j[Q];m[Q]=$+(K+(N[Q]-K)*B-$)*a}else for(var tt=0;tt<c;tt++){var et=F[tt];m[tt]=(et+(N[tt]-et)*B)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var nt=F[rt];m[rt]+=(nt+(N[rt]-nt)*B-m[rt])*a}break;case 3:var at=l;if(null==at.bones)for(var it=at.vertices,st=0;st<c;st++){var ot=F[st];m[st]+=(ot+(N[st]-ot)*B-it[st])*a}else for(var lt=0;lt<c;lt++){var ht=F[lt];m[lt]+=(ht+(N[lt]-ht)*B)*a}}}}}}},e}(bt),Pt=function(){function t(t){this.frames=H.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,r,n,a,i,s){if(null!=n){var o=this.frames,l=this.frames.length;if(e>r)this.apply(t,e,Number.MAX_VALUE,n,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(r<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=yt.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&r>=o[h];h++)n.push(this.events[h])}}},t}(),_t=function(){function t(t){this.frames=H.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,r){this.frames[t]=e,this.drawOrders[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.drawOrder,l=t.slots;if(1!=s){var h=this.frames;if(r<h[0])0!=i&&1!=i||H.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=r>=h[h.length-1]?h.length-1:yt.binarySearch(h,r)-1;var c=this.drawOrders[u];if(null==c)H.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&&H.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),Ft=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=H.newFloatArray(r*e.ENTRIES),n}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},r.setFrame=function(t,r,n,a,i,s,o){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.MIX]=n,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},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(n<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(n>=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=yt.binarySearch(l,n,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(n-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*v-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*v-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)*v-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*v-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}(bt);Ft.ENTRIES=6,Ft.PREV_TIME=-6,Ft.PREV_MIX=-5,Ft.PREV_SOFTNESS=-4,Ft.PREV_BEND_DIRECTION=-3,Ft.PREV_COMPRESS=-2,Ft.PREV_STRETCH=-1,Ft.MIX=1,Ft.SOFTNESS=2,Ft.BEND_DIRECTION=3,Ft.COMPRESS=4,Ft.STRETCH=5;var Nt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=H.newFloatArray(r*e.ENTRIES),n}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(n<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,v=0;if(n>=l[l.length-e.ENTRIES]){var p=l.length;c=l[p+e.PREV_ROTATE],d=l[p+e.PREV_TRANSLATE],f=l[p+e.PREV_SCALE],v=l[p+e.PREV_SHEAR]}else{var g=yt.binarySearch(l,n,e.ENTRIES);c=l[g+e.PREV_ROTATE],d=l[g+e.PREV_TRANSLATE],f=l[g+e.PREV_SCALE],v=l[g+e.PREV_SHEAR];var m=l[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(n-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,v+=(l[g+e.SHEAR]-v)*w}if(0==s){var E=h.data;h.rotateMix=E.rotateMix+(c-E.rotateMix)*i,h.translateMix=E.translateMix+(d-E.translateMix)*i,h.scaleMix=E.scaleMix+(f-E.scaleMix)*i,h.shearMix=E.shearMix+(v-E.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(v-h.shearMix)*i}},e}(bt);Nt.ENTRIES=5,Nt.PREV_TIME=-5,Nt.PREV_ROTATE=-4,Nt.PREV_TRANSLATE=-3,Nt.PREV_SCALE=-2,Nt.PREV_SHEAR=-1,Nt.ROTATE=1,Nt.TRANSLATE=2,Nt.SCALE=3,Nt.SHEAR=4;var Ot=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=H.newFloatArray(r*e.ENTRIES),n}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.VALUE]=n},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<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(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=yt.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-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}(bt);Ot.ENTRIES=2,Ot.PREV_TIME=-2,Ot.PREV_VALUE=-1,Ot.VALUE=1;var Bt,Lt=function(t){function e(e){return t.call(this,e)}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<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(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=yt.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-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}(Ot),Xt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=H.newFloatArray(r*e.ENTRIES),n}T(e,t);var r=e.prototype;return r.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<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(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=yt.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*v,c+=(l[d+e.TRANSLATE]-c)*v}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}(bt);Xt.ENTRIES=3,Xt.PREV_TIME=-3,Xt.PREV_ROTATE=-2,Xt.PREV_TRANSLATE=-1,Xt.ROTATE=1,Xt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Bt||(Bt={}));var Yt,Dt=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},Wt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new it,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(n.hash=i.hash,n.version=i.spine,"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=i.x,n.y=i.y,n.width=i.width,n.height=i.height,n.fps=i.fps,n.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=n.findBone(h)))throw new Error("Parent bone not found: "+h);var u=new st(n.bones.length,o.name,l);u.length=this.getValue(o,"length",0)*r,u.x=this.getValue(o,"x",0)*r,u.y=this.getValue(o,"y",0)*r,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),n.bones.push(u)}if(a.slots)for(var c=0;c<a.slots.length;c++){var d=a.slots[c],f=d.name,v=d.bone,p=n.findBone(v);if(null==p)throw new Error("Slot bone not found: "+v);var g=new ut(n.slots.length,f,p),m=this.getValue(d,"color",null);null!=m&&g.color.setFromString(m);var w=this.getValue(d,"dark",null);null!=w&&(g.darkColor=new U(1,1,1,1),g.darkColor.setFromString(w)),g.attachmentName=this.getValue(d,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),n.slots.push(g)}if(a.ik)for(var E=0;E<a.ik.length;E++){var x=a.ik[E],y=new dt(x.name);y.order=this.getValue(x,"order",0),y.skinRequired=this.getValue(x,"skin",!1);for(var b=0;b<x.bones.length;b++){var S=x.bones[b],M=n.findBone(S);if(null==M)throw new Error("IK bone not found: "+S);y.bones.push(M)}var A=x.target;if(y.target=n.findBone(A),null==y.target)throw new Error("IK target bone not found: "+A);y.mix=this.getValue(x,"mix",1),y.softness=this.getValue(x,"softness",0)*r,y.bendDirection=this.getValue(x,"bendPositive",!0)?1:-1,y.compress=this.getValue(x,"compress",!1),y.stretch=this.getValue(x,"stretch",!1),y.uniform=this.getValue(x,"uniform",!1),n.ikConstraints.push(y)}if(a.transform)for(var T=0;T<a.transform.length;T++){var I=a.transform[T],R=new ft(I.name);R.order=this.getValue(I,"order",0),R.skinRequired=this.getValue(I,"skin",!1);for(var C=0;C<I.bones.length;C++){var V=I.bones[C],k=n.findBone(V);if(null==k)throw new Error("Transform constraint bone not found: "+V);R.bones.push(k)}var P=I.target;if(R.target=n.findBone(P),null==R.target)throw new Error("Transform constraint target bone not found: "+P);R.local=this.getValue(I,"local",!1),R.relative=this.getValue(I,"relative",!1),R.offsetRotation=this.getValue(I,"rotation",0),R.offsetX=this.getValue(I,"x",0)*r,R.offsetY=this.getValue(I,"y",0)*r,R.offsetScaleX=this.getValue(I,"scaleX",0),R.offsetScaleY=this.getValue(I,"scaleY",0),R.offsetShearY=this.getValue(I,"shearY",0),R.rotateMix=this.getValue(I,"rotateMix",1),R.translateMix=this.getValue(I,"translateMix",1),R.scaleMix=this.getValue(I,"scaleMix",1),R.shearMix=this.getValue(I,"shearMix",1),n.transformConstraints.push(R)}if(a.path)for(var _=0;_<a.path.length;_++){var F=a.path[_],N=new vt(F.name);N.order=this.getValue(F,"order",0),N.skinRequired=this.getValue(F,"skin",!1);for(var O=0;O<F.bones.length;O++){var B=F.bones[O],L=n.findBone(B);if(null==L)throw new Error("Transform constraint bone not found: "+B);N.bones.push(L)}var X=F.target;if(N.target=n.findSlot(X),null==N.target)throw new Error("Path target slot not found: "+X);N.positionMode=t.positionModeFromString(this.getValue(F,"positionMode","percent")),N.spacingMode=t.spacingModeFromString(this.getValue(F,"spacingMode","length")),N.rotateMode=t.rotateModeFromString(this.getValue(F,"rotateMode","tangent")),N.offsetRotation=this.getValue(F,"rotation",0),N.position=this.getValue(F,"position",0),N.positionMode==ot.Fixed&&(N.position*=r),N.spacing=this.getValue(F,"spacing",0),N.spacingMode!=lt.Length&&N.spacingMode!=lt.Fixed||(N.spacing*=r),N.rotateMix=this.getValue(F,"rotateMix",1),N.translateMix=this.getValue(F,"translateMix",1),n.pathConstraints.push(N)}if(a.skins)for(var Y=0;Y<a.skins.length;Y++){var D=a.skins[Y],W=new Et(D.name);if(D.bones)for(var q=0;q<D.bones.length;q++){var H=n.findBone(D.bones[q]);if(null==H)throw new Error("Skin bone not found: "+D.bones[Y]);W.bones.push(H)}if(D.ik)for(var G=0;G<D.ik.length;G++){var z=n.findIkConstraint(D.ik[G]);if(null==z)throw new Error("Skin IK constraint not found: "+D.ik[Y]);W.constraints.push(z)}if(D.transform)for(var j=0;j<D.transform.length;j++){var Z=n.findTransformConstraint(D.transform[j]);if(null==Z)throw new Error("Skin transform constraint not found: "+D.transform[Y]);W.constraints.push(Z)}if(D.path)for(var Q=0;Q<D.path.length;Q++){var J=n.findPathConstraint(D.path[Q]);if(null==J)throw new Error("Skin path constraint not found: "+D.path[Y]);W.constraints.push(J)}for(var K in D.attachments){var $=n.findSlot(K);if(null==$)throw new Error("Slot not found: "+K);var tt=D.attachments[K];for(var et in tt){var rt=this.readAttachment(tt[et],W,$.index,et,n);null!=rt&&W.setAttachment($.index,et,rt)}}n.skins.push(W),"default"==W.name&&(n.defaultSkin=W)}for(var nt=0,at=this.linkedMeshes.length;nt<at;nt++){var ht=this.linkedMeshes[nt],ct=null==ht.skin?n.defaultSkin:n.findSkin(ht.skin);if(null==ct)throw new Error("Skin not found: "+ht.skin);var pt=ct.getAttachment(ht.slotIndex,ht.parent);if(null==pt)throw new Error("Parent mesh not found: "+ht.parent);ht.mesh.deformAttachment=ht.inheritDeform?pt:ht.mesh,ht.mesh.setParentMesh(pt),ht.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var gt in a.events){var mt=a.events[gt],wt=new xt(gt);wt.intValue=this.getValue(mt,"int",0),wt.floatValue=this.getValue(mt,"float",0),wt.stringValue=this.getValue(mt,"string",""),wt.audioPath=this.getValue(mt,"audio",null),null!=wt.audioPath&&(wt.volume=this.getValue(mt,"volume",1),wt.balance=this.getValue(mt,"balance",0)),n.events.push(wt)}if(a.animations)for(var yt in a.animations){var bt=a.animations[yt];this.readAnimation(bt,yt,n)}return n},e.readAttachment=function(t,e,r,n,a){var i=this.scale;switch(n=this.getValue(t,"name",n),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",n),o=this.attachmentLoader.newRegionAttachment(e,n,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,n);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",n),d=this.attachmentLoader.newMeshAttachment(e,n,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 v=this.getValue(t,"parent",null);if(null!=v)return this.linkedMeshes.push(new Ut(d,this.getValue(t,"skin",null),r,v,this.getValue(t,"deform",!0))),d;var p=t.uvs;return this.readVertices(t,d,p.length),d.triangles=t.triangles,d.regionUVs=p,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,n);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=H.newArray(m/3,0),E=0;E<t.lengths.length;E++)w[E]=t.lengths[E]*i;g.lengths=w;var x=this.getValue(t,"color",null);return null!=x&&g.color.setFromString(x),g;case"point":var y=this.attachmentLoader.newPointAttachment(e,n);if(null==y)return null;y.x=this.getValue(t,"x",0)*i,y.y=this.getValue(t,"y",0)*i,y.rotation=this.getValue(t,"rotation",0);var b=this.getValue(t,"color",null);return null!=b&&y.color.setFromString(b),y;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,n);if(null==S)return null;var M=this.getValue(t,"end",null);if(null!=M){var A=a.findSlot(M);if(null==A)throw new Error("Clipping end slot not found: "+M);S.endSlot=A}var T=t.vertexCount;this.readVertices(t,S,T<<1);var I=this.getValue(t,"color",null);return null!=I&&S.color.setFromString(I),S}return null},e.readVertices=function(t,e,r){var n=this.scale;e.worldVerticesLength=r;var a=t.vertices;if(r!=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]*n),i.push(a[o+2]*n),i.push(a[o+3])}e.bones=s,e.vertices=H.toFloatArray(i)}else{var c=H.toFloatArray(a);if(1!=n)for(var d=0,f=a.length;d<f;d++)c[d]*=n;e.vertices=c}},e.readAnimation=function(t,e,r){var n=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],l=r.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 Ct(u.length);c.slotIndex=l;for(var d=0,f=0;f<u.length;f++){var v=u[f];c.setFrame(d++,this.getValue(v,"time",0),v.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==h){var p=new It(u.length);p.slotIndex=l;for(var g=0,m=0;m<u.length;m++){var w=u[m],E=new U;E.setFromString(w.color),p.setFrame(g,this.getValue(w,"time",0),E.r,E.g,E.b,E.a),this.readCurve(w,p,g),g++}a.push(p),i=Math.max(i,p.frames[(p.getFrameCount()-1)*It.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var x=new Rt(u.length);x.slotIndex=l;for(var y=0,b=0;b<u.length;b++){var S=u[b],M=new U,A=new U;M.setFromString(S.light),A.setFromString(S.dark),x.setFrame(y,this.getValue(S,"time",0),M.r,M.g,M.b,M.a,A.r,A.g,A.b),this.readCurve(S,x,y),y++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*Rt.ENTRIES])}}}if(t.bones)for(var T in t.bones){var I=t.bones[T],R=r.findBoneIndex(T);if(-1==R)throw new Error("Bone not found: "+T);for(var C in I){var V=I[C];if("rotate"===C){var k=new St(V.length);k.boneIndex=R;for(var P=0,_=0;_<V.length;_++){var F=V[_];k.setFrame(P,this.getValue(F,"time",0),this.getValue(F,"angle",0)),this.readCurve(F,k,P),P++}a.push(k),i=Math.max(i,k.frames[(k.getFrameCount()-1)*St.ENTRIES])}else{if("translate"!==C&&"scale"!==C&&"shear"!==C)throw new Error("Invalid timeline type for a bone: "+C+" ("+T+")");var N=null,O=1,B=0;"scale"===C?(N=new At(V.length),B=1):"shear"===C?N=new Tt(V.length):(N=new Mt(V.length),O=n),N.boneIndex=R;for(var L=0,X=0;X<V.length;X++){var Y=V[X],D=this.getValue(Y,"x",B),W=this.getValue(Y,"y",B);N.setFrame(L,this.getValue(Y,"time",0),D*O,W*O),this.readCurve(Y,N,L),L++}a.push(N),i=Math.max(i,N.frames[(N.getFrameCount()-1)*Mt.ENTRIES])}}}if(t.ik)for(var q in t.ik){var G=t.ik[q],z=r.findIkConstraint(q),j=new Ft(G.length);j.ikConstraintIndex=r.ikConstraints.indexOf(z);for(var Z=0,Q=0;Q<G.length;Q++){var J=G[Q];j.setFrame(Z,this.getValue(J,"time",0),this.getValue(J,"mix",1),this.getValue(J,"softness",0)*n,this.getValue(J,"bendPositive",!0)?1:-1,this.getValue(J,"compress",!1),this.getValue(J,"stretch",!1)),this.readCurve(J,j,Z),Z++}a.push(j),i=Math.max(i,j.frames[(j.getFrameCount()-1)*Ft.ENTRIES])}if(t.transform)for(var K in t.transform){var $=t.transform[K],tt=r.findTransformConstraint(K),et=new Nt($.length);et.transformConstraintIndex=r.transformConstraints.indexOf(tt);for(var rt=0,nt=0;nt<$.length;nt++){var at=$[nt];et.setFrame(rt,this.getValue(at,"time",0),this.getValue(at,"rotateMix",1),this.getValue(at,"translateMix",1),this.getValue(at,"scaleMix",1),this.getValue(at,"shearMix",1)),this.readCurve(at,et,rt),rt++}a.push(et),i=Math.max(i,et.frames[(et.getFrameCount()-1)*Nt.ENTRIES])}if(t.path)for(var it in t.path){var st=t.path[it],ht=r.findPathConstraintIndex(it);if(-1==ht)throw new Error("Path constraint not found: "+it);var ut=r.pathConstraints[ht];for(var ct in st){var dt=st[ct];if("position"===ct||"spacing"===ct){var ft=null,vt=1;"spacing"===ct?(ft=new Lt(dt.length),ut.spacingMode!=lt.Length&&ut.spacingMode!=lt.Fixed||(vt=n)):(ft=new Ot(dt.length),ut.positionMode==ot.Fixed&&(vt=n)),ft.pathConstraintIndex=ht;for(var pt=0,gt=0;gt<dt.length;gt++){var mt=dt[gt];ft.setFrame(pt,this.getValue(mt,"time",0),this.getValue(mt,ct,0)*vt),this.readCurve(mt,ft,pt),pt++}a.push(ft),i=Math.max(i,ft.frames[(ft.getFrameCount()-1)*Ot.ENTRIES])}else if("mix"===ct){var wt=new Xt(dt.length);wt.pathConstraintIndex=ht;for(var Et=0,xt=0;xt<dt.length;xt++){var bt=dt[xt];wt.setFrame(Et,this.getValue(bt,"time",0),this.getValue(bt,"rotateMix",1),this.getValue(bt,"translateMix",1)),this.readCurve(bt,wt,Et),Et++}a.push(wt),i=Math.max(i,wt.frames[(wt.getFrameCount()-1)*Xt.ENTRIES])}}}if(t.deform)for(var Vt in t.deform){var Bt=t.deform[Vt],Yt=r.findSkin(Vt);if(null==Yt)throw new Error("Skin not found: "+Vt);for(var Wt in Bt){var Ut=Bt[Wt],qt=r.findSlotIndex(Wt);if(-1==qt)throw new Error("Slot not found: "+Ut.name);for(var Ht in Ut){var Gt=Ut[Ht],zt=Yt.getAttachment(qt,Ht);if(null==zt)throw new Error("Deform attachment not found: "+Gt.name);var jt=null!=zt.bones,Zt=zt.vertices,Qt=jt?Zt.length/3*2:Zt.length,Jt=new kt(Gt.length);Jt.slotIndex=qt,Jt.attachment=zt;for(var Kt=0,$t=0;$t<Gt.length;$t++){var te=Gt[$t],ee=void 0,re=this.getValue(te,"vertices",null);if(null==re)ee=jt?H.newFloatArray(Qt):Zt;else{ee=H.newFloatArray(Qt);var ne=this.getValue(te,"offset",0);if(H.arrayCopy(re,0,ee,ne,re.length),1!=n)for(var ae=ne,ie=ae+re.length;ae<ie;ae++)ee[ae]*=n;if(!jt)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 _t(oe.length),he=r.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,ve=this.getValue(de,"offsets",null);if(null!=ve){fe=H.newArray(he,-1);for(var pe=H.newArray(he-ve.length,0),ge=0,me=0,we=0;we<ve.length;we++){var Ee=ve[we],xe=r.findSlotIndex(Ee.slot);if(-1==xe)throw new Error("Slot not found: "+Ee.slot);for(;ge!=xe;)pe[me++]=ge++;fe[ge+Ee.offset]=ge++}for(;ge<he;)pe[me++]=ge++;for(var ye=he-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--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 Pt(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Ae=t.events[Me],Te=r.findEvent(Ae.name);if(null==Te)throw new Error("Event not found: "+Ae.name);var Ie=new Dt(H.toSinglePrecision(this.getValue(Ae,"time",0)),Te);Ie.intValue=this.getValue(Ae,"int",Te.intValue),Ie.floatValue=this.getValue(Ae,"float",Te.floatValue),Ie.stringValue=this.getValue(Ae,"string",Te.stringValue),null!=Ie.data.audioPath&&(Ie.volume=this.getValue(Ae,"volume",1),Ie.balance=this.getValue(Ae,"balance",0)),be.setFrame(Se++,Ie)}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");r.animations.push(new yt(e,a,i))},e.readCurve=function(t,e,r){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(r);else{var n=t.curve;e.setCurve(r,n,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,r){return void 0!==t[e]?t[e]:r},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return Bt.Normal;if("additive"==t)return Bt.Additive;if("multiply"==t)return Bt.Multiply;if("screen"==t)return Bt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return ot.Fixed;if("percent"==t)return ot.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return lt.Length;if("fixed"==t)return lt.Fixed;if("percent"==t)return lt.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return ht.Tangent;if("chain"==t)return ht.Chain;if("chainscale"==t)return ht.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return K.Normal;if("onlytranslation"==t)return K.OnlyTranslation;if("norotationorreflection"==t)return K.NoRotationOrReflection;if("noscale"==t)return K.NoScale;if("noscaleorreflection"==t)return K.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Ut=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,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"}(Yt||(Yt={}));var qt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new it;n.name="";var a=new Ht(e);if(n.hash=a.readString(),n.version=a.readString(),"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=a.readFloat(),n.y=a.readFloat(),n.width=a.readFloat(),n.height=a.readFloat();var i=a.readBoolean();i&&(n.fps=a.readFloat(),n.imagesPath=a.readString(),n.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:n.bones[a.readInt(!0)],c=new st(l,h,u);c.rotation=a.readFloat(),c.x=a.readFloat()*r,c.y=a.readFloat()*r,c.scaleX=a.readFloat(),c.scaleY=a.readFloat(),c.shearX=a.readFloat(),c.shearY=a.readFloat(),c.length=a.readFloat()*r,c.transformMode=t.TransformModeValues[a.readInt(!0)],c.skinRequired=a.readBoolean(),i&&U.rgba8888ToColor(c.color,a.readInt32()),n.bones.push(c)}s=a.readInt(!0);for(var d=0;d<s;d++){var f=a.readString(),v=n.bones[a.readInt(!0)],p=new ut(d,f,v);U.rgba8888ToColor(p.color,a.readInt32());var g=a.readInt32();-1!=g&&U.rgb888ToColor(p.darkColor=new U,g),p.attachmentName=a.readStringRef(),p.blendMode=t.BlendModeValues[a.readInt(!0)],n.slots.push(p)}s=a.readInt(!0);for(var m,w=0;w<s;w++){var E=new dt(a.readString());E.order=a.readInt(!0),E.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var x=0;x<m;x++)E.bones.push(n.bones[a.readInt(!0)]);E.target=n.bones[a.readInt(!0)],E.mix=a.readFloat(),E.softness=a.readFloat()*r,E.bendDirection=a.readByte(),E.compress=a.readBoolean(),E.stretch=a.readBoolean(),E.uniform=a.readBoolean(),n.ikConstraints.push(E)}s=a.readInt(!0);for(var y,b=0;b<s;b++){var S=new ft(a.readString());S.order=a.readInt(!0),S.skinRequired=a.readBoolean(),y=a.readInt(!0);for(var M=0;M<y;M++)S.bones.push(n.bones[a.readInt(!0)]);S.target=n.bones[a.readInt(!0)],S.local=a.readBoolean(),S.relative=a.readBoolean(),S.offsetRotation=a.readFloat(),S.offsetX=a.readFloat()*r,S.offsetY=a.readFloat()*r,S.offsetScaleX=a.readFloat(),S.offsetScaleY=a.readFloat(),S.offsetShearY=a.readFloat(),S.rotateMix=a.readFloat(),S.translateMix=a.readFloat(),S.scaleMix=a.readFloat(),S.shearMix=a.readFloat(),n.transformConstraints.push(S)}s=a.readInt(!0);for(var A,T=0;T<s;T++){var I=new vt(a.readString());I.order=a.readInt(!0),I.skinRequired=a.readBoolean(),A=a.readInt(!0);for(var R=0;R<A;R++)I.bones.push(n.bones[a.readInt(!0)]);I.target=n.slots[a.readInt(!0)],I.positionMode=t.PositionModeValues[a.readInt(!0)],I.spacingMode=t.SpacingModeValues[a.readInt(!0)],I.rotateMode=t.RotateModeValues[a.readInt(!0)],I.offsetRotation=a.readFloat(),I.position=a.readFloat(),I.positionMode==ot.Fixed&&(I.position*=r),I.spacing=a.readFloat(),I.spacingMode!=lt.Length&&I.spacingMode!=lt.Fixed||(I.spacing*=r),I.rotateMix=a.readFloat(),I.translateMix=a.readFloat(),n.pathConstraints.push(I)}var C=this.readSkin(a,n,!0,i);null!=C&&(n.defaultSkin=C,n.skins.push(C));var V=n.skins.length;for(H.setArraySize(n.skins,s=V+a.readInt(!0));V<s;V++)n.skins[V]=this.readSkin(a,n,!1,i);s=this.linkedMeshes.length;for(var k=0;k<s;k++){var P=this.linkedMeshes[k],_=null==P.skin?n.defaultSkin:n.findSkin(P.skin);if(null==_)throw new Error("Skin not found: "+P.skin);var F=_.getAttachment(P.slotIndex,P.parent);if(null==F)throw new Error("Parent mesh not found: "+P.parent);P.mesh.deformAttachment=P.inheritDeform?F:P.mesh,P.mesh.setParentMesh(F),P.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var N=0;N<s;N++){var O=new xt(a.readStringRef());O.intValue=a.readInt(!1),O.floatValue=a.readFloat(),O.stringValue=a.readString(),O.audioPath=a.readString(),null!=O.audioPath&&(O.volume=a.readFloat(),O.balance=a.readFloat()),n.events.push(O)}s=a.readInt(!0);for(var B=0;B<s;B++)n.animations.push(this.readAnimation(a,a.readString(),n));return n},e.readSkin=function(t,e,r,n){var a=null,i=0;if(r){if(0==(i=t.readInt(!0)))return null;a=new Et("default")}else{(a=new Et(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 v=0;v<i;v++)for(var p=t.readInt(!0),g=0,m=t.readInt(!0);g<m;g++){var w=t.readStringRef(),E=this.readAttachment(t,e,a,p,w,n);null!=E&&a.setAttachment(p,w,E)}return a},e.readAttachment=function(e,r,n,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case Yt.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),v=e.readFloat(),p=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readInt32();null==u&&(u=l);var E=this.attachmentLoader.newRegionAttachment(n,l,u);return null==E?null:(E.path=u,E.x=d*o,E.y=f*o,E.scaleX=v,E.scaleY=p,E.rotation=c,E.width=g*o,E.height=m*o,U.rgba8888ToColor(E.color,w),E.updateOffset(),E);case Yt.BoundingBox:var x=e.readInt(!0),y=this.readVertices(e,x),b=s?e.readInt32():0,S=this.attachmentLoader.newBoundingBoxAttachment(n,l);return null==S?null:(S.worldVerticesLength=x<<1,S.vertices=y.vertices,S.bones=y.bones,s&&U.rgba8888ToColor(S.color,b),S);case Yt.Mesh:var M=e.readStringRef(),A=e.readInt32(),T=e.readInt(!0),I=this.readFloatArray(e,T<<1,1),R=this.readShortArray(e),C=this.readVertices(e,T),V=e.readInt(!0),k=null,P=0,_=0;s&&(k=this.readShortArray(e),P=e.readFloat(),_=e.readFloat()),null==M&&(M=l);var F=this.attachmentLoader.newMeshAttachment(n,l,M);return null==F?null:(F.path=M,U.rgba8888ToColor(F.color,A),F.bones=C.bones,F.vertices=C.vertices,F.worldVerticesLength=T<<1,F.triangles=R,F.regionUVs=I,F.updateUVs(),F.hullLength=V<<1,s&&(F.edges=k,F.width=P*o,F.height=_*o),F);case Yt.LinkedMesh:var N=e.readStringRef(),O=e.readInt32(),B=e.readStringRef(),L=e.readStringRef(),X=e.readBoolean(),Y=0,D=0;s&&(Y=e.readFloat(),D=e.readFloat()),null==N&&(N=l);var W=this.attachmentLoader.newMeshAttachment(n,l,N);return null==W?null:(W.path=N,U.rgba8888ToColor(W.color,O),s&&(W.width=Y*o,W.height=D*o),this.linkedMeshes.push(new Gt(W,B,a,L,X)),W);case Yt.Path:for(var q=e.readBoolean(),G=e.readBoolean(),z=e.readInt(!0),j=this.readVertices(e,z),Z=H.newArray(z/3,0),Q=0,J=Z.length;Q<J;Q++)Z[Q]=e.readFloat()*o;var K=s?e.readInt32():0,$=this.attachmentLoader.newPathAttachment(n,l);return null==$?null:($.closed=q,$.constantSpeed=G,$.worldVerticesLength=z<<1,$.vertices=j.vertices,$.bones=j.bones,$.lengths=Z,s&&U.rgba8888ToColor($.color,K),$);case Yt.Point:var tt=e.readFloat(),et=e.readFloat(),rt=e.readFloat(),nt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(n,l);return null==at?null:(at.x=et*o,at.y=rt*o,at.rotation=tt,s&&U.rgba8888ToColor(at.color,nt),at);case Yt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(n,l);return null==ht?null:(ht.endSlot=r.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&U.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var r=e<<1,n=new zt,a=this.scale;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,a),n;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 n.vertices=H.toFloatArray(i),n.bones=s,n},e.readFloatArray=function(t,e,r){var n=new Array(e);if(1==r)for(var a=0;a<e;a++)n[a]=t.readFloat();else for(var i=0;i<e;i++)n[i]=t.readFloat()*r;return n},e.readShortArray=function(t){for(var e=t.readInt(!0),r=new Array(e),n=0;n<e;n++)r[n]=t.readShort();return r},e.readAnimation=function(e,r,n){for(var a=new Array,i=this.scale,s=0,o=new U,l=new U,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 v=e.readByte(),p=e.readInt(!0);switch(v){case t.SLOT_ATTACHMENT:var g=new Ct(p);g.slotIndex=c;for(var m=0;m<p;m++)g.setFrame(m,e.readFloat(),e.readStringRef());a.push(g),s=Math.max(s,g.frames[p-1]);break;case t.SLOT_COLOR:var w=new It(p);w.slotIndex=c;for(var E=0;E<p;E++){var x=e.readFloat();U.rgba8888ToColor(o,e.readInt32()),w.setFrame(E,x,o.r,o.g,o.b,o.a),E<p-1&&this.readCurve(e,E,w)}a.push(w),s=Math.max(s,w.frames[(p-1)*It.ENTRIES]);break;case t.SLOT_TWO_COLOR:var y=new Rt(p);y.slotIndex=c;for(var b=0;b<p;b++){var S=e.readFloat();U.rgba8888ToColor(o,e.readInt32()),U.rgb888ToColor(l,e.readInt32()),y.setFrame(b,S,o.r,o.g,o.b,o.a,l.r,l.g,l.b),b<p-1&&this.readCurve(e,b,y)}a.push(y),s=Math.max(s,y.frames[(p-1)*Rt.ENTRIES])}}for(var M=0,A=e.readInt(!0);M<A;M++)for(var T=e.readInt(!0),I=0,R=e.readInt(!0);I<R;I++){var C=e.readByte(),V=e.readInt(!0);switch(C){case t.BONE_ROTATE:var k=new St(V);k.boneIndex=T;for(var P=0;P<V;P++)k.setFrame(P,e.readFloat(),e.readFloat()),P<V-1&&this.readCurve(e,P,k);a.push(k),s=Math.max(s,k.frames[(V-1)*St.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var _=void 0,F=1;C==t.BONE_SCALE?_=new At(V):C==t.BONE_SHEAR?_=new Tt(V):(_=new Mt(V),F=i),_.boneIndex=T;for(var N=0;N<V;N++)_.setFrame(N,e.readFloat(),e.readFloat()*F,e.readFloat()*F),N<V-1&&this.readCurve(e,N,_);a.push(_),s=Math.max(s,_.frames[(V-1)*Mt.ENTRIES])}}for(var O=0,B=e.readInt(!0);O<B;O++){var L=e.readInt(!0),X=e.readInt(!0),Y=new Ft(X);Y.ikConstraintIndex=L;for(var D=0;D<X;D++)Y.setFrame(D,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),D<X-1&&this.readCurve(e,D,Y);a.push(Y),s=Math.max(s,Y.frames[(X-1)*Ft.ENTRIES])}for(var W=0,q=e.readInt(!0);W<q;W++){var G=e.readInt(!0),z=e.readInt(!0),j=new Nt(z);j.transformConstraintIndex=G;for(var Z=0;Z<z;Z++)j.setFrame(Z,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),Z<z-1&&this.readCurve(e,Z,j);a.push(j),s=Math.max(s,j.frames[(z-1)*Nt.ENTRIES])}for(var Q=0,J=e.readInt(!0);Q<J;Q++)for(var K=e.readInt(!0),$=n.pathConstraints[K],tt=0,et=e.readInt(!0);tt<et;tt++){var rt=e.readByte(),nt=e.readInt(!0);switch(rt){case t.PATH_POSITION:case t.PATH_SPACING:var at=void 0,it=1;rt==t.PATH_SPACING?(at=new Lt(nt),$.spacingMode!=lt.Length&&$.spacingMode!=lt.Fixed||(it=i)):(at=new Ot(nt),$.positionMode==ot.Fixed&&(it=i)),at.pathConstraintIndex=K;for(var st=0;st<nt;st++)at.setFrame(st,e.readFloat(),e.readFloat()*it),st<nt-1&&this.readCurve(e,st,at);a.push(at),s=Math.max(s,at.frames[(nt-1)*Ot.ENTRIES]);break;case t.PATH_MIX:var ht=new Xt(nt);ht.pathConstraintIndex=K;for(var ut=0;ut<nt;ut++)ht.setFrame(ut,e.readFloat(),e.readFloat(),e.readFloat()),ut<nt-1&&this.readCurve(e,ut,ht);a.push(ht),s=Math.max(s,ht.frames[(nt-1)*Xt.ENTRIES])}}for(var ct=0,dt=e.readInt(!0);ct<dt;ct++)for(var ft=n.skins[e.readInt(!0)],vt=0,pt=e.readInt(!0);vt<pt;vt++)for(var gt=e.readInt(!0),mt=0,wt=e.readInt(!0);mt<wt;mt++){var Et=ft.getAttachment(gt,e.readStringRef()),xt=null!=Et.bones,bt=Et.vertices,Vt=xt?bt.length/3*2:bt.length,Bt=e.readInt(!0),Yt=new kt(Bt);Yt.slotIndex=gt,Yt.attachment=Et;for(var Wt=0;Wt<Bt;Wt++){var Ut=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=xt?H.newFloatArray(Vt):bt;else{qt=H.newFloatArray(Vt);var Gt=e.readInt(!0);if(Ht+=Gt,1==i)for(var zt=Gt;zt<Ht;zt++)qt[zt]=e.readFloat();else for(var jt=Gt;jt<Ht;jt++)qt[jt]=e.readFloat()*i;if(!xt)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=bt[Zt]}Yt.setFrame(Wt,Ut,qt),Wt<Bt-1&&this.readCurve(e,Wt,Yt)}a.push(Yt),s=Math.max(s,Yt.frames[Bt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new _t(Jt),$t=n.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),re=e.readInt(!0),ne=H.newArray($t,0),ae=$t-1;ae>=0;ae--)ne[ae]=-1;for(var ie=H.newArray($t-re,0),se=0,oe=0,le=0;le<re;le++){for(var he=e.readInt(!0);se!=he;)ie[oe++]=se++;ne[se+e.readInt(!0)]=se++}for(;se<$t;)ie[oe++]=se++;for(var ue=$t-1;ue>=0;ue--)-1==ne[ue]&&(ne[ue]=ie[--oe]);Kt.setFrame(te,ee,ne)}a.push(Kt),s=Math.max(s,Kt.frames[Jt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new Pt(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=n.events[e.readInt(!0)],ge=new Dt(ve,pe);ge.intValue=e.readInt(!1),ge.floatValue=e.readFloat(),ge.stringValue=e.readBoolean()?e.readString():pe.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 yt(r,a,s)},e.readCurve=function(e,r,n){switch(e.readByte()){case t.CURVE_STEPPED:n.setStepped(r);break;case t.CURVE_BEZIER:this.setCurve(n,r,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat())}},e.setCurve=function(t,e,r,n,a,i){t.setCurve(e,r,n,a,i)},t}();qt.AttachmentTypeValues=[0,1,2,3,4,5,6],qt.TransformModeValues=[K.Normal,K.OnlyTranslation,K.NoRotationOrReflection,K.NoScale,K.NoScaleOrReflection],qt.PositionModeValues=[ot.Fixed,ot.Percent],qt.SpacingModeValues=[lt.Length,lt.Fixed,lt.Percent],qt.RotateModeValues=[ht.Tangent,ht.Chain,ht.ChainScale],qt.BlendModeValues=[Bt.Normal,Bt.Additive,Bt.Multiply,Bt.Screen],qt.BONE_ROTATE=0,qt.BONE_TRANSLATE=1,qt.BONE_SCALE=2,qt.BONE_SHEAR=3,qt.SLOT_ATTACHMENT=0,qt.SLOT_COLOR=1,qt.SLOT_TWO_COLOR=2,qt.PATH_POSITION=0,qt.PATH_SPACING=1,qt.PATH_MIX=2,qt.CURVE_LINEAR=0,qt.CURVE_STEPPED=1,qt.CURVE_BEZIER=2;var Ht=function(){function t(t,e,r,n){void 0===e&&(e=new Array),void 0===r&&(r=0),void 0===n&&(n=new DataView(t.buffer)),this.strings=e,this.index=r,this.buffer=n}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(),r=127&e;return 128&e&&(r|=(127&(e=this.readByte()))<<7,128&e&&(r|=(127&(e=this.readByte()))<<14,128&e&&(r|=(127&(e=this.readByte()))<<21,128&e&&(r|=(127&(e=this.readByte()))<<28)))),t?r:r>>>1^-(1&r)},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="",r=0;r<t;){var n=this.readByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),r+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),r+=3;break;default:e+=String.fromCharCode(n),r++}}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}(),Gt=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},zt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function jt(){return(jt=V((function(t,e){var a,i,s,o,l,h,u,c,d,f,v,p,g,m,w,E;return R(this,(function(x){switch(x.label){case 0:if(a=t.skeletonPath,i=t.atlasPath,s=t.imagePaths,o=t.skeletonExtension,l=t.imageExtensions,h="json"===o?Zt:Qt,!(s.length>0))return[3,5];v=[h(a),Zt(i)],p=s.map((function(t,n){var a=l[n],i=r.Texture2D;return"ktx"===a&&(i=r.KTX),"ktx2"===a&&(i=r.KTX2),Jt(t,e,i)})),v.push(n.all(p)),x.label=1;case 1:return x.trys.push([1,3,,4]),[4,Promise.all(v)];case 2:return g=x.sent(),u=g[0],d=g[1],f=g[2],m=0,c=new L(d,(function(){var t=f[m];return m++,ee(t)})),[3,4];case 3:throw x.sent();case 4:return[3,8];case 5:return x.trys.push([5,7,,8]),[4,Promise.all([h(a),Kt(i,e)])];case 6:return w=x.sent(),u=w[0],c=w[1],[3,8];case 7:throw x.sent();case 8:return E=new at(c),"json"===o?[2,new Wt(E).readSkeletonData(u)]:[2,new qt(E).readSkeletonData(new Uint8Array(u))]}}))}))).apply(this,arguments)}function Zt(t){return a(t,{type:"text"})}function Qt(t){return a(t,{type:"arraybuffer"})}function Jt(t,e,n){return void 0===n&&(n=r.Texture2D),e.resourceManager.load({url:t,type:n})}function Kt(t,e){return $t.apply(this,arguments)}function $t(){return($t=V((function(t,e){var r,n,a,i,s,o,l,h,u,c,d;return R(this,(function(f){switch(f.label){case 0:r=[],n=function(t){var e=new URL(t),r=e.origin+e.pathname;return r.endsWith("/")?r:r.substring(0,r.lastIndexOf("/")+1)}(t),s={},f.label=1;case 1:return f.trys.push([1,3,,4]),[4,Zt(t)];case 2:return a=f.sent(),[3,4];case 3:throw o=f.sent(),new Error("Spine Atlas: "+t+" load error: "+o);case 4:try{new L(a,(function(t){return r.push(n+t),new B(new Image)}))}catch(e){throw new Error("Spine Atlas: "+t+" read error: "+e)}for(l=[],h=P(r);!(u=h()).done;)c=u.value,l.push(Jt(c,e));f.label=5;case 5:return f.trys.push([5,7,,8]),[4,Promise.all(l)];case 6:return i=f.sent(),[3,8];case 7:throw d=f.sent(),new Error("Spine Texture: "+t+" load error: "+d);case 8:return i.forEach((function(t,e){var n=r[e];s[n]=t})),[2,new L(a,(function(t){return ee(s[n+t])}))]}}))}))).apply(this,arguments)}function te(t,e){return new L(t,(function(t){return ee(e[t])}))}function ee(t){return new re(new Image,t)}var re=function(r){function n(t,e){var n;return(n=r.call(this,t)||this).texture=e,n.texture.generateMipmaps(),n}T(n,r);var a=n.prototype;return a.getImage=function(){return console.log(this.texture),this.texture},a.setFilters=function(e,r){e===_.Nearest?this.texture.filterMode=t.Point:r===_.MipMapLinearLinear?this.texture.filterMode=t.Trilinear:this.texture.filterMode=t.Bilinear},a.setWraps=function(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)},a.dispose=function(){},a._convertWrapMode=function(t){switch(t){case F.ClampToEdge:return e.Clamp;case F.Repeat:return e.Repeat;case F.MirroredRepeat:return e.Mirror;default:throw new Error("Unsupported texture wrap mode.")}},n}(N);function ne(t,e){if(e)return e;if(t.startsWith("blob:"))return null;var r=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)/);return r&&r[2]?r[2]:null}var ae=function(t){function e(){return t.apply(this,arguments)}return T(e,t),e.prototype.load=function(t,e){return new n((function(r,n){var a={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]},i=t.params||{},s=i.fileExtensions;if(i.imageLoaderType,t.urls){s=se(s,!0);for(var o=0;o<t.urls.length;o+=1){ie(t.urls[o],s&&s[o]||null,a)}}else{var l=se(s,!1);!function(t,e,r){var n=ne(t,e);if(!n)return;r.skeletonPath=t,r.skeletonExtension=n;var a,i=/(\.(json|bin|skel))$/;i.test(t)&&(a=t.replace(i,""));if(a){var s=a+".atlas";r.atlasPath=s}}(t.url,l,a)}a.skeletonPath&&a.atlasPath?function(t,e){return jt.apply(this,arguments)}(a,e.engine).then((function(t){r(t)})).catch((function(t){n(t)})):n("Failed to load spine assets. Please check the file path and ensure the file extension is included.")}))},e}(s);function ie(t,e,r){var n=ne(t,e);n&&(["skel","json","bin"].includes(n)&&(r.skeletonPath=t,r.skeletonExtension=n),"atlas"===n&&(r.atlasPath=t),["png","jpg","webp","jpeg","ktx","ktx2"].includes(n)&&(r.imagePaths.push(t),r.imageExtensions.push(n)))}function se(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}function oe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function le(t,e,r){return e&&oe(t.prototype,e),r&&oe(t,r),t}function he(){return he=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},he.apply(this,arguments)}ae=I([i("spine",["json","bin","skel"])],ae);var ue=function(){function t(t,e,r){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=r,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,r,n,a,i,s){this.ax=t,this.ay=e,this.arotation=r,this.ascaleX=n,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var l=this.skeleton,h=r+90+s,u=l.scaleX,c=l.scaleY;return this.a=q.cosDeg(r+i)*n*u,this.b=q.cosDeg(h)*a*u,this.c=q.sinDeg(r+i)*n*c,this.d=q.sinDeg(h)*a*c,this.worldX=t*u+l.x,void(this.worldY=e*c+l.y)}var d=o.a,f=o.b,v=o.c,p=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=v*t+p*e+o.worldY,this.data.transformMode){case K.Normal:var g=r+90+s,m=q.cosDeg(r+i)*n,w=q.cosDeg(g)*a,E=q.sinDeg(r+i)*n,x=q.sinDeg(g)*a;return this.a=d*m+f*E,this.b=d*w+f*x,this.c=v*m+p*E,void(this.d=v*w+p*x);case K.OnlyTranslation:var y=r+90+s;this.a=q.cosDeg(r+i)*n,this.b=q.cosDeg(y)*a,this.c=q.sinDeg(r+i)*n,this.d=q.sinDeg(y)*a;break;case K.NoRotationOrReflection:var b=d*d+v*v,S=0;b>1e-4?(b=Math.abs(d*p-f*v)/b,d/=this.skeleton.scaleX,f=(v/=this.skeleton.scaleY)*b,p=d*b,S=Math.atan2(v,d)*q.radDeg):(d=0,v=0,S=90-Math.atan2(p,f)*q.radDeg);var M=r+i-S,A=r+s-S+90,T=q.cosDeg(M)*n,I=q.cosDeg(A)*a,R=q.sinDeg(M)*n,C=q.sinDeg(A)*a;this.a=d*T-f*R,this.b=d*I-f*C,this.c=v*T+p*R,this.d=v*I+p*C;break;case K.NoScale:case K.NoScaleOrReflection:var V=q.cosDeg(r),k=q.sinDeg(r),P=(d*V+f*k)/this.skeleton.scaleX,_=(v*V+p*k)/this.skeleton.scaleY,F=Math.sqrt(P*P+_*_);F>1e-5&&(F=1/F),P*=F,_*=F,F=Math.sqrt(P*P+_*_),this.data.transformMode==K.NoScale&&d*p-f*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(F=-F);var N=Math.PI/2+Math.atan2(_,P),O=Math.cos(N)*F,B=Math.sin(N)*F,L=q.cosDeg(i)*n,X=q.cosDeg(90+s)*a,Y=q.sinDeg(i)*n,D=q.sinDeg(90+s)*a;this.a=P*L+O*Y,this.b=P*X+O*D,this.c=_*L+B*Y,this.d=_*X+B*D}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)*q.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*q.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)*q.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)*q.radDeg);var e=t.a,r=t.b,n=t.c,a=t.d,i=1/(e*a-r*n),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*r*i,this.ay=o*e*i-s*n*i;var l=i*a,h=i*e,u=i*r,c=i*n,d=l*this.a-u*this.c,f=l*this.b-u*this.d,v=h*this.c-c*this.a,p=h*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+v*v),this.ascaleX>1e-4){var g=d*p-f*v;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+v*p,g)*q.radDeg,this.arotation=Math.atan2(v,d)*q.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,f)*q.radDeg},e.worldToLocal=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=1/(e*a-r*n),s=t.x-this.worldX,o=t.y-this.worldY;return t.x=s*a*i-o*r*i,t.y=o*e*i-s*n*i,t},e.localToWorld=function(t){var e=t.x,r=t.y;return t.x=e*this.a+r*this.b+this.worldX,t.y=e*this.c+r*this.d+this.worldY,t},e.worldToLocalRotation=function(t){var e=q.sinDeg(t),r=q.cosDeg(t);return Math.atan2(this.a*e-this.c*r,this.d*r-this.b*e)*q.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=q.sinDeg(t),r=q.cosDeg(t);return Math.atan2(r*this.c+e*this.d,r*this.a+e*this.b)*q.radDeg},e.rotateWorld=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=q.cosDeg(t),s=q.sinDeg(t);this.a=i*e-s*n,this.b=i*r-s*a,this.c=s*e+i*n,this.d=s*r+i*a,this.appliedValid=!1},t}(),ce=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 U,this.darkColor=null==t.darkColor?null:new U,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}(),de=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 r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].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,r,n,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,v=0;switch(t.data.transformMode){case K.OnlyTranslation:f=e-t.worldX,v=r-t.worldY;break;case K.NoRotationOrReflection:var p=Math.abs(l*c-h*u)/(l*l+u*u),g=l/t.skeleton.scaleX,m=u/t.skeleton.scaleY;h=-m*p*t.skeleton.scaleX,c=g*p*t.skeleton.scaleY,d+=Math.atan2(m,g)*q.radDeg;default:var w=e-o.worldX,E=r-o.worldY,x=l*c-h*u;f=(w*c-E*h)/x-t.ax,v=(E*l-w*u)/x-t.ay}d+=Math.atan2(v,f)*q.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var y=t.ascaleX,b=t.ascaleY;if(n||a){switch(t.data.transformMode){case K.NoScale:case K.NoScaleOrReflection:f=e-t.worldX,v=r-t.worldY}var S=t.data.length*y,M=Math.sqrt(f*f+v*v);if(n&&M<S||a&&M>S&&S>1e-4){var A=(M/S-1)*s+1;y*=A,i&&(b*=A)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,y,b,t.ashearX,t.ashearY)},e.apply2=function(t,e,r,n,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,v=0,p=0,g=0;u<0?(u=-u,v=180,g=-1):(v=0,g=1),d<0&&(d=-d,g=-g),f<0?(f=-f,p=180):p=0;var m=e.ax,w=0,E=0,x=0,y=t.a,b=t.b,S=t.c,M=t.d,A=Math.abs(u-d)<=1e-4;A?(E=y*m+b*(w=e.ay)+t.worldX,x=S*m+M*w+t.worldY):(w=0,E=y*m+t.worldX,x=S*m+t.worldY);var T=t.parent;y=T.a,b=T.b,S=T.c;var I,R,C=1/(y*(M=T.d)-b*S),V=E-T.worldX,k=x-T.worldY,P=(V*M-k*b)*C-l,_=(k*y-V*S)*C-h,F=Math.sqrt(P*P+_*_),N=e.data.length*f;if(F<1e-4)return this.apply1(t,r,n,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var O=((V=r-T.worldX)*M-(k=n-T.worldY)*b)*C-l,B=(k*y-V*S)*C-h,L=O*O+B*B;if(0!=s){s*=u*(f+1)/2;var X=Math.sqrt(L),Y=X-F-N*u+s;if(Y>0){var D=Math.min(1,Y/(2*s))-1;L=(O-=(D=(Y-s*(1-D*D))/X)*O)*O+(B-=D*B)*B}}t:if(A){var W=(L-F*F-(N*=u)*N)/(2*F*N);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(L)/(F+N)-1)*o+1)),R=Math.acos(W)*a,y=F+N*W,b=N*Math.sin(R),I=Math.atan2(B*y-O*b,O*y+B*b)}else{var U=(y=u*N)*y,H=(b=d*N)*b,G=Math.atan2(B,O),z=-2*H*F,j=H-U;if((M=z*z-4*j*(S=H*F*F+U*L-U*H))>=0){var Z=Math.sqrt(M);z<0&&(Z=-Z);var Q=(Z=-(z+Z)/2)/j,J=S/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=L){k=Math.sqrt(L-K*K)*a,I=G-Math.atan2(k,K),R=Math.atan2(k/d,(K-F)/u);break t}}var $=q.PI,tt=F-y,et=tt*tt,rt=0,nt=0,at=F+y,it=at*at,st=0;(S=-y*F/(U-H))>=-1&&S<=1&&(S=Math.acos(S),(M=(V=y*Math.cos(S)+F)*V+(k=b*Math.sin(S))*k)<et&&($=S,et=M,tt=V,rt=k),M>it&&(nt=S,it=M,at=V,st=k)),L<=(et+it)/2?(I=G-Math.atan2(rt*a,tt),R=$*a):(I=G-Math.atan2(st*a,at),R=nt*a)}var ot=Math.atan2(w,m)*g,lt=t.arotation;(I=(I-ot)*q.radDeg+v-lt)>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,h,lt+I*o,c,t.ascaleY,0,0),lt=e.arotation,(R=((R+ot)*q.radDeg-e.ashearX)*g+p-lt)>180?R-=360:R<-180&&(R+=360),e.updateWorldTransformWith(m,w,lt+R*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),fe=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new z,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 r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].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,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?q.degRad:-q.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],g=!1;if(0!=t){var m=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)-Math.atan2(E,m)+u;y>q.PI?y-=q.PI2:y<-q.PI&&(y+=q.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*m-S*E,p.b=b*w-S*x,p.c=S*m+b*E,p.d=S*w+b*x,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(M.x-p.worldX)*e,p.worldY+=(M.y-p.worldY)*e,g=!0}if(r>0){var A=Math.sqrt(p.a*p.a+p.c*p.c),T=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(T-A+this.data.offsetScaleX)*r)/A),p.a*=A,p.c*=A,A=Math.sqrt(p.b*p.b+p.d*p.d),T=Math.sqrt(s*s+l*l),A>1e-5&&(A=(A+(T-A+this.data.offsetScaleY)*r)/A),p.b*=A,p.d*=A,g=!0}if(n>0){var I=p.b,R=p.d,C=Math.atan2(R,I),V=Math.atan2(l,s)-Math.atan2(o,i)-(C-Math.atan2(p.c,p.a));V>q.PI?V-=q.PI2:V<-q.PI&&(V+=q.PI2),V=C+(V+c)*n;var k=Math.sqrt(I*I+R*R);p.b=Math.cos(V)*k,p.d=Math.sin(V)*k,g=!0}g&&(p.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?q.degRad:-q.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],g=!1;if(0!=t){var m=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)+u;y>q.PI?y-=q.PI2:y<-q.PI&&(y+=q.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*m-S*E,p.b=b*w-S*x,p.c=S*m+b*E,p.d=S*w+b*x,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=M.x*e,p.worldY+=M.y*e,g=!0}if(r>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*r+1;p.a*=A,p.c*=A,A=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,p.b*=A,p.d*=A,g=!0}if(n>0){var T=Math.atan2(l,s)-Math.atan2(o,i);T>q.PI?T-=q.PI2:T<-q.PI&&(T+=q.PI2);var I=p.b,R=p.d;T=Math.atan2(R,I)+(T-q.PI/2+c)*n;var C=Math.sqrt(I*I+R*R);p.b=Math.cos(T)*C,p.d=Math.sin(T)*C,g=!0}g&&(p.appliedValid=!1)}},e.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=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,v=l.ascaleY;0!=r&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*r)/f),v>1e-5&&(v=(v+(a.ascaleY-v+this.data.offsetScaleY)*r)/v));var p=l.ashearY;if(0!=n){var g=a.ashearY-p+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),l.shearY+=g*n}l.updateWorldTransformWith(c,d,h,f,v,l.ashearX,p)}},e.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=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!=r&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*r+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*r+1));var v=l.ashearY;0!=n&&(v+=(a.ashearY+this.data.offsetShearY)*n),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,v)}},t}(),ve=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 r=0,n=t.bones.length;r<n;r++)this.bones.push(e.findBone(t.bones[r].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(J(e,et)){var r=this.rotateMix,n=this.translateMix,a=r>0;if(n>0||a){var i=this.data,s=i.spacingMode==lt.Percent,o=i.rotateMode,l=o==ht.Tangent,h=o==ht.ChainScale,u=this.bones.length,c=l?u:u+1,d=this.bones,f=H.setArraySize(this.spaces,c),v=null,p=this.spacing;if(h||!s){h&&(v=H.setArraySize(this.lengths,u));for(var g=i.spacingMode==lt.Length,m=0,w=c-1;m<w;){var E=d[m],x=E.data.length;if(x<t.epsilon)h&&(v[m]=0),f[++m]=0;else if(s){if(h){var y=x*E.a,b=x*E.c,S=Math.sqrt(y*y+b*b);v[m]=S}f[++m]=p}else{var M=x*E.a,A=x*E.c,T=Math.sqrt(M*M+A*A);h&&(v[m]=T),f[++m]=(g?x+p:p)*T/x}}}else for(var I=1;I<c;I++)f[I]=p;var R=this.computeWorldPositions(e,c,l,i.positionMode==ot.Percent,s),C=R[0],V=R[1],k=i.offsetRotation,P=!1;if(0==k)P=o==ht.Chain;else{P=!1;var _=this.target.bone;k*=_.a*_.d-_.b*_.c>0?q.degRad:-q.degRad}for(var F=0,N=3;F<u;F++,N+=3){var O=d[F];O.worldX+=(C-O.worldX)*n,O.worldY+=(V-O.worldY)*n;var B=R[N],L=R[N+1],X=B-C,Y=L-V;if(h){var D=v[F];if(0!=D){var W=(Math.sqrt(X*X+Y*Y)/D-1)*r+1;O.a*=W,O.c*=W}}if(C=B,V=L,a){var U=O.a,G=O.b,z=O.c,j=O.d,Z=0,Q=0,K=0;if(Z=l?R[N-1]:0==f[F+1]?R[N+2]:Math.atan2(Y,X),Z-=Math.atan2(z,U),P){Q=Math.cos(Z),K=Math.sin(Z);var $=O.data.length;C+=($*(Q*U-K*z)-X)*r,V+=($*(K*U+Q*z)-Y)*r}else Z+=k;Z>q.PI?Z-=q.PI2:Z<-q.PI&&(Z+=q.PI2),Z*=r,Q=Math.cos(Z),K=Math.sin(Z),O.a=Q*U-K*z,O.b=Q*G-K*j,O.c=K*U+Q*z,O.d=K*G+Q*j}O.appliedValid=!1}}}},e.computeWorldPositions=function(e,r,n,a,i){var s=this.target,o=this.position,l=this.spaces,h=H.setArraySize(this.positions,3*r+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,v=t.NONE;if(!e.constantSpeed){var p=e.lengths,g=p[f-=c?1:2];if(a&&(o*=g),i)for(var m=1;m<r;m++)l[m]*=g;u=H.setArraySize(this.world,8);for(var w=0,E=0,x=0;w<r;w++,E+=3){var y=l[w],b=o+=y;if(c)(b%=g)<0&&(b+=g),x=0;else{if(b<0){v!=t.BEFORE&&(v=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(b,u,0,h,E);continue}if(b>g){v!=t.AFTER&&(v=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(b-g,u,0,h,E);continue}}for(;;x++){var S=p[x];if(!(b>S)){if(0==x)b/=S;else{var M=p[x-1];b=(b-M)/(S-M)}break}}x!=v&&(v=x,c&&x==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*x+2,8,u,0,2)),this.addCurvePosition(b,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,E,n||w>0&&0==y)}return h}c?(d+=2,u=H.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=H.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var A=H.setArraySize(this.curves,f),T=0,I=u[0],R=u[1],C=0,V=0,k=0,P=0,_=0,F=0,N=0,O=0,B=0,L=0,X=0,Y=0,D=0,W=0,U=0,q=2;U<f;U++,q+=6)C=u[q],V=u[q+1],k=u[q+2],P=u[q+3],X=2*(N=.1875*(I-2*C+k))+(B=.09375*(3*(C-k)-I+(_=u[q+4]))),Y=2*(O=.1875*(R-2*V+P))+(L=.09375*(3*(V-P)-R+(F=u[q+5]))),D=.75*(C-I)+N+.16666667*B,W=.75*(V-R)+O+.16666667*L,T+=Math.sqrt(D*D+W*W),D+=X,W+=Y,X+=B,Y+=L,T+=Math.sqrt(D*D+W*W),D+=X,W+=Y,T+=Math.sqrt(D*D+W*W),D+=X+B,W+=Y+L,T+=Math.sqrt(D*D+W*W),A[U]=T,I=_,R=F;if(o*=a?T:T/e.lengths[f-1],i)for(var G=1;G<r;G++)l[G]*=T;for(var z=this.segments,j=0,Z=0,Q=0,J=0,K=0;Z<r;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=A[J];if(!(tt>et)){if(0==J)tt/=et;else{var rt=A[J-1];tt=(tt-rt)/(et-rt)}break}}if(J!=v){v=J;var nt=6*J;for(I=u[nt],R=u[nt+1],C=u[nt+2],V=u[nt+3],k=u[nt+4],P=u[nt+5],X=2*(N=.03*(I-2*C+k))+(B=.006*(3*(C-k)-I+(_=u[nt+6]))),Y=2*(O=.03*(R-2*V+P))+(L=.006*(3*(V-P)-R+(F=u[nt+7]))),D=.3*(C-I)+N+.16666667*B,W=.3*(V-R)+O+.16666667*L,j=Math.sqrt(D*D+W*W),z[0]=j,nt=1;nt<8;nt++)D+=X,W+=Y,X+=B,Y+=L,j+=Math.sqrt(D*D+W*W),z[nt]=j;D+=X,W+=Y,j+=Math.sqrt(D*D+W*W),z[8]=j,D+=X+B,W+=Y+L,j+=Math.sqrt(D*D+W*W),z[9]=j,K=0}for(tt*=j;;K++){var at=z[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=z[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,I,R,C,V,k,P,_,F,h,Q,n||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,r,n,a){var i=e[r],s=e[r+1],o=e[r+2]-i,l=e[r+3]-s,h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addAfterPosition=function(t,e,r,n,a){var i=e[r+2],s=e[r+3],o=i-e[r],l=s-e[r+1],h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addCurvePosition=function(t,e,r,n,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=r,void(h[u+2]=Math.atan2(a-r,n-e));var d=t*t,f=d*t,v=1-t,p=v*v,g=p*v,m=v*t,w=3*m,E=v*w,x=w*t,y=e*g+n*E+i*x+o*f,b=r*g+a*E+s*x+l*f;h[u]=y,h[u+1]=b,c&&(h[u+2]=t<.001?Math.atan2(a-r,n-e):Math.atan2(b-(r*p+a*m*2+s*d),y-(e*p+n*m*2+i*d)))},t}();ve.NONE=-1,ve.BEFORE=-2,ve.AFTER=-3,ve.epsilon=1e-5;var pe=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 r=t.bones[e],n=void 0;if(null==r.parent)n=new ue(r,this,null);else{var a=this.bones[r.parent.index];n=new ue(r,this,a),a.children.push(n)}this.bones.push(n)}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 ce(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 de(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new fe(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var v=t.pathConstraints[f];this.pathConstraints.push(new ve(v,this))}this.color=new U(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,r=0,n=e.length;r<n;r++){var a=e[r];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,v=c.length,p=d+f+v;t:for(var g=0;g<p;g++){for(var m=0;m<d;m++){var w=h[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var E=0;E<f;E++){var x=u[E];if(x.data.order==g){this.sortTransformConstraint(x);continue t}}for(var y=0;y<v;y++){var b=c[y];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&&H.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var r=t.bones,n=r[0];if(this.sortBone(n),r.length>1){var a=r[r.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(n.children),r[r.length-1].sorted=!0}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&H.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,r=e.data.index,n=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,n),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,n);for(var a=0,i=this.data.skins.length;a<i;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,n);var s=e.getAttachment();J(s,et)&&this.sortPathConstraintAttachmentWith(s,n);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&&H.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,r=e.length;if(t.data.local)for(var n=0;n<r;n++){var a=e[n];this.sortBone(a.parent),this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}else for(var i=0;i<r;i++)this.sortBone(e[i]);this._updateCache.push(t);for(var s=0;s<r;s++)this.sortReset(e[s].children);for(var o=0;o<r;o++)e[o].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,r){var n=t.attachments[e];if(n)for(var a in n)this.sortPathConstraintAttachmentWith(n[a],r)},e.sortPathConstraintAttachmentWith=function(t,e){if(J(t,et)){var r=t.bones;if(null==r)this.sortBone(e);else for(var n=this.bones,a=0;a<r.length;)for(var i=r[a++],s=a+i;a<s;a++){var o=r[a];this.sortBone(n[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,r=t.length;e<r;e++){var n=t[e];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,r=t.length;e<r;e++){var n=t[e];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY,n.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,r=t.length;e<r;e++)t[e].setToSetupPose();for(var n=this.ikConstraints,a=0,i=n.length;a<i;a++){var s=n[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,v=d.length;f<v;f++){var p=d[f],g=p.data;p.position=g.position,p.spacing=g.spacing,p.rotateMix=g.rotateMix,p.translateMix=g.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;H.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,r=t.length;e<r;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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;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,r=0,n=e.length;r<n;r++){var a=e[r],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(r,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 r=this.skin.getAttachment(t,e);if(null!=r)return r}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 r=this.slots,n=0,a=r.length;n<a;n++){var i=r[n];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(n,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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++){var a=e[r];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,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,r){if(void 0===r&&(r=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==e)throw new Error("size cannot be null.");for(var n=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=0,h=n.length;l<h;l++){var u=n[l];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(J(f,Q))c=8,d=H.setArraySize(r,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(J(f,$)){var v=f;c=v.worldVerticesLength,d=H.setArraySize(r,c,0),v.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var p=0,g=d.length;p<g;p+=2){var m=d[p],w=d[p+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}(),ge=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 G((function(){return new Array})),this.polygonIndicesPool=new G((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var r=e,n=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<n;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,l=n;o<l;++o)s[o]=t.isConcave(o,n,r,a);var h=this.triangles;for(h.length=0;n>3;){for(var u=n-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,v=a[c]<<1,p=a[d]<<1,g=r[f],m=r[f+1],w=r[v],E=r[v+1],x=r[p],y=r[p+1],b=(d+1)%n;b!=u;b=(b+1)%n)if(s[b]){var S=a[b]<<1,M=r[S],A=r[S+1];if(t.positiveArea(x,y,g,m,M,A)&&t.positiveArea(g,m,w,E,M,A)&&t.positiveArea(w,E,x,y,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)%n}h.push(a[(n+c-1)%n]),h.push(a[c]),h.push(a[(c+1)%n]),a.splice(c,1),s.splice(c,1);var T=(--n+c-1)%n,I=c==n?0:c;s[T]=t.isConcave(T,n,r,a),s[I]=t.isConcave(I,n,r,a)}return 3==n&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.decompose=function(e,r){var n=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=r.length;u<c;u+=3){var d=r[u]<<1,f=r[u+1]<<1,v=r[u+2]<<1,p=n[d],g=n[d+1],m=n[f],w=n[f+1],E=n[v],x=n[v+1],y=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],E,x),M=t.winding(E,x,o[0],o[1],o[2],o[3]);S==h&&M==h&&(o.push(E),o.push(x),s.push(v),y=!0)}y||(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(p),o.push(g),o.push(m),o.push(w),o.push(E),o.push(x),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(v),h=t.winding(p,g,m,w,E,x),l=d)}o.length>0&&(a.push(o),i.push(s));for(var A=0,T=a.length;A<T;A++)if(0!=(s=i[A]).length)for(var I=s[0],R=s[s.length-1],C=(o=a[A]).length-4,V=o[C],k=o[C+1],P=o[C+2],_=o[C+3],F=o[0],N=o[1],O=o[2],B=o[3],L=t.winding(V,k,P,_,F,N),X=0;X<T;X++)if(X!=A){var Y=i[X];if(3==Y.length){var D=Y[0],W=Y[1],U=Y[2],q=a[X],H=q[q.length-2],G=q[q.length-1];if(D==I&&W==R){var z=t.winding(V,k,P,_,H,G),j=t.winding(H,G,F,N,O,B);z==L&&j==L&&(q.length=0,Y.length=0,o.push(H),o.push(G),s.push(U),V=P,k=_,P=H,_=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,r,n){var a=n[(e+t-1)%e]<<1,i=n[t]<<1,s=n[(t+1)%e]<<1;return!this.positiveArea(r[a],r[a+1],r[i],r[i+1],r[s],r[s+1])},t.positiveArea=function(t,e,r,n,a,i){return t*(i-n)+r*(e-i)+a*(n-e)>=0},t.winding=function(t,e,r,n,a,i){var s=r-t,o=n-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),me=function(){function t(){this.triangulator=new ge,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,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var n=r.worldVerticesLength,a=H.setArraySize(this.clippingPolygon,n);r.computeWorldVertices(e,0,n,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,r,n,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,v=0;h.length=0,u.length=0;t:for(var p=0;p<n;p+=3)for(var g=r[p]<<1,m=t[g],w=t[g+1],E=a[g],x=a[g+1],y=t[g=r[p+1]<<1],b=t[g+1],S=a[g],M=a[g+1],A=t[g=r[p+2]<<1],T=t[g+1],I=a[g],R=a[g+1],C=0;C<d;C++){var V=h.length;if(!this.clip(m,w,y,b,A,T,c[C],l)){var k=H.setArraySize(h,V+3*f);k[V]=m,k[V+1]=w,k[V+2]=i.r,k[V+3]=i.g,k[V+4]=i.b,k[V+5]=i.a,o?(k[V+6]=E,k[V+7]=x,k[V+8]=s.r,k[V+9]=s.g,k[V+10]=s.b,k[V+11]=s.a,k[V+12]=y,k[V+13]=b,k[V+14]=i.r,k[V+15]=i.g,k[V+16]=i.b,k[V+17]=i.a,k[V+18]=S,k[V+19]=M,k[V+20]=s.r,k[V+21]=s.g,k[V+22]=s.b,k[V+23]=s.a,k[V+24]=A,k[V+25]=T,k[V+26]=i.r,k[V+27]=i.g,k[V+28]=i.b,k[V+29]=i.a,k[V+30]=I,k[V+31]=R,k[V+32]=s.r,k[V+33]=s.g,k[V+34]=s.b,k[V+35]=s.a):(k[V+6]=E,k[V+7]=x,k[V+8]=y,k[V+9]=b,k[V+10]=i.r,k[V+11]=i.g,k[V+12]=i.b,k[V+13]=i.a,k[V+14]=S,k[V+15]=M,k[V+16]=A,k[V+17]=T,k[V+18]=i.r,k[V+19]=i.g,k[V+20]=i.b,k[V+21]=i.a,k[V+22]=I,k[V+23]=R),V=u.length;var P=H.setArraySize(u,V+3);P[V]=v,P[V+1]=v+1,P[V+2]=v+2,v+=3;continue t}var _=l.length;if(0!=_){for(var F=b-T,N=A-y,O=m-A,B=T-w,L=1/(F*O+N*(w-T)),X=_>>1,Y=this.clipOutput,D=H.setArraySize(h,V+X*f),W=0;W<_;W+=2){var U=Y[W],q=Y[W+1];D[V]=U,D[V+1]=q,D[V+2]=i.r,D[V+3]=i.g,D[V+4]=i.b,D[V+5]=i.a;var G=U-A,z=q-T,j=(F*G+N*z)*L,Z=(B*G+O*z)*L,Q=1-j-Z;D[V+6]=E*j+S*Z+I*Q,D[V+7]=x*j+M*Z+R*Q,o&&(D[V+8]=s.r,D[V+9]=s.g,D[V+10]=s.b,D[V+11]=s.a),V+=f}V=u.length;var J=H.setArraySize(u,V+3*(X-2));X--;for(var K=1;K<X;K++)J[V]=v,J[V+1]=v+K,J[V+2]=v+K+1,V+=3;v+=X+1}}},e.clip=function(t,e,r,n,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(r),u.push(n),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 v=c[f],p=c[f+1],g=c[f+2],m=c[f+3],w=v-g,E=p-m,x=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var M=x[S],A=x[S+1],T=x[S+2],I=x[S+3],R=w*(I-m)-E*(T-g)>0;if(w*(A-m)-E*(M-g)>0){if(R){o.push(T),o.push(I);continue}var C=I-A,V=T-M,k=C*(g-v)-V*(m-p);if(Math.abs(k)>1e-6){var P=(V*(p-A)-C*(v-M))/k;o.push(v+(g-v)*P),o.push(p+(m-p)*P)}else o.push(v),o.push(p)}else if(R){var _=I-A,F=T-M,N=_*(g-v)-F*(m-p);if(Math.abs(N)>1e-6){var O=(F*(p-A)-_*(v-M))/N;o.push(v+(g-v)*O),o.push(p+(m-p)*O)}else o.push(v),o.push(p);o.push(T),o.push(I)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var B=o;(o=u).length=0,u=B}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,r=t.length,n=e[r-2]*e[1]-e[0]*e[r-1],a=0,i=0,s=0,o=0,l=r-3;o<l;o+=2)a=e[o],i=e[o+1],s=e[o+2],n+=a*e[o+3]-s*i;if(!(n<0))for(var h=0,u=r-2,c=r>>1;h<c;h+=2){var d=e[h],f=e[h+1],v=u-h;e[h]=e[v],e[h+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),we=function(){function t(){}var e=t.prototype;return e.initialize=function(t,e){var r=this._mesh=new o(t),n=[new l("POSITION",0,h.Vector3,0),new l("COLOR_0",12,h.Vector4,0),new l("TEXCOORD_0",28,h.Vector2,0)],a=4*Ee.VERTEX_STRIDE,i=a*e,s=new u(t,c.VertexBuffer,i,d.Dynamic),v=new u(t,c.IndexBuffer,2*e,d.Dynamic);this._indexBuffer=v,this._vertexBuffer=s,r.setVertexBufferBinding(s,a),r.setIndexBufferBinding(v,f.UInt16),r.setVertexElements(n),r.addSubMesh(0,e)},e.changeBuffer=function(t,e){var r=4*Ee.VERTEX_STRIDE,n=r*e,a=new u(t,c.VertexBuffer,n,d.Dynamic),i=new u(t,c.IndexBuffer,2*e,d.Dynamic),s=this._mesh;this._indexBuffer=i,this._vertexBuffer=a,s.setVertexBufferBinding(a,r),s.setIndexBufferBinding(i,f.UInt16)},le(t,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),t}(),Ee=function(){function t(t,e){this._clipper=new me,this._spineMesh=new we,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this.separateSlotTextureMap=new Map,this._engine=t,this._entity=e}var e=t.prototype;return e.initialize=function(e,r){if(e){var n=this._entity.getComponent(v);if(n){this._meshRenderer=n,r&&(this._setting=r);for(var a=e.defaultSkin.attachments,i=0,s=t.QUAD_TRIANGLES.length,o=0,l=a.length;o<l;o++){var h=a[o];for(var u in h){var c=h[u];if(c)if(J(c,Q))i+=s;else{if(!J(c,$))continue;i+=c.triangles.length}}}this._vertexCount=i,this._prepareBufferData(this._vertexCount);var d=this._spineMesh;d.initialize(this._engine,this._vertexCount),n.mesh=d.mesh}else console.warn("You need add MeshRenderer component to entity first")}},e.buildMesh=function(e){var r=this._setting||{},n=r.useClipping,a=void 0===n||n,i=r.zSpacing,s=void 0===i?.01:i,o=0,l=0,h=e.drawOrder,u=h.length,c=this._clipper,d=this._spineMesh,f=d.mesh,v=this._subMeshItems;v.length=0;var g,m,w=this._vertices,E=0,x=0,y=Bt.Normal,b=null;t.tempBlendMode=null,t.tempTexture=null;for(var S=0;S<u;++S){var M=h[S];if(M.bone.active){var A=M.getAttachment(),T=null,I=s*S,R=0,C=c.isClipping()?2:t.VERTEX_SIZE;if(J(A,Q)){var V=A;T=V.color,w=this._vertices,R=4*C,V.computeWorldVertices(M.bone,w,0,C),g=t.QUAD_TRIANGLES,m=V.uvs,b=V.region.renderObject.texture,4}else if(J(A,$)){var k=A;T=k.color,w=this._vertices,(R=(k.worldVerticesLength>>1)*C)>w.length&&(w=this._vertices=new Float32Array(R)),k.computeWorldVertices(M,0,k.worldVerticesLength,w,0,C),g=k.triangles,m=k.uvs,b=k.region.renderObject.texture,k.worldVerticesLength>>1}else if(J(A,nt)){if(a){var P=A;c.clipStart(M,P);continue}}else if(a){c.clipEndWithSlot(M);continue}if(null!=b){var _=void 0,F=void 0,N=void 0,O=void 0,B=M.bone.skeleton.color,L=M.color,X=B.a*L.a*T.a,Y=t.tempColor;if(Y.set(B.r*L.r*T.r,B.g*L.g*T.g,B.b*L.b*T.b,X),c.isClipping()){c.clipTriangles(w,R,g,g.length,m,Y,null,!1);var D=c.clippedVertices,W=c.clippedTriangles;_=D,F=D.length,N=W,O=W.length}else{for(var U=w,q=2,H=0,G=R;q<G;q+=C,H+=2)U[q]=Y.r,U[q+1]=Y.g,U[q+2]=Y.b,U[q+3]=Y.a,U[q+4]=m[H],U[q+5]=m[H+1];_=w,F=R,N=g,O=g.length}for(var z=o/t.VERTEX_STRIDE,j=this._verticesWithZ,Z=o,K=0;K<F;)j[Z++]=_[K++],j[Z++]=_[K++],j[Z++]=I,j[Z++]=_[K++],j[Z++]=_[K++],j[Z++]=_[K++],j[Z++]=_[K++],j[Z++]=_[K++],j[Z++]=_[K++];o=Z;var tt=this._indices;for(Z=l,K=0;K<O;Z++,K++)tt[Z]=N[K]+z;l+=O;var et=M.data.name;y=M.data.blendMode;var rt=null!==t.tempBlendMode&&t.tempBlendMode!==M.data.blendMode,at=null!==t.tempTexture&&t.tempTexture!==b,it=this.separateSlots.includes(et);if(it||rt||at){if(x>0){var st=new p(E,x);v.push({subMesh:st,texture:t.tempTexture,blendMode:t.tempBlendMode}),E+=x,x=0}if(it){var ot=this.separateSlotTextureMap.get(et);if(ot){var lt=b.texture;ot.filterMode=lt.filterMode,ot.wrapModeU=lt.wrapModeU,ot.wrapModeV=lt.wrapModeV}var ht=new p(E,O);v.push({blendMode:y,subMesh:ht,texture:b,slotName:et}),E+=O,x=0}else x+=O}else x+=O;t.tempBlendMode=y,t.tempTexture=b}c.clipEndWithSlot(M)}else c.clipEndWithSlot(M)}if(x>0){var ut=new p(E,x);v.push({blendMode:y,subMesh:ut,texture:b}),x=0}if(c.clipEnd(),v.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),l>0&&l!==this._vertexCount&&l>this._vertexCount)return this._vertexCount=l,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);f.clearSubMesh();for(var ct=this._meshRenderer,dt=0,ft=v.length;dt<ft;++dt){var vt=v[dt],pt=vt.slotName,gt=vt.blendMode,mt=vt.texture;f.addSubMesh(vt.subMesh);var wt=ct.getMaterial(dt);wt||(wt=ye.getDefaultMaterial(this._engine));var Et=mt.texture;this.separateSlotTextureMap.has(pt)&&(Et=this.separateSlotTextureMap.get(pt)),wt.shaderData.setTexture("material_SpineTexture",Et),wt._priority=dt,this.setBlendMode(wt,gt),ct.setMaterial(dt,wt)}this._needResize&&(d.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),d.vertexBuffer.setData(this._verticesWithZ),d.indexBuffer.setData(this._indices)},e.addSeparateSlot=function(t){this.separateSlots.push(t)},e.addSeparateSlotTexture=function(t,e){this.separateSlotTextureMap.set(t,e)},e._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},e.setBlendMode=function(t,e){var r=t.renderState.blendState.targetBlendState;switch(e){case Bt.Additive:r.sourceColorBlendFactor=g.SourceAlpha,r.destinationColorBlendFactor=g.One,r.sourceAlphaBlendFactor=g.One,r.destinationAlphaBlendFactor=g.One,r.colorBlendOperation=r.alphaBlendOperation=m.Add;break;case Bt.Multiply:r.sourceColorBlendFactor=g.DestinationColor,r.destinationColorBlendFactor=g.Zero,r.sourceAlphaBlendFactor=g.One,r.destinationAlphaBlendFactor=g.Zero,r.colorBlendOperation=r.alphaBlendOperation=m.Add;break;case Bt.Screen:r.sourceColorBlendFactor=g.One,r.destinationColorBlendFactor=g.OneMinusSourceColor,r.sourceAlphaBlendFactor=g.One,r.destinationAlphaBlendFactor=g.OneMinusSourceColor,r.colorBlendOperation=r.alphaBlendOperation=m.Add;break;default:r.sourceColorBlendFactor=g.SourceAlpha,r.destinationColorBlendFactor=g.OneMinusSourceAlpha,r.sourceAlphaBlendFactor=g.One,r.destinationAlphaBlendFactor=g.OneMinusSourceAlpha,r.colorBlendOperation=r.alphaBlendOperation=m.Add}},le(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();Ee.QUAD_TRIANGLES=[0,1,2,2,3,0],Ee.VERTEX_SIZE=8,Ee.VERTEX_STRIDE=9,Ee.tempColor=new U,Ee.tempBlendMode=null,Ee.tempTexture=null;var xe=function(t){function e(r){var n,a=w.find("galacean-spine-shader")||w.create("galacean-spine-shader",e._spineVS,e._spineFS),i=(n=t.call(this,r,a)||this).renderState,s=i.blendState.targetBlendState;return s.enabled=!0,s.sourceColorBlendFactor=g.SourceAlpha,s.destinationColorBlendFactor=g.OneMinusSourceAlpha,s.sourceAlphaBlendFactor=g.One,s.destinationAlphaBlendFactor=g.OneMinusSourceAlpha,s.colorBlendOperation=s.alphaBlendOperation=m.Add,i.depthState.writeEnabled=!1,i.rasterState.cullMode=E.Off,i.renderQueueType=x.Transparent,n}return T(e,t),e}(y);xe._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 ",xe._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 ye=function(t){function e(e){var r;return(r=t.call(this,e)||this)._tempOffset=new z,r._tempSize=new z,r._tempArray=[0,0],r.autoUpdateBounds=!1,r._meshGenerator=new Ee(r.engine,e),r}T(e,t);var r=e.prototype;return r.initialize=function(t,e){this.setting=e,this._skeletonData=t,this._skeleton=new pe(t),this._meshGenerator.initialize(this._skeletonData,this.setting)},r.addSeparateSlot=function(t){this._skeleton||console.error("Skeleton not found!"),this.entity.getComponent(v)||console.warn("You need add MeshRenderer component to entity first"),this._skeleton.findSlot(t)?this._meshGenerator.addSeparateSlot(t):console.warn("Slot: "+t+" not find.")},r.hackSeparateSlotTexture=function(t,e){var r=this._meshGenerator.separateSlots;0!==r.length?r.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")},r.onLateUpdate=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},r.updateBounds=function(){var t,e=this.entity.getComponent(v).bounds,r=this._tempOffset,n=this._tempSize,a=this._tempArray,i=(null==(t=this.setting)?void 0:t.zSpacing)||.01,s=this._skeleton;s.getBounds(r,n,a);var o=s.drawOrder,l=r.x,h=r.x+n.x,u=r.y,c=r.y+n.y,d=o.length*i;e.min.set(l,u,0),e.max.set(h,c,d),b.transform(e,this.entity.transform.worldMatrix,e)},r._cloneTo=function(t){t.initialize(this._skeletonData);var e=he({},this.setting);t.setting=e},r._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null},r.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},e.getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new xe(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},le(e,[{key:"skeleton",get:function(){return this._skeleton}}]),e}(M);I([S],ye.prototype,"_skeletonData",void 0),I([S],ye.prototype,"_skeleton",void 0),I([S],ye.prototype,"_tempOffset",void 0),I([S],ye.prototype,"_tempSize",void 0),I([S],ye.prototype,"_tempArray",void 0),I([S],ye.prototype,"_meshGenerator",void 0),I([S],ye.prototype,"setting",void 0);var be=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 Ae(this),this.propertyIDs=new W,this.animationsChanged=!1,this.trackEntryPool=new G((function(){return new Me})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,r=0,n=e.length;r<n;r++){var a=e[r];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(r,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[r]=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 r=t.mixingFrom;if(null==r)return!0;var n=this.updateMixingFrom(r,e);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=r.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=r.mixingFrom,null!=r.mixingFrom&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),n):(r.trackTime+=e*r.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 r=this.events,n=this.tracks,a=!1,i=0,s=n.length;i<s;i++){var o=n[i];if(!(null==o||o.delay>0)){a=!0;var l=0==i?pt.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==pt.add)for(var v=0;v<d;v++){H.webkit602BugfixHelper(h,l);var p=f[v];J(p,Ct)?this.applyAttachmentTimeline(p,e,c,l,!0):p.apply(e,u,c,r,h,l,gt.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&H.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,E=0;E<d;E++){var x=f[E],y=g[E]==t.SUBSEQUENT?l:pt.setup;J(x,St)?this.applyRotateTimeline(x,e,c,h,y,w,E<<1,m):J(x,Ct)?this.applyAttachmentTimeline(x,e,c,l,!0):(H.webkit602BugfixHelper(h,l),x.apply(e,u,c,r,h,y,gt.mixIn))}}this.queueEvents(o,c),r.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var b=this.unkeyedState+t.SETUP,S=e.slots,M=0,A=e.slots.length;M<A;M++){var T=S[M];if(T.attachmentState==b){var I=T.data.attachmentName;T.attachment=null==I?null:e.getAttachment(T.data.index,I)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,r,n){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,r,n);var i=0;0==e.mixDuration?(i=1,n==pt.first&&(n=pt.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),n!=pt.first&&(n=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,v=f*(1-i);if(n==pt.add)for(var p=0;p<c;p++)d[p].apply(r,h,u,s,v,n,gt.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&H.setArraySize(a.timelinesRotation,c<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var x=0;x<c;x++){var y=d[x],b=gt.mixOut,S=void 0,M=0;switch(g[x]){case t.SUBSEQUENT:if(!l&&J(y,_t))continue;S=n,M=v;break;case t.FIRST:S=pt.setup,M=v;break;case t.HOLD_SUBSEQUENT:S=n,M=f;break;case t.HOLD_FIRST:S=pt.setup,M=f;break;default:S=pt.setup;var A=m[x];M=f*Math.max(0,1-A.mixTime/A.mixDuration)}a.totalAlpha+=M,J(y,St)?this.applyRotateTimeline(y,r,u,M,S,E,x<<1,w):J(y,Ct)?this.applyAttachmentTimeline(y,r,u,S,o):(H.webkit602BugfixHelper(M,n),l&&J(y,_t)&&S==pt.setup&&(b=gt.mixIn),y.apply(r,h,u,s,M,S,b))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,r,n,a,i){var s=r.slots[e.slotIndex];if(s.bone.active){var o,l=e.frames;if(n<l[0])a!=pt.setup&&a!=pt.first||this.setAttachment(r,s,s.data.attachmentName,i);else o=n>=l[l.length-1]?l.length-1:yt.binarySearch(l,n)-1,this.setAttachment(r,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,r,n,a){r.attachment=null==n?null:e.getAttachment(r.data.index,n),a&&(r.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,r,n,a,i,s,o){if(o&&(i[s]=0),1!=n){var l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var c=0,d=0;if(r<h[0])switch(a){case pt.setup:u.rotation=u.data.rotation;default:return;case pt.first:c=u.rotation,d=u.data.rotation}else if(c=a==pt.setup?u.data.rotation:u.rotation,r>=h[h.length-St.ENTRIES])d=u.data.rotation+h[h.length+St.PREV_ROTATION];else{var f=yt.binarySearch(h,r,St.ENTRIES),v=h[f+St.PREV_ROTATION],p=h[f],g=l.getCurvePercent((f>>1)-1,1-(r-p)/(h[f+St.PREV_TIME]-p));d=h[f+St.ROTATION]-v,d=v+(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 E=0,x=0;o?(E=0,x=w):(E=i[s],x=i[s+1]);var y=w>0,b=E>=0;q.signum(x)!=q.signum(w)&&Math.abs(x)<=90&&(Math.abs(E)>180&&(E+=360*q.signum(E)),b=y),m=w+E-E%360,b!=y&&(m+=360*q.signum(E)),i[s]=m}i[s+1]=w,c+=m*n,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,r,null,1,a,gt.mixIn)},e.queueEvents=function(t,e){for(var r=t.animationStart,n=t.animationEnd,a=n-r,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>n||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=n&&t.animationLast<n)&&this.queue.complete(t);o<l;o++){s[o].time<r||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,r=this.tracks.length;e<r;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 r=e;;){var n=r.mixingFrom;if(null==n)break;this.queue.end(n),r.mixingFrom=null,r.mixingTo=null,r=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,r){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(r&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,r){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,r)},e.setAnimationWith=function(t,e,r){if(null==e)throw new Error("animation cannot be null.");var n=!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,n=!1):this.disposeNext(a));var i=this.trackEntry(t,e,r,a);return this.setCurrent(t,i,n),this.queue.drain(),i},e.addAnimation=function(t,e,r,n){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,r,n)},e.addAnimationWith=function(t,e,r,n){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,r,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,n<=0){var s=a.animationEnd-a.animationStart;0!=s?(a.loop?n+=s*(1+(a.trackTime/s|0)):n+=Math.max(s,a.trackTime),n-=this.data.getMix(a.animation,e)):n=a.trackTime}return i.delay=n,i},e.setEmptyAnimation=function(e,r){var n=this.setAnimationWith(e,t.emptyAnimation,!1);return n.mixDuration=r,n.trackEnd=r,n},e.addEmptyAnimation=function(e,r,n){n<=0&&(n-=r);var a=this.addAnimationWith(e,t.emptyAnimation,!1,n);return a.mixDuration=r,a.trackEnd=r,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var r=0,n=this.tracks.length;r<n;r++){var a=this.tracks[r];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]:(H.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,r,n){var a=this.trackEntryPool.obtain();return a.trackIndex=t,a.animation=e,a.loop=r,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==n?0:this.data.getMix(n.animation,e),a.mixBlend=pt.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 r=this.tracks[t];if(null!=r){for(;null!=r.mixingFrom;)r=r.mixingFrom;do{null!=r.mixingFrom&&r.mixBlend==pt.add||this.computeHold(r),r=r.mixingTo}while(null!=r)}}},e.computeHold=function(e){var r=e.mixingTo,n=e.animation.timelines,a=e.animation.timelines.length,i=H.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=H.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=r&&r.holdPrevious)for(var l=0;l<a;l++)i[l]=o.add(n[l].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var h=0;h<a;h++){var u=n[h],c=u.getPropertyId();if(o.add(c))if(null==r||J(u,Ct)||J(u,_t)||J(u,Pt)||!r.animation.hasTimeline(c))i[h]=t.FIRST;else{for(var d=r.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}();be.emptyAnimation=new yt("<empty>",[],0),be.SUBSEQUENT=0,be.FIRST=1,be.HOLD_SUBSEQUENT=2,be.HOLD_FIRST=3,be.HOLD_MIX=4,be.SETUP=1,be.CURRENT=2;var Se,Me=function(){function t(){this.mixBlend=pt.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}(),Ae=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,r=0;r<t.length;r+=2){var n=t[r],a=t[r+1];switch(n){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+r++];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"}(Se||(Se={}));var Te=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,r){var n=this.skeletonData.findAnimation(t);if(null==n)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(n,a,r)},e.setMixWith=function(t,e,r){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");var n=t.name+"."+e.name;this.animationToMixTime[n]=r},e.getMix=function(t,e){var r=t.name+"."+e.name,n=this.animationToMixTime[r];return void 0===n?this.defaultMix:n},t}(),Ie=function(t){function e(e){return t.call(this,e)}T(e,t);var r=e.prototype;return r.initialize=function(e){t.prototype.initialize.call(this,e);var r=new Te(e);this._state=new be(r)},r.onUpdate=function(t){if(this._skeleton&&this.state){var e=this._state,r=this._skeleton;e.update(t),e.apply(r),r.updateWorldTransform()}},le(e,[{key:"state",get:function(){return this._state}}]),e}(ye);I([S],Ie.prototype,"_state",void 0);var Re=function(){function t(t,e,r){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this._engine=t,this.pathPrefix=e||"",this.textureLoader=r}var e=t.prototype;return e.downloadText=function(t,e,r){a(t,{type:"text"}).then((function(t){e(t)})).catch((function(t){r(t)}))},e.downloadBinary=function(t,e,r){var n=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status?e(new Uint8Array(n.response)):r(n.status,n.responseText)},n.onerror=function(){r(n.status,n.responseText)},n.send()},e.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},e.loadBinary=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null),t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e,a){n.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,r&&r("Couldn't load binary "+t+": status "+status+", "+a),n.onLoad(),n.loaded++}))},e.loadText=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null),t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e){n.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),r&&r("Couldn't load text "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},e.loadImage=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null);var a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(r){n.assets[a]=i,n.onLoad(),n.loaded++,e&&e(t,i)},i.onerror=function(e){n.errors[t]="Couldn't load image "+t,n.onLoad(),n.loaded++,r&&r("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},e.loadTexture=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null);var i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),a(t,{type:"image"}).then((function(r){var a=n.textureLoader(r);n.assets[i]=a,n.onLoad(),n.loaded++,e&&e(t,a)})).catch((function(t){r(t)}))},e.loadEngineTexture=function(t,e,r,n){var a=this;void 0===r&&(r=null),void 0===n&&(n=null);var 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 n=a.textureLoader(e);a.assets[i]=n,a.onLoad(),a.loaded++,r&&r(t,n)})).catch((function(t){n(t)}))},e.loadTextureAtlas=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null);var a=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(i){var s=function(){var s=u.value,h=!1;n.loadTexture(s,(function(s,u){if(o.count++,o.count==l.length)if(h)n.errors[t]="Couldn't load texture atlas page "+s+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+s+" of atlas "+t),n.onLoad(),n.loaded++;else try{var c=new L(i,(function(t){return n.get(""==a?t:a+"/"+t)}));n.assets[t]=c,e&&e(t,c),n.onLoad(),n.loaded++}catch(e){var d=e;n.errors[t]="Couldn't load texture atlas "+t+": "+d.message,r&&r("Couldn't load texture atlas "+t+": "+d.message),n.onLoad(),n.loaded++}}),(function(e){h=!0,o.count++,o.count==l.length&&(n.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),n.onLoad(),n.loaded++)}))},o={count:0},l=new Array;try{new L(i,(function(t){return l.push(""==a?t:a+"/"+t),new B(new Image)}))}catch(e){var h=e;return n.errors[t]="Couldn't load texture atlas "+t+": "+h.message,r&&r("Couldn't load texture atlas "+t+": "+h.message),n.onLoad(),void n.loaded++}for(var u,c=P(l);!(u=c()).done;)s()}),(function(e){n.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),r&&r("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},e.get=function(t){return t=this.pathPrefix+t,this.assets[t]},e.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},e.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},e.isLoadingComplete=function(){return 0==this.toLoad},e.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},e.getToLoad=function(){return this.toLoad},e.getLoaded=function(){return this.loaded},e.dispose=function(){this.removeAll()},e.hasErrors=function(){return Object.keys(this.errors).length>0},e.getErrors=function(){return this.errors},le(t,[{key:"engine",get:function(){return this._engine}}]),t}(),Ce="2.0.0";console.log("Galacean spine version: "+Ce);export{Re as AssetManager,at as AtlasAttachmentLoader,qt as SkeletonBinary,it as SkeletonData,Wt as SkeletonJson,Ie as SpineAnimation,ye as SpineRenderer,N as Texture,L as TextureAtlas,te as generateTextureAtlas,Ce as version};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|