@galacean/engine-spine 0.0.0-experimental-engine-spine-20240821 → 0.0.0-experimental-engine-spine-20241107

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/module.js CHANGED
@@ -1,2 +1,2 @@
1
- import{request as t,TextureFilterMode as e,TextureWrapMode as n,AssetType as r,BlendFactor as a,BlendOperation as i,SubPrimitive as s,BoundingBox as o,Vector3 as l,Shader as h,CullMode as u,RenderQueueType as c,Material as d,VertexElement as f,VertexElementFormat as v,Buffer as p,BufferBindFlag as m,BufferUsage as g,VertexBufferBinding as w,IndexBufferBinding as x,IndexFormat as E,Renderer as y,deepClone as b,ignoreClone as S,Primitive as A,ReferResource as I,resourceLoader as M,AssetPromise as T,Loader as R}from"@galacean/engine";function C(t,e,n,r,a,i,s){try{var o=t[i](s),l=o.value}catch(t){return void n(t)}o.done?e(l):Promise.resolve(l).then(r,a)}function _(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var i=t.apply(e,n);function s(t){C(i,r,a,s,o,"next",t)}function o(t){C(i,r,a,s,o,"throw",t)}s(void 0)}))}}function V(t,e){return V=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},V(t,e)}function P(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&&V(t,e)}function k(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 F(t,e){var n,r,a,i,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(s=0)),s;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(a=s.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function N(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 O(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 N(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)?N(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 B(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}"function"==typeof SuppressedError&&SuppressedError;var X=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}(),L=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}();L.WHITE=new L(1,1,1,1),L.RED=new L(1,0,0,1),L.GREEN=new L(0,1,0,1),L.BLUE=new L(0,0,1,1),L.MAGENTA=new L(1,0,1,1);var Y=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}();Y.PI=3.1415927,Y.PI2=2*Y.PI,Y.radiansToDegrees=180/Y.PI,Y.radDeg=Y.radiansToDegrees,Y.degreesToRadians=Y.PI/180,Y.degRad=Y.degreesToRadians;var D=function(){function t(){}return t.prototype.apply=function(t,e,n){return t+(e-t)*this.applyInternal(n)},t}(),U=function(t){function e(e){var n;return(n=t.call(this)||this).power=2,n.power=e,n}return P(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(D),W=function(t){function e(e){return t.call(this,e)}return P(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(U),q=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}();q.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var H=function(){function t(){}return t.logBones=function(t){for(var e=0;e<t.bones.length;e++){var n=t.bones[e];console.log(n.data.name+", "+n.a+", "+n.b+", "+n.c+", "+n.d+", "+n.worldX+", "+n.worldY)}},t}(),j=function(){function t(t){this.items=new Array,this.instantiator=t}var e=t.prototype;return e.obtain=function(){return this.items.length>0?this.items.pop():this.instantiator()},e.free=function(t){t.reset&&t.reset(),this.items.push(t)},e.freeAll=function(t){for(var e=0;e<t.length;e++)this.free(t[e])},e.clear=function(){this.items.length=0},t}(),G=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.normalize=function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this},t}(),z=function(){function t(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.frameTime=0}return t.prototype.update=function(){var t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}(),Z=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}var e=t.prototype;return e.hasEnoughData=function(){return this.addedValues>=this.values.length},e.addValue=function(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0},e.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0},t}();function Q(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var J=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},K=function(t){function e(n){var r;return(r=t.call(this,n)||this).id=(65535&e.nextID++)<<11,r.worldVerticesLength=0,r.deformAttachment=Q(r),r}P(e,t);var n=e.prototype;return n.computeWorldVertices=function(t,e,n,r,a,i){n=a+(n>>1)*i;var s=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,d=0;d<e;d+=2){var f=h[u];u+=f+1,c+=f}var v=s.bones;if(0==o.length)for(var p=a,m=3*c;p<n;p+=i){var g=0,w=0,x=h[u++];for(x+=u;u<x;u++,m+=3){var E=v[h[u]],y=l[m],b=l[m+1],S=l[m+2];g+=(y*E.a+b*E.b+E.worldX)*S,w+=(y*E.c+b*E.d+E.worldY)*S}r[p]=g,r[p+1]=w}else for(var A=o,I=a,M=3*c,T=c<<1;I<n;I+=i){var R=0,C=0,_=h[u++];for(_+=u;u<_;u++,M+=3,T+=2){var V=v[h[u]],P=l[M]+A[T],k=l[M+1]+A[T+1],F=l[M+2];R+=(P*V.a+k*V.b+V.worldX)*F,C+=(P*V.c+k*V.d+V.worldY)*F}r[I]=R,r[I+1]=C}}else{o.length>0&&(l=o);for(var N=t.bone,O=N.worldX,B=N.worldY,X=N.a,L=N.b,Y=N.c,D=N.d,U=e,W=a;W<n;U+=2,W+=i){var q=l[U],H=l[U+1];r[W]=q*X+H*L+O,r[W+1]=q*Y+H*D+B}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),q.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=q.newFloatArray(this.vertices.length),q.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(J);K.nextID=0;var $,tt,et,nt=function(){function t(t,e,n){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=n}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,n,r,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(n%=this.duration,e>0&&(e%=this.duration));for(var l=this.timelines,h=0,u=l.length;h<u;h++)l[h].apply(t,e,n,a,i,s,o)},t.binarySearch=function(t,e,n){void 0===n&&(n=1);var r=0,a=t.length/n-2;if(0==a)return n;for(var i=a>>>1;;){if(t[(i+1)*n]<=e?r=i+1:a=i,r==a)return(r+1)*n;i=r+a>>>1}},t.linearSearch=function(t,e,n){for(var r=0,a=t.length-n;r<=a;r+=n)if(t[r]>e)return r;return-1},t}();!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}($||($={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(tt||(tt={})),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"}(et||(et={}));var rt=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=q.newFloatArray((e-1)*t.BEZIER_SIZE)}var e=t.prototype;return e.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},e.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},e.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},e.getCurveType=function(e){var n=e*t.BEZIER_SIZE;if(n==this.curves.length)return t.LINEAR;var r=this.curves[n];return r==t.LINEAR?t.LINEAR:r==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,n,r,a,i){var s=.03*(2*-n+a),o=.03*(2*-r+i),l=.006*(3*(n-a)+1),h=.006*(3*(r-i)+1),u=2*s+l,c=2*o+h,d=.3*n+s+.16666667*l,f=.3*r+o+.16666667*h,v=e*t.BEZIER_SIZE,p=this.curves;p[v++]=t.BEZIER;for(var m=d,g=f,w=v+t.BEZIER_SIZE-1;v<w;v+=2)p[v]=m,p[v+1]=g,d+=u,f+=c,u+=l,c+=h,m+=d,g+=f},e.getCurvePercent=function(e,n){n=Y.clamp(n,0,1);var r=this.curves,a=e*t.BEZIER_SIZE,i=r[a];if(i==t.LINEAR)return n;if(i==t.STEPPED)return 0;for(var s=0,o=++a,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=r[a])>=n){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=r[a-2],u=r[a-1]),u+(r[a+1]-u)*(n-h)/(s-h)}var c=r[a-1];return c+(1-c)*(n-s)/(1-s)},t}();rt.LINEAR=0,rt.STEPPED=1,rt.BEZIER=2,rt.BEZIER_SIZE=19;var at=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=q.newFloatArray(e<<1),n}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return 0+this.boneIndex},n.setFrame=function(t,n,r){t<<=1,this.frames[t]=n,this.frames[t+e.ROTATION]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.rotation=h.data.rotation);case 1:var u=h.data.rotation-h.rotation;h.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(r>=l[l.length-e.ENTRIES]){var c=l[l.length+e.PREV_ROTATION];switch(s){case 0:h.rotation=h.data.rotation+c*i;break;case 1:case 2:c+=h.data.rotation-h.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:h.rotation+=c*i}}else{var d=nt.binarySearch(l,r,e.ENTRIES),f=l[d+e.PREV_ROTATION],v=l[d],p=this.getCurvePercent((d>>1)-1,1-(r-v)/(l[d+e.PREV_TIME]-v)),m=l[d+e.ROTATION]-f;switch(m=f+(m-360*(16384-(16384.499999999996-m/360|0)))*p,s){case 0:h.rotation=h.data.rotation+(m-360*(16384-(16384.499999999996-m/360|0)))*i;break;case 1:case 2:m+=h.data.rotation-h.rotation;case 3:h.rotation+=(m-360*(16384-(16384.499999999996-m/360|0)))*i}}},e}(rt);at.ENTRIES=2,at.PREV_TIME=-2,at.PREV_ROTATION=-1,at.ROTATION=1;var it=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=q.newFloatArray(n*e.ENTRIES),r}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(1<<24)+this.boneIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.X]=r,this.frames[t+e.Y]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.x=h.data.x,void(h.y=h.data.y);case 1:h.x+=(h.data.x-h.x)*i,h.y+=(h.data.y-h.y)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=nt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}switch(s){case 0:h.x=h.data.x+u*i,h.y=h.data.y+c*i;break;case 1:case 2:h.x+=(h.data.x+u-h.x)*i,h.y+=(h.data.y+c-h.y)*i;break;case 3:h.x+=u*i,h.y+=c*i}}},e}(rt);it.ENTRIES=3,it.PREV_TIME=-3,it.PREV_X=-2,it.PREV_Y=-1,it.X=1,it.Y=2;var st=function(t){function e(e){return t.call(this,e)}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(2<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case 1:h.scaleX+=(h.data.scaleX-h.scaleX)*i,h.scaleY+=(h.data.scaleY-h.scaleY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X]*h.data.scaleX,c=l[l.length+e.PREV_Y]*h.data.scaleY;else{var d=nt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u=(u+(l[d+e.X]-u)*v)*h.data.scaleX,c=(c+(l[d+e.Y]-c)*v)*h.data.scaleY}if(1==i)3==s?(h.scaleX+=u-h.data.scaleX,h.scaleY+=c-h.data.scaleY):(h.scaleX=u,h.scaleY=c);else{var p=0,m=0;if(1==o)switch(s){case 0:p=h.data.scaleX,m=h.data.scaleY,h.scaleX=p+(Math.abs(u)*Y.signum(p)-p)*i,h.scaleY=m+(Math.abs(c)*Y.signum(m)-m)*i;break;case 1:case 2:p=h.scaleX,m=h.scaleY,h.scaleX=p+(Math.abs(u)*Y.signum(p)-p)*i,h.scaleY=m+(Math.abs(c)*Y.signum(m)-m)*i;break;case 3:p=h.scaleX,m=h.scaleY,h.scaleX=p+(Math.abs(u)*Y.signum(p)-h.data.scaleX)*i,h.scaleY=m+(Math.abs(c)*Y.signum(m)-h.data.scaleY)*i}else switch(s){case 0:p=Math.abs(h.data.scaleX)*Y.signum(u),m=Math.abs(h.data.scaleY)*Y.signum(c),h.scaleX=p+(u-p)*i,h.scaleY=m+(c-m)*i;break;case 1:case 2:p=Math.abs(h.scaleX)*Y.signum(u),m=Math.abs(h.scaleY)*Y.signum(c),h.scaleX=p+(u-p)*i,h.scaleY=m+(c-m)*i;break;case 3:p=Y.signum(u),m=Y.signum(c),h.scaleX=Math.abs(h.scaleX)*p+(u-Math.abs(h.data.scaleX)*p)*i,h.scaleY=Math.abs(h.scaleY)*m+(c-Math.abs(h.data.scaleY)*m)*i}}}},e}(it),ot=function(t){function e(e){return t.call(this,e)}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(3<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.shearX=h.data.shearX,void(h.shearY=h.data.shearY);case 1:h.shearX+=(h.data.shearX-h.shearX)*i,h.shearY+=(h.data.shearY-h.shearY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=nt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}switch(s){case 0:h.shearX=h.data.shearX+u*i,h.shearY=h.data.shearY+c*i;break;case 1:case 2:h.shearX+=(h.data.shearX+u-h.shearX)*i,h.shearY+=(h.data.shearY+c-h.shearY)*i;break;case 3:h.shearX+=u*i,h.shearY+=c*i}}},e}(it),lt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=q.newFloatArray(n*e.ENTRIES),r}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(5<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return void l.color.setFromColor(l.data.color);case 1:var u=l.color,c=l.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,v=0,p=0;if(r>=h[h.length-e.ENTRIES]){var m=h.length;d=h[m+e.PREV_R],f=h[m+e.PREV_G],v=h[m+e.PREV_B],p=h[m+e.PREV_A]}else{var g=nt.binarySearch(h,r,e.ENTRIES);d=h[g+e.PREV_R],f=h[g+e.PREV_G],v=h[g+e.PREV_B],p=h[g+e.PREV_A];var w=h[g],x=this.getCurvePercent(g/e.ENTRIES-1,1-(r-w)/(h[g+e.PREV_TIME]-w));d+=(h[g+e.R]-d)*x,f+=(h[g+e.G]-f)*x,v+=(h[g+e.B]-v)*x,p+=(h[g+e.A]-p)*x}if(1==i)l.color.set(d,f,v,p);else{var E=l.color;0==s&&E.setFromColor(l.data.color),E.add((d-E.r)*i,(f-E.g)*i,(v-E.b)*i,(p-E.a)*i)}}}},e}(rt);lt.ENTRIES=5,lt.PREV_TIME=-5,lt.PREV_R=-4,lt.PREV_G=-3,lt.PREV_B=-2,lt.PREV_A=-1,lt.R=1,lt.G=2,lt.B=3,lt.A=4;var ht=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=q.newFloatArray(n*e.ENTRIES),r}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(14<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s,o,l,h){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s,this.frames[t+e.R2]=o,this.frames[t+e.G2]=l,this.frames[t+e.B2]=h},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return l.color.setFromColor(l.data.color),void l.darkColor.setFromColor(l.data.darkColor);case 1:var u=l.color,c=l.darkColor,d=l.data.color,f=l.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var v=0,p=0,m=0,g=0,w=0,x=0,E=0;if(r>=h[h.length-e.ENTRIES]){var y=h.length;v=h[y+e.PREV_R],p=h[y+e.PREV_G],m=h[y+e.PREV_B],g=h[y+e.PREV_A],w=h[y+e.PREV_R2],x=h[y+e.PREV_G2],E=h[y+e.PREV_B2]}else{var b=nt.binarySearch(h,r,e.ENTRIES);v=h[b+e.PREV_R],p=h[b+e.PREV_G],m=h[b+e.PREV_B],g=h[b+e.PREV_A],w=h[b+e.PREV_R2],x=h[b+e.PREV_G2],E=h[b+e.PREV_B2];var S=h[b],A=this.getCurvePercent(b/e.ENTRIES-1,1-(r-S)/(h[b+e.PREV_TIME]-S));v+=(h[b+e.R]-v)*A,p+=(h[b+e.G]-p)*A,m+=(h[b+e.B]-m)*A,g+=(h[b+e.A]-g)*A,w+=(h[b+e.R2]-w)*A,x+=(h[b+e.G2]-x)*A,E+=(h[b+e.B2]-E)*A}if(1==i)l.color.set(v,p,m,g),l.darkColor.set(w,x,E,1);else{var I=l.color,M=l.darkColor;0==s&&(I.setFromColor(l.data.color),M.setFromColor(l.data.darkColor)),I.add((v-I.r)*i,(p-I.g)*i,(m-I.b)*i,(g-I.a)*i),M.add((w-M.r)*i,(x-M.g)*i,(E-M.b)*i,0)}}}},e}(rt);ht.ENTRIES=8,ht.PREV_TIME=-8,ht.PREV_R=-7,ht.PREV_G=-6,ht.PREV_B=-5,ht.PREV_A=-4,ht.PREV_R2=-3,ht.PREV_G2=-2,ht.PREV_B2=-1,ht.R=1,ht.G=2,ht.B=3,ht.A=4,ht.R2=5,ht.G2=6,ht.B2=7;var ut=function(){function t(t){this.frames=q.newFloatArray(t),this.attachmentNames=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return(4<<24)+this.slotIndex},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var l=this.frames;if(n<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=n>=l[l.length-1]?l.length-1:nt.binarySearch(l,n,1)-1;var u=this.attachmentNames[h];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,n){e.attachment=null==n?null:t.getAttachment(this.slotIndex,n)},t}(),ct=null,dt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=q.newFloatArray(e),n.frameVertices=new Array(e),null==ct&&(ct=q.newFloatArray(64)),n}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},n.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},n.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var l=o.getAttachment();if(B(l,K)&&l.deformAttachment==this.attachment){var h=o.deform;0==h.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(n<d[0]){var f=l;switch(i){case 0:return void(h.length=0);case 1:if(1==a){h.length=0;break}var v=q.setArraySize(h,c);if(null==f.bones)for(var p=f.vertices,m=0;m<c;m++)v[m]+=(p[m]-v[m])*a;else{a=1-a;for(m=0;m<c;m++)v[m]*=a}}}else{var g=q.setArraySize(h,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var x=l;if(null==x.bones)for(var E=x.vertices,y=0;y<c;y++)g[y]+=w[y]-E[y];else for(var b=0;b<c;b++)g[b]+=w[b]}else q.arrayCopy(w,0,g,0,c);else switch(i){case 0:var S=l;if(null==S.bones)for(var A=S.vertices,I=0;I<c;I++){var M=A[I];g[I]=M+(w[I]-M)*a}else for(var T=0;T<c;T++)g[T]=w[T]*a;break;case 1:case 2:for(var R=0;R<c;R++)g[R]+=(w[R]-g[R])*a;break;case 3:var C=l;if(null==C.bones)for(var _=C.vertices,V=0;V<c;V++)g[V]+=(w[V]-_[V])*a;else for(var P=0;P<c;P++)g[P]+=w[P]*a}}else{var k=nt.binarySearch(d,n),F=u[k-1],N=u[k],O=d[k],X=this.getCurvePercent(k-1,1-(n-O)/(d[k-1]-O));if(1==a)if(3==i){var L=l;if(null==L.bones)for(var Y=L.vertices,D=0;D<c;D++){var U=F[D];g[D]+=U+(N[D]-U)*X-Y[D]}else for(var W=0;W<c;W++){var H=F[W];g[W]+=H+(N[W]-H)*X}}else for(var j=0;j<c;j++){var G=F[j];g[j]=G+(N[j]-G)*X}else switch(i){case 0:var z=l;if(null==z.bones)for(var Z=z.vertices,Q=0;Q<c;Q++){var J=F[Q],$=Z[Q];g[Q]=$+(J+(N[Q]-J)*X-$)*a}else for(var tt=0;tt<c;tt++){var et=F[tt];g[tt]=(et+(N[tt]-et)*X)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var at=F[rt];g[rt]+=(at+(N[rt]-at)*X-g[rt])*a}break;case 3:var it=l;if(null==it.bones)for(var st=it.vertices,ot=0;ot<c;ot++){var lt=F[ot];g[ot]+=(lt+(N[ot]-lt)*X-st[ot])*a}else for(var ht=0;ht<c;ht++){var ut=F[ht];g[ht]+=(ut+(N[ht]-ut)*X)*a}}}}}}},e}(rt),ft=function(){function t(t){this.frames=q.newFloatArray(t),this.events=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 7<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.apply=function(t,e,n,r,a,i,s){if(null!=r){var o=this.frames,l=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(n<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=nt.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&n>=o[h];h++)r.push(this.events[h])}}},t}(),vt=function(){function t(t){this.frames=q.newFloatArray(t),this.drawOrders=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 8<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.drawOrder,l=t.slots;if(1!=s){var h=this.frames;if(n<h[0])0!=i&&1!=i||q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=h[h.length-1]?h.length-1:nt.binarySearch(h,n)-1;var c=this.drawOrders[u];if(null==c)q.arrayCopy(l,0,o,0,l.length);else for(var d=0,f=c.length;d<f;d++)o[d]=l[c[d]]}}else 0==i&&q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),pt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=q.newFloatArray(n*e.ENTRIES),r}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},n.setFrame=function(t,n,r,a,i,s,o){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.MIX]=r,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,void(h.stretch=h.data.stretch);case 1:h.mix+=(h.data.mix-h.mix)*i,h.softness+=(h.data.softness-h.softness)*i,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}else if(r>=l[l.length-e.ENTRIES])0==s?(h.mix=h.data.mix+(l[l.length+e.PREV_MIX]-h.data.mix)*i,h.softness=h.data.softness+(l[l.length+e.PREV_SOFTNESS]-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH])):(h.mix+=(l[l.length+e.PREV_MIX]-h.mix)*i,h.softness+=(l[l.length+e.PREV_SOFTNESS]-h.softness)*i,0==o&&(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH]));else{var u=nt.binarySearch(l,r,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(r-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*v-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*v-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH])):(h.mix+=(c+(l[u+e.MIX]-c)*v-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*v-h.softness)*i,0==o&&(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH]))}},e}(rt);pt.ENTRIES=6,pt.PREV_TIME=-6,pt.PREV_MIX=-5,pt.PREV_SOFTNESS=-4,pt.PREV_BEND_DIRECTION=-3,pt.PREV_COMPRESS=-2,pt.PREV_STRETCH=-1,pt.MIX=1,pt.SOFTNESS=2,pt.BEND_DIRECTION=3,pt.COMPRESS=4,pt.STRETCH=5;var mt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=q.newFloatArray(n*e.ENTRIES),r}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(r<l[0]){var u=h.data;switch(s){case 0:return h.rotateMix=u.rotateMix,h.translateMix=u.translateMix,h.scaleMix=u.scaleMix,void(h.shearMix=u.shearMix);case 1:h.rotateMix+=(u.rotateMix-h.rotateMix)*i,h.translateMix+=(u.translateMix-h.translateMix)*i,h.scaleMix+=(u.scaleMix-h.scaleMix)*i,h.shearMix+=(u.shearMix-h.shearMix)*i}}else{var c=0,d=0,f=0,v=0;if(r>=l[l.length-e.ENTRIES]){var p=l.length;c=l[p+e.PREV_ROTATE],d=l[p+e.PREV_TRANSLATE],f=l[p+e.PREV_SCALE],v=l[p+e.PREV_SHEAR]}else{var m=nt.binarySearch(l,r,e.ENTRIES);c=l[m+e.PREV_ROTATE],d=l[m+e.PREV_TRANSLATE],f=l[m+e.PREV_SCALE],v=l[m+e.PREV_SHEAR];var g=l[m],w=this.getCurvePercent(m/e.ENTRIES-1,1-(r-g)/(l[m+e.PREV_TIME]-g));c+=(l[m+e.ROTATE]-c)*w,d+=(l[m+e.TRANSLATE]-d)*w,f+=(l[m+e.SCALE]-f)*w,v+=(l[m+e.SHEAR]-v)*w}if(0==s){var x=h.data;h.rotateMix=x.rotateMix+(c-x.rotateMix)*i,h.translateMix=x.translateMix+(d-x.translateMix)*i,h.scaleMix=x.scaleMix+(f-x.scaleMix)*i,h.shearMix=x.shearMix+(v-x.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(v-h.shearMix)*i}},e}(rt);mt.ENTRIES=5,mt.PREV_TIME=-5,mt.PREV_ROTATE=-4,mt.PREV_TRANSLATE=-3,mt.PREV_SCALE=-2,mt.PREV_SHEAR=-1,mt.ROTATE=1,mt.TRANSLATE=2,mt.SCALE=3,mt.SHEAR=4;var gt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=q.newFloatArray(n*e.ENTRIES),r}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.VALUE]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.position=h.data.position);case 1:h.position+=(h.data.position-h.position)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=nt.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.position=h.data.position+(u-h.data.position)*i:h.position+=(u-h.position)*i}},e}(rt);gt.ENTRIES=2,gt.PREV_TIME=-2,gt.PREV_VALUE=-1,gt.VALUE=1;var wt=function(t){function e(e){return t.call(this,e)}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.spacing=h.data.spacing);case 1:h.spacing+=(h.data.spacing-h.spacing)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=nt.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.spacing=h.data.spacing+(u-h.data.spacing)*i:h.spacing+=(u-h.spacing)*i}},e}(gt),xt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=q.newFloatArray(n*e.ENTRIES),r}P(e,t);var n=e.prototype;return n.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.rotateMix=h.data.rotateMix,void(h.translateMix=h.data.translateMix);case 1:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*i,h.translateMix+=(h.data.translateMix-h.translateMix)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=nt.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*v,c+=(l[d+e.TRANSLATE]-c)*v}0==s?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*i,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*i):(h.rotateMix+=(u-h.rotateMix)*i,h.translateMix+=(c-h.translateMix)*i)}},e}(rt);xt.ENTRIES=3,xt.PREV_TIME=-3,xt.PREV_ROTATE=-2,xt.PREV_TRANSLATE=-1,xt.ROTATE=1,xt.TRANSLATE=2;var Et=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 St(this),this.propertyIDs=new X,this.animationsChanged=!1,this.trackEntryPool=new j((function(){return new bt})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n<r;n++){var a=e[n];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(n,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)},e.apply=function(e){if(null==e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,r=this.tracks,a=!1,i=0,s=r.length;i<s;i++){var o=r[i];if(!(null==o||o.delay>0)){a=!0;var l=0==i?$.first:o.mixBlend,h=o.alpha;null!=o.mixingFrom?h*=this.applyMixingFrom(o,e,l):o.trackTime>=o.trackEnd&&null==o.next&&(h=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==h||l==$.add)for(var v=0;v<d;v++){q.webkit602BugfixHelper(h,l);var p=f[v];B(p,ut)?this.applyAttachmentTimeline(p,e,c,l,!0):p.apply(e,u,c,n,h,l,tt.mixIn)}else{var m=o.timelineMode,g=0==o.timelinesRotation.length;g&&q.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,x=0;x<d;x++){var E=f[x],y=m[x]==t.SUBSEQUENT?l:$.setup;B(E,at)?this.applyRotateTimeline(E,e,c,h,y,w,x<<1,g):B(E,ut)?this.applyAttachmentTimeline(E,e,c,l,!0):(q.webkit602BugfixHelper(h,l),E.apply(e,u,c,n,h,y,tt.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var b=this.unkeyedState+t.SETUP,S=e.slots,A=0,I=e.slots.length;A<I;A++){var M=S[A];if(M.attachmentState==b){var T=M.data.attachmentName;M.attachment=null==T?null:e.getAttachment(M.data.index,T)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,n,r){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,n,r);var i=0;0==e.mixDuration?(i=1,r==$.first&&(r=$.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=$.first&&(r=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,l=i<a.drawOrderThreshold,h=a.animationLast,u=a.getAnimationTime(),c=a.animation.timelines.length,d=a.animation.timelines,f=a.alpha*e.interruptAlpha,v=f*(1-i);if(r==$.add)for(var p=0;p<c;p++)d[p].apply(n,h,u,s,v,r,tt.mixOut);else{var m=a.timelineMode,g=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&q.setArraySize(a.timelinesRotation,c<<1,null);var x=a.timelinesRotation;a.totalAlpha=0;for(var E=0;E<c;E++){var y=d[E],b=tt.mixOut,S=void 0,A=0;switch(m[E]){case t.SUBSEQUENT:if(!l&&B(y,vt))continue;S=r,A=v;break;case t.FIRST:S=$.setup,A=v;break;case t.HOLD_SUBSEQUENT:S=r,A=f;break;case t.HOLD_FIRST:S=$.setup,A=f;break;default:S=$.setup;var I=g[E];A=f*Math.max(0,1-I.mixTime/I.mixDuration)}a.totalAlpha+=A,B(y,at)?this.applyRotateTimeline(y,n,u,A,S,x,E<<1,w):B(y,ut)?this.applyAttachmentTimeline(y,n,u,S,o):(q.webkit602BugfixHelper(A,r),l&&B(y,vt)&&S==$.setup&&(b=tt.mixIn),y.apply(n,h,u,s,A,S,b))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,n,r,a,i){var s=n.slots[e.slotIndex];if(s.bone.active){var o,l=e.frames;if(r<l[0])a!=$.setup&&a!=$.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=l[l.length-1]?l.length-1:nt.binarySearch(l,r)-1,this.setAttachment(n,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,n,r,a){n.attachment=null==r?null:e.getAttachment(n.data.index,r),a&&(n.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,n,r,a,i,s,o){if(o&&(i[s]=0),1!=r){var l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var c=0,d=0;if(n<h[0])switch(a){case $.setup:u.rotation=u.data.rotation;default:return;case $.first:c=u.rotation,d=u.data.rotation}else if(c=a==$.setup?u.data.rotation:u.rotation,n>=h[h.length-at.ENTRIES])d=u.data.rotation+h[h.length+at.PREV_ROTATION];else{var f=nt.binarySearch(h,n,at.ENTRIES),v=h[f+at.PREV_ROTATION],p=h[f],m=l.getCurvePercent((f>>1)-1,1-(n-p)/(h[f+at.PREV_TIME]-p));d=h[f+at.ROTATION]-v,d=v+(d-=360*(16384-(16384.499999999996-d/360|0)))*m+u.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var g=0,w=d-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))g=i[s];else{var x=0,E=0;o?(x=0,E=w):(x=i[s],E=i[s+1]);var y=w>0,b=x>=0;Y.signum(E)!=Y.signum(w)&&Math.abs(E)<=90&&(Math.abs(x)>180&&(x+=360*Y.signum(x)),b=y),g=w+x-x%360,b!=y&&(g+=360*Y.signum(x)),i[s]=g}i[s+1]=w,c+=g*r,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,n,null,1,a,tt.mixIn)},e.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,s=this.events,o=0,l=s.length;o<l;o++){var h=s[o];if(h.time<i)break;h.time>r||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast<r)&&this.queue.complete(t);o<l;o++){s[o].time<n||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,r=!1):this.disposeNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i},e.addAnimation=function(t,e,n,r){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)},e.addAnimationWith=function(t,e,n,r){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,n,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,r<=0){var s=a.animationEnd-a.animationStart;0!=s?(a.loop?r+=s*(1+(a.trackTime/s|0)):r+=Math.max(s,a.trackTime),r-=this.data.getMix(a.animation,e)):r=a.trackTime}return i.delay=r,i},e.setEmptyAnimation=function(e,n){var r=this.setAnimationWith(e,t.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.addEmptyAnimation=function(e,n,r){r<=0&&(r-=n);var a=this.addAnimationWith(e,t.emptyAnimation,!1,r);return a.mixDuration=n,a.trackEnd=n,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n<r;n++){var a=this.tracks[n];null!=a&&this.setEmptyAnimation(a.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(q.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=$.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==$.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=q.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=q.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var l=0;l<a;l++)i[l]=o.add(r[l].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var h=0;h<a;h++){var u=r[h],c=u.getPropertyId();if(o.add(c))if(null==n||B(u,ut)||B(u,vt)||B(u,ft)||!n.animation.hasTimeline(c))i[h]=t.FIRST;else{for(var d=n.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[h]=t.HOLD_MIX,s[h]=d;continue t}break}i[h]=t.HOLD_FIRST}else i[h]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Et.emptyAnimation=new nt("<empty>",[],0),Et.SUBSEQUENT=0,Et.FIRST=1,Et.HOLD_SUBSEQUENT=2,Et.HOLD_FIRST=3,Et.HOLD_MIX=4,Et.SETUP=1,Et.CURRENT=2;var yt,bt=function(){function t(){this.mixBlend=$.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}(),St=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n<t.length;n+=2){var r=t[n],a=t[n+1];switch(r){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var h=0;h<e.length;h++)e[h].complete&&e[h].complete(a);break;case 5:var u=t[2+n++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(yt||(yt={}));var At=function(){function t(){}var e=t.prototype;return e.start=function(t){},e.interrupt=function(t){},e.end=function(t){},e.dispose=function(t){},e.complete=function(t){},e.event=function(t,e){},t}(),It=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}();function Mt(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 Tt(t,e,n){return e&&Mt(t.prototype,e),n&&Mt(t,n),t}var Rt,Ct,_t=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"}(Rt||(Rt={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(Ct||(Ct={}));var Vt=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},Pt=function(t){function e(){return t.apply(this,arguments)}P(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(_t),kt=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 Ft(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 Ot;s.name=i,s.page=a;var o=n.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,n.readTuple(r);var l=parseInt(r[0]),h=parseInt(r[1]);n.readTuple(r);var u=parseInt(r[0]),c=parseInt(r[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+c)/a.width,s.v2=(h+u)/a.height):(s.u2=(l+u)/a.width,s.v2=(h+c)/a.height),s.x=l,s.y=h,s.width=Math.abs(u),s.height=Math.abs(c),4==n.readTuple(r)&&4==n.readTuple(r)&&n.readTuple(r),s.originalWidth=parseInt(r[0]),s.originalHeight=parseInt(r[1]),n.readTuple(r),s.offsetX=parseInt(r[0]),s.offsetY=parseInt(r[1]),s.index=parseInt(n.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new Nt).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=_t.filterFromString(r[0]),a.magFilter=_t.filterFromString(r[1]);var d=n.readValue();a.uWrap=Ct.ClampToEdge,a.vWrap=Ct.ClampToEdge,"x"==d?a.uWrap=Ct.Repeat:"y"==d?a.vWrap=Ct.Repeat:"xy"==d&&(a.uWrap=a.vWrap=Ct.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}(),Ft=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}(),Nt=function(){},Ot=function(t){function e(){return t.apply(this,arguments)}return P(e,t),e}(Vt),Bt=function(){function e(t,e,n){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this._engine=t,this.pathPrefix=e||"",this.textureLoader=n}var n=e.prototype;return n.downloadText=function(e,n,r){t(e,{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){var r=this;void 0===e&&(e=null),void 0===n&&(n=null),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){var r=this;void 0===e&&(e=null),void 0===n&&(n=null),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){var r=this;void 0===e&&(e=null),void 0===n&&(n=null);var 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(e,n,r){var a=this;void 0===n&&(n=null),void 0===r&&(r=null);var i=e=this.pathPrefix+e;this.toLoad++,this.rawDataUris[e]&&(e=this.rawDataUris[e]),t(e,{type:"image"}).then((function(t){var r=a.textureLoader(t);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(e,r)})).catch((function(t){r(t)}))},n.loadEngineTexture=function(t,e,n,r){var a=this;void 0===n&&(n=null),void 0===r&&(r=null);var i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),this.engine.resourceManager.load({url:t,type:e}).then((function(e){var 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){var r=this;void 0===e&&(e=null),void 0===n&&(n=null);var a=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(i){var s=function(){var s=u.value,h=!1;r.loadTexture(s,(function(s,u){if(o.count++,o.count==l.length)if(h)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 kt(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 d=e;r.errors[t]="Couldn't load texture atlas "+t+": "+d.message,n&&n("Couldn't load texture atlas "+t+": "+d.message),r.onLoad(),r.loaded++}}),(function(e){h=!0,o.count++,o.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++)}))},o={count:0},l=new Array;try{new kt(i,(function(t){return l.push(""==a?t:a+"/"+t),new Pt(new Image)}))}catch(e){var h=e;return r.errors[t]="Couldn't load texture atlas "+t+": "+h.message,n&&n("Couldn't load texture atlas "+t+": "+h.message),r.onLoad(),void r.loaded++}for(var u,c=O(l);!(u=c()).done;)s()}),(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},Tt(e,[{key:"engine",get:function(){return this._engine}}]),e}(),Xt=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 L(1,1,1,1),n.offset=q.newFloatArray(8),n.uvs=q.newFloatArray(8),n.tempColor=new L(1,1,1,1),n}P(e,t);var n=e.prototype;return n.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*n,i=r+this.region.width*t,s=a+this.region.height*n,o=this.rotation*Math.PI/180,l=Math.cos(o),h=Math.sin(o),u=r*l+this.x,c=r*h,d=a*l+this.y,f=a*h,v=i*l+this.x,p=i*h,m=s*l+this.y,g=s*h,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-g,w[e.OY2]=m+c,w[e.OX3]=v-g,w[e.OY3]=m+p,w[e.OX4]=v-f,w[e.OY4]=d+p},n.setRegion=function(t){this.region=t;var e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)},n.computeWorldVertices=function(t,n,r,a){var i=this.offset,s=t.worldX,o=t.worldY,l=t.a,h=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX2],f=i[e.OY2],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX3],f=i[e.OY3],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX4],f=i[e.OY4],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o},n.copy=function(){var t=new e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,q.arrayCopy(this.uvs,0,t.uvs,0,8),q.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(J);Xt.OX1=0,Xt.OY1=1,Xt.OX2=2,Xt.OY2=3,Xt.OX3=4,Xt.OY3=5,Xt.OX4=6,Xt.OY4=7,Xt.X1=0,Xt.Y1=1,Xt.C1R=2,Xt.C1G=3,Xt.C1B=4,Xt.C1A=5,Xt.U1=6,Xt.V1=7,Xt.X2=8,Xt.Y2=9,Xt.C2R=10,Xt.C2G=11,Xt.C2B=12,Xt.C2A=13,Xt.U2=14,Xt.V2=15,Xt.X3=16,Xt.Y3=17,Xt.C3R=18,Xt.C3G=19,Xt.C3B=20,Xt.C3A=21,Xt.U3=22,Xt.V3=23,Xt.X4=24,Xt.Y4=25,Xt.C4R=26,Xt.C4G=27,Xt.C4B=28,Xt.C4A=29,Xt.U4=30,Xt.V4=31;var Lt,Yt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new L(1,1,1,1),n.tempColor=new L(0,0,0,0),n}P(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=q.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(B(this.region,Ot)){var o=this.region,l=o.texture.getImage().width,h=o.texture.getImage().height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/l,a-=(o.originalWidth-o.offsetX-o.width)/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var u=0;u<n;u+=2)e[u]=r+t[u+1]*i,e[u+1]=a+(1-t[u])*s;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/l,a-=o.offsetY/h,i=o.originalWidth/l,s=o.originalHeight/h;for(var c=0;c<n;c+=2)e[c]=r+(1-t[c])*i,e[c+1]=a+(1-t[c+1])*s;return;case 270:r-=o.offsetY/l,a-=o.offsetX/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var d=0;d<n;d+=2)e[d]=r+(1-t[d+1])*i,e[d+1]=a+t[d]*s;return}r-=o.offsetX/l,a-=(o.originalHeight-o.offsetY-o.height)/h,i=o.originalWidth/l,s=o.originalHeight/h}else null==this.region?(r=a=0,i=s=1):(i=this.region.u2-r,s=this.region.v2-a);for(var f=0;f<n;f+=2)e[f]=r+t[f]*i,e[f+1]=a+t[f+1]*s},n.getParentMesh=function(){return this.parentMesh},n.setParentMesh=function(t){this.parentMesh=t,null!=t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)},n.copy=function(){if(null!=this.parentMesh)return this.newLinkedMesh();var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),q.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),q.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),q.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),q.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}(K),Dt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new L(1,1,1,1),n}return P(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(K),Ut=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new L(1,1,1,1),n}return P(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),q.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(K),Wt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new L(.38,.94,0,1),n.name=e,n}P(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=Y.cosDeg(this.rotation),n=Y.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*Y.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}(K),qt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new L(.2275,.2275,.8078,1),n}return P(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}(K),Ht=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 Xt(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 Yt(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new Dt(e)},e.newPathAttachment=function(t,e){return new Ut(e)},e.newPointAttachment=function(t,e){return new Wt(e)},e.newClippingAttachment=function(t,e){return new qt(e)},t}();!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Lt||(Lt={}));var jt,Gt=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 L,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"}(jt||(jt={}));var zt,Zt,Qt,Jt=function(){function t(t,e,n){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=n,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,n,r,a,i,s){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var l=this.skeleton,h=n+90+s,u=l.scaleX,c=l.scaleY;return this.a=Y.cosDeg(n+i)*r*u,this.b=Y.cosDeg(h)*a*u,this.c=Y.sinDeg(n+i)*r*c,this.d=Y.sinDeg(h)*a*c,this.worldX=t*u+l.x,void(this.worldY=e*c+l.y)}var d=o.a,f=o.b,v=o.c,p=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=v*t+p*e+o.worldY,this.data.transformMode){case jt.Normal:var m=n+90+s,g=Y.cosDeg(n+i)*r,w=Y.cosDeg(m)*a,x=Y.sinDeg(n+i)*r,E=Y.sinDeg(m)*a;return this.a=d*g+f*x,this.b=d*w+f*E,this.c=v*g+p*x,void(this.d=v*w+p*E);case jt.OnlyTranslation:var y=n+90+s;this.a=Y.cosDeg(n+i)*r,this.b=Y.cosDeg(y)*a,this.c=Y.sinDeg(n+i)*r,this.d=Y.sinDeg(y)*a;break;case jt.NoRotationOrReflection:var b=d*d+v*v,S=0;b>1e-4?(b=Math.abs(d*p-f*v)/b,d/=this.skeleton.scaleX,f=(v/=this.skeleton.scaleY)*b,p=d*b,S=Math.atan2(v,d)*Y.radDeg):(d=0,v=0,S=90-Math.atan2(p,f)*Y.radDeg);var A=n+i-S,I=n+s-S+90,M=Y.cosDeg(A)*r,T=Y.cosDeg(I)*a,R=Y.sinDeg(A)*r,C=Y.sinDeg(I)*a;this.a=d*M-f*R,this.b=d*T-f*C,this.c=v*M+p*R,this.d=v*T+p*C;break;case jt.NoScale:case jt.NoScaleOrReflection:var _=Y.cosDeg(n),V=Y.sinDeg(n),P=(d*_+f*V)/this.skeleton.scaleX,k=(v*_+p*V)/this.skeleton.scaleY,F=Math.sqrt(P*P+k*k);F>1e-5&&(F=1/F),P*=F,k*=F,F=Math.sqrt(P*P+k*k),this.data.transformMode==jt.NoScale&&d*p-f*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(F=-F);var N=Math.PI/2+Math.atan2(k,P),O=Math.cos(N)*F,B=Math.sin(N)*F,X=Y.cosDeg(i)*r,L=Y.cosDeg(90+s)*a,D=Y.sinDeg(i)*r,U=Y.sinDeg(90+s)*a;this.a=P*X+O*D,this.b=P*L+O*U,this.c=k*X+B*D,this.d=k*L+B*U}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)*Y.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*Y.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)*Y.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)*Y.radDeg);var e=t.a,n=t.b,r=t.c,a=t.d,i=1/(e*a-n*r),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*n*i,this.ay=o*e*i-s*r*i;var l=i*a,h=i*e,u=i*n,c=i*r,d=l*this.a-u*this.c,f=l*this.b-u*this.d,v=h*this.c-c*this.a,p=h*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+v*v),this.ascaleX>1e-4){var m=d*p-f*v;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(d*f+v*p,m)*Y.radDeg,this.arotation=Math.atan2(v,d)*Y.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,f)*Y.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=Y.sinDeg(t),n=Y.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*Y.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=Y.sinDeg(t),n=Y.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*Y.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=Y.cosDeg(t),s=Y.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}(),Kt=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},$t=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},te=function(t){this.name=t},ee=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix)}},e.apply1=function(t,e,n,r,a,i,s){t.appliedValid||t.updateAppliedTransform();var o=t.parent,l=o.a,h=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,v=0;switch(t.data.transformMode){case jt.OnlyTranslation:f=e-t.worldX,v=n-t.worldY;break;case jt.NoRotationOrReflection:var p=Math.abs(l*c-h*u)/(l*l+u*u),m=l/t.skeleton.scaleX,g=u/t.skeleton.scaleY;h=-g*p*t.skeleton.scaleX,c=m*p*t.skeleton.scaleY,d+=Math.atan2(g,m)*Y.radDeg;default:var w=e-o.worldX,x=n-o.worldY,E=l*c-h*u;f=(w*c-x*h)/E-t.ax,v=(x*l-w*u)/E-t.ay}d+=Math.atan2(v,f)*Y.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var y=t.ascaleX,b=t.ascaleY;if(r||a){switch(t.data.transformMode){case jt.NoScale:case jt.NoScaleOrReflection:f=e-t.worldX,v=n-t.worldY}var S=t.data.length*y,A=Math.sqrt(f*f+v*v);if(r&&A<S||a&&A>S&&S>1e-4){var I=(A/S-1)*s+1;y*=I,i&&(b*=I)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,y,b,t.ashearX,t.ashearY)},e.apply2=function(t,e,n,r,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var l=t.ax,h=t.ay,u=t.ascaleX,c=u,d=t.ascaleY,f=e.ascaleX,v=0,p=0,m=0;u<0?(u=-u,v=180,m=-1):(v=0,m=1),d<0&&(d=-d,m=-m),f<0?(f=-f,p=180):p=0;var g=e.ax,w=0,x=0,E=0,y=t.a,b=t.b,S=t.c,A=t.d,I=Math.abs(u-d)<=1e-4;I?(x=y*g+b*(w=e.ay)+t.worldX,E=S*g+A*w+t.worldY):(w=0,x=y*g+t.worldX,E=S*g+t.worldY);var M=t.parent;y=M.a,b=M.b,S=M.c;var T,R,C=1/(y*(A=M.d)-b*S),_=x-M.worldX,V=E-M.worldY,P=(_*A-V*b)*C-l,k=(V*y-_*S)*C-h,F=Math.sqrt(P*P+k*k),N=e.data.length*f;if(F<1e-4)return this.apply1(t,n,r,!1,i,!1,o),void e.updateWorldTransformWith(g,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var O=((_=n-M.worldX)*A-(V=r-M.worldY)*b)*C-l,B=(V*y-_*S)*C-h,X=O*O+B*B;if(0!=s){s*=u*(f+1)/2;var L=Math.sqrt(X),D=L-F-N*u+s;if(D>0){var U=Math.min(1,D/(2*s))-1;X=(O-=(U=(D-s*(1-U*U))/L)*O)*O+(B-=U*B)*B}}t:if(I){var W=(X-F*F-(N*=u)*N)/(2*F*N);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(X)/(F+N)-1)*o+1)),R=Math.acos(W)*a,y=F+N*W,b=N*Math.sin(R),T=Math.atan2(B*y-O*b,O*y+B*b)}else{var q=(y=u*N)*y,H=(b=d*N)*b,j=Math.atan2(B,O),G=-2*H*F,z=H-q;if((A=G*G-4*z*(S=H*F*F+q*X-q*H))>=0){var Z=Math.sqrt(A);G<0&&(Z=-Z);var Q=(Z=-(G+Z)/2)/z,J=S/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){V=Math.sqrt(X-K*K)*a,T=j-Math.atan2(V,K),R=Math.atan2(V/d,(K-F)/u);break t}}var $=Y.PI,tt=F-y,et=tt*tt,nt=0,rt=0,at=F+y,it=at*at,st=0;(S=-y*F/(q-H))>=-1&&S<=1&&(S=Math.acos(S),(A=(_=y*Math.cos(S)+F)*_+(V=b*Math.sin(S))*V)<et&&($=S,et=A,tt=_,nt=V),A>it&&(rt=S,it=A,at=_,st=V)),X<=(et+it)/2?(T=j-Math.atan2(nt*a,tt),R=$*a):(T=j-Math.atan2(st*a,at),R=rt*a)}var ot=Math.atan2(w,g)*m,lt=t.arotation;(T=(T-ot)*Y.radDeg+v-lt)>180?T-=360:T<-180&&(T+=360),t.updateWorldTransformWith(l,h,lt+T*o,c,t.ascaleY,0,0),lt=e.arotation,(R=((R+ot)*Y.radDeg-e.ashearX)*m+p-lt)>180?R-=360:R<-180&&(R+=360),e.updateWorldTransformWith(g,w,lt+R*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),ne=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 P(e,t),e}(Kt),re=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return P(e,t),e}(Kt);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(zt||(zt={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(Zt||(Zt={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(Qt||(Qt={}));var ae,ie=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(B(e,Ut)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==Zt.Percent,o=i.rotateMode,l=o==Qt.Tangent,h=o==Qt.ChainScale,u=this.bones.length,c=l?u:u+1,d=this.bones,f=q.setArraySize(this.spaces,c),v=null,p=this.spacing;if(h||!s){h&&(v=q.setArraySize(this.lengths,u));for(var m=i.spacingMode==Zt.Length,g=0,w=c-1;g<w;){var x=d[g],E=x.data.length;if(E<t.epsilon)h&&(v[g]=0),f[++g]=0;else if(s){if(h){var y=E*x.a,b=E*x.c,S=Math.sqrt(y*y+b*b);v[g]=S}f[++g]=p}else{var A=E*x.a,I=E*x.c,M=Math.sqrt(A*A+I*I);h&&(v[g]=M),f[++g]=(m?E+p:p)*M/E}}}else for(var T=1;T<c;T++)f[T]=p;var R=this.computeWorldPositions(e,c,l,i.positionMode==zt.Percent,s),C=R[0],_=R[1],V=i.offsetRotation,P=!1;if(0==V)P=o==Qt.Chain;else{P=!1;var k=this.target.bone;V*=k.a*k.d-k.b*k.c>0?Y.degRad:-Y.degRad}for(var F=0,N=3;F<u;F++,N+=3){var O=d[F];O.worldX+=(C-O.worldX)*r,O.worldY+=(_-O.worldY)*r;var X=R[N],L=R[N+1],D=X-C,U=L-_;if(h){var W=v[F];if(0!=W){var H=(Math.sqrt(D*D+U*U)/W-1)*n+1;O.a*=H,O.c*=H}}if(C=X,_=L,a){var j=O.a,G=O.b,z=O.c,Z=O.d,Q=0,J=0,K=0;if(Q=l?R[N-1]:0==f[F+1]?R[N+2]:Math.atan2(U,D),Q-=Math.atan2(z,j),P){J=Math.cos(Q),K=Math.sin(Q);var $=O.data.length;C+=($*(J*j-K*z)-D)*n,_+=($*(K*j+J*z)-U)*n}else Q+=V;Q>Y.PI?Q-=Y.PI2:Q<-Y.PI&&(Q+=Y.PI2),Q*=n,J=Math.cos(Q),K=Math.sin(Q),O.a=J*j-K*z,O.b=J*G-K*Z,O.c=K*j+J*z,O.d=K*G+J*Z}O.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,l=this.spaces,h=q.setArraySize(this.positions,3*n+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,v=t.NONE;if(!e.constantSpeed){var p=e.lengths,m=p[f-=c?1:2];if(a&&(o*=m),i)for(var g=1;g<n;g++)l[g]*=m;u=q.setArraySize(this.world,8);for(var w=0,x=0,E=0;w<n;w++,x+=3){var y=l[w],b=o+=y;if(c)(b%=m)<0&&(b+=m),E=0;else{if(b<0){v!=t.BEFORE&&(v=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(b,u,0,h,x);continue}if(b>m){v!=t.AFTER&&(v=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(b-m,u,0,h,x);continue}}for(;;E++){var S=p[E];if(!(b>S)){if(0==E)b/=S;else{var A=p[E-1];b=(b-A)/(S-A)}break}}E!=v&&(v=E,c&&E==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*E+2,8,u,0,2)),this.addCurvePosition(b,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,x,r||w>0&&0==y)}return h}c?(d+=2,u=q.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=q.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var I=q.setArraySize(this.curves,f),M=0,T=u[0],R=u[1],C=0,_=0,V=0,P=0,k=0,F=0,N=0,O=0,B=0,X=0,L=0,Y=0,D=0,U=0,W=0,H=2;W<f;W++,H+=6)C=u[H],_=u[H+1],V=u[H+2],P=u[H+3],L=2*(N=.1875*(T-2*C+V))+(B=.09375*(3*(C-V)-T+(k=u[H+4]))),Y=2*(O=.1875*(R-2*_+P))+(X=.09375*(3*(_-P)-R+(F=u[H+5]))),D=.75*(C-T)+N+.16666667*B,U=.75*(_-R)+O+.16666667*X,M+=Math.sqrt(D*D+U*U),D+=L,U+=Y,L+=B,Y+=X,M+=Math.sqrt(D*D+U*U),D+=L,U+=Y,M+=Math.sqrt(D*D+U*U),D+=L+B,U+=Y+X,M+=Math.sqrt(D*D+U*U),I[W]=M,T=k,R=F;if(o*=a?M:M/e.lengths[f-1],i)for(var j=1;j<n;j++)l[j]*=M;for(var G=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<n;Z++,Q+=3){var $=l[Z],tt=o+=$;if(c)(tt%=M)<0&&(tt+=M),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>M){this.addAfterPosition(tt-M,u,d-4,h,Q);continue}}for(;;J++){var et=I[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=I[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=v){v=J;var rt=6*J;for(T=u[rt],R=u[rt+1],C=u[rt+2],_=u[rt+3],V=u[rt+4],P=u[rt+5],L=2*(N=.03*(T-2*C+V))+(B=.006*(3*(C-V)-T+(k=u[rt+6]))),Y=2*(O=.03*(R-2*_+P))+(X=.006*(3*(_-P)-R+(F=u[rt+7]))),D=.3*(C-T)+N+.16666667*B,U=.3*(_-R)+O+.16666667*X,z=Math.sqrt(D*D+U*U),G[0]=z,rt=1;rt<8;rt++)D+=L,U+=Y,L+=B,Y+=X,z+=Math.sqrt(D*D+U*U),G[rt]=z;D+=L,U+=Y,z+=Math.sqrt(D*D+U*U),G[8]=z,D+=L+B,U+=Y+X,z+=Math.sqrt(D*D+U*U),G[9]=z,K=0}for(tt*=z;;K++){var at=G[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=G[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,T,R,C,_,V,P,k,F,h,Q,r||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,l=e[n+3]-s,h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],l=s-e[n+1],h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addCurvePosition=function(t,e,n,r,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=n,void(h[u+2]=Math.atan2(a-n,r-e));var d=t*t,f=d*t,v=1-t,p=v*v,m=p*v,g=v*t,w=3*g,x=v*w,E=w*t,y=e*m+r*x+i*E+o*f,b=n*m+a*x+s*E+l*f;h[u]=y,h[u+1]=b,c&&(h[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(b-(n*p+a*g*2+s*d),y-(e*p+r*g*2+i*d)))},t}();ie.NONE=-1,ie.BEFORE=-2,ie.AFTER=-3,ie.epsilon=1e-5,Math.fround||(Math.fround=(ae=new Float32Array(1),function(t){return ae[0]=t,ae[0]}));var se,oe=function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t}(),le=function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}var e=t.prototype;return e.queueAsset=function(t,e,n){var r=this.clientAssets[t];return null==r&&(r=new oe(t),this.clientAssets[t]=r),null!==e&&(r.textureLoader=e),r.toLoad.push(n),this.queuedAssets[n]!==n&&(this.queuedAssets[n]=n,!0)},e.loadText=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=r.responseText:n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},e.loadJson=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=JSON.parse(r.responseText):n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},e.loadTexture=function(t,e,n){var r=this;if(n=this.pathPrefix+n,this.queueAsset(t,e,n))if(!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts){fetch(n,{mode:"cors"}).then((function(t){return t.ok||(r.errors[n]="Couldn't load image "+n),t.blob()})).then((function(t){return createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(t){r.rawAssets[n]=t}))}else{var a=new Image;a.crossOrigin="anonymous",a.onload=function(t){r.rawAssets[n]=a},a.onerror=function(t){r.errors[n]="Couldn't load image "+n},a.src=n}},e.get=function(t,e){e=this.pathPrefix+e;var n=this.clientAssets[t];return null==n||n.assets[e]},e.updateClientAssets=function(t){for(var e=!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts,n=0;n<t.toLoad.length;n++){var r=t.toLoad[n],a=t.assets[r];if(null==a){var i=this.rawAssets[r];if(null==i)continue;e?B(i,ImageBitmap)?t.assets[r]=t.textureLoader(i):t.assets[r]=i:B(i,HTMLImageElement)?t.assets[r]=t.textureLoader(i):t.assets[r]=i}}},e.isLoadingComplete=function(t){var e=this.clientAssets[t];return null==e||(this.updateClientAssets(e),e.toLoad.length==e.loaded())},e.dispose=function(){},e.hasErrors=function(){return Object.keys(this.errors).length>0},e.getErrors=function(){return this.errors},t}(),he=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 L,this.darkColor=null==t.darkColor?null:new L,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}(),ue=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new G,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()},e.applyAbsoluteWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?Y.degRad:-Y.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],m=!1;if(0!=t){var g=p.a,w=p.b,x=p.c,E=p.d,y=Math.atan2(o,i)-Math.atan2(x,g)+u;y>Y.PI?y-=Y.PI2:y<-Y.PI&&(y+=Y.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*g-S*x,p.b=b*w-S*E,p.c=S*g+b*x,p.d=S*w+b*E,m=!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,m=!0}if(n>0){var I=Math.sqrt(p.a*p.a+p.c*p.c),M=Math.sqrt(i*i+o*o);I>1e-5&&(I=(I+(M-I+this.data.offsetScaleX)*n)/I),p.a*=I,p.c*=I,I=Math.sqrt(p.b*p.b+p.d*p.d),M=Math.sqrt(s*s+l*l),I>1e-5&&(I=(I+(M-I+this.data.offsetScaleY)*n)/I),p.b*=I,p.d*=I,m=!0}if(r>0){var T=p.b,R=p.d,C=Math.atan2(R,T),_=Math.atan2(l,s)-Math.atan2(o,i)-(C-Math.atan2(p.c,p.a));_>Y.PI?_-=Y.PI2:_<-Y.PI&&(_+=Y.PI2),_=C+(_+c)*r;var V=Math.sqrt(T*T+R*R);p.b=Math.cos(_)*V,p.d=Math.sin(_)*V,m=!0}m&&(p.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?Y.degRad:-Y.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],m=!1;if(0!=t){var g=p.a,w=p.b,x=p.c,E=p.d,y=Math.atan2(o,i)+u;y>Y.PI?y-=Y.PI2:y<-Y.PI&&(y+=Y.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*g-S*x,p.b=b*w-S*E,p.c=S*g+b*x,p.d=S*w+b*E,m=!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,m=!0}if(n>0){var I=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;p.a*=I,p.c*=I,I=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*n+1,p.b*=I,p.d*=I,m=!0}if(r>0){var M=Math.atan2(l,s)-Math.atan2(o,i);M>Y.PI?M-=Y.PI2:M<-Y.PI&&(M+=Y.PI2);var T=p.b,R=p.d;M=Math.atan2(R,T)+(M-Y.PI/2+c)*r;var C=Math.sqrt(T*T+R*R);p.b=Math.cos(M)*C,p.d=Math.sin(M)*C,m=!0}m&&(p.appliedValid=!1)}},e.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;if(0!=t){var u=a.arotation-h+this.data.offsetRotation;h+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=l.ax,d=l.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=l.ascaleX,v=l.ascaleY;0!=n&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*n)/f),v>1e-5&&(v=(v+(a.ascaleY-v+this.data.offsetScaleY)*n)/v));var p=l.ashearY;if(0!=r){var m=a.ashearY-p+this.data.offsetShearY;m-=360*(16384-(16384.499999999996-m/360|0)),l.shearY+=m*r}l.updateWorldTransformWith(c,d,h,f,v,l.ashearX,p)}},e.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;0!=t&&(h+=(a.arotation+this.data.offsetRotation)*t);var u=l.ax,c=l.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=l.ascaleX,f=l.ascaleY;0!=n&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*n+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));var v=l.ashearY;0!=r&&(v+=(a.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,v)}},t}(),ce=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 Jt(n,this,null);else{var a=this.bones[n.parent.index];r=new Jt(n,this,a),a.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],l=new he(s,o);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(var h=0;h<t.ikConstraints.length;h++){var u=t.ikConstraints[h];this.ikConstraints.push(new ee(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new ue(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var v=t.pathConstraints[f];this.pathConstraints.push(new ie(v,this))}this.color=new L(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){var t=this._updateCache;t.length=0,this.updateCacheReset.length=0;for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];a.sorted=a.data.skinRequired,a.active=!a.sorted}if(null!=this.skin)for(var i=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var l=this.bones[i[s].index];do{l.sorted=!1,l.active=!0,l=l.parent}while(null!=l)}var h=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=h.length,f=u.length,v=c.length,p=d+f+v;t:for(var m=0;m<p;m++){for(var g=0;g<d;g++){var w=h[g];if(w.data.order==m){this.sortIkConstraint(w);continue t}}for(var x=0;x<f;x++){var E=u[x];if(E.data.order==m){this.sortTransformConstraint(E);continue t}}for(var y=0;y<v;y++){var b=c[y];if(b.data.order==m){this.sortPathConstraint(b);continue t}}}for(var S=0,A=e.length;S<A;S++)this.sortBone(e[S])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&q.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&&q.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();B(s,Ut)&&this.sortPathConstraintAttachmentWith(s,r);for(var o=t.bones,l=o.length,h=0;h<l;h++)this.sortBone(o[h]);this._updateCache.push(t);for(var u=0;u<l;u++)this.sortReset(o[u].children);for(var c=0;c<l;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&q.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(B(t,Ut)){var n=t.bones;if(null==n)this.sortBone(e);else for(var r=this.bones,a=0;a<n.length;)for(var i=n[a++],s=a+i;a<s;a++){var o=n[a];this.sortBone(r[o])}}},e.sortBone=function(t){if(!t.sorted){var e=t.parent;null!=e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,n=t.length;e<n;e++){var r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,n=t.length;e<n;e++){var r=t[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}for(var a=this._updateCache,i=0,s=a.length;i<s;i++)a[i].update()},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t=this.bones,e=0,n=t.length;e<n;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,a=0,i=r.length;a<i;a++){var s=r[a];s.mix=s.data.mix,s.softness=s.data.softness,s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch}for(var o=this.transformConstraints,l=0,h=o.length;l<h;l++){var u=o[l],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,v=d.length;f<v;f++){var p=d[f],m=p.data;p.position=m.position,p.spacing=m.spacing,p.rotateMix=m.rotateMix,p.translateMix=m.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;q.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,n=t.length;e<n;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(null==e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(null!=t)if(null!=this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(n,i);null!=s&&a.setAttachment(s)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)},e.getAttachment=function(t,e){if(null==e)throw new Error("attachmentName cannot be null.");if(null!=this.skin){var n=this.skin.getAttachment(t,e);if(null!=n)return n}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(null==t)throw new Error("slotName cannot be null.");for(var n=this.slots,r=0,a=n.length;r<a;r++){var i=n[r];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(r,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,n){if(void 0===n&&(n=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==e)throw new Error("size cannot be null.");for(var r=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=0,h=r.length;l<h;l++){var u=r[l];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(B(f,Xt))c=8,d=q.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(B(f,Yt)){var v=f;c=v.worldVerticesLength,d=q.setArraySize(n,c,0),v.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var p=0,m=d.length;p<m;p+=2){var g=d[p],w=d[p+1];a=Math.min(a,g),i=Math.min(i,w),s=Math.max(s,g),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),de=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}(),fe=function(t,e,n){if(this.color=new L(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},ve=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 P(e,t),e}(Kt),pe=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},me=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,n){if(null==n)throw new Error("attachment cannot be null.");var r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];null!=c.attachment&&(B(c.attachment,Yt)?(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 pe(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 pe(t,r,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var n=0,r=0;r<t.slots.length;r++){var a=t.slots[r],i=a.getAttachment();if(i&&n<e.attachments.length){var s=e.attachments[n];for(var o in s){if(i==s[o]){var l=this.getAttachment(n,o);null!=l&&a.setAttachment(l);break}}}n++}},t}();!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"}(se||(se={}));var ge=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 de;r.name="";var a=new we(e);if(r.hash=a.readString(),r.version=a.readString(),"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=a.readFloat(),r.y=a.readFloat(),r.width=a.readFloat(),r.height=a.readFloat();var i=a.readBoolean();i&&(r.fps=a.readFloat(),r.imagesPath=a.readString(),r.audioPath=a.readString());var s=0;s=a.readInt(!0);for(var o=0;o<s;o++)a.strings.push(a.readString());s=a.readInt(!0);for(var l=0;l<s;l++){var h=a.readString(),u=0==l?null:r.bones[a.readInt(!0)],c=new Gt(l,h,u);c.rotation=a.readFloat(),c.x=a.readFloat()*n,c.y=a.readFloat()*n,c.scaleX=a.readFloat(),c.scaleY=a.readFloat(),c.shearX=a.readFloat(),c.shearY=a.readFloat(),c.length=a.readFloat()*n,c.transformMode=t.TransformModeValues[a.readInt(!0)],c.skinRequired=a.readBoolean(),i&&L.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 fe(d,f,v);L.rgba8888ToColor(p.color,a.readInt32());var m=a.readInt32();-1!=m&&L.rgb888ToColor(p.darkColor=new L,m),p.attachmentName=a.readStringRef(),p.blendMode=t.BlendModeValues[a.readInt(!0)],r.slots.push(p)}s=a.readInt(!0);for(var g,w=0;w<s;w++){var x=new ne(a.readString());x.order=a.readInt(!0),x.skinRequired=a.readBoolean(),g=a.readInt(!0);for(var E=0;E<g;E++)x.bones.push(r.bones[a.readInt(!0)]);x.target=r.bones[a.readInt(!0)],x.mix=a.readFloat(),x.softness=a.readFloat()*n,x.bendDirection=a.readByte(),x.compress=a.readBoolean(),x.stretch=a.readBoolean(),x.uniform=a.readBoolean(),r.ikConstraints.push(x)}s=a.readInt(!0);for(var y,b=0;b<s;b++){var S=new ve(a.readString());S.order=a.readInt(!0),S.skinRequired=a.readBoolean(),y=a.readInt(!0);for(var A=0;A<y;A++)S.bones.push(r.bones[a.readInt(!0)]);S.target=r.bones[a.readInt(!0)],S.local=a.readBoolean(),S.relative=a.readBoolean(),S.offsetRotation=a.readFloat(),S.offsetX=a.readFloat()*n,S.offsetY=a.readFloat()*n,S.offsetScaleX=a.readFloat(),S.offsetScaleY=a.readFloat(),S.offsetShearY=a.readFloat(),S.rotateMix=a.readFloat(),S.translateMix=a.readFloat(),S.scaleMix=a.readFloat(),S.shearMix=a.readFloat(),r.transformConstraints.push(S)}s=a.readInt(!0);for(var I,M=0;M<s;M++){var T=new re(a.readString());T.order=a.readInt(!0),T.skinRequired=a.readBoolean(),I=a.readInt(!0);for(var R=0;R<I;R++)T.bones.push(r.bones[a.readInt(!0)]);T.target=r.slots[a.readInt(!0)],T.positionMode=t.PositionModeValues[a.readInt(!0)],T.spacingMode=t.SpacingModeValues[a.readInt(!0)],T.rotateMode=t.RotateModeValues[a.readInt(!0)],T.offsetRotation=a.readFloat(),T.position=a.readFloat(),T.positionMode==zt.Fixed&&(T.position*=n),T.spacing=a.readFloat(),T.spacingMode!=Zt.Length&&T.spacingMode!=Zt.Fixed||(T.spacing*=n),T.rotateMix=a.readFloat(),T.translateMix=a.readFloat(),r.pathConstraints.push(T)}var C=this.readSkin(a,r,!0,i);null!=C&&(r.defaultSkin=C,r.skins.push(C));var _=r.skins.length;for(q.setArraySize(r.skins,s=_+a.readInt(!0));_<s;_++)r.skins[_]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var V=0;V<s;V++){var P=this.linkedMeshes[V],k=null==P.skin?r.defaultSkin:r.findSkin(P.skin);if(null==k)throw new Error("Skin not found: "+P.skin);var F=k.getAttachment(P.slotIndex,P.parent);if(null==F)throw new Error("Parent mesh not found: "+P.parent);P.mesh.deformAttachment=P.inheritDeform?F:P.mesh,P.mesh.setParentMesh(F),P.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var N=0;N<s;N++){var O=new te(a.readStringRef());O.intValue=a.readInt(!1),O.floatValue=a.readFloat(),O.stringValue=a.readString(),O.audioPath=a.readString(),null!=O.audioPath&&(O.volume=a.readFloat(),O.balance=a.readFloat()),r.events.push(O)}s=a.readInt(!0);for(var B=0;B<s;B++)r.animations.push(this.readAnimation(a,a.readString(),r));return r},e.readSkin=function(t,e,n,r){var a=null,i=0;if(n){if(0==(i=t.readInt(!0)))return null;a=new me("default")}else{(a=new me(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var l=0,h=t.readInt(!0);l<h;l++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var v=0;v<i;v++)for(var p=t.readInt(!0),m=0,g=t.readInt(!0);m<g;m++){var w=t.readStringRef(),x=this.readAttachment(t,e,a,p,w,r);null!=x&&a.setAttachment(p,w,x)}return a},e.readAttachment=function(e,n,r,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case se.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),v=e.readFloat(),p=e.readFloat(),m=e.readFloat(),g=e.readFloat(),w=e.readInt32();null==u&&(u=l);var x=this.attachmentLoader.newRegionAttachment(r,l,u);return null==x?null:(x.path=u,x.x=d*o,x.y=f*o,x.scaleX=v,x.scaleY=p,x.rotation=c,x.width=m*o,x.height=g*o,L.rgba8888ToColor(x.color,w),x.updateOffset(),x);case se.BoundingBox:var E=e.readInt(!0),y=this.readVertices(e,E),b=s?e.readInt32():0,S=this.attachmentLoader.newBoundingBoxAttachment(r,l);return null==S?null:(S.worldVerticesLength=E<<1,S.vertices=y.vertices,S.bones=y.bones,s&&L.rgba8888ToColor(S.color,b),S);case se.Mesh:var A=e.readStringRef(),I=e.readInt32(),M=e.readInt(!0),T=this.readFloatArray(e,M<<1,1),R=this.readShortArray(e),C=this.readVertices(e,M),_=e.readInt(!0),V=null,P=0,k=0;s&&(V=this.readShortArray(e),P=e.readFloat(),k=e.readFloat()),null==A&&(A=l);var F=this.attachmentLoader.newMeshAttachment(r,l,A);return null==F?null:(F.path=A,L.rgba8888ToColor(F.color,I),F.bones=C.bones,F.vertices=C.vertices,F.worldVerticesLength=M<<1,F.triangles=R,F.regionUVs=T,F.updateUVs(),F.hullLength=_<<1,s&&(F.edges=V,F.width=P*o,F.height=k*o),F);case se.LinkedMesh:var N=e.readStringRef(),O=e.readInt32(),B=e.readStringRef(),X=e.readStringRef(),Y=e.readBoolean(),D=0,U=0;s&&(D=e.readFloat(),U=e.readFloat()),null==N&&(N=l);var W=this.attachmentLoader.newMeshAttachment(r,l,N);return null==W?null:(W.path=N,L.rgba8888ToColor(W.color,O),s&&(W.width=D*o,W.height=U*o),this.linkedMeshes.push(new xe(W,B,a,X,Y)),W);case se.Path:for(var H=e.readBoolean(),j=e.readBoolean(),G=e.readInt(!0),z=this.readVertices(e,G),Z=q.newArray(G/3,0),Q=0,J=Z.length;Q<J;Q++)Z[Q]=e.readFloat()*o;var K=s?e.readInt32():0,$=this.attachmentLoader.newPathAttachment(r,l);return null==$?null:($.closed=H,$.constantSpeed=j,$.worldVerticesLength=G<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&L.rgba8888ToColor($.color,K),$);case se.Point:var tt=e.readFloat(),et=e.readFloat(),nt=e.readFloat(),rt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(r,l);return null==at?null:(at.x=et*o,at.y=nt*o,at.rotation=tt,s&&L.rgba8888ToColor(at.color,rt),at);case se.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(r,l);return null==ht?null:(ht.endSlot=n.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&L.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var n=e<<1,r=new Ee,a=this.scale;if(!t.readBoolean())return r.vertices=this.readFloatArray(t,n,a),r;for(var i=new Array,s=new Array,o=0;o<e;o++){var l=t.readInt(!0);s.push(l);for(var h=0;h<l;h++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return r.vertices=q.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 L,l=new L,h=0,u=e.readInt(!0);h<u;h++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var v=e.readByte(),p=e.readInt(!0);switch(v){case t.SLOT_ATTACHMENT:var m=new ut(p);m.slotIndex=c;for(var g=0;g<p;g++)m.setFrame(g,e.readFloat(),e.readStringRef());a.push(m),s=Math.max(s,m.frames[p-1]);break;case t.SLOT_COLOR:var w=new lt(p);w.slotIndex=c;for(var x=0;x<p;x++){var E=e.readFloat();L.rgba8888ToColor(o,e.readInt32()),w.setFrame(x,E,o.r,o.g,o.b,o.a),x<p-1&&this.readCurve(e,x,w)}a.push(w),s=Math.max(s,w.frames[(p-1)*lt.ENTRIES]);break;case t.SLOT_TWO_COLOR:var y=new ht(p);y.slotIndex=c;for(var b=0;b<p;b++){var S=e.readFloat();L.rgba8888ToColor(o,e.readInt32()),L.rgb888ToColor(l,e.readInt32()),y.setFrame(b,S,o.r,o.g,o.b,o.a,l.r,l.g,l.b),b<p-1&&this.readCurve(e,b,y)}a.push(y),s=Math.max(s,y.frames[(p-1)*ht.ENTRIES])}}for(var A=0,I=e.readInt(!0);A<I;A++)for(var M=e.readInt(!0),T=0,R=e.readInt(!0);T<R;T++){var C=e.readByte(),_=e.readInt(!0);switch(C){case t.BONE_ROTATE:var V=new at(_);V.boneIndex=M;for(var P=0;P<_;P++)V.setFrame(P,e.readFloat(),e.readFloat()),P<_-1&&this.readCurve(e,P,V);a.push(V),s=Math.max(s,V.frames[(_-1)*at.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var k=void 0,F=1;C==t.BONE_SCALE?k=new st(_):C==t.BONE_SHEAR?k=new ot(_):(k=new it(_),F=i),k.boneIndex=M;for(var N=0;N<_;N++)k.setFrame(N,e.readFloat(),e.readFloat()*F,e.readFloat()*F),N<_-1&&this.readCurve(e,N,k);a.push(k),s=Math.max(s,k.frames[(_-1)*it.ENTRIES])}}for(var O=0,B=e.readInt(!0);O<B;O++){var X=e.readInt(!0),Y=e.readInt(!0),D=new pt(Y);D.ikConstraintIndex=X;for(var U=0;U<Y;U++)D.setFrame(U,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),U<Y-1&&this.readCurve(e,U,D);a.push(D),s=Math.max(s,D.frames[(Y-1)*pt.ENTRIES])}for(var W=0,H=e.readInt(!0);W<H;W++){var j=e.readInt(!0),G=e.readInt(!0),z=new mt(G);z.transformConstraintIndex=j;for(var Z=0;Z<G;Z++)z.setFrame(Z,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),Z<G-1&&this.readCurve(e,Z,z);a.push(z),s=Math.max(s,z.frames[(G-1)*mt.ENTRIES])}for(var Q=0,J=e.readInt(!0);Q<J;Q++)for(var K=e.readInt(!0),$=r.pathConstraints[K],tt=0,et=e.readInt(!0);tt<et;tt++){var rt=e.readByte(),ct=e.readInt(!0);switch(rt){case t.PATH_POSITION:case t.PATH_SPACING:var Et=void 0,yt=1;rt==t.PATH_SPACING?(Et=new wt(ct),$.spacingMode!=Zt.Length&&$.spacingMode!=Zt.Fixed||(yt=i)):(Et=new gt(ct),$.positionMode==zt.Fixed&&(yt=i)),Et.pathConstraintIndex=K;for(var bt=0;bt<ct;bt++)Et.setFrame(bt,e.readFloat(),e.readFloat()*yt),bt<ct-1&&this.readCurve(e,bt,Et);a.push(Et),s=Math.max(s,Et.frames[(ct-1)*gt.ENTRIES]);break;case t.PATH_MIX:var St=new xt(ct);St.pathConstraintIndex=K;for(var At=0;At<ct;At++)St.setFrame(At,e.readFloat(),e.readFloat(),e.readFloat()),At<ct-1&&this.readCurve(e,At,St);a.push(St),s=Math.max(s,St.frames[(ct-1)*xt.ENTRIES])}}for(var It=0,Mt=e.readInt(!0);It<Mt;It++)for(var Tt=r.skins[e.readInt(!0)],Rt=0,Ct=e.readInt(!0);Rt<Ct;Rt++)for(var _t=e.readInt(!0),Vt=0,Pt=e.readInt(!0);Vt<Pt;Vt++){var kt=Tt.getAttachment(_t,e.readStringRef()),Ft=null!=kt.bones,Nt=kt.vertices,Ot=Ft?Nt.length/3*2:Nt.length,Bt=e.readInt(!0),Xt=new dt(Bt);Xt.slotIndex=_t,Xt.attachment=kt;for(var Lt=0;Lt<Bt;Lt++){var Yt=e.readFloat(),Dt=void 0,Ut=e.readInt(!0);if(0==Ut)Dt=Ft?q.newFloatArray(Ot):Nt;else{Dt=q.newFloatArray(Ot);var Wt=e.readInt(!0);if(Ut+=Wt,1==i)for(var qt=Wt;qt<Ut;qt++)Dt[qt]=e.readFloat();else for(var Ht=Wt;Ht<Ut;Ht++)Dt[Ht]=e.readFloat()*i;if(!Ft)for(var jt=0,Gt=Dt.length;jt<Gt;jt++)Dt[jt]+=Nt[jt]}Xt.setFrame(Lt,Yt,Dt),Lt<Bt-1&&this.readCurve(e,Lt,Xt)}a.push(Xt),s=Math.max(s,Xt.frames[Bt-1])}var Qt=e.readInt(!0);if(Qt>0){for(var Jt=new vt(Qt),Kt=r.slots.length,te=0;te<Qt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=q.newArray(Kt,0),ae=Kt-1;ae>=0;ae--)re[ae]=-1;for(var ie=q.newArray(Kt-ne,0),se=0,oe=0,le=0;le<ne;le++){for(var he=e.readInt(!0);se!=he;)ie[oe++]=se++;re[se+e.readInt(!0)]=se++}for(;se<Kt;)ie[oe++]=se++;for(var ue=Kt-1;ue>=0;ue--)-1==re[ue]&&(re[ue]=ie[--oe]);Jt.setFrame(te,ee,re)}a.push(Jt),s=Math.max(s,Jt.frames[Qt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new ft(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=r.events[e.readInt(!0)],me=new $t(ve,pe);me.intValue=e.readInt(!1),me.floatValue=e.readFloat(),me.stringValue=e.readBoolean()?e.readString():pe.stringValue,null!=me.data.audioPath&&(me.volume=e.readFloat(),me.balance=e.readFloat()),de.setFrame(fe,me)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new nt(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}();ge.AttachmentTypeValues=[0,1,2,3,4,5,6],ge.TransformModeValues=[jt.Normal,jt.OnlyTranslation,jt.NoRotationOrReflection,jt.NoScale,jt.NoScaleOrReflection],ge.PositionModeValues=[zt.Fixed,zt.Percent],ge.SpacingModeValues=[Zt.Length,Zt.Fixed,Zt.Percent],ge.RotateModeValues=[Qt.Tangent,Qt.Chain,Qt.ChainScale],ge.BlendModeValues=[Lt.Normal,Lt.Additive,Lt.Multiply,Lt.Screen],ge.BONE_ROTATE=0,ge.BONE_TRANSLATE=1,ge.BONE_SCALE=2,ge.BONE_SHEAR=3,ge.SLOT_ATTACHMENT=0,ge.SLOT_COLOR=1,ge.SLOT_TWO_COLOR=2,ge.PATH_POSITION=0,ge.PATH_SPACING=1,ge.PATH_MIX=2,ge.CURVE_LINEAR=0,ge.CURVE_STEPPED=1,ge.CURVE_BEZIER=2;var we=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 128&e&&(n|=(127&(e=this.readByte()))<<7,128&e&&(n|=(127&(e=this.readByte()))<<14,128&e&&(n|=(127&(e=this.readByte()))<<21,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}(),xe=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},Ee=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e},ye=function(){function t(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new j((function(){return q.newFloatArray(16)}))}var e=t.prototype;return e.update=function(t,e){if(null==t)throw new Error("skeleton cannot be null.");var n=this.boundingBoxes,r=this.polygons,a=this.polygonPool,i=t.slots,s=i.length;n.length=0,a.freeAll(r),r.length=0;for(var o=0;o<s;o++){var l=i[o];if(l.bone.active){var h=l.getAttachment();if(B(h,Dt)){var u=h;n.push(u);var c=a.obtain();c.length!=u.worldVerticesLength&&(c=q.newFloatArray(u.worldVerticesLength)),r.push(c),u.computeWorldVertices(l,0,u.worldVerticesLength,c,0,2)}}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)},e.aabbCompute=function(){for(var t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,a=this.polygons,i=0,s=a.length;i<s;i++)for(var o=a[i],l=o,h=0,u=o.length;h<u;h+=2){var c=l[h],d=l[h+1];t=Math.min(t,c),e=Math.min(e,d),n=Math.max(n,c),r=Math.max(r,d)}this.minX=t,this.minY=e,this.maxX=n,this.maxY=r},e.aabbContainsPoint=function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.aabbIntersectsSegment=function(t,e,n,r){var a=this.minX,i=this.minY,s=this.maxX,o=this.maxY;if(t<=a&&n<=a||e<=i&&r<=i||t>=s&&n>=s||e>=o&&r>=o)return!1;var l=(r-e)/(n-t),h=l*(a-t)+e;if(h>i&&h<o)return!0;if((h=l*(s-t)+e)>i&&h<o)return!0;var u=(i-e)/l+t;return u>a&&u<s||(u=(o-e)/l+t)>a&&u<s},e.aabbIntersectsSkeleton=function(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY},e.containsPoint=function(t,e){for(var n=this.polygons,r=0,a=n.length;r<a;r++)if(this.containsPointPolygon(n[r],t,e))return this.boundingBoxes[r];return null},e.containsPointPolygon=function(t,e,n){for(var r=t,a=t.length,i=a-2,s=!1,o=0;o<a;o+=2){var l=r[o+1],h=r[i+1];if(l<n&&h>=n||h<n&&l>=n){var u=r[o];u+(n-l)/(h-l)*(r[i]-u)<e&&(s=!s)}i=o}return s},e.intersectsSegment=function(t,e,n,r){for(var a=this.polygons,i=0,s=a.length;i<s;i++)if(this.intersectsSegmentPolygon(a[i],t,e,n,r))return this.boundingBoxes[i];return null},e.intersectsSegmentPolygon=function(t,e,n,r,a){for(var i=t,s=t.length,o=e-r,l=n-a,h=e*a-n*r,u=i[s-2],c=i[s-1],d=0;d<s;d+=2){var f=i[d],v=i[d+1],p=u*v-c*f,m=u-f,g=c-v,w=o*g-l*m,x=(h*m-o*p)/w;if((x>=u&&x<=f||x>=f&&x<=u)&&(x>=e&&x<=r||x>=r&&x<=e)){var E=(h*g-l*p)/w;if((E>=c&&E<=v||E>=v&&E<=c)&&(E>=n&&E<=a||E>=a&&E<=n))return!0}u=f,c=v}return!1},e.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.getWidth=function(){return this.maxX-this.minX},e.getHeight=function(){return this.maxY-this.minY},t}(),be=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new j((function(){return new Array})),this.polygonIndicesPool=new j((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var n=e,r=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<r;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,l=r;o<l;++o)s[o]=t.isConcave(o,r,n,a);var h=this.triangles;for(h.length=0;r>3;){for(var u=r-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,v=a[c]<<1,p=a[d]<<1,m=n[f],g=n[f+1],w=n[v],x=n[v+1],E=n[p],y=n[p+1],b=(d+1)%r;b!=u;b=(b+1)%r)if(s[b]){var S=a[b]<<1,A=n[S],I=n[S+1];if(t.positiveArea(E,y,m,g,A,I)&&t.positiveArea(m,g,w,x,A,I)&&t.positiveArea(w,x,E,y,A,I))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%r}h.push(a[(r+c-1)%r]),h.push(a[c]),h.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var M=(--r+c-1)%r,T=c==r?0:c;s[M]=t.isConcave(M,r,n,a),s[T]=t.isConcave(T,r,n,a)}return 3==r&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.decompose=function(e,n){var r=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var l=-1,h=0,u=0,c=n.length;u<c;u+=3){var d=n[u]<<1,f=n[u+1]<<1,v=n[u+2]<<1,p=r[d],m=r[d+1],g=r[f],w=r[f+1],x=r[v],E=r[v+1],y=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],x,E),A=t.winding(x,E,o[0],o[1],o[2],o[3]);S==h&&A==h&&(o.push(x),o.push(E),s.push(v),y=!0)}y||(o.length>0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(p),o.push(m),o.push(g),o.push(w),o.push(x),o.push(E),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(v),h=t.winding(p,m,g,w,x,E),l=d)}o.length>0&&(a.push(o),i.push(s));for(var I=0,M=a.length;I<M;I++)if(0!=(s=i[I]).length)for(var T=s[0],R=s[s.length-1],C=(o=a[I]).length-4,_=o[C],V=o[C+1],P=o[C+2],k=o[C+3],F=o[0],N=o[1],O=o[2],B=o[3],X=t.winding(_,V,P,k,F,N),L=0;L<M;L++)if(L!=I){var Y=i[L];if(3==Y.length){var D=Y[0],U=Y[1],W=Y[2],q=a[L],H=q[q.length-2],j=q[q.length-1];if(D==T&&U==R){var G=t.winding(_,V,P,k,H,j),z=t.winding(H,j,F,N,O,B);G==X&&z==X&&(q.length=0,Y.length=0,o.push(H),o.push(j),s.push(W),_=P,V=k,P=H,k=j,L=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}(),Se=function(){function t(){this.triangulator=new be,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=q.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(e,0,r,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,l=s.length;o<l;o++){var h=s[o];t.makeClockwise(h),h.push(h[0]),h.push(h[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,n,r,a,i,s,o){var l=this.clipOutput,h=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,v=0;h.length=0,u.length=0;t:for(var p=0;p<r;p+=3)for(var m=n[p]<<1,g=t[m],w=t[m+1],x=a[m],E=a[m+1],y=t[m=n[p+1]<<1],b=t[m+1],S=a[m],A=a[m+1],I=t[m=n[p+2]<<1],M=t[m+1],T=a[m],R=a[m+1],C=0;C<d;C++){var _=h.length;if(!this.clip(g,w,y,b,I,M,c[C],l)){var V=q.setArraySize(h,_+3*f);V[_]=g,V[_+1]=w,V[_+2]=i.r,V[_+3]=i.g,V[_+4]=i.b,V[_+5]=i.a,o?(V[_+6]=x,V[_+7]=E,V[_+8]=s.r,V[_+9]=s.g,V[_+10]=s.b,V[_+11]=s.a,V[_+12]=y,V[_+13]=b,V[_+14]=i.r,V[_+15]=i.g,V[_+16]=i.b,V[_+17]=i.a,V[_+18]=S,V[_+19]=A,V[_+20]=s.r,V[_+21]=s.g,V[_+22]=s.b,V[_+23]=s.a,V[_+24]=I,V[_+25]=M,V[_+26]=i.r,V[_+27]=i.g,V[_+28]=i.b,V[_+29]=i.a,V[_+30]=T,V[_+31]=R,V[_+32]=s.r,V[_+33]=s.g,V[_+34]=s.b,V[_+35]=s.a):(V[_+6]=x,V[_+7]=E,V[_+8]=y,V[_+9]=b,V[_+10]=i.r,V[_+11]=i.g,V[_+12]=i.b,V[_+13]=i.a,V[_+14]=S,V[_+15]=A,V[_+16]=I,V[_+17]=M,V[_+18]=i.r,V[_+19]=i.g,V[_+20]=i.b,V[_+21]=i.a,V[_+22]=T,V[_+23]=R),_=u.length;var P=q.setArraySize(u,_+3);P[_]=v,P[_+1]=v+1,P[_+2]=v+2,v+=3;continue t}var k=l.length;if(0!=k){for(var F=b-M,N=I-y,O=g-I,B=M-w,X=1/(F*O+N*(w-M)),L=k>>1,Y=this.clipOutput,D=q.setArraySize(h,_+L*f),U=0;U<k;U+=2){var W=Y[U],H=Y[U+1];D[_]=W,D[_+1]=H,D[_+2]=i.r,D[_+3]=i.g,D[_+4]=i.b,D[_+5]=i.a;var j=W-I,G=H-M,z=(F*j+N*G)*X,Z=(B*j+O*G)*X,Q=1-z-Z;D[_+6]=x*z+S*Z+T*Q,D[_+7]=E*z+A*Z+R*Q,o&&(D[_+8]=s.r,D[_+9]=s.g,D[_+10]=s.b,D[_+11]=s.a),_+=f}_=u.length;var J=q.setArraySize(u,_+3*(L-2));L--;for(var K=1;K<L;K++)J[_]=v,J[_+1]=v+K,J[_+2]=v+K+1,_+=3;v+=L+1}}},e.clip=function(t,e,n,r,a,i,s,o){var l=o,h=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(a),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,d=s.length-4,f=0;;f+=2){for(var v=c[f],p=c[f+1],m=c[f+2],g=c[f+3],w=v-m,x=p-g,E=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var A=E[S],I=E[S+1],M=E[S+2],T=E[S+3],R=w*(T-g)-x*(M-m)>0;if(w*(I-g)-x*(A-m)>0){if(R){o.push(M),o.push(T);continue}var C=T-I,_=M-A,V=C*(m-v)-_*(g-p);if(Math.abs(V)>1e-6){var P=(_*(p-I)-C*(v-A))/V;o.push(v+(m-v)*P),o.push(p+(g-p)*P)}else o.push(v),o.push(p)}else if(R){var k=T-I,F=M-A,N=k*(m-v)-F*(g-p);if(Math.abs(N)>1e-6){var O=(F*(p-I)-k*(v-A))/N;o.push(v+(m-v)*O),o.push(p+(g-p)*O)}else o.push(v),o.push(p);o.push(M),o.push(T)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var B=o;(o=u).length=0,u=B}if(l!=o){l.length=0;for(var X=0,L=o.length-2;X<L;X++)l[X]=o[X]}else l.length=l.length-2;return h},t.makeClockwise=function(t){for(var e=t,n=t.length,r=e[n-2]*e[1]-e[0]*e[n-1],a=0,i=0,s=0,o=0,l=n-3;o<l;o+=2)a=e[o],i=e[o+1],s=e[o+2],r+=a*e[o+3]-s*i;if(!(r<0))for(var h=0,u=n-2,c=n>>1;h<c;h+=2){var d=e[h],f=e[h+1],v=u-h;e[h]=e[v],e[h+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),Ae=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 de,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(r.hash=i.hash,r.version=i.spine,"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=i.x,r.y=i.y,r.width=i.width,r.height=i.height,r.fps=i.fps,r.imagesPath=i.images}if(a.bones)for(var s=0;s<a.bones.length;s++){var o=a.bones[s],l=null,h=this.getValue(o,"parent",null);if(null!=h&&null==(l=r.findBone(h)))throw new Error("Parent bone not found: "+h);var u=new Gt(r.bones.length,o.name,l);u.length=this.getValue(o,"length",0)*n,u.x=this.getValue(o,"x",0)*n,u.y=this.getValue(o,"y",0)*n,u.rotation=this.getValue(o,"rotation",0),u.scaleX=this.getValue(o,"scaleX",1),u.scaleY=this.getValue(o,"scaleY",1),u.shearX=this.getValue(o,"shearX",0),u.shearY=this.getValue(o,"shearY",0),u.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),u.skinRequired=this.getValue(o,"skin",!1),r.bones.push(u)}if(a.slots)for(var c=0;c<a.slots.length;c++){var d=a.slots[c],f=d.name,v=d.bone,p=r.findBone(v);if(null==p)throw new Error("Slot bone not found: "+v);var m=new fe(r.slots.length,f,p),g=this.getValue(d,"color",null);null!=g&&m.color.setFromString(g);var w=this.getValue(d,"dark",null);null!=w&&(m.darkColor=new L(1,1,1,1),m.darkColor.setFromString(w)),m.attachmentName=this.getValue(d,"attachment",null),m.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),r.slots.push(m)}if(a.ik)for(var x=0;x<a.ik.length;x++){var E=a.ik[x],y=new ne(E.name);y.order=this.getValue(E,"order",0),y.skinRequired=this.getValue(E,"skin",!1);for(var b=0;b<E.bones.length;b++){var S=E.bones[b],A=r.findBone(S);if(null==A)throw new Error("IK bone not found: "+S);y.bones.push(A)}var I=E.target;if(y.target=r.findBone(I),null==y.target)throw new Error("IK target bone not found: "+I);y.mix=this.getValue(E,"mix",1),y.softness=this.getValue(E,"softness",0)*n,y.bendDirection=this.getValue(E,"bendPositive",!0)?1:-1,y.compress=this.getValue(E,"compress",!1),y.stretch=this.getValue(E,"stretch",!1),y.uniform=this.getValue(E,"uniform",!1),r.ikConstraints.push(y)}if(a.transform)for(var M=0;M<a.transform.length;M++){var T=a.transform[M],R=new ve(T.name);R.order=this.getValue(T,"order",0),R.skinRequired=this.getValue(T,"skin",!1);for(var C=0;C<T.bones.length;C++){var _=T.bones[C],V=r.findBone(_);if(null==V)throw new Error("Transform constraint bone not found: "+_);R.bones.push(V)}var P=T.target;if(R.target=r.findBone(P),null==R.target)throw new Error("Transform constraint target bone not found: "+P);R.local=this.getValue(T,"local",!1),R.relative=this.getValue(T,"relative",!1),R.offsetRotation=this.getValue(T,"rotation",0),R.offsetX=this.getValue(T,"x",0)*n,R.offsetY=this.getValue(T,"y",0)*n,R.offsetScaleX=this.getValue(T,"scaleX",0),R.offsetScaleY=this.getValue(T,"scaleY",0),R.offsetShearY=this.getValue(T,"shearY",0),R.rotateMix=this.getValue(T,"rotateMix",1),R.translateMix=this.getValue(T,"translateMix",1),R.scaleMix=this.getValue(T,"scaleMix",1),R.shearMix=this.getValue(T,"shearMix",1),r.transformConstraints.push(R)}if(a.path)for(var k=0;k<a.path.length;k++){var F=a.path[k],N=new re(F.name);N.order=this.getValue(F,"order",0),N.skinRequired=this.getValue(F,"skin",!1);for(var O=0;O<F.bones.length;O++){var B=F.bones[O],X=r.findBone(B);if(null==X)throw new Error("Transform constraint bone not found: "+B);N.bones.push(X)}var Y=F.target;if(N.target=r.findSlot(Y),null==N.target)throw new Error("Path target slot not found: "+Y);N.positionMode=t.positionModeFromString(this.getValue(F,"positionMode","percent")),N.spacingMode=t.spacingModeFromString(this.getValue(F,"spacingMode","length")),N.rotateMode=t.rotateModeFromString(this.getValue(F,"rotateMode","tangent")),N.offsetRotation=this.getValue(F,"rotation",0),N.position=this.getValue(F,"position",0),N.positionMode==zt.Fixed&&(N.position*=n),N.spacing=this.getValue(F,"spacing",0),N.spacingMode!=Zt.Length&&N.spacingMode!=Zt.Fixed||(N.spacing*=n),N.rotateMix=this.getValue(F,"rotateMix",1),N.translateMix=this.getValue(F,"translateMix",1),r.pathConstraints.push(N)}if(a.skins)for(var D=0;D<a.skins.length;D++){var U=a.skins[D],W=new me(U.name);if(U.bones)for(var q=0;q<U.bones.length;q++){var H=r.findBone(U.bones[q]);if(null==H)throw new Error("Skin bone not found: "+U.bones[D]);W.bones.push(H)}if(U.ik)for(var j=0;j<U.ik.length;j++){var G=r.findIkConstraint(U.ik[j]);if(null==G)throw new Error("Skin IK constraint not found: "+U.ik[D]);W.constraints.push(G)}if(U.transform)for(var z=0;z<U.transform.length;z++){var Z=r.findTransformConstraint(U.transform[z]);if(null==Z)throw new Error("Skin transform constraint not found: "+U.transform[D]);W.constraints.push(Z)}if(U.path)for(var Q=0;Q<U.path.length;Q++){var J=r.findPathConstraint(U.path[Q]);if(null==J)throw new Error("Skin path constraint not found: "+U.path[D]);W.constraints.push(J)}for(var K in U.attachments){var $=r.findSlot(K);if(null==$)throw new Error("Slot not found: "+K);var tt=U.attachments[K];for(var et in tt){var nt=this.readAttachment(tt[et],W,$.index,et,r);null!=nt&&W.setAttachment($.index,et,nt)}}r.skins.push(W),"default"==W.name&&(r.defaultSkin=W)}for(var rt=0,at=this.linkedMeshes.length;rt<at;rt++){var it=this.linkedMeshes[rt],st=null==it.skin?r.defaultSkin:r.findSkin(it.skin);if(null==st)throw new Error("Skin not found: "+it.skin);var ot=st.getAttachment(it.slotIndex,it.parent);if(null==ot)throw new Error("Parent mesh not found: "+it.parent);it.mesh.deformAttachment=it.inheritDeform?ot:it.mesh,it.mesh.setParentMesh(ot),it.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var lt in a.events){var ht=a.events[lt],ut=new te(lt);ut.intValue=this.getValue(ht,"int",0),ut.floatValue=this.getValue(ht,"float",0),ut.stringValue=this.getValue(ht,"string",""),ut.audioPath=this.getValue(ht,"audio",null),null!=ut.audioPath&&(ut.volume=this.getValue(ht,"volume",1),ut.balance=this.getValue(ht,"balance",0)),r.events.push(ut)}if(a.animations)for(var ct in a.animations){var dt=a.animations[ct];this.readAnimation(dt,ct,r)}return r},e.readAttachment=function(t,e,n,r,a){var i=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",r),o=this.attachmentLoader.newRegionAttachment(e,r,s);if(null==o)return null;o.path=s,o.x=this.getValue(t,"x",0)*i,o.y=this.getValue(t,"y",0)*i,o.scaleX=this.getValue(t,"scaleX",1),o.scaleY=this.getValue(t,"scaleY",1),o.rotation=this.getValue(t,"rotation",0),o.width=t.width*i,o.height=t.height*i;var l=this.getValue(t,"color",null);return null!=l&&o.color.setFromString(l),o.updateOffset(),o;case"boundingbox":var h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(null==h)return null;this.readVertices(t,h,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&h.color.setFromString(u),h;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",r),d=this.attachmentLoader.newMeshAttachment(e,r,c);if(null==d)return null;d.path=c;var f=this.getValue(t,"color",null);null!=f&&d.color.setFromString(f),d.width=this.getValue(t,"width",0)*i,d.height=this.getValue(t,"height",0)*i;var v=this.getValue(t,"parent",null);if(null!=v)return this.linkedMeshes.push(new Ie(d,this.getValue(t,"skin",null),n,v,this.getValue(t,"deform",!0))),d;var p=t.uvs;return this.readVertices(t,d,p.length),d.triangles=t.triangles,d.regionUVs=p,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var m=this.attachmentLoader.newPathAttachment(e,r);if(null==m)return null;m.closed=this.getValue(t,"closed",!1),m.constantSpeed=this.getValue(t,"constantSpeed",!0);var g=t.vertexCount;this.readVertices(t,m,g<<1);for(var w=q.newArray(g/3,0),x=0;x<t.lengths.length;x++)w[x]=t.lengths[x]*i;m.lengths=w;var E=this.getValue(t,"color",null);return null!=E&&m.color.setFromString(E),m;case"point":var y=this.attachmentLoader.newPointAttachment(e,r);if(null==y)return null;y.x=this.getValue(t,"x",0)*i,y.y=this.getValue(t,"y",0)*i,y.rotation=this.getValue(t,"rotation",0);var b=this.getValue(t,"color",null);return null!=b&&y.color.setFromString(b),y;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,r);if(null==S)return null;var A=this.getValue(t,"end",null);if(null!=A){var I=a.findSlot(A);if(null==I)throw new Error("Clipping end slot not found: "+A);S.endSlot=I}var M=t.vertexCount;this.readVertices(t,S,M<<1);var T=this.getValue(t,"color",null);return null!=T&&S.color.setFromString(T),S}return null},e.readVertices=function(t,e,n){var r=this.scale;e.worldVerticesLength=n;var a=t.vertices;if(n!=a.length){for(var i=new Array,s=new Array,o=0,l=a.length;o<l;){var h=a[o++];s.push(h);for(var u=o+4*h;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*r),i.push(a[o+2]*r),i.push(a[o+3])}e.bones=s,e.vertices=q.toFloatArray(i)}else{var c=q.toFloatArray(a);if(1!=r)for(var d=0,f=a.length;d<f;d++)c[d]*=r;e.vertices=c}},e.readAnimation=function(t,e,n){var r=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],l=n.findSlotIndex(s);if(-1==l)throw new Error("Slot not found: "+s);for(var h in o){var u=o[h];if("attachment"==h){var c=new ut(u.length);c.slotIndex=l;for(var d=0,f=0;f<u.length;f++){var v=u[f];c.setFrame(d++,this.getValue(v,"time",0),v.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==h){var p=new lt(u.length);p.slotIndex=l;for(var m=0,g=0;g<u.length;g++){var w=u[g],x=new L;x.setFromString(w.color),p.setFrame(m,this.getValue(w,"time",0),x.r,x.g,x.b,x.a),this.readCurve(w,p,m),m++}a.push(p),i=Math.max(i,p.frames[(p.getFrameCount()-1)*lt.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var E=new ht(u.length);E.slotIndex=l;for(var y=0,b=0;b<u.length;b++){var S=u[b],A=new L,I=new L;A.setFromString(S.light),I.setFromString(S.dark),E.setFrame(y,this.getValue(S,"time",0),A.r,A.g,A.b,A.a,I.r,I.g,I.b),this.readCurve(S,E,y),y++}a.push(E),i=Math.max(i,E.frames[(E.getFrameCount()-1)*ht.ENTRIES])}}}if(t.bones)for(var M in t.bones){var T=t.bones[M],R=n.findBoneIndex(M);if(-1==R)throw new Error("Bone not found: "+M);for(var C in T){var _=T[C];if("rotate"===C){var V=new at(_.length);V.boneIndex=R;for(var P=0,k=0;k<_.length;k++){var F=_[k];V.setFrame(P,this.getValue(F,"time",0),this.getValue(F,"angle",0)),this.readCurve(F,V,P),P++}a.push(V),i=Math.max(i,V.frames[(V.getFrameCount()-1)*at.ENTRIES])}else{if("translate"!==C&&"scale"!==C&&"shear"!==C)throw new Error("Invalid timeline type for a bone: "+C+" ("+M+")");var N=null,O=1,B=0;"scale"===C?(N=new st(_.length),B=1):"shear"===C?N=new ot(_.length):(N=new it(_.length),O=r),N.boneIndex=R;for(var X=0,Y=0;Y<_.length;Y++){var D=_[Y],U=this.getValue(D,"x",B),W=this.getValue(D,"y",B);N.setFrame(X,this.getValue(D,"time",0),U*O,W*O),this.readCurve(D,N,X),X++}a.push(N),i=Math.max(i,N.frames[(N.getFrameCount()-1)*it.ENTRIES])}}}if(t.ik)for(var H in t.ik){var j=t.ik[H],G=n.findIkConstraint(H),z=new pt(j.length);z.ikConstraintIndex=n.ikConstraints.indexOf(G);for(var Z=0,Q=0;Q<j.length;Q++){var J=j[Q];z.setFrame(Z,this.getValue(J,"time",0),this.getValue(J,"mix",1),this.getValue(J,"softness",0)*r,this.getValue(J,"bendPositive",!0)?1:-1,this.getValue(J,"compress",!1),this.getValue(J,"stretch",!1)),this.readCurve(J,z,Z),Z++}a.push(z),i=Math.max(i,z.frames[(z.getFrameCount()-1)*pt.ENTRIES])}if(t.transform)for(var K in t.transform){var $=t.transform[K],tt=n.findTransformConstraint(K),et=new mt($.length);et.transformConstraintIndex=n.transformConstraints.indexOf(tt);for(var rt=0,ct=0;ct<$.length;ct++){var Et=$[ct];et.setFrame(rt,this.getValue(Et,"time",0),this.getValue(Et,"rotateMix",1),this.getValue(Et,"translateMix",1),this.getValue(Et,"scaleMix",1),this.getValue(Et,"shearMix",1)),this.readCurve(Et,et,rt),rt++}a.push(et),i=Math.max(i,et.frames[(et.getFrameCount()-1)*mt.ENTRIES])}if(t.path)for(var yt in t.path){var bt=t.path[yt],St=n.findPathConstraintIndex(yt);if(-1==St)throw new Error("Path constraint not found: "+yt);var At=n.pathConstraints[St];for(var It in bt){var Mt=bt[It];if("position"===It||"spacing"===It){var Tt=null,Rt=1;"spacing"===It?(Tt=new wt(Mt.length),At.spacingMode!=Zt.Length&&At.spacingMode!=Zt.Fixed||(Rt=r)):(Tt=new gt(Mt.length),At.positionMode==zt.Fixed&&(Rt=r)),Tt.pathConstraintIndex=St;for(var Ct=0,_t=0;_t<Mt.length;_t++){var Vt=Mt[_t];Tt.setFrame(Ct,this.getValue(Vt,"time",0),this.getValue(Vt,It,0)*Rt),this.readCurve(Vt,Tt,Ct),Ct++}a.push(Tt),i=Math.max(i,Tt.frames[(Tt.getFrameCount()-1)*gt.ENTRIES])}else if("mix"===It){var Pt=new xt(Mt.length);Pt.pathConstraintIndex=St;for(var kt=0,Ft=0;Ft<Mt.length;Ft++){var Nt=Mt[Ft];Pt.setFrame(kt,this.getValue(Nt,"time",0),this.getValue(Nt,"rotateMix",1),this.getValue(Nt,"translateMix",1)),this.readCurve(Nt,Pt,kt),kt++}a.push(Pt),i=Math.max(i,Pt.frames[(Pt.getFrameCount()-1)*xt.ENTRIES])}}}if(t.deform)for(var Ot in t.deform){var Bt=t.deform[Ot],Xt=n.findSkin(Ot);if(null==Xt)throw new Error("Skin not found: "+Ot);for(var Lt in Bt){var Yt=Bt[Lt],Dt=n.findSlotIndex(Lt);if(-1==Dt)throw new Error("Slot not found: "+Yt.name);for(var Ut in Yt){var Wt=Yt[Ut],qt=Xt.getAttachment(Dt,Ut);if(null==qt)throw new Error("Deform attachment not found: "+Wt.name);var Ht=null!=qt.bones,jt=qt.vertices,Gt=Ht?jt.length/3*2:jt.length,Qt=new dt(Wt.length);Qt.slotIndex=Dt,Qt.attachment=qt;for(var Jt=0,Kt=0;Kt<Wt.length;Kt++){var te=Wt[Kt],ee=void 0,ne=this.getValue(te,"vertices",null);if(null==ne)ee=Ht?q.newFloatArray(Gt):jt;else{ee=q.newFloatArray(Gt);var re=this.getValue(te,"offset",0);if(q.arrayCopy(ne,0,ee,re,ne.length),1!=r)for(var ae=re,ie=ae+ne.length;ae<ie;ae++)ee[ae]*=r;if(!Ht)for(var se=0;se<Gt;se++)ee[se]+=jt[se]}Qt.setFrame(Jt,this.getValue(te,"time",0),ee),this.readCurve(te,Qt,Jt),Jt++}a.push(Qt),i=Math.max(i,Qt.frames[Qt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var le=new vt(oe.length),he=n.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,ve=this.getValue(de,"offsets",null);if(null!=ve){fe=q.newArray(he,-1);for(var pe=q.newArray(he-ve.length,0),me=0,ge=0,we=0;we<ve.length;we++){var xe=ve[we],Ee=n.findSlotIndex(xe.slot);if(-1==Ee)throw new Error("Slot not found: "+xe.slot);for(;me!=Ee;)pe[ge++]=me++;fe[me+xe.offset]=me++}for(;me<he;)pe[ge++]=me++;for(var ye=he-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--ge])}le.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(le),i=Math.max(i,le.frames[le.getFrameCount()-1])}if(t.events){for(var be=new ft(t.events.length),Se=0,Ae=0;Ae<t.events.length;Ae++){var Ie=t.events[Ae],Me=n.findEvent(Ie.name);if(null==Me)throw new Error("Event not found: "+Ie.name);var Te=new $t(q.toSinglePrecision(this.getValue(Ie,"time",0)),Me);Te.intValue=this.getValue(Ie,"int",Me.intValue),Te.floatValue=this.getValue(Ie,"float",Me.floatValue),Te.stringValue=this.getValue(Ie,"string",Me.stringValue),null!=Te.data.audioPath&&(Te.volume=this.getValue(Ie,"volume",1),Te.balance=this.getValue(Ie,"balance",0)),be.setFrame(Se++,Te)}a.push(be),i=Math.max(i,be.frames[be.getFrameCount()-1])}if(isNaN(i))throw new Error("Error while parsing animation, duration is NaN");n.animations.push(new nt(e,a,i))},e.readCurve=function(t,e,n){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(n);else{var r=t.curve;e.setCurve(n,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,n){return void 0!==t[e]?t[e]:n},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return Lt.Normal;if("additive"==t)return Lt.Additive;if("multiply"==t)return Lt.Multiply;if("screen"==t)return Lt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return zt.Fixed;if("percent"==t)return zt.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return Zt.Length;if("fixed"==t)return Zt.Fixed;if("percent"==t)return Zt.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return Qt.Tangent;if("chain"==t)return Qt.Chain;if("chainscale"==t)return Qt.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return jt.Normal;if("onlytranslation"==t)return jt.OnlyTranslation;if("norotationorreflection"==t)return jt.NoRotationOrReflection;if("noscale"==t)return jt.NoScale;if("noscaleorreflection"==t)return jt.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Ie=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},Me=function(){function t(t,e){this.jitterX=0,this.jitterY=0,this.jitterX=t,this.jitterY=e}var e=t.prototype;return e.begin=function(t){},e.transform=function(t,e,n,r){t.x+=Y.randomTriangular(-this.jitterX,this.jitterY),t.y+=Y.randomTriangular(-this.jitterX,this.jitterY)},e.end=function(){},t}(),Te=function(){function t(t){this.centerX=0,this.centerY=0,this.radius=0,this.angle=0,this.worldX=0,this.worldY=0,this.radius=t}var e=t.prototype;return e.begin=function(t){this.worldX=t.x+this.centerX,this.worldY=t.y+this.centerY},e.transform=function(e,n,r,a){var i=this.angle*Y.degreesToRadians,s=e.x-this.worldX,o=e.y-this.worldY,l=Math.sqrt(s*s+o*o);if(l<this.radius){var h=t.interpolation.apply(0,i,(this.radius-l)/this.radius),u=Math.cos(h),c=Math.sin(h);e.x=u*s-c*o+this.worldX,e.y=c*s+u*o+this.worldY}},e.end=function(){},t}();function Re(t,e,n){var r=new Ht(t);return"json"===n?new Ae(r).readSkeletonData(e):new ge(r).readSkeletonData(new Uint8Array(e))}function Ce(t,e,n){return _e.apply(this,arguments)}function _e(){return(_e=_((function(t,e,n){var a,i;return F(this,(function(s){switch(s.label){case 0:i=t.map((function(t,a){var i=e[a],s=r.Texture2D;return"ktx"===i?s=r.KTX:"ktx2"===i&&(s=r.KTX2),Fe(t,n,s)})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,Promise.all(i)];case 2:return a=s.sent(),[3,4];case 3:throw s.sent();case 4:return[2,a]}}))}))).apply(this,arguments)}function Ve(t,e){return Pe.apply(this,arguments)}function Pe(){return(Pe=_((function(e,n){var r,a,i,s,o,l,h,u,c,d,f,v;return F(this,(function(p){switch(p.label){case 0:m=new URL(e),g=m.origin+m.pathname,r=g.endsWith("/")?g:g.substring(0,g.lastIndexOf("/")+1),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,t(e,{type:"text"})];case 2:return a=p.sent(),[3,4];case 3:throw s=p.sent(),new Error("Spine Atlas: "+e+" load error: "+s);case 4:for(o=function(){},l=new kt(a,(function(){return{setFilters:o,setWraps:o,getImage:function(){return{width:0,height:0}}}})),h=[],u=O(l.pages);!(c=u()).done;)d=c.value,f=r+d.name,h.push(Fe(f,n));p.label=5;case 5:return p.trys.push([5,7,,8]),[4,Promise.all(h)];case 6:return i=p.sent(),[3,8];case 7:throw v=p.sent(),new Error("Spine Texture: load error: "+v);case 8:return[2,l=ke(a,i)]}var m,g}))}))).apply(this,arguments)}function ke(t,e){var n=0,r=new kt(t,(function(t){return function(t,e,n){var r=e.find((function(e){return e.name===t}))||e[n];return a=r,new Ne(new Image,a);var a}(t,e,n++)}));return r}function Fe(t,e,n){return void 0===n&&(n=r.Texture2D),e.resourceManager.load({url:t,type:n})}Te.interpolation=new W(2);var Ne=function(t){function r(e,n){var r,a;return(r=t.call(this,e)||this).texture=n,null==(a=r.texture)||a.generateMipmaps(),r}P(r,t);var a=r.prototype;return a.getImage=function(){return this.texture},a.setFilters=function(t,n){t===Rt.Nearest?this.texture.filterMode=e.Point:n===Rt.MipMapLinearLinear?this.texture.filterMode=e.Trilinear:this.texture.filterMode=e.Bilinear},a.setWraps=function(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)},a.dispose=function(){},a._convertWrapMode=function(t){switch(t){case Ct.ClampToEdge:return n.Clamp;case Ct.Repeat:return n.Repeat;case Ct.MirroredRepeat:return n.Mirror;default:throw new Error("Unsupported texture wrap mode.")}},r}(_t),Oe=function(){function t(t,e){void 0===e&&(e=1),this._type=t,this._lastElementIndex=e-1;for(var n=this._elements=new Array(e),r=0;r<e;++r)n[r]=new t}var e=t.prototype;return e.get=function(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]},e.return=function(t){this._elements[++this._lastElementIndex]=t},t}(),Be=function(){function t(t){this._usedElementCount=0,this._type=t,this._elements=[]}var e=t.prototype;return e.get=function(){var t=this._usedElementCount,e=this._elements;if(this._usedElementCount++,e.length===t){var n=new this._type;return e.push(n),n}return e[t]},e.clear=function(){this._usedElementCount=0},t}(),Xe=a.SourceAlpha,Le=a.One,Ye=a.DestinationColor,De=a.Zero,Ue=a.OneMinusSourceColor,We=a.OneMinusSourceAlpha,qe=i.Add;function He(t,e){var n=t.renderState.blendState.targetBlendState;switch(e){case Lt.Additive:n.sourceColorBlendFactor=Xe,n.destinationColorBlendFactor=Le,n.sourceAlphaBlendFactor=Le,n.destinationAlphaBlendFactor=Le,n.colorBlendOperation=n.alphaBlendOperation=qe;break;case Lt.Multiply:n.sourceColorBlendFactor=Ye,n.destinationColorBlendFactor=We,n.sourceAlphaBlendFactor=Le,n.destinationAlphaBlendFactor=We,n.colorBlendOperation=n.alphaBlendOperation=qe;break;case Lt.Screen:n.sourceColorBlendFactor=Le,n.destinationColorBlendFactor=Ue,n.sourceAlphaBlendFactor=Le,n.destinationAlphaBlendFactor=Ue,n.colorBlendOperation=n.alphaBlendOperation=qe;break;default:n.sourceColorBlendFactor=Xe,n.destinationColorBlendFactor=We,n.sourceAlphaBlendFactor=Le,n.destinationAlphaBlendFactor=We,n.colorBlendOperation=n.alphaBlendOperation=qe}}var je=1/0,Ge=-1/0,ze=function(){function t(){this._clipper=new Se,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}var e=t.prototype;return e.getMaxVertexCount=function(t){for(var e=new Set,n=t.skins,r=n.length,a=0;a<r;a++){var i=n[a];this._collectUniqueAttachments(i,e)}return this._calculateTotalVertexCount(e)},e.buildPrimitive=function(e,n){var r=n.setting,a=r.useClipping,i=void 0===a||a,s=r.zSpacing,o=void 0===s?.01:s,l=this,h=l._clipper,u=l._separateSlots,c=l._subRenderItems,d=l._separateSlotTextureMap,f=t.bounds;f.min.set(je,je,je),f.max.set(Ge,Ge,Ge);var v=0,p=0,m=e.drawOrder,g=m.length,w=n.engine,x=n._indices,E=n._vertices,y=n._vertexCount,b=n._subPrimitives,S=t.tempVerts,A=t.tempTexture,I=t.tempBlendMode,M=t.subRenderItemPool,T=t.subPrimitivePool;c.length=0,M.clear();var R,C,_=n._vertices,V=0,P=0,k=Lt.Normal,F=null,N=0;t.tempBlendMode=null,t.tempTexture=null;for(var O=0;O<g;++O){var B=m[O];if(B.bone.active){var X=B.getAttachment(),L=null,Y=o*O,D=0,U=h.isClipping(),W=U?2:t.VERTEX_SIZE;if(X){switch(X.constructor){case Xt:var q=X;L=q.color,D=4*W,q.computeWorldVertices(B.bone,S,0,W),R=t.QUAD_TRIANGLES,C=q.uvs,F=q.region.renderObject.texture;break;case Yt:var H=X;L=H.color,(D=(H.worldVerticesLength>>1)*W)>_.length&&(t.tempVerts=new Array(D)),H.computeWorldVertices(B,0,H.worldVerticesLength,S,0,W),R=H.triangles,C=H.uvs,F=H.region.renderObject.texture;break;case qt:if(i){var j=X;h.clipStart(B,j)}continue;default:i&&h.clipEndWithSlot(B);continue}if(null!=F){var G=void 0,z=void 0,Z=void 0,Q=void 0,J=B.bone.skeleton.color,K=B.color,$=J.a*K.a*L.a,tt=t.tempColor,et=t.tempDark;if(tt.set(J.r*K.r*L.r,J.g*K.g*L.g,J.b*K.b*L.b,$),U)h.clipTriangles(S,D,R,R.length,C,tt,et,!1),z=(G=h.clippedVertices).length,Q=(Z=h.clippedTriangles).length;else{for(var nt=S,rt=tt.r,at=tt.g,it=tt.b,st=tt.a,ot=2,lt=0,ht=D;ot<ht;ot+=W,lt+=2)nt[ot]=rt,nt[ot+1]=at,nt[ot+2]=it,nt[ot+3]=st,nt[ot+4]=C[lt],nt[ot+5]=C[lt+1];G=S,z=D,Z=R,Q=R.length}if(0==z||0==Q){h.clipEndWithSlot(B);continue}for(var ut=v/t.VERTEX_STRIDE,ct=E,dt=v,ft=0;ft<z;){var vt=G[ft++],pt=G[ft++];ct[dt++]=vt,ct[dt++]=pt,ct[dt++]=Y,ct[dt++]=G[ft++],ct[dt++]=G[ft++],ct[dt++]=G[ft++],ct[dt++]=G[ft++],ct[dt++]=G[ft++],ct[dt++]=G[ft++],this._expandByPoint(vt,pt,Y)}v=dt;var mt=x;for(dt=p,ft=0;ft<Q;dt++,ft++)mt[dt]=Z[ft]+ut;p+=Q;var gt=B.data,wt=gt.name;k=gt.blendMode;var xt=null!==I&&I!==gt.blendMode,Et=null!==A&&A!==F,yt=u.get(wt);if(yt||xt||Et){if(P>0){var bt=b[N];bt&&N++;var St=bt||T.get();St.start=V,St.count=P;var At=M.get();At.subPrimitive=St,At.texture=A,At.blendMode=I,c.push(At),V+=P,P=0}if(yt){var It=d.get(wt);if(It){var Mt=F.texture;It.filterMode=Mt.filterMode,It.wrapModeU=Mt.wrapModeU,It.wrapModeV=Mt.wrapModeV}var Tt=b[N];Tt&&N++;var Rt=Tt||T.get();Rt.start=V,Rt.count=Q;var Ct=M.get();Ct.blendMode=k,Ct.subPrimitive=Rt,Ct.texture=F,Ct.slotName=wt,c.push(Ct),V+=Q,P=0}else P+=Q}else P+=Q;A=F,I=k}h.clipEndWithSlot(B)}else i&&h.clipEndWithSlot(B)}else h.clipEndWithSlot(B)}if(P>0){var _t=b[N];_t&&N++;var Vt=_t||T.get();Vt.start=V,Vt.count=P;var Pt=M.get();Pt.blendMode=k,Pt.subPrimitive=Vt,Pt.texture=F,c.push(Pt),P=0}h.clipEnd();var kt=b.length,Ft=c.length;if(Ft<kt)for(var Nt=Ft;Nt<kt;Nt++){var Ot=b[Nt];T.return(Ot)}n._clearSubPrimitives();for(var Bt=0,Dt=Ft;Bt<Dt;++Bt){var Ut=c[Bt],Wt=Ut.slotName,Ht=Ut.blendMode,jt=Ut.texture;n._addSubPrimitive(Ut.subPrimitive);var Gt=jt.texture;d.has(Wt)&&(Gt=d.get(Wt));var zt=Gt.instanceId+"_"+Ht,Zt=Ke._materialCache.get(zt);Zt||(Zt=this._createMaterialForTexture(Gt,w,Ht),Ke._materialCache.set(zt,Zt)),n.setMaterial(Bt,Zt)}if(p>y)return n._createBuffer(p),void this.buildPrimitive(e,n);n._vertexBuffer.setData(E),n._indexBuffer.setData(x)},e.addSeparateSlot=function(t){this._separateSlots.set(t,t)},e.addSeparateSlotTexture=function(t,e){this._separateSlotTextureMap.set(t,e)},e._createMaterialForTexture=function(t,e,n){var r=Ke._getDefaultMaterial(e);return r.shaderData.setTexture("material_SpineTexture",t),He(r,n),r},e._expandByPoint=function(e,n,r){var a=t.bounds,i=a.min,s=a.max,o=Math.min(i.x,e),l=Math.min(i.y,n),h=Math.min(i.z,r),u=Math.max(s.x,e),c=Math.max(s.y,n),d=Math.max(s.z,r);i.set(o,l,h),s.set(u,c,d)},e._collectUniqueAttachments=function(t,e){for(var n=t.attachments,r=0,a=n.length;r<a;r++){var i=n[r];for(var s in i){var o=i[s];o&&!e.has(o)&&e.add(o)}}},e._calculateTotalVertexCount=function(e){var n=0,r=t.QUAD_TRIANGLES.length;return e.forEach((function(t){B(t,Xt)?n+=r:B(t,Yt)&&(n+=t.triangles.length)})),n},t}();ze.QUAD_TRIANGLES=[0,1,2,2,3,0],ze.VERTEX_SIZE=8,ze.VERTEX_STRIDE=9,ze.tempDark=new L,ze.tempColor=new L,ze.tempVerts=new Array(8),ze.tempBlendMode=null,ze.tempTexture=null,ze.subPrimitivePool=new Oe(s),ze.subRenderItemPool=new Be((function(){})),ze.bounds=new o(new l(je,je,je),new l(Ge,Ge,Ge));var Ze=function(t){function e(n){var r,a=h.find("galacean-spine-shader")||h.create("galacean-spine-shader",e._spineVS,e._spineFS),i=(r=t.call(this,n,a)||this).renderState;return i.blendState.targetBlendState.enabled=!0,He(Q(r),Lt.Normal),i.depthState.writeEnabled=!1,i.rasterState.cullMode=u.Off,i.renderQueueType=c.Transparent,r}return P(e,t),e}(d);Ze._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 ",Ze._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 Qe,Je,Ke=function(t){function e(n){var r;(r=t.call(this,n)||this).setting=new $e,r.defaultState=new tn,r._subPrimitives=[],r._needResizeBuffer=!1,r._vertexCount=0;var a=new A(r._engine);return r._primitive=a,a.addVertexElement(e._positionVertexElement),a.addVertexElement(e._colorVertexElement),a.addVertexElement(e._uvVertexElement),r}P(e,t);var n=e.prototype;return n.addSeparateSlot=function(t){this._skeleton||console.error("Skeleton not found!"),this._skeleton.findSlot(t)?e._spineGenerator.addSeparateSlot(t):console.warn("Slot: "+t+" not find.")},n._onEnable=function(){this._initializeDefaultState()},n.update=function(t){var n=this._state,r=this._skeleton;n&&r&&(n.update(t),n.apply(r),r.updateWorldTransform(),e._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))},n._render=function(t){var e=this._primitive,n=this._subPrimitives,r=this._materials,a=this._engine,i=a._renderElementPool.get();i.set(this.priority,this._distanceForSort);var s=a._subRenderElementPool;if(n){for(var o=0,l=n.length;o<l;o++){var h=r[o];if(h){(h.destroyed||h.shader.destroyed)&&(h=this.engine._meshMagentaMaterial);var u=s.get();u.set(this,h,e,n[o]),i.addSubRenderElement(u)}}t.camera._renderPipeline.pushRenderElement(t,i)}},n._updateBounds=function(t){this._calculateGeneratorBounds(t)},n._calculateGeneratorBounds=function(t){var e=ze.bounds;o.transform(e,this.entity.transform.worldMatrix,t)},n._cloneTo=function(t){t.resource=this._resource},n._onDestroy=function(){var e=this,n=e._primitive,r=e._subPrimitives,a=e._resource;r.length=0,n&&n.destroy(),a&&this._addResourceReferCount(a,-1),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,this.setting=null,t.prototype._onDestroy.call(this)},n._createBuffer=function(t){var e=this._engine,n=this._primitive;this._vertexCount=t,this._vertices=new Float32Array(t*ze.VERTEX_STRIDE),this._indices=new Uint16Array(t);var r=4*ze.VERTEX_STRIDE,a=new p(e,m.VertexBuffer,this._vertices,g.Dynamic),i=new p(e,m.IndexBuffer,this._indices,g.Dynamic);this._indexBuffer=i,this._vertexBuffer=a;var s=new w(a,r);this._primitive.setVertexBufferBinding(0,s);var o=new x(i,E.UInt16);n.setIndexBufferBinding(o)},n._addSubPrimitive=function(t){this._subPrimitives.push(t)},n._clearSubPrimitives=function(){this._subPrimitives.length=0},n._isContainDirtyFlag=function(t){return!!(this._dirtyUpdateFlag&t)},n._setDirtyFlagFalse=function(t){this._dirtyUpdateFlag&=~t},n._onWorldVolumeChanged=function(){this._dirtyUpdateFlag|=1},n._onAnimationStart=function(){this._dirtyUpdateFlag|=2},n._onAnimationComplete=function(t){t.loop||this._setDirtyFlagFalse(2)},n._clearMaterialCache=function(){this._materials.forEach((function(t){var n,r=t.shaderData.getTexture("material_SpineTexture"),a=(n=t.renderState.blendState.targetBlendState).sourceColorBlendFactor===Xe&&n.destinationColorBlendFactor===Le&&n.sourceAlphaBlendFactor===Le&&n.destinationAlphaBlendFactor===Le&&n.colorBlendOperation===qe&&n.alphaBlendOperation===qe?Lt.Additive:n.sourceColorBlendFactor===Ye&&n.destinationColorBlendFactor===De&&n.sourceAlphaBlendFactor===Le&&n.destinationAlphaBlendFactor===De&&n.colorBlendOperation===qe&&n.alphaBlendOperation===qe?Lt.Multiply:n.sourceColorBlendFactor===Le&&n.destinationColorBlendFactor===Ue&&n.sourceAlphaBlendFactor===Le&&n.destinationAlphaBlendFactor===Ue&&n.colorBlendOperation===qe&&n.alphaBlendOperation===qe?Lt.Screen:Lt.Normal,i=r.instanceId+"_"+a;e._materialCache.delete(i)}))},n._initializeDefaultState=function(){var t=this.skeleton,e=this.state;if(t&&e){var n=this.defaultState,r=n.animationName,a=n.skinName,i=n.loop,s=n.scale;t.scaleX=s,t.scaleY=s,"default"!==a&&(t.setSkinByName(a),t.setToSetupPose()),r&&e.setAnimation(0,r,i)}},e._getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new Ze(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},Tt(e,[{key:"resource",get:function(){return this._resource},set:function(t){var n=this;if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t,this._addResourceReferCount(t,1);var r=t.skeletonData;this._skeleton=new ce(r);var a=e._animationDataCache.get(r);a||(a=new It(r),e._animationDataCache.set(r,a)),this._state=new Et(a),e._spineGenerator.getMaxVertexCount(r),this._createBuffer(0),this._initializeDefaultState(),this._dirtyUpdateFlag|=4,this._state.addListener({start:function(){n._onAnimationStart()},complete:function(t){n._onAnimationComplete(t)}})}},{key:"state",get:function(){return this._state}},{key:"skeleton",get:function(){return this._skeleton}}]),e}(y);Ke._spineGenerator=new ze,Ke._positionVertexElement=new f("POSITION",0,v.Vector3,0),Ke._colorVertexElement=new f("COLOR_0",12,v.Vector4,0),Ke._uvVertexElement=new f("TEXCOORD_0",28,v.Vector2,0),Ke._materialCache=new Map,Ke._animationDataCache=new Map,k([b],Ke.prototype,"setting",void 0),k([b],Ke.prototype,"defaultState",void 0),k([S],Ke.prototype,"_primitive",void 0),k([S],Ke.prototype,"_subPrimitives",void 0),k([S],Ke.prototype,"_indexBuffer",void 0),k([S],Ke.prototype,"_vertexBuffer",void 0),k([S],Ke.prototype,"_vertices",void 0),k([S],Ke.prototype,"_indices",void 0),k([S],Ke.prototype,"_needResizeBuffer",void 0),k([S],Ke.prototype,"_vertexCount",void 0),k([S],Ke.prototype,"_resource",void 0),k([S],Ke.prototype,"_skeleton",void 0),k([S],Ke.prototype,"_state",void 0),function(t){t[t.TransformVolume=1]="TransformVolume",t[t.AnimationVolume=2]="AnimationVolume",t[t.InitialVolume=4]="InitialVolume"}(Qe||(Qe={})),function(t){t[t.WorldVolume=1]="WorldVolume"}(Je||(Je={}));var $e=function(t,e){void 0===t&&(t=.01),void 0===e&&(e=!0),this.zSpacing=t,this.useClipping=e},tn=function(t,e,n,r){void 0===t&&(t=1),void 0===e&&(e=!0),void 0===n&&(n=null),void 0===r&&(r="default"),this.scale=t,this.loop=e,this.animationName=n,this.skinName=r},en=function(t){function e(e,n){var r;return(r=t.call(this,e)||this).textures=[],r._skeletonData=n,r._associationTextureInSkeletonData(n),r}P(e,t);var n=e.prototype;return n._onDestroy=function(){t.prototype._onDestroy.call(this);var e=this.textures,n=this._skeletonData;e&&this._disassociationSuperResource(e),this._clearAttachmentTextures(n),Ke._animationDataCache.delete(n),this._skeletonData=null},n._disassociationSuperResource=function(t){for(var e=0,n=t.length;e<n;e++)t[e]._disassociationSuperResource(this)},n._associationTextureInSkeletonData=function(t){var e=this;t.skins.forEach((function(t){t.attachments.forEach((function(t){var n,r=Object.values(t)[0],a=null==r||null==(n=r.region)?void 0:n.texture.texture;a&&!e.textures.find((function(t){return t.instanceId===a.instanceId}))&&(e.textures.push(a),a._associationSuperResource(e))}))}))},n._clearAttachmentTextures=function(t){t.skins.forEach((function(t){t.attachments.forEach((function(t){var e,n=Object.values(t)[0];(null==n||null==(e=n.region)?void 0:e.texture)&&(n.region.texture.texture=null)}))}))},Tt(e,[{key:"skeletonData",get:function(){return this._skeletonData}}]),e}(I),nn=function(){function t(t,e,n){void 0===e&&(e=0),this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,null!=n?n:t.byteLength-e),this._position=0}var e=t.prototype;return e.nextUint16=function(){var t=this._dataView.getUint16(this._position,!0);return this._position+=2,t},e.nextStr=function(){var t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,this.decodeText(e)},e.nextImageData=function(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)},e.decodeText=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);return decodeURIComponent(encodeURIComponent(e))},t}(),rn=function(t){function e(){return t.apply(this,arguments)}P(e,t);var n=e.prototype;return n.load=function(t,e){var n=this;return new T(_((function(r){var a,i,s,o;return F(this,(function(l){switch(l.label){case 0:return t.urls?[4,n._handleOriginAsset(t,e)]:[3,2];case 1:return a=l.sent(),[3,7];case 2:return[4,n.request(t.url,{type:"arraybuffer"})];case 3:return i=l.sent(),s=new nn(new Uint8Array(i)),(o=s.nextStr()).startsWith("spine")?[4,n._handleEditorAsset(i,s,o,e)]:[3,5];case 4:return a=l.sent(),[3,7];case 5:return[4,n._handleOriginAsset(t,e,i)];case 6:a=l.sent(),l.label=7;case 7:return r(a),[2]}}))})))},n._handleEditorAsset=function(t,e,n,r){return _((function(){var a,i,s,o,l,h,u,c,d,f,v;return F(this,(function(p){switch(p.label){case 0:return s=n.startsWith("spine:skel")?"skel":"json",o=r.engine,"skel"===s?(i=e.nextStr(),a=e.nextImageData()):(l=new TextDecoder("utf-8"),h=l.decode(new Uint8Array(t)),u=JSON.parse(h),c=u.data,d=u.atlas,i=d.refId,a=c),[4,r.getResourceByRef({refId:i})];case 1:return f=p.sent(),v=Re(f,a,s),[2,new en(o,v)]}}))}))()},n._handleOriginAsset=function(t,n,r){var a=this;return _((function(){var i,s,o,l,h,u,c,d,f,v,p,m,g,w,x,E,y,b,S,A,I,M,T,R,C,_,V,P,k;return F(this,(function(F){switch(F.label){case 0:if(i=(t.params||{}).fileExtensions,s={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]},o=n.engine,!r)return[3,2];if(l=e.verifyFileExtensions(i,!1),e.deriveAndAssignSpineAsset(t.url,l,s),h=s.skeletonPath,u=s.atlasPath,!h||!u)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");return[4,Ve(u,o)];case 1:return c=F.sent(),d=a._determineSkeletonDataType(r),f=d.data,v=d.type,p=Re(c,f,v),[2,new en(o,p)];case 2:for(i=e.verifyFileExtensions(i,!0),m=0;m<t.urls.length;m+=1)g=t.urls[m],w=i&&i[m]||null,e.parseAndAssignSpineAsset(g,w,s);if(x=s.skeletonPath,E=s.atlasPath,y=s.imagePaths,b=s.skeletonExtension,S=s.imageExtensions,!x||!E)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");return A="json"===b?a.request(x,{type:"text"}):a.request(x,{type:"arraybuffer"}),I="json"===b?"json":"skel",M=[A],y.length>0?(M=M.concat([a.request(E,{type:"text"}),Ce(y,S,o)]),[4,Promise.all(M)]):[3,4];case 3:return V=F.sent(),R=V[0],C=V[1],_=V[2],T=ke(C,_),[3,6];case 4:return M.push(Ve(E,o)),[4,Promise.all(M)];case 5:P=F.sent(),R=P[0],T=P[1],F.label=6;case 6:return k=Re(T,R,I),[2,new en(o,k)];case 7:return[2]}}))}))()},n._determineSkeletonDataType=function(t){var e,n;try{var r=new TextDecoder("utf-8").decode(t);JSON.parse(r),e=r,n="json"}catch(r){e=t,n="skel"}return{data:e,type:n}},e.parseAndAssignSpineAsset=function(t,n,r){var a=e.imageExtensions,i=e.skeletonExtensions,s=e.getUrlExtension(t,n);s&&(i.includes(s)&&(r.skeletonPath=t,r.skeletonExtension=s),"atlas"===s&&(r.atlasPath=t),a.includes(s)&&(r.imagePaths.push(t),r.imageExtensions.push(s)))},e.deriveAndAssignSpineAsset=function(t,n,r){var a=e.getUrlExtension(t,n);if(a){r.skeletonPath=t,r.skeletonExtension=a;var i,s=/(\.(json|bin|skel))$/;if(s.test(t)&&(i=t.replace(s,"")),i){var o=i+".atlas";r.atlasPath=o}}},e.verifyFileExtensions=function(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null},e.getUrlExtension=function(t,e){if(e)return e;var n=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return n?n[2]||n[4]:null},e}(R);rn.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"],rn.skeletonExtensions=["skel","json","bin"],rn=k([M("spine",["json","bin","skel"])],rn);var an=function(t){function e(){return t.apply(this,arguments)}return P(e,t),e.prototype.load=function(t,e){var n=this;return new T(_((function(r){var a,i,s,o,l,h,u;return F(this,(function(c){switch(c.label){case 0:return[4,n.request(t.url,{type:"text"})];case 1:return a=c.sent(),i=JSON.parse(a),s=i.data,o=i.textures,l=o.map((function(t){return e.getResourceByRef({refId:t.refId})})),[4,Promise.all(l)];case 2:return h=c.sent(),u=ke(s,h),r(u),[2]}}))})))},e}(R);an=k([M("EditorSpineAtlas",["atlas"])],an);var sn="0.0.0-experimental-engine-spine-20240821";R.registerClass("SpineAnimationRenderer",Ke),console.log("Galacean spine version: "+sn);export{nt as Animation,Et as AnimationState,At as AnimationStateAdapter,It as AnimationStateData,Bt as AssetManager,Ht as AtlasAttachmentLoader,J as Attachment,ut as AttachmentTimeline,se as AttachmentType,Lt as BlendMode,Jt as Bone,Gt as BoneData,Dt as BoundingBoxAttachment,qt as ClippingAttachment,L as Color,lt as ColorTimeline,Kt as ConstraintData,rt as CurveTimeline,H as DebugUtils,dt as DeformTimeline,vt as DrawOrderTimeline,$t as Event,te as EventData,St as EventQueue,ft as EventTimeline,yt as EventType,Pt as FakeTexture,ee as IkConstraint,ne as IkConstraintData,pt as IkConstraintTimeline,X as IntSet,D as Interpolation,Me as JitterEffect,Y as MathUtils,Yt as MeshAttachment,$ as MixBlend,tt as MixDirection,Ut as PathAttachment,ie as PathConstraint,re as PathConstraintData,xt as PathConstraintMixTimeline,gt as PathConstraintPositionTimeline,wt as PathConstraintSpacingTimeline,Wt as PointAttachment,j as Pool,zt as PositionMode,U as Pow,W as PowOut,Xt as RegionAttachment,Qt as RotateMode,at as RotateTimeline,st as ScaleTimeline,le as SharedAssetManager,ot as ShearTimeline,ce as Skeleton,ge as SkeletonBinary,ye as SkeletonBounds,Se as SkeletonClipping,de as SkeletonData,en as SkeletonDataResource,Ae as SkeletonJson,me as Skin,pe as SkinEntry,he as Slot,fe as SlotData,Zt as SpacingMode,Ke as SpineAnimationRenderer,Te as SwirlEffect,_t as Texture,kt as TextureAtlas,Nt as TextureAtlasPage,Ot as TextureAtlasRegion,Rt as TextureFilter,Vt as TextureRegion,Ct as TextureWrap,z as TimeKeeper,et as TimelineType,bt as TrackEntry,ue as TransformConstraint,ve as TransformConstraintData,mt as TransformConstraintTimeline,jt as TransformMode,it as TranslateTimeline,be as Triangulator,ht as TwoColorTimeline,q as Utils,G as Vector2,K as VertexAttachment,Z as WindowedMean,ke as createTextureAtlas,sn as version};
1
+ import{AssetType as t,request as e,TextureFilterMode as s,TextureWrapMode as i,BlendFactor as a,BlendOperation as n,SubPrimitive as r,BoundingBox as o,Vector3 as l,Material as h,Shader as c,CullMode as d,RenderQueueType as u,Renderer as m,VertexElement as f,VertexElementFormat as p,Primitive as g,Buffer as x,BufferBindFlag as w,BufferUsage as b,VertexBufferBinding as y,IndexBufferBinding as k,IndexFormat as v,assignmentClone as S,deepClone as A,ignoreClone as I,ReferResource as M,Entity as C,Loader as F,AssetPromise as T,resourceLoader as E}from"@galacean/engine";function Y(t,e,s,i){var a,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(r=(n<3?a(r):n>3?a(e,s,r):a(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}"function"==typeof SuppressedError&&SuppressedError;class _{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}}class X{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class R{r;g;b;a;static WHITE=new R(1,1,1,1);static RED=new R(1,0,0,1);static GREEN=new R(0,1,0,1);static BLUE=new R(0,0,1,1);static MAGENTA=new R(1,0,1,1);constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new R).setFromString(t)}}class B{static PI=3.1415927;static PI2=2*B.PI;static invPI2=1/B.PI2;static radiansToDegrees=180/B.PI;static radDeg=B.radiansToDegrees;static degreesToRadians=B.PI/180;static degRad=B.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*B.degRad)}static sinDeg(t){return Math.sin(t*B.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*B.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return B.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),a=e-t;return i<=(s-t)/a?t+Math.sqrt(i*a*(s-t)):e-Math.sqrt((1-i)*a*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class P{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class V extends P{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class D extends V{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class O{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,i,a){for(let n=e,r=i;n<e+a;n++,r++)s[r]=t[n]}static arrayFill(t,e,s,i){for(let a=e;a<s;a++)t[a]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let a=i;a<e;a++)t[a]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:O.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(O.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(O.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return O.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return O.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class N{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class L{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class q{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}class U{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class W{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class z{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class $ extends z{static nextID=0;id=$.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,i,a,n){s=a+(s>>1)*n;let r=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let r=t.bone,h=r.worldX,c=r.worldY,d=r.a,u=r.b,m=r.c,f=r.d;for(let t=e,r=a;r<s;t+=2,r+=n){let e=l[t],s=l[t+1];i[r]=e*d+s*u+h,i[r+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=r.bones;if(0==o.length)for(let t=a,e=3*d;t<s;t+=n){let s=0,a=0,n=h[c++];for(n+=c;c<n;c++,e+=3){let t=u[h[c]],i=l[e],n=l[e+1],r=l[e+2];s+=(i*t.a+n*t.b+t.worldX)*r,a+=(i*t.c+n*t.d+t.worldY)*r}i[t]=s,i[t+1]=a}else{let t=o;for(let e=a,r=3*d,o=d<<1;e<s;e+=n){let s=0,a=0,n=h[c++];for(n+=c;c<n;c++,r+=3,o+=2){let e=u[h[c]],i=l[r]+t[o],n=l[r+1]+t[o+1],d=l[r+2];s+=(i*e.a+n*e.b+e.worldX)*d,a+=(i*e.c+n*e.d+e.worldY)*d}i[e]=s,i[e+1]=a}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),O.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=O.newFloatArray(this.vertices.length),O.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class G{static _nextID=0;id=G.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new G(this.regions.length);return O.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return G._nextID++}}var j;!function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"}(j||(j={}));const H=[j.hold,j.once,j.loop,j.pingpong,j.onceReverse,j.loopReverse,j.pingpongReverse];class J{name;timelines=[];timelineIds=new X;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,a,n,r,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,a,n,r,o)}}var K,Z;!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(K||(K={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(Z||(Z={}));const Q={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class tt{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=O.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let a=s;a<i;a+=s)if(t[a]>e)return a-s;return i-s}}class et extends tt{curves;constructor(t,e,s){super(t,s),this.curves=O.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=O.newFloatArray(e);O.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,a,n,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*n+o),f=.03*(a-2*r+l),p=.006*(3*(n-o)-i+h),g=.006*(3*(r-l)-a+c),x=2*m+p,w=2*f+g,b=.3*(n-i)+m+.16666667*p,y=.3*(r-a)+f+.16666667*g,k=i+b,v=a+y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=p,w+=g,k+=b,v+=y}getBezierValue(t,e,s,i){let a=this.curves;if(a[i]>t){let n=this.frames[e],r=this.frames[e+s];return r+(t-n)/(a[i]-n)*(a[i+1]-r)}let n=i+18;for(i+=2;i<n;i+=2)if(a[i]>=t){let e=a[i-2],s=a[i-1];return s+(t-e)/(a[i]-e)*(a[i+1]-s)}e+=this.getFrameEntries();let r=a[n-2],o=a[n-1];return o+(t-r)/(this.frames[e]-r)*(this.frames[e+s]-o)}}class st extends et{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],a=e[s+1];return a+(t-i)/(e[s+2]-i)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,a){if(t<this.frames[0]){switch(s){case K.setup:return a;case K.first:return i+(a-i)*e}return i}let n=this.getCurveValue(t);switch(s){case K.setup:return a+n*e;case K.first:case K.replace:n+=a-i}return i+n*e}getAbsoluteValue(t,e,s,i,a){if(t<this.frames[0]){switch(s){case K.setup:return a;case K.first:return i+(a-i)*e}return i}let n=this.getCurveValue(t);return s==K.setup?a+(n-a)*e:i+(n-i)*e}getAbsoluteValue2(t,e,s,i,a,n){if(t<this.frames[0]){switch(s){case K.setup:return a;case K.first:return i+(a-i)*e}return i}return s==K.setup?a+(n-a)*e:i+(n-i)*e}getScaleValue(t,e,s,i,a,n){if(t<this.frames[0]){switch(s){case K.setup:return n;case K.first:return a+(n-a)*e}return a}let r=this.getCurveValue(t)*n;if(1==e)return s==K.add?a+r-n:r;if(i==Z.mixOut)switch(s){case K.setup:return n+(Math.abs(r)*B.signum(n)-n)*e;case K.first:case K.replace:return a+(Math.abs(r)*B.signum(a)-a)*e}else{let t=0;switch(s){case K.setup:return t=Math.abs(n)*B.signum(r),t+(r-t)*e;case K.first:case K.replace:return t=Math.abs(a)*B.signum(r),t+(r-t)*e}}return a+(r-n)*e}}class it extends et{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class at extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,a,n,o.rotation,o.data.rotation))}}class nt extends it{boneIndex=0;constructor(t,e,s){super(t,e,Q.x+"|"+s,Q.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case K.setup:return o.x=o.data.x,void(o.y=o.data.y);case K.first:o.x+=(o.data.x-o.x)*a,o.y+=(o.data.y-o.y)*a}return}let h=0,c=0,d=tt.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case K.setup:o.x=o.data.x+h*a,o.y=o.data.y+c*a;break;case K.first:case K.replace:o.x+=(o.data.x+h-o.x)*a,o.y+=(o.data.y+c-o.y)*a;break;case K.add:o.x+=h*a,o.y+=c*a}}}class rt extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,a,n,o.x,o.data.x))}}class ot extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,a,n,o.y,o.data.y))}}class lt extends it{boneIndex=0;constructor(t,e,s){super(t,e,Q.scaleX+"|"+s,Q.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(n){case K.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case K.first:o.scaleX+=(o.data.scaleX-o.scaleX)*a,o.scaleY+=(o.data.scaleY-o.scaleY)*a}return}let d=tt.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==a)n==K.add?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(r==Z.mixOut)switch(n){case K.setup:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*B.signum(t)-t)*a,o.scaleY=e+(Math.abs(h)*B.signum(e)-e)*a;break;case K.first:case K.replace:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*B.signum(t)-t)*a,o.scaleY=e+(Math.abs(h)*B.signum(e)-e)*a;break;case K.add:o.scaleX+=(l-o.data.scaleX)*a,o.scaleY+=(h-o.data.scaleY)*a}else switch(n){case K.setup:t=Math.abs(o.data.scaleX)*B.signum(l),e=Math.abs(o.data.scaleY)*B.signum(h),o.scaleX=t+(l-t)*a,o.scaleY=e+(h-e)*a;break;case K.first:case K.replace:t=Math.abs(o.scaleX)*B.signum(l),e=Math.abs(o.scaleY)*B.signum(h),o.scaleX=t+(l-t)*a,o.scaleY=e+(h-e)*a;break;case K.add:o.scaleX+=(l-o.data.scaleX)*a,o.scaleY+=(h-o.data.scaleY)*a}}}}class ht extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,a,n,r,o.scaleX,o.data.scaleX))}}class ct extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,a,n,r,o.scaleY,o.data.scaleY))}}class dt extends it{boneIndex=0;constructor(t,e,s){super(t,e,Q.shearX+"|"+s,Q.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case K.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case K.first:o.shearX+=(o.data.shearX-o.shearX)*a,o.shearY+=(o.data.shearY-o.shearY)*a}return}let h=0,c=0,d=tt.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case K.setup:o.shearX=o.data.shearX+h*a,o.shearY=o.data.shearY+c*a;break;case K.first:case K.replace:o.shearX+=(o.data.shearX+h-o.shearX)*a,o.shearY+=(o.data.shearY+c-o.shearY)*a;break;case K.add:o.shearX+=h*a,o.shearY+=c*a}}}class ut extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,a,n,o.shearX,o.data.shearX))}}class mt extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,a,n,o.shearY,o.data.shearY))}}class ft extends tt{boneIndex=0;constructor(t,e){super(t,[Q.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;if(r==Z.mixOut)return void(n==K.setup&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?n!=K.setup&&n!=K.first||(o.inherit=o.data.inherit):o.inherit=this.frames[tt.search(l,s,2)+1]}}class pt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s,Q.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,a,n){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case K.setup:return void h.setFromColor(t);case K.first:h.add((t.r-h.r)*a,(t.g-h.g)*a,(t.b-h.b)*a,(t.a-h.a)*a)}return}let c=0,d=0,u=0,m=0,f=tt.search(l,s,5),p=this.curves[f/5];switch(p){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+36-2),m=this.getBezierValue(s,f,4,p+54-2)}1==a?h.set(c,d,u,m):(n==K.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*a,(d-h.g)*a,(u-h.b)*a,(m-h.a)*a))}}class gt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,a){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case K.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case K.first:h.r+=(t.r-h.r)*a,h.g+=(t.g-h.g)*a,h.b+=(t.b-h.b)*a}return}let c=0,d=0,u=0,m=tt.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==a)h.r=c,h.g=d,h.b=u;else{if(n==K.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*a,h.g+=(d-h.g)*a,h.b+=(u-h.b)*a}}}class xt extends st{slotIndex=0;constructor(t,e,s){super(t,e,Q.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(n){case K.setup:return void(l.a=t.a);case K.first:l.a+=(t.a-l.a)*a}return}let h=this.getCurveValue(s);1==a?l.a=h:(n==K.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*a)}}class wt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s,Q.alpha+"|"+s,Q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,a,n,r,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n,this.frames[t+5]=r,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case K.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case K.first:h.add((t.r-h.r)*a,(t.g-h.g)*a,(t.b-h.b)*a,(t.a-h.a)*a),c.r+=(e.r-c.r)*a,c.g+=(e.g-c.g)*a,c.b+=(e.b-c.b)*a}return}let d=0,u=0,m=0,f=0,p=0,g=0,x=0,w=tt.search(l,s,8),b=this.curves[w>>3];switch(b){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],x=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,m+=(l[w+8+3]-m)*e,f+=(l[w+8+4]-f)*e,p+=(l[w+8+5]-p)*e,g+=(l[w+8+6]-g)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,b-2),u=this.getBezierValue(s,w,2,b+18-2),m=this.getBezierValue(s,w,3,b+36-2),f=this.getBezierValue(s,w,4,b+54-2),p=this.getBezierValue(s,w,5,b+72-2),g=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==a)h.set(d,u,m,f),c.r=p,c.g=g,c.b=x;else{if(n==K.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*a,(u-h.g)*a,(m-h.b)*a,(f-h.a)*a),c.r+=(p-c.r)*a,c.g+=(g-c.g)*a,c.b+=(x-c.b)*a}}}class bt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s,Q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,a,n,r,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n,this.frames[t+5]=r,this.frames[t+6]=o}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case K.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case K.first:h.r+=(t.r-h.r)*a,h.g+=(t.g-h.g)*a,h.b+=(t.b-h.b)*a,c.r+=(e.r-c.r)*a,c.g+=(e.g-c.g)*a,c.b+=(e.b-c.b)*a}return}let d=0,u=0,m=0,f=0,p=0,g=0,x=tt.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],p=l[x+5],g=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,p+=(l[x+7+5]-p)*e,g+=(l[x+7+6]-g)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],p=l[x+5],g=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+36-2),f=this.getBezierValue(s,x,4,w+54-2),p=this.getBezierValue(s,x,5,w+72-2),g=this.getBezierValue(s,x,6,w+90-2)}if(1==a)h.r=d,h.g=u,h.b=m,c.r=f,c.g=p,c.b=g;else{if(n==K.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*a,h.g+=(u-h.g)*a,h.b+=(m-h.b)*a,c.r+=(f-c.r)*a,c.g+=(p-c.g)*a,c.b+=(g-c.b)*a}}}class yt extends tt{slotIndex=0;attachmentNames;constructor(t,e){super(t,[Q.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];o.bone.active&&(r!=Z.mixOut?s<this.frames[0]?n!=K.setup&&n!=K.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[tt.search1(this.frames,s)]):n==K.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class kt extends et{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[Q.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,a,n,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*n+o),f=.03*l-.06*r,p=.006*(3*(n-o)-i+h),g=.018*(r-l+.33333333),x=2*m+p,w=2*f+g,b=.3*(n-i)+m+.16666667*p,y=.3*r+f+.16666667*g,k=i+b,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=p,w+=g,k+=b,v+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let a=this.frames[e];return s[i+1]*(t-a)/(s[i]-a)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=t){let e=s[i-2],a=s[i-1];return a+(t-e)/(s[i]-e)*(s[i+1]-a)}let n=s[a-2],r=s[a-1];return r+(1-r)*(t-n)/(this.frames[e+this.getFrameEntries()]-n)}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof $)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(n=K.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(n){case K.setup:return void(h.length=0);case K.first:if(1==a)return void(h.length=0);h.length=d;let t=l;if(t.bones){a=1-a;for(m=0;m<d;m++)h[m]*=a}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*a}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==a)if(n==K.add){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else O.arrayCopy(t,0,h,0,d);else switch(n){case K.setup:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*a;else{let s=e.vertices;for(let e=0;e<d;e++){let i=s[e];h[e]=i+(t[e]-i)*a}}break}case K.first:case K.replace:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*a;break;case K.add:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*a;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*a}}return}let f=tt.search1(u,s),p=this.getCurvePercent(s,f),g=c[f],x=c[f+1];if(1==a)if(n==K.add){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=e+(x[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=s+(x[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=g[t];h[t]=e+(x[t]-e)*p}else switch(n){case K.setup:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]=(e+(x[t]-e)*p)*a}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t],i=e[t];h[t]=i+(s+(x[t]-s)*p-i)*a}}break}case K.first:case K.replace:for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(x[t]-e)*p-h[t])*a}break;case K.add:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(x[t]-e)*p)*a}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=(s+(x[t]-s)*p-e[t])*a}}}}}class vt extends tt{static propertyIds=[""+Q.event];events;constructor(t){super(t,vt.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,a,n,r){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,a,n,r),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=tt.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)i.push(this.events[h])}}class St extends tt{static propertyIds=[""+Q.drawOrder];drawOrders;constructor(t){super(t,St.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,a,n,r){if(r==Z.mixOut)return void(n==K.setup&&O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(n!=K.setup&&n!=K.first||O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=tt.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,i=l.length;t<i;t++)e[t]=s[l[t]]}else O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class At extends et{constraintIndex=0;constructor(t,e,s){super(t,e,[Q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,a,n,r){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n?1:0,this.frames[t+5]=r?1:0}apply(t,e,s,i,a,n,r){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case K.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case K.first:o.mix+=(o.data.mix-o.mix)*a,o.softness+=(o.data.softness-o.softness)*a,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=tt.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}n==K.setup?(o.mix=o.data.mix+(h-o.data.mix)*a,o.softness=o.data.softness+(c-o.data.softness)*a,r==Z.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*a,o.softness+=(c-o.softness)*a,r==Z.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class It extends et{constraintIndex=0;constructor(t,e,s){super(t,e,[Q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,a,n,r,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=a,l[t+4]=n,l[t+5]=r,l[t+6]=o}apply(t,e,s,i,a,n,r){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(n){case K.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case K.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*a,o.mixX+=(t.mixX-o.mixX)*a,o.mixY+=(t.mixY-o.mixY)*a,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*a,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*a,o.mixShearY+=(t.mixShearY-o.mixShearY)*a}return}let p=tt.search(f,s,7),g=this.curves[p/7];switch(g){case 0:let t=f[p];l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];let e=(s-t)/(f[p+7]-t);l+=(f[p+7+1]-l)*e,h+=(f[p+7+2]-h)*e,c+=(f[p+7+3]-c)*e,d+=(f[p+7+4]-d)*e,u+=(f[p+7+5]-u)*e,m+=(f[p+7+6]-m)*e;break;case 1:l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),h=this.getBezierValue(s,p,2,g+18-2),c=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),u=this.getBezierValue(s,p,5,g+72-2),m=this.getBezierValue(s,p,6,g+90-2)}if(n==K.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*a,o.mixX=t.mixX+(h-t.mixX)*a,o.mixY=t.mixY+(c-t.mixY)*a,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*a,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*a,o.mixShearY=t.mixShearY+(m-t.mixShearY)*a}else o.mixRotate+=(l-o.mixRotate)*a,o.mixX+=(h-o.mixX)*a,o.mixY+=(c-o.mixY)*a,o.mixScaleX+=(d-o.mixScaleX)*a,o.mixScaleY+=(u-o.mixScaleY)*a,o.mixShearY+=(m-o.mixShearY)*a}}class Mt extends st{constraintIndex=0;constructor(t,e,s){super(t,e,Q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,a,n,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,a,n,o.position,o.data.position))}}class Ct extends st{constraintIndex=0;constructor(t,e,s){super(t,e,Q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,a,n,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,a,n,o.spacing,o.data.spacing))}}class Ft extends et{constraintIndex=0;constructor(t,e,s){super(t,e,[Q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,a){let n=this.frames;n[t<<=2]=e,n[t+1]=s,n[t+2]=i,n[t+3]=a}apply(t,e,s,i,a,n,r){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(n){case K.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case K.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*a,o.mixX+=(o.data.mixX-o.mixX)*a,o.mixY+=(o.data.mixY-o.mixY)*a}return}let u=tt.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(n==K.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*a,o.mixX=t.mixX+(h-t.mixX)*a,o.mixY=t.mixY+(c-t.mixY)*a}else o.mixRotate+=(l-o.mixRotate)*a,o.mixX+=(h-o.mixX)*a,o.mixY+=(c-o.mixY)*a}}class Tt extends st{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,a,n,r){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,a,n,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,a,n,this.get(o),this.setup(o)))}}class Et extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class Yt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class _t extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Xt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class Rt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class Bt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class Pt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class Vt extends tt{static propertyIds=[Q.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,Vt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,a,n,r){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],a,n,r),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[tt.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class Dt extends tt{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[Q.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,a){let n=this.frames;n[t*=Dt.ENTRIES]=e,n[t+Dt.MODE]=s|i<<4,n[t+Dt.DELAY]=a}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof $&&l.timelineAttachment==h))return;let c=this.frames;if(s<c[0])return void(n!=K.setup&&n!=K.first||(o.sequenceIndex=-1));let d=tt.search(c,s,Dt.ENTRIES),u=c[d],m=c[d+Dt.MODE],f=c[d+Dt.DELAY];if(!this.attachment.sequence)return;let p=m>>4,g=this.attachment.sequence.regions.length,x=H[15&m];if(x!=j.hold)switch(p+=(s-u)/f+1e-5|0,x){case j.once:p=Math.min(g-1,p);break;case j.loop:p%=g;break;case j.pingpong:{let t=(g<<1)-2;p=0==t?0:p%t,p>=g&&(p=t-p);break}case j.onceReverse:p=Math.max(g-1-p,0);break;case j.loopReverse:p=g-1-p%g;break;case j.pingpongReverse:{let t=(g<<1)-2;p=0==t?0:(p+g-1)%t,p>=g&&(p=t-p)}}o.sequenceIndex=p}}class Ot{static _emptyAnimation=new J("<empty>",[],0);static emptyAnimation(){return Ot._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Lt(this);propertyIDs=new X;animationsChanged=!1;trackEntryPool=new L((()=>new Nt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let a=t*i.timeScale;if(i.delay>0){if(i.delay-=a,i.delay>0)continue;a=-i.delay,i.delay=0}let n=i.next;if(n){let e=i.trackLast-n.delay;if(e>=0){for(n.delay=0,n.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*n.timeScale,i.trackTime+=a,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=a}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,i=!1;for(let n=0,r=s.length;n<r;n++){let r=s[n];if(!r||r.delay>0)continue;i=!0;let o=0==n?K.first:r.mixBlend,l=r.alpha;r.mixingFrom?l*=this.applyMixingFrom(r,t,o):r.trackTime>=r.trackEnd&&!r.next&&(l=0);let h=l>=r.alphaAttachmentThreshold,c=r.animationLast,d=r.getAnimationTime(),u=d,m=e;r.reverse&&(u=r.animation.duration-u,m=null);let f=r.animation.timelines,p=f.length;if(0==n&&1==l||o==K.add){0==n&&(h=!0);for(let e=0;e<p;e++){O.webkit602BugfixHelper(l,o);var a=f[e];a instanceof yt?this.applyAttachmentTimeline(a,t,u,o,h):a.apply(t,c,u,m,l,o,Z.mixIn)}}else{let e=r.timelineMode,s=r.shortestRotation,i=!s&&r.timelinesRotation.length!=p<<1;i&&(r.timelinesRotation.length=p<<1);for(let a=0;a<p;a++){let n=f[a],d=e[a]==Wt?o:K.setup;!s&&n instanceof at?this.applyRotateTimeline(n,t,u,l,d,r.timelinesRotation,a<<1,i):n instanceof yt?this.applyAttachmentTimeline(n,t,u,o,h):(O.webkit602BugfixHelper(l,o),n.apply(t,c,u,m,l,d,Z.mixIn))}}this.queueEvents(r,d),e.length=0,r.nextAnimationLast=d,r.nextTrackLast=r.trackTime}for(var n=this.unkeyedState+Ht,r=t.slots,o=0,l=t.slots.length;o<l;o++){var h=r[o];if(h.attachmentState==n){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let a=0;0==t.mixDuration?(a=1,s==K.first&&(s=K.setup)):(a=t.mixTime/t.mixDuration,a>1&&(a=1),s!=K.first&&(s=i.mixBlend));let n=a<i.mixAttachmentThreshold,r=a<i.mixDrawOrderThreshold,o=i.animation.timelines,l=o.length,h=i.alpha*t.interruptAlpha,c=h*(1-a),d=i.animationLast,u=i.getAnimationTime(),m=u,f=null;if(i.reverse?m=i.animation.duration-m:a<i.eventThreshold&&(f=this.events),s==K.add)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,Z.mixOut);else{let t=i.timelineMode,a=i.timelineHoldMix,u=i.shortestRotation,p=!u&&i.timelinesRotation.length!=l<<1;p&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let g=0;g<l;g++){let l,x=o[g],w=Z.mixOut,b=0;switch(t[g]){case Wt:if(!r&&x instanceof St)continue;l=s,b=c;break;case zt:l=K.setup,b=c;break;case $t:l=s,b=h;break;case Gt:l=K.setup,b=h;break;default:l=K.setup;let t=a[g];b=h*Math.max(0,1-t.mixTime/t.mixDuration)}i.totalAlpha+=b,!u&&x instanceof at?this.applyRotateTimeline(x,e,m,b,l,i.timelinesRotation,g<<1,p):x instanceof yt?this.applyAttachmentTimeline(x,e,m,l,n&&b>=i.alphaAttachmentThreshold):(O.webkit602BugfixHelper(b,s),r&&x instanceof St&&l==K.setup&&(w=Z.mixIn),x.apply(e,d,m,f,b,l,w))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(t,e,s,i,a){var n=e.slots[t.slotIndex];n.bone.active&&(s<t.frames[0]?i!=K.setup&&i!=K.first||this.setAttachment(e,n,n.data.attachmentName,a):this.setAttachment(e,n,t.attachmentNames[tt.search1(t.frames,s)],a),n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Ht))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Jt)}applyRotateTimeline(t,e,s,i,a,n,r,o){if(o&&(n[r]=0),1==i)return void t.apply(e,0,s,null,1,a,Z.mixIn);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(a){case K.setup:l.rotation=l.data.rotation;default:return;case K.first:h=l.rotation,c=l.data.rotation}else h=a==K.setup?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=n[r];else{let t=0,e=0;o?(t=0,e=u):(t=n[r],e=n[r+1]);let s=t-t%360;d=u+s;let i=u>=0,a=t>=0;Math.abs(e)<=90&&B.signum(e)!=B.signum(u)&&(Math.abs(t-s)>180?(d+=360*B.signum(t),a=i):0!=s?d-=360*B.signum(t):a=i),a!=i&&(d+=360*B.signum(t)),n[r]=d}n[r+1]=u,l.rotation=h+d*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,a=i-s,n=t.trackLast%a,r=this.events,o=0,l=r.length;for(;o<l;o++){let e=r[o];if(e.time<n)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==a)h=!0;else{const e=Math.floor(t.trackTime/a);h=e>0&&e>Math.floor(t.trackLast/a)}else h=e>=i&&t.animationLast<i;for(h&&this.queue.complete(t);o<l;o++){let e=r[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(t);a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let n=this.trackEntry(t,e,s,a);return this.setCurrent(t,n,i),this.queue.drain(),n}addAnimation(t,e,s=!1,i=0){let a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let a=this.expandToIndex(t);if(a)for(;a.next;)a=a.next;let n=this.trackEntry(t,e,s,a);return a?(a.next=n,n.previous=a,i<=0&&(i+=a.getTrackComplete()-n.mixDuration)):(this.setCurrent(t,n,!0),this.queue.drain()),n.delay=i,n}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Ot.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,Ot.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(O.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=t,a.animation=e,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=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.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,e):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=K.replace,a}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==K.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,a=t.timelineMode;a.length=i;let n=t.timelineHoldMix;n.length=0;let r=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)a[t]=r.addAll(s[t].getPropertyIds())?Gt:$t;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(r.addAll(l))if(!e||i instanceof yt||i instanceof St||i instanceof vt||!e.animation.hasTimeline(l))a[o]=zt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){a[o]=jt,n[o]=s;continue t}break}a[o]=Gt}else a[o]=Wt}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class Nt{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=K.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class Lt{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(qt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(qt.interrupt),this.objects.push(t)}end(t){this.objects.push(qt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(qt.dispose),this.objects.push(t)}complete(t){this.objects.push(qt.complete),this.objects.push(t)}event(t,e){this.objects.push(qt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],a=t[s+1];switch(i){case qt.start:a.listener&&a.listener.start&&a.listener.start(a);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(a)}break;case qt.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(a)}break;case qt.end:a.listener&&a.listener.end&&a.listener.end(a);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(a)}case qt.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(a)}this.animState.trackEntryPool.free(a);break;case qt.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(a)}break;case qt.event:let i=t[2+s++];a.listener&&a.listener.event&&a.listener.event(a,i);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(a,i)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var qt;!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"}(qt||(qt={}));class Ut{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const Wt=0,zt=1,$t=2,Gt=3,jt=4,Ht=1,Jt=2;class Kt{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let a=this.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);this.setMixWith(i,a,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}}class Zt extends ${color=new R(1,1,1,1);constructor(t){super(t)}copy(){let t=new Zt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Qt extends ${endSlot=null;color=new R(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Qt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class te{_image;constructor(t){this._image=t}getImage(){return this._image}}var ee,se,ie,ae,ne,re,oe,le,he;!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"}(ee||(ee={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(se||(se={}));class ce{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class de extends te{setFilters(t,e){}setWraps(t,e){}dispose(){}}class ue{pages=new Array;regions=new Array;constructor(t){let e=new me(t),s=new Array(4),i={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=O.enumValue(ee,s[1]),t.magFilter=O.enumValue(ee,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=se.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=se.Repeat)},pma:t=>{t.pma="true"==s[1]}};var a={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let n=e.readLine();for(;n&&0==n.trim().length;)n=e.readLine();for(;n&&0!=n.trim().length&&0!=e.readEntry(s,n);)n=e.readLine();let r=null,o=null,l=null;for(;null!==n;)if(0==n.trim().length)r=null,n=e.readLine();else if(r){let t=new pe(r,n);for(;;){let i=e.readEntry(s,n=e.readLine());if(0==i)break;let r=a[s[0]];if(r)r(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<i;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/r.width,t.v=t.y/r.height,90==t.degrees?(t.u2=(t.x+t.height)/r.width,t.v2=(t.y+t.width)/r.height):(t.u2=(t.x+t.width)/r.width,t.v2=(t.y+t.height)/r.height),this.regions.push(t)}else{for(r=new fe(n.trim());0!=e.readEntry(s,n=e.readLine());){let t=i[s[0]];t&&t(r)}this.pages.push(r)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class me{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,a=s+1;;i++){let s=e.indexOf(",",a);if(-1==s)return t[i]=e.substr(a).trim(),i;if(t[i]=e.substr(a,s-a).trim(),a=s+1,4==i)return 4}}}class fe{name;minFilter=ee.Nearest;magFilter=ee.Nearest;uWrap=se.ClampToEdge;vWrap=se.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class pe extends ce{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class ge extends ${region=null;path;regionUVs=[];uvs=[];triangles=[];color=new R(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new R(0,0,0,0);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=O.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,n=0,r=0;if(this.region instanceof pe){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/c,n=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*n,e[o+1]=a+(1-t[o])*r;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,a-=o.offsetY/c,n=o.originalWidth/h,r=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*n,e[o+1]=a+(1-t[o+1])*r;return;case 270:i-=o.offsetY/h,a-=o.offsetX/c,n=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*n,e[o+1]=a+t[o]*r;return}i-=o.offsetX/h,a-=(o.originalHeight-o.offsetY-o.height)/c,n=o.originalWidth/h,r=o.originalHeight/c}else this.region?(n=this.region.u2-i,r=this.region.v2-a):(i=a=0,n=r=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*n,e[o+1]=a+t[o+1]*r}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new ge(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),O.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),O.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),O.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),O.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,a,n){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,a,n)}newLinkedMesh(){let t=new ge(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}}class xe extends ${lengths=[];closed=!1;constantSpeed=!1;color=new R(1,1,1,1);constructor(t){super(t)}copy(){let t=new xe(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),O.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class we extends ${x=0;y=0;rotation=0;color=new R(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*B.degRad,s=Math.cos(e),i=Math.sin(e),a=s*t.a+i*t.b,n=s*t.c+i*t.d;return B.atan2Deg(n,a)}copy(){let t=new we(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class be extends z{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new R(1,1,1,1);path;region=null;sequence=null;offset=O.newFloatArray(8);uvs=O.newFloatArray(8);tempColor=new R(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,n=-this.height/2*this.scaleY+this.region.offsetY*i,r=a+this.region.width*s,o=n+this.region.height*i,l=this.rotation*B.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=a*h+d,f=a*c,p=n*h+u,g=n*c,x=r*h+d,w=r*c,b=o*h+u,y=o*c,k=this.offset;k[0]=m-g,k[1]=p+f,k[2]=m-y,k[3]=b+f,k[4]=x-y,k[5]=b+w,k[6]=x-g,k[7]=p+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){null!=this.sequence&&this.sequence.apply(t,this);let a=t.bone,n=this.offset,r=a.worldX,o=a.worldY,l=a.a,h=a.b,c=a.c,d=a.d,u=0,m=0;u=n[0],m=n[1],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=n[2],m=n[3],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=n[4],m=n[5],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=n[6],m=n[7],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o}copy(){let t=new be(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,O.arrayCopy(this.uvs,0,t.uvs,0,8),O.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class ye{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let a=0,n=i.length;a<n;a++){let n=s.getPath(e,a),r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (sequence: "+t+")");i[a]=r}}newRegionAttachment(t,e,s,i){let a=new be(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");a.region=t}return a}newMeshAttachment(t,e,s,i){let a=new ge(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");a.region=t}return a}newBoundingBoxAttachment(t,e){return new Zt(e)}newPathAttachment(t,e){return new xe(e)}newPointAttachment(t,e){return new we(e)}newClippingAttachment(t,e){return new Qt(e)}}class ke{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=ie.Normal;skinRequired=!1;color=new R;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}!function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(ie||(ie={}));class ve{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=ie.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,a,n,r){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=n,this.ashearY=r;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+n)*B.degRad,d=(s+90+r)*B.degRad;return this.a=Math.cos(c)*i*l,this.b=Math.cos(d)*a*l,this.c=Math.sin(c)*i*h,this.d=Math.sin(d)*a*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case ie.Normal:{const t=(s+n)*B.degRad,e=(s+90+r)*B.degRad,o=Math.cos(t)*i,u=Math.cos(e)*a,m=Math.sin(t)*i,f=Math.sin(e)*a;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case ie.OnlyTranslation:{const t=(s+n)*B.degRad,e=(s+90+r)*B.degRad;this.a=Math.cos(t)*i,this.b=Math.cos(e)*a,this.c=Math.sin(t)*i,this.d=Math.sin(e)*a;break}case ie.NoRotationOrReflection:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,c*=e;let o=l*l+c*c,u=0;o>1e-4?(o=Math.abs(l*d*e-h*t*c)/o,h=c*o,d=l*o,u=Math.atan2(c,l)*B.radDeg):(l=0,c=0,u=90-Math.atan2(d,h)*B.radDeg);const m=(s+n-u)*B.degRad,f=(s+r-u+90)*B.degRad,p=Math.cos(m)*i,g=Math.cos(f)*a,x=Math.sin(m)*i,w=Math.sin(f)*a;this.a=l*p-h*x,this.b=l*g-h*w,this.c=c*p+d*x,this.d=c*g+d*w;break}case ie.NoScale:case ie.NoScaleOrReflection:{s*=B.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),this.inherit==ie.NoScale&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,p=Math.sin(s)*m;n*=B.degRad,r=(90+r)*B.degRad;const g=Math.cos(n)*i,x=Math.cos(r)*a,w=Math.sin(n)*i,b=Math.sin(r)*a;this.a=o*g+f*w,this.b=o*x+f*b,this.c=u*g+p*w,this.d=u*x+p*b;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.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)*B.radDeg);let e,s,i,a,n=t.a,r=t.b,o=t.c,l=t.d,h=1/(n*l-r*o),c=l*h,d=r*h,u=o*h,m=n*h,f=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=f*c-p*d,this.ay=p*m-f*u,this.inherit==ie.OnlyTranslation)e=this.a,s=this.b,i=this.c,a=this.d;else{switch(this.inherit){case ie.NoRotationOrReflection:{let t=Math.abs(n*l-r*o)/(n*n+o*o);r=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=n*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(n*l-r*o),c=l*h,d=r*h;break}case ie.NoScale:case ie.NoScaleOrReflection:let t=B.cosDeg(this.rotation),e=B.sinDeg(this.rotation);n=(n*t+r*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(n*n+o*o);s>1e-5&&(s=1/s),n*=s,o*=s,s=Math.sqrt(n*n+o*o),this.inherit==ie.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let i=B.PI/2+Math.atan2(o,n);r=Math.cos(i)*s,l=Math.sin(i)*s,h=1/(n*l-r*o),c=l*h,d=r*h,u=o*h,m=n*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,i=m*this.c-u*this.a,a=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+i*i),this.ascaleX>1e-4){let t=e*a-s*i;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+i*a,t)*B.radDeg,this.arotation=Math.atan2(i,e)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+a*a),this.ashearY=0,this.arotation=90-Math.atan2(a,s)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,a=this.b;this.a=s*i-e*this.c,this.b=s*a-e*this.d,this.c=e*i+s*this.c,this.d=e*a+s*this.d}}class Se{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class Ae{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Ie){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let a=t.lastIndexOf("/"),n=a>=0?t.substring(0,a+1):"";t=this.start(t),this.downloader.downloadText(t,(a=>{try{let r=new ue(a),o=r.pages.length,l=!1;for(let a of r.pages)this.loadTexture(i?i[a.name]:n+a.name,((s,i)=>{l||(a.setTexture(i),0==--o&&this.success(e,t,r))}),((e,i)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}}class Ie{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),a=0;a<s;a++)i[a]=e.charCodeAt(a);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let a=()=>{this.finish(t,i.status,i.responseText)};i.onload=a,i.onerror=a,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let a=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):a()},i.onerror=a,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let a=200==e||0==e?[s]:[e,s];for(let t=a.length-1,e=i.length;t<e;t+=2)i[t].apply(null,a)}}class Me{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class Ce{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Fe{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,i,a,n,r){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case ie.OnlyTranslation:m=(e-t.worldX)*B.signum(t.skeleton.scaleX),f=(s-t.worldY)*B.signum(t.skeleton.scaleY);break;case ie.NoRotationOrReflection:let i=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),a=l/t.skeleton.scaleX,n=c/t.skeleton.scaleY;h=-n*i*t.skeleton.scaleX,d=a*i*t.skeleton.scaleY,u+=Math.atan2(n,a)*B.radDeg;default:let r=e-o.worldX,p=s-o.worldY,g=l*d-h*c;Math.abs(g)<=1e-4?(m=0,f=0):(m=(r*d-p*h)/g-t.ax,f=(p*l-r*c)/g-t.ay)}u+=Math.atan2(f,m)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=t.ascaleX,g=t.ascaleY;if(i||a){switch(t.inherit){case ie.NoScale:case ie.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=m*m+f*f;if(i&&t<o*o||a&&t>o*o){const e=(Math.sqrt(t)/o-1)*r+1;p*=e,n&&(g*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*r,p,g,t.ashearX,t.ashearY)}apply2(t,e,s,i,a,n,r,o,l){if(t.inherit!=ie.Normal||e.inherit!=ie.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,p=e.ascaleX,g=0,x=0,w=0;d<0?(d=-d,g=180,w=-1):(g=0,w=1),u<0&&(u=-u,w=-w),p<0?(p=-p,x=180):x=0;let b=e.ax,y=0,k=0,v=0,S=t.a,A=t.b,I=t.c,M=t.d,C=Math.abs(d-u)<=1e-4;!C||n?(y=0,k=S*b+t.worldX,v=I*b+t.worldY):(y=e.ay,k=S*b+A*y+t.worldX,v=I*b+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,A=F.b,I=F.c,M=F.d;let T=S*M-A*I,E=k-F.worldX,Y=v-F.worldY;T=Math.abs(T)<=1e-4?0:1/T;let _,X,R=(E*M-Y*A)*T-h,P=(Y*S-E*I)*T-c,V=Math.sqrt(R*R+P*P),D=e.data.length*p;if(V<1e-4)return this.apply1(t,s,i,!1,n,!1,l),void e.updateWorldTransformWith(b,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-F.worldX,Y=i-F.worldY;let O=(E*M-Y*A)*T-h,N=(Y*S-E*I)*T-c,L=O*O+N*N;if(0!=o){o*=d*(p+1)*.5;let t=Math.sqrt(L),e=t-V-D*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(C){D*=d;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,X=Math.PI*a):t>1?(t=1,X=0,n&&(S=(Math.sqrt(L)/(V+D)-1)*l+1,m*=S,r&&(f*=S))):X=Math.acos(t)*a,S=V+D*t,A=D*Math.sin(X),_=Math.atan2(N*S-O*A,O*S+N*A)}else{S=d*D,A=u*D;let t=S*S,e=A*A,s=Math.atan2(N,O);I=e*V*V+t*L-t*e;let i=-2*e*V,n=e-t;if(M=i*i-4*n*I,M>=0){let t=Math.sqrt(M);i<0&&(t=-t),t=.5*-(i+t);let e=t/n,r=I/t,o=Math.abs(e)<Math.abs(r)?e:r;if(e=L-o*o,e>=0){Y=Math.sqrt(e)*a,_=s-Math.atan2(Y,o),X=Math.atan2(Y/u,(o-V)/d);break t}}let r=B.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,p=0;I=-S*V/(t-e),I>=-1&&I<=1&&(I=Math.acos(I),E=S*Math.cos(I)+V,Y=A*Math.sin(I),M=E*E+Y*Y,M<l&&(r=I,l=M,o=E,h=Y),M>f&&(c=I,f=M,m=E,p=Y)),L<=.5*(l+f)?(_=s-Math.atan2(h*a,o),X=r*a):(_=s-Math.atan2(p*a,m),X=c*a)}let q=Math.atan2(y,b)*w,U=t.arotation;_=(_-q)*B.radDeg+g-U,_>180?_-=360:_<-180&&(_+=360),t.updateWorldTransformWith(h,c,U+_*l,m,f,0,0),U=e.arotation,X=((X+q)*B.radDeg-e.ashearX)*w+x-U,X>180?X-=360:X<-180&&(X+=360),e.updateWorldTransformWith(b,y,U+X*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Te extends Se{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}}class Ee extends Se{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=ae.Fixed;spacingMode=ne.Fixed;rotateMode=re.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ae||(ae={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(ne||(ne={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(re||(re={}));class Ye{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof xe))return;let s=this.mixRotate,i=this.mixX,a=this.mixY;if(0==s&&0==i&&0==a)return;let n=this.data,r=n.rotateMode==re.Tangent,o=n.rotateMode==re.ChainScale,l=this.bones,h=l.length,c=r?h:h+1,d=O.setArraySize(this.spaces,c),u=o?this.lengths=O.setArraySize(this.lengths,h):[],m=this.spacing;switch(n.spacingMode){case ne.Percent:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,i=s*e.a,a=s*e.c;u[t]=Math.sqrt(i*i+a*a)}O.arrayFill(d,1,c,m);break;case ne.Proportional:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],i=s.data.length;if(i<Ye.epsilon)o&&(u[e]=0),d[++e]=m;else{let a=i*s.a,n=i*s.c,r=Math.sqrt(a*a+n*n);o&&(u[e]=r),d[++e]=r,t+=r}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=n.spacingMode==ne.Length;for(let t=0,s=c-1;t<s;){let s=l[t],i=s.data.length;if(i<Ye.epsilon)o&&(u[t]=0),d[++t]=m;else{let a=i*s.a,n=i*s.c,r=Math.sqrt(a*a+n*n);o&&(u[t]=r),d[++t]=(e?i+m:m)*r/i}}}let f=this.computeWorldPositions(e,c,r),p=f[0],g=f[1],x=n.offsetRotation,w=!1;if(0==x)w=n.rotateMode==re.Chain;else{w=!1;let t=this.target.bone;x*=t.a*t.d-t.b*t.c>0?B.degRad:-B.degRad}for(let t=0,e=3;t<h;t++,e+=3){let n=l[t];n.worldX+=(p-n.worldX)*i,n.worldY+=(g-n.worldY)*a;let h=f[e],c=f[e+1],m=h-p,b=c-g;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+b*b)/e-1)*s+1;n.a*=t,n.c*=t}}if(p=h,g=c,s>0){let i=n.a,a=n.b,o=n.c,l=n.d,h=0,c=0,u=0;if(h=r?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(b,m),h-=Math.atan2(o,i),w){c=Math.cos(h),u=Math.sin(h);let t=n.data.length;p+=(t*(c*i-u*o)-m)*s,g+=(t*(u*i+c*o)-b)*s}else h+=x;h>B.PI?h-=B.PI2:h<-B.PI&&(h+=B.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),n.a=c*i-u*o,n.b=c*a-u*l,n.c=u*i+c*o,n.d=u*a+c*l}n.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,a=this.position,n=this.spaces,r=O.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=Ye.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(this.data.positionMode==ae.Percent&&(a*=f),this.data.spacingMode){case ne.Percent:m=f;break;case ne.Proportional:m=f/e;break;default:m=1}o=O.setArraySize(this.world,8);for(let p=0,g=0,x=0;p<e;p++,g+=3){let e=n[p]*m;a+=e;let w=a;if(l)w%=f,w<0&&(w+=f),x=0;else{if(w<0){d!=Ye.BEFORE&&(d=Ye.BEFORE,t.computeWorldVertices(i,2,4,o,0,2)),this.addBeforePosition(w,o,0,r,g);continue}if(w>f){d!=Ye.AFTER&&(d=Ye.AFTER,t.computeWorldVertices(i,h-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,r,g);continue}}for(;;x++){let t=u[x];if(!(w>t)){if(0==x)w/=t;else{let e=u[x-1];w=(w-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(i,h-4,4,o,0,2),t.computeWorldVertices(i,0,4,o,4,2)):t.computeWorldVertices(i,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],r,g,s||p>0&&0==e)}return r}l?(h+=2,o=O.setArraySize(this.world,h),t.computeWorldVertices(i,2,h-4,o,0,2),t.computeWorldVertices(i,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=O.setArraySize(this.world,h),t.computeWorldVertices(i,2,h,o,0,2));let u,m=O.setArraySize(this.curves,c),f=0,p=o[0],g=o[1],x=0,w=0,b=0,y=0,k=0,v=0,S=0,A=0,I=0,M=0,C=0,F=0,T=0,E=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],w=o[e+1],b=o[e+2],y=o[e+3],k=o[e+4],v=o[e+5],S=.1875*(p-2*x+b),A=.1875*(g-2*w+y),I=.09375*(3*(x-b)-p+k),M=.09375*(3*(w-y)-g+v),C=2*S+I,F=2*A+M,T=.75*(x-p)+S+.16666667*I,E=.75*(w-g)+A+.16666667*M,f+=Math.sqrt(T*T+E*E),T+=C,E+=F,C+=I,F+=M,f+=Math.sqrt(T*T+E*E),T+=C,E+=F,f+=Math.sqrt(T*T+E*E),T+=C+I,E+=F+M,f+=Math.sqrt(T*T+E*E),m[t]=f,p=k,g=v;switch(this.data.positionMode==ae.Percent&&(a*=f),this.data.spacingMode){case ne.Percent:u=f;break;case ne.Proportional:u=f/e;break;default:u=1}let Y=this.segments,_=0;for(let t=0,i=0,c=0,X=0;t<e;t++,i+=3){let e=n[t]*u;a+=e;let R=a;if(l)R%=f,R<0&&(R+=f),c=0;else{if(R<0){this.addBeforePosition(R,o,0,r,i);continue}if(R>f){this.addAfterPosition(R-f,o,h-4,r,i);continue}}for(;;c++){let t=m[c];if(!(R>t)){if(0==c)R/=t;else{let e=m[c-1];R=(R-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],g=o[t+1],x=o[t+2],w=o[t+3],b=o[t+4],y=o[t+5],k=o[t+6],v=o[t+7],S=.03*(p-2*x+b),A=.03*(g-2*w+y),I=.006*(3*(x-b)-p+k),M=.006*(3*(w-y)-g+v),C=2*S+I,F=2*A+M,T=.3*(x-p)+S+.16666667*I,E=.3*(w-g)+A+.16666667*M,_=Math.sqrt(T*T+E*E),Y[0]=_,t=1;t<8;t++)T+=C,E+=F,C+=I,F+=M,_+=Math.sqrt(T*T+E*E),Y[t]=_;T+=C,E+=F,_+=Math.sqrt(T*T+E*E),Y[8]=_,T+=C+I,E+=F+M,_+=Math.sqrt(T*T+E*E),Y[9]=_,X=0}for(R*=_;;X++){let t=Y[X];if(!(R>t)){if(0==X)R/=t;else{let e=Y[X-1];R=X+(R-e)/(t-e)}break}}this.addCurvePosition(.1*R,p,g,x,w,b,y,k,v,r,i,s||t>0&&0==e)}return r}addBeforePosition(t,e,s,i,a){let n=e[s],r=e[s+1],o=e[s+2]-n,l=e[s+3]-r,h=Math.atan2(l,o);i[a]=n+t*Math.cos(h),i[a+1]=r+t*Math.sin(h),i[a+2]=h}addAfterPosition(t,e,s,i,a){let n=e[s+2],r=e[s+3],o=n-e[s],l=r-e[s+1],h=Math.atan2(l,o);i[a]=n+t*Math.cos(h),i[a+1]=r+t*Math.sin(h),i[a+2]=h}addCurvePosition(t,e,s,i,a,n,r,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(a-s,i-e));let u=t*t,m=u*t,f=1-t,p=f*f,g=p*f,x=f*t,w=3*x,b=f*w,y=w*t,k=e*g+i*b+n*y+o*m,v=s*g+a*b+r*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(a-s,i-e):Math.atan2(v-(s*p+a*x*2+r*u),k-(e*p+i*x*2+n*u)))}}class _e{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,n=this.data.scaleX>0,r=this.bone,o=r.data.length;switch(t){case oe.none:return;case oe.reset:this.reset();case oe.update:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=r.worldX,c=r.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,p=-1,g=this.data.limit*l,x=g*Math.abs(t.scaleY);if(g*=Math.abs(t.scaleX),s||i){if(s){const t=(this.ux-h)*u;this.xOffset+=t>g?g:t<-g?-g:t,this.ux=h}if(i){const t=(this.uy-c)*u;this.yOffset+=t>x?x:t<-x?-x:t,this.uy=c}if(d>=m){p=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,a=this.wind*f,n=(Be.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(a-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=p),i&&(this.yVelocity-=(n+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=p),d-=m}while(d>=m)}s&&(r.worldX+=this.xOffset*e*this.data.x),i&&(r.worldY+=this.yOffset*e*this.data.y)}if(a||n){let t=Math.atan2(r.c,r.a),s=0,i=0,l=0,h=this.cx-r.worldX,c=this.cy-r.worldY;if(h>g?h=g:h<-g&&(h=-g),c>x?c=x:c<-x&&(c=-x),a){l=(this.data.rotate+this.data.shearX)*e;let a=Math.atan2(c+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(a-Math.ceil(a*B.invPI2-.5)*B.PI2)*u,a=this.rotateOffset*l+t,s=Math.cos(a),i=Math.sin(a),n&&(a=o*r.getWorldScaleX(),a>0&&(this.scaleOffset+=(h*s+c*i)*u/a))}else{s=Math.cos(t),i=Math.sin(t);const e=o*r.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+c*i)*u/e)}if(d=this.remaining,d>=m){-1==p&&(p=Math.pow(this.damping,60*m));const e=this.massInverse*m,r=this.strength,h=this.wind,c=Be.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(d-=m,n&&(this.scaleVelocity+=(h*s-c*i-this.scaleOffset*r)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=p),a){if(this.rotateVelocity-=((h*i+c*s)*u+this.rotateOffset*r)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=p,d<m)break;const a=this.rotateOffset*l+t;s=Math.cos(a),i=Math.sin(a)}else if(d<m)break}}this.remaining=d}this.cx=r.worldX,this.cy=r.worldY;break;case oe.pose:s&&(r.worldX+=this.xOffset*e*this.data.x),i&&(r.worldY+=this.yOffset*e*this.data.y)}if(a){let t=this.rotateOffset*e,s=0,i=0,a=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),i=Math.cos(e),a=r.b,r.b=i*a-s*r.d,r.d=s*a+i*r.d),e+=t*this.data.shearX,s=Math.sin(e),i=Math.cos(e),a=r.a,r.a=i*a-s*r.c,r.c=s*a+i*r.c}else t*=this.data.rotate,s=Math.sin(t),i=Math.cos(t),a=r.a,r.a=i*a-s*r.c,r.c=s*a+i*r.c,a=r.b,r.b=i*a-s*r.d,r.d=s*a+i*r.d}if(n){const t=1+this.scaleOffset*e*this.data.scaleX;r.a*=t,r.c*=t}t!=oe.pose&&(this.tx=o*r.a,this.ty=o*r.c),r.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*B.degRad,a=Math.cos(i),n=Math.sin(i),r=this.cx-t,o=this.cy-e;this.translate(r*a-o*n-r,r*n+o*a-o)}}class Xe{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new R,this.darkColor=t.darkColor?new R:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof $&&this.attachment instanceof $&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class Re{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new q;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,i=g.c,a=g.d,n=Math.atan2(c,l)-Math.atan2(i,e)+m;n>B.PI?n-=B.PI2:n<-B.PI&&(n+=B.PI2),n*=t;let r=Math.cos(n),o=Math.sin(n);g.a=r*e-o*i,g.b=r*s-o*a,g.c=o*e+r*i,g.d=o*s+r*a}if(r){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(t.x-g.worldX)*e,g.worldY+=(t.y-g.worldY)*s}if(0!=i){let t=Math.sqrt(g.a*g.a+g.c*g.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*i)/t),g.a*=t,g.c*=t}if(0!=a){let t=Math.sqrt(g.b*g.b+g.d*g.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*a)/t),g.b*=t,g.d*=t}if(n>0){let t=g.b,e=g.d,s=Math.atan2(e,t),i=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(g.c,g.a));i>B.PI?i-=B.PI2:i<-B.PI&&(i+=B.PI2),i=s+(i+f)*n;let a=Math.sqrt(t*t+e*e);g.b=Math.cos(i)*a,g.d=Math.sin(i)*a}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,i=g.c,a=g.d,n=Math.atan2(c,l)+m;n>B.PI?n-=B.PI2:n<-B.PI&&(n+=B.PI2),n*=t;let r=Math.cos(n),o=Math.sin(n);g.a=r*e-o*i,g.b=r*s-o*a,g.c=o*e+r*i,g.d=o*s+r*a}if(r){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=t.x*e,g.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=t,g.c*=t}if(0!=a){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*a+1;g.b*=t,g.d*=t}if(n>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>B.PI?t-=B.PI2:t<-B.PI&&(t+=B.PI2);let e=g.b,s=g.d;t=Math.atan2(s,e)+(t-B.PI/2+f)*n;let i=Math.sqrt(e*e+s*s);g.b=Math.cos(t)*i,g.d=Math.sin(t)*i}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(r.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(r.ax-d+this.data.offsetX)*e,u+=(r.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(r.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=a&&0!=f&&(f=(f+(r.ascaleY-f+this.data.offsetScaleY)*a)/f);let p=h.ashearY;0!=n&&(p+=(r.ashearY-p+this.data.offsetShearY)*n),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(r.arotation+this.data.offsetRotation)*t,d=h.ax+(r.ax+this.data.offsetX)*e,u=h.ay+(r.ay+this.data.offsetY)*s,m=h.ascaleX*((r.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((r.ascaleY-1+this.data.offsetScaleY)*a+1),p=h.ashearY+(r.ashearY+this.data.offsetShearY)*n;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}}class Be{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Be.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new ve(i,this,t),t.children.push(s)}else s=new ve(i,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],a=new Xe(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Fe(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Re(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Ye(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new _e(s,this))}this.color=new R(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,a=this.physicsConstraints,n=e.length,r=s.length,o=i.length,l=this.physicsConstraints.length,h=n+r+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<n;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<r;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=a[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let a=e.getAttachment();a instanceof xe&&this.sortPathConstraintAttachmentWith(a,i);let n=t.bones,r=n.length;for(let t=0;t<r;t++)this.sortBone(n[t]);this._updateCache.push(t);for(let t=0;t<r;t++)this.sortReset(n[t].children);for(let t=0;t<r;t++)n[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof xe))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&O.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=e.a,a=e.b,n=e.c,r=e.d;s.worldX=i*this.x+a*this.y+e.worldX,s.worldY=n*this.x+r*this.y+e.worldY;const o=(s.rotation+s.shearX)*B.degRad,l=(s.rotation+90+s.shearY)*B.degRad,h=Math.cos(o)*s.scaleX,c=Math.cos(l)*s.scaleY,d=Math.sin(o)*s.scaleX,u=Math.sin(l)*s.scaleY;s.a=(i*h+a*d)*this.scaleX,s.b=(i*c+a*u)*this.scaleX,s.c=(n*h+r*d)*this.scaleY,s.d=(n*c+r*u)*this.scaleY;let m=this._updateCache;for(let e=0,i=m.length;e<i;e++){let i=m[e];i!=s&&i.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;O.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s],a=i.data.attachmentName;if(a){let e=t.getAttachment(s,a);e&&i.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let a=s[i];if(a.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void a.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find((e=>e.data.name==t))??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find((e=>e.data.name==t))??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find((e=>e.data.name==t))??null}findPhysicsConstraint(t){if(null==t)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find((e=>e.data.name==t))??null}getBoundsRect(){let t=new q,e=new q;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let a=this.drawOrder,n=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=a.length;t<e;t++){let e=a[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof be)h=8,c=O.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Be.quadTriangles;else if(u instanceof ge){let t=u;h=t.worldVerticesLength,c=O.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Qt&&null!=i){i.clipStart(e,u);continue}if(c&&d){null!=i&&i.isClipping()&&(i.clipTriangles(c,d,d.length),c=i.clippedVertices,h=i.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];n=Math.min(n,e),r=Math.min(r,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(n,r),e.set(o-n,l-r)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,a=s.length;i<a;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let a=0,n=i.length;a<n;a++)i[a].rotate(t,e,s)}}!function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"}(oe||(oe={}));class Pe extends Se{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}}class Ve{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}}class De{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class Oe{name;attachments=new Array;bones=Array();constraints=new Array;color=new R(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof ge?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new De(e,i,a))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new De(t,i,a))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let a=t.slots[i],n=a.getAttachment();if(n&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(n==t[e]){let t=this.getAttachment(s,e);t&&a.setAttachment(t);break}}}s++}}}class Ne{index=0;name;boneData;color=new R(1,1,1,1);darkColor=null;attachmentName=null;blendMode=le.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(le||(le={}));class Le extends Se{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}}class qe{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ve;s.name="";let i=new Ue(t),a=i.readInt32(),n=i.readInt32();s.hash=0==n&&0==a?null:n.toString(16)+a.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let r=i.readBoolean();r&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let o=0;o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("String in string table must not be null.");i.strings.push(t)}o=i.readInt(!0);for(let t=0;t<o;t++){let a=i.readString();if(!a)throw new Error("Bone name must not be null.");let n=0==t?null:s.bones[i.readInt(!0)],o=new ke(t,a,n);o.rotation=i.readFloat(),o.x=i.readFloat()*e,o.y=i.readFloat()*e,o.scaleX=i.readFloat(),o.scaleY=i.readFloat(),o.shearX=i.readFloat(),o.shearY=i.readFloat(),o.length=i.readFloat()*e,o.inherit=i.readByte(),o.skinRequired=i.readBoolean(),r&&(R.rgba8888ToColor(o.color,i.readInt32()),o.icon=i.readString()??void 0,o.visible=i.readBoolean()),s.bones.push(o)}o=i.readInt(!0);for(let t=0;t<o;t++){let e=i.readString();if(!e)throw new Error("Slot name must not be null.");let a=s.bones[i.readInt(!0)],n=new Ne(t,e,a);R.rgba8888ToColor(n.color,i.readInt32());let o=i.readInt32();-1!=o&&R.rgb888ToColor(n.darkColor=new R,o),n.attachmentName=i.readStringRef(),n.blendMode=i.readInt(!0),r&&(n.visible=i.readBoolean()),s.slots.push(n)}o=i.readInt(!0);for(let t,a=0;a<o;a++){let a=i.readString();if(!a)throw new Error("IK constraint data name must not be null.");let n=new Te(a);n.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[i.readInt(!0)]);n.target=s.bones[i.readInt(!0)];let r=i.readByte();n.skinRequired=!!(1&r),n.bendDirection=2&r?1:-1,n.compress=!!(4&r),n.stretch=!!(8&r),n.uniform=!!(16&r),32&r&&(n.mix=64&r?i.readFloat():1),128&r&&(n.softness=i.readFloat()*e),s.ikConstraints.push(n)}o=i.readInt(!0);for(let t,a=0;a<o;a++){let a=i.readString();if(!a)throw new Error("Transform constraint data name must not be null.");let n=new Le(a);n.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[i.readInt(!0)]);n.target=s.bones[i.readInt(!0)];let r=i.readByte();n.skinRequired=!!(1&r),n.local=!!(2&r),n.relative=!!(4&r),8&r&&(n.offsetRotation=i.readFloat()),16&r&&(n.offsetX=i.readFloat()*e),32&r&&(n.offsetY=i.readFloat()*e),64&r&&(n.offsetScaleX=i.readFloat()),128&r&&(n.offsetScaleY=i.readFloat()),r=i.readByte(),1&r&&(n.offsetShearY=i.readFloat()),2&r&&(n.mixRotate=i.readFloat()),4&r&&(n.mixX=i.readFloat()),8&r&&(n.mixY=i.readFloat()),16&r&&(n.mixScaleX=i.readFloat()),32&r&&(n.mixScaleY=i.readFloat()),64&r&&(n.mixShearY=i.readFloat()),s.transformConstraints.push(n)}o=i.readInt(!0);for(let t,a=0;a<o;a++){let a=i.readString();if(!a)throw new Error("Path constraint data name must not be null.");let n=new Ee(a);n.order=i.readInt(!0),n.skinRequired=i.readBoolean(),t=i.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[i.readInt(!0)]);n.target=s.slots[i.readInt(!0)];const r=i.readByte();n.positionMode=1&r,n.spacingMode=r>>1&3,n.rotateMode=r>>3&3,128&r&&(n.offsetRotation=i.readFloat()),n.position=i.readFloat(),n.positionMode==ae.Fixed&&(n.position*=e),n.spacing=i.readFloat(),n.spacingMode!=ne.Length&&n.spacingMode!=ne.Fixed||(n.spacing*=e),n.mixRotate=i.readFloat(),n.mixX=i.readFloat(),n.mixY=i.readFloat(),s.pathConstraints.push(n)}o=i.readInt(!0);for(let t=0;t<o;t++){const t=i.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const a=new Pe(t);a.order=i.readInt(!0),a.bone=s.bones[i.readInt(!0)];let n=i.readByte();a.skinRequired=!!(1&n),2&n&&(a.x=i.readFloat()),4&n&&(a.y=i.readFloat()),8&n&&(a.rotate=i.readFloat()),16&n&&(a.scaleX=i.readFloat()),32&n&&(a.shearX=i.readFloat()),a.limit=(64&n?i.readFloat():5e3)*e,a.step=1/i.readUnsignedByte(),a.inertia=i.readFloat(),a.strength=i.readFloat(),a.damping=i.readFloat(),a.massInverse=128&n?i.readFloat():1,a.wind=i.readFloat(),a.gravity=i.readFloat(),n=i.readByte(),1&n&&(a.inertiaGlobal=!0),2&n&&(a.strengthGlobal=!0),4&n&&(a.dampingGlobal=!0),8&n&&(a.massGlobal=!0),16&n&&(a.windGlobal=!0),32&n&&(a.gravityGlobal=!0),64&n&&(a.mixGlobal=!0),a.mix=128&n?i.readFloat():1,s.physicsConstraints.push(a)}let l=this.readSkin(i,s,!0,r);l&&(s.defaultSkin=l,s.skins.push(l));{let t=s.skins.length;for(O.setArraySize(s.skins,o=t+i.readInt(!0));t<o;t++){let e=this.readSkin(i,s,!1,r);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}o=this.linkedMeshes.length;for(let t=0;t<o;t++){let e=this.linkedMeshes[t];const i=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let a=i.getAttachment(e.slotIndex,e.parent);if(!a)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?a:e.mesh,e.mesh.setParentMesh(a),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ce(t);e.intValue=i.readInt(!1),e.floatValue=i.readFloat(),e.stringValue=i.readString(),e.audioPath=i.readString(),e.audioPath&&(e.volume=i.readFloat(),e.balance=i.readFloat()),s.events.push(e)}o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,t,s))}return s}readSkin(t,e,s,i){let a=null,n=0;if(s){if(n=t.readInt(!0),0==n)return null;a=new Oe("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");a=new Oe(s),i&&R.rgba8888ToColor(a.color,t.readInt32()),a.bones.length=t.readInt(!0);for(let s=0,i=a.bones.length;s<i;s++)a.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.physicsConstraints[t.readInt(!0)]);n=t.readInt(!0)}for(let s=0;s<n;s++){let s=t.readInt(!0);for(let n=0,r=t.readInt(!0);n<r;n++){let n=t.readStringRef();if(!n)throw new Error("Attachment name must not be null");let r=this.readAttachment(t,e,a,s,n,i);r&&a.setAttachment(s,n,r)}}return a}readAttachment(t,e,s,i,a,n){let r=this.scale,o=t.readByte();const l=8&o?t.readStringRef():a;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case he.Region:{let e=16&o?t.readStringRef():null;const i=32&o?t.readInt32():4294967295,a=64&o?this.readSequence(t):null;let n=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=l);let p=this.attachmentLoader.newRegionAttachment(s,l,e,a);return p?(p.path=e,p.x=h*r,p.y=c*r,p.scaleX=d,p.scaleY=u,p.rotation=n,p.width=m*r,p.height=f*r,R.rgba8888ToColor(p.color,i),p.sequence=a,null==a&&p.updateRegion(),p):null}case he.BoundingBox:{let e=this.readVertices(t,!!(16&o)),i=n?t.readInt32():0,a=this.attachmentLoader.newBoundingBoxAttachment(s,l);return a?(a.worldVerticesLength=e.length,a.vertices=e.vertices,a.bones=e.bones,n&&R.rgba8888ToColor(a.color,i),a):null}case he.Mesh:{let e=16&o?t.readStringRef():l;const i=32&o?t.readInt32():4294967295,a=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let m=[],f=0,p=0;n&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),p=t.readFloat()),e||(e=l);let g=this.attachmentLoader.newMeshAttachment(s,l,e,a);return g?(g.path=e,R.rgba8888ToColor(g.color,i),g.bones=c.bones,g.vertices=c.vertices,g.worldVerticesLength=c.length,g.triangles=u,g.regionUVs=d,null==a&&g.updateRegion(),g.hullLength=h<<1,g.sequence=a,n&&(g.edges=m,g.width=f*r,g.height=p*r),g):null}case he.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const a=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let m=0,f=0;n&&(m=t.readFloat(),f=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,e,h);return p?(p.path=e,R.rgba8888ToColor(p.color,a),p.sequence=h,n&&(p.width=m*r,p.height=f*r),this.linkedMeshes.push(new We(p,d,i,u,c)),p):null}case he.Path:{const e=!!(16&o),i=!!(32&o),a=this.readVertices(t,!!(64&o)),h=O.newArray(a.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*r;const c=n?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=i,d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,d.lengths=h,n&&R.rgba8888ToColor(d.color,c),d):null}case he.Point:{const e=t.readFloat(),i=t.readFloat(),a=t.readFloat(),o=n?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=i*r,h.y=a*r,h.rotation=e,n&&R.rgba8888ToColor(h.color,o),h):null}case he.Clipping:{const i=t.readInt(!0),a=this.readVertices(t,!!(16&o));let r=n?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[i],h.worldVerticesLength=a.length,h.vertices=a.vertices,h.bones=a.bones,n&&R.rgba8888ToColor(h.color,r),h):null}}return null}readSequence(t){let e=new G(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),a=new ze;if(a.length=i<<1,!e)return a.vertices=this.readFloatArray(t,a.length,s),a;let n=new Array,r=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);r.push(e);for(let i=0;i<e;i++)r.push(t.readInt(!0)),n.push(t.readFloat()*s),n.push(t.readFloat()*s),n.push(t.readFloat())}return a.vertices=O.toFloatArray(n),a.bones=r,a}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let a=0;a<e;a++)i[a]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,a=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,a=t.readInt(!0);s<a;s++){let s=t.readByte(),a=t.readInt(!0),n=a-1;switch(s){case rs:{let s=new yt(a,e);for(let e=0;e<a;e++)s.setFrame(e,t.readFloat(),t.readStringRef());i.push(s);break}case os:{let s=t.readInt(!0),r=new pt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,u,1),je(t,r,s++,e,3,o,i,d,m,1)}o=i,l=a,h=n,c=u,d=m}i.push(r);break}case ls:{let s=t.readInt(!0),r=new gt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,d,1)}o=i,l=a,h=n,c=d}i.push(r);break}case hs:{let s=t.readInt(!0),r=new wt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d,u,m,f),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,p,1),je(t,r,s++,e,3,o,i,d,g,1),je(t,r,s++,e,4,o,i,u,x,1),je(t,r,s++,e,5,o,i,m,w,1),je(t,r,s++,e,6,o,i,f,b,1)}o=i,l=a,h=n,c=p,d=g,u=x,m=w,f=b}i.push(r);break}case cs:{let s=t.readInt(!0),r=new bt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d,u,m),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,f,1),je(t,r,s++,e,3,o,i,d,p,1),je(t,r,s++,e,4,o,i,u,g,1),je(t,r,s++,e,5,o,i,m,x,1)}o=i,l=a,h=n,c=f,d=p,u=g,m=x}i.push(r);break}case ds:{let s=new xt(a,t.readInt(!0),e),r=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,i=0;s.setFrame(e,r,o),e!=n;e++){let a=t.readFloat(),n=t.readUnsignedByte()/255;switch(t.readByte()){case Is:s.setStepped(e);break;case Ms:je(t,s,i++,e,0,r,a,o,n,1)}r=a,o=n}i.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0);if(s==ns){let s=new ft(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readByte());i.push(s);continue}let r=t.readInt(!0);switch(s){case He:i.push($e(t,new at(n,r,e),1));break;case Je:i.push(Ge(t,new nt(n,r,e),a));break;case Ke:i.push($e(t,new rt(n,r,e),a));break;case Ze:i.push($e(t,new ot(n,r,e),a));break;case Qe:i.push(Ge(t,new lt(n,r,e),1));break;case ts:i.push($e(t,new ht(n,r,e),1));break;case es:i.push($e(t,new ct(n,r,e),1));break;case ss:i.push(Ge(t,new dt(n,r,e),1));break;case is:i.push($e(t,new ut(n,r,e),1));break;case as:i.push($e(t,new mt(n,r,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new At(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*a:0;for(let e=0,s=0;r.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=n;e++){o=t.readByte();const i=t.readFloat(),n=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*a:0;64&o?r.setStepped(e):128&o&&(je(t,r,s++,e,0,l,i,h,n,1),je(t,r,s++,e,1,l,i,c,d,a)),l=i,h=n,c=d}i.push(r)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),a=s-1,n=new It(s,t.readInt(!0),e),r=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;n.setFrame(e,r,o,l,h,c,d,u),e!=a;e++){let i=t.readFloat(),a=t.readFloat(),m=t.readFloat(),f=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Is:n.setStepped(e);break;case Ms:je(t,n,s++,e,0,r,i,o,a,1),je(t,n,s++,e,1,r,i,l,m,1),je(t,n,s++,e,2,r,i,h,f,1),je(t,n,s++,e,3,r,i,c,p,1),je(t,n,s++,e,4,r,i,d,g,1),je(t,n,s++,e,5,r,i,u,x,1)}r=i,o=a,l=m,h=f,c=p,d=g,u=x}i.push(n)}for(let e=0,n=t.readInt(!0);e<n;e++){let e=t.readInt(!0),n=s.pathConstraints[e];for(let s=0,r=t.readInt(!0);s<r;s++){const s=t.readByte(),r=t.readInt(!0),o=t.readInt(!0);switch(s){case fs:i.push($e(t,new Mt(r,o,e),n.positionMode==ae.Fixed?a:1));break;case ps:i.push($e(t,new Ct(r,o,e),n.spacingMode==ne.Length||n.spacingMode==ne.Fixed?a:1));break;case gs:let s=new Ft(r,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,i=0,a=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=a;e++){let a=t.readFloat(),n=t.readFloat(),r=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Is:s.setStepped(e);break;case Ms:je(t,s,i++,e,0,l,a,h,n,1),je(t,s,i++,e,1,l,a,c,r,1),je(t,s,i++,e,2,l,a,d,o,1)}l=a,h=n,c=r,d=o}i.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0);if(s==As){const s=new Vt(a,e);for(let e=0;e<a;e++)s.setFrame(e,t.readFloat());i.push(s);continue}const n=t.readInt(!0);switch(s){case xs:i.push($e(t,new Et(a,n,e),1));break;case ws:i.push($e(t,new Yt(a,n,e),1));break;case bs:i.push($e(t,new _t(a,n,e),1));break;case ys:i.push($e(t,new Xt(a,n,e),1));break;case ks:i.push($e(t,new Rt(a,n,e),1));break;case vs:i.push($e(t,new Bt(a,n,e),1));break;case Ss:i.push($e(t,new Pt(a,n,e),1))}}}for(let e=0,n=t.readInt(!0);e<n;e++){let e=s.skins[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readInt(!0);for(let n=0,r=t.readInt(!0);n<r;n++){let n=t.readStringRef();if(!n)throw new Error("attachmentName must not be null.");let r=e.getAttachment(s,n),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case us:{let e=r,n=e.bones,o=e.vertices,c=n?o.length/3*2:o.length,d=t.readInt(!0),u=new kt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let i,r=t.readInt(!0);if(0==r)i=n?O.newFloatArray(c):o;else{i=O.newFloatArray(c);let e=t.readInt(!0);if(r+=e,1==a)for(let s=e;s<r;s++)i[s]=t.readFloat();else for(let s=e;s<r;s++)i[s]=t.readFloat()*a;if(!n)for(let t=0,e=i.length;t<e;t++)i[t]+=o[t]}if(u.setFrame(e,m,i),e==h)break;let l=t.readFloat();switch(t.readByte()){case Is:u.setStepped(e);break;case Ms:je(t,u,s++,e,0,m,l,0,1,1)}m=l}i.push(u);break}case ms:{let e=new Dt(l,s,r);for(let s=0;s<l;s++){let i=t.readFloat(),a=t.readInt32();e.setFrame(s,i,H[15&a],a>>4,t.readFloat())}i.push(e);break}}}}}let n=t.readInt(!0);if(n>0){let e=new St(n),a=s.slots.length;for(let s=0;s<n;s++){let i=t.readFloat(),n=t.readInt(!0),r=O.newArray(a,0);for(let t=a-1;t>=0;t--)r[t]=-1;let o=O.newArray(a-n,0),l=0,h=0;for(let e=0;e<n;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;r[l+t.readInt(!0)]=l++}for(;l<a;)o[h++]=l++;for(let t=a-1;t>=0;t--)-1==r[t]&&(r[t]=o[--h]);e.setFrame(s,i,r)}i.push(e)}let r=t.readInt(!0);if(r>0){let e=new vt(r);for(let i=0;i<r;i++){let a=t.readFloat(),n=s.events[t.readInt(!0)],r=new Me(a,n);r.intValue=t.readInt(!1),r.floatValue=t.readFloat(),r.stringValue=t.readString(),null==r.stringValue&&(r.stringValue=n.stringValue),r.data.audioPath&&(r.volume=t.readFloat(),r.balance=t.readFloat()),e.setFrame(i,r)}i.push(e)}let o=0;for(let t=0,e=i.length;t<e;t++)o=Math.max(o,i[t].getDuration());return new J(e,i,o)}}class Ue{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class We{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,a){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}}class ze{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function $e(t,e,s){let i=t.readFloat(),a=t.readFloat()*s;for(let n=0,r=0,o=e.getFrameCount()-1;e.setFrame(n,i,a),n!=o;n++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Is:e.setStepped(n);break;case Ms:je(t,e,r++,n,0,i,o,a,l,s)}i=o,a=l}return e}function Ge(t,e,s){let i=t.readFloat(),a=t.readFloat()*s,n=t.readFloat()*s;for(let r=0,o=0,l=e.getFrameCount()-1;e.setFrame(r,i,a,n),r!=l;r++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Is:e.setStepped(r);break;case Ms:je(t,e,o++,r,0,i,l,a,h,s),je(t,e,o++,r,1,i,l,n,c,s)}i=l,a=h,n=c}return e}function je(t,e,s,i,a,n,r,o,l,h){e.setBezier(s,i,a,n,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,r,l)}!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(he||(he={}));const He=0,Je=1,Ke=2,Ze=3,Qe=4,ts=5,es=6,ss=7,is=8,as=9,ns=10,rs=0,os=1,ls=2,hs=3,cs=4,ds=5,us=0,ms=1,fs=0,ps=1,gs=2,xs=0,ws=1,bs=2,ys=4,ks=5,vs=6,Ss=7,As=8,Is=1,Ms=2;class Cs{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new L((()=>O.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,n=t.slots,r=n.length;s.length=0,a.freeAll(i),i.length=0;for(let t=0;t<r;t++){let e=n[t];if(!e.bone.active)continue;let r=e.getAttachment();if(r instanceof Zt){let t=r;s.push(t);let n=a.obtain();n.length!=t.worldVerticesLength&&(n=O.newFloatArray(t.worldVerticesLength)),i.push(n),t.computeWorldVertices(e,0,t.worldVerticesLength,n,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=this.polygons;for(let n=0,r=a.length;n<r;n++){let r=a[n],o=r;for(let a=0,n=r.length;a<n;a+=2){let n=o[a],r=o[a+1];t=Math.min(t,n),e=Math.min(e,r),s=Math.max(s,n),i=Math.max(i,r)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let a=this.minX,n=this.minY,r=this.maxX,o=this.maxY;if(t<=a&&s<=a||e<=n&&i<=n||t>=r&&s>=r||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(a-t)+e;if(h>n&&h<o)return!0;if(h=l*(r-t)+e,h>n&&h<o)return!0;let c=(n-e)/l+t;return c>a&&c<r||(c=(o-e)/l+t,c>a&&c<r)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,a=t.length,n=a-2,r=!1;for(let t=0;t<a;t+=2){let a=i[t+1],o=i[n+1];if(a<s&&o>=s||o<s&&a>=s){let l=i[t];l+(s-a)/(o-a)*(i[n]-l)<e&&(r=!r)}n=t}return r}intersectsSegment(t,e,s,i){let a=this.polygons;for(let n=0,r=a.length;n<r;n++)if(this.intersectsSegmentPolygon(a[n],t,e,s,i))return this.boundingBoxes[n];return null}intersectsSegmentPolygon(t,e,s,i,a){let n=t,r=t.length,o=e-i,l=s-a,h=e*a-s*i,c=n[r-2],d=n[r-1];for(let t=0;t<r;t+=2){let r=n[t],u=n[t+1],m=c*u-d*r,f=c-r,p=d-u,g=o*p-l*f,x=(h*f-o*m)/g;if((x>=c&&x<=r||x>=r&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let t=(h*p-l*m)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=a||t>=a&&t<=s))return!0}c=r,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}class Fs{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new L((()=>new Array));polygonIndicesPool=new L((()=>new Array));triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let a=this.isConcaveArray;a.length=0;for(let t=0,n=s;t<n;++t)a[t]=Fs.isConcave(t,s,e,i);let n=this.triangles;for(n.length=0;s>3;){let t=s-1,r=0,o=1;for(;;){t:if(!a[r]){let n=i[t]<<1,l=i[r]<<1,h=i[o]<<1,c=e[n],d=e[n+1],u=e[l],m=e[l+1],f=e[h],p=e[h+1];for(let n=(o+1)%s;n!=t;n=(n+1)%s){if(!a[n])continue;let t=i[n]<<1,s=e[t],r=e[t+1];if(Fs.positiveArea(f,p,c,d,s,r)&&Fs.positiveArea(c,d,u,m,s,r)&&Fs.positiveArea(u,m,f,p,s,r))break t}break}if(0==o){do{if(!a[r])break;r--}while(r>0);break}t=r,r=o,o=(o+1)%s}n.push(i[(s+r-1)%s]),n.push(i[r]),n.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let l=(s+r-1)%s,h=r==s?0:r;a[l]=Fs.isConcave(l,s,e,i),a[h]=Fs.isConcave(h,s,e,i)}return 3==s&&(n.push(i[2]),n.push(i[0]),n.push(i[1])),n}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let n=this.polygonIndicesPool.obtain();n.length=0;let r=this.polygonPool.obtain();r.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],m=s[h+1],f=s[c],p=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=r.length-4,e=Fs.winding(r[t],r[t+1],r[t+2],r[t+3],g,x),s=Fs.winding(g,x,r[0],r[1],r[2],r[3]);e==l&&s==l&&(r.push(g),r.push(x),n.push(d),w=!0)}w||(r.length>0?(i.push(r),a.push(n)):(this.polygonPool.free(r),this.polygonIndicesPool.free(n)),r=this.polygonPool.obtain(),r.length=0,r.push(u),r.push(m),r.push(f),r.push(p),r.push(g),r.push(x),n=this.polygonIndicesPool.obtain(),n.length=0,n.push(h),n.push(c),n.push(d),l=Fs.winding(u,m,f,p,g,x),o=h)}r.length>0&&(i.push(r),a.push(n));for(let t=0,e=i.length;t<e;t++){if(n=a[t],0==n.length)continue;let s=n[0],o=n[n.length-1];r=i[t];let l=r.length-4,h=r[l],c=r[l+1],d=r[l+2],u=r[l+3],m=r[0],f=r[1],p=r[2],g=r[3],x=Fs.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=a[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],k=i[l],v=k[k.length-2],S=k[k.length-1];if(w!=s||b!=o)continue;let A=Fs.winding(h,c,d,u,v,S),I=Fs.winding(v,S,m,f,p,g);A==x&&I==x&&(k.length=0,e.length=0,r.push(v),r.push(S),n.push(y),h=d,c=u,d=v,u=S,l=0)}}for(let t=i.length-1;t>=0;t--)r=i[t],0==r.length&&(i.splice(t,1),this.polygonPool.free(r),n=a[t],a.splice(t,1),this.polygonIndicesPool.free(n));return i}static isConcave(t,e,s,i){let a=i[(e+t-1)%e]<<1,n=i[t]<<1,r=i[(t+1)%e]<<1;return!this.positiveArea(s[a],s[a+1],s[n],s[n+1],s[r],s[r+1])}static positiveArea(t,e,s,i,a,n){return t*(n-i)+s*(e-n)+a*(i-e)>=0}static winding(t,e,s,i,a,n){let r=s-t,o=i-e;return a*o-n*r+r*e-t*o>=0?1:-1}}class Ts{triangulator=new Fs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=O.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let a=this.clippingPolygon;Ts.makeClockwise(a);let n=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let t=0,e=n.length;t<e;t++){let e=n[t];Ts.makeClockwise(e),e.push(e[0]),e.push(e[1])}return n.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,i,a,n,r,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=i,c=a,d=n,u=r,m=o):(l=e,h=s,c=i,d=a,u=n,m=r),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,a=this.clippedVertices,n=this.clippedTriangles,r=this.clippingPolygons,o=r.length,l=0;a.length=0,n.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],p=t[s+1];for(let t=0;t<o;t++){let e=a.length;if(!this.clip(c,d,u,m,f,p,r[t],i)){let t=O.setArraySize(a,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=p,e=n.length;let s=O.setArraySize(n,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,r=this.clipOutput,o=O.setArraySize(a,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=r[s],i=r[s+1];o[e]=t,o[e+1]=i}e=n.length;let h=O.setArraySize(n,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,i,a,n,r){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=r?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,p=t[s],g=t[s+1],x=i[s],w=i[s+1];s=e[f+1]<<1;let b=t[s],y=t[s+1],k=i[s],v=i[s+1];s=e[f+2]<<1;let S=t[s],A=t[s+1],I=i[s],M=i[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(p,g,b,y,S,A,c[t],o)){let t=O.setArraySize(l,e+3*u);t[e]=p,t[e+1]=g,t[e+2]=a.r,t[e+3]=a.g,t[e+4]=a.b,t[e+5]=a.a,r?(t[e+6]=x,t[e+7]=w,t[e+8]=n.r,t[e+9]=n.g,t[e+10]=n.b,t[e+11]=n.a,t[e+12]=b,t[e+13]=y,t[e+14]=a.r,t[e+15]=a.g,t[e+16]=a.b,t[e+17]=a.a,t[e+18]=k,t[e+19]=v,t[e+20]=n.r,t[e+21]=n.g,t[e+22]=n.b,t[e+23]=n.a,t[e+24]=S,t[e+25]=A,t[e+26]=a.r,t[e+27]=a.g,t[e+28]=a.b,t[e+29]=a.a,t[e+30]=I,t[e+31]=M,t[e+32]=n.r,t[e+33]=n.g,t[e+34]=n.b,t[e+35]=n.a):(t[e+6]=x,t[e+7]=w,t[e+8]=b,t[e+9]=y,t[e+10]=a.r,t[e+11]=a.g,t[e+12]=a.b,t[e+13]=a.a,t[e+14]=k,t[e+15]=v,t[e+16]=S,t[e+17]=A,t[e+18]=a.r,t[e+19]=a.g,t[e+20]=a.b,t[e+21]=a.a,t[e+22]=I,t[e+23]=M),e=h.length;let s=O.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=y-A,i=S-b,c=p-S,d=A-g,f=1/(s*c+i*(g-A)),C=t>>1,F=this.clipOutput,T=O.setArraySize(l,e+C*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];T[e]=t,T[e+1]=l,T[e+2]=a.r,T[e+3]=a.g,T[e+4]=a.b,T[e+5]=a.a;let h=t-S,u=l-A,m=(s*h+i*u)*f,p=(d*h+c*u)*f,g=1-m-p;T[e+6]=x*m+k*p+I*g,T[e+7]=w*m+v*p+M*g,r&&(T[e+8]=n.r,T[e+9]=n.g,T[e+10]=n.b,T[e+11]=n.a)}e=h.length;let E=O.setArraySize(h,e+3*(C-2));C--;for(let t=1;t<C;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=C+1}}}}clipTrianglesUnpacked(t,e,s,i){let a=this.clipOutput,n=this.clippedVertices,r=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;n.length=0,r.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=i[s],p=i[s+1];s=e[d+1]<<1;let g=t[s],x=t[s+1],w=i[s],b=i[s+1];s=e[d+2]<<1;let y=t[s],k=t[s+1],v=i[s],S=i[s+1];for(let t=0;t<h;t++){let e=n.length;if(!this.clip(u,m,g,x,y,k,l[t],a)){let t=O.setArraySize(n,e+6);t[e]=u,t[e+1]=m,t[e+2]=g,t[e+3]=x,t[e+4]=y,t[e+5]=k;let s=O.setArraySize(r,e+6);s[e]=f,s[e+1]=p,s[e+2]=w,s[e+3]=b,s[e+4]=v,s[e+5]=S,e=o.length;let i=O.setArraySize(o,e+3);i[e]=c,i[e+1]=c+1,i[e+2]=c+2,c+=3;break}{let t=a.length;if(0==t)continue;let s=x-k,i=y-g,l=u-y,h=k-m,d=1/(s*l+i*(m-k)),A=t>>1,I=this.clipOutput,M=O.setArraySize(n,e+2*A),C=O.setArraySize(r,e+2*A);for(let a=0;a<t;a+=2,e+=2){let t=I[a],n=I[a+1];M[e]=t,M[e+1]=n;let r=t-y,o=n-k,c=(s*r+i*o)*d,u=(h*r+l*o)*d,m=1-c-u;C[e]=f*c+w*u+v*m,C[e+1]=p*c+b*u+S*m}e=o.length;let F=O.setArraySize(o,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=A+1}}}}clip(t,e,s,i,a,n,r,o){let l,h=o,c=!1;r.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(i),l.push(a),l.push(n),l.push(t),l.push(e),o.length=0;let d=r.length-4,u=r;for(let t=0;;t+=2){let e=u[t],s=u[t+1],i=e-u[t+2],a=s-u[t+3],n=o.length,r=l;for(let t=0,n=l.length-2;t<n;){let n=r[t],l=r[t+1];t+=2;let h=r[t],d=r[t+1],u=a*(e-h)>i*(s-d),m=a*(e-n)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-n,e=d-l,s=m/(t*a-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s)}else if(u){let t=h-n,e=d-l,s=m/(t*a-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(n==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],a=0,n=0,r=0,o=0;for(let t=0,l=s-3;t<l;t+=2)a=e[t],n=e[t+1],r=e[t+2],o=e[t+3],i+=a*o-r*n;if(!(i<0))for(let t=0,i=s-2,a=s>>1;t<a;t+=2){let s=e[t],a=e[t+1],n=i-t;e[t]=e[n],e[t+1]=e[n+1],e[n]=s,e[n+1]=a}}}class Es{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ve,i="string"==typeof t?JSON.parse(t):t,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.referenceScale=Bs(a,"referenceScale",100)*e,s.fps=a.fps,s.imagesPath=a.images??null,s.audioPath=a.audio??null),i.bones)for(let t=0;t<i.bones.length;t++){let a=i.bones[t],n=null,r=Bs(a,"parent",null);r&&(n=s.findBone(r));let o=new ke(s.bones.length,a.name,n);o.length=Bs(a,"length",0)*e,o.x=Bs(a,"x",0)*e,o.y=Bs(a,"y",0)*e,o.rotation=Bs(a,"rotation",0),o.scaleX=Bs(a,"scaleX",1),o.scaleY=Bs(a,"scaleY",1),o.shearX=Bs(a,"shearX",0),o.shearY=Bs(a,"shearY",0),o.inherit=O.enumValue(ie,Bs(a,"inherit","Normal")),o.skinRequired=Bs(a,"skin",!1);let l=Bs(a,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(i.slots)for(let t=0;t<i.slots.length;t++){let e=i.slots[t],a=e.name,n=s.findBone(e.bone);if(!n)throw new Error(`Couldn't find bone ${e.bone} for slot ${a}`);let r=new Ne(s.slots.length,a,n),o=Bs(e,"color",null);o&&r.color.setFromString(o);let l=Bs(e,"dark",null);l&&(r.darkColor=R.fromString(l)),r.attachmentName=Bs(e,"attachment",null),r.blendMode=O.enumValue(le,Bs(e,"blend","normal")),r.visible=Bs(e,"visible",!0),s.slots.push(r)}if(i.ik)for(let t=0;t<i.ik.length;t++){let a=i.ik[t],n=new Te(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);for(let t=0;t<a.bones.length;t++){let e=s.findBone(a.bones[t]);if(!e)throw new Error(`Couldn't find bone ${a.bones[t]} for IK constraint ${a.name}.`);n.bones.push(e)}let r=s.findBone(a.target);if(!r)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);n.target=r,n.mix=Bs(a,"mix",1),n.softness=Bs(a,"softness",0)*e,n.bendDirection=Bs(a,"bendPositive",!0)?1:-1,n.compress=Bs(a,"compress",!1),n.stretch=Bs(a,"stretch",!1),n.uniform=Bs(a,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let t=0;t<i.transform.length;t++){let a=i.transform[t],n=new Le(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);for(let t=0;t<a.bones.length;t++){let e=a.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for transform constraint ${a.name}.`);n.bones.push(i)}let r=a.target,o=s.findBone(r);if(!o)throw new Error(`Couldn't find target bone ${r} for transform constraint ${a.name}.`);n.target=o,n.local=Bs(a,"local",!1),n.relative=Bs(a,"relative",!1),n.offsetRotation=Bs(a,"rotation",0),n.offsetX=Bs(a,"x",0)*e,n.offsetY=Bs(a,"y",0)*e,n.offsetScaleX=Bs(a,"scaleX",0),n.offsetScaleY=Bs(a,"scaleY",0),n.offsetShearY=Bs(a,"shearY",0),n.mixRotate=Bs(a,"mixRotate",1),n.mixX=Bs(a,"mixX",1),n.mixY=Bs(a,"mixY",n.mixX),n.mixScaleX=Bs(a,"mixScaleX",1),n.mixScaleY=Bs(a,"mixScaleY",n.mixScaleX),n.mixShearY=Bs(a,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let t=0;t<i.path.length;t++){let a=i.path[t],n=new Ee(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);for(let t=0;t<a.bones.length;t++){let e=a.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for path constraint ${a.name}.`);n.bones.push(i)}let r=a.target,o=s.findSlot(r);if(!o)throw new Error(`Couldn't find target slot ${r} for path constraint ${a.name}.`);n.target=o,n.positionMode=O.enumValue(ae,Bs(a,"positionMode","Percent")),n.spacingMode=O.enumValue(ne,Bs(a,"spacingMode","Length")),n.rotateMode=O.enumValue(re,Bs(a,"rotateMode","Tangent")),n.offsetRotation=Bs(a,"rotation",0),n.position=Bs(a,"position",0),n.positionMode==ae.Fixed&&(n.position*=e),n.spacing=Bs(a,"spacing",0),n.spacingMode!=ne.Length&&n.spacingMode!=ne.Fixed||(n.spacing*=e),n.mixRotate=Bs(a,"mixRotate",1),n.mixX=Bs(a,"mixX",1),n.mixY=Bs(a,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let t=0;t<i.physics.length;t++){const a=i.physics[t],n=new Pe(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);const r=a.bone,o=s.findBone(r);if(null==o)throw new Error("Physics bone not found: "+r);n.bone=o,n.x=Bs(a,"x",0),n.y=Bs(a,"y",0),n.rotate=Bs(a,"rotate",0),n.scaleX=Bs(a,"scaleX",0),n.shearX=Bs(a,"shearX",0),n.limit=Bs(a,"limit",5e3)*e,n.step=1/Bs(a,"fps",60),n.inertia=Bs(a,"inertia",1),n.strength=Bs(a,"strength",100),n.damping=Bs(a,"damping",1),n.massInverse=1/Bs(a,"mass",1),n.wind=Bs(a,"wind",0),n.gravity=Bs(a,"gravity",0),n.mix=Bs(a,"mix",1),n.inertiaGlobal=Bs(a,"inertiaGlobal",!1),n.strengthGlobal=Bs(a,"strengthGlobal",!1),n.dampingGlobal=Bs(a,"dampingGlobal",!1),n.massGlobal=Bs(a,"massGlobal",!1),n.windGlobal=Bs(a,"windGlobal",!1),n.gravityGlobal=Bs(a,"gravityGlobal",!1),n.mixGlobal=Bs(a,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let t=0;t<i.skins.length;t++){let e=i.skins[t],a=new Oe(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],n=s.findBone(i);if(!n)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);a.bones.push(n)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],n=s.findIkConstraint(i);if(!n)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],n=s.findTransformConstraint(i);if(!n)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],n=s.findPathConstraint(i);if(!n)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],n=s.findPhysicsConstraint(i);if(!n)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}for(let t in e.attachments){let i=s.findSlot(t);if(!i)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let n=e.attachments[t];for(let t in n){let e=this.readAttachment(n[t],a,i.index,t,s);e&&a.setAttachment(i.index,t,e)}}s.skins.push(a),"default"==a.name&&(s.defaultSkin=a)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],i=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!i)throw new Error(`Skin not found: ${e.skin}`);let a=i.getAttachment(e.slotIndex,e.parent);if(!a)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?a:e.mesh,e.mesh.setParentMesh(a),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let t in i.events){let e=i.events[t],a=new Ce(t);a.intValue=Bs(e,"int",0),a.floatValue=Bs(e,"float",0),a.stringValue=Bs(e,"string",""),a.audioPath=Bs(e,"audio",null),a.audioPath&&(a.volume=Bs(e,"volume",1),a.balance=Bs(e,"balance",0)),s.events.push(a)}if(i.animations)for(let t in i.animations){let e=i.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,i,a){let n=this.scale;switch(i=Bs(t,"name",i),Bs(t,"type","region")){case"region":{let s=Bs(t,"path",i),a=this.readSequence(Bs(t,"sequence",null)),r=this.attachmentLoader.newRegionAttachment(e,i,s,a);if(!r)return null;r.path=s,r.x=Bs(t,"x",0)*n,r.y=Bs(t,"y",0)*n,r.scaleX=Bs(t,"scaleX",1),r.scaleY=Bs(t,"scaleY",1),r.rotation=Bs(t,"rotation",0),r.width=t.width*n,r.height=t.height*n,r.sequence=a;let o=Bs(t,"color",null);return o&&r.color.setFromString(o),null!=r.region&&r.updateRegion(),r}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let a=Bs(t,"color",null);return a&&s.color.setFromString(a),s}case"mesh":case"linkedmesh":{let a=Bs(t,"path",i),r=this.readSequence(Bs(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,a,r);if(!o)return null;o.path=a;let l=Bs(t,"color",null);l&&o.color.setFromString(l),o.width=Bs(t,"width",0)*n,o.height=Bs(t,"height",0)*n,o.sequence=r;let h=Bs(t,"parent",null);if(h)return this.linkedMeshes.push(new Ys(o,Bs(t,"skin",null),s,h,Bs(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Bs(t,"edges",null),o.hullLength=2*Bs(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=Bs(t,"closed",!1),s.constantSpeed=Bs(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,s,a<<1);let r=O.newArray(a/3,0);for(let e=0;e<t.lengths.length;e++)r[e]=t.lengths[e]*n;s.lengths=r;let o=Bs(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=Bs(t,"x",0)*n,s.y=Bs(t,"y",0)*n,s.rotation=Bs(t,"rotation",0);let a=Bs(t,"color",null);return a&&s.color.setFromString(a),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let n=Bs(t,"end",null);n&&(s.endSlot=a.findSlot(n));let r=t.vertexCount;this.readVertices(t,s,r<<1);let o=Bs(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new G(Bs(t,"count",0));return e.start=Bs(t,"start",1),e.digits=Bs(t,"digits",0),e.setupIndex=Bs(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let a=t.vertices;if(s==a.length){let t=O.toFloatArray(a);if(1!=i)for(let e=0,s=a.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let n=new Array,r=new Array;for(let t=0,e=a.length;t<e;){let e=a[t++];r.push(e);for(let s=t+4*e;t<s;t+=4)r.push(a[t]),n.push(a[t+1]*i),n.push(a[t+2]*i),n.push(a[t+3])}e.bones=r,e.vertices=O.toFloatArray(n)}readAnimation(t,e,s){let i=this.scale,a=new Array;if(t.slots)for(let e in t.slots){let i=t.slots[e],n=s.findSlot(e);if(!n)throw new Error("Slot not found: "+e);let r=n.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new yt(s,r);for(let i=0;i<s;i++){let s=e[i];t.setFrame(i,Bs(s,"time",0),Bs(s,"name",null))}a.push(t)}else if("rgba"==t){let t=new pt(s,s<<2,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.color);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,o.a);let r=e[s+1];if(!r){t.shrink(a);break}let l=Bs(r,"time",0),h=R.fromString(r.color),c=i.curve;c&&(a=Rs(c,t,a,s,0,n,l,o.r,h.r,1),a=Rs(c,t,a,s,1,n,l,o.g,h.g,1),a=Rs(c,t,a,s,2,n,l,o.b,h.b,1),a=Rs(c,t,a,s,3,n,l,o.a,h.a,1)),n=l,o=h,i=r}a.push(t)}else if("rgb"==t){let t=new gt(s,3*s,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.color);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b);let r=e[s+1];if(!r){t.shrink(a);break}let l=Bs(r,"time",0),h=R.fromString(r.color),c=i.curve;c&&(a=Rs(c,t,a,s,0,n,l,o.r,h.r,1),a=Rs(c,t,a,s,1,n,l,o.g,h.g,1),a=Rs(c,t,a,s,2,n,l,o.b,h.b,1)),n=l,o=h,i=r}a.push(t)}else if("alpha"==t)a.push(_s(e,new xt(s,s,r),0,1));else if("rgba2"==t){let t=new wt(s,7*s,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.light),l=R.fromString(i.dark);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let r=e[s+1];if(!r){t.shrink(a);break}let h=Bs(r,"time",0),c=R.fromString(r.light),d=R.fromString(r.dark),u=i.curve;u&&(a=Rs(u,t,a,s,0,n,h,o.r,c.r,1),a=Rs(u,t,a,s,1,n,h,o.g,c.g,1),a=Rs(u,t,a,s,2,n,h,o.b,c.b,1),a=Rs(u,t,a,s,3,n,h,o.a,c.a,1),a=Rs(u,t,a,s,4,n,h,l.r,d.r,1),a=Rs(u,t,a,s,5,n,h,l.g,d.g,1),a=Rs(u,t,a,s,6,n,h,l.b,d.b,1)),n=h,o=c,l=d,i=r}a.push(t)}else if("rgb2"==t){let t=new bt(s,6*s,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.light),l=R.fromString(i.dark);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,l.r,l.g,l.b);let r=e[s+1];if(!r){t.shrink(a);break}let h=Bs(r,"time",0),c=R.fromString(r.light),d=R.fromString(r.dark),u=i.curve;u&&(a=Rs(u,t,a,s,0,n,h,o.r,c.r,1),a=Rs(u,t,a,s,1,n,h,o.g,c.g,1),a=Rs(u,t,a,s,2,n,h,o.b,c.b,1),a=Rs(u,t,a,s,3,n,h,l.r,d.r,1),a=Rs(u,t,a,s,4,n,h,l.g,d.g,1),a=Rs(u,t,a,s,5,n,h,l.b,d.b,1)),n=h,o=c,l=d,i=r}a.push(t)}}}if(t.bones)for(let e in t.bones){let n=t.bones[e],r=s.findBone(e);if(!r)throw new Error("Bone not found: "+e);let o=r.index;for(let t in n){let e=n[t],s=e.length;if(0!=s)if("rotate"===t)a.push(_s(e,new at(s,s,o),0,1));else if("translate"===t){let t=new nt(s,s<<1,o);a.push(Xs(e,t,"x","y",0,i))}else if("translatex"===t){let t=new rt(s,s,o);a.push(_s(e,t,0,i))}else if("translatey"===t){let t=new ot(s,s,o);a.push(_s(e,t,0,i))}else if("scale"===t){let t=new lt(s,s<<1,o);a.push(Xs(e,t,"x","y",1,1))}else if("scalex"===t){let t=new ht(s,s,o);a.push(_s(e,t,1,1))}else if("scaley"===t){let t=new ct(s,s,o);a.push(_s(e,t,1,1))}else if("shear"===t){let t=new dt(s,s<<1,o);a.push(Xs(e,t,"x","y",0,1))}else if("shearx"===t){let t=new ut(s,s,o);a.push(_s(e,t,0,1))}else if("sheary"===t){let t=new mt(s,s,o);a.push(_s(e,t,0,1))}else if("inherit"===t){let t=new ft(s,r.index);for(let s=0;s<e.length;s++){let i=e[s];t.setFrame(s,Bs(i,"time",0),O.enumValue(ie,Bs(i,"inherit","Normal")))}a.push(t)}}}if(t.ik)for(let e in t.ik){let n=t.ik[e],r=n[0];if(!r)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new At(n.length,n.length<<1,l),c=Bs(r,"time",0),d=Bs(r,"mix",1),u=Bs(r,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Bs(r,"bendPositive",!0)?1:-1,Bs(r,"compress",!1),Bs(r,"stretch",!1));let s=n[t+1];if(!s){h.shrink(e);break}let a=Bs(s,"time",0),o=Bs(s,"mix",1),l=Bs(s,"softness",0)*i,m=r.curve;m&&(e=Rs(m,h,e,t,0,c,a,d,o,1),e=Rs(m,h,e,t,1,c,a,u,l,i)),c=a,d=o,u=l,r=s}a.push(h)}if(t.transform)for(let e in t.transform){let i=t.transform[e],n=i[0];if(!n)continue;let r=s.findTransformConstraint(e);if(!r)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(r),l=new It(i.length,6*i.length,o),h=Bs(n,"time",0),c=Bs(n,"mixRotate",1),d=Bs(n,"mixX",1),u=Bs(n,"mixY",d),m=Bs(n,"mixScaleX",1),f=Bs(n,"mixScaleY",m),p=Bs(n,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,p);let s=i[t+1];if(!s){l.shrink(e);break}let a=Bs(s,"time",0),r=Bs(s,"mixRotate",1),o=Bs(s,"mixX",1),g=Bs(s,"mixY",o),x=Bs(s,"mixScaleX",1),w=Bs(s,"mixScaleY",x),b=Bs(s,"mixShearY",1),y=n.curve;y&&(e=Rs(y,l,e,t,0,h,a,c,r,1),e=Rs(y,l,e,t,1,h,a,d,o,1),e=Rs(y,l,e,t,2,h,a,u,g,1),e=Rs(y,l,e,t,3,h,a,m,x,1),e=Rs(y,l,e,t,4,h,a,f,w,1),e=Rs(y,l,e,t,5,h,a,p,b,1)),h=a,c=r,d=o,u=g,m=x,f=w,m=x,n=s}a.push(l)}if(t.path)for(let e in t.path){let n=t.path[e],r=s.findPathConstraint(e);if(!r)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(r);for(let t in n){let e=n[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new Mt(l,l,o);a.push(_s(e,t,0,r.positionMode==ae.Fixed?i:1))}else if("spacing"===t){let t=new Ct(l,l,o);a.push(_s(e,t,0,r.spacingMode==ne.Length||r.spacingMode==ne.Fixed?i:1))}else if("mix"===t){let t=new Ft(l,3*l,o),i=Bs(s,"time",0),n=Bs(s,"mixRotate",1),r=Bs(s,"mixX",1),h=Bs(s,"mixY",r);for(let a=0,o=0;;a++){t.setFrame(a,i,n,r,h);let l=e[a+1];if(!l){t.shrink(o);break}let c=Bs(l,"time",0),d=Bs(l,"mixRotate",1),u=Bs(l,"mixX",1),m=Bs(l,"mixY",u),f=s.curve;f&&(o=Rs(f,t,o,a,0,i,c,n,d,1),o=Rs(f,t,o,a,1,i,c,r,u,1),o=Rs(f,t,o,a,2,i,c,h,m,1)),i=c,n=d,r=u,h=m,s=l}a.push(t)}}}if(t.physics)for(let e in t.physics){let i=t.physics[e],n=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);n=s.physicsConstraints.indexOf(t)}for(let t in i){let e=i[t],s=e[0];if(!s)continue;let r,o=e.length;if("reset"!=t){if("inertia"==t)r=new Et(o,o,n);else if("strength"==t)r=new Yt(o,o,n);else if("damping"==t)r=new _t(o,o,n);else if("mass"==t)r=new Xt(o,o,n);else if("wind"==t)r=new Rt(o,o,n);else if("gravity"==t)r=new Bt(o,o,n);else{if("mix"!=t)continue;r=new Pt(o,o,n)}a.push(_s(e,r,0,1))}else{const t=new Vt(o,n);for(let i=0;null!=s;s=e[i+1],i++)t.setFrame(i,Bs(s,"time",0));a.push(t)}}}if(t.attachments)for(let e in t.attachments){let n=t.attachments[e],r=s.findSkin(e);if(!r)throw new Error("Skin not found: "+e);for(let t in n){let e=n[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],n=r.getAttachment(l,t);for(let t in s){let e=s[t],r=e[0];if(r)if("deform"==t){let t=n.bones,s=n.vertices,o=t?s.length/3*2:s.length,h=new kt(e.length,e.length,l,n),c=Bs(r,"time",0);for(let a=0,n=0;;a++){let l,d=Bs(r,"vertices",null);if(d){l=O.newFloatArray(o);let e=Bs(r,"offset",0);if(O.arrayCopy(d,0,l,e,d.length),1!=i)for(let t=e,s=t+d.length;t<s;t++)l[t]*=i;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?O.newFloatArray(o):s;h.setFrame(a,c,l);let u=e[a+1];if(!u){h.shrink(n);break}let m=Bs(u,"time",0),f=r.curve;f&&(n=Rs(f,h,n,a,0,c,m,0,1,1)),c=m,r=u}a.push(h)}else if("sequence"==t){let t=new Dt(e.length,l,n),s=0;for(let i=0;i<e.length;i++){let a=Bs(r,"delay",s),n=Bs(r,"time",0),o=j[Bs(r,"mode","hold")],l=Bs(r,"index",0);t.setFrame(i,n,o,l,a),s=a,r=e[i+1]}a.push(t)}}}}}if(t.drawOrder){let e=new St(t.drawOrder.length),i=s.slots.length,n=0;for(let a=0;a<t.drawOrder.length;a++,n++){let r=t.drawOrder[a],o=null,l=Bs(r,"offsets",null);if(l){o=O.newArray(i,-1);let t=O.newArray(i-l.length,0),e=0,a=0;for(let i=0;i<l.length;i++){let n=l[i],r=s.findSlot(n.slot);if(!r)throw new Error("Slot not found: "+r);let h=r.index;for(;e!=h;)t[a++]=e++;o[e+n.offset]=e++}for(;e<i;)t[a++]=e++;for(let e=i-1;e>=0;e--)-1==o[e]&&(o[e]=t[--a])}e.setFrame(n,Bs(r,"time",0),o)}a.push(e)}if(t.events){let e=new vt(t.events.length),i=0;for(let a=0;a<t.events.length;a++,i++){let n=t.events[a],r=s.findEvent(n.name);if(!r)throw new Error("Event not found: "+n.name);let o=new Me(O.toSinglePrecision(Bs(n,"time",0)),r);o.intValue=Bs(n,"int",r.intValue),o.floatValue=Bs(n,"float",r.floatValue),o.stringValue=Bs(n,"string",r.stringValue),o.data.audioPath&&(o.volume=Bs(n,"volume",1),o.balance=Bs(n,"balance",0)),e.setFrame(i,o)}a.push(e)}let n=0;for(let t=0,e=a.length;t<e;t++)n=Math.max(n,a[t].getDuration());s.animations.push(new J(e,a,n))}}class Ys{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,a){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}}function _s(t,e,s,i){let a=t[0],n=Bs(a,"time",0),r=Bs(a,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,n,r);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Bs(h,"time",0),d=Bs(h,"value",s)*i;a.curve&&(o=Rs(a.curve,e,o,l,0,n,c,r,d,i)),n=c,r=d,a=h}}function Xs(t,e,s,i,a,n){let r=t[0],o=Bs(r,"time",0),l=Bs(r,s,a)*n,h=Bs(r,i,a)*n,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Bs(u,"time",0),f=Bs(u,s,a)*n,p=Bs(u,i,a)*n,g=r.curve;g&&(c=Rs(g,e,c,d,0,o,m,l,f,n),c=Rs(g,e,c,d,1,o,m,h,p,n)),o=m,l=f,h=p,r=u}}function Rs(t,e,s,i,a,n,r,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=a<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,a,n,o,d,u,m,f,r,l),s+1}function Bs(t,e,s){return void 0!==t[e]?t[e]:s}var Ps;function Vs(t,e,s){const i=new ye(t);return"json"===s?new Es(i).readSkeletonData(e):new qe(i).readSkeletonData(new Uint8Array(e))}async function Ds(e,s,i){let a;const n=e.map(((e,a)=>{const n=s[a];let r=t.Texture2D;return"ktx"===n?r=t.KTX:"ktx2"===n&&(r=t.KTX2),Ls(e,i,r)}));try{a=await Promise.all(n)}catch(t){throw t}return a}async function Os(t,s){const i=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let a,n;try{a=await e(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let r=new ue(a);const o=[];for(let t of r.pages){const e=i+t.name;o.push(Ls(e,s))}try{n=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return r=Ns(a,n),r}function Ns(t,e){const s=new ue(t);return s.pages.forEach(((t,s)=>{const i=function(t){return new qs(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(i)})),s}function Ls(e,s,i=t.Texture2D){return s.resourceManager.load({url:e,type:i})}void 0===Math.fround&&(Math.fround=(Ps=new Float32Array(1),function(t){return Ps[0]=t,Ps[0]}));class qs extends te{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,e){t===ee.Nearest?this.texture.filterMode=s.Point:e===ee.MipMapLinearLinear?this.texture.filterMode=s.Trilinear:this.texture.filterMode=s.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case se.ClampToEdge:return i.Clamp;case se.Repeat:return i.Repeat;case se.MirroredRepeat:return i.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class Us{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let i=0;i<e;++i)s[i]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class Ws{constructor(t){this._usedElementCount=0,this._type=t,this._elements=[]}get(){const{_usedElementCount:t,_elements:e}=this;if(this._usedElementCount++,e.length===t){const t=new this._type;return e.push(t),t}return e[t]}clear(){this._usedElementCount=0}}const{SourceAlpha:zs,One:$s,DestinationColor:Gs,Zero:js,OneMinusSourceColor:Hs,OneMinusSourceAlpha:Js}=a,{Add:Ks}=n;function Zs(t,e,s){const i=t.renderState.blendState.targetBlendState;switch(e){case le.Additive:i.sourceColorBlendFactor=s?$s:zs,i.destinationColorBlendFactor=$s,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=$s,i.colorBlendOperation=i.alphaBlendOperation=Ks;break;case le.Multiply:i.sourceColorBlendFactor=Gs,i.destinationColorBlendFactor=Js,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=Js,i.colorBlendOperation=i.alphaBlendOperation=Ks;break;case le.Screen:i.sourceColorBlendFactor=$s,i.destinationColorBlendFactor=Hs,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=Hs,i.colorBlendOperation=i.alphaBlendOperation=Ks;break;default:i.sourceColorBlendFactor=s?$s:zs,i.destinationColorBlendFactor=Js,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=Js,i.colorBlendOperation=i.alphaBlendOperation=Ks}}class Qs{}const ti=1/0,ei=-1/0;class si{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new R}static{this.tempColor=new R}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new Us(r)}static{this.subRenderItemPool=new Ws(Qs)}static{this.bounds=new o(new l(ti,ti,ti),new l(ei,ei,ei))}buildPrimitive(t,e){const{_clipper:s,_separateSlots:i,_subRenderItems:a,_separateSlotTextureMap:n}=this,{bounds:r}=si;r.min.set(ti,ti,ti),r.max.set(ei,ei,ei);let o=0,l=0;const h=t.drawOrder,c=h.length,{engine:d,_indices:u,_vertices:m,_vertexCount:f,_subPrimitives:p,zSpacing:g,premultipliedAlpha:x}=e;let{tempVerts:w,tempTexture:b,tempBlendMode:y,subRenderItemPool:k,subPrimitivePool:v}=si;a.length=0,k.clear();let S,A,I=e._vertices,M=0,C=0,F=le.Normal,T=null,E=0;si.tempBlendMode=null,si.tempTexture=null;for(let t=0;t<c;++t){const e=h[t];if(!e.bone.active){s.clipEndWithSlot(e);continue}const r=e.getAttachment();let c=null;const d=g*t;let f=0;const Y=s.isClipping();let _=Y?2:si.VERTEX_SIZE;if(r){switch(r.constructor){case be:const t=r;c=t.color,f=4*_,t.computeWorldVertices(e,w,0,_),S=si.QUAD_TRIANGLES,A=t.uvs,T=t.region.texture;break;case ge:const i=r;c=i.color,f=(i.worldVerticesLength>>1)*_,f>I.length&&(si.tempVerts=new Array(f)),i.computeWorldVertices(e,0,i.worldVerticesLength,w,0,_),S=i.triangles,A=i.uvs,T=i.region.texture;break;case Qt:let a=r;s.clipStart(e,a);continue;default:s.clipEndWithSlot(e);continue}if(null!=T){let t,r,h,g,I=e.bone.skeleton.color,X=e.color,R=si.tempColor,B=si.tempDark;if(R.r=I.r*X.r*c.r,R.g=I.g*X.g*c.g,R.b=I.b*X.b*c.b,R.a=I.a*X.a*c.a,x&&(R.r*=R.a,R.g*=R.a,R.b*=R.a),Y)s.clipTriangles(w,S,S.length,A,R,B,!1),t=s.clippedVertices,r=t.length,h=s.clippedTriangles,g=h.length;else{let e=w;const{r:s,g:i,b:a,a:n}=R;for(let t=2,r=0,o=f;t<o;t+=_,r+=2)e[t]=s,e[t+1]=i,e[t+2]=a,e[t+3]=n,e[t+4]=A[r],e[t+5]=A[r+1];t=w,r=f,h=S,g=S.length}if(0==r||0==g){s.clipEndWithSlot(e);continue}let P=o/si.VERTEX_STRIDE,V=m,D=o,O=0;for(;O<r;){let e=t[O++],s=t[O++];V[D++]=e,V[D++]=s,V[D++]=d,V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],this._expandByPoint(e,s,d)}o=D;let N=u;for(D=l,O=0;O<g;D++,O++)N[D]=h[O]+P;l+=g;const L=e.data,q=L.name;F=L.blendMode;const U=null!==y&&y!==L.blendMode,W=null!==b&&b!==T,z=i.get(q);if(z||U||W){if(C>0){const t=p[E];t&&E++;const e=t||v.get();e.start=M,e.count=C;const s=k.get();s.subPrimitive=e,s.texture=b,s.blendMode=y,a.push(s),M+=C,C=0}if(z){const t=n.get(q);if(t){const e=T.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=p[E];e&&E++;const s=e||v.get();s.start=M,s.count=g;const i=k.get();i.blendMode=F,i.subPrimitive=s,i.texture=T,i.slotName=q,a.push(i),M+=g,C=0}else C+=g}else C+=g;b=T,y=F}s.clipEndWithSlot(e)}else s.clipEndWithSlot(e)}if(C>0){const t=p[E];t&&E++;const e=t||v.get();e.start=M,e.count=C;const s=k.get();s.blendMode=F,s.subPrimitive=e,s.texture=T,a.push(s),C=0}s.clipEnd();const Y=p.length,_=a.length;if(_<Y)for(let t=_;t<Y;t++){const e=p[t];v.return(e)}e._clearSubPrimitives();for(let t=0,s=_;t<s;++t){const s=a[t],{slotName:i,blendMode:r,texture:o}=s;e._addSubPrimitive(s.subPrimitive);let l=o.texture;n.has(i)&&(l=n.get(i));const h=`${l.instanceId}_${r}`;let c=ai._materialCache.get(h);c||(c=this._createMaterialForTexture(l,d,r,x),ai._materialCache.set(h,c)),e.setMaterial(t,c)}if(l>f)return e._createAndBindBuffer(l),void this.buildPrimitive(t,e);e._vertexBuffer.setData(m),e._indexBuffer.setData(u)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s,i){const a=ai._getDefaultMaterial(e);return a.shaderData.setTexture("material_SpineTexture",t),Zs(a,s,i),a}_expandByPoint(t,e,s){const{bounds:{min:i,max:a}}=si,n=Math.min(i.x,t),r=Math.min(i.y,e),o=Math.min(i.z,s),l=Math.max(a.x,t),h=Math.max(a.y,e),c=Math.max(a.z,s);i.set(n,r,o),a.set(l,h,c)}constructor(){this._clipper=new Ts,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class ii extends h{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(t){super(t,c.find("galacean-spine-shader")||c.create("galacean-spine-shader",ii._spineVS,ii._spineFS));const e=this.renderState;e.blendState.targetBlendState.enabled=!0,Zs(this,le.Normal,!1),e.depthState.writeEnabled=!1,e.rasterState.cullMode=d.Off,e.renderQueueType=u.Transparent}}class ai extends m{static{this._spineGenerator=new si}static{this._positionVertexElement=new f("POSITION",0,p.Vector3,0)}static{this._colorVertexElement=new f("COLOR_0",12,p.Vector4,0)}static{this._uvVertexElement=new f("TEXCOORD_0",28,p.Vector2,0)}static{this._materialCache=new Map}static _getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new ii(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.zSpacing=.01,this.premultipliedAlpha=!1,this.defaultConfig=new ni,this._subPrimitives=[],this._vertices=new Float32Array,this._indices=new Uint16Array,this._needResizeBuffer=!1,this._vertexCount=0,this._needsInitialize=!1;const e=new g(this._engine);this._primitive=e,e.addVertexElement(ai._positionVertexElement),e.addVertexElement(ai._colorVertexElement),e.addVertexElement(ai._uvVertexElement)}_onEnable(){this._applyDefaultConfig()}update(t){this._needsInitialize&&(this._initialize(),this._needsInitialize=!1);const{_state:e,_skeleton:s}=this;e&&s&&(e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(oe.update),ai._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))}_render(t){const{_primitive:e,_subPrimitives:s}=this,{_materials:i,_engine:a}=this,n=a._renderElementPool.get();n.set(this.priority,this._distanceForSort);const r=a._subRenderElementPool;if(s){for(let t=0,a=s.length;t<a;t++){let a=i[t];if(!a)continue;(a.destroyed||a.shader.destroyed)&&(a=this.engine._meshMagentaMaterial);const o=r.get();o.set(this,a,e,s[t]),n.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,n)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:e}=si;o.transform(e,this.entity.transform.worldMatrix,t)}_setSkeleton(t){this._skeleton!==t&&(this._skeleton=t,this._needsInitialize=!!t)}_setState(t){this._state!==t&&(this._state=t,this._needsInitialize=!!t)}_cloneTo(t){const e=this._skeleton.data,s=new Kt(e),i=new Be(e),a=new Ot(s);t._setSkeleton(i),t._setState(a)}_onDestroy(){const{_primitive:t,_subPrimitives:e}=this;e.length=0,t&&t.destroy(),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,super._onDestroy()}_createAndBindBuffer(t){const{_engine:e,_primitive:s}=this;this._vertexCount=t,this._vertices=new Float32Array(t*si.VERTEX_STRIDE),this._indices=new Uint16Array(t);const i=4*si.VERTEX_STRIDE,a=new x(e,w.VertexBuffer,this._vertices,b.Dynamic),n=new x(e,w.IndexBuffer,this._indices,b.Dynamic);this._indexBuffer=n,this._vertexBuffer=a;const r=new y(a,i);this._primitive.setVertexBufferBinding(0,r);const o=new k(n,v.UInt16);s.setIndexBufferBinding(o)}_addSubPrimitive(t){this._subPrimitives.push(t)}_clearSubPrimitives(){this._subPrimitives.length=0}_isContainDirtyFlag(t){return!!(this._dirtyUpdateFlag&t)}_setDirtyFlagFalse(t){this._dirtyUpdateFlag&=~t}_onWorldVolumeChanged(){this._dirtyUpdateFlag|=1}_initialize(){this._applyDefaultConfig(),this._dirtyUpdateFlag|=4,this._state.addListener({start:()=>{this._onAnimationStart()},complete:t=>{this._onAnimationComplete(t)}})}_onAnimationStart(){this._dirtyUpdateFlag|=2}_onAnimationComplete(t){t.loop||this._setDirtyFlagFalse(2)}_clearMaterialCache(){this._materials.forEach((t=>{const e=t.shaderData.getTexture("material_SpineTexture"),s=function(t){const e=t.renderState.blendState.targetBlendState;return e.sourceColorBlendFactor===zs&&e.destinationColorBlendFactor===$s&&e.sourceAlphaBlendFactor===$s&&e.destinationAlphaBlendFactor===$s&&e.colorBlendOperation===Ks&&e.alphaBlendOperation===Ks?le.Additive:e.sourceColorBlendFactor===Gs&&e.destinationColorBlendFactor===js&&e.sourceAlphaBlendFactor===$s&&e.destinationAlphaBlendFactor===js&&e.colorBlendOperation===Ks&&e.alphaBlendOperation===Ks?le.Multiply:e.sourceColorBlendFactor===$s&&e.destinationColorBlendFactor===Hs&&e.sourceAlphaBlendFactor===$s&&e.destinationAlphaBlendFactor===Hs&&e.colorBlendOperation===Ks&&e.alphaBlendOperation===Ks?le.Screen:le.Normal}(t),i=`${e.instanceId}_${s}`;ai._materialCache.delete(i)}))}_applyDefaultConfig(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:i,loop:a}=this.defaultConfig;"default"!==i&&(t.setSkinByName(i),t.setToSetupPose()),s&&e.setAnimation(0,s,a)}}get resource(){return this._resource}set resource(t){if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t;const{skeletonData:e,stateData:s}=t,i=new Be(e),a=new Ot(s);this._setSkeleton(i),this._setState(a)}}Y([S],ai.prototype,"zSpacing",void 0),Y([S],ai.prototype,"premultipliedAlpha",void 0),Y([A],ai.prototype,"defaultConfig",void 0),Y([I],ai.prototype,"_primitive",void 0),Y([I],ai.prototype,"_subPrimitives",void 0),Y([I],ai.prototype,"_indexBuffer",void 0),Y([I],ai.prototype,"_vertexBuffer",void 0),Y([I],ai.prototype,"_vertices",void 0),Y([I],ai.prototype,"_indices",void 0),Y([I],ai.prototype,"_needResizeBuffer",void 0),Y([I],ai.prototype,"_vertexCount",void 0),Y([I],ai.prototype,"_resource",void 0),Y([I],ai.prototype,"_skeleton",void 0),Y([I],ai.prototype,"_state",void 0),Y([I],ai.prototype,"_needsInitialize",void 0);class ni{constructor(t=!0,e=null,s="default"){this.loop=t,this.animationName=e,this.skinName=s}}class ri extends M{constructor(t,e,s){super(t),this._texturesInSpineAtlas=[],this.url=s,this._skeletonData=e,this._stateData=new Kt(e),this._associationTextureInSkeletonData(e),this._createTemplate()}get skeletonData(){return this._skeletonData}get stateData(){return this._stateData}instantiate(){return this._template.clone()}_onDestroy(){super._onDestroy(),this._disassociationSuperResource(),this._skeletonData=null,this._stateData=null}_createTemplate(){const t=this._extractFileName(this.url),e=new C(this.engine,t),s=e.addComponent(ai),i=new Be(this._skeletonData),a=new Ot(this._stateData);s._setSkeleton(i),s._setState(a),e._markAsTemplate(this),this._template=e}_associationTextureInSkeletonData(t){const{skins:e,slots:s}=t,i=this._texturesInSpineAtlas;for(let t=0,a=e.length;t<a;t++)for(let a=0,n=s.length;a<n;a++){const n=s[a],r=e[t].getAttachment(n.index,n.name),o=r?.region?.texture.texture;o&&(i.includes(o)||(i.push(o),o._associationSuperResource(this)))}}_disassociationSuperResource(){const t=this._texturesInSpineAtlas;for(let e=0,s=t.length;e<s;e++)t[e]._disassociationSuperResource(this)}_extractFileName(t){if(!t)return"Spine Entity";const e=t.match(/\/([^\/]+?)(\.[^\/]*)?$/);return e?e[1]:"Spine Entity"}}class oi{constructor(t,e=0,s){this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,s??t.byteLength-e),this._position=0}nextUint16(){const t=this._dataView.getUint16(this._position,!0);return this._position+=2,t}nextStr(){const t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,this.decodeText(e)}nextImageData(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)}decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let s=0,i=t.length;s<i;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class li extends F{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:i,skeletonExtensions:a}=li,n=li.getUrlExtension(t,e);n&&(a.includes(n)&&(s.skeletonPath=t,s.skeletonExtension=n),"atlas"===n&&(s.atlasPath=t),i.includes(n)&&(s.imagePaths.push(t),s.imageExtensions.push(n)))}static deriveAndAssignSpineAsset(t,e,s){const i=li.getUrlExtension(t,e);if(!i)return;s.skeletonPath=t,s.skeletonExtension=i;const a=/(\.(json|bin|skel))$/;let n;if(a.test(t)&&(n=t.replace(a,"")),n){const t=n+".atlas";s.atlasPath=t}}static verifyFileExtensions(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}static getUrlExtension(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}load(t,e){return new T((async s=>{let i;if(t.urls)i=await this._handleOriginAsset(t,e);else{const s=await this.request(t.url,{type:"arraybuffer"}),a=new oi(new Uint8Array(s)),n=a.nextStr();i=n.startsWith("spine")?await this._handleEditorAsset(t,s,a,n,e):await this._handleOriginAsset(t,e,s)}s(i)}))}async _handleEditorAsset(t,e,s,i,a){let n,r;const o=i.startsWith("spine:skel")?"skel":"json",{engine:l}=a;if("skel"===o)r=s.nextStr(),n=s.nextImageData();else{const t=new TextDecoder("utf-8").decode(new Uint8Array(e)),{data:s,atlas:i}=JSON.parse(t);r=i.refId,n=s}const h=Vs(await a.getResourceByRef({refId:r}),n,o);return new ri(l,h,t.url)}async _handleOriginAsset(t,e,s){let{fileExtensions:i}=t.params||{},a={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:n}=e;if(s){const e=li.verifyFileExtensions(i,!1);li.deriveAndAssignSpineAsset(t.url,e,a);const{skeletonPath:r,atlasPath:o}=a;if(!r||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await Os(o,n),{data:h,type:c}=this._determineSkeletonDataType(s),d=Vs(l,h,c);return new ri(n,d,r)}{i=li.verifyFileExtensions(i,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],n=i&&i[e]||null;li.parseAndAssignSpineAsset(s,n,a)}const{skeletonPath:e,atlasPath:s,imagePaths:r,skeletonExtension:o,imageExtensions:l}=a;if(!e||!s)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const h="json"===o?"json":"skel";let c,d,u=["json"===o?this.request(e,{type:"text"}):this.request(e,{type:"arraybuffer"})];if(r.length>0){let t,e;u=u.concat([this.request(s,{type:"text"}),Ds(r,l,n)]),[d,t,e]=await Promise.all(u),c=Ns(t,e)}else u.push(Os(s,n)),[d,c]=await Promise.all(u);const m=Vs(c,d,h);return new ri(n,m,e)}}_determineSkeletonDataType(t){let e,s;try{const i=new TextDecoder("utf-8").decode(t);JSON.parse(i),e=i,s="json"}catch(i){e=t,s="skel"}return{data:e,type:s}}}li=Y([E("spine",["json","bin","skel"])],li);class hi extends F{load(t,e){return new T((async s=>{const i=await this.request(t.url,{type:"text"}),{data:a,textures:n}=JSON.parse(i),r=n.map((t=>e.getResourceByRef({refId:t.refId})));s(Ns(a,await Promise.all(r)))}))}}hi=Y([E("EditorSpineAtlas",["atlas"])],hi);const ci="0.0.0-experimental-engine-spine-20241107";F.registerClass("SpineAnimationRenderer",ai),console.log(`Galacean spine version: ${ci}`);export{xt as AlphaTimeline,J as Animation,Ot as AnimationState,Ut as AnimationStateAdapter,Kt as AnimationStateData,Ae as AssetManagerBase,ye as AtlasAttachmentLoader,z as Attachment,yt as AttachmentTimeline,Ue as BinaryInput,le as BlendMode,ve as Bone,ke as BoneData,Zt as BoundingBoxAttachment,Jt as CURRENT,Qt as ClippingAttachment,R as Color,Se as ConstraintData,et as CurveTimeline,st as CurveTimeline1,it as CurveTimeline2,N as DebugUtils,kt as DeformTimeline,Ie as Downloader,St as DrawOrderTimeline,Me as Event,Ce as EventData,Lt as EventQueue,vt as EventTimeline,qt as EventType,zt as FIRST,de as FakeTexture,Gt as HOLD_FIRST,jt as HOLD_MIX,$t as HOLD_SUBSEQUENT,Fe as IkConstraint,Te as IkConstraintData,At as IkConstraintTimeline,ie as Inherit,ft as InheritTimeline,_ as IntSet,P as Interpolation,B as MathUtils,ge as MeshAttachment,K as MixBlend,Z as MixDirection,xe as PathAttachment,Ye as PathConstraint,Ee as PathConstraintData,Ft as PathConstraintMixTimeline,Mt as PathConstraintPositionTimeline,Ct as PathConstraintSpacingTimeline,oe as Physics,_t as PhysicsConstraintDampingTimeline,Bt as PhysicsConstraintGravityTimeline,Et as PhysicsConstraintInertiaTimeline,Xt as PhysicsConstraintMassTimeline,Pt as PhysicsConstraintMixTimeline,Vt as PhysicsConstraintResetTimeline,Yt as PhysicsConstraintStrengthTimeline,Tt as PhysicsConstraintTimeline,Rt as PhysicsConstraintWindTimeline,we as PointAttachment,L as Pool,ae as PositionMode,V as Pow,D as PowOut,bt as RGB2Timeline,wt as RGBA2Timeline,pt as RGBATimeline,gt as RGBTimeline,be as RegionAttachment,re as RotateMode,at as RotateTimeline,Ht as SETUP,Wt as SUBSEQUENT,lt as ScaleTimeline,ht as ScaleXTimeline,ct as ScaleYTimeline,Dt as SequenceTimeline,dt as ShearTimeline,ut as ShearXTimeline,mt as ShearYTimeline,Be as Skeleton,qe as SkeletonBinary,Cs as SkeletonBounds,Ts as SkeletonClipping,Ve as SkeletonData,Es as SkeletonJson,Oe as Skin,De as SkinEntry,Xe as Slot,Ne as SlotData,ne as SpacingMode,ai as SpineAnimationRenderer,ri as SpineResource,X as StringSet,te as Texture,ue as TextureAtlas,fe as TextureAtlasPage,pe as TextureAtlasRegion,ee as TextureFilter,ce as TextureRegion,se as TextureWrap,U as TimeKeeper,tt as Timeline,Nt as TrackEntry,Re as TransformConstraint,Le as TransformConstraintData,It as TransformConstraintTimeline,nt as TranslateTimeline,rt as TranslateXTimeline,ot as TranslateYTimeline,Fs as Triangulator,O as Utils,q as Vector2,$ as VertexAttachment,W as WindowedMean,Ns as createTextureAtlas,ci as version};
2
2
  //# sourceMappingURL=module.js.map