@galacean/engine-spine 1.1.0-beta.10 → 1.1.0-beta.12

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/dist/browser.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.Spine={}),t.Galacean)}(this,(function(t,e){"use strict";function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function a(t,e,n,r){var a,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function i(t,e){(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 s(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 i(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)?i(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 o,h,l=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"}(o||(o={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(h||(h={}));var u=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},c=function(t){function e(){return t.apply(this,arguments)}r(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(l),d=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 f(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 p;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 u=parseInt(r[0]),c=parseInt(r[1]);n.readTuple(r);var d=parseInt(r[0]),g=parseInt(r[1]);s.u=u/a.width,s.v=c/a.height,s.rotate?(s.u2=(u+g)/a.width,s.v2=(c+d)/a.height):(s.u2=(u+d)/a.width,s.v2=(c+g)/a.height),s.x=u,s.y=c,s.width=Math.abs(d),s.height=Math.abs(g),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 v).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=l.filterFromString(r[0]),a.magFilter=l.filterFromString(r[1]);var m=n.readValue();a.uWrap=h.ClampToEdge,a.vWrap=h.ClampToEdge,"x"==m?a.uWrap=h.Repeat:"y"==m?a.vWrap=h.Repeat:"xy"==m&&(a.uWrap=a.vWrap=h.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}(),f=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}(),v=function(){},p=function(t){function e(){return t.apply(this,arguments)}return r(e,t),e}(u),g=function(){function t(t,e){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this.pathPrefix=t||"",this.textureLoader=e}var n=t.prototype;return n.downloadText=function(t,n,r){e.request(t,{type:"text"}).then((function(t){n(t)})).catch((function(t){r(t)}))},n.downloadBinary=function(t,e,n){var r=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status?e(new Uint8Array(r.response)):n(r.status,r.responseText)},r.onerror=function(){n(r.status,r.responseText)},r.send()},n.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},n.loadBinary=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e,a){r.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,n&&n("Couldn't load binary "+t+": status "+status+", "+a),r.onLoad(),r.loaded++}))},n.loadText=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e){r.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),n&&n("Couldn't load text "+t+": "+JSON.stringify(e)),r.onLoad(),r.loaded++}))},n.loadImage=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this,a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(n){r.assets[a]=i,r.onLoad(),r.loaded++,e&&e(t,i)},i.onerror=function(e){r.errors[t]="Couldn't load image "+t,r.onLoad(),r.loaded++,n&&n("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},n.loadTexture=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),e.request(t,{type:"image"}).then((function(e){var r=a.textureLoader(e);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(t,r)})).catch((function(t){r(t)}))},n.loadTextureAtlas=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this,a=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(i){var o=function(){var s=f.value,o=!1;r.loadTexture(s,(function(s,u){if(h.count++,h.count==l.length)if(o)r.errors[t]="Couldn't load texture atlas page "+s+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+s+" of atlas "+t),r.onLoad(),r.loaded++;else try{var c=new d(i,(function(t){return r.get(""==a?t:a+"/"+t)}));r.assets[t]=c,e&&e(t,c),r.onLoad(),r.loaded++}catch(e){var f=e;r.errors[t]="Couldn't load texture atlas "+t+": "+f.message,n&&n("Couldn't load texture atlas "+t+": "+f.message),r.onLoad(),r.loaded++}}),(function(e){o=!0,h.count++,h.count==l.length&&(r.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+e+" of atlas "+t),r.onLoad(),r.loaded++)}))},h={count:0},l=new Array;try{new d(i,(function(t){l.push(""==a?t:a+"/"+t);var e=document.createElement("img");return e.width=16,e.height=16,new c(e)}))}catch(e){var u=e;return r.errors[t]="Couldn't load texture atlas "+t+": "+u.message,n&&n("Couldn't load texture atlas "+t+": "+u.message),r.onLoad(),void r.loaded++}for(var f,v=s(l);!(f=v()).done;)o()}),(function(e){r.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),n&&n("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),r.onLoad(),r.loaded++}))},n.get=function(t){return t=this.pathPrefix+t,this.assets[t]},n.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},n.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},n.isLoadingComplete=function(){return 0==this.toLoad},n.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},n.getToLoad=function(){return this.toLoad},n.getLoaded=function(){return this.loaded},n.dispose=function(){this.removeAll()},n.hasErrors=function(){return Object.keys(this.errors).length>0},n.getErrors=function(){return this.errors},t}();var m=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}(),w=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}();w.WHITE=new w(1,1,1,1),w.RED=new w(1,0,0,1),w.GREEN=new w(0,1,0,1),w.BLUE=new w(0,0,1,1),w.MAGENTA=new w(1,0,1,1);var E=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}();E.PI=3.1415927,E.PI2=2*E.PI,E.radiansToDegrees=180/E.PI,E.radDeg=E.radiansToDegrees,E.degreesToRadians=E.PI/180,E.degRad=E.degreesToRadians;var x=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}();x.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var y=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}(),b=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}(),S=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},M=function(t){function e(n){var r;return(r=t.call(this,n)||this).id=(65535&e.nextID++)<<11,r.worldVerticesLength=0,r.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r),r}r(e,t);var n=e.prototype;return n.computeWorldVertices=function(t,e,n,r,a,i){n=a+(n>>1)*i;var s=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,d=0;d<e;d+=2){var f=l[u];u+=f+1,c+=f}var v=s.bones;if(0==o.length)for(var p=a,g=3*c;p<n;p+=i){var m=0,w=0,E=l[u++];for(E+=u;u<E;u++,g+=3){var x=v[l[u]],y=h[g],b=h[g+1],S=h[g+2];m+=(y*x.a+b*x.b+x.worldX)*S,w+=(y*x.c+b*x.d+x.worldY)*S}r[p]=m,r[p+1]=w}else for(var M=o,A=a,R=3*c,I=c<<1;A<n;A+=i){var T=0,C=0,_=l[u++];for(_+=u;u<_;u++,R+=3,I+=2){var k=v[l[u]],V=h[R]+M[I],P=h[R+1]+M[I+1],F=h[R+2];T+=(V*k.a+P*k.b+k.worldX)*F,C+=(V*k.c+P*k.d+k.worldY)*F}r[A]=T,r[A+1]=C}}else{o.length>0&&(h=o);for(var N=t.bone,O=N.worldX,B=N.worldY,L=N.a,X=N.b,Y=N.c,D=N.d,U=e,W=a;W<n;U+=2,W+=i){var q=h[U],H=h[U+1];r[W]=q*L+H*X+O,r[W+1]=q*Y+H*D+B}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),x.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=x.newFloatArray(this.vertices.length),x.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(S);M.nextID=0;var A=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 w(1,1,1,1),n.offset=x.newFloatArray(8),n.uvs=x.newFloatArray(8),n.tempColor=new w(1,1,1,1),n}r(e,t);var n=e.prototype;return n.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*n,i=r+this.region.width*t,s=a+this.region.height*n,o=this.rotation*Math.PI/180,h=Math.cos(o),l=Math.sin(o),u=r*h+this.x,c=r*l,d=a*h+this.y,f=a*l,v=i*h+this.x,p=i*l,g=s*h+this.y,m=s*l,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},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,h=t.a,l=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX2],f=i[e.OY2],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX3],f=i[e.OY3],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX4],f=i[e.OY4],n[r]=d*h+f*l+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,x.arrayCopy(this.uvs,0,t.uvs,0,8),x.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(S);function R(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}A.OX1=0,A.OY1=1,A.OX2=2,A.OY2=3,A.OX3=4,A.OY3=5,A.OX4=6,A.OY4=7,A.X1=0,A.Y1=1,A.C1R=2,A.C1G=3,A.C1B=4,A.C1A=5,A.U1=6,A.V1=7,A.X2=8,A.Y2=9,A.C2R=10,A.C2G=11,A.C2B=12,A.C2A=13,A.U2=14,A.V2=15,A.X3=16,A.Y3=17,A.C3R=18,A.C3G=19,A.C3B=20,A.C3A=21,A.U3=22,A.V3=23,A.X4=24,A.Y4=25,A.C4R=26,A.C4G=27,A.C4B=28,A.C4A=29,A.U4=30,A.V4=31;var I,T=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(1,1,1,1),n.tempColor=new w(0,0,0,0),n}r(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=x.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(R(this.region,p)){var o=this.region,h=o.texture.getImage().width,l=o.texture.getImage().height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/l,i=o.originalHeight/h,s=o.originalWidth/l;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)/h,a-=o.offsetY/l,i=o.originalWidth/h,s=o.originalHeight/l;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/h,a-=o.offsetX/l,i=o.originalHeight/h,s=o.originalWidth/l;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/h,a-=(o.originalHeight-o.offsetY-o.height)/l,i=o.originalWidth/h,s=o.originalHeight/l}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),x.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),x.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),x.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),x.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}(M),C=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(M),_=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new w(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),x.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(M),k=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(.38,.94,0,1),n.name=e,n}r(e,t);var n=e.prototype;return n.computeWorldPosition=function(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e},n.computeWorldRotation=function(t){var e=E.cosDeg(this.rotation),n=E.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*E.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}(M),V=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(.2275,.2275,.8078,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(M),P=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 A(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 T(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new C(e)},e.newPathAttachment=function(t,e){return new _(e)},e.newPointAttachment=function(t,e){return new k(e)},e.newClippingAttachment=function(t,e){return new V(e)},t}(),F=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}(),N=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 w,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"}(I||(I={}));var O,B,L,X=function(t,e,n){if(this.color=new w(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},Y=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},D=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return r(e,t),e}(Y),U=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.rotateMix=0,n.translateMix=0,n.scaleMix=0,n.shearMix=0,n.offsetRotation=0,n.offsetX=0,n.offsetY=0,n.offsetScaleX=0,n.offsetScaleY=0,n.offsetShearY=0,n.relative=!1,n.local=!1,n}return r(e,t),e}(Y),W=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return r(e,t),e}(Y);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(O||(O={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(B||(B={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(L||(L={}));var q,H,G,j=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},z=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,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[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,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];null!=c.attachment&&(R(c.attachment,T)?(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 j(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 j(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 h=this.getAttachment(n,o);null!=h&&a.setAttachment(h);break}}}n++}},t}(),Z=function(t){this.name=t},Q=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 h=this.timelines,l=0,u=h.length;l<u;l++)h[l].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"}(q||(q={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(H||(H={})),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"}(G||(G={}));var J=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=x.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),h=.006*(3*(n-a)+1),l=.006*(3*(r-i)+1),u=2*s+h,c=2*o+l,d=.3*n+s+.16666667*h,f=.3*r+o+.16666667*l,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+=h,c+=l,g+=d,m+=f},e.getCurvePercent=function(e,n){n=E.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,h=a+t.BEZIER_SIZE-1;a<h;a+=2)if((s=r[a])>=n){var l=void 0,u=void 0;return a==o?(l=0,u=0):(l=r[a-2],u=r[a-1]),u+(r[a+1]-u)*(n-l)/(s-l)}var c=r[a-1];return c+(1-c)*(n-s)/(1-s)},t}();J.LINEAR=0,J.STEPPED=1,J.BEZIER=2,J.BEZIER_SIZE=19;var K=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=x.newFloatArray(e<<1),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return 0+this.boneIndex},n.setFrame=function(t,n,r){t<<=1,this.frames[t]=n,this.frames[t+e.ROTATION]=r},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.rotation=l.data.rotation);case 1:var u=l.data.rotation-l.rotation;l.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(r>=h[h.length-e.ENTRIES]){var c=h[h.length+e.PREV_ROTATION];switch(s){case 0:l.rotation=l.data.rotation+c*i;break;case 1:case 2:c+=l.data.rotation-l.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:l.rotation+=c*i}}else{var d=Q.binarySearch(h,r,e.ENTRIES),f=h[d+e.PREV_ROTATION],v=h[d],p=this.getCurvePercent((d>>1)-1,1-(r-v)/(h[d+e.PREV_TIME]-v)),g=h[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*p,s){case 0:l.rotation=l.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=l.data.rotation-l.rotation;case 3:l.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}(J);K.ENTRIES=2,K.PREV_TIME=-2,K.PREV_ROTATION=-1,K.ROTATION=1;var $=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(1<<24)+this.boneIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.X]=r,this.frames[t+e.Y]=a},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.x=l.data.x,void(l.y=l.data.y);case 1:l.x+=(l.data.x-l.x)*i,l.y+=(l.data.y-l.y)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.x=l.data.x+u*i,l.y=l.data.y+c*i;break;case 1:case 2:l.x+=(l.data.x+u-l.x)*i,l.y+=(l.data.y+c-l.y)*i;break;case 3:l.x+=u*i,l.y+=c*i}}},e}(J);$.ENTRIES=3,$.PREV_TIME=-3,$.PREV_X=-2,$.PREV_Y=-1,$.X=1,$.Y=2;var tt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(2<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case 1:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X]*l.data.scaleX,c=h[h.length+e.PREV_Y]*l.data.scaleY;else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u=(u+(h[d+e.X]-u)*v)*l.data.scaleX,c=(c+(h[d+e.Y]-c)*v)*l.data.scaleY}if(1==i)3==s?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{var p=0,g=0;if(1==o)switch(s){case 0:p=l.data.scaleX,g=l.data.scaleY,l.scaleX=p+(Math.abs(u)*E.signum(p)-p)*i,l.scaleY=g+(Math.abs(c)*E.signum(g)-g)*i;break;case 1:case 2:p=l.scaleX,g=l.scaleY,l.scaleX=p+(Math.abs(u)*E.signum(p)-p)*i,l.scaleY=g+(Math.abs(c)*E.signum(g)-g)*i;break;case 3:p=l.scaleX,g=l.scaleY,l.scaleX=p+(Math.abs(u)*E.signum(p)-l.data.scaleX)*i,l.scaleY=g+(Math.abs(c)*E.signum(g)-l.data.scaleY)*i}else switch(s){case 0:p=Math.abs(l.data.scaleX)*E.signum(u),g=Math.abs(l.data.scaleY)*E.signum(c),l.scaleX=p+(u-p)*i,l.scaleY=g+(c-g)*i;break;case 1:case 2:p=Math.abs(l.scaleX)*E.signum(u),g=Math.abs(l.scaleY)*E.signum(c),l.scaleX=p+(u-p)*i,l.scaleY=g+(c-g)*i;break;case 3:p=E.signum(u),g=E.signum(c),l.scaleX=Math.abs(l.scaleX)*p+(u-Math.abs(l.data.scaleX)*p)*i,l.scaleY=Math.abs(l.scaleY)*g+(c-Math.abs(l.data.scaleY)*g)*i}}}},e}($),et=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(3<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.shearX=l.data.shearX,void(l.shearY=l.data.shearY);case 1:l.shearX+=(l.data.shearX-l.shearX)*i,l.shearY+=(l.data.shearY-l.shearY)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.shearX=l.data.shearX+u*i,l.shearY=l.data.shearY+c*i;break;case 1:case 2:l.shearX+=(l.data.shearX+u-l.shearX)*i,l.shearY+=(l.data.shearY+c-l.shearY)*i;break;case 3:l.shearX+=u*i,l.shearY+=c*i}}},e}($),nt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(5<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},n.apply=function(t,n,r,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(r<l[0])switch(s){case 0:return void h.color.setFromColor(h.data.color);case 1:var u=h.color,c=h.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>=l[l.length-e.ENTRIES]){var g=l.length;d=l[g+e.PREV_R],f=l[g+e.PREV_G],v=l[g+e.PREV_B],p=l[g+e.PREV_A]}else{var m=Q.binarySearch(l,r,e.ENTRIES);d=l[m+e.PREV_R],f=l[m+e.PREV_G],v=l[m+e.PREV_B],p=l[m+e.PREV_A];var w=l[m],E=this.getCurvePercent(m/e.ENTRIES-1,1-(r-w)/(l[m+e.PREV_TIME]-w));d+=(l[m+e.R]-d)*E,f+=(l[m+e.G]-f)*E,v+=(l[m+e.B]-v)*E,p+=(l[m+e.A]-p)*E}if(1==i)h.color.set(d,f,v,p);else{var x=h.color;0==s&&x.setFromColor(h.data.color),x.add((d-x.r)*i,(f-x.g)*i,(v-x.b)*i,(p-x.a)*i)}}}},e}(J);nt.ENTRIES=5,nt.PREV_TIME=-5,nt.PREV_R=-4,nt.PREV_G=-3,nt.PREV_B=-2,nt.PREV_A=-1,nt.R=1,nt.G=2,nt.B=3,nt.A=4;var rt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(14<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s,o,h,l){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]=h,this.frames[t+e.B2]=l},n.apply=function(t,n,r,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(r<l[0])switch(s){case 0:return h.color.setFromColor(h.data.color),void h.darkColor.setFromColor(h.data.darkColor);case 1:var u=h.color,c=h.darkColor,d=h.data.color,f=h.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(r>=l[l.length-e.ENTRIES]){var y=l.length;v=l[y+e.PREV_R],p=l[y+e.PREV_G],g=l[y+e.PREV_B],m=l[y+e.PREV_A],w=l[y+e.PREV_R2],E=l[y+e.PREV_G2],x=l[y+e.PREV_B2]}else{var b=Q.binarySearch(l,r,e.ENTRIES);v=l[b+e.PREV_R],p=l[b+e.PREV_G],g=l[b+e.PREV_B],m=l[b+e.PREV_A],w=l[b+e.PREV_R2],E=l[b+e.PREV_G2],x=l[b+e.PREV_B2];var S=l[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(r-S)/(l[b+e.PREV_TIME]-S));v+=(l[b+e.R]-v)*M,p+=(l[b+e.G]-p)*M,g+=(l[b+e.B]-g)*M,m+=(l[b+e.A]-m)*M,w+=(l[b+e.R2]-w)*M,E+=(l[b+e.G2]-E)*M,x+=(l[b+e.B2]-x)*M}if(1==i)h.color.set(v,p,g,m),h.darkColor.set(w,E,x,1);else{var A=h.color,R=h.darkColor;0==s&&(A.setFromColor(h.data.color),R.setFromColor(h.data.darkColor)),A.add((v-A.r)*i,(p-A.g)*i,(g-A.b)*i,(m-A.a)*i),R.add((w-R.r)*i,(E-R.g)*i,(x-R.b)*i,0)}}}},e}(J);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 at=function(){function t(t){this.frames=x.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 h=this.frames;if(n<h[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var l=0;l=n>=h[h.length-1]?h.length-1:Q.binarySearch(h,n,1)-1;var u=this.attachmentNames[l];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}(),it=null,st=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=x.newFloatArray(e),n.frameVertices=new Array(e),null==it&&(it=x.newFloatArray(64)),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},n.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},n.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.getAttachment();if(R(h,M)&&h.deformAttachment==this.attachment){var l=o.deform;0==l.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(n<d[0]){var f=h;switch(i){case 0:return void(l.length=0);case 1:if(1==a){l.length=0;break}var v=x.setArraySize(l,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=x.setArraySize(l,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var E=h;if(null==E.bones)for(var y=E.vertices,b=0;b<c;b++)m[b]+=w[b]-y[b];else for(var S=0;S<c;S++)m[S]+=w[S]}else x.arrayCopy(w,0,m,0,c);else switch(i){case 0:var A=h;if(null==A.bones)for(var I=A.vertices,T=0;T<c;T++){var C=I[T];m[T]=C+(w[T]-C)*a}else for(var _=0;_<c;_++)m[_]=w[_]*a;break;case 1:case 2:for(var k=0;k<c;k++)m[k]+=(w[k]-m[k])*a;break;case 3:var V=h;if(null==V.bones)for(var P=V.vertices,F=0;F<c;F++)m[F]+=(w[F]-P[F])*a;else for(var N=0;N<c;N++)m[N]+=w[N]*a}}else{var O=Q.binarySearch(d,n),B=u[O-1],L=u[O],X=d[O],Y=this.getCurvePercent(O-1,1-(n-X)/(d[O-1]-X));if(1==a)if(3==i){var D=h;if(null==D.bones)for(var U=D.vertices,W=0;W<c;W++){var q=B[W];m[W]+=q+(L[W]-q)*Y-U[W]}else for(var H=0;H<c;H++){var G=B[H];m[H]+=G+(L[H]-G)*Y}}else for(var j=0;j<c;j++){var z=B[j];m[j]=z+(L[j]-z)*Y}else switch(i){case 0:var Z=h;if(null==Z.bones)for(var J=Z.vertices,K=0;K<c;K++){var $=B[K],tt=J[K];m[K]=tt+($+(L[K]-$)*Y-tt)*a}else for(var et=0;et<c;et++){var nt=B[et];m[et]=(nt+(L[et]-nt)*Y)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var at=B[rt];m[rt]+=(at+(L[rt]-at)*Y-m[rt])*a}break;case 3:var it=h;if(null==it.bones)for(var st=it.vertices,ot=0;ot<c;ot++){var ht=B[ot];m[ot]+=(ht+(L[ot]-ht)*Y-st[ot])*a}else for(var lt=0;lt<c;lt++){var ut=B[lt];m[lt]+=(ut+(L[lt]-ut)*Y)*a}}}}}}},e}(J),ot=function(){function t(t){this.frames=x.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,h=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[h-1])return;if(!(n<o[0])){var l=0;if(e<o[0])l=0;else for(var u=o[l=Q.binarySearch(o,e)];l>0&&o[l-1]==u;)l--;for(;l<h&&n>=o[l];l++)r.push(this.events[l])}}},t}(),ht=function(){function t(t){this.frames=x.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,h=t.slots;if(1!=s){var l=this.frames;if(n<l[0])0!=i&&1!=i||x.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=l[l.length-1]?l.length-1:Q.binarySearch(l,n)-1;var c=this.drawOrders[u];if(null==c)x.arrayCopy(h,0,o,0,h.length);else for(var d=0,f=c.length;d<f;d++)o[d]=h[c[d]]}}else 0==i&&x.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),lt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},n.setFrame=function(t,n,r,a,i,s,o){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.MIX]=r,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,void(l.stretch=l.data.stretch);case 1:l.mix+=(l.data.mix-l.mix)*i,l.softness+=(l.data.softness-l.softness)*i,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}else if(r>=h[h.length-e.ENTRIES])0==s?(l.mix=l.data.mix+(h[h.length+e.PREV_MIX]-l.data.mix)*i,l.softness=l.data.softness+(h[h.length+e.PREV_SOFTNESS]-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH])):(l.mix+=(h[h.length+e.PREV_MIX]-l.mix)*i,l.softness+=(h[h.length+e.PREV_SOFTNESS]-l.softness)*i,0==o&&(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH]));else{var u=Q.binarySearch(h,r,e.ENTRIES),c=h[u+e.PREV_MIX],d=h[u+e.PREV_SOFTNESS],f=h[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(r-f)/(h[u+e.PREV_TIME]-f));0==s?(l.mix=l.data.mix+(c+(h[u+e.MIX]-c)*v-l.data.mix)*i,l.softness=l.data.softness+(d+(h[u+e.SOFTNESS]-d)*v-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH])):(l.mix+=(c+(h[u+e.MIX]-c)*v-l.mix)*i,l.softness+=(d+(h[u+e.SOFTNESS]-d)*v-l.softness)*i,0==o&&(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH]))}},e}(J);lt.ENTRIES=6,lt.PREV_TIME=-6,lt.PREV_MIX=-5,lt.PREV_SOFTNESS=-4,lt.PREV_BEND_DIRECTION=-3,lt.PREV_COMPRESS=-2,lt.PREV_STRETCH=-1,lt.MIX=1,lt.SOFTNESS=2,lt.BEND_DIRECTION=3,lt.COMPRESS=4,lt.STRETCH=5;var ut=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(l.active)if(r<h[0]){var u=l.data;switch(s){case 0:return l.rotateMix=u.rotateMix,l.translateMix=u.translateMix,l.scaleMix=u.scaleMix,void(l.shearMix=u.shearMix);case 1:l.rotateMix+=(u.rotateMix-l.rotateMix)*i,l.translateMix+=(u.translateMix-l.translateMix)*i,l.scaleMix+=(u.scaleMix-l.scaleMix)*i,l.shearMix+=(u.shearMix-l.shearMix)*i}}else{var c=0,d=0,f=0,v=0;if(r>=h[h.length-e.ENTRIES]){var p=h.length;c=h[p+e.PREV_ROTATE],d=h[p+e.PREV_TRANSLATE],f=h[p+e.PREV_SCALE],v=h[p+e.PREV_SHEAR]}else{var g=Q.binarySearch(h,r,e.ENTRIES);c=h[g+e.PREV_ROTATE],d=h[g+e.PREV_TRANSLATE],f=h[g+e.PREV_SCALE],v=h[g+e.PREV_SHEAR];var m=h[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(r-m)/(h[g+e.PREV_TIME]-m));c+=(h[g+e.ROTATE]-c)*w,d+=(h[g+e.TRANSLATE]-d)*w,f+=(h[g+e.SCALE]-f)*w,v+=(h[g+e.SHEAR]-v)*w}if(0==s){var E=l.data;l.rotateMix=E.rotateMix+(c-E.rotateMix)*i,l.translateMix=E.translateMix+(d-E.translateMix)*i,l.scaleMix=E.scaleMix+(f-E.scaleMix)*i,l.shearMix=E.shearMix+(v-E.shearMix)*i}else l.rotateMix+=(c-l.rotateMix)*i,l.translateMix+=(d-l.translateMix)*i,l.scaleMix+=(f-l.scaleMix)*i,l.shearMix+=(v-l.shearMix)*i}},e}(J);ut.ENTRIES=5,ut.PREV_TIME=-5,ut.PREV_ROTATE=-4,ut.PREV_TRANSLATE=-3,ut.PREV_SCALE=-2,ut.PREV_SHEAR=-1,ut.ROTATE=1,ut.TRANSLATE=2,ut.SCALE=3,ut.SHEAR=4;var ct=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.VALUE]=r},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.position=l.data.position);case 1:l.position+=(l.data.position-l.position)*i}else{var u=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=Q.binarySearch(h,r,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.position=l.data.position+(u-l.data.position)*i:l.position+=(u-l.position)*i}},e}(J);ct.ENTRIES=2,ct.PREV_TIME=-2,ct.PREV_VALUE=-1,ct.VALUE=1;var dt,ft=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.spacing=l.data.spacing);case 1:l.spacing+=(l.data.spacing-l.spacing)*i}else{var u=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=Q.binarySearch(h,r,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.spacing=l.data.spacing+(u-l.data.spacing)*i:l.spacing+=(u-l.spacing)*i}},e}(ct),vt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.rotateMix=l.data.rotateMix,void(l.translateMix=l.data.translateMix);case 1:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*i,l.translateMix+=(l.data.translateMix-l.translateMix)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_ROTATE],c=h[h.length+e.PREV_TRANSLATE];else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_ROTATE],c=h[d+e.PREV_TRANSLATE];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.ROTATE]-u)*v,c+=(h[d+e.TRANSLATE]-c)*v}0==s?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*i,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*i):(l.rotateMix+=(u-l.rotateMix)*i,l.translateMix+=(c-l.translateMix)*i)}},e}(J);vt.ENTRIES=3,vt.PREV_TIME=-3,vt.PREV_ROTATE=-2,vt.PREV_TRANSLATE=-1,vt.ROTATE=1,vt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(dt||(dt={}));var pt,gt=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},mt=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 F,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],h=null,l=this.getValue(o,"parent",null);if(null!=l&&null==(h=r.findBone(l)))throw new Error("Parent bone not found: "+l);var u=new N(r.bones.length,o.name,h);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 g=new X(r.slots.length,f,p),m=this.getValue(d,"color",null);null!=m&&g.color.setFromString(m);var E=this.getValue(d,"dark",null);null!=E&&(g.darkColor=new w(1,1,1,1),g.darkColor.setFromString(E)),g.attachmentName=this.getValue(d,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),r.slots.push(g)}if(a.ik)for(var x=0;x<a.ik.length;x++){var y=a.ik[x],b=new D(y.name);b.order=this.getValue(y,"order",0),b.skinRequired=this.getValue(y,"skin",!1);for(var S=0;S<y.bones.length;S++){var M=y.bones[S],A=r.findBone(M);if(null==A)throw new Error("IK bone not found: "+M);b.bones.push(A)}var R=y.target;if(b.target=r.findBone(R),null==b.target)throw new Error("IK target bone not found: "+R);b.mix=this.getValue(y,"mix",1),b.softness=this.getValue(y,"softness",0)*n,b.bendDirection=this.getValue(y,"bendPositive",!0)?1:-1,b.compress=this.getValue(y,"compress",!1),b.stretch=this.getValue(y,"stretch",!1),b.uniform=this.getValue(y,"uniform",!1),r.ikConstraints.push(b)}if(a.transform)for(var I=0;I<a.transform.length;I++){var T=a.transform[I],C=new U(T.name);C.order=this.getValue(T,"order",0),C.skinRequired=this.getValue(T,"skin",!1);for(var _=0;_<T.bones.length;_++){var k=T.bones[_],V=r.findBone(k);if(null==V)throw new Error("Transform constraint bone not found: "+k);C.bones.push(V)}var P=T.target;if(C.target=r.findBone(P),null==C.target)throw new Error("Transform constraint target bone not found: "+P);C.local=this.getValue(T,"local",!1),C.relative=this.getValue(T,"relative",!1),C.offsetRotation=this.getValue(T,"rotation",0),C.offsetX=this.getValue(T,"x",0)*n,C.offsetY=this.getValue(T,"y",0)*n,C.offsetScaleX=this.getValue(T,"scaleX",0),C.offsetScaleY=this.getValue(T,"scaleY",0),C.offsetShearY=this.getValue(T,"shearY",0),C.rotateMix=this.getValue(T,"rotateMix",1),C.translateMix=this.getValue(T,"translateMix",1),C.scaleMix=this.getValue(T,"scaleMix",1),C.shearMix=this.getValue(T,"shearMix",1),r.transformConstraints.push(C)}if(a.path)for(var L=0;L<a.path.length;L++){var Y=a.path[L],q=new W(Y.name);q.order=this.getValue(Y,"order",0),q.skinRequired=this.getValue(Y,"skin",!1);for(var H=0;H<Y.bones.length;H++){var G=Y.bones[H],j=r.findBone(G);if(null==j)throw new Error("Transform constraint bone not found: "+G);q.bones.push(j)}var Q=Y.target;if(q.target=r.findSlot(Q),null==q.target)throw new Error("Path target slot not found: "+Q);q.positionMode=t.positionModeFromString(this.getValue(Y,"positionMode","percent")),q.spacingMode=t.spacingModeFromString(this.getValue(Y,"spacingMode","length")),q.rotateMode=t.rotateModeFromString(this.getValue(Y,"rotateMode","tangent")),q.offsetRotation=this.getValue(Y,"rotation",0),q.position=this.getValue(Y,"position",0),q.positionMode==O.Fixed&&(q.position*=n),q.spacing=this.getValue(Y,"spacing",0),q.spacingMode!=B.Length&&q.spacingMode!=B.Fixed||(q.spacing*=n),q.rotateMix=this.getValue(Y,"rotateMix",1),q.translateMix=this.getValue(Y,"translateMix",1),r.pathConstraints.push(q)}if(a.skins)for(var J=0;J<a.skins.length;J++){var K=a.skins[J],$=new z(K.name);if(K.bones)for(var tt=0;tt<K.bones.length;tt++){var et=r.findBone(K.bones[tt]);if(null==et)throw new Error("Skin bone not found: "+K.bones[J]);$.bones.push(et)}if(K.ik)for(var nt=0;nt<K.ik.length;nt++){var rt=r.findIkConstraint(K.ik[nt]);if(null==rt)throw new Error("Skin IK constraint not found: "+K.ik[J]);$.constraints.push(rt)}if(K.transform)for(var at=0;at<K.transform.length;at++){var it=r.findTransformConstraint(K.transform[at]);if(null==it)throw new Error("Skin transform constraint not found: "+K.transform[J]);$.constraints.push(it)}if(K.path)for(var st=0;st<K.path.length;st++){var ot=r.findPathConstraint(K.path[st]);if(null==ot)throw new Error("Skin path constraint not found: "+K.path[J]);$.constraints.push(ot)}for(var ht in K.attachments){var lt=r.findSlot(ht);if(null==lt)throw new Error("Slot not found: "+ht);var ut=K.attachments[ht];for(var ct in ut){var dt=this.readAttachment(ut[ct],$,lt.index,ct,r);null!=dt&&$.setAttachment(lt.index,ct,dt)}}r.skins.push($),"default"==$.name&&(r.defaultSkin=$)}for(var ft=0,vt=this.linkedMeshes.length;ft<vt;ft++){var pt=this.linkedMeshes[ft],gt=null==pt.skin?r.defaultSkin:r.findSkin(pt.skin);if(null==gt)throw new Error("Skin not found: "+pt.skin);var mt=gt.getAttachment(pt.slotIndex,pt.parent);if(null==mt)throw new Error("Parent mesh not found: "+pt.parent);pt.mesh.deformAttachment=pt.inheritDeform?mt:pt.mesh,pt.mesh.setParentMesh(mt),pt.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var wt in a.events){var Et=a.events[wt],xt=new Z(wt);xt.intValue=this.getValue(Et,"int",0),xt.floatValue=this.getValue(Et,"float",0),xt.stringValue=this.getValue(Et,"string",""),xt.audioPath=this.getValue(Et,"audio",null),null!=xt.audioPath&&(xt.volume=this.getValue(Et,"volume",1),xt.balance=this.getValue(Et,"balance",0)),r.events.push(xt)}if(a.animations)for(var yt in a.animations){var bt=a.animations[yt];this.readAnimation(bt,yt,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 h=this.getValue(t,"color",null);return null!=h&&o.color.setFromString(h),o.updateOffset(),o;case"boundingbox":var l=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(null==l)return null;this.readVertices(t,l,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&l.color.setFromString(u),l;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 wt(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 g=this.attachmentLoader.newPathAttachment(e,r);if(null==g)return null;g.closed=this.getValue(t,"closed",!1),g.constantSpeed=this.getValue(t,"constantSpeed",!0);var m=t.vertexCount;this.readVertices(t,g,m<<1);for(var w=x.newArray(m/3,0),E=0;E<t.lengths.length;E++)w[E]=t.lengths[E]*i;g.lengths=w;var y=this.getValue(t,"color",null);return null!=y&&g.color.setFromString(y),g;case"point":var b=this.attachmentLoader.newPointAttachment(e,r);if(null==b)return null;b.x=this.getValue(t,"x",0)*i,b.y=this.getValue(t,"y",0)*i,b.rotation=this.getValue(t,"rotation",0);var S=this.getValue(t,"color",null);return null!=S&&b.color.setFromString(S),b;case"clipping":var M=this.attachmentLoader.newClippingAttachment(e,r);if(null==M)return null;var A=this.getValue(t,"end",null);if(null!=A){var R=a.findSlot(A);if(null==R)throw new Error("Clipping end slot not found: "+A);M.endSlot=R}var I=t.vertexCount;this.readVertices(t,M,I<<1);var T=this.getValue(t,"color",null);return null!=T&&M.color.setFromString(T),M}return null},e.readVertices=function(t,e,n){var r=this.scale;e.worldVerticesLength=n;var a=t.vertices;if(n!=a.length){for(var i=new Array,s=new Array,o=0,h=a.length;o<h;){var l=a[o++];s.push(l);for(var u=o+4*l;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=x.toFloatArray(i)}else{var c=x.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],h=n.findSlotIndex(s);if(-1==h)throw new Error("Slot not found: "+s);for(var l in o){var u=o[l];if("attachment"==l){var c=new at(u.length);c.slotIndex=h;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"==l){var p=new nt(u.length);p.slotIndex=h;for(var g=0,m=0;m<u.length;m++){var E=u[m],y=new w;y.setFromString(E.color),p.setFrame(g,this.getValue(E,"time",0),y.r,y.g,y.b,y.a),this.readCurve(E,p,g),g++}a.push(p),i=Math.max(i,p.frames[(p.getFrameCount()-1)*nt.ENTRIES])}else{if("twoColor"!=l)throw new Error("Invalid timeline type for a slot: "+l+" ("+s+")");var b=new rt(u.length);b.slotIndex=h;for(var S=0,M=0;M<u.length;M++){var A=u[M],R=new w,I=new w;R.setFromString(A.light),I.setFromString(A.dark),b.setFrame(S,this.getValue(A,"time",0),R.r,R.g,R.b,R.a,I.r,I.g,I.b),this.readCurve(A,b,S),S++}a.push(b),i=Math.max(i,b.frames[(b.getFrameCount()-1)*rt.ENTRIES])}}}if(t.bones)for(var T in t.bones){var C=t.bones[T],_=n.findBoneIndex(T);if(-1==_)throw new Error("Bone not found: "+T);for(var k in C){var V=C[k];if("rotate"===k){var P=new K(V.length);P.boneIndex=_;for(var F=0,N=0;N<V.length;N++){var L=V[N];P.setFrame(F,this.getValue(L,"time",0),this.getValue(L,"angle",0)),this.readCurve(L,P,F),F++}a.push(P),i=Math.max(i,P.frames[(P.getFrameCount()-1)*K.ENTRIES])}else{if("translate"!==k&&"scale"!==k&&"shear"!==k)throw new Error("Invalid timeline type for a bone: "+k+" ("+T+")");var X=null,Y=1,D=0;"scale"===k?(X=new tt(V.length),D=1):"shear"===k?X=new et(V.length):(X=new $(V.length),Y=r),X.boneIndex=_;for(var U=0,W=0;W<V.length;W++){var q=V[W],H=this.getValue(q,"x",D),G=this.getValue(q,"y",D);X.setFrame(U,this.getValue(q,"time",0),H*Y,G*Y),this.readCurve(q,X,U),U++}a.push(X),i=Math.max(i,X.frames[(X.getFrameCount()-1)*$.ENTRIES])}}}if(t.ik)for(var j in t.ik){var z=t.ik[j],Z=n.findIkConstraint(j),J=new lt(z.length);J.ikConstraintIndex=n.ikConstraints.indexOf(Z);for(var it=0,dt=0;dt<z.length;dt++){var pt=z[dt];J.setFrame(it,this.getValue(pt,"time",0),this.getValue(pt,"mix",1),this.getValue(pt,"softness",0)*r,this.getValue(pt,"bendPositive",!0)?1:-1,this.getValue(pt,"compress",!1),this.getValue(pt,"stretch",!1)),this.readCurve(pt,J,it),it++}a.push(J),i=Math.max(i,J.frames[(J.getFrameCount()-1)*lt.ENTRIES])}if(t.transform)for(var mt in t.transform){var wt=t.transform[mt],Et=n.findTransformConstraint(mt),xt=new ut(wt.length);xt.transformConstraintIndex=n.transformConstraints.indexOf(Et);for(var yt=0,bt=0;bt<wt.length;bt++){var St=wt[bt];xt.setFrame(yt,this.getValue(St,"time",0),this.getValue(St,"rotateMix",1),this.getValue(St,"translateMix",1),this.getValue(St,"scaleMix",1),this.getValue(St,"shearMix",1)),this.readCurve(St,xt,yt),yt++}a.push(xt),i=Math.max(i,xt.frames[(xt.getFrameCount()-1)*ut.ENTRIES])}if(t.path)for(var Mt in t.path){var At=t.path[Mt],Rt=n.findPathConstraintIndex(Mt);if(-1==Rt)throw new Error("Path constraint not found: "+Mt);var It=n.pathConstraints[Rt];for(var Tt in At){var Ct=At[Tt];if("position"===Tt||"spacing"===Tt){var _t=null,kt=1;"spacing"===Tt?(_t=new ft(Ct.length),It.spacingMode!=B.Length&&It.spacingMode!=B.Fixed||(kt=r)):(_t=new ct(Ct.length),It.positionMode==O.Fixed&&(kt=r)),_t.pathConstraintIndex=Rt;for(var Vt=0,Pt=0;Pt<Ct.length;Pt++){var Ft=Ct[Pt];_t.setFrame(Vt,this.getValue(Ft,"time",0),this.getValue(Ft,Tt,0)*kt),this.readCurve(Ft,_t,Vt),Vt++}a.push(_t),i=Math.max(i,_t.frames[(_t.getFrameCount()-1)*ct.ENTRIES])}else if("mix"===Tt){var Nt=new vt(Ct.length);Nt.pathConstraintIndex=Rt;for(var Ot=0,Bt=0;Bt<Ct.length;Bt++){var Lt=Ct[Bt];Nt.setFrame(Ot,this.getValue(Lt,"time",0),this.getValue(Lt,"rotateMix",1),this.getValue(Lt,"translateMix",1)),this.readCurve(Lt,Nt,Ot),Ot++}a.push(Nt),i=Math.max(i,Nt.frames[(Nt.getFrameCount()-1)*vt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Yt=t.deform[Xt],Dt=n.findSkin(Xt);if(null==Dt)throw new Error("Skin not found: "+Xt);for(var Ut in Yt){var Wt=Yt[Ut],qt=n.findSlotIndex(Ut);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var Gt=Wt[Ht],jt=Dt.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 st(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?x.newFloatArray(Qt):Zt;else{ee=x.newFloatArray(Qt);var re=this.getValue(te,"offset",0);if(x.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 he=new ht(oe.length),le=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=x.newArray(le,-1);for(var pe=x.newArray(le-ve.length,0),ge=0,me=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(;ge!=xe;)pe[me++]=ge++;fe[ge+Ee.offset]=ge++}for(;ge<le;)pe[me++]=ge++;for(var ye=le-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--me])}he.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(he),i=Math.max(i,he.frames[he.getFrameCount()-1])}if(t.events){for(var be=new ot(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 Ie=new gt(x.toSinglePrecision(this.getValue(Ae,"time",0)),Re);Ie.intValue=this.getValue(Ae,"int",Re.intValue),Ie.floatValue=this.getValue(Ae,"float",Re.floatValue),Ie.stringValue=this.getValue(Ae,"string",Re.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");n.animations.push(new Q(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 dt.Normal;if("additive"==t)return dt.Additive;if("multiply"==t)return dt.Multiply;if("screen"==t)return dt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return O.Fixed;if("percent"==t)return O.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return B.Length;if("fixed"==t)return B.Fixed;if("percent"==t)return B.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return L.Tangent;if("chain"==t)return L.Chain;if("chainscale"==t)return L.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return I.Normal;if("onlytranslation"==t)return I.OnlyTranslation;if("norotationorreflection"==t)return I.NoRotationOrReflection;if("noscale"==t)return I.NoScale;if("noscaleorreflection"==t)return I.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),wt=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"}(pt||(pt={}));var Et=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 F;r.name="";var a=new xt(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 h=0;h<s;h++){var l=a.readString(),u=0==h?null:r.bones[a.readInt(!0)],c=new N(h,l,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&&w.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 X(d,f,v);w.rgba8888ToColor(p.color,a.readInt32());var g=a.readInt32();-1!=g&&w.rgb888ToColor(p.darkColor=new w,g),p.attachmentName=a.readStringRef(),p.blendMode=t.BlendModeValues[a.readInt(!0)],r.slots.push(p)}s=a.readInt(!0);for(var m,E=0;E<s;E++){var y=new D(a.readString());y.order=a.readInt(!0),y.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var b=0;b<m;b++)y.bones.push(r.bones[a.readInt(!0)]);y.target=r.bones[a.readInt(!0)],y.mix=a.readFloat(),y.softness=a.readFloat()*n,y.bendDirection=a.readByte(),y.compress=a.readBoolean(),y.stretch=a.readBoolean(),y.uniform=a.readBoolean(),r.ikConstraints.push(y)}s=a.readInt(!0);for(var S,M=0;M<s;M++){var A=new U(a.readString());A.order=a.readInt(!0),A.skinRequired=a.readBoolean(),S=a.readInt(!0);for(var R=0;R<S;R++)A.bones.push(r.bones[a.readInt(!0)]);A.target=r.bones[a.readInt(!0)],A.local=a.readBoolean(),A.relative=a.readBoolean(),A.offsetRotation=a.readFloat(),A.offsetX=a.readFloat()*n,A.offsetY=a.readFloat()*n,A.offsetScaleX=a.readFloat(),A.offsetScaleY=a.readFloat(),A.offsetShearY=a.readFloat(),A.rotateMix=a.readFloat(),A.translateMix=a.readFloat(),A.scaleMix=a.readFloat(),A.shearMix=a.readFloat(),r.transformConstraints.push(A)}s=a.readInt(!0);for(var I,T=0;T<s;T++){var C=new W(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),I=a.readInt(!0);for(var _=0;_<I;_++)C.bones.push(r.bones[a.readInt(!0)]);C.target=r.slots[a.readInt(!0)],C.positionMode=t.PositionModeValues[a.readInt(!0)],C.spacingMode=t.SpacingModeValues[a.readInt(!0)],C.rotateMode=t.RotateModeValues[a.readInt(!0)],C.offsetRotation=a.readFloat(),C.position=a.readFloat(),C.positionMode==O.Fixed&&(C.position*=n),C.spacing=a.readFloat(),C.spacingMode!=B.Length&&C.spacingMode!=B.Fixed||(C.spacing*=n),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),r.pathConstraints.push(C)}var k=this.readSkin(a,r,!0,i);null!=k&&(r.defaultSkin=k,r.skins.push(k));var V=r.skins.length;for(x.setArraySize(r.skins,s=V+a.readInt(!0));V<s;V++)r.skins[V]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var P=0;P<s;P++){var L=this.linkedMeshes[P],Y=null==L.skin?r.defaultSkin:r.findSkin(L.skin);if(null==Y)throw new Error("Skin not found: "+L.skin);var q=Y.getAttachment(L.slotIndex,L.parent);if(null==q)throw new Error("Parent mesh not found: "+L.parent);L.mesh.deformAttachment=L.inheritDeform?q:L.mesh,L.mesh.setParentMesh(q),L.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var H=0;H<s;H++){var G=new Z(a.readStringRef());G.intValue=a.readInt(!1),G.floatValue=a.readFloat(),G.stringValue=a.readString(),G.audioPath=a.readString(),null!=G.audioPath&&(G.volume=a.readFloat(),G.balance=a.readFloat()),r.events.push(G)}s=a.readInt(!0);for(var j=0;j<s;j++)r.animations.push(this.readAnimation(a,a.readString(),r));return r},e.readSkin=function(t,e,n,r){var a=null,i=0;if(n){if(0==(i=t.readInt(!0)))return null;a=new z("default")}else{(a=new z(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 h=0,l=t.readInt(!0);h<l;h++)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,r);null!=E&&a.setAttachment(p,w,E)}return a},e.readAttachment=function(e,n,r,a,i,s){var o=this.scale,h=e.readStringRef();null==h&&(h=i);var l=e.readByte();switch(t.AttachmentTypeValues[l]){case pt.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(),E=e.readInt32();null==u&&(u=h);var y=this.attachmentLoader.newRegionAttachment(r,h,u);return null==y?null:(y.path=u,y.x=d*o,y.y=f*o,y.scaleX=v,y.scaleY=p,y.rotation=c,y.width=g*o,y.height=m*o,w.rgba8888ToColor(y.color,E),y.updateOffset(),y);case pt.BoundingBox:var b=e.readInt(!0),S=this.readVertices(e,b),M=s?e.readInt32():0,A=this.attachmentLoader.newBoundingBoxAttachment(r,h);return null==A?null:(A.worldVerticesLength=b<<1,A.vertices=S.vertices,A.bones=S.bones,s&&w.rgba8888ToColor(A.color,M),A);case pt.Mesh:var R=e.readStringRef(),I=e.readInt32(),T=e.readInt(!0),C=this.readFloatArray(e,T<<1,1),_=this.readShortArray(e),k=this.readVertices(e,T),V=e.readInt(!0),P=null,F=0,N=0;s&&(P=this.readShortArray(e),F=e.readFloat(),N=e.readFloat()),null==R&&(R=h);var O=this.attachmentLoader.newMeshAttachment(r,h,R);return null==O?null:(O.path=R,w.rgba8888ToColor(O.color,I),O.bones=k.bones,O.vertices=k.vertices,O.worldVerticesLength=T<<1,O.triangles=_,O.regionUVs=C,O.updateUVs(),O.hullLength=V<<1,s&&(O.edges=P,O.width=F*o,O.height=N*o),O);case pt.LinkedMesh:var B=e.readStringRef(),L=e.readInt32(),X=e.readStringRef(),Y=e.readStringRef(),D=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==B&&(B=h);var q=this.attachmentLoader.newMeshAttachment(r,h,B);return null==q?null:(q.path=B,w.rgba8888ToColor(q.color,L),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new yt(q,X,a,Y,D)),q);case pt.Path:for(var H=e.readBoolean(),G=e.readBoolean(),j=e.readInt(!0),z=this.readVertices(e,j),Z=x.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,h);return null==$?null:($.closed=H,$.constantSpeed=G,$.worldVerticesLength=j<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&w.rgba8888ToColor($.color,K),$);case pt.Point:var tt=e.readFloat(),et=e.readFloat(),nt=e.readFloat(),rt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(r,h);return null==at?null:(at.x=et*o,at.y=nt*o,at.rotation=tt,s&&w.rgba8888ToColor(at.color,rt),at);case pt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),ht=s?e.readInt32():0,lt=this.attachmentLoader.newClippingAttachment(r,h);return null==lt?null:(lt.endSlot=n.slots[it],lt.worldVerticesLength=st<<1,lt.vertices=ot.vertices,lt.bones=ot.bones,s&&w.rgba8888ToColor(lt.color,ht),lt)}return null},e.readVertices=function(t,e){var n=e<<1,r=new bt,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 h=t.readInt(!0);s.push(h);for(var l=0;l<h;l++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return r.vertices=x.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 w,h=new w,l=0,u=e.readInt(!0);l<u;l++)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 at(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 E=new nt(p);E.slotIndex=c;for(var y=0;y<p;y++){var b=e.readFloat();w.rgba8888ToColor(o,e.readInt32()),E.setFrame(y,b,o.r,o.g,o.b,o.a),y<p-1&&this.readCurve(e,y,E)}a.push(E),s=Math.max(s,E.frames[(p-1)*nt.ENTRIES]);break;case t.SLOT_TWO_COLOR:var S=new rt(p);S.slotIndex=c;for(var M=0;M<p;M++){var A=e.readFloat();w.rgba8888ToColor(o,e.readInt32()),w.rgb888ToColor(h,e.readInt32()),S.setFrame(M,A,o.r,o.g,o.b,o.a,h.r,h.g,h.b),M<p-1&&this.readCurve(e,M,S)}a.push(S),s=Math.max(s,S.frames[(p-1)*rt.ENTRIES])}}for(var R=0,I=e.readInt(!0);R<I;R++)for(var T=e.readInt(!0),C=0,_=e.readInt(!0);C<_;C++){var k=e.readByte(),V=e.readInt(!0);switch(k){case t.BONE_ROTATE:var P=new K(V);P.boneIndex=T;for(var F=0;F<V;F++)P.setFrame(F,e.readFloat(),e.readFloat()),F<V-1&&this.readCurve(e,F,P);a.push(P),s=Math.max(s,P.frames[(V-1)*K.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var N=void 0,L=1;k==t.BONE_SCALE?N=new tt(V):k==t.BONE_SHEAR?N=new et(V):(N=new $(V),L=i),N.boneIndex=T;for(var X=0;X<V;X++)N.setFrame(X,e.readFloat(),e.readFloat()*L,e.readFloat()*L),X<V-1&&this.readCurve(e,X,N);a.push(N),s=Math.max(s,N.frames[(V-1)*$.ENTRIES])}}for(var Y=0,D=e.readInt(!0);Y<D;Y++){var U=e.readInt(!0),W=e.readInt(!0),q=new lt(W);q.ikConstraintIndex=U;for(var H=0;H<W;H++)q.setFrame(H,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),H<W-1&&this.readCurve(e,H,q);a.push(q),s=Math.max(s,q.frames[(W-1)*lt.ENTRIES])}for(var G=0,j=e.readInt(!0);G<j;G++){var z=e.readInt(!0),Z=e.readInt(!0),J=new ut(Z);J.transformConstraintIndex=z;for(var it=0;it<Z;it++)J.setFrame(it,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),it<Z-1&&this.readCurve(e,it,J);a.push(J),s=Math.max(s,J.frames[(Z-1)*ut.ENTRIES])}for(var dt=0,pt=e.readInt(!0);dt<pt;dt++)for(var mt=e.readInt(!0),wt=r.pathConstraints[mt],Et=0,xt=e.readInt(!0);Et<xt;Et++){var yt=e.readByte(),bt=e.readInt(!0);switch(yt){case t.PATH_POSITION:case t.PATH_SPACING:var St=void 0,Mt=1;yt==t.PATH_SPACING?(St=new ft(bt),wt.spacingMode!=B.Length&&wt.spacingMode!=B.Fixed||(Mt=i)):(St=new ct(bt),wt.positionMode==O.Fixed&&(Mt=i)),St.pathConstraintIndex=mt;for(var At=0;At<bt;At++)St.setFrame(At,e.readFloat(),e.readFloat()*Mt),At<bt-1&&this.readCurve(e,At,St);a.push(St),s=Math.max(s,St.frames[(bt-1)*ct.ENTRIES]);break;case t.PATH_MIX:var Rt=new vt(bt);Rt.pathConstraintIndex=mt;for(var It=0;It<bt;It++)Rt.setFrame(It,e.readFloat(),e.readFloat(),e.readFloat()),It<bt-1&&this.readCurve(e,It,Rt);a.push(Rt),s=Math.max(s,Rt.frames[(bt-1)*vt.ENTRIES])}}for(var Tt=0,Ct=e.readInt(!0);Tt<Ct;Tt++)for(var _t=r.skins[e.readInt(!0)],kt=0,Vt=e.readInt(!0);kt<Vt;kt++)for(var Pt=e.readInt(!0),Ft=0,Nt=e.readInt(!0);Ft<Nt;Ft++){var Ot=_t.getAttachment(Pt,e.readStringRef()),Bt=null!=Ot.bones,Lt=Ot.vertices,Xt=Bt?Lt.length/3*2:Lt.length,Yt=e.readInt(!0),Dt=new st(Yt);Dt.slotIndex=Pt,Dt.attachment=Ot;for(var Ut=0;Ut<Yt;Ut++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=Bt?x.newFloatArray(Xt):Lt;else{qt=x.newFloatArray(Xt);var Gt=e.readInt(!0);if(Ht+=Gt,1==i)for(var jt=Gt;jt<Ht;jt++)qt[jt]=e.readFloat();else for(var zt=Gt;zt<Ht;zt++)qt[zt]=e.readFloat()*i;if(!Bt)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=Lt[Zt]}Dt.setFrame(Ut,Wt,qt),Ut<Yt-1&&this.readCurve(e,Ut,Dt)}a.push(Dt),s=Math.max(s,Dt.frames[Yt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new ht(Jt),$t=r.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=x.newArray($t,0),ae=$t-1;ae>=0;ae--)re[ae]=-1;for(var ie=x.newArray($t-ne,0),se=0,oe=0,he=0;he<ne;he++){for(var le=e.readInt(!0);se!=le;)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 ot(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=r.events[e.readInt(!0)],ge=new gt(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 Q(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}();Et.AttachmentTypeValues=[0,1,2,3,4,5,6],Et.TransformModeValues=[I.Normal,I.OnlyTranslation,I.NoRotationOrReflection,I.NoScale,I.NoScaleOrReflection],Et.PositionModeValues=[O.Fixed,O.Percent],Et.SpacingModeValues=[B.Length,B.Fixed,B.Percent],Et.RotateModeValues=[L.Tangent,L.Chain,L.ChainScale],Et.BlendModeValues=[dt.Normal,dt.Additive,dt.Multiply,dt.Screen],Et.BONE_ROTATE=0,Et.BONE_TRANSLATE=1,Et.BONE_SCALE=2,Et.BONE_SHEAR=3,Et.SLOT_ATTACHMENT=0,Et.SLOT_COLOR=1,Et.SLOT_TWO_COLOR=2,Et.PATH_POSITION=0,Et.PATH_SPACING=1,Et.PATH_MIX=2,Et.CURVE_LINEAR=0,Et.CURVE_STEPPED=1,Et.CURVE_BEZIER=2;var xt=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}(),yt=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},bt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function St(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 Mt(t,e,n){return e&&St(t.prototype,e),n&&St(t,n),t}function At(){return At=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},At.apply(this,arguments)}var Rt=function(){function t(t,e,n){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=n,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,n,r,a,i,s){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var h=this.skeleton,l=n+90+s,u=h.scaleX,c=h.scaleY;return this.a=E.cosDeg(n+i)*r*u,this.b=E.cosDeg(l)*a*u,this.c=E.sinDeg(n+i)*r*c,this.d=E.sinDeg(l)*a*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.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 I.Normal:var g=n+90+s,m=E.cosDeg(n+i)*r,w=E.cosDeg(g)*a,x=E.sinDeg(n+i)*r,y=E.sinDeg(g)*a;return this.a=d*m+f*x,this.b=d*w+f*y,this.c=v*m+p*x,void(this.d=v*w+p*y);case I.OnlyTranslation:var b=n+90+s;this.a=E.cosDeg(n+i)*r,this.b=E.cosDeg(b)*a,this.c=E.sinDeg(n+i)*r,this.d=E.sinDeg(b)*a;break;case I.NoRotationOrReflection:var S=d*d+v*v,M=0;S>1e-4?(S=Math.abs(d*p-f*v)/S,d/=this.skeleton.scaleX,f=(v/=this.skeleton.scaleY)*S,p=d*S,M=Math.atan2(v,d)*E.radDeg):(d=0,v=0,M=90-Math.atan2(p,f)*E.radDeg);var A=n+i-M,R=n+s-M+90,T=E.cosDeg(A)*r,C=E.cosDeg(R)*a,_=E.sinDeg(A)*r,k=E.sinDeg(R)*a;this.a=d*T-f*_,this.b=d*C-f*k,this.c=v*T+p*_,this.d=v*C+p*k;break;case I.NoScale:case I.NoScaleOrReflection:var V=E.cosDeg(n),P=E.sinDeg(n),F=(d*V+f*P)/this.skeleton.scaleX,N=(v*V+p*P)/this.skeleton.scaleY,O=Math.sqrt(F*F+N*N);O>1e-5&&(O=1/O),F*=O,N*=O,O=Math.sqrt(F*F+N*N),this.data.transformMode==I.NoScale&&d*p-f*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(O=-O);var B=Math.PI/2+Math.atan2(N,F),L=Math.cos(B)*O,X=Math.sin(B)*O,Y=E.cosDeg(i)*r,D=E.cosDeg(90+s)*a,U=E.sinDeg(i)*r,W=E.sinDeg(90+s)*a;this.a=F*Y+L*U,this.b=F*D+L*W,this.c=N*Y+X*U,this.d=N*D+X*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*E.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*E.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)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg);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 h=i*a,l=i*e,u=i*n,c=i*r,d=h*this.a-u*this.c,f=h*this.b-u*this.d,v=l*this.c-c*this.a,p=l*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)*E.radDeg,this.arotation=Math.atan2(v,d)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,f)*E.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=E.sinDeg(t),n=E.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*E.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=E.sinDeg(t),n=E.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*E.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=E.cosDeg(t),s=E.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}(),It=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 w,this.darkColor=null==t.darkColor?null:new w,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}(),Tt=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,h=o.a,l=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,v=0;switch(t.data.transformMode){case I.OnlyTranslation:f=e-t.worldX,v=n-t.worldY;break;case I.NoRotationOrReflection:var p=Math.abs(h*c-l*u)/(h*h+u*u),g=h/t.skeleton.scaleX,m=u/t.skeleton.scaleY;l=-m*p*t.skeleton.scaleX,c=g*p*t.skeleton.scaleY,d+=Math.atan2(m,g)*E.radDeg;default:var w=e-o.worldX,x=n-o.worldY,y=h*c-l*u;f=(w*c-x*l)/y-t.ax,v=(x*h-w*u)/y-t.ay}d+=Math.atan2(v,f)*E.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var b=t.ascaleX,S=t.ascaleY;if(r||a){switch(t.data.transformMode){case I.NoScale:case I.NoScaleOrReflection:f=e-t.worldX,v=n-t.worldY}var M=t.data.length*b,A=Math.sqrt(f*f+v*v);if(r&&A<M||a&&A>M&&M>1e-4){var R=(A/M-1)*s+1;b*=R,i&&(S*=R)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,b,S,t.ashearX,t.ashearY)},e.apply2=function(t,e,n,r,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var h=t.ax,l=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,x=0,y=0,b=t.a,S=t.b,M=t.c,A=t.d,R=Math.abs(u-d)<=1e-4;R?(x=b*m+S*(w=e.ay)+t.worldX,y=M*m+A*w+t.worldY):(w=0,x=b*m+t.worldX,y=M*m+t.worldY);var I=t.parent;b=I.a,S=I.b,M=I.c;var T,C,_=1/(b*(A=I.d)-S*M),k=x-I.worldX,V=y-I.worldY,P=(k*A-V*S)*_-h,F=(V*b-k*M)*_-l,N=Math.sqrt(P*P+F*F),O=e.data.length*f;if(N<1e-4)return this.apply1(t,n,r,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((k=n-I.worldX)*A-(V=r-I.worldY)*S)*_-h,L=(V*b-k*M)*_-l,X=B*B+L*L;if(0!=s){s*=u*(f+1)/2;var Y=Math.sqrt(X),D=Y-N-O*u+s;if(D>0){var U=Math.min(1,D/(2*s))-1;X=(B-=(U=(D-s*(1-U*U))/Y)*B)*B+(L-=U*L)*L}}t:if(R){var W=(X-N*N-(O*=u)*O)/(2*N*O);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(X)/(N+O)-1)*o+1)),C=Math.acos(W)*a,b=N+O*W,S=O*Math.sin(C),T=Math.atan2(L*b-B*S,B*b+L*S)}else{var q=(b=u*O)*b,H=(S=d*O)*S,G=Math.atan2(L,B),j=-2*H*N,z=H-q;if((A=j*j-4*z*(M=H*N*N+q*X-q*H))>=0){var Z=Math.sqrt(A);j<0&&(Z=-Z);var Q=(Z=-(j+Z)/2)/z,J=M/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){V=Math.sqrt(X-K*K)*a,T=G-Math.atan2(V,K),C=Math.atan2(V/d,(K-N)/u);break t}}var $=E.PI,tt=N-b,et=tt*tt,nt=0,rt=0,at=N+b,it=at*at,st=0;(M=-b*N/(q-H))>=-1&&M<=1&&(M=Math.acos(M),(A=(k=b*Math.cos(M)+N)*k+(V=S*Math.sin(M))*V)<et&&($=M,et=A,tt=k,nt=V),A>it&&(rt=M,it=A,at=k,st=V)),X<=(et+it)/2?(T=G-Math.atan2(nt*a,tt),C=$*a):(T=G-Math.atan2(st*a,at),C=rt*a)}var ot=Math.atan2(w,m)*g,ht=t.arotation;(T=(T-ot)*E.radDeg+v-ht)>180?T-=360:T<-180&&(T+=360),t.updateWorldTransformWith(h,l,ht+T*o,c,t.ascaleY,0,0),ht=e.arotation,(C=((C+ot)*E.radDeg-e.ashearX)*g+p-ht)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(m,w,ht+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),Ct=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new b,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,h=a.d,l=i*h-s*o>0?E.degRad:-E.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,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,x=p.c,y=p.d,b=Math.atan2(o,i)-Math.atan2(x,m)+u;b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);p.a=S*m-M*x,p.b=S*w-M*y,p.c=M*m+S*x,p.d=M*w+S*y,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(A.x-p.worldX)*e,p.worldY+=(A.y-p.worldY)*e,g=!0}if(n>0){var R=Math.sqrt(p.a*p.a+p.c*p.c),I=Math.sqrt(i*i+o*o);R>1e-5&&(R=(R+(I-R+this.data.offsetScaleX)*n)/R),p.a*=R,p.c*=R,R=Math.sqrt(p.b*p.b+p.d*p.d),I=Math.sqrt(s*s+h*h),R>1e-5&&(R=(R+(I-R+this.data.offsetScaleY)*n)/R),p.b*=R,p.d*=R,g=!0}if(r>0){var T=p.b,C=p.d,_=Math.atan2(C,T),k=Math.atan2(h,s)-Math.atan2(o,i)-(_-Math.atan2(p.c,p.a));k>E.PI?k-=E.PI2:k<-E.PI&&(k+=E.PI2),k=_+(k+c)*r;var V=Math.sqrt(T*T+C*C);p.b=Math.cos(k)*V,p.d=Math.sin(k)*V,g=!0}g&&(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,h=a.d,l=i*h-s*o>0?E.degRad:-E.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,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,x=p.c,y=p.d,b=Math.atan2(o,i)+u;b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);p.a=S*m-M*x,p.b=S*w-M*y,p.c=M*m+S*x,p.d=M*w+S*y,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),p.worldX+=A.x*e,p.worldY+=A.y*e,g=!0}if(n>0){var R=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;p.a*=R,p.c*=R,R=(Math.sqrt(s*s+h*h)-1+this.data.offsetScaleY)*n+1,p.b*=R,p.d*=R,g=!0}if(r>0){var I=Math.atan2(h,s)-Math.atan2(o,i);I>E.PI?I-=E.PI2:I<-E.PI&&(I+=E.PI2);var T=p.b,C=p.d;I=Math.atan2(C,T)+(I-E.PI/2+c)*r;var _=Math.sqrt(T*T+C*C);p.b=Math.cos(I)*_,p.d=Math.sin(I)*_,g=!0}g&&(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 h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;if(0!=t){var u=a.arotation-l+this.data.offsetRotation;l+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=h.ax,d=h.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=h.ascaleX,v=h.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=h.ashearY;if(0!=r){var g=a.ashearY-p+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),h.shearY+=g*r}h.updateWorldTransformWith(c,d,l,f,v,h.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 h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;0!=t&&(l+=(a.arotation+this.data.offsetRotation)*t);var u=h.ax,c=h.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=h.ascaleX,f=h.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=h.ashearY;0!=r&&(v+=(a.ashearY+this.data.offsetShearY)*r),h.updateWorldTransformWith(u,c,l,d,f,h.ashearX,v)}},t}(),_t=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var n=0,r=t.bones.length;n<r;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(R(e,_)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==B.Percent,o=i.rotateMode,h=o==L.Tangent,l=o==L.ChainScale,u=this.bones.length,c=h?u:u+1,d=this.bones,f=x.setArraySize(this.spaces,c),v=null,p=this.spacing;if(l||!s){l&&(v=x.setArraySize(this.lengths,u));for(var g=i.spacingMode==B.Length,m=0,w=c-1;m<w;){var y=d[m],b=y.data.length;if(b<t.epsilon)l&&(v[m]=0),f[++m]=0;else if(s){if(l){var S=b*y.a,M=b*y.c,A=Math.sqrt(S*S+M*M);v[m]=A}f[++m]=p}else{var I=b*y.a,T=b*y.c,C=Math.sqrt(I*I+T*T);l&&(v[m]=C),f[++m]=(g?b+p:p)*C/b}}}else for(var k=1;k<c;k++)f[k]=p;var V=this.computeWorldPositions(e,c,h,i.positionMode==O.Percent,s),P=V[0],F=V[1],N=i.offsetRotation,X=!1;if(0==N)X=o==L.Chain;else{X=!1;var Y=this.target.bone;N*=Y.a*Y.d-Y.b*Y.c>0?E.degRad:-E.degRad}for(var D=0,U=3;D<u;D++,U+=3){var W=d[D];W.worldX+=(P-W.worldX)*r,W.worldY+=(F-W.worldY)*r;var q=V[U],H=V[U+1],G=q-P,j=H-F;if(l){var z=v[D];if(0!=z){var Z=(Math.sqrt(G*G+j*j)/z-1)*n+1;W.a*=Z,W.c*=Z}}if(P=q,F=H,a){var Q=W.a,J=W.b,K=W.c,$=W.d,tt=0,et=0,nt=0;if(tt=h?V[U-1]:0==f[D+1]?V[U+2]:Math.atan2(j,G),tt-=Math.atan2(K,Q),X){et=Math.cos(tt),nt=Math.sin(tt);var rt=W.data.length;P+=(rt*(et*Q-nt*K)-G)*n,F+=(rt*(nt*Q+et*K)-j)*n}else tt+=N;tt>E.PI?tt-=E.PI2:tt<-E.PI&&(tt+=E.PI2),tt*=n,et=Math.cos(tt),nt=Math.sin(tt),W.a=et*Q-nt*K,W.b=et*J-nt*$,W.c=nt*Q+et*K,W.d=nt*J+et*$}W.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,h=this.spaces,l=x.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,g=p[f-=c?1:2];if(a&&(o*=g),i)for(var m=1;m<n;m++)h[m]*=g;u=x.setArraySize(this.world,8);for(var w=0,E=0,y=0;w<n;w++,E+=3){var b=h[w],S=o+=b;if(c)(S%=g)<0&&(S+=g),y=0;else{if(S<0){v!=t.BEFORE&&(v=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(S,u,0,l,E);continue}if(S>g){v!=t.AFTER&&(v=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(S-g,u,0,l,E);continue}}for(;;y++){var M=p[y];if(!(S>M)){if(0==y)S/=M;else{var A=p[y-1];S=(S-A)/(M-A)}break}}y!=v&&(v=y,c&&y==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*y+2,8,u,0,2)),this.addCurvePosition(S,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],l,E,r||w>0&&0==b)}return l}c?(d+=2,u=x.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=x.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var R=x.setArraySize(this.curves,f),I=0,T=u[0],C=u[1],_=0,k=0,V=0,P=0,F=0,N=0,O=0,B=0,L=0,X=0,Y=0,D=0,U=0,W=0,q=0,H=2;q<f;q++,H+=6)_=u[H],k=u[H+1],V=u[H+2],P=u[H+3],Y=2*(O=.1875*(T-2*_+V))+(L=.09375*(3*(_-V)-T+(F=u[H+4]))),D=2*(B=.1875*(C-2*k+P))+(X=.09375*(3*(k-P)-C+(N=u[H+5]))),U=.75*(_-T)+O+.16666667*L,W=.75*(k-C)+B+.16666667*X,I+=Math.sqrt(U*U+W*W),U+=Y,W+=D,Y+=L,D+=X,I+=Math.sqrt(U*U+W*W),U+=Y,W+=D,I+=Math.sqrt(U*U+W*W),U+=Y+L,W+=D+X,I+=Math.sqrt(U*U+W*W),R[q]=I,T=F,C=N;if(o*=a?I:I/e.lengths[f-1],i)for(var G=1;G<n;G++)h[G]*=I;for(var j=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<n;Z++,Q+=3){var $=h[Z],tt=o+=$;if(c)(tt%=I)<0&&(tt+=I),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,l,Q);continue}if(tt>I){this.addAfterPosition(tt-I,u,d-4,l,Q);continue}}for(;;J++){var et=R[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=R[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=v){v=J;var rt=6*J;for(T=u[rt],C=u[rt+1],_=u[rt+2],k=u[rt+3],V=u[rt+4],P=u[rt+5],Y=2*(O=.03*(T-2*_+V))+(L=.006*(3*(_-V)-T+(F=u[rt+6]))),D=2*(B=.03*(C-2*k+P))+(X=.006*(3*(k-P)-C+(N=u[rt+7]))),U=.3*(_-T)+O+.16666667*L,W=.3*(k-C)+B+.16666667*X,z=Math.sqrt(U*U+W*W),j[0]=z,rt=1;rt<8;rt++)U+=Y,W+=D,Y+=L,D+=X,z+=Math.sqrt(U*U+W*W),j[rt]=z;U+=Y,W+=D,z+=Math.sqrt(U*U+W*W),j[8]=z,U+=Y+L,W+=D+X,z+=Math.sqrt(U*U+W*W),j[9]=z,K=0}for(tt*=z;;K++){var at=j[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=j[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,T,C,_,k,V,P,F,N,l,Q,r||Z>0&&0==$)}return l},e.addBeforePosition=function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,h=e[n+3]-s,l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l},e.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],h=s-e[n+1],l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l},e.addCurvePosition=function(t,e,n,r,a,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=n,void(l[u+2]=Math.atan2(a-n,r-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+r*E+i*x+o*f,b=n*g+a*E+s*x+h*f;l[u]=y,l[u+1]=b,c&&(l[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(b-(n*p+a*m*2+s*d),y-(e*p+r*m*2+i*d)))},t}();_t.NONE=-1,_t.BEFORE=-2,_t.AFTER=-3,_t.epsilon=1e-5;var kt=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var n=t.bones[e],r=void 0;if(null==n.parent)r=new Rt(n,this,null);else{var a=this.bones[n.parent.index];r=new Rt(n,this,a),a.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],h=new It(s,o);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(var l=0;l<t.ikConstraints.length;l++){var u=t.ikConstraints[l];this.ikConstraints.push(new Tt(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new Ct(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var v=t.pathConstraints[f];this.pathConstraints.push(new _t(v,this))}this.color=new w(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 h=this.bones[i[s].index];do{h.sorted=!1,h.active=!0,h=h.parent}while(null!=h)}var l=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=l.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=l[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&&x.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&&x.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();R(s,_)&&this.sortPathConstraintAttachmentWith(s,r);for(var o=t.bones,h=o.length,l=0;l<h;l++)this.sortBone(o[l]);this._updateCache.push(t);for(var u=0;u<h;u++)this.sortReset(o[u].children);for(var c=0;c<h;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&x.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(R(t,_)){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,h=0,l=o.length;h<l;h++){var u=o[h],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;x.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,h=0,l=r.length;h<l;h++){var u=r[h];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(R(f,A))c=8,d=x.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(R(f,T)){var v=f;c=v.worldVerticesLength,d=x.setArraySize(n,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}(),Vt=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Nt(this),this.propertyIDs=new m,this.animationsChanged=!1,this.trackEntryPool=new y((function(){return new Ft})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n<r;n++){var a=e[n];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(n,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.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 h=0==i?q.first:o.mixBlend,l=o.alpha;null!=o.mixingFrom?l*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&null==o.next&&(l=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==l||h==q.add)for(var v=0;v<d;v++){x.webkit602BugfixHelper(l,h);var p=f[v];R(p,at)?this.applyAttachmentTimeline(p,e,c,h,!0):p.apply(e,u,c,n,l,h,H.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&x.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,E=0;E<d;E++){var y=f[E],b=g[E]==t.SUBSEQUENT?h:q.setup;R(y,K)?this.applyRotateTimeline(y,e,c,l,b,w,E<<1,m):R(y,at)?this.applyAttachmentTimeline(y,e,c,h,!0):(x.webkit602BugfixHelper(l,h),y.apply(e,u,c,n,l,b,H.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var S=this.unkeyedState+t.SETUP,M=e.slots,A=0,I=e.slots.length;A<I;A++){var T=M[A];if(T.attachmentState==S){var C=T.data.attachmentName;T.attachment=null==C?null:e.getAttachment(T.data.index,C)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,n,r){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,n,r);var i=0;0==e.mixDuration?(i=1,r==q.first&&(r=q.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=q.first&&(r=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,h=i<a.drawOrderThreshold,l=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==q.add)for(var p=0;p<c;p++)d[p].apply(n,l,u,s,v,r,H.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&x.setArraySize(a.timelinesRotation,c<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var y=0;y<c;y++){var b=d[y],S=H.mixOut,M=void 0,A=0;switch(g[y]){case t.SUBSEQUENT:if(!h&&R(b,ht))continue;M=r,A=v;break;case t.FIRST:M=q.setup,A=v;break;case t.HOLD_SUBSEQUENT:M=r,A=f;break;case t.HOLD_FIRST:M=q.setup,A=f;break;default:M=q.setup;var I=m[y];A=f*Math.max(0,1-I.mixTime/I.mixDuration)}a.totalAlpha+=A,R(b,K)?this.applyRotateTimeline(b,n,u,A,M,E,y<<1,w):R(b,at)?this.applyAttachmentTimeline(b,n,u,M,o):(x.webkit602BugfixHelper(A,r),h&&R(b,ht)&&M==q.setup&&(S=H.mixIn),b.apply(n,l,u,s,A,M,S))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,n,r,a,i){var s=n.slots[e.slotIndex];if(s.bone.active){var o,h=e.frames;if(r<h[0])a!=q.setup&&a!=q.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=h[h.length-1]?h.length-1:Q.binarySearch(h,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 h=t,l=h.frames,u=e.bones[h.boneIndex];if(u.active){var c=0,d=0;if(n<l[0])switch(a){case q.setup:u.rotation=u.data.rotation;default:return;case q.first:c=u.rotation,d=u.data.rotation}else if(c=a==q.setup?u.data.rotation:u.rotation,n>=l[l.length-K.ENTRIES])d=u.data.rotation+l[l.length+K.PREV_ROTATION];else{var f=Q.binarySearch(l,n,K.ENTRIES),v=l[f+K.PREV_ROTATION],p=l[f],g=h.getCurvePercent((f>>1)-1,1-(n-p)/(l[f+K.PREV_TIME]-p));d=l[f+K.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 x=0,y=0;o?(x=0,y=w):(x=i[s],y=i[s+1]);var b=w>0,S=x>=0;E.signum(y)!=E.signum(w)&&Math.abs(y)<=90&&(Math.abs(x)>180&&(x+=360*E.signum(x)),S=b),m=w+x-x%360,S!=b&&(m+=360*E.signum(x)),i[s]=m}i[s+1]=w,c+=m*r,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,n,null,1,a,H.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,h=s.length;o<h;o++){var l=s[o];if(l.time<i)break;l.time>r||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast<r)&&this.queue.complete(t);o<h;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]:(x.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=q.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==q.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=x.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=x.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var h=0;h<a;h++)i[h]=o.add(r[h].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var l=0;l<a;l++){var u=r[l],c=u.getPropertyId();if(o.add(c))if(null==n||R(u,at)||R(u,ht)||R(u,ot)||!n.animation.hasTimeline(c))i[l]=t.FIRST;else{for(var d=n.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[l]=t.HOLD_MIX,s[l]=d;continue t}break}i[l]=t.HOLD_FIRST}else i[l]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Vt.emptyAnimation=new Q("<empty>",[],0),Vt.SUBSEQUENT=0,Vt.FIRST=1,Vt.HOLD_SUBSEQUENT=2,Vt.HOLD_FIRST=3,Vt.HOLD_MIX=4,Vt.SETUP=1,Vt.CURRENT=2;var Pt,Ft=function(){function t(){this.mixBlend=q.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},t}(),Nt=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n<t.length;n+=2){var r=t[n],a=t[n+1];switch(r){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var h=0;h<e.length;h++)e[h].dispose&&e[h].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var l=0;l<e.length;l++)e[l].complete&&e[l].complete(a);break;case 5:var u=t[2+n++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Pt||(Pt={}));var Ot=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}(),Bt=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 y((function(){return new Array})),this.polygonIndicesPool=new y((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,h=r;o<h;++o)s[o]=t.isConcave(o,r,n,a);var l=this.triangles;for(l.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,g=n[f],m=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,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)%r}l.push(a[(r+c-1)%r]),l.push(a[c]),l.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var R=(--r+c-1)%r,I=c==r?0:c;s[R]=t.isConcave(R,r,n,a),s[I]=t.isConcave(I,r,n,a)}return 3==r&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l},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 h=-1,l=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],g=r[d+1],m=r[f],w=r[f+1],E=r[v],x=r[v+1],y=!1;if(h==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==l&&M==l&&(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),l=t.winding(p,g,m,w,E,x),h=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 I=s[0],T=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 Y=i[X];if(3==Y.length){var D=Y[0],U=Y[1],W=Y[2],q=a[X],H=q[q.length-2],G=q[q.length-1];if(D==I&&U==T){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,Y.length=0,o.push(H),o.push(G),s.push(W),_=V,k=P,V=H,P=G,X=0)}}}for(var Z=a.length-1;Z>=0;Z--)0==(o=a[Z]).length&&(a.splice(Z,1),this.polygonPool.free(o),s=i[Z],i.splice(Z,1),this.polygonIndicesPool.free(s));return a},t.isConcave=function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,s=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[s],n[s+1])},t.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},t.winding=function(t,e,n,r,a,i){var s=n-t,o=r-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),Lt=function(){function t(){this.triangulator=new Bt,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=x.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,h=s.length;o<h;o++){var l=s[o];t.makeClockwise(l),l.push(l[0]),l.push(l[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 h=this.clipOutput,l=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,v=0;l.length=0,u.length=0;t:for(var p=0;p<r;p+=3)for(var g=n[p]<<1,m=t[g],w=t[g+1],E=a[g],y=a[g+1],b=t[g=n[p+1]<<1],S=t[g+1],M=a[g],A=a[g+1],R=t[g=n[p+2]<<1],I=t[g+1],T=a[g],C=a[g+1],_=0;_<d;_++){var k=l.length;if(!this.clip(m,w,b,S,R,I,c[_],h)){var V=x.setArraySize(l,k+3*f);V[k]=m,V[k+1]=w,V[k+2]=i.r,V[k+3]=i.g,V[k+4]=i.b,V[k+5]=i.a,o?(V[k+6]=E,V[k+7]=y,V[k+8]=s.r,V[k+9]=s.g,V[k+10]=s.b,V[k+11]=s.a,V[k+12]=b,V[k+13]=S,V[k+14]=i.r,V[k+15]=i.g,V[k+16]=i.b,V[k+17]=i.a,V[k+18]=M,V[k+19]=A,V[k+20]=s.r,V[k+21]=s.g,V[k+22]=s.b,V[k+23]=s.a,V[k+24]=R,V[k+25]=I,V[k+26]=i.r,V[k+27]=i.g,V[k+28]=i.b,V[k+29]=i.a,V[k+30]=T,V[k+31]=C,V[k+32]=s.r,V[k+33]=s.g,V[k+34]=s.b,V[k+35]=s.a):(V[k+6]=E,V[k+7]=y,V[k+8]=b,V[k+9]=S,V[k+10]=i.r,V[k+11]=i.g,V[k+12]=i.b,V[k+13]=i.a,V[k+14]=M,V[k+15]=A,V[k+16]=R,V[k+17]=I,V[k+18]=i.r,V[k+19]=i.g,V[k+20]=i.b,V[k+21]=i.a,V[k+22]=T,V[k+23]=C),k=u.length;var P=x.setArraySize(u,k+3);P[k]=v,P[k+1]=v+1,P[k+2]=v+2,v+=3;continue t}var F=h.length;if(0!=F){for(var N=S-I,O=R-b,B=m-R,L=I-w,X=1/(N*B+O*(w-I)),Y=F>>1,D=this.clipOutput,U=x.setArraySize(l,k+Y*f),W=0;W<F;W+=2){var q=D[W],H=D[W+1];U[k]=q,U[k+1]=H,U[k+2]=i.r,U[k+3]=i.g,U[k+4]=i.b,U[k+5]=i.a;var G=q-R,j=H-I,z=(N*G+O*j)*X,Z=(L*G+B*j)*X,Q=1-z-Z;U[k+6]=E*z+M*Z+T*Q,U[k+7]=y*z+A*Z+C*Q,o&&(U[k+8]=s.r,U[k+9]=s.g,U[k+10]=s.b,U[k+11]=s.a),k+=f}k=u.length;var J=x.setArraySize(u,k+3*(Y-2));Y--;for(var K=1;K<Y;K++)J[k]=v,J[k+1]=v+K,J[k+2]=v+K+1,k+=3;v+=Y+1}}},e.clip=function(t,e,n,r,a,i,s,o){var h=o,l=!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],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],R=x[S+2],I=x[S+3],T=w*(I-m)-E*(R-g)>0;if(w*(A-m)-E*(M-g)>0){if(T){o.push(R),o.push(I);continue}var C=I-A,_=R-M,k=C*(g-v)-_*(m-p);if(Math.abs(k)>1e-6){var V=(_*(p-A)-C*(v-M))/k;o.push(v+(g-v)*V),o.push(p+(m-p)*V)}else o.push(v),o.push(p)}else if(T){var P=I-A,F=R-M,N=P*(g-v)-F*(m-p);if(Math.abs(N)>1e-6){var O=(F*(p-A)-P*(v-M))/N;o.push(v+(g-v)*O),o.push(p+(m-p)*O)}else o.push(v),o.push(p);o.push(R),o.push(I)}l=!0}if(b==o.length)return h.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(h!=o){h.length=0;for(var L=0,X=o.length-2;L<X;L++)h[L]=o[L]}else h.length=h.length-2;return l},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,h=n-3;o<h;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 l=0,u=n-2,c=n>>1;l<c;l+=2){var d=e[l],f=e[l+1],v=u-l;e[l]=e[v],e[l+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),Xt=function(){function t(){}var n=t.prototype;return n.initialize=function(t,n){var r=this._mesh=new e.BufferMesh(t),a=[new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0),new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0),new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)],i=4*Yt.VERTEX_STRIDE,s=i*n,o=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,s,e.BufferUsage.Dynamic),h=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic);this._indexBuffer=h,this._vertexBuffer=o,r.setVertexBufferBinding(o,i),r.setIndexBufferBinding(h,e.IndexFormat.UInt16),r.setVertexElements(a),r.addSubMesh(0,n)},n.changeBuffer=function(t,n){var r=4*Yt.VERTEX_STRIDE,a=r*n,i=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,a,e.BufferUsage.Dynamic),s=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic),o=this._mesh;this._indexBuffer=s,this._vertexBuffer=i,o.setVertexBufferBinding(i,r),o.setIndexBufferBinding(s,e.IndexFormat.UInt16)},Mt(t,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),t}(),Yt=function(){function t(t,e){this._clipper=new Lt,this._spineMesh=new Xt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this._engine=t,this._entity=e}var n=t.prototype;return n.initialize=function(n,r){if(n){var a=this._entity.getComponent(e.MeshRenderer);if(a){this._meshRenderer=a,r&&(this._setting=r);for(var i=n.defaultSkin.attachments,s=0,o=t.QUAD_TRIANGLES.length,h=0,l=i.length;h<l;h++){var u=i[h];for(var c in u){var d=u[c];if(d)if(R(d,A))s+=o;else{if(!R(d,T))continue;s+=d.triangles.length}}}this._vertexCount=s,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),a.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},n.buildMesh=function(n){var r=this._setting||{},a=r.useClipping,i=void 0===a||a,s=r.zSpacing,o=void 0===s?.01:s,h=0,l=0;this._subMeshItems.length=0;for(var u,c,d=this._meshRenderer,f=n.drawOrder,v=f.length,p=this._clipper,g=this._spineMesh,m=g.mesh,w=this._subMeshItems,E=this._vertices,x=0,y=0,b=0;b<v;b+=1){var S=f[b];if(S.bone.active){var M=S.getAttachment(),I=null,C=null,_=o*b,k=0,P=p.isClipping()?2:t.VERTEX_SIZE;if(R(M,A)){var F=M;I=F.color,E=this._vertices,k=4*P,F.computeWorldVertices(S.bone,E,0,P),u=t.QUAD_TRIANGLES,c=F.uvs,C=F.region.renderObject.texture}else if(R(M,T)){var N=M;I=N.color,E=this._vertices,(k=(N.worldVerticesLength>>1)*P)>E.length&&(E=this._vertices=new Float32Array(k)),N.computeWorldVertices(S,0,N.worldVerticesLength,E,0,P),u=N.triangles,c=N.uvs,C=N.region.renderObject.texture}else if(R(M,V)){if(i){var O=M;p.clipStart(S,O);continue}}else if(i){p.clipEndWithSlot(S);continue}if(null!=C){var B=void 0,L=void 0,X=void 0,Y=void 0,D=S.bone.skeleton.color,U=S.color,W=D.a*U.a*I.a,q=t.tempColor;if(q.set(D.r*U.r*I.r,D.g*U.g*I.g,D.b*U.b*I.b,W),p.isClipping()){p.clipTriangles(E,k,u,u.length,c,q,null,!1);var H=p.clippedVertices,G=p.clippedTriangles;B=H,L=H.length,X=G,Y=G.length}else{for(var j=E,z=2,Z=0,Q=k;z<Q;z+=P,Z+=2)j[z]=q.r,j[z+1]=q.g,j[z+2]=q.b,j[z+3]=q.a,j[z+4]=c[Z],j[z+5]=c[Z+1];B=E,L=k,X=u,Y=u.length}for(var J=h/t.VERTEX_STRIDE,K=this._verticesWithZ,$=h,tt=0;tt<L;)K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=_,K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++];h=$;var et=this._indices;for($=l,tt=0;tt<Y;$++,tt++)et[$]=X[tt]+J;var nt=S.data.name;if(this.separateSlots.includes(nt)){var rt=new e.SubMesh(l,Y);if(w.push({name:nt,subMesh:rt}),y>0){var at=new e.SubMesh(x,y);w.push({name:"default",subMesh:at}),y=0}x=l+Y}else y+=Y;l+=Y;for(var it=d.getMaterials(),st=it.length,ot=0;ot<st;ot+=1){var ht=it[ot];ht.shaderData.getTexture("material_SpineTexture")||ht.shaderData.setTexture("material_SpineTexture",C.texture)}}p.clipEndWithSlot(S)}else p.clipEndWithSlot(S)}if(p.clipEnd(),y>0){var lt=new e.SubMesh(x,y);w.push({name:"default",subMesh:lt}),y=0}if(w.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);m.clearSubMesh();for(var ut=w.length,ct=0;ct<ut;ct+=1)m.addSubMesh(w[ct].subMesh);this._needResize&&(g.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),g.vertexBuffer.setData(this._verticesWithZ),g.indexBuffer.setData(this._indices)},n.addSeparateSlot=function(t){this.separateSlots.push(t)},n._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},Mt(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();Yt.QUAD_TRIANGLES=[0,1,2,2,3,0],Yt.VERTEX_SIZE=8,Yt.VERTEX_STRIDE=9,Yt.tempColor=new w;var Dt=function(t){function n(r){var a,i=e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",n._spineVS,n._spineFS),s=(a=t.call(this,r,i)||this).renderState,o=s.blendState.targetBlendState;return o.enabled=!0,o.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,o.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.sourceAlphaBlendFactor=e.BlendFactor.One,o.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.colorBlendOperation=o.alphaBlendOperation=e.BlendOperation.Add,s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent,a}return r(n,t),n}(e.Material);Dt._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 ",Dt._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n ";var Ut=function(t){function n(e){var n;return(n=t.call(this,e)||this)._tempOffset=new b,n._tempSize=new b,n._tempArray=[0,0],n.autoUpdate=!0,n.autoUpdateBounds=!1,n._meshGenerator=new Yt(n.engine,e),n}r(n,t);var a=n.prototype;return a.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new kt(t);var n=new Ot(t);this._state=new Vt(n),this._meshGenerator.initialize(t,this.setting)},a.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!");var r=this.entity.getComponent(e.MeshRenderer);if(r||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)){this._meshGenerator.addSeparateSlot(t);var a=n._defaultMaterial.clone(),i=n._defaultMaterial.clone(),s=r.materialCount;r.setMaterial(s,a),r.setMaterial(s+1,i)}else console.warn("Slot: "+t+" not find.")},a.hackSeparateSlotTexture=function(t,n){this._meshGenerator.buildMesh(this._skeleton);var r=this._meshGenerator,a=r.separateSlots,i=r.subMeshItems;if(0!==a.length)if(a.includes(t)){var s=this.entity.getComponent(e.MeshRenderer),o=i.findIndex((function(e){return e.name===t}));s.getMaterial(o).shaderData.setTexture("material_SpineTexture",n)}else console.warn("Slot "+t+" is not separated. You should use addSeparateSlot to separate it");else console.warn("You need add separate slot")},a.onUpdate=function(t){this.autoUpdate&&this.updateState(t)},a.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()}},a.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},a.updateBounds=function(){var t,n=this.entity.getComponent(e.MeshRenderer).bounds,r=this._tempOffset,a=this._tempSize,i=this._tempArray,s=(null==(t=this.setting)?void 0:t.zSpacing)||.01,o=this._skeleton;o.getBounds(r,a,i);var h=o.drawOrder;n.min.set(r.x,r.y,0),n.max.set(r.x+a.x,r.y+a.y,h.length*s)},a._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=At({},this.setting);t.setting=e},a._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},a.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},n.getDefaultMaterial=function(t){return this._defaultMaterial||(this._defaultMaterial=new Dt(t),this._defaultMaterial.isGCIgnored=!0),this._defaultMaterial.clone()},Mt(n,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),n}(e.Script);a([e.ignoreClone],Ut.prototype,"_skeletonData",void 0),a([e.ignoreClone],Ut.prototype,"_skeleton",void 0),a([e.ignoreClone],Ut.prototype,"_state",void 0),a([e.ignoreClone],Ut.prototype,"_tempOffset",void 0),a([e.ignoreClone],Ut.prototype,"_tempSize",void 0),a([e.ignoreClone],Ut.prototype,"_tempArray",void 0),a([e.ignoreClone],Ut.prototype,"_meshGenerator",void 0),a([e.ignoreClone],Ut.prototype,"setting",void 0);var Wt=function(t){function n(){return t.apply(this,arguments)}r(n,t);var a=n.prototype;return a.load=function(t,n){var r=this;return new e.AssetPromise((function(e,a){"spine"!==t.type&&a("Asset type must be spine.");var i=null;t.urls?r.handleResource(n,t,i,e,a):r.request(t.url||"",{type:"json"}).then((function(s){s.jsonUrl&&s.atlasUrl&&s.pngUrl?(i=r.getResouceFromUrls([s.jsonUrl,s.atlasUrl,s.pngUrl]),r.handleResource(n,t,i,e,a)):r.handleResource(n,t,i,e,a)})).catch((function(s){r.handleResource(n,t,i,e,a)}))}))},a.handleResource=function(t,n,r,a,i){var s=this,o=t.engine;r||(!n.urls&&n.url&&this.checkUrl(n.url)&&(r=this.getResouceFromUrl(n.url)),n.urls&&this.checkUrls(n.urls)&&(r=this.getResouceFromUrls(n.urls)));var h,l=!1;h=new g(null,(function(t){return s.createAdaptiveTexture(t,o)}));var u=r.skeletonFile,c=r.atlasFile,f=r.textureFile;h.onLoadComplete=function(){try{var t;if(l)t=h.get(c);else{var n=h.get(c);t=new d(n,s.textureAssetPicker.bind(s,h,f))}var r=new P(t),v=(s.isBinFile(u)?new Et(r):new mt(r)).readSkeletonData(h.get(u)),p=new e.Entity(o),g=p.addComponent(e.MeshRenderer),m=Ut.getDefaultMaterial(o);g.setMaterial(m),p.addComponent(Ut).setSkeletonData(v),a(p)}catch(t){i(t)}};var v=this.isBinFile(u);u&&c&&f?(v?h.loadBinary(u,null,i):h.loadText(u,null,i),h.loadText(c,null,i),h.loadTexture(f,null,i)):u&&c&&!f?(l=!0,v?h.loadBinary(u,null,i):h.loadText(u,null,i),h.loadTextureAtlas(c,null,i)):i("Resouce param error")},a.textureAssetPicker=function(t,e){return t.get(e)},a.createAdaptiveTexture=function(t,e){return new qt(t,e)},a.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},a.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},a.getResouceFromUrl=function(t){var e=t,n=t,r=n.indexOf("?");return r>0&&(n=n.substr(0,r)),{skeletonFile:e,atlasFile:n=n.substr(0,n.lastIndexOf("."))+".atlas"}},a.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),n=e.skeletonFile,r=e.atlasFile;return e.textureFile,!(!n||!r)||(console.error("Lack "+(n?"":"skeletonFile")+(r?" atlasFile":"")),!1)},a.getResouceFromUrls=function(t){for(var e,n,r,a=0;a<t.length;a+=1){var i=t[a],s=this.getExtFromUrl(i);"json"!==s&&"bin"!==s||(e=i),"atlas"===s&&(n=i);["png","jpg","webp","jpeg"].includes(s)&&(r=i)}return{skeletonFile:e,atlasFile:n,textureFile:r}},a.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},n}(e.Loader);Wt=a([e.resourceLoader("spine",["json","bin"])],Wt);var qt=function(t){function n(n,r){var a;return(a=t.call(this,n)||this).texture=new e.Texture2D(r,n.width,n.height),a.texture.setImageSource(n),a.texture.generateMipmaps(),a}r(n,t);var a=n.prototype;return a.setFilters=function(t,n){t===o.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:n===o.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear},a.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},a.dispose=function(){},n}(l),Ht=function(t){function e(){var e;return(e=t.apply(this,arguments)||this)._animationName="",e._loop=!0,e._autoPlay=!0,e._scale=1,e._spineAnimation=null,e._animationNames=[],e}r(e,t);var n=e.prototype;return n.onDestroy=function(){this._resource.parent=null,this._resource.destroy(),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._removeResource=function(){this._resource&&this._spineAnimation&&(this.entity.removeChild(this._resource),this._resource.destroy(),this._resource=null,this._spineAnimation=null,this._animationName="")},Mt(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(Ut),this._spineAnimation.scale=this._scale,this._autoPlay)){var n=this._spineAnimation.skeletonData.animations,r=this._animationNames;r.length=0;for(var a=0,i=n.length;a<i;++a)r.push(n[a].name);r.length>0&&this.play(this._animationName||r[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:"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}(e.Script),Gt="1.1.0-beta.10";e.Loader.registerClass("SpineRenderer",Ht),console.log("Galacean spine version :"+Gt),t.AssetManager=g,t.AtlasAttachmentLoader=P,t.SkeletonBinary=Et,t.SkeletonJson=mt,t.SpineAnimation=Ut,t.SpineRenderer=Ht,t.Texture=l,t.TextureAtlas=d,t.version=Gt,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.Spine={}),t.Galacean)}(this,(function(t,e){"use strict";function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function a(t,e,n,r){var a,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function i(t,e){(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 s(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 i(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)?i(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 o,h,l=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"}(o||(o={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(h||(h={}));var u=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},c=function(t){function e(){return t.apply(this,arguments)}r(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(l),d=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 f(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 g;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 u=parseInt(r[0]),c=parseInt(r[1]);n.readTuple(r);var d=parseInt(r[0]),p=parseInt(r[1]);s.u=u/a.width,s.v=c/a.height,s.rotate?(s.u2=(u+p)/a.width,s.v2=(c+d)/a.height):(s.u2=(u+d)/a.width,s.v2=(c+p)/a.height),s.x=u,s.y=c,s.width=Math.abs(d),s.height=Math.abs(p),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 v).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=l.filterFromString(r[0]),a.magFilter=l.filterFromString(r[1]);var m=n.readValue();a.uWrap=h.ClampToEdge,a.vWrap=h.ClampToEdge,"x"==m?a.uWrap=h.Repeat:"y"==m?a.vWrap=h.Repeat:"xy"==m&&(a.uWrap=a.vWrap=h.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}(),f=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}(),v=function(){},g=function(t){function e(){return t.apply(this,arguments)}return r(e,t),e}(u),p=function(){function t(t,e){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this.pathPrefix=t||"",this.textureLoader=e}var n=t.prototype;return n.downloadText=function(t,n,r){e.request(t,{type:"text"}).then((function(t){n(t)})).catch((function(t){r(t)}))},n.downloadBinary=function(t,e,n){var r=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status?e(new Uint8Array(r.response)):n(r.status,r.responseText)},r.onerror=function(){n(r.status,r.responseText)},r.send()},n.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},n.loadBinary=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e,a){r.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,n&&n("Couldn't load binary "+t+": status "+status+", "+a),r.onLoad(),r.loaded++}))},n.loadText=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e){r.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),n&&n("Couldn't load text "+t+": "+JSON.stringify(e)),r.onLoad(),r.loaded++}))},n.loadImage=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this,a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(n){r.assets[a]=i,r.onLoad(),r.loaded++,e&&e(t,i)},i.onerror=function(e){r.errors[t]="Couldn't load image "+t,r.onLoad(),r.loaded++,n&&n("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},n.loadTexture=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),e.request(t,{type:"image"}).then((function(e){var r=a.textureLoader(e);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(t,r)})).catch((function(t){r(t)}))},n.loadTextureAtlas=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this,a=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(i){var o=function(){var s=f.value,o=!1;r.loadTexture(s,(function(s,u){if(h.count++,h.count==l.length)if(o)r.errors[t]="Couldn't load texture atlas page "+s+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+s+" of atlas "+t),r.onLoad(),r.loaded++;else try{var c=new d(i,(function(t){return r.get(""==a?t:a+"/"+t)}));r.assets[t]=c,e&&e(t,c),r.onLoad(),r.loaded++}catch(e){var f=e;r.errors[t]="Couldn't load texture atlas "+t+": "+f.message,n&&n("Couldn't load texture atlas "+t+": "+f.message),r.onLoad(),r.loaded++}}),(function(e){o=!0,h.count++,h.count==l.length&&(r.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+e+" of atlas "+t),r.onLoad(),r.loaded++)}))},h={count:0},l=new Array;try{new d(i,(function(t){l.push(""==a?t:a+"/"+t);var e=document.createElement("img");return e.width=16,e.height=16,new c(e)}))}catch(e){var u=e;return r.errors[t]="Couldn't load texture atlas "+t+": "+u.message,n&&n("Couldn't load texture atlas "+t+": "+u.message),r.onLoad(),void r.loaded++}for(var f,v=s(l);!(f=v()).done;)o()}),(function(e){r.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),n&&n("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),r.onLoad(),r.loaded++}))},n.get=function(t){return t=this.pathPrefix+t,this.assets[t]},n.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},n.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},n.isLoadingComplete=function(){return 0==this.toLoad},n.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},n.getToLoad=function(){return this.toLoad},n.getLoaded=function(){return this.loaded},n.dispose=function(){this.removeAll()},n.hasErrors=function(){return Object.keys(this.errors).length>0},n.getErrors=function(){return this.errors},t}();var m=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}(),w=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}();w.WHITE=new w(1,1,1,1),w.RED=new w(1,0,0,1),w.GREEN=new w(0,1,0,1),w.BLUE=new w(0,0,1,1),w.MAGENTA=new w(1,0,1,1);var E=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}();E.PI=3.1415927,E.PI2=2*E.PI,E.radiansToDegrees=180/E.PI,E.radDeg=E.radiansToDegrees,E.degreesToRadians=E.PI/180,E.degRad=E.degreesToRadians;var x=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}();x.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var y=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}(),b=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}(),S=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},M=function(t){function e(n){var r;return(r=t.call(this,n)||this).id=(65535&e.nextID++)<<11,r.worldVerticesLength=0,r.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r),r}r(e,t);var n=e.prototype;return n.computeWorldVertices=function(t,e,n,r,a,i){n=a+(n>>1)*i;var s=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,d=0;d<e;d+=2){var f=l[u];u+=f+1,c+=f}var v=s.bones;if(0==o.length)for(var g=a,p=3*c;g<n;g+=i){var m=0,w=0,E=l[u++];for(E+=u;u<E;u++,p+=3){var x=v[l[u]],y=h[p],b=h[p+1],S=h[p+2];m+=(y*x.a+b*x.b+x.worldX)*S,w+=(y*x.c+b*x.d+x.worldY)*S}r[g]=m,r[g+1]=w}else for(var M=o,A=a,R=3*c,I=c<<1;A<n;A+=i){var T=0,C=0,_=l[u++];for(_+=u;u<_;u++,R+=3,I+=2){var k=v[l[u]],V=h[R]+M[I],P=h[R+1]+M[I+1],F=h[R+2];T+=(V*k.a+P*k.b+k.worldX)*F,C+=(V*k.c+P*k.d+k.worldY)*F}r[A]=T,r[A+1]=C}}else{o.length>0&&(h=o);for(var N=t.bone,O=N.worldX,B=N.worldY,L=N.a,X=N.b,Y=N.c,D=N.d,U=e,W=a;W<n;U+=2,W+=i){var q=h[U],H=h[U+1];r[W]=q*L+H*X+O,r[W+1]=q*Y+H*D+B}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),x.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=x.newFloatArray(this.vertices.length),x.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(S);M.nextID=0;var A=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 w(1,1,1,1),n.offset=x.newFloatArray(8),n.uvs=x.newFloatArray(8),n.tempColor=new w(1,1,1,1),n}r(e,t);var n=e.prototype;return n.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*n,i=r+this.region.width*t,s=a+this.region.height*n,o=this.rotation*Math.PI/180,h=Math.cos(o),l=Math.sin(o),u=r*h+this.x,c=r*l,d=a*h+this.y,f=a*l,v=i*h+this.x,g=i*l,p=s*h+this.y,m=s*l,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-m,w[e.OY2]=p+c,w[e.OX3]=v-m,w[e.OY3]=p+g,w[e.OX4]=v-f,w[e.OY4]=d+g},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,h=t.a,l=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX2],f=i[e.OY2],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX3],f=i[e.OY3],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX4],f=i[e.OY4],n[r]=d*h+f*l+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,x.arrayCopy(this.uvs,0,t.uvs,0,8),x.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(S);function R(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}A.OX1=0,A.OY1=1,A.OX2=2,A.OY2=3,A.OX3=4,A.OY3=5,A.OX4=6,A.OY4=7,A.X1=0,A.Y1=1,A.C1R=2,A.C1G=3,A.C1B=4,A.C1A=5,A.U1=6,A.V1=7,A.X2=8,A.Y2=9,A.C2R=10,A.C2G=11,A.C2B=12,A.C2A=13,A.U2=14,A.V2=15,A.X3=16,A.Y3=17,A.C3R=18,A.C3G=19,A.C3B=20,A.C3A=21,A.U3=22,A.V3=23,A.X4=24,A.Y4=25,A.C4R=26,A.C4G=27,A.C4B=28,A.C4A=29,A.U4=30,A.V4=31;var I,T=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(1,1,1,1),n.tempColor=new w(0,0,0,0),n}r(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=x.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(R(this.region,g)){var o=this.region,h=o.texture.getImage().width,l=o.texture.getImage().height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/l,i=o.originalHeight/h,s=o.originalWidth/l;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)/h,a-=o.offsetY/l,i=o.originalWidth/h,s=o.originalHeight/l;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/h,a-=o.offsetX/l,i=o.originalHeight/h,s=o.originalWidth/l;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/h,a-=(o.originalHeight-o.offsetY-o.height)/l,i=o.originalWidth/h,s=o.originalHeight/l}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),x.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),x.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),x.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),x.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}(M),C=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(M),_=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new w(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),x.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(M),k=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(.38,.94,0,1),n.name=e,n}r(e,t);var n=e.prototype;return n.computeWorldPosition=function(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e},n.computeWorldRotation=function(t){var e=E.cosDeg(this.rotation),n=E.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*E.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}(M),V=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new w(.2275,.2275,.8078,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(M),P=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 A(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 T(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new C(e)},e.newPathAttachment=function(t,e){return new _(e)},e.newPointAttachment=function(t,e){return new k(e)},e.newClippingAttachment=function(t,e){return new V(e)},t}(),F=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}(),N=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 w,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"}(I||(I={}));var O,B,L,X=function(t,e,n){if(this.color=new w(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},Y=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},D=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return r(e,t),e}(Y),U=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.rotateMix=0,n.translateMix=0,n.scaleMix=0,n.shearMix=0,n.offsetRotation=0,n.offsetX=0,n.offsetY=0,n.offsetScaleX=0,n.offsetScaleY=0,n.offsetShearY=0,n.relative=!1,n.local=!1,n}return r(e,t),e}(Y),W=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return r(e,t),e}(Y);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(O||(O={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(B||(B={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(L||(L={}));var q,H,G,j=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},z=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,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[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,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];null!=c.attachment&&(R(c.attachment,T)?(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 j(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 j(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 h=this.getAttachment(n,o);null!=h&&a.setAttachment(h);break}}}n++}},t}(),Z=function(t){this.name=t},Q=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 h=this.timelines,l=0,u=h.length;l<u;l++)h[l].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"}(q||(q={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(H||(H={})),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"}(G||(G={}));var J=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=x.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),h=.006*(3*(n-a)+1),l=.006*(3*(r-i)+1),u=2*s+h,c=2*o+l,d=.3*n+s+.16666667*h,f=.3*r+o+.16666667*l,v=e*t.BEZIER_SIZE,g=this.curves;g[v++]=t.BEZIER;for(var p=d,m=f,w=v+t.BEZIER_SIZE-1;v<w;v+=2)g[v]=p,g[v+1]=m,d+=u,f+=c,u+=h,c+=l,p+=d,m+=f},e.getCurvePercent=function(e,n){n=E.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,h=a+t.BEZIER_SIZE-1;a<h;a+=2)if((s=r[a])>=n){var l=void 0,u=void 0;return a==o?(l=0,u=0):(l=r[a-2],u=r[a-1]),u+(r[a+1]-u)*(n-l)/(s-l)}var c=r[a-1];return c+(1-c)*(n-s)/(1-s)},t}();J.LINEAR=0,J.STEPPED=1,J.BEZIER=2,J.BEZIER_SIZE=19;var K=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=x.newFloatArray(e<<1),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return 0+this.boneIndex},n.setFrame=function(t,n,r){t<<=1,this.frames[t]=n,this.frames[t+e.ROTATION]=r},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.rotation=l.data.rotation);case 1:var u=l.data.rotation-l.rotation;l.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(r>=h[h.length-e.ENTRIES]){var c=h[h.length+e.PREV_ROTATION];switch(s){case 0:l.rotation=l.data.rotation+c*i;break;case 1:case 2:c+=l.data.rotation-l.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:l.rotation+=c*i}}else{var d=Q.binarySearch(h,r,e.ENTRIES),f=h[d+e.PREV_ROTATION],v=h[d],g=this.getCurvePercent((d>>1)-1,1-(r-v)/(h[d+e.PREV_TIME]-v)),p=h[d+e.ROTATION]-f;switch(p=f+(p-360*(16384-(16384.499999999996-p/360|0)))*g,s){case 0:l.rotation=l.data.rotation+(p-360*(16384-(16384.499999999996-p/360|0)))*i;break;case 1:case 2:p+=l.data.rotation-l.rotation;case 3:l.rotation+=(p-360*(16384-(16384.499999999996-p/360|0)))*i}}},e}(J);K.ENTRIES=2,K.PREV_TIME=-2,K.PREV_ROTATION=-1,K.ROTATION=1;var $=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(1<<24)+this.boneIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.X]=r,this.frames[t+e.Y]=a},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.x=l.data.x,void(l.y=l.data.y);case 1:l.x+=(l.data.x-l.x)*i,l.y+=(l.data.y-l.y)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.x=l.data.x+u*i,l.y=l.data.y+c*i;break;case 1:case 2:l.x+=(l.data.x+u-l.x)*i,l.y+=(l.data.y+c-l.y)*i;break;case 3:l.x+=u*i,l.y+=c*i}}},e}(J);$.ENTRIES=3,$.PREV_TIME=-3,$.PREV_X=-2,$.PREV_Y=-1,$.X=1,$.Y=2;var tt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(2<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case 1:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X]*l.data.scaleX,c=h[h.length+e.PREV_Y]*l.data.scaleY;else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u=(u+(h[d+e.X]-u)*v)*l.data.scaleX,c=(c+(h[d+e.Y]-c)*v)*l.data.scaleY}if(1==i)3==s?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{var g=0,p=0;if(1==o)switch(s){case 0:g=l.data.scaleX,p=l.data.scaleY,l.scaleX=g+(Math.abs(u)*E.signum(g)-g)*i,l.scaleY=p+(Math.abs(c)*E.signum(p)-p)*i;break;case 1:case 2:g=l.scaleX,p=l.scaleY,l.scaleX=g+(Math.abs(u)*E.signum(g)-g)*i,l.scaleY=p+(Math.abs(c)*E.signum(p)-p)*i;break;case 3:g=l.scaleX,p=l.scaleY,l.scaleX=g+(Math.abs(u)*E.signum(g)-l.data.scaleX)*i,l.scaleY=p+(Math.abs(c)*E.signum(p)-l.data.scaleY)*i}else switch(s){case 0:g=Math.abs(l.data.scaleX)*E.signum(u),p=Math.abs(l.data.scaleY)*E.signum(c),l.scaleX=g+(u-g)*i,l.scaleY=p+(c-p)*i;break;case 1:case 2:g=Math.abs(l.scaleX)*E.signum(u),p=Math.abs(l.scaleY)*E.signum(c),l.scaleX=g+(u-g)*i,l.scaleY=p+(c-p)*i;break;case 3:g=E.signum(u),p=E.signum(c),l.scaleX=Math.abs(l.scaleX)*g+(u-Math.abs(l.data.scaleX)*g)*i,l.scaleY=Math.abs(l.scaleY)*p+(c-Math.abs(l.data.scaleY)*p)*i}}}},e}($),et=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(3<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.shearX=l.data.shearX,void(l.shearY=l.data.shearY);case 1:l.shearX+=(l.data.shearX-l.shearX)*i,l.shearY+=(l.data.shearY-l.shearY)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.shearX=l.data.shearX+u*i,l.shearY=l.data.shearY+c*i;break;case 1:case 2:l.shearX+=(l.data.shearX+u-l.shearX)*i,l.shearY+=(l.data.shearY+c-l.shearY)*i;break;case 3:l.shearX+=u*i,l.shearY+=c*i}}},e}($),nt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(5<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},n.apply=function(t,n,r,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(r<l[0])switch(s){case 0:return void h.color.setFromColor(h.data.color);case 1:var u=h.color,c=h.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,g=0;if(r>=l[l.length-e.ENTRIES]){var p=l.length;d=l[p+e.PREV_R],f=l[p+e.PREV_G],v=l[p+e.PREV_B],g=l[p+e.PREV_A]}else{var m=Q.binarySearch(l,r,e.ENTRIES);d=l[m+e.PREV_R],f=l[m+e.PREV_G],v=l[m+e.PREV_B],g=l[m+e.PREV_A];var w=l[m],E=this.getCurvePercent(m/e.ENTRIES-1,1-(r-w)/(l[m+e.PREV_TIME]-w));d+=(l[m+e.R]-d)*E,f+=(l[m+e.G]-f)*E,v+=(l[m+e.B]-v)*E,g+=(l[m+e.A]-g)*E}if(1==i)h.color.set(d,f,v,g);else{var x=h.color;0==s&&x.setFromColor(h.data.color),x.add((d-x.r)*i,(f-x.g)*i,(v-x.b)*i,(g-x.a)*i)}}}},e}(J);nt.ENTRIES=5,nt.PREV_TIME=-5,nt.PREV_R=-4,nt.PREV_G=-3,nt.PREV_B=-2,nt.PREV_A=-1,nt.R=1,nt.G=2,nt.B=3,nt.A=4;var rt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(14<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s,o,h,l){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]=h,this.frames[t+e.B2]=l},n.apply=function(t,n,r,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(r<l[0])switch(s){case 0:return h.color.setFromColor(h.data.color),void h.darkColor.setFromColor(h.data.darkColor);case 1:var u=h.color,c=h.darkColor,d=h.data.color,f=h.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,g=0,p=0,m=0,w=0,E=0,x=0;if(r>=l[l.length-e.ENTRIES]){var y=l.length;v=l[y+e.PREV_R],g=l[y+e.PREV_G],p=l[y+e.PREV_B],m=l[y+e.PREV_A],w=l[y+e.PREV_R2],E=l[y+e.PREV_G2],x=l[y+e.PREV_B2]}else{var b=Q.binarySearch(l,r,e.ENTRIES);v=l[b+e.PREV_R],g=l[b+e.PREV_G],p=l[b+e.PREV_B],m=l[b+e.PREV_A],w=l[b+e.PREV_R2],E=l[b+e.PREV_G2],x=l[b+e.PREV_B2];var S=l[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(r-S)/(l[b+e.PREV_TIME]-S));v+=(l[b+e.R]-v)*M,g+=(l[b+e.G]-g)*M,p+=(l[b+e.B]-p)*M,m+=(l[b+e.A]-m)*M,w+=(l[b+e.R2]-w)*M,E+=(l[b+e.G2]-E)*M,x+=(l[b+e.B2]-x)*M}if(1==i)h.color.set(v,g,p,m),h.darkColor.set(w,E,x,1);else{var A=h.color,R=h.darkColor;0==s&&(A.setFromColor(h.data.color),R.setFromColor(h.data.darkColor)),A.add((v-A.r)*i,(g-A.g)*i,(p-A.b)*i,(m-A.a)*i),R.add((w-R.r)*i,(E-R.g)*i,(x-R.b)*i,0)}}}},e}(J);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 at=function(){function t(t){this.frames=x.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 h=this.frames;if(n<h[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var l=0;l=n>=h[h.length-1]?h.length-1:Q.binarySearch(h,n,1)-1;var u=this.attachmentNames[l];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}(),it=null,st=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=x.newFloatArray(e),n.frameVertices=new Array(e),null==it&&(it=x.newFloatArray(64)),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},n.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},n.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.getAttachment();if(R(h,M)&&h.deformAttachment==this.attachment){var l=o.deform;0==l.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(n<d[0]){var f=h;switch(i){case 0:return void(l.length=0);case 1:if(1==a){l.length=0;break}var v=x.setArraySize(l,c);if(null==f.bones)for(var g=f.vertices,p=0;p<c;p++)v[p]+=(g[p]-v[p])*a;else{a=1-a;for(p=0;p<c;p++)v[p]*=a}}}else{var m=x.setArraySize(l,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var E=h;if(null==E.bones)for(var y=E.vertices,b=0;b<c;b++)m[b]+=w[b]-y[b];else for(var S=0;S<c;S++)m[S]+=w[S]}else x.arrayCopy(w,0,m,0,c);else switch(i){case 0:var A=h;if(null==A.bones)for(var I=A.vertices,T=0;T<c;T++){var C=I[T];m[T]=C+(w[T]-C)*a}else for(var _=0;_<c;_++)m[_]=w[_]*a;break;case 1:case 2:for(var k=0;k<c;k++)m[k]+=(w[k]-m[k])*a;break;case 3:var V=h;if(null==V.bones)for(var P=V.vertices,F=0;F<c;F++)m[F]+=(w[F]-P[F])*a;else for(var N=0;N<c;N++)m[N]+=w[N]*a}}else{var O=Q.binarySearch(d,n),B=u[O-1],L=u[O],X=d[O],Y=this.getCurvePercent(O-1,1-(n-X)/(d[O-1]-X));if(1==a)if(3==i){var D=h;if(null==D.bones)for(var U=D.vertices,W=0;W<c;W++){var q=B[W];m[W]+=q+(L[W]-q)*Y-U[W]}else for(var H=0;H<c;H++){var G=B[H];m[H]+=G+(L[H]-G)*Y}}else for(var j=0;j<c;j++){var z=B[j];m[j]=z+(L[j]-z)*Y}else switch(i){case 0:var Z=h;if(null==Z.bones)for(var J=Z.vertices,K=0;K<c;K++){var $=B[K],tt=J[K];m[K]=tt+($+(L[K]-$)*Y-tt)*a}else for(var et=0;et<c;et++){var nt=B[et];m[et]=(nt+(L[et]-nt)*Y)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var at=B[rt];m[rt]+=(at+(L[rt]-at)*Y-m[rt])*a}break;case 3:var it=h;if(null==it.bones)for(var st=it.vertices,ot=0;ot<c;ot++){var ht=B[ot];m[ot]+=(ht+(L[ot]-ht)*Y-st[ot])*a}else for(var lt=0;lt<c;lt++){var ut=B[lt];m[lt]+=(ut+(L[lt]-ut)*Y)*a}}}}}}},e}(J),ot=function(){function t(t){this.frames=x.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,h=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[h-1])return;if(!(n<o[0])){var l=0;if(e<o[0])l=0;else for(var u=o[l=Q.binarySearch(o,e)];l>0&&o[l-1]==u;)l--;for(;l<h&&n>=o[l];l++)r.push(this.events[l])}}},t}(),ht=function(){function t(t){this.frames=x.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,h=t.slots;if(1!=s){var l=this.frames;if(n<l[0])0!=i&&1!=i||x.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=l[l.length-1]?l.length-1:Q.binarySearch(l,n)-1;var c=this.drawOrders[u];if(null==c)x.arrayCopy(h,0,o,0,h.length);else for(var d=0,f=c.length;d<f;d++)o[d]=h[c[d]]}}else 0==i&&x.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),lt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},n.setFrame=function(t,n,r,a,i,s,o){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.MIX]=r,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,void(l.stretch=l.data.stretch);case 1:l.mix+=(l.data.mix-l.mix)*i,l.softness+=(l.data.softness-l.softness)*i,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}else if(r>=h[h.length-e.ENTRIES])0==s?(l.mix=l.data.mix+(h[h.length+e.PREV_MIX]-l.data.mix)*i,l.softness=l.data.softness+(h[h.length+e.PREV_SOFTNESS]-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH])):(l.mix+=(h[h.length+e.PREV_MIX]-l.mix)*i,l.softness+=(h[h.length+e.PREV_SOFTNESS]-l.softness)*i,0==o&&(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH]));else{var u=Q.binarySearch(h,r,e.ENTRIES),c=h[u+e.PREV_MIX],d=h[u+e.PREV_SOFTNESS],f=h[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(r-f)/(h[u+e.PREV_TIME]-f));0==s?(l.mix=l.data.mix+(c+(h[u+e.MIX]-c)*v-l.data.mix)*i,l.softness=l.data.softness+(d+(h[u+e.SOFTNESS]-d)*v-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH])):(l.mix+=(c+(h[u+e.MIX]-c)*v-l.mix)*i,l.softness+=(d+(h[u+e.SOFTNESS]-d)*v-l.softness)*i,0==o&&(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH]))}},e}(J);lt.ENTRIES=6,lt.PREV_TIME=-6,lt.PREV_MIX=-5,lt.PREV_SOFTNESS=-4,lt.PREV_BEND_DIRECTION=-3,lt.PREV_COMPRESS=-2,lt.PREV_STRETCH=-1,lt.MIX=1,lt.SOFTNESS=2,lt.BEND_DIRECTION=3,lt.COMPRESS=4,lt.STRETCH=5;var ut=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(l.active)if(r<h[0]){var u=l.data;switch(s){case 0:return l.rotateMix=u.rotateMix,l.translateMix=u.translateMix,l.scaleMix=u.scaleMix,void(l.shearMix=u.shearMix);case 1:l.rotateMix+=(u.rotateMix-l.rotateMix)*i,l.translateMix+=(u.translateMix-l.translateMix)*i,l.scaleMix+=(u.scaleMix-l.scaleMix)*i,l.shearMix+=(u.shearMix-l.shearMix)*i}}else{var c=0,d=0,f=0,v=0;if(r>=h[h.length-e.ENTRIES]){var g=h.length;c=h[g+e.PREV_ROTATE],d=h[g+e.PREV_TRANSLATE],f=h[g+e.PREV_SCALE],v=h[g+e.PREV_SHEAR]}else{var p=Q.binarySearch(h,r,e.ENTRIES);c=h[p+e.PREV_ROTATE],d=h[p+e.PREV_TRANSLATE],f=h[p+e.PREV_SCALE],v=h[p+e.PREV_SHEAR];var m=h[p],w=this.getCurvePercent(p/e.ENTRIES-1,1-(r-m)/(h[p+e.PREV_TIME]-m));c+=(h[p+e.ROTATE]-c)*w,d+=(h[p+e.TRANSLATE]-d)*w,f+=(h[p+e.SCALE]-f)*w,v+=(h[p+e.SHEAR]-v)*w}if(0==s){var E=l.data;l.rotateMix=E.rotateMix+(c-E.rotateMix)*i,l.translateMix=E.translateMix+(d-E.translateMix)*i,l.scaleMix=E.scaleMix+(f-E.scaleMix)*i,l.shearMix=E.shearMix+(v-E.shearMix)*i}else l.rotateMix+=(c-l.rotateMix)*i,l.translateMix+=(d-l.translateMix)*i,l.scaleMix+=(f-l.scaleMix)*i,l.shearMix+=(v-l.shearMix)*i}},e}(J);ut.ENTRIES=5,ut.PREV_TIME=-5,ut.PREV_ROTATE=-4,ut.PREV_TRANSLATE=-3,ut.PREV_SCALE=-2,ut.PREV_SHEAR=-1,ut.ROTATE=1,ut.TRANSLATE=2,ut.SCALE=3,ut.SHEAR=4;var ct=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.VALUE]=r},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.position=l.data.position);case 1:l.position+=(l.data.position-l.position)*i}else{var u=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=Q.binarySearch(h,r,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.position=l.data.position+(u-l.data.position)*i:l.position+=(u-l.position)*i}},e}(J);ct.ENTRIES=2,ct.PREV_TIME=-2,ct.PREV_VALUE=-1,ct.VALUE=1;var dt,ft=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.spacing=l.data.spacing);case 1:l.spacing+=(l.data.spacing-l.spacing)*i}else{var u=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=Q.binarySearch(h,r,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.spacing=l.data.spacing+(u-l.data.spacing)*i:l.spacing+=(u-l.spacing)*i}},e}(ct),vt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=x.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a},n.apply=function(t,n,r,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.rotateMix=l.data.rotateMix,void(l.translateMix=l.data.translateMix);case 1:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*i,l.translateMix+=(l.data.translateMix-l.translateMix)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_ROTATE],c=h[h.length+e.PREV_TRANSLATE];else{var d=Q.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_ROTATE],c=h[d+e.PREV_TRANSLATE];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.ROTATE]-u)*v,c+=(h[d+e.TRANSLATE]-c)*v}0==s?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*i,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*i):(l.rotateMix+=(u-l.rotateMix)*i,l.translateMix+=(c-l.translateMix)*i)}},e}(J);vt.ENTRIES=3,vt.PREV_TIME=-3,vt.PREV_ROTATE=-2,vt.PREV_TRANSLATE=-1,vt.ROTATE=1,vt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(dt||(dt={}));var gt,pt=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},mt=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 F,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],h=null,l=this.getValue(o,"parent",null);if(null!=l&&null==(h=r.findBone(l)))throw new Error("Parent bone not found: "+l);var u=new N(r.bones.length,o.name,h);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,g=r.findBone(v);if(null==g)throw new Error("Slot bone not found: "+v);var p=new X(r.slots.length,f,g),m=this.getValue(d,"color",null);null!=m&&p.color.setFromString(m);var E=this.getValue(d,"dark",null);null!=E&&(p.darkColor=new w(1,1,1,1),p.darkColor.setFromString(E)),p.attachmentName=this.getValue(d,"attachment",null),p.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),r.slots.push(p)}if(a.ik)for(var x=0;x<a.ik.length;x++){var y=a.ik[x],b=new D(y.name);b.order=this.getValue(y,"order",0),b.skinRequired=this.getValue(y,"skin",!1);for(var S=0;S<y.bones.length;S++){var M=y.bones[S],A=r.findBone(M);if(null==A)throw new Error("IK bone not found: "+M);b.bones.push(A)}var R=y.target;if(b.target=r.findBone(R),null==b.target)throw new Error("IK target bone not found: "+R);b.mix=this.getValue(y,"mix",1),b.softness=this.getValue(y,"softness",0)*n,b.bendDirection=this.getValue(y,"bendPositive",!0)?1:-1,b.compress=this.getValue(y,"compress",!1),b.stretch=this.getValue(y,"stretch",!1),b.uniform=this.getValue(y,"uniform",!1),r.ikConstraints.push(b)}if(a.transform)for(var I=0;I<a.transform.length;I++){var T=a.transform[I],C=new U(T.name);C.order=this.getValue(T,"order",0),C.skinRequired=this.getValue(T,"skin",!1);for(var _=0;_<T.bones.length;_++){var k=T.bones[_],V=r.findBone(k);if(null==V)throw new Error("Transform constraint bone not found: "+k);C.bones.push(V)}var P=T.target;if(C.target=r.findBone(P),null==C.target)throw new Error("Transform constraint target bone not found: "+P);C.local=this.getValue(T,"local",!1),C.relative=this.getValue(T,"relative",!1),C.offsetRotation=this.getValue(T,"rotation",0),C.offsetX=this.getValue(T,"x",0)*n,C.offsetY=this.getValue(T,"y",0)*n,C.offsetScaleX=this.getValue(T,"scaleX",0),C.offsetScaleY=this.getValue(T,"scaleY",0),C.offsetShearY=this.getValue(T,"shearY",0),C.rotateMix=this.getValue(T,"rotateMix",1),C.translateMix=this.getValue(T,"translateMix",1),C.scaleMix=this.getValue(T,"scaleMix",1),C.shearMix=this.getValue(T,"shearMix",1),r.transformConstraints.push(C)}if(a.path)for(var L=0;L<a.path.length;L++){var Y=a.path[L],q=new W(Y.name);q.order=this.getValue(Y,"order",0),q.skinRequired=this.getValue(Y,"skin",!1);for(var H=0;H<Y.bones.length;H++){var G=Y.bones[H],j=r.findBone(G);if(null==j)throw new Error("Transform constraint bone not found: "+G);q.bones.push(j)}var Q=Y.target;if(q.target=r.findSlot(Q),null==q.target)throw new Error("Path target slot not found: "+Q);q.positionMode=t.positionModeFromString(this.getValue(Y,"positionMode","percent")),q.spacingMode=t.spacingModeFromString(this.getValue(Y,"spacingMode","length")),q.rotateMode=t.rotateModeFromString(this.getValue(Y,"rotateMode","tangent")),q.offsetRotation=this.getValue(Y,"rotation",0),q.position=this.getValue(Y,"position",0),q.positionMode==O.Fixed&&(q.position*=n),q.spacing=this.getValue(Y,"spacing",0),q.spacingMode!=B.Length&&q.spacingMode!=B.Fixed||(q.spacing*=n),q.rotateMix=this.getValue(Y,"rotateMix",1),q.translateMix=this.getValue(Y,"translateMix",1),r.pathConstraints.push(q)}if(a.skins)for(var J=0;J<a.skins.length;J++){var K=a.skins[J],$=new z(K.name);if(K.bones)for(var tt=0;tt<K.bones.length;tt++){var et=r.findBone(K.bones[tt]);if(null==et)throw new Error("Skin bone not found: "+K.bones[J]);$.bones.push(et)}if(K.ik)for(var nt=0;nt<K.ik.length;nt++){var rt=r.findIkConstraint(K.ik[nt]);if(null==rt)throw new Error("Skin IK constraint not found: "+K.ik[J]);$.constraints.push(rt)}if(K.transform)for(var at=0;at<K.transform.length;at++){var it=r.findTransformConstraint(K.transform[at]);if(null==it)throw new Error("Skin transform constraint not found: "+K.transform[J]);$.constraints.push(it)}if(K.path)for(var st=0;st<K.path.length;st++){var ot=r.findPathConstraint(K.path[st]);if(null==ot)throw new Error("Skin path constraint not found: "+K.path[J]);$.constraints.push(ot)}for(var ht in K.attachments){var lt=r.findSlot(ht);if(null==lt)throw new Error("Slot not found: "+ht);var ut=K.attachments[ht];for(var ct in ut){var dt=this.readAttachment(ut[ct],$,lt.index,ct,r);null!=dt&&$.setAttachment(lt.index,ct,dt)}}r.skins.push($),"default"==$.name&&(r.defaultSkin=$)}for(var ft=0,vt=this.linkedMeshes.length;ft<vt;ft++){var gt=this.linkedMeshes[ft],pt=null==gt.skin?r.defaultSkin:r.findSkin(gt.skin);if(null==pt)throw new Error("Skin not found: "+gt.skin);var mt=pt.getAttachment(gt.slotIndex,gt.parent);if(null==mt)throw new Error("Parent mesh not found: "+gt.parent);gt.mesh.deformAttachment=gt.inheritDeform?mt:gt.mesh,gt.mesh.setParentMesh(mt),gt.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var wt in a.events){var Et=a.events[wt],xt=new Z(wt);xt.intValue=this.getValue(Et,"int",0),xt.floatValue=this.getValue(Et,"float",0),xt.stringValue=this.getValue(Et,"string",""),xt.audioPath=this.getValue(Et,"audio",null),null!=xt.audioPath&&(xt.volume=this.getValue(Et,"volume",1),xt.balance=this.getValue(Et,"balance",0)),r.events.push(xt)}if(a.animations)for(var yt in a.animations){var bt=a.animations[yt];this.readAnimation(bt,yt,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 h=this.getValue(t,"color",null);return null!=h&&o.color.setFromString(h),o.updateOffset(),o;case"boundingbox":var l=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(null==l)return null;this.readVertices(t,l,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&l.color.setFromString(u),l;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 wt(d,this.getValue(t,"skin",null),n,v,this.getValue(t,"deform",!0))),d;var g=t.uvs;return this.readVertices(t,d,g.length),d.triangles=t.triangles,d.regionUVs=g,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var p=this.attachmentLoader.newPathAttachment(e,r);if(null==p)return null;p.closed=this.getValue(t,"closed",!1),p.constantSpeed=this.getValue(t,"constantSpeed",!0);var m=t.vertexCount;this.readVertices(t,p,m<<1);for(var w=x.newArray(m/3,0),E=0;E<t.lengths.length;E++)w[E]=t.lengths[E]*i;p.lengths=w;var y=this.getValue(t,"color",null);return null!=y&&p.color.setFromString(y),p;case"point":var b=this.attachmentLoader.newPointAttachment(e,r);if(null==b)return null;b.x=this.getValue(t,"x",0)*i,b.y=this.getValue(t,"y",0)*i,b.rotation=this.getValue(t,"rotation",0);var S=this.getValue(t,"color",null);return null!=S&&b.color.setFromString(S),b;case"clipping":var M=this.attachmentLoader.newClippingAttachment(e,r);if(null==M)return null;var A=this.getValue(t,"end",null);if(null!=A){var R=a.findSlot(A);if(null==R)throw new Error("Clipping end slot not found: "+A);M.endSlot=R}var I=t.vertexCount;this.readVertices(t,M,I<<1);var T=this.getValue(t,"color",null);return null!=T&&M.color.setFromString(T),M}return null},e.readVertices=function(t,e,n){var r=this.scale;e.worldVerticesLength=n;var a=t.vertices;if(n!=a.length){for(var i=new Array,s=new Array,o=0,h=a.length;o<h;){var l=a[o++];s.push(l);for(var u=o+4*l;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=x.toFloatArray(i)}else{var c=x.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],h=n.findSlotIndex(s);if(-1==h)throw new Error("Slot not found: "+s);for(var l in o){var u=o[l];if("attachment"==l){var c=new at(u.length);c.slotIndex=h;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"==l){var g=new nt(u.length);g.slotIndex=h;for(var p=0,m=0;m<u.length;m++){var E=u[m],y=new w;y.setFromString(E.color),g.setFrame(p,this.getValue(E,"time",0),y.r,y.g,y.b,y.a),this.readCurve(E,g,p),p++}a.push(g),i=Math.max(i,g.frames[(g.getFrameCount()-1)*nt.ENTRIES])}else{if("twoColor"!=l)throw new Error("Invalid timeline type for a slot: "+l+" ("+s+")");var b=new rt(u.length);b.slotIndex=h;for(var S=0,M=0;M<u.length;M++){var A=u[M],R=new w,I=new w;R.setFromString(A.light),I.setFromString(A.dark),b.setFrame(S,this.getValue(A,"time",0),R.r,R.g,R.b,R.a,I.r,I.g,I.b),this.readCurve(A,b,S),S++}a.push(b),i=Math.max(i,b.frames[(b.getFrameCount()-1)*rt.ENTRIES])}}}if(t.bones)for(var T in t.bones){var C=t.bones[T],_=n.findBoneIndex(T);if(-1==_)throw new Error("Bone not found: "+T);for(var k in C){var V=C[k];if("rotate"===k){var P=new K(V.length);P.boneIndex=_;for(var F=0,N=0;N<V.length;N++){var L=V[N];P.setFrame(F,this.getValue(L,"time",0),this.getValue(L,"angle",0)),this.readCurve(L,P,F),F++}a.push(P),i=Math.max(i,P.frames[(P.getFrameCount()-1)*K.ENTRIES])}else{if("translate"!==k&&"scale"!==k&&"shear"!==k)throw new Error("Invalid timeline type for a bone: "+k+" ("+T+")");var X=null,Y=1,D=0;"scale"===k?(X=new tt(V.length),D=1):"shear"===k?X=new et(V.length):(X=new $(V.length),Y=r),X.boneIndex=_;for(var U=0,W=0;W<V.length;W++){var q=V[W],H=this.getValue(q,"x",D),G=this.getValue(q,"y",D);X.setFrame(U,this.getValue(q,"time",0),H*Y,G*Y),this.readCurve(q,X,U),U++}a.push(X),i=Math.max(i,X.frames[(X.getFrameCount()-1)*$.ENTRIES])}}}if(t.ik)for(var j in t.ik){var z=t.ik[j],Z=n.findIkConstraint(j),J=new lt(z.length);J.ikConstraintIndex=n.ikConstraints.indexOf(Z);for(var it=0,dt=0;dt<z.length;dt++){var gt=z[dt];J.setFrame(it,this.getValue(gt,"time",0),this.getValue(gt,"mix",1),this.getValue(gt,"softness",0)*r,this.getValue(gt,"bendPositive",!0)?1:-1,this.getValue(gt,"compress",!1),this.getValue(gt,"stretch",!1)),this.readCurve(gt,J,it),it++}a.push(J),i=Math.max(i,J.frames[(J.getFrameCount()-1)*lt.ENTRIES])}if(t.transform)for(var mt in t.transform){var wt=t.transform[mt],Et=n.findTransformConstraint(mt),xt=new ut(wt.length);xt.transformConstraintIndex=n.transformConstraints.indexOf(Et);for(var yt=0,bt=0;bt<wt.length;bt++){var St=wt[bt];xt.setFrame(yt,this.getValue(St,"time",0),this.getValue(St,"rotateMix",1),this.getValue(St,"translateMix",1),this.getValue(St,"scaleMix",1),this.getValue(St,"shearMix",1)),this.readCurve(St,xt,yt),yt++}a.push(xt),i=Math.max(i,xt.frames[(xt.getFrameCount()-1)*ut.ENTRIES])}if(t.path)for(var Mt in t.path){var At=t.path[Mt],Rt=n.findPathConstraintIndex(Mt);if(-1==Rt)throw new Error("Path constraint not found: "+Mt);var It=n.pathConstraints[Rt];for(var Tt in At){var Ct=At[Tt];if("position"===Tt||"spacing"===Tt){var _t=null,kt=1;"spacing"===Tt?(_t=new ft(Ct.length),It.spacingMode!=B.Length&&It.spacingMode!=B.Fixed||(kt=r)):(_t=new ct(Ct.length),It.positionMode==O.Fixed&&(kt=r)),_t.pathConstraintIndex=Rt;for(var Vt=0,Pt=0;Pt<Ct.length;Pt++){var Ft=Ct[Pt];_t.setFrame(Vt,this.getValue(Ft,"time",0),this.getValue(Ft,Tt,0)*kt),this.readCurve(Ft,_t,Vt),Vt++}a.push(_t),i=Math.max(i,_t.frames[(_t.getFrameCount()-1)*ct.ENTRIES])}else if("mix"===Tt){var Nt=new vt(Ct.length);Nt.pathConstraintIndex=Rt;for(var Ot=0,Bt=0;Bt<Ct.length;Bt++){var Lt=Ct[Bt];Nt.setFrame(Ot,this.getValue(Lt,"time",0),this.getValue(Lt,"rotateMix",1),this.getValue(Lt,"translateMix",1)),this.readCurve(Lt,Nt,Ot),Ot++}a.push(Nt),i=Math.max(i,Nt.frames[(Nt.getFrameCount()-1)*vt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Yt=t.deform[Xt],Dt=n.findSkin(Xt);if(null==Dt)throw new Error("Skin not found: "+Xt);for(var Ut in Yt){var Wt=Yt[Ut],qt=n.findSlotIndex(Ut);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var Gt=Wt[Ht],jt=Dt.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 st(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?x.newFloatArray(Qt):Zt;else{ee=x.newFloatArray(Qt);var re=this.getValue(te,"offset",0);if(x.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 he=new ht(oe.length),le=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=x.newArray(le,-1);for(var ge=x.newArray(le-ve.length,0),pe=0,me=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(;pe!=xe;)ge[me++]=pe++;fe[pe+Ee.offset]=pe++}for(;pe<le;)ge[me++]=pe++;for(var ye=le-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=ge[--me])}he.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(he),i=Math.max(i,he.frames[he.getFrameCount()-1])}if(t.events){for(var be=new ot(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 Ie=new pt(x.toSinglePrecision(this.getValue(Ae,"time",0)),Re);Ie.intValue=this.getValue(Ae,"int",Re.intValue),Ie.floatValue=this.getValue(Ae,"float",Re.floatValue),Ie.stringValue=this.getValue(Ae,"string",Re.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");n.animations.push(new Q(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 dt.Normal;if("additive"==t)return dt.Additive;if("multiply"==t)return dt.Multiply;if("screen"==t)return dt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return O.Fixed;if("percent"==t)return O.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return B.Length;if("fixed"==t)return B.Fixed;if("percent"==t)return B.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return L.Tangent;if("chain"==t)return L.Chain;if("chainscale"==t)return L.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return I.Normal;if("onlytranslation"==t)return I.OnlyTranslation;if("norotationorreflection"==t)return I.NoRotationOrReflection;if("noscale"==t)return I.NoScale;if("noscaleorreflection"==t)return I.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),wt=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"}(gt||(gt={}));var Et=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 F;r.name="";var a=new xt(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 h=0;h<s;h++){var l=a.readString(),u=0==h?null:r.bones[a.readInt(!0)],c=new N(h,l,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&&w.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)],g=new X(d,f,v);w.rgba8888ToColor(g.color,a.readInt32());var p=a.readInt32();-1!=p&&w.rgb888ToColor(g.darkColor=new w,p),g.attachmentName=a.readStringRef(),g.blendMode=t.BlendModeValues[a.readInt(!0)],r.slots.push(g)}s=a.readInt(!0);for(var m,E=0;E<s;E++){var y=new D(a.readString());y.order=a.readInt(!0),y.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var b=0;b<m;b++)y.bones.push(r.bones[a.readInt(!0)]);y.target=r.bones[a.readInt(!0)],y.mix=a.readFloat(),y.softness=a.readFloat()*n,y.bendDirection=a.readByte(),y.compress=a.readBoolean(),y.stretch=a.readBoolean(),y.uniform=a.readBoolean(),r.ikConstraints.push(y)}s=a.readInt(!0);for(var S,M=0;M<s;M++){var A=new U(a.readString());A.order=a.readInt(!0),A.skinRequired=a.readBoolean(),S=a.readInt(!0);for(var R=0;R<S;R++)A.bones.push(r.bones[a.readInt(!0)]);A.target=r.bones[a.readInt(!0)],A.local=a.readBoolean(),A.relative=a.readBoolean(),A.offsetRotation=a.readFloat(),A.offsetX=a.readFloat()*n,A.offsetY=a.readFloat()*n,A.offsetScaleX=a.readFloat(),A.offsetScaleY=a.readFloat(),A.offsetShearY=a.readFloat(),A.rotateMix=a.readFloat(),A.translateMix=a.readFloat(),A.scaleMix=a.readFloat(),A.shearMix=a.readFloat(),r.transformConstraints.push(A)}s=a.readInt(!0);for(var I,T=0;T<s;T++){var C=new W(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),I=a.readInt(!0);for(var _=0;_<I;_++)C.bones.push(r.bones[a.readInt(!0)]);C.target=r.slots[a.readInt(!0)],C.positionMode=t.PositionModeValues[a.readInt(!0)],C.spacingMode=t.SpacingModeValues[a.readInt(!0)],C.rotateMode=t.RotateModeValues[a.readInt(!0)],C.offsetRotation=a.readFloat(),C.position=a.readFloat(),C.positionMode==O.Fixed&&(C.position*=n),C.spacing=a.readFloat(),C.spacingMode!=B.Length&&C.spacingMode!=B.Fixed||(C.spacing*=n),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),r.pathConstraints.push(C)}var k=this.readSkin(a,r,!0,i);null!=k&&(r.defaultSkin=k,r.skins.push(k));var V=r.skins.length;for(x.setArraySize(r.skins,s=V+a.readInt(!0));V<s;V++)r.skins[V]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var P=0;P<s;P++){var L=this.linkedMeshes[P],Y=null==L.skin?r.defaultSkin:r.findSkin(L.skin);if(null==Y)throw new Error("Skin not found: "+L.skin);var q=Y.getAttachment(L.slotIndex,L.parent);if(null==q)throw new Error("Parent mesh not found: "+L.parent);L.mesh.deformAttachment=L.inheritDeform?q:L.mesh,L.mesh.setParentMesh(q),L.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var H=0;H<s;H++){var G=new Z(a.readStringRef());G.intValue=a.readInt(!1),G.floatValue=a.readFloat(),G.stringValue=a.readString(),G.audioPath=a.readString(),null!=G.audioPath&&(G.volume=a.readFloat(),G.balance=a.readFloat()),r.events.push(G)}s=a.readInt(!0);for(var j=0;j<s;j++)r.animations.push(this.readAnimation(a,a.readString(),r));return r},e.readSkin=function(t,e,n,r){var a=null,i=0;if(n){if(0==(i=t.readInt(!0)))return null;a=new z("default")}else{(a=new z(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 h=0,l=t.readInt(!0);h<l;h++)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 g=t.readInt(!0),p=0,m=t.readInt(!0);p<m;p++){var w=t.readStringRef(),E=this.readAttachment(t,e,a,g,w,r);null!=E&&a.setAttachment(g,w,E)}return a},e.readAttachment=function(e,n,r,a,i,s){var o=this.scale,h=e.readStringRef();null==h&&(h=i);var l=e.readByte();switch(t.AttachmentTypeValues[l]){case gt.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),v=e.readFloat(),g=e.readFloat(),p=e.readFloat(),m=e.readFloat(),E=e.readInt32();null==u&&(u=h);var y=this.attachmentLoader.newRegionAttachment(r,h,u);return null==y?null:(y.path=u,y.x=d*o,y.y=f*o,y.scaleX=v,y.scaleY=g,y.rotation=c,y.width=p*o,y.height=m*o,w.rgba8888ToColor(y.color,E),y.updateOffset(),y);case gt.BoundingBox:var b=e.readInt(!0),S=this.readVertices(e,b),M=s?e.readInt32():0,A=this.attachmentLoader.newBoundingBoxAttachment(r,h);return null==A?null:(A.worldVerticesLength=b<<1,A.vertices=S.vertices,A.bones=S.bones,s&&w.rgba8888ToColor(A.color,M),A);case gt.Mesh:var R=e.readStringRef(),I=e.readInt32(),T=e.readInt(!0),C=this.readFloatArray(e,T<<1,1),_=this.readShortArray(e),k=this.readVertices(e,T),V=e.readInt(!0),P=null,F=0,N=0;s&&(P=this.readShortArray(e),F=e.readFloat(),N=e.readFloat()),null==R&&(R=h);var O=this.attachmentLoader.newMeshAttachment(r,h,R);return null==O?null:(O.path=R,w.rgba8888ToColor(O.color,I),O.bones=k.bones,O.vertices=k.vertices,O.worldVerticesLength=T<<1,O.triangles=_,O.regionUVs=C,O.updateUVs(),O.hullLength=V<<1,s&&(O.edges=P,O.width=F*o,O.height=N*o),O);case gt.LinkedMesh:var B=e.readStringRef(),L=e.readInt32(),X=e.readStringRef(),Y=e.readStringRef(),D=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==B&&(B=h);var q=this.attachmentLoader.newMeshAttachment(r,h,B);return null==q?null:(q.path=B,w.rgba8888ToColor(q.color,L),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new yt(q,X,a,Y,D)),q);case gt.Path:for(var H=e.readBoolean(),G=e.readBoolean(),j=e.readInt(!0),z=this.readVertices(e,j),Z=x.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,h);return null==$?null:($.closed=H,$.constantSpeed=G,$.worldVerticesLength=j<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&w.rgba8888ToColor($.color,K),$);case gt.Point:var tt=e.readFloat(),et=e.readFloat(),nt=e.readFloat(),rt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(r,h);return null==at?null:(at.x=et*o,at.y=nt*o,at.rotation=tt,s&&w.rgba8888ToColor(at.color,rt),at);case gt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),ht=s?e.readInt32():0,lt=this.attachmentLoader.newClippingAttachment(r,h);return null==lt?null:(lt.endSlot=n.slots[it],lt.worldVerticesLength=st<<1,lt.vertices=ot.vertices,lt.bones=ot.bones,s&&w.rgba8888ToColor(lt.color,ht),lt)}return null},e.readVertices=function(t,e){var n=e<<1,r=new bt,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 h=t.readInt(!0);s.push(h);for(var l=0;l<h;l++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return r.vertices=x.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 w,h=new w,l=0,u=e.readInt(!0);l<u;l++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var v=e.readByte(),g=e.readInt(!0);switch(v){case t.SLOT_ATTACHMENT:var p=new at(g);p.slotIndex=c;for(var m=0;m<g;m++)p.setFrame(m,e.readFloat(),e.readStringRef());a.push(p),s=Math.max(s,p.frames[g-1]);break;case t.SLOT_COLOR:var E=new nt(g);E.slotIndex=c;for(var y=0;y<g;y++){var b=e.readFloat();w.rgba8888ToColor(o,e.readInt32()),E.setFrame(y,b,o.r,o.g,o.b,o.a),y<g-1&&this.readCurve(e,y,E)}a.push(E),s=Math.max(s,E.frames[(g-1)*nt.ENTRIES]);break;case t.SLOT_TWO_COLOR:var S=new rt(g);S.slotIndex=c;for(var M=0;M<g;M++){var A=e.readFloat();w.rgba8888ToColor(o,e.readInt32()),w.rgb888ToColor(h,e.readInt32()),S.setFrame(M,A,o.r,o.g,o.b,o.a,h.r,h.g,h.b),M<g-1&&this.readCurve(e,M,S)}a.push(S),s=Math.max(s,S.frames[(g-1)*rt.ENTRIES])}}for(var R=0,I=e.readInt(!0);R<I;R++)for(var T=e.readInt(!0),C=0,_=e.readInt(!0);C<_;C++){var k=e.readByte(),V=e.readInt(!0);switch(k){case t.BONE_ROTATE:var P=new K(V);P.boneIndex=T;for(var F=0;F<V;F++)P.setFrame(F,e.readFloat(),e.readFloat()),F<V-1&&this.readCurve(e,F,P);a.push(P),s=Math.max(s,P.frames[(V-1)*K.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var N=void 0,L=1;k==t.BONE_SCALE?N=new tt(V):k==t.BONE_SHEAR?N=new et(V):(N=new $(V),L=i),N.boneIndex=T;for(var X=0;X<V;X++)N.setFrame(X,e.readFloat(),e.readFloat()*L,e.readFloat()*L),X<V-1&&this.readCurve(e,X,N);a.push(N),s=Math.max(s,N.frames[(V-1)*$.ENTRIES])}}for(var Y=0,D=e.readInt(!0);Y<D;Y++){var U=e.readInt(!0),W=e.readInt(!0),q=new lt(W);q.ikConstraintIndex=U;for(var H=0;H<W;H++)q.setFrame(H,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),H<W-1&&this.readCurve(e,H,q);a.push(q),s=Math.max(s,q.frames[(W-1)*lt.ENTRIES])}for(var G=0,j=e.readInt(!0);G<j;G++){var z=e.readInt(!0),Z=e.readInt(!0),J=new ut(Z);J.transformConstraintIndex=z;for(var it=0;it<Z;it++)J.setFrame(it,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),it<Z-1&&this.readCurve(e,it,J);a.push(J),s=Math.max(s,J.frames[(Z-1)*ut.ENTRIES])}for(var dt=0,gt=e.readInt(!0);dt<gt;dt++)for(var mt=e.readInt(!0),wt=r.pathConstraints[mt],Et=0,xt=e.readInt(!0);Et<xt;Et++){var yt=e.readByte(),bt=e.readInt(!0);switch(yt){case t.PATH_POSITION:case t.PATH_SPACING:var St=void 0,Mt=1;yt==t.PATH_SPACING?(St=new ft(bt),wt.spacingMode!=B.Length&&wt.spacingMode!=B.Fixed||(Mt=i)):(St=new ct(bt),wt.positionMode==O.Fixed&&(Mt=i)),St.pathConstraintIndex=mt;for(var At=0;At<bt;At++)St.setFrame(At,e.readFloat(),e.readFloat()*Mt),At<bt-1&&this.readCurve(e,At,St);a.push(St),s=Math.max(s,St.frames[(bt-1)*ct.ENTRIES]);break;case t.PATH_MIX:var Rt=new vt(bt);Rt.pathConstraintIndex=mt;for(var It=0;It<bt;It++)Rt.setFrame(It,e.readFloat(),e.readFloat(),e.readFloat()),It<bt-1&&this.readCurve(e,It,Rt);a.push(Rt),s=Math.max(s,Rt.frames[(bt-1)*vt.ENTRIES])}}for(var Tt=0,Ct=e.readInt(!0);Tt<Ct;Tt++)for(var _t=r.skins[e.readInt(!0)],kt=0,Vt=e.readInt(!0);kt<Vt;kt++)for(var Pt=e.readInt(!0),Ft=0,Nt=e.readInt(!0);Ft<Nt;Ft++){var Ot=_t.getAttachment(Pt,e.readStringRef()),Bt=null!=Ot.bones,Lt=Ot.vertices,Xt=Bt?Lt.length/3*2:Lt.length,Yt=e.readInt(!0),Dt=new st(Yt);Dt.slotIndex=Pt,Dt.attachment=Ot;for(var Ut=0;Ut<Yt;Ut++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=Bt?x.newFloatArray(Xt):Lt;else{qt=x.newFloatArray(Xt);var Gt=e.readInt(!0);if(Ht+=Gt,1==i)for(var jt=Gt;jt<Ht;jt++)qt[jt]=e.readFloat();else for(var zt=Gt;zt<Ht;zt++)qt[zt]=e.readFloat()*i;if(!Bt)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=Lt[Zt]}Dt.setFrame(Ut,Wt,qt),Ut<Yt-1&&this.readCurve(e,Ut,Dt)}a.push(Dt),s=Math.max(s,Dt.frames[Yt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new ht(Jt),$t=r.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=x.newArray($t,0),ae=$t-1;ae>=0;ae--)re[ae]=-1;for(var ie=x.newArray($t-ne,0),se=0,oe=0,he=0;he<ne;he++){for(var le=e.readInt(!0);se!=le;)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 ot(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),ge=r.events[e.readInt(!0)],pe=new pt(ve,ge);pe.intValue=e.readInt(!1),pe.floatValue=e.readFloat(),pe.stringValue=e.readBoolean()?e.readString():ge.stringValue,null!=pe.data.audioPath&&(pe.volume=e.readFloat(),pe.balance=e.readFloat()),de.setFrame(fe,pe)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new Q(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}();Et.AttachmentTypeValues=[0,1,2,3,4,5,6],Et.TransformModeValues=[I.Normal,I.OnlyTranslation,I.NoRotationOrReflection,I.NoScale,I.NoScaleOrReflection],Et.PositionModeValues=[O.Fixed,O.Percent],Et.SpacingModeValues=[B.Length,B.Fixed,B.Percent],Et.RotateModeValues=[L.Tangent,L.Chain,L.ChainScale],Et.BlendModeValues=[dt.Normal,dt.Additive,dt.Multiply,dt.Screen],Et.BONE_ROTATE=0,Et.BONE_TRANSLATE=1,Et.BONE_SCALE=2,Et.BONE_SHEAR=3,Et.SLOT_ATTACHMENT=0,Et.SLOT_COLOR=1,Et.SLOT_TWO_COLOR=2,Et.PATH_POSITION=0,Et.PATH_SPACING=1,Et.PATH_MIX=2,Et.CURVE_LINEAR=0,Et.CURVE_STEPPED=1,Et.CURVE_BEZIER=2;var xt=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}(),yt=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},bt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function St(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 Mt(t,e,n){return e&&St(t.prototype,e),n&&St(t,n),t}function At(){return At=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},At.apply(this,arguments)}var Rt=function(){function t(t,e,n){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=n,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,n,r,a,i,s){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var h=this.skeleton,l=n+90+s,u=h.scaleX,c=h.scaleY;return this.a=E.cosDeg(n+i)*r*u,this.b=E.cosDeg(l)*a*u,this.c=E.sinDeg(n+i)*r*c,this.d=E.sinDeg(l)*a*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.y)}var d=o.a,f=o.b,v=o.c,g=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=v*t+g*e+o.worldY,this.data.transformMode){case I.Normal:var p=n+90+s,m=E.cosDeg(n+i)*r,w=E.cosDeg(p)*a,x=E.sinDeg(n+i)*r,y=E.sinDeg(p)*a;return this.a=d*m+f*x,this.b=d*w+f*y,this.c=v*m+g*x,void(this.d=v*w+g*y);case I.OnlyTranslation:var b=n+90+s;this.a=E.cosDeg(n+i)*r,this.b=E.cosDeg(b)*a,this.c=E.sinDeg(n+i)*r,this.d=E.sinDeg(b)*a;break;case I.NoRotationOrReflection:var S=d*d+v*v,M=0;S>1e-4?(S=Math.abs(d*g-f*v)/S,d/=this.skeleton.scaleX,f=(v/=this.skeleton.scaleY)*S,g=d*S,M=Math.atan2(v,d)*E.radDeg):(d=0,v=0,M=90-Math.atan2(g,f)*E.radDeg);var A=n+i-M,R=n+s-M+90,T=E.cosDeg(A)*r,C=E.cosDeg(R)*a,_=E.sinDeg(A)*r,k=E.sinDeg(R)*a;this.a=d*T-f*_,this.b=d*C-f*k,this.c=v*T+g*_,this.d=v*C+g*k;break;case I.NoScale:case I.NoScaleOrReflection:var V=E.cosDeg(n),P=E.sinDeg(n),F=(d*V+f*P)/this.skeleton.scaleX,N=(v*V+g*P)/this.skeleton.scaleY,O=Math.sqrt(F*F+N*N);O>1e-5&&(O=1/O),F*=O,N*=O,O=Math.sqrt(F*F+N*N),this.data.transformMode==I.NoScale&&d*g-f*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(O=-O);var B=Math.PI/2+Math.atan2(N,F),L=Math.cos(B)*O,X=Math.sin(B)*O,Y=E.cosDeg(i)*r,D=E.cosDeg(90+s)*a,U=E.sinDeg(i)*r,W=E.sinDeg(90+s)*a;this.a=F*Y+L*U,this.b=F*D+L*W,this.c=N*Y+X*U,this.d=N*D+X*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*E.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*E.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)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg);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 h=i*a,l=i*e,u=i*n,c=i*r,d=h*this.a-u*this.c,f=h*this.b-u*this.d,v=l*this.c-c*this.a,g=l*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+v*v),this.ascaleX>1e-4){var p=d*g-f*v;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(d*f+v*g,p)*E.radDeg,this.arotation=Math.atan2(v,d)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,f)*E.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=E.sinDeg(t),n=E.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*E.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=E.sinDeg(t),n=E.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*E.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=E.cosDeg(t),s=E.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}(),It=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 w,this.darkColor=null==t.darkColor?null:new w,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}(),Tt=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,h=o.a,l=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,v=0;switch(t.data.transformMode){case I.OnlyTranslation:f=e-t.worldX,v=n-t.worldY;break;case I.NoRotationOrReflection:var g=Math.abs(h*c-l*u)/(h*h+u*u),p=h/t.skeleton.scaleX,m=u/t.skeleton.scaleY;l=-m*g*t.skeleton.scaleX,c=p*g*t.skeleton.scaleY,d+=Math.atan2(m,p)*E.radDeg;default:var w=e-o.worldX,x=n-o.worldY,y=h*c-l*u;f=(w*c-x*l)/y-t.ax,v=(x*h-w*u)/y-t.ay}d+=Math.atan2(v,f)*E.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var b=t.ascaleX,S=t.ascaleY;if(r||a){switch(t.data.transformMode){case I.NoScale:case I.NoScaleOrReflection:f=e-t.worldX,v=n-t.worldY}var M=t.data.length*b,A=Math.sqrt(f*f+v*v);if(r&&A<M||a&&A>M&&M>1e-4){var R=(A/M-1)*s+1;b*=R,i&&(S*=R)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,b,S,t.ashearX,t.ashearY)},e.apply2=function(t,e,n,r,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var h=t.ax,l=t.ay,u=t.ascaleX,c=u,d=t.ascaleY,f=e.ascaleX,v=0,g=0,p=0;u<0?(u=-u,v=180,p=-1):(v=0,p=1),d<0&&(d=-d,p=-p),f<0?(f=-f,g=180):g=0;var m=e.ax,w=0,x=0,y=0,b=t.a,S=t.b,M=t.c,A=t.d,R=Math.abs(u-d)<=1e-4;R?(x=b*m+S*(w=e.ay)+t.worldX,y=M*m+A*w+t.worldY):(w=0,x=b*m+t.worldX,y=M*m+t.worldY);var I=t.parent;b=I.a,S=I.b,M=I.c;var T,C,_=1/(b*(A=I.d)-S*M),k=x-I.worldX,V=y-I.worldY,P=(k*A-V*S)*_-h,F=(V*b-k*M)*_-l,N=Math.sqrt(P*P+F*F),O=e.data.length*f;if(N<1e-4)return this.apply1(t,n,r,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((k=n-I.worldX)*A-(V=r-I.worldY)*S)*_-h,L=(V*b-k*M)*_-l,X=B*B+L*L;if(0!=s){s*=u*(f+1)/2;var Y=Math.sqrt(X),D=Y-N-O*u+s;if(D>0){var U=Math.min(1,D/(2*s))-1;X=(B-=(U=(D-s*(1-U*U))/Y)*B)*B+(L-=U*L)*L}}t:if(R){var W=(X-N*N-(O*=u)*O)/(2*N*O);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(X)/(N+O)-1)*o+1)),C=Math.acos(W)*a,b=N+O*W,S=O*Math.sin(C),T=Math.atan2(L*b-B*S,B*b+L*S)}else{var q=(b=u*O)*b,H=(S=d*O)*S,G=Math.atan2(L,B),j=-2*H*N,z=H-q;if((A=j*j-4*z*(M=H*N*N+q*X-q*H))>=0){var Z=Math.sqrt(A);j<0&&(Z=-Z);var Q=(Z=-(j+Z)/2)/z,J=M/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){V=Math.sqrt(X-K*K)*a,T=G-Math.atan2(V,K),C=Math.atan2(V/d,(K-N)/u);break t}}var $=E.PI,tt=N-b,et=tt*tt,nt=0,rt=0,at=N+b,it=at*at,st=0;(M=-b*N/(q-H))>=-1&&M<=1&&(M=Math.acos(M),(A=(k=b*Math.cos(M)+N)*k+(V=S*Math.sin(M))*V)<et&&($=M,et=A,tt=k,nt=V),A>it&&(rt=M,it=A,at=k,st=V)),X<=(et+it)/2?(T=G-Math.atan2(nt*a,tt),C=$*a):(T=G-Math.atan2(st*a,at),C=rt*a)}var ot=Math.atan2(w,m)*p,ht=t.arotation;(T=(T-ot)*E.radDeg+v-ht)>180?T-=360:T<-180&&(T+=360),t.updateWorldTransformWith(h,l,ht+T*o,c,t.ascaleY,0,0),ht=e.arotation,(C=((C+ot)*E.radDeg-e.ashearX)*p+g-ht)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(m,w,ht+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),Ct=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new b,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,h=a.d,l=i*h-s*o>0?E.degRad:-E.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,d=this.bones,f=0,v=d.length;f<v;f++){var g=d[f],p=!1;if(0!=t){var m=g.a,w=g.b,x=g.c,y=g.d,b=Math.atan2(o,i)-Math.atan2(x,m)+u;b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);g.a=S*m-M*x,g.b=S*w-M*y,g.c=M*m+S*x,g.d=M*w+S*y,p=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(A.x-g.worldX)*e,g.worldY+=(A.y-g.worldY)*e,p=!0}if(n>0){var R=Math.sqrt(g.a*g.a+g.c*g.c),I=Math.sqrt(i*i+o*o);R>1e-5&&(R=(R+(I-R+this.data.offsetScaleX)*n)/R),g.a*=R,g.c*=R,R=Math.sqrt(g.b*g.b+g.d*g.d),I=Math.sqrt(s*s+h*h),R>1e-5&&(R=(R+(I-R+this.data.offsetScaleY)*n)/R),g.b*=R,g.d*=R,p=!0}if(r>0){var T=g.b,C=g.d,_=Math.atan2(C,T),k=Math.atan2(h,s)-Math.atan2(o,i)-(_-Math.atan2(g.c,g.a));k>E.PI?k-=E.PI2:k<-E.PI&&(k+=E.PI2),k=_+(k+c)*r;var V=Math.sqrt(T*T+C*C);g.b=Math.cos(k)*V,g.d=Math.sin(k)*V,p=!0}p&&(g.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,h=a.d,l=i*h-s*o>0?E.degRad:-E.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,d=this.bones,f=0,v=d.length;f<v;f++){var g=d[f],p=!1;if(0!=t){var m=g.a,w=g.b,x=g.c,y=g.d,b=Math.atan2(o,i)+u;b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);g.a=S*m-M*x,g.b=S*w-M*y,g.c=M*m+S*x,g.d=M*w+S*y,p=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),g.worldX+=A.x*e,g.worldY+=A.y*e,p=!0}if(n>0){var R=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;g.a*=R,g.c*=R,R=(Math.sqrt(s*s+h*h)-1+this.data.offsetScaleY)*n+1,g.b*=R,g.d*=R,p=!0}if(r>0){var I=Math.atan2(h,s)-Math.atan2(o,i);I>E.PI?I-=E.PI2:I<-E.PI&&(I+=E.PI2);var T=g.b,C=g.d;I=Math.atan2(C,T)+(I-E.PI/2+c)*r;var _=Math.sqrt(T*T+C*C);g.b=Math.cos(I)*_,g.d=Math.sin(I)*_,p=!0}p&&(g.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 h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;if(0!=t){var u=a.arotation-l+this.data.offsetRotation;l+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=h.ax,d=h.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=h.ascaleX,v=h.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 g=h.ashearY;if(0!=r){var p=a.ashearY-g+this.data.offsetShearY;p-=360*(16384-(16384.499999999996-p/360|0)),h.shearY+=p*r}h.updateWorldTransformWith(c,d,l,f,v,h.ashearX,g)}},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 h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;0!=t&&(l+=(a.arotation+this.data.offsetRotation)*t);var u=h.ax,c=h.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=h.ascaleX,f=h.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=h.ashearY;0!=r&&(v+=(a.ashearY+this.data.offsetShearY)*r),h.updateWorldTransformWith(u,c,l,d,f,h.ashearX,v)}},t}(),_t=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var n=0,r=t.bones.length;n<r;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(R(e,_)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==B.Percent,o=i.rotateMode,h=o==L.Tangent,l=o==L.ChainScale,u=this.bones.length,c=h?u:u+1,d=this.bones,f=x.setArraySize(this.spaces,c),v=null,g=this.spacing;if(l||!s){l&&(v=x.setArraySize(this.lengths,u));for(var p=i.spacingMode==B.Length,m=0,w=c-1;m<w;){var y=d[m],b=y.data.length;if(b<t.epsilon)l&&(v[m]=0),f[++m]=0;else if(s){if(l){var S=b*y.a,M=b*y.c,A=Math.sqrt(S*S+M*M);v[m]=A}f[++m]=g}else{var I=b*y.a,T=b*y.c,C=Math.sqrt(I*I+T*T);l&&(v[m]=C),f[++m]=(p?b+g:g)*C/b}}}else for(var k=1;k<c;k++)f[k]=g;var V=this.computeWorldPositions(e,c,h,i.positionMode==O.Percent,s),P=V[0],F=V[1],N=i.offsetRotation,X=!1;if(0==N)X=o==L.Chain;else{X=!1;var Y=this.target.bone;N*=Y.a*Y.d-Y.b*Y.c>0?E.degRad:-E.degRad}for(var D=0,U=3;D<u;D++,U+=3){var W=d[D];W.worldX+=(P-W.worldX)*r,W.worldY+=(F-W.worldY)*r;var q=V[U],H=V[U+1],G=q-P,j=H-F;if(l){var z=v[D];if(0!=z){var Z=(Math.sqrt(G*G+j*j)/z-1)*n+1;W.a*=Z,W.c*=Z}}if(P=q,F=H,a){var Q=W.a,J=W.b,K=W.c,$=W.d,tt=0,et=0,nt=0;if(tt=h?V[U-1]:0==f[D+1]?V[U+2]:Math.atan2(j,G),tt-=Math.atan2(K,Q),X){et=Math.cos(tt),nt=Math.sin(tt);var rt=W.data.length;P+=(rt*(et*Q-nt*K)-G)*n,F+=(rt*(nt*Q+et*K)-j)*n}else tt+=N;tt>E.PI?tt-=E.PI2:tt<-E.PI&&(tt+=E.PI2),tt*=n,et=Math.cos(tt),nt=Math.sin(tt),W.a=et*Q-nt*K,W.b=et*J-nt*$,W.c=nt*Q+et*K,W.d=nt*J+et*$}W.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,h=this.spaces,l=x.setArraySize(this.positions,3*n+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,v=t.NONE;if(!e.constantSpeed){var g=e.lengths,p=g[f-=c?1:2];if(a&&(o*=p),i)for(var m=1;m<n;m++)h[m]*=p;u=x.setArraySize(this.world,8);for(var w=0,E=0,y=0;w<n;w++,E+=3){var b=h[w],S=o+=b;if(c)(S%=p)<0&&(S+=p),y=0;else{if(S<0){v!=t.BEFORE&&(v=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(S,u,0,l,E);continue}if(S>p){v!=t.AFTER&&(v=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(S-p,u,0,l,E);continue}}for(;;y++){var M=g[y];if(!(S>M)){if(0==y)S/=M;else{var A=g[y-1];S=(S-A)/(M-A)}break}}y!=v&&(v=y,c&&y==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*y+2,8,u,0,2)),this.addCurvePosition(S,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],l,E,r||w>0&&0==b)}return l}c?(d+=2,u=x.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=x.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var R=x.setArraySize(this.curves,f),I=0,T=u[0],C=u[1],_=0,k=0,V=0,P=0,F=0,N=0,O=0,B=0,L=0,X=0,Y=0,D=0,U=0,W=0,q=0,H=2;q<f;q++,H+=6)_=u[H],k=u[H+1],V=u[H+2],P=u[H+3],Y=2*(O=.1875*(T-2*_+V))+(L=.09375*(3*(_-V)-T+(F=u[H+4]))),D=2*(B=.1875*(C-2*k+P))+(X=.09375*(3*(k-P)-C+(N=u[H+5]))),U=.75*(_-T)+O+.16666667*L,W=.75*(k-C)+B+.16666667*X,I+=Math.sqrt(U*U+W*W),U+=Y,W+=D,Y+=L,D+=X,I+=Math.sqrt(U*U+W*W),U+=Y,W+=D,I+=Math.sqrt(U*U+W*W),U+=Y+L,W+=D+X,I+=Math.sqrt(U*U+W*W),R[q]=I,T=F,C=N;if(o*=a?I:I/e.lengths[f-1],i)for(var G=1;G<n;G++)h[G]*=I;for(var j=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<n;Z++,Q+=3){var $=h[Z],tt=o+=$;if(c)(tt%=I)<0&&(tt+=I),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,l,Q);continue}if(tt>I){this.addAfterPosition(tt-I,u,d-4,l,Q);continue}}for(;;J++){var et=R[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=R[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=v){v=J;var rt=6*J;for(T=u[rt],C=u[rt+1],_=u[rt+2],k=u[rt+3],V=u[rt+4],P=u[rt+5],Y=2*(O=.03*(T-2*_+V))+(L=.006*(3*(_-V)-T+(F=u[rt+6]))),D=2*(B=.03*(C-2*k+P))+(X=.006*(3*(k-P)-C+(N=u[rt+7]))),U=.3*(_-T)+O+.16666667*L,W=.3*(k-C)+B+.16666667*X,z=Math.sqrt(U*U+W*W),j[0]=z,rt=1;rt<8;rt++)U+=Y,W+=D,Y+=L,D+=X,z+=Math.sqrt(U*U+W*W),j[rt]=z;U+=Y,W+=D,z+=Math.sqrt(U*U+W*W),j[8]=z,U+=Y+L,W+=D+X,z+=Math.sqrt(U*U+W*W),j[9]=z,K=0}for(tt*=z;;K++){var at=j[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=j[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,T,C,_,k,V,P,F,N,l,Q,r||Z>0&&0==$)}return l},e.addBeforePosition=function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,h=e[n+3]-s,l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l},e.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],h=s-e[n+1],l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l},e.addCurvePosition=function(t,e,n,r,a,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=n,void(l[u+2]=Math.atan2(a-n,r-e));var d=t*t,f=d*t,v=1-t,g=v*v,p=g*v,m=v*t,w=3*m,E=v*w,x=w*t,y=e*p+r*E+i*x+o*f,b=n*p+a*E+s*x+h*f;l[u]=y,l[u+1]=b,c&&(l[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(b-(n*g+a*m*2+s*d),y-(e*g+r*m*2+i*d)))},t}();_t.NONE=-1,_t.BEFORE=-2,_t.AFTER=-3,_t.epsilon=1e-5;var kt=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var n=t.bones[e],r=void 0;if(null==n.parent)r=new Rt(n,this,null);else{var a=this.bones[n.parent.index];r=new Rt(n,this,a),a.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],h=new It(s,o);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(var l=0;l<t.ikConstraints.length;l++){var u=t.ikConstraints[l];this.ikConstraints.push(new Tt(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new Ct(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var v=t.pathConstraints[f];this.pathConstraints.push(new _t(v,this))}this.color=new w(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 h=this.bones[i[s].index];do{h.sorted=!1,h.active=!0,h=h.parent}while(null!=h)}var l=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=l.length,f=u.length,v=c.length,g=d+f+v;t:for(var p=0;p<g;p++){for(var m=0;m<d;m++){var w=l[m];if(w.data.order==p){this.sortIkConstraint(w);continue t}}for(var E=0;E<f;E++){var x=u[E];if(x.data.order==p){this.sortTransformConstraint(x);continue t}}for(var y=0;y<v;y++){var b=c[y];if(b.data.order==p){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&&x.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&&x.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();R(s,_)&&this.sortPathConstraintAttachmentWith(s,r);for(var o=t.bones,h=o.length,l=0;l<h;l++)this.sortBone(o[l]);this._updateCache.push(t);for(var u=0;u<h;u++)this.sortReset(o[u].children);for(var c=0;c<h;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&x.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(R(t,_)){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,h=0,l=o.length;h<l;h++){var u=o[h],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 g=d[f],p=g.data;g.position=p.position,g.spacing=p.spacing,g.rotateMix=p.rotateMix,g.translateMix=p.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;x.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,h=0,l=r.length;h<l;h++){var u=r[h];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(R(f,A))c=8,d=x.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(R(f,T)){var v=f;c=v.worldVerticesLength,d=x.setArraySize(n,c,0),v.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var g=0,p=d.length;g<p;g+=2){var m=d[g],w=d[g+1];a=Math.min(a,m),i=Math.min(i,w),s=Math.max(s,m),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),Vt=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Nt(this),this.propertyIDs=new m,this.animationsChanged=!1,this.trackEntryPool=new y((function(){return new Ft})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n<r;n++){var a=e[n];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(n,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.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 h=0==i?q.first:o.mixBlend,l=o.alpha;null!=o.mixingFrom?l*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&null==o.next&&(l=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==l||h==q.add)for(var v=0;v<d;v++){x.webkit602BugfixHelper(l,h);var g=f[v];R(g,at)?this.applyAttachmentTimeline(g,e,c,h,!0):g.apply(e,u,c,n,l,h,H.mixIn)}else{var p=o.timelineMode,m=0==o.timelinesRotation.length;m&&x.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,E=0;E<d;E++){var y=f[E],b=p[E]==t.SUBSEQUENT?h:q.setup;R(y,K)?this.applyRotateTimeline(y,e,c,l,b,w,E<<1,m):R(y,at)?this.applyAttachmentTimeline(y,e,c,h,!0):(x.webkit602BugfixHelper(l,h),y.apply(e,u,c,n,l,b,H.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var S=this.unkeyedState+t.SETUP,M=e.slots,A=0,I=e.slots.length;A<I;A++){var T=M[A];if(T.attachmentState==S){var C=T.data.attachmentName;T.attachment=null==C?null:e.getAttachment(T.data.index,C)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,n,r){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,n,r);var i=0;0==e.mixDuration?(i=1,r==q.first&&(r=q.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=q.first&&(r=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,h=i<a.drawOrderThreshold,l=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==q.add)for(var g=0;g<c;g++)d[g].apply(n,l,u,s,v,r,H.mixOut);else{var p=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&x.setArraySize(a.timelinesRotation,c<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var y=0;y<c;y++){var b=d[y],S=H.mixOut,M=void 0,A=0;switch(p[y]){case t.SUBSEQUENT:if(!h&&R(b,ht))continue;M=r,A=v;break;case t.FIRST:M=q.setup,A=v;break;case t.HOLD_SUBSEQUENT:M=r,A=f;break;case t.HOLD_FIRST:M=q.setup,A=f;break;default:M=q.setup;var I=m[y];A=f*Math.max(0,1-I.mixTime/I.mixDuration)}a.totalAlpha+=A,R(b,K)?this.applyRotateTimeline(b,n,u,A,M,E,y<<1,w):R(b,at)?this.applyAttachmentTimeline(b,n,u,M,o):(x.webkit602BugfixHelper(A,r),h&&R(b,ht)&&M==q.setup&&(S=H.mixIn),b.apply(n,l,u,s,A,M,S))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,n,r,a,i){var s=n.slots[e.slotIndex];if(s.bone.active){var o,h=e.frames;if(r<h[0])a!=q.setup&&a!=q.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=h[h.length-1]?h.length-1:Q.binarySearch(h,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 h=t,l=h.frames,u=e.bones[h.boneIndex];if(u.active){var c=0,d=0;if(n<l[0])switch(a){case q.setup:u.rotation=u.data.rotation;default:return;case q.first:c=u.rotation,d=u.data.rotation}else if(c=a==q.setup?u.data.rotation:u.rotation,n>=l[l.length-K.ENTRIES])d=u.data.rotation+l[l.length+K.PREV_ROTATION];else{var f=Q.binarySearch(l,n,K.ENTRIES),v=l[f+K.PREV_ROTATION],g=l[f],p=h.getCurvePercent((f>>1)-1,1-(n-g)/(l[f+K.PREV_TIME]-g));d=l[f+K.ROTATION]-v,d=v+(d-=360*(16384-(16384.499999999996-d/360|0)))*p+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 x=0,y=0;o?(x=0,y=w):(x=i[s],y=i[s+1]);var b=w>0,S=x>=0;E.signum(y)!=E.signum(w)&&Math.abs(y)<=90&&(Math.abs(x)>180&&(x+=360*E.signum(x)),S=b),m=w+x-x%360,S!=b&&(m+=360*E.signum(x)),i[s]=m}i[s+1]=w,c+=m*r,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,n,null,1,a,H.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,h=s.length;o<h;o++){var l=s[o];if(l.time<i)break;l.time>r||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast<r)&&this.queue.complete(t);o<h;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]:(x.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=q.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==q.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=x.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=x.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var h=0;h<a;h++)i[h]=o.add(r[h].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var l=0;l<a;l++){var u=r[l],c=u.getPropertyId();if(o.add(c))if(null==n||R(u,at)||R(u,ht)||R(u,ot)||!n.animation.hasTimeline(c))i[l]=t.FIRST;else{for(var d=n.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[l]=t.HOLD_MIX,s[l]=d;continue t}break}i[l]=t.HOLD_FIRST}else i[l]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Vt.emptyAnimation=new Q("<empty>",[],0),Vt.SUBSEQUENT=0,Vt.FIRST=1,Vt.HOLD_SUBSEQUENT=2,Vt.HOLD_FIRST=3,Vt.HOLD_MIX=4,Vt.SETUP=1,Vt.CURRENT=2;var Pt,Ft=function(){function t(){this.mixBlend=q.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},t}(),Nt=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n<t.length;n+=2){var r=t[n],a=t[n+1];switch(r){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var h=0;h<e.length;h++)e[h].dispose&&e[h].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var l=0;l<e.length;l++)e[l].complete&&e[l].complete(a);break;case 5:var u=t[2+n++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Pt||(Pt={}));var Ot=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}(),Bt=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 y((function(){return new Array})),this.polygonIndicesPool=new y((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,h=r;o<h;++o)s[o]=t.isConcave(o,r,n,a);var l=this.triangles;for(l.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,g=a[d]<<1,p=n[f],m=n[f+1],w=n[v],E=n[v+1],x=n[g],y=n[g+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,p,m,M,A)&&t.positiveArea(p,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)%r}l.push(a[(r+c-1)%r]),l.push(a[c]),l.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var R=(--r+c-1)%r,I=c==r?0:c;s[R]=t.isConcave(R,r,n,a),s[I]=t.isConcave(I,r,n,a)}return 3==r&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l},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 h=-1,l=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,g=r[d],p=r[d+1],m=r[f],w=r[f+1],E=r[v],x=r[v+1],y=!1;if(h==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==l&&M==l&&(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(g),o.push(p),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),l=t.winding(g,p,m,w,E,x),h=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 I=s[0],T=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 Y=i[X];if(3==Y.length){var D=Y[0],U=Y[1],W=Y[2],q=a[X],H=q[q.length-2],G=q[q.length-1];if(D==I&&U==T){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,Y.length=0,o.push(H),o.push(G),s.push(W),_=V,k=P,V=H,P=G,X=0)}}}for(var Z=a.length-1;Z>=0;Z--)0==(o=a[Z]).length&&(a.splice(Z,1),this.polygonPool.free(o),s=i[Z],i.splice(Z,1),this.polygonIndicesPool.free(s));return a},t.isConcave=function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,s=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[s],n[s+1])},t.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},t.winding=function(t,e,n,r,a,i){var s=n-t,o=r-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),Lt=function(){function t(){this.triangulator=new Bt,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=x.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,h=s.length;o<h;o++){var l=s[o];t.makeClockwise(l),l.push(l[0]),l.push(l[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 h=this.clipOutput,l=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,v=0;l.length=0,u.length=0;t:for(var g=0;g<r;g+=3)for(var p=n[g]<<1,m=t[p],w=t[p+1],E=a[p],y=a[p+1],b=t[p=n[g+1]<<1],S=t[p+1],M=a[p],A=a[p+1],R=t[p=n[g+2]<<1],I=t[p+1],T=a[p],C=a[p+1],_=0;_<d;_++){var k=l.length;if(!this.clip(m,w,b,S,R,I,c[_],h)){var V=x.setArraySize(l,k+3*f);V[k]=m,V[k+1]=w,V[k+2]=i.r,V[k+3]=i.g,V[k+4]=i.b,V[k+5]=i.a,o?(V[k+6]=E,V[k+7]=y,V[k+8]=s.r,V[k+9]=s.g,V[k+10]=s.b,V[k+11]=s.a,V[k+12]=b,V[k+13]=S,V[k+14]=i.r,V[k+15]=i.g,V[k+16]=i.b,V[k+17]=i.a,V[k+18]=M,V[k+19]=A,V[k+20]=s.r,V[k+21]=s.g,V[k+22]=s.b,V[k+23]=s.a,V[k+24]=R,V[k+25]=I,V[k+26]=i.r,V[k+27]=i.g,V[k+28]=i.b,V[k+29]=i.a,V[k+30]=T,V[k+31]=C,V[k+32]=s.r,V[k+33]=s.g,V[k+34]=s.b,V[k+35]=s.a):(V[k+6]=E,V[k+7]=y,V[k+8]=b,V[k+9]=S,V[k+10]=i.r,V[k+11]=i.g,V[k+12]=i.b,V[k+13]=i.a,V[k+14]=M,V[k+15]=A,V[k+16]=R,V[k+17]=I,V[k+18]=i.r,V[k+19]=i.g,V[k+20]=i.b,V[k+21]=i.a,V[k+22]=T,V[k+23]=C),k=u.length;var P=x.setArraySize(u,k+3);P[k]=v,P[k+1]=v+1,P[k+2]=v+2,v+=3;continue t}var F=h.length;if(0!=F){for(var N=S-I,O=R-b,B=m-R,L=I-w,X=1/(N*B+O*(w-I)),Y=F>>1,D=this.clipOutput,U=x.setArraySize(l,k+Y*f),W=0;W<F;W+=2){var q=D[W],H=D[W+1];U[k]=q,U[k+1]=H,U[k+2]=i.r,U[k+3]=i.g,U[k+4]=i.b,U[k+5]=i.a;var G=q-R,j=H-I,z=(N*G+O*j)*X,Z=(L*G+B*j)*X,Q=1-z-Z;U[k+6]=E*z+M*Z+T*Q,U[k+7]=y*z+A*Z+C*Q,o&&(U[k+8]=s.r,U[k+9]=s.g,U[k+10]=s.b,U[k+11]=s.a),k+=f}k=u.length;var J=x.setArraySize(u,k+3*(Y-2));Y--;for(var K=1;K<Y;K++)J[k]=v,J[k+1]=v+K,J[k+2]=v+K+1,k+=3;v+=Y+1}}},e.clip=function(t,e,n,r,a,i,s,o){var h=o,l=!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],g=c[f+1],p=c[f+2],m=c[f+3],w=v-p,E=g-m,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],I=x[S+3],T=w*(I-m)-E*(R-p)>0;if(w*(A-m)-E*(M-p)>0){if(T){o.push(R),o.push(I);continue}var C=I-A,_=R-M,k=C*(p-v)-_*(m-g);if(Math.abs(k)>1e-6){var V=(_*(g-A)-C*(v-M))/k;o.push(v+(p-v)*V),o.push(g+(m-g)*V)}else o.push(v),o.push(g)}else if(T){var P=I-A,F=R-M,N=P*(p-v)-F*(m-g);if(Math.abs(N)>1e-6){var O=(F*(g-A)-P*(v-M))/N;o.push(v+(p-v)*O),o.push(g+(m-g)*O)}else o.push(v),o.push(g);o.push(R),o.push(I)}l=!0}if(b==o.length)return h.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(h!=o){h.length=0;for(var L=0,X=o.length-2;L<X;L++)h[L]=o[L]}else h.length=h.length-2;return l},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,h=n-3;o<h;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 l=0,u=n-2,c=n>>1;l<c;l+=2){var d=e[l],f=e[l+1],v=u-l;e[l]=e[v],e[l+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),Xt=function(){function t(){}var n=t.prototype;return n.initialize=function(t,n){var r=this._mesh=new e.BufferMesh(t),a=[new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0),new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0),new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)],i=4*Yt.VERTEX_STRIDE,s=i*n,o=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,s,e.BufferUsage.Dynamic),h=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic);this._indexBuffer=h,this._vertexBuffer=o,r.setVertexBufferBinding(o,i),r.setIndexBufferBinding(h,e.IndexFormat.UInt16),r.setVertexElements(a),r.addSubMesh(0,n)},n.changeBuffer=function(t,n){var r=4*Yt.VERTEX_STRIDE,a=r*n,i=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,a,e.BufferUsage.Dynamic),s=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic),o=this._mesh;this._indexBuffer=s,this._vertexBuffer=i,o.setVertexBufferBinding(i,r),o.setIndexBufferBinding(s,e.IndexFormat.UInt16)},Mt(t,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),t}(),Yt=function(){function t(t,e){this._clipper=new Lt,this._spineMesh=new Xt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this._engine=t,this._entity=e}var n=t.prototype;return n.initialize=function(n,r){if(n){var a=this._entity.getComponent(e.MeshRenderer);if(a){this._meshRenderer=a,r&&(this._setting=r);for(var i=n.defaultSkin.attachments,s=0,o=t.QUAD_TRIANGLES.length,h=0,l=i.length;h<l;h++){var u=i[h];for(var c in u){var d=u[c];if(d)if(R(d,A))s+=o;else{if(!R(d,T))continue;s+=d.triangles.length}}}this._vertexCount=s,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),a.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},n.buildMesh=function(n){var r=this._setting||{},a=r.useClipping,i=void 0===a||a,s=r.zSpacing,o=void 0===s?.01:s,h=0,l=0;this._subMeshItems.length=0;for(var u,c,d=this._meshRenderer,f=n.drawOrder,v=f.length,g=this._clipper,p=this._spineMesh,m=p.mesh,w=this._subMeshItems,E=this._vertices,x=0,y=0,b=0;b<v;b+=1){var S=f[b];if(S.bone.active){var M=S.getAttachment(),I=null,C=null,_=o*b,k=0,P=g.isClipping()?2:t.VERTEX_SIZE;if(R(M,A)){var F=M;I=F.color,E=this._vertices,k=4*P,F.computeWorldVertices(S.bone,E,0,P),u=t.QUAD_TRIANGLES,c=F.uvs,C=F.region.renderObject.texture}else if(R(M,T)){var N=M;I=N.color,E=this._vertices,(k=(N.worldVerticesLength>>1)*P)>E.length&&(E=this._vertices=new Float32Array(k)),N.computeWorldVertices(S,0,N.worldVerticesLength,E,0,P),u=N.triangles,c=N.uvs,C=N.region.renderObject.texture}else if(R(M,V)){if(i){var O=M;g.clipStart(S,O);continue}}else if(i){g.clipEndWithSlot(S);continue}if(null!=C){var B=void 0,L=void 0,X=void 0,Y=void 0,D=S.bone.skeleton.color,U=S.color,W=D.a*U.a*I.a,q=t.tempColor;if(q.set(D.r*U.r*I.r,D.g*U.g*I.g,D.b*U.b*I.b,W),g.isClipping()){g.clipTriangles(E,k,u,u.length,c,q,null,!1);var H=g.clippedVertices,G=g.clippedTriangles;B=H,L=H.length,X=G,Y=G.length}else{for(var j=E,z=2,Z=0,Q=k;z<Q;z+=P,Z+=2)j[z]=q.r,j[z+1]=q.g,j[z+2]=q.b,j[z+3]=q.a,j[z+4]=c[Z],j[z+5]=c[Z+1];B=E,L=k,X=u,Y=u.length}for(var J=h/t.VERTEX_STRIDE,K=this._verticesWithZ,$=h,tt=0;tt<L;)K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=_,K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++],K[$++]=B[tt++];h=$;var et=this._indices;for($=l,tt=0;tt<Y;$++,tt++)et[$]=X[tt]+J;var nt=S.data.name;if(this.separateSlots.includes(nt)){var rt=new e.SubMesh(l,Y);if(w.push({name:nt,subMesh:rt}),y>0){var at=new e.SubMesh(x,y);w.push({name:"default",subMesh:at}),y=0}x=l+Y}else y+=Y;l+=Y;for(var it=d.getMaterials(),st=it.length,ot=0;ot<st;ot+=1){var ht=it[ot];ht.shaderData.getTexture("material_SpineTexture")||ht.shaderData.setTexture("material_SpineTexture",C.texture)}}g.clipEndWithSlot(S)}else g.clipEndWithSlot(S)}if(g.clipEnd(),y>0){var lt=new e.SubMesh(x,y);w.push({name:"default",subMesh:lt}),y=0}if(w.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);m.clearSubMesh();for(var ut=w.length,ct=0;ct<ut;ct+=1)m.addSubMesh(w[ct].subMesh);this._needResize&&(p.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),p.vertexBuffer.setData(this._verticesWithZ),p.indexBuffer.setData(this._indices)},n.addSeparateSlot=function(t){this.separateSlots.push(t)},n._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},Mt(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();Yt.QUAD_TRIANGLES=[0,1,2,2,3,0],Yt.VERTEX_SIZE=8,Yt.VERTEX_STRIDE=9,Yt.tempColor=new w;var Dt=function(t){function n(r){var a,i=e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",n._spineVS,n._spineFS),s=(a=t.call(this,r,i)||this).renderState,o=s.blendState.targetBlendState;return o.enabled=!0,o.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,o.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.sourceAlphaBlendFactor=e.BlendFactor.One,o.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.colorBlendOperation=o.alphaBlendOperation=e.BlendOperation.Add,s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent,a}return r(n,t),n}(e.Material);Dt._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 ",Dt._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n ";var Ut=function(t){function n(e){var n;return(n=t.call(this,e)||this)._tempOffset=new b,n._tempSize=new b,n._tempArray=[0,0],n.autoUpdate=!0,n.autoUpdateBounds=!1,n._meshGenerator=new Yt(n.engine,e),n}r(n,t);var a=n.prototype;return a.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new kt(t);var n=new Ot(t);this._state=new Vt(n),this._meshGenerator.initialize(t,this.setting)},a.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!");var r=this.entity.getComponent(e.MeshRenderer);if(r||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)){this._meshGenerator.addSeparateSlot(t);var a=n._defaultMaterial.clone(),i=n._defaultMaterial.clone(),s=r.materialCount;r.setMaterial(s,a),r.setMaterial(s+1,i)}else console.warn("Slot: "+t+" not find.")},a.hackSeparateSlotTexture=function(t,n){this._meshGenerator.buildMesh(this._skeleton);var r=this._meshGenerator,a=r.separateSlots,i=r.subMeshItems;if(0!==a.length)if(a.includes(t)){var s=this.entity.getComponent(e.MeshRenderer),o=i.findIndex((function(e){return e.name===t}));s.getMaterial(o).shaderData.setTexture("material_SpineTexture",n)}else console.warn("Slot "+t+" is not separated. You should use addSeparateSlot to separate it");else console.warn("You need add separate slot")},a.onUpdate=function(t){this.autoUpdate&&this.updateState(t)},a.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()}},a.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},a.updateBounds=function(){var t,n=this.entity.getComponent(e.MeshRenderer).bounds,r=this._tempOffset,a=this._tempSize,i=this._tempArray,s=(null==(t=this.setting)?void 0:t.zSpacing)||.01,o=this._skeleton;o.getBounds(r,a,i);var h=o.drawOrder;n.min.set(r.x,r.y,0),n.max.set(r.x+a.x,r.y+a.y,h.length*s)},a._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=At({},this.setting);t.setting=e},a._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},a.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},n.getDefaultMaterial=function(t){return this._defaultMaterial&&this._defaultMaterial.engine===t||(this._defaultMaterial=new Dt(t),this._defaultMaterial.isGCIgnored=!0),this._defaultMaterial.clone()},Mt(n,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),n}(e.Script);a([e.ignoreClone],Ut.prototype,"_skeletonData",void 0),a([e.ignoreClone],Ut.prototype,"_skeleton",void 0),a([e.ignoreClone],Ut.prototype,"_state",void 0),a([e.ignoreClone],Ut.prototype,"_tempOffset",void 0),a([e.ignoreClone],Ut.prototype,"_tempSize",void 0),a([e.ignoreClone],Ut.prototype,"_tempArray",void 0),a([e.ignoreClone],Ut.prototype,"_meshGenerator",void 0),a([e.ignoreClone],Ut.prototype,"setting",void 0);var Wt=function(t){function n(){return t.apply(this,arguments)}r(n,t);var a=n.prototype;return a.load=function(t,n){var r=this;return new e.AssetPromise((function(e,a){"spine"!==t.type&&a("Asset type must be spine.");var i=null;t.urls?r.handleResource(n,t,i,e,a):r.request(t.url||"",{type:"json"}).then((function(s){s.jsonUrl&&s.atlasUrl&&s.pngUrl?(i=r.getResouceFromUrls([s.jsonUrl,s.atlasUrl,s.pngUrl]),r.handleResource(n,t,i,e,a)):r.handleResource(n,t,i,e,a)})).catch((function(s){r.handleResource(n,t,i,e,a)}))}))},a.handleResource=function(t,n,r,a,i){var s=this,o=t.engine;r||(!n.urls&&n.url&&this.checkUrl(n.url)&&(r=this.getResouceFromUrl(n.url)),n.urls&&this.checkUrls(n.urls)&&(r=this.getResouceFromUrls(n.urls)));var h,l=!1;h=new p(null,(function(t){return s.createAdaptiveTexture(t,o)}));var u=r.skeletonFile,c=r.atlasFile,f=r.textureFile;h.onLoadComplete=function(){try{var t;if(l)t=h.get(c);else{var n=h.get(c);t=new d(n,s.textureAssetPicker.bind(s,h,f))}var r=new P(t),v=(s.isBinFile(u)?new Et(r):new mt(r)).readSkeletonData(h.get(u)),g=new e.Entity(o),p=g.addComponent(e.MeshRenderer),m=Ut.getDefaultMaterial(o);p.setMaterial(m),g.addComponent(Ut).setSkeletonData(v),a(g)}catch(t){i(t)}};var v=this.isBinFile(u);u&&c&&f?(v?h.loadBinary(u,null,i):h.loadText(u,null,i),h.loadText(c,null,i),h.loadTexture(f,null,i)):u&&c&&!f?(l=!0,v?h.loadBinary(u,null,i):h.loadText(u,null,i),h.loadTextureAtlas(c,null,i)):i("Resouce param error")},a.textureAssetPicker=function(t,e){return t.get(e)},a.createAdaptiveTexture=function(t,e){return new qt(t,e)},a.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},a.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},a.getResouceFromUrl=function(t){var e=t,n=t,r=n.indexOf("?");return r>0&&(n=n.substr(0,r)),{skeletonFile:e,atlasFile:n=n.substr(0,n.lastIndexOf("."))+".atlas"}},a.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),n=e.skeletonFile,r=e.atlasFile;return e.textureFile,!(!n||!r)||(console.error("Lack "+(n?"":"skeletonFile")+(r?" atlasFile":"")),!1)},a.getResouceFromUrls=function(t){for(var e,n,r,a=0;a<t.length;a+=1){var i=t[a],s=this.getExtFromUrl(i);"json"!==s&&"bin"!==s||(e=i),"atlas"===s&&(n=i);["png","jpg","webp","jpeg"].includes(s)&&(r=i)}return{skeletonFile:e,atlasFile:n,textureFile:r}},a.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},n}(e.Loader);Wt=a([e.resourceLoader("spine",["json","bin"])],Wt);var qt=function(t){function n(n,r){var a;return(a=t.call(this,n)||this).texture=new e.Texture2D(r,n.width,n.height),a.texture.setImageSource(n),a.texture.generateMipmaps(),a}r(n,t);var a=n.prototype;return a.setFilters=function(t,n){t===o.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:n===o.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear},a.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},a.dispose=function(){},n}(l),Ht=function(t){function e(){var e;return(e=t.apply(this,arguments)||this)._animationName="",e._loop=!0,e._autoPlay=!0,e._scale=1,e._spineAnimation=null,e._animationNames=[],e}r(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._removeResource=function(){this._resource&&this._spineAnimation&&(this.entity.removeChild(this._resource),this._resource.destroy(),this._resource=null,this._spineAnimation=null,this._animationName="")},Mt(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(Ut),this._spineAnimation.scale=this._scale,this._autoPlay)){var n=this._spineAnimation.skeletonData.animations,r=this._animationNames;r.length=0;for(var a=0,i=n.length;a<i;++a)r.push(n[a].name);r.length>0&&this.play(this._animationName||r[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:"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}(e.Script),Gt="1.1.0-beta.12";e.Loader.registerClass("SpineRenderer",Ht),console.log("Galacean spine version: "+Gt),t.AssetManager=p,t.AtlasAttachmentLoader=P,t.SkeletonBinary=Et,t.SkeletonJson=mt,t.SpineAnimation=Ut,t.SpineRenderer=Ht,t.Texture=l,t.TextureAtlas=d,t.version=Gt,Object.defineProperty(t,"__esModule",{value:!0})}));