@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/README.md +67 -43
- package/dist/browser.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +62 -8
- package/types/SpineAnimationRenderer.d.ts +43 -60
- package/types/SpineGenerator.d.ts +1 -4
- package/types/index.d.ts +2 -2
- package/types/loader/EditorSpineAtlasLoader.d.ts +1 -1
- package/types/loader/LoaderUtils.d.ts +1 -1
- package/types/loader/SpineLoader.d.ts +3 -3
- package/types/loader/SpineResource.d.ts +33 -0
- package/types/util/BlendMode.d.ts +2 -2
package/dist/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@galacean/engine");function e(t,e,r,n,a,i,s){try{var o=t[i](s),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,a)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(a,i){var s=t.apply(r,n);function o(t){e(s,a,i,o,l,"next",t)}function l(t){e(s,a,i,o,l,"throw",t)}o(void 0)}))}}function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function i(t,e,r,n){var a,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function s(t,e){var r,n,a,i,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(s=0)),s;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(a=s.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function l(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}"function"==typeof SuppressedError&&SuppressedError;var u=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}(),c=function(){function t(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=r,this.a=n}var e=t.prototype;return e.set=function(t,e,r,n){return this.r=t,this.g=e,this.b=r,this.a=n,this.clamp(),this},e.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},e.add=function(t,e,r,n){return this.r+=t,this.g+=e,this.b+=r,this.a+=n,this.clamp(),this},e.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t}();c.WHITE=new c(1,1,1,1),c.RED=new c(1,0,0,1),c.GREEN=new c(0,1,0,1),c.BLUE=new c(0,0,1,1),c.MAGENTA=new c(1,0,1,1);var d=function(){function t(){}return t.clamp=function(t,e,r){return t<e?e:t>r?r:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,r){return t.randomTriangularWith(e,r,.5*(e+r))},t.randomTriangularWith=function(t,e,r){var n=Math.random(),a=e-t;return n<=(r-t)/a?t+Math.sqrt(n*a*(r-t)):e-Math.sqrt((1-n)*a*(e-r))},t}();d.PI=3.1415927,d.PI2=2*d.PI,d.radiansToDegrees=180/d.PI,d.radDeg=d.radiansToDegrees,d.degreesToRadians=d.PI/180,d.degRad=d.degreesToRadians;var f=function(){function t(){}return t.prototype.apply=function(t,e,r){return t+(e-t)*this.applyInternal(r)},t}(),p=function(t){function e(e){var r;return(r=t.call(this)||this).power=2,r.power=e,r}return a(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}(f),v=function(t){function e(e){return t.call(this,e)}return a(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(p),m=function(){function t(){}return t.arrayCopy=function(t,e,r,n,a){for(var i=e,s=n;i<e+a;i++,s++)r[s]=t[i]},t.setArraySize=function(t,e,r){void 0===r&&(r=0);var n=t.length;if(n==e)return t;if(t.length=e,n<e)for(var a=n;a<e;a++)t[a]=r;return t},t.ensureArrayCapacity=function(e,r,n){return void 0===n&&(n=0),e.length>=r?e:t.setArraySize(e,r,n)},t.newArray=function(t,e){for(var r=new Array(t),n=0;n<t;n++)r[n]=e;return r},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},t.toFloatArray=function(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e},t.toSinglePrecision=function(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e},t.webkit602BugfixHelper=function(t,e){},t.contains=function(t,e,r){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},t}();m.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var g=function(){function t(){}return t.logBones=function(t){for(var e=0;e<t.bones.length;e++){var r=t.bones[e];console.log(r.data.name+", "+r.a+", "+r.b+", "+r.c+", "+r.d+", "+r.worldX+", "+r.worldY)}},t}(),x=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}(),w=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}(),y=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}(),E=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 b(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var M=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},S=function(t){function e(r){var n;return(n=t.call(this,r)||this).id=(65535&e.nextID++)<<11,n.worldVerticesLength=0,n.deformAttachment=b(n),n}a(e,t);var r=e.prototype;return r.computeWorldVertices=function(t,e,r,n,a,i){r=a+(r>>1)*i;var s=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,d=0;d<e;d+=2){var f=h[u];u+=f+1,c+=f}var p=s.bones;if(0==o.length)for(var v=a,m=3*c;v<r;v+=i){var g=0,x=0,w=h[u++];for(w+=u;u<w;u++,m+=3){var y=p[h[u]],E=l[m],b=l[m+1],M=l[m+2];g+=(E*y.a+b*y.b+y.worldX)*M,x+=(E*y.c+b*y.d+y.worldY)*M}n[v]=g,n[v+1]=x}else for(var S=o,T=a,A=3*c,I=c<<1;T<r;T+=i){var R=0,C=0,P=h[u++];for(P+=u;u<P;u++,A+=3,I+=2){var V=p[h[u]],_=l[A]+S[I],k=l[A+1]+S[I+1],F=l[A+2];R+=(_*V.a+k*V.b+V.worldX)*F,C+=(_*V.c+k*V.d+V.worldY)*F}n[T]=R,n[T+1]=C}}else{o.length>0&&(l=o);for(var B=t.bone,N=B.worldX,O=B.worldY,D=B.a,L=B.b,X=B.c,Y=B.d,W=e,U=a;U<r;W+=2,U+=i){var q=l[W],H=l[W+1];n[U]=q*D+H*L+N,n[U+1]=q*X+H*Y+O}}},r.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),m.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=m.newFloatArray(this.vertices.length),m.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(M);S.nextID=0;var T,A,I,R=function(){function t(t,e,r){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var n=0;n<e.length;n++)this.timelineIds[e[n].getPropertyId()]=!0;this.duration=r}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,r,n,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");n&&0!=this.duration&&(r%=this.duration,e>0&&(e%=this.duration));for(var l=this.timelines,h=0,u=l.length;h<u;h++)l[h].apply(t,e,r,a,i,s,o)},t.binarySearch=function(t,e,r){void 0===r&&(r=1);var n=0,a=t.length/r-2;if(0==a)return r;for(var i=a>>>1;;){if(t[(i+1)*r]<=e?n=i+1:a=i,n==a)return(n+1)*r;i=n+a>>>1}},t.linearSearch=function(t,e,r){for(var n=0,a=t.length-r;n<=a;n+=r)if(t[n]>e)return n;return-1},t}();exports.MixBlend=void 0,(T=exports.MixBlend||(exports.MixBlend={}))[T.setup=0]="setup",T[T.first=1]="first",T[T.replace=2]="replace",T[T.add=3]="add",exports.MixDirection=void 0,(A=exports.MixDirection||(exports.MixDirection={}))[A.mixIn=0]="mixIn",A[A.mixOut=1]="mixOut",exports.TimelineType=void 0,(I=exports.TimelineType||(exports.TimelineType={}))[I.rotate=0]="rotate",I[I.translate=1]="translate",I[I.scale=2]="scale",I[I.shear=3]="shear",I[I.attachment=4]="attachment",I[I.color=5]="color",I[I.deform=6]="deform",I[I.event=7]="event",I[I.drawOrder=8]="drawOrder",I[I.ikConstraint=9]="ikConstraint",I[I.transformConstraint=10]="transformConstraint",I[I.pathConstraintPosition=11]="pathConstraintPosition",I[I.pathConstraintSpacing=12]="pathConstraintSpacing",I[I.pathConstraintMix=13]="pathConstraintMix",I[I.twoColor=14]="twoColor";var C=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=m.newFloatArray((e-1)*t.BEZIER_SIZE)}var e=t.prototype;return e.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},e.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},e.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},e.getCurveType=function(e){var r=e*t.BEZIER_SIZE;if(r==this.curves.length)return t.LINEAR;var n=this.curves[r];return n==t.LINEAR?t.LINEAR:n==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,r,n,a,i){var s=.03*(2*-r+a),o=.03*(2*-n+i),l=.006*(3*(r-a)+1),h=.006*(3*(n-i)+1),u=2*s+l,c=2*o+h,d=.3*r+s+.16666667*l,f=.3*n+o+.16666667*h,p=e*t.BEZIER_SIZE,v=this.curves;v[p++]=t.BEZIER;for(var m=d,g=f,x=p+t.BEZIER_SIZE-1;p<x;p+=2)v[p]=m,v[p+1]=g,d+=u,f+=c,u+=l,c+=h,m+=d,g+=f},e.getCurvePercent=function(e,r){r=d.clamp(r,0,1);var n=this.curves,a=e*t.BEZIER_SIZE,i=n[a];if(i==t.LINEAR)return r;if(i==t.STEPPED)return 0;for(var s=0,o=++a,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=n[a])>=r){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=n[a-2],u=n[a-1]),u+(n[a+1]-u)*(r-h)/(s-h)}var c=n[a-1];return c+(1-c)*(r-s)/(1-s)},t}();C.LINEAR=0,C.STEPPED=1,C.BEZIER=2,C.BEZIER_SIZE=19;var P=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=m.newFloatArray(e<<1),r}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return 0+this.boneIndex},r.setFrame=function(t,r,n){t<<=1,this.frames[t]=r,this.frames[t+e.ROTATION]=n},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.rotation=h.data.rotation);case 1:var u=h.data.rotation-h.rotation;h.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(n>=l[l.length-e.ENTRIES]){var c=l[l.length+e.PREV_ROTATION];switch(s){case 0:h.rotation=h.data.rotation+c*i;break;case 1:case 2:c+=h.data.rotation-h.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:h.rotation+=c*i}}else{var d=R.binarySearch(l,n,e.ENTRIES),f=l[d+e.PREV_ROTATION],p=l[d],v=this.getCurvePercent((d>>1)-1,1-(n-p)/(l[d+e.PREV_TIME]-p)),m=l[d+e.ROTATION]-f;switch(m=f+(m-360*(16384-(16384.499999999996-m/360|0)))*v,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}(C);P.ENTRIES=2,P.PREV_TIME=-2,P.PREV_ROTATION=-1,P.ROTATION=1;var V=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=m.newFloatArray(r*e.ENTRIES),n}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(1<<24)+this.boneIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.X]=n,this.frames[t+e.Y]=a},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.x=h.data.x,void(h.y=h.data.y);case 1:h.x+=(h.data.x-h.x)*i,h.y+=(h.data.y-h.y)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=R.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.x=h.data.x+u*i,h.y=h.data.y+c*i;break;case 1:case 2:h.x+=(h.data.x+u-h.x)*i,h.y+=(h.data.y+c-h.y)*i;break;case 3:h.x+=u*i,h.y+=c*i}}},e}(C);V.ENTRIES=3,V.PREV_TIME=-3,V.PREV_X=-2,V.PREV_Y=-1,V.X=1,V.Y=2;var _=function(t){function e(e){return t.call(this,e)}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(2<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case 1:h.scaleX+=(h.data.scaleX-h.scaleX)*i,h.scaleY+=(h.data.scaleY-h.scaleY)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X]*h.data.scaleX,c=l[l.length+e.PREV_Y]*h.data.scaleY;else{var f=R.binarySearch(l,n,e.ENTRIES);u=l[f+e.PREV_X],c=l[f+e.PREV_Y];var p=l[f],v=this.getCurvePercent(f/e.ENTRIES-1,1-(n-p)/(l[f+e.PREV_TIME]-p));u=(u+(l[f+e.X]-u)*v)*h.data.scaleX,c=(c+(l[f+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 m=0,g=0;if(1==o)switch(s){case 0:m=h.data.scaleX,g=h.data.scaleY,h.scaleX=m+(Math.abs(u)*d.signum(m)-m)*i,h.scaleY=g+(Math.abs(c)*d.signum(g)-g)*i;break;case 1:case 2:m=h.scaleX,g=h.scaleY,h.scaleX=m+(Math.abs(u)*d.signum(m)-m)*i,h.scaleY=g+(Math.abs(c)*d.signum(g)-g)*i;break;case 3:m=h.scaleX,g=h.scaleY,h.scaleX=m+(Math.abs(u)*d.signum(m)-h.data.scaleX)*i,h.scaleY=g+(Math.abs(c)*d.signum(g)-h.data.scaleY)*i}else switch(s){case 0:m=Math.abs(h.data.scaleX)*d.signum(u),g=Math.abs(h.data.scaleY)*d.signum(c),h.scaleX=m+(u-m)*i,h.scaleY=g+(c-g)*i;break;case 1:case 2:m=Math.abs(h.scaleX)*d.signum(u),g=Math.abs(h.scaleY)*d.signum(c),h.scaleX=m+(u-m)*i,h.scaleY=g+(c-g)*i;break;case 3:m=d.signum(u),g=d.signum(c),h.scaleX=Math.abs(h.scaleX)*m+(u-Math.abs(h.data.scaleX)*m)*i,h.scaleY=Math.abs(h.scaleY)*g+(c-Math.abs(h.data.scaleY)*g)*i}}}},e}(V),k=function(t){function e(e){return t.call(this,e)}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(3<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.shearX=h.data.shearX,void(h.shearY=h.data.shearY);case 1:h.shearX+=(h.data.shearX-h.shearX)*i,h.shearY+=(h.data.shearY-h.shearY)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=R.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.shearX=h.data.shearX+u*i,h.shearY=h.data.shearY+c*i;break;case 1:case 2:h.shearX+=(h.data.shearX+u-h.shearX)*i,h.shearY+=(h.data.shearY+c-h.shearY)*i;break;case 3:h.shearX+=u*i,h.shearY+=c*i}}},e}(V),F=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=m.newFloatArray(r*e.ENTRIES),n}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(5<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},r.apply=function(t,r,n,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<h[0])switch(s){case 0:return void l.color.setFromColor(l.data.color);case 1:var u=l.color,c=l.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,p=0,v=0;if(n>=h[h.length-e.ENTRIES]){var m=h.length;d=h[m+e.PREV_R],f=h[m+e.PREV_G],p=h[m+e.PREV_B],v=h[m+e.PREV_A]}else{var g=R.binarySearch(h,n,e.ENTRIES);d=h[g+e.PREV_R],f=h[g+e.PREV_G],p=h[g+e.PREV_B],v=h[g+e.PREV_A];var x=h[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(n-x)/(h[g+e.PREV_TIME]-x));d+=(h[g+e.R]-d)*w,f+=(h[g+e.G]-f)*w,p+=(h[g+e.B]-p)*w,v+=(h[g+e.A]-v)*w}if(1==i)l.color.set(d,f,p,v);else{var y=l.color;0==s&&y.setFromColor(l.data.color),y.add((d-y.r)*i,(f-y.g)*i,(p-y.b)*i,(v-y.a)*i)}}}},e}(C);F.ENTRIES=5,F.PREV_TIME=-5,F.PREV_R=-4,F.PREV_G=-3,F.PREV_B=-2,F.PREV_A=-1,F.R=1,F.G=2,F.B=3,F.A=4;var B=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=m.newFloatArray(r*e.ENTRIES),n}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(14<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s,o,l,h){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s,this.frames[t+e.R2]=o,this.frames[t+e.G2]=l,this.frames[t+e.B2]=h},r.apply=function(t,r,n,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<h[0])switch(s){case 0:return l.color.setFromColor(l.data.color),void l.darkColor.setFromColor(l.data.darkColor);case 1:var u=l.color,c=l.darkColor,d=l.data.color,f=l.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var p=0,v=0,m=0,g=0,x=0,w=0,y=0;if(n>=h[h.length-e.ENTRIES]){var E=h.length;p=h[E+e.PREV_R],v=h[E+e.PREV_G],m=h[E+e.PREV_B],g=h[E+e.PREV_A],x=h[E+e.PREV_R2],w=h[E+e.PREV_G2],y=h[E+e.PREV_B2]}else{var b=R.binarySearch(h,n,e.ENTRIES);p=h[b+e.PREV_R],v=h[b+e.PREV_G],m=h[b+e.PREV_B],g=h[b+e.PREV_A],x=h[b+e.PREV_R2],w=h[b+e.PREV_G2],y=h[b+e.PREV_B2];var M=h[b],S=this.getCurvePercent(b/e.ENTRIES-1,1-(n-M)/(h[b+e.PREV_TIME]-M));p+=(h[b+e.R]-p)*S,v+=(h[b+e.G]-v)*S,m+=(h[b+e.B]-m)*S,g+=(h[b+e.A]-g)*S,x+=(h[b+e.R2]-x)*S,w+=(h[b+e.G2]-w)*S,y+=(h[b+e.B2]-y)*S}if(1==i)l.color.set(p,v,m,g),l.darkColor.set(x,w,y,1);else{var T=l.color,A=l.darkColor;0==s&&(T.setFromColor(l.data.color),A.setFromColor(l.data.darkColor)),T.add((p-T.r)*i,(v-T.g)*i,(m-T.b)*i,(g-T.a)*i),A.add((x-A.r)*i,(w-A.g)*i,(y-A.b)*i,0)}}}},e}(C);B.ENTRIES=8,B.PREV_TIME=-8,B.PREV_R=-7,B.PREV_G=-6,B.PREV_B=-5,B.PREV_A=-4,B.PREV_R2=-3,B.PREV_G2=-2,B.PREV_B2=-1,B.R=1,B.G=2,B.B=3,B.A=4,B.R2=5,B.G2=6,B.B2=7;var N=function(){function t(t){this.frames=m.newFloatArray(t),this.attachmentNames=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return(4<<24)+this.slotIndex},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,r){this.frames[t]=e,this.attachmentNames[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var l=this.frames;if(r<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=r>=l[l.length-1]?l.length-1:R.binarySearch(l,r,1)-1;var u=this.attachmentNames[h];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,r){e.attachment=null==r?null:t.getAttachment(this.slotIndex,r)},t}(),O=null,D=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=m.newFloatArray(e),r.frameVertices=new Array(e),null==O&&(O=m.newFloatArray(64)),r}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},r.setFrame=function(t,e,r){this.frames[t]=e,this.frameVertices[t]=r},r.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var l=o.getAttachment();if(h(l,S)&&l.deformAttachment==this.attachment){var u=o.deform;0==u.length&&(i=0);var c=this.frameVertices,d=c[0].length,f=this.frames;if(r<f[0]){var p=l;switch(i){case 0:return void(u.length=0);case 1:if(1==a){u.length=0;break}var v=m.setArraySize(u,d);if(null==p.bones)for(var g=p.vertices,x=0;x<d;x++)v[x]+=(g[x]-v[x])*a;else{a=1-a;for(x=0;x<d;x++)v[x]*=a}}}else{var w=m.setArraySize(u,d);if(r>=f[f.length-1]){var y=c[f.length-1];if(1==a)if(3==i){var E=l;if(null==E.bones)for(var b=E.vertices,M=0;M<d;M++)w[M]+=y[M]-b[M];else for(var T=0;T<d;T++)w[T]+=y[T]}else m.arrayCopy(y,0,w,0,d);else switch(i){case 0:var A=l;if(null==A.bones)for(var I=A.vertices,C=0;C<d;C++){var P=I[C];w[C]=P+(y[C]-P)*a}else for(var V=0;V<d;V++)w[V]=y[V]*a;break;case 1:case 2:for(var _=0;_<d;_++)w[_]+=(y[_]-w[_])*a;break;case 3:var k=l;if(null==k.bones)for(var F=k.vertices,B=0;B<d;B++)w[B]+=(y[B]-F[B])*a;else for(var N=0;N<d;N++)w[N]+=y[N]*a}}else{var O=R.binarySearch(f,r),D=c[O-1],L=c[O],X=f[O],Y=this.getCurvePercent(O-1,1-(r-X)/(f[O-1]-X));if(1==a)if(3==i){var W=l;if(null==W.bones)for(var U=W.vertices,q=0;q<d;q++){var H=D[q];w[q]+=H+(L[q]-H)*Y-U[q]}else for(var j=0;j<d;j++){var G=D[j];w[j]+=G+(L[j]-G)*Y}}else for(var z=0;z<d;z++){var Z=D[z];w[z]=Z+(L[z]-Z)*Y}else switch(i){case 0:var Q=l;if(null==Q.bones)for(var J=Q.vertices,K=0;K<d;K++){var $=D[K],tt=J[K];w[K]=tt+($+(L[K]-$)*Y-tt)*a}else for(var et=0;et<d;et++){var rt=D[et];w[et]=(rt+(L[et]-rt)*Y)*a}break;case 1:case 2:for(var nt=0;nt<d;nt++){var at=D[nt];w[nt]+=(at+(L[nt]-at)*Y-w[nt])*a}break;case 3:var it=l;if(null==it.bones)for(var st=it.vertices,ot=0;ot<d;ot++){var lt=D[ot];w[ot]+=(lt+(L[ot]-lt)*Y-st[ot])*a}else for(var ht=0;ht<d;ht++){var ut=D[ht];w[ht]+=(ut+(L[ht]-ut)*Y)*a}}}}}}},e}(C),L=function(){function t(t){this.frames=m.newFloatArray(t),this.events=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 7<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.apply=function(t,e,r,n,a,i,s){if(null!=n){var o=this.frames,l=this.frames.length;if(e>r)this.apply(t,e,Number.MAX_VALUE,n,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(r<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=R.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&r>=o[h];h++)n.push(this.events[h])}}},t}(),X=function(){function t(t){this.frames=m.newFloatArray(t),this.drawOrders=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 8<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,r){this.frames[t]=e,this.drawOrders[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.drawOrder,l=t.slots;if(1!=s){var h=this.frames;if(r<h[0])0!=i&&1!=i||m.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=r>=h[h.length-1]?h.length-1:R.binarySearch(h,r)-1;var c=this.drawOrders[u];if(null==c)m.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&&m.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),Y=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=m.newFloatArray(r*e.ENTRIES),n}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},r.setFrame=function(t,r,n,a,i,s,o){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.MIX]=n,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,void(h.stretch=h.data.stretch);case 1:h.mix+=(h.data.mix-h.mix)*i,h.softness+=(h.data.softness-h.softness)*i,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}else if(n>=l[l.length-e.ENTRIES])0==s?(h.mix=h.data.mix+(l[l.length+e.PREV_MIX]-h.data.mix)*i,h.softness=h.data.softness+(l[l.length+e.PREV_SOFTNESS]-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH])):(h.mix+=(l[l.length+e.PREV_MIX]-h.mix)*i,h.softness+=(l[l.length+e.PREV_SOFTNESS]-h.softness)*i,0==o&&(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH]));else{var u=R.binarySearch(l,n,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],p=this.getCurvePercent(u/e.ENTRIES-1,1-(n-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*p-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*p-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH])):(h.mix+=(c+(l[u+e.MIX]-c)*p-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*p-h.softness)*i,0==o&&(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH]))}},e}(C);Y.ENTRIES=6,Y.PREV_TIME=-6,Y.PREV_MIX=-5,Y.PREV_SOFTNESS=-4,Y.PREV_BEND_DIRECTION=-3,Y.PREV_COMPRESS=-2,Y.PREV_STRETCH=-1,Y.MIX=1,Y.SOFTNESS=2,Y.BEND_DIRECTION=3,Y.COMPRESS=4,Y.STRETCH=5;var W=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=m.newFloatArray(r*e.ENTRIES),n}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(n<l[0]){var u=h.data;switch(s){case 0:return h.rotateMix=u.rotateMix,h.translateMix=u.translateMix,h.scaleMix=u.scaleMix,void(h.shearMix=u.shearMix);case 1:h.rotateMix+=(u.rotateMix-h.rotateMix)*i,h.translateMix+=(u.translateMix-h.translateMix)*i,h.scaleMix+=(u.scaleMix-h.scaleMix)*i,h.shearMix+=(u.shearMix-h.shearMix)*i}}else{var c=0,d=0,f=0,p=0;if(n>=l[l.length-e.ENTRIES]){var v=l.length;c=l[v+e.PREV_ROTATE],d=l[v+e.PREV_TRANSLATE],f=l[v+e.PREV_SCALE],p=l[v+e.PREV_SHEAR]}else{var m=R.binarySearch(l,n,e.ENTRIES);c=l[m+e.PREV_ROTATE],d=l[m+e.PREV_TRANSLATE],f=l[m+e.PREV_SCALE],p=l[m+e.PREV_SHEAR];var g=l[m],x=this.getCurvePercent(m/e.ENTRIES-1,1-(n-g)/(l[m+e.PREV_TIME]-g));c+=(l[m+e.ROTATE]-c)*x,d+=(l[m+e.TRANSLATE]-d)*x,f+=(l[m+e.SCALE]-f)*x,p+=(l[m+e.SHEAR]-p)*x}if(0==s){var w=h.data;h.rotateMix=w.rotateMix+(c-w.rotateMix)*i,h.translateMix=w.translateMix+(d-w.translateMix)*i,h.scaleMix=w.scaleMix+(f-w.scaleMix)*i,h.shearMix=w.shearMix+(p-w.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(p-h.shearMix)*i}},e}(C);W.ENTRIES=5,W.PREV_TIME=-5,W.PREV_ROTATE=-4,W.PREV_TRANSLATE=-3,W.PREV_SCALE=-2,W.PREV_SHEAR=-1,W.ROTATE=1,W.TRANSLATE=2,W.SCALE=3,W.SHEAR=4;var U=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=m.newFloatArray(r*e.ENTRIES),n}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.VALUE]=n},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.position=h.data.position);case 1:h.position+=(h.data.position-h.position)*i}else{var u=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=R.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.position=h.data.position+(u-h.data.position)*i:h.position+=(u-h.position)*i}},e}(C);U.ENTRIES=2,U.PREV_TIME=-2,U.PREV_VALUE=-1,U.VALUE=1;var q=function(t){function e(e){return t.call(this,e)}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.spacing=h.data.spacing);case 1:h.spacing+=(h.data.spacing-h.spacing)*i}else{var u=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=R.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.spacing=h.data.spacing+(u-h.data.spacing)*i:h.spacing+=(u-h.spacing)*i}},e}(U),H=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=m.newFloatArray(r*e.ENTRIES),n}a(e,t);var r=e.prototype;return r.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a},r.apply=function(t,r,n,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.rotateMix=h.data.rotateMix,void(h.translateMix=h.data.translateMix);case 1:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*i,h.translateMix+=(h.data.translateMix-h.translateMix)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=R.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*p,c+=(l[d+e.TRANSLATE]-c)*p}0==s?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*i,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*i):(h.rotateMix+=(u-h.rotateMix)*i,h.translateMix+=(c-h.translateMix)*i)}},e}(C);H.ENTRIES=3,H.PREV_TIME=-3,H.PREV_ROTATE=-2,H.PREV_TRANSLATE=-1,H.ROTATE=1,H.TRANSLATE=2;var j=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 Z(this),this.propertyIDs=new u,this.animationsChanged=!1,this.trackEntryPool=new x((function(){return new z})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,r=0,n=e.length;r<n;r++){var a=e[r];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(r,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[r]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var r=t.mixingFrom;if(null==r)return!0;var n=this.updateMixingFrom(r,e);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=r.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=r.mixingFrom,null!=r.mixingFrom&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),n):(r.trackTime+=e*r.timeScale,t.mixTime+=e,!1)},e.apply=function(e){if(null==e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,n=this.tracks,a=!1,i=0,s=n.length;i<s;i++){var o=n[i];if(!(null==o||o.delay>0)){a=!0;var l=0==i?exports.MixBlend.first:o.mixBlend,u=o.alpha;null!=o.mixingFrom?u*=this.applyMixingFrom(o,e,l):o.trackTime>=o.trackEnd&&null==o.next&&(u=0);var c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(0==i&&1==u||l==exports.MixBlend.add)for(var v=0;v<f;v++){m.webkit602BugfixHelper(u,l);var g=p[v];h(g,N)?this.applyAttachmentTimeline(g,e,d,l,!0):g.apply(e,c,d,r,u,l,exports.MixDirection.mixIn)}else{var x=o.timelineMode,w=0==o.timelinesRotation.length;w&&m.setArraySize(o.timelinesRotation,f<<1,null);for(var y=o.timelinesRotation,E=0;E<f;E++){var b=p[E],M=x[E]==t.SUBSEQUENT?l:exports.MixBlend.setup;h(b,P)?this.applyRotateTimeline(b,e,d,u,M,y,E<<1,w):h(b,N)?this.applyAttachmentTimeline(b,e,d,l,!0):(m.webkit602BugfixHelper(u,l),b.apply(e,c,d,r,u,M,exports.MixDirection.mixIn))}}this.queueEvents(o,d),r.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}}for(var S=this.unkeyedState+t.SETUP,T=e.slots,A=0,I=e.slots.length;A<I;A++){var R=T[A];if(R.attachmentState==S){var C=R.data.attachmentName;R.attachment=null==C?null:e.getAttachment(R.data.index,C)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,r,n){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,r,n);var i=0;0==e.mixDuration?(i=1,n==exports.MixBlend.first&&(n=exports.MixBlend.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),n!=exports.MixBlend.first&&(n=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,l=i<a.drawOrderThreshold,u=a.animationLast,c=a.getAnimationTime(),d=a.animation.timelines.length,f=a.animation.timelines,p=a.alpha*e.interruptAlpha,v=p*(1-i);if(n==exports.MixBlend.add)for(var g=0;g<d;g++)f[g].apply(r,u,c,s,v,n,exports.MixDirection.mixOut);else{var x=a.timelineMode,w=a.timelineHoldMix,y=0==a.timelinesRotation.length;y&&m.setArraySize(a.timelinesRotation,d<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var b=0;b<d;b++){var M=f[b],S=exports.MixDirection.mixOut,T=void 0,A=0;switch(x[b]){case t.SUBSEQUENT:if(!l&&h(M,X))continue;T=n,A=v;break;case t.FIRST:T=exports.MixBlend.setup,A=v;break;case t.HOLD_SUBSEQUENT:T=n,A=p;break;case t.HOLD_FIRST:T=exports.MixBlend.setup,A=p;break;default:T=exports.MixBlend.setup;var I=w[b];A=p*Math.max(0,1-I.mixTime/I.mixDuration)}a.totalAlpha+=A,h(M,P)?this.applyRotateTimeline(M,r,c,A,T,E,b<<1,y):h(M,N)?this.applyAttachmentTimeline(M,r,c,T,o):(m.webkit602BugfixHelper(A,n),l&&h(M,X)&&T==exports.MixBlend.setup&&(S=exports.MixDirection.mixIn),M.apply(r,u,c,s,A,T,S))}}return e.mixDuration>0&&this.queueEvents(a,c),this.events.length=0,a.nextAnimationLast=c,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,r,n,a,i){var s=r.slots[e.slotIndex];if(s.bone.active){var o,l=e.frames;if(n<l[0])a!=exports.MixBlend.setup&&a!=exports.MixBlend.first||this.setAttachment(r,s,s.data.attachmentName,i);else o=n>=l[l.length-1]?l.length-1:R.binarySearch(l,n)-1,this.setAttachment(r,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,r,n,a){r.attachment=null==n?null:e.getAttachment(r.data.index,n),a&&(r.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,r,n,a,i,s,o){if(o&&(i[s]=0),1!=n){var l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var c=0,f=0;if(r<h[0])switch(a){case exports.MixBlend.setup:u.rotation=u.data.rotation;default:return;case exports.MixBlend.first:c=u.rotation,f=u.data.rotation}else if(c=a==exports.MixBlend.setup?u.data.rotation:u.rotation,r>=h[h.length-P.ENTRIES])f=u.data.rotation+h[h.length+P.PREV_ROTATION];else{var p=R.binarySearch(h,r,P.ENTRIES),v=h[p+P.PREV_ROTATION],m=h[p],g=l.getCurvePercent((p>>1)-1,1-(r-m)/(h[p+P.PREV_TIME]-m));f=h[p+P.ROTATION]-v,f=v+(f-=360*(16384-(16384.499999999996-f/360|0)))*g+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var x=0,w=f-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))x=i[s];else{var y=0,E=0;o?(y=0,E=w):(y=i[s],E=i[s+1]);var b=w>0,M=y>=0;d.signum(E)!=d.signum(w)&&Math.abs(E)<=90&&(Math.abs(y)>180&&(y+=360*d.signum(y)),M=b),x=w+y-y%360,M!=b&&(x+=360*d.signum(y)),i[s]=x}i[s+1]=w,c+=x*n,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,r,null,1,a,exports.MixDirection.mixIn)},e.queueEvents=function(t,e){for(var r=t.animationStart,n=t.animationEnd,a=n-r,i=t.trackLast%a,s=this.events,o=0,l=s.length;o<l;o++){var h=s[o];if(h.time<i)break;h.time>n||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=n&&t.animationLast<n)&&this.queue.complete(t);o<l;o++){s[o].time<r||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,r=this.tracks.length;e<r;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var r=e;;){var n=r.mixingFrom;if(null==n)break;this.queue.end(n),r.mixingFrom=null,r.mixingTo=null,r=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,r){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(r&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,r){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,r)},e.setAnimationWith=function(t,e,r){if(null==e)throw new Error("animation cannot be null.");var n=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,n=!1):this.disposeNext(a));var i=this.trackEntry(t,e,r,a);return this.setCurrent(t,i,n),this.queue.drain(),i},e.addAnimation=function(t,e,r,n){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,r,n)},e.addAnimationWith=function(t,e,r,n){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,r,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,n<=0){var s=a.animationEnd-a.animationStart;0!=s?(a.loop?n+=s*(1+(a.trackTime/s|0)):n+=Math.max(s,a.trackTime),n-=this.data.getMix(a.animation,e)):n=a.trackTime}return i.delay=n,i},e.setEmptyAnimation=function(e,r){var n=this.setAnimationWith(e,t.emptyAnimation,!1);return n.mixDuration=r,n.trackEnd=r,n},e.addEmptyAnimation=function(e,r,n){n<=0&&(n-=r);var a=this.addAnimationWith(e,t.emptyAnimation,!1,n);return a.mixDuration=r,a.trackEnd=r,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var r=0,n=this.tracks.length;r<n;r++){var a=this.tracks[r];null!=a&&this.setEmptyAnimation(a.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(m.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,r,n){var a=this.trackEntryPool.obtain();return a.trackIndex=t,a.animation=e,a.loop=r,a.holdPrevious=!1,a.eventThreshold=0,a.attachmentThreshold=0,a.drawOrderThreshold=0,a.animationStart=0,a.animationEnd=e.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.interruptAlpha=1,a.mixTime=0,a.mixDuration=null==n?0:this.data.getMix(n.animation,e),a.mixBlend=exports.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 r=this.tracks[t];if(null!=r){for(;null!=r.mixingFrom;)r=r.mixingFrom;do{null!=r.mixingFrom&&r.mixBlend==exports.MixBlend.add||this.computeHold(r),r=r.mixingTo}while(null!=r)}}},e.computeHold=function(e){var r=e.mixingTo,n=e.animation.timelines,a=e.animation.timelines.length,i=m.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=m.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=r&&r.holdPrevious)for(var l=0;l<a;l++)i[l]=o.add(n[l].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var u=0;u<a;u++){var c=n[u],d=c.getPropertyId();if(o.add(d))if(null==r||h(c,N)||h(c,X)||h(c,L)||!r.animation.hasTimeline(d))i[u]=t.FIRST;else{for(var f=r.mixingTo;null!=f;f=f.mixingTo)if(!f.animation.hasTimeline(d)){if(e.mixDuration>0){i[u]=t.HOLD_MIX,s[u]=f;continue t}break}i[u]=t.HOLD_FIRST}else i[u]=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}();j.emptyAnimation=new R("<empty>",[],0),j.SUBSEQUENT=0,j.FIRST=1,j.HOLD_SUBSEQUENT=2,j.HOLD_FIRST=3,j.HOLD_MIX=4,j.SETUP=1,j.CURRENT=2;var G,z=function(){function t(){this.mixBlend=exports.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}(),Z=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,r=0;r<t.length;r+=2){var n=t[r],a=t[r+1];switch(n){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var h=0;h<e.length;h++)e[h].complete&&e[h].complete(a);break;case 5:var u=t[2+r++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();exports.EventType=void 0,(G=exports.EventType||(exports.EventType={}))[G.start=0]="start",G[G.interrupt=1]="interrupt",G[G.end=2]="end",G[G.dispose=3]="dispose",G[G.complete=4]="complete",G[G.event=5]="event";var Q=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}(),J=function(){function t(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}var e=t.prototype;return e.setMix=function(t,e,r){var n=this.skeletonData.findAnimation(t);if(null==n)throw new Error("Animation not found: "+t);var a=this.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);this.setMixWith(n,a,r)},e.setMixWith=function(t,e,r){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");var n=t.name+"."+e.name;this.animationToMixTime[n]=r},e.getMix=function(t,e){var r=t.name+"."+e.name,n=this.animationToMixTime[r];return void 0===n?this.defaultMix:n},t}();function K(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $(t,e,r){return e&&K(t.prototype,e),r&&K(t,r),t}var tt,et,rt=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}();exports.TextureFilter=void 0,(tt=exports.TextureFilter||(exports.TextureFilter={}))[tt.Nearest=9728]="Nearest",tt[tt.Linear=9729]="Linear",tt[tt.MipMap=9987]="MipMap",tt[tt.MipMapNearestNearest=9984]="MipMapNearestNearest",tt[tt.MipMapLinearNearest=9985]="MipMapLinearNearest",tt[tt.MipMapNearestLinear=9986]="MipMapNearestLinear",tt[tt.MipMapLinearLinear=9987]="MipMapLinearLinear",exports.TextureWrap=void 0,(et=exports.TextureWrap||(exports.TextureWrap={}))[et.MirroredRepeat=33648]="MirroredRepeat",et[et.ClampToEdge=33071]="ClampToEdge",et[et.Repeat=10497]="Repeat";var nt=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},at=function(t){function e(){return t.apply(this,arguments)}a(e,t);var r=e.prototype;return r.setFilters=function(t,e){},r.setWraps=function(t,e){},r.dispose=function(){},e}(rt),it=function(){function t(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}var e=t.prototype;return e.load=function(t,e){if(null==e)throw new Error("textureLoader cannot be null.");for(var r=new st(t),n=new Array(4),a=null;;){var i=r.readLine();if(null==i)break;if(0==(i=i.trim()).length)a=null;else if(a){var s=new lt;s.name=i,s.page=a;var o=r.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,r.readTuple(n);var l=parseInt(n[0]),h=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+c)/a.width,s.v2=(h+u)/a.height):(s.u2=(l+u)/a.width,s.v2=(h+c)/a.height),s.x=l,s.y=h,s.width=Math.abs(u),s.height=Math.abs(c),4==r.readTuple(n)&&4==r.readTuple(n)&&r.readTuple(n),s.originalWidth=parseInt(n[0]),s.originalHeight=parseInt(n[1]),r.readTuple(n),s.offsetX=parseInt(n[0]),s.offsetY=parseInt(n[1]),s.index=parseInt(r.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new ot).name=i,2==r.readTuple(n)&&(a.width=parseInt(n[0]),a.height=parseInt(n[1]),r.readTuple(n)),r.readTuple(n),a.minFilter=rt.filterFromString(n[0]),a.magFilter=rt.filterFromString(n[1]);var d=r.readValue();a.uWrap=exports.TextureWrap.ClampToEdge,a.vWrap=exports.TextureWrap.ClampToEdge,"x"==d?a.uWrap=exports.TextureWrap.Repeat:"y"==d?a.vWrap=exports.TextureWrap.Repeat:"xy"==d&&(a.uWrap=a.vWrap=exports.TextureWrap.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}(),st=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}var e=t.prototype;return e.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},e.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},e.readTuple=function(t){var e=this.readLine(),r=e.indexOf(":");if(-1==r)throw new Error("Invalid line: "+e);for(var n=0,a=r+1;n<3;n++){var i=e.indexOf(",",a);if(-1==i)break;t[n]=e.substr(a,i-a).trim(),a=i+1}return t[n]=e.substring(a).trim(),n+1},t}(),ot=function(){},lt=function(t){function e(){return t.apply(this,arguments)}return a(e,t),e}(nt),ht=function(){function e(t,e,r){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this._engine=t,this.pathPrefix=e||"",this.textureLoader=r}var r=e.prototype;return r.downloadText=function(e,r,n){t.request(e,{type:"text"}).then((function(t){r(t)})).catch((function(t){n(t)}))},r.downloadBinary=function(t,e,r){var n=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status?e(new Uint8Array(n.response)):r(n.status,n.responseText)},n.onerror=function(){r(n.status,n.responseText)},n.send()},r.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},r.loadBinary=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null),t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e,a){n.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,r&&r("Couldn't load binary "+t+": status "+status+", "+a),n.onLoad(),n.loaded++}))},r.loadText=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null),t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e){n.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),r&&r("Couldn't load text "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},r.loadImage=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null);var a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(r){n.assets[a]=i,n.onLoad(),n.loaded++,e&&e(t,i)},i.onerror=function(e){n.errors[t]="Couldn't load image "+t,n.onLoad(),n.loaded++,r&&r("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},r.loadTexture=function(e,r,n){var a=this;void 0===r&&(r=null),void 0===n&&(n=null);var i=e=this.pathPrefix+e;this.toLoad++,this.rawDataUris[e]&&(e=this.rawDataUris[e]),t.request(e,{type:"image"}).then((function(t){var n=a.textureLoader(t);a.assets[i]=n,a.onLoad(),a.loaded++,r&&r(e,n)})).catch((function(t){n(t)}))},r.loadEngineTexture=function(t,e,r,n){var a=this;void 0===r&&(r=null),void 0===n&&(n=null);var i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),this.engine.resourceManager.load({url:t,type:e}).then((function(e){var n=a.textureLoader(e);a.assets[i]=n,a.onLoad(),a.loaded++,r&&r(t,n)})).catch((function(t){n(t)}))},r.loadTextureAtlas=function(t,e,r){var n=this;void 0===e&&(e=null),void 0===r&&(r=null);var a=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(i){var s=function(){var s=c.value,l=!1;n.loadTexture(s,(function(s,u){if(o.count++,o.count==h.length)if(l)n.errors[t]="Couldn't load texture atlas page "+s+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+s+" of atlas "+t),n.onLoad(),n.loaded++;else try{var c=new it(i,(function(t){return n.get(""==a?t:a+"/"+t)}));n.assets[t]=c,e&&e(t,c),n.onLoad(),n.loaded++}catch(e){var d=e;n.errors[t]="Couldn't load texture atlas "+t+": "+d.message,r&&r("Couldn't load texture atlas "+t+": "+d.message),n.onLoad(),n.loaded++}}),(function(e){l=!0,o.count++,o.count==h.length&&(n.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),n.onLoad(),n.loaded++)}))},o={count:0},h=new Array;try{new it(i,(function(t){return h.push(""==a?t:a+"/"+t),new at(new Image)}))}catch(e){var u=e;return n.errors[t]="Couldn't load texture atlas "+t+": "+u.message,r&&r("Couldn't load texture atlas "+t+": "+u.message),n.onLoad(),void n.loaded++}for(var c,d=l(h);!(c=d()).done;)s()}),(function(e){n.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),r&&r("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},r.get=function(t){return t=this.pathPrefix+t,this.assets[t]},r.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},r.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},r.isLoadingComplete=function(){return 0==this.toLoad},r.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},r.getToLoad=function(){return this.toLoad},r.getLoaded=function(){return this.loaded},r.dispose=function(){this.removeAll()},r.hasErrors=function(){return Object.keys(this.errors).length>0},r.getErrors=function(){return this.errors},$(e,[{key:"engine",get:function(){return this._engine}}]),e}(),ut=function(t){function e(e){var r;return(r=t.call(this,e)||this).x=0,r.y=0,r.scaleX=1,r.scaleY=1,r.rotation=0,r.width=0,r.height=0,r.color=new c(1,1,1,1),r.offset=m.newFloatArray(8),r.uvs=m.newFloatArray(8),r.tempColor=new c(1,1,1,1),r}a(e,t);var r=e.prototype;return r.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*r,i=n+this.region.width*t,s=a+this.region.height*r,o=this.rotation*Math.PI/180,l=Math.cos(o),h=Math.sin(o),u=n*l+this.x,c=n*h,d=a*l+this.y,f=a*h,p=i*l+this.x,v=i*h,m=s*l+this.y,g=s*h,x=this.offset;x[e.OX1]=u-f,x[e.OY1]=d+c,x[e.OX2]=u-g,x[e.OY2]=m+c,x[e.OX3]=p-g,x[e.OY3]=m+v,x[e.OX4]=p-f,x[e.OY4]=d+v},r.setRegion=function(t){this.region=t;var e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)},r.computeWorldVertices=function(t,r,n,a){var i=this.offset,s=t.worldX,o=t.worldY,l=t.a,h=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX2],f=i[e.OY2],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX3],f=i[e.OY3],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX4],f=i[e.OY4],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o},r.copy=function(){var t=new e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,m.arrayCopy(this.uvs,0,t.uvs,0,8),m.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(M);ut.OX1=0,ut.OY1=1,ut.OX2=2,ut.OY2=3,ut.OX3=4,ut.OY3=5,ut.OX4=6,ut.OY4=7,ut.X1=0,ut.Y1=1,ut.C1R=2,ut.C1G=3,ut.C1B=4,ut.C1A=5,ut.U1=6,ut.V1=7,ut.X2=8,ut.Y2=9,ut.C2R=10,ut.C2G=11,ut.C2B=12,ut.C2A=13,ut.U2=14,ut.V2=15,ut.X3=16,ut.Y3=17,ut.C3R=18,ut.C3G=19,ut.C3B=20,ut.C3A=21,ut.U3=22,ut.V3=23,ut.X4=24,ut.Y4=25,ut.C4R=26,ut.C4G=27,ut.C4B=28,ut.C4A=29,ut.U4=30,ut.V4=31;var ct,dt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new c(1,1,1,1),r.tempColor=new c(0,0,0,0),r}a(e,t);var r=e.prototype;return r.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=m.newFloatArray(t.length));var e=this.uvs,r=this.uvs.length,n=this.region.u,a=this.region.v,i=0,s=0;if(h(this.region,lt)){var o=this.region,l=o.texture.getImage().width,u=o.texture.getImage().height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/l,a-=(o.originalWidth-o.offsetX-o.width)/u,i=o.originalHeight/l,s=o.originalWidth/u;for(var c=0;c<r;c+=2)e[c]=n+t[c+1]*i,e[c+1]=a+(1-t[c])*s;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/l,a-=o.offsetY/u,i=o.originalWidth/l,s=o.originalHeight/u;for(var d=0;d<r;d+=2)e[d]=n+(1-t[d])*i,e[d+1]=a+(1-t[d+1])*s;return;case 270:n-=o.offsetY/l,a-=o.offsetX/u,i=o.originalHeight/l,s=o.originalWidth/u;for(var f=0;f<r;f+=2)e[f]=n+(1-t[f+1])*i,e[f+1]=a+t[f]*s;return}n-=o.offsetX/l,a-=(o.originalHeight-o.offsetY-o.height)/u,i=o.originalWidth/l,s=o.originalHeight/u}else null==this.region?(n=a=0,i=s=1):(i=this.region.u2-n,s=this.region.v2-a);for(var p=0;p<r;p+=2)e[p]=n+t[p]*i,e[p+1]=a+t[p+1]*s},r.getParentMesh=function(){return this.parentMesh},r.setParentMesh=function(t){this.parentMesh=t,null!=t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)},r.copy=function(){if(null!=this.parentMesh)return this.newLinkedMesh();var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),m.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),m.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),m.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),m.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},r.newLinkedMesh=function(){var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(null!=this.parentMesh?this.parentMesh:this),t.updateUVs(),t},e}(S),ft=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new c(1,1,1,1),r}return a(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(S),pt=function(t){function e(e){var r;return(r=t.call(this,e)||this).closed=!1,r.constantSpeed=!1,r.color=new c(1,1,1,1),r}return a(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),m.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(S),vt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new c(.38,.94,0,1),r.name=e,r}a(e,t);var r=e.prototype;return r.computeWorldPosition=function(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e},r.computeWorldRotation=function(t){var e=d.cosDeg(this.rotation),r=d.sinDeg(this.rotation),n=e*t.a+r*t.b,a=e*t.c+r*t.d;return Math.atan2(a,n)*d.radDeg},r.copy=function(){var t=new e(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t},e}(S),mt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new c(.2275,.2275,.8078,1),r}return a(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}(S),gt=function(){function t(t){this.atlas=t}var e=t.prototype;return e.newRegionAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (region attachment: "+e+")");n.renderObject=n;var a=new ut(e);return a.setRegion(n),a},e.newMeshAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+e+")");n.renderObject=n;var a=new dt(e);return a.region=n,a},e.newBoundingBoxAttachment=function(t,e){return new ft(e)},e.newPathAttachment=function(t,e){return new pt(e)},e.newPointAttachment=function(t,e){return new vt(e)},e.newClippingAttachment=function(t,e){return new mt(e)},t}();exports.BlendMode=void 0,(ct=exports.BlendMode||(exports.BlendMode={}))[ct.Normal=0]="Normal",ct[ct.Additive=1]="Additive",ct[ct.Multiply=2]="Multiply",ct[ct.Screen=3]="Screen";var xt,wt=function(t,e,r){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=0,this.skinRequired=!1,this.color=new c,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=r};exports.TransformMode=void 0,(xt=exports.TransformMode||(exports.TransformMode={}))[xt.Normal=0]="Normal",xt[xt.OnlyTranslation=1]="OnlyTranslation",xt[xt.NoRotationOrReflection=2]="NoRotationOrReflection",xt[xt.NoScale=3]="NoScale",xt[xt.NoScaleOrReflection=4]="NoScaleOrReflection";var yt,Et,bt,Mt=function(){function t(t,e,r){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=r,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,r,n,a,i,s){this.ax=t,this.ay=e,this.arotation=r,this.ascaleX=n,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var l=this.skeleton,h=r+90+s,u=l.scaleX,c=l.scaleY;return this.a=d.cosDeg(r+i)*n*u,this.b=d.cosDeg(h)*a*u,this.c=d.sinDeg(r+i)*n*c,this.d=d.sinDeg(h)*a*c,this.worldX=t*u+l.x,void(this.worldY=e*c+l.y)}var f=o.a,p=o.b,v=o.c,m=o.d;switch(this.worldX=f*t+p*e+o.worldX,this.worldY=v*t+m*e+o.worldY,this.data.transformMode){case exports.TransformMode.Normal:var g=r+90+s,x=d.cosDeg(r+i)*n,w=d.cosDeg(g)*a,y=d.sinDeg(r+i)*n,E=d.sinDeg(g)*a;return this.a=f*x+p*y,this.b=f*w+p*E,this.c=v*x+m*y,void(this.d=v*w+m*E);case exports.TransformMode.OnlyTranslation:var b=r+90+s;this.a=d.cosDeg(r+i)*n,this.b=d.cosDeg(b)*a,this.c=d.sinDeg(r+i)*n,this.d=d.sinDeg(b)*a;break;case exports.TransformMode.NoRotationOrReflection:var M=f*f+v*v,S=0;M>1e-4?(M=Math.abs(f*m-p*v)/M,f/=this.skeleton.scaleX,p=(v/=this.skeleton.scaleY)*M,m=f*M,S=Math.atan2(v,f)*d.radDeg):(f=0,v=0,S=90-Math.atan2(m,p)*d.radDeg);var T=r+i-S,A=r+s-S+90,I=d.cosDeg(T)*n,R=d.cosDeg(A)*a,C=d.sinDeg(T)*n,P=d.sinDeg(A)*a;this.a=f*I-p*C,this.b=f*R-p*P,this.c=v*I+m*C,this.d=v*R+m*P;break;case exports.TransformMode.NoScale:case exports.TransformMode.NoScaleOrReflection:var V=d.cosDeg(r),_=d.sinDeg(r),k=(f*V+p*_)/this.skeleton.scaleX,F=(v*V+m*_)/this.skeleton.scaleY,B=Math.sqrt(k*k+F*F);B>1e-5&&(B=1/B),k*=B,F*=B,B=Math.sqrt(k*k+F*F),this.data.transformMode==exports.TransformMode.NoScale&&f*m-p*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(B=-B);var N=Math.PI/2+Math.atan2(F,k),O=Math.cos(N)*B,D=Math.sin(N)*B,L=d.cosDeg(i)*n,X=d.cosDeg(90+s)*a,Y=d.sinDeg(i)*n,W=d.sinDeg(90+s)*a;this.a=k*L+O*Y,this.b=k*X+O*W,this.c=F*L+D*Y,this.d=F*X+D*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*d.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*d.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)*d.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)*d.radDeg);var e=t.a,r=t.b,n=t.c,a=t.d,i=1/(e*a-r*n),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*r*i,this.ay=o*e*i-s*n*i;var l=i*a,h=i*e,u=i*r,c=i*n,f=l*this.a-u*this.c,p=l*this.b-u*this.d,v=h*this.c-c*this.a,m=h*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+v*v),this.ascaleX>1e-4){var g=f*m-p*v;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(f*p+v*m,g)*d.radDeg,this.arotation=Math.atan2(v,f)*d.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(p*p+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,p)*d.radDeg},e.worldToLocal=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=1/(e*a-r*n),s=t.x-this.worldX,o=t.y-this.worldY;return t.x=s*a*i-o*r*i,t.y=o*e*i-s*n*i,t},e.localToWorld=function(t){var e=t.x,r=t.y;return t.x=e*this.a+r*this.b+this.worldX,t.y=e*this.c+r*this.d+this.worldY,t},e.worldToLocalRotation=function(t){var e=d.sinDeg(t),r=d.cosDeg(t);return Math.atan2(this.a*e-this.c*r,this.d*r-this.b*e)*d.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=d.sinDeg(t),r=d.cosDeg(t);return Math.atan2(r*this.c+e*this.d,r*this.a+e*this.b)*d.radDeg},e.rotateWorld=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=d.cosDeg(t),s=d.sinDeg(t);this.a=i*e-s*n,this.b=i*r-s*a,this.c=s*e+i*n,this.d=s*r+i*a,this.appliedValid=!1},t}(),St=function(t,e,r){this.name=t,this.order=e,this.skinRequired=r},Tt=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},At=function(t){this.name=t},It=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix)}},e.apply1=function(t,e,r,n,a,i,s){t.appliedValid||t.updateAppliedTransform();var o=t.parent,l=o.a,h=o.b,u=o.c,c=o.d,f=-t.ashearX-t.arotation,p=0,v=0;switch(t.data.transformMode){case exports.TransformMode.OnlyTranslation:p=e-t.worldX,v=r-t.worldY;break;case exports.TransformMode.NoRotationOrReflection:var m=Math.abs(l*c-h*u)/(l*l+u*u),g=l/t.skeleton.scaleX,x=u/t.skeleton.scaleY;h=-x*m*t.skeleton.scaleX,c=g*m*t.skeleton.scaleY,f+=Math.atan2(x,g)*d.radDeg;default:var w=e-o.worldX,y=r-o.worldY,E=l*c-h*u;p=(w*c-y*h)/E-t.ax,v=(y*l-w*u)/E-t.ay}f+=Math.atan2(v,p)*d.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);var b=t.ascaleX,M=t.ascaleY;if(n||a){switch(t.data.transformMode){case exports.TransformMode.NoScale:case exports.TransformMode.NoScaleOrReflection:p=e-t.worldX,v=r-t.worldY}var S=t.data.length*b,T=Math.sqrt(p*p+v*v);if(n&&T<S||a&&T>S&&S>1e-4){var A=(T/S-1)*s+1;b*=A,i&&(M*=A)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*s,b,M,t.ashearX,t.ashearY)},e.apply2=function(t,e,r,n,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var l=t.ax,h=t.ay,u=t.ascaleX,c=u,f=t.ascaleY,p=e.ascaleX,v=0,m=0,g=0;u<0?(u=-u,v=180,g=-1):(v=0,g=1),f<0&&(f=-f,g=-g),p<0?(p=-p,m=180):m=0;var x=e.ax,w=0,y=0,E=0,b=t.a,M=t.b,S=t.c,T=t.d,A=Math.abs(u-f)<=1e-4;A?(y=b*x+M*(w=e.ay)+t.worldX,E=S*x+T*w+t.worldY):(w=0,y=b*x+t.worldX,E=S*x+t.worldY);var I=t.parent;b=I.a,M=I.b,S=I.c;var R,C,P=1/(b*(T=I.d)-M*S),V=y-I.worldX,_=E-I.worldY,k=(V*T-_*M)*P-l,F=(_*b-V*S)*P-h,B=Math.sqrt(k*k+F*F),N=e.data.length*p;if(B<1e-4)return this.apply1(t,r,n,!1,i,!1,o),void e.updateWorldTransformWith(x,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var O=((V=r-I.worldX)*T-(_=n-I.worldY)*M)*P-l,D=(_*b-V*S)*P-h,L=O*O+D*D;if(0!=s){s*=u*(p+1)/2;var X=Math.sqrt(L),Y=X-B-N*u+s;if(Y>0){var W=Math.min(1,Y/(2*s))-1;L=(O-=(W=(Y-s*(1-W*W))/X)*O)*O+(D-=W*D)*D}}t:if(A){var U=(L-B*B-(N*=u)*N)/(2*B*N);U<-1?U=-1:U>1&&(U=1,i&&(c*=(Math.sqrt(L)/(B+N)-1)*o+1)),C=Math.acos(U)*a,b=B+N*U,M=N*Math.sin(C),R=Math.atan2(D*b-O*M,O*b+D*M)}else{var q=(b=u*N)*b,H=(M=f*N)*M,j=Math.atan2(D,O),G=-2*H*B,z=H-q;if((T=G*G-4*z*(S=H*B*B+q*L-q*H))>=0){var Z=Math.sqrt(T);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<=L){_=Math.sqrt(L-K*K)*a,R=j-Math.atan2(_,K),C=Math.atan2(_/f,(K-B)/u);break t}}var $=d.PI,tt=B-b,et=tt*tt,rt=0,nt=0,at=B+b,it=at*at,st=0;(S=-b*B/(q-H))>=-1&&S<=1&&(S=Math.acos(S),(T=(V=b*Math.cos(S)+B)*V+(_=M*Math.sin(S))*_)<et&&($=S,et=T,tt=V,rt=_),T>it&&(nt=S,it=T,at=V,st=_)),L<=(et+it)/2?(R=j-Math.atan2(rt*a,tt),C=$*a):(R=j-Math.atan2(st*a,at),C=nt*a)}var ot=Math.atan2(w,x)*g,lt=t.arotation;(R=(R-ot)*d.radDeg+v-lt)>180?R-=360:R<-180&&(R+=360),t.updateWorldTransformWith(l,h,lt+R*o,c,t.ascaleY,0,0),lt=e.arotation,(C=((C+ot)*d.radDeg-e.ashearX)*g+m-lt)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(x,w,lt+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),Rt=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.bendDirection=1,r.compress=!1,r.stretch=!1,r.uniform=!1,r.mix=1,r.softness=0,r}return a(e,t),e}(St),Ct=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r}return a(e,t),e}(St);exports.PositionMode=void 0,(yt=exports.PositionMode||(exports.PositionMode={}))[yt.Fixed=0]="Fixed",yt[yt.Percent=1]="Percent",exports.SpacingMode=void 0,(Et=exports.SpacingMode||(exports.SpacingMode={}))[Et.Length=0]="Length",Et[Et.Fixed=1]="Fixed",Et[Et.Percent=2]="Percent",exports.RotateMode=void 0,(bt=exports.RotateMode||(exports.RotateMode={}))[bt.Tangent=0]="Tangent",bt[bt.Chain=1]="Chain",bt[bt.ChainScale=2]="ChainScale";var Pt,Vt=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var r=0,n=t.bones.length;r<n;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(h(e,pt)){var r=this.rotateMix,n=this.translateMix,a=r>0;if(n>0||a){var i=this.data,s=i.spacingMode==exports.SpacingMode.Percent,o=i.rotateMode,l=o==exports.RotateMode.Tangent,u=o==exports.RotateMode.ChainScale,c=this.bones.length,f=l?c:c+1,p=this.bones,v=m.setArraySize(this.spaces,f),g=null,x=this.spacing;if(u||!s){u&&(g=m.setArraySize(this.lengths,c));for(var w=i.spacingMode==exports.SpacingMode.Length,y=0,E=f-1;y<E;){var b=p[y],M=b.data.length;if(M<t.epsilon)u&&(g[y]=0),v[++y]=0;else if(s){if(u){var S=M*b.a,T=M*b.c,A=Math.sqrt(S*S+T*T);g[y]=A}v[++y]=x}else{var I=M*b.a,R=M*b.c,C=Math.sqrt(I*I+R*R);u&&(g[y]=C),v[++y]=(w?M+x:x)*C/M}}}else for(var P=1;P<f;P++)v[P]=x;var V=this.computeWorldPositions(e,f,l,i.positionMode==exports.PositionMode.Percent,s),_=V[0],k=V[1],F=i.offsetRotation,B=!1;if(0==F)B=o==exports.RotateMode.Chain;else{B=!1;var N=this.target.bone;F*=N.a*N.d-N.b*N.c>0?d.degRad:-d.degRad}for(var O=0,D=3;O<c;O++,D+=3){var L=p[O];L.worldX+=(_-L.worldX)*n,L.worldY+=(k-L.worldY)*n;var X=V[D],Y=V[D+1],W=X-_,U=Y-k;if(u){var q=g[O];if(0!=q){var H=(Math.sqrt(W*W+U*U)/q-1)*r+1;L.a*=H,L.c*=H}}if(_=X,k=Y,a){var j=L.a,G=L.b,z=L.c,Z=L.d,Q=0,J=0,K=0;if(Q=l?V[D-1]:0==v[O+1]?V[D+2]:Math.atan2(U,W),Q-=Math.atan2(z,j),B){J=Math.cos(Q),K=Math.sin(Q);var $=L.data.length;_+=($*(J*j-K*z)-W)*r,k+=($*(K*j+J*z)-U)*r}else Q+=F;Q>d.PI?Q-=d.PI2:Q<-d.PI&&(Q+=d.PI2),Q*=r,J=Math.cos(Q),K=Math.sin(Q),L.a=J*j-K*z,L.b=J*G-K*Z,L.c=K*j+J*z,L.d=K*G+J*Z}L.appliedValid=!1}}}},e.computeWorldPositions=function(e,r,n,a,i){var s=this.target,o=this.position,l=this.spaces,h=m.setArraySize(this.positions,3*r+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,p=t.NONE;if(!e.constantSpeed){var v=e.lengths,g=v[f-=c?1:2];if(a&&(o*=g),i)for(var x=1;x<r;x++)l[x]*=g;u=m.setArraySize(this.world,8);for(var w=0,y=0,E=0;w<r;w++,y+=3){var b=l[w],M=o+=b;if(c)(M%=g)<0&&(M+=g),E=0;else{if(M<0){p!=t.BEFORE&&(p=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(M,u,0,h,y);continue}if(M>g){p!=t.AFTER&&(p=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(M-g,u,0,h,y);continue}}for(;;E++){var S=v[E];if(!(M>S)){if(0==E)M/=S;else{var T=v[E-1];M=(M-T)/(S-T)}break}}E!=p&&(p=E,c&&E==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*E+2,8,u,0,2)),this.addCurvePosition(M,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,y,n||w>0&&0==b)}return h}c?(d+=2,u=m.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=m.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var A=m.setArraySize(this.curves,f),I=0,R=u[0],C=u[1],P=0,V=0,_=0,k=0,F=0,B=0,N=0,O=0,D=0,L=0,X=0,Y=0,W=0,U=0,q=0,H=2;q<f;q++,H+=6)P=u[H],V=u[H+1],_=u[H+2],k=u[H+3],X=2*(N=.1875*(R-2*P+_))+(D=.09375*(3*(P-_)-R+(F=u[H+4]))),Y=2*(O=.1875*(C-2*V+k))+(L=.09375*(3*(V-k)-C+(B=u[H+5]))),W=.75*(P-R)+N+.16666667*D,U=.75*(V-C)+O+.16666667*L,I+=Math.sqrt(W*W+U*U),W+=X,U+=Y,X+=D,Y+=L,I+=Math.sqrt(W*W+U*U),W+=X,U+=Y,I+=Math.sqrt(W*W+U*U),W+=X+D,U+=Y+L,I+=Math.sqrt(W*W+U*U),A[q]=I,R=F,C=B;if(o*=a?I:I/e.lengths[f-1],i)for(var j=1;j<r;j++)l[j]*=I;for(var G=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<r;Z++,Q+=3){var $=l[Z],tt=o+=$;if(c)(tt%=I)<0&&(tt+=I),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>I){this.addAfterPosition(tt-I,u,d-4,h,Q);continue}}for(;;J++){var et=A[J];if(!(tt>et)){if(0==J)tt/=et;else{var rt=A[J-1];tt=(tt-rt)/(et-rt)}break}}if(J!=p){p=J;var nt=6*J;for(R=u[nt],C=u[nt+1],P=u[nt+2],V=u[nt+3],_=u[nt+4],k=u[nt+5],X=2*(N=.03*(R-2*P+_))+(D=.006*(3*(P-_)-R+(F=u[nt+6]))),Y=2*(O=.03*(C-2*V+k))+(L=.006*(3*(V-k)-C+(B=u[nt+7]))),W=.3*(P-R)+N+.16666667*D,U=.3*(V-C)+O+.16666667*L,z=Math.sqrt(W*W+U*U),G[0]=z,nt=1;nt<8;nt++)W+=X,U+=Y,X+=D,Y+=L,z+=Math.sqrt(W*W+U*U),G[nt]=z;W+=X,U+=Y,z+=Math.sqrt(W*W+U*U),G[8]=z,W+=X+D,U+=Y+L,z+=Math.sqrt(W*W+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,R,C,P,V,_,k,F,B,h,Q,n||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,r,n,a){var i=e[r],s=e[r+1],o=e[r+2]-i,l=e[r+3]-s,h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addAfterPosition=function(t,e,r,n,a){var i=e[r+2],s=e[r+3],o=i-e[r],l=s-e[r+1],h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addCurvePosition=function(t,e,r,n,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=r,void(h[u+2]=Math.atan2(a-r,n-e));var d=t*t,f=d*t,p=1-t,v=p*p,m=v*p,g=p*t,x=3*g,w=p*x,y=x*t,E=e*m+n*w+i*y+o*f,b=r*m+a*w+s*y+l*f;h[u]=E,h[u+1]=b,c&&(h[u+2]=t<.001?Math.atan2(a-r,n-e):Math.atan2(b-(r*v+a*g*2+s*d),E-(e*v+n*g*2+i*d)))},t}();Vt.NONE=-1,Vt.BEFORE=-2,Vt.AFTER=-3,Vt.epsilon=1e-5,Math.fround||(Math.fround=(Pt=new Float32Array(1),function(t){return Pt[0]=t,Pt[0]}));var _t,kt=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}(),Ft=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,r){var n=this.clientAssets[t];return null==n&&(n=new kt(t),this.clientAssets[t]=n),null!==e&&(n.textureLoader=e),n.toLoad.push(r),this.queuedAssets[r]!==r&&(this.queuedAssets[r]=r,!0)},e.loadText=function(t,e){var r=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?r.rawAssets[e]=n.responseText:r.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},e.loadJson=function(t,e){var r=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?r.rawAssets[e]=JSON.parse(n.responseText):r.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},e.loadTexture=function(t,e,r){var n=this;if(r=this.pathPrefix+r,this.queueAsset(t,e,r))if(!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts){fetch(r,{mode:"cors"}).then((function(t){return t.ok||(n.errors[r]="Couldn't load image "+r),t.blob()})).then((function(t){return createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(t){n.rawAssets[r]=t}))}else{var a=new Image;a.crossOrigin="anonymous",a.onload=function(t){n.rawAssets[r]=a},a.onerror=function(t){n.errors[r]="Couldn't load image "+r},a.src=r}},e.get=function(t,e){e=this.pathPrefix+e;var r=this.clientAssets[t];return null==r||r.assets[e]},e.updateClientAssets=function(t){for(var e=!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts,r=0;r<t.toLoad.length;r++){var n=t.toLoad[r],a=t.assets[n];if(null==a){var i=this.rawAssets[n];if(null==i)continue;e?h(i,ImageBitmap)?t.assets[n]=t.textureLoader(i):t.assets[n]=i:h(i,HTMLImageElement)?t.assets[n]=t.textureLoader(i):t.assets[n]=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}(),Bt=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 c,this.darkColor=null==t.darkColor?null:new c,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}(),Nt=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new w,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()},e.applyAbsoluteWorld=function(){for(var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?d.degRad:-d.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,f=this.bones,p=0,v=f.length;p<v;p++){var m=f[p],g=!1;if(0!=t){var x=m.a,w=m.b,y=m.c,E=m.d,b=Math.atan2(o,i)-Math.atan2(y,x)+u;b>d.PI?b-=d.PI2:b<-d.PI&&(b+=d.PI2),b*=t;var M=Math.cos(b),S=Math.sin(b);m.a=M*x-S*y,m.b=M*w-S*E,m.c=S*x+M*y,m.d=S*w+M*E,g=!0}if(0!=e){var T=this.temp;a.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),m.worldX+=(T.x-m.worldX)*e,m.worldY+=(T.y-m.worldY)*e,g=!0}if(r>0){var A=Math.sqrt(m.a*m.a+m.c*m.c),I=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(I-A+this.data.offsetScaleX)*r)/A),m.a*=A,m.c*=A,A=Math.sqrt(m.b*m.b+m.d*m.d),I=Math.sqrt(s*s+l*l),A>1e-5&&(A=(A+(I-A+this.data.offsetScaleY)*r)/A),m.b*=A,m.d*=A,g=!0}if(n>0){var R=m.b,C=m.d,P=Math.atan2(C,R),V=Math.atan2(l,s)-Math.atan2(o,i)-(P-Math.atan2(m.c,m.a));V>d.PI?V-=d.PI2:V<-d.PI&&(V+=d.PI2),V=P+(V+c)*n;var _=Math.sqrt(R*R+C*C);m.b=Math.cos(V)*_,m.d=Math.sin(V)*_,g=!0}g&&(m.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?d.degRad:-d.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,f=this.bones,p=0,v=f.length;p<v;p++){var m=f[p],g=!1;if(0!=t){var x=m.a,w=m.b,y=m.c,E=m.d,b=Math.atan2(o,i)+u;b>d.PI?b-=d.PI2:b<-d.PI&&(b+=d.PI2),b*=t;var M=Math.cos(b),S=Math.sin(b);m.a=M*x-S*y,m.b=M*w-S*E,m.c=S*x+M*y,m.d=S*w+M*E,g=!0}if(0!=e){var T=this.temp;a.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),m.worldX+=T.x*e,m.worldY+=T.y*e,g=!0}if(r>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*r+1;m.a*=A,m.c*=A,A=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,m.b*=A,m.d*=A,g=!0}if(n>0){var I=Math.atan2(l,s)-Math.atan2(o,i);I>d.PI?I-=d.PI2:I<-d.PI&&(I+=d.PI2);var R=m.b,C=m.d;I=Math.atan2(C,R)+(I-d.PI/2+c)*n;var P=Math.sqrt(R*R+C*C);m.b=Math.cos(I)*P,m.d=Math.sin(I)*P,g=!0}g&&(m.appliedValid=!1)}},e.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;if(0!=t){var u=a.arotation-h+this.data.offsetRotation;h+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=l.ax,d=l.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=l.ascaleX,p=l.ascaleY;0!=r&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*r)/f),p>1e-5&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*r)/p));var v=l.ashearY;if(0!=n){var m=a.ashearY-v+this.data.offsetShearY;m-=360*(16384-(16384.499999999996-m/360|0)),l.shearY+=m*n}l.updateWorldTransformWith(c,d,h,f,p,l.ashearX,v)}},e.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;0!=t&&(h+=(a.arotation+this.data.offsetRotation)*t);var u=l.ax,c=l.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=l.ascaleX,f=l.ascaleY;0!=r&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*r+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*r+1));var p=l.ashearY;0!=n&&(p+=(a.ashearY+this.data.offsetShearY)*n),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,p)}},t}(),Ot=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var r=t.bones[e],n=void 0;if(null==r.parent)n=new Mt(r,this,null);else{var a=this.bones[r.parent.index];n=new Mt(r,this,a),a.children.push(n)}this.bones.push(n)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],l=new Bt(s,o);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(var h=0;h<t.ikConstraints.length;h++){var u=t.ikConstraints[h];this.ikConstraints.push(new It(u,this))}this.transformConstraints=new Array;for(var d=0;d<t.transformConstraints.length;d++){var f=t.transformConstraints[d];this.transformConstraints.push(new Nt(f,this))}this.pathConstraints=new Array;for(var p=0;p<t.pathConstraints.length;p++){var v=t.pathConstraints[p];this.pathConstraints.push(new Vt(v,this))}this.color=new c(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){var t=this._updateCache;t.length=0,this.updateCacheReset.length=0;for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];a.sorted=a.data.skinRequired,a.active=!a.sorted}if(null!=this.skin)for(var i=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var l=this.bones[i[s].index];do{l.sorted=!1,l.active=!0,l=l.parent}while(null!=l)}var h=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=h.length,f=u.length,p=c.length,v=d+f+p;t:for(var m=0;m<v;m++){for(var g=0;g<d;g++){var x=h[g];if(x.data.order==m){this.sortIkConstraint(x);continue t}}for(var w=0;w<f;w++){var y=u[w];if(y.data.order==m){this.sortTransformConstraint(y);continue t}}for(var E=0;E<p;E++){var b=c[E];if(b.data.order==m){this.sortPathConstraint(b);continue t}}}for(var M=0,S=e.length;M<S;M++)this.sortBone(e[M])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&m.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var r=t.bones,n=r[0];if(this.sortBone(n),r.length>1){var a=r[r.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(n.children),r[r.length-1].sorted=!0}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&m.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,r=e.data.index,n=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,n),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,n);for(var a=0,i=this.data.skins.length;a<i;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,n);var s=e.getAttachment();h(s,pt)&&this.sortPathConstraintAttachmentWith(s,n);for(var o=t.bones,l=o.length,u=0;u<l;u++)this.sortBone(o[u]);this._updateCache.push(t);for(var c=0;c<l;c++)this.sortReset(o[c].children);for(var d=0;d<l;d++)o[d].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&m.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,r=e.length;if(t.data.local)for(var n=0;n<r;n++){var a=e[n];this.sortBone(a.parent),this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}else for(var i=0;i<r;i++)this.sortBone(e[i]);this._updateCache.push(t);for(var s=0;s<r;s++)this.sortReset(e[s].children);for(var o=0;o<r;o++)e[o].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,r){var n=t.attachments[e];if(n)for(var a in n)this.sortPathConstraintAttachmentWith(n[a],r)},e.sortPathConstraintAttachmentWith=function(t,e){if(h(t,pt)){var r=t.bones;if(null==r)this.sortBone(e);else for(var n=this.bones,a=0;a<r.length;)for(var i=r[a++],s=a+i;a<s;a++){var o=r[a];this.sortBone(n[o])}}},e.sortBone=function(t){if(!t.sorted){var e=t.parent;null!=e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,r=t.length;e<r;e++){var n=t[e];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,r=t.length;e<r;e++){var n=t[e];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY,n.appliedValid=!0}for(var a=this._updateCache,i=0,s=a.length;i<s;i++)a[i].update()},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t=this.bones,e=0,r=t.length;e<r;e++)t[e].setToSetupPose();for(var n=this.ikConstraints,a=0,i=n.length;a<i;a++){var s=n[a];s.mix=s.data.mix,s.softness=s.data.softness,s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch}for(var o=this.transformConstraints,l=0,h=o.length;l<h;l++){var u=o[l],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,p=d.length;f<p;f++){var v=d[f],m=v.data;v.position=m.position,v.spacing=m.spacing,v.rotateMix=m.rotateMix,v.translateMix=m.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;m.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,r=t.length;e<r;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;return-1},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(null==e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(null!=t)if(null!=this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(r,i);null!=s&&a.setAttachment(s)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)},e.getAttachment=function(t,e){if(null==e)throw new Error("attachmentName cannot be null.");if(null!=this.skin){var r=this.skin.getAttachment(t,e);if(null!=r)return r}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(null==t)throw new Error("slotName cannot be null.");for(var r=this.slots,n=0,a=r.length;n<a;n++){var i=r[n];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(n,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,r){if(void 0===r&&(r=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==e)throw new Error("size cannot be null.");for(var n=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=0,u=n.length;l<u;l++){var c=n[l];if(c.bone.active){var d=0,f=null,p=c.getAttachment();if(h(p,ut))d=8,f=m.setArraySize(r,d,0),p.computeWorldVertices(c.bone,f,0,2);else if(h(p,dt)){var v=p;d=v.worldVerticesLength,f=m.setArraySize(r,d,0),v.computeWorldVertices(c,0,d,f,0,2)}if(null!=f)for(var g=0,x=f.length;g<x;g+=2){var w=f[g],y=f[g+1];a=Math.min(a,w),i=Math.min(i,y),s=Math.max(s,w),o=Math.max(o,y)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),Dt=function(){function t(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}var e=t.prototype;return e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSkin=function(t){if(null==t)throw new Error("skinName cannot be null.");for(var e=this.skins,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findEvent=function(t){if(null==t)throw new Error("eventDataName cannot be null.");for(var e=this.events,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findAnimation=function(t){if(null==t)throw new Error("animationName cannot be null.");for(var e=this.animations,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findPathConstraintIndex=function(t){if(null==t)throw new Error("pathConstraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},t}(),Lt=function(t,e,r){if(this.color=new c(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=r},Xt=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.rotateMix=0,r.translateMix=0,r.scaleMix=0,r.shearMix=0,r.offsetRotation=0,r.offsetX=0,r.offsetY=0,r.offsetScaleX=0,r.offsetScaleY=0,r.offsetShearY=0,r.relative=!1,r.local=!1,r}return a(e,t),e}(St),Yt=function(t,e,r){this.slotIndex=t,this.name=e,this.attachment=r},Wt=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,r){if(null==r)throw new Error("attachment cannot be null.");var n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=r},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var u=t.getAttachments(),c=0;c<u.length;c++){var d=u[c];null!=d.attachment&&(h(d.attachment,dt)?(d.attachment=d.attachment.newLinkedMesh(),this.setAttachment(d.slotIndex,d.name,d.attachment)):(d.attachment=d.attachment.copy(),this.setAttachment(d.slotIndex,d.name,d.attachment)))}},e.getAttachment=function(t,e){var r=this.attachments[t];return r?r[e]:null},e.removeAttachment=function(t,e){var r=this.attachments[t];r&&(r[e]=null)},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var r=this.attachments[e];if(r)for(var n in r){var a=r[n];a&&t.push(new Yt(e,n,a))}}return t},e.getAttachmentsForSlot=function(t,e){var r=this.attachments[t];if(r)for(var n in r){var a=r[n];a&&e.push(new Yt(t,n,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var r=0,n=0;n<t.slots.length;n++){var a=t.slots[n],i=a.getAttachment();if(i&&r<e.attachments.length){var s=e.attachments[r];for(var o in s){if(i==s[o]){var l=this.getAttachment(r,o);null!=l&&a.setAttachment(l);break}}}r++}},t}();exports.AttachmentType=void 0,(_t=exports.AttachmentType||(exports.AttachmentType={}))[_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";var Ut=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new Dt;n.name="";var a=new qt(e);if(n.hash=a.readString(),n.version=a.readString(),"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=a.readFloat(),n.y=a.readFloat(),n.width=a.readFloat(),n.height=a.readFloat();var i=a.readBoolean();i&&(n.fps=a.readFloat(),n.imagesPath=a.readString(),n.audioPath=a.readString());var s=0;s=a.readInt(!0);for(var o=0;o<s;o++)a.strings.push(a.readString());s=a.readInt(!0);for(var l=0;l<s;l++){var h=a.readString(),u=0==l?null:n.bones[a.readInt(!0)],d=new wt(l,h,u);d.rotation=a.readFloat(),d.x=a.readFloat()*r,d.y=a.readFloat()*r,d.scaleX=a.readFloat(),d.scaleY=a.readFloat(),d.shearX=a.readFloat(),d.shearY=a.readFloat(),d.length=a.readFloat()*r,d.transformMode=t.TransformModeValues[a.readInt(!0)],d.skinRequired=a.readBoolean(),i&&c.rgba8888ToColor(d.color,a.readInt32()),n.bones.push(d)}s=a.readInt(!0);for(var f=0;f<s;f++){var p=a.readString(),v=n.bones[a.readInt(!0)],g=new Lt(f,p,v);c.rgba8888ToColor(g.color,a.readInt32());var x=a.readInt32();-1!=x&&c.rgb888ToColor(g.darkColor=new c,x),g.attachmentName=a.readStringRef(),g.blendMode=t.BlendModeValues[a.readInt(!0)],n.slots.push(g)}s=a.readInt(!0);for(var w,y=0;y<s;y++){var E=new Rt(a.readString());E.order=a.readInt(!0),E.skinRequired=a.readBoolean(),w=a.readInt(!0);for(var b=0;b<w;b++)E.bones.push(n.bones[a.readInt(!0)]);E.target=n.bones[a.readInt(!0)],E.mix=a.readFloat(),E.softness=a.readFloat()*r,E.bendDirection=a.readByte(),E.compress=a.readBoolean(),E.stretch=a.readBoolean(),E.uniform=a.readBoolean(),n.ikConstraints.push(E)}s=a.readInt(!0);for(var M,S=0;S<s;S++){var T=new Xt(a.readString());T.order=a.readInt(!0),T.skinRequired=a.readBoolean(),M=a.readInt(!0);for(var A=0;A<M;A++)T.bones.push(n.bones[a.readInt(!0)]);T.target=n.bones[a.readInt(!0)],T.local=a.readBoolean(),T.relative=a.readBoolean(),T.offsetRotation=a.readFloat(),T.offsetX=a.readFloat()*r,T.offsetY=a.readFloat()*r,T.offsetScaleX=a.readFloat(),T.offsetScaleY=a.readFloat(),T.offsetShearY=a.readFloat(),T.rotateMix=a.readFloat(),T.translateMix=a.readFloat(),T.scaleMix=a.readFloat(),T.shearMix=a.readFloat(),n.transformConstraints.push(T)}s=a.readInt(!0);for(var I,R=0;R<s;R++){var C=new Ct(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),I=a.readInt(!0);for(var P=0;P<I;P++)C.bones.push(n.bones[a.readInt(!0)]);C.target=n.slots[a.readInt(!0)],C.positionMode=t.PositionModeValues[a.readInt(!0)],C.spacingMode=t.SpacingModeValues[a.readInt(!0)],C.rotateMode=t.RotateModeValues[a.readInt(!0)],C.offsetRotation=a.readFloat(),C.position=a.readFloat(),C.positionMode==exports.PositionMode.Fixed&&(C.position*=r),C.spacing=a.readFloat(),C.spacingMode!=exports.SpacingMode.Length&&C.spacingMode!=exports.SpacingMode.Fixed||(C.spacing*=r),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),n.pathConstraints.push(C)}var V=this.readSkin(a,n,!0,i);null!=V&&(n.defaultSkin=V,n.skins.push(V));var _=n.skins.length;for(m.setArraySize(n.skins,s=_+a.readInt(!0));_<s;_++)n.skins[_]=this.readSkin(a,n,!1,i);s=this.linkedMeshes.length;for(var k=0;k<s;k++){var F=this.linkedMeshes[k],B=null==F.skin?n.defaultSkin:n.findSkin(F.skin);if(null==B)throw new Error("Skin not found: "+F.skin);var N=B.getAttachment(F.slotIndex,F.parent);if(null==N)throw new Error("Parent mesh not found: "+F.parent);F.mesh.deformAttachment=F.inheritDeform?N:F.mesh,F.mesh.setParentMesh(N),F.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var O=0;O<s;O++){var D=new At(a.readStringRef());D.intValue=a.readInt(!1),D.floatValue=a.readFloat(),D.stringValue=a.readString(),D.audioPath=a.readString(),null!=D.audioPath&&(D.volume=a.readFloat(),D.balance=a.readFloat()),n.events.push(D)}s=a.readInt(!0);for(var L=0;L<s;L++)n.animations.push(this.readAnimation(a,a.readString(),n));return n},e.readSkin=function(t,e,r,n){var a=null,i=0;if(r){if(0==(i=t.readInt(!0)))return null;a=new Wt("default")}else{(a=new Wt(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var l=0,h=t.readInt(!0);l<h;l++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var p=0;p<i;p++)for(var v=t.readInt(!0),m=0,g=t.readInt(!0);m<g;m++){var x=t.readStringRef(),w=this.readAttachment(t,e,a,v,x,n);null!=w&&a.setAttachment(v,x,w)}return a},e.readAttachment=function(e,r,n,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case exports.AttachmentType.Region:var u=e.readStringRef(),d=e.readFloat(),f=e.readFloat(),p=e.readFloat(),v=e.readFloat(),g=e.readFloat(),x=e.readFloat(),w=e.readFloat(),y=e.readInt32();null==u&&(u=l);var E=this.attachmentLoader.newRegionAttachment(n,l,u);return null==E?null:(E.path=u,E.x=f*o,E.y=p*o,E.scaleX=v,E.scaleY=g,E.rotation=d,E.width=x*o,E.height=w*o,c.rgba8888ToColor(E.color,y),E.updateOffset(),E);case exports.AttachmentType.BoundingBox:var b=e.readInt(!0),M=this.readVertices(e,b),S=s?e.readInt32():0,T=this.attachmentLoader.newBoundingBoxAttachment(n,l);return null==T?null:(T.worldVerticesLength=b<<1,T.vertices=M.vertices,T.bones=M.bones,s&&c.rgba8888ToColor(T.color,S),T);case exports.AttachmentType.Mesh:var A=e.readStringRef(),I=e.readInt32(),R=e.readInt(!0),C=this.readFloatArray(e,R<<1,1),P=this.readShortArray(e),V=this.readVertices(e,R),_=e.readInt(!0),k=null,F=0,B=0;s&&(k=this.readShortArray(e),F=e.readFloat(),B=e.readFloat()),null==A&&(A=l);var N=this.attachmentLoader.newMeshAttachment(n,l,A);return null==N?null:(N.path=A,c.rgba8888ToColor(N.color,I),N.bones=V.bones,N.vertices=V.vertices,N.worldVerticesLength=R<<1,N.triangles=P,N.regionUVs=C,N.updateUVs(),N.hullLength=_<<1,s&&(N.edges=k,N.width=F*o,N.height=B*o),N);case exports.AttachmentType.LinkedMesh:var O=e.readStringRef(),D=e.readInt32(),L=e.readStringRef(),X=e.readStringRef(),Y=e.readBoolean(),W=0,U=0;s&&(W=e.readFloat(),U=e.readFloat()),null==O&&(O=l);var q=this.attachmentLoader.newMeshAttachment(n,l,O);return null==q?null:(q.path=O,c.rgba8888ToColor(q.color,D),s&&(q.width=W*o,q.height=U*o),this.linkedMeshes.push(new Ht(q,L,a,X,Y)),q);case exports.AttachmentType.Path:for(var H=e.readBoolean(),j=e.readBoolean(),G=e.readInt(!0),z=this.readVertices(e,G),Z=m.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(n,l);return null==$?null:($.closed=H,$.constantSpeed=j,$.worldVerticesLength=G<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&c.rgba8888ToColor($.color,K),$);case exports.AttachmentType.Point:var tt=e.readFloat(),et=e.readFloat(),rt=e.readFloat(),nt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(n,l);return null==at?null:(at.x=et*o,at.y=rt*o,at.rotation=tt,s&&c.rgba8888ToColor(at.color,nt),at);case exports.AttachmentType.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(n,l);return null==ht?null:(ht.endSlot=r.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&c.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var r=e<<1,n=new jt,a=this.scale;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,a),n;for(var i=new Array,s=new Array,o=0;o<e;o++){var l=t.readInt(!0);s.push(l);for(var h=0;h<l;h++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return n.vertices=m.toFloatArray(i),n.bones=s,n},e.readFloatArray=function(t,e,r){var n=new Array(e);if(1==r)for(var a=0;a<e;a++)n[a]=t.readFloat();else for(var i=0;i<e;i++)n[i]=t.readFloat()*r;return n},e.readShortArray=function(t){for(var e=t.readInt(!0),r=new Array(e),n=0;n<e;n++)r[n]=t.readShort();return r},e.readAnimation=function(e,r,n){for(var a=new Array,i=this.scale,s=0,o=new c,l=new c,h=0,u=e.readInt(!0);h<u;h++)for(var d=e.readInt(!0),f=0,p=e.readInt(!0);f<p;f++){var v=e.readByte(),g=e.readInt(!0);switch(v){case t.SLOT_ATTACHMENT:var x=new N(g);x.slotIndex=d;for(var w=0;w<g;w++)x.setFrame(w,e.readFloat(),e.readStringRef());a.push(x),s=Math.max(s,x.frames[g-1]);break;case t.SLOT_COLOR:var y=new F(g);y.slotIndex=d;for(var E=0;E<g;E++){var b=e.readFloat();c.rgba8888ToColor(o,e.readInt32()),y.setFrame(E,b,o.r,o.g,o.b,o.a),E<g-1&&this.readCurve(e,E,y)}a.push(y),s=Math.max(s,y.frames[(g-1)*F.ENTRIES]);break;case t.SLOT_TWO_COLOR:var M=new B(g);M.slotIndex=d;for(var S=0;S<g;S++){var T=e.readFloat();c.rgba8888ToColor(o,e.readInt32()),c.rgb888ToColor(l,e.readInt32()),M.setFrame(S,T,o.r,o.g,o.b,o.a,l.r,l.g,l.b),S<g-1&&this.readCurve(e,S,M)}a.push(M),s=Math.max(s,M.frames[(g-1)*B.ENTRIES])}}for(var A=0,I=e.readInt(!0);A<I;A++)for(var C=e.readInt(!0),O=0,j=e.readInt(!0);O<j;O++){var G=e.readByte(),z=e.readInt(!0);switch(G){case t.BONE_ROTATE:var Z=new P(z);Z.boneIndex=C;for(var Q=0;Q<z;Q++)Z.setFrame(Q,e.readFloat(),e.readFloat()),Q<z-1&&this.readCurve(e,Q,Z);a.push(Z),s=Math.max(s,Z.frames[(z-1)*P.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var J=void 0,K=1;G==t.BONE_SCALE?J=new _(z):G==t.BONE_SHEAR?J=new k(z):(J=new V(z),K=i),J.boneIndex=C;for(var $=0;$<z;$++)J.setFrame($,e.readFloat(),e.readFloat()*K,e.readFloat()*K),$<z-1&&this.readCurve(e,$,J);a.push(J),s=Math.max(s,J.frames[(z-1)*V.ENTRIES])}}for(var tt=0,et=e.readInt(!0);tt<et;tt++){var rt=e.readInt(!0),nt=e.readInt(!0),at=new Y(nt);at.ikConstraintIndex=rt;for(var it=0;it<nt;it++)at.setFrame(it,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),it<nt-1&&this.readCurve(e,it,at);a.push(at),s=Math.max(s,at.frames[(nt-1)*Y.ENTRIES])}for(var st=0,ot=e.readInt(!0);st<ot;st++){var lt=e.readInt(!0),ht=e.readInt(!0),ut=new W(ht);ut.transformConstraintIndex=lt;for(var ct=0;ct<ht;ct++)ut.setFrame(ct,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),ct<ht-1&&this.readCurve(e,ct,ut);a.push(ut),s=Math.max(s,ut.frames[(ht-1)*W.ENTRIES])}for(var dt=0,ft=e.readInt(!0);dt<ft;dt++)for(var pt=e.readInt(!0),vt=n.pathConstraints[pt],mt=0,gt=e.readInt(!0);mt<gt;mt++){var xt=e.readByte(),wt=e.readInt(!0);switch(xt){case t.PATH_POSITION:case t.PATH_SPACING:var yt=void 0,Et=1;xt==t.PATH_SPACING?(yt=new q(wt),vt.spacingMode!=exports.SpacingMode.Length&&vt.spacingMode!=exports.SpacingMode.Fixed||(Et=i)):(yt=new U(wt),vt.positionMode==exports.PositionMode.Fixed&&(Et=i)),yt.pathConstraintIndex=pt;for(var bt=0;bt<wt;bt++)yt.setFrame(bt,e.readFloat(),e.readFloat()*Et),bt<wt-1&&this.readCurve(e,bt,yt);a.push(yt),s=Math.max(s,yt.frames[(wt-1)*U.ENTRIES]);break;case t.PATH_MIX:var Mt=new H(wt);Mt.pathConstraintIndex=pt;for(var St=0;St<wt;St++)Mt.setFrame(St,e.readFloat(),e.readFloat(),e.readFloat()),St<wt-1&&this.readCurve(e,St,Mt);a.push(Mt),s=Math.max(s,Mt.frames[(wt-1)*H.ENTRIES])}}for(var At=0,It=e.readInt(!0);At<It;At++)for(var Rt=n.skins[e.readInt(!0)],Ct=0,Pt=e.readInt(!0);Ct<Pt;Ct++)for(var Vt=e.readInt(!0),_t=0,kt=e.readInt(!0);_t<kt;_t++){var Ft=Rt.getAttachment(Vt,e.readStringRef()),Bt=null!=Ft.bones,Nt=Ft.vertices,Ot=Bt?Nt.length/3*2:Nt.length,Dt=e.readInt(!0),Lt=new D(Dt);Lt.slotIndex=Vt,Lt.attachment=Ft;for(var Xt=0;Xt<Dt;Xt++){var Yt=e.readFloat(),Wt=void 0,Ut=e.readInt(!0);if(0==Ut)Wt=Bt?m.newFloatArray(Ot):Nt;else{Wt=m.newFloatArray(Ot);var qt=e.readInt(!0);if(Ut+=qt,1==i)for(var Ht=qt;Ht<Ut;Ht++)Wt[Ht]=e.readFloat();else for(var jt=qt;jt<Ut;jt++)Wt[jt]=e.readFloat()*i;if(!Bt)for(var Gt=0,zt=Wt.length;Gt<zt;Gt++)Wt[Gt]+=Nt[Gt]}Lt.setFrame(Xt,Yt,Wt),Xt<Dt-1&&this.readCurve(e,Xt,Lt)}a.push(Lt),s=Math.max(s,Lt.frames[Dt-1])}var Zt=e.readInt(!0);if(Zt>0){for(var Qt=new X(Zt),Jt=n.slots.length,Kt=0;Kt<Zt;Kt++){for(var $t=e.readFloat(),te=e.readInt(!0),ee=m.newArray(Jt,0),re=Jt-1;re>=0;re--)ee[re]=-1;for(var ne=m.newArray(Jt-te,0),ae=0,ie=0,se=0;se<te;se++){for(var oe=e.readInt(!0);ae!=oe;)ne[ie++]=ae++;ee[ae+e.readInt(!0)]=ae++}for(;ae<Jt;)ne[ie++]=ae++;for(var le=Jt-1;le>=0;le--)-1==ee[le]&&(ee[le]=ne[--ie]);Qt.setFrame(Kt,$t,ee)}a.push(Qt),s=Math.max(s,Qt.frames[Zt-1])}var he=e.readInt(!0);if(he>0){for(var ue=new L(he),ce=0;ce<he;ce++){var de=e.readFloat(),fe=n.events[e.readInt(!0)],pe=new Tt(de,fe);pe.intValue=e.readInt(!1),pe.floatValue=e.readFloat(),pe.stringValue=e.readBoolean()?e.readString():fe.stringValue,null!=pe.data.audioPath&&(pe.volume=e.readFloat(),pe.balance=e.readFloat()),ue.setFrame(ce,pe)}a.push(ue),s=Math.max(s,ue.frames[he-1])}return new R(r,a,s)},e.readCurve=function(e,r,n){switch(e.readByte()){case t.CURVE_STEPPED:n.setStepped(r);break;case t.CURVE_BEZIER:this.setCurve(n,r,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat())}},e.setCurve=function(t,e,r,n,a,i){t.setCurve(e,r,n,a,i)},t}();Ut.AttachmentTypeValues=[0,1,2,3,4,5,6],Ut.TransformModeValues=[exports.TransformMode.Normal,exports.TransformMode.OnlyTranslation,exports.TransformMode.NoRotationOrReflection,exports.TransformMode.NoScale,exports.TransformMode.NoScaleOrReflection],Ut.PositionModeValues=[exports.PositionMode.Fixed,exports.PositionMode.Percent],Ut.SpacingModeValues=[exports.SpacingMode.Length,exports.SpacingMode.Fixed,exports.SpacingMode.Percent],Ut.RotateModeValues=[exports.RotateMode.Tangent,exports.RotateMode.Chain,exports.RotateMode.ChainScale],Ut.BlendModeValues=[exports.BlendMode.Normal,exports.BlendMode.Additive,exports.BlendMode.Multiply,exports.BlendMode.Screen],Ut.BONE_ROTATE=0,Ut.BONE_TRANSLATE=1,Ut.BONE_SCALE=2,Ut.BONE_SHEAR=3,Ut.SLOT_ATTACHMENT=0,Ut.SLOT_COLOR=1,Ut.SLOT_TWO_COLOR=2,Ut.PATH_POSITION=0,Ut.PATH_SPACING=1,Ut.PATH_MIX=2,Ut.CURVE_LINEAR=0,Ut.CURVE_STEPPED=1,Ut.CURVE_BEZIER=2;var qt=function(){function t(t,e,r,n){void 0===e&&(e=new Array),void 0===r&&(r=0),void 0===n&&(n=new DataView(t.buffer)),this.strings=e,this.index=r,this.buffer=n}var e=t.prototype;return e.readByte=function(){return this.buffer.getInt8(this.index++)},e.readShort=function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t},e.readInt32=function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t},e.readInt=function(t){var e=this.readByte(),r=127&e;return 128&e&&(r|=(127&(e=this.readByte()))<<7,128&e&&(r|=(127&(e=this.readByte()))<<14,128&e&&(r|=(127&(e=this.readByte()))<<21,128&e&&(r|=(127&(e=this.readByte()))<<28)))),t?r:r>>>1^-(1&r)},e.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},e.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",r=0;r<t;){var n=this.readByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),r+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),r+=3;break;default:e+=String.fromCharCode(n),r++}}return e},e.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},e.readBoolean=function(){return 0!=this.readByte()},t}(),Ht=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},jt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e},Gt=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 x((function(){return m.newFloatArray(16)}))}var e=t.prototype;return e.update=function(t,e){if(null==t)throw new Error("skeleton cannot be null.");var r=this.boundingBoxes,n=this.polygons,a=this.polygonPool,i=t.slots,s=i.length;r.length=0,a.freeAll(n),n.length=0;for(var o=0;o<s;o++){var l=i[o];if(l.bone.active){var u=l.getAttachment();if(h(u,ft)){var c=u;r.push(c);var d=a.obtain();d.length!=c.worldVerticesLength&&(d=m.newFloatArray(c.worldVerticesLength)),n.push(d),c.computeWorldVertices(l,0,c.worldVerticesLength,d,0,2)}}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)},e.aabbCompute=function(){for(var t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,n=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),r=Math.max(r,c),n=Math.max(n,d)}this.minX=t,this.minY=e,this.maxX=r,this.maxY=n},e.aabbContainsPoint=function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.aabbIntersectsSegment=function(t,e,r,n){var a=this.minX,i=this.minY,s=this.maxX,o=this.maxY;if(t<=a&&r<=a||e<=i&&n<=i||t>=s&&r>=s||e>=o&&n>=o)return!1;var l=(n-e)/(r-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 r=this.polygons,n=0,a=r.length;n<a;n++)if(this.containsPointPolygon(r[n],t,e))return this.boundingBoxes[n];return null},e.containsPointPolygon=function(t,e,r){for(var n=t,a=t.length,i=a-2,s=!1,o=0;o<a;o+=2){var l=n[o+1],h=n[i+1];if(l<r&&h>=r||h<r&&l>=r){var u=n[o];u+(r-l)/(h-l)*(n[i]-u)<e&&(s=!s)}i=o}return s},e.intersectsSegment=function(t,e,r,n){for(var a=this.polygons,i=0,s=a.length;i<s;i++)if(this.intersectsSegmentPolygon(a[i],t,e,r,n))return this.boundingBoxes[i];return null},e.intersectsSegmentPolygon=function(t,e,r,n,a){for(var i=t,s=t.length,o=e-n,l=r-a,h=e*a-r*n,u=i[s-2],c=i[s-1],d=0;d<s;d+=2){var f=i[d],p=i[d+1],v=u*p-c*f,m=u-f,g=c-p,x=o*g-l*m,w=(h*m-o*v)/x;if((w>=u&&w<=f||w>=f&&w<=u)&&(w>=e&&w<=n||w>=n&&w<=e)){var y=(h*g-l*v)/x;if((y>=c&&y<=p||y>=p&&y<=c)&&(y>=r&&y<=a||y>=a&&y<=r))return!0}u=f,c=p}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}(),zt=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 x((function(){return new Array})),this.polygonIndicesPool=new x((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var r=e,n=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<n;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,l=n;o<l;++o)s[o]=t.isConcave(o,n,r,a);var h=this.triangles;for(h.length=0;n>3;){for(var u=n-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,p=a[c]<<1,v=a[d]<<1,m=r[f],g=r[f+1],x=r[p],w=r[p+1],y=r[v],E=r[v+1],b=(d+1)%n;b!=u;b=(b+1)%n)if(s[b]){var M=a[b]<<1,S=r[M],T=r[M+1];if(t.positiveArea(y,E,m,g,S,T)&&t.positiveArea(m,g,x,w,S,T)&&t.positiveArea(x,w,y,E,S,T))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%n}h.push(a[(n+c-1)%n]),h.push(a[c]),h.push(a[(c+1)%n]),a.splice(c,1),s.splice(c,1);var A=(--n+c-1)%n,I=c==n?0:c;s[A]=t.isConcave(A,n,r,a),s[I]=t.isConcave(I,n,r,a)}return 3==n&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.decompose=function(e,r){var n=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var l=-1,h=0,u=0,c=r.length;u<c;u+=3){var d=r[u]<<1,f=r[u+1]<<1,p=r[u+2]<<1,v=n[d],m=n[d+1],g=n[f],x=n[f+1],w=n[p],y=n[p+1],E=!1;if(l==d){var b=o.length-4,M=t.winding(o[b],o[b+1],o[b+2],o[b+3],w,y),S=t.winding(w,y,o[0],o[1],o[2],o[3]);M==h&&S==h&&(o.push(w),o.push(y),s.push(p),E=!0)}E||(o.length>0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(v),o.push(m),o.push(g),o.push(x),o.push(w),o.push(y),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(p),h=t.winding(v,m,g,x,w,y),l=d)}o.length>0&&(a.push(o),i.push(s));for(var T=0,A=a.length;T<A;T++)if(0!=(s=i[T]).length)for(var I=s[0],R=s[s.length-1],C=(o=a[T]).length-4,P=o[C],V=o[C+1],_=o[C+2],k=o[C+3],F=o[0],B=o[1],N=o[2],O=o[3],D=t.winding(P,V,_,k,F,B),L=0;L<A;L++)if(L!=T){var X=i[L];if(3==X.length){var Y=X[0],W=X[1],U=X[2],q=a[L],H=q[q.length-2],j=q[q.length-1];if(Y==I&&W==R){var G=t.winding(P,V,_,k,H,j),z=t.winding(H,j,F,B,N,O);G==D&&z==D&&(q.length=0,X.length=0,o.push(H),o.push(j),s.push(U),P=_,V=k,_=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,r,n){var a=n[(e+t-1)%e]<<1,i=n[t]<<1,s=n[(t+1)%e]<<1;return!this.positiveArea(r[a],r[a+1],r[i],r[i+1],r[s],r[s+1])},t.positiveArea=function(t,e,r,n,a,i){return t*(i-n)+r*(e-i)+a*(n-e)>=0},t.winding=function(t,e,r,n,a,i){var s=r-t,o=n-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),Zt=function(){function t(){this.triangulator=new zt,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}var e=t.prototype;return e.clipStart=function(e,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var n=r.worldVerticesLength,a=m.setArraySize(this.clippingPolygon,n);r.computeWorldVertices(e,0,n,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,l=s.length;o<l;o++){var h=s[o];t.makeClockwise(h),h.push(h[0]),h.push(h[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,r,n,a,i,s,o){var l=this.clipOutput,h=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,p=0;h.length=0,u.length=0;t:for(var v=0;v<n;v+=3)for(var g=r[v]<<1,x=t[g],w=t[g+1],y=a[g],E=a[g+1],b=t[g=r[v+1]<<1],M=t[g+1],S=a[g],T=a[g+1],A=t[g=r[v+2]<<1],I=t[g+1],R=a[g],C=a[g+1],P=0;P<d;P++){var V=h.length;if(!this.clip(x,w,b,M,A,I,c[P],l)){var _=m.setArraySize(h,V+3*f);_[V]=x,_[V+1]=w,_[V+2]=i.r,_[V+3]=i.g,_[V+4]=i.b,_[V+5]=i.a,o?(_[V+6]=y,_[V+7]=E,_[V+8]=s.r,_[V+9]=s.g,_[V+10]=s.b,_[V+11]=s.a,_[V+12]=b,_[V+13]=M,_[V+14]=i.r,_[V+15]=i.g,_[V+16]=i.b,_[V+17]=i.a,_[V+18]=S,_[V+19]=T,_[V+20]=s.r,_[V+21]=s.g,_[V+22]=s.b,_[V+23]=s.a,_[V+24]=A,_[V+25]=I,_[V+26]=i.r,_[V+27]=i.g,_[V+28]=i.b,_[V+29]=i.a,_[V+30]=R,_[V+31]=C,_[V+32]=s.r,_[V+33]=s.g,_[V+34]=s.b,_[V+35]=s.a):(_[V+6]=y,_[V+7]=E,_[V+8]=b,_[V+9]=M,_[V+10]=i.r,_[V+11]=i.g,_[V+12]=i.b,_[V+13]=i.a,_[V+14]=S,_[V+15]=T,_[V+16]=A,_[V+17]=I,_[V+18]=i.r,_[V+19]=i.g,_[V+20]=i.b,_[V+21]=i.a,_[V+22]=R,_[V+23]=C),V=u.length;var k=m.setArraySize(u,V+3);k[V]=p,k[V+1]=p+1,k[V+2]=p+2,p+=3;continue t}var F=l.length;if(0!=F){for(var B=M-I,N=A-b,O=x-A,D=I-w,L=1/(B*O+N*(w-I)),X=F>>1,Y=this.clipOutput,W=m.setArraySize(h,V+X*f),U=0;U<F;U+=2){var q=Y[U],H=Y[U+1];W[V]=q,W[V+1]=H,W[V+2]=i.r,W[V+3]=i.g,W[V+4]=i.b,W[V+5]=i.a;var j=q-A,G=H-I,z=(B*j+N*G)*L,Z=(D*j+O*G)*L,Q=1-z-Z;W[V+6]=y*z+S*Z+R*Q,W[V+7]=E*z+T*Z+C*Q,o&&(W[V+8]=s.r,W[V+9]=s.g,W[V+10]=s.b,W[V+11]=s.a),V+=f}V=u.length;var J=m.setArraySize(u,V+3*(X-2));X--;for(var K=1;K<X;K++)J[V]=p,J[V+1]=p+K,J[V+2]=p+K+1,V+=3;p+=X+1}}},e.clip=function(t,e,r,n,a,i,s,o){var l=o,h=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(r),u.push(n),u.push(a),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,d=s.length-4,f=0;;f+=2){for(var p=c[f],v=c[f+1],m=c[f+2],g=c[f+3],x=p-m,w=v-g,y=u,E=u.length-2,b=o.length,M=0;M<E;M+=2){var S=y[M],T=y[M+1],A=y[M+2],I=y[M+3],R=x*(I-g)-w*(A-m)>0;if(x*(T-g)-w*(S-m)>0){if(R){o.push(A),o.push(I);continue}var C=I-T,P=A-S,V=C*(m-p)-P*(g-v);if(Math.abs(V)>1e-6){var _=(P*(v-T)-C*(p-S))/V;o.push(p+(m-p)*_),o.push(v+(g-v)*_)}else o.push(p),o.push(v)}else if(R){var k=I-T,F=A-S,B=k*(m-p)-F*(g-v);if(Math.abs(B)>1e-6){var N=(F*(v-T)-k*(p-S))/B;o.push(p+(m-p)*N),o.push(v+(g-v)*N)}else o.push(p),o.push(v);o.push(A),o.push(I)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var O=o;(o=u).length=0,u=O}if(l!=o){l.length=0;for(var D=0,L=o.length-2;D<L;D++)l[D]=o[D]}else l.length=l.length-2;return h},t.makeClockwise=function(t){for(var e=t,r=t.length,n=e[r-2]*e[1]-e[0]*e[r-1],a=0,i=0,s=0,o=0,l=r-3;o<l;o+=2)a=e[o],i=e[o+1],s=e[o+2],n+=a*e[o+3]-s*i;if(!(n<0))for(var h=0,u=r-2,c=r>>1;h<c;h+=2){var d=e[h],f=e[h+1],p=u-h;e[h]=e[p],e[h+1]=e[p+1],e[p]=d,e[p+1]=f}},t}(),Qt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new Dt,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(n.hash=i.hash,n.version=i.spine,"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=i.x,n.y=i.y,n.width=i.width,n.height=i.height,n.fps=i.fps,n.imagesPath=i.images}if(a.bones)for(var s=0;s<a.bones.length;s++){var o=a.bones[s],l=null,h=this.getValue(o,"parent",null);if(null!=h&&null==(l=n.findBone(h)))throw new Error("Parent bone not found: "+h);var u=new wt(n.bones.length,o.name,l);u.length=this.getValue(o,"length",0)*r,u.x=this.getValue(o,"x",0)*r,u.y=this.getValue(o,"y",0)*r,u.rotation=this.getValue(o,"rotation",0),u.scaleX=this.getValue(o,"scaleX",1),u.scaleY=this.getValue(o,"scaleY",1),u.shearX=this.getValue(o,"shearX",0),u.shearY=this.getValue(o,"shearY",0),u.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),u.skinRequired=this.getValue(o,"skin",!1),n.bones.push(u)}if(a.slots)for(var d=0;d<a.slots.length;d++){var f=a.slots[d],p=f.name,v=f.bone,m=n.findBone(v);if(null==m)throw new Error("Slot bone not found: "+v);var g=new Lt(n.slots.length,p,m),x=this.getValue(f,"color",null);null!=x&&g.color.setFromString(x);var w=this.getValue(f,"dark",null);null!=w&&(g.darkColor=new c(1,1,1,1),g.darkColor.setFromString(w)),g.attachmentName=this.getValue(f,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(f,"blend","normal")),n.slots.push(g)}if(a.ik)for(var y=0;y<a.ik.length;y++){var E=a.ik[y],b=new Rt(E.name);b.order=this.getValue(E,"order",0),b.skinRequired=this.getValue(E,"skin",!1);for(var M=0;M<E.bones.length;M++){var S=E.bones[M],T=n.findBone(S);if(null==T)throw new Error("IK bone not found: "+S);b.bones.push(T)}var A=E.target;if(b.target=n.findBone(A),null==b.target)throw new Error("IK target bone not found: "+A);b.mix=this.getValue(E,"mix",1),b.softness=this.getValue(E,"softness",0)*r,b.bendDirection=this.getValue(E,"bendPositive",!0)?1:-1,b.compress=this.getValue(E,"compress",!1),b.stretch=this.getValue(E,"stretch",!1),b.uniform=this.getValue(E,"uniform",!1),n.ikConstraints.push(b)}if(a.transform)for(var I=0;I<a.transform.length;I++){var R=a.transform[I],C=new Xt(R.name);C.order=this.getValue(R,"order",0),C.skinRequired=this.getValue(R,"skin",!1);for(var P=0;P<R.bones.length;P++){var V=R.bones[P],_=n.findBone(V);if(null==_)throw new Error("Transform constraint bone not found: "+V);C.bones.push(_)}var k=R.target;if(C.target=n.findBone(k),null==C.target)throw new Error("Transform constraint target bone not found: "+k);C.local=this.getValue(R,"local",!1),C.relative=this.getValue(R,"relative",!1),C.offsetRotation=this.getValue(R,"rotation",0),C.offsetX=this.getValue(R,"x",0)*r,C.offsetY=this.getValue(R,"y",0)*r,C.offsetScaleX=this.getValue(R,"scaleX",0),C.offsetScaleY=this.getValue(R,"scaleY",0),C.offsetShearY=this.getValue(R,"shearY",0),C.rotateMix=this.getValue(R,"rotateMix",1),C.translateMix=this.getValue(R,"translateMix",1),C.scaleMix=this.getValue(R,"scaleMix",1),C.shearMix=this.getValue(R,"shearMix",1),n.transformConstraints.push(C)}if(a.path)for(var F=0;F<a.path.length;F++){var B=a.path[F],N=new Ct(B.name);N.order=this.getValue(B,"order",0),N.skinRequired=this.getValue(B,"skin",!1);for(var O=0;O<B.bones.length;O++){var D=B.bones[O],L=n.findBone(D);if(null==L)throw new Error("Transform constraint bone not found: "+D);N.bones.push(L)}var X=B.target;if(N.target=n.findSlot(X),null==N.target)throw new Error("Path target slot not found: "+X);N.positionMode=t.positionModeFromString(this.getValue(B,"positionMode","percent")),N.spacingMode=t.spacingModeFromString(this.getValue(B,"spacingMode","length")),N.rotateMode=t.rotateModeFromString(this.getValue(B,"rotateMode","tangent")),N.offsetRotation=this.getValue(B,"rotation",0),N.position=this.getValue(B,"position",0),N.positionMode==exports.PositionMode.Fixed&&(N.position*=r),N.spacing=this.getValue(B,"spacing",0),N.spacingMode!=exports.SpacingMode.Length&&N.spacingMode!=exports.SpacingMode.Fixed||(N.spacing*=r),N.rotateMix=this.getValue(B,"rotateMix",1),N.translateMix=this.getValue(B,"translateMix",1),n.pathConstraints.push(N)}if(a.skins)for(var Y=0;Y<a.skins.length;Y++){var W=a.skins[Y],U=new Wt(W.name);if(W.bones)for(var q=0;q<W.bones.length;q++){var H=n.findBone(W.bones[q]);if(null==H)throw new Error("Skin bone not found: "+W.bones[Y]);U.bones.push(H)}if(W.ik)for(var j=0;j<W.ik.length;j++){var G=n.findIkConstraint(W.ik[j]);if(null==G)throw new Error("Skin IK constraint not found: "+W.ik[Y]);U.constraints.push(G)}if(W.transform)for(var z=0;z<W.transform.length;z++){var Z=n.findTransformConstraint(W.transform[z]);if(null==Z)throw new Error("Skin transform constraint not found: "+W.transform[Y]);U.constraints.push(Z)}if(W.path)for(var Q=0;Q<W.path.length;Q++){var J=n.findPathConstraint(W.path[Q]);if(null==J)throw new Error("Skin path constraint not found: "+W.path[Y]);U.constraints.push(J)}for(var K in W.attachments){var $=n.findSlot(K);if(null==$)throw new Error("Slot not found: "+K);var tt=W.attachments[K];for(var et in tt){var rt=this.readAttachment(tt[et],U,$.index,et,n);null!=rt&&U.setAttachment($.index,et,rt)}}n.skins.push(U),"default"==U.name&&(n.defaultSkin=U)}for(var nt=0,at=this.linkedMeshes.length;nt<at;nt++){var it=this.linkedMeshes[nt],st=null==it.skin?n.defaultSkin:n.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 At(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)),n.events.push(ut)}if(a.animations)for(var ct in a.animations){var dt=a.animations[ct];this.readAnimation(dt,ct,n)}return n},e.readAttachment=function(t,e,r,n,a){var i=this.scale;switch(n=this.getValue(t,"name",n),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",n),o=this.attachmentLoader.newRegionAttachment(e,n,s);if(null==o)return null;o.path=s,o.x=this.getValue(t,"x",0)*i,o.y=this.getValue(t,"y",0)*i,o.scaleX=this.getValue(t,"scaleX",1),o.scaleY=this.getValue(t,"scaleY",1),o.rotation=this.getValue(t,"rotation",0),o.width=t.width*i,o.height=t.height*i;var l=this.getValue(t,"color",null);return null!=l&&o.color.setFromString(l),o.updateOffset(),o;case"boundingbox":var h=this.attachmentLoader.newBoundingBoxAttachment(e,n);if(null==h)return null;this.readVertices(t,h,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&h.color.setFromString(u),h;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",n),d=this.attachmentLoader.newMeshAttachment(e,n,c);if(null==d)return null;d.path=c;var f=this.getValue(t,"color",null);null!=f&&d.color.setFromString(f),d.width=this.getValue(t,"width",0)*i,d.height=this.getValue(t,"height",0)*i;var p=this.getValue(t,"parent",null);if(null!=p)return this.linkedMeshes.push(new Jt(d,this.getValue(t,"skin",null),r,p,this.getValue(t,"deform",!0))),d;var v=t.uvs;return this.readVertices(t,d,v.length),d.triangles=t.triangles,d.regionUVs=v,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var g=this.attachmentLoader.newPathAttachment(e,n);if(null==g)return null;g.closed=this.getValue(t,"closed",!1),g.constantSpeed=this.getValue(t,"constantSpeed",!0);var x=t.vertexCount;this.readVertices(t,g,x<<1);for(var w=m.newArray(x/3,0),y=0;y<t.lengths.length;y++)w[y]=t.lengths[y]*i;g.lengths=w;var E=this.getValue(t,"color",null);return null!=E&&g.color.setFromString(E),g;case"point":var b=this.attachmentLoader.newPointAttachment(e,n);if(null==b)return null;b.x=this.getValue(t,"x",0)*i,b.y=this.getValue(t,"y",0)*i,b.rotation=this.getValue(t,"rotation",0);var M=this.getValue(t,"color",null);return null!=M&&b.color.setFromString(M),b;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,n);if(null==S)return null;var T=this.getValue(t,"end",null);if(null!=T){var A=a.findSlot(T);if(null==A)throw new Error("Clipping end slot not found: "+T);S.endSlot=A}var I=t.vertexCount;this.readVertices(t,S,I<<1);var R=this.getValue(t,"color",null);return null!=R&&S.color.setFromString(R),S}return null},e.readVertices=function(t,e,r){var n=this.scale;e.worldVerticesLength=r;var a=t.vertices;if(r!=a.length){for(var i=new Array,s=new Array,o=0,l=a.length;o<l;){var h=a[o++];s.push(h);for(var u=o+4*h;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*n),i.push(a[o+2]*n),i.push(a[o+3])}e.bones=s,e.vertices=m.toFloatArray(i)}else{var c=m.toFloatArray(a);if(1!=n)for(var d=0,f=a.length;d<f;d++)c[d]*=n;e.vertices=c}},e.readAnimation=function(t,e,r){var n=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],l=r.findSlotIndex(s);if(-1==l)throw new Error("Slot not found: "+s);for(var h in o){var u=o[h];if("attachment"==h){var d=new N(u.length);d.slotIndex=l;for(var f=0,p=0;p<u.length;p++){var v=u[p];d.setFrame(f++,this.getValue(v,"time",0),v.name)}a.push(d),i=Math.max(i,d.frames[d.getFrameCount()-1])}else if("color"==h){var g=new F(u.length);g.slotIndex=l;for(var x=0,w=0;w<u.length;w++){var y=u[w],E=new c;E.setFromString(y.color),g.setFrame(x,this.getValue(y,"time",0),E.r,E.g,E.b,E.a),this.readCurve(y,g,x),x++}a.push(g),i=Math.max(i,g.frames[(g.getFrameCount()-1)*F.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var b=new B(u.length);b.slotIndex=l;for(var M=0,S=0;S<u.length;S++){var T=u[S],A=new c,I=new c;A.setFromString(T.light),I.setFromString(T.dark),b.setFrame(M,this.getValue(T,"time",0),A.r,A.g,A.b,A.a,I.r,I.g,I.b),this.readCurve(T,b,M),M++}a.push(b),i=Math.max(i,b.frames[(b.getFrameCount()-1)*B.ENTRIES])}}}if(t.bones)for(var C in t.bones){var O=t.bones[C],j=r.findBoneIndex(C);if(-1==j)throw new Error("Bone not found: "+C);for(var G in O){var z=O[G];if("rotate"===G){var Z=new P(z.length);Z.boneIndex=j;for(var Q=0,J=0;J<z.length;J++){var K=z[J];Z.setFrame(Q,this.getValue(K,"time",0),this.getValue(K,"angle",0)),this.readCurve(K,Z,Q),Q++}a.push(Z),i=Math.max(i,Z.frames[(Z.getFrameCount()-1)*P.ENTRIES])}else{if("translate"!==G&&"scale"!==G&&"shear"!==G)throw new Error("Invalid timeline type for a bone: "+G+" ("+C+")");var $=null,tt=1,et=0;"scale"===G?($=new _(z.length),et=1):"shear"===G?$=new k(z.length):($=new V(z.length),tt=n),$.boneIndex=j;for(var rt=0,nt=0;nt<z.length;nt++){var at=z[nt],it=this.getValue(at,"x",et),st=this.getValue(at,"y",et);$.setFrame(rt,this.getValue(at,"time",0),it*tt,st*tt),this.readCurve(at,$,rt),rt++}a.push($),i=Math.max(i,$.frames[($.getFrameCount()-1)*V.ENTRIES])}}}if(t.ik)for(var ot in t.ik){var lt=t.ik[ot],ht=r.findIkConstraint(ot),ut=new Y(lt.length);ut.ikConstraintIndex=r.ikConstraints.indexOf(ht);for(var ct=0,dt=0;dt<lt.length;dt++){var ft=lt[dt];ut.setFrame(ct,this.getValue(ft,"time",0),this.getValue(ft,"mix",1),this.getValue(ft,"softness",0)*n,this.getValue(ft,"bendPositive",!0)?1:-1,this.getValue(ft,"compress",!1),this.getValue(ft,"stretch",!1)),this.readCurve(ft,ut,ct),ct++}a.push(ut),i=Math.max(i,ut.frames[(ut.getFrameCount()-1)*Y.ENTRIES])}if(t.transform)for(var pt in t.transform){var vt=t.transform[pt],mt=r.findTransformConstraint(pt),gt=new W(vt.length);gt.transformConstraintIndex=r.transformConstraints.indexOf(mt);for(var xt=0,wt=0;wt<vt.length;wt++){var yt=vt[wt];gt.setFrame(xt,this.getValue(yt,"time",0),this.getValue(yt,"rotateMix",1),this.getValue(yt,"translateMix",1),this.getValue(yt,"scaleMix",1),this.getValue(yt,"shearMix",1)),this.readCurve(yt,gt,xt),xt++}a.push(gt),i=Math.max(i,gt.frames[(gt.getFrameCount()-1)*W.ENTRIES])}if(t.path)for(var Et in t.path){var bt=t.path[Et],Mt=r.findPathConstraintIndex(Et);if(-1==Mt)throw new Error("Path constraint not found: "+Et);var St=r.pathConstraints[Mt];for(var At in bt){var It=bt[At];if("position"===At||"spacing"===At){var Rt=null,Ct=1;"spacing"===At?(Rt=new q(It.length),St.spacingMode!=exports.SpacingMode.Length&&St.spacingMode!=exports.SpacingMode.Fixed||(Ct=n)):(Rt=new U(It.length),St.positionMode==exports.PositionMode.Fixed&&(Ct=n)),Rt.pathConstraintIndex=Mt;for(var Pt=0,Vt=0;Vt<It.length;Vt++){var _t=It[Vt];Rt.setFrame(Pt,this.getValue(_t,"time",0),this.getValue(_t,At,0)*Ct),this.readCurve(_t,Rt,Pt),Pt++}a.push(Rt),i=Math.max(i,Rt.frames[(Rt.getFrameCount()-1)*U.ENTRIES])}else if("mix"===At){var kt=new H(It.length);kt.pathConstraintIndex=Mt;for(var Ft=0,Bt=0;Bt<It.length;Bt++){var Nt=It[Bt];kt.setFrame(Ft,this.getValue(Nt,"time",0),this.getValue(Nt,"rotateMix",1),this.getValue(Nt,"translateMix",1)),this.readCurve(Nt,kt,Ft),Ft++}a.push(kt),i=Math.max(i,kt.frames[(kt.getFrameCount()-1)*H.ENTRIES])}}}if(t.deform)for(var Ot in t.deform){var Dt=t.deform[Ot],Lt=r.findSkin(Ot);if(null==Lt)throw new Error("Skin not found: "+Ot);for(var Xt in Dt){var Yt=Dt[Xt],Wt=r.findSlotIndex(Xt);if(-1==Wt)throw new Error("Slot not found: "+Yt.name);for(var Ut in Yt){var qt=Yt[Ut],Ht=Lt.getAttachment(Wt,Ut);if(null==Ht)throw new Error("Deform attachment not found: "+qt.name);var jt=null!=Ht.bones,Gt=Ht.vertices,zt=jt?Gt.length/3*2:Gt.length,Zt=new D(qt.length);Zt.slotIndex=Wt,Zt.attachment=Ht;for(var Qt=0,Jt=0;Jt<qt.length;Jt++){var Kt=qt[Jt],$t=void 0,te=this.getValue(Kt,"vertices",null);if(null==te)$t=jt?m.newFloatArray(zt):Gt;else{$t=m.newFloatArray(zt);var ee=this.getValue(Kt,"offset",0);if(m.arrayCopy(te,0,$t,ee,te.length),1!=n)for(var re=ee,ne=re+te.length;re<ne;re++)$t[re]*=n;if(!jt)for(var ae=0;ae<zt;ae++)$t[ae]+=Gt[ae]}Zt.setFrame(Qt,this.getValue(Kt,"time",0),$t),this.readCurve(Kt,Zt,Qt),Qt++}a.push(Zt),i=Math.max(i,Zt.frames[Zt.getFrameCount()-1])}}}var ie=t.drawOrder;if(null==ie&&(ie=t.draworder),null!=ie){for(var se=new X(ie.length),oe=r.slots.length,le=0,he=0;he<ie.length;he++){var ue=ie[he],ce=null,de=this.getValue(ue,"offsets",null);if(null!=de){ce=m.newArray(oe,-1);for(var fe=m.newArray(oe-de.length,0),pe=0,ve=0,me=0;me<de.length;me++){var ge=de[me],xe=r.findSlotIndex(ge.slot);if(-1==xe)throw new Error("Slot not found: "+ge.slot);for(;pe!=xe;)fe[ve++]=pe++;ce[pe+ge.offset]=pe++}for(;pe<oe;)fe[ve++]=pe++;for(var we=oe-1;we>=0;we--)-1==ce[we]&&(ce[we]=fe[--ve])}se.setFrame(le++,this.getValue(ue,"time",0),ce)}a.push(se),i=Math.max(i,se.frames[se.getFrameCount()-1])}if(t.events){for(var ye=new L(t.events.length),Ee=0,be=0;be<t.events.length;be++){var Me=t.events[be],Se=r.findEvent(Me.name);if(null==Se)throw new Error("Event not found: "+Me.name);var Te=new Tt(m.toSinglePrecision(this.getValue(Me,"time",0)),Se);Te.intValue=this.getValue(Me,"int",Se.intValue),Te.floatValue=this.getValue(Me,"float",Se.floatValue),Te.stringValue=this.getValue(Me,"string",Se.stringValue),null!=Te.data.audioPath&&(Te.volume=this.getValue(Me,"volume",1),Te.balance=this.getValue(Me,"balance",0)),ye.setFrame(Ee++,Te)}a.push(ye),i=Math.max(i,ye.frames[ye.getFrameCount()-1])}if(isNaN(i))throw new Error("Error while parsing animation, duration is NaN");r.animations.push(new R(e,a,i))},e.readCurve=function(t,e,r){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(r);else{var n=t.curve;e.setCurve(r,n,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,r){return void 0!==t[e]?t[e]:r},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return exports.BlendMode.Normal;if("additive"==t)return exports.BlendMode.Additive;if("multiply"==t)return exports.BlendMode.Multiply;if("screen"==t)return exports.BlendMode.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return exports.PositionMode.Fixed;if("percent"==t)return exports.PositionMode.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return exports.SpacingMode.Length;if("fixed"==t)return exports.SpacingMode.Fixed;if("percent"==t)return exports.SpacingMode.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return exports.RotateMode.Tangent;if("chain"==t)return exports.RotateMode.Chain;if("chainscale"==t)return exports.RotateMode.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return exports.TransformMode.Normal;if("onlytranslation"==t)return exports.TransformMode.OnlyTranslation;if("norotationorreflection"==t)return exports.TransformMode.NoRotationOrReflection;if("noscale"==t)return exports.TransformMode.NoScale;if("noscaleorreflection"==t)return exports.TransformMode.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Jt=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},Kt=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,r,n){t.x+=d.randomTriangular(-this.jitterX,this.jitterY),t.y+=d.randomTriangular(-this.jitterX,this.jitterY)},e.end=function(){},t}(),$t=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,r,n,a){var i=this.angle*d.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 te(t,e,r){var n=new gt(t);return"json"===r?new Qt(n).readSkeletonData(e):new Ut(n).readSkeletonData(new Uint8Array(e))}function ee(t,e,r){return re.apply(this,arguments)}function re(){return(re=r((function(e,r,n){var a,i;return s(this,(function(s){switch(s.label){case 0:i=e.map((function(e,a){var i=r[a],s=t.AssetType.Texture2D;return"ktx"===i?s=t.AssetType.KTX:"ktx2"===i&&(s=t.AssetType.KTX2),se(e,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 ne(t,e){return ae.apply(this,arguments)}function ae(){return(ae=r((function(e,r){var n,a,i,o,h,u,c,d,f,p,v,m;return s(this,(function(s){switch(s.label){case 0:g=new URL(e),x=g.origin+g.pathname,n=x.endsWith("/")?x:x.substring(0,x.lastIndexOf("/")+1),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,t.request(e,{type:"text"})];case 2:return a=s.sent(),[3,4];case 3:throw o=s.sent(),new Error("Spine Atlas: "+e+" load error: "+o);case 4:for(h=function(){},u=new it(a,(function(){return{setFilters:h,setWraps:h,getImage:function(){return{width:0,height:0}}}})),c=[],d=l(u.pages);!(f=d()).done;)p=f.value,v=n+p.name,c.push(se(v,r));s.label=5;case 5:return s.trys.push([5,7,,8]),[4,Promise.all(c)];case 6:return i=s.sent(),[3,8];case 7:throw m=s.sent(),new Error("Spine Texture: load error: "+m);case 8:return[2,u=ie(a,i)]}var g,x}))}))).apply(this,arguments)}function ie(t,e){var r=0,n=new it(t,(function(t){return function(t,e,r){var n=e.find((function(e){return e.name===t}))||e[r];return a=n,new oe(new Image,a);var a}(t,e,r++)}));return n}function se(e,r,n){return void 0===n&&(n=t.AssetType.Texture2D),r.resourceManager.load({url:e,type:n})}$t.interpolation=new v(2);var oe=function(e){function r(t,r){var n,a;return(n=e.call(this,t)||this).texture=r,null==(a=n.texture)||a.generateMipmaps(),n}a(r,e);var n=r.prototype;return n.getImage=function(){return this.texture},n.setFilters=function(e,r){e===exports.TextureFilter.Nearest?this.texture.filterMode=t.TextureFilterMode.Point:r===exports.TextureFilter.MipMapLinearLinear?this.texture.filterMode=t.TextureFilterMode.Trilinear:this.texture.filterMode=t.TextureFilterMode.Bilinear},n.setWraps=function(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)},n.dispose=function(){},n._convertWrapMode=function(e){switch(e){case exports.TextureWrap.ClampToEdge:return t.TextureWrapMode.Clamp;case exports.TextureWrap.Repeat:return t.TextureWrapMode.Repeat;case exports.TextureWrap.MirroredRepeat:return t.TextureWrapMode.Mirror;default:throw new Error("Unsupported texture wrap mode.")}},r}(rt),le=function(){function t(t,e){void 0===e&&(e=1),this._type=t,this._lastElementIndex=e-1;for(var r=this._elements=new Array(e),n=0;n<e;++n)r[n]=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}(),he=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 r=new this._type;return e.push(r),r}return e[t]},e.clear=function(){this._usedElementCount=0},t}(),ue=t.BlendFactor.SourceAlpha,ce=t.BlendFactor.One,de=t.BlendFactor.DestinationColor,fe=t.BlendFactor.Zero,pe=t.BlendFactor.OneMinusSourceColor,ve=t.BlendFactor.OneMinusSourceAlpha,me=t.BlendOperation.Add;function ge(t,e){var r=t.renderState.blendState.targetBlendState;switch(e){case exports.BlendMode.Additive:r.sourceColorBlendFactor=ue,r.destinationColorBlendFactor=ce,r.sourceAlphaBlendFactor=ce,r.destinationAlphaBlendFactor=ce,r.colorBlendOperation=r.alphaBlendOperation=me;break;case exports.BlendMode.Multiply:r.sourceColorBlendFactor=de,r.destinationColorBlendFactor=ve,r.sourceAlphaBlendFactor=ce,r.destinationAlphaBlendFactor=ve,r.colorBlendOperation=r.alphaBlendOperation=me;break;case exports.BlendMode.Screen:r.sourceColorBlendFactor=ce,r.destinationColorBlendFactor=pe,r.sourceAlphaBlendFactor=ce,r.destinationAlphaBlendFactor=pe,r.colorBlendOperation=r.alphaBlendOperation=me;break;default:r.sourceColorBlendFactor=ue,r.destinationColorBlendFactor=ve,r.sourceAlphaBlendFactor=ce,r.destinationAlphaBlendFactor=ve,r.colorBlendOperation=r.alphaBlendOperation=me}}var xe=1/0,we=-1/0,ye=function(){function t(){this._clipper=new Zt,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}var e=t.prototype;return e.getMaxVertexCount=function(t){for(var e=new Set,r=t.skins,n=r.length,a=0;a<n;a++){var i=r[a];this._collectUniqueAttachments(i,e)}return this._calculateTotalVertexCount(e)},e.buildPrimitive=function(e,r){var n=r.setting,a=n.useClipping,i=void 0===a||a,s=n.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(xe,xe,xe),f.max.set(we,we,we);var p=0,v=0,m=e.drawOrder,g=m.length,x=r.engine,w=r._indices,y=r._vertices,E=r._vertexCount,b=r._subPrimitives,M=t.tempVerts,S=t.tempTexture,T=t.tempBlendMode,A=t.subRenderItemPool,I=t.subPrimitivePool;c.length=0,A.clear();var R,C,P=r._vertices,V=0,_=0,k=exports.BlendMode.Normal,F=null,B=0;t.tempBlendMode=null,t.tempTexture=null;for(var N=0;N<g;++N){var O=m[N];if(O.bone.active){var D=O.getAttachment(),L=null,X=o*N,Y=0,W=h.isClipping(),U=W?2:t.VERTEX_SIZE;if(D){switch(D.constructor){case ut:var q=D;L=q.color,Y=4*U,q.computeWorldVertices(O.bone,M,0,U),R=t.QUAD_TRIANGLES,C=q.uvs,F=q.region.renderObject.texture;break;case dt:var H=D;L=H.color,(Y=(H.worldVerticesLength>>1)*U)>P.length&&(t.tempVerts=new Array(Y)),H.computeWorldVertices(O,0,H.worldVerticesLength,M,0,U),R=H.triangles,C=H.uvs,F=H.region.renderObject.texture;break;case mt:if(i){var j=D;h.clipStart(O,j)}continue;default:i&&h.clipEndWithSlot(O);continue}if(null!=F){var G=void 0,z=void 0,Z=void 0,Q=void 0,J=O.bone.skeleton.color,K=O.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,$),W)h.clipTriangles(M,Y,R,R.length,C,tt,et,!1),z=(G=h.clippedVertices).length,Q=(Z=h.clippedTriangles).length;else{for(var rt=M,nt=tt.r,at=tt.g,it=tt.b,st=tt.a,ot=2,lt=0,ht=Y;ot<ht;ot+=U,lt+=2)rt[ot]=nt,rt[ot+1]=at,rt[ot+2]=it,rt[ot+3]=st,rt[ot+4]=C[lt],rt[ot+5]=C[lt+1];G=M,z=Y,Z=R,Q=R.length}if(0==z||0==Q){h.clipEndWithSlot(O);continue}for(var ct=p/t.VERTEX_STRIDE,ft=y,pt=p,vt=0;vt<z;){var gt=G[vt++],xt=G[vt++];ft[pt++]=gt,ft[pt++]=xt,ft[pt++]=X,ft[pt++]=G[vt++],ft[pt++]=G[vt++],ft[pt++]=G[vt++],ft[pt++]=G[vt++],ft[pt++]=G[vt++],ft[pt++]=G[vt++],this._expandByPoint(gt,xt,X)}p=pt;var wt=w;for(pt=v,vt=0;vt<Q;pt++,vt++)wt[pt]=Z[vt]+ct;v+=Q;var yt=O.data,Et=yt.name;k=yt.blendMode;var bt=null!==T&&T!==yt.blendMode,Mt=null!==S&&S!==F,St=u.get(Et);if(St||bt||Mt){if(_>0){var Tt=b[B];Tt&&B++;var At=Tt||I.get();At.start=V,At.count=_;var It=A.get();It.subPrimitive=At,It.texture=S,It.blendMode=T,c.push(It),V+=_,_=0}if(St){var Rt=d.get(Et);if(Rt){var Ct=F.texture;Rt.filterMode=Ct.filterMode,Rt.wrapModeU=Ct.wrapModeU,Rt.wrapModeV=Ct.wrapModeV}var Pt=b[B];Pt&&B++;var Vt=Pt||I.get();Vt.start=V,Vt.count=Q;var _t=A.get();_t.blendMode=k,_t.subPrimitive=Vt,_t.texture=F,_t.slotName=Et,c.push(_t),V+=Q,_=0}else _+=Q}else _+=Q;S=F,T=k}h.clipEndWithSlot(O)}else i&&h.clipEndWithSlot(O)}else h.clipEndWithSlot(O)}if(_>0){var kt=b[B];kt&&B++;var Ft=kt||I.get();Ft.start=V,Ft.count=_;var Bt=A.get();Bt.blendMode=k,Bt.subPrimitive=Ft,Bt.texture=F,c.push(Bt),_=0}h.clipEnd();var Nt=b.length,Ot=c.length;if(Ot<Nt)for(var Dt=Ot;Dt<Nt;Dt++){var Lt=b[Dt];I.return(Lt)}r._clearSubPrimitives();for(var Xt=0,Yt=Ot;Xt<Yt;++Xt){var Wt=c[Xt],Ut=Wt.slotName,qt=Wt.blendMode,Ht=Wt.texture;r._addSubPrimitive(Wt.subPrimitive);var jt=Ht.texture;d.has(Ut)&&(jt=d.get(Ut));var Gt=jt.instanceId+"_"+qt,zt=Se._materialCache.get(Gt);zt||(zt=this._createMaterialForTexture(jt,x,qt),Se._materialCache.set(Gt,zt)),r.setMaterial(Xt,zt)}if(v>E)return r._createBuffer(v),void this.buildPrimitive(e,r);r._vertexBuffer.setData(y),r._indexBuffer.setData(w)},e.addSeparateSlot=function(t){this._separateSlots.set(t,t)},e.addSeparateSlotTexture=function(t,e){this._separateSlotTextureMap.set(t,e)},e._createMaterialForTexture=function(t,e,r){var n=Se._getDefaultMaterial(e);return n.shaderData.setTexture("material_SpineTexture",t),ge(n,r),n},e._expandByPoint=function(e,r,n){var a=t.bounds,i=a.min,s=a.max,o=Math.min(i.x,e),l=Math.min(i.y,r),h=Math.min(i.z,n),u=Math.max(s.x,e),c=Math.max(s.y,r),d=Math.max(s.z,n);i.set(o,l,h),s.set(u,c,d)},e._collectUniqueAttachments=function(t,e){for(var r=t.attachments,n=0,a=r.length;n<a;n++){var i=r[n];for(var s in i){var o=i[s];o&&!e.has(o)&&e.add(o)}}},e._calculateTotalVertexCount=function(e){var r=0,n=t.QUAD_TRIANGLES.length;return e.forEach((function(t){h(t,ut)?r+=n:h(t,dt)&&(r+=t.triangles.length)})),r},t}();ye.QUAD_TRIANGLES=[0,1,2,2,3,0],ye.VERTEX_SIZE=8,ye.VERTEX_STRIDE=9,ye.tempDark=new c,ye.tempColor=new c,ye.tempVerts=new Array(8),ye.tempBlendMode=null,ye.tempTexture=null,ye.subPrimitivePool=new le(t.SubPrimitive),ye.subRenderItemPool=new he((function(){})),ye.bounds=new t.BoundingBox(new t.Vector3(xe,xe,xe),new t.Vector3(we,we,we));var Ee=function(e){function r(n){var a,i=t.Shader.find("galacean-spine-shader")||t.Shader.create("galacean-spine-shader",r._spineVS,r._spineFS),s=(a=e.call(this,n,i)||this).renderState;return s.blendState.targetBlendState.enabled=!0,ge(b(a),exports.BlendMode.Normal),s.depthState.writeEnabled=!1,s.rasterState.cullMode=t.CullMode.Off,s.renderQueueType=t.RenderQueueType.Transparent,a}return a(r,e),r}(t.Material);Ee._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 ",Ee._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 be,Me,Se=function(e){function r(n){var a;(a=e.call(this,n)||this).setting=new Te,a.defaultState=new Ae,a._subPrimitives=[],a._needResizeBuffer=!1,a._vertexCount=0;var i=new t.Primitive(a._engine);return a._primitive=i,i.addVertexElement(r._positionVertexElement),i.addVertexElement(r._colorVertexElement),i.addVertexElement(r._uvVertexElement),a}a(r,e);var n=r.prototype;return n.addSeparateSlot=function(t){this._skeleton||console.error("Skeleton not found!"),this._skeleton.findSlot(t)?r._spineGenerator.addSeparateSlot(t):console.warn("Slot: "+t+" not find.")},n._onEnable=function(){this._initializeDefaultState()},n.update=function(t){var e=this._state,n=this._skeleton;e&&n&&(e.update(t),e.apply(n),n.updateWorldTransform(),r._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,r=this._subPrimitives,n=this._materials,a=this._engine,i=a._renderElementPool.get();i.set(this.priority,this._distanceForSort);var s=a._subRenderElementPool;if(r){for(var o=0,l=r.length;o<l;o++){var h=n[o];if(h){(h.destroyed||h.shader.destroyed)&&(h=this.engine._meshMagentaMaterial);var u=s.get();u.set(this,h,e,r[o]),i.addSubRenderElement(u)}}t.camera._renderPipeline.pushRenderElement(t,i)}},n._updateBounds=function(t){this._calculateGeneratorBounds(t)},n._calculateGeneratorBounds=function(e){var r=ye.bounds;t.BoundingBox.transform(r,this.entity.transform.worldMatrix,e)},n._cloneTo=function(t){t.resource=this._resource},n._onDestroy=function(){var t=this,r=t._primitive,n=t._subPrimitives,a=t._resource;n.length=0,r&&r.destroy(),a&&this._addResourceReferCount(a,-1),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,this.setting=null,e.prototype._onDestroy.call(this)},n._createBuffer=function(e){var r=this._engine,n=this._primitive;this._vertexCount=e,this._vertices=new Float32Array(e*ye.VERTEX_STRIDE),this._indices=new Uint16Array(e);var a=4*ye.VERTEX_STRIDE,i=new t.Buffer(r,t.BufferBindFlag.VertexBuffer,this._vertices,t.BufferUsage.Dynamic),s=new t.Buffer(r,t.BufferBindFlag.IndexBuffer,this._indices,t.BufferUsage.Dynamic);this._indexBuffer=s,this._vertexBuffer=i;var o=new t.VertexBufferBinding(i,a);this._primitive.setVertexBufferBinding(0,o);var l=new t.IndexBufferBinding(s,t.IndexFormat.UInt16);n.setIndexBufferBinding(l)},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 e,n=t.shaderData.getTexture("material_SpineTexture"),a=(e=t.renderState.blendState.targetBlendState).sourceColorBlendFactor===ue&&e.destinationColorBlendFactor===ce&&e.sourceAlphaBlendFactor===ce&&e.destinationAlphaBlendFactor===ce&&e.colorBlendOperation===me&&e.alphaBlendOperation===me?exports.BlendMode.Additive:e.sourceColorBlendFactor===de&&e.destinationColorBlendFactor===fe&&e.sourceAlphaBlendFactor===ce&&e.destinationAlphaBlendFactor===fe&&e.colorBlendOperation===me&&e.alphaBlendOperation===me?exports.BlendMode.Multiply:e.sourceColorBlendFactor===ce&&e.destinationColorBlendFactor===pe&&e.sourceAlphaBlendFactor===ce&&e.destinationAlphaBlendFactor===pe&&e.colorBlendOperation===me&&e.alphaBlendOperation===me?exports.BlendMode.Screen:exports.BlendMode.Normal,i=n.instanceId+"_"+a;r._materialCache.delete(i)}))},n._initializeDefaultState=function(){var t=this.skeleton,e=this.state;if(t&&e){var r=this.defaultState,n=r.animationName,a=r.skinName,i=r.loop,s=r.scale;t.scaleX=s,t.scaleY=s,"default"!==a&&(t.setSkinByName(a),t.setToSetupPose()),n&&e.setAnimation(0,n,i)}},r._getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new Ee(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},$(r,[{key:"resource",get:function(){return this._resource},set:function(t){var e=this;if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t,this._addResourceReferCount(t,1);var n=t.skeletonData;this._skeleton=new Ot(n);var a=r._animationDataCache.get(n);a||(a=new J(n),r._animationDataCache.set(n,a)),this._state=new j(a),r._spineGenerator.getMaxVertexCount(n),this._createBuffer(0),this._initializeDefaultState(),this._dirtyUpdateFlag|=4,this._state.addListener({start:function(){e._onAnimationStart()},complete:function(t){e._onAnimationComplete(t)}})}},{key:"state",get:function(){return this._state}},{key:"skeleton",get:function(){return this._skeleton}}]),r}(t.Renderer);Se._spineGenerator=new ye,Se._positionVertexElement=new t.VertexElement("POSITION",0,t.VertexElementFormat.Vector3,0),Se._colorVertexElement=new t.VertexElement("COLOR_0",12,t.VertexElementFormat.Vector4,0),Se._uvVertexElement=new t.VertexElement("TEXCOORD_0",28,t.VertexElementFormat.Vector2,0),Se._materialCache=new Map,Se._animationDataCache=new Map,i([t.deepClone],Se.prototype,"setting",void 0),i([t.deepClone],Se.prototype,"defaultState",void 0),i([t.ignoreClone],Se.prototype,"_primitive",void 0),i([t.ignoreClone],Se.prototype,"_subPrimitives",void 0),i([t.ignoreClone],Se.prototype,"_indexBuffer",void 0),i([t.ignoreClone],Se.prototype,"_vertexBuffer",void 0),i([t.ignoreClone],Se.prototype,"_vertices",void 0),i([t.ignoreClone],Se.prototype,"_indices",void 0),i([t.ignoreClone],Se.prototype,"_needResizeBuffer",void 0),i([t.ignoreClone],Se.prototype,"_vertexCount",void 0),i([t.ignoreClone],Se.prototype,"_resource",void 0),i([t.ignoreClone],Se.prototype,"_skeleton",void 0),i([t.ignoreClone],Se.prototype,"_state",void 0),function(t){t[t.TransformVolume=1]="TransformVolume",t[t.AnimationVolume=2]="AnimationVolume",t[t.InitialVolume=4]="InitialVolume"}(be||(be={})),function(t){t[t.WorldVolume=1]="WorldVolume"}(Me||(Me={}));var Te=function(t,e){void 0===t&&(t=.01),void 0===e&&(e=!0),this.zSpacing=t,this.useClipping=e},Ae=function(t,e,r,n){void 0===t&&(t=1),void 0===e&&(e=!0),void 0===r&&(r=null),void 0===n&&(n="default"),this.scale=t,this.loop=e,this.animationName=r,this.skinName=n},Ie=function(t){function e(e,r){var n;return(n=t.call(this,e)||this).textures=[],n._skeletonData=r,n._associationTextureInSkeletonData(r),n}a(e,t);var r=e.prototype;return r._onDestroy=function(){t.prototype._onDestroy.call(this);var e=this.textures,r=this._skeletonData;e&&this._disassociationSuperResource(e),this._clearAttachmentTextures(r),Se._animationDataCache.delete(r),this._skeletonData=null},r._disassociationSuperResource=function(t){for(var e=0,r=t.length;e<r;e++)t[e]._disassociationSuperResource(this)},r._associationTextureInSkeletonData=function(t){var e=this;t.skins.forEach((function(t){t.attachments.forEach((function(t){var r,n=Object.values(t)[0],a=null==n||null==(r=n.region)?void 0:r.texture.texture;a&&!e.textures.find((function(t){return t.instanceId===a.instanceId}))&&(e.textures.push(a),a._associationSuperResource(e))}))}))},r._clearAttachmentTextures=function(t){t.skins.forEach((function(t){t.attachments.forEach((function(t){var e,r=Object.values(t)[0];(null==r||null==(e=r.region)?void 0:e.texture)&&(r.region.texture.texture=null)}))}))},$(e,[{key:"skeletonData",get:function(){return this._skeletonData}}]),e}(t.ReferResource),Re=function(){function t(t,e,r){void 0===e&&(e=0),this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,null!=r?r: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="",r=0,n=t.length;r<n;r++)e+=String.fromCharCode(t[r]);return decodeURIComponent(encodeURIComponent(e))},t}(),Ce=function(e){function n(){return e.apply(this,arguments)}a(n,e);var i=n.prototype;return i.load=function(e,n){var a=this;return new t.AssetPromise(r((function(t){var r,i,o,l;return s(this,(function(s){switch(s.label){case 0:return e.urls?[4,a._handleOriginAsset(e,n)]:[3,2];case 1:return r=s.sent(),[3,7];case 2:return[4,a.request(e.url,{type:"arraybuffer"})];case 3:return i=s.sent(),o=new Re(new Uint8Array(i)),(l=o.nextStr()).startsWith("spine")?[4,a._handleEditorAsset(i,o,l,n)]:[3,5];case 4:return r=s.sent(),[3,7];case 5:return[4,a._handleOriginAsset(e,n,i)];case 6:r=s.sent(),s.label=7;case 7:return t(r),[2]}}))})))},i._handleEditorAsset=function(t,e,n,a){return r((function(){var r,i,o,l,h,u,c,d,f,p,v;return s(this,(function(s){switch(s.label){case 0:return o=n.startsWith("spine:skel")?"skel":"json",l=a.engine,"skel"===o?(i=e.nextStr(),r=e.nextImageData()):(h=new TextDecoder("utf-8"),u=h.decode(new Uint8Array(t)),c=JSON.parse(u),d=c.data,f=c.atlas,i=f.refId,r=d),[4,a.getResourceByRef({refId:i})];case 1:return p=s.sent(),v=te(p,r,o),[2,new Ie(l,v)]}}))}))()},i._handleOriginAsset=function(t,e,a){var i=this;return r((function(){var r,o,l,h,u,c,d,f,p,v,m,g,x,w,y,E,b,M,S,T,A,I,R,C,P,V,_,k,F;return s(this,(function(s){switch(s.label){case 0:if(r=(t.params||{}).fileExtensions,o={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]},l=e.engine,!a)return[3,2];if(h=n.verifyFileExtensions(r,!1),n.deriveAndAssignSpineAsset(t.url,h,o),u=o.skeletonPath,c=o.atlasPath,!u||!c)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");return[4,ne(c,l)];case 1:return d=s.sent(),f=i._determineSkeletonDataType(a),p=f.data,v=f.type,m=te(d,p,v),[2,new Ie(l,m)];case 2:for(r=n.verifyFileExtensions(r,!0),g=0;g<t.urls.length;g+=1)x=t.urls[g],w=r&&r[g]||null,n.parseAndAssignSpineAsset(x,w,o);if(y=o.skeletonPath,E=o.atlasPath,b=o.imagePaths,M=o.skeletonExtension,S=o.imageExtensions,!y||!E)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");return T="json"===M?i.request(y,{type:"text"}):i.request(y,{type:"arraybuffer"}),A="json"===M?"json":"skel",I=[T],b.length>0?(I=I.concat([i.request(E,{type:"text"}),ee(b,S,l)]),[4,Promise.all(I)]):[3,4];case 3:return _=s.sent(),C=_[0],P=_[1],V=_[2],R=ie(P,V),[3,6];case 4:return I.push(ne(E,l)),[4,Promise.all(I)];case 5:k=s.sent(),C=k[0],R=k[1],s.label=6;case 6:return F=te(R,C,A),[2,new Ie(l,F)];case 7:return[2]}}))}))()},i._determineSkeletonDataType=function(t){var e,r;try{var n=new TextDecoder("utf-8").decode(t);JSON.parse(n),e=n,r="json"}catch(n){e=t,r="skel"}return{data:e,type:r}},n.parseAndAssignSpineAsset=function(t,e,r){var a=n.imageExtensions,i=n.skeletonExtensions,s=n.getUrlExtension(t,e);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)))},n.deriveAndAssignSpineAsset=function(t,e,r){var a=n.getUrlExtension(t,e);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}}},n.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},n.getUrlExtension=function(t,e){if(e)return e;var r=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return r?r[2]||r[4]:null},n}(t.Loader);Ce.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"],Ce.skeletonExtensions=["skel","json","bin"],Ce=i([t.resourceLoader("spine",["json","bin","skel"])],Ce);var Pe=function(e){function n(){return e.apply(this,arguments)}return a(n,e),n.prototype.load=function(e,n){var a=this;return new t.AssetPromise(r((function(t){var r,i,o,l,h,u,c;return s(this,(function(s){switch(s.label){case 0:return[4,a.request(e.url,{type:"text"})];case 1:return r=s.sent(),i=JSON.parse(r),o=i.data,l=i.textures,h=l.map((function(t){return n.getResourceByRef({refId:t.refId})})),[4,Promise.all(h)];case 2:return u=s.sent(),c=ie(o,u),t(c),[2]}}))})))},n}(t.Loader);Pe=i([t.resourceLoader("EditorSpineAtlas",["atlas"])],Pe);var Ve="0.0.0-experimental-engine-spine-20240821";t.Loader.registerClass("SpineAnimationRenderer",Se),console.log("Galacean spine version: "+Ve),exports.Animation=R,exports.AnimationState=j,exports.AnimationStateAdapter=Q,exports.AnimationStateData=J,exports.AssetManager=ht,exports.AtlasAttachmentLoader=gt,exports.Attachment=M,exports.AttachmentTimeline=N,exports.Bone=Mt,exports.BoneData=wt,exports.BoundingBoxAttachment=ft,exports.ClippingAttachment=mt,exports.Color=c,exports.ColorTimeline=F,exports.ConstraintData=St,exports.CurveTimeline=C,exports.DebugUtils=g,exports.DeformTimeline=D,exports.DrawOrderTimeline=X,exports.Event=Tt,exports.EventData=At,exports.EventQueue=Z,exports.EventTimeline=L,exports.FakeTexture=at,exports.IkConstraint=It,exports.IkConstraintData=Rt,exports.IkConstraintTimeline=Y,exports.IntSet=u,exports.Interpolation=f,exports.JitterEffect=Kt,exports.MathUtils=d,exports.MeshAttachment=dt,exports.PathAttachment=pt,exports.PathConstraint=Vt,exports.PathConstraintData=Ct,exports.PathConstraintMixTimeline=H,exports.PathConstraintPositionTimeline=U,exports.PathConstraintSpacingTimeline=q,exports.PointAttachment=vt,exports.Pool=x,exports.Pow=p,exports.PowOut=v,exports.RegionAttachment=ut,exports.RotateTimeline=P,exports.ScaleTimeline=_,exports.SharedAssetManager=Ft,exports.ShearTimeline=k,exports.Skeleton=Ot,exports.SkeletonBinary=Ut,exports.SkeletonBounds=Gt,exports.SkeletonClipping=Zt,exports.SkeletonData=Dt,exports.SkeletonDataResource=Ie,exports.SkeletonJson=Qt,exports.Skin=Wt,exports.SkinEntry=Yt,exports.Slot=Bt,exports.SlotData=Lt,exports.SpineAnimationRenderer=Se,exports.SwirlEffect=$t,exports.Texture=rt,exports.TextureAtlas=it,exports.TextureAtlasPage=ot,exports.TextureAtlasRegion=lt,exports.TextureRegion=nt,exports.TimeKeeper=y,exports.TrackEntry=z,exports.TransformConstraint=Nt,exports.TransformConstraintData=Xt,exports.TransformConstraintTimeline=W,exports.TranslateTimeline=V,exports.Triangulator=zt,exports.TwoColorTimeline=B,exports.Utils=m,exports.Vector2=w,exports.VertexAttachment=S,exports.WindowedMean=E,exports.createTextureAtlas=ie,exports.version=Ve;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/engine");function s(t,e,s,r){var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(n<3?i(a):n>3?i(e,s,a):i(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a}"function"==typeof SuppressedError&&SuppressedError;class r{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,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class i{r;g;b;a;static WHITE=new i(1,1,1,1);static RED=new i(1,0,0,1);static GREEN=new i(0,1,0,1);static BLUE=new i(0,0,1,1);static MAGENTA=new i(1,0,1,1);constructor(t=0,e=0,s=0,r=0){this.r=t,this.g=e,this.b=s,this.a=r}set(t,e,s,r){return this.r=t,this.g=e,this.b=s,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,r){return this.r+=t,this.g+=e,this.b+=s,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((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 i).setFromString(t)}}class n{static PI=3.1415927;static PI2=2*n.PI;static invPI2=1/n.PI2;static radiansToDegrees=180/n.PI;static radDeg=n.radiansToDegrees;static degreesToRadians=n.PI/180;static degRad=n.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*n.degRad)}static sinDeg(t){return Math.sin(t*n.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*n.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 n.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let r=Math.random(),i=e-t;return r<=(s-t)/i?t+Math.sqrt(r*i*(s-t)):e-Math.sqrt((1-r)*i*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class a{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class o extends a{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 l{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,r,i){for(let n=e,a=r;n<e+i;n++,a++)s[a]=t[n]}static arrayFill(t,e,s,r){for(let i=e;i<s;i++)t[i]=r}static setArraySize(t,e,s=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let i=r;i<e;i++)t[i]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:l.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e;return s}static newFloatArray(t){if(l.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(l.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 l.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return l.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class h{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 c{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 d{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class u extends d{static nextID=0;id=u.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,r,i,n){s=i+(s>>1)*n;let a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let a=t.bone,h=a.worldX,c=a.worldY,d=a.a,u=a.b,p=a.c,m=a.d;for(let t=e,a=i;a<s;t+=2,a+=n){let e=l[t],s=l[t+1];r[a]=e*d+s*u+h,r[a+1]=e*p+s*m+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=a.bones;if(0==o.length)for(let t=i,e=3*d;t<s;t+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,e+=3){let t=u[h[c]],r=l[e],n=l[e+1],a=l[e+2];s+=(r*t.a+n*t.b+t.worldX)*a,i+=(r*t.c+n*t.d+t.worldY)*a}r[t]=s,r[t+1]=i}else{let t=o;for(let e=i,a=3*d,o=d<<1;e<s;e+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,a+=3,o+=2){let e=u[h[c]],r=l[a]+t[o],n=l[a+1]+t[o+1],d=l[a+2];s+=(r*e.a+n*e.b+e.worldX)*d,i+=(r*e.c+n*e.d+e.worldY)*d}r[e]=s,r[e+1]=i}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),l.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=l.newFloatArray(this.vertices.length),l.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class p{static _nextID=0;id=p.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new p(this.regions.length);return l.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 r=this.regions[s];e.region!=r&&(e.region=r,e.updateRegion())}getPath(t,e){let s=t,r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return p._nextID++}}!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"}(t||(t={}));const m=[t.hold,t.once,t.loop,t.pingpong,t.onceReverse,t.loopReverse,t.pingpongReverse];class f{name;timelines=[];timelineIds=new r;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,r,i,n,a,o){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let r=0,h=l.length;r<h;r++)l[r].apply(t,e,s,i,n,a,o)}}var g,x;exports.MixBlend=void 0,(g=exports.MixBlend||(exports.MixBlend={}))[g.setup=0]="setup",g[g.first=1]="first",g[g.replace=2]="replace",g[g.add=3]="add",exports.MixDirection=void 0,(x=exports.MixDirection||(exports.MixDirection={}))[x.mixIn=0]="mixIn",x[x.mixOut=1]="mixOut";const w={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 b{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=l.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 r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}}class y extends b{curves;constructor(t,e,s){super(t,s),this.curves=l.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=l.newFloatArray(e);l.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*(i-2*a+l),f=.006*(3*(n-o)-r+h),g=.006*(3*(a-l)-i+c),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*(a-i)+m+.16666667*g,M=r+b,S=i+y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],a=this.frames[e+s];return a+(t-n)/(i[r]-n)*(i[r+1]-a)}let n=r+18;for(r+=2;r<n;r+=2)if(i[r]>=t){let e=i[r-2],s=i[r-1];return s+(t-e)/(i[r]-e)*(i[r+1]-s)}e+=this.getFrameEntries();let a=i[n-2],o=i[n-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}}class M extends y{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 r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let r=this.curves[s>>1];switch(r){case 0:let r=e[s],i=e[s+1];return i+(t-r)/(e[s+2]-r)*(e[s+2+1]-i);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);switch(s){case exports.MixBlend.setup:return i+n*e;case exports.MixBlend.first:case exports.MixBlend.replace:n+=i-r}return r+n*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getAbsoluteValue2(t,e,s,r,i,n){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getScaleValue(t,e,s,r,i,a){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return a;case exports.MixBlend.first:return i+(a-i)*e}return i}let o=this.getCurveValue(t)*a;if(1==e)return s==exports.MixBlend.add?i+o-a:o;if(r==exports.MixDirection.mixOut)switch(s){case exports.MixBlend.setup:return a+(Math.abs(o)*n.signum(a)-a)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return i+(Math.abs(o)*n.signum(i)-i)*e}else{let t=0;switch(s){case exports.MixBlend.setup:return t=Math.abs(a)*n.signum(o),t+(o-t)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return t=Math.abs(i)*n.signum(o),t+(o-t)*e}}return i+(o-a)*e}}class S extends y{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class v extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,i,n,o.rotation,o.data.rotation))}}class k extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.x=o.data.x,void(o.y=o.data.y);case exports.MixBlend.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let h=0,c=0,d=b.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 exports.MixBlend.setup:o.x=o.data.x+h*i,o.y=o.data.y+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.x+=(o.data.x+h-o.x)*i,o.y+=(o.data.y+c-o.y)*i;break;case exports.MixBlend.add:o.x+=h*i,o.y+=c*i}}}class I extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,i,n,o.x,o.data.x))}}class A extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,i,n,o.y,o.data.y))}}class B extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,o){let l=t.bones[this.boneIndex];if(!l.active)return;let h,c,d=this.frames;if(s<d[0]){switch(a){case exports.MixBlend.setup:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case exports.MixBlend.first:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}return}let u=b.search(d,s,3),p=this.curves[u/3];switch(p){case 0:let t=d[u];h=d[u+1],c=d[u+2];let e=(s-t)/(d[u+3]-t);h+=(d[u+3+1]-h)*e,c+=(d[u+3+2]-c)*e;break;case 1:h=d[u+1],c=d[u+2];break;default:h=this.getBezierValue(s,u,1,p-2),c=this.getBezierValue(s,u,2,p+18-2)}if(h*=l.data.scaleX,c*=l.data.scaleY,1==i)a==exports.MixBlend.add?(l.scaleX+=h-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=h,l.scaleY=c);else{let t=0,e=0;if(o==exports.MixDirection.mixOut)switch(a){case exports.MixBlend.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(h)*n.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*n.signum(e)-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(h)*n.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*n.signum(e)-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}else switch(a){case exports.MixBlend.setup:t=Math.abs(l.data.scaleX)*n.signum(h),e=Math.abs(l.data.scaleY)*n.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=Math.abs(l.scaleX)*n.signum(h),e=Math.abs(l.scaleY)*n.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}}}}class T extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,i,n,a,o.scaleX,o.data.scaleX))}}class C extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,i,n,a,o.scaleY,o.data.scaleY))}}class F extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case exports.MixBlend.first:o.shearX+=(o.data.shearX-o.shearX)*i,o.shearY+=(o.data.shearY-o.shearY)*i}return}let h=0,c=0,d=b.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 exports.MixBlend.setup:o.shearX=o.data.shearX+h*i,o.shearY=o.data.shearY+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.shearX+=(o.data.shearX+h-o.shearX)*i,o.shearY+=(o.data.shearY+c-o.shearY)*i;break;case exports.MixBlend.add:o.shearX+=h*i,o.shearY+=c*i}}}class E extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,i,n,o.shearX,o.data.shearX))}}class Y extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,i,n,o.shearY,o.data.shearY))}}class R extends b{boneIndex=0;constructor(t,e){super(t,[w.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,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(a==exports.MixDirection.mixOut)return void(n==exports.MixBlend.setup&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||(o.inherit=o.data.inherit):o.inherit=this.frames[b.search(l,s,2)+1]}}class P extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,n){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n}apply(t,e,s,r,i,n,a){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 exports.MixBlend.setup:return void h.setFromColor(t);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i)}return}let c=0,d=0,u=0,p=0,m=b.search(l,s,5),f=this.curves[m/5];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];let e=(s-t)/(l[m+5]-t);c+=(l[m+5+1]-c)*e,d+=(l[m+5+2]-d)*e,u+=(l[m+5+3]-u)*e,p+=(l[m+5+4]-p)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];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),p=this.getBezierValue(s,m,4,f+54-2)}1==i?h.set(c,d,u,p):(n==exports.MixBlend.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*i,(d-h.g)*i,(u-h.b)*i,(p-h.a)*i))}}class _ extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,n,a){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 exports.MixBlend.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i}return}let c=0,d=0,u=0,p=b.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:let t=l[p];c=l[p+1],d=l[p+2],u=l[p+3];let e=(s-t)/(l[p+4]-t);c+=(l[p+4+1]-c)*e,d+=(l[p+4+2]-d)*e,u+=(l[p+4+3]-u)*e;break;case 1:c=l[p+1],d=l[p+2],u=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),u=this.getBezierValue(s,p,3,m+36-2)}if(1==i)h.r=c,h.g=d,h.b=u;else{if(n==exports.MixBlend.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*i,h.g+=(d-h.g)*i,h.b+=(u-h.b)*i}}}class X extends M{slotIndex=0;constructor(t,e,s){super(t,e,w.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,n,a){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 exports.MixBlend.setup:return void(l.a=t.a);case exports.MixBlend.first:l.a+=(t.a-l.a)*i}return}let h=this.getCurveValue(s);1==i?l.a=h:(n==exports.MixBlend.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*i)}}class V extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,n,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,i,n,a){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 exports.MixBlend.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i),c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=0,w=b.search(l,s,8),y=this.curves[w>>3];switch(y){case 0:let t=l[w];d=l[w+1],u=l[w+2],p=l[w+3],m=l[w+4],f=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,p+=(l[w+8+3]-p)*e,m+=(l[w+8+4]-m)*e,f+=(l[w+8+5]-f)*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],p=l[w+3],m=l[w+4],f=l[w+5],g=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,y-2),u=this.getBezierValue(s,w,2,y+18-2),p=this.getBezierValue(s,w,3,y+36-2),m=this.getBezierValue(s,w,4,y+54-2),f=this.getBezierValue(s,w,5,y+72-2),g=this.getBezierValue(s,w,6,y+90-2),x=this.getBezierValue(s,w,7,y+108-2)}if(1==i)h.set(d,u,p,m),c.r=f,c.g=g,c.b=x;else{if(n==exports.MixBlend.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)*i,(u-h.g)*i,(p-h.b)*i,(m-h.a)*i),c.r+=(f-c.r)*i,c.g+=(g-c.g)*i,c.b+=(x-c.b)*i}}}class D extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,r,i,n,a){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 exports.MixBlend.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 exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i,c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=b.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],p=l[x+3],m=l[x+4],f=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,p+=(l[x+7+3]-p)*e,m+=(l[x+7+4]-m)*e,f+=(l[x+7+5]-f)*e,g+=(l[x+7+6]-g)*e;break;case 1:d=l[x+1],u=l[x+2],p=l[x+3],m=l[x+4],f=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),p=this.getBezierValue(s,x,3,w+36-2),m=this.getBezierValue(s,x,4,w+54-2),f=this.getBezierValue(s,x,5,w+72-2),g=this.getBezierValue(s,x,6,w+90-2)}if(1==i)h.r=d,h.g=u,h.b=p,c.r=m,c.g=f,c.b=g;else{if(n==exports.MixBlend.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)*i,h.g+=(u-h.g)*i,h.b+=(p-h.b)*i,c.r+=(m-c.r)*i,c.g+=(f-c.g)*i,c.b+=(g-c.b)*i}}}class O extends b{slotIndex=0;attachmentNames;constructor(t,e){super(t,[w.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,r,i,n,a){let o=t.slots[this.slotIndex];o.bone.active&&(a!=exports.MixDirection.mixOut?s<this.frames[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[b.search1(this.frames,s)]):n==exports.MixBlend.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class N extends y{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[w.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*l-.06*a,f=.006*(3*(n-o)-r+h),g=.018*(a-l+.33333333),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*a+m+.16666667*g,M=r+b,S=y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(r-=2,s[r]>t){let i=this.frames[e];return s[r+1]*(t-i)/(s[r]-i)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let e=s[r-2],i=s[r-1];return i+(t-e)/(s[r]-e)*(s[r+1]-i)}let n=s[i-2],a=s[i-1];return a+(1-a)*(t-n)/(this.frames[e+this.getFrameEntries()]-n)}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let h=o.getAttachment();if(!h)return;if(!(h instanceof u)||h.timelineAttachment!=this.attachment)return;let c=o.deform;0==c.length&&(n=exports.MixBlend.setup);let d=this.vertices,p=d[0].length,m=this.frames;if(s<m[0]){switch(n){case exports.MixBlend.setup:return void(c.length=0);case exports.MixBlend.first:if(1==i)return void(c.length=0);c.length=p;let t=h;if(t.bones){i=1-i;for(f=0;f<p;f++)c[f]*=i}else{let e=t.vertices;for(var f=0;f<p;f++)c[f]+=(e[f]-c[f])*i}}return}if(c.length=p,s>=m[m.length-1]){let t=d[m.length-1];if(1==i)if(n==exports.MixBlend.add){let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]+=t[e];else{let s=e.vertices;for(let e=0;e<p;e++)c[e]+=t[e]-s[e]}}else l.arrayCopy(t,0,c,0,p);else switch(n){case exports.MixBlend.setup:{let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]=t[e]*i;else{let s=e.vertices;for(let e=0;e<p;e++){let r=s[e];c[e]=r+(t[e]-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let e=0;e<p;e++)c[e]+=(t[e]-c[e])*i;break;case exports.MixBlend.add:let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]+=t[e]*i;else{let s=e.vertices;for(let e=0;e<p;e++)c[e]+=(t[e]-s[e])*i}}return}let g=b.search1(m,s),x=this.getCurvePercent(s,g),w=d[g],y=d[g+1];if(1==i)if(n==exports.MixBlend.add){let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]+=e+(y[t]-e)*x}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t];c[t]+=s+(y[t]-s)*x-e[t]}}}else for(let t=0;t<p;t++){let e=w[t];c[t]=e+(y[t]-e)*x}else switch(n){case exports.MixBlend.setup:{let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t],r=e[t];c[t]=r+(s+(y[t]-s)*x-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let t=0;t<p;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x-c[t])*i}break;case exports.MixBlend.add:let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t];c[t]+=(s+(y[t]-s)*x-e[t])*i}}}}}class L extends b{static propertyIds=[""+w.event];events;constructor(t){super(t,L.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,r,i,n,a){if(!r)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,i,n,a),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=b.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)r.push(this.events[h])}}class q extends b{static propertyIds=[""+w.drawOrder];drawOrders;constructor(t){super(t,q.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,r,i,n,a){if(a==exports.MixDirection.mixOut)return void(n==exports.MixBlend.setup&&l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=b.search1(this.frames,s),h=this.drawOrders[o];if(h){let e=t.drawOrder,s=t.slots;for(let t=0,r=h.length;t<r;t++)e[t]=s[h[t]]}else l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class U extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,n,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,r,i,n,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.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 exports.MixBlend.first:o.mix+=(o.data.mix-o.mix)*i,o.softness+=(o.data.softness-o.softness)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=b.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==exports.MixBlend.setup?(o.mix=o.data.mix+(h-o.data.mix)*i,o.softness=o.data.softness+(c-o.data.softness)*i,a==exports.MixDirection.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)*i,o.softness+=(c-o.softness)*i,a==exports.MixDirection.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class W extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=r,l[t+3]=i,l[t+4]=n,l[t+5]=a,l[t+6]=o}apply(t,e,s,r,i,n,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,p,m=this.frames;if(s<m[0]){let t=o.data;switch(n){case exports.MixBlend.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 exports.MixBlend.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*i,o.mixX+=(t.mixX-o.mixX)*i,o.mixY+=(t.mixY-o.mixY)*i,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*i,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*i,o.mixShearY+=(t.mixShearY-o.mixShearY)*i}return}let f=b.search(m,s,7),g=this.curves[f/7];switch(g){case 0:let t=m[f];l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];let e=(s-t)/(m[f+7]-t);l+=(m[f+7+1]-l)*e,h+=(m[f+7+2]-h)*e,c+=(m[f+7+3]-c)*e,d+=(m[f+7+4]-d)*e,u+=(m[f+7+5]-u)*e,p+=(m[f+7+6]-p)*e;break;case 1:l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];break;default:l=this.getBezierValue(s,f,1,g-2),h=this.getBezierValue(s,f,2,g+18-2),c=this.getBezierValue(s,f,3,g+36-2),d=this.getBezierValue(s,f,4,g+54-2),u=this.getBezierValue(s,f,5,g+72-2),p=this.getBezierValue(s,f,6,g+90-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*i,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*i,o.mixShearY=t.mixShearY+(p-t.mixShearY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i,o.mixScaleX+=(d-o.mixScaleX)*i,o.mixScaleY+=(u-o.mixScaleY)*i,o.mixShearY+=(p-o.mixShearY)*i}}class z extends M{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,i,n,o.position,o.data.position))}}class $ extends M{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,i,n,o.spacing,o.data.spacing))}}class G extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let n=this.frames;n[t<<=2]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(n){case exports.MixBlend.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case exports.MixBlend.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*i,o.mixX+=(o.data.mixX-o.mixX)*i,o.mixY+=(o.data.mixY-o.mixY)*i}return}let u=b.search(d,s,4),p=this.curves[u>>2];switch(p){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,p-2),h=this.getBezierValue(s,u,2,p+18-2),c=this.getBezierValue(s,u,3,p+36-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i}}class j extends M{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const r of t.physicsConstraints)r.active&&this.global(r.data)&&this.set(r,this.getAbsoluteValue2(s,i,n,this.get(r),this.setup(r),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,i,n,this.get(o),this.setup(o)))}}class H extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class J extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class K extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Q extends j{constructor(t,e,s){super(t,e,s,w.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 Z extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class tt extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class et extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class st extends b{static propertyIds=[w.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,st.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,r,i,n,a){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,[],i,n,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[b.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class rt extends b{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[w.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return rt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,i){let n=this.frames;n[t*=rt.ENTRIES]=e,n[t+rt.MODE]=s|r<<4,n[t+rt.DELAY]=i}apply(e,s,r,i,n,a,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=l.attachment,c=this.attachment;if(!(h==c||h instanceof u&&h.timelineAttachment==c))return;let d=this.frames;if(r<d[0])return void(a!=exports.MixBlend.setup&&a!=exports.MixBlend.first||(l.sequenceIndex=-1));let p=b.search(d,r,rt.ENTRIES),f=d[p],g=d[p+rt.MODE],x=d[p+rt.DELAY];if(!this.attachment.sequence)return;let w=g>>4,y=this.attachment.sequence.regions.length,M=m[15&g];if(M!=t.hold)switch(w+=(r-f)/x+1e-5|0,M){case t.once:w=Math.min(y-1,w);break;case t.loop:w%=y;break;case t.pingpong:{let t=(y<<1)-2;w=0==t?0:w%t,w>=y&&(w=t-w);break}case t.onceReverse:w=Math.max(y-1-w,0);break;case t.loopReverse:w=y-1-w%y;break;case t.pingpongReverse:{let t=(y<<1)-2;w=0==t?0:(w+y-1)%t,w>=y&&(w=t-w)}}l.sequenceIndex=w}}class it{static _emptyAnimation=new f("<empty>",[],0);static emptyAnimation(){return it._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new at(this);propertyIDs=new r;animationsChanged=!1;trackEntryPool=new h((()=>new nt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let i=t*r.timeScale;if(r.delay>0){if(r.delay-=i,r.delay>0)continue;i=-r.delay,r.delay=0}let n=r.next;if(n){let e=r.trackLast-n.delay;if(e>=0){for(n.delay=0,n.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*n.timeScale,r.trackTime+=i,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=i}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let r=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)),r):(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,r=!1;for(let n=0,a=s.length;n<a;n++){let a=s[n];if(!a||a.delay>0)continue;r=!0;let o=0==n?exports.MixBlend.first:a.mixBlend,h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let c=h>=a.alphaAttachmentThreshold,d=a.animationLast,u=a.getAnimationTime(),p=u,m=e;a.reverse&&(p=a.animation.duration-p,m=null);let f=a.animation.timelines,g=f.length;if(0==n&&1==h||o==exports.MixBlend.add){0==n&&(c=!0);for(let e=0;e<g;e++){l.webkit602BugfixHelper(h,o);var i=f[e];i instanceof O?this.applyAttachmentTimeline(i,t,p,o,c):i.apply(t,d,p,m,h,o,exports.MixDirection.mixIn)}}else{let e=a.timelineMode,s=a.shortestRotation,r=!s&&a.timelinesRotation.length!=g<<1;r&&(a.timelinesRotation.length=g<<1);for(let i=0;i<g;i++){let n=f[i],u=e[i]==lt?o:exports.MixBlend.setup;!s&&n instanceof v?this.applyRotateTimeline(n,t,p,h,u,a.timelinesRotation,i<<1,r):n instanceof O?this.applyAttachmentTimeline(n,t,p,o,c):(l.webkit602BugfixHelper(h,o),n.apply(t,d,p,m,h,u,exports.MixDirection.mixIn))}}this.queueEvents(a,u),e.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}for(var n=this.unkeyedState+pt,a=t.slots,o=0,h=t.slots.length;o<h;o++){var c=a[o];if(c.attachmentState==n){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,s){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,s);let i=0;0==t.mixDuration?(i=1,s==exports.MixBlend.first&&(s=exports.MixBlend.setup)):(i=t.mixTime/t.mixDuration,i>1&&(i=1),s!=exports.MixBlend.first&&(s=r.mixBlend));let n=i<r.mixAttachmentThreshold,a=i<r.mixDrawOrderThreshold,o=r.animation.timelines,h=o.length,c=r.alpha*t.interruptAlpha,d=c*(1-i),u=r.animationLast,p=r.getAnimationTime(),m=p,f=null;if(r.reverse?m=r.animation.duration-m:i<r.eventThreshold&&(f=this.events),s==exports.MixBlend.add)for(let t=0;t<h;t++)o[t].apply(e,u,m,f,d,s,exports.MixDirection.mixOut);else{let t=r.timelineMode,i=r.timelineHoldMix,p=r.shortestRotation,g=!p&&r.timelinesRotation.length!=h<<1;g&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let x=0;x<h;x++){let h,w=o[x],b=exports.MixDirection.mixOut,y=0;switch(t[x]){case lt:if(!a&&w instanceof q)continue;h=s,y=d;break;case ht:h=exports.MixBlend.setup,y=d;break;case ct:h=s,y=c;break;case dt:h=exports.MixBlend.setup,y=c;break;default:h=exports.MixBlend.setup;let t=i[x];y=c*Math.max(0,1-t.mixTime/t.mixDuration)}r.totalAlpha+=y,!p&&w instanceof v?this.applyRotateTimeline(w,e,m,y,h,r.timelinesRotation,x<<1,g):w instanceof O?this.applyAttachmentTimeline(w,e,m,h,n&&y>=r.alphaAttachmentThreshold):(l.webkit602BugfixHelper(y,s),a&&w instanceof q&&h==exports.MixBlend.setup&&(b=exports.MixDirection.mixIn),w.apply(e,u,m,f,y,h,b))}}return t.mixDuration>0&&this.queueEvents(r,p),this.events.length=0,r.nextAnimationLast=p,r.nextTrackLast=r.trackTime,i}applyAttachmentTimeline(t,e,s,r,i){var n=e.slots[t.slotIndex];n.bone.active&&(s<t.frames[0]?r!=exports.MixBlend.setup&&r!=exports.MixBlend.first||this.setAttachment(e,n,n.data.attachmentName,i):this.setAttachment(e,n,t.attachmentNames[b.search1(t.frames,s)],i),n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+pt))}setAttachment(t,e,s,r){e.setAttachment(s?t.getAttachment(e.data.index,s):null),r&&(e.attachmentState=this.unkeyedState+mt)}applyRotateTimeline(t,e,s,r,i,a,o,l){if(l&&(a[o]=0),1==r)return void t.apply(e,0,s,null,1,i,exports.MixDirection.mixIn);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(i){case exports.MixBlend.setup:h.rotation=h.data.rotation;default:return;case exports.MixBlend.first:c=h.rotation,d=h.data.rotation}else c=i==exports.MixBlend.setup?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(s);let u=0,p=d-c;if(p-=360*Math.ceil(p/360-.5),0==p)u=a[o];else{let t=0,e=0;l?(t=0,e=p):(t=a[o],e=a[o+1]);let s=t-t%360;u=p+s;let r=p>=0,i=t>=0;Math.abs(e)<=90&&n.signum(e)!=n.signum(p)&&(Math.abs(t-s)>180?(u+=360*n.signum(t),i=r):0!=s?u-=360*n.signum(t):i=r),i!=r&&(u+=360*n.signum(t)),a[o]=u}a[o+1]=p,h.rotation=c+u*r}queueEvents(t,e){let s=t.animationStart,r=t.animationEnd,i=r-s,n=t.trackLast%i,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<n)break;e.time>r||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==i)h=!0;else{const e=Math.floor(t.trackTime/i);h=e>0&&e>Math.floor(t.trackLast/i)}else h=e>=r&&t.animationLast<r;for(h&&this.queue.complete(t);o<l;o++){let e=a[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 r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,i=this.expandToIndex(t);i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,r=!1):this.clearNext(i));let n=this.trackEntry(t,e,s,i);return this.setCurrent(t,n,r),this.queue.drain(),n}addAnimation(t,e,s=!1,r=0){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let i=this.expandToIndex(t);if(i)for(;i.next;)i=i.next;let n=this.trackEntry(t,e,s,i);return i?(i.next=n,n.previous=i,r<=0&&(r+=i.getTrackComplete()-n.mixDuration)):(this.setCurrent(t,n,!0),this.queue.drain()),n.delay=r,n}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,it.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let r=this.addAnimationWith(t,it.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let 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]:(l.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,r){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=t,i.animation=e,i.loop=s,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.alphaAttachmentThreshold=0,i.mixAttachmentThreshold=0,i.mixDrawOrderThreshold=0,i.animationStart=0,i.animationEnd=e.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=r?this.data.getMix(r.animation,e):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=exports.MixBlend.replace,i}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==exports.MixBlend.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,r=t.animation.timelines.length,i=t.timelineMode;i.length=r;let n=t.timelineHoldMix;n.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<r;t++)i[t]=a.addAll(s[t].getPropertyIds())?dt:ct;else t:for(let o=0;o<r;o++){let r=s[o],l=r.getPropertyIds();if(a.addAll(l))if(!e||r instanceof O||r instanceof q||r instanceof L||!e.animation.hasTimeline(l))i[o]=ht;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){i[o]=ut,n[o]=s;continue t}break}i[o]=dt}else i[o]=lt}}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=exports.MixBlend.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 at{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(exports.EventType.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(exports.EventType.interrupt),this.objects.push(t)}end(t){this.objects.push(exports.EventType.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(exports.EventType.dispose),this.objects.push(t)}complete(t){this.objects.push(exports.EventType.complete),this.objects.push(t)}event(t,e){this.objects.push(exports.EventType.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 r=t[s],i=t[s+1];switch(r){case exports.EventType.start:i.listener&&i.listener.start&&i.listener.start(i);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(i)}break;case exports.EventType.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(i)}break;case exports.EventType.end:i.listener&&i.listener.end&&i.listener.end(i);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(i)}case exports.EventType.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(i)}this.animState.trackEntryPool.free(i);break;case exports.EventType.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(i)}break;case exports.EventType.event:let r=t[2+s++];i.listener&&i.listener.event&&i.listener.event(i,r);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(i,r)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var ot;exports.EventType=void 0,(ot=exports.EventType||(exports.EventType={}))[ot.start=0]="start",ot[ot.interrupt=1]="interrupt",ot[ot.end=2]="end",ot[ot.dispose=3]="dispose",ot[ot.complete=4]="complete",ot[ot.event=5]="event";const lt=0,ht=1,ct=2,dt=3,ut=4,pt=1,mt=2;class ft{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}}class gt extends u{color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new gt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class xt extends u{endSlot=null;color=new i(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new xt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class wt{_image;constructor(t){this._image=t}getImage(){return this._image}}var bt,yt,Mt,St,vt,kt,It,At,Bt;exports.TextureFilter=void 0,(bt=exports.TextureFilter||(exports.TextureFilter={}))[bt.Nearest=9728]="Nearest",bt[bt.Linear=9729]="Linear",bt[bt.MipMap=9987]="MipMap",bt[bt.MipMapNearestNearest=9984]="MipMapNearestNearest",bt[bt.MipMapLinearNearest=9985]="MipMapLinearNearest",bt[bt.MipMapNearestLinear=9986]="MipMapNearestLinear",bt[bt.MipMapLinearLinear=9987]="MipMapLinearLinear",exports.TextureWrap=void 0,(yt=exports.TextureWrap||(exports.TextureWrap={}))[yt.MirroredRepeat=33648]="MirroredRepeat",yt[yt.ClampToEdge=33071]="ClampToEdge",yt[yt.Repeat=10497]="Repeat";class Tt{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class Ct{pages=new Array;regions=new Array;constructor(t){let e=new Ft(t),s=new Array(4),r={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=l.enumValue(exports.TextureFilter,s[1]),t.magFilter=l.enumValue(exports.TextureFilter,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=exports.TextureWrap.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=exports.TextureWrap.Repeat)},pma:t=>{t.pma="true"==s[1]}};var i={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 a=null,o=null,h=null;for(;null!==n;)if(0==n.trim().length)a=null,n=e.readLine();else if(a){let t=new Yt(a,n);for(;;){let r=e.readEntry(s,n=e.readLine());if(0==r)break;let a=i[s[0]];if(a)a(t);else{o||(o=[]),h||(h=[]),o.push(s[0]);let t=[];for(let e=0;e<r;e++)t.push(parseInt(s[e+1]));h.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&h&&h.length>0&&(t.names=o,t.values=h,o=null,h=null),t.u=t.x/a.width,t.v=t.y/a.height,90==t.degrees?(t.u2=(t.x+t.height)/a.width,t.v2=(t.y+t.width)/a.height):(t.u2=(t.x+t.width)/a.width,t.v2=(t.y+t.height)/a.height),this.regions.push(t)}else{for(a=new Et(n.trim());0!=e.readEntry(s,n=e.readLine());){let t=r[s[0]];t&&t(a)}this.pages.push(a)}}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 Ft{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 r=1,i=s+1;;r++){let s=e.indexOf(",",i);if(-1==s)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,s-i).trim(),i=s+1,4==r)return 4}}}class Et{name;minFilter=exports.TextureFilter.Nearest;magFilter=exports.TextureFilter.Nearest;uWrap=exports.TextureWrap.ClampToEdge;vWrap=exports.TextureWrap.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 Yt extends Tt{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 Rt extends u{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new i(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new i(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=l.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,r=this.region.u,i=this.region.v,n=0,a=0;if(this.region instanceof Yt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,i-=(o.originalWidth-o.offsetX-o.width)/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+t[o+1]*n,e[o+1]=i+(1-t[o])*a;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/h,i-=o.offsetY/c,n=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o])*n,e[o+1]=i+(1-t[o+1])*a;return;case 270:r-=o.offsetY/h,i-=o.offsetX/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o+1])*n,e[o+1]=i+t[o]*a;return}r-=o.offsetX/h,i-=(o.originalHeight-o.offsetY-o.height)/c,n=o.originalWidth/h,a=o.originalHeight/c}else this.region?(n=this.region.u2-r,a=this.region.v2-i):(r=i=0,n=a=1);for(let o=0;o<s;o+=2)e[o]=r+t[o]*n,e[o+1]=i+t[o+1]*a}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 Rt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),l.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),l.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),l.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),l.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,i,n){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,i,n)}newLinkedMesh(){let t=new Rt(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 Pt extends u{lengths=[];closed=!1;constantSpeed=!1;color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new Pt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),l.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class _t extends u{x=0;y=0;rotation=0;color=new i(.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*n.degRad,s=Math.cos(e),r=Math.sin(e),i=s*t.a+r*t.b,a=s*t.c+r*t.d;return n.atan2Deg(a,i)}copy(){let t=new _t(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class Xt extends d{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new i(1,1,1,1);path;region=null;sequence=null;offset=l.newFloatArray(8);uvs=l.newFloatArray(8);tempColor=new i(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,r=this.height/this.region.originalHeight*this.scaleY,i=-this.width/2*this.scaleX+this.region.offsetX*s,a=-this.height/2*this.scaleY+this.region.offsetY*r,o=i+this.region.width*s,l=a+this.region.height*r,h=this.rotation*n.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,p=this.y,m=i*c+u,f=i*d,g=a*c+p,x=a*d,w=o*c+u,b=o*d,y=l*c+p,M=l*d,S=this.offset;S[0]=m-x,S[1]=g+f,S[2]=m-M,S[3]=y+f,S[4]=w-M,S[5]=y+b,S[6]=w-x,S[7]=g+b,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,r){null!=this.sequence&&this.sequence.apply(t,this);let i=t.bone,n=this.offset,a=i.worldX,o=i.worldY,l=i.a,h=i.b,c=i.c,d=i.d,u=0,p=0;u=n[0],p=n[1],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[2],p=n[3],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[4],p=n[5],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[6],p=n[7],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o}copy(){let t=new Xt(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,l.arrayCopy(this.uvs,0,t.uvs,0,8),l.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 Vt{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,n=r.length;i<n;i++){let n=s.getPath(e,i),a=this.atlas.findRegion(n);if(null==a)throw new Error("Region not found in atlas: "+n+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new Xt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=t}return i}newMeshAttachment(t,e,s,r){let i=new Rt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=t}return i}newBoundingBoxAttachment(t,e){return new gt(e)}newPathAttachment(t,e){return new Pt(e)}newPointAttachment(t,e){return new _t(e)}newClippingAttachment(t,e){return new xt(e)}}class Dt{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=exports.Inherit.Normal;skinRequired=!1;color=new i;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}}exports.Inherit=void 0,(Mt=exports.Inherit||(exports.Inherit={}))[Mt.Normal=0]="Normal",Mt[Mt.OnlyTranslation=1]="OnlyTranslation",Mt[Mt.NoRotationOrReflection=2]="NoRotationOrReflection",Mt[Mt.NoScale=3]="NoScale",Mt[Mt.NoScaleOrReflection=4]="NoScaleOrReflection";class Ot{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=exports.Inherit.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,r,i,a,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=a,this.ashearY=o;let l=this.parent;if(!l){let l=this.skeleton;const h=l.scaleX,c=l.scaleY,d=(s+a)*n.degRad,u=(s+90+o)*n.degRad;return this.a=Math.cos(d)*r*h,this.b=Math.cos(u)*i*h,this.c=Math.sin(d)*r*c,this.d=Math.sin(u)*i*c,this.worldX=t*h+l.x,void(this.worldY=e*c+l.y)}let h=l.a,c=l.b,d=l.c,u=l.d;switch(this.worldX=h*t+c*e+l.worldX,this.worldY=d*t+u*e+l.worldY,this.inherit){case exports.Inherit.Normal:{const t=(s+a)*n.degRad,e=(s+90+o)*n.degRad,l=Math.cos(t)*r,p=Math.cos(e)*i,m=Math.sin(t)*r,f=Math.sin(e)*i;return this.a=h*l+c*m,this.b=h*p+c*f,this.c=d*l+u*m,void(this.d=d*p+u*f)}case exports.Inherit.OnlyTranslation:{const t=(s+a)*n.degRad,e=(s+90+o)*n.degRad;this.a=Math.cos(t)*r,this.b=Math.cos(e)*i,this.c=Math.sin(t)*r,this.d=Math.sin(e)*i;break}case exports.Inherit.NoRotationOrReflection:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;h*=t,d*=e;let l=h*h+d*d,p=0;l>1e-4?(l=Math.abs(h*u*e-c*t*d)/l,c=d*l,u=h*l,p=Math.atan2(d,h)*n.radDeg):(h=0,d=0,p=90-Math.atan2(u,c)*n.radDeg);const m=(s+a-p)*n.degRad,f=(s+o-p+90)*n.degRad,g=Math.cos(m)*r,x=Math.cos(f)*i,w=Math.sin(m)*r,b=Math.sin(f)*i;this.a=h*g-c*w,this.b=h*x-c*b,this.c=d*g+u*w,this.d=d*x+u*b;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:{s*=n.degRad;const t=Math.cos(s),e=Math.sin(s);let l=(h*t+c*e)/this.skeleton.scaleX,p=(d*t+u*e)/this.skeleton.scaleY,m=Math.sqrt(l*l+p*p);m>1e-5&&(m=1/m),l*=m,p*=m,m=Math.sqrt(l*l+p*p),this.inherit==exports.Inherit.NoScale&&h*u-c*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(p,l);const f=Math.cos(s)*m,g=Math.sin(s)*m;a*=n.degRad,o=(90+o)*n.degRad;const x=Math.cos(a)*r,w=Math.cos(o)*i,b=Math.sin(a)*r,y=Math.sin(o)*i;this.a=l*x+f*b,this.b=l*w+f*y,this.c=p*x+g*b,this.d=p*w+g*y;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)*n.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)*n.radDeg);let e,s,r,i,a=t.a,o=t.b,l=t.c,h=t.d,c=1/(a*h-o*l),d=h*c,u=o*c,p=l*c,m=a*c,f=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=f*d-g*u,this.ay=g*m-f*p,this.inherit==exports.Inherit.OnlyTranslation)e=this.a,s=this.b,r=this.c,i=this.d;else{switch(this.inherit){case exports.Inherit.NoRotationOrReflection:{let t=Math.abs(a*h-o*l)/(a*a+l*l);o=-l*this.skeleton.scaleX*t/this.skeleton.scaleY,h=a*this.skeleton.scaleY*t/this.skeleton.scaleX,c=1/(a*h-o*l),d=h*c,u=o*c;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:let t=n.cosDeg(this.rotation),e=n.sinDeg(this.rotation);a=(a*t+o*e)/this.skeleton.scaleX,l=(l*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(a*a+l*l);s>1e-5&&(s=1/s),a*=s,l*=s,s=Math.sqrt(a*a+l*l),this.inherit==exports.Inherit.NoScale&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let r=n.PI/2+Math.atan2(l,a);o=Math.cos(r)*s,h=Math.sin(r)*s,c=1/(a*h-o*l),d=h*c,u=o*c,p=l*c,m=a*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,r=m*this.c-p*this.a,i=m*this.d-p*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){let t=e*i-s*r;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+r*i,t)*n.radDeg,this.arotation=Math.atan2(r,e)*n.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+i*i),this.ashearY=0,this.arotation=90-Math.atan2(i,s)*n.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*n.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*n.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,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*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=n.sinDeg(t),s=n.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*n.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=n.sinDeg(t),s=n.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*n.radDeg}rotateWorld(t){t*=n.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}}class Nt{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class Lt{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,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}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 r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",t,!0);let i=()=>{this.finish(t,r.status,r.responseText)};r.onload=i,r.onerror=i,r.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 r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer";let i=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{200==r.status||0==r.status?this.finish(t,200,new Uint8Array(r.response)):i()},r.onerror=i,r.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=200==e||0==e?[s]:[e,s];for(let t=i.length-1,e=r.length;t<e;t+=2)r[t].apply(null,i)}}class qt{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 Ut{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Wt{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 r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(r)}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,r,i,a,o){let l=t.parent;if(!l)throw new Error("IK bone must have parent.");let h=l.a,c=l.b,d=l.c,u=l.d,p=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case exports.Inherit.OnlyTranslation:m=(e-t.worldX)*n.signum(t.skeleton.scaleX),f=(s-t.worldY)*n.signum(t.skeleton.scaleY);break;case exports.Inherit.NoRotationOrReflection:let r=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),i=h/t.skeleton.scaleX,a=d/t.skeleton.scaleY;c=-a*r*t.skeleton.scaleX,u=i*r*t.skeleton.scaleY,p+=Math.atan2(a,i)*n.radDeg;default:let o=e-l.worldX,g=s-l.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(m=0,f=0):(m=(o*u-g*c)/x-t.ax,f=(g*h-o*d)/x-t.ay)}p+=Math.atan2(f,m)*n.radDeg,t.ascaleX<0&&(p+=180),p>180?p-=360:p<-180&&(p+=360);let g=t.ascaleX,x=t.ascaleY;if(r||i){switch(t.inherit){case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const n=t.data.length*g;if(n>1e-4){const t=m*m+f*f;if(r&&t<n*n||i&&t>n*n){const e=(Math.sqrt(t)/n-1)*o+1;g*=e,a&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+p*o,g,x,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,a,o,l,h){if(t.inherit!=exports.Inherit.Normal||e.inherit!=exports.Inherit.Normal)return;let c=t.ax,d=t.ay,u=t.ascaleX,p=t.ascaleY,m=u,f=p,g=e.ascaleX,x=0,w=0,b=0;u<0?(u=-u,x=180,b=-1):(x=0,b=1),p<0&&(p=-p,b=-b),g<0?(g=-g,w=180):w=0;let y=e.ax,M=0,S=0,v=0,k=t.a,I=t.b,A=t.c,B=t.d,T=Math.abs(u-p)<=1e-4;!T||a?(M=0,S=k*y+t.worldX,v=A*y+t.worldY):(M=e.ay,S=k*y+I*M+t.worldX,v=A*y+B*M+t.worldY);let C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");k=C.a,I=C.b,A=C.c,B=C.d;let F=k*B-I*A,E=S-C.worldX,Y=v-C.worldY;F=Math.abs(F)<=1e-4?0:1/F;let R,P,_=(E*B-Y*I)*F-c,X=(Y*k-E*A)*F-d,V=Math.sqrt(_*_+X*X),D=e.data.length*g;if(V<1e-4)return this.apply1(t,s,r,!1,a,!1,h),void e.updateWorldTransformWith(y,M,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-C.worldX,Y=r-C.worldY;let O=(E*B-Y*I)*F-c,N=(Y*k-E*A)*F-d,L=O*O+N*N;if(0!=l){l*=u*(g+1)*.5;let t=Math.sqrt(L),e=t-V-D*u+l;if(e>0){let s=Math.min(1,e/(2*l))-1;s=(e-l*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(T){D*=u;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,P=Math.PI*i):t>1?(t=1,P=0,a&&(k=(Math.sqrt(L)/(V+D)-1)*h+1,m*=k,o&&(f*=k))):P=Math.acos(t)*i,k=V+D*t,I=D*Math.sin(P),R=Math.atan2(N*k-O*I,O*k+N*I)}else{k=u*D,I=p*D;let t=k*k,e=I*I,s=Math.atan2(N,O);A=e*V*V+t*L-t*e;let r=-2*e*V,a=e-t;if(B=r*r-4*a*A,B>=0){let t=Math.sqrt(B);r<0&&(t=-t),t=.5*-(r+t);let e=t/a,n=A/t,o=Math.abs(e)<Math.abs(n)?e:n;if(e=L-o*o,e>=0){Y=Math.sqrt(e)*i,R=s-Math.atan2(Y,o),P=Math.atan2(Y/p,(o-V)/u);break t}}let o=n.PI,l=V-k,h=l*l,c=0,d=0,m=V+k,f=m*m,g=0;A=-k*V/(t-e),A>=-1&&A<=1&&(A=Math.acos(A),E=k*Math.cos(A)+V,Y=I*Math.sin(A),B=E*E+Y*Y,B<h&&(o=A,h=B,l=E,c=Y),B>f&&(d=A,f=B,m=E,g=Y)),L<=.5*(h+f)?(R=s-Math.atan2(c*i,l),P=o*i):(R=s-Math.atan2(g*i,m),P=d*i)}let q=Math.atan2(M,y)*b,U=t.arotation;R=(R-q)*n.radDeg+x-U,R>180?R-=360:R<-180&&(R+=360),t.updateWorldTransformWith(c,d,U+R*h,m,f,0,0),U=e.arotation,P=((P+q)*n.radDeg-e.ashearX)*b+w-U,P>180?P-=360:P<-180&&(P+=360),e.updateWorldTransformWith(y,M,U+P*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class zt extends Nt{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 $t extends Nt{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=exports.PositionMode.Fixed;spacingMode=exports.SpacingMode.Fixed;rotateMode=exports.RotateMode.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}exports.PositionMode=void 0,(St=exports.PositionMode||(exports.PositionMode={}))[St.Fixed=0]="Fixed",St[St.Percent=1]="Percent",exports.SpacingMode=void 0,(vt=exports.SpacingMode||(exports.SpacingMode={}))[vt.Length=0]="Length",vt[vt.Fixed=1]="Fixed",vt[vt.Percent=2]="Percent",vt[vt.Proportional=3]="Proportional",exports.RotateMode=void 0,(kt=exports.RotateMode||(exports.RotateMode={}))[kt.Tangent=0]="Tangent",kt[kt.Chain=1]="Chain",kt[kt.ChainScale=2]="ChainScale";class Gt{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,r=t.bones.length;s<r;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}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 Pt))return;let s=this.mixRotate,r=this.mixX,i=this.mixY;if(0==s&&0==r&&0==i)return;let a=this.data,o=a.rotateMode==exports.RotateMode.Tangent,h=a.rotateMode==exports.RotateMode.ChainScale,c=this.bones,d=c.length,u=o?d:d+1,p=l.setArraySize(this.spaces,u),m=h?this.lengths=l.setArraySize(this.lengths,d):[],f=this.spacing;switch(a.spacingMode){case exports.SpacingMode.Percent:if(h)for(let t=0,e=u-1;t<e;t++){let e=c[t],s=e.data.length,r=s*e.a,i=s*e.c;m[t]=Math.sqrt(r*r+i*i)}l.arrayFill(p,1,u,f);break;case exports.SpacingMode.Proportional:let t=0;for(let e=0,s=u-1;e<s;){let s=c[e],r=s.data.length;if(r<Gt.epsilon)h&&(m[e]=0),p[++e]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);h&&(m[e]=a),p[++e]=a,t+=a}}if(t>0){t=u/t*f;for(let e=1;e<u;e++)p[e]*=t}break;default:let e=a.spacingMode==exports.SpacingMode.Length;for(let t=0,s=u-1;t<s;){let s=c[t],r=s.data.length;if(r<Gt.epsilon)h&&(m[t]=0),p[++t]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);h&&(m[t]=a),p[++t]=(e?r+f:f)*a/r}}}let g=this.computeWorldPositions(e,u,o),x=g[0],w=g[1],b=a.offsetRotation,y=!1;if(0==b)y=a.rotateMode==exports.RotateMode.Chain;else{y=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?n.degRad:-n.degRad}for(let t=0,e=3;t<d;t++,e+=3){let a=c[t];a.worldX+=(x-a.worldX)*r,a.worldY+=(w-a.worldY)*i;let l=g[e],d=g[e+1],u=l-x,f=d-w;if(h){let e=m[t];if(0!=e){let t=(Math.sqrt(u*u+f*f)/e-1)*s+1;a.a*=t,a.c*=t}}if(x=l,w=d,s>0){let r=a.a,i=a.b,l=a.c,h=a.d,c=0,d=0,m=0;if(c=o?g[e-1]:0==p[t+1]?g[e+2]:Math.atan2(f,u),c-=Math.atan2(l,r),y){d=Math.cos(c),m=Math.sin(c);let t=a.data.length;x+=(t*(d*r-m*l)-u)*s,w+=(t*(m*r+d*l)-f)*s}else c+=b;c>n.PI?c-=n.PI2:c<-n.PI&&(c+=n.PI2),c*=s,d=Math.cos(c),m=Math.sin(c),a.a=d*r-m*l,a.b=d*i-m*h,a.c=m*r+d*l,a.d=m*i+d*h}a.updateAppliedTransform()}}computeWorldPositions(t,e,s){let r=this.target,i=this.position,n=this.spaces,a=l.setArraySize(this.positions,3*e+2),o=this.world,h=t.closed,c=t.worldVerticesLength,d=c/6,u=Gt.NONE;if(!t.constantSpeed){let p=t.lengths;d-=h?1:2;let m,f=p[d];switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:m=f;break;case exports.SpacingMode.Proportional:m=f/e;break;default:m=1}o=l.setArraySize(this.world,8);for(let l=0,g=0,x=0;l<e;l++,g+=3){let e=n[l]*m;i+=e;let w=i;if(h)w%=f,w<0&&(w+=f),x=0;else{if(w<0){u!=Gt.BEFORE&&(u=Gt.BEFORE,t.computeWorldVertices(r,2,4,o,0,2)),this.addBeforePosition(w,o,0,a,g);continue}if(w>f){u!=Gt.AFTER&&(u=Gt.AFTER,t.computeWorldVertices(r,c-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,a,g);continue}}for(;;x++){let t=p[x];if(!(w>t)){if(0==x)w/=t;else{let e=p[x-1];w=(w-e)/(t-e)}break}}x!=u&&(u=x,h&&x==d?(t.computeWorldVertices(r,c-4,4,o,0,2),t.computeWorldVertices(r,0,4,o,4,2)):t.computeWorldVertices(r,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],a,g,s||l>0&&0==e)}return a}h?(c+=2,o=l.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,o,0,2),t.computeWorldVertices(r,0,2,o,c-4,2),o[c-2]=o[0],o[c-1]=o[1]):(d--,c-=4,o=l.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,o,0,2));let p,m=l.setArraySize(this.curves,d),f=0,g=o[0],x=o[1],w=0,b=0,y=0,M=0,S=0,v=0,k=0,I=0,A=0,B=0,T=0,C=0,F=0,E=0;for(let t=0,e=2;t<d;t++,e+=6)w=o[e],b=o[e+1],y=o[e+2],M=o[e+3],S=o[e+4],v=o[e+5],k=.1875*(g-2*w+y),I=.1875*(x-2*b+M),A=.09375*(3*(w-y)-g+S),B=.09375*(3*(b-M)-x+v),T=2*k+A,C=2*I+B,F=.75*(w-g)+k+.16666667*A,E=.75*(b-x)+I+.16666667*B,f+=Math.sqrt(F*F+E*E),F+=T,E+=C,T+=A,C+=B,f+=Math.sqrt(F*F+E*E),F+=T,E+=C,f+=Math.sqrt(F*F+E*E),F+=T+A,E+=C+B,f+=Math.sqrt(F*F+E*E),m[t]=f,g=S,x=v;switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:p=f;break;case exports.SpacingMode.Proportional:p=f/e;break;default:p=1}let Y=this.segments,R=0;for(let t=0,r=0,l=0,d=0;t<e;t++,r+=3){let e=n[t]*p;i+=e;let P=i;if(h)P%=f,P<0&&(P+=f),l=0;else{if(P<0){this.addBeforePosition(P,o,0,a,r);continue}if(P>f){this.addAfterPosition(P-f,o,c-4,a,r);continue}}for(;;l++){let t=m[l];if(!(P>t)){if(0==l)P/=t;else{let e=m[l-1];P=(P-e)/(t-e)}break}}if(l!=u){u=l;let t=6*l;for(g=o[t],x=o[t+1],w=o[t+2],b=o[t+3],y=o[t+4],M=o[t+5],S=o[t+6],v=o[t+7],k=.03*(g-2*w+y),I=.03*(x-2*b+M),A=.006*(3*(w-y)-g+S),B=.006*(3*(b-M)-x+v),T=2*k+A,C=2*I+B,F=.3*(w-g)+k+.16666667*A,E=.3*(b-x)+I+.16666667*B,R=Math.sqrt(F*F+E*E),Y[0]=R,t=1;t<8;t++)F+=T,E+=C,T+=A,C+=B,R+=Math.sqrt(F*F+E*E),Y[t]=R;F+=T,E+=C,R+=Math.sqrt(F*F+E*E),Y[8]=R,F+=T+A,E+=C+B,R+=Math.sqrt(F*F+E*E),Y[9]=R,d=0}for(P*=R;;d++){let t=Y[d];if(!(P>t)){if(0==d)P/=t;else{let e=Y[d-1];P=d+(P-e)/(t-e)}break}}this.addCurvePosition(.1*P,g,x,w,b,y,M,S,v,a,r,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,r,i){let n=e[s],a=e[s+1],o=e[s+2]-n,l=e[s+3]-a,h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addAfterPosition(t,e,s,r,i){let n=e[s+2],a=e[s+3],o=n-e[s],l=a-e[s+1],h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addCurvePosition(t,e,s,r,i,n,a,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(i-s,r-e));let u=t*t,p=u*t,m=1-t,f=m*m,g=f*m,x=m*t,w=3*x,b=m*w,y=w*t,M=e*g+r*b+n*y+o*p,S=s*g+i*b+a*y+l*p;h[c]=M,h[c+1]=S,d&&(h[c+2]=t<.001?Math.atan2(i-s,r-e):Math.atan2(S-(s*f+i*x*2+a*u),M-(e*f+r*x*2+n*u)))}}class jt{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,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,o=this.bone,l=o.data.length;switch(t){case exports.Physics.none:return;case exports.Physics.reset:this.reset();case exports.Physics.update:const t=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=t.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,p=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,g=-1,x=this.data.limit*h,w=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||r){if(s){const t=(this.ux-c)*p;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=c}if(r){const t=(this.uy-d)*p;this.yOffset+=t>w?w:t<-w?-w:t,this.uy=d}if(u>=m){g=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,i=this.wind*f,n=(Kt.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(i-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=g),r&&(this.yVelocity-=(n+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=g),u-=m}while(u>=m)}s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i||a){let t=Math.atan2(o.c,o.a),s=0,r=0,h=0,c=this.cx-o.worldX,d=this.cy-o.worldY;if(c>x?c=x:c<-x&&(c=-x),d>w?d=w:d<-w&&(d=-w),i){h=(this.data.rotate+this.data.shearX)*e;let i=Math.atan2(d+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(i-Math.ceil(i*n.invPI2-.5)*n.PI2)*p,i=this.rotateOffset*h+t,s=Math.cos(i),r=Math.sin(i),a&&(i=l*o.getWorldScaleX(),i>0&&(this.scaleOffset+=(c*s+d*r)*p/i))}else{s=Math.cos(t),r=Math.sin(t);const e=l*o.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+d*r)*p/e)}if(u=this.remaining,u>=m){-1==g&&(g=Math.pow(this.damping,60*m));const e=this.massInverse*m,n=this.strength,o=this.wind,c=Kt.yDown?-this.gravity:this.gravity,d=l/f;for(;;)if(u-=m,a&&(this.scaleVelocity+=(o*s-c*r-this.scaleOffset*n)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=g),i){if(this.rotateVelocity-=((o*r+c*s)*d+this.rotateOffset*n)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=g,u<m)break;const i=this.rotateOffset*h+t;s=Math.cos(i),r=Math.sin(i)}else if(u<m)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case exports.Physics.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i){let t=this.rotateOffset*e,s=0,r=0,i=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),r=Math.cos(e),i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d),e+=t*this.data.shearX,s=Math.sin(e),r=Math.cos(e),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c}else t*=this.data.rotate,s=Math.sin(t),r=Math.cos(t),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c,i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d}if(a){const t=1+this.scaleOffset*e*this.data.scaleX;o.a*=t,o.c*=t}t!=exports.Physics.pose&&(this.tx=l*o.a,this.ty=l*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*n.degRad,i=Math.cos(r),a=Math.sin(r),o=this.cx-t,l=this.cy-e;this.translate(o*i-l*a-o,o*a+l*i-l)}}class Ht{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 i,this.darkColor=t.darkColor?new i:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof u&&this.attachment instanceof u&&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 Jt{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new c;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 r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}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,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?n.degRad:-n.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,a=Math.atan2(d,h)-Math.atan2(r,e)+m;a>n.PI?a-=n.PI2:a<-n.PI&&(a+=n.PI2),a*=t;let o=Math.cos(a),l=Math.sin(a);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(t.x-x.worldX)*e,x.worldY+=(t.y-x.worldY)*s}if(0!=r){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*r)/t),x.a*=t,x.c*=t}if(0!=i){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*i)/t),x.b*=t,x.d*=t}if(a>0){let t=x.b,e=x.d,s=Math.atan2(e,t),r=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));r>n.PI?r-=n.PI2:r<-n.PI&&(r+=n.PI2),r=s+(r+f)*a;let i=Math.sqrt(t*t+e*e);x.b=Math.cos(r)*i,x.d=Math.sin(r)*i}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?n.degRad:-n.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,a=Math.atan2(d,h)+m;a>n.PI?a-=n.PI2:a<-n.PI&&(a+=n.PI2),a*=t;let o=Math.cos(a),l=Math.sin(a);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=r){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*r+1;x.a*=t,x.c*=t}if(0!=i){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*i+1;x.b*=t,x.d*=t}if(a>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>n.PI?t-=n.PI2:t<-n.PI&&(t+=n.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-n.PI/2+f)*a;let r=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*r,x.d=Math.sin(t)*r}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=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+=(a.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(a.ax-d+this.data.offsetX)*e,u+=(a.ay-u+this.data.offsetY)*s;let p=h.ascaleX,m=h.ascaleY;0!=r&&0!=p&&(p=(p+(a.ascaleX-p+this.data.offsetScaleX)*r)/p),0!=i&&0!=m&&(m=(m+(a.ascaleY-m+this.data.offsetScaleY)*i)/m);let f=h.ashearY;0!=n&&(f+=(a.ashearY-f+this.data.offsetShearY)*n),h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(a.arotation+this.data.offsetRotation)*t,d=h.ax+(a.ax+this.data.offsetX)*e,u=h.ay+(a.ay+this.data.offsetY)*s,p=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*r+1),m=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*i+1),f=h.ashearY+(a.ashearY+this.data.offsetShearY)*n;h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}}class Kt{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 Kt.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,r=t.bones[e];if(r.parent){let t=this.bones[r.parent.index];s=new Ot(r,this,t),t.children.push(s)}else s=new Ot(r,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],r=this.bones[s.boneData.index],i=new Ht(s,r);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Wt(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Jt(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Gt(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new jt(s,this))}this.color=new i(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,r=this.pathConstraints,i=this.physicsConstraints,n=e.length,a=s.length,o=r.length,l=this.physicsConstraints.length,h=n+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<n;s++){let r=e[s];if(r.data.order==t){this.sortIkConstraint(r);continue t}}for(let e=0;e<a;e++){let r=s[e];if(r.data.order==t){this.sortTransformConstraint(r);continue t}}for(let e=0;e<o;e++){let s=r[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=i[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&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,r=s[0];if(this.sortBone(r),1==s.length)this._updateCache.push(t),this.sortReset(r.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(r.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,r);let i=e.getAttachment();i instanceof Pt&&this.sortPathConstraintAttachmentWith(i,r);let n=t.bones,a=n.length;for(let t=0;t<a;t++)this.sortBone(n[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(n[t].children);for(let t=0;t<a;t++)n[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&l.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 r=t.attachments[e];if(r)for(let t in r)this.sortPathConstraintAttachmentWith(r[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Pt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,r=s.length;e<r;){let r=s[e++];for(r+=e;e<r;)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&&l.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,r=s.length;e<r;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let r=e.a,i=e.b,a=e.c,o=e.d;s.worldX=r*this.x+i*this.y+e.worldX,s.worldY=a*this.x+o*this.y+e.worldY;const l=(s.rotation+s.shearX)*n.degRad,h=(s.rotation+90+s.shearY)*n.degRad,c=Math.cos(l)*s.scaleX,d=Math.cos(h)*s.scaleY,u=Math.sin(l)*s.scaleX,p=Math.sin(h)*s.scaleY;s.a=(r*c+i*u)*this.scaleX,s.b=(r*d+i*p)*this.scaleX,s.c=(a*c+o*u)*this.scaleY,s.d=(a*d+o*p)*this.scaleY;let m=this._updateCache;for(let e=0,r=m.length;e<r;e++){let r=m[e];r!=s&&r.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;l.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,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}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,r=e.length;s<r;s++){let r=e[s],i=r.data.attachmentName;if(i){let e=t.getAttachment(s,i);e&&r.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 r=0,i=s.length;r<i;r++){let i=s[r];if(i.data.name==t){let s=null;if(e&&(s=this.getAttachment(r,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.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 c,e=new c;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let i=this.drawOrder,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let t=0,e=i.length;t<e;t++){let e=i[t];if(!e.bone.active)continue;let c=0,d=null,u=null,p=e.getAttachment();if(p instanceof Xt)c=8,d=l.setArraySize(s,c,0),p.computeWorldVertices(e,d,0,2),u=Kt.quadTriangles;else if(p instanceof Rt){let t=p;c=t.worldVerticesLength,d=l.setArraySize(s,c,0),t.computeWorldVertices(e,0,c,d,0,2),u=t.triangles}else if(p instanceof xt&&null!=r){r.clipStart(e,p);continue}if(d&&u){null!=r&&r.isClipping()&&(r.clipTriangles(d,u,u.length),d=r.clippedVertices,c=r.clippedVertices.length);for(let t=0,e=d.length;t<e;t+=2){let e=d[t],s=d[t+1];n=Math.min(n,e),a=Math.min(a,s),o=Math.max(o,e),h=Math.max(h,s)}}null!=r&&r.clipEndWithSlot(e)}null!=r&&r.clipEnd(),t.set(n,a),e.set(o-n,h-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let r=0,i=s.length;r<i;r++)s[r].translate(t,e)}physicsRotate(t,e,s){const r=this.physicsConstraints;for(let i=0,n=r.length;i<n;i++)r[i].rotate(t,e,s)}}exports.Physics=void 0,(It=exports.Physics||(exports.Physics={}))[It.none=0]="none",It[It.reset=1]="reset",It[It.update=2]="update",It[It.pose=3]="pose";class Qt extends Nt{_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 Zt{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,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}}class te{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class ee{name;attachments=new Array;bones=Array();constraints=new Array;color=new i(.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 r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||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],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||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 Rt?(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 r in s){let i=s[r];i&&t.push(new te(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new te(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],n=i.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&&i.setAttachment(t);break}}}s++}}}class se{index=0;name;boneData;color=new i(1,1,1,1);darkColor=null;attachmentName=null;blendMode=exports.BlendMode.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}}exports.BlendMode=void 0,(At=exports.BlendMode||(exports.BlendMode={}))[At.Normal=0]="Normal",At[At.Additive=1]="Additive",At[At.Multiply=2]="Multiply",At[At.Screen=3]="Screen";class re extends Nt{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 ie{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Zt;s.name="";let r=new ne(t),n=r.readInt32(),a=r.readInt32();s.hash=0==a&&0==n?null:a.toString(16)+n.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let h=0;h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("String in string table must not be null.");r.strings.push(t)}h=r.readInt(!0);for(let t=0;t<h;t++){let n=r.readString();if(!n)throw new Error("Bone name must not be null.");let a=0==t?null:s.bones[r.readInt(!0)],l=new Dt(t,n,a);l.rotation=r.readFloat(),l.x=r.readFloat()*e,l.y=r.readFloat()*e,l.scaleX=r.readFloat(),l.scaleY=r.readFloat(),l.shearX=r.readFloat(),l.shearY=r.readFloat(),l.length=r.readFloat()*e,l.inherit=r.readByte(),l.skinRequired=r.readBoolean(),o&&(i.rgba8888ToColor(l.color,r.readInt32()),l.icon=r.readString()??void 0,l.visible=r.readBoolean()),s.bones.push(l)}h=r.readInt(!0);for(let t=0;t<h;t++){let e=r.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[r.readInt(!0)],a=new se(t,e,n);i.rgba8888ToColor(a.color,r.readInt32());let l=r.readInt32();-1!=l&&i.rgb888ToColor(a.darkColor=new i,l),a.attachmentName=r.readStringRef(),a.blendMode=r.readInt(!0),o&&(a.visible=r.readBoolean()),s.slots.push(a)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("IK constraint data name must not be null.");let n=new zt(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.bendDirection=2&a?1:-1,n.compress=!!(4&a),n.stretch=!!(8&a),n.uniform=!!(16&a),32&a&&(n.mix=64&a?r.readFloat():1),128&a&&(n.softness=r.readFloat()*e),s.ikConstraints.push(n)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("Transform constraint data name must not be null.");let n=new re(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.local=!!(2&a),n.relative=!!(4&a),8&a&&(n.offsetRotation=r.readFloat()),16&a&&(n.offsetX=r.readFloat()*e),32&a&&(n.offsetY=r.readFloat()*e),64&a&&(n.offsetScaleX=r.readFloat()),128&a&&(n.offsetScaleY=r.readFloat()),a=r.readByte(),1&a&&(n.offsetShearY=r.readFloat()),2&a&&(n.mixRotate=r.readFloat()),4&a&&(n.mixX=r.readFloat()),8&a&&(n.mixY=r.readFloat()),16&a&&(n.mixScaleX=r.readFloat()),32&a&&(n.mixScaleY=r.readFloat()),64&a&&(n.mixShearY=r.readFloat()),s.transformConstraints.push(n)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("Path constraint data name must not be null.");let n=new $t(i);n.order=r.readInt(!0),n.skinRequired=r.readBoolean(),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.slots[r.readInt(!0)];const a=r.readByte();n.positionMode=1&a,n.spacingMode=a>>1&3,n.rotateMode=a>>3&3,128&a&&(n.offsetRotation=r.readFloat()),n.position=r.readFloat(),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=r.readFloat(),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=r.readFloat(),n.mixX=r.readFloat(),n.mixY=r.readFloat(),s.pathConstraints.push(n)}h=r.readInt(!0);for(let t=0;t<h;t++){const t=r.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const i=new Qt(t);i.order=r.readInt(!0),i.bone=s.bones[r.readInt(!0)];let n=r.readByte();i.skinRequired=!!(1&n),2&n&&(i.x=r.readFloat()),4&n&&(i.y=r.readFloat()),8&n&&(i.rotate=r.readFloat()),16&n&&(i.scaleX=r.readFloat()),32&n&&(i.shearX=r.readFloat()),i.limit=(64&n?r.readFloat():5e3)*e,i.step=1/r.readUnsignedByte(),i.inertia=r.readFloat(),i.strength=r.readFloat(),i.damping=r.readFloat(),i.massInverse=128&n?r.readFloat():1,i.wind=r.readFloat(),i.gravity=r.readFloat(),n=r.readByte(),1&n&&(i.inertiaGlobal=!0),2&n&&(i.strengthGlobal=!0),4&n&&(i.dampingGlobal=!0),8&n&&(i.massGlobal=!0),16&n&&(i.windGlobal=!0),32&n&&(i.gravityGlobal=!0),64&n&&(i.mixGlobal=!0),i.mix=128&n?r.readFloat():1,s.physicsConstraints.push(i)}let c=this.readSkin(r,s,!0,o);c&&(s.defaultSkin=c,s.skins.push(c));{let t=s.skins.length;for(l.setArraySize(s.skins,h=t+r.readInt(!0));t<h;t++){let e=this.readSkin(r,s,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}h=this.linkedMeshes.length;for(let t=0;t<h;t++){let e=this.linkedMeshes[t];const r=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ut(t);e.intValue=r.readInt(!1),e.floatValue=r.readFloat(),e.stringValue=r.readString(),e.audioPath=r.readString(),e.audioPath&&(e.volume=r.readFloat(),e.balance=r.readFloat()),s.events.push(e)}h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,t,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),0==a)return null;n=new ee("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new ee(s),r&&i.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,r=n.bones.length;s<r;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let s=0;s<a;s++){let s=t.readInt(!0);for(let i=0,a=t.readInt(!0);i<a;i++){let i=t.readStringRef();if(!i)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,i,r);a&&n.setAttachment(s,i,a)}}return n}readAttachment(t,e,s,r,n,a){let o=this.scale,h=t.readByte();const c=8&h?t.readStringRef():n;if(!c)throw new Error("Attachment name must not be null");switch(7&h){case Bt.Region:{let e=16&h?t.readStringRef():null;const r=32&h?t.readInt32():4294967295,n=64&h?this.readSequence(t):null;let a=128&h?t.readFloat():0,l=t.readFloat(),d=t.readFloat(),u=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=c);let g=this.attachmentLoader.newRegionAttachment(s,c,e,n);return g?(g.path=e,g.x=l*o,g.y=d*o,g.scaleX=u,g.scaleY=p,g.rotation=a,g.width=m*o,g.height=f*o,i.rgba8888ToColor(g.color,r),g.sequence=n,null==n&&g.updateRegion(),g):null}case Bt.BoundingBox:{let e=this.readVertices(t,!!(16&h)),r=a?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,c);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,a&&i.rgba8888ToColor(n.color,r),n):null}case Bt.Mesh:{let e=16&h?t.readStringRef():c;const r=32&h?t.readInt32():4294967295,n=64&h?this.readSequence(t):null,l=t.readInt(!0),d=this.readVertices(t,!!(128&h)),u=this.readFloatArray(t,d.length,1),p=this.readShortArray(t,3*(d.length-l-2));let m=[],f=0,g=0;a&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),g=t.readFloat()),e||(e=c);let x=this.attachmentLoader.newMeshAttachment(s,c,e,n);return x?(x.path=e,i.rgba8888ToColor(x.color,r),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=p,x.regionUVs=u,null==n&&x.updateRegion(),x.hullLength=l<<1,x.sequence=n,a&&(x.edges=m,x.width=f*o,x.height=g*o),x):null}case Bt.LinkedMesh:{const e=16&h?t.readStringRef():c;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&h?t.readInt32():4294967295,l=64&h?this.readSequence(t):null,d=!!(128&h),u=t.readInt(!0),p=t.readStringRef();let m=0,f=0;a&&(m=t.readFloat(),f=t.readFloat());let g=this.attachmentLoader.newMeshAttachment(s,c,e,l);return g?(g.path=e,i.rgba8888ToColor(g.color,n),g.sequence=l,a&&(g.width=m*o,g.height=f*o),this.linkedMeshes.push(new ae(g,u,r,p,d)),g):null}case Bt.Path:{const e=!!(16&h),r=!!(32&h),n=this.readVertices(t,!!(64&h)),d=l.newArray(n.length/6,0);for(let e=0,s=d.length;e<s;e++)d[e]=t.readFloat()*o;const u=a?t.readInt32():0,p=this.attachmentLoader.newPathAttachment(s,c);return p?(p.closed=e,p.constantSpeed=r,p.worldVerticesLength=n.length,p.vertices=n.vertices,p.bones=n.bones,p.lengths=d,a&&i.rgba8888ToColor(p.color,u),p):null}case Bt.Point:{const e=t.readFloat(),r=t.readFloat(),n=t.readFloat(),l=a?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,c);return h?(h.x=r*o,h.y=n*o,h.rotation=e,a&&i.rgba8888ToColor(h.color,l),h):null}case Bt.Clipping:{const r=t.readInt(!0),n=this.readVertices(t,!!(16&h));let o=a?t.readInt32():0,l=this.attachmentLoader.newClippingAttachment(s,c);return l?(l.endSlot=e.slots[r],l.worldVerticesLength=n.length,l.vertices=n.vertices,l.bones=n.bones,a&&i.rgba8888ToColor(l.color,o),l):null}}return null}readSequence(t){let e=new p(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,r=t.readInt(!0),i=new oe;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let n=new Array,a=new Array;for(let e=0;e<r;e++){let e=t.readInt(!0);a.push(e);for(let r=0;r<e;r++)a.push(t.readInt(!0)),n.push(t.readFloat()*s),n.push(t.readFloat()*s),n.push(t.readFloat())}return i.vertices=l.toFloatArray(n),i.bones=a,i}readFloatArray(t,e,s){let r=new Array(e);if(1==s)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readByte(),i=t.readInt(!0),n=i-1;switch(s){case Se:{let s=new O(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readStringRef());r.push(s);break}case ve:{let s=t.readInt(!0),a=new P(i,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;a.setFrame(e,o,l,h,c,d),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,u,1),ce(t,a,s++,e,3,o,r,d,p,1)}o=r,l=i,h=n,c=u,d=p}r.push(a);break}case ke:{let s=t.readInt(!0),a=new _(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,d,1)}o=r,l=i,h=n,c=d}r.push(a);break}case Ie:{let s=t.readInt(!0),a=new V(i,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,p=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p,m),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,f,1),ce(t,a,s++,e,3,o,r,d,g,1),ce(t,a,s++,e,4,o,r,u,x,1),ce(t,a,s++,e,5,o,r,p,w,1),ce(t,a,s++,e,6,o,r,m,b,1)}o=r,l=i,h=n,c=f,d=g,u=x,p=w,m=b}r.push(a);break}case Ae:{let s=t.readInt(!0),a=new D(i,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,p=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,m,1),ce(t,a,s++,e,3,o,r,d,f,1),ce(t,a,s++,e,4,o,r,u,g,1),ce(t,a,s++,e,5,o,r,p,x,1)}o=r,l=i,h=n,c=m,d=f,u=g,p=x}r.push(a);break}case Be:{let s=new X(i,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,r=0;s.setFrame(e,a,o),e!=n;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255;switch(t.readByte()){case Le:s.setStepped(e);break;case qe:ce(t,s,r++,e,0,a,i,o,n,1)}a=i,o=n}r.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==Me){let s=new R(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readByte());r.push(s);continue}let a=t.readInt(!0);switch(s){case de:r.push(le(t,new v(n,a,e),1));break;case ue:r.push(he(t,new k(n,a,e),i));break;case pe:r.push(le(t,new I(n,a,e),i));break;case me:r.push(le(t,new A(n,a,e),i));break;case fe:r.push(he(t,new B(n,a,e),1));break;case ge:r.push(le(t,new T(n,a,e),1));break;case xe:r.push(le(t,new C(n,a,e),1));break;case we:r.push(he(t,new F(n,a,e),1));break;case be:r.push(le(t,new E(n,a,e),1));break;case ye:r.push(le(t,new Y(n,a,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,a=new U(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()*i:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=n;e++){o=t.readByte();const r=t.readFloat(),n=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*i:0;64&o?a.setStepped(e):128&o&&(ce(t,a,s++,e,0,l,r,h,n,1),ce(t,a,s++,e,1,l,r,c,d,i)),l=r,h=n,c=d}r.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,n=new W(s,t.readInt(!0),e),a=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,a,o,l,h,c,d,u),e!=i;e++){let r=t.readFloat(),i=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Le:n.setStepped(e);break;case qe:ce(t,n,s++,e,0,a,r,o,i,1),ce(t,n,s++,e,1,a,r,l,p,1),ce(t,n,s++,e,2,a,r,h,m,1),ce(t,n,s++,e,3,a,r,c,f,1),ce(t,n,s++,e,4,a,r,d,g,1),ce(t,n,s++,e,5,a,r,u,x,1)}a=r,o=i,l=p,h=m,c=f,d=g,u=x}r.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,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0),o=t.readInt(!0);switch(s){case Fe:r.push(le(t,new z(a,o,e),n.positionMode==exports.PositionMode.Fixed?i:1));break;case Ee:r.push(le(t,new $(a,o,e),n.spacingMode==exports.SpacingMode.Length||n.spacingMode==exports.SpacingMode.Fixed?i:1));break;case Ye:let s=new G(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,r=0,i=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=i;e++){let i=t.readFloat(),n=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Le:s.setStepped(e);break;case qe:ce(t,s,r++,e,0,l,i,h,n,1),ce(t,s,r++,e,1,l,i,c,a,1),ce(t,s,r++,e,2,l,i,d,o,1)}l=i,h=n,c=a,d=o}r.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0);if(s==Ne){const s=new st(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat());r.push(s);continue}const n=t.readInt(!0);switch(s){case Re:r.push(le(t,new H(i,n,e),1));break;case Pe:r.push(le(t,new J(i,n,e),1));break;case _e:r.push(le(t,new K(i,n,e),1));break;case Xe:r.push(le(t,new Q(i,n,e),1));break;case Ve:r.push(le(t,new Z(i,n,e),1));break;case De:r.push(le(t,new tt(i,n,e),1));break;case Oe:r.push(le(t,new et(i,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,a=t.readInt(!0);n<a;n++){let n=t.readStringRef();if(!n)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,n),o=t.readByte(),h=t.readInt(!0),c=h-1;switch(o){case Te:{let e=a,n=e.bones,o=e.vertices,d=n?o.length/3*2:o.length,u=t.readInt(!0),p=new N(h,u,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let r,a=t.readInt(!0);if(0==a)r=n?l.newFloatArray(d):o;else{r=l.newFloatArray(d);let e=t.readInt(!0);if(a+=e,1==i)for(let s=e;s<a;s++)r[s]=t.readFloat();else for(let s=e;s<a;s++)r[s]=t.readFloat()*i;if(!n)for(let t=0,e=r.length;t<e;t++)r[t]+=o[t]}if(p.setFrame(e,m,r),e==c)break;let h=t.readFloat();switch(t.readByte()){case Le:p.setStepped(e);break;case qe:ce(t,p,s++,e,0,m,h,0,1,1)}m=h}r.push(p);break}case Ce:{let e=new rt(h,s,a);for(let s=0;s<h;s++){let r=t.readFloat(),i=t.readInt32();e.setFrame(s,r,m[15&i],i>>4,t.readFloat())}r.push(e);break}}}}}let n=t.readInt(!0);if(n>0){let e=new q(n),i=s.slots.length;for(let s=0;s<n;s++){let r=t.readFloat(),n=t.readInt(!0),a=l.newArray(i,0);for(let t=i-1;t>=0;t--)a[t]=-1;let o=l.newArray(i-n,0),h=0,c=0;for(let e=0;e<n;e++){let e=t.readInt(!0);for(;h!=e;)o[c++]=h++;a[h+t.readInt(!0)]=h++}for(;h<i;)o[c++]=h++;for(let t=i-1;t>=0;t--)-1==a[t]&&(a[t]=o[--c]);e.setFrame(s,r,a)}r.push(e)}let a=t.readInt(!0);if(a>0){let e=new L(a);for(let r=0;r<a;r++){let i=t.readFloat(),n=s.events[t.readInt(!0)],a=new qt(i,n);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=n.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(r,a)}r.push(e)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());return new f(e,r,o)}}class ne{strings;index;buffer;constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),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 ae{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}class oe{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function le(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let n=0,a=0,o=e.getFrameCount()-1;e.setFrame(n,r,i),n!=o;n++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Le:e.setStepped(n);break;case qe:ce(t,e,a++,n,0,r,o,i,l,s)}r=o,i=l}return e}function he(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,n=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,r,i,n),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Le:e.setStepped(a);break;case qe:ce(t,e,o++,a,0,r,l,i,h,s),ce(t,e,o++,a,1,r,l,n,c,s)}r=l,i=h,n=c}return e}function ce(t,e,s,r,i,n,a,o,l,h){e.setBezier(s,r,i,n,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,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"}(Bt||(Bt={}));const de=0,ue=1,pe=2,me=3,fe=4,ge=5,xe=6,we=7,be=8,ye=9,Me=10,Se=0,ve=1,ke=2,Ie=3,Ae=4,Be=5,Te=0,Ce=1,Fe=0,Ee=1,Ye=2,Re=0,Pe=1,_e=2,Xe=4,Ve=5,De=6,Oe=7,Ne=8,Le=1,qe=2;class Ue{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new h((()=>new Array));polygonIndicesPool=new h((()=>new Array));triangulate(t){let e=t,s=t.length>>1,r=this.indicesArray;r.length=0;for(let t=0;t<s;t++)r[t]=t;let i=this.isConcaveArray;i.length=0;for(let t=0,n=s;t<n;++t)i[t]=Ue.isConcave(t,s,e,r);let n=this.triangles;for(n.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!i[a]){let n=r[t]<<1,l=r[a]<<1,h=r[o]<<1,c=e[n],d=e[n+1],u=e[l],p=e[l+1],m=e[h],f=e[h+1];for(let n=(o+1)%s;n!=t;n=(n+1)%s){if(!i[n])continue;let t=r[n]<<1,s=e[t],a=e[t+1];if(Ue.positiveArea(m,f,c,d,s,a)&&Ue.positiveArea(c,d,u,p,s,a)&&Ue.positiveArea(u,p,m,f,s,a))break t}break}if(0==o){do{if(!i[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}n.push(r[(s+a-1)%s]),n.push(r[a]),n.push(r[(a+1)%s]),r.splice(a,1),i.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;i[l]=Ue.isConcave(l,s,e,r),i[h]=Ue.isConcave(h,s,e,r)}return 3==s&&(n.push(r[2]),n.push(r[0]),n.push(r[1])),n}decompose(t,e){let s=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let n=this.polygonIndicesPool.obtain();n.length=0;let a=this.polygonPool.obtain();a.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],p=s[h+1],m=s[c],f=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=a.length-4,e=Ue.winding(a[t],a[t+1],a[t+2],a[t+3],g,x),s=Ue.winding(g,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(g),a.push(x),n.push(d),w=!0)}w||(a.length>0?(r.push(a),i.push(n)):(this.polygonPool.free(a),this.polygonIndicesPool.free(n)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(p),a.push(m),a.push(f),a.push(g),a.push(x),n=this.polygonIndicesPool.obtain(),n.length=0,n.push(h),n.push(c),n.push(d),l=Ue.winding(u,p,m,f,g,x),o=h)}a.length>0&&(r.push(a),i.push(n));for(let t=0,e=r.length;t<e;t++){if(n=i[t],0==n.length)continue;let s=n[0],o=n[n.length-1];a=r[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],p=a[0],m=a[1],f=a[2],g=a[3],x=Ue.winding(h,c,d,u,p,m);for(let l=0;l<e;l++){if(l==t)continue;let e=i[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],M=r[l],S=M[M.length-2],v=M[M.length-1];if(w!=s||b!=o)continue;let k=Ue.winding(h,c,d,u,S,v),I=Ue.winding(S,v,p,m,f,g);k==x&&I==x&&(M.length=0,e.length=0,a.push(S),a.push(v),n.push(y),h=d,c=u,d=S,u=v,l=0)}}for(let t=r.length-1;t>=0;t--)a=r[t],0==a.length&&(r.splice(t,1),this.polygonPool.free(a),n=i[t],i.splice(t,1),this.polygonIndicesPool.free(n));return r}static isConcave(t,e,s,r){let i=r[(e+t-1)%e]<<1,n=r[t]<<1,a=r[(t+1)%e]<<1;return!this.positiveArea(s[i],s[i+1],s[n],s[n+1],s[a],s[a+1])}static positiveArea(t,e,s,r,i,n){return t*(n-r)+s*(e-n)+i*(r-e)>=0}static winding(t,e,s,r,i,n){let a=s-t,o=r-e;return i*o-n*a+a*e-t*o>=0?1:-1}}class We{triangulator=new Ue;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,r=l.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,r,0,2);let i=this.clippingPolygon;We.makeClockwise(i);let n=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let t=0,e=n.length;t<e;t++){let e=n[t];We.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,r,i,n,a,o){let l,h,c,d,u,p;"number"==typeof e?(l=s,h=r,c=i,d=n,u=a,p=o):(l=e,h=s,c=r,d=i,u=n,p=a),c&&d&&u&&"boolean"==typeof p?this.clipTrianglesRender(t,l,h,c,d,u,p):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let r=this.clipOutput,i=this.clippedVertices,n=this.clippedTriangles,a=this.clippingPolygons,o=a.length,h=0;i.length=0,n.length=0;for(let c=0;c<s;c+=3){let s=e[c]<<1,d=t[s],u=t[s+1];s=e[c+1]<<1;let p=t[s],m=t[s+1];s=e[c+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=i.length;if(!this.clip(d,u,p,m,f,g,a[t],r)){let t=l.setArraySize(i,e+6);t[e]=d,t[e+1]=u,t[e+2]=p,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=n.length;let s=l.setArraySize(n,e+3);s[e]=h,s[e+1]=h+1,s[e+2]=h+2,h+=3;break}{let t=r.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=l.setArraySize(i,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],r=a[s+1];o[e]=t,o[e+1]=r}e=n.length;let c=l.setArraySize(n,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)c[e]=h,c[e+1]=h+t,c[e+2]=h+t+1;h+=s+1}}}}clipTrianglesRender(t,e,s,r,i,n,a){let o=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,p=a?12:8,m=0;h.length=0,c.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],x=t[s+1],w=r[s],b=r[s+1];s=e[f+1]<<1;let y=t[s],M=t[s+1],S=r[s],v=r[s+1];s=e[f+2]<<1;let k=t[s],I=t[s+1],A=r[s],B=r[s+1];for(let t=0;t<u;t++){let e=h.length;if(!this.clip(g,x,y,M,k,I,d[t],o)){let t=l.setArraySize(h,e+3*p);t[e]=g,t[e+1]=x,t[e+2]=i.r,t[e+3]=i.g,t[e+4]=i.b,t[e+5]=i.a,a?(t[e+6]=w,t[e+7]=b,t[e+8]=n.r,t[e+9]=n.g,t[e+10]=n.b,t[e+11]=n.a,t[e+12]=y,t[e+13]=M,t[e+14]=i.r,t[e+15]=i.g,t[e+16]=i.b,t[e+17]=i.a,t[e+18]=S,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]=k,t[e+25]=I,t[e+26]=i.r,t[e+27]=i.g,t[e+28]=i.b,t[e+29]=i.a,t[e+30]=A,t[e+31]=B,t[e+32]=n.r,t[e+33]=n.g,t[e+34]=n.b,t[e+35]=n.a):(t[e+6]=w,t[e+7]=b,t[e+8]=y,t[e+9]=M,t[e+10]=i.r,t[e+11]=i.g,t[e+12]=i.b,t[e+13]=i.a,t[e+14]=S,t[e+15]=v,t[e+16]=k,t[e+17]=I,t[e+18]=i.r,t[e+19]=i.g,t[e+20]=i.b,t[e+21]=i.a,t[e+22]=A,t[e+23]=B),e=c.length;let s=l.setArraySize(c,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=M-I,r=k-y,d=g-k,u=I-x,f=1/(s*d+r*(x-I)),T=t>>1,C=this.clipOutput,F=l.setArraySize(h,e+T*p);for(let o=0;o<t;o+=2,e+=p){let t=C[o],l=C[o+1];F[e]=t,F[e+1]=l,F[e+2]=i.r,F[e+3]=i.g,F[e+4]=i.b,F[e+5]=i.a;let h=t-k,c=l-I,p=(s*h+r*c)*f,m=(u*h+d*c)*f,g=1-p-m;F[e+6]=w*p+S*m+A*g,F[e+7]=b*p+v*m+B*g,a&&(F[e+8]=n.r,F[e+9]=n.g,F[e+10]=n.b,F[e+11]=n.a)}e=c.length;let E=l.setArraySize(c,e+3*(T-2));T--;for(let t=1;t<T;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=T+1}}}}clipTrianglesUnpacked(t,e,s,r){let i=this.clipOutput,n=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;n.length=0,a.length=0,o.length=0;for(let u=0;u<s;u+=3){let s=e[u]<<1,p=t[s],m=t[s+1],f=r[s],g=r[s+1];s=e[u+1]<<1;let x=t[s],w=t[s+1],b=r[s],y=r[s+1];s=e[u+2]<<1;let M=t[s],S=t[s+1],v=r[s],k=r[s+1];for(let t=0;t<c;t++){let e=n.length;if(!this.clip(p,m,x,w,M,S,h[t],i)){let t=l.setArraySize(n,e+6);t[e]=p,t[e+1]=m,t[e+2]=x,t[e+3]=w,t[e+4]=M,t[e+5]=S;let s=l.setArraySize(a,e+6);s[e]=f,s[e+1]=g,s[e+2]=b,s[e+3]=y,s[e+4]=v,s[e+5]=k,e=o.length;let r=l.setArraySize(o,e+3);r[e]=d,r[e+1]=d+1,r[e+2]=d+2,d+=3;break}{let t=i.length;if(0==t)continue;let s=w-S,r=M-x,h=p-M,c=S-m,u=1/(s*h+r*(m-S)),I=t>>1,A=this.clipOutput,B=l.setArraySize(n,e+2*I),T=l.setArraySize(a,e+2*I);for(let i=0;i<t;i+=2,e+=2){let t=A[i],n=A[i+1];B[e]=t,B[e+1]=n;let a=t-M,o=n-S,l=(s*a+r*o)*u,d=(c*a+h*o)*u,p=1-l-d;T[e]=f*l+b*d+v*p,T[e+1]=g*l+y*d+k*p}e=o.length;let C=l.setArraySize(o,e+3*(I-2));I--;for(let t=1;t<I;t++,e+=3)C[e]=d,C[e+1]=d+t,C[e+2]=d+t+1;d+=I+1}}}}clip(t,e,s,r,i,n,a,o){let l,h=o,c=!1;a.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(r),l.push(i),l.push(n),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],r=e-u[t+2],i=s-u[t+3],n=o.length,a=l;for(let t=0,n=l.length-2;t<n;){let n=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=i*(e-h)>r*(s-d),p=i*(e-n)-r*(s-l);if(p>0){if(u){o.push(h),o.push(d);continue}let t=h-n,e=d-l,s=p/(t*i-e*r);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=p/(t*i-e*r);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 p=o;(o=l).length=0,l=p}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,r=e[s-2]*e[1]-e[0]*e[s-1],i=0,n=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)i=e[t],n=e[t+1],a=e[t+2],o=e[t+3],r+=i*o-a*n;if(!(r<0))for(let t=0,r=s-2,i=s>>1;t<i;t+=2){let s=e[t],i=e[t+1],n=r-t;e[t]=e[n],e[t+1]=e[n+1],e[n]=s,e[n+1]=i}}}class ze{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Zt,r="string"==typeof t?JSON.parse(t):t,n=r.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=Je(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),r.bones)for(let t=0;t<r.bones.length;t++){let i=r.bones[t],n=null,a=Je(i,"parent",null);a&&(n=s.findBone(a));let o=new Dt(s.bones.length,i.name,n);o.length=Je(i,"length",0)*e,o.x=Je(i,"x",0)*e,o.y=Je(i,"y",0)*e,o.rotation=Je(i,"rotation",0),o.scaleX=Je(i,"scaleX",1),o.scaleY=Je(i,"scaleY",1),o.shearX=Je(i,"shearX",0),o.shearY=Je(i,"shearY",0),o.inherit=l.enumValue(exports.Inherit,Je(i,"inherit","Normal")),o.skinRequired=Je(i,"skin",!1);let h=Je(i,"color",null);h&&o.color.setFromString(h),s.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],n=e.name,a=s.findBone(e.bone);if(!a)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let o=new se(s.slots.length,n,a),h=Je(e,"color",null);h&&o.color.setFromString(h);let c=Je(e,"dark",null);c&&(o.darkColor=i.fromString(c)),o.attachmentName=Je(e,"attachment",null),o.blendMode=l.enumValue(exports.BlendMode,Je(e,"blend","normal")),o.visible=Je(e,"visible",!0),s.slots.push(o)}if(r.ik)for(let t=0;t<r.ik.length;t++){let i=r.ik[t],n=new zt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=s.findBone(i.bones[t]);if(!e)throw new Error(`Couldn't find bone ${i.bones[t]} for IK constraint ${i.name}.`);n.bones.push(e)}let a=s.findBone(i.target);if(!a)throw new Error(`Couldn't find target bone ${i.target} for IK constraint ${i.name}.`);n.target=a,n.mix=Je(i,"mix",1),n.softness=Je(i,"softness",0)*e,n.bendDirection=Je(i,"bendPositive",!0)?1:-1,n.compress=Je(i,"compress",!1),n.stretch=Je(i,"stretch",!1),n.uniform=Je(i,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let t=0;t<r.transform.length;t++){let i=r.transform[t],n=new re(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for transform constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${i.name}.`);n.target=o,n.local=Je(i,"local",!1),n.relative=Je(i,"relative",!1),n.offsetRotation=Je(i,"rotation",0),n.offsetX=Je(i,"x",0)*e,n.offsetY=Je(i,"y",0)*e,n.offsetScaleX=Je(i,"scaleX",0),n.offsetScaleY=Je(i,"scaleY",0),n.offsetShearY=Je(i,"shearY",0),n.mixRotate=Je(i,"mixRotate",1),n.mixX=Je(i,"mixX",1),n.mixY=Je(i,"mixY",n.mixX),n.mixScaleX=Je(i,"mixScaleX",1),n.mixScaleY=Je(i,"mixScaleY",n.mixScaleX),n.mixShearY=Je(i,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let t=0;t<r.path.length;t++){let i=r.path[t],n=new $t(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for path constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${i.name}.`);n.target=o,n.positionMode=l.enumValue(exports.PositionMode,Je(i,"positionMode","Percent")),n.spacingMode=l.enumValue(exports.SpacingMode,Je(i,"spacingMode","Length")),n.rotateMode=l.enumValue(exports.RotateMode,Je(i,"rotateMode","Tangent")),n.offsetRotation=Je(i,"rotation",0),n.position=Je(i,"position",0),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=Je(i,"spacing",0),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=Je(i,"mixRotate",1),n.mixX=Je(i,"mixX",1),n.mixY=Je(i,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let t=0;t<r.physics.length;t++){const i=r.physics[t],n=new Qt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);const a=i.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=Je(i,"x",0),n.y=Je(i,"y",0),n.rotate=Je(i,"rotate",0),n.scaleX=Je(i,"scaleX",0),n.shearX=Je(i,"shearX",0),n.limit=Je(i,"limit",5e3)*e,n.step=1/Je(i,"fps",60),n.inertia=Je(i,"inertia",1),n.strength=Je(i,"strength",100),n.damping=Je(i,"damping",1),n.massInverse=1/Je(i,"mass",1),n.wind=Je(i,"wind",0),n.gravity=Je(i,"gravity",0),n.mix=Je(i,"mix",1),n.inertiaGlobal=Je(i,"inertiaGlobal",!1),n.strengthGlobal=Je(i,"strengthGlobal",!1),n.dampingGlobal=Je(i,"dampingGlobal",!1),n.massGlobal=Je(i,"massGlobal",!1),n.windGlobal=Je(i,"windGlobal",!1),n.gravityGlobal=Je(i,"gravityGlobal",!1),n.mixGlobal=Je(i,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],i=new ee(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let r=e.bones[t],n=s.findBone(r);if(!n)throw new Error(`Couldn't find bone ${r} for skin ${e.name}.`);i.bones.push(n)}if(e.ik)for(let t=0;t<e.ik.length;t++){let r=e.ik[t],n=s.findIkConstraint(r);if(!n)throw new Error(`Couldn't find IK constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.transform)for(let t=0;t<e.transform.length;t++){let r=e.transform[t],n=s.findTransformConstraint(r);if(!n)throw new Error(`Couldn't find transform constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.path)for(let t=0;t<e.path.length;t++){let r=e.path[t],n=s.findPathConstraint(r);if(!n)throw new Error(`Couldn't find path constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.physics)for(let t=0;t<e.physics.length;t++){let r=e.physics[t],n=s.findPhysicsConstraint(r);if(!n)throw new Error(`Couldn't find physics constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}for(let t in e.attachments){let r=s.findSlot(t);if(!r)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],i,r.index,t,s);e&&i.setAttachment(r.index,t,e)}}s.skins.push(i),"default"==i.name&&(s.defaultSkin=i)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],r=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!r)throw new Error(`Skin not found: ${e.skin}`);let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],i=new Ut(t);i.intValue=Je(e,"int",0),i.floatValue=Je(e,"float",0),i.stringValue=Je(e,"string",""),i.audioPath=Je(e,"audio",null),i.audioPath&&(i.volume=Je(e,"volume",1),i.balance=Je(e,"balance",0)),s.events.push(i)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,r,i){let n=this.scale;switch(r=Je(t,"name",r),Je(t,"type","region")){case"region":{let s=Je(t,"path",r),i=this.readSequence(Je(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,r,s,i);if(!a)return null;a.path=s,a.x=Je(t,"x",0)*n,a.y=Je(t,"y",0)*n,a.scaleX=Je(t,"scaleX",1),a.scaleY=Je(t,"scaleY",1),a.rotation=Je(t,"rotation",0),a.width=t.width*n,a.height=t.height*n,a.sequence=i;let o=Je(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"mesh":case"linkedmesh":{let i=Je(t,"path",r),a=this.readSequence(Je(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,r,i,a);if(!o)return null;o.path=i;let l=Je(t,"color",null);l&&o.color.setFromString(l),o.width=Je(t,"width",0)*n,o.height=Je(t,"height",0)*n,o.sequence=a;let h=Je(t,"parent",null);if(h)return this.linkedMeshes.push(new $e(o,Je(t,"skin",null),s,h,Je(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=Je(t,"edges",null),o.hullLength=2*Je(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,r);if(!s)return null;s.closed=Je(t,"closed",!1),s.constantSpeed=Je(t,"constantSpeed",!0);let i=t.vertexCount;this.readVertices(t,s,i<<1);let a=l.newArray(i/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*n;s.lengths=a;let o=Je(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,r);if(!s)return null;s.x=Je(t,"x",0)*n,s.y=Je(t,"y",0)*n,s.rotation=Je(t,"rotation",0);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,r);if(!s)return null;let n=Je(t,"end",null);n&&(s.endSlot=i.findSlot(n));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Je(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new p(Je(t,"count",0));return e.start=Je(t,"start",1),e.digits=Je(t,"digits",0),e.setupIndex=Je(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let t=l.toFloatArray(i);if(1!=r)for(let e=0,s=i.length;e<s;e++)t[e]*=r;return void(e.vertices=t)}let n=new Array,a=new Array;for(let t=0,e=i.length;t<e;){let e=i[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(i[t]),n.push(i[t+1]*r),n.push(i[t+2]*r),n.push(i[t+3])}e.bones=a,e.vertices=l.toFloatArray(n)}readAnimation(e,s,r){let n=this.scale,a=new Array;if(e.slots)for(let t in e.slots){let s=e.slots[t],n=r.findSlot(t);if(!n)throw new Error("Slot not found: "+t);let o=n.index;for(let t in s){let e=s[t];if(!e)continue;let r=e.length;if("attachment"==t){let t=new O(r,o);for(let s=0;s<r;s++){let r=e[s];t.setFrame(s,Je(r,"time",0),Je(r,"name",null))}a.push(t)}else if("rgba"==t){let t=new P(r,r<<2,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,l.a);let o=e[r+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=i.fromString(o.color),d=s.curve;d&&(a=He(d,t,a,r,0,n,h,l.r,c.r,1),a=He(d,t,a,r,1,n,h,l.g,c.g,1),a=He(d,t,a,r,2,n,h,l.b,c.b,1),a=He(d,t,a,r,3,n,h,l.a,c.a,1)),n=h,l=c,s=o}a.push(t)}else if("rgb"==t){let t=new _(r,3*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b);let o=e[r+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=i.fromString(o.color),d=s.curve;d&&(a=He(d,t,a,r,0,n,h,l.r,c.r,1),a=He(d,t,a,r,1,n,h,l.g,c.g,1),a=He(d,t,a,r,2,n,h,l.b,c.b,1)),n=h,l=c,s=o}a.push(t)}else if("alpha"==t)a.push(Ge(e,new X(r,r,o),0,1));else if("rgba2"==t){let t=new V(r,7*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.light),h=i.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),p=s.curve;p&&(a=He(p,t,a,r,0,n,c,l.r,d.r,1),a=He(p,t,a,r,1,n,c,l.g,d.g,1),a=He(p,t,a,r,2,n,c,l.b,d.b,1),a=He(p,t,a,r,3,n,c,l.a,d.a,1),a=He(p,t,a,r,4,n,c,h.r,u.r,1),a=He(p,t,a,r,5,n,c,h.g,u.g,1),a=He(p,t,a,r,6,n,c,h.b,u.b,1)),n=c,l=d,h=u,s=o}a.push(t)}else if("rgb2"==t){let t=new D(r,6*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.light),h=i.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),p=s.curve;p&&(a=He(p,t,a,r,0,n,c,l.r,d.r,1),a=He(p,t,a,r,1,n,c,l.g,d.g,1),a=He(p,t,a,r,2,n,c,l.b,d.b,1),a=He(p,t,a,r,3,n,c,h.r,u.r,1),a=He(p,t,a,r,4,n,c,h.g,u.g,1),a=He(p,t,a,r,5,n,c,h.b,u.b,1)),n=c,l=d,h=u,s=o}a.push(t)}}}if(e.bones)for(let t in e.bones){let s=e.bones[t],i=r.findBone(t);if(!i)throw new Error("Bone not found: "+t);let o=i.index;for(let t in s){let e=s[t],r=e.length;if(0!=r)if("rotate"===t)a.push(Ge(e,new v(r,r,o),0,1));else if("translate"===t){let t=new k(r,r<<1,o);a.push(je(e,t,"x","y",0,n))}else if("translatex"===t){let t=new I(r,r,o);a.push(Ge(e,t,0,n))}else if("translatey"===t){let t=new A(r,r,o);a.push(Ge(e,t,0,n))}else if("scale"===t){let t=new B(r,r<<1,o);a.push(je(e,t,"x","y",1,1))}else if("scalex"===t){let t=new T(r,r,o);a.push(Ge(e,t,1,1))}else if("scaley"===t){let t=new C(r,r,o);a.push(Ge(e,t,1,1))}else if("shear"===t){let t=new F(r,r<<1,o);a.push(je(e,t,"x","y",0,1))}else if("shearx"===t){let t=new E(r,r,o);a.push(Ge(e,t,0,1))}else if("sheary"===t){let t=new Y(r,r,o);a.push(Ge(e,t,0,1))}else if("inherit"===t){let t=new R(r,i.index);for(let s=0;s<e.length;s++){let r=e[s];t.setFrame(s,Je(r,"time",0),l.enumValue(exports.Inherit,Je(r,"inherit","Normal")))}a.push(t)}}}if(e.ik)for(let t in e.ik){let s=e.ik[t],i=s[0];if(!i)continue;let o=r.findIkConstraint(t);if(!o)throw new Error("IK Constraint not found: "+t);let l=r.ikConstraints.indexOf(o),h=new U(s.length,s.length<<1,l),c=Je(i,"time",0),d=Je(i,"mix",1),u=Je(i,"softness",0)*n;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Je(i,"bendPositive",!0)?1:-1,Je(i,"compress",!1),Je(i,"stretch",!1));let r=s[t+1];if(!r){h.shrink(e);break}let a=Je(r,"time",0),o=Je(r,"mix",1),l=Je(r,"softness",0)*n,p=i.curve;p&&(e=He(p,h,e,t,0,c,a,d,o,1),e=He(p,h,e,t,1,c,a,u,l,n)),c=a,d=o,u=l,i=r}a.push(h)}if(e.transform)for(let t in e.transform){let s=e.transform[t],i=s[0];if(!i)continue;let n=r.findTransformConstraint(t);if(!n)throw new Error("Transform constraint not found: "+t);let o=r.transformConstraints.indexOf(n),l=new W(s.length,6*s.length,o),h=Je(i,"time",0),c=Je(i,"mixRotate",1),d=Je(i,"mixX",1),u=Je(i,"mixY",d),p=Je(i,"mixScaleX",1),m=Je(i,"mixScaleY",p),f=Je(i,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,p,m,f);let r=s[t+1];if(!r){l.shrink(e);break}let n=Je(r,"time",0),a=Je(r,"mixRotate",1),o=Je(r,"mixX",1),g=Je(r,"mixY",o),x=Je(r,"mixScaleX",1),w=Je(r,"mixScaleY",x),b=Je(r,"mixShearY",1),y=i.curve;y&&(e=He(y,l,e,t,0,h,n,c,a,1),e=He(y,l,e,t,1,h,n,d,o,1),e=He(y,l,e,t,2,h,n,u,g,1),e=He(y,l,e,t,3,h,n,p,x,1),e=He(y,l,e,t,4,h,n,m,w,1),e=He(y,l,e,t,5,h,n,f,b,1)),h=n,c=a,d=o,u=g,p=x,m=w,p=x,i=r}a.push(l)}if(e.path)for(let t in e.path){let s=e.path[t],i=r.findPathConstraint(t);if(!i)throw new Error("Path constraint not found: "+t);let o=r.pathConstraints.indexOf(i);for(let t in s){let e=s[t],r=e[0];if(!r)continue;let l=e.length;if("position"===t){let t=new z(l,l,o);a.push(Ge(e,t,0,i.positionMode==exports.PositionMode.Fixed?n:1))}else if("spacing"===t){let t=new $(l,l,o);a.push(Ge(e,t,0,i.spacingMode==exports.SpacingMode.Length||i.spacingMode==exports.SpacingMode.Fixed?n:1))}else if("mix"===t){let t=new G(l,3*l,o),s=Je(r,"time",0),i=Je(r,"mixRotate",1),n=Je(r,"mixX",1),h=Je(r,"mixY",n);for(let a=0,o=0;;a++){t.setFrame(a,s,i,n,h);let l=e[a+1];if(!l){t.shrink(o);break}let c=Je(l,"time",0),d=Je(l,"mixRotate",1),u=Je(l,"mixX",1),p=Je(l,"mixY",u),m=r.curve;m&&(o=He(m,t,o,a,0,s,c,i,d,1),o=He(m,t,o,a,1,s,c,n,u,1),o=He(m,t,o,a,2,s,c,h,p,1)),s=c,i=d,n=u,h=p,r=l}a.push(t)}}}if(e.physics)for(let t in e.physics){let s=e.physics[t],i=-1;if(t.length>0){let e=r.findPhysicsConstraint(t);if(!e)throw new Error("Physics constraint not found: "+t);i=r.physicsConstraints.indexOf(e)}for(let t in s){let e=s[t],r=e[0];if(!r)continue;let n,o=e.length;if("reset"!=t){if("inertia"==t)n=new H(o,o,i);else if("strength"==t)n=new J(o,o,i);else if("damping"==t)n=new K(o,o,i);else if("mass"==t)n=new Q(o,o,i);else if("wind"==t)n=new Z(o,o,i);else if("gravity"==t)n=new tt(o,o,i);else{if("mix"!=t)continue;n=new et(o,o,i)}a.push(Ge(e,n,0,1))}else{const t=new st(o,i);for(let s=0;null!=r;r=e[s+1],s++)t.setFrame(s,Je(r,"time",0));a.push(t)}}}if(e.attachments)for(let s in e.attachments){let i=e.attachments[s],o=r.findSkin(s);if(!o)throw new Error("Skin not found: "+s);for(let e in i){let s=i[e],h=r.findSlot(e);if(!h)throw new Error("Slot not found: "+e);let c=h.index;for(let e in s){let r=s[e],i=o.getAttachment(c,e);for(let e in r){let s=r[e],o=s[0];if(o)if("deform"==e){let t=i.bones,e=i.vertices,r=t?e.length/3*2:e.length,h=new N(s.length,s.length,c,i),d=Je(o,"time",0);for(let i=0,a=0;;i++){let c,u=Je(o,"vertices",null);if(u){c=l.newFloatArray(r);let s=Je(o,"offset",0);if(l.arrayCopy(u,0,c,s,u.length),1!=n)for(let t=s,e=t+u.length;t<e;t++)c[t]*=n;if(!t)for(let t=0;t<r;t++)c[t]+=e[t]}else c=t?l.newFloatArray(r):e;h.setFrame(i,d,c);let p=s[i+1];if(!p){h.shrink(a);break}let m=Je(p,"time",0),f=o.curve;f&&(a=He(f,h,a,i,0,d,m,0,1,1)),d=m,o=p}a.push(h)}else if("sequence"==e){let e=new rt(s.length,c,i),r=0;for(let i=0;i<s.length;i++){let n=Je(o,"delay",r),a=Je(o,"time",0),l=t[Je(o,"mode","hold")],h=Je(o,"index",0);e.setFrame(i,a,l,h,n),r=n,o=s[i+1]}a.push(e)}}}}}if(e.drawOrder){let t=new q(e.drawOrder.length),s=r.slots.length,i=0;for(let n=0;n<e.drawOrder.length;n++,i++){let a=e.drawOrder[n],o=null,h=Je(a,"offsets",null);if(h){o=l.newArray(s,-1);let t=l.newArray(s-h.length,0),e=0,i=0;for(let s=0;s<h.length;s++){let n=h[s],a=r.findSlot(n.slot);if(!a)throw new Error("Slot not found: "+a);let l=a.index;for(;e!=l;)t[i++]=e++;o[e+n.offset]=e++}for(;e<s;)t[i++]=e++;for(let e=s-1;e>=0;e--)-1==o[e]&&(o[e]=t[--i])}t.setFrame(i,Je(a,"time",0),o)}a.push(t)}if(e.events){let t=new L(e.events.length),s=0;for(let i=0;i<e.events.length;i++,s++){let n=e.events[i],a=r.findEvent(n.name);if(!a)throw new Error("Event not found: "+n.name);let o=new qt(l.toSinglePrecision(Je(n,"time",0)),a);o.intValue=Je(n,"int",a.intValue),o.floatValue=Je(n,"float",a.floatValue),o.stringValue=Je(n,"string",a.stringValue),o.data.audioPath&&(o.volume=Je(n,"volume",1),o.balance=Je(n,"balance",0)),t.setFrame(s,o)}a.push(t)}let o=0;for(let t=0,e=a.length;t<e;t++)o=Math.max(o,a[t].getDuration());r.animations.push(new f(s,a,o))}}class $e{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}function Ge(t,e,s,r){let i=t[0],n=Je(i,"time",0),a=Je(i,"value",s)*r,o=0;for(let l=0;;l++){e.setFrame(l,n,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Je(h,"time",0),d=Je(h,"value",s)*r;i.curve&&(o=He(i.curve,e,o,l,0,n,c,a,d,r)),n=c,a=d,i=h}}function je(t,e,s,r,i,n){let a=t[0],o=Je(a,"time",0),l=Je(a,s,i)*n,h=Je(a,r,i)*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 p=Je(u,"time",0),m=Je(u,s,i)*n,f=Je(u,r,i)*n,g=a.curve;g&&(c=He(g,e,c,d,0,o,p,l,m,n),c=He(g,e,c,d,1,o,p,h,f,n)),o=p,l=m,h=f,a=u}}function He(t,e,s,r,i,n,a,o,l,h){if("stepped"==t)return e.setStepped(r),s;let c=i<<2,d=t[c],u=t[c+1]*h,p=t[c+2],m=t[c+3]*h;return e.setBezier(s,r,i,n,o,d,u,p,m,a,l),s+1}function Je(t,e,s){return void 0!==t[e]?t[e]:s}var Ke;function Qe(t,e,s){const r=new Vt(t);return"json"===s?new ze(r).readSkeletonData(e):new ie(r).readSkeletonData(new Uint8Array(e))}async function Ze(t,s,r){let i;const n=t.map(((t,i)=>{const n=s[i];let a=e.AssetType.Texture2D;return"ktx"===n?a=e.AssetType.KTX:"ktx2"===n&&(a=e.AssetType.KTX2),ss(t,r,a)}));try{i=await Promise.all(n)}catch(t){throw t}return i}async function ts(t,s){const r=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let i,n;try{i=await e.request(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let a=new Ct(i);const o=[];for(let t of a.pages){const e=r+t.name;o.push(ss(e,s))}try{n=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return a=es(i,n),a}function es(t,e){const s=new Ct(t);return s.pages.forEach(((t,s)=>{const r=function(t){return new rs(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(r)})),s}function ss(t,s,r=e.AssetType.Texture2D){return s.resourceManager.load({url:t,type:r})}void 0===Math.fround&&(Math.fround=(Ke=new Float32Array(1),function(t){return Ke[0]=t,Ke[0]}));class rs extends wt{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,s){t===exports.TextureFilter.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:s===exports.TextureFilter.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case exports.TextureWrap.ClampToEdge:return e.TextureWrapMode.Clamp;case exports.TextureWrap.Repeat:return e.TextureWrapMode.Repeat;case exports.TextureWrap.MirroredRepeat:return e.TextureWrapMode.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class is{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let r=0;r<e;++r)s[r]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class ns{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:as,One:os,DestinationColor:ls,Zero:hs,OneMinusSourceColor:cs,OneMinusSourceAlpha:ds}=e.BlendFactor,{Add:us}=e.BlendOperation;function ps(t,e,s){const r=t.renderState.blendState.targetBlendState;switch(e){case exports.BlendMode.Additive:r.sourceColorBlendFactor=s?os:as,r.destinationColorBlendFactor=os,r.sourceAlphaBlendFactor=os,r.destinationAlphaBlendFactor=os,r.colorBlendOperation=r.alphaBlendOperation=us;break;case exports.BlendMode.Multiply:r.sourceColorBlendFactor=ls,r.destinationColorBlendFactor=ds,r.sourceAlphaBlendFactor=os,r.destinationAlphaBlendFactor=ds,r.colorBlendOperation=r.alphaBlendOperation=us;break;case exports.BlendMode.Screen:r.sourceColorBlendFactor=os,r.destinationColorBlendFactor=cs,r.sourceAlphaBlendFactor=os,r.destinationAlphaBlendFactor=cs,r.colorBlendOperation=r.alphaBlendOperation=us;break;default:r.sourceColorBlendFactor=s?os:as,r.destinationColorBlendFactor=ds,r.sourceAlphaBlendFactor=os,r.destinationAlphaBlendFactor=ds,r.colorBlendOperation=r.alphaBlendOperation=us}}class ms{}const fs=1/0,gs=-1/0;class xs{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new i}static{this.tempColor=new i}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new is(e.SubPrimitive)}static{this.subRenderItemPool=new ns(ms)}static{this.bounds=new e.BoundingBox(new e.Vector3(fs,fs,fs),new e.Vector3(gs,gs,gs))}buildPrimitive(t,e){const{_clipper:s,_separateSlots:r,_subRenderItems:i,_separateSlotTextureMap:n}=this,{bounds:a}=xs;a.min.set(fs,fs,fs),a.max.set(gs,gs,gs);let o=0,l=0;const h=t.drawOrder,c=h.length,{engine:d,_indices:u,_vertices:p,_vertexCount:m,_subPrimitives:f,zSpacing:g,premultipliedAlpha:x}=e;let{tempVerts:w,tempTexture:b,tempBlendMode:y,subRenderItemPool:M,subPrimitivePool:S}=xs;i.length=0,M.clear();let v,k,I=e._vertices,A=0,B=0,T=exports.BlendMode.Normal,C=null,F=0;xs.tempBlendMode=null,xs.tempTexture=null;for(let t=0;t<c;++t){const e=h[t];if(!e.bone.active){s.clipEndWithSlot(e);continue}const a=e.getAttachment();let c=null;const d=g*t;let m=0;const E=s.isClipping();let Y=E?2:xs.VERTEX_SIZE;if(a){switch(a.constructor){case Xt:const t=a;c=t.color,m=4*Y,t.computeWorldVertices(e,w,0,Y),v=xs.QUAD_TRIANGLES,k=t.uvs,C=t.region.texture;break;case Rt:const r=a;c=r.color,m=(r.worldVerticesLength>>1)*Y,m>I.length&&(xs.tempVerts=new Array(m)),r.computeWorldVertices(e,0,r.worldVerticesLength,w,0,Y),v=r.triangles,k=r.uvs,C=r.region.texture;break;case xt:let i=a;s.clipStart(e,i);continue;default:s.clipEndWithSlot(e);continue}if(null!=C){let t,a,h,g,I=e.bone.skeleton.color,R=e.color,P=xs.tempColor,_=xs.tempDark;if(P.r=I.r*R.r*c.r,P.g=I.g*R.g*c.g,P.b=I.b*R.b*c.b,P.a=I.a*R.a*c.a,x&&(P.r*=P.a,P.g*=P.a,P.b*=P.a),E)s.clipTriangles(w,v,v.length,k,P,_,!1),t=s.clippedVertices,a=t.length,h=s.clippedTriangles,g=h.length;else{let e=w;const{r:s,g:r,b:i,a:n}=P;for(let t=2,a=0,o=m;t<o;t+=Y,a+=2)e[t]=s,e[t+1]=r,e[t+2]=i,e[t+3]=n,e[t+4]=k[a],e[t+5]=k[a+1];t=w,a=m,h=v,g=v.length}if(0==a||0==g){s.clipEndWithSlot(e);continue}let X=o/xs.VERTEX_STRIDE,V=p,D=o,O=0;for(;O<a;){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]+X;l+=g;const L=e.data,q=L.name;T=L.blendMode;const U=null!==y&&y!==L.blendMode,W=null!==b&&b!==C,z=r.get(q);if(z||U||W){if(B>0){const t=f[F];t&&F++;const e=t||S.get();e.start=A,e.count=B;const s=M.get();s.subPrimitive=e,s.texture=b,s.blendMode=y,i.push(s),A+=B,B=0}if(z){const t=n.get(q);if(t){const e=C.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=f[F];e&&F++;const s=e||S.get();s.start=A,s.count=g;const r=M.get();r.blendMode=T,r.subPrimitive=s,r.texture=C,r.slotName=q,i.push(r),A+=g,B=0}else B+=g}else B+=g;b=C,y=T}s.clipEndWithSlot(e)}else s.clipEndWithSlot(e)}if(B>0){const t=f[F];t&&F++;const e=t||S.get();e.start=A,e.count=B;const s=M.get();s.blendMode=T,s.subPrimitive=e,s.texture=C,i.push(s),B=0}s.clipEnd();const E=f.length,Y=i.length;if(Y<E)for(let t=Y;t<E;t++){const e=f[t];S.return(e)}e._clearSubPrimitives();for(let t=0,s=Y;t<s;++t){const s=i[t],{slotName:r,blendMode:a,texture:o}=s;e._addSubPrimitive(s.subPrimitive);let l=o.texture;n.has(r)&&(l=n.get(r));const h=`${l.instanceId}_${a}`;let c=bs._materialCache.get(h);c||(c=this._createMaterialForTexture(l,d,a,x),bs._materialCache.set(h,c)),e.setMaterial(t,c)}if(l>m)return e._createAndBindBuffer(l),void this.buildPrimitive(t,e);e._vertexBuffer.setData(p),e._indexBuffer.setData(u)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s,r){const i=bs._getDefaultMaterial(e);return i.shaderData.setTexture("material_SpineTexture",t),ps(i,s,r),i}_expandByPoint(t,e,s){const{bounds:{min:r,max:i}}=xs,n=Math.min(r.x,t),a=Math.min(r.y,e),o=Math.min(r.z,s),l=Math.max(i.x,t),h=Math.max(i.y,e),c=Math.max(i.z,s);r.set(n,a,o),i.set(l,h,c)}constructor(){this._clipper=new We,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class ws extends e.Material{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,e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",ws._spineVS,ws._spineFS));const s=this.renderState;s.blendState.targetBlendState.enabled=!0,ps(this,exports.BlendMode.Normal,!1),s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent}}class bs extends e.Renderer{static{this._spineGenerator=new xs}static{this._positionVertexElement=new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0)}static{this._colorVertexElement=new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0)}static{this._uvVertexElement=new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.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 ws(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 ys,this._subPrimitives=[],this._vertices=new Float32Array,this._indices=new Uint16Array,this._needResizeBuffer=!1,this._vertexCount=0,this._needsInitialize=!1;const s=new e.Primitive(this._engine);this._primitive=s,s.addVertexElement(bs._positionVertexElement),s.addVertexElement(bs._colorVertexElement),s.addVertexElement(bs._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(exports.Physics.update),bs._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:r,_engine:i}=this,n=i._renderElementPool.get();n.set(this.priority,this._distanceForSort);const a=i._subRenderElementPool;if(s){for(let t=0,i=s.length;t<i;t++){let i=r[t];if(!i)continue;(i.destroyed||i.shader.destroyed)&&(i=this.engine._meshMagentaMaterial);const o=a.get();o.set(this,i,e,s[t]),n.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,n)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:s}=xs;e.BoundingBox.transform(s,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 ft(e),r=new Kt(e),i=new it(s);t._setSkeleton(r),t._setState(i)}_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:s,_primitive:r}=this;this._vertexCount=t,this._vertices=new Float32Array(t*xs.VERTEX_STRIDE),this._indices=new Uint16Array(t);const i=4*xs.VERTEX_STRIDE,n=new e.Buffer(s,e.BufferBindFlag.VertexBuffer,this._vertices,e.BufferUsage.Dynamic),a=new e.Buffer(s,e.BufferBindFlag.IndexBuffer,this._indices,e.BufferUsage.Dynamic);this._indexBuffer=a,this._vertexBuffer=n;const o=new e.VertexBufferBinding(n,i);this._primitive.setVertexBufferBinding(0,o);const l=new e.IndexBufferBinding(a,e.IndexFormat.UInt16);r.setIndexBufferBinding(l)}_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===as&&e.destinationColorBlendFactor===os&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===os&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Additive:e.sourceColorBlendFactor===ls&&e.destinationColorBlendFactor===hs&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===hs&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Multiply:e.sourceColorBlendFactor===os&&e.destinationColorBlendFactor===cs&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===cs&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Screen:exports.BlendMode.Normal}(t),r=`${e.instanceId}_${s}`;bs._materialCache.delete(r)}))}_applyDefaultConfig(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:r,loop:i}=this.defaultConfig;"default"!==r&&(t.setSkinByName(r),t.setToSetupPose()),s&&e.setAnimation(0,s,i)}}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,r=new Kt(e),i=new it(s);this._setSkeleton(r),this._setState(i)}}s([e.assignmentClone],bs.prototype,"zSpacing",void 0),s([e.assignmentClone],bs.prototype,"premultipliedAlpha",void 0),s([e.deepClone],bs.prototype,"defaultConfig",void 0),s([e.ignoreClone],bs.prototype,"_primitive",void 0),s([e.ignoreClone],bs.prototype,"_subPrimitives",void 0),s([e.ignoreClone],bs.prototype,"_indexBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertexBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertices",void 0),s([e.ignoreClone],bs.prototype,"_indices",void 0),s([e.ignoreClone],bs.prototype,"_needResizeBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertexCount",void 0),s([e.ignoreClone],bs.prototype,"_resource",void 0),s([e.ignoreClone],bs.prototype,"_skeleton",void 0),s([e.ignoreClone],bs.prototype,"_state",void 0),s([e.ignoreClone],bs.prototype,"_needsInitialize",void 0);class ys{constructor(t=!0,e=null,s="default"){this.loop=t,this.animationName=e,this.skinName=s}}class Ms extends e.ReferResource{constructor(t,e,s){super(t),this._texturesInSpineAtlas=[],this.url=s,this._skeletonData=e,this._stateData=new ft(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),s=new e.Entity(this.engine,t),r=s.addComponent(bs),i=new Kt(this._skeletonData),n=new it(this._stateData);r._setSkeleton(i),r._setState(n),s._markAsTemplate(this),this._template=s}_associationTextureInSkeletonData(t){const{skins:e,slots:s}=t,r=this._texturesInSpineAtlas;for(let t=0,i=e.length;t<i;t++)for(let i=0,n=s.length;i<n;i++){const n=s[i],a=e[t].getAttachment(n.index,n.name),o=a?.region?.texture.texture;o&&(r.includes(o)||(r.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 Ss{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,r=t.length;s<r;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class vs extends e.Loader{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:r,skeletonExtensions:i}=vs,n=vs.getUrlExtension(t,e);n&&(i.includes(n)&&(s.skeletonPath=t,s.skeletonExtension=n),"atlas"===n&&(s.atlasPath=t),r.includes(n)&&(s.imagePaths.push(t),s.imageExtensions.push(n)))}static deriveAndAssignSpineAsset(t,e,s){const r=vs.getUrlExtension(t,e);if(!r)return;s.skeletonPath=t,s.skeletonExtension=r;const i=/(\.(json|bin|skel))$/;let n;if(i.test(t)&&(n=t.replace(i,"")),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,s){return new e.AssetPromise((async e=>{let r;if(t.urls)r=await this._handleOriginAsset(t,s);else{const e=await this.request(t.url,{type:"arraybuffer"}),i=new Ss(new Uint8Array(e)),n=i.nextStr();r=n.startsWith("spine")?await this._handleEditorAsset(t,e,i,n,s):await this._handleOriginAsset(t,s,e)}e(r)}))}async _handleEditorAsset(t,e,s,r,i){let n,a;const o=r.startsWith("spine:skel")?"skel":"json",{engine:l}=i;if("skel"===o)a=s.nextStr(),n=s.nextImageData();else{const t=new TextDecoder("utf-8").decode(new Uint8Array(e)),{data:s,atlas:r}=JSON.parse(t);a=r.refId,n=s}const h=Qe(await i.getResourceByRef({refId:a}),n,o);return new Ms(l,h,t.url)}async _handleOriginAsset(t,e,s){let{fileExtensions:r}=t.params||{},i={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:n}=e;if(s){const e=vs.verifyFileExtensions(r,!1);vs.deriveAndAssignSpineAsset(t.url,e,i);const{skeletonPath:a,atlasPath:o}=i;if(!a||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await ts(o,n),{data:h,type:c}=this._determineSkeletonDataType(s),d=Qe(l,h,c);return new Ms(n,d,a)}{r=vs.verifyFileExtensions(r,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],n=r&&r[e]||null;vs.parseAndAssignSpineAsset(s,n,i)}const{skeletonPath:e,atlasPath:s,imagePaths:a,skeletonExtension:o,imageExtensions:l}=i;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(a.length>0){let t,e;u=u.concat([this.request(s,{type:"text"}),Ze(a,l,n)]),[d,t,e]=await Promise.all(u),c=es(t,e)}else u.push(ts(s,n)),[d,c]=await Promise.all(u);const p=Qe(c,d,h);return new Ms(n,p,e)}}_determineSkeletonDataType(t){let e,s;try{const r=new TextDecoder("utf-8").decode(t);JSON.parse(r),e=r,s="json"}catch(r){e=t,s="skel"}return{data:e,type:s}}}vs=s([e.resourceLoader("spine",["json","bin","skel"])],vs);class ks extends e.Loader{load(t,s){return new e.AssetPromise((async e=>{const r=await this.request(t.url,{type:"text"}),{data:i,textures:n}=JSON.parse(r),a=n.map((t=>s.getResourceByRef({refId:t.refId})));e(es(i,await Promise.all(a)))}))}}ks=s([e.resourceLoader("EditorSpineAtlas",["atlas"])],ks);const Is="0.0.0-experimental-engine-spine-20241107";e.Loader.registerClass("SpineAnimationRenderer",bs),console.log(`Galacean spine version: ${Is}`),exports.AlphaTimeline=X,exports.Animation=f,exports.AnimationState=it,exports.AnimationStateAdapter=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},exports.AnimationStateData=ft,exports.AssetManagerBase=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Lt){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,r)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${r}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${r}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${r}`)}))}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 r=new Image;r.crossOrigin="anonymous",r.onload=()=>{this.success(e,t,this.textureLoader(r))},r.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),n=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(i=>{try{let a=new Ct(i),o=a.pages.length,l=!1;for(let i of a.pages)this.loadTexture(r?r[i.name]:n+i.name,((s,r)=>{l||(i.setTexture(r),0==--o&&this.success(e,t,a))}),((e,r)=>{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,r)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${r}`)}))}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}},exports.AtlasAttachmentLoader=Vt,exports.Attachment=d,exports.AttachmentTimeline=O,exports.BinaryInput=ne,exports.Bone=Ot,exports.BoneData=Dt,exports.BoundingBoxAttachment=gt,exports.CURRENT=mt,exports.ClippingAttachment=xt,exports.Color=i,exports.ConstraintData=Nt,exports.CurveTimeline=y,exports.CurveTimeline1=M,exports.CurveTimeline2=S,exports.DebugUtils=class{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)}}},exports.DeformTimeline=N,exports.Downloader=Lt,exports.DrawOrderTimeline=q,exports.Event=qt,exports.EventData=Ut,exports.EventQueue=at,exports.EventTimeline=L,exports.FIRST=ht,exports.FakeTexture=class extends wt{setFilters(t,e){}setWraps(t,e){}dispose(){}},exports.HOLD_FIRST=dt,exports.HOLD_MIX=ut,exports.HOLD_SUBSEQUENT=ct,exports.IkConstraint=Wt,exports.IkConstraintData=zt,exports.IkConstraintTimeline=U,exports.InheritTimeline=R,exports.IntSet=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}},exports.Interpolation=a,exports.MathUtils=n,exports.MeshAttachment=Rt,exports.PathAttachment=Pt,exports.PathConstraint=Gt,exports.PathConstraintData=$t,exports.PathConstraintMixTimeline=G,exports.PathConstraintPositionTimeline=z,exports.PathConstraintSpacingTimeline=$,exports.PhysicsConstraintDampingTimeline=K,exports.PhysicsConstraintGravityTimeline=tt,exports.PhysicsConstraintInertiaTimeline=H,exports.PhysicsConstraintMassTimeline=Q,exports.PhysicsConstraintMixTimeline=et,exports.PhysicsConstraintResetTimeline=st,exports.PhysicsConstraintStrengthTimeline=J,exports.PhysicsConstraintTimeline=j,exports.PhysicsConstraintWindTimeline=Z,exports.PointAttachment=_t,exports.Pool=h,exports.Pow=o,exports.PowOut=class extends o{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},exports.RGB2Timeline=D,exports.RGBA2Timeline=V,exports.RGBATimeline=P,exports.RGBTimeline=_,exports.RegionAttachment=Xt,exports.RotateTimeline=v,exports.SETUP=pt,exports.SUBSEQUENT=lt,exports.ScaleTimeline=B,exports.ScaleXTimeline=T,exports.ScaleYTimeline=C,exports.SequenceTimeline=rt,exports.ShearTimeline=F,exports.ShearXTimeline=E,exports.ShearYTimeline=Y,exports.Skeleton=Kt,exports.SkeletonBinary=ie,exports.SkeletonBounds=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new h((()=>l.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,n=t.slots,a=n.length;s.length=0,i.freeAll(r),r.length=0;for(let t=0;t<a;t++){let e=n[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof gt){let t=a;s.push(t);let n=i.obtain();n.length!=t.worldVerticesLength&&(n=l.newFloatArray(t.worldVerticesLength)),r.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,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let n=0,a=i.length;n<a;n++){let a=i[n],o=a;for(let i=0,n=a.length;i<n;i+=2){let n=o[i],a=o[i+1];t=Math.min(t,n),e=Math.min(e,a),s=Math.max(s,n),r=Math.max(r,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,n=this.minY,a=this.maxX,o=this.maxY;if(t<=i&&s<=i||e<=n&&r<=n||t>=a&&s>=a||e>=o&&r>=o)return!1;let l=(r-e)/(s-t),h=l*(i-t)+e;if(h>n&&h<o)return!0;if(h=l*(a-t)+e,h>n&&h<o)return!0;let c=(n-e)/l+t;return c>i&&c<a||(c=(o-e)/l+t,c>i&&c<a)}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 r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,n=i-2,a=!1;for(let t=0;t<i;t+=2){let i=r[t+1],o=r[n+1];if(i<s&&o>=s||o<s&&i>=s){let l=r[t];l+(s-i)/(o-i)*(r[n]-l)<e&&(a=!a)}n=t}return a}intersectsSegment(t,e,s,r){let i=this.polygons;for(let n=0,a=i.length;n<a;n++)if(this.intersectsSegmentPolygon(i[n],t,e,s,r))return this.boundingBoxes[n];return null}intersectsSegmentPolygon(t,e,s,r,i){let n=t,a=t.length,o=e-r,l=s-i,h=e*i-s*r,c=n[a-2],d=n[a-1];for(let t=0;t<a;t+=2){let a=n[t],u=n[t+1],p=c*u-d*a,m=c-a,f=d-u,g=o*f-l*m,x=(h*m-o*p)/g;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let t=(h*f-l*p)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=i||t>=i&&t<=s))return!0}c=a,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}},exports.SkeletonClipping=We,exports.SkeletonData=Zt,exports.SkeletonJson=ze,exports.Skin=ee,exports.SkinEntry=te,exports.Slot=Ht,exports.SlotData=se,exports.SpineAnimationRenderer=bs,exports.SpineResource=Ms,exports.StringSet=r,exports.Texture=wt,exports.TextureAtlas=Ct,exports.TextureAtlasPage=Et,exports.TextureAtlasRegion=Yt,exports.TextureRegion=Tt,exports.TimeKeeper=class{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)}},exports.Timeline=b,exports.TrackEntry=nt,exports.TransformConstraint=Jt,exports.TransformConstraintData=re,exports.TransformConstraintTimeline=W,exports.TranslateTimeline=k,exports.TranslateXTimeline=I,exports.TranslateYTimeline=A,exports.Triangulator=Ue,exports.Utils=l,exports.Vector2=c,exports.VertexAttachment=u,exports.WindowedMean=class{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}},exports.createTextureAtlas=es,exports.version=Is;
|
|
2
2
|
//# sourceMappingURL=main.js.map
|