@eva/plugin-renderer-spine 2.0.0-beta.1 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EVA.plugin.renderer.spine.js +2 -2
- package/dist/EVA.plugin.renderer.spine.min.js +1 -1
- package/dist/plugin-renderer-spine.cjs.js +25 -61
- package/dist/plugin-renderer-spine.cjs.prod.js +1 -1
- package/dist/plugin-renderer-spine.d.ts +2 -0
- package/dist/plugin-renderer-spine.esm.js +23 -60
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
function ownKeys(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,i)}return s}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(s),!0).forEach((function(e){_defineProperty(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ownKeys(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}function _defineProperty(t,e,s){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"==typeof e?e:e+""}function _toPrimitive(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)({}).hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},_extends.apply(null,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_spine=function(t,e,s,i){"use strict";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])},n(t,e)};function r(t,e){function s(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}function a(t){return function(e,s){var i=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,s);i.key=s,i.type=t}}var o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])},o(t,e)};function l(t,e){function s(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}function h(t,e,s,i){var n,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,s,a):n(e,s))||a);return r>3&&a&&Object.defineProperty(e,s,a),a}function c(t,e,s,i){return new(s||(s=Promise))((function(n,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){t.done?n(t.value):new s((function(e){e(t.value)})).then(a,o)}l((i=i.apply(t,e||[])).next())}))}function d(t,e){var s,i,n,r,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(r){return function(o){return function(r){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,i&&(n=2&r[0]?i.return:r[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,r[1])).done)return n;switch(i=0,n&&(r=[2&r[0],n.value]),r[0]){case 0:case 1:n=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!n||r[1]>n[0]&&r[1]<n[3])){a.label=r[1];break}if(6===r[0]&&a.label<n[1]){a.label=n[1],n=r;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(r);break}n[2]&&a.ops.pop(),a.trys.pop();continue}r=e.call(t,a)}catch(t){r=[6,t],i=0}finally{s=n=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}}var u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.resource="",e.scale=1,e.animationName="",e.autoPlay=!0,e.waitExecuteInfos=[],e}return l(e,t),Object.defineProperty(e.prototype,"armature",{get:function(){return this._armature},set:function(t){var e,s;if(this._armature=t,t){this.autoPlay&&this.play(this.animationName);try{for(var i=function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],s=0;return e?e.call(t):{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}}}(this.waitExecuteInfos),n=i.next();!n.done;n=i.next()){var r=n.value;if(r.playType){var a=r.name,o=r.loop,l=r.track;this.play(a,o,l)}else this.stop(r.track)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(s=i.return)&&s.call(i)}finally{if(e)throw e.error}}this.waitExecuteInfos=[]}},enumerable:!1,configurable:!0}),e.prototype.init=function(t){t&&_extends(this,t)},e.prototype.onDestroy=function(){this.destroied=!0},e.prototype.play=function(t,e,s){try{t&&(this.animationName=t),this.armature?(void 0===s&&(s=0),this.armature.state.setAnimation(s,this.animationName,e)):this.waitExecuteInfos.push({playType:!0,name:t,loop:null!=e?e:this.autoPlay,track:s})}catch(t){console.log(t)}},e.prototype.stop=function(t){this.armature?(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0)):this.waitExecuteInfos.push({playType:!1,track:t})},e.prototype.addAnimation=function(t,e,s,i){try{this.armature&&(void 0===i&&(i=0),this.armature.state.addAnimation(i,t,s,e))}catch(t){console.log(t)}},e.prototype.setMix=function(t,e,s){this.armature&&this.armature.stateData.setMix(t,e,s)},e.prototype.getAnim=function(t){void 0===t&&(t=0);try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}},e.prototype.setDefaultMix=function(t){this.armature&&(this.armature.stateData.defaultMix=t)},e.prototype.setAttachment=function(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)},e.prototype.getBone=function(t){if(this.armature)return this.armature.skeleton.findBone(t)},e.componentName="Spine",h([a("string")],e.prototype,"resource",void 0),h([a("number")],e.prototype,"scale",void 0),h([a("string")],e.prototype,"animationName",void 0),h([a("boolean")],e.prototype,"autoPlay",void 0),e}(e.Component),m=u,f={};function p(t,e){var s=f[t];return s||(s=function(t){var e=t.image;return{tex:e instanceof i.Texture?e:i.Texture.from(e),count:0}}(e),f[t]=s),s.count++,s.tex}var g={};function b(t,e,s){return c(this,void 0,void 0,(function(){var i;return d(this,(function(n){if(!(i=g[t.name]))if(t.complete)i=function(t,e,s,i){var n=e.ske,r=e.atlas,a=new i.AtlasAttachmentLoader(r),o=n instanceof Uint8Array?new i.SkeletonBinary(a):new i.SkeletonJson(a);o.scale=s||1;var l={spineData:o.readSkeletonData(n),ref:0,imageSrc:e.image.label};return g[t]=l,l}(t.name,t.data,e,s);else if(!i)return[2];return p(t.data.image.label,t.data),i.ref++,[2,i.spineData]}))}))}function w(t,e){var s=g[t];s&&(s.ref--,s.ref<=0&&(!function(t){t&&setTimeout((function(){var e=f[t];e&&(e.count--,e.count<=0&&(e.tex&&(e.tex.destroy(!0),e.tex=null),delete f[t]))}),100)}(e),delete g[t]))}var x=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.armatures={},e}return l(i,t),i.prototype.init=function(t){var i=this,n=t.pixiSpine;this.renderSystem=this.game.getSystem(s.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=n,this.game.canvas.addEventListener("webglcontextrestored",(function(){var t=i.game.gameObjects,s=[];for(var n in i.armatures)for(var r=+n,a=0;a<t.length;++a){var o=t[a];if(o.id===r){var l=o.getComponent(m);l&&(i.remove({type:e.OBSERVER_TYPE.REMOVE,gameObject:o,component:l,componentName:m.componentName}),s.push({type:e.OBSERVER_TYPE.ADD,gameObject:o,component:l,componentName:m.componentName}));break}}setTimeout((function(){s.forEach((function(t){i.add(t)}))}),1e3)}),!1)},i.prototype.update=function(e){for(var s in this.armatures)this.armatures[s].update(.001*e.deltaTime);t.prototype.update.call(this)},i.prototype.componentChanged=function(t){return c(this,void 0,void 0,(function(){return d(this,(function(s){if("Spine"===t.componentName)if(t.type===e.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===e.OBSERVER_TYPE.CHANGE){if("resource"===t.prop.prop[0])this.change(t)}else t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t);return[2]}))}))},i.prototype.add=function(t,s){var i,n;return c(this,void 0,void 0,(function(){var r,a,o,l,h,c,u,m,f=this;return d(this,(function(d){switch(d.label){case 0:return r=t.component,clearTimeout(r.addHandler),a=t.gameObject.id,o=this.increaseAsyncId(a),[4,e.resource.getResource(r.resource)];case 1:return l=d.sent(),this.validateAsyncId(a,o)?[4,b(l,r.scale,this.pixiSpine)]:[2];case 2:return h=d.sent(),this.validateAsyncId(a,o)?h?(this.remove(t),(c=null===(n=null===(i=this.renderSystem)||void 0===i?void 0:i.containerManager)||void 0===n?void 0:n.getContainer(t.gameObject.id))?(r.lastResource=r.resource,u=new this.pixiSpine.Spine({skeletonData:h,autoUpdate:!1}),this.armatures[t.gameObject.id]=u,t.gameObject&&t.gameObject.transform&&(m=t.gameObject.transform,u.x=m.size.width*m.origin.x,u.y=m.size.height*m.origin.y),c.addChildAt(u,0),u.update(),r.armature=u,r.emit("loaded",{resource:r.resource}),u.state.addListener({start:function(t,e){r.emit("start",{track:t,name:t.animation.name})},complete:function(t,e){r.emit("complete",{track:t,name:t.animation.name})},interrupt:function(t,e){r.emit("interrupt",{track:t,name:t.animation.name})},end:function(t,e){r.emit("end",{track:t,name:t.animation.name})},event:function(t,e){r.emit("event",t,e)}}),[2]):[2]):(r.addHandler=setTimeout((function(){r.destroied||(void 0===s&&(s=20),--s>0?f.add(t,s):console.log("retry exceed max times",r.resource))}),1e3),[2]):[2]}}))}))},i.prototype.change=function(t){this.remove(t),this.add(t)},i.prototype.remove=function(t){var s,i,n,r;return c(this,void 0,void 0,(function(){var a,o,l,h;return d(this,(function(c){switch(c.label){case 0:return this.increaseAsyncId(t.gameObject.id),a=t.component,clearTimeout(a.addHandler),o=this.armatures[t.gameObject.id],(l=null===(i=null===(s=this.renderSystem)||void 0===s?void 0:s.containerManager)||void 0===i?void 0:i.getContainer(t.gameObject.id))&&o&&l.removeChild(o),a.armature?(a.armature.destroy({children:!0}),[4,e.resource.getResource(a.lastResource)]):[3,2];case 1:w((h=c.sent()).name,null===(r=null===(n=h.data)||void 0===n?void 0:n.image)||void 0===r?void 0:r.src),c.label=2;case 2:return a.armature=null,delete this.armatures[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE,[2]}}))}))},i.systemName="SpineSystem",i=h([e.decorators.componentObserver({Spine:["resource"]})],i)}(s.Renderer),y=x;e.resource.registerResourceType("SPINE");var v=Object.defineProperty,k=(t,e,s)=>(((t,e,s)=>{e in t?v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(t,"symbol"!=typeof e?e+"":e,s),s);if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var S=class{constructor(){this.entries={},this.size=0}add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},C=class{constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new C).setFromString(t)}},A=C;k(A,"WHITE",new C(1,1,1,1)),k(A,"RED",new C(1,0,0,1)),k(A,"GREEN",new C(0,1,0,1)),k(A,"BLUE",new C(0,0,1,1)),k(A,"MAGENTA",new C(1,0,1,1));var I=class{static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*I.degRad)}static sinDeg(t){return Math.sin(t*I.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*I.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 I.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},T=I;k(T,"PI",3.1415927),k(T,"PI2",2*I.PI),k(T,"invPI2",1/I.PI2),k(T,"radiansToDegrees",180/I.PI),k(T,"radDeg",I.radiansToDegrees),k(T,"degreesToRadians",I.PI/180),k(T,"degRad",I.degreesToRadians);var M=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},F=class extends M{constructor(t){super(),this.power=2,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}},Y=class{static arrayCopy(t,e,s,i,n){for(let r=e,a=i;r<e+n;r++,a++)s[a]=t[r]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:Y.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(Y.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(Y.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 Y.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Y.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},P=Y;k(P,"SUPPORTS_TYPED_ARRAYS","undefined"!=typeof Float32Array);var E=class{constructor(t){this.items=new Array,this.instantiator=void 0,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}},X=class{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}},B=class{constructor(t){if(this.name=void 0,!t)throw new Error("name cannot be null.");this.name=t}},R=class extends B{constructor(t){super(t),this.id=R.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVertices(t,e,s,i,n,r){s=n+(s>>1)*r;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,m=a.c,f=a.d;for(let t=e,a=n;a<s;t+=2,a+=r){let e=l[t],s=l[t+1];i[a]=e*d+s*u+h,i[a+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=a.bones;if(0==o.length)for(let t=n,e=3*d;t<s;t+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,e+=3){let t=u[h[c]],i=l[e],r=l[e+1],a=l[e+2];s+=(i*t.a+r*t.b+t.worldX)*a,n+=(i*t.c+r*t.d+t.worldY)*a}i[t]=s,i[t+1]=n}else{let t=o;for(let e=n,a=3*d,o=d<<1;e<s;e+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,a+=3,o+=2){let e=u[h[c]],i=l[a]+t[o],r=l[a+1]+t[o+1],d=l[a+2];s+=(i*e.a+r*e.b+e.worldX)*d,n+=(i*e.c+r*e.d+e.worldY)*d}i[e]=s,i[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},D=R;k(D,"nextID",0);var V=class{constructor(t){this.id=V.nextID(),this.regions=void 0,this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(t)}copy(){let t=new V(this.regions.length);return P.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return V._nextID++}},O=V;k(O,"_nextID",0);var _,L,N,U=((_=U||{})[_.hold=0]="hold",_[_.once=1]="once",_[_.loop=2]="loop",_[_.pingpong=3]="pingpong",_[_.onceReverse=4]="onceReverse",_[_.loopReverse=5]="loopReverse",_[_.pingpongReverse=6]="pingpongReverse",_),q=[0,1,2,3,4,5,6],W=class{constructor(t,e,s){if(this.name=void 0,this.timelines=[],this.timelineIds=new S,this.duration=void 0,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,r,a,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,n,r,a,o)}},z=((L=z||{})[L.setup=0]="setup",L[L.first=1]="first",L[L.replace=2]="replace",L[L.add=3]="add",L),j=((N=j||{})[N.mixIn=0]="mixIn",N[N.mixOut=1]="mixOut",N),G={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{constructor(t,e){this.propertyIds=void 0,this.frames=void 0,this.propertyIds=e,this.frames=P.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}},H=class extends ${constructor(t,e,s){super(t,s),this.curves=void 0,this.curves=P.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=P.newFloatArray(e);P.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*(n-2*a+l),p=.006*(3*(r-o)-i+h),g=.006*(3*(a-l)-n+c),b=2*m+p,w=2*f+g,x=.3*(r-i)+m+.16666667*p,y=.3*(a-n)+f+.16666667*g,v=i+x,k=n+y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,x+=b,y+=w,b+=p,w+=g,v+=x,k+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let r=this.frames[e],a=this.frames[e+s];return a+(t-r)/(n[i]-r)*(n[i+1]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=t){let e=n[i-2],s=n[i-1];return s+(t-e)/(n[i]-e)*(n[i+1]-s)}e+=this.getFrameEntries();let a=n[r-2],o=n[r-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}},K=class extends H{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],n=e[s+1];return n+(t-i)/(e[s+2]-i)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);switch(s){case 0:return n+r*e;case 1:case 2:r+=n-i}return i+r*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);return 0==s?n+(r-n)*e:i+(r-i)*e}getAbsoluteValue2(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}return 0==s?n+(r-n)*e:i+(r-i)*e}getScaleValue(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}let a=this.getCurveValue(t)*r;if(1==e)return 3==s?n+a-r:a;if(1==i)switch(s){case 0:return r+(Math.abs(a)*T.signum(r)-r)*e;case 1:case 2:return n+(Math.abs(a)*T.signum(n)-n)*e}else{let t=0;switch(s){case 0:return t=Math.abs(r)*T.signum(a),t+(a-t)*e;case 1:case 2:return t=Math.abs(n)*T.signum(a),t+(a-t)*e}}return n+(a-r)*e}},J=class extends H{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},Q=class extends K{constructor(t,e,s){super(t,e,G.rotate+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,r,o.rotation,o.data.rotation))}},Z=class extends J{constructor(t,e,s){super(t,e,G.x+"|"+s,G.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.x=o.data.x,void(o.y=o.data.y);case 1:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let h=0,c=0,d=$.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(r){case 0:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case 1:case 2:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case 3:o.x+=h*n,o.y+=c*n}}},tt=class extends K{constructor(t,e,s){super(t,e,G.x+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,r,o.x,o.data.x))}},et=class extends K{constructor(t,e,s){super(t,e,G.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,r,o.y,o.data.y))}},st=class extends J{constructor(t,e,s){super(t,e,G.scaleX+"|"+s,G.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(r){case 0:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case 1:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let d=$.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==n)3==r?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(1==a)switch(r){case 0:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*T.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*T.signum(e)-e)*n;break;case 1:case 2:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*T.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*T.signum(e)-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}else switch(r){case 0:t=Math.abs(o.data.scaleX)*T.signum(l),e=Math.abs(o.data.scaleY)*T.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 1:case 2:t=Math.abs(o.scaleX)*T.signum(l),e=Math.abs(o.scaleY)*T.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}}}},it=class extends K{constructor(t,e,s){super(t,e,G.scaleX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,r,a,o.scaleX,o.data.scaleX))}},nt=class extends K{constructor(t,e,s){super(t,e,G.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,r,a,o.scaleY,o.data.scaleY))}},rt=class extends J{constructor(t,e,s){super(t,e,G.shearX+"|"+s,G.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case 1:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let h=0,c=0,d=$.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(r){case 0:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case 1:case 2:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case 3:o.shearX+=h*n,o.shearY+=c*n}}},at=class extends K{constructor(t,e,s){super(t,e,G.shearX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,r,o.shearX,o.data.shearX))}},ot=class extends K{constructor(t,e,s){super(t,e,G.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,r,o.shearY,o.data.shearY))}},lt=class extends ${constructor(t,e){super(t,[G.inherit+"|"+e]),this.boneIndex=0,this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(1==a)return void(0==r&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?0!=r&&1!=r||(o.inherit=o.data.inherit):o.inherit=this.frames[$.search(l,s,2)+1]}},ht=class extends H{constructor(t,e,s){super(t,e,[G.rgb+"|"+s,G.alpha+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r}apply(t,e,s,i,n,r,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(r){case 0:return void h.setFromColor(t);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n)}return}let c=0,d=0,u=0,m=0,f=$.search(l,s,5),p=this.curves[f/5];switch(p){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+36-2),m=this.getBezierValue(s,f,4,p+54-2)}1==n?h.set(c,d,u,m):(0==r&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}},ct=class extends H{constructor(t,e,s){super(t,e,[G.rgb+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,r,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(r){case 0:return h.r=t.r,h.g=t.g,void(h.b=t.b);case 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n}return}let c=0,d=0,u=0,m=$.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==n)h.r=c,h.g=d,h.b=u;else{if(0==r){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*n,h.g+=(d-h.g)*n,h.b+=(u-h.b)*n}}},dt=class extends K{constructor(t,e,s){super(t,e,G.alpha+"|"+s),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,r,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(r){case 0:return void(l.a=t.a);case 1:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(0==r&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}},ut=class extends H{constructor(t,e,s){super(t,e,[G.rgb+"|"+s,G.alpha+"|"+s,G.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,r,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,n,r,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(r){case 0:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n),c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,p=0,g=0,b=0,w=$.search(l,s,8),x=this.curves[w>>3];switch(x){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],b=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,m+=(l[w+8+3]-m)*e,f+=(l[w+8+4]-f)*e,p+=(l[w+8+5]-p)*e,g+=(l[w+8+6]-g)*e,b+=(l[w+8+7]-b)*e;break;case 1:d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],b=l[w+7];break;default:d=this.getBezierValue(s,w,1,x-2),u=this.getBezierValue(s,w,2,x+18-2),m=this.getBezierValue(s,w,3,x+36-2),f=this.getBezierValue(s,w,4,x+54-2),p=this.getBezierValue(s,w,5,x+72-2),g=this.getBezierValue(s,w,6,x+90-2),b=this.getBezierValue(s,w,7,x+108-2)}if(1==n)h.set(d,u,m,f),c.r=p,c.g=g,c.b=b;else{if(0==r){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)*n,(u-h.g)*n,(m-h.b)*n,(f-h.a)*n),c.r+=(p-c.r)*n,c.g+=(g-c.g)*n,c.b+=(b-c.b)*n}}},mt=class extends H{constructor(t,e,s){super(t,e,[G.rgb+"|"+s,G.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,i,n,r,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(r){case 0: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 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n,c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,p=0,g=0,b=$.search(l,s,7),w=this.curves[b/7];switch(w){case 0:let t=l[b];d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],p=l[b+5],g=l[b+6];let e=(s-t)/(l[b+7]-t);d+=(l[b+7+1]-d)*e,u+=(l[b+7+2]-u)*e,m+=(l[b+7+3]-m)*e,f+=(l[b+7+4]-f)*e,p+=(l[b+7+5]-p)*e,g+=(l[b+7+6]-g)*e;break;case 1:d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],p=l[b+5],g=l[b+6];break;default:d=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+36-2),f=this.getBezierValue(s,b,4,w+54-2),p=this.getBezierValue(s,b,5,w+72-2),g=this.getBezierValue(s,b,6,w+90-2)}if(1==n)h.r=d,h.g=u,h.b=m,c.r=f,c.g=p,c.b=g;else{if(0==r){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)*n,h.g+=(u-h.g)*n,h.b+=(m-h.b)*n,c.r+=(f-c.r)*n,c.g+=(p-c.g)*n,c.b+=(g-c.b)*n}}},ft=class extends ${constructor(t,e){super(t,[G.attachment+"|"+e]),this.slotIndex=0,this.attachmentNames=void 0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];o.bone.active&&(1!=a?s<this.frames[0]?0!=r&&1!=r||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[$.search1(this.frames,s)]):0==r&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},pt=class extends H{constructor(t,e,s,i){super(t,e,[G.deform+"|"+s+"|"+i.id]),this.slotIndex=0,this.attachment=void 0,this.vertices=void 0,this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*l-.06*a,p=.006*(3*(r-o)-i+h),g=.018*(a-l+.33333333),b=2*m+p,w=2*f+g,x=.3*(r-i)+m+.16666667*p,y=.3*a+f+.16666667*g,v=i+x,k=y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,x+=b,y+=w,b+=p,w+=g,v+=x,k+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let e=s[i-2],n=s[i-1];return n+(t-e)/(s[i]-e)*(s[i+1]-n)}let r=s[n-2],a=s[n-1];return a+(1-a)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof D)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(r=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(r){case 0:return void(h.length=0);case 1:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(m=0;m<d;m++)h[m]*=n}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*n}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==n)if(3==r){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else P.arrayCopy(t,0,h,0,d);else switch(r){case 0:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++){let i=s[e];h[e]=i+(t[e]-i)*n}}break}case 1:case 2:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case 3:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*n}}return}let f=$.search1(u,s),p=this.getCurvePercent(s,f),g=c[f],b=c[f+1];if(1==n)if(3==r){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=e+(b[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=s+(b[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=g[t];h[t]=e+(b[t]-e)*p}else switch(r){case 0:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]=(e+(b[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t],i=e[t];h[t]=i+(s+(b[t]-s)*p-i)*n}}break}case 1:case 2:for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(b[t]-e)*p-h[t])*n}break;case 3:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(b[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=(s+(b[t]-s)*p-e[t])*n}}}}},gt=class extends ${constructor(t){super(t,gt.propertyIds),this.events=void 0,this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,r,a){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,r,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=$.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)i.push(this.events[h])}},bt=gt;k(bt,"propertyIds",[""+G.event]);var wt=class extends ${constructor(t){super(t,wt.propertyIds),this.drawOrders=void 0,this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,r,a){if(1==a)return void(0==r&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(0!=r&&1!=r||P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=$.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,i=l.length;t<i;t++)e[t]=s[l[t]]}else P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},xt=wt;k(xt,"propertyIds",[""+G.drawOrder]);var yt=class extends H{constructor(t,e,s){super(t,e,[G.ikConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,r,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,r,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0: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 1:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=$.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)}0==r?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,1==a?(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)*n,o.softness+=(c-o.softness)*n,0==a&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},vt=class extends H{constructor(t,e,s){super(t,e,[G.transformConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=r,l[t+5]=a,l[t+6]=o}apply(t,e,s,i,n,r,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(r){case 0: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 1:o.mixRotate+=(t.mixRotate-o.mixRotate)*n,o.mixX+=(t.mixX-o.mixX)*n,o.mixY+=(t.mixY-o.mixY)*n,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(t.mixShearY-o.mixShearY)*n}return}let p=$.search(f,s,7),g=this.curves[p/7];switch(g){case 0:let t=f[p];l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];let e=(s-t)/(f[p+7]-t);l+=(f[p+7+1]-l)*e,h+=(f[p+7+2]-h)*e,c+=(f[p+7+3]-c)*e,d+=(f[p+7+4]-d)*e,u+=(f[p+7+5]-u)*e,m+=(f[p+7+6]-m)*e;break;case 1:l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),h=this.getBezierValue(s,p,2,g+18-2),c=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),u=this.getBezierValue(s,p,5,g+72-2),m=this.getBezierValue(s,p,6,g+90-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*n,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*n,o.mixShearY=t.mixShearY+(m-t.mixShearY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n,o.mixScaleX+=(d-o.mixScaleX)*n,o.mixScaleY+=(u-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}},kt=class extends K{constructor(t,e,s){super(t,e,G.pathConstraintPosition+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,r,o.position,o.data.position))}},St=class extends K{constructor(t,e,s){super(t,e,G.pathConstraintSpacing+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,r,o.spacing,o.data.spacing))}},Ct=class extends H{constructor(t,e,s){super(t,e,[G.pathConstraintMix+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let r=this.frames;r[t<<=2]=e,r[t+1]=s,r[t+2]=i,r[t+3]=n}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(r){case 0:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case 1:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u=$.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n}},At=class extends K{constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,n,r,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,r,this.get(o),this.setup(o)))}},It=class extends At{constructor(t,e,s){super(t,e,s,G.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},Tt=class extends At{constructor(t,e,s){super(t,e,s,G.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},Mt=class extends At{constructor(t,e,s){super(t,e,s,G.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},Ft=class extends At{constructor(t,e,s){super(t,e,s,G.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}},Yt=class extends At{constructor(t,e,s){super(t,e,s,G.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},Pt=class extends At{constructor(t,e,s){super(t,e,s,G.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},Et=class extends At{constructor(t,e,s){super(t,e,s,G.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},Xt=class extends ${constructor(t,e){super(t,Xt.propertyIds),this.constraintIndex=void 0,this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,r,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,[],n,r,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[$.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},Bt=Xt;k(Bt,"propertyIds",[G.physicsConstraintReset.toString()]);var Rt=class extends ${constructor(t,e,s){super(t,[G.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=void 0,this.attachment=void 0,this.slotIndex=e,this.attachment=s}getFrameEntries(){return Rt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let r=this.frames;r[t*=Rt.ENTRIES]=e,r[t+Rt.MODE]=s|i<<4,r[t+Rt.DELAY]=n}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof D&&l.timelineAttachment==h))return;if(1==a)return void(0==r&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(0!=r&&1!=r||(o.sequenceIndex=-1));let d=$.search(c,s,Rt.ENTRIES),u=c[d],m=c[d+Rt.MODE],f=c[d+Rt.DELAY];if(!this.attachment.sequence)return;let p=m>>4,g=this.attachment.sequence.regions.length,b=q[15&m];if(0!=b)switch(p+=(s-u)/f+1e-5|0,b){case 1:p=Math.min(g-1,p);break;case 2:p%=g;break;case 3:{let t=(g<<1)-2;p=0==t?0:p%t,p>=g&&(p=t-p);break}case 4:p=Math.max(g-1-p,0);break;case 5:p=g-1-p%g;break;case 6:{let t=(g<<1)-2;p=0==t?0:(p+g-1)%t,p>=g&&(p=t-p)}}o.sequenceIndex=p}},Dt=Rt;k(Dt,"ENTRIES",3),k(Dt,"MODE",1),k(Dt,"DELAY",2);var Vt=class{static emptyAnimation(){return Vt._emptyAnimation}constructor(t){this.data=void 0,this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new qt(this),this.propertyIDs=new S,this.animationsChanged=!1,this.trackEntryPool=new E((()=>new Ut)),this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=t*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let r=i.next;if(r){let e=i.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*r.timeScale,i.trackTime+=n,this.setCurrent(s,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,i=!1;for(let r=0,a=s.length;r<a;r++){let a=s[r];if(!a||a.delay>0)continue;i=!0;let o=0==r?1:a.mixBlend,l=a.alpha;a.mixingFrom?l*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(l=0);let h=l>=a.alphaAttachmentThreshold,c=a.animationLast,d=a.getAnimationTime(),u=d,m=e;a.reverse&&(u=a.animation.duration-u,m=null);let f=a.animation.timelines,p=f.length;if(0==r&&1==l||3==o){0==r&&(h=!0);for(let e=0;e<p;e++){P.webkit602BugfixHelper(l,o);var n=f[e];n instanceof ft?this.applyAttachmentTimeline(n,t,u,o,h):n.apply(t,c,u,m,l,o,0)}}else{let e=a.timelineMode,s=a.shortestRotation,i=!s&&a.timelinesRotation.length!=p<<1;i&&(a.timelinesRotation.length=p<<1);for(let n=0;n<p;n++){let r=f[n],d=e[n]==zt?o:0;!s&&r instanceof Q?this.applyRotateTimeline(r,t,u,l,d,a.timelinesRotation,n<<1,i):r instanceof ft?this.applyAttachmentTimeline(r,t,u,o,h):(P.webkit602BugfixHelper(l,o),r.apply(t,c,u,m,l,d,0))}}this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}for(var r=this.unkeyedState+Kt,a=t.slots,o=0,l=t.slots.length;o<l;o++){var h=a[o];if(h.attachmentState==r){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;0==t.mixDuration?(n=1,1==s&&(s=0)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),1!=s&&(s=i.mixBlend));let r=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,o=i.animation.timelines,l=o.length,h=i.alpha*t.interruptAlpha,c=h*(1-n),d=i.animationLast,u=i.getAnimationTime(),m=u,f=null;if(i.reverse?m=i.animation.duration-m:n<i.eventThreshold&&(f=this.events),3==s)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,1);else{let t=i.timelineMode,n=i.timelineHoldMix,u=i.shortestRotation,p=!u&&i.timelinesRotation.length!=l<<1;p&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let g=0;g<l;g++){let l,b=o[g],w=1,x=0;switch(t[g]){case zt:if(!a&&b instanceof xt)continue;l=s,x=c;break;case jt:l=0,x=c;break;case Gt:l=s,x=h;break;case $t:l=0,x=h;break;default:l=0;let t=n[g];x=h*Math.max(0,1-t.mixTime/t.mixDuration)}i.totalAlpha+=x,!u&&b instanceof Q?this.applyRotateTimeline(b,e,m,x,l,i.timelinesRotation,g<<1,p):b instanceof ft?this.applyAttachmentTimeline(b,e,m,l,r&&x>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(x,s),a&&b instanceof xt&&0==l&&(w=0),b.apply(e,d,m,f,x,l,w))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var r=e.slots[t.slotIndex];r.bone.active&&(s<t.frames[0]?0!=i&&1!=i||this.setAttachment(e,r,r.data.attachmentName,n):this.setAttachment(e,r,t.attachmentNames[$.search1(t.frames,s)],n),r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+Kt))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Jt)}applyRotateTimeline(t,e,s,i,n,r,a,o){if(o&&(r[a]=0),1==i)return void t.apply(e,0,s,null,1,n,0);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,c=l.data.rotation}else h=0==n?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=r[a];else{let t=0,e=0;o?(t=0,e=u):(t=r[a],e=r[a+1]);let s=t-t%360;d=u+s;let i=u>=0,n=t>=0;Math.abs(e)<=90&&T.signum(e)!=T.signum(u)&&(Math.abs(t-s)>180?(d+=360*T.signum(t),n=i):0!=s?d-=360*T.signum(t):n=i),n!=i&&(d+=360*T.signum(t)),r[a]=d}r[a+1]=u,l.rotation=h+d*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,r=t.trackLast%n,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<r)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==n)h=!0;else{const e=Math.floor(t.trackTime/n);h=e>0&&e>Math.floor(t.trackLast/n)}else h=e>=i&&t.animationLast<i;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 i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let r=this.trackEntry(t,e,s,n);return this.setCurrent(t,r,i),this.queue.drain(),r}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let r=this.trackEntry(t,e,s,n);return n?(n.next=r,r.previous=n,i<=0&&(i+=n.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=i,r}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Vt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,Vt.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(P.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}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&&3==s.mixBlend||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let r=t.timelineHoldMix;r.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)n[t]=a.addAll(s[t].getPropertyIds())?$t:Gt;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(a.addAll(l))if(!e||i instanceof ft||i instanceof xt||i instanceof bt||!e.animation.hasTimeline(l))n[o]=jt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=Ht,r[o]=s;continue t}break}n[o]=$t}else n[o]=zt}}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()}},Ot=Vt;k(Ot,"_emptyAnimation",new W("<empty>",[],0));var _t,Lt,Nt,Ut=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.mixAttachmentThreshold=0,this.alphaAttachmentThreshold=0,this.mixDrawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this._mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=2,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}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}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}},qt=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=void 0,this.animState=t}start(t){this.objects.push(Wt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Wt.interrupt),this.objects.push(t)}end(t){this.objects.push(Wt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Wt.dispose),this.objects.push(t)}complete(t){this.objects.push(Wt.complete),this.objects.push(t)}event(t,e){this.objects.push(Wt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],n=t[s+1];switch(i){case Wt.start:n.listener&&n.listener.start&&n.listener.start(n);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(n)}break;case Wt.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(n)}break;case Wt.end:n.listener&&n.listener.end&&n.listener.end(n);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(n)}case Wt.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(n)}this.animState.trackEntryPool.free(n);break;case Wt.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(n)}break;case Wt.event:let i=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,i);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,i)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Wt=((_t=Wt||{})[_t.start=0]="start",_t[_t.interrupt=1]="interrupt",_t[_t.end=2]="end",_t[_t.dispose=3]="dispose",_t[_t.complete=4]="complete",_t[_t.event=5]="event",_t),zt=0,jt=1,Gt=2,$t=3,Ht=4,Kt=1,Jt=2,Qt=class{constructor(t){if(this.skeletonData=void 0,this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}},Zt=class extends D{constructor(t){super(t),this.color=new A(1,1,1,1)}copy(){let t=new Zt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},te=class extends D{constructor(t){super(t),this.endSlot=null,this.color=new A(.2275,.2275,.8078,1)}copy(){let t=new te(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},ee=class{constructor(t){this._image=void 0,this._image=t}getImage(){return this._image}},se=((Lt=se||{})[Lt.Nearest=9728]="Nearest",Lt[Lt.Linear=9729]="Linear",Lt[Lt.MipMap=9987]="MipMap",Lt[Lt.MipMapNearestNearest=9984]="MipMapNearestNearest",Lt[Lt.MipMapLinearNearest=9985]="MipMapLinearNearest",Lt[Lt.MipMapNearestLinear=9986]="MipMapNearestLinear",Lt[Lt.MipMapLinearLinear=9987]="MipMapLinearLinear",Lt),ie=((Nt=ie||{})[Nt.MirroredRepeat=33648]="MirroredRepeat",Nt[Nt.ClampToEdge=33071]="ClampToEdge",Nt[Nt.Repeat=10497]="Repeat",Nt),ne=class{constructor(){this.texture=void 0,this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},re=class{constructor(t){this.pages=new Array,this.regions=new Array;let e=new ae(t),s=new Array(4),i={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=P.enumValue(se,s[1]),t.magFilter=P.enumValue(se,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=10497),-1!=s[1].indexOf("y")&&(t.vWrap=10497)},pma:t=>{t.pma="true"==s[1]}};var n={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 r=e.readLine();for(;r&&0==r.trim().length;)r=e.readLine();for(;r&&0!=r.trim().length&&0!=e.readEntry(s,r);)r=e.readLine();let a=null,o=null,l=null;for(;null!==r;)if(0==r.trim().length)a=null,r=e.readLine();else if(a){let t=new le(a,r);for(;;){let i=e.readEntry(s,r=e.readLine());if(0==i)break;let a=n[s[0]];if(a)a(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<i;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/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 oe(r.trim());0!=e.readEntry(s,r=e.readLine());){let t=i[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 e=0;e<this.pages.length;e++){var t;null===(t=this.pages[e].texture)||void 0===t||t.dispose()}}},ae=class{constructor(t){this.lines=void 0,this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let s=e.indexOf(",",n);if(-1==s)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,s-n).trim(),n=s+1,4==i)return 4}}},oe=class{constructor(t){this.name=void 0,this.minFilter=9728,this.magFilter=9728,this.uWrap=33071,this.vWrap=33071,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,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}},le=class extends ne{constructor(t,e){super(),this.page=void 0,this.name=void 0,this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=t,this.name=e,t.regions.push(this)}},he=class extends D{constructor(t,e){super(t),this.region=null,this.path=void 0,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new A(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new A(0,0,0,0),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=P.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,r=0,a=0;if(this.region instanceof le){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*r,e[o+1]=n+(1-t[o])*a;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,r=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*r,e[o+1]=n+(1-t[o+1])*a;return;case 270:i-=o.offsetY/h,n-=o.offsetX/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*r,e[o+1]=n+t[o]*a;return}i-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,r=o.originalWidth/h,a=o.originalHeight/c}else this.region?(r=this.region.u2-i,a=this.region.v2-n):(i=n=0,r=a=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*r,e[o+1]=n+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 he(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),P.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),P.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),P.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,r){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,r)}newLinkedMesh(){let t=new he(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}},ce=class extends D{constructor(t){super(t),this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new A(1,1,1,1)}copy(){let t=new ce(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},de=class extends D{constructor(t){super(t),this.x=0,this.y=0,this.rotation=0,this.color=new A(.38,.94,0,1)}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*T.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,r=s*t.c+i*t.d;return T.atan2Deg(r,n)}copy(){let t=new de(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},ue=class extends B{constructor(t,e){super(t),this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new A(1,1,1,1),this.path=void 0,this.region=null,this.sequence=null,this.offset=P.newFloatArray(8),this.uvs=P.newFloatArray(8),this.tempColor=new A(1,1,1,1),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,r=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,o=r+this.region.height*i,l=this.rotation*T.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=n*h+d,f=n*c,p=r*h+u,g=r*c,b=a*h+d,w=a*c,x=o*h+u,y=o*c,v=this.offset;v[0]=m-g,v[1]=p+f,v[2]=m-y,v[3]=x+f,v[4]=b-y,v[5]=x+w,v[6]=b-g,v[7]=p+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,r=this.offset,a=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=r[0],m=r[1],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[2],m=r[3],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[4],m=r[5],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[6],m=r[7],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o}copy(){let t=new ue(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,P.arrayCopy(this.uvs,0,t.uvs,0,8),P.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}},me=ue;k(me,"X1",0),k(me,"Y1",1),k(me,"C1R",2),k(me,"C1G",3),k(me,"C1B",4),k(me,"C1A",5),k(me,"U1",6),k(me,"V1",7),k(me,"X2",8),k(me,"Y2",9),k(me,"C2R",10),k(me,"C2G",11),k(me,"C2B",12),k(me,"C2A",13),k(me,"U2",14),k(me,"V2",15),k(me,"X3",16),k(me,"Y3",17),k(me,"C3R",18),k(me,"C3G",19),k(me,"C3B",20),k(me,"C3A",21),k(me,"U3",22),k(me,"V3",23),k(me,"X4",24),k(me,"Y4",25),k(me,"C4R",26),k(me,"C4G",27),k(me,"C4B",28),k(me,"C4A",29),k(me,"U4",30),k(me,"V4",31);var fe,pe,ge,be,we=class{constructor(t){this.atlas=void 0,this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,r=i.length;n<r;n++){let r=s.getPath(e,n),a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (sequence: "+t+")");i[n]=a}}newRegionAttachment(t,e,s,i){let n=new me(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,i){let n=new he(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new Zt(e)}newPathAttachment(t,e){return new ce(e)}newPointAttachment(t,e){return new de(e)}newClippingAttachment(t,e){return new te(e)}},xe=class{constructor(t,e,s){if(this.index=0,this.name=void 0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.inherit=ye.Normal,this.skinRequired=!1,this.color=new A,this.icon=void 0,this.visible=!1,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}},ye=((fe=ye||{})[fe.Normal=0]="Normal",fe[fe.OnlyTranslation=1]="OnlyTranslation",fe[fe.NoRotationOrReflection=2]="NoRotationOrReflection",fe[fe.NoScale=3]="NoScale",fe[fe.NoScaleOrReflection=4]="NoScaleOrReflection",fe),ve=class{constructor(t,e,s){if(this.data=void 0,this.skeleton=void 0,this.parent=null,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.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.inherit=0,this.sorted=!1,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,r,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=r,this.ashearY=a;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+r)*T.degRad,d=(s+90+a)*T.degRad;return this.a=Math.cos(c)*i*l,this.b=Math.cos(d)*n*l,this.c=Math.sin(c)*i*h,this.d=Math.sin(d)*n*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case 0:{const t=(s+r)*T.degRad,e=(s+90+a)*T.degRad,o=Math.cos(t)*i,u=Math.cos(e)*n,m=Math.sin(t)*i,f=Math.sin(e)*n;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case 1:{const t=(s+r)*T.degRad,e=(s+90+a)*T.degRad;this.a=Math.cos(t)*i,this.b=Math.cos(e)*n,this.c=Math.sin(t)*i,this.d=Math.sin(e)*n;break}case 2:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,c*=e;let o=l*l+c*c,u=0;o>1e-4?(o=Math.abs(l*d*e-h*t*c)/o,h=c*o,d=l*o,u=Math.atan2(c,l)*T.radDeg):(l=0,c=0,u=90-Math.atan2(d,h)*T.radDeg);const m=(s+r-u)*T.degRad,f=(s+a-u+90)*T.degRad,p=Math.cos(m)*i,g=Math.cos(f)*n,b=Math.sin(m)*i,w=Math.sin(f)*n;this.a=l*p-h*b,this.b=l*g-h*w,this.c=c*p+d*b,this.d=c*g+d*w;break}case 3:case 4:{s*=T.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),3==this.inherit&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,p=Math.sin(s)*m;r*=T.degRad,a=(90+a)*T.degRad;const g=Math.cos(r)*i,b=Math.cos(a)*n,w=Math.sin(r)*i,x=Math.sin(a)*n;this.a=o*g+f*w,this.b=o*b+f*x,this.c=u*g+p*w,this.d=u*b+p*x;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)*T.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)*T.radDeg);let e,s,i,n,r=t.a,a=t.b,o=t.c,l=t.d,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h,f=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=f*c-p*d,this.ay=p*m-f*u,1==this.inherit)e=this.a,s=this.b,i=this.c,n=this.d;else{switch(this.inherit){case 2:{let t=Math.abs(r*l-a*o)/(r*r+o*o);a=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=r*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(r*l-a*o),c=l*h,d=a*h;break}case 3:case 4:let t=T.cosDeg(this.rotation),e=T.sinDeg(this.rotation);r=(r*t+a*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(r*r+o*o);s>1e-5&&(s=1/s),r*=s,o*=s,s=Math.sqrt(r*r+o*o),3==this.inherit&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let i=T.PI/2+Math.atan2(o,r);a=Math.cos(i)*s,l=Math.sin(i)*s,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,i=m*this.c-u*this.a,n=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+i*i),this.ascaleX>1e-4){let t=e*n-s*i;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+i*n,t)*T.radDeg,this.arotation=Math.atan2(i,e)*T.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,s)*T.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*T.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*T.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=T.sinDeg(t),s=T.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*T.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=T.sinDeg(t),s=T.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*T.radDeg}rotateWorld(t){t*=T.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}},ke=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Se=class{constructor(){this.callbacks={},this.rawDataUris={}}dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let n=()=>{this.finish(t,i.status,i.responseText)};i.onload=n,i.onerror=n,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let n=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):n()},i.onerror=n,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=i.length;t<e;t+=2)i[t].apply(null,n)}},Ce=class{constructor(t,e){if(this.data=void 0,this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Ae=class{constructor(t){this.name=void 0,this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}},Ie=class{constructor(t,e){if(this.data=void 0,this.bones=void 0,this.target=void 0,this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,i,n,r,a){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*T.signum(t.skeleton.scaleX),f=(s-t.worldY)*T.signum(t.skeleton.scaleY);break;case 2:let i=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),n=l/t.skeleton.scaleX,r=c/t.skeleton.scaleY;h=-r*i*t.skeleton.scaleX,d=n*i*t.skeleton.scaleY,u+=Math.atan2(r,n)*T.radDeg;default:let a=e-o.worldX,p=s-o.worldY,g=l*d-h*c;Math.abs(g)<=1e-4?(m=0,f=0):(m=(a*d-p*h)/g-t.ax,f=(p*l-a*c)/g-t.ay)}u+=Math.atan2(f,m)*T.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=t.ascaleX,g=t.ascaleY;if(i||n){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=m*m+f*f;if(i&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*a+1;p*=e,r&&(g*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*a,p,g,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,r,a,o,l){if(0!=t.inherit||0!=e.inherit)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,p=e.ascaleX,g=0,b=0,w=0;d<0?(d=-d,g=180,w=-1):(g=0,w=1),u<0&&(u=-u,w=-w),p<0?(p=-p,b=180):b=0;let x=e.ax,y=0,v=0,k=0,S=t.a,C=t.b,A=t.c,I=t.d,M=Math.abs(d-u)<=1e-4;!M||r?(y=0,v=S*x+t.worldX,k=A*x+t.worldY):(y=e.ay,v=S*x+C*y+t.worldX,k=A*x+I*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,C=F.b,A=F.c,I=F.d;let Y=S*I-C*A,P=v-F.worldX,E=k-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let X,B,R=(P*I-E*C)*Y-h,D=(E*S-P*A)*Y-c,V=Math.sqrt(R*R+D*D),O=e.data.length*p;if(V<1e-4)return this.apply1(t,s,i,!1,r,!1,l),void e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);P=s-F.worldX,E=i-F.worldY;let _=(P*I-E*C)*Y-h,L=(E*S-P*A)*Y-c,N=_*_+L*L;if(0!=o){o*=d*(p+1)*.5;let t=Math.sqrt(N),e=t-V-O*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,_-=s*_,L-=s*L,N=_*_+L*L}}t:if(M){O*=d;let t=(N-V*V-O*O)/(2*V*O);t<-1?(t=-1,B=Math.PI*n):t>1?(t=1,B=0,r&&(S=(Math.sqrt(N)/(V+O)-1)*l+1,m*=S,a&&(f*=S))):B=Math.acos(t)*n,S=V+O*t,C=O*Math.sin(B),X=Math.atan2(L*S-_*C,_*S+L*C)}else{S=d*O,C=u*O;let t=S*S,e=C*C,s=Math.atan2(L,_);A=e*V*V+t*N-t*e;let i=-2*e*V,r=e-t;if(I=i*i-4*r*A,I>=0){let t=Math.sqrt(I);i<0&&(t=-t),t=.5*-(i+t);let e=t/r,a=A/t,o=Math.abs(e)<Math.abs(a)?e:a;if(e=N-o*o,e>=0){E=Math.sqrt(e)*n,X=s-Math.atan2(E,o),B=Math.atan2(E/u,(o-V)/d);break t}}let a=T.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,p=0;A=-S*V/(t-e),A>=-1&&A<=1&&(A=Math.acos(A),P=S*Math.cos(A)+V,E=C*Math.sin(A),I=P*P+E*E,I<l&&(a=A,l=I,o=P,h=E),I>f&&(c=A,f=I,m=P,p=E)),N<=.5*(l+f)?(X=s-Math.atan2(h*n,o),B=a*n):(X=s-Math.atan2(p*n,m),B=c*n)}let U=Math.atan2(y,x)*w,q=t.arotation;X=(X-U)*T.radDeg+g-q,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(h,c,q+X*l,m,f,0,0),q=e.arotation,B=((B+U)*T.radDeg-e.ashearX)*w+b-q,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(x,y,q+B*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Te=class extends ke{set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=0,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=0,this.softness=0}},Me=class extends ke{set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=Fe.Fixed,this.spacingMode=Ye.Fixed,this.rotateMode=Pe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}},Fe=((pe=Fe||{})[pe.Fixed=0]="Fixed",pe[pe.Percent=1]="Percent",pe),Ye=((ge=Ye||{})[ge.Length=0]="Length",ge[ge.Fixed=1]="Fixed",ge[ge.Percent=2]="Percent",ge[ge.Proportional=3]="Proportional",ge),Pe=((be=Pe||{})[be.Tangent=0]="Tangent",be[be.Chain=1]="Chain",be[be.ChainScale=2]="ChainScale",be),Ee=class{constructor(t,e){if(this.data=void 0,this.bones=void 0,this.target=void 0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=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,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof ce))return;let s=this.mixRotate,i=this.mixX,n=this.mixY;if(0==s&&0==i&&0==n)return;let r=this.data,a=0==r.rotateMode,o=2==r.rotateMode,l=this.bones,h=l.length,c=a?h:h+1,d=P.setArraySize(this.spaces,c),u=o?this.lengths=P.setArraySize(this.lengths,h):[],m=this.spacing;switch(r.spacingMode){case 2:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,i=s*e.a,n=s*e.c;u[t]=Math.sqrt(i*i+n*n)}P.arrayFill(d,1,c,m);break;case 3:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],i=s.data.length;if(i<Ee.epsilon)o&&(u[e]=0),d[++e]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[e]=a),d[++e]=a,t+=a}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=0==r.spacingMode;for(let t=0,s=c-1;t<s;){let s=l[t],i=s.data.length;if(i<Ee.epsilon)o&&(u[t]=0),d[++t]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[t]=a),d[++t]=(e?i+m:m)*a/i}}}let f=this.computeWorldPositions(e,c,a),p=f[0],g=f[1],b=r.offsetRotation,w=!1;if(0==b)w=1==r.rotateMode;else{w=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?T.degRad:-T.degRad}for(let t=0,e=3;t<h;t++,e+=3){let r=l[t];r.worldX+=(p-r.worldX)*i,r.worldY+=(g-r.worldY)*n;let h=f[e],c=f[e+1],m=h-p,x=c-g;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+x*x)/e-1)*s+1;r.a*=t,r.c*=t}}if(p=h,g=c,s>0){let i=r.a,n=r.b,o=r.c,l=r.d,h=0,c=0,u=0;if(h=a?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(x,m),h-=Math.atan2(o,i),w){c=Math.cos(h),u=Math.sin(h);let t=r.data.length;p+=(t*(c*i-u*o)-m)*s,g+=(t*(u*i+c*o)-x)*s}else h+=b;h>T.PI?h-=T.PI2:h<-T.PI&&(h+=T.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),r.a=c*i-u*o,r.b=c*n-u*l,r.c=u*i+c*o,r.d=u*n+c*l}r.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,n=this.position,r=this.spaces,a=P.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=Ee.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:m=f;break;case 3:m=f/e;break;default:m=1}o=P.setArraySize(this.world,8);for(let p=0,g=0,b=0;p<e;p++,g+=3){let e=r[p]*m;n+=e;let w=n;if(l)w%=f,w<0&&(w+=f),b=0;else{if(w<0){d!=Ee.BEFORE&&(d=Ee.BEFORE,t.computeWorldVertices(i,2,4,o,0,2)),this.addBeforePosition(w,o,0,a,g);continue}if(w>f){d!=Ee.AFTER&&(d=Ee.AFTER,t.computeWorldVertices(i,h-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,a,g);continue}}for(;;b++){let t=u[b];if(!(w>t)){if(0==b)w/=t;else{let e=u[b-1];w=(w-e)/(t-e)}break}}b!=d&&(d=b,l&&b==c?(t.computeWorldVertices(i,h-4,4,o,0,2),t.computeWorldVertices(i,0,4,o,4,2)):t.computeWorldVertices(i,6*b+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||p>0&&0==e)}return a}l?(h+=2,o=P.setArraySize(this.world,h),t.computeWorldVertices(i,2,h-4,o,0,2),t.computeWorldVertices(i,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=P.setArraySize(this.world,h),t.computeWorldVertices(i,2,h,o,0,2));let u,m=P.setArraySize(this.curves,c),f=0,p=o[0],g=o[1],b=0,w=0,x=0,y=0,v=0,k=0,S=0,C=0,A=0,I=0,T=0,M=0,F=0,Y=0;for(let t=0,e=2;t<c;t++,e+=6)b=o[e],w=o[e+1],x=o[e+2],y=o[e+3],v=o[e+4],k=o[e+5],S=.1875*(p-2*b+x),C=.1875*(g-2*w+y),A=.09375*(3*(b-x)-p+v),I=.09375*(3*(w-y)-g+k),T=2*S+A,M=2*C+I,F=.75*(b-p)+S+.16666667*A,Y=.75*(w-g)+C+.16666667*I,f+=Math.sqrt(F*F+Y*Y),F+=T,Y+=M,T+=A,M+=I,f+=Math.sqrt(F*F+Y*Y),F+=T,Y+=M,f+=Math.sqrt(F*F+Y*Y),F+=T+A,Y+=M+I,f+=Math.sqrt(F*F+Y*Y),m[t]=f,p=v,g=k;switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:u=f;break;case 3:u=f/e;break;default:u=1}let E=this.segments,X=0;for(let t=0,i=0,c=0,P=0;t<e;t++,i+=3){let e=r[t]*u;n+=e;let B=n;if(l)B%=f,B<0&&(B+=f),c=0;else{if(B<0){this.addBeforePosition(B,o,0,a,i);continue}if(B>f){this.addAfterPosition(B-f,o,h-4,a,i);continue}}for(;;c++){let t=m[c];if(!(B>t)){if(0==c)B/=t;else{let e=m[c-1];B=(B-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],g=o[t+1],b=o[t+2],w=o[t+3],x=o[t+4],y=o[t+5],v=o[t+6],k=o[t+7],S=.03*(p-2*b+x),C=.03*(g-2*w+y),A=.006*(3*(b-x)-p+v),I=.006*(3*(w-y)-g+k),T=2*S+A,M=2*C+I,F=.3*(b-p)+S+.16666667*A,Y=.3*(w-g)+C+.16666667*I,X=Math.sqrt(F*F+Y*Y),E[0]=X,t=1;t<8;t++)F+=T,Y+=M,T+=A,M+=I,X+=Math.sqrt(F*F+Y*Y),E[t]=X;F+=T,Y+=M,X+=Math.sqrt(F*F+Y*Y),E[8]=X,F+=T+A,Y+=M+I,X+=Math.sqrt(F*F+Y*Y),E[9]=X,P=0}for(B*=X;;P++){let t=E[P];if(!(B>t)){if(0==P)B/=t;else{let e=E[P-1];B=P+(B-e)/(t-e)}break}}this.addCurvePosition(.1*B,p,g,b,w,x,y,v,k,a,i,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,i,n){let r=e[s],a=e[s+1],o=e[s+2]-r,l=e[s+3]-a,h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addAfterPosition(t,e,s,i,n){let r=e[s+2],a=e[s+3],o=r-e[s],l=a-e[s+1],h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addCurvePosition(t,e,s,i,n,r,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(n-s,i-e));let u=t*t,m=u*t,f=1-t,p=f*f,g=p*f,b=f*t,w=3*b,x=f*w,y=w*t,v=e*g+i*x+r*y+o*m,k=s*g+n*x+a*y+l*m;h[c]=v,h[c+1]=k,d&&(h[c+2]=t<.001?Math.atan2(n-s,i-e):Math.atan2(k-(s*p+n*b*2+a*u),v-(e*p+i*b*2+r*u)))}},Xe=Ee;k(Xe,"NONE",-1),k(Xe,"BEFORE",-2),k(Xe,"AFTER",-3),k(Xe,"epsilon",1e-5);var Be=class{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}constructor(t,e){this.data=void 0,this._bone=null,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this._reset=!0,this.ux=0,this.uy=0,this.cx=0,this.cy=0,this.tx=0,this.ty=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,this.active=!1,this.skeleton=void 0,this.remaining=0,this.lastTime=0,this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,i=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,r=this.data.scaleX>0,a=this.bone,o=a.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=a.worldX,c=a.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,p=-1,g=this.data.limit*l,b=g*Math.abs(t.scaleY);if(g*=Math.abs(t.scaleX),s||i){if(s){const t=(this.ux-h)*u;this.xOffset+=t>g?g:t<-g?-g:t,this.ux=h}if(i){const t=(this.uy-c)*u;this.yOffset+=t>b?b:t<-b?-b:t,this.uy=c}if(d>=m){p=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,n=this.wind*f,r=(Oe.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(n-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=p),i&&(this.yVelocity-=(r+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=p),d-=m}while(d>=m)}s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||r){let t=Math.atan2(a.c,a.a),s=0,i=0,l=0,h=this.cx-a.worldX,c=this.cy-a.worldY;if(h>g?h=g:h<-g&&(h=-g),c>b?c=b:c<-b&&(c=-b),n){l=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(c+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(n-Math.ceil(n*T.invPI2-.5)*T.PI2)*u,n=this.rotateOffset*l+t,s=Math.cos(n),i=Math.sin(n),r&&(n=o*a.getWorldScaleX(),n>0&&(this.scaleOffset+=(h*s+c*i)*u/n))}else{s=Math.cos(t),i=Math.sin(t);const e=o*a.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+c*i)*u/e)}if(d=this.remaining,d>=m){-1==p&&(p=Math.pow(this.damping,60*m));const e=this.massInverse*m,a=this.strength,h=this.wind,c=Oe.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(d-=m,r&&(this.scaleVelocity+=(h*s-c*i-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=p),n){if(this.rotateVelocity-=((h*i+c*s)*u+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=p,d<m)break;const n=this.rotateOffset*l+t;s=Math.cos(n),i=Math.sin(n)}else if(d<m)break}}this.remaining=d}this.cx=a.worldX,this.cy=a.worldY;break;case 3:s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,i=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),i=Math.cos(e),n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d),e+=t*this.data.shearX,s=Math.sin(e),i=Math.cos(e),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c}else t*=this.data.rotate,s=Math.sin(t),i=Math.cos(t),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c,n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d}if(r){const t=1+this.scaleOffset*e*this.data.scaleX;a.a*=t,a.c*=t}3!=t&&(this.tx=o*a.a,this.ty=o*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*T.degRad,n=Math.cos(i),r=Math.sin(i),a=this.cx-t,o=this.cy-e;this.translate(a*n-o*r-a,a*r+o*n-o)}},Re=class{constructor(t,e){if(this.data=void 0,this.bone=void 0,this.color=void 0,this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!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 A,this.darkColor=t.darkColor?new A:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof D&&this.attachment instanceof D&&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}},De=class{constructor(t,e){if(this.data=void 0,this.bones=void 0,this.target=void 0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new X,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?T.degRad:-T.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,i=g.c,n=g.d,r=Math.atan2(c,l)-Math.atan2(i,e)+m;r>T.PI?r-=T.PI2:r<-T.PI&&(r+=T.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);g.a=a*e-o*i,g.b=a*s-o*n,g.c=o*e+a*i,g.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(t.x-g.worldX)*e,g.worldY+=(t.y-g.worldY)*s}if(0!=i){let t=Math.sqrt(g.a*g.a+g.c*g.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*i)/t),g.a*=t,g.c*=t}if(0!=n){let t=Math.sqrt(g.b*g.b+g.d*g.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*n)/t),g.b*=t,g.d*=t}if(r>0){let t=g.b,e=g.d,s=Math.atan2(e,t),i=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(g.c,g.a));i>T.PI?i-=T.PI2:i<-T.PI&&(i+=T.PI2),i=s+(i+f)*r;let n=Math.sqrt(t*t+e*e);g.b=Math.cos(i)*n,g.d=Math.sin(i)*n}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?T.degRad:-T.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,i=g.c,n=g.d,r=Math.atan2(c,l)+m;r>T.PI?r-=T.PI2:r<-T.PI&&(r+=T.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);g.a=a*e-o*i,g.b=a*s-o*n,g.c=o*e+a*i,g.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=t.x*e,g.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=t,g.c*=t}if(0!=n){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*n+1;g.b*=t,g.d*=t}if(r>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>T.PI?t-=T.PI2:t<-T.PI&&(t+=T.PI2);let e=g.b,s=g.d;t=Math.atan2(s,e)+(t-T.PI/2+f)*r;let i=Math.sqrt(e*e+s*s);g.b=Math.cos(t)*i,g.d=Math.sin(t)*i}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=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 m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=n&&0!=f&&(f=(f+(a.ascaleY-f+this.data.offsetScaleY)*n)/f);let p=h.ashearY;0!=r&&(p+=(a.ashearY-p+this.data.offsetShearY)*r),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=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,m=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),p=h.ashearY+(a.ashearY+this.data.offsetShearY)*r;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}},Ve=class{get scaleY(){return Ve.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}constructor(t){if(this.data=void 0,this.bones=void 0,this.slots=void 0,this.drawOrder=void 0,this.ikConstraints=void 0,this.transformConstraints=void 0,this.pathConstraints=void 0,this.physicsConstraints=void 0,this._updateCache=new Array,this.skin=null,this.color=void 0,this.scaleX=1,this._scaleY=1,this.x=0,this.y=0,this.time=0,!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new ve(i,this,t),t.children.push(s)}else s=new ve(i,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],n=new Re(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Ie(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new De(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Xe(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Be(s,this))}this.color=new A(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=this.physicsConstraints,r=e.length,a=s.length,o=i.length,l=this.physicsConstraints.length,h=r+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<r;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<a;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[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&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let n=e.getAttachment();n instanceof ce&&this.sortPathConstraintAttachmentWith(n,i);let r=t.bones,a=r.length;for(let t=0;t<a;t++)this.sortBone(r[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(r[t].children);for(let t=0;t<a;t++)r[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof ce))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&P.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let n=e.a,r=e.b,a=e.c,o=e.d;i.worldX=n*this.x+r*this.y+e.worldX,i.worldY=a*this.x+o*this.y+e.worldY;const l=(i.rotation+i.shearX)*T.degRad,h=(i.rotation+90+i.shearY)*T.degRad,c=Math.cos(l)*i.scaleX,d=Math.cos(h)*i.scaleY,u=Math.sin(l)*i.scaleX,m=Math.sin(h)*i.scaleY;i.a=(n*c+r*u)*this.scaleX,i.b=(n*d+r*m)*this.scaleX,i.c=(a*c+o*u)*this.scaleY,i.d=(a*d+o*m)*this.scaleY;let f=this._updateCache;for(let e=0,s=f.length;e<s;e++){let s=f[e];s!=i&&s.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;P.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s],n=i.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&i.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,n=s.length;i<n;i++){let n=s[i];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.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 X,e=new X;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof me)h=8,c=P.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Ve.quadTriangles;else if(u instanceof he){let t=u;h=t.worldVerticesLength,c=P.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof te&&null!=i){i.clipStart(e,u);continue}if(c&&d){null!=i&&i.isClipping()&&(i.clipTriangles(c,d,d.length),c=i.clippedVertices,h=i.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];r=Math.min(r,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(r,a),e.set(o-r,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,r=i.length;n<r;n++)i[n].rotate(t,e,s)}},Oe=Ve;k(Oe,"quadTriangles",[0,1,2,2,3,0]),k(Oe,"yDown",!1);var _e,Le,Ne,Ue=((_e=Ue||{})[_e.none=0]="none",_e[_e.reset=1]="reset",_e[_e.update=2]="update",_e[_e.pose=3]="pose",_e),qe=class extends ke{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}constructor(t){super(t,0,!1),this._bone=null,this.x=0,this.y=0,this.rotate=0,this.scaleX=0,this.shearX=0,this.limit=0,this.step=0,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this.inertiaGlobal=!1,this.strengthGlobal=!1,this.dampingGlobal=!1,this.massGlobal=!1,this.windGlobal=!1,this.gravityGlobal=!1,this.mixGlobal=!1}},We=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.physicsConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.referenceScale=100,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}},ze=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},je=class{constructor(t){if(this.name=void 0,this.attachments=new Array,this.bones=Array(),this.constraints=new Array,this.color=new A(.99607843,.61960787,.30980393,1),!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof he?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new ze(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new ze(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],r=n.getAttachment();if(r&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(r==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}},Ge=class{constructor(t,e,s){if(this.index=0,this.name=void 0,this.boneData=void 0,this.color=new A(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=$e.Normal,this.visible=!0,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}},$e=((Le=$e||{})[Le.Normal=0]="Normal",Le[Le.Additive=1]="Additive",Le[Le.Multiply=2]="Multiply",Le[Le.Screen=3]="Screen",Le),He=class extends ke{set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Ke=class{constructor(t){this.scale=1,this.attachmentLoader=void 0,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new We;s.name="";let i=new Je(t),n=i.readInt32(),r=i.readInt32();s.hash=0==r&&0==n?null:r.toString(16)+n.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let o=0;o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("String in string table must not be null.");i.strings.push(t)}o=i.readInt(!0);for(let t=0;t<o;t++){let n=i.readString();if(!n)throw new Error("Bone name must not be null.");let r=0==t?null:s.bones[i.readInt(!0)],o=new xe(t,n,r);o.rotation=i.readFloat(),o.x=i.readFloat()*e,o.y=i.readFloat()*e,o.scaleX=i.readFloat(),o.scaleY=i.readFloat(),o.shearX=i.readFloat(),o.shearY=i.readFloat(),o.length=i.readFloat()*e,o.inherit=i.readByte(),o.skinRequired=i.readBoolean(),a&&(A.rgba8888ToColor(o.color,i.readInt32()),o.icon=i.readString()??void 0,o.visible=i.readBoolean()),s.bones.push(o)}o=i.readInt(!0);for(let t=0;t<o;t++){let e=i.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[i.readInt(!0)],r=new Ge(t,e,n);A.rgba8888ToColor(r.color,i.readInt32());let o=i.readInt32();-1!=o&&A.rgb888ToColor(r.darkColor=new A,o),r.attachmentName=i.readStringRef(),r.blendMode=i.readInt(!0),a&&(r.visible=i.readBoolean()),s.slots.push(r)}o=i.readInt(!0);for(let t,n=0;n<o;n++){let n=i.readString();if(!n)throw new Error("IK constraint data name must not be null.");let r=new Te(n);r.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[i.readInt(!0)]);r.target=s.bones[i.readInt(!0)];let a=i.readByte();r.skinRequired=!!(1&a),r.bendDirection=2&a?1:-1,r.compress=!!(4&a),r.stretch=!!(8&a),r.uniform=!!(16&a),32&a&&(r.mix=64&a?i.readFloat():1),128&a&&(r.softness=i.readFloat()*e),s.ikConstraints.push(r)}o=i.readInt(!0);for(let t,n=0;n<o;n++){let n=i.readString();if(!n)throw new Error("Transform constraint data name must not be null.");let r=new He(n);r.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[i.readInt(!0)]);r.target=s.bones[i.readInt(!0)];let a=i.readByte();r.skinRequired=!!(1&a),r.local=!!(2&a),r.relative=!!(4&a),8&a&&(r.offsetRotation=i.readFloat()),16&a&&(r.offsetX=i.readFloat()*e),32&a&&(r.offsetY=i.readFloat()*e),64&a&&(r.offsetScaleX=i.readFloat()),128&a&&(r.offsetScaleY=i.readFloat()),a=i.readByte(),1&a&&(r.offsetShearY=i.readFloat()),2&a&&(r.mixRotate=i.readFloat()),4&a&&(r.mixX=i.readFloat()),8&a&&(r.mixY=i.readFloat()),16&a&&(r.mixScaleX=i.readFloat()),32&a&&(r.mixScaleY=i.readFloat()),64&a&&(r.mixShearY=i.readFloat()),s.transformConstraints.push(r)}o=i.readInt(!0);for(let t,n=0;n<o;n++){let n=i.readString();if(!n)throw new Error("Path constraint data name must not be null.");let r=new Me(n);r.order=i.readInt(!0),r.skinRequired=i.readBoolean(),t=i.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[i.readInt(!0)]);r.target=s.slots[i.readInt(!0)];const a=i.readByte();r.positionMode=1&a,r.spacingMode=a>>1&3,r.rotateMode=a>>3&3,128&a&&(r.offsetRotation=i.readFloat()),r.position=i.readFloat(),0==r.positionMode&&(r.position*=e),r.spacing=i.readFloat(),0!=r.spacingMode&&1!=r.spacingMode||(r.spacing*=e),r.mixRotate=i.readFloat(),r.mixX=i.readFloat(),r.mixY=i.readFloat(),s.pathConstraints.push(r)}o=i.readInt(!0);for(let t=0;t<o;t++){const t=i.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const n=new qe(t);n.order=i.readInt(!0),n.bone=s.bones[i.readInt(!0)];let r=i.readByte();n.skinRequired=!!(1&r),2&r&&(n.x=i.readFloat()),4&r&&(n.y=i.readFloat()),8&r&&(n.rotate=i.readFloat()),16&r&&(n.scaleX=i.readFloat()),32&r&&(n.shearX=i.readFloat()),n.limit=(64&r?i.readFloat():5e3)*e,n.step=1/i.readUnsignedByte(),n.inertia=i.readFloat(),n.strength=i.readFloat(),n.damping=i.readFloat(),n.massInverse=128&r?i.readFloat():1,n.wind=i.readFloat(),n.gravity=i.readFloat(),r=i.readByte(),1&r&&(n.inertiaGlobal=!0),2&r&&(n.strengthGlobal=!0),4&r&&(n.dampingGlobal=!0),8&r&&(n.massGlobal=!0),16&r&&(n.windGlobal=!0),32&r&&(n.gravityGlobal=!0),64&r&&(n.mixGlobal=!0),n.mix=128&r?i.readFloat():1,s.physicsConstraints.push(n)}let l=this.readSkin(i,s,!0,a);l&&(s.defaultSkin=l,s.skins.push(l));{let t=s.skins.length;for(P.setArraySize(s.skins,o=t+i.readInt(!0));t<o;t++){let e=this.readSkin(i,s,!1,a);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}o=this.linkedMeshes.length;for(let t=0;t<o;t++){let e=this.linkedMeshes[t];const i=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=i.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ae(t);e.intValue=i.readInt(!1),e.floatValue=i.readFloat(),e.stringValue=i.readString(),e.audioPath=i.readString(),e.audioPath&&(e.volume=i.readFloat(),e.balance=i.readFloat()),s.events.push(e)}o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,t,s))}return s}readSkin(t,e,s,i){let n=null,r=0;if(s){if(r=t.readInt(!0),0==r)return null;n=new je("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new je(s),i&&A.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,i=n.bones.length;s<i;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,r,i);a&&n.setAttachment(s,r,a)}}return n}readAttachment(t,e,s,i,n,r){let a=this.scale,o=t.readByte();const l=8&o?t.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case ts.Region:{let e=16&o?t.readStringRef():null;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null;let r=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=l);let p=this.attachmentLoader.newRegionAttachment(s,l,e,n);return p?(p.path=e,p.x=h*a,p.y=c*a,p.scaleX=d,p.scaleY=u,p.rotation=r,p.width=m*a,p.height=f*a,A.rgba8888ToColor(p.color,i),p.sequence=n,null==n&&p.updateRegion(),p):null}case ts.BoundingBox:{let e=this.readVertices(t,!!(16&o)),i=r?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,l);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,r&&A.rgba8888ToColor(n.color,i),n):null}case ts.Mesh:{let e=16&o?t.readStringRef():l;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let m=[],f=0,p=0;r&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),p=t.readFloat()),e||(e=l);let g=this.attachmentLoader.newMeshAttachment(s,l,e,n);return g?(g.path=e,A.rgba8888ToColor(g.color,i),g.bones=c.bones,g.vertices=c.vertices,g.worldVerticesLength=c.length,g.triangles=u,g.regionUVs=d,null==n&&g.updateRegion(),g.hullLength=h<<1,g.sequence=n,r&&(g.edges=m,g.width=f*a,g.height=p*a),g):null}case ts.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let m=0,f=0;r&&(m=t.readFloat(),f=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,e,h);return p?(p.path=e,A.rgba8888ToColor(p.color,n),p.sequence=h,r&&(p.width=m*a,p.height=f*a),this.linkedMeshes.push(new Qe(p,d,i,u,c)),p):null}case ts.Path:{const e=!!(16&o),i=!!(32&o),n=this.readVertices(t,!!(64&o)),h=P.newArray(n.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*a;const c=r?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=i,d.worldVerticesLength=n.length,d.vertices=n.vertices,d.bones=n.bones,d.lengths=h,r&&A.rgba8888ToColor(d.color,c),d):null}case ts.Point:{const e=t.readFloat(),i=t.readFloat(),n=t.readFloat(),o=r?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=i*a,h.y=n*a,h.rotation=e,r&&A.rgba8888ToColor(h.color,o),h):null}case ts.Clipping:{const i=t.readInt(!0),n=this.readVertices(t,!!(16&o));let a=r?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[i],h.worldVerticesLength=n.length,h.vertices=n.vertices,h.bones=n.bones,r&&A.rgba8888ToColor(h.color,a),h):null}}return null}readSequence(t){let e=new O(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new Ze;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let r=new Array,a=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);a.push(e);for(let i=0;i<e;i++)a.push(t.readInt(!0)),r.push(t.readFloat()*s),r.push(t.readFloat()*s),r.push(t.readFloat())}return n.vertices=P.toFloatArray(r),n.bones=a,n}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,n=this.scale;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),r=n-1;switch(s){case gs:{let s=new ft(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());i.push(s);break}case bs:{let s=t.readInt(!0),a=new ht(n,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!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:a.setStepped(e);break;case Ds:is(t,a,s++,e,0,o,i,l,n,1),is(t,a,s++,e,1,o,i,h,r,1),is(t,a,s++,e,2,o,i,c,u,1),is(t,a,s++,e,3,o,i,d,m,1)}o=i,l=n,h=r,c=u,d=m}i.push(a);break}case ws:{let s=t.readInt(!0),a=new ct(n,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!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:a.setStepped(e);break;case Ds:is(t,a,s++,e,0,o,i,l,n,1),is(t,a,s++,e,1,o,i,h,r,1),is(t,a,s++,e,2,o,i,c,d,1)}o=i,l=n,h=r,c=d}i.push(a);break}case xs:{let s=t.readInt(!0),a=new ut(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m,f),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:a.setStepped(e);break;case Ds:is(t,a,s++,e,0,o,i,l,n,1),is(t,a,s++,e,1,o,i,h,r,1),is(t,a,s++,e,2,o,i,c,p,1),is(t,a,s++,e,3,o,i,d,g,1),is(t,a,s++,e,4,o,i,u,b,1),is(t,a,s++,e,5,o,i,m,w,1),is(t,a,s++,e,6,o,i,f,x,1)}o=i,l=n,h=r,c=p,d=g,u=b,m=w,f=x}i.push(a);break}case ys:{let s=t.readInt(!0),a=new mt(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:a.setStepped(e);break;case Ds:is(t,a,s++,e,0,o,i,l,n,1),is(t,a,s++,e,1,o,i,h,r,1),is(t,a,s++,e,2,o,i,c,f,1),is(t,a,s++,e,3,o,i,d,p,1),is(t,a,s++,e,4,o,i,u,g,1),is(t,a,s++,e,5,o,i,m,b,1)}o=i,l=n,h=r,c=f,d=p,u=g,m=b}i.push(a);break}case vs:{let s=new dt(n,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,i=0;s.setFrame(e,a,o),e!=r;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:s.setStepped(e);break;case Ds:is(t,s,i++,e,0,a,n,o,r,1)}a=n,o=r}i.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readByte(),r=t.readInt(!0);if(s==ps){let s=new lt(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat(),t.readByte());i.push(s);continue}let a=t.readInt(!0);switch(s){case rs:i.push(es(t,new Q(r,a,e),1));break;case as:i.push(ss(t,new Z(r,a,e),n));break;case os:i.push(es(t,new tt(r,a,e),n));break;case ls:i.push(es(t,new et(r,a,e),n));break;case hs:i.push(ss(t,new st(r,a,e),1));break;case cs:i.push(es(t,new it(r,a,e),1));break;case ds:i.push(es(t,new nt(r,a,e),1));break;case us:i.push(ss(t,new rt(r,a,e),1));break;case ms:i.push(es(t,new at(r,a,e),1));break;case fs:i.push(es(t,new ot(r,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),r=s-1,a=new yt(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()*n:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=r;e++){o=t.readByte();const i=t.readFloat(),r=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?a.setStepped(e):128&o&&(is(t,a,s++,e,0,l,i,h,r,1),is(t,a,s++,e,1,l,i,c,d,n)),l=i,h=r,c=d}i.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new vt(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;r.setFrame(e,a,o,l,h,c,d,u),e!=n;e++){let i=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),p=t.readFloat(),g=t.readFloat(),b=t.readFloat();switch(t.readByte()){case Rs:r.setStepped(e);break;case Ds:is(t,r,s++,e,0,a,i,o,n,1),is(t,r,s++,e,1,a,i,l,m,1),is(t,r,s++,e,2,a,i,h,f,1),is(t,r,s++,e,3,a,i,c,p,1),is(t,r,s++,e,4,a,i,d,g,1),is(t,r,s++,e,5,a,i,u,b,1)}a=i,o=n,l=m,h=f,c=p,d=g,u=b}i.push(r)}for(let e=0,r=t.readInt(!0);e<r;e++){let e=t.readInt(!0),r=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 Cs:i.push(es(t,new kt(a,o,e),0==r.positionMode?n:1));break;case As:i.push(es(t,new St(a,o,e),0==r.spacingMode||1==r.spacingMode?n:1));break;case Is:let s=new Ct(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,i=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),r=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Rs:s.setStepped(e);break;case Ds:is(t,s,i++,e,0,l,n,h,r,1),is(t,s,i++,e,1,l,n,c,a,1),is(t,s,i++,e,2,l,n,d,o,1)}l=n,h=r,c=a,d=o}i.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==Bs){const s=new Bt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());i.push(s);continue}const r=t.readInt(!0);switch(s){case Ts:i.push(es(t,new It(n,r,e),1));break;case Ms:i.push(es(t,new Tt(n,r,e),1));break;case Fs:i.push(es(t,new Mt(n,r,e),1));break;case Ys:i.push(es(t,new Ft(n,r,e),1));break;case Ps:i.push(es(t,new Yt(n,r,e),1));break;case Es:i.push(es(t,new Pt(n,r,e),1));break;case Xs:i.push(es(t,new Et(n,r,e),1))}}}for(let e=0,r=t.readInt(!0);e<r;e++){let e=s.skins[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,r),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case ks:{let e=a,r=e.bones,o=e.vertices,c=r?o.length/3*2:o.length,d=t.readInt(!0),u=new pt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let i,a=t.readInt(!0);if(0==a)i=r?P.newFloatArray(c):o;else{i=P.newFloatArray(c);let e=t.readInt(!0);if(a+=e,1==n)for(let s=e;s<a;s++)i[s]=t.readFloat();else for(let s=e;s<a;s++)i[s]=t.readFloat()*n;if(!r)for(let t=0,e=i.length;t<e;t++)i[t]+=o[t]}if(u.setFrame(e,m,i),e==h)break;let l=t.readFloat();switch(t.readByte()){case Rs:u.setStepped(e);break;case Ds:is(t,u,s++,e,0,m,l,0,1,1)}m=l}i.push(u);break}case Ss:{let e=new Dt(l,s,a);for(let s=0;s<l;s++){let i=t.readFloat(),n=t.readInt32();e.setFrame(s,i,q[15&n],n>>4,t.readFloat())}i.push(e);break}}}}}let r=t.readInt(!0);if(r>0){let e=new xt(r),n=s.slots.length;for(let s=0;s<r;s++){let i=t.readFloat(),r=t.readInt(!0),a=P.newArray(n,0);for(let t=n-1;t>=0;t--)a[t]=-1;let o=P.newArray(n-r,0),l=0,h=0;for(let e=0;e<r;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;a[l+t.readInt(!0)]=l++}for(;l<n;)o[h++]=l++;for(let t=n-1;t>=0;t--)-1==a[t]&&(a[t]=o[--h]);e.setFrame(s,i,a)}i.push(e)}let a=t.readInt(!0);if(a>0){let e=new bt(a);for(let i=0;i<a;i++){let n=t.readFloat(),r=s.events[t.readInt(!0)],a=new Ce(n,r);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=r.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(i,a)}i.push(e)}let o=0;for(let t=0,e=i.length;t<e;t++)o=Math.max(o,i[t].getDuration());return new W(e,i,o)}},Je=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}},Qe=class{constructor(t,e,s,i,n){this.parent=void 0,this.skinIndex=void 0,this.slotIndex=void 0,this.mesh=void 0,this.inheritTimeline=void 0,this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}},Ze=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},ts=((Ne=ts||{})[Ne.Region=0]="Region",Ne[Ne.BoundingBox=1]="BoundingBox",Ne[Ne.Mesh=2]="Mesh",Ne[Ne.LinkedMesh=3]="LinkedMesh",Ne[Ne.Path=4]="Path",Ne[Ne.Point=5]="Point",Ne[Ne.Clipping=6]="Clipping",Ne);function es(t,e,s){let i=t.readFloat(),n=t.readFloat()*s;for(let r=0,a=0,o=e.getFrameCount()-1;e.setFrame(r,i,n),r!=o;r++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Rs:e.setStepped(r);break;case Ds:is(t,e,a++,r,0,i,o,n,l,s)}i=o,n=l}return e}function ss(t,e,s){let i=t.readFloat(),n=t.readFloat()*s,r=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,i,n,r),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Rs:e.setStepped(a);break;case Ds:is(t,e,o++,a,0,i,l,n,h,s),is(t,e,o++,a,1,i,l,r,c,s)}i=l,n=h,r=c}return e}function is(t,e,s,i,n,r,a,o,l,h){e.setBezier(s,i,n,r,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}var ns,rs=0,as=1,os=2,ls=3,hs=4,cs=5,ds=6,us=7,ms=8,fs=9,ps=10,gs=0,bs=1,ws=2,xs=3,ys=4,vs=5,ks=0,Ss=1,Cs=0,As=1,Is=2,Ts=0,Ms=1,Fs=2,Ys=4,Ps=5,Es=6,Xs=7,Bs=8,Rs=1,Ds=2,Vs=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new E((()=>P.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=t.slots,a=r.length;s.length=0,n.freeAll(i),i.length=0;for(let t=0;t<a;t++){let e=r[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof Zt){let t=a;s.push(t);let r=n.obtain();r.length!=t.worldVerticesLength&&(r=P.newFloatArray(t.worldVerticesLength)),i.push(r),t.computeWorldVertices(e,0,t.worldVerticesLength,r,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let r=0,a=n.length;r<a;r++){let a=n[r],o=a;for(let n=0,r=a.length;n<r;n+=2){let r=o[n],a=o[n+1];t=Math.min(t,r),e=Math.min(e,a),s=Math.max(s,r),i=Math.max(i,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,r=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=r&&i<=r||t>=a&&s>=a||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(n-t)+e;if(h>r&&h<o)return!0;if(h=l*(a-t)+e,h>r&&h<o)return!0;let c=(r-e)/l+t;return c>n&&c<a||(c=(o-e)/l+t,c>n&&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 i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,r=n-2,a=!1;for(let t=0;t<n;t+=2){let n=i[t+1],o=i[r+1];if(n<s&&o>=s||o<s&&n>=s){let l=i[t];l+(s-n)/(o-n)*(i[r]-l)<e&&(a=!a)}r=t}return a}intersectsSegment(t,e,s,i){let n=this.polygons;for(let r=0,a=n.length;r<a;r++)if(this.intersectsSegmentPolygon(n[r],t,e,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,i,n){let r=t,a=t.length,o=e-i,l=s-n,h=e*n-s*i,c=r[a-2],d=r[a-1];for(let t=0;t<a;t+=2){let a=r[t],u=r[t+1],m=c*u-d*a,f=c-a,p=d-u,g=o*p-l*f,b=(h*f-o*m)/g;if((b>=c&&b<=a||b>=a&&b<=c)&&(b>=e&&b<=i||b>=i&&b<=e)){let t=(h*p-l*m)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&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}},Os=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new E((()=>new Array)),this.polygonIndicesPool=new E((()=>new Array))}triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,r=s;t<r;++t)n[t]=Os.isConcave(t,s,e,i);let r=this.triangles;for(r.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!n[a]){let r=i[t]<<1,l=i[a]<<1,h=i[o]<<1,c=e[r],d=e[r+1],u=e[l],m=e[l+1],f=e[h],p=e[h+1];for(let r=(o+1)%s;r!=t;r=(r+1)%s){if(!n[r])continue;let t=i[r]<<1,s=e[t],a=e[t+1];if(Os.positiveArea(f,p,c,d,s,a)&&Os.positiveArea(c,d,u,m,s,a)&&Os.positiveArea(u,m,f,p,s,a))break t}break}if(0==o){do{if(!n[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}r.push(i[(s+a-1)%s]),r.push(i[a]),r.push(i[(a+1)%s]),i.splice(a,1),n.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;n[l]=Os.isConcave(l,s,e,i),n[h]=Os.isConcave(h,s,e,i)}return 3==s&&(r.push(i[2]),r.push(i[0]),r.push(i[1])),r}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let r=this.polygonIndicesPool.obtain();r.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],m=s[h+1],f=s[c],p=s[c+1],g=s[d],b=s[d+1],w=!1;if(o==h){let t=a.length-4,e=Os.winding(a[t],a[t+1],a[t+2],a[t+3],g,b),s=Os.winding(g,b,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(g),a.push(b),r.push(d),w=!0)}w||(a.length>0?(i.push(a),n.push(r)):(this.polygonPool.free(a),this.polygonIndicesPool.free(r)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(m),a.push(f),a.push(p),a.push(g),a.push(b),r=this.polygonIndicesPool.obtain(),r.length=0,r.push(h),r.push(c),r.push(d),l=Os.winding(u,m,f,p,g,b),o=h)}a.length>0&&(i.push(a),n.push(r));for(let t=0,e=i.length;t<e;t++){if(r=n[t],0==r.length)continue;let s=r[0],o=r[r.length-1];a=i[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],m=a[0],f=a[1],p=a[2],g=a[3],b=Os.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let w=e[0],x=e[1],y=e[2],v=i[l],k=v[v.length-2],S=v[v.length-1];if(w!=s||x!=o)continue;let C=Os.winding(h,c,d,u,k,S),A=Os.winding(k,S,m,f,p,g);C==b&&A==b&&(v.length=0,e.length=0,a.push(k),a.push(S),r.push(y),h=d,c=u,d=k,u=S,l=0)}}for(let t=i.length-1;t>=0;t--)a=i[t],0==a.length&&(i.splice(t,1),this.polygonPool.free(a),r=n[t],n.splice(t,1),this.polygonIndicesPool.free(r));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,r=i[t]<<1,a=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[r],s[r+1],s[a],s[a+1])}static positiveArea(t,e,s,i,n,r){return t*(r-i)+s*(e-r)+n*(i-e)>=0}static winding(t,e,s,i,n,r){let a=s-t,o=i-e;return n*o-r*a+a*e-t*o>=0?1:-1}},_s=class{constructor(){this.triangulator=new Os,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedUVs=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=P.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;_s.makeClockwise(n);let r=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=r.length;t<e;t++){let e=r[t];_s.makeClockwise(e),e.push(e[0]),e.push(e[1])}return r.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,i,n,r,a,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=i,c=n,d=r,u=a,m=o):(l=e,h=s,c=i,d=n,u=r,m=a),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,r=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;n.length=0,r.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],p=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(c,d,u,m,f,p,a[t],i)){let t=P.setArraySize(n,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=p,e=r.length;let s=P.setArraySize(r,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=P.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],i=a[s+1];o[e]=t,o[e+1]=i}e=r.length;let h=P.setArraySize(r,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,i,n,r,a){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=a?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,p=t[s],g=t[s+1],b=i[s],w=i[s+1];s=e[f+1]<<1;let x=t[s],y=t[s+1],v=i[s],k=i[s+1];s=e[f+2]<<1;let S=t[s],C=t[s+1],A=i[s],I=i[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(p,g,x,y,S,C,c[t],o)){let t=P.setArraySize(l,e+3*u);t[e]=p,t[e+1]=g,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,a?(t[e+6]=b,t[e+7]=w,t[e+8]=r.r,t[e+9]=r.g,t[e+10]=r.b,t[e+11]=r.a,t[e+12]=x,t[e+13]=y,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=v,t[e+19]=k,t[e+20]=r.r,t[e+21]=r.g,t[e+22]=r.b,t[e+23]=r.a,t[e+24]=S,t[e+25]=C,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=A,t[e+31]=I,t[e+32]=r.r,t[e+33]=r.g,t[e+34]=r.b,t[e+35]=r.a):(t[e+6]=b,t[e+7]=w,t[e+8]=x,t[e+9]=y,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=v,t[e+15]=k,t[e+16]=S,t[e+17]=C,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=A,t[e+23]=I),e=h.length;let s=P.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=y-C,i=S-x,c=p-S,d=C-g,f=1/(s*c+i*(g-C)),T=t>>1,M=this.clipOutput,F=P.setArraySize(l,e+T*u);for(let o=0;o<t;o+=2,e+=u){let t=M[o],l=M[o+1];F[e]=t,F[e+1]=l,F[e+2]=n.r,F[e+3]=n.g,F[e+4]=n.b,F[e+5]=n.a;let h=t-S,u=l-C,m=(s*h+i*u)*f,p=(d*h+c*u)*f,g=1-m-p;F[e+6]=b*m+v*p+A*g,F[e+7]=w*m+k*p+I*g,a&&(F[e+8]=r.r,F[e+9]=r.g,F[e+10]=r.b,F[e+11]=r.a)}e=h.length;let Y=P.setArraySize(h,e+3*(T-2));T--;for(let t=1;t<T;t++,e+=3)Y[e]=m,Y[e+1]=m+t,Y[e+2]=m+t+1;m+=T+1}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,r=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;r.length=0,a.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=i[s],p=i[s+1];s=e[d+1]<<1;let g=t[s],b=t[s+1],w=i[s],x=i[s+1];s=e[d+2]<<1;let y=t[s],v=t[s+1],k=i[s],S=i[s+1];for(let t=0;t<h;t++){let e=r.length;if(!this.clip(u,m,g,b,y,v,l[t],n)){let t=P.setArraySize(r,e+6);t[e]=u,t[e+1]=m,t[e+2]=g,t[e+3]=b,t[e+4]=y,t[e+5]=v;let s=P.setArraySize(a,e+6);s[e]=f,s[e+1]=p,s[e+2]=w,s[e+3]=x,s[e+4]=k,s[e+5]=S,e=o.length;let i=P.setArraySize(o,e+3);i[e]=c,i[e+1]=c+1,i[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=b-v,i=y-g,l=u-y,h=v-m,d=1/(s*l+i*(m-v)),C=t>>1,A=this.clipOutput,I=P.setArraySize(r,e+2*C),T=P.setArraySize(a,e+2*C);for(let n=0;n<t;n+=2,e+=2){let t=A[n],r=A[n+1];I[e]=t,I[e+1]=r;let a=t-y,o=r-v,c=(s*a+i*o)*d,u=(h*a+l*o)*d,m=1-c-u;T[e]=f*c+w*u+k*m,T[e+1]=p*c+x*u+S*m}e=o.length;let M=P.setArraySize(o,e+3*(C-2));C--;for(let t=1;t<C;t++,e+=3)M[e]=c,M[e+1]=c+t,M[e+2]=c+t+1;c+=C+1}}}}clip(t,e,s,i,n,r,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(i),l.push(n),l.push(r),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],i=e-u[t+2],n=s-u[t+3],r=o.length,a=l;for(let t=0,r=l.length-2;t<r;){let r=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=n*(e-h)>i*(s-d),m=n*(e-r)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s)}else if(u){let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(r==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,r=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],r=e[t+1],a=e[t+2],o=e[t+3],i+=n*o-a*r;if(!(i<0))for(let t=0,i=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],r=i-t;e[t]=e[r],e[t+1]=e[r+1],e[r]=s,e[r+1]=n}}},Ls=class{constructor(t){this.attachmentLoader=void 0,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new We,i="string"==typeof t?JSON.parse(t):t,n=i.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=zs(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),i.bones)for(let t=0;t<i.bones.length;t++){let n=i.bones[t],r=null,a=zs(n,"parent",null);a&&(r=s.findBone(a));let o=new xe(s.bones.length,n.name,r);o.length=zs(n,"length",0)*e,o.x=zs(n,"x",0)*e,o.y=zs(n,"y",0)*e,o.rotation=zs(n,"rotation",0),o.scaleX=zs(n,"scaleX",1),o.scaleY=zs(n,"scaleY",1),o.shearX=zs(n,"shearX",0),o.shearY=zs(n,"shearY",0),o.inherit=P.enumValue(ye,zs(n,"inherit","Normal")),o.skinRequired=zs(n,"skin",!1);let l=zs(n,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(i.slots)for(let t=0;t<i.slots.length;t++){let e=i.slots[t],n=e.name,r=s.findBone(e.bone);if(!r)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let a=new Ge(s.slots.length,n,r),o=zs(e,"color",null);o&&a.color.setFromString(o);let l=zs(e,"dark",null);l&&(a.darkColor=A.fromString(l)),a.attachmentName=zs(e,"attachment",null),a.blendMode=P.enumValue($e,zs(e,"blend","normal")),a.visible=zs(e,"visible",!0),s.slots.push(a)}if(i.ik)for(let t=0;t<i.ik.length;t++){let n=i.ik[t],r=new Te(n.name);r.order=zs(n,"order",0),r.skinRequired=zs(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=s.findBone(n.bones[t]);if(!e)throw new Error(`Couldn't find bone ${n.bones[t]} for IK constraint ${n.name}.`);r.bones.push(e)}let a=s.findBone(n.target);if(!a)throw new Error(`Couldn't find target bone ${n.target} for IK constraint ${n.name}.`);r.target=a,r.mix=zs(n,"mix",1),r.softness=zs(n,"softness",0)*e,r.bendDirection=zs(n,"bendPositive",!0)?1:-1,r.compress=zs(n,"compress",!1),r.stretch=zs(n,"stretch",!1),r.uniform=zs(n,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let t=0;t<i.transform.length;t++){let n=i.transform[t],r=new He(n.name);r.order=zs(n,"order",0),r.skinRequired=zs(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for transform constraint ${n.name}.`);r.bones.push(i)}let a=n.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${n.name}.`);r.target=o,r.local=zs(n,"local",!1),r.relative=zs(n,"relative",!1),r.offsetRotation=zs(n,"rotation",0),r.offsetX=zs(n,"x",0)*e,r.offsetY=zs(n,"y",0)*e,r.offsetScaleX=zs(n,"scaleX",0),r.offsetScaleY=zs(n,"scaleY",0),r.offsetShearY=zs(n,"shearY",0),r.mixRotate=zs(n,"mixRotate",1),r.mixX=zs(n,"mixX",1),r.mixY=zs(n,"mixY",r.mixX),r.mixScaleX=zs(n,"mixScaleX",1),r.mixScaleY=zs(n,"mixScaleY",r.mixScaleX),r.mixShearY=zs(n,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let t=0;t<i.path.length;t++){let n=i.path[t],r=new Me(n.name);r.order=zs(n,"order",0),r.skinRequired=zs(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for path constraint ${n.name}.`);r.bones.push(i)}let a=n.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${n.name}.`);r.target=o,r.positionMode=P.enumValue(Fe,zs(n,"positionMode","Percent")),r.spacingMode=P.enumValue(Ye,zs(n,"spacingMode","Length")),r.rotateMode=P.enumValue(Pe,zs(n,"rotateMode","Tangent")),r.offsetRotation=zs(n,"rotation",0),r.position=zs(n,"position",0),0==r.positionMode&&(r.position*=e),r.spacing=zs(n,"spacing",0),0!=r.spacingMode&&1!=r.spacingMode||(r.spacing*=e),r.mixRotate=zs(n,"mixRotate",1),r.mixX=zs(n,"mixX",1),r.mixY=zs(n,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let t=0;t<i.physics.length;t++){const n=i.physics[t],r=new qe(n.name);r.order=zs(n,"order",0),r.skinRequired=zs(n,"skin",!1);const a=n.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);r.bone=o,r.x=zs(n,"x",0),r.y=zs(n,"y",0),r.rotate=zs(n,"rotate",0),r.scaleX=zs(n,"scaleX",0),r.shearX=zs(n,"shearX",0),r.limit=zs(n,"limit",5e3)*e,r.step=1/zs(n,"fps",60),r.inertia=zs(n,"inertia",1),r.strength=zs(n,"strength",100),r.damping=zs(n,"damping",1),r.massInverse=1/zs(n,"mass",1),r.wind=zs(n,"wind",0),r.gravity=zs(n,"gravity",0),r.mix=zs(n,"mix",1),r.inertiaGlobal=zs(n,"inertiaGlobal",!1),r.strengthGlobal=zs(n,"strengthGlobal",!1),r.dampingGlobal=zs(n,"dampingGlobal",!1),r.massGlobal=zs(n,"massGlobal",!1),r.windGlobal=zs(n,"windGlobal",!1),r.gravityGlobal=zs(n,"gravityGlobal",!1),r.mixGlobal=zs(n,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let t=0;t<i.skins.length;t++){let e=i.skins[t],n=new je(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=s.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);n.bones.push(r)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],r=s.findIkConstraint(i);if(!r)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],r=s.findTransformConstraint(i);if(!r)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],r=s.findPathConstraint(i);if(!r)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],r=s.findPhysicsConstraint(i);if(!r)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}for(let t in e.attachments){let i=s.findSlot(t);if(!i)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let r=e.attachments[t];for(let t in r){let e=this.readAttachment(r[t],n,i.index,t,s);e&&n.setAttachment(i.index,t,e)}}s.skins.push(n),"default"==n.name&&(s.defaultSkin=n)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],i=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!i)throw new Error(`Skin not found: ${e.skin}`);let n=i.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let t in i.events){let e=i.events[t],n=new Ae(t);n.intValue=zs(e,"int",0),n.floatValue=zs(e,"float",0),n.stringValue=zs(e,"string",""),n.audioPath=zs(e,"audio",null),n.audioPath&&(n.volume=zs(e,"volume",1),n.balance=zs(e,"balance",0)),s.events.push(n)}if(i.animations)for(let t in i.animations){let e=i.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,i,n){let r=this.scale;switch(i=zs(t,"name",i),zs(t,"type","region")){case"region":{let s=zs(t,"path",i),n=this.readSequence(zs(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,s,n);if(!a)return null;a.path=s,a.x=zs(t,"x",0)*r,a.y=zs(t,"y",0)*r,a.scaleX=zs(t,"scaleX",1),a.scaleY=zs(t,"scaleY",1),a.rotation=zs(t,"rotation",0),a.width=t.width*r,a.height=t.height*r,a.sequence=n;let o=zs(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=zs(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=zs(t,"path",i),a=this.readSequence(zs(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,n,a);if(!o)return null;o.path=n;let l=zs(t,"color",null);l&&o.color.setFromString(l),o.width=zs(t,"width",0)*r,o.height=zs(t,"height",0)*r,o.sequence=a;let h=zs(t,"parent",null);if(h)return this.linkedMeshes.push(new Ns(o,zs(t,"skin",null),s,h,zs(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=zs(t,"edges",null),o.hullLength=2*zs(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=zs(t,"closed",!1),s.constantSpeed=zs(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let a=P.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*r;s.lengths=a;let o=zs(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=zs(t,"x",0)*r,s.y=zs(t,"y",0)*r,s.rotation=zs(t,"rotation",0);let n=zs(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let r=zs(t,"end",null);r&&(s.endSlot=n.findSlot(r));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=zs(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new O(zs(t,"count",0));return e.start=zs(t,"start",1),e.digits=zs(t,"digits",0),e.setupIndex=zs(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=P.toFloatArray(n);if(1!=i)for(let e=0,s=n.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let r=new Array,a=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(n[t]),r.push(n[t+1]*i),r.push(n[t+2]*i),r.push(n[t+3])}e.bones=a,e.vertices=P.toFloatArray(r)}readAnimation(t,e,s){let i=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let i=t.slots[e],r=s.findSlot(e);if(!r)throw new Error("Slot not found: "+e);let a=r.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new ft(s,a);for(let i=0;i<s;i++){let s=e[i];t.setFrame(i,zs(s,"time",0),zs(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new ht(s,s<<2,a),i=e[0],r=zs(i,"time",0),o=A.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a);let a=e[s+1];if(!a){t.shrink(n);break}let l=zs(a,"time",0),h=A.fromString(a.color),c=i.curve;c&&(n=Ws(c,t,n,s,0,r,l,o.r,h.r,1),n=Ws(c,t,n,s,1,r,l,o.g,h.g,1),n=Ws(c,t,n,s,2,r,l,o.b,h.b,1),n=Ws(c,t,n,s,3,r,l,o.a,h.a,1)),r=l,o=h,i=a}n.push(t)}else if("rgb"==t){let t=new ct(s,3*s,a),i=e[0],r=zs(i,"time",0),o=A.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b);let a=e[s+1];if(!a){t.shrink(n);break}let l=zs(a,"time",0),h=A.fromString(a.color),c=i.curve;c&&(n=Ws(c,t,n,s,0,r,l,o.r,h.r,1),n=Ws(c,t,n,s,1,r,l,o.g,h.g,1),n=Ws(c,t,n,s,2,r,l,o.b,h.b,1)),r=l,o=h,i=a}n.push(t)}else if("alpha"==t)n.push(Us(e,new dt(s,s,a),0,1));else if("rgba2"==t){let t=new ut(s,7*s,a),i=e[0],r=zs(i,"time",0),o=A.fromString(i.light),l=A.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=zs(a,"time",0),c=A.fromString(a.light),d=A.fromString(a.dark),u=i.curve;u&&(n=Ws(u,t,n,s,0,r,h,o.r,c.r,1),n=Ws(u,t,n,s,1,r,h,o.g,c.g,1),n=Ws(u,t,n,s,2,r,h,o.b,c.b,1),n=Ws(u,t,n,s,3,r,h,o.a,c.a,1),n=Ws(u,t,n,s,4,r,h,l.r,d.r,1),n=Ws(u,t,n,s,5,r,h,l.g,d.g,1),n=Ws(u,t,n,s,6,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}else if("rgb2"==t){let t=new mt(s,6*s,a),i=e[0],r=zs(i,"time",0),o=A.fromString(i.light),l=A.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=zs(a,"time",0),c=A.fromString(a.light),d=A.fromString(a.dark),u=i.curve;u&&(n=Ws(u,t,n,s,0,r,h,o.r,c.r,1),n=Ws(u,t,n,s,1,r,h,o.g,c.g,1),n=Ws(u,t,n,s,2,r,h,o.b,c.b,1),n=Ws(u,t,n,s,3,r,h,l.r,d.r,1),n=Ws(u,t,n,s,4,r,h,l.g,d.g,1),n=Ws(u,t,n,s,5,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}}}if(t.bones)for(let e in t.bones){let r=t.bones[e],a=s.findBone(e);if(!a)throw new Error("Bone not found: "+e);let o=a.index;for(let t in r){let e=r[t],s=e.length;if(0!=s)if("rotate"===t)n.push(Us(e,new Q(s,s,o),0,1));else if("translate"===t){let t=new Z(s,s<<1,o);n.push(qs(e,t,"x","y",0,i))}else if("translatex"===t){let t=new tt(s,s,o);n.push(Us(e,t,0,i))}else if("translatey"===t){let t=new et(s,s,o);n.push(Us(e,t,0,i))}else if("scale"===t){let t=new st(s,s<<1,o);n.push(qs(e,t,"x","y",1,1))}else if("scalex"===t){let t=new it(s,s,o);n.push(Us(e,t,1,1))}else if("scaley"===t){let t=new nt(s,s,o);n.push(Us(e,t,1,1))}else if("shear"===t){let t=new rt(s,s<<1,o);n.push(qs(e,t,"x","y",0,1))}else if("shearx"===t){let t=new at(s,s,o);n.push(Us(e,t,0,1))}else if("sheary"===t){let t=new ot(s,s,o);n.push(Us(e,t,0,1))}else if("inherit"===t){let t=new lt(s,a.index);for(let s=0;s<e.length;s++){let i=e[s];t.setFrame(s,zs(i,"time",0),P.enumValue(ye,zs(i,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let r=t.ik[e],a=r[0];if(!a)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new yt(r.length,r.length<<1,l),c=zs(a,"time",0),d=zs(a,"mix",1),u=zs(a,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,zs(a,"bendPositive",!0)?1:-1,zs(a,"compress",!1),zs(a,"stretch",!1));let s=r[t+1];if(!s){h.shrink(e);break}let n=zs(s,"time",0),o=zs(s,"mix",1),l=zs(s,"softness",0)*i,m=a.curve;m&&(e=Ws(m,h,e,t,0,c,n,d,o,1),e=Ws(m,h,e,t,1,c,n,u,l,i)),c=n,d=o,u=l,a=s}n.push(h)}if(t.transform)for(let e in t.transform){let i=t.transform[e],r=i[0];if(!r)continue;let a=s.findTransformConstraint(e);if(!a)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(a),l=new vt(i.length,6*i.length,o),h=zs(r,"time",0),c=zs(r,"mixRotate",1),d=zs(r,"mixX",1),u=zs(r,"mixY",d),m=zs(r,"mixScaleX",1),f=zs(r,"mixScaleY",m),p=zs(r,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,p);let s=i[t+1];if(!s){l.shrink(e);break}let n=zs(s,"time",0),a=zs(s,"mixRotate",1),o=zs(s,"mixX",1),g=zs(s,"mixY",o),b=zs(s,"mixScaleX",1),w=zs(s,"mixScaleY",b),x=zs(s,"mixShearY",1),y=r.curve;y&&(e=Ws(y,l,e,t,0,h,n,c,a,1),e=Ws(y,l,e,t,1,h,n,d,o,1),e=Ws(y,l,e,t,2,h,n,u,g,1),e=Ws(y,l,e,t,3,h,n,m,b,1),e=Ws(y,l,e,t,4,h,n,f,w,1),e=Ws(y,l,e,t,5,h,n,p,x,1)),h=n,c=a,d=o,u=g,m=b,f=w,m=b,r=s}n.push(l)}if(t.path)for(let e in t.path){let r=t.path[e],a=s.findPathConstraint(e);if(!a)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(a);for(let t in r){let e=r[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new kt(l,l,o);n.push(Us(e,t,0,0==a.positionMode?i:1))}else if("spacing"===t){let t=new St(l,l,o);n.push(Us(e,t,0,0==a.spacingMode||1==a.spacingMode?i:1))}else if("mix"===t){let t=new Ct(l,3*l,o),i=zs(s,"time",0),r=zs(s,"mixRotate",1),a=zs(s,"mixX",1),h=zs(s,"mixY",a);for(let n=0,o=0;;n++){t.setFrame(n,i,r,a,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=zs(l,"time",0),d=zs(l,"mixRotate",1),u=zs(l,"mixX",1),m=zs(l,"mixY",u),f=s.curve;f&&(o=Ws(f,t,o,n,0,i,c,r,d,1),o=Ws(f,t,o,n,1,i,c,a,u,1),o=Ws(f,t,o,n,2,i,c,h,m,1)),i=c,r=d,a=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let i=t.physics[e],r=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);r=s.physicsConstraints.indexOf(t)}for(let t in i){let e=i[t],s=e[0];if(!s)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new It(o,o,r);else if("strength"==t)a=new Tt(o,o,r);else if("damping"==t)a=new Mt(o,o,r);else if("mass"==t)a=new Ft(o,o,r);else if("wind"==t)a=new Yt(o,o,r);else if("gravity"==t)a=new Pt(o,o,r);else{if("mix"!=t)continue;a=new Et(o,o,r)}n.push(Us(e,a,0,1))}else{const t=new Bt(o,r);for(let i=0;null!=s;s=e[i+1],i++)t.setFrame(i,zs(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let r=t.attachments[e],a=s.findSkin(e);if(!a)throw new Error("Skin not found: "+e);for(let t in r){let e=r[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],r=a.getAttachment(l,t);for(let t in s){let e=s[t],a=e[0];if(a)if("deform"==t){let t=r.bones,s=r.vertices,o=t?s.length/3*2:s.length,h=new pt(e.length,e.length,l,r),c=zs(a,"time",0);for(let n=0,r=0;;n++){let l,d=zs(a,"vertices",null);if(d){l=P.newFloatArray(o);let e=zs(a,"offset",0);if(P.arrayCopy(d,0,l,e,d.length),1!=i)for(let t=e,s=t+d.length;t<s;t++)l[t]*=i;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?P.newFloatArray(o):s;h.setFrame(n,c,l);let u=e[n+1];if(!u){h.shrink(r);break}let m=zs(u,"time",0),f=a.curve;f&&(r=Ws(f,h,r,n,0,c,m,0,1,1)),c=m,a=u}n.push(h)}else if("sequence"==t){let t=new Dt(e.length,l,r),s=0;for(let i=0;i<e.length;i++){let n=zs(a,"delay",s),r=zs(a,"time",0),o=U[zs(a,"mode","hold")],l=zs(a,"index",0);t.setFrame(i,r,o,l,n),s=n,a=e[i+1]}n.push(t)}}}}}if(t.drawOrder){let e=new xt(t.drawOrder.length),i=s.slots.length,r=0;for(let n=0;n<t.drawOrder.length;n++,r++){let a=t.drawOrder[n],o=null,l=zs(a,"offsets",null);if(l){o=P.newArray(i,-1);let t=P.newArray(i-l.length,0),e=0,n=0;for(let i=0;i<l.length;i++){let r=l[i],a=s.findSlot(r.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[n++]=e++;o[e+r.offset]=e++}for(;e<i;)t[n++]=e++;for(let e=i-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(r,zs(a,"time",0),o)}n.push(e)}if(t.events){let e=new bt(t.events.length),i=0;for(let n=0;n<t.events.length;n++,i++){let r=t.events[n],a=s.findEvent(r.name);if(!a)throw new Error("Event not found: "+r.name);let o=new Ce(P.toSinglePrecision(zs(r,"time",0)),a);o.intValue=zs(r,"int",a.intValue),o.floatValue=zs(r,"float",a.floatValue),o.stringValue=zs(r,"string",a.stringValue),o.data.audioPath&&(o.volume=zs(r,"volume",1),o.balance=zs(r,"balance",0)),e.setFrame(i,o)}n.push(e)}let r=0;for(let t=0,e=n.length;t<e;t++)r=Math.max(r,n[t].getDuration());s.animations.push(new W(e,n,r))}},Ns=class{constructor(t,e,s,i,n){this.parent=void 0,this.skin=void 0,this.slotIndex=void 0,this.mesh=void 0,this.inheritTimeline=void 0,this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};function Us(t,e,s,i){let n=t[0],r=zs(n,"time",0),a=zs(n,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,r,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=zs(h,"time",0),d=zs(h,"value",s)*i;n.curve&&(o=Ws(n.curve,e,o,l,0,r,c,a,d,i)),r=c,a=d,n=h}}function qs(t,e,s,i,n,r){let a=t[0],o=zs(a,"time",0),l=zs(a,s,n)*r,h=zs(a,i,n)*r,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=zs(u,"time",0),f=zs(u,s,n)*r,p=zs(u,i,n)*r,g=a.curve;g&&(c=Ws(g,e,c,d,0,o,m,l,f,r),c=Ws(g,e,c,d,1,o,m,h,p,r)),o=m,l=f,h=p,a=u}}function Ws(t,e,s,i,n,r,a,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=n<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,n,r,o,d,u,m,f,a,l),s+1}function zs(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=(ns=new Float32Array(1),function(t){return ns[0]=t,ns[0]}));var js=class extends ee{static from(t){return js.textureMap.has(t)?js.textureMap.get(t):new js(t)}constructor(t){super(t.resource),this.texture=void 0,this.texture=i.Texture.from(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=js.toPixiTextureFilter(t),s.magFilter=js.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=js.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=js.toPixiTextureWrap(t),s.addressModeV=js.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Gs=js;k(Gs,"textureMap",new Map);var $s={extension:i.ExtensionType.Asset,resolver:{test:t=>i.checkExtension(t,".atlas"),parse:t=>{var e,s;const n=t.split(".");return{resolution:parseFloat((null===(e=i.Resolver.RETINA_PREFIX)||void 0===e||null===(s=e.exec(t))||void 0===s?void 0:s[1])??"1"),format:n[n.length-2],src:t}}},loader:{extension:{type:i.ExtensionType.LoadParser,priority:i.LoaderParserPriority.Normal,name:"spineTextureAtlasLoader"},test:t=>i.checkExtension(t,".atlas"),async load(t){const e=await i.DOMAdapter.get().fetch(t);return await e.text()},testParse(t,e){const s=i.checkExtension(e.src,".atlas"),n="string"==typeof t;return Promise.resolve(s&&n)},unload(t){t.dispose()},async parse(t,e,s){const n=e.data||{};let r=i.path.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const a=new re(t);if(n.images instanceof i.TextureSource||"string"==typeof n.images){const t=n.images;n.images={},n.images[a.pages[0].name]=t}const o=[];for(const t of a.pages){if(n.resolve){const e=n.resolve().then((e=>{t.setTexture(Gs.from(e.source))}));o.push(e);continue}const e=t.name,a=null!=n&&n.images?n.images[e]:void 0;if(a instanceof i.TextureSource)t.setTexture(Gs.from(a));else{const l={src:a??i.path.normalize([...r.split(i.path.sep),e].join(i.path.sep)),data:_objectSpread(_objectSpread({},n.imageMetadata),{},{alphaMode:t.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"})},h=s.load(l).then((e=>{t.setTexture(Gs.from(e.source))}));o.push(h)}}return await Promise.all(o),a}}};i.extensions.add($s);var Hs={extension:i.ExtensionType.Asset,loader:{extension:{type:i.ExtensionType.LoadParser,priority:i.LoaderParserPriority.Normal,name:"spineSkeletonLoader"},test:t=>i.checkExtension(t,".skel"),async load(t){const e=await i.DOMAdapter.get().fetch(t);return new Uint8Array(await e.arrayBuffer())},testParse(t,e){const s=i.checkExtension(e.src,".json")&&(n=t,Object.prototype.hasOwnProperty.call(n,"bones"));var n;const r=i.checkExtension(e.src,".skel")&&function(t){return t instanceof Uint8Array}(t);return Promise.resolve(s||r)}}};i.extensions.add(Hs);var Ks=new Float32Array(1),Js=new Uint32Array(1),Qs=class extends i.Geometry{constructor(){const t=new i.Buffer({data:Ks,label:"attribute-batch-buffer",usage:i.BufferUsage.VERTEX|i.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:28,offset:0},aUV:{buffer:t,format:"float32x2",stride:28,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:t,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:28,offset:24}},indexBuffer:new i.Buffer({data:Js,label:"index-batch-buffer",usage:i.BufferUsage.INDEX|i.BufferUsage.COPY_DST,shrinkToFit:!1})})}},Zs={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},ti={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},ei=class extends i.Shader{constructor(t){super({glProgram:i.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[i.colorBitGl,ti,i.generateTextureBatchBitGl(t),i.roundPixelsBitGl]}),gpuProgram:i.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[i.colorBit,Zs,i.generateTextureBatchBit(t),i.roundPixelsBit]}),resources:{batchSamplers:i.getBatchSamplersUniformGroup(t)}})}},si=null,ii=class extends i.Batcher{constructor(...t){super(...t),this.geometry=new Qs,this.shader=si||(si=new ei(this.maxTextures)),this.name=ii.extension.name,this.vertexSize=7}packAttributes(t,e,s,n,r){const a=r<<16|65535&t.roundPixels,o=t.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:p}=t,g=t.color,b=(g>>24&255)/255,w=i.Color.shared.setValue(t.darkColor).premultiply(b,!0).toPremultiplied(1,!1),x=t.attributeOffset,y=x+t.attributeSize;for(let t=x;t<y;t++){const i=2*t,r=f[i],o=f[i+1];e[n++]=l*r+c*o+u,e[n++]=d*o+h*r+m,e[n++]=p[i],e[n++]=p[i+1],s[n++]=g,s[n++]=w,s[n++]=a}}packQuadAttributes(t,e,s,i,n){const r=t.texture,a=t.transform,o=a.a,l=a.b,h=a.c,c=a.d,d=a.tx,u=a.ty,m=t.bounds,f=m.maxX,p=m.minX,g=m.maxY,b=m.minY,w=r.uvs,x=t.color,y=t.darkColor,v=n<<16|65535&t.roundPixels;e[i+0]=o*p+h*b+d,e[i+1]=c*b+l*p+u,e[i+2]=w.x0,e[i+3]=w.y0,s[i+4]=x,s[i+5]=y,s[i+6]=v,e[i+7]=o*f+h*b+d,e[i+8]=c*b+l*f+u,e[i+9]=w.x1,e[i+10]=w.y1,s[i+11]=x,s[i+12]=y,s[i+13]=v,e[i+14]=o*f+h*g+d,e[i+15]=c*g+l*f+u,e[i+16]=w.x2,e[i+17]=w.y2,s[i+18]=x,s[i+19]=y,s[i+20]=v,e[i+21]=o*p+h*g+d,e[i+22]=c*g+l*p+u,e[i+23]=w.x3,e[i+24]=w.y3,s[i+25]=x,s[i+26]=y,s[i+27]=v}},ni=ii;k(ni,"extension",{type:[i.ExtensionType.Batcher],name:"darkTint"}),i.extensions.add(ni);var ri=class{constructor(){this.indexOffset=0,this.attributeOffset=0,this.indexSize=void 0,this.attributeSize=void 0,this.batcherName="darkTint",this.topology="triangle-list",this.packAsQuad=!1,this.renderable=void 0,this.positions=void 0,this.indices=void 0,this.uvs=void 0,this.roundPixels=void 0,this.data=void 0,this.blendMode=void 0,this.darkTint=void 0,this.texture=void 0,this.transform=void 0,this._textureId=void 0,this._attributeStart=void 0,this._indexStart=void 0,this._batcher=void 0,this._batch=void 0}get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const n=t.a*s*255;if(16777215!==e){const s=e>>16&255,r=e>>8&255,a=255&e,o=t.r*a,l=t.g*r;i=n<<24|t.b*s<<16|l<<8|o}else i=n<<24|255*t.b<<16|255*t.g<<8|255*t.r;return i}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},ai={0:"normal",1:"add",2:"multiply",3:"screen"},oi=class{constructor(t){this.renderer=void 0,this.gpuSpineData={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,n=e.length;i<n;i++){const n=e[i],r=n.getAttachment();if(r instanceof me||r instanceof he){const e=t._getCachedData(n,r),i=s.slotBatches[e.id],a=e.texture;if(a!==i.texture&&!i._batcher.checkAndUpdateTexture(i,a))return!0}}}return!1}addRenderable(t,e){const s=this._getSpineData(t),n=this.renderer.renderPipes.batch,r=t.skeleton.drawOrder,a=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments();for(let o=0,l=r.length;o<l;o++){const l=r[o],h=l.getAttachment(),c=ai[l.data.blendMode];if(h instanceof me||h instanceof he){const i=t._getCachedData(l,h),r=s.slotBatches[i.id]||=new ri;r.setData(t,i,c,a),i.skipRender||n.addToBatch(r,e)}const d=t._slotsObject[l.data.name];if(d){const t=d.container;t.includeInBuild=!0,i.collectAllRenderables(t,e,this.renderer),t.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments();const s=t.skeleton.drawOrder;for(let n=0,r=s.length;n<r;n++){const r=s[n],a=r.getAttachment();if(a instanceof me||a instanceof he){if(!t._getCachedData(r,a).skipRender){var i;const s=e.slotBatches[t._getCachedData(r,a).id];null===(i=s._batcher)||void 0===i||i.updateElement(s)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};k(oi,"extension",{type:[i.ExtensionType.WebGLPipes,i.ExtensionType.WebGPUPipes,i.ExtensionType.CanvasPipes],name:"spine"}),i.extensions.add(oi);var li=new X;Oe.yDown=!0;var hi=new _s,ci=new E((()=>new i.Graphics)),di=class extends i.ViewContainer{getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t?i.Ticker.shared.add(this.internalUpdate,this):i.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=t}constructor(t){var e,s,i;t instanceof We&&(t={skeletonData:t}),super(),this.batched=!0,this.buildId=0,this.renderPipeId="spine",this._didSpineUpdate=!1,this.beforeUpdateWorldTransforms=()=>{},this.afterUpdateWorldTransforms=()=>{},this.skeleton=void 0,this.state=void 0,this.skeletonBounds=void 0,this.darkTint=!1,this._debug=void 0,this._slotsObject=Object.create(null),this.clippingSlotToPixiMasks=Object.create(null),this.spineAttachmentsDirty=!0,this.spineTexturesDirty=!0,this._lastAttachments=[],this._stateChanged=!0,this.attachmentCacheData=[],this._autoUpdate=!0,this.hasNeverUpdated=!0,this.currentClippingSlot=void 0;const n=t instanceof We?t:t.skeletonData;this.skeleton=new Oe(n),this.state=new Ot(new Qt(n)),this.autoUpdate=(null===(e=t)||void 0===e?void 0:e.autoUpdate)??!0,this.darkTint=void 0===(null===(s=t)||void 0===s?void 0:s.darkTint)?this.skeleton.slots.some((t=>!!t.data.darkColor)):null===(i=t)||void 0===i?void 0:i.darkTint;const r=this.skeleton.slots;for(let t=0;t<r.length;t++)this.attachmentCacheData[t]=Object.create(null)}update(t){this.internalUpdate(0,t)}internalUpdate(t,e){this._updateAndApplyState(e??i.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(li.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(li);t.x=e.x,t.y=-e.y}else t.x=li.x,t.y=li.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,i=!1;for(let n=0;n<t.length;n++){const r=t[n].getAttachment();r&&(r!==e[s]&&(i=!0,e[s]=r),s++)}s!==e.length&&(i=!0,e.length=s),this.spineAttachmentsDirty=i}updateAndSetPixiMask(t,e){const s=t.attachment;if(s&&s instanceof te){return(this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array}).maskComputed=!1,void(this.currentClippingSlot=this.clippingSlotToPixiMasks[t.data.name])}let i=this.currentClippingSlot,n=this._slotsObject[t.data.name];if(i&&n){let t=i.slot,e=t.attachment,s=i.mask;if(s||(s=ci.obtain(),i.mask=s,this.addChild(s)),!i.maskComputed){i.maskComputed=!0;const n=e.worldVerticesLength,r=i.vertices;e.computeWorldVertices(t,0,n,r,0,2),s.clear().poly(r).stroke({width:0}).fill({alpha:.25})}n.container.mask=s}else null!=n&&n.container.mask&&(n.container.mask=null);if(i&&i.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e)for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof te&&e.maskComputed||!e.mask||(this.removeChild(e.mask),ci.free(e.mask),e.mask=void 0)}}transformAttachments(){const t=this.skeleton.drawOrder;for(let s=0;s<t.length;s++){const n=t[s];this.updateAndSetPixiMask(n,s===t.length-1);const r=n.getAttachment();if(r)if(r instanceof he||r instanceof me){var e;const t=this._getCachedData(n,r);r instanceof me?r.computeWorldVertices(n,t.vertices,0,2):r.computeWorldVertices(n,0,r.worldVerticesLength,t.vertices,0,2),t.uvs.length<r.uvs.length&&(t.uvs=new Float32Array(r.uvs.length)),i.fastCopy(r.uvs.buffer,t.uvs.buffer);const s=n.bone.skeleton.color,a=n.color,o=r.color;t.color.set(s.r*a.r*o.r,s.g*a.g*o.g,s.b*a.b*o.b,s.a*a.a*o.a),n.darkColor&&t.darkColor.setFromColor(n.darkColor),t.skipRender=t.clipped=!1;const l=(null===(e=r.region)||void 0===e?void 0:e.texture.texture)||i.Texture.EMPTY;t.texture!==l&&(t.texture=l,this.spineTexturesDirty=!0),hi.isClipping()&&this.updateClippingData(t)}else if(r instanceof te){hi.clipStart(n,r);continue}hi.clipEndWithSlot(n)}hi.clipEnd()}updateClippingData(t){t.clipped=!0,hi.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:i}=hi,n=e.length/2,r=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*n),uvs:new Float32Array(2*n),vertexCount:n,indices:new Uint16Array(r),indicesCount:r},this.spineAttachmentsDirty=!0);const a=t.clippedData,o=a.vertexCount!==n||r!==a.indicesCount;t.skipRender=0===n,o&&(this.spineAttachmentsDirty=!0,a.vertexCount<n&&(a.vertices=new Float32Array(2*n),a.uvs=new Float32Array(2*n)),a.indices.length<r&&(a.indices=new Uint16Array(r)));const{vertices:l,uvs:h,indices:c}=a;for(let t=0;t<n;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];a.vertexCount=n;for(let t=0;t<r;t++)c[t]!==i[t]&&(this.spineAttachmentsDirty=!0,c[t]=i[t]);a.indicesCount=r}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:e,container:s}=t;if(s.visible=this.skeleton.drawOrder.includes(e),s.visible){const t=e.bone;s.position.set(t.worldX,t.worldY),s.scale.x=t.getWorldScaleX(),s.scale.y=t.getWorldScaleY(),s.rotation=t.getWorldRotationX()*i.DEG_TO_RAD,s.alpha=this.skeleton.color.a*e.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){let s;var i,n;e instanceof me?(s=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new A(1,1,1,1),darkColor:new A(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null===(i=e.region)||void 0===i?void 0:i.texture.texture}):(s=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new A(1,1,1,1),darkColor:new A(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null===(n=e.region)||void 0===n?void 0:n.texture.texture});return this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){var t;if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),null===(t=this.debug)||void 0===t||t.renderDebug(this)}addSlotObject(t,e){t=this.getSlotFromRef(t);for(const t in this._slotsObject){var s;(null===(s=this._slotsObject[t])||void 0===s?void 0:s.container)===e&&this.removeSlotObject(this._slotsObject[t].slot)}this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const i={container:e,slot:t};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(t){let e;if(t instanceof i.Container)for(const i in this._slotsObject){var s;if((null===(s=this._slotsObject[i])||void 0===s?void 0:s.container)===t){this._slotsObject[i]=null,e=t;break}}else{var n;const s=this.getSlotFromRef(t);e=null===(n=this._slotsObject[s.data.name])||void 0===n?void 0:n.container,this._slotsObject[s.data.name]=null}e&&(this.removeChild(e),e.includeInBuild=!0)}getSlotObject(t){var e;return t=this.getSlotFromRef(t),null===(e=this._slotsObject[t.data.name])||void 0===e?void 0:e.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new Vs;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const i=t[s],n=i.getAttachment();if(n&&(n instanceof me||n instanceof he)){const t=this._getCachedData(i,n);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),i.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:t,atlas:e,scale:s=1,darkTint:n,autoUpdate:r=!0}){const a=`${t}-${e}-${s}`;if(i.Cache.has(a))return new di(i.Cache.get(a));const o=i.Assets.get(t),l=i.Assets.get(e),h=new we(l),c=o instanceof Uint8Array?new Ke(h):new Ls(h);c.scale=s;const d=c.readSkeletonData(o);return i.Cache.set(a,d),new di({skeletonData:d,darkTint:n,autoUpdate:r})}},ui={AlphaTimeline:dt,Animation:W,AnimationState:Ot,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:Qt,AssetManagerBase:class{constructor(t,e="",s=new Se){this.pathPrefix="",this.textureLoader=void 0,this.downloader=void 0,this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),r=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let a=new re(n),o=a.pages.length,l=!1;for(let n of a.pages)this.loadTexture(i?i[n.name]:r+n.name,((s,i)=>{l||(n.setTexture(i),0==--o&&this.success(e,t,a))}),((e,i)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},AtlasAttachmentLoader:we,Attachment:B,AttachmentTimeline:ft,BinaryInput:Je,BlendMode:$e,Bone:ve,BoneData:xe,BoundingBoxAttachment:Zt,CURRENT:Jt,ClippingAttachment:te,Color:A,ConstraintData:ke,CurveTimeline:H,CurveTimeline1:K,CurveTimeline2:J,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)}}},DeformTimeline:pt,Downloader:Se,DrawOrderTimeline:xt,Event:Ce,EventData:Ae,EventQueue:qt,EventTimeline:bt,EventType:Wt,FIRST:jt,FakeTexture:class extends ee{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:$t,HOLD_MIX:Ht,HOLD_SUBSEQUENT:Gt,IkConstraint:Ie,IkConstraintData:Te,IkConstraintTimeline:yt,Inherit:ye,InheritTimeline:lt,IntSet:class{constructor(){this.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}},Interpolation:M,MathUtils:T,MeshAttachment:he,MixBlend:z,MixDirection:j,PathAttachment:ce,PathConstraint:Xe,PathConstraintData:Me,PathConstraintMixTimeline:Ct,PathConstraintPositionTimeline:kt,PathConstraintSpacingTimeline:St,Physics:Ue,PhysicsConstraintDampingTimeline:Mt,PhysicsConstraintGravityTimeline:Pt,PhysicsConstraintInertiaTimeline:It,PhysicsConstraintMassTimeline:Ft,PhysicsConstraintMixTimeline:Et,PhysicsConstraintResetTimeline:Bt,PhysicsConstraintStrengthTimeline:Tt,PhysicsConstraintTimeline:At,PhysicsConstraintWindTimeline:Yt,PointAttachment:de,Pool:E,PositionMode:Fe,Pow:F,PowOut:class extends F{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:mt,RGBA2Timeline:ut,RGBATimeline:ht,RGBTimeline:ct,RegionAttachment:me,RotateMode:Pe,RotateTimeline:Q,SETUP:Kt,SUBSEQUENT:zt,ScaleTimeline:st,ScaleXTimeline:it,ScaleYTimeline:nt,SequenceTimeline:Dt,ShearTimeline:rt,ShearXTimeline:at,ShearYTimeline:ot,Skeleton:Oe,SkeletonBinary:Ke,SkeletonBounds:Vs,SkeletonClipping:_s,SkeletonData:We,SkeletonJson:Ls,Skin:je,SkinEntry:ze,Slot:Re,SlotData:Ge,SpacingMode:Ye,Spine:di,SpineDebugRenderer:class{constructor(){this.registeredSpines=new Map,this.drawMeshHull=!0,this.drawMeshTriangles=!0,this.drawBones=!0,this.drawPaths=!0,this.drawBoundingBoxes=!0,this.drawClipping=!0,this.drawRegionAttachments=!0,this.drawEvents=!0,this.lineWidth=1,this.regionAttachmentsColor=30975,this.meshHullColor=30975,this.meshTrianglesColor=16763904,this.clippingPolygonColor=16711935,this.boundingBoxesRectColor=65280,this.boundingBoxesPolygonColor=65280,this.boundingBoxesCircleColor=65280,this.pathsCurveColor=16711680,this.pathsLineColor=16711935,this.skeletonXYColor=16711680,this.bonesColor=61132,this.eventFontSize=24,this.eventFontColor=0}registerSpine(t){if(this.registeredSpines.has(t))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);const e={parentDebugContainer:new i.Container,bones:new i.Container,skeletonXY:new i.Graphics,regionAttachmentsShape:new i.Graphics,meshTrianglesLine:new i.Graphics,meshHullLine:new i.Graphics,clippingPolygon:new i.Graphics,boundingBoxesRect:new i.Graphics,boundingBoxesCircle:new i.Graphics,boundingBoxesPolygon:new i.Graphics,pathsCurve:new i.Graphics,pathsLine:new i.Graphics,eventText:new i.Container,eventCallback:{event:(s,n)=>{if(this.drawEvents){const s=Math.abs(t.scale.x||t.scale.y||1),r=new i.Text({text:n.data.name,style:{fontSize:this.eventFontSize/s,fill:this.eventFontColor,fontFamily:"monospace"}});r.scale.x=Math.sign(t.scale.x),r.anchor.set(.5),e.eventText.addChild(r),setTimeout((()=>{r.destroyed||r.destroy()}),250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(t,e,s,n){const r=t.skeleton,a=r.x,o=r.y,l=r.bones;e.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let t=0,r=l.length;t<r;t++){const r=l[t],h=r.data.length,c=a+r.worldX,d=o+r.worldY,u=a+h*r.a+r.worldX,m=o+h*r.b+r.worldY;if("root"===r.data.name||null===r.data.parent)continue;const f=Math.abs(c-u),p=Math.abs(d-m),g=Math.pow(f,2),b=p,w=Math.pow(p,2),x=Math.sqrt(g+w),y=Math.pow(x,2),v=Math.PI/180,k=Math.acos((y+w-g)/(2*b*x))||0;if(0===x)continue;const S=new i.Graphics;e.bones.addChild(S);const C=x/50/n;S.context.poly([0,0,0-C,x-3*C,0,x-C,0+C,x-3*C]).fill(this.bonesColor),S.x=c,S.y=d,S.pivot.y=x;let A=0;c<u&&d<m?A=180*v-k:c>u&&d<m?A=180*v+k:c>u&&d>m?A=-k:c<u&&d>m?A=k:d===m&&c<u?A=90*v:d===m&&c>u?A=-90*v:c===u&&d<m?A=180*v:c===u&&d>m&&(A=0),S.rotation=A,S.circle(0,x,1.2*C).fill({color:0,alpha:.6}).stroke({width:s+C/2.4,color:this.bonesColor})}const h=3*s;e.skeletonXY.context.moveTo(a-h,o-h).lineTo(a+h,o+h).moveTo(a+h,o-h).lineTo(a-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t],n=s.getAttachment();if(null===n||!(n instanceof me))continue;const r=n,a=new Float32Array(8);r.computeWorldVertices(s,a,0,2),e.regionAttachmentsShape.poly(Array.from(a.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof he))continue;const r=n,a=new Float32Array(r.worldVerticesLength),o=r.triangles;let l=r.hullLength;if(r.computeWorldVertices(s,0,r.worldVerticesLength,a,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],i=2*o[t+1],n=2*o[t+2];e.meshTrianglesLine.context.moveTo(a[s],a[s+1]).lineTo(a[i],a[i+1]).lineTo(a[n],a[n+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=a[l-2],s=a[l-1];for(let i=0,n=l;i<n;i+=2){const n=a[i],r=a[i+1];e.meshHullLine.context.moveTo(n,r).lineTo(t,s),t=n,s=r}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof te))continue;const r=n,a=r.worldVerticesLength,o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new Vs;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=i.polygons,r=(t,i,n)=>{if(n<3)throw new Error("Polygon must contain at least 3 vertices");const r=[],a=2*s;for(let s=0,i=t.length;s<i;s+=2){const i=t[s],n=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(i,n,a),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(i,n,a).fill({color:this.boundingBoxesCircleColor}),r.push(i,n)}e.boundingBoxesPolygon.poly(r).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=n.length;t<e;t++){const e=n[t];r(e,0,e.length)}}drawPathsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof ce))continue;const r=n;let a=r.worldVerticesLength;const o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(r.closed){const t=o[0],s=o[1],i=o[a-2],n=o[a-1];c=o[a-4],d=o[a-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,i,n,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(i,n)}a-=4;for(let t=4;t<a;t+=6){const s=o[t],i=o[t+1],n=o[t+2],r=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,i,n,r,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,i),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,r),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:oi,SpineTexture:Gs,StringSet:S,Texture:ee,TextureAtlas:re,TextureAtlasPage:oe,TextureAtlasRegion:le,TextureFilter:se,TextureRegion:ne,TextureWrap:ie,TimeKeeper:class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.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)}},Timeline:$,TrackEntry:Ut,TransformConstraint:De,TransformConstraintData:He,TransformConstraintTimeline:vt,TranslateTimeline:Z,TranslateXTimeline:tt,TranslateYTimeline:et,Triangulator:Os,Utils:P,Vector2:X,VertexAttachment:D,WindowedMean:class{constructor(t=32){this.values=void 0,this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,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}}},mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.init=function(){t.prototype.init.call(this,{pixiSpine:ui})},e}(y),fi=mi,pi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(m),gi=pi;return t.Spine=gi,t.SpineSystem=fi,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer,PIXI);window.EVA.plugin.renderer.spine=window.EVA.plugin.renderer.spine||_EVA_IIFE_spine;
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)({}).hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},_extends.apply(null,arguments)}function ownKeys(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,i)}return s}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(s),!0).forEach((function(e){_defineProperty(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ownKeys(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}function _defineProperty(t,e,s){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"==typeof e?e:e+""}function _toPrimitive(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_spine=function(t,e,s,i){"use strict";var n=Object.defineProperty,r=(t,e,s)=>(((t,e,s)=>{e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(t,"symbol"!=typeof e?e+"":e,s),s);if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var a=class{constructor(){this.entries={},this.size=0}add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},o=class{constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new o).setFromString(t)}},l=o;r(l,"WHITE",new o(1,1,1,1)),r(l,"RED",new o(1,0,0,1)),r(l,"GREEN",new o(0,1,0,1)),r(l,"BLUE",new o(0,0,1,1)),r(l,"MAGENTA",new o(1,0,1,1));var h=class{static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*h.degRad)}static sinDeg(t){return Math.sin(t*h.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*h.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 h.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},c=h;r(c,"PI",3.1415927),r(c,"PI2",2*h.PI),r(c,"invPI2",1/h.PI2),r(c,"radiansToDegrees",180/h.PI),r(c,"radDeg",h.radiansToDegrees),r(c,"degreesToRadians",h.PI/180),r(c,"degRad",h.degreesToRadians);var d=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},u=class extends d{constructor(t){super(),this.power=2,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}},m=class{static arrayCopy(t,e,s,i,n){for(let r=e,a=i;r<e+n;r++,a++)s[a]=t[r]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:m.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(m.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(m.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 m.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return m.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},f=m;r(f,"SUPPORTS_TYPED_ARRAYS","undefined"!=typeof Float32Array);var g=class{constructor(t){this.items=new Array,this.instantiator=void 0,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}},p=class{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}},x=class{constructor(t){if(this.name=void 0,!t)throw new Error("name cannot be null.");this.name=t}},b=class extends x{constructor(t){super(t),this.id=b.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVertices(t,e,s,i,n,r){s=n+(s>>1)*r;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,m=a.c,f=a.d;for(let t=e,a=n;a<s;t+=2,a+=r){let e=l[t],s=l[t+1];i[a]=e*d+s*u+h,i[a+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=a.bones;if(0==o.length)for(let t=n,e=3*d;t<s;t+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,e+=3){let t=u[h[c]],i=l[e],r=l[e+1],a=l[e+2];s+=(i*t.a+r*t.b+t.worldX)*a,n+=(i*t.c+r*t.d+t.worldY)*a}i[t]=s,i[t+1]=n}else{let t=o;for(let e=n,a=3*d,o=d<<1;e<s;e+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,a+=3,o+=2){let e=u[h[c]],i=l[a]+t[o],r=l[a+1]+t[o+1],d=l[a+2];s+=(i*e.a+r*e.b+e.worldX)*d,n+=(i*e.c+r*e.d+e.worldY)*d}i[e]=s,i[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),f.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=f.newFloatArray(this.vertices.length),f.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},w=b;r(w,"nextID",0);var y=class{constructor(t){this.id=y.nextID(),this.regions=void 0,this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(t)}copy(){let t=new y(this.regions.length);return f.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return y._nextID++}},v=y;r(v,"_nextID",0);var k,S,C,A=((k=A||{})[k.hold=0]="hold",k[k.once=1]="once",k[k.loop=2]="loop",k[k.pingpong=3]="pingpong",k[k.onceReverse=4]="onceReverse",k[k.loopReverse=5]="loopReverse",k[k.pingpongReverse=6]="pingpongReverse",k),T=[0,1,2,3,4,5,6],I=class{constructor(t,e,s){if(this.name=void 0,this.timelines=[],this.timelineIds=new a,this.duration=void 0,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,r,a,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,n,r,a,o)}},M=((S=M||{})[S.setup=0]="setup",S[S.first=1]="first",S[S.replace=2]="replace",S[S.add=3]="add",S),F=((C=F||{})[C.mixIn=0]="mixIn",C[C.mixOut=1]="mixOut",C),Y={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},P=class{constructor(t,e){this.propertyIds=void 0,this.frames=void 0,this.propertyIds=e,this.frames=f.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}},E=class extends P{constructor(t,e,s){super(t,s),this.curves=void 0,this.curves=f.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=f.newFloatArray(e);f.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*(n-2*a+l),g=.006*(3*(r-o)-i+h),p=.006*(3*(a-l)-n+c),x=2*m+g,b=2*f+p,w=.3*(r-i)+m+.16666667*g,y=.3*(a-n)+f+.16666667*p,v=i+w,k=n+y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,w+=x,y+=b,x+=g,b+=p,v+=w,k+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let r=this.frames[e],a=this.frames[e+s];return a+(t-r)/(n[i]-r)*(n[i+1]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=t){let e=n[i-2],s=n[i-1];return s+(t-e)/(n[i]-e)*(n[i+1]-s)}e+=this.getFrameEntries();let a=n[r-2],o=n[r-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}},X=class extends E{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],n=e[s+1];return n+(t-i)/(e[s+2]-i)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);switch(s){case 0:return n+r*e;case 1:case 2:r+=n-i}return i+r*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);return 0==s?n+(r-n)*e:i+(r-i)*e}getAbsoluteValue2(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}return 0==s?n+(r-n)*e:i+(r-i)*e}getScaleValue(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}let a=this.getCurveValue(t)*r;if(1==e)return 3==s?n+a-r:a;if(1==i)switch(s){case 0:return r+(Math.abs(a)*c.signum(r)-r)*e;case 1:case 2:return n+(Math.abs(a)*c.signum(n)-n)*e}else{let t=0;switch(s){case 0:return t=Math.abs(r)*c.signum(a),t+(a-t)*e;case 1:case 2:return t=Math.abs(n)*c.signum(a),t+(a-t)*e}}return n+(a-r)*e}},B=class extends E{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},R=class extends X{constructor(t,e,s){super(t,e,Y.rotate+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,r,o.rotation,o.data.rotation))}},D=class extends B{constructor(t,e,s){super(t,e,Y.x+"|"+s,Y.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.x=o.data.x,void(o.y=o.data.y);case 1:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let h=0,c=0,d=P.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(r){case 0:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case 1:case 2:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case 3:o.x+=h*n,o.y+=c*n}}},V=class extends X{constructor(t,e,s){super(t,e,Y.x+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,r,o.x,o.data.x))}},O=class extends X{constructor(t,e,s){super(t,e,Y.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,r,o.y,o.data.y))}},L=class extends B{constructor(t,e,s){super(t,e,Y.scaleX+"|"+s,Y.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,d=this.frames;if(s<d[0]){switch(r){case 0:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case 1:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u=P.search(d,s,3),m=this.curves[u/3];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2];let e=(s-t)/(d[u+3]-t);l+=(d[u+3+1]-l)*e,h+=(d[u+3+2]-h)*e;break;case 1:l=d[u+1],h=d[u+2];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==n)3==r?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(1==a)switch(r){case 0:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*c.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*c.signum(e)-e)*n;break;case 1:case 2:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*c.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*c.signum(e)-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}else switch(r){case 0:t=Math.abs(o.data.scaleX)*c.signum(l),e=Math.abs(o.data.scaleY)*c.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 1:case 2:t=Math.abs(o.scaleX)*c.signum(l),e=Math.abs(o.scaleY)*c.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}}}},_=class extends X{constructor(t,e,s){super(t,e,Y.scaleX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,r,a,o.scaleX,o.data.scaleX))}},N=class extends X{constructor(t,e,s){super(t,e,Y.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,r,a,o.scaleY,o.data.scaleY))}},U=class extends B{constructor(t,e,s){super(t,e,Y.shearX+"|"+s,Y.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case 1:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let h=0,c=0,d=P.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(r){case 0:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case 1:case 2:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case 3:o.shearX+=h*n,o.shearY+=c*n}}},q=class extends X{constructor(t,e,s){super(t,e,Y.shearX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,r,o.shearX,o.data.shearX))}},W=class extends X{constructor(t,e,s){super(t,e,Y.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,r,o.shearY,o.data.shearY))}},z=class extends P{constructor(t,e){super(t,[Y.inherit+"|"+e]),this.boneIndex=0,this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(1==a)return void(0==r&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?0!=r&&1!=r||(o.inherit=o.data.inherit):o.inherit=this.frames[P.search(l,s,2)+1]}},j=class extends E{constructor(t,e,s){super(t,e,[Y.rgb+"|"+s,Y.alpha+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r}apply(t,e,s,i,n,r,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(r){case 0:return void h.setFromColor(t);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n)}return}let c=0,d=0,u=0,m=0,f=P.search(l,s,5),g=this.curves[f/5];switch(g){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==n?h.set(c,d,u,m):(0==r&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}},G=class extends E{constructor(t,e,s){super(t,e,[Y.rgb+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,r,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(r){case 0:return h.r=t.r,h.g=t.g,void(h.b=t.b);case 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n}return}let c=0,d=0,u=0,m=P.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==n)h.r=c,h.g=d,h.b=u;else{if(0==r){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*n,h.g+=(d-h.g)*n,h.b+=(u-h.b)*n}}},$=class extends X{constructor(t,e,s){super(t,e,Y.alpha+"|"+s),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,r,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(r){case 0:return void(l.a=t.a);case 1:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(0==r&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}},H=class extends E{constructor(t,e,s){super(t,e,[Y.rgb+"|"+s,Y.alpha+"|"+s,Y.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,r,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,n,r,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(r){case 0:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n),c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=0,b=P.search(l,s,8),w=this.curves[b>>3];switch(w){case 0:let t=l[b];d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];let e=(s-t)/(l[b+8]-t);d+=(l[b+8+1]-d)*e,u+=(l[b+8+2]-u)*e,m+=(l[b+8+3]-m)*e,f+=(l[b+8+4]-f)*e,g+=(l[b+8+5]-g)*e,p+=(l[b+8+6]-p)*e,x+=(l[b+8+7]-x)*e;break;case 1:d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];break;default:d=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+36-2),f=this.getBezierValue(s,b,4,w+54-2),g=this.getBezierValue(s,b,5,w+72-2),p=this.getBezierValue(s,b,6,w+90-2),x=this.getBezierValue(s,b,7,w+108-2)}if(1==n)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(0==r){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)*n,(u-h.g)*n,(m-h.b)*n,(f-h.a)*n),c.r+=(g-c.r)*n,c.g+=(p-c.g)*n,c.b+=(x-c.b)*n}}},K=class extends E{constructor(t,e,s){super(t,e,[Y.rgb+"|"+s,Y.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,i,n,r,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(r){case 0: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 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n,c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=P.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,b-2),u=this.getBezierValue(s,x,2,b+18-2),m=this.getBezierValue(s,x,3,b+36-2),f=this.getBezierValue(s,x,4,b+54-2),g=this.getBezierValue(s,x,5,b+72-2),p=this.getBezierValue(s,x,6,b+90-2)}if(1==n)h.r=d,h.g=u,h.b=m,c.r=f,c.g=g,c.b=p;else{if(0==r){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)*n,h.g+=(u-h.g)*n,h.b+=(m-h.b)*n,c.r+=(f-c.r)*n,c.g+=(g-c.g)*n,c.b+=(p-c.b)*n}}},J=class extends P{constructor(t,e){super(t,[Y.attachment+"|"+e]),this.slotIndex=0,this.attachmentNames=void 0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];o.bone.active&&(1!=a?s<this.frames[0]?0!=r&&1!=r||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[P.search1(this.frames,s)]):0==r&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Q=class extends E{constructor(t,e,s,i){super(t,e,[Y.deform+"|"+s+"|"+i.id]),this.slotIndex=0,this.attachment=void 0,this.vertices=void 0,this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*l-.06*a,g=.006*(3*(r-o)-i+h),p=.018*(a-l+.33333333),x=2*m+g,b=2*f+p,w=.3*(r-i)+m+.16666667*g,y=.3*a+f+.16666667*p,v=i+w,k=y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,w+=x,y+=b,x+=g,b+=p,v+=w,k+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let e=s[i-2],n=s[i-1];return n+(t-e)/(s[i]-e)*(s[i+1]-n)}let r=s[n-2],a=s[n-1];return a+(1-a)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof w)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(r=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(r){case 0:return void(h.length=0);case 1:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(m=0;m<d;m++)h[m]*=n}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*n}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==n)if(3==r){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else f.arrayCopy(t,0,h,0,d);else switch(r){case 0:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++){let i=s[e];h[e]=i+(t[e]-i)*n}}break}case 1:case 2:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case 3:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*n}}return}let g=P.search1(u,s),p=this.getCurvePercent(s,g),x=c[g],b=c[g+1];if(1==n)if(3==r){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=x[t];h[t]+=e+(b[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=x[t];h[t]+=s+(b[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=x[t];h[t]=e+(b[t]-e)*p}else switch(r){case 0:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=x[t];h[t]=(e+(b[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=x[t],i=e[t];h[t]=i+(s+(b[t]-s)*p-i)*n}}break}case 1:case 2:for(let t=0;t<d;t++){let e=x[t];h[t]+=(e+(b[t]-e)*p-h[t])*n}break;case 3:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=x[t];h[t]+=(e+(b[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=x[t];h[t]+=(s+(b[t]-s)*p-e[t])*n}}}}},Z=class extends P{constructor(t){super(t,Z.propertyIds),this.events=void 0,this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,r,a){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,r,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=P.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)i.push(this.events[h])}},tt=Z;r(tt,"propertyIds",[""+Y.event]);var et=class extends P{constructor(t){super(t,et.propertyIds),this.drawOrders=void 0,this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,r,a){if(1==a)return void(0==r&&f.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(0!=r&&1!=r||f.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=P.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,i=l.length;t<i;t++)e[t]=s[l[t]]}else f.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},st=et;r(st,"propertyIds",[""+Y.drawOrder]);var it=class extends E{constructor(t,e,s){super(t,e,[Y.ikConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,r,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,r,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0: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 1:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=P.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)}0==r?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,1==a?(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)*n,o.softness+=(c-o.softness)*n,0==a&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},nt=class extends E{constructor(t,e,s){super(t,e,[Y.transformConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=r,l[t+5]=a,l[t+6]=o}apply(t,e,s,i,n,r,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(r){case 0: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 1:o.mixRotate+=(t.mixRotate-o.mixRotate)*n,o.mixX+=(t.mixX-o.mixX)*n,o.mixY+=(t.mixY-o.mixY)*n,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(t.mixShearY-o.mixShearY)*n}return}let g=P.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*n,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*n,o.mixShearY=t.mixShearY+(m-t.mixShearY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n,o.mixScaleX+=(d-o.mixScaleX)*n,o.mixScaleY+=(u-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}},rt=class extends X{constructor(t,e,s){super(t,e,Y.pathConstraintPosition+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,r,o.position,o.data.position))}},at=class extends X{constructor(t,e,s){super(t,e,Y.pathConstraintSpacing+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,r,o.spacing,o.data.spacing))}},ot=class extends E{constructor(t,e,s){super(t,e,[Y.pathConstraintMix+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let r=this.frames;r[t<<=2]=e,r[t+1]=s,r[t+2]=i,r[t+3]=n}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(r){case 0:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case 1:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u=P.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n}},lt=class extends X{constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,n,r,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,r,this.get(o),this.setup(o)))}},ht=class extends lt{constructor(t,e,s){super(t,e,s,Y.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ct=class extends lt{constructor(t,e,s){super(t,e,s,Y.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},dt=class extends lt{constructor(t,e,s){super(t,e,s,Y.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ut=class extends lt{constructor(t,e,s){super(t,e,s,Y.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}},mt=class extends lt{constructor(t,e,s){super(t,e,s,Y.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ft=class extends lt{constructor(t,e,s){super(t,e,s,Y.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},gt=class extends lt{constructor(t,e,s){super(t,e,s,Y.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},pt=class extends P{constructor(t,e){super(t,pt.propertyIds),this.constraintIndex=void 0,this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,r,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,[],n,r,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[P.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},xt=pt;r(xt,"propertyIds",[Y.physicsConstraintReset.toString()]);var bt=class extends P{constructor(t,e,s){super(t,[Y.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=void 0,this.attachment=void 0,this.slotIndex=e,this.attachment=s}getFrameEntries(){return bt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let r=this.frames;r[t*=bt.ENTRIES]=e,r[t+bt.MODE]=s|i<<4,r[t+bt.DELAY]=n}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof w&&l.timelineAttachment==h))return;if(1==a)return void(0==r&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(0!=r&&1!=r||(o.sequenceIndex=-1));let d=P.search(c,s,bt.ENTRIES),u=c[d],m=c[d+bt.MODE],f=c[d+bt.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,x=T[15&m];if(0!=x)switch(g+=(s-u)/f+1e-5|0,x){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}},wt=bt;r(wt,"ENTRIES",3),r(wt,"MODE",1),r(wt,"DELAY",2);var yt=class{static emptyAnimation(){return yt._emptyAnimation}constructor(t){this.data=void 0,this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Tt(this),this.propertyIDs=new a,this.animationsChanged=!1,this.trackEntryPool=new g((()=>new At)),this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=t*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let r=i.next;if(r){let e=i.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*r.timeScale,i.trackTime+=n,this.setCurrent(s,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,-1!=t.nextTrackLast){const e=0==t.mixTime&&0==s.mixTime;if(t.mixTime>=t.mixDuration||e)return(0==s.totalAlpha||0==t.mixDuration||e)&&(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i}return s.trackTime+=e*s.timeScale,t.mixTime+=e,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,i=!1;for(let r=0,a=s.length;r<a;r++){let a=s[r];if(!a||a.delay>0)continue;i=!0;let o=0==r?1:a.mixBlend,l=a.alpha;a.mixingFrom?l*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(l=0);let h=l>=a.alphaAttachmentThreshold,c=a.animationLast,d=a.getAnimationTime(),u=d,m=e;a.reverse&&(u=a.animation.duration-u,m=null);let g=a.animation.timelines,p=g.length;if(0==r&&1==l||3==o){0==r&&(h=!0);for(let e=0;e<p;e++){f.webkit602BugfixHelper(l,o);var n=g[e];n instanceof J?this.applyAttachmentTimeline(n,t,u,o,h):n.apply(t,c,u,m,l,o,0)}}else{let e=a.timelineMode,s=a.shortestRotation,i=!s&&a.timelinesRotation.length!=p<<1;i&&(a.timelinesRotation.length=p<<1);for(let n=0;n<p;n++){let r=g[n],d=e[n]==Mt?o:0;!s&&r instanceof R?this.applyRotateTimeline(r,t,u,l,d,a.timelinesRotation,n<<1,i):r instanceof J?this.applyAttachmentTimeline(r,t,u,o,h):(f.webkit602BugfixHelper(l,o),r.apply(t,c,u,m,l,d,0))}}this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}for(var r=this.unkeyedState+Xt,a=t.slots,o=0,l=t.slots.length;o<l;o++){var h=a[o];if(h.attachmentState==r){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;0==t.mixDuration?(n=1,1==s&&(s=0)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),1!=s&&(s=i.mixBlend));let r=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,o=i.animation.timelines,l=o.length,h=i.alpha*t.interruptAlpha,c=h*(1-n),d=i.animationLast,u=i.getAnimationTime(),m=u,g=null;if(i.reverse?m=i.animation.duration-m:n<i.eventThreshold&&(g=this.events),3==s)for(let t=0;t<l;t++)o[t].apply(e,d,m,g,c,s,1);else{let t=i.timelineMode,n=i.timelineHoldMix,u=i.shortestRotation,p=!u&&i.timelinesRotation.length!=l<<1;p&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let x=0;x<l;x++){let l,b=o[x],w=1,y=0;switch(t[x]){case Mt:if(!a&&b instanceof st)continue;l=s,y=c;break;case Ft:l=0,y=c;break;case Yt:l=s,y=h;break;case Pt:l=0,y=h;break;default:l=0;let t=n[x];y=h*Math.max(0,1-t.mixTime/t.mixDuration)}i.totalAlpha+=y,!u&&b instanceof R?this.applyRotateTimeline(b,e,m,y,l,i.timelinesRotation,x<<1,p):b instanceof J?this.applyAttachmentTimeline(b,e,m,l,r&&y>=i.alphaAttachmentThreshold):(f.webkit602BugfixHelper(y,s),a&&b instanceof st&&0==l&&(w=0),b.apply(e,d,m,g,y,l,w))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var r=e.slots[t.slotIndex];r.bone.active&&(s<t.frames[0]?0!=i&&1!=i||this.setAttachment(e,r,r.data.attachmentName,n):this.setAttachment(e,r,t.attachmentNames[P.search1(t.frames,s)],n),r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+Xt))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Bt)}applyRotateTimeline(t,e,s,i,n,r,a,o){if(o&&(r[a]=0),1==i)return void t.apply(e,0,s,null,1,n,0);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,d=0;if(s<t.frames[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,d=l.data.rotation}else h=0==n?l.data.rotation:l.rotation,d=l.data.rotation+t.getCurveValue(s);let u=0,m=d-h;if(m-=360*Math.ceil(m/360-.5),0==m)u=r[a];else{let t=0,e=0;o?(t=0,e=m):(t=r[a],e=r[a+1]);let s=t-t%360;u=m+s;let i=m>=0,n=t>=0;Math.abs(e)<=90&&c.signum(e)!=c.signum(m)&&(Math.abs(t-s)>180?(u+=360*c.signum(t),n=i):0!=s?u-=360*c.signum(t):n=i),n!=i&&(u+=360*c.signum(t)),r[a]=u}r[a+1]=m,l.rotation=h+u*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,r=t.trackLast%n,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<r)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==n)h=!0;else{const e=Math.floor(t.trackTime/n);h=e>0&&e>Math.floor(t.trackLast/n)}else h=e>=i&&t.animationLast<i;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 i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let r=this.trackEntry(t,e,s,n);return this.setCurrent(t,r,i),this.queue.drain(),r}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let r=this.trackEntry(t,e,s,n);return n?(n.next=r,r.previous=n,i<=0&&(i+=n.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=i,r}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,yt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,yt.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(f.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}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&&3==s.mixBlend||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let r=t.timelineHoldMix;r.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)n[t]=a.addAll(s[t].getPropertyIds())?Pt:Yt;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(a.addAll(l))if(!e||i instanceof J||i instanceof st||i instanceof tt||!e.animation.hasTimeline(l))n[o]=Ft;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=Et,r[o]=s;continue t}break}n[o]=Pt}else n[o]=Mt}}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()}},vt=yt;r(vt,"_emptyAnimation",new I("<empty>",[],0));var kt,St,Ct,At=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.mixAttachmentThreshold=0,this.alphaAttachmentThreshold=0,this.mixDrawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this._mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=2,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}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}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}},Tt=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=void 0,this.animState=t}start(t){this.objects.push(It.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(It.interrupt),this.objects.push(t)}end(t){this.objects.push(It.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(It.dispose),this.objects.push(t)}complete(t){this.objects.push(It.complete),this.objects.push(t)}event(t,e){this.objects.push(It.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],n=t[s+1];switch(i){case It.start:n.listener&&n.listener.start&&n.listener.start(n);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(n)}break;case It.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(n)}break;case It.end:n.listener&&n.listener.end&&n.listener.end(n);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(n)}case It.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(n)}this.animState.trackEntryPool.free(n);break;case It.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(n)}break;case It.event:let i=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,i);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,i)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},It=((kt=It||{})[kt.start=0]="start",kt[kt.interrupt=1]="interrupt",kt[kt.end=2]="end",kt[kt.dispose=3]="dispose",kt[kt.complete=4]="complete",kt[kt.event=5]="event",kt),Mt=0,Ft=1,Yt=2,Pt=3,Et=4,Xt=1,Bt=2,Rt=class{constructor(t){if(this.skeletonData=void 0,this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}},Dt=class extends w{constructor(t){super(t),this.color=new l(1,1,1,1)}copy(){let t=new Dt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Vt=class extends w{constructor(t){super(t),this.endSlot=null,this.color=new l(.2275,.2275,.8078,1)}copy(){let t=new Vt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Ot=class{constructor(t){this._image=void 0,this._image=t}getImage(){return this._image}},Lt=((St=Lt||{})[St.Nearest=9728]="Nearest",St[St.Linear=9729]="Linear",St[St.MipMap=9987]="MipMap",St[St.MipMapNearestNearest=9984]="MipMapNearestNearest",St[St.MipMapLinearNearest=9985]="MipMapLinearNearest",St[St.MipMapNearestLinear=9986]="MipMapNearestLinear",St[St.MipMapLinearLinear=9987]="MipMapLinearLinear",St),_t=((Ct=_t||{})[Ct.MirroredRepeat=33648]="MirroredRepeat",Ct[Ct.ClampToEdge=33071]="ClampToEdge",Ct[Ct.Repeat=10497]="Repeat",Ct),Nt=class{constructor(){this.texture=void 0,this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},Ut=class{constructor(t){this.pages=new Array,this.regions=new Array;let e=new qt(t),s=new Array(4),i={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=f.enumValue(Lt,s[1]),t.magFilter=f.enumValue(Lt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=10497),-1!=s[1].indexOf("y")&&(t.vWrap=10497)},pma:t=>{t.pma="true"==s[1]}};var n={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 r=e.readLine();for(;r&&0==r.trim().length;)r=e.readLine();for(;r&&0!=r.trim().length&&0!=e.readEntry(s,r);)r=e.readLine();let a=null,o=null,l=null;for(;null!==r;)if(0==r.trim().length)a=null,r=e.readLine();else if(a){let t=new zt(a,r);for(;;){let i=e.readEntry(s,r=e.readLine());if(0==i)break;let a=n[s[0]];if(a)a(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<i;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/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 Wt(r.trim());0!=e.readEntry(s,r=e.readLine());){let t=i[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 e=0;e<this.pages.length;e++){var t;null===(t=this.pages[e].texture)||void 0===t||t.dispose()}}},qt=class{constructor(t){this.lines=void 0,this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let s=e.indexOf(",",n);if(-1==s)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,s-n).trim(),n=s+1,4==i)return 4}}},Wt=class{constructor(t){this.name=void 0,this.minFilter=9728,this.magFilter=9728,this.uWrap=33071,this.vWrap=33071,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,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}},zt=class extends Nt{constructor(t,e){super(),this.page=void 0,this.name=void 0,this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=t,this.name=e,t.regions.push(this)}},jt=class extends w{constructor(t,e){super(t),this.region=null,this.path=void 0,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new l(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new l(0,0,0,0),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=f.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,r=0,a=0;if(this.region instanceof zt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*r,e[o+1]=n+(1-t[o])*a;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,r=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*r,e[o+1]=n+(1-t[o+1])*a;return;case 270:i-=o.offsetY/h,n-=o.offsetX/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*r,e[o+1]=n+t[o]*a;return}i-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,r=o.originalWidth/h,a=o.originalHeight/c}else this.region?(r=this.region.u2-i,a=this.region.v2-n):(i=n=0,r=a=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*r,e[o+1]=n+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 jt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),f.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),f.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),f.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),f.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,r){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,r)}newLinkedMesh(){let t=new jt(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}},Gt=class extends w{constructor(t){super(t),this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new l(1,1,1,1)}copy(){let t=new Gt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),f.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},$t=class extends w{constructor(t){super(t),this.x=0,this.y=0,this.rotation=0,this.color=new l(.38,.94,0,1)}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*c.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,r=s*t.c+i*t.d;return c.atan2Deg(r,n)}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}},Ht=class extends x{constructor(t,e){super(t),this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new l(1,1,1,1),this.path=void 0,this.region=null,this.sequence=null,this.offset=f.newFloatArray(8),this.uvs=f.newFloatArray(8),this.tempColor=new l(1,1,1,1),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,r=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,o=r+this.region.height*i,l=this.rotation*c.degRad,h=Math.cos(l),d=Math.sin(l),u=this.x,m=this.y,f=n*h+u,g=n*d,p=r*h+m,x=r*d,b=a*h+u,w=a*d,y=o*h+m,v=o*d,k=this.offset;k[0]=f-x,k[1]=p+g,k[2]=f-v,k[3]=y+g,k[4]=b-v,k[5]=y+w,k[6]=b-x,k[7]=p+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,r=this.offset,a=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=r[0],m=r[1],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[2],m=r[3],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[4],m=r[5],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[6],m=r[7],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o}copy(){let t=new Ht(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,f.arrayCopy(this.uvs,0,t.uvs,0,8),f.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}},Kt=Ht;r(Kt,"X1",0),r(Kt,"Y1",1),r(Kt,"C1R",2),r(Kt,"C1G",3),r(Kt,"C1B",4),r(Kt,"C1A",5),r(Kt,"U1",6),r(Kt,"V1",7),r(Kt,"X2",8),r(Kt,"Y2",9),r(Kt,"C2R",10),r(Kt,"C2G",11),r(Kt,"C2B",12),r(Kt,"C2A",13),r(Kt,"U2",14),r(Kt,"V2",15),r(Kt,"X3",16),r(Kt,"Y3",17),r(Kt,"C3R",18),r(Kt,"C3G",19),r(Kt,"C3B",20),r(Kt,"C3A",21),r(Kt,"U3",22),r(Kt,"V3",23),r(Kt,"X4",24),r(Kt,"Y4",25),r(Kt,"C4R",26),r(Kt,"C4G",27),r(Kt,"C4B",28),r(Kt,"C4A",29),r(Kt,"U4",30),r(Kt,"V4",31);var Jt,Qt,Zt,te,ee=class{constructor(t){this.atlas=void 0,this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,r=i.length;n<r;n++){let r=s.getPath(e,n),a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (sequence: "+t+")");i[n]=a}}newRegionAttachment(t,e,s,i){let n=new Kt(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,i){let n=new jt(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new Dt(e)}newPathAttachment(t,e){return new Gt(e)}newPointAttachment(t,e){return new $t(e)}newClippingAttachment(t,e){return new Vt(e)}},se=class{constructor(t,e,s){if(this.index=0,this.name=void 0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.inherit=ie.Normal,this.skinRequired=!1,this.color=new l,this.icon=void 0,this.visible=!1,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}},ie=((Jt=ie||{})[Jt.Normal=0]="Normal",Jt[Jt.OnlyTranslation=1]="OnlyTranslation",Jt[Jt.NoRotationOrReflection=2]="NoRotationOrReflection",Jt[Jt.NoScale=3]="NoScale",Jt[Jt.NoScaleOrReflection=4]="NoScaleOrReflection",Jt),ne=class{constructor(t,e,s){if(this.data=void 0,this.skeleton=void 0,this.parent=null,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.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.inherit=0,this.sorted=!1,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,r,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=r,this.ashearY=a;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,d=(s+r)*c.degRad,u=(s+90+a)*c.degRad;return this.a=Math.cos(d)*i*l,this.b=Math.cos(u)*n*l,this.c=Math.sin(d)*i*h,this.d=Math.sin(u)*n*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,d=o.c,u=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=d*t+u*e+o.worldY,this.inherit){case 0:{const t=(s+r)*c.degRad,e=(s+90+a)*c.degRad,o=Math.cos(t)*i,m=Math.cos(e)*n,f=Math.sin(t)*i,g=Math.sin(e)*n;return this.a=l*o+h*f,this.b=l*m+h*g,this.c=d*o+u*f,void(this.d=d*m+u*g)}case 1:{const t=(s+r)*c.degRad,e=(s+90+a)*c.degRad;this.a=Math.cos(t)*i,this.b=Math.cos(e)*n,this.c=Math.sin(t)*i,this.d=Math.sin(e)*n;break}case 2:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,d*=e;let o=l*l+d*d,m=0;o>1e-4?(o=Math.abs(l*u*e-h*t*d)/o,h=d*o,u=l*o,m=Math.atan2(d,l)*c.radDeg):(l=0,d=0,m=90-Math.atan2(u,h)*c.radDeg);const f=(s+r-m)*c.degRad,g=(s+a-m+90)*c.degRad,p=Math.cos(f)*i,x=Math.cos(g)*n,b=Math.sin(f)*i,w=Math.sin(g)*n;this.a=l*p-h*b,this.b=l*x-h*w,this.c=d*p+u*b,this.d=d*x+u*w;break}case 3:case 4:{s*=c.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,m=(d*t+u*e)/this.skeleton.scaleY,f=Math.sqrt(o*o+m*m);f>1e-5&&(f=1/f),o*=f,m*=f,f=Math.sqrt(o*o+m*m),3==this.inherit&&l*u-h*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(f=-f),s=Math.PI/2+Math.atan2(m,o);const g=Math.cos(s)*f,p=Math.sin(s)*f;r*=c.degRad,a=(90+a)*c.degRad;const x=Math.cos(r)*i,b=Math.cos(a)*n,w=Math.sin(r)*i,y=Math.sin(a)*n;this.a=o*x+g*w,this.b=o*b+g*y,this.c=m*x+p*w,this.d=m*b+p*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)*c.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)*c.radDeg);let e,s,i,n,r=t.a,a=t.b,o=t.c,l=t.d,h=1/(r*l-a*o),d=l*h,u=a*h,m=o*h,f=r*h,g=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=g*d-p*u,this.ay=p*f-g*m,1==this.inherit)e=this.a,s=this.b,i=this.c,n=this.d;else{switch(this.inherit){case 2:{let t=Math.abs(r*l-a*o)/(r*r+o*o);a=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=r*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(r*l-a*o),d=l*h,u=a*h;break}case 3:case 4:let t=c.cosDeg(this.rotation),e=c.sinDeg(this.rotation);r=(r*t+a*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(r*r+o*o);s>1e-5&&(s=1/s),r*=s,o*=s,s=Math.sqrt(r*r+o*o),3==this.inherit&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let i=c.PI/2+Math.atan2(o,r);a=Math.cos(i)*s,l=Math.sin(i)*s,h=1/(r*l-a*o),d=l*h,u=a*h,m=o*h,f=r*h}e=d*this.a-u*this.c,s=d*this.b-u*this.d,i=f*this.c-m*this.a,n=f*this.d-m*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+i*i),this.ascaleX>1e-4){let t=e*n-s*i;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+i*n,t)*c.radDeg,this.arotation=Math.atan2(i,e)*c.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,s)*c.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*c.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*c.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=c.sinDeg(t),s=c.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*c.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=c.sinDeg(t),s=c.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*c.radDeg}rotateWorld(t){t*=c.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}},re=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},ae=class{constructor(){this.callbacks={},this.rawDataUris={}}dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let n=()=>{this.finish(t,i.status,i.responseText)};i.onload=n,i.onerror=n,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let n=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):n()},i.onerror=n,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=i.length;t<e;t+=2)i[t].apply(null,n)}},oe=class{constructor(t,e){if(this.data=void 0,this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},le=class{constructor(t){this.name=void 0,this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}},he=class{constructor(t,e){if(this.data=void 0,this.bones=void 0,this.target=void 0,this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,i,n,r,a){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,d=o.c,u=o.d,m=-t.ashearX-t.arotation,f=0,g=0;switch(t.inherit){case 1:f=(e-t.worldX)*c.signum(t.skeleton.scaleX),g=(s-t.worldY)*c.signum(t.skeleton.scaleY);break;case 2:let i=Math.abs(l*u-h*d)/Math.max(1e-4,l*l+d*d),n=l/t.skeleton.scaleX,r=d/t.skeleton.scaleY;h=-r*i*t.skeleton.scaleX,u=n*i*t.skeleton.scaleY,m+=Math.atan2(r,n)*c.radDeg;default:let a=e-o.worldX,p=s-o.worldY,x=l*u-h*d;Math.abs(x)<=1e-4?(f=0,g=0):(f=(a*u-p*h)/x-t.ax,g=(p*l-a*d)/x-t.ay)}m+=Math.atan2(g,f)*c.radDeg,t.ascaleX<0&&(m+=180),m>180?m-=360:m<-180&&(m+=360);let p=t.ascaleX,x=t.ascaleY;if(i||n){switch(t.inherit){case 3:case 4:f=e-t.worldX,g=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=f*f+g*g;if(i&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*a+1;p*=e,r&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*a,p,x,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,r,a,o,l){if(0!=t.inherit||0!=e.inherit)return;let h=t.ax,d=t.ay,u=t.ascaleX,m=t.ascaleY,f=u,g=m,p=e.ascaleX,x=0,b=0,w=0;u<0?(u=-u,x=180,w=-1):(x=0,w=1),m<0&&(m=-m,w=-w),p<0?(p=-p,b=180):b=0;let y=e.ax,v=0,k=0,S=0,C=t.a,A=t.b,T=t.c,I=t.d,M=Math.abs(u-m)<=1e-4;!M||r?(v=0,k=C*y+t.worldX,S=T*y+t.worldY):(v=e.ay,k=C*y+A*v+t.worldX,S=T*y+I*v+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,A=F.b,T=F.c,I=F.d;let Y=C*I-A*T,P=k-F.worldX,E=S-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let X,B,R=(P*I-E*A)*Y-h,D=(E*C-P*T)*Y-d,V=Math.sqrt(R*R+D*D),O=e.data.length*p;if(V<1e-4)return this.apply1(t,s,i,!1,r,!1,l),void e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);P=s-F.worldX,E=i-F.worldY;let L=(P*I-E*A)*Y-h,_=(E*C-P*T)*Y-d,N=L*L+_*_;if(0!=o){o*=u*(p+1)*.5;let t=Math.sqrt(N),e=t-V-O*u+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,L-=s*L,_-=s*_,N=L*L+_*_}}t:if(M){O*=u;let t=(N-V*V-O*O)/(2*V*O);t<-1?(t=-1,B=Math.PI*n):t>1?(t=1,B=0,r&&(C=(Math.sqrt(N)/(V+O)-1)*l+1,f*=C,a&&(g*=C))):B=Math.acos(t)*n,C=V+O*t,A=O*Math.sin(B),X=Math.atan2(_*C-L*A,L*C+_*A)}else{C=u*O,A=m*O;let t=C*C,e=A*A,s=Math.atan2(_,L);T=e*V*V+t*N-t*e;let i=-2*e*V,r=e-t;if(I=i*i-4*r*T,I>=0){let t=Math.sqrt(I);i<0&&(t=-t),t=.5*-(i+t);let e=t/r,a=T/t,o=Math.abs(e)<Math.abs(a)?e:a;if(e=N-o*o,e>=0){E=Math.sqrt(e)*n,X=s-Math.atan2(E,o),B=Math.atan2(E/m,(o-V)/u);break t}}let a=c.PI,o=V-C,l=o*o,h=0,d=0,f=V+C,g=f*f,p=0;T=-C*V/(t-e),T>=-1&&T<=1&&(T=Math.acos(T),P=C*Math.cos(T)+V,E=A*Math.sin(T),I=P*P+E*E,I<l&&(a=T,l=I,o=P,h=E),I>g&&(d=T,g=I,f=P,p=E)),N<=.5*(l+g)?(X=s-Math.atan2(h*n,o),B=a*n):(X=s-Math.atan2(p*n,f),B=d*n)}let U=Math.atan2(v,y)*w,q=t.arotation;X=(X-U)*c.radDeg+x-q,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(h,d,q+X*l,f,g,0,0),q=e.arotation,B=((B+U)*c.radDeg-e.ashearX)*w+b-q,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(y,v,q+B*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},ce=class extends re{set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=0,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=0,this.softness=0}},de=class extends re{set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ue.Fixed,this.spacingMode=me.Fixed,this.rotateMode=fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}},ue=((Qt=ue||{})[Qt.Fixed=0]="Fixed",Qt[Qt.Percent=1]="Percent",Qt),me=((Zt=me||{})[Zt.Length=0]="Length",Zt[Zt.Fixed=1]="Fixed",Zt[Zt.Percent=2]="Percent",Zt[Zt.Proportional=3]="Proportional",Zt),fe=((te=fe||{})[te.Tangent=0]="Tangent",te[te.Chain=1]="Chain",te[te.ChainScale=2]="ChainScale",te),ge=class{constructor(t,e){if(this.data=void 0,this.bones=void 0,this.target=void 0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=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,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof Gt))return;let s=this.mixRotate,i=this.mixX,n=this.mixY;if(0==s&&0==i&&0==n)return;let r=this.data,a=0==r.rotateMode,o=2==r.rotateMode,l=this.bones,h=l.length,d=a?h:h+1,u=f.setArraySize(this.spaces,d),m=o?this.lengths=f.setArraySize(this.lengths,h):[],g=this.spacing;switch(r.spacingMode){case 2:if(o)for(let t=0,e=d-1;t<e;t++){let e=l[t],s=e.data.length,i=s*e.a,n=s*e.c;m[t]=Math.sqrt(i*i+n*n)}f.arrayFill(u,1,d,g);break;case 3:let t=0;for(let e=0,s=d-1;e<s;){let s=l[e],i=s.data.length;if(i<ge.epsilon)o&&(m[e]=0),u[++e]=g;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(m[e]=a),u[++e]=a,t+=a}}if(t>0){t=d/t*g;for(let e=1;e<d;e++)u[e]*=t}break;default:let e=0==r.spacingMode;for(let t=0,s=d-1;t<s;){let s=l[t],i=s.data.length;if(i<ge.epsilon)o&&(m[t]=0),u[++t]=g;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(m[t]=a),u[++t]=(e?i+g:g)*a/i}}}let p=this.computeWorldPositions(e,d,a),x=p[0],b=p[1],w=r.offsetRotation,y=!1;if(0==w)y=1==r.rotateMode;else{y=!1;let t=this.target.bone;w*=t.a*t.d-t.b*t.c>0?c.degRad:-c.degRad}for(let t=0,e=3;t<h;t++,e+=3){let r=l[t];r.worldX+=(x-r.worldX)*i,r.worldY+=(b-r.worldY)*n;let h=p[e],d=p[e+1],f=h-x,g=d-b;if(o){let e=m[t];if(0!=e){let t=(Math.sqrt(f*f+g*g)/e-1)*s+1;r.a*=t,r.c*=t}}if(x=h,b=d,s>0){let i=r.a,n=r.b,o=r.c,l=r.d,h=0,d=0,m=0;if(h=a?p[e-1]:0==u[t+1]?p[e+2]:Math.atan2(g,f),h-=Math.atan2(o,i),y){d=Math.cos(h),m=Math.sin(h);let t=r.data.length;x+=(t*(d*i-m*o)-f)*s,b+=(t*(m*i+d*o)-g)*s}else h+=w;h>c.PI?h-=c.PI2:h<-c.PI&&(h+=c.PI2),h*=s,d=Math.cos(h),m=Math.sin(h),r.a=d*i-m*o,r.b=d*n-m*l,r.c=m*i+d*o,r.d=m*n+d*l}r.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,n=this.position,r=this.spaces,a=f.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=ge.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,g=u[c];switch(1==this.data.positionMode&&(n*=g),this.data.spacingMode){case 2:m=g;break;case 3:m=g/e;break;default:m=1}o=f.setArraySize(this.world,8);for(let f=0,p=0,x=0;f<e;f++,p+=3){let e=r[f]*m;n+=e;let b=n;if(l)b%=g,b<0&&(b+=g),x=0;else{if(b<0){d!=ge.BEFORE&&(d=ge.BEFORE,t.computeWorldVertices(i,2,4,o,0,2)),this.addBeforePosition(b,o,0,a,p);continue}if(b>g){d!=ge.AFTER&&(d=ge.AFTER,t.computeWorldVertices(i,h-6,4,o,0,2)),this.addAfterPosition(b-g,o,0,a,p);continue}}for(;;x++){let t=u[x];if(!(b>t)){if(0==x)b/=t;else{let e=u[x-1];b=(b-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(i,h-4,4,o,0,2),t.computeWorldVertices(i,0,4,o,4,2)):t.computeWorldVertices(i,6*x+2,8,o,0,2)),this.addCurvePosition(b,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,p,s||f>0&&0==e)}return a}l?(h+=2,o=f.setArraySize(this.world,h),t.computeWorldVertices(i,2,h-4,o,0,2),t.computeWorldVertices(i,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=f.setArraySize(this.world,h),t.computeWorldVertices(i,2,h,o,0,2));let u,m=f.setArraySize(this.curves,c),g=0,p=o[0],x=o[1],b=0,w=0,y=0,v=0,k=0,S=0,C=0,A=0,T=0,I=0,M=0,F=0,Y=0,P=0;for(let t=0,e=2;t<c;t++,e+=6)b=o[e],w=o[e+1],y=o[e+2],v=o[e+3],k=o[e+4],S=o[e+5],C=.1875*(p-2*b+y),A=.1875*(x-2*w+v),T=.09375*(3*(b-y)-p+k),I=.09375*(3*(w-v)-x+S),M=2*C+T,F=2*A+I,Y=.75*(b-p)+C+.16666667*T,P=.75*(w-x)+A+.16666667*I,g+=Math.sqrt(Y*Y+P*P),Y+=M,P+=F,M+=T,F+=I,g+=Math.sqrt(Y*Y+P*P),Y+=M,P+=F,g+=Math.sqrt(Y*Y+P*P),Y+=M+T,P+=F+I,g+=Math.sqrt(Y*Y+P*P),m[t]=g,p=k,x=S;switch(1==this.data.positionMode&&(n*=g),this.data.spacingMode){case 2:u=g;break;case 3:u=g/e;break;default:u=1}let E=this.segments,X=0;for(let t=0,i=0,c=0,f=0;t<e;t++,i+=3){let e=r[t]*u;n+=e;let B=n;if(l)B%=g,B<0&&(B+=g),c=0;else{if(B<0){this.addBeforePosition(B,o,0,a,i);continue}if(B>g){this.addAfterPosition(B-g,o,h-4,a,i);continue}}for(;;c++){let t=m[c];if(!(B>t)){if(0==c)B/=t;else{let e=m[c-1];B=(B-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],x=o[t+1],b=o[t+2],w=o[t+3],y=o[t+4],v=o[t+5],k=o[t+6],S=o[t+7],C=.03*(p-2*b+y),A=.03*(x-2*w+v),T=.006*(3*(b-y)-p+k),I=.006*(3*(w-v)-x+S),M=2*C+T,F=2*A+I,Y=.3*(b-p)+C+.16666667*T,P=.3*(w-x)+A+.16666667*I,X=Math.sqrt(Y*Y+P*P),E[0]=X,t=1;t<8;t++)Y+=M,P+=F,M+=T,F+=I,X+=Math.sqrt(Y*Y+P*P),E[t]=X;Y+=M,P+=F,X+=Math.sqrt(Y*Y+P*P),E[8]=X,Y+=M+T,P+=F+I,X+=Math.sqrt(Y*Y+P*P),E[9]=X,f=0}for(B*=X;;f++){let t=E[f];if(!(B>t)){if(0==f)B/=t;else{let e=E[f-1];B=f+(B-e)/(t-e)}break}}this.addCurvePosition(.1*B,p,x,b,w,y,v,k,S,a,i,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,i,n){let r=e[s],a=e[s+1],o=e[s+2]-r,l=e[s+3]-a,h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addAfterPosition(t,e,s,i,n){let r=e[s+2],a=e[s+3],o=r-e[s],l=a-e[s+1],h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addCurvePosition(t,e,s,i,n,r,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(n-s,i-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,b=3*x,w=f*b,y=b*t,v=e*p+i*w+r*y+o*m,k=s*p+n*w+a*y+l*m;h[c]=v,h[c+1]=k,d&&(h[c+2]=t<.001?Math.atan2(n-s,i-e):Math.atan2(k-(s*g+n*x*2+a*u),v-(e*g+i*x*2+r*u)))}},pe=ge;r(pe,"NONE",-1),r(pe,"BEFORE",-2),r(pe,"AFTER",-3),r(pe,"epsilon",1e-5);var xe=class{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}constructor(t,e){this.data=void 0,this._bone=null,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this._reset=!0,this.ux=0,this.uy=0,this.cx=0,this.cy=0,this.tx=0,this.ty=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,this.active=!1,this.skeleton=void 0,this.remaining=0,this.lastTime=0,this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,i=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,r=this.data.scaleX>0,a=this.bone,o=a.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=a.worldX,d=a.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,p=-1,x=this.data.limit*l,b=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||i){if(s){const t=(this.ux-h)*m;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=h}if(i){const t=(this.uy-d)*m;this.yOffset+=t>b?b:t<-b?-b:t,this.uy=d}if(u>=f){p=Math.pow(this.damping,60*f);const t=this.massInverse*f,e=this.strength,n=this.wind*g,r=(ve.yDown?-this.gravity:this.gravity)*g;do{s&&(this.xVelocity+=(n-this.xOffset*e)*t,this.xOffset+=this.xVelocity*f,this.xVelocity*=p),i&&(this.yVelocity-=(r+this.yOffset*e)*t,this.yOffset+=this.yVelocity*f,this.yVelocity*=p),u-=f}while(u>=f)}s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||r){let t=Math.atan2(a.c,a.a),s=0,i=0,l=0,h=this.cx-a.worldX,d=this.cy-a.worldY;if(h>x?h=x:h<-x&&(h=-x),d>b?d=b:d<-b&&(d=-b),n){l=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(d+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(n-Math.ceil(n*c.invPI2-.5)*c.PI2)*m,n=this.rotateOffset*l+t,s=Math.cos(n),i=Math.sin(n),r&&(n=o*a.getWorldScaleX(),n>0&&(this.scaleOffset+=(h*s+d*i)*m/n))}else{s=Math.cos(t),i=Math.sin(t);const e=o*a.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+d*i)*m/e)}if(u=this.remaining,u>=f){-1==p&&(p=Math.pow(this.damping,60*f));const e=this.massInverse*f,a=this.strength,h=this.wind,c=ve.yDown?-this.gravity:this.gravity,d=o/g;for(;;)if(u-=f,r&&(this.scaleVelocity+=(h*s-c*i-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),n){if(this.rotateVelocity-=((h*i+c*s)*d+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=p,u<f)break;const n=this.rotateOffset*l+t;s=Math.cos(n),i=Math.sin(n)}else if(u<f)break}}this.remaining=u}this.cx=a.worldX,this.cy=a.worldY;break;case 3:s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,i=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),i=Math.cos(e),n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d),e+=t*this.data.shearX,s=Math.sin(e),i=Math.cos(e),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c}else t*=this.data.rotate,s=Math.sin(t),i=Math.cos(t),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c,n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d}if(r){const t=1+this.scaleOffset*e*this.data.scaleX;a.a*=t,a.c*=t}3!=t&&(this.tx=o*a.a,this.ty=o*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*c.degRad,n=Math.cos(i),r=Math.sin(i),a=this.cx-t,o=this.cy-e;this.translate(a*n-o*r-a,a*r+o*n-o)}},be=class{constructor(t,e){if(this.data=void 0,this.bone=void 0,this.color=void 0,this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!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 l,this.darkColor=t.darkColor?new l:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof w&&this.attachment instanceof w&&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}},we=class{constructor(t,e){if(this.data=void 0,this.bones=void 0,this.target=void 0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new p,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,d=o.c,u=o.d,m=l*u-h*d>0?c.degRad:-c.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,i=x.c,n=x.d,r=Math.atan2(d,l)-Math.atan2(i,e)+f;r>c.PI?r-=c.PI2:r<-c.PI&&(r+=c.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);x.a=a*e-o*i,x.b=a*s-o*n,x.c=o*e+a*i,x.d=o*s+a*n}if(a){let t=this.temp;o.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!=i){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(l*l+d*d)-t+this.data.offsetScaleX)*i)/t),x.a*=t,x.c*=t}if(0!=n){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(h*h+u*u)-t+this.data.offsetScaleY)*n)/t),x.b*=t,x.d*=t}if(r>0){let t=x.b,e=x.d,s=Math.atan2(e,t),i=Math.atan2(u,h)-Math.atan2(d,l)-(s-Math.atan2(x.c,x.a));i>c.PI?i-=c.PI2:i<-c.PI&&(i+=c.PI2),i=s+(i+g)*r;let n=Math.sqrt(t*t+e*e);x.b=Math.cos(i)*n,x.d=Math.sin(i)*n}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,d=o.c,u=o.d,m=l*u-h*d>0?c.degRad:-c.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,i=x.c,n=x.d,r=Math.atan2(d,l)+f;r>c.PI?r-=c.PI2:r<-c.PI&&(r+=c.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);x.a=a*e-o*i,x.b=a*s-o*n,x.c=o*e+a*i,x.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleX)*i+1;x.a*=t,x.c*=t}if(0!=n){let t=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleY)*n+1;x.b*=t,x.d*=t}if(r>0){let t=Math.atan2(u,h)-Math.atan2(d,l);t>c.PI?t-=c.PI2:t<-c.PI&&(t+=c.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-c.PI/2+g)*r;let i=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*i,x.d=Math.sin(t)*i}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=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 m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=n&&0!=f&&(f=(f+(a.ascaleY-f+this.data.offsetScaleY)*n)/f);let g=h.ashearY;0!=r&&(g+=(a.ashearY-g+this.data.offsetShearY)*r),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=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,m=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),g=h.ashearY+(a.ashearY+this.data.offsetShearY)*r;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},ye=class{get scaleY(){return ye.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}constructor(t){if(this.data=void 0,this.bones=void 0,this.slots=void 0,this.drawOrder=void 0,this.ikConstraints=void 0,this.transformConstraints=void 0,this.pathConstraints=void 0,this.physicsConstraints=void 0,this._updateCache=new Array,this.skin=null,this.color=void 0,this.scaleX=1,this._scaleY=1,this.x=0,this.y=0,this.time=0,!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new ne(i,this,t),t.children.push(s)}else s=new ne(i,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],n=new be(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new he(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new we(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new pe(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new xe(s,this))}this.color=new l(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=this.physicsConstraints,r=e.length,a=s.length,o=i.length,l=this.physicsConstraints.length,h=r+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<r;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<a;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[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&&f.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&f.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let n=e.getAttachment();n instanceof Gt&&this.sortPathConstraintAttachmentWith(n,i);let r=t.bones,a=r.length;for(let t=0;t<a;t++)this.sortBone(r[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(r[t].children);for(let t=0;t<a;t++)r[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&f.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Gt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&f.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let n=e.a,r=e.b,a=e.c,o=e.d;i.worldX=n*this.x+r*this.y+e.worldX,i.worldY=a*this.x+o*this.y+e.worldY;const l=(i.rotation+i.shearX)*c.degRad,h=(i.rotation+90+i.shearY)*c.degRad,d=Math.cos(l)*i.scaleX,u=Math.cos(h)*i.scaleY,m=Math.sin(l)*i.scaleX,f=Math.sin(h)*i.scaleY;i.a=(n*d+r*m)*this.scaleX,i.b=(n*u+r*f)*this.scaleX,i.c=(a*d+o*m)*this.scaleY,i.d=(a*u+o*f)*this.scaleY;let g=this._updateCache;for(let e=0,s=g.length;e<s;e++){let s=g[e];s!=i&&s.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;f.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s],n=i.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&i.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,n=s.length;i<n;i++){let n=s[i];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.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 p,e=new p;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof Kt)h=8,c=f.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=ye.quadTriangles;else if(u instanceof jt){let t=u;h=t.worldVerticesLength,c=f.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Vt&&null!=i){i.clipStart(e,u);continue}if(c&&d){null!=i&&i.isClipping()&&(i.clipTriangles(c,d,d.length),c=i.clippedVertices,h=i.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];r=Math.min(r,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(r,a),e.set(o-r,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,r=i.length;n<r;n++)i[n].rotate(t,e,s)}},ve=ye;r(ve,"quadTriangles",[0,1,2,2,3,0]),r(ve,"yDown",!1);var ke,Se,Ce,Ae=((ke=Ae||{})[ke.none=0]="none",ke[ke.reset=1]="reset",ke[ke.update=2]="update",ke[ke.pose=3]="pose",ke),Te=class extends re{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}constructor(t){super(t,0,!1),this._bone=null,this.x=0,this.y=0,this.rotate=0,this.scaleX=0,this.shearX=0,this.limit=0,this.step=0,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this.inertiaGlobal=!1,this.strengthGlobal=!1,this.dampingGlobal=!1,this.massGlobal=!1,this.windGlobal=!1,this.gravityGlobal=!1,this.mixGlobal=!1}},Ie=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.physicsConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.referenceScale=100,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}},Me=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Fe=class{constructor(t){if(this.name=void 0,this.attachments=new Array,this.bones=Array(),this.constraints=new Array,this.color=new l(.99607843,.61960787,.30980393,1),!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof jt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new Me(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new Me(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],r=n.getAttachment();if(r&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(r==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}},Ye=class{constructor(t,e,s){if(this.index=0,this.name=void 0,this.boneData=void 0,this.color=new l(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=Pe.Normal,this.visible=!0,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}},Pe=((Se=Pe||{})[Se.Normal=0]="Normal",Se[Se.Additive=1]="Additive",Se[Se.Multiply=2]="Multiply",Se[Se.Screen=3]="Screen",Se),Ee=class extends re{set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Xe=class{constructor(t){this.scale=1,this.attachmentLoader=void 0,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ie;s.name="";let i=new Be(t),n=i.readInt32(),r=i.readInt32();s.hash=0==r&&0==n?null:r.toString(16)+n.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let o=0;o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("String in string table must not be null.");i.strings.push(t)}o=i.readInt(!0);for(let t=0;t<o;t++){let n=i.readString();if(!n)throw new Error("Bone name must not be null.");let r=0==t?null:s.bones[i.readInt(!0)],o=new se(t,n,r);o.rotation=i.readFloat(),o.x=i.readFloat()*e,o.y=i.readFloat()*e,o.scaleX=i.readFloat(),o.scaleY=i.readFloat(),o.shearX=i.readFloat(),o.shearY=i.readFloat(),o.length=i.readFloat()*e,o.inherit=i.readByte(),o.skinRequired=i.readBoolean(),a&&(l.rgba8888ToColor(o.color,i.readInt32()),o.icon=i.readString()??void 0,o.visible=i.readBoolean()),s.bones.push(o)}o=i.readInt(!0);for(let t=0;t<o;t++){let e=i.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[i.readInt(!0)],r=new Ye(t,e,n);l.rgba8888ToColor(r.color,i.readInt32());let o=i.readInt32();-1!=o&&l.rgb888ToColor(r.darkColor=new l,o),r.attachmentName=i.readStringRef(),r.blendMode=i.readInt(!0),a&&(r.visible=i.readBoolean()),s.slots.push(r)}o=i.readInt(!0);for(let t,n=0;n<o;n++){let n=i.readString();if(!n)throw new Error("IK constraint data name must not be null.");let r=new ce(n);r.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[i.readInt(!0)]);r.target=s.bones[i.readInt(!0)];let a=i.readByte();r.skinRequired=!!(1&a),r.bendDirection=2&a?1:-1,r.compress=!!(4&a),r.stretch=!!(8&a),r.uniform=!!(16&a),32&a&&(r.mix=64&a?i.readFloat():1),128&a&&(r.softness=i.readFloat()*e),s.ikConstraints.push(r)}o=i.readInt(!0);for(let t,n=0;n<o;n++){let n=i.readString();if(!n)throw new Error("Transform constraint data name must not be null.");let r=new Ee(n);r.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[i.readInt(!0)]);r.target=s.bones[i.readInt(!0)];let a=i.readByte();r.skinRequired=!!(1&a),r.local=!!(2&a),r.relative=!!(4&a),8&a&&(r.offsetRotation=i.readFloat()),16&a&&(r.offsetX=i.readFloat()*e),32&a&&(r.offsetY=i.readFloat()*e),64&a&&(r.offsetScaleX=i.readFloat()),128&a&&(r.offsetScaleY=i.readFloat()),a=i.readByte(),1&a&&(r.offsetShearY=i.readFloat()),2&a&&(r.mixRotate=i.readFloat()),4&a&&(r.mixX=i.readFloat()),8&a&&(r.mixY=i.readFloat()),16&a&&(r.mixScaleX=i.readFloat()),32&a&&(r.mixScaleY=i.readFloat()),64&a&&(r.mixShearY=i.readFloat()),s.transformConstraints.push(r)}o=i.readInt(!0);for(let t,n=0;n<o;n++){let n=i.readString();if(!n)throw new Error("Path constraint data name must not be null.");let r=new de(n);r.order=i.readInt(!0),r.skinRequired=i.readBoolean(),t=i.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[i.readInt(!0)]);r.target=s.slots[i.readInt(!0)];const a=i.readByte();r.positionMode=1&a,r.spacingMode=a>>1&3,r.rotateMode=a>>3&3,128&a&&(r.offsetRotation=i.readFloat()),r.position=i.readFloat(),0==r.positionMode&&(r.position*=e),r.spacing=i.readFloat(),0!=r.spacingMode&&1!=r.spacingMode||(r.spacing*=e),r.mixRotate=i.readFloat(),r.mixX=i.readFloat(),r.mixY=i.readFloat(),s.pathConstraints.push(r)}o=i.readInt(!0);for(let t=0;t<o;t++){const t=i.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const n=new Te(t);n.order=i.readInt(!0),n.bone=s.bones[i.readInt(!0)];let r=i.readByte();n.skinRequired=!!(1&r),2&r&&(n.x=i.readFloat()),4&r&&(n.y=i.readFloat()),8&r&&(n.rotate=i.readFloat()),16&r&&(n.scaleX=i.readFloat()),32&r&&(n.shearX=i.readFloat()),n.limit=(64&r?i.readFloat():5e3)*e,n.step=1/i.readUnsignedByte(),n.inertia=i.readFloat(),n.strength=i.readFloat(),n.damping=i.readFloat(),n.massInverse=128&r?i.readFloat():1,n.wind=i.readFloat(),n.gravity=i.readFloat(),r=i.readByte(),1&r&&(n.inertiaGlobal=!0),2&r&&(n.strengthGlobal=!0),4&r&&(n.dampingGlobal=!0),8&r&&(n.massGlobal=!0),16&r&&(n.windGlobal=!0),32&r&&(n.gravityGlobal=!0),64&r&&(n.mixGlobal=!0),n.mix=128&r?i.readFloat():1,s.physicsConstraints.push(n)}let h=this.readSkin(i,s,!0,a);h&&(s.defaultSkin=h,s.skins.push(h));{let t=s.skins.length;for(f.setArraySize(s.skins,o=t+i.readInt(!0));t<o;t++){let e=this.readSkin(i,s,!1,a);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}o=this.linkedMeshes.length;for(let t=0;t<o;t++){let e=this.linkedMeshes[t];const i=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=i.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Event data name must not be null");let e=new le(t);e.intValue=i.readInt(!1),e.floatValue=i.readFloat(),e.stringValue=i.readString(),e.audioPath=i.readString(),e.audioPath&&(e.volume=i.readFloat(),e.balance=i.readFloat()),s.events.push(e)}o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,t,s))}return s}readSkin(t,e,s,i){let n=null,r=0;if(s){if(r=t.readInt(!0),0==r)return null;n=new Fe("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new Fe(s),i&&l.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,i=n.bones.length;s<i;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,r,i);a&&n.setAttachment(s,r,a)}}return n}readAttachment(t,e,s,i,n,r){let a=this.scale,o=t.readByte();const h=8&o?t.readStringRef():n;if(!h)throw new Error("Attachment name must not be null");switch(7&o){case Ve.Region:{let e=16&o?t.readStringRef():null;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null;let r=128&o?t.readFloat():0,c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat();e||(e=h);let p=this.attachmentLoader.newRegionAttachment(s,h,e,n);return p?(p.path=e,p.x=c*a,p.y=d*a,p.scaleX=u,p.scaleY=m,p.rotation=r,p.width=f*a,p.height=g*a,l.rgba8888ToColor(p.color,i),p.sequence=n,null==n&&p.updateRegion(),p):null}case Ve.BoundingBox:{let e=this.readVertices(t,!!(16&o)),i=r?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,h);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,r&&l.rgba8888ToColor(n.color,i),n):null}case Ve.Mesh:{let e=16&o?t.readStringRef():h;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null,c=t.readInt(!0),d=this.readVertices(t,!!(128&o)),u=this.readFloatArray(t,d.length,1),m=this.readShortArray(t,3*(d.length-c-2));let f=[],g=0,p=0;r&&(f=this.readShortArray(t,t.readInt(!0)),g=t.readFloat(),p=t.readFloat()),e||(e=h);let x=this.attachmentLoader.newMeshAttachment(s,h,e,n);return x?(x.path=e,l.rgba8888ToColor(x.color,i),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=m,x.regionUVs=u,null==n&&x.updateRegion(),x.hullLength=c<<1,x.sequence=n,r&&(x.edges=f,x.width=g*a,x.height=p*a),x):null}case Ve.LinkedMesh:{const e=16&o?t.readStringRef():h;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&o?t.readInt32():4294967295,c=64&o?this.readSequence(t):null,d=!!(128&o),u=t.readInt(!0),m=t.readStringRef();let f=0,g=0;r&&(f=t.readFloat(),g=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,h,e,c);return p?(p.path=e,l.rgba8888ToColor(p.color,n),p.sequence=c,r&&(p.width=f*a,p.height=g*a),this.linkedMeshes.push(new Re(p,u,i,m,d)),p):null}case Ve.Path:{const e=!!(16&o),i=!!(32&o),n=this.readVertices(t,!!(64&o)),c=f.newArray(n.length/6,0);for(let e=0,s=c.length;e<s;e++)c[e]=t.readFloat()*a;const d=r?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,h);return u?(u.closed=e,u.constantSpeed=i,u.worldVerticesLength=n.length,u.vertices=n.vertices,u.bones=n.bones,u.lengths=c,r&&l.rgba8888ToColor(u.color,d),u):null}case Ve.Point:{const e=t.readFloat(),i=t.readFloat(),n=t.readFloat(),o=r?t.readInt32():0,c=this.attachmentLoader.newPointAttachment(s,h);return c?(c.x=i*a,c.y=n*a,c.rotation=e,r&&l.rgba8888ToColor(c.color,o),c):null}case Ve.Clipping:{const i=t.readInt(!0),n=this.readVertices(t,!!(16&o));let a=r?t.readInt32():0,c=this.attachmentLoader.newClippingAttachment(s,h);return c?(c.endSlot=e.slots[i],c.worldVerticesLength=n.length,c.vertices=n.vertices,c.bones=n.bones,r&&l.rgba8888ToColor(c.color,a),c):null}}return null}readSequence(t){let e=new v(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new De;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let r=new Array,a=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);a.push(e);for(let i=0;i<e;i++)a.push(t.readInt(!0)),r.push(t.readFloat()*s),r.push(t.readFloat()*s),r.push(t.readFloat())}return n.vertices=f.toFloatArray(r),n.bones=a,n}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,n=this.scale;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),r=n-1;switch(s){case Ze:{let s=new J(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());i.push(s);break}case ts:{let s=t.readInt(!0),a=new j(n,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!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case bs:a.setStepped(e);break;case ws:_e(t,a,s++,e,0,o,i,l,n,1),_e(t,a,s++,e,1,o,i,h,r,1),_e(t,a,s++,e,2,o,i,c,u,1),_e(t,a,s++,e,3,o,i,d,m,1)}o=i,l=n,h=r,c=u,d=m}i.push(a);break}case es:{let s=t.readInt(!0),a=new G(n,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!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case bs:a.setStepped(e);break;case ws:_e(t,a,s++,e,0,o,i,l,n,1),_e(t,a,s++,e,1,o,i,h,r,1),_e(t,a,s++,e,2,o,i,c,d,1)}o=i,l=n,h=r,c=d}i.push(a);break}case ss:{let s=t.readInt(!0),a=new H(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m,f),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;switch(t.readByte()){case bs:a.setStepped(e);break;case ws:_e(t,a,s++,e,0,o,i,l,n,1),_e(t,a,s++,e,1,o,i,h,r,1),_e(t,a,s++,e,2,o,i,c,g,1),_e(t,a,s++,e,3,o,i,d,p,1),_e(t,a,s++,e,4,o,i,u,x,1),_e(t,a,s++,e,5,o,i,m,b,1),_e(t,a,s++,e,6,o,i,f,w,1)}o=i,l=n,h=r,c=g,d=p,u=x,m=b,f=w}i.push(a);break}case is:{let s=t.readInt(!0),a=new K(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case bs:a.setStepped(e);break;case ws:_e(t,a,s++,e,0,o,i,l,n,1),_e(t,a,s++,e,1,o,i,h,r,1),_e(t,a,s++,e,2,o,i,c,f,1),_e(t,a,s++,e,3,o,i,d,g,1),_e(t,a,s++,e,4,o,i,u,p,1),_e(t,a,s++,e,5,o,i,m,x,1)}o=i,l=n,h=r,c=f,d=g,u=p,m=x}i.push(a);break}case ns:{let s=new $(n,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,i=0;s.setFrame(e,a,o),e!=r;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255;switch(t.readByte()){case bs:s.setStepped(e);break;case ws:_e(t,s,i++,e,0,a,n,o,r,1)}a=n,o=r}i.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readByte(),r=t.readInt(!0);if(s==Qe){let s=new z(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat(),t.readByte());i.push(s);continue}let a=t.readInt(!0);switch(s){case Ue:i.push(Oe(t,new R(r,a,e),1));break;case qe:i.push(Le(t,new D(r,a,e),n));break;case We:i.push(Oe(t,new V(r,a,e),n));break;case ze:i.push(Oe(t,new O(r,a,e),n));break;case je:i.push(Le(t,new L(r,a,e),1));break;case Ge:i.push(Oe(t,new _(r,a,e),1));break;case $e:i.push(Oe(t,new N(r,a,e),1));break;case He:i.push(Le(t,new U(r,a,e),1));break;case Ke:i.push(Oe(t,new q(r,a,e),1));break;case Je:i.push(Oe(t,new W(r,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),r=s-1,a=new it(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()*n:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=r;e++){o=t.readByte();const i=t.readFloat(),r=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?a.setStepped(e):128&o&&(_e(t,a,s++,e,0,l,i,h,r,1),_e(t,a,s++,e,1,l,i,c,d,n)),l=i,h=r,c=d}i.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new nt(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;r.setFrame(e,a,o,l,h,c,d,u),e!=n;e++){let i=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case bs:r.setStepped(e);break;case ws:_e(t,r,s++,e,0,a,i,o,n,1),_e(t,r,s++,e,1,a,i,l,m,1),_e(t,r,s++,e,2,a,i,h,f,1),_e(t,r,s++,e,3,a,i,c,g,1),_e(t,r,s++,e,4,a,i,d,p,1),_e(t,r,s++,e,5,a,i,u,x,1)}a=i,o=n,l=m,h=f,c=g,d=p,u=x}i.push(r)}for(let e=0,r=t.readInt(!0);e<r;e++){let e=t.readInt(!0),r=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 os:i.push(Oe(t,new rt(a,o,e),0==r.positionMode?n:1));break;case ls:i.push(Oe(t,new at(a,o,e),0==r.spacingMode||1==r.spacingMode?n:1));break;case hs:let s=new ot(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,i=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),r=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case bs:s.setStepped(e);break;case ws:_e(t,s,i++,e,0,l,n,h,r,1),_e(t,s,i++,e,1,l,n,c,a,1),_e(t,s,i++,e,2,l,n,d,o,1)}l=n,h=r,c=a,d=o}i.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==xs){const s=new xt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());i.push(s);continue}const r=t.readInt(!0);switch(s){case cs:i.push(Oe(t,new ht(n,r,e),1));break;case ds:i.push(Oe(t,new ct(n,r,e),1));break;case us:i.push(Oe(t,new dt(n,r,e),1));break;case ms:i.push(Oe(t,new ut(n,r,e),1));break;case fs:i.push(Oe(t,new mt(n,r,e),1));break;case gs:i.push(Oe(t,new ft(n,r,e),1));break;case ps:i.push(Oe(t,new gt(n,r,e),1))}}}for(let e=0,r=t.readInt(!0);e<r;e++){let e=s.skins[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,r),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case rs:{let e=a,r=e.bones,o=e.vertices,c=r?o.length/3*2:o.length,d=t.readInt(!0),u=new Q(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let i,a=t.readInt(!0);if(0==a)i=r?f.newFloatArray(c):o;else{i=f.newFloatArray(c);let e=t.readInt(!0);if(a+=e,1==n)for(let s=e;s<a;s++)i[s]=t.readFloat();else for(let s=e;s<a;s++)i[s]=t.readFloat()*n;if(!r)for(let t=0,e=i.length;t<e;t++)i[t]+=o[t]}if(u.setFrame(e,m,i),e==h)break;let l=t.readFloat();switch(t.readByte()){case bs:u.setStepped(e);break;case ws:_e(t,u,s++,e,0,m,l,0,1,1)}m=l}i.push(u);break}case as:{let e=new wt(l,s,a);for(let s=0;s<l;s++){let i=t.readFloat(),n=t.readInt32();e.setFrame(s,i,T[15&n],n>>4,t.readFloat())}i.push(e);break}}}}}let r=t.readInt(!0);if(r>0){let e=new st(r),n=s.slots.length;for(let s=0;s<r;s++){let i=t.readFloat(),r=t.readInt(!0),a=f.newArray(n,0);for(let t=n-1;t>=0;t--)a[t]=-1;let o=f.newArray(n-r,0),l=0,h=0;for(let e=0;e<r;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;a[l+t.readInt(!0)]=l++}for(;l<n;)o[h++]=l++;for(let t=n-1;t>=0;t--)-1==a[t]&&(a[t]=o[--h]);e.setFrame(s,i,a)}i.push(e)}let a=t.readInt(!0);if(a>0){let e=new tt(a);for(let i=0;i<a;i++){let n=t.readFloat(),r=s.events[t.readInt(!0)],a=new oe(n,r);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=r.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(i,a)}i.push(e)}let o=0;for(let t=0,e=i.length;t<e;t++)o=Math.max(o,i[t].getDuration());return new I(e,i,o)}},Be=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}},Re=class{constructor(t,e,s,i,n){this.parent=void 0,this.skinIndex=void 0,this.slotIndex=void 0,this.mesh=void 0,this.inheritTimeline=void 0,this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}},De=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},Ve=((Ce=Ve||{})[Ce.Region=0]="Region",Ce[Ce.BoundingBox=1]="BoundingBox",Ce[Ce.Mesh=2]="Mesh",Ce[Ce.LinkedMesh=3]="LinkedMesh",Ce[Ce.Path=4]="Path",Ce[Ce.Point=5]="Point",Ce[Ce.Clipping=6]="Clipping",Ce);function Oe(t,e,s){let i=t.readFloat(),n=t.readFloat()*s;for(let r=0,a=0,o=e.getFrameCount()-1;e.setFrame(r,i,n),r!=o;r++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case bs:e.setStepped(r);break;case ws:_e(t,e,a++,r,0,i,o,n,l,s)}i=o,n=l}return e}function Le(t,e,s){let i=t.readFloat(),n=t.readFloat()*s,r=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,i,n,r),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case bs:e.setStepped(a);break;case ws:_e(t,e,o++,a,0,i,l,n,h,s),_e(t,e,o++,a,1,i,l,r,c,s)}i=l,n=h,r=c}return e}function _e(t,e,s,i,n,r,a,o,l,h){e.setBezier(s,i,n,r,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}var Ne,Ue=0,qe=1,We=2,ze=3,je=4,Ge=5,$e=6,He=7,Ke=8,Je=9,Qe=10,Ze=0,ts=1,es=2,ss=3,is=4,ns=5,rs=0,as=1,os=0,ls=1,hs=2,cs=0,ds=1,us=2,ms=4,fs=5,gs=6,ps=7,xs=8,bs=1,ws=2,ys=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new g((()=>f.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=t.slots,a=r.length;s.length=0,n.freeAll(i),i.length=0;for(let t=0;t<a;t++){let e=r[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof Dt){let t=a;s.push(t);let r=n.obtain();r.length!=t.worldVerticesLength&&(r=f.newFloatArray(t.worldVerticesLength)),i.push(r),t.computeWorldVertices(e,0,t.worldVerticesLength,r,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let r=0,a=n.length;r<a;r++){let a=n[r],o=a;for(let n=0,r=a.length;n<r;n+=2){let r=o[n],a=o[n+1];t=Math.min(t,r),e=Math.min(e,a),s=Math.max(s,r),i=Math.max(i,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,r=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=r&&i<=r||t>=a&&s>=a||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(n-t)+e;if(h>r&&h<o)return!0;if(h=l*(a-t)+e,h>r&&h<o)return!0;let c=(r-e)/l+t;return c>n&&c<a||(c=(o-e)/l+t,c>n&&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 i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,r=n-2,a=!1;for(let t=0;t<n;t+=2){let n=i[t+1],o=i[r+1];if(n<s&&o>=s||o<s&&n>=s){let l=i[t];l+(s-n)/(o-n)*(i[r]-l)<e&&(a=!a)}r=t}return a}intersectsSegment(t,e,s,i){let n=this.polygons;for(let r=0,a=n.length;r<a;r++)if(this.intersectsSegmentPolygon(n[r],t,e,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,i,n){let r=t,a=t.length,o=e-i,l=s-n,h=e*n-s*i,c=r[a-2],d=r[a-1];for(let t=0;t<a;t+=2){let a=r[t],u=r[t+1],m=c*u-d*a,f=c-a,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&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}},vs=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new g((()=>new Array)),this.polygonIndicesPool=new g((()=>new Array))}triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,r=s;t<r;++t)n[t]=vs.isConcave(t,s,e,i);let r=this.triangles;for(r.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!n[a]){let r=i[t]<<1,l=i[a]<<1,h=i[o]<<1,c=e[r],d=e[r+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let r=(o+1)%s;r!=t;r=(r+1)%s){if(!n[r])continue;let t=i[r]<<1,s=e[t],a=e[t+1];if(vs.positiveArea(f,g,c,d,s,a)&&vs.positiveArea(c,d,u,m,s,a)&&vs.positiveArea(u,m,f,g,s,a))break t}break}if(0==o){do{if(!n[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}r.push(i[(s+a-1)%s]),r.push(i[a]),r.push(i[(a+1)%s]),i.splice(a,1),n.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;n[l]=vs.isConcave(l,s,e,i),n[h]=vs.isConcave(h,s,e,i)}return 3==s&&(r.push(i[2]),r.push(i[0]),r.push(i[1])),r}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let r=this.polygonIndicesPool.obtain();r.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],m=s[h+1],f=s[c],g=s[c+1],p=s[d],x=s[d+1],b=!1;if(o==h){let t=a.length-4,e=vs.winding(a[t],a[t+1],a[t+2],a[t+3],p,x),s=vs.winding(p,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(p),a.push(x),r.push(d),b=!0)}b||(a.length>0?(i.push(a),n.push(r)):(this.polygonPool.free(a),this.polygonIndicesPool.free(r)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(m),a.push(f),a.push(g),a.push(p),a.push(x),r=this.polygonIndicesPool.obtain(),r.length=0,r.push(h),r.push(c),r.push(d),l=vs.winding(u,m,f,g,p,x),o=h)}a.length>0&&(i.push(a),n.push(r));for(let t=0,e=i.length;t<e;t++){if(r=n[t],0==r.length)continue;let s=r[0],o=r[r.length-1];a=i[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],m=a[0],f=a[1],g=a[2],p=a[3],x=vs.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let b=e[0],w=e[1],y=e[2],v=i[l],k=v[v.length-2],S=v[v.length-1];if(b!=s||w!=o)continue;let C=vs.winding(h,c,d,u,k,S),A=vs.winding(k,S,m,f,g,p);C==x&&A==x&&(v.length=0,e.length=0,a.push(k),a.push(S),r.push(y),h=d,c=u,d=k,u=S,l=0)}}for(let t=i.length-1;t>=0;t--)a=i[t],0==a.length&&(i.splice(t,1),this.polygonPool.free(a),r=n[t],n.splice(t,1),this.polygonIndicesPool.free(r));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,r=i[t]<<1,a=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[r],s[r+1],s[a],s[a+1])}static positiveArea(t,e,s,i,n,r){return t*(r-i)+s*(e-r)+n*(i-e)>=0}static winding(t,e,s,i,n,r){let a=s-t,o=i-e;return n*o-r*a+a*e-t*o>=0?1:-1}},ks=class{constructor(){this.triangulator=new vs,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedUVs=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=f.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;ks.makeClockwise(n);let r=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=r.length;t<e;t++){let e=r[t];ks.makeClockwise(e),e.push(e[0]),e.push(e[1])}return r.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,i,n,r,a,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=i,c=n,d=r,u=a,m=o):(l=e,h=s,c=i,d=n,u=r,m=a),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,r=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;n.length=0,r.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let g=t[s],p=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(c,d,u,m,g,p,a[t],i)){let t=f.setArraySize(n,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=g,t[e+5]=p,e=r.length;let s=f.setArraySize(r,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=f.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],i=a[s+1];o[e]=t,o[e+1]=i}e=r.length;let h=f.setArraySize(r,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,i,n,r,a){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=a?12:8,m=0;l.length=0,h.length=0;for(let g=0;g<s;g+=3){let s=e[g]<<1,p=t[s],x=t[s+1],b=i[s],w=i[s+1];s=e[g+1]<<1;let y=t[s],v=t[s+1],k=i[s],S=i[s+1];s=e[g+2]<<1;let C=t[s],A=t[s+1],T=i[s],I=i[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(p,x,y,v,C,A,c[t],o)){let t=f.setArraySize(l,e+3*u);t[e]=p,t[e+1]=x,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,a?(t[e+6]=b,t[e+7]=w,t[e+8]=r.r,t[e+9]=r.g,t[e+10]=r.b,t[e+11]=r.a,t[e+12]=y,t[e+13]=v,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=k,t[e+19]=S,t[e+20]=r.r,t[e+21]=r.g,t[e+22]=r.b,t[e+23]=r.a,t[e+24]=C,t[e+25]=A,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=T,t[e+31]=I,t[e+32]=r.r,t[e+33]=r.g,t[e+34]=r.b,t[e+35]=r.a):(t[e+6]=b,t[e+7]=w,t[e+8]=y,t[e+9]=v,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=k,t[e+15]=S,t[e+16]=C,t[e+17]=A,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=T,t[e+23]=I),e=h.length;let s=f.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=v-A,i=C-y,c=p-C,d=A-x,g=1/(s*c+i*(x-A)),M=t>>1,F=this.clipOutput,Y=f.setArraySize(l,e+M*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];Y[e]=t,Y[e+1]=l,Y[e+2]=n.r,Y[e+3]=n.g,Y[e+4]=n.b,Y[e+5]=n.a;let h=t-C,u=l-A,m=(s*h+i*u)*g,f=(d*h+c*u)*g,p=1-m-f;Y[e+6]=b*m+k*f+T*p,Y[e+7]=w*m+S*f+I*p,a&&(Y[e+8]=r.r,Y[e+9]=r.g,Y[e+10]=r.b,Y[e+11]=r.a)}e=h.length;let P=f.setArraySize(h,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)P[e]=m,P[e+1]=m+t,P[e+2]=m+t+1;m+=M+1}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,r=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;r.length=0,a.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],g=i[s],p=i[s+1];s=e[d+1]<<1;let x=t[s],b=t[s+1],w=i[s],y=i[s+1];s=e[d+2]<<1;let v=t[s],k=t[s+1],S=i[s],C=i[s+1];for(let t=0;t<h;t++){let e=r.length;if(!this.clip(u,m,x,b,v,k,l[t],n)){let t=f.setArraySize(r,e+6);t[e]=u,t[e+1]=m,t[e+2]=x,t[e+3]=b,t[e+4]=v,t[e+5]=k;let s=f.setArraySize(a,e+6);s[e]=g,s[e+1]=p,s[e+2]=w,s[e+3]=y,s[e+4]=S,s[e+5]=C,e=o.length;let i=f.setArraySize(o,e+3);i[e]=c,i[e+1]=c+1,i[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=b-k,i=v-x,l=u-v,h=k-m,d=1/(s*l+i*(m-k)),A=t>>1,T=this.clipOutput,I=f.setArraySize(r,e+2*A),M=f.setArraySize(a,e+2*A);for(let n=0;n<t;n+=2,e+=2){let t=T[n],r=T[n+1];I[e]=t,I[e+1]=r;let a=t-v,o=r-k,c=(s*a+i*o)*d,u=(h*a+l*o)*d,m=1-c-u;M[e]=g*c+w*u+S*m,M[e+1]=p*c+y*u+C*m}e=o.length;let F=f.setArraySize(o,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=A+1}}}}clip(t,e,s,i,n,r,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(i),l.push(n),l.push(r),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],i=e-u[t+2],n=s-u[t+3],r=o.length,a=l;for(let t=0,r=l.length-2;t<r;){let r=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=n*(e-h)>i*(s-d),m=n*(e-r)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s)}else if(u){let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(r==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,r=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],r=e[t+1],a=e[t+2],o=e[t+3],i+=n*o-a*r;if(!(i<0))for(let t=0,i=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],r=i-t;e[t]=e[r],e[t+1]=e[r+1],e[r]=s,e[r+1]=n}}},Ss=class{constructor(t){this.attachmentLoader=void 0,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ie,i="string"==typeof t?JSON.parse(t):t,n=i.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=Ms(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),i.bones)for(let t=0;t<i.bones.length;t++){let n=i.bones[t],r=null,a=Ms(n,"parent",null);a&&(r=s.findBone(a));let o=new se(s.bones.length,n.name,r);o.length=Ms(n,"length",0)*e,o.x=Ms(n,"x",0)*e,o.y=Ms(n,"y",0)*e,o.rotation=Ms(n,"rotation",0),o.scaleX=Ms(n,"scaleX",1),o.scaleY=Ms(n,"scaleY",1),o.shearX=Ms(n,"shearX",0),o.shearY=Ms(n,"shearY",0),o.inherit=f.enumValue(ie,Ms(n,"inherit","Normal")),o.skinRequired=Ms(n,"skin",!1);let l=Ms(n,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(i.slots)for(let t=0;t<i.slots.length;t++){let e=i.slots[t],n=e.name,r=s.findBone(e.bone);if(!r)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let a=new Ye(s.slots.length,n,r),o=Ms(e,"color",null);o&&a.color.setFromString(o);let h=Ms(e,"dark",null);h&&(a.darkColor=l.fromString(h)),a.attachmentName=Ms(e,"attachment",null),a.blendMode=f.enumValue(Pe,Ms(e,"blend","normal")),a.visible=Ms(e,"visible",!0),s.slots.push(a)}if(i.ik)for(let t=0;t<i.ik.length;t++){let n=i.ik[t],r=new ce(n.name);r.order=Ms(n,"order",0),r.skinRequired=Ms(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=s.findBone(n.bones[t]);if(!e)throw new Error(`Couldn't find bone ${n.bones[t]} for IK constraint ${n.name}.`);r.bones.push(e)}let a=s.findBone(n.target);if(!a)throw new Error(`Couldn't find target bone ${n.target} for IK constraint ${n.name}.`);r.target=a,r.mix=Ms(n,"mix",1),r.softness=Ms(n,"softness",0)*e,r.bendDirection=Ms(n,"bendPositive",!0)?1:-1,r.compress=Ms(n,"compress",!1),r.stretch=Ms(n,"stretch",!1),r.uniform=Ms(n,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let t=0;t<i.transform.length;t++){let n=i.transform[t],r=new Ee(n.name);r.order=Ms(n,"order",0),r.skinRequired=Ms(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for transform constraint ${n.name}.`);r.bones.push(i)}let a=n.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${n.name}.`);r.target=o,r.local=Ms(n,"local",!1),r.relative=Ms(n,"relative",!1),r.offsetRotation=Ms(n,"rotation",0),r.offsetX=Ms(n,"x",0)*e,r.offsetY=Ms(n,"y",0)*e,r.offsetScaleX=Ms(n,"scaleX",0),r.offsetScaleY=Ms(n,"scaleY",0),r.offsetShearY=Ms(n,"shearY",0),r.mixRotate=Ms(n,"mixRotate",1),r.mixX=Ms(n,"mixX",1),r.mixY=Ms(n,"mixY",r.mixX),r.mixScaleX=Ms(n,"mixScaleX",1),r.mixScaleY=Ms(n,"mixScaleY",r.mixScaleX),r.mixShearY=Ms(n,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let t=0;t<i.path.length;t++){let n=i.path[t],r=new de(n.name);r.order=Ms(n,"order",0),r.skinRequired=Ms(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for path constraint ${n.name}.`);r.bones.push(i)}let a=n.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${n.name}.`);r.target=o,r.positionMode=f.enumValue(ue,Ms(n,"positionMode","Percent")),r.spacingMode=f.enumValue(me,Ms(n,"spacingMode","Length")),r.rotateMode=f.enumValue(fe,Ms(n,"rotateMode","Tangent")),r.offsetRotation=Ms(n,"rotation",0),r.position=Ms(n,"position",0),0==r.positionMode&&(r.position*=e),r.spacing=Ms(n,"spacing",0),0!=r.spacingMode&&1!=r.spacingMode||(r.spacing*=e),r.mixRotate=Ms(n,"mixRotate",1),r.mixX=Ms(n,"mixX",1),r.mixY=Ms(n,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let t=0;t<i.physics.length;t++){const n=i.physics[t],r=new Te(n.name);r.order=Ms(n,"order",0),r.skinRequired=Ms(n,"skin",!1);const a=n.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);r.bone=o,r.x=Ms(n,"x",0),r.y=Ms(n,"y",0),r.rotate=Ms(n,"rotate",0),r.scaleX=Ms(n,"scaleX",0),r.shearX=Ms(n,"shearX",0),r.limit=Ms(n,"limit",5e3)*e,r.step=1/Ms(n,"fps",60),r.inertia=Ms(n,"inertia",1),r.strength=Ms(n,"strength",100),r.damping=Ms(n,"damping",1),r.massInverse=1/Ms(n,"mass",1),r.wind=Ms(n,"wind",0),r.gravity=Ms(n,"gravity",0),r.mix=Ms(n,"mix",1),r.inertiaGlobal=Ms(n,"inertiaGlobal",!1),r.strengthGlobal=Ms(n,"strengthGlobal",!1),r.dampingGlobal=Ms(n,"dampingGlobal",!1),r.massGlobal=Ms(n,"massGlobal",!1),r.windGlobal=Ms(n,"windGlobal",!1),r.gravityGlobal=Ms(n,"gravityGlobal",!1),r.mixGlobal=Ms(n,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let t=0;t<i.skins.length;t++){let e=i.skins[t],n=new Fe(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=s.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);n.bones.push(r)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],r=s.findIkConstraint(i);if(!r)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],r=s.findTransformConstraint(i);if(!r)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],r=s.findPathConstraint(i);if(!r)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],r=s.findPhysicsConstraint(i);if(!r)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);n.constraints.push(r)}for(let t in e.attachments){let i=s.findSlot(t);if(!i)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let r=e.attachments[t];for(let t in r){let e=this.readAttachment(r[t],n,i.index,t,s);e&&n.setAttachment(i.index,t,e)}}s.skins.push(n),"default"==n.name&&(s.defaultSkin=n)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],i=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!i)throw new Error(`Skin not found: ${e.skin}`);let n=i.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let t in i.events){let e=i.events[t],n=new le(t);n.intValue=Ms(e,"int",0),n.floatValue=Ms(e,"float",0),n.stringValue=Ms(e,"string",""),n.audioPath=Ms(e,"audio",null),n.audioPath&&(n.volume=Ms(e,"volume",1),n.balance=Ms(e,"balance",0)),s.events.push(n)}if(i.animations)for(let t in i.animations){let e=i.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,i,n){let r=this.scale;switch(i=Ms(t,"name",i),Ms(t,"type","region")){case"region":{let s=Ms(t,"path",i),n=this.readSequence(Ms(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,s,n);if(!a)return null;a.path=s,a.x=Ms(t,"x",0)*r,a.y=Ms(t,"y",0)*r,a.scaleX=Ms(t,"scaleX",1),a.scaleY=Ms(t,"scaleY",1),a.rotation=Ms(t,"rotation",0),a.width=t.width*r,a.height=t.height*r,a.sequence=n;let o=Ms(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=Ms(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=Ms(t,"path",i),a=this.readSequence(Ms(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,n,a);if(!o)return null;o.path=n;let l=Ms(t,"color",null);l&&o.color.setFromString(l),o.width=Ms(t,"width",0)*r,o.height=Ms(t,"height",0)*r,o.sequence=a;let h=Ms(t,"parent",null);if(h)return this.linkedMeshes.push(new Cs(o,Ms(t,"skin",null),s,h,Ms(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=Ms(t,"edges",null),o.hullLength=2*Ms(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=Ms(t,"closed",!1),s.constantSpeed=Ms(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let a=f.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*r;s.lengths=a;let o=Ms(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=Ms(t,"x",0)*r,s.y=Ms(t,"y",0)*r,s.rotation=Ms(t,"rotation",0);let n=Ms(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let r=Ms(t,"end",null);r&&(s.endSlot=n.findSlot(r));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Ms(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new v(Ms(t,"count",0));return e.start=Ms(t,"start",1),e.digits=Ms(t,"digits",0),e.setupIndex=Ms(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=f.toFloatArray(n);if(1!=i)for(let e=0,s=n.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let r=new Array,a=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(n[t]),r.push(n[t+1]*i),r.push(n[t+2]*i),r.push(n[t+3])}e.bones=a,e.vertices=f.toFloatArray(r)}readAnimation(t,e,s){let i=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let i=t.slots[e],r=s.findSlot(e);if(!r)throw new Error("Slot not found: "+e);let a=r.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new J(s,a);for(let i=0;i<s;i++){let s=e[i];t.setFrame(i,Ms(s,"time",0),Ms(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new j(s,s<<2,a),i=e[0],r=Ms(i,"time",0),o=l.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a);let a=e[s+1];if(!a){t.shrink(n);break}let h=Ms(a,"time",0),c=l.fromString(a.color),d=i.curve;d&&(n=Is(d,t,n,s,0,r,h,o.r,c.r,1),n=Is(d,t,n,s,1,r,h,o.g,c.g,1),n=Is(d,t,n,s,2,r,h,o.b,c.b,1),n=Is(d,t,n,s,3,r,h,o.a,c.a,1)),r=h,o=c,i=a}n.push(t)}else if("rgb"==t){let t=new G(s,3*s,a),i=e[0],r=Ms(i,"time",0),o=l.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=Ms(a,"time",0),c=l.fromString(a.color),d=i.curve;d&&(n=Is(d,t,n,s,0,r,h,o.r,c.r,1),n=Is(d,t,n,s,1,r,h,o.g,c.g,1),n=Is(d,t,n,s,2,r,h,o.b,c.b,1)),r=h,o=c,i=a}n.push(t)}else if("alpha"==t)n.push(As(e,new $(s,s,a),0,1));else if("rgba2"==t){let t=new H(s,7*s,a),i=e[0],r=Ms(i,"time",0),o=l.fromString(i.light),h=l.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a,h.r,h.g,h.b);let a=e[s+1];if(!a){t.shrink(n);break}let c=Ms(a,"time",0),d=l.fromString(a.light),u=l.fromString(a.dark),m=i.curve;m&&(n=Is(m,t,n,s,0,r,c,o.r,d.r,1),n=Is(m,t,n,s,1,r,c,o.g,d.g,1),n=Is(m,t,n,s,2,r,c,o.b,d.b,1),n=Is(m,t,n,s,3,r,c,o.a,d.a,1),n=Is(m,t,n,s,4,r,c,h.r,u.r,1),n=Is(m,t,n,s,5,r,c,h.g,u.g,1),n=Is(m,t,n,s,6,r,c,h.b,u.b,1)),r=c,o=d,h=u,i=a}n.push(t)}else if("rgb2"==t){let t=new K(s,6*s,a),i=e[0],r=Ms(i,"time",0),o=l.fromString(i.light),h=l.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,h.r,h.g,h.b);let a=e[s+1];if(!a){t.shrink(n);break}let c=Ms(a,"time",0),d=l.fromString(a.light),u=l.fromString(a.dark),m=i.curve;m&&(n=Is(m,t,n,s,0,r,c,o.r,d.r,1),n=Is(m,t,n,s,1,r,c,o.g,d.g,1),n=Is(m,t,n,s,2,r,c,o.b,d.b,1),n=Is(m,t,n,s,3,r,c,h.r,u.r,1),n=Is(m,t,n,s,4,r,c,h.g,u.g,1),n=Is(m,t,n,s,5,r,c,h.b,u.b,1)),r=c,o=d,h=u,i=a}n.push(t)}}}if(t.bones)for(let e in t.bones){let r=t.bones[e],a=s.findBone(e);if(!a)throw new Error("Bone not found: "+e);let o=a.index;for(let t in r){let e=r[t],s=e.length;if(0!=s)if("rotate"===t)n.push(As(e,new R(s,s,o),0,1));else if("translate"===t){let t=new D(s,s<<1,o);n.push(Ts(e,t,"x","y",0,i))}else if("translatex"===t){let t=new V(s,s,o);n.push(As(e,t,0,i))}else if("translatey"===t){let t=new O(s,s,o);n.push(As(e,t,0,i))}else if("scale"===t){let t=new L(s,s<<1,o);n.push(Ts(e,t,"x","y",1,1))}else if("scalex"===t){let t=new _(s,s,o);n.push(As(e,t,1,1))}else if("scaley"===t){let t=new N(s,s,o);n.push(As(e,t,1,1))}else if("shear"===t){let t=new U(s,s<<1,o);n.push(Ts(e,t,"x","y",0,1))}else if("shearx"===t){let t=new q(s,s,o);n.push(As(e,t,0,1))}else if("sheary"===t){let t=new W(s,s,o);n.push(As(e,t,0,1))}else if("inherit"===t){let t=new z(s,a.index);for(let s=0;s<e.length;s++){let i=e[s];t.setFrame(s,Ms(i,"time",0),f.enumValue(ie,Ms(i,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let r=t.ik[e],a=r[0];if(!a)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new it(r.length,r.length<<1,l),c=Ms(a,"time",0),d=Ms(a,"mix",1),u=Ms(a,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Ms(a,"bendPositive",!0)?1:-1,Ms(a,"compress",!1),Ms(a,"stretch",!1));let s=r[t+1];if(!s){h.shrink(e);break}let n=Ms(s,"time",0),o=Ms(s,"mix",1),l=Ms(s,"softness",0)*i,m=a.curve;m&&(e=Is(m,h,e,t,0,c,n,d,o,1),e=Is(m,h,e,t,1,c,n,u,l,i)),c=n,d=o,u=l,a=s}n.push(h)}if(t.transform)for(let e in t.transform){let i=t.transform[e],r=i[0];if(!r)continue;let a=s.findTransformConstraint(e);if(!a)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(a),l=new nt(i.length,6*i.length,o),h=Ms(r,"time",0),c=Ms(r,"mixRotate",1),d=Ms(r,"mixX",1),u=Ms(r,"mixY",d),m=Ms(r,"mixScaleX",1),f=Ms(r,"mixScaleY",m),g=Ms(r,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=i[t+1];if(!s){l.shrink(e);break}let n=Ms(s,"time",0),a=Ms(s,"mixRotate",1),o=Ms(s,"mixX",1),p=Ms(s,"mixY",o),x=Ms(s,"mixScaleX",1),b=Ms(s,"mixScaleY",x),w=Ms(s,"mixShearY",1),y=r.curve;y&&(e=Is(y,l,e,t,0,h,n,c,a,1),e=Is(y,l,e,t,1,h,n,d,o,1),e=Is(y,l,e,t,2,h,n,u,p,1),e=Is(y,l,e,t,3,h,n,m,x,1),e=Is(y,l,e,t,4,h,n,f,b,1),e=Is(y,l,e,t,5,h,n,g,w,1)),h=n,c=a,d=o,u=p,m=x,f=b,m=x,r=s}n.push(l)}if(t.path)for(let e in t.path){let r=t.path[e],a=s.findPathConstraint(e);if(!a)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(a);for(let t in r){let e=r[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new rt(l,l,o);n.push(As(e,t,0,0==a.positionMode?i:1))}else if("spacing"===t){let t=new at(l,l,o);n.push(As(e,t,0,0==a.spacingMode||1==a.spacingMode?i:1))}else if("mix"===t){let t=new ot(l,3*l,o),i=Ms(s,"time",0),r=Ms(s,"mixRotate",1),a=Ms(s,"mixX",1),h=Ms(s,"mixY",a);for(let n=0,o=0;;n++){t.setFrame(n,i,r,a,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=Ms(l,"time",0),d=Ms(l,"mixRotate",1),u=Ms(l,"mixX",1),m=Ms(l,"mixY",u),f=s.curve;f&&(o=Is(f,t,o,n,0,i,c,r,d,1),o=Is(f,t,o,n,1,i,c,a,u,1),o=Is(f,t,o,n,2,i,c,h,m,1)),i=c,r=d,a=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let i=t.physics[e],r=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);r=s.physicsConstraints.indexOf(t)}for(let t in i){let e=i[t],s=e[0];if(!s)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new ht(o,o,r);else if("strength"==t)a=new ct(o,o,r);else if("damping"==t)a=new dt(o,o,r);else if("mass"==t)a=new ut(o,o,r);else if("wind"==t)a=new mt(o,o,r);else if("gravity"==t)a=new ft(o,o,r);else{if("mix"!=t)continue;a=new gt(o,o,r)}n.push(As(e,a,0,1))}else{const t=new xt(o,r);for(let i=0;null!=s;s=e[i+1],i++)t.setFrame(i,Ms(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let r=t.attachments[e],a=s.findSkin(e);if(!a)throw new Error("Skin not found: "+e);for(let t in r){let e=r[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],r=a.getAttachment(l,t);for(let t in s){let e=s[t],a=e[0];if(a)if("deform"==t){let t=r.bones,s=r.vertices,o=t?s.length/3*2:s.length,h=new Q(e.length,e.length,l,r),c=Ms(a,"time",0);for(let n=0,r=0;;n++){let l,d=Ms(a,"vertices",null);if(d){l=f.newFloatArray(o);let e=Ms(a,"offset",0);if(f.arrayCopy(d,0,l,e,d.length),1!=i)for(let t=e,s=t+d.length;t<s;t++)l[t]*=i;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?f.newFloatArray(o):s;h.setFrame(n,c,l);let u=e[n+1];if(!u){h.shrink(r);break}let m=Ms(u,"time",0),g=a.curve;g&&(r=Is(g,h,r,n,0,c,m,0,1,1)),c=m,a=u}n.push(h)}else if("sequence"==t){let t=new wt(e.length,l,r),s=0;for(let i=0;i<e.length;i++){let n=Ms(a,"delay",s),r=Ms(a,"time",0),o=A[Ms(a,"mode","hold")],l=Ms(a,"index",0);t.setFrame(i,r,o,l,n),s=n,a=e[i+1]}n.push(t)}}}}}if(t.drawOrder){let e=new st(t.drawOrder.length),i=s.slots.length,r=0;for(let n=0;n<t.drawOrder.length;n++,r++){let a=t.drawOrder[n],o=null,l=Ms(a,"offsets",null);if(l){o=f.newArray(i,-1);let t=f.newArray(i-l.length,0),e=0,n=0;for(let i=0;i<l.length;i++){let r=l[i],a=s.findSlot(r.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[n++]=e++;o[e+r.offset]=e++}for(;e<i;)t[n++]=e++;for(let e=i-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(r,Ms(a,"time",0),o)}n.push(e)}if(t.events){let e=new tt(t.events.length),i=0;for(let n=0;n<t.events.length;n++,i++){let r=t.events[n],a=s.findEvent(r.name);if(!a)throw new Error("Event not found: "+r.name);let o=new oe(f.toSinglePrecision(Ms(r,"time",0)),a);o.intValue=Ms(r,"int",a.intValue),o.floatValue=Ms(r,"float",a.floatValue),o.stringValue=Ms(r,"string",a.stringValue),o.data.audioPath&&(o.volume=Ms(r,"volume",1),o.balance=Ms(r,"balance",0)),e.setFrame(i,o)}n.push(e)}let r=0;for(let t=0,e=n.length;t<e;t++)r=Math.max(r,n[t].getDuration());s.animations.push(new I(e,n,r))}},Cs=class{constructor(t,e,s,i,n){this.parent=void 0,this.skin=void 0,this.slotIndex=void 0,this.mesh=void 0,this.inheritTimeline=void 0,this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};function As(t,e,s,i){let n=t[0],r=Ms(n,"time",0),a=Ms(n,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,r,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Ms(h,"time",0),d=Ms(h,"value",s)*i;n.curve&&(o=Is(n.curve,e,o,l,0,r,c,a,d,i)),r=c,a=d,n=h}}function Ts(t,e,s,i,n,r){let a=t[0],o=Ms(a,"time",0),l=Ms(a,s,n)*r,h=Ms(a,i,n)*r,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Ms(u,"time",0),f=Ms(u,s,n)*r,g=Ms(u,i,n)*r,p=a.curve;p&&(c=Is(p,e,c,d,0,o,m,l,f,r),c=Is(p,e,c,d,1,o,m,h,g,r)),o=m,l=f,h=g,a=u}}function Is(t,e,s,i,n,r,a,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=n<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,n,r,o,d,u,m,f,a,l),s+1}function Ms(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=(Ne=new Float32Array(1),function(t){return Ne[0]=t,Ne[0]}));var Fs=class extends Ot{static from(t){return Fs.textureMap.has(t)?Fs.textureMap.get(t):new Fs(t)}constructor(t){super(t.resource),this.texture=void 0,this.texture=e.Texture.from(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=Fs.toPixiTextureFilter(t),s.magFilter=Fs.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=Fs.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=Fs.toPixiTextureWrap(t),s.addressModeV=Fs.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Ys=Fs;r(Ys,"textureMap",new Map);var Ps={extension:e.ExtensionType.Asset,resolver:{test:t=>e.checkExtension(t,".atlas"),parse:t=>{var s,i;const n=t.split(".");return{resolution:parseFloat((null===(s=e.Resolver.RETINA_PREFIX)||void 0===s||null===(i=s.exec(t))||void 0===i?void 0:i[1])??"1"),format:n[n.length-2],src:t}}},loader:{extension:{type:e.ExtensionType.LoadParser,priority:e.LoaderParserPriority.Normal,name:"spineTextureAtlasLoader"},test:t=>e.checkExtension(t,".atlas"),async load(t){const s=await e.DOMAdapter.get().fetch(t);return await s.text()},testParse(t,s){const i=e.checkExtension(s.src,".atlas"),n="string"==typeof t;return Promise.resolve(i&&n)},unload(t){t.dispose()},async parse(t,s,i){const n=s.data||{};let r=e.path.dirname(s.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const a=new Ut(t);if(n.images instanceof e.TextureSource||"string"==typeof n.images){const t=n.images;n.images={},n.images[a.pages[0].name]=t}const o=[];for(const t of a.pages){if(n.resolve){const e=n.resolve().then((e=>{t.setTexture(Ys.from(e.source))}));o.push(e);continue}const s=t.name,a=null!=n&&n.images?n.images[s]:void 0;if(a instanceof e.TextureSource)t.setTexture(Ys.from(a));else{const l={src:a??e.path.normalize([...r.split(e.path.sep),s].join(e.path.sep)),data:_objectSpread(_objectSpread({},n.imageMetadata),{},{alphaMode:t.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"})},h=i.load(l).then((e=>{t.setTexture(Ys.from(e.source))}));o.push(h)}}return await Promise.all(o),a}}};e.extensions.add(Ps);var Es={extension:e.ExtensionType.Asset,loader:{extension:{type:e.ExtensionType.LoadParser,priority:e.LoaderParserPriority.Normal,name:"spineSkeletonLoader"},test:t=>e.checkExtension(t,".skel"),async load(t){const s=await e.DOMAdapter.get().fetch(t);return new Uint8Array(await s.arrayBuffer())},testParse(t,s){const i=e.checkExtension(s.src,".json")&&(n=t,Object.prototype.hasOwnProperty.call(n,"bones"));var n;const r=e.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(t);return Promise.resolve(i||r)}}};e.extensions.add(Es);var Xs=new Float32Array(1),Bs=new Uint32Array(1),Rs=class extends e.Geometry{constructor(){const t=new e.Buffer({data:Xs,label:"attribute-batch-buffer",usage:e.BufferUsage.VERTEX|e.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:28,offset:0},aUV:{buffer:t,format:"float32x2",stride:28,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:t,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:28,offset:24}},indexBuffer:new e.Buffer({data:Bs,label:"index-batch-buffer",usage:e.BufferUsage.INDEX|e.BufferUsage.COPY_DST,shrinkToFit:!1})})}},Ds={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},Vs={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},Os=class extends e.Shader{constructor(t){super({glProgram:e.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[e.colorBitGl,Vs,e.generateTextureBatchBitGl(t),e.roundPixelsBitGl]}),gpuProgram:e.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[e.colorBit,Ds,e.generateTextureBatchBit(t),e.roundPixelsBit]}),resources:{batchSamplers:e.getBatchSamplersUniformGroup(t)}})}},Ls=null,_s=class extends e.Batcher{constructor(...t){super(...t),this.geometry=new Rs,this.shader=Ls||(Ls=new Os(this.maxTextures)),this.name=_s.extension.name,this.vertexSize=7}packAttributes(t,s,i,n,r){const a=r<<16|65535&t.roundPixels,o=t.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:g}=t,p=t.color,x=(p>>24&255)/255,b=e.Color.shared.setValue(t.darkColor).premultiply(x,!0).toPremultiplied(1,!1),w=t.attributeOffset,y=w+t.attributeSize;for(let t=w;t<y;t++){const e=2*t,r=f[e],o=f[e+1];s[n++]=l*r+c*o+u,s[n++]=d*o+h*r+m,s[n++]=g[e],s[n++]=g[e+1],i[n++]=p,i[n++]=b,i[n++]=a}}packQuadAttributes(t,e,s,i,n){const r=t.texture,a=t.transform,o=a.a,l=a.b,h=a.c,c=a.d,d=a.tx,u=a.ty,m=t.bounds,f=m.maxX,g=m.minX,p=m.maxY,x=m.minY,b=r.uvs,w=t.color,y=t.darkColor,v=n<<16|65535&t.roundPixels;e[i+0]=o*g+h*x+d,e[i+1]=c*x+l*g+u,e[i+2]=b.x0,e[i+3]=b.y0,s[i+4]=w,s[i+5]=y,s[i+6]=v,e[i+7]=o*f+h*x+d,e[i+8]=c*x+l*f+u,e[i+9]=b.x1,e[i+10]=b.y1,s[i+11]=w,s[i+12]=y,s[i+13]=v,e[i+14]=o*f+h*p+d,e[i+15]=c*p+l*f+u,e[i+16]=b.x2,e[i+17]=b.y2,s[i+18]=w,s[i+19]=y,s[i+20]=v,e[i+21]=o*g+h*p+d,e[i+22]=c*p+l*g+u,e[i+23]=b.x3,e[i+24]=b.y3,s[i+25]=w,s[i+26]=y,s[i+27]=v}},Ns=_s;r(Ns,"extension",{type:[e.ExtensionType.Batcher],name:"darkTint"}),e.extensions.add(Ns);var Us=class{constructor(){this.indexOffset=0,this.attributeOffset=0,this.indexSize=void 0,this.attributeSize=void 0,this.batcherName="darkTint",this.topology="triangle-list",this.packAsQuad=!1,this.renderable=void 0,this.positions=void 0,this.indices=void 0,this.uvs=void 0,this.roundPixels=void 0,this.data=void 0,this.blendMode=void 0,this.darkTint=void 0,this.texture=void 0,this.transform=void 0,this._textureId=void 0,this._attributeStart=void 0,this._indexStart=void 0,this._batcher=void 0,this._batch=void 0}get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const n=t.a*s*255;if(16777215!==e){const s=e>>16&255,r=e>>8&255,a=255&e,o=t.r*a,l=t.g*r;i=n<<24|t.b*s<<16|l<<8|o}else i=n<<24|255*t.b<<16|255*t.g<<8|255*t.r;return i}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},qs={0:"normal",1:"add",2:"multiply",3:"screen"},Ws=class{constructor(t){this.renderer=void 0,this.gpuSpineData={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,n=e.length;i<n;i++){const n=e[i],r=n.getAttachment();if(r instanceof Kt||r instanceof jt){const e=t._getCachedData(n,r),i=s.slotBatches[e.id],a=e.texture;if(a!==i.texture&&!i._batcher.checkAndUpdateTexture(i,a))return!0}}}return!1}addRenderable(t,s){const i=this._getSpineData(t),n=this.renderer.renderPipes.batch,r=t.skeleton.drawOrder,a=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments();for(let o=0,l=r.length;o<l;o++){const l=r[o],h=l.getAttachment(),c=qs[l.data.blendMode];if(h instanceof Kt||h instanceof jt){const e=t._getCachedData(l,h),r=i.slotBatches[e.id]||=new Us;r.setData(t,e,c,a),e.skipRender||n.addToBatch(r,s)}const d=t._slotsObject[l.data.name];if(d){const t=d.container;t.includeInBuild=!0,e.collectAllRenderables(t,s,this.renderer),t.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments();const s=t.skeleton.drawOrder;for(let n=0,r=s.length;n<r;n++){const r=s[n],a=r.getAttachment();if(a instanceof Kt||a instanceof jt){if(!t._getCachedData(r,a).skipRender){var i;const s=e.slotBatches[t._getCachedData(r,a).id];null===(i=s._batcher)||void 0===i||i.updateElement(s)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};r(Ws,"extension",{type:[e.ExtensionType.WebGLPipes,e.ExtensionType.WebGPUPipes,e.ExtensionType.CanvasPipes],name:"spine"}),e.extensions.add(Ws);var zs=new p;ve.yDown=!0;var js=new ks,Gs=new g((()=>new e.Graphics)),$s=class extends e.ViewContainer{getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t?e.Ticker.shared.add(this.internalUpdate,this):e.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=t}constructor(t){var e,s,i;t instanceof Ie&&(t={skeletonData:t}),super(),this.batched=!0,this.buildId=0,this.renderPipeId="spine",this._didSpineUpdate=!1,this.beforeUpdateWorldTransforms=()=>{},this.afterUpdateWorldTransforms=()=>{},this.skeleton=void 0,this.state=void 0,this.skeletonBounds=void 0,this.darkTint=!1,this._debug=void 0,this._slotsObject=Object.create(null),this.clippingSlotToPixiMasks=Object.create(null),this.spineAttachmentsDirty=!0,this.spineTexturesDirty=!0,this._lastAttachments=[],this._stateChanged=!0,this.attachmentCacheData=[],this._autoUpdate=!0,this.hasNeverUpdated=!0,this.currentClippingSlot=void 0;const n=t instanceof Ie?t:t.skeletonData;this.skeleton=new ve(n),this.state=new vt(new Rt(n)),this.autoUpdate=(null===(e=t)||void 0===e?void 0:e.autoUpdate)??!0,this.darkTint=void 0===(null===(s=t)||void 0===s?void 0:s.darkTint)?this.skeleton.slots.some((t=>!!t.data.darkColor)):null===(i=t)||void 0===i?void 0:i.darkTint;const r=this.skeleton.slots;for(let t=0;t<r.length;t++)this.attachmentCacheData[t]=Object.create(null)}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this._updateAndApplyState(s??e.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(zs.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(zs);t.x=e.x,t.y=-e.y}else t.x=zs.x,t.y=zs.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,i=!1;for(let n=0;n<t.length;n++){const r=t[n].getAttachment();r&&(r!==e[s]&&(i=!0,e[s]=r),s++)}s!==e.length&&(i=!0,e.length=s),this.spineAttachmentsDirty=i}updateAndSetPixiMask(t,e){const s=t.attachment;if(s&&s instanceof Vt){return(this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array}).maskComputed=!1,void(this.currentClippingSlot=this.clippingSlotToPixiMasks[t.data.name])}let i=this.currentClippingSlot,n=this._slotsObject[t.data.name];if(i&&n){let t=i.slot,e=t.attachment,s=i.mask;if(s||(s=Gs.obtain(),i.mask=s,this.addChild(s)),!i.maskComputed){i.maskComputed=!0;const n=e.worldVerticesLength,r=i.vertices;e.computeWorldVertices(t,0,n,r,0,2),s.clear().poly(r).stroke({width:0}).fill({alpha:.25})}n.container.mask=s}else null!=n&&n.container.mask&&(n.container.mask=null);if(i&&i.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e)for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof Vt&&e.maskComputed||!e.mask||(this.removeChild(e.mask),Gs.free(e.mask),e.mask=void 0)}}transformAttachments(){const t=this.skeleton.drawOrder;for(let i=0;i<t.length;i++){const n=t[i];this.updateAndSetPixiMask(n,i===t.length-1);const r=n.getAttachment();if(r)if(r instanceof jt||r instanceof Kt){var s;const t=this._getCachedData(n,r);r instanceof Kt?r.computeWorldVertices(n,t.vertices,0,2):r.computeWorldVertices(n,0,r.worldVerticesLength,t.vertices,0,2),t.uvs.length<r.uvs.length&&(t.uvs=new Float32Array(r.uvs.length)),e.fastCopy(r.uvs.buffer,t.uvs.buffer);const i=n.bone.skeleton.color,a=n.color,o=r.color;t.color.set(i.r*a.r*o.r,i.g*a.g*o.g,i.b*a.b*o.b,i.a*a.a*o.a),n.darkColor&&t.darkColor.setFromColor(n.darkColor),t.skipRender=t.clipped=!1;const l=(null===(s=r.region)||void 0===s?void 0:s.texture.texture)||e.Texture.EMPTY;t.texture!==l&&(t.texture=l,this.spineTexturesDirty=!0),js.isClipping()&&this.updateClippingData(t)}else if(r instanceof Vt){js.clipStart(n,r);continue}js.clipEndWithSlot(n)}js.clipEnd()}updateClippingData(t){t.clipped=!0,js.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:i}=js,n=e.length/2,r=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*n),uvs:new Float32Array(2*n),vertexCount:n,indices:new Uint16Array(r),indicesCount:r},this.spineAttachmentsDirty=!0);const a=t.clippedData,o=a.vertexCount!==n||r!==a.indicesCount;t.skipRender=0===n,o&&(this.spineAttachmentsDirty=!0,a.vertexCount<n&&(a.vertices=new Float32Array(2*n),a.uvs=new Float32Array(2*n)),a.indices.length<r&&(a.indices=new Uint16Array(r)));const{vertices:l,uvs:h,indices:c}=a;for(let t=0;t<n;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];a.vertexCount=n;for(let t=0;t<r;t++)c[t]!==i[t]&&(this.spineAttachmentsDirty=!0,c[t]=i[t]);a.indicesCount=r}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:s,container:i}=t;if(i.visible=this.skeleton.drawOrder.includes(s),i.visible){const t=s.bone;i.position.set(t.worldX,t.worldY),i.scale.x=t.getWorldScaleX(),i.scale.y=t.getWorldScaleY(),i.rotation=t.getWorldRotationX()*e.DEG_TO_RAD,i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){let s;var i,n;e instanceof Kt?(s=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new l(1,1,1,1),darkColor:new l(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null===(i=e.region)||void 0===i?void 0:i.texture.texture}):(s=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new l(1,1,1,1),darkColor:new l(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null===(n=e.region)||void 0===n?void 0:n.texture.texture});return this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){var t;if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),null===(t=this.debug)||void 0===t||t.renderDebug(this)}addSlotObject(t,e){t=this.getSlotFromRef(t);for(const t in this._slotsObject){var s;(null===(s=this._slotsObject[t])||void 0===s?void 0:s.container)===e&&this.removeSlotObject(this._slotsObject[t].slot)}this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const i={container:e,slot:t};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(t){let s;if(t instanceof e.Container)for(const e in this._slotsObject){var i;if((null===(i=this._slotsObject[e])||void 0===i?void 0:i.container)===t){this._slotsObject[e]=null,s=t;break}}else{var n;const e=this.getSlotFromRef(t);s=null===(n=this._slotsObject[e.data.name])||void 0===n?void 0:n.container,this._slotsObject[e.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}getSlotObject(t){var e;return t=this.getSlotFromRef(t),null===(e=this._slotsObject[t.data.name])||void 0===e?void 0:e.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new ys;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const i=t[s],n=i.getAttachment();if(n&&(n instanceof Kt||n instanceof jt)){const t=this._getCachedData(i,n);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),e.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:t,atlas:s,scale:i=1,darkTint:n,autoUpdate:r=!0}){const a=`${t}-${s}-${i}`;if(e.Cache.has(a))return new $s(e.Cache.get(a));const o=e.Assets.get(t),l=e.Assets.get(s),h=new ee(l),c=o instanceof Uint8Array?new Xe(h):new Ss(h);c.scale=i;const d=c.readSkeletonData(o);return e.Cache.set(a,d),new $s({skeletonData:d,darkTint:n,autoUpdate:r})}},Hs={AlphaTimeline:$,Animation:I,AnimationState:vt,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:Rt,AssetManagerBase:class{constructor(t,e="",s=new ae){this.pathPrefix="",this.textureLoader=void 0,this.downloader=void 0,this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),r=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let a=new Ut(n),o=a.pages.length,l=!1;for(let n of a.pages)this.loadTexture(i?i[n.name]:r+n.name,((s,i)=>{l||(n.setTexture(i),0==--o&&this.success(e,t,a))}),((e,i)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},AtlasAttachmentLoader:ee,Attachment:x,AttachmentTimeline:J,BinaryInput:Be,BlendMode:Pe,Bone:ne,BoneData:se,BoundingBoxAttachment:Dt,CURRENT:Bt,ClippingAttachment:Vt,Color:l,ConstraintData:re,CurveTimeline:E,CurveTimeline1:X,CurveTimeline2:B,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)}}},DeformTimeline:Q,Downloader:ae,DrawOrderTimeline:st,Event:oe,EventData:le,EventQueue:Tt,EventTimeline:tt,EventType:It,FIRST:Ft,FakeTexture:class extends Ot{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:Pt,HOLD_MIX:Et,HOLD_SUBSEQUENT:Yt,IkConstraint:he,IkConstraintData:ce,IkConstraintTimeline:it,Inherit:ie,InheritTimeline:z,IntSet:class{constructor(){this.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}},Interpolation:d,MathUtils:c,MeshAttachment:jt,MixBlend:M,MixDirection:F,PathAttachment:Gt,PathConstraint:pe,PathConstraintData:de,PathConstraintMixTimeline:ot,PathConstraintPositionTimeline:rt,PathConstraintSpacingTimeline:at,Physics:Ae,PhysicsConstraintDampingTimeline:dt,PhysicsConstraintGravityTimeline:ft,PhysicsConstraintInertiaTimeline:ht,PhysicsConstraintMassTimeline:ut,PhysicsConstraintMixTimeline:gt,PhysicsConstraintResetTimeline:xt,PhysicsConstraintStrengthTimeline:ct,PhysicsConstraintTimeline:lt,PhysicsConstraintWindTimeline:mt,PointAttachment:$t,Pool:g,PositionMode:ue,Pow:u,PowOut:class extends u{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:K,RGBA2Timeline:H,RGBATimeline:j,RGBTimeline:G,RegionAttachment:Kt,RotateMode:fe,RotateTimeline:R,SETUP:Xt,SUBSEQUENT:Mt,ScaleTimeline:L,ScaleXTimeline:_,ScaleYTimeline:N,SequenceTimeline:wt,ShearTimeline:U,ShearXTimeline:q,ShearYTimeline:W,Skeleton:ve,SpineTexture:Ys,SkeletonBinary:Xe,SkeletonBounds:ys,SkeletonClipping:ks,SkeletonData:Ie,SkeletonJson:Ss,Skin:Fe,SkinEntry:Me,Slot:be,SlotData:Ye,SpacingMode:me,Spine:$s,SpineDebugRenderer:class{constructor(){this.registeredSpines=new Map,this.drawMeshHull=!0,this.drawMeshTriangles=!0,this.drawBones=!0,this.drawPaths=!0,this.drawBoundingBoxes=!0,this.drawClipping=!0,this.drawRegionAttachments=!0,this.drawEvents=!0,this.lineWidth=1,this.regionAttachmentsColor=30975,this.meshHullColor=30975,this.meshTrianglesColor=16763904,this.clippingPolygonColor=16711935,this.boundingBoxesRectColor=65280,this.boundingBoxesPolygonColor=65280,this.boundingBoxesCircleColor=65280,this.pathsCurveColor=16711680,this.pathsLineColor=16711935,this.skeletonXYColor=16711680,this.bonesColor=61132,this.eventFontSize=24,this.eventFontColor=0}registerSpine(t){if(this.registeredSpines.has(t))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);const s={parentDebugContainer:new e.Container,bones:new e.Container,skeletonXY:new e.Graphics,regionAttachmentsShape:new e.Graphics,meshTrianglesLine:new e.Graphics,meshHullLine:new e.Graphics,clippingPolygon:new e.Graphics,boundingBoxesRect:new e.Graphics,boundingBoxesCircle:new e.Graphics,boundingBoxesPolygon:new e.Graphics,pathsCurve:new e.Graphics,pathsLine:new e.Graphics,eventText:new e.Container,eventCallback:{event:(i,n)=>{if(this.drawEvents){const i=Math.abs(t.scale.x||t.scale.y||1),r=new e.Text({text:n.data.name,style:{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"}});r.scale.x=Math.sign(t.scale.x),r.anchor.set(.5),s.eventText.addChild(r),setTimeout((()=>{r.destroyed||r.destroy()}),250)}}}};s.parentDebugContainer.addChild(s.bones),s.parentDebugContainer.addChild(s.skeletonXY),s.parentDebugContainer.addChild(s.regionAttachmentsShape),s.parentDebugContainer.addChild(s.meshTrianglesLine),s.parentDebugContainer.addChild(s.meshHullLine),s.parentDebugContainer.addChild(s.clippingPolygon),s.parentDebugContainer.addChild(s.boundingBoxesRect),s.parentDebugContainer.addChild(s.boundingBoxesCircle),s.parentDebugContainer.addChild(s.boundingBoxesPolygon),s.parentDebugContainer.addChild(s.pathsCurve),s.parentDebugContainer.addChild(s.pathsLine),s.parentDebugContainer.addChild(s.eventText),s.parentDebugContainer.zIndex=9999999,s.parentDebugContainer.accessibleChildren=!1,s.parentDebugContainer.eventMode="none",s.parentDebugContainer.interactiveChildren=!1,t.addChild(s.parentDebugContainer),t.state.addListener(s.eventCallback),this.registeredSpines.set(t,s)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(t,s,i,n){const r=t.skeleton,a=r.x,o=r.y,l=r.bones;s.skeletonXY.strokeStyle={width:i,color:this.skeletonXYColor};for(let t=0,r=l.length;t<r;t++){const r=l[t],h=r.data.length,c=a+r.worldX,d=o+r.worldY,u=a+h*r.a+r.worldX,m=o+h*r.b+r.worldY;if("root"===r.data.name||null===r.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,b=Math.pow(g,2),w=Math.sqrt(p+b),y=Math.pow(w,2),v=Math.PI/180,k=Math.acos((y+b-p)/(2*x*w))||0;if(0===w)continue;const S=new e.Graphics;s.bones.addChild(S);const C=w/50/n;S.context.poly([0,0,0-C,w-3*C,0,w-C,0+C,w-3*C]).fill(this.bonesColor),S.x=c,S.y=d,S.pivot.y=w;let A=0;c<u&&d<m?A=180*v-k:c>u&&d<m?A=180*v+k:c>u&&d>m?A=-k:c<u&&d>m?A=k:d===m&&c<u?A=90*v:d===m&&c>u?A=-90*v:c===u&&d<m?A=180*v:c===u&&d>m&&(A=0),S.rotation=A,S.circle(0,w,1.2*C).fill({color:0,alpha:.6}).stroke({width:i+C/2.4,color:this.bonesColor})}const h=3*i;s.skeletonXY.context.moveTo(a-h,o-h).lineTo(a+h,o+h).moveTo(a+h,o-h).lineTo(a-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t],n=s.getAttachment();if(null===n||!(n instanceof Kt))continue;const r=n,a=new Float32Array(8);r.computeWorldVertices(s,a,0,2),e.regionAttachmentsShape.poly(Array.from(a.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof jt))continue;const r=n,a=new Float32Array(r.worldVerticesLength),o=r.triangles;let l=r.hullLength;if(r.computeWorldVertices(s,0,r.worldVerticesLength,a,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],i=2*o[t+1],n=2*o[t+2];e.meshTrianglesLine.context.moveTo(a[s],a[s+1]).lineTo(a[i],a[i+1]).lineTo(a[n],a[n+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=a[l-2],s=a[l-1];for(let i=0,n=l;i<n;i+=2){const n=a[i],r=a[i+1];e.meshHullLine.context.moveTo(n,r).lineTo(t,s),t=n,s=r}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Vt))continue;const r=n,a=r.worldVerticesLength,o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new ys;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=i.polygons,r=(t,i,n)=>{if(n<3)throw new Error("Polygon must contain at least 3 vertices");const r=[],a=2*s;for(let s=0,i=t.length;s<i;s+=2){const i=t[s],n=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(i,n,a),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(i,n,a).fill({color:this.boundingBoxesCircleColor}),r.push(i,n)}e.boundingBoxesPolygon.poly(r).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=n.length;t<e;t++){const e=n[t];r(e,0,e.length)}}drawPathsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Gt))continue;const r=n;let a=r.worldVerticesLength;const o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(r.closed){const t=o[0],s=o[1],i=o[a-2],n=o[a-1];c=o[a-4],d=o[a-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,i,n,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(i,n)}a-=4;for(let t=4;t<a;t+=6){const s=o[t],i=o[t+1],n=o[t+2],r=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,i,n,r,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,i),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,r),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:Ws,SpineTexture:Ys,StringSet:a,Texture:Ot,TextureAtlas:Ut,TextureAtlasPage:Wt,TextureAtlasRegion:zt,TextureFilter:Lt,TextureRegion:Nt,TextureWrap:_t,TimeKeeper:class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.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)}},Timeline:P,TrackEntry:At,TransformConstraint:we,TransformConstraintData:Ee,TransformConstraintTimeline:nt,TranslateTimeline:D,TranslateXTimeline:V,TranslateYTimeline:O,Triangulator:vs,Utils:f,Vector2:p,VertexAttachment:w,WindowedMean:class{constructor(t=32){this.values=void 0,this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,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}}};function Ks(t){return function(e,s){var i=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,s);i.key=s,i.type=t}}function Js(t,e,s,i){var n,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,s,a):n(e,s))||a);return r>3&&a&&Object.defineProperty(e,s,a),a}function Qs(t,e,s,i){return new(s||(s=Promise))((function(n,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){t.done?n(t.value):new s((function(e){e(t.value)})).then(a,o)}l((i=i.apply(t,e||[])).next())}))}class Zs extends s.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.waitExecuteInfos=[]}set armature(t){if(this._armature=t,t){this.autoPlay&&this.play(this.animationName);for(const t of this.waitExecuteInfos)if(t.playType){const{name:e,loop:s,track:i}=t;this.play(e,s,i)}else this.stop(t.track);this.waitExecuteInfos=[]}}get armature(){return this._armature}init(t){t&&_extends(this,t)}onDestroy(){this.destroied=!0}play(t,e,s){try{t&&(this.animationName=t),this.armature?(void 0===s&&(s=0),this.armature.state.setAnimation(s,this.animationName,e)):this.waitExecuteInfos.push({playType:!0,name:t,loop:null!=e?e:this.autoPlay,track:s})}catch(t){console.log(t)}}stop(t){this.armature?(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0)):this.waitExecuteInfos.push({playType:!1,track:t})}addAnimation(t,e,s,i){try{this.armature&&(void 0===i&&(i=0),this.armature.state.addAnimation(i,t,s,e))}catch(t){console.log(t)}}setMix(t,e,s){this.armature&&this.armature.stateData.setMix(t,e,s)}getAnim(t=0){try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}}setDefaultMix(t){this.armature&&(this.armature.stateData.defaultMix=t)}setAttachment(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)}getBone(t){if(this.armature)return this.armature.skeleton.findBone(t)}}Zs.componentName="Spine",Js([Ks("string")],Zs.prototype,"resource",void 0),Js([Ks("number")],Zs.prototype,"scale",void 0),Js([Ks("string")],Zs.prototype,"animationName",void 0),Js([Ks("boolean")],Zs.prototype,"autoPlay",void 0);let ti={};function ei(t,s){let i=ti[t];return i||(i=function(t){const s=t.image;return{tex:s instanceof e.Texture?s:e.Texture.from(s),count:0}}(s),ti[t]=i),i.count++,i.tex}let si={};function ii(t,e,s){return Qs(this,void 0,void 0,(function*(){let i=si[t.name];if(!i)if(t.complete)i=function(t,e,s,i){const n=e.ske,r=e.atlas,a=new i.AtlasAttachmentLoader(r),o=n instanceof Uint8Array?new i.SkeletonBinary(a):new i.SkeletonJson(a);o.scale=s||1;const l={spineData:o.readSkeletonData(n),ref:0,imageSrc:e.image.label};return si[t]=l,l}(t.name,t.data,e,s);else if(!i)return;return ei(t.data.image.label,t.data),i.ref++,i.spineData}))}function ni(t,e){const s=si[t];s&&(s.ref--,s.ref<=0&&(!function(t){t&&setTimeout((()=>{const e=ti[t];e&&(e.count--,e.count<=0&&(e.tex&&(e.tex.destroy(!0),e.tex=null),delete ti[t]))}),100)}(e),delete si[t]))}let ri=class extends i.Renderer{constructor(){super(...arguments),this.armatures={}}init({pixiSpine:t}){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=t,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let e=[];for(let i in this.armatures){const n=+i;for(let i=0;i<t.length;++i){let r=t[i];if(r.id===n){let t=r.getComponent(Zs);t&&(this.remove({type:s.OBSERVER_TYPE.REMOVE,gameObject:r,component:t,componentName:Zs.componentName}),e.push({type:s.OBSERVER_TYPE.ADD,gameObject:r,component:t,componentName:Zs.componentName}));break}}}setTimeout((()=>{e.forEach((t=>{this.add(t)}))}),1e3)}),!1)}update(t){for(let e in this.armatures)this.armatures[e].update(.001*t.deltaTime);super.update()}componentChanged(t){return Qs(this,void 0,void 0,(function*(){if("Spine"===t.componentName)if(t.type===s.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===s.OBSERVER_TYPE.CHANGE){if("resource"===t.prop.prop[0])this.change(t)}else t.type===s.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t,e){var i,n;return Qs(this,void 0,void 0,(function*(){const r=t.component;clearTimeout(r.addHandler);const a=t.gameObject.id,o=this.increaseAsyncId(a),l=yield s.resource.getResource(r.resource);if(!this.validateAsyncId(a,o))return;const h=yield ii(l,r.scale,this.pixiSpine);if(!this.validateAsyncId(a,o))return;if(!h)return void(r.addHandler=setTimeout((()=>{r.destroied||(void 0===e&&(e=20),--e>0?this.add(t,e):console.log("retry exceed max times",r.resource))}),1e3));this.remove(t);const c=null===(n=null===(i=this.renderSystem)||void 0===i?void 0:i.containerManager)||void 0===n?void 0:n.getContainer(t.gameObject.id);if(!c)return;r.lastResource=r.resource;const d=new this.pixiSpine.Spine({skeletonData:h,autoUpdate:!1});if(this.armatures[t.gameObject.id]=d,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;d.x=e.size.width*e.origin.x,d.y=e.size.height*e.origin.y}c.addChildAt(d,0),d.update(),r.armature=d,r.emit("loaded",{resource:r.resource}),d.state.addListener({start:(t,e)=>{r.emit("start",{track:t,name:t.animation.name})},complete:(t,e)=>{r.emit("complete",{track:t,name:t.animation.name})},interrupt:(t,e)=>{r.emit("interrupt",{track:t,name:t.animation.name})},end:(t,e)=>{r.emit("end",{track:t,name:t.animation.name})},event:(t,e)=>{r.emit("event",t,e)}})}))}change(t){this.remove(t),this.add(t)}remove(t){var e,i,n,r;return Qs(this,void 0,void 0,(function*(){this.increaseAsyncId(t.gameObject.id);const a=t.component;clearTimeout(a.addHandler);const o=this.armatures[t.gameObject.id],l=null===(i=null===(e=this.renderSystem)||void 0===e?void 0:e.containerManager)||void 0===i?void 0:i.getContainer(t.gameObject.id);if(l&&o&&l.removeChild(o),a.armature){a.armature.destroy({children:!0});const t=yield s.resource.getResource(a.lastResource);ni(t.name,null===(r=null===(n=t.data)||void 0===n?void 0:n.image)||void 0===r?void 0:r.src)}a.armature=null,delete this.armatures[t.gameObject.id],t.type,s.OBSERVER_TYPE.CHANGE}))}};ri.systemName="SpineSystem",ri=Js([s.decorators.componentObserver({Spine:["resource"]})],ri);var ai=ri;s.resource.registerResourceType("SPINE");return t.PixiSpine=Hs,t.Spine=class extends Zs{},t.SpineSystem=class extends ai{init(){super.init({pixiSpine:Hs})}},Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer);window.EVA.plugin.renderer.spine=window.EVA.plugin.renderer.spine||_EVA_IIFE_spine;
|