Files
mini-viewer/vendor/spine.js
T

85 lines
229 KiB
JavaScript

var ci=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var fr=Object.getOwnPropertyNames;var ur=Object.prototype.hasOwnProperty;var mr=(A,t,e)=>t in A?ci(A,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):A[t]=e;var Ni=(A,t)=>{for(var e in t)ci(A,e,{get:t[e],enumerable:!0})},gr=(A,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of fr(t))!ur.call(A,s)&&s!==e&&ci(A,s,{get:()=>t[s],enumerable:!(i=dr(t,s))||i.enumerable});return A};var pr=A=>gr(ci({},"__esModule",{value:!0}),A);var c=(A,t,e)=>mr(A,typeof t!="symbol"?t+"":t,e);var Qr={};Ni(Qr,{core:()=>Zi,webgl:()=>sr});module.exports=pr(Qr);var Zi={};Ni(Zi,{AlphaTimeline:()=>Re,Animation:()=>re,AnimationState:()=>yi,AnimationStateAdapter:()=>vi,AnimationStateData:()=>Si,AssetCache:()=>$s,AssetManagerBase:()=>Is,AtlasAttachmentLoader:()=>Ti,Attachment:()=>os,AttachmentTimeline:()=>Ut,BinaryInput:()=>ti,BlendMode:()=>qt,Bone:()=>us,BoneData:()=>Ke,BoundingBoxAttachment:()=>Ze,CURRENT:()=>Ui,ClippingAttachment:()=>Zt,Color:()=>N,ConstraintData:()=>Jt,CurveTimeline:()=>Ot,CurveTimeline1:()=>Xt,CurveTimeline2:()=>hs,DebugUtils:()=>ui,DeformTimeline:()=>Xe,Downloader:()=>ms,DrawOrderTimeline:()=>jt,Event:()=>Je,EventData:()=>Qe,EventQueue:()=>Qs,EventTimeline:()=>ne,EventType:()=>Yt,FIRST:()=>Ai,FakeTexture:()=>Ii,HOLD_FIRST:()=>Ks,HOLD_MIX:()=>Di,HOLD_SUBSEQUENT:()=>Ci,IkConstraint:()=>Ts,IkConstraintData:()=>_e,IkConstraintTimeline:()=>Le,Inherit:()=>xt,InheritTimeline:()=>Te,IntSet:()=>di,Interpolation:()=>Hs,MathUtils:()=>B,MeshAttachment:()=>Nt,MixBlend:()=>P,MixDirection:()=>Mt,PathAttachment:()=>zt,PathConstraint:()=>Es,PathConstraintData:()=>$e,PathConstraintMixTimeline:()=>Oe,PathConstraintPositionTimeline:()=>Be,PathConstraintSpacingTimeline:()=>Ve,Physics:()=>ae,PhysicsConstraintDampingTimeline:()=>Ue,PhysicsConstraintGravityTimeline:()=>qe,PhysicsConstraintInertiaTimeline:()=>Ne,PhysicsConstraintMassTimeline:()=>ze,PhysicsConstraintMixTimeline:()=>Ge,PhysicsConstraintResetTimeline:()=>He,PhysicsConstraintStrengthTimeline:()=>De,PhysicsConstraintTimeline:()=>$t,PhysicsConstraintWindTimeline:()=>We,PointAttachment:()=>Ms,Pool:()=>Qt,PositionMode:()=>Lt,Pow:()=>js,PowOut:()=>fi,RGB2Timeline:()=>ke,RGBA2Timeline:()=>Fe,RGBATimeline:()=>Ee,RGBTimeline:()=>Ye,RegionAttachment:()=>Kt,RotateMode:()=>te,RotateTimeline:()=>_t,SETUP:()=>Mi,SUBSEQUENT:()=>Zs,ScaleTimeline:()=>ve,ScaleXTimeline:()=>Ae,ScaleYTimeline:()=>Ce,SequenceTimeline:()=>je,ShearTimeline:()=>Me,ShearXTimeline:()=>Se,ShearYTimeline:()=>Ie,Skeleton:()=>Ys,SkeletonBinary:()=>Yi,SkeletonBounds:()=>Ps,SkeletonClipping:()=>Vs,SkeletonData:()=>ts,SkeletonJson:()=>Ri,Skin:()=>de,SkinEntry:()=>Ls,Slot:()=>Rs,SlotData:()=>es,SpacingMode:()=>bt,StringSet:()=>pe,Texture:()=>cs,TextureAtlas:()=>ds,TextureAtlasPage:()=>_s,TextureAtlasRegion:()=>fs,TextureFilter:()=>St,TextureRegion:()=>Cs,TextureWrap:()=>ce,TimeKeeper:()=>xe,Timeline:()=>gt,TrackEntry:()=>Js,TransformConstraint:()=>Fs,TransformConstraintData:()=>ss,TransformConstraintTimeline:()=>Pe,TranslateTimeline:()=>we,TranslateXTimeline:()=>be,TranslateYTimeline:()=>ye,Triangulator:()=>Bs,Utils:()=>O,Vector2:()=>Vt,VertexAttachment:()=>vt,WindowedMean:()=>mi});var di=class{constructor(){c(this,"array",new Array)}add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},pe=class{constructor(){c(this,"entries",{});c(this,"size",0)}add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var i=0,s=t.length;i<s;i++)this.add(t[i]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},Dt=class Dt{constructor(t=0,e=0,i=0,s=0){c(this,"r");c(this,"g");c(this,"b");c(this,"a");this.r=t,this.g=e,this.b=i,this.a=s}set(t,e,i,s){return this.r=t,this.g=e,this.b=i,this.a=s,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=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,i,s){return this.r+=t,this.g+=e,this.b+=i,this.a+=s,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=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}toRgb888(){let t=e=>("0"+(e*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,e=new Dt){return e.setFromString(t)}};c(Dt,"WHITE",new Dt(1,1,1,1)),c(Dt,"RED",new Dt(1,0,0,1)),c(Dt,"GREEN",new Dt(0,1,0,1)),c(Dt,"BLUE",new Dt(0,0,1,1)),c(Dt,"MAGENTA",new Dt(1,0,1,1));var N=Dt,At=class At{static clamp(t,e,i){return t<e?e:t>i?i:t}static cosDeg(t){return Math.cos(t*At.degRad)}static sinDeg(t){return Math.sin(t*At.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*At.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),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return At.randomTriangularWith(t,e,(t+e)*.5)}static randomTriangularWith(t,e,i){let s=Math.random(),n=e-t;return s<=(i-t)/n?t+Math.sqrt(s*n*(i-t)):e-Math.sqrt((1-s)*n*(e-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}};c(At,"PI",3.1415927),c(At,"PI2",At.PI*2),c(At,"invPI2",1/At.PI2),c(At,"radiansToDegrees",180/At.PI),c(At,"radDeg",At.radiansToDegrees),c(At,"degreesToRadians",At.PI/180),c(At,"degRad",At.degreesToRadians);var B=At,Hs=class{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}},js=class extends Hs{constructor(e){super();c(this,"power",2);this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},fi=class extends js{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},ge=class ge{static arrayCopy(t,e,i,s,n){for(let o=e,h=s;o<e+n;o++,h++)i[h]=t[o]}static arrayFill(t,e,i,s){for(let n=e;n<i;n++)t[n]=s}static setArraySize(t,e,i=0){let s=t.length;if(s==e)return t;if(t.length=e,s<e)for(let n=s;n<e;n++)t[n]=i;return t}static ensureArrayCapacity(t,e,i=0){return t.length>=e?t:ge.setArraySize(t,e,i)}static newArray(t,e){let i=new Array(t);for(let s=0;s<t;s++)i[s]=e;return i}static newFloatArray(t){if(ge.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let i=0;i<e.length;i++)e[i]=0;return e}}static newShortArray(t){if(ge.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let i=0;i<e.length;i++)e[i]=0;return e}}static toFloatArray(t){return ge.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return ge.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,i=!0){for(var s=0;s<t.length;s++)if(t[s]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}};c(ge,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array!="undefined");var O=ge,ui=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let i=t.bones[e];console.log(i.data.name+", "+i.a+", "+i.b+", "+i.c+", "+i.d+", "+i.worldX+", "+i.worldY)}}},Qt=class{constructor(t){c(this,"items",new Array);c(this,"instantiator");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}},Vt=class{constructor(t=0,e=0){c(this,"x");c(this,"y");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 t!=0&&(this.x/=t,this.y/=t),this}},xe=class{constructor(){c(this,"maxDelta",.064);c(this,"framesPerSecond",0);c(this,"delta",0);c(this,"totalTime",0);c(this,"lastTime",Date.now()/1e3);c(this,"frameCount",0);c(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)}},mi=class{constructor(t=32){c(this,"values");c(this,"addedValues",0);c(this,"lastValue",0);c(this,"mean",0);c(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}};var os=class{constructor(t){c(this,"name");if(!t)throw new Error("name cannot be null.");this.name=t}},gi=class gi extends os{constructor(e){super(e);c(this,"id",gi.nextID++);c(this,"bones",null);c(this,"vertices",[]);c(this,"worldVerticesLength",0);c(this,"timelineAttachment",this)}computeWorldVertices(e,i,s,n,o,h){s=o+(s>>1)*h;let d=e.bone.skeleton,r=e.deform,a=this.vertices,l=this.bones;if(!l){r.length>0&&(a=r);let g=e.bone,x=g.worldX,b=g.worldY,y=g.a,w=g.b,p=g.c,C=g.d;for(let v=i,M=o;M<s;v+=2,M+=h){let S=a[v],I=a[v+1];n[M]=S*y+I*w+x,n[M+1]=S*p+I*C+b}return}let f=0,m=0;for(let g=0;g<i;g+=2){let x=l[f];f+=x+1,m+=x}let u=d.bones;if(r.length==0)for(let g=o,x=m*3;g<s;g+=h){let b=0,y=0,w=l[f++];for(w+=f;f<w;f++,x+=3){let p=u[l[f]],C=a[x],v=a[x+1],M=a[x+2];b+=(C*p.a+v*p.b+p.worldX)*M,y+=(C*p.c+v*p.d+p.worldY)*M}n[g]=b,n[g+1]=y}else{let g=r;for(let x=o,b=m*3,y=m<<1;x<s;x+=h){let w=0,p=0,C=l[f++];for(C+=f;f<C;f++,b+=3,y+=2){let v=u[l[f]],M=a[b]+g[y],S=a[b+1]+g[y+1],I=a[b+2];w+=(M*v.a+S*v.b+v.worldX)*I,p+=(M*v.c+S*v.d+v.worldY)*I}n[x]=w,n[x+1]=p}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),O.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=O.newFloatArray(this.vertices.length),O.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}};c(gi,"nextID",0);var vt=gi;var ys=class ys{constructor(t){c(this,"id",ys.nextID());c(this,"regions");c(this,"start",0);c(this,"digits",0);c(this,"setupIndex",0);this.regions=new Array(t)}copy(){let t=new ys(this.regions.length);return O.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let i=t.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let s=this.regions[i];e.region!=s&&(e.region=s,e.updateRegion())}getPath(t,e){let i=t,s=(this.start+e).toString();for(let n=this.digits-s.length;n>0;n--)i+="0";return i+=s,i}static nextID(){return ys._nextID++}};c(ys,"_nextID",0);var vs=ys,Ct;(function(A){A[A.hold=0]="hold",A[A.once=1]="once",A[A.loop=2]="loop",A[A.pingpong=3]="pingpong",A[A.onceReverse=4]="onceReverse",A[A.loopReverse=5]="loopReverse",A[A.pingpongReverse=6]="pingpongReverse"})(Ct||(Ct={}));var pi=[Ct.hold,Ct.once,Ct.loop,Ct.pingpong,Ct.onceReverse,Ct.loopReverse,Ct.pingpongReverse];var re=class{constructor(t,e,i){c(this,"name");c(this,"timelines",[]);c(this,"timelineIds",new pe);c(this,"duration");if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=i}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,i,s,n,o,h,d){if(!t)throw new Error("skeleton cannot be null.");s&&this.duration!=0&&(i%=this.duration,e>0&&(e%=this.duration));let r=this.timelines;for(let a=0,l=r.length;a<l;a++)r[a].apply(t,e,i,n,o,h,d)}},P;(function(A){A[A.setup=0]="setup",A[A.first=1]="first",A[A.replace=2]="replace",A[A.add=3]="add"})(P||(P={}));var Mt;(function(A){A[A.mixIn=0]="mixIn",A[A.mixOut=1]="mixOut"})(Mt||(Mt={}));var at={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},gt=class{constructor(t,e){c(this,"propertyIds");c(this,"frames");this.propertyIds=e,this.frames=O.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let i=t.length;for(let s=1;s<i;s++)if(t[s]>e)return s-1;return i-1}static search(t,e,i){let s=t.length;for(let n=i;n<s;n+=i)if(t[n]>e)return n-i;return s-i}},Ot=class extends gt{constructor(e,i,s){super(e,s);c(this,"curves");this.curves=O.newFloatArray(e+i*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let i=this.getFrameCount()+e*18;if(this.curves.length>i){let s=O.newFloatArray(i);O.arrayCopy(this.curves,0,s,0,i),this.curves=s}}setBezier(e,i,s,n,o,h,d,r,a,l,f){let m=this.curves,u=this.getFrameCount()+e*18;s==0&&(m[i]=2+u);let g=(n-h*2+r)*.03,x=(o-d*2+a)*.03,b=((h-r)*3-n+l)*.006,y=((d-a)*3-o+f)*.006,w=g*2+b,p=x*2+y,C=(h-n)*.3+g+b*.16666667,v=(d-o)*.3+x+y*.16666667,M=n+C,S=o+v;for(let I=u+18;u<I;u+=2)m[u]=M,m[u+1]=S,C+=w,v+=p,w+=b,p+=y,M+=C,S+=v}getBezierValue(e,i,s,n){let o=this.curves;if(o[n]>e){let a=this.frames[i],l=this.frames[i+s];return l+(e-a)/(o[n]-a)*(o[n+1]-l)}let h=n+18;for(n+=2;n<h;n+=2)if(o[n]>=e){let a=o[n-2],l=o[n-1];return l+(e-a)/(o[n]-a)*(o[n+1]-l)}i+=this.getFrameEntries();let d=o[h-2],r=o[h-1];return r+(e-d)/(this.frames[i]-d)*(this.frames[i+s]-r)}},Xt=class extends Ot{constructor(t,e,i){super(t,e,[i])}getFrameEntries(){return 2}setFrame(t,e,i){t<<=1,this.frames[t]=e,this.frames[t+1]=i}getCurveValue(t){let e=this.frames,i=e.length-2;for(let n=2;n<=i;n+=2)if(e[n]>t){i=n-2;break}let s=this.curves[i>>1];switch(s){case 0:let n=e[i],o=e[i+1];return o+(t-n)/(e[i+2]-n)*(e[i+2+1]-o);case 1:return e[i+1]}return this.getBezierValue(t,i,1,s-2)}getRelativeValue(t,e,i,s,n){if(t<this.frames[0]){switch(i){case P.setup:return n;case P.first:return s+(n-s)*e}return s}let o=this.getCurveValue(t);switch(i){case P.setup:return n+o*e;case P.first:case P.replace:o+=n-s}return s+o*e}getAbsoluteValue(t,e,i,s,n){if(t<this.frames[0]){switch(i){case P.setup:return n;case P.first:return s+(n-s)*e}return s}let o=this.getCurveValue(t);return i==P.setup?n+(o-n)*e:s+(o-s)*e}getAbsoluteValue2(t,e,i,s,n,o){if(t<this.frames[0]){switch(i){case P.setup:return n;case P.first:return s+(n-s)*e}return s}return i==P.setup?n+(o-n)*e:s+(o-s)*e}getScaleValue(t,e,i,s,n,o){let h=this.frames;if(t<h[0]){switch(i){case P.setup:return o;case P.first:return n+(o-n)*e}return n}let d=this.getCurveValue(t)*o;if(e==1)return i==P.add?n+d-o:d;if(s==Mt.mixOut)switch(i){case P.setup:return o+(Math.abs(d)*B.signum(o)-o)*e;case P.first:case P.replace:return n+(Math.abs(d)*B.signum(n)-n)*e}else{let r=0;switch(i){case P.setup:return r=Math.abs(o)*B.signum(d),r+(d-r)*e;case P.first:case P.replace:return r=Math.abs(n)*B.signum(d),r+(d-r)*e}}return n+(d-o)*e}},hs=class extends Ot{constructor(t,e,i,s){super(t,e,[i,s])}getFrameEntries(){return 3}setFrame(t,e,i,s){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s}},_t=class extends Xt{constructor(e,i,s){super(e,i,at.rotate+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,o,h,r.rotation,r.data.rotation))}},we=class extends hs{constructor(e,i,s){super(e,i,at.x+"|"+s,at.y+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];if(!r.active)return;let a=this.frames;if(s<a[0]){switch(h){case P.setup:r.x=r.data.x,r.y=r.data.y;return;case P.first:r.x+=(r.data.x-r.x)*o,r.y+=(r.data.y-r.y)*o}return}let l=0,f=0,m=gt.search(a,s,3),u=this.curves[m/3];switch(u){case 0:let g=a[m];l=a[m+1],f=a[m+2];let x=(s-g)/(a[m+3]-g);l+=(a[m+3+1]-l)*x,f+=(a[m+3+2]-f)*x;break;case 1:l=a[m+1],f=a[m+2];break;default:l=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2)}switch(h){case P.setup:r.x=r.data.x+l*o,r.y=r.data.y+f*o;break;case P.first:case P.replace:r.x+=(r.data.x+l-r.x)*o,r.y+=(r.data.y+f-r.y)*o;break;case P.add:r.x+=l*o,r.y+=f*o}}},be=class extends Xt{constructor(e,i,s){super(e,i,at.x+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,o,h,r.x,r.data.x))}},ye=class extends Xt{constructor(e,i,s){super(e,i,at.y+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,o,h,r.y,r.data.y))}},ve=class extends hs{constructor(e,i,s){super(e,i,at.scaleX+"|"+s,at.scaleY+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];if(!r.active)return;let a=this.frames;if(s<a[0]){switch(h){case P.setup:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case P.first:r.scaleX+=(r.data.scaleX-r.scaleX)*o,r.scaleY+=(r.data.scaleY-r.scaleY)*o}return}let l,f,m=gt.search(a,s,3),u=this.curves[m/3];switch(u){case 0:let g=a[m];l=a[m+1],f=a[m+2];let x=(s-g)/(a[m+3]-g);l+=(a[m+3+1]-l)*x,f+=(a[m+3+2]-f)*x;break;case 1:l=a[m+1],f=a[m+2];break;default:l=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2)}if(l*=r.data.scaleX,f*=r.data.scaleY,o==1)h==P.add?(r.scaleX+=l-r.data.scaleX,r.scaleY+=f-r.data.scaleY):(r.scaleX=l,r.scaleY=f);else{let g=0,x=0;if(d==Mt.mixOut)switch(h){case P.setup:g=r.data.scaleX,x=r.data.scaleY,r.scaleX=g+(Math.abs(l)*B.signum(g)-g)*o,r.scaleY=x+(Math.abs(f)*B.signum(x)-x)*o;break;case P.first:case P.replace:g=r.scaleX,x=r.scaleY,r.scaleX=g+(Math.abs(l)*B.signum(g)-g)*o,r.scaleY=x+(Math.abs(f)*B.signum(x)-x)*o;break;case P.add:r.scaleX+=(l-r.data.scaleX)*o,r.scaleY+=(f-r.data.scaleY)*o}else switch(h){case P.setup:g=Math.abs(r.data.scaleX)*B.signum(l),x=Math.abs(r.data.scaleY)*B.signum(f),r.scaleX=g+(l-g)*o,r.scaleY=x+(f-x)*o;break;case P.first:case P.replace:g=Math.abs(r.scaleX)*B.signum(l),x=Math.abs(r.scaleY)*B.signum(f),r.scaleX=g+(l-g)*o,r.scaleY=x+(f-x)*o;break;case P.add:r.scaleX+=(l-r.data.scaleX)*o,r.scaleY+=(f-r.data.scaleY)*o}}}},Ae=class extends Xt{constructor(e,i,s){super(e,i,at.scaleX+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,o,h,d,r.scaleX,r.data.scaleX))}},Ce=class extends Xt{constructor(e,i,s){super(e,i,at.scaleY+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,o,h,d,r.scaleY,r.data.scaleY))}},Me=class extends hs{constructor(e,i,s){super(e,i,at.shearX+"|"+s,at.shearY+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];if(!r.active)return;let a=this.frames;if(s<a[0]){switch(h){case P.setup:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case P.first:r.shearX+=(r.data.shearX-r.shearX)*o,r.shearY+=(r.data.shearY-r.shearY)*o}return}let l=0,f=0,m=gt.search(a,s,3),u=this.curves[m/3];switch(u){case 0:let g=a[m];l=a[m+1],f=a[m+2];let x=(s-g)/(a[m+3]-g);l+=(a[m+3+1]-l)*x,f+=(a[m+3+2]-f)*x;break;case 1:l=a[m+1],f=a[m+2];break;default:l=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2)}switch(h){case P.setup:r.shearX=r.data.shearX+l*o,r.shearY=r.data.shearY+f*o;break;case P.first:case P.replace:r.shearX+=(r.data.shearX+l-r.shearX)*o,r.shearY+=(r.data.shearY+f-r.shearY)*o;break;case P.add:r.shearX+=l*o,r.shearY+=f*o}}},Se=class extends Xt{constructor(e,i,s){super(e,i,at.shearX+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,o,h,r.shearX,r.data.shearX))}},Ie=class extends Xt{constructor(e,i,s){super(e,i,at.shearY+"|"+s);c(this,"boneIndex",0);this.boneIndex=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,o,h,r.shearY,r.data.shearY))}},Te=class extends gt{constructor(e,i){super(e,[at.inherit+"|"+i]);c(this,"boneIndex",0);this.boneIndex=i}getFrameEntries(){return 2}setFrame(e,i,s){e*=2,this.frames[e]=i,this.frames[e+1]=s}apply(e,i,s,n,o,h,d){let r=e.bones[this.boneIndex];if(!r.active)return;if(d==Mt.mixOut){h==P.setup&&(r.inherit=r.data.inherit);return}let a=this.frames;if(s<a[0]){(h==P.setup||h==P.first)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[gt.search(a,s,2)+1]}},Ee=class extends Ot{constructor(e,i,s){super(e,i,[at.rgb+"|"+s,at.alpha+"|"+s]);c(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,i,s,n,o,h){e*=5,this.frames[e]=i,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=o,this.frames[e+4]=h}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let a=this.frames,l=r.color;if(s<a[0]){let y=r.data.color;switch(h){case P.setup:l.setFromColor(y);return;case P.first:l.add((y.r-l.r)*o,(y.g-l.g)*o,(y.b-l.b)*o,(y.a-l.a)*o)}return}let f=0,m=0,u=0,g=0,x=gt.search(a,s,5),b=this.curves[x/5];switch(b){case 0:let y=a[x];f=a[x+1],m=a[x+2],u=a[x+3],g=a[x+4];let w=(s-y)/(a[x+5]-y);f+=(a[x+5+1]-f)*w,m+=(a[x+5+2]-m)*w,u+=(a[x+5+3]-u)*w,g+=(a[x+5+4]-g)*w;break;case 1:f=a[x+1],m=a[x+2],u=a[x+3],g=a[x+4];break;default:f=this.getBezierValue(s,x,1,b-2),m=this.getBezierValue(s,x,2,b+18-2),u=this.getBezierValue(s,x,3,b+36-2),g=this.getBezierValue(s,x,4,b+54-2)}o==1?l.set(f,m,u,g):(h==P.setup&&l.setFromColor(r.data.color),l.add((f-l.r)*o,(m-l.g)*o,(u-l.b)*o,(g-l.a)*o))}},Ye=class extends Ot{constructor(e,i,s){super(e,i,[at.rgb+"|"+s]);c(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,i,s,n,o){e<<=2,this.frames[e]=i,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=o}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let a=this.frames,l=r.color;if(s<a[0]){let b=r.data.color;switch(h){case P.setup:l.r=b.r,l.g=b.g,l.b=b.b;return;case P.first:l.r+=(b.r-l.r)*o,l.g+=(b.g-l.g)*o,l.b+=(b.b-l.b)*o}return}let f=0,m=0,u=0,g=gt.search(a,s,4),x=this.curves[g>>2];switch(x){case 0:let b=a[g];f=a[g+1],m=a[g+2],u=a[g+3];let y=(s-b)/(a[g+4]-b);f+=(a[g+4+1]-f)*y,m+=(a[g+4+2]-m)*y,u+=(a[g+4+3]-u)*y;break;case 1:f=a[g+1],m=a[g+2],u=a[g+3];break;default:f=this.getBezierValue(s,g,1,x-2),m=this.getBezierValue(s,g,2,x+18-2),u=this.getBezierValue(s,g,3,x+36-2)}if(o==1)l.r=f,l.g=m,l.b=u;else{if(h==P.setup){let b=r.data.color;l.r=b.r,l.g=b.g,l.b=b.b}l.r+=(f-l.r)*o,l.g+=(m-l.g)*o,l.b+=(u-l.b)*o}}},Re=class extends Xt{constructor(e,i,s){super(e,i,at.alpha+"|"+s);c(this,"slotIndex",0);this.slotIndex=s}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let a=r.color;if(s<this.frames[0]){let f=r.data.color;switch(h){case P.setup:a.a=f.a;return;case P.first:a.a+=(f.a-a.a)*o}return}let l=this.getCurveValue(s);o==1?a.a=l:(h==P.setup&&(a.a=r.data.color.a),a.a+=(l-a.a)*o)}},Fe=class extends Ot{constructor(e,i,s){super(e,i,[at.rgb+"|"+s,at.alpha+"|"+s,at.rgb2+"|"+s]);c(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,i,s,n,o,h,d,r,a){e<<=3,this.frames[e]=i,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=o,this.frames[e+4]=h,this.frames[e+5]=d,this.frames[e+6]=r,this.frames[e+7]=a}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let a=this.frames,l=r.color,f=r.darkColor;if(s<a[0]){let v=r.data.color,M=r.data.darkColor;switch(h){case P.setup:l.setFromColor(v),f.r=M.r,f.g=M.g,f.b=M.b;return;case P.first:l.add((v.r-l.r)*o,(v.g-l.g)*o,(v.b-l.b)*o,(v.a-l.a)*o),f.r+=(M.r-f.r)*o,f.g+=(M.g-f.g)*o,f.b+=(M.b-f.b)*o}return}let m=0,u=0,g=0,x=0,b=0,y=0,w=0,p=gt.search(a,s,8),C=this.curves[p>>3];switch(C){case 0:let v=a[p];m=a[p+1],u=a[p+2],g=a[p+3],x=a[p+4],b=a[p+5],y=a[p+6],w=a[p+7];let M=(s-v)/(a[p+8]-v);m+=(a[p+8+1]-m)*M,u+=(a[p+8+2]-u)*M,g+=(a[p+8+3]-g)*M,x+=(a[p+8+4]-x)*M,b+=(a[p+8+5]-b)*M,y+=(a[p+8+6]-y)*M,w+=(a[p+8+7]-w)*M;break;case 1:m=a[p+1],u=a[p+2],g=a[p+3],x=a[p+4],b=a[p+5],y=a[p+6],w=a[p+7];break;default:m=this.getBezierValue(s,p,1,C-2),u=this.getBezierValue(s,p,2,C+18-2),g=this.getBezierValue(s,p,3,C+36-2),x=this.getBezierValue(s,p,4,C+54-2),b=this.getBezierValue(s,p,5,C+72-2),y=this.getBezierValue(s,p,6,C+90-2),w=this.getBezierValue(s,p,7,C+108-2)}if(o==1)l.set(m,u,g,x),f.r=b,f.g=y,f.b=w;else{if(h==P.setup){l.setFromColor(r.data.color);let v=r.data.darkColor;f.r=v.r,f.g=v.g,f.b=v.b}l.add((m-l.r)*o,(u-l.g)*o,(g-l.b)*o,(x-l.a)*o),f.r+=(b-f.r)*o,f.g+=(y-f.g)*o,f.b+=(w-f.b)*o}}},ke=class extends Ot{constructor(e,i,s){super(e,i,[at.rgb+"|"+s,at.rgb2+"|"+s]);c(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,i,s,n,o,h,d,r){e*=7,this.frames[e]=i,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=o,this.frames[e+4]=h,this.frames[e+5]=d,this.frames[e+6]=r}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let a=this.frames,l=r.color,f=r.darkColor;if(s<a[0]){let v=r.data.color,M=r.data.darkColor;switch(h){case P.setup:l.r=v.r,l.g=v.g,l.b=v.b,f.r=M.r,f.g=M.g,f.b=M.b;return;case P.first:l.r+=(v.r-l.r)*o,l.g+=(v.g-l.g)*o,l.b+=(v.b-l.b)*o,f.r+=(M.r-f.r)*o,f.g+=(M.g-f.g)*o,f.b+=(M.b-f.b)*o}return}let m=0,u=0,g=0,x=0,b=0,y=0,w=0,p=gt.search(a,s,7),C=this.curves[p/7];switch(C){case 0:let v=a[p];m=a[p+1],u=a[p+2],g=a[p+3],b=a[p+4],y=a[p+5],w=a[p+6];let M=(s-v)/(a[p+7]-v);m+=(a[p+7+1]-m)*M,u+=(a[p+7+2]-u)*M,g+=(a[p+7+3]-g)*M,b+=(a[p+7+4]-b)*M,y+=(a[p+7+5]-y)*M,w+=(a[p+7+6]-w)*M;break;case 1:m=a[p+1],u=a[p+2],g=a[p+3],b=a[p+4],y=a[p+5],w=a[p+6];break;default:m=this.getBezierValue(s,p,1,C-2),u=this.getBezierValue(s,p,2,C+18-2),g=this.getBezierValue(s,p,3,C+36-2),b=this.getBezierValue(s,p,4,C+54-2),y=this.getBezierValue(s,p,5,C+72-2),w=this.getBezierValue(s,p,6,C+90-2)}if(o==1)l.r=m,l.g=u,l.b=g,f.r=b,f.g=y,f.b=w;else{if(h==P.setup){let v=r.data.color,M=r.data.darkColor;l.r=v.r,l.g=v.g,l.b=v.b,f.r=M.r,f.g=M.g,f.b=M.b}l.r+=(m-l.r)*o,l.g+=(u-l.g)*o,l.b+=(g-l.b)*o,f.r+=(b-f.r)*o,f.g+=(y-f.g)*o,f.b+=(w-f.b)*o}}},Ut=class extends gt{constructor(e,i){super(e,[at.attachment+"|"+i]);c(this,"slotIndex",0);c(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,i,s){this.frames[e]=i,this.attachmentNames[e]=s}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(r.bone.active){if(d==Mt.mixOut){h==P.setup&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[gt.search1(this.frames,s)])}}setAttachment(e,i,s){i.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},Xe=class extends Ot{constructor(e,i,s,n){super(e,i,[at.deform+"|"+s+"|"+n.id]);c(this,"slotIndex",0);c(this,"attachment");c(this,"vertices");this.slotIndex=s,this.attachment=n,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,i,s){this.frames[e]=i,this.vertices[e]=s}setBezier(e,i,s,n,o,h,d,r,a,l,f){let m=this.curves,u=this.getFrameCount()+e*18;s==0&&(m[i]=2+u);let g=(n-h*2+r)*.03,x=a*.03-d*.06,b=((h-r)*3-n+l)*.006,y=(d-a+.33333333)*.018,w=g*2+b,p=x*2+y,C=(h-n)*.3+g+b*.16666667,v=d*.3+x+y*.16666667,M=n+C,S=v;for(let I=u+18;u<I;u+=2)m[u]=M,m[u+1]=S,C+=w,v+=p,w+=b,p+=y,M+=C,S+=v}getCurvePercent(e,i){let s=this.curves,n=s[i];switch(n){case 0:let r=this.frames[i];return(e-r)/(this.frames[i+this.getFrameEntries()]-r);case 1:return 0}if(n-=2,s[n]>e){let r=this.frames[i];return s[n+1]*(e-r)/(s[n]-r)}let o=n+18;for(n+=2;n<o;n+=2)if(s[n]>=e){let r=s[n-2],a=s[n-1];return a+(e-r)/(s[n]-r)*(s[n+1]-a)}let h=s[o-2],d=s[o-1];return d+(1-d)*(e-h)/(this.frames[i+this.getFrameEntries()]-h)}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let a=r.getAttachment();if(!a||!(a instanceof vt)||a.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=P.setup);let f=this.vertices,m=f[0].length,u=this.frames;if(s<u[0]){switch(h){case P.setup:l.length=0;return;case P.first:if(o==1){l.length=0;return}l.length=m;let p=a;if(p.bones){o=1-o;for(var g=0;g<m;g++)l[g]*=o}else{let C=p.vertices;for(var g=0;g<m;g++)l[g]+=(C[g]-l[g])*o}}return}if(l.length=m,s>=u[u.length-1]){let p=f[u.length-1];if(o==1)if(h==P.add){let C=a;if(C.bones)for(let v=0;v<m;v++)l[v]+=p[v];else{let v=C.vertices;for(let M=0;M<m;M++)l[M]+=p[M]-v[M]}}else O.arrayCopy(p,0,l,0,m);else switch(h){case P.setup:{let v=a;if(v.bones)for(let M=0;M<m;M++)l[M]=p[M]*o;else{let M=v.vertices;for(let S=0;S<m;S++){let I=M[S];l[S]=I+(p[S]-I)*o}}break}case P.first:case P.replace:for(let v=0;v<m;v++)l[v]+=(p[v]-l[v])*o;break;case P.add:let C=a;if(C.bones)for(let v=0;v<m;v++)l[v]+=p[v]*o;else{let v=C.vertices;for(let M=0;M<m;M++)l[M]+=(p[M]-v[M])*o}}return}let x=gt.search1(u,s),b=this.getCurvePercent(s,x),y=f[x],w=f[x+1];if(o==1)if(h==P.add){let p=a;if(p.bones)for(let C=0;C<m;C++){let v=y[C];l[C]+=v+(w[C]-v)*b}else{let C=p.vertices;for(let v=0;v<m;v++){let M=y[v];l[v]+=M+(w[v]-M)*b-C[v]}}}else for(let p=0;p<m;p++){let C=y[p];l[p]=C+(w[p]-C)*b}else switch(h){case P.setup:{let C=a;if(C.bones)for(let v=0;v<m;v++){let M=y[v];l[v]=(M+(w[v]-M)*b)*o}else{let v=C.vertices;for(let M=0;M<m;M++){let S=y[M],I=v[M];l[M]=I+(S+(w[M]-S)*b-I)*o}}break}case P.first:case P.replace:for(let C=0;C<m;C++){let v=y[C];l[C]+=(v+(w[C]-v)*b-l[C])*o}break;case P.add:let p=a;if(p.bones)for(let C=0;C<m;C++){let v=y[C];l[C]+=(v+(w[C]-v)*b)*o}else{let C=p.vertices;for(let v=0;v<m;v++){let M=y[v];l[v]+=(M+(w[v]-M)*b-C[v])*o}}}}},xi=class xi extends gt{constructor(e){super(e,xi.propertyIds);c(this,"events");this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,i){this.frames[e]=i.time,this.events[e]=i}apply(e,i,s,n,o,h,d){if(!n)return;let r=this.frames,a=this.frames.length;if(i>s)this.apply(e,i,Number.MAX_VALUE,n,o,h,d),i=-1;else if(i>=r[a-1])return;if(s<r[0])return;let l=0;if(i<r[0])l=0;else{l=gt.search1(r,i)+1;let f=r[l];for(;l>0&&r[l-1]==f;)l--}for(;l<a&&s>=r[l];l++)n.push(this.events[l])}};c(xi,"propertyIds",[""+at.event]);var ne=xi,wi=class wi extends gt{constructor(e){super(e,wi.propertyIds);c(this,"drawOrders");this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,i,s){this.frames[e]=i,this.drawOrders[e]=s}apply(e,i,s,n,o,h,d){if(d==Mt.mixOut){h==P.setup&&O.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&O.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=gt.search1(this.frames,s),a=this.drawOrders[r];if(!a)O.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let l=e.drawOrder,f=e.slots;for(let m=0,u=a.length;m<u;m++)l[m]=f[a[m]]}}};c(wi,"propertyIds",[""+at.drawOrder]);var jt=wi,Le=class extends Ot{constructor(e,i,s){super(e,i,[at.ikConstraint+"|"+s]);c(this,"constraintIndex",0);this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,i,s,n,o,h,d){e*=6,this.frames[e]=i,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=o,this.frames[e+4]=h?1:0,this.frames[e+5]=d?1:0}apply(e,i,s,n,o,h,d){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let a=this.frames;if(s<a[0]){switch(h){case P.setup:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case P.first:r.mix+=(r.data.mix-r.mix)*o,r.softness+=(r.data.softness-r.softness)*o,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let l=0,f=0,m=gt.search(a,s,6),u=this.curves[m/6];switch(u){case 0:let g=a[m];l=a[m+1],f=a[m+2];let x=(s-g)/(a[m+6]-g);l+=(a[m+6+1]-l)*x,f+=(a[m+6+2]-f)*x;break;case 1:l=a[m+1],f=a[m+2];break;default:l=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2)}h==P.setup?(r.mix=r.data.mix+(l-r.data.mix)*o,r.softness=r.data.softness+(f-r.data.softness)*o,d==Mt.mixOut?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=a[m+3],r.compress=a[m+4]!=0,r.stretch=a[m+5]!=0)):(r.mix+=(l-r.mix)*o,r.softness+=(f-r.softness)*o,d==Mt.mixIn&&(r.bendDirection=a[m+3],r.compress=a[m+4]!=0,r.stretch=a[m+5]!=0))}},Pe=class extends Ot{constructor(e,i,s){super(e,i,[at.transformConstraint+"|"+s]);c(this,"constraintIndex",0);this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,i,s,n,o,h,d,r){let a=this.frames;e*=7,a[e]=i,a[e+1]=s,a[e+2]=n,a[e+3]=o,a[e+4]=h,a[e+5]=d,a[e+6]=r}apply(e,i,s,n,o,h,d){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let a=this.frames;if(s<a[0]){let w=r.data;switch(h){case P.setup:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case P.first:r.mixRotate+=(w.mixRotate-r.mixRotate)*o,r.mixX+=(w.mixX-r.mixX)*o,r.mixY+=(w.mixY-r.mixY)*o,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*o,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*o,r.mixShearY+=(w.mixShearY-r.mixShearY)*o}return}let l,f,m,u,g,x,b=gt.search(a,s,7),y=this.curves[b/7];switch(y){case 0:let w=a[b];l=a[b+1],f=a[b+2],m=a[b+3],u=a[b+4],g=a[b+5],x=a[b+6];let p=(s-w)/(a[b+7]-w);l+=(a[b+7+1]-l)*p,f+=(a[b+7+2]-f)*p,m+=(a[b+7+3]-m)*p,u+=(a[b+7+4]-u)*p,g+=(a[b+7+5]-g)*p,x+=(a[b+7+6]-x)*p;break;case 1:l=a[b+1],f=a[b+2],m=a[b+3],u=a[b+4],g=a[b+5],x=a[b+6];break;default:l=this.getBezierValue(s,b,1,y-2),f=this.getBezierValue(s,b,2,y+18-2),m=this.getBezierValue(s,b,3,y+36-2),u=this.getBezierValue(s,b,4,y+54-2),g=this.getBezierValue(s,b,5,y+72-2),x=this.getBezierValue(s,b,6,y+90-2)}if(h==P.setup){let w=r.data;r.mixRotate=w.mixRotate+(l-w.mixRotate)*o,r.mixX=w.mixX+(f-w.mixX)*o,r.mixY=w.mixY+(m-w.mixY)*o,r.mixScaleX=w.mixScaleX+(u-w.mixScaleX)*o,r.mixScaleY=w.mixScaleY+(g-w.mixScaleY)*o,r.mixShearY=w.mixShearY+(x-w.mixShearY)*o}else r.mixRotate+=(l-r.mixRotate)*o,r.mixX+=(f-r.mixX)*o,r.mixY+=(m-r.mixY)*o,r.mixScaleX+=(u-r.mixScaleX)*o,r.mixScaleY+=(g-r.mixScaleY)*o,r.mixShearY+=(x-r.mixShearY)*o}},Be=class extends Xt{constructor(e,i,s){super(e,i,at.pathConstraintPosition+"|"+s);c(this,"constraintIndex",0);this.constraintIndex=s}apply(e,i,s,n,o,h,d){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,o,h,r.position,r.data.position))}},Ve=class extends Xt{constructor(e,i,s){super(e,i,at.pathConstraintSpacing+"|"+s);c(this,"constraintIndex",0);this.constraintIndex=s}apply(e,i,s,n,o,h,d){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,o,h,r.spacing,r.data.spacing))}},Oe=class extends Ot{constructor(e,i,s){super(e,i,[at.pathConstraintMix+"|"+s]);c(this,"constraintIndex",0);this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,i,s,n,o){let h=this.frames;e<<=2,h[e]=i,h[e+1]=s,h[e+2]=n,h[e+3]=o}apply(e,i,s,n,o,h,d){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let a=this.frames;if(s<a[0]){switch(h){case P.setup:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case P.first:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*o,r.mixX+=(r.data.mixX-r.mixX)*o,r.mixY+=(r.data.mixY-r.mixY)*o}return}let l,f,m,u=gt.search(a,s,4),g=this.curves[u>>2];switch(g){case 0:let x=a[u];l=a[u+1],f=a[u+2],m=a[u+3];let b=(s-x)/(a[u+4]-x);l+=(a[u+4+1]-l)*b,f+=(a[u+4+2]-f)*b,m+=(a[u+4+3]-m)*b;break;case 1:l=a[u+1],f=a[u+2],m=a[u+3];break;default:l=this.getBezierValue(s,u,1,g-2),f=this.getBezierValue(s,u,2,g+18-2),m=this.getBezierValue(s,u,3,g+36-2)}if(h==P.setup){let x=r.data;r.mixRotate=x.mixRotate+(l-x.mixRotate)*o,r.mixX=x.mixX+(f-x.mixX)*o,r.mixY=x.mixY+(m-x.mixY)*o}else r.mixRotate+=(l-r.mixRotate)*o,r.mixX+=(f-r.mixX)*o,r.mixY+=(m-r.mixY)*o}},$t=class extends Xt{constructor(e,i,s,n){super(e,i,n+"|"+s);c(this,"constraintIndex",0);this.constraintIndex=s}apply(e,i,s,n,o,h,d){let r;if(this.constraintIndex==-1){let a=s>=this.frames[0]?this.getCurveValue(s):0;for(let l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,o,h,this.get(l),this.setup(l),a))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,o,h,this.get(r),this.setup(r)))}},Ne=class extends $t{constructor(t,e,i){super(t,e,i,at.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},De=class extends $t{constructor(t,e,i){super(t,e,i,at.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},Ue=class extends $t{constructor(t,e,i){super(t,e,i,at.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ze=class extends $t{constructor(t,e,i){super(t,e,i,at.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}},We=class extends $t{constructor(t,e,i){super(t,e,i,at.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},qe=class extends $t{constructor(t,e,i){super(t,e,i,at.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},Ge=class extends $t{constructor(t,e,i){super(t,e,i,at.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},bi=class bi extends gt{constructor(e,i){super(e,bi.propertyIds);c(this,"constraintIndex");this.constraintIndex=i}getFrameCount(){return this.frames.length}setFrame(e,i){this.frames[e]=i}apply(e,i,s,n,o,h,d){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;let a=this.frames;if(i>s)this.apply(e,i,Number.MAX_VALUE,[],o,h,d),i=-1;else if(i>=a[a.length-1])return;if(!(s<a[0])&&(i<a[0]||s>=a[gt.search1(a,i)+1]))if(r!=null)r.reset();else for(let l of e.physicsConstraints)l.active&&l.reset()}};c(bi,"propertyIds",[at.physicsConstraintReset.toString()]);var He=bi,Ht=class Ht extends gt{constructor(e,i,s){super(e,[at.sequence+"|"+i+"|"+s.sequence.id]);c(this,"slotIndex");c(this,"attachment");this.slotIndex=i,this.attachment=s}getFrameEntries(){return Ht.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,i,s,n,o){let h=this.frames;e*=Ht.ENTRIES,h[e]=i,h[e+Ht.MODE]=s|n<<4,h[e+Ht.DELAY]=o}apply(e,i,s,n,o,h,d){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let a=r.attachment,l=this.attachment;if(a!=l&&(!(a instanceof vt)||a.timelineAttachment!=l))return;if(d==Mt.mixOut){h==P.setup&&(r.sequenceIndex=-1);return}let f=this.frames;if(s<f[0]){(h==P.setup||h==P.first)&&(r.sequenceIndex=-1);return}let m=gt.search(f,s,Ht.ENTRIES),u=f[m],g=f[m+Ht.MODE],x=f[m+Ht.DELAY];if(!this.attachment.sequence)return;let b=g>>4,y=this.attachment.sequence.regions.length,w=pi[g&15];if(w!=Ct.hold)switch(b+=(s-u)/x+1e-5|0,w){case Ct.once:b=Math.min(y-1,b);break;case Ct.loop:b%=y;break;case Ct.pingpong:{let p=(y<<1)-2;b=p==0?0:b%p,b>=y&&(b=p-b);break}case Ct.onceReverse:b=Math.max(y-1-b,0);break;case Ct.loopReverse:b=y-1-b%y;break;case Ct.pingpongReverse:{let p=(y<<1)-2;b=p==0?0:(b+y-1)%p,b>=y&&(b=p-b)}}r.sequenceIndex=b}};c(Ht,"ENTRIES",3),c(Ht,"MODE",1),c(Ht,"DELAY",2);var je=Ht;var As=class As{constructor(t){c(this,"data");c(this,"tracks",new Array);c(this,"timeScale",1);c(this,"unkeyedState",0);c(this,"events",new Array);c(this,"listeners",new Array);c(this,"queue",new Qs(this));c(this,"propertyIDs",new pe);c(this,"animationsChanged",!1);c(this,"trackEntryPool",new Qt(()=>new Js));this.data=t}static emptyAnimation(){return As._emptyAnimation}update(t){t*=this.timeScale;let e=this.tracks;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let o=t*n.timeScale;if(n.delay>0){if(n.delay-=o,n.delay>0)continue;o=-n.delay,n.delay=0}let h=n.next;if(h){let d=n.trackLast-h.delay;if(d>=0){for(h.delay=0,h.trackTime+=n.timeScale==0?0:(d/n.timeScale+t)*h.timeScale,n.trackTime+=o,this.setCurrent(i,h,!0);h.mixingFrom;)h.mixTime+=t,h=h.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[i]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let d=n.mixingFrom;for(n.mixingFrom=null,d&&(d.mixingTo=null);d;)this.queue.end(d),d=d.mixingFrom}n.trackTime+=o}this.queue.drain()}updateMixingFrom(t,e){let i=t.mixingFrom;if(!i)return!0;let s=this.updateMixingFrom(i,e);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),s):(i.trackTime+=e*i.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,i=this.tracks,s=!1;for(let f=0,m=i.length;f<m;f++){let u=i[f];if(!u||u.delay>0)continue;s=!0;let g=f==0?P.first:u.mixBlend,x=u.alpha;u.mixingFrom?x*=this.applyMixingFrom(u,t,g):u.trackTime>=u.trackEnd&&!u.next&&(x=0);let b=x>=u.alphaAttachmentThreshold,y=u.animationLast,w=u.getAnimationTime(),p=w,C=e;u.reverse&&(p=u.animation.duration-p,C=null);let v=u.animation.timelines,M=v.length;if(f==0&&x==1||g==P.add){f==0&&(b=!0);for(let S=0;S<M;S++){O.webkit602BugfixHelper(x,g);var n=v[S];n instanceof Ut?this.applyAttachmentTimeline(n,t,p,g,b):n.apply(t,y,p,C,x,g,Mt.mixIn)}}else{let S=u.timelineMode,I=u.shortestRotation,F=!I&&u.timelinesRotation.length!=M<<1;F&&(u.timelinesRotation.length=M<<1);for(let R=0;R<M;R++){let V=v[R],X=S[R]==Zs?g:P.setup;!I&&V instanceof _t?this.applyRotateTimeline(V,t,p,x,X,u.timelinesRotation,R<<1,F):V instanceof Ut?this.applyAttachmentTimeline(V,t,p,g,b):(O.webkit602BugfixHelper(x,g),V.apply(t,y,p,C,x,X,Mt.mixIn))}}this.queueEvents(u,w),e.length=0,u.nextAnimationLast=w,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Mi,h=t.slots,d=0,r=t.slots.length;d<r;d++){var a=h[d];if(a.attachmentState==o){var l=a.data.attachmentName;a.setAttachment(l?t.getAttachment(a.data.index,l):null)}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(t,e,i){let s=t.mixingFrom;s.mixingFrom&&this.applyMixingFrom(s,e,i);let n=0;t.mixDuration==0?(n=1,i==P.first&&(i=P.setup)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),i!=P.first&&(i=s.mixBlend));let o=n<s.mixAttachmentThreshold,h=n<s.mixDrawOrderThreshold,d=s.animation.timelines,r=d.length,a=s.alpha*t.interruptAlpha,l=a*(1-n),f=s.animationLast,m=s.getAnimationTime(),u=m,g=null;if(s.reverse?u=s.animation.duration-u:n<s.eventThreshold&&(g=this.events),i==P.add)for(let x=0;x<r;x++)d[x].apply(e,f,u,g,l,i,Mt.mixOut);else{let x=s.timelineMode,b=s.timelineHoldMix,y=s.shortestRotation,w=!y&&s.timelinesRotation.length!=r<<1;w&&(s.timelinesRotation.length=r<<1),s.totalAlpha=0;for(let p=0;p<r;p++){let C=d[p],v=Mt.mixOut,M,S=0;switch(x[p]){case Zs:if(!h&&C instanceof jt)continue;M=i,S=l;break;case Ai:M=P.setup,S=l;break;case Ci:M=i,S=a;break;case Ks:M=P.setup,S=a;break;default:M=P.setup;let I=b[p];S=a*Math.max(0,1-I.mixTime/I.mixDuration);break}s.totalAlpha+=S,!y&&C instanceof _t?this.applyRotateTimeline(C,e,u,S,M,s.timelinesRotation,p<<1,w):C instanceof Ut?this.applyAttachmentTimeline(C,e,u,M,o&&S>=s.alphaAttachmentThreshold):(O.webkit602BugfixHelper(S,i),h&&C instanceof jt&&M==P.setup&&(v=Mt.mixIn),C.apply(e,f,u,g,S,M,v))}}return t.mixDuration>0&&this.queueEvents(s,m),this.events.length=0,s.nextAnimationLast=m,s.nextTrackLast=s.trackTime,n}applyAttachmentTimeline(t,e,i,s,n){var o=e.slots[t.slotIndex];o.bone.active&&(i<t.frames[0]?(s==P.setup||s==P.first)&&this.setAttachment(e,o,o.data.attachmentName,n):this.setAttachment(e,o,t.attachmentNames[gt.search1(t.frames,i)],n),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Mi))}setAttachment(t,e,i,s){e.setAttachment(i?t.getAttachment(e.data.index,i):null),s&&(e.attachmentState=this.unkeyedState+Ui)}applyRotateTimeline(t,e,i,s,n,o,h,d){if(d&&(o[h]=0),s==1){t.apply(e,0,i,null,1,n,Mt.mixIn);return}let r=e.bones[t.boneIndex];if(!r.active)return;let a=t.frames,l=0,f=0;if(i<a[0])switch(n){case P.setup:r.rotation=r.data.rotation;default:return;case P.first:l=r.rotation,f=r.data.rotation}else l=n==P.setup?r.data.rotation:r.rotation,f=r.data.rotation+t.getCurveValue(i);let m=0,u=f-l;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[h];else{let g=0,x=0;d?(g=0,x=u):(g=o[h],x=o[h+1]);let b=g-g%360;m=u+b;let y=u>=0,w=g>=0;Math.abs(x)<=90&&B.signum(x)!=B.signum(u)&&(Math.abs(g-b)>180?(m+=360*B.signum(g),w=y):b!=0?m-=360*B.signum(g):w=y),w!=y&&(m+=360*B.signum(g)),o[h]=m}o[h+1]=u,r.rotation=l+m*s}queueEvents(t,e){let i=t.animationStart,s=t.animationEnd,n=s-i,o=t.trackLast%n,h=this.events,d=0,r=h.length;for(;d<r;d++){let l=h[d];if(l.time<o)break;l.time>s||this.queue.event(t,l)}let a=!1;if(t.loop)if(n==0)a=!0;else{let l=Math.floor(t.trackTime/n);a=l>0&&l>Math.floor(t.trackLast/n)}else a=e>=s&&t.animationLast<s;for(a&&this.queue.complete(t);d<r;d++){let l=h[d];l.time<i||this.queue.event(t,l)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e<i;e++)this.clearTrack(e);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 i=e;for(;;){let s=i.mixingFrom;if(!s)break;this.queue.end(s),i.mixingFrom=null,i.mixingTo=null,i=s}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,i){let s=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,s&&(i&&this.queue.interrupt(s),e.mixingFrom=s,s.mixingTo=e,e.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(e.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,i=!1){let s=this.data.skeletonData.findAnimation(e);if(!s)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,s,i)}setAnimationWith(t,e,i=!1){if(!e)throw new Error("animation cannot be null.");let s=!0,n=this.expandToIndex(t);n&&(n.nextTrackLast==-1?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,s=!1):this.clearNext(n));let o=this.trackEntry(t,e,i,n);return this.setCurrent(t,o,s),this.queue.drain(),o}addAnimation(t,e,i=!1,s=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,i,s)}addAnimationWith(t,e,i=!1,s=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let o=this.trackEntry(t,e,i,n);return n?(n.next=o,o.previous=n,s<=0&&(s=Math.max(s+n.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),s<0&&(s=0)),o.delay=s,o}setEmptyAnimation(t,e=0){let i=this.setAnimationWith(t,As.emptyAnimation(),!1);return i.mixDuration=e,i.trackEnd=e,i}addEmptyAnimation(t,e=0,i=0){let s=this.addAnimationWith(t,As.emptyAnimation(),!1,i);return i<=0&&(s.delay=Math.max(s.delay+s.mixDuration-e,0)),s.mixDuration=e,s.trackEnd=e,s}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;i++){let n=this.tracks[i];n&&this.setEmptyAnimation(n.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(O.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,i,s){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=i,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=s?this.data.getMix(s.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=P.replace,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,i=t.length;e<i;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do(!s.mixingTo||s.mixBlend!=P.add)&&this.computeHold(s),s=s.mixingTo;while(s)}}}computeHold(t){let e=t.mixingTo,i=t.animation.timelines,s=t.animation.timelines.length,n=t.timelineMode;n.length=s;let o=t.timelineHoldMix;o.length=0;let h=this.propertyIDs;if(e&&e.holdPrevious){for(let d=0;d<s;d++)n[d]=h.addAll(i[d].getPropertyIds())?Ks:Ci;return}t:for(let d=0;d<s;d++){let r=i[d],a=r.getPropertyIds();if(!h.addAll(a))n[d]=Zs;else if(!e||r instanceof Ut||r instanceof jt||r instanceof ne||!e.animation.hasTimeline(a))n[d]=Ai;else{for(let l=e.mixingTo;l;l=l.mixingTo)if(!l.animation.hasTimeline(a)){if(t.mixDuration>0){n[d]=Di,o[d]=l;continue t}break}n[d]=Ks}}}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()}};c(As,"_emptyAnimation",new re("<empty>",[],0));var yi=As,Js=class{constructor(){c(this,"animation",null);c(this,"previous",null);c(this,"next",null);c(this,"mixingFrom",null);c(this,"mixingTo",null);c(this,"listener",null);c(this,"trackIndex",0);c(this,"loop",!1);c(this,"holdPrevious",!1);c(this,"reverse",!1);c(this,"shortestRotation",!1);c(this,"eventThreshold",0);c(this,"mixAttachmentThreshold",0);c(this,"alphaAttachmentThreshold",0);c(this,"mixDrawOrderThreshold",0);c(this,"animationStart",0);c(this,"animationEnd",0);c(this,"animationLast",0);c(this,"nextAnimationLast",0);c(this,"delay",0);c(this,"trackTime",0);c(this,"trackLast",0);c(this,"nextTrackLast",0);c(this,"trackEnd",0);c(this,"timeScale",0);c(this,"alpha",0);c(this,"mixTime",0);c(this,"_mixDuration",0);c(this,"interruptAlpha",0);c(this,"totalAlpha",0);c(this,"mixBlend",P.replace);c(this,"timelineMode",new Array);c(this,"timelineHoldMix",new Array);c(this,"timelinesRotation",new Array)}get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),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 t==0?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(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Qs=class{constructor(t){c(this,"objects",[]);c(this,"drainDisabled",!1);c(this,"animState");this.animState=t}start(t){this.objects.push(Yt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Yt.interrupt),this.objects.push(t)}end(t){this.objects.push(Yt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Yt.dispose),this.objects.push(t)}complete(t){this.objects.push(Yt.complete),this.objects.push(t)}event(t,e){this.objects.push(Yt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects;for(let e=0;e<t.length;e+=2){let i=t[e],s=t[e+1],n=this.animState.listeners.slice();switch(i){case Yt.start:s.listener&&s.listener.start&&s.listener.start(s);for(let h=0;h<n.length;h++){let d=n[h];d.start&&d.start(s)}break;case Yt.interrupt:s.listener&&s.listener.interrupt&&s.listener.interrupt(s);for(let h=0;h<n.length;h++){let d=n[h];d.interrupt&&d.interrupt(s)}break;case Yt.end:s.listener&&s.listener.end&&s.listener.end(s);for(let h=0;h<n.length;h++){let d=n[h];d.end&&d.end(s)}case Yt.dispose:s.listener&&s.listener.dispose&&s.listener.dispose(s);for(let h=0;h<n.length;h++){let d=n[h];d.dispose&&d.dispose(s)}this.animState.trackEntryPool.free(s);break;case Yt.complete:s.listener&&s.listener.complete&&s.listener.complete(s);for(let h=0;h<n.length;h++){let d=n[h];d.complete&&d.complete(s)}break;case Yt.event:let o=t[e+++2];s.listener&&s.listener.event&&s.listener.event(s,o);for(let h=0;h<n.length;h++){let d=n[h];d.event&&d.event(s,o)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Yt;(function(A){A[A.start=0]="start",A[A.interrupt=1]="interrupt",A[A.end=2]="end",A[A.dispose=3]="dispose",A[A.complete=4]="complete",A[A.event=5]="event"})(Yt||(Yt={}));var vi=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},Zs=0,Ai=1,Ci=2,Ks=3,Di=4,Mi=1,Ui=2;var Si=class{constructor(t){c(this,"skeletonData");c(this,"animationToMixTime",{});c(this,"defaultMix",0);if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,i){let s=this.skeletonData.findAnimation(t);if(!s)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(s,n,i)}setMixWith(t,e,i){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let s=t.name+"."+e.name;this.animationToMixTime[s]=i}getMix(t,e){let i=t.name+"."+e.name,s=this.animationToMixTime[i];return s===void 0?this.defaultMix:s}};var Ze=class A extends vt{constructor(e){super(e);c(this,"color",new N(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}};var Zt=class A extends vt{constructor(e){super(e);c(this,"endSlot",null);c(this,"color",new N(.2275,.2275,.8078,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}};var cs=class{constructor(t){c(this,"_image");this._image=t}getImage(){return this._image}},St;(function(A){A[A.Nearest=9728]="Nearest",A[A.Linear=9729]="Linear",A[A.MipMap=9987]="MipMap",A[A.MipMapNearestNearest=9984]="MipMapNearestNearest",A[A.MipMapLinearNearest=9985]="MipMapLinearNearest",A[A.MipMapNearestLinear=9986]="MipMapNearestLinear",A[A.MipMapLinearLinear=9987]="MipMapLinearLinear"})(St||(St={}));var ce;(function(A){A[A.MirroredRepeat=33648]="MirroredRepeat",A[A.ClampToEdge=33071]="ClampToEdge",A[A.Repeat=10497]="Repeat"})(ce||(ce={}));var Cs=class{constructor(){c(this,"texture");c(this,"u",0);c(this,"v",0);c(this,"u2",0);c(this,"v2",0);c(this,"width",0);c(this,"height",0);c(this,"degrees",0);c(this,"offsetX",0);c(this,"offsetY",0);c(this,"originalWidth",0);c(this,"originalHeight",0)}},Ii=class extends cs{setFilters(t,e){}setWraps(t,e){}dispose(){}};var ds=class{constructor(t){c(this,"pages",new Array);c(this,"regions",new Array);let e=new zi(t),i=new Array(4),s={};s.size=a=>{a.width=parseInt(i[1]),a.height=parseInt(i[2])},s.format=()=>{},s.filter=a=>{a.minFilter=O.enumValue(St,i[1]),a.magFilter=O.enumValue(St,i[2])},s.repeat=a=>{i[1].indexOf("x")!=-1&&(a.uWrap=ce.Repeat),i[1].indexOf("y")!=-1&&(a.vWrap=ce.Repeat)},s.pma=a=>{a.pma=i[1]=="true"};var n={};n.xy=a=>{a.x=parseInt(i[1]),a.y=parseInt(i[2])},n.size=a=>{a.width=parseInt(i[1]),a.height=parseInt(i[2])},n.bounds=a=>{a.x=parseInt(i[1]),a.y=parseInt(i[2]),a.width=parseInt(i[3]),a.height=parseInt(i[4])},n.offset=a=>{a.offsetX=parseInt(i[1]),a.offsetY=parseInt(i[2])},n.orig=a=>{a.originalWidth=parseInt(i[1]),a.originalHeight=parseInt(i[2])},n.offsets=a=>{a.offsetX=parseInt(i[1]),a.offsetY=parseInt(i[2]),a.originalWidth=parseInt(i[3]),a.originalHeight=parseInt(i[4])},n.rotate=a=>{let l=i[1];l=="true"?a.degrees=90:l!="false"&&(a.degrees=parseInt(l))},n.index=a=>{a.index=parseInt(i[1])};let o=e.readLine();for(;o&&o.trim().length==0;)o=e.readLine();for(;!(!o||o.trim().length==0||e.readEntry(i,o)==0);)o=e.readLine();let h=null,d=null,r=null;for(;o!==null;)if(o.trim().length==0)h=null,o=e.readLine();else if(h){let a=new fs(h,o);for(;;){let l=e.readEntry(i,o=e.readLine());if(l==0)break;let f=n[i[0]];if(f)f(a);else{d||(d=[]),r||(r=[]),d.push(i[0]);let m=[];for(let u=0;u<l;u++)m.push(parseInt(i[u+1]));r.push(m)}}a.originalWidth==0&&a.originalHeight==0&&(a.originalWidth=a.width,a.originalHeight=a.height),d&&d.length>0&&r&&r.length>0&&(a.names=d,a.values=r,d=null,r=null),a.u=a.x/h.width,a.v=a.y/h.height,a.degrees==90?(a.u2=(a.x+a.height)/h.width,a.v2=(a.y+a.width)/h.height):(a.u2=(a.x+a.width)/h.width,a.v2=(a.y+a.height)/h.height),this.regions.push(a)}else{for(h=new _s(o.trim());e.readEntry(i,o=e.readLine())!=0;){let a=s[i[0]];a&&a(h)}this.pages.push(h)}}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 i of this.pages)i.setTexture(t.get(e+i.name))}dispose(){var t;for(let e=0;e<this.pages.length;e++)(t=this.pages[e].texture)==null||t.dispose()}},zi=class{constructor(t){c(this,"lines");c(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||(e=e.trim(),e.length==0))return 0;let i=e.indexOf(":");if(i==-1)return 0;t[0]=e.substr(0,i).trim();for(let s=1,n=i+1;;s++){let o=e.indexOf(",",n);if(o==-1)return t[s]=e.substr(n).trim(),s;if(t[s]=e.substr(n,o-n).trim(),n=o+1,s==4)return 4}}},_s=class{constructor(t){c(this,"name");c(this,"minFilter",St.Nearest);c(this,"magFilter",St.Nearest);c(this,"uWrap",ce.ClampToEdge);c(this,"vWrap",ce.ClampToEdge);c(this,"texture",null);c(this,"width",0);c(this,"height",0);c(this,"pma",!1);c(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}},fs=class extends Cs{constructor(e,i){super();c(this,"page");c(this,"name");c(this,"x",0);c(this,"y",0);c(this,"offsetX",0);c(this,"offsetY",0);c(this,"originalWidth",0);c(this,"originalHeight",0);c(this,"index",0);c(this,"degrees",0);c(this,"names",null);c(this,"values",null);this.page=e,this.name=i,e.regions.push(this)}};var Nt=class A extends vt{constructor(e,i){super(e);c(this,"region",null);c(this,"path");c(this,"regionUVs",[]);c(this,"uvs",[]);c(this,"triangles",[]);c(this,"color",new N(1,1,1,1));c(this,"width",0);c(this,"height",0);c(this,"hullLength",0);c(this,"edges",[]);c(this,"parentMesh",null);c(this,"sequence",null);c(this,"tempColor",new N(0,0,0,0));this.path=i}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=O.newFloatArray(e.length));let i=this.uvs,s=this.uvs.length,n=this.region.u,o=this.region.v,h=0,d=0;if(this.region instanceof fs){let r=this.region,a=r.page,l=a.width,f=a.height;switch(r.degrees){case 90:n-=(r.originalHeight-r.offsetY-r.height)/l,o-=(r.originalWidth-r.offsetX-r.width)/f,h=r.originalHeight/l,d=r.originalWidth/f;for(let m=0;m<s;m+=2)i[m]=n+e[m+1]*h,i[m+1]=o+(1-e[m])*d;return;case 180:n-=(r.originalWidth-r.offsetX-r.width)/l,o-=r.offsetY/f,h=r.originalWidth/l,d=r.originalHeight/f;for(let m=0;m<s;m+=2)i[m]=n+(1-e[m])*h,i[m+1]=o+(1-e[m+1])*d;return;case 270:n-=r.offsetY/l,o-=r.offsetX/f,h=r.originalHeight/l,d=r.originalWidth/f;for(let m=0;m<s;m+=2)i[m]=n+(1-e[m+1])*h,i[m+1]=o+e[m]*d;return}n-=r.offsetX/l,o-=(r.originalHeight-r.offsetY-r.height)/f,h=r.originalWidth/l,d=r.originalHeight/f}else this.region?(h=this.region.u2-n,d=this.region.v2-o):(n=o=0,h=d=1);for(let r=0;r<s;r+=2)i[r]=n+e[r]*h,i[r+1]=o+e[r+1]*d}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new A(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),O.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?O.newFloatArray(this.uvs.length):new Array(this.uvs.length),O.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),O.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),O.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,i,s,n,o,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,i,s,n,o,h)}newLinkedMesh(){let e=new A(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}};var zt=class A extends vt{constructor(e){super(e);c(this,"lengths",[]);c(this,"closed",!1);c(this,"constantSpeed",!1);c(this,"color",new N(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),O.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}};var Ms=class A extends vt{constructor(e){super(e);c(this,"x",0);c(this,"y",0);c(this,"rotation",0);c(this,"color",new N(.38,.94,0,1))}computeWorldPosition(e,i){return i.x=this.x*e.a+this.y*e.b+e.worldX,i.y=this.x*e.c+this.y*e.d+e.worldY,i}computeWorldRotation(e){let i=this.rotation*B.degRad,s=Math.cos(i),n=Math.sin(i),o=s*e.a+n*e.b,h=s*e.c+n*e.d;return B.atan2Deg(h,o)}copy(){let e=new A(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}};var dt=class dt extends os{constructor(e,i){super(e);c(this,"x",0);c(this,"y",0);c(this,"scaleX",1);c(this,"scaleY",1);c(this,"rotation",0);c(this,"width",0);c(this,"height",0);c(this,"color",new N(1,1,1,1));c(this,"path");c(this,"region",null);c(this,"sequence",null);c(this,"offset",O.newFloatArray(8));c(this,"uvs",O.newFloatArray(8));c(this,"tempColor",new N(1,1,1,1));this.path=i}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,i=this.uvs;if(e==null){i[0]=0,i[1]=0,i[2]=0,i[3]=1,i[4]=1,i[5]=1,i[6]=1,i[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,o=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*n,d=o+this.region.width*s,r=h+this.region.height*n,a=this.rotation*B.degRad,l=Math.cos(a),f=Math.sin(a),m=this.x,u=this.y,g=o*l+m,x=o*f,b=h*l+u,y=h*f,w=d*l+m,p=d*f,C=r*l+u,v=r*f,M=this.offset;M[0]=g-y,M[1]=b+x,M[2]=g-v,M[3]=C+x,M[4]=w-v,M[5]=C+p,M[6]=w-y,M[7]=b+p,e.degrees==90?(i[0]=e.u2,i[1]=e.v2,i[2]=e.u,i[3]=e.v2,i[4]=e.u,i[5]=e.v,i[6]=e.u2,i[7]=e.v):(i[0]=e.u,i[1]=e.v2,i[2]=e.u,i[3]=e.v,i[4]=e.u2,i[5]=e.v,i[6]=e.u2,i[7]=e.v2)}computeWorldVertices(e,i,s,n){this.sequence!=null&&this.sequence.apply(e,this);let o=e.bone,h=this.offset,d=o.worldX,r=o.worldY,a=o.a,l=o.b,f=o.c,m=o.d,u=0,g=0;u=h[0],g=h[1],i[s]=u*a+g*l+d,i[s+1]=u*f+g*m+r,s+=n,u=h[2],g=h[3],i[s]=u*a+g*l+d,i[s+1]=u*f+g*m+r,s+=n,u=h[4],g=h[5],i[s]=u*a+g*l+d,i[s+1]=u*f+g*m+r,s+=n,u=h[6],g=h[7],i[s]=u*a+g*l+d,i[s+1]=u*f+g*m+r}copy(){let e=new dt(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,O.arrayCopy(this.uvs,0,e.uvs,0,8),O.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}};c(dt,"X1",0),c(dt,"Y1",1),c(dt,"C1R",2),c(dt,"C1G",3),c(dt,"C1B",4),c(dt,"C1A",5),c(dt,"U1",6),c(dt,"V1",7),c(dt,"X2",8),c(dt,"Y2",9),c(dt,"C2R",10),c(dt,"C2G",11),c(dt,"C2B",12),c(dt,"C2A",13),c(dt,"U2",14),c(dt,"V2",15),c(dt,"X3",16),c(dt,"Y3",17),c(dt,"C3R",18),c(dt,"C3G",19),c(dt,"C3B",20),c(dt,"C3A",21),c(dt,"U3",22),c(dt,"V3",23),c(dt,"X4",24),c(dt,"Y4",25),c(dt,"C4R",26),c(dt,"C4G",27),c(dt,"C4B",28),c(dt,"C4A",29),c(dt,"U4",30),c(dt,"V4",31);var Kt=dt;var Ti=class{constructor(t){c(this,"atlas");this.atlas=t}loadSequence(t,e,i){let s=i.regions;for(let n=0,o=s.length;n<o;n++){let h=i.getPath(e,n),d=this.atlas.findRegion(h);if(d==null)throw new Error("Region not found in atlas: "+h+" (sequence: "+t+")");s[n]=d}}newRegionAttachment(t,e,i,s){let n=new Kt(e,i);if(s!=null)this.loadSequence(e,i,s);else{let o=this.atlas.findRegion(i);if(!o)throw new Error("Region not found in atlas: "+i+" (region attachment: "+e+")");n.region=o}return n}newMeshAttachment(t,e,i,s){let n=new Nt(e,i);if(s!=null)this.loadSequence(e,i,s);else{let o=this.atlas.findRegion(i);if(!o)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+e+")");n.region=o}return n}newBoundingBoxAttachment(t,e){return new Ze(e)}newPathAttachment(t,e){return new zt(e)}newPointAttachment(t,e){return new Ms(e)}newClippingAttachment(t,e){return new Zt(e)}};var Ke=class{constructor(t,e,i){c(this,"index",0);c(this,"name");c(this,"parent",null);c(this,"length",0);c(this,"x",0);c(this,"y",0);c(this,"rotation",0);c(this,"scaleX",1);c(this,"scaleY",1);c(this,"shearX",0);c(this,"shearY",0);c(this,"inherit",xt.Normal);c(this,"skinRequired",!1);c(this,"color",new N);c(this,"icon");c(this,"visible",!1);if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=i}},xt;(function(A){A[A.Normal=0]="Normal",A[A.OnlyTranslation=1]="OnlyTranslation",A[A.NoRotationOrReflection=2]="NoRotationOrReflection",A[A.NoScale=3]="NoScale",A[A.NoScaleOrReflection=4]="NoScaleOrReflection"})(xt||(xt={}));var us=class{constructor(t,e,i){c(this,"data");c(this,"skeleton");c(this,"parent",null);c(this,"children",new Array);c(this,"x",0);c(this,"y",0);c(this,"rotation",0);c(this,"scaleX",0);c(this,"scaleY",0);c(this,"shearX",0);c(this,"shearY",0);c(this,"ax",0);c(this,"ay",0);c(this,"arotation",0);c(this,"ascaleX",0);c(this,"ascaleY",0);c(this,"ashearX",0);c(this,"ashearY",0);c(this,"a",0);c(this,"b",0);c(this,"c",0);c(this,"d",0);c(this,"worldY",0);c(this,"worldX",0);c(this,"inherit",xt.Normal);c(this,"sorted",!1);c(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=i,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,i,s,n,o,h){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=s,this.ascaleY=n,this.ashearX=o,this.ashearY=h;let d=this.parent;if(!d){let m=this.skeleton,u=m.scaleX,g=m.scaleY,x=(i+o)*B.degRad,b=(i+90+h)*B.degRad;this.a=Math.cos(x)*s*u,this.b=Math.cos(b)*n*u,this.c=Math.sin(x)*s*g,this.d=Math.sin(b)*n*g,this.worldX=t*u+m.x,this.worldY=e*g+m.y;return}let r=d.a,a=d.b,l=d.c,f=d.d;switch(this.worldX=r*t+a*e+d.worldX,this.worldY=l*t+f*e+d.worldY,this.inherit){case xt.Normal:{let m=(i+o)*B.degRad,u=(i+90+h)*B.degRad,g=Math.cos(m)*s,x=Math.cos(u)*n,b=Math.sin(m)*s,y=Math.sin(u)*n;this.a=r*g+a*b,this.b=r*x+a*y,this.c=l*g+f*b,this.d=l*x+f*y;return}case xt.OnlyTranslation:{let m=(i+o)*B.degRad,u=(i+90+h)*B.degRad;this.a=Math.cos(m)*s,this.b=Math.cos(u)*n,this.c=Math.sin(m)*s,this.d=Math.sin(u)*n;break}case xt.NoRotationOrReflection:{let m=1/this.skeleton.scaleX,u=1/this.skeleton.scaleY;r*=m,l*=u;let g=r*r+l*l,x=0;g>1e-4?(g=Math.abs(r*f*u-a*m*l)/g,a=l*g,f=r*g,x=Math.atan2(l,r)*B.radDeg):(r=0,l=0,x=90-Math.atan2(f,a)*B.radDeg);let b=(i+o-x)*B.degRad,y=(i+h-x+90)*B.degRad,w=Math.cos(b)*s,p=Math.cos(y)*n,C=Math.sin(b)*s,v=Math.sin(y)*n;this.a=r*w-a*C,this.b=r*p-a*v,this.c=l*w+f*C,this.d=l*p+f*v;break}case xt.NoScale:case xt.NoScaleOrReflection:{i*=B.degRad;let m=Math.cos(i),u=Math.sin(i),g=(r*m+a*u)/this.skeleton.scaleX,x=(l*m+f*u)/this.skeleton.scaleY,b=Math.sqrt(g*g+x*x);b>1e-5&&(b=1/b),g*=b,x*=b,b=Math.sqrt(g*g+x*x),this.inherit==xt.NoScale&&r*f-a*l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),i=Math.PI/2+Math.atan2(x,g);let y=Math.cos(i)*b,w=Math.sin(i)*b;o*=B.degRad,h=(90+h)*B.degRad;let p=Math.cos(o)*s,C=Math.cos(h)*n,v=Math.sin(o)*s,M=Math.sin(h)*n;this.a=g*p+y*v,this.b=g*C+y*M,this.c=x*p+w*v,this.d=x*C+w*M;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){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let e=t.a,i=t.b,s=t.c,n=t.d,o=1/(e*n-i*s),h=n*o,d=i*o,r=s*o,a=e*o,l=this.worldX-t.worldX,f=this.worldY-t.worldY;this.ax=l*h-f*d,this.ay=f*a-l*r;let m,u,g,x;if(this.inherit==xt.OnlyTranslation)m=this.a,u=this.b,g=this.c,x=this.d;else{switch(this.inherit){case xt.NoRotationOrReflection:{let C=Math.abs(e*n-i*s)/(e*e+s*s);i=-s*this.skeleton.scaleX*C/this.skeleton.scaleY,n=e*this.skeleton.scaleY*C/this.skeleton.scaleX,o=1/(e*n-i*s),h=n*o,d=i*o;break}case xt.NoScale:case xt.NoScaleOrReflection:let b=B.cosDeg(this.rotation),y=B.sinDeg(this.rotation);e=(e*b+i*y)/this.skeleton.scaleX,s=(s*b+n*y)/this.skeleton.scaleY;let w=Math.sqrt(e*e+s*s);w>1e-5&&(w=1/w),e*=w,s*=w,w=Math.sqrt(e*e+s*s),this.inherit==xt.NoScale&&o<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w);let p=B.PI/2+Math.atan2(s,e);i=Math.cos(p)*w,n=Math.sin(p)*w,o=1/(e*n-i*s),h=n*o,d=i*o,r=s*o,a=e*o}m=h*this.a-d*this.c,u=h*this.b-d*this.d,g=a*this.c-r*this.a,x=a*this.d-r*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(m*m+g*g),this.ascaleX>1e-4){let b=m*x-u*g;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(m*u+g*x,b)*B.radDeg,this.arotation=Math.atan2(g,m)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,u)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),i=t.x-this.worldX,s=t.y-this.worldY;return t.x=i*this.d*e-s*this.b*e,t.y=s*this.a*e-i*this.c*e,t}localToWorld(t){let e=t.x,i=t.y;return t.x=e*this.a+i*this.b+this.worldX,t.y=e*this.c+i*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),i=B.cosDeg(t);return Math.atan2(this.a*e-this.c*i,this.d*i-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),i=B.cosDeg(t);return Math.atan2(i*this.c+e*this.d,i*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;let e=Math.sin(t),i=Math.cos(t),s=this.a,n=this.b;this.a=i*s-e*this.c,this.b=i*n-e*this.d,this.c=e*s+i*this.c,this.d=e*n+i*this.d}};var Jt=class{constructor(t,e,i){c(this,"name");c(this,"order");c(this,"skinRequired");this.name=t,this.order=e,this.skinRequired=i}};var Is=class{constructor(t,e="",i=new ms,s=new $s){c(this,"pathPrefix","");c(this,"textureLoader");c(this,"downloader");c(this,"cache");c(this,"errors",{});c(this,"toLoad",0);c(this,"loaded",0);this.textureLoader=t,this.pathPrefix=e,this.downloader=i,this.cache=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,i){this.toLoad--,this.loaded++,this.cache.assets[e]=i,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,i)}error(t,e,i){this.toLoad--,this.loaded++,this.errors[e]=i,t&&t(e,i)}loadAll(){return new Promise((e,i)=>{let s=()=>{if(this.isLoadingComplete()){this.hasErrors()?i(this.errors):e(this);return}requestAnimationFrame(s)};requestAnimationFrame(s)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},i=()=>{}){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((s,n)=>{this.downloader.downloadBinary(t,o=>{this.success(e,t,o),s(o)},(o,h)=>{let d=`Couldn't load binary ${t}: status ${o}, ${h}`;this.error(i,t,d),n(d)})}))}loadText(t,e=()=>{},i=()=>{}){t=this.start(t),this.downloader.downloadText(t,s=>{this.success(e,t,s)},(s,n)=>{this.error(i,t,`Couldn't load text ${t}: status ${s}, ${n}`)})}loadJson(t,e=()=>{},i=()=>{}){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((s,n)=>{this.downloader.downloadJson(t,o=>{this.success(e,t,o),s(o)},(o,h)=>{let d=`Couldn't load JSON ${t}: status ${o}, ${h}`;this.error(i,t,d),n(d)})}))}reuseAssets(t,e=()=>{},i=()=>{}){let s=this.cache.assetsLoaded[t],n=s!==void 0;return n&&(this.cache.assetsLoaded[t]=s.then(o=>(o=o instanceof Image||o instanceof ImageBitmap?this.textureLoader(o):o,this.success(e,t,o),o)).catch(o=>this.error(i,t,o))),n}loadTexture(t,e=()=>{},i=()=>{}){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((s,n)=>{if(!!!(typeof window!="undefined"&&typeof navigator!="undefined"&&window.document))fetch(t,{mode:"cors"}).then(d=>{if(d.ok)return d.blob();let r=`Couldn't load image: ${t}`;this.error(i,t,`Couldn't load image: ${t}`),n(r)}).then(d=>d?createImageBitmap(d,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(d=>{if(d){let r=this.createTexture(t,d);this.success(e,t,r),s(r)}});else{let d=new Image;d.crossOrigin="anonymous",d.onload=()=>{let r=this.createTexture(t,d);this.success(e,t,r),s(r)},d.onerror=()=>{let r=`Couldn't load image: ${t}`;this.error(i,t,r),n(r)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),d.src=t}}))}loadTextureAtlas(t,e=()=>{},i=()=>{},s){let n=t.lastIndexOf("/"),o=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((h,d)=>{this.downloader.downloadText(t,r=>{try{let a=this.createTextureAtlas(t,r),l=a.pages.length,f=!1;if(l===0){this.success(e,t,a),h(a);return}for(let m of a.pages)this.loadTexture(s?s[m.name]:o+m.name,(u,g)=>{f||(m.setTexture(g),--l==0&&(this.success(e,t,a),h(a)))},(u,g)=>{if(!f){let x=`Couldn't load texture ${t} page image: ${u}`;this.error(i,t,x),d(x)}f=!0})}catch(a){let l=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(i,t,l),d(l)}},(r,a)=>{let l=`Couldn't load texture atlas ${t}: status ${r}, ${a}`;this.error(i,t,l),d(l)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},i=()=>{},s){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((n,o)=>{this.downloader.downloadText(t,h=>{try{let d=this.createTextureAtlas(t,h);this.success(e,t,d),n(d)}catch(d){let r=`Couldn't parse texture atlas ${t}: ${d.message}`;this.error(i,t,r),o(r)}},(h,d)=>{let r=`Couldn't load texture atlas ${t}: status ${h}, ${d}`;this.error(i,t,r),o(r)})}))}async loadBinaryAsync(t){return new Promise((e,i)=>{this.loadBinary(t,(s,n)=>e(n),(s,n)=>i(n))})}async loadJsonAsync(t){return new Promise((e,i)=>{this.loadJson(t,(s,n)=>e(n),(s,n)=>i(n))})}async loadTextureAsync(t){return new Promise((e,i)=>{this.loadTexture(t,(s,n)=>e(n),(s,n)=>i(n))})}async loadTextureAtlasAsync(t){return new Promise((e,i)=>{this.loadTextureAtlas(t,(s,n)=>e(n),(s,n)=>i(n))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,i)=>{this.loadTextureAtlasButNoTextures(t,(s,n)=>e(n),(s,n)=>i(n))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let i=this.errors[t];throw Error("Asset not found: "+t+(i?`
`+i:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){let e=this.cache.assets[t];if(e instanceof ds){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){let i=new ds(e);return i.dispose=()=>{var s;if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(let n of i.pages)(s=n.texture)==null||s.dispose()}},i}createTexture(t,e){let i=this.textureLoader(e),s=i.dispose.bind(i);return i.dispose=()=>{this.disposeAssetInternal(t)&&s()},i}},Ss=class Ss{constructor(){c(this,"assets",{});c(this,"assetsRefCount",{});c(this,"assetsLoaded",{})}static getCache(t){let e=Ss.AVAILABLE_CACHES.get(t);if(e)return e;let i=new Ss;return Ss.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,e){this.assetsLoaded[t]=Promise.resolve(e),this.assets[t]=await e}};c(Ss,"AVAILABLE_CACHES",new Map);var $s=Ss,ms=class{constructor(){c(this,"callbacks",{});c(this,"rawDataUris",{})}dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),i=e.length,s=new Uint8Array(i),n=0;n<i;n++)s[n]=e.charCodeAt(n);return s}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,i){if(this.start(t,e,i))return;let s=this.rawDataUris[t];if(s&&!s.includes(".")){try{this.finish(t,200,this.dataUriToString(s))}catch(h){this.finish(t,400,JSON.stringify(h))}return}let n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",s||t,!0);let o=()=>{this.finish(t,n.status,n.responseText)};n.onload=o,n.onerror=o,n.send()}downloadJson(t,e,i){this.downloadText(t,s=>{e(JSON.parse(s))},i)}downloadBinary(t,e,i){if(this.start(t,e,i))return;let s=this.rawDataUris[t];if(s&&!s.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(s))}catch(h){this.finish(t,400,JSON.stringify(h))}return}let n=new XMLHttpRequest;n.open("GET",s||t,!0),n.responseType="arraybuffer";let o=()=>{this.finish(t,n.status,n.response)};n.onload=()=>{n.status==200||n.status==0?this.finish(t,200,new Uint8Array(n.response)):o()},n.onerror=o,n.send()}start(t,e,i){let s=this.callbacks[t];try{if(s)return!0;this.callbacks[t]=s=[]}finally{s.push(e,i)}}finish(t,e,i){let s=this.callbacks[t];delete this.callbacks[t];let n=e==200||e==0?[i]:[e,i];for(let o=n.length-1,h=s.length;o<h;o+=2)s[o].apply(null,n)}};var Je=class{constructor(t,e){c(this,"data");c(this,"intValue",0);c(this,"floatValue",0);c(this,"stringValue",null);c(this,"time",0);c(this,"volume",0);c(this,"balance",0);if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};var Qe=class{constructor(t){c(this,"name");c(this,"intValue",0);c(this,"floatValue",0);c(this,"stringValue",null);c(this,"audioPath",null);c(this,"volume",0);c(this,"balance",0);this.name=t}};var Ts=class{constructor(t,e){c(this,"data");c(this,"bones");c(this,"target");c(this,"bendDirection",0);c(this,"compress",!1);c(this,"stretch",!1);c(this,"mix",1);c(this,"softness",0);c(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(n)}let i=e.findBone(t.target.name);if(!i)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=i,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(){let 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(this.mix==0)return;let e=this.target,i=this.bones;switch(i.length){case 1:this.apply1(i[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(i[0],i[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,i,s,n,o,h){let d=t.parent;if(!d)throw new Error("IK bone must have parent.");let r=d.a,a=d.b,l=d.c,f=d.d,m=-t.ashearX-t.arotation,u=0,g=0;switch(t.inherit){case xt.OnlyTranslation:u=(e-t.worldX)*B.signum(t.skeleton.scaleX),g=(i-t.worldY)*B.signum(t.skeleton.scaleY);break;case xt.NoRotationOrReflection:let y=Math.abs(r*f-a*l)/Math.max(1e-4,r*r+l*l),w=r/t.skeleton.scaleX,p=l/t.skeleton.scaleY;a=-p*y*t.skeleton.scaleX,f=w*y*t.skeleton.scaleY,m+=Math.atan2(p,w)*B.radDeg;default:let C=e-d.worldX,v=i-d.worldY,M=r*f-a*l;Math.abs(M)<=1e-4?(u=0,g=0):(u=(C*f-v*a)/M-t.ax,g=(v*r-C*l)/M-t.ay)}m+=Math.atan2(g,u)*B.radDeg,t.ascaleX<0&&(m+=180),m>180?m-=360:m<-180&&(m+=360);let x=t.ascaleX,b=t.ascaleY;if(s||n){switch(t.inherit){case xt.NoScale:case xt.NoScaleOrReflection:u=e-t.worldX,g=i-t.worldY}let y=t.data.length*x;if(y>1e-4){let w=u*u+g*g;if(s&&w<y*y||n&&w>y*y){let p=(Math.sqrt(w)/y-1)*h+1;x*=p,o&&(b*=p)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*h,x,b,t.ashearX,t.ashearY)}apply2(t,e,i,s,n,o,h,d,r){if(t.inherit!=xt.Normal||e.inherit!=xt.Normal)return;let a=t.ax,l=t.ay,f=t.ascaleX,m=t.ascaleY,u=f,g=m,x=e.ascaleX,b=0,y=0,w=0;f<0?(f=-f,b=180,w=-1):(b=0,w=1),m<0&&(m=-m,w=-w),x<0?(x=-x,y=180):y=0;let p=e.ax,C=0,v=0,M=0,S=t.a,I=t.b,F=t.c,R=t.d,V=Math.abs(f-m)<=1e-4;!V||o?(C=0,v=S*p+t.worldX,M=F*p+t.worldY):(C=e.ay,v=S*p+I*C+t.worldX,M=F*p+R*C+t.worldY);let X=t.parent;if(!X)throw new Error("IK parent must itself have a parent.");S=X.a,I=X.b,F=X.c,R=X.d;let Y=S*R-I*F,k=v-X.worldX,L=M-X.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let D=(k*R-L*I)*Y-a,nt=(L*S-k*F)*Y-l,j=Math.sqrt(D*D+nt*nt),ct=e.data.length*x,mt,pt;if(j<1e-4){this.apply1(t,i,s,!1,o,!1,r),e.updateWorldTransformWith(p,C,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}k=i-X.worldX,L=s-X.worldY;let tt=(k*R-L*I)*Y-a,lt=(L*S-k*F)*Y-l,ot=tt*tt+lt*lt;if(d!=0){d*=f*(x+1)*.5;let yt=Math.sqrt(ot),Tt=yt-j-ct*f+d;if(Tt>0){let Et=Math.min(1,Tt/(d*2))-1;Et=(Tt-d*(1-Et*Et))/yt,tt-=Et*tt,lt-=Et*lt,ot=tt*tt+lt*lt}}t:if(V){ct*=f;let yt=(ot-j*j-ct*ct)/(2*j*ct);yt<-1?(yt=-1,pt=Math.PI*n):yt>1?(yt=1,pt=0,o&&(S=(Math.sqrt(ot)/(j+ct)-1)*r+1,u*=S,h&&(g*=S))):pt=Math.acos(yt)*n,S=j+ct*yt,I=ct*Math.sin(pt),mt=Math.atan2(lt*S-tt*I,tt*S+lt*I)}else{S=f*ct,I=m*ct;let yt=S*S,Tt=I*I,Et=Math.atan2(lt,tt);F=Tt*j*j+yt*ot-yt*Tt;let me=-2*Tt*j,qs=Tt-yt;if(R=me*me-4*qs*F,R>=0){let bs=Math.sqrt(R);me<0&&(bs=-bs),bs=-(me+bs)*.5;let Gs=bs/qs,lr=F/bs,hi=Math.abs(Gs)<Math.abs(lr)?Gs:lr;if(Gs=ot-hi*hi,Gs>=0){L=Math.sqrt(Gs)*n,mt=Et-Math.atan2(L,hi),pt=Math.atan2(L/m,(hi-j)/f);break t}}let ir=B.PI,li=j-S,Vi=li*li,rr=0,nr=0,oi=j+S,Oi=oi*oi,ar=0;F=-S*j/(yt-Tt),F>=-1&&F<=1&&(F=Math.acos(F),k=S*Math.cos(F)+j,L=I*Math.sin(F),R=k*k+L*L,R<Vi&&(ir=F,Vi=R,li=k,rr=L),R>Oi&&(nr=F,Oi=R,oi=k,ar=L)),ot<=(Vi+Oi)*.5?(mt=Et-Math.atan2(rr*n,li),pt=ir*n):(mt=Et-Math.atan2(ar*n,oi),pt=nr*n)}let Gt=Math.atan2(C,p)*w,Bt=t.arotation;mt=(mt-Gt)*B.radDeg+b-Bt,mt>180?mt-=360:mt<-180&&(mt+=360),t.updateWorldTransformWith(a,l,Bt+mt*r,u,g,0,0),Bt=e.arotation,pt=((pt+Gt)*B.radDeg-e.ashearX)*w+y-Bt,pt>180?pt-=360:pt<-180&&(pt+=360),e.updateWorldTransformWith(p,C,Bt+pt*r,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};var _e=class extends Jt{constructor(e){super(e,0,!1);c(this,"bones",new Array);c(this,"_target",null);c(this,"bendDirection",0);c(this,"compress",!1);c(this,"stretch",!1);c(this,"uniform",!1);c(this,"mix",0);c(this,"softness",0)}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}};var $e=class extends Jt{constructor(e){super(e,0,!1);c(this,"bones",new Array);c(this,"_target",null);c(this,"positionMode",Lt.Fixed);c(this,"spacingMode",bt.Fixed);c(this,"rotateMode",te.Chain);c(this,"offsetRotation",0);c(this,"position",0);c(this,"spacing",0);c(this,"mixRotate",0);c(this,"mixX",0);c(this,"mixY",0)}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},Lt;(function(A){A[A.Fixed=0]="Fixed",A[A.Percent=1]="Percent"})(Lt||(Lt={}));var bt;(function(A){A[A.Length=0]="Length",A[A.Fixed=1]="Fixed",A[A.Percent=2]="Percent",A[A.Proportional=3]="Proportional"})(bt||(bt={}));var te;(function(A){A[A.Tangent=0]="Tangent",A[A.Chain=1]="Chain",A[A.ChainScale=2]="ChainScale"})(te||(te={}));var Wt=class Wt{constructor(t,e){c(this,"data");c(this,"bones");c(this,"target");c(this,"position",0);c(this,"spacing",0);c(this,"mixRotate",0);c(this,"mixX",0);c(this,"mixY",0);c(this,"spaces",new Array);c(this,"positions",new Array);c(this,"world",new Array);c(this,"curves",new Array);c(this,"lengths",new Array);c(this,"segments",new Array);c(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,n=t.bones.length;s<n;s++){let o=e.findBone(t.bones[s].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(o)}let i=e.findSlot(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=i,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(){let 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 zt))return;let i=this.mixRotate,s=this.mixX,n=this.mixY;if(i==0&&s==0&&n==0)return;let o=this.data,h=o.rotateMode==te.Tangent,d=o.rotateMode==te.ChainScale,r=this.bones,a=r.length,l=h?a:a+1,f=O.setArraySize(this.spaces,l),m=d?this.lengths=O.setArraySize(this.lengths,a):[],u=this.spacing;switch(o.spacingMode){case bt.Percent:if(d)for(let v=0,M=l-1;v<M;v++){let S=r[v],I=S.data.length,F=I*S.a,R=I*S.c;m[v]=Math.sqrt(F*F+R*R)}O.arrayFill(f,1,l,u);break;case bt.Proportional:let p=0;for(let v=0,M=l-1;v<M;){let S=r[v],I=S.data.length;if(I<Wt.epsilon)d&&(m[v]=0),f[++v]=u;else{let F=I*S.a,R=I*S.c,V=Math.sqrt(F*F+R*R);d&&(m[v]=V),f[++v]=V,p+=V}}if(p>0){p=l/p*u;for(let v=1;v<l;v++)f[v]*=p}break;default:let C=o.spacingMode==bt.Length;for(let v=0,M=l-1;v<M;){let S=r[v],I=S.data.length;if(I<Wt.epsilon)d&&(m[v]=0),f[++v]=u;else{let F=I*S.a,R=I*S.c,V=Math.sqrt(F*F+R*R);d&&(m[v]=V),f[++v]=(C?I+u:u)*V/I}}}let g=this.computeWorldPositions(e,l,h),x=g[0],b=g[1],y=o.offsetRotation,w=!1;if(y==0)w=o.rotateMode==te.Chain;else{w=!1;let p=this.target.bone;y*=p.a*p.d-p.b*p.c>0?B.degRad:-B.degRad}for(let p=0,C=3;p<a;p++,C+=3){let v=r[p];v.worldX+=(x-v.worldX)*s,v.worldY+=(b-v.worldY)*n;let M=g[C],S=g[C+1],I=M-x,F=S-b;if(d){let R=m[p];if(R!=0){let V=(Math.sqrt(I*I+F*F)/R-1)*i+1;v.a*=V,v.c*=V}}if(x=M,b=S,i>0){let R=v.a,V=v.b,X=v.c,Y=v.d,k=0,L=0,D=0;if(h?k=g[C-1]:f[p+1]==0?k=g[C+2]:k=Math.atan2(F,I),k-=Math.atan2(X,R),w){L=Math.cos(k),D=Math.sin(k);let nt=v.data.length;x+=(nt*(L*R-D*X)-I)*i,b+=(nt*(D*R+L*X)-F)*i}else k+=y;k>B.PI?k-=B.PI2:k<-B.PI&&(k+=B.PI2),k*=i,L=Math.cos(k),D=Math.sin(k),v.a=L*R-D*X,v.b=L*V-D*Y,v.c=D*R+L*X,v.d=D*V+L*Y}v.updateAppliedTransform()}}computeWorldPositions(t,e,i){let s=this.target,n=this.position,o=this.spaces,h=O.setArraySize(this.positions,e*3+2),d=this.world,r=t.closed,a=t.worldVerticesLength,l=a/6,f=Wt.NONE;if(!t.constantSpeed){let nt=t.lengths;l-=r?1:2;let j=nt[l];this.data.positionMode==Lt.Percent&&(n*=j);let ct;switch(this.data.spacingMode){case bt.Percent:ct=j;break;case bt.Proportional:ct=j/e;break;default:ct=1}d=O.setArraySize(this.world,8);for(let mt=0,pt=0,tt=0;mt<e;mt++,pt+=3){let lt=o[mt]*ct;n+=lt;let ot=n;if(r)ot%=j,ot<0&&(ot+=j),tt=0;else if(ot<0){f!=Wt.BEFORE&&(f=Wt.BEFORE,t.computeWorldVertices(s,2,4,d,0,2)),this.addBeforePosition(ot,d,0,h,pt);continue}else if(ot>j){f!=Wt.AFTER&&(f=Wt.AFTER,t.computeWorldVertices(s,a-6,4,d,0,2)),this.addAfterPosition(ot-j,d,0,h,pt);continue}for(;;tt++){let Gt=nt[tt];if(!(ot>Gt)){if(tt==0)ot/=Gt;else{let Bt=nt[tt-1];ot=(ot-Bt)/(Gt-Bt)}break}}tt!=f&&(f=tt,r&&tt==l?(t.computeWorldVertices(s,a-4,4,d,0,2),t.computeWorldVertices(s,0,4,d,4,2)):t.computeWorldVertices(s,tt*6+2,8,d,0,2)),this.addCurvePosition(ot,d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],h,pt,i||mt>0&&lt==0)}return h}r?(a+=2,d=O.setArraySize(this.world,a),t.computeWorldVertices(s,2,a-4,d,0,2),t.computeWorldVertices(s,0,2,d,a-4,2),d[a-2]=d[0],d[a-1]=d[1]):(l--,a-=4,d=O.setArraySize(this.world,a),t.computeWorldVertices(s,2,a,d,0,2));let m=O.setArraySize(this.curves,l),u=0,g=d[0],x=d[1],b=0,y=0,w=0,p=0,C=0,v=0,M=0,S=0,I=0,F=0,R=0,V=0,X=0,Y=0;for(let nt=0,j=2;nt<l;nt++,j+=6)b=d[j],y=d[j+1],w=d[j+2],p=d[j+3],C=d[j+4],v=d[j+5],M=(g-b*2+w)*.1875,S=(x-y*2+p)*.1875,I=((b-w)*3-g+C)*.09375,F=((y-p)*3-x+v)*.09375,R=M*2+I,V=S*2+F,X=(b-g)*.75+M+I*.16666667,Y=(y-x)*.75+S+F*.16666667,u+=Math.sqrt(X*X+Y*Y),X+=R,Y+=V,R+=I,V+=F,u+=Math.sqrt(X*X+Y*Y),X+=R,Y+=V,u+=Math.sqrt(X*X+Y*Y),X+=R+I,Y+=V+F,u+=Math.sqrt(X*X+Y*Y),m[nt]=u,g=C,x=v;this.data.positionMode==Lt.Percent&&(n*=u);let k;switch(this.data.spacingMode){case bt.Percent:k=u;break;case bt.Proportional:k=u/e;break;default:k=1}let L=this.segments,D=0;for(let nt=0,j=0,ct=0,mt=0;nt<e;nt++,j+=3){let pt=o[nt]*k;n+=pt;let tt=n;if(r)tt%=u,tt<0&&(tt+=u),ct=0;else if(tt<0){this.addBeforePosition(tt,d,0,h,j);continue}else if(tt>u){this.addAfterPosition(tt-u,d,a-4,h,j);continue}for(;;ct++){let lt=m[ct];if(!(tt>lt)){if(ct==0)tt/=lt;else{let ot=m[ct-1];tt=(tt-ot)/(lt-ot)}break}}if(ct!=f){f=ct;let lt=ct*6;for(g=d[lt],x=d[lt+1],b=d[lt+2],y=d[lt+3],w=d[lt+4],p=d[lt+5],C=d[lt+6],v=d[lt+7],M=(g-b*2+w)*.03,S=(x-y*2+p)*.03,I=((b-w)*3-g+C)*.006,F=((y-p)*3-x+v)*.006,R=M*2+I,V=S*2+F,X=(b-g)*.3+M+I*.16666667,Y=(y-x)*.3+S+F*.16666667,D=Math.sqrt(X*X+Y*Y),L[0]=D,lt=1;lt<8;lt++)X+=R,Y+=V,R+=I,V+=F,D+=Math.sqrt(X*X+Y*Y),L[lt]=D;X+=R,Y+=V,D+=Math.sqrt(X*X+Y*Y),L[8]=D,X+=R+I,Y+=V+F,D+=Math.sqrt(X*X+Y*Y),L[9]=D,mt=0}for(tt*=D;;mt++){let lt=L[mt];if(!(tt>lt)){if(mt==0)tt/=lt;else{let ot=L[mt-1];tt=mt+(tt-ot)/(lt-ot)}break}}this.addCurvePosition(tt*.1,g,x,b,y,w,p,C,v,h,j,i||nt>0&&pt==0)}return h}addBeforePosition(t,e,i,s,n){let o=e[i],h=e[i+1],d=e[i+2]-o,r=e[i+3]-h,a=Math.atan2(r,d);s[n]=o+t*Math.cos(a),s[n+1]=h+t*Math.sin(a),s[n+2]=a}addAfterPosition(t,e,i,s,n){let o=e[i+2],h=e[i+3],d=o-e[i],r=h-e[i+1],a=Math.atan2(r,d);s[n]=o+t*Math.cos(a),s[n+1]=h+t*Math.sin(a),s[n+2]=a}addCurvePosition(t,e,i,s,n,o,h,d,r,a,l,f){if(t==0||isNaN(t)){a[l]=e,a[l+1]=i,a[l+2]=Math.atan2(n-i,s-e);return}let m=t*t,u=m*t,g=1-t,x=g*g,b=x*g,y=g*t,w=y*3,p=g*w,C=w*t,v=e*b+s*p+o*C+d*u,M=i*b+n*p+h*C+r*u;a[l]=v,a[l+1]=M,f&&(t<.001?a[l+2]=Math.atan2(n-i,s-e):a[l+2]=Math.atan2(M-(i*x+n*y*2+h*m),v-(e*x+s*y*2+o*m)))}};c(Wt,"NONE",-1),c(Wt,"BEFORE",-2),c(Wt,"AFTER",-3),c(Wt,"epsilon",1e-5);var Es=Wt;var Ei=class{constructor(t,e){c(this,"data");c(this,"_bone",null);c(this,"inertia",0);c(this,"strength",0);c(this,"damping",0);c(this,"massInverse",0);c(this,"wind",0);c(this,"gravity",0);c(this,"mix",0);c(this,"_reset",!0);c(this,"ux",0);c(this,"uy",0);c(this,"cx",0);c(this,"cy",0);c(this,"tx",0);c(this,"ty",0);c(this,"xOffset",0);c(this,"xVelocity",0);c(this,"yOffset",0);c(this,"yVelocity",0);c(this,"rotateOffset",0);c(this,"rotateVelocity",0);c(this,"scaleOffset",0);c(this,"scaleVelocity",0);c(this,"active",!1);c(this,"skeleton");c(this,"remaining",0);c(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}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}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(){let 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){let e=this.mix;if(e==0)return;let i=this.data.x>0,s=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,h=this.bone,d=h.data.length;switch(t){case ae.none:return;case ae.reset:this.reset();case ae.update:let r=this.skeleton,a=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=a,this.lastTime=r.time;let l=h.worldX,f=h.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=f;else{let m=this.remaining,u=this.inertia,g=this.data.step,x=this.skeleton.data.referenceScale,b=-1,y=this.data.limit*a,w=y*Math.abs(r.scaleY);if(y*=Math.abs(r.scaleX),i||s){if(i){let p=(this.ux-l)*u;this.xOffset+=p>y?y:p<-y?-y:p,this.ux=l}if(s){let p=(this.uy-f)*u;this.yOffset+=p>w?w:p<-w?-w:p,this.uy=f}if(m>=g){b=Math.pow(this.damping,60*g);let p=this.massInverse*g,C=this.strength,v=this.wind*x*r.scaleX,M=this.gravity*x*r.scaleY;do i&&(this.xVelocity+=(v-this.xOffset*C)*p,this.xOffset+=this.xVelocity*g,this.xVelocity*=b),s&&(this.yVelocity-=(M+this.yOffset*C)*p,this.yOffset+=this.yVelocity*g,this.yVelocity*=b),m-=g;while(m>=g)}i&&(h.worldX+=this.xOffset*e*this.data.x),s&&(h.worldY+=this.yOffset*e*this.data.y)}if(n||o){let p=Math.atan2(h.c,h.a),C=0,v=0,M=0,S=this.cx-h.worldX,I=this.cy-h.worldY;if(S>y?S=y:S<-y&&(S=-y),I>w?I=w:I<-w&&(I=-w),n){M=(this.data.rotate+this.data.shearX)*e;let F=Math.atan2(I+this.ty,S+this.tx)-p-this.rotateOffset*M;this.rotateOffset+=(F-Math.ceil(F*B.invPI2-.5)*B.PI2)*u,F=this.rotateOffset*M+p,C=Math.cos(F),v=Math.sin(F),o&&(F=d*h.getWorldScaleX(),F>0&&(this.scaleOffset+=(S*C+I*v)*u/F))}else{C=Math.cos(p),v=Math.sin(p);let F=d*h.getWorldScaleX();F>0&&(this.scaleOffset+=(S*C+I*v)*u/F)}if(m=this.remaining,m>=g){b==-1&&(b=Math.pow(this.damping,60*g));let F=this.massInverse*g,R=this.strength,V=this.wind,X=Ys.yDown?-this.gravity:this.gravity,Y=d/x;for(;;)if(m-=g,o&&(this.scaleVelocity+=(V*C-X*v-this.scaleOffset*R)*F,this.scaleOffset+=this.scaleVelocity*g,this.scaleVelocity*=b),n){if(this.rotateVelocity-=((V*v+X*C)*Y+this.rotateOffset*R)*F,this.rotateOffset+=this.rotateVelocity*g,this.rotateVelocity*=b,m<g)break;let k=this.rotateOffset*M+p;C=Math.cos(k),v=Math.sin(k)}else if(m<g)break}}this.remaining=m}this.cx=h.worldX,this.cy=h.worldY;break;case ae.pose:i&&(h.worldX+=this.xOffset*e*this.data.x),s&&(h.worldY+=this.yOffset*e*this.data.y)}if(n){let r=this.rotateOffset*e,a=0,l=0,f=0;if(this.data.shearX>0){let m=0;this.data.rotate>0&&(m=r*this.data.rotate,a=Math.sin(m),l=Math.cos(m),f=h.b,h.b=l*f-a*h.d,h.d=a*f+l*h.d),m+=r*this.data.shearX,a=Math.sin(m),l=Math.cos(m),f=h.a,h.a=l*f-a*h.c,h.c=a*f+l*h.c}else r*=this.data.rotate,a=Math.sin(r),l=Math.cos(r),f=h.a,h.a=l*f-a*h.c,h.c=a*f+l*h.c,f=h.b,h.b=l*f-a*h.d,h.d=a*f+l*h.d}if(o){let r=1+this.scaleOffset*e*this.data.scaleX;h.a*=r,h.c*=r}t!=ae.pose&&(this.tx=d*h.a,this.ty=d*h.c),h.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,i){let s=i*B.degRad,n=Math.cos(s),o=Math.sin(s),h=this.cx-t,d=this.cy-e;this.translate(h*n-d*o-h,h*o+d*n-d)}};var Rs=class{constructor(t,e){c(this,"data");c(this,"bone");c(this,"color");c(this,"darkColor",null);c(this,"attachment",null);c(this,"attachmentState",0);c(this,"sequenceIndex",-1);c(this,"deform",new Array);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new N,this.darkColor=t.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof vt)||!(this.attachment instanceof vt)||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}};var Fs=class{constructor(t,e){c(this,"data");c(this,"bones");c(this,"target");c(this,"mixRotate",0);c(this,"mixX",0);c(this,"mixY",0);c(this,"mixScaleX",0);c(this,"mixScaleY",0);c(this,"mixShearY",0);c(this,"temp",new Vt);c(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(n)}let i=e.findBone(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=i,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(){let 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){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(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,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,o=this.mixShearY,h=e!=0||i!=0,d=this.target,r=d.a,a=d.b,l=d.c,f=d.d,m=r*f-a*l>0?B.degRad:-B.degRad,u=this.data.offsetRotation*m,g=this.data.offsetShearY*m,x=this.bones;for(let b=0,y=x.length;b<y;b++){let w=x[b];if(t!=0){let p=w.a,C=w.b,v=w.c,M=w.d,S=Math.atan2(l,r)-Math.atan2(v,p)+u;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=t;let I=Math.cos(S),F=Math.sin(S);w.a=I*p-F*v,w.b=I*C-F*M,w.c=F*p+I*v,w.d=F*C+I*M}if(h){let p=this.temp;d.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),w.worldX+=(p.x-w.worldX)*e,w.worldY+=(p.y-w.worldY)*i}if(s!=0){let p=Math.sqrt(w.a*w.a+w.c*w.c);p!=0&&(p=(p+(Math.sqrt(r*r+l*l)-p+this.data.offsetScaleX)*s)/p),w.a*=p,w.c*=p}if(n!=0){let p=Math.sqrt(w.b*w.b+w.d*w.d);p!=0&&(p=(p+(Math.sqrt(a*a+f*f)-p+this.data.offsetScaleY)*n)/p),w.b*=p,w.d*=p}if(o>0){let p=w.b,C=w.d,v=Math.atan2(C,p),M=Math.atan2(f,a)-Math.atan2(l,r)-(v-Math.atan2(w.c,w.a));M>B.PI?M-=B.PI2:M<-B.PI&&(M+=B.PI2),M=v+(M+g)*o;let S=Math.sqrt(p*p+C*C);w.b=Math.cos(M)*S,w.d=Math.sin(M)*S}w.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,o=this.mixShearY,h=e!=0||i!=0,d=this.target,r=d.a,a=d.b,l=d.c,f=d.d,m=r*f-a*l>0?B.degRad:-B.degRad,u=this.data.offsetRotation*m,g=this.data.offsetShearY*m,x=this.bones;for(let b=0,y=x.length;b<y;b++){let w=x[b];if(t!=0){let p=w.a,C=w.b,v=w.c,M=w.d,S=Math.atan2(l,r)+u;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=t;let I=Math.cos(S),F=Math.sin(S);w.a=I*p-F*v,w.b=I*C-F*M,w.c=F*p+I*v,w.d=F*C+I*M}if(h){let p=this.temp;d.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),w.worldX+=p.x*e,w.worldY+=p.y*i}if(s!=0){let p=(Math.sqrt(r*r+l*l)-1+this.data.offsetScaleX)*s+1;w.a*=p,w.c*=p}if(n!=0){let p=(Math.sqrt(a*a+f*f)-1+this.data.offsetScaleY)*n+1;w.b*=p,w.d*=p}if(o>0){let p=Math.atan2(f,a)-Math.atan2(l,r);p>B.PI?p-=B.PI2:p<-B.PI&&(p+=B.PI2);let C=w.b,v=w.d;p=Math.atan2(v,C)+(p-B.PI/2+g)*o;let M=Math.sqrt(C*C+v*v);w.b=Math.cos(p)*M,w.d=Math.sin(p)*M}w.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,o=this.mixShearY,h=this.target,d=this.bones;for(let r=0,a=d.length;r<a;r++){let l=d[r],f=l.arotation;t!=0&&(f+=(h.arotation-f+this.data.offsetRotation)*t);let m=l.ax,u=l.ay;m+=(h.ax-m+this.data.offsetX)*e,u+=(h.ay-u+this.data.offsetY)*i;let g=l.ascaleX,x=l.ascaleY;s!=0&&g!=0&&(g=(g+(h.ascaleX-g+this.data.offsetScaleX)*s)/g),n!=0&&x!=0&&(x=(x+(h.ascaleY-x+this.data.offsetScaleY)*n)/x);let b=l.ashearY;o!=0&&(b+=(h.ashearY-b+this.data.offsetShearY)*o),l.updateWorldTransformWith(m,u,f,g,x,l.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,o=this.mixShearY,h=this.target,d=this.bones;for(let r=0,a=d.length;r<a;r++){let l=d[r],f=l.arotation+(h.arotation+this.data.offsetRotation)*t,m=l.ax+(h.ax+this.data.offsetX)*e,u=l.ay+(h.ay+this.data.offsetY)*i,g=l.ascaleX*((h.ascaleX-1+this.data.offsetScaleX)*s+1),x=l.ascaleY*((h.ascaleY-1+this.data.offsetScaleY)*n+1),b=l.ashearY+(h.ashearY+this.data.offsetShearY)*o;l.updateWorldTransformWith(m,u,f,g,x,l.ashearX,b)}}};var ks=class ks{constructor(t){c(this,"data");c(this,"bones");c(this,"slots");c(this,"drawOrder");c(this,"ikConstraints");c(this,"transformConstraints");c(this,"pathConstraints");c(this,"physicsConstraints");c(this,"_updateCache",new Array);c(this,"skin",null);c(this,"color");c(this,"scaleX",1);c(this,"_scaleY",1);c(this,"x",0);c(this,"y",0);c(this,"time",0);if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let i=t.bones[e],s;if(!i.parent)s=new us(i,this,null);else{let n=this.bones[i.parent.index];s=new us(i,this,n),n.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let i=t.slots[e],s=this.bones[i.boneData.index],n=new Rs(i,s);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let i=t.ikConstraints[e];this.ikConstraints.push(new Ts(i,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let i=t.transformConstraints[e];this.transformConstraints.push(new Fs(i,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let i=t.pathConstraints[e];this.pathConstraints.push(new Es(i,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let i=t.physicsConstraints[e];this.physicsConstraints.push(new Ei(i,this))}this.color=new N(1,1,1,1),this.updateCache()}get scaleY(){return ks.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}updateCache(){let t=this._updateCache;t.length=0;let e=this.bones;for(let f=0,m=e.length;f<m;f++){let u=e[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let g=this.bones[f[m].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let i=this.ikConstraints,s=this.transformConstraints,n=this.pathConstraints,o=this.physicsConstraints,h=i.length,d=s.length,r=n.length,a=this.physicsConstraints.length,l=h+d+r+a;t:for(let f=0;f<l;f++){for(let m=0;m<h;m++){let u=i[m];if(u.data.order==f){this.sortIkConstraint(u);continue t}}for(let m=0;m<d;m++){let u=s[m];if(u.data.order==f){this.sortTransformConstraint(u);continue t}}for(let m=0;m<r;m++){let u=n[m];if(u.data.order==f){this.sortPathConstraint(u);continue t}}for(let m=0;m<a;m++){let u=o[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue t}}}for(let f=0,m=e.length;f<m;f++)this.sortBone(e[f])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let i=t.bones,s=i[0];if(this.sortBone(s),i.length==1)this._updateCache.push(t),this.sortReset(s.children);else{let n=i[i.length-1];this.sortBone(n),this._updateCache.push(t),this.sortReset(s.children),n.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,i=e.data.index,s=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,s),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,s);for(let d=0,r=this.data.skins.length;d<r;d++)this.sortPathConstraintAttachment(this.data.skins[d],i,s);let n=e.getAttachment();n instanceof zt&&this.sortPathConstraintAttachmentWith(n,s);let o=t.bones,h=o.length;for(let d=0;d<h;d++)this.sortBone(o[d]);this._updateCache.push(t);for(let d=0;d<h;d++)this.sortReset(o[d].children);for(let d=0;d<h;d++)o[d].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,i=e.length;if(t.data.local)for(let s=0;s<i;s++){let n=e[s];this.sortBone(n.parent),this.sortBone(n)}else for(let s=0;s<i;s++)this.sortBone(e[s]);this._updateCache.push(t);for(let s=0;s<i;s++)this.sortReset(e[s].children);for(let s=0;s<i;s++)e[s].sorted=!0}sortPathConstraintAttachment(t,e,i){let s=t.attachments[e];if(s)for(let n in s)this.sortPathConstraintAttachmentWith(s[n],i)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof zt))return;let i=t.bones;if(!i)this.sortBone(e);else{let s=this.bones;for(let n=0,o=i.length;n<o;){let h=i[n++];for(h+=n;n<h;)this.sortBone(s[i[n++]])}}}sortPhysicsConstraint(t){let e=t.bone;t.active=e.active&&(!t.data.skinRequired||this.skin!=null&&O.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,i=t.length;e<i;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let e=this.bones;for(let s=0,n=e.length;s<n;s++){let o=e[s];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let s=0,n=i.length;s<n;s++)i[s].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let i=this.bones;for(let x=1,b=i.length;x<b;x++){let y=i[x];y.ax=y.x,y.ay=y.y,y.arotation=y.rotation,y.ascaleX=y.scaleX,y.ascaleY=y.scaleY,y.ashearX=y.shearX,y.ashearY=y.shearY}let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let n=e.a,o=e.b,h=e.c,d=e.d;s.worldX=n*this.x+o*this.y+e.worldX,s.worldY=h*this.x+d*this.y+e.worldY;let r=(s.rotation+s.shearX)*B.degRad,a=(s.rotation+90+s.shearY)*B.degRad,l=Math.cos(r)*s.scaleX,f=Math.cos(a)*s.scaleY,m=Math.sin(r)*s.scaleX,u=Math.sin(a)*s.scaleY;s.a=(n*l+o*m)*this.scaleX,s.b=(n*f+o*u)*this.scaleX,s.c=(h*l+d*m)*this.scaleY,s.d=(h*f+d*u)*this.scaleY;let g=this._updateCache;for(let x=0,b=g.length;x<b;x++){let y=g[x];y!=s&&y.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(let t of this.bones)t.setToSetupPose();for(let t of this.ikConstraints)t.setToSetupPose();for(let t of this.transformConstraints)t.setToSetupPose();for(let t of this.pathConstraints)t.setToSetupPose();for(let t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;O.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,i=t.length;e<i;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.data.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.data.name==t)return n}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 i=0,s=e.length;i<s;i++){let n=e[i],o=n.data.attachmentName;if(o){let h=t.getAttachment(i,o);h&&n.setAttachment(h)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,e);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let i=this.slots;for(let s=0,n=i.length;s<n;s++){let o=i[s];if(o.data.name==t){let h=null;if(e&&(h=this.getAttachment(s,e),!h))throw new Error("Attachment not found: "+e+", for slot: "+t);o.setAttachment(h);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return(e=this.ikConstraints.find(i=>i.data.name==t))!=null?e:null}findTransformConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return(e=this.transformConstraints.find(i=>i.data.name==t))!=null?e:null}findPathConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return(e=this.pathConstraints.find(i=>i.data.name==t))!=null?e:null}findPhysicsConstraint(t){var e;if(t==null)throw new Error("constraintName cannot be null.");return(e=this.physicsConstraints.find(i=>i.data.name==t))!=null?e:null}getBoundsRect(t){let e=new Vt,i=new Vt;return this.getBounds(e,i,void 0,t),{x:e.x,y:e.y,width:i.x,height:i.y}}getBounds(t,e,i=new Array(2),s=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,o=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let a=0,l=n.length;a<l;a++){let f=n[a];if(!f.bone.active)continue;let m=0,u=null,g=null,x=f.getAttachment();if(x instanceof Kt)m=8,u=O.setArraySize(i,m,0),x.computeWorldVertices(f,u,0,2),g=ks.quadTriangles;else if(x instanceof Nt){let b=x;m=b.worldVerticesLength,u=O.setArraySize(i,m,0),b.computeWorldVertices(f,0,m,u,0,2),g=b.triangles}else if(x instanceof Zt&&s!=null){s.clipStart(f,x);continue}if(u&&g){s!=null&&s.isClipping()&&(s.clipTriangles(u,g,g.length),u=s.clippedVertices,m=s.clippedVertices.length);for(let b=0,y=u.length;b<y;b+=2){let w=u[b],p=u[b+1];o=Math.min(o,w),h=Math.min(h,p),d=Math.max(d,w),r=Math.max(r,p)}}s!=null&&s.clipEndWithSlot(f)}s!=null&&s.clipEnd(),t.set(o,h),e.set(d-o,r-h)}update(t){this.time+=t}physicsTranslate(t,e){let i=this.physicsConstraints;for(let s=0,n=i.length;s<n;s++)i[s].translate(t,e)}physicsRotate(t,e,i){let s=this.physicsConstraints;for(let n=0,o=s.length;n<o;n++)s[n].rotate(t,e,i)}};c(ks,"quadTriangles",[0,1,2,2,3,0]),c(ks,"yDown",!1);var Ys=ks,ae;(function(A){A[A.none=0]="none",A[A.reset=1]="reset",A[A.update=2]="update",A[A.pose=3]="pose"})(ae||(ae={}));var Xs=class extends Jt{constructor(e){super(e,0,!1);c(this,"_bone",null);c(this,"x",0);c(this,"y",0);c(this,"rotate",0);c(this,"scaleX",0);c(this,"shearX",0);c(this,"limit",0);c(this,"step",0);c(this,"inertia",0);c(this,"strength",0);c(this,"damping",0);c(this,"massInverse",0);c(this,"wind",0);c(this,"gravity",0);c(this,"mix",0);c(this,"inertiaGlobal",!1);c(this,"strengthGlobal",!1);c(this,"dampingGlobal",!1);c(this,"massGlobal",!1);c(this,"windGlobal",!1);c(this,"gravityGlobal",!1);c(this,"mixGlobal",!1)}set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}};var ts=class{constructor(){c(this,"name",null);c(this,"bones",new Array);c(this,"slots",new Array);c(this,"skins",new Array);c(this,"defaultSkin",null);c(this,"events",new Array);c(this,"animations",new Array);c(this,"ikConstraints",new Array);c(this,"transformConstraints",new Array);c(this,"pathConstraints",new Array);c(this,"physicsConstraints",new Array);c(this,"x",0);c(this,"y",0);c(this,"width",0);c(this,"height",0);c(this,"referenceScale",100);c(this,"version",null);c(this,"hash",null);c(this,"fps",0);c(this,"imagesPath",null);c(this,"audioPath",null)}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.physicsConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}};var Ls=class{constructor(t=0,e,i){c(this,"slotIndex");c(this,"name");c(this,"attachment");this.slotIndex=t,this.name=e,this.attachment=i}},de=class{constructor(t){c(this,"name");c(this,"attachments",new Array);c(this,"bones",Array());c(this,"constraints",new Array);c(this,"color",new N(.99607843,.61960787,.30980393,1));if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,i){if(!i)throw new Error("attachment cannot be null.");let s=this.attachments;t>=s.length&&(s.length=t+1),s[t]||(s[t]={}),s[t][e]=i}addSkin(t){for(let s=0;s<t.bones.length;s++){let n=t.bones[s],o=!1;for(let h=0;h<this.bones.length;h++)if(this.bones[h]==n){o=!0;break}o||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){let n=t.constraints[s],o=!1;for(let h=0;h<this.constraints.length;h++)if(this.constraints[h]==n){o=!0;break}o||this.constraints.push(n)}let e=t.getAttachments();for(let s=0;s<e.length;s++){var i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){let n=t.bones[s],o=!1;for(let h=0;h<this.bones.length;h++)if(this.bones[h]==n){o=!0;break}o||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){let n=t.constraints[s],o=!1;for(let h=0;h<this.constraints.length;h++)if(this.constraints[h]==n){o=!0;break}o||this.constraints.push(n)}let e=t.getAttachments();for(let s=0;s<e.length;s++){var i=e[s];i.attachment&&(i.attachment instanceof Nt?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(t,e){let i=this.attachments[t];return i?i[e]:null}removeAttachment(t,e){let i=this.attachments[t];i&&delete i[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let i=this.attachments[e];if(i)for(let s in i){let n=i[s];n&&t.push(new Ls(e,s,n))}}return t}getAttachmentsForSlot(t,e){let i=this.attachments[t];if(i)for(let s in i){let n=i[s];n&&e.push(new Ls(t,s,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let i=0;for(let s=0;s<t.slots.length;s++){let n=t.slots[s],o=n.getAttachment();if(o&&i<e.attachments.length){let h=e.attachments[i];for(let d in h){let r=h[d];if(o==r){let a=this.getAttachment(i,d);a&&n.setAttachment(a);break}}}i++}}};var es=class{constructor(t,e,i){c(this,"index",0);c(this,"name");c(this,"boneData");c(this,"color",new N(1,1,1,1));c(this,"darkColor",null);c(this,"attachmentName",null);c(this,"blendMode",qt.Normal);c(this,"visible",!0);if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=i}},qt;(function(A){A[A.Normal=0]="Normal",A[A.Additive=1]="Additive",A[A.Multiply=2]="Multiply",A[A.Screen=3]="Screen"})(qt||(qt={}));var ss=class extends Jt{constructor(e){super(e,0,!1);c(this,"bones",new Array);c(this,"_target",null);c(this,"mixRotate",0);c(this,"mixX",0);c(this,"mixY",0);c(this,"mixScaleX",0);c(this,"mixScaleY",0);c(this,"mixShearY",0);c(this,"offsetRotation",0);c(this,"offsetX",0);c(this,"offsetY",0);c(this,"offsetScaleX",0);c(this,"offsetScaleY",0);c(this,"offsetShearY",0);c(this,"relative",!1);c(this,"local",!1)}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}};var Yi=class{constructor(t){c(this,"scale",1);c(this,"attachmentLoader");c(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){var a;let e=this.scale,i=new ts;i.name="";let s=new ti(t),n=s.readInt32(),o=s.readInt32();i.hash=o==0&&n==0?null:o.toString(16)+n.toString(16),i.version=s.readString(),i.x=s.readFloat(),i.y=s.readFloat(),i.width=s.readFloat(),i.height=s.readFloat(),i.referenceScale=s.readFloat()*e;let h=s.readBoolean();h&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let d=0;d=s.readInt(!0);for(let l=0;l<d;l++){let f=s.readString();if(!f)throw new Error("String in string table must not be null.");s.strings.push(f)}d=s.readInt(!0);for(let l=0;l<d;l++){let f=s.readString();if(!f)throw new Error("Bone name must not be null.");let m=l==0?null:i.bones[s.readInt(!0)],u=new Ke(l,f,m);u.rotation=s.readFloat(),u.x=s.readFloat()*e,u.y=s.readFloat()*e,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*e,u.inherit=s.readByte(),u.skinRequired=s.readBoolean(),h&&(N.rgba8888ToColor(u.color,s.readInt32()),u.icon=(a=s.readString())!=null?a:void 0,u.visible=s.readBoolean()),i.bones.push(u)}d=s.readInt(!0);for(let l=0;l<d;l++){let f=s.readString();if(!f)throw new Error("Slot name must not be null.");let m=i.bones[s.readInt(!0)],u=new es(l,f,m);N.rgba8888ToColor(u.color,s.readInt32());let g=s.readInt32();g!=-1&&N.rgb888ToColor(u.darkColor=new N,g),u.attachmentName=s.readStringRef(),u.blendMode=s.readInt(!0),h&&(u.visible=s.readBoolean()),i.slots.push(u)}d=s.readInt(!0);for(let l=0,f;l<d;l++){let m=s.readString();if(!m)throw new Error("IK constraint data name must not be null.");let u=new _e(m);u.order=s.readInt(!0),f=s.readInt(!0);for(let x=0;x<f;x++)u.bones.push(i.bones[s.readInt(!0)]);u.target=i.bones[s.readInt(!0)];let g=s.readByte();u.skinRequired=(g&1)!=0,u.bendDirection=(g&2)!=0?1:-1,u.compress=(g&4)!=0,u.stretch=(g&8)!=0,u.uniform=(g&16)!=0,(g&32)!=0&&(u.mix=(g&64)!=0?s.readFloat():1),(g&128)!=0&&(u.softness=s.readFloat()*e),i.ikConstraints.push(u)}d=s.readInt(!0);for(let l=0,f;l<d;l++){let m=s.readString();if(!m)throw new Error("Transform constraint data name must not be null.");let u=new ss(m);u.order=s.readInt(!0),f=s.readInt(!0);for(let x=0;x<f;x++)u.bones.push(i.bones[s.readInt(!0)]);u.target=i.bones[s.readInt(!0)];let g=s.readByte();u.skinRequired=(g&1)!=0,u.local=(g&2)!=0,u.relative=(g&4)!=0,(g&8)!=0&&(u.offsetRotation=s.readFloat()),(g&16)!=0&&(u.offsetX=s.readFloat()*e),(g&32)!=0&&(u.offsetY=s.readFloat()*e),(g&64)!=0&&(u.offsetScaleX=s.readFloat()),(g&128)!=0&&(u.offsetScaleY=s.readFloat()),g=s.readByte(),(g&1)!=0&&(u.offsetShearY=s.readFloat()),(g&2)!=0&&(u.mixRotate=s.readFloat()),(g&4)!=0&&(u.mixX=s.readFloat()),(g&8)!=0&&(u.mixY=s.readFloat()),(g&16)!=0&&(u.mixScaleX=s.readFloat()),(g&32)!=0&&(u.mixScaleY=s.readFloat()),(g&64)!=0&&(u.mixShearY=s.readFloat()),i.transformConstraints.push(u)}d=s.readInt(!0);for(let l=0,f;l<d;l++){let m=s.readString();if(!m)throw new Error("Path constraint data name must not be null.");let u=new $e(m);u.order=s.readInt(!0),u.skinRequired=s.readBoolean(),f=s.readInt(!0);for(let x=0;x<f;x++)u.bones.push(i.bones[s.readInt(!0)]);u.target=i.slots[s.readInt(!0)];let g=s.readByte();u.positionMode=g&1,u.spacingMode=g>>1&3,u.rotateMode=g>>3&3,(g&128)!=0&&(u.offsetRotation=s.readFloat()),u.position=s.readFloat(),u.positionMode==Lt.Fixed&&(u.position*=e),u.spacing=s.readFloat(),(u.spacingMode==bt.Length||u.spacingMode==bt.Fixed)&&(u.spacing*=e),u.mixRotate=s.readFloat(),u.mixX=s.readFloat(),u.mixY=s.readFloat(),i.pathConstraints.push(u)}d=s.readInt(!0);for(let l=0,f;l<d;l++){let m=s.readString();if(!m)throw new Error("Physics constraint data name must not be null.");let u=new Xs(m);u.order=s.readInt(!0),u.bone=i.bones[s.readInt(!0)];let g=s.readByte();u.skinRequired=(g&1)!=0,(g&2)!=0&&(u.x=s.readFloat()),(g&4)!=0&&(u.y=s.readFloat()),(g&8)!=0&&(u.rotate=s.readFloat()),(g&16)!=0&&(u.scaleX=s.readFloat()),(g&32)!=0&&(u.shearX=s.readFloat()),u.limit=((g&64)!=0?s.readFloat():5e3)*e,u.step=1/s.readUnsignedByte(),u.inertia=s.readFloat(),u.strength=s.readFloat(),u.damping=s.readFloat(),u.massInverse=(g&128)!=0?s.readFloat():1,u.wind=s.readFloat(),u.gravity=s.readFloat(),g=s.readByte(),(g&1)!=0&&(u.inertiaGlobal=!0),(g&2)!=0&&(u.strengthGlobal=!0),(g&4)!=0&&(u.dampingGlobal=!0),(g&8)!=0&&(u.massGlobal=!0),(g&16)!=0&&(u.windGlobal=!0),(g&32)!=0&&(u.gravityGlobal=!0),(g&64)!=0&&(u.mixGlobal=!0),u.mix=(g&128)!=0?s.readFloat():1,i.physicsConstraints.push(u)}let r=this.readSkin(s,i,!0,h);r&&(i.defaultSkin=r,i.skins.push(r));{let l=i.skins.length;for(O.setArraySize(i.skins,d=l+s.readInt(!0));l<d;l++){let f=this.readSkin(s,i,!1,h);if(!f)throw new Error("readSkin() should not have returned null.");i.skins[l]=f}}d=this.linkedMeshes.length;for(let l=0;l<d;l++){let f=this.linkedMeshes[l],m=i.skins[f.skinIndex];if(!f.parent)throw new Error("Linked mesh parent must not be null");let u=m.getAttachment(f.slotIndex,f.parent);if(!u)throw new Error(`Parent mesh not found: ${f.parent}`);f.mesh.timelineAttachment=f.inheritTimeline?u:f.mesh,f.mesh.setParentMesh(u),f.mesh.region!=null&&f.mesh.updateRegion()}this.linkedMeshes.length=0,d=s.readInt(!0);for(let l=0;l<d;l++){let f=s.readString();if(!f)throw new Error("Event data name must not be null");let m=new Qe(f);m.intValue=s.readInt(!1),m.floatValue=s.readFloat(),m.stringValue=s.readString(),m.audioPath=s.readString(),m.audioPath&&(m.volume=s.readFloat(),m.balance=s.readFloat()),i.events.push(m)}d=s.readInt(!0);for(let l=0;l<d;l++){let f=s.readString();if(!f)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,f,i))}return i}readSkin(t,e,i,s){let n=null,o=0;if(i){if(o=t.readInt(!0),o==0)return null;n=new de("default")}else{let h=t.readString();if(!h)throw new Error("Skin name must not be null.");n=new de(h),s&&N.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let d=0,r=n.bones.length;d<r;d++)n.bones[d]=e.bones[t.readInt(!0)];for(let d=0,r=t.readInt(!0);d<r;d++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let d=0,r=t.readInt(!0);d<r;d++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let d=0,r=t.readInt(!0);d<r;d++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let d=0,r=t.readInt(!0);d<r;d++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);o=t.readInt(!0)}for(let h=0;h<o;h++){let d=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let l=t.readStringRef();if(!l)throw new Error("Attachment name must not be null");let f=this.readAttachment(t,e,n,d,l,s);f&&n.setAttachment(d,l,f)}}return n}readAttachment(t,e,i,s,n,o){let h=this.scale,d=t.readByte(),r=(d&8)!=0?t.readStringRef():n;if(!r)throw new Error("Attachment name must not be null");switch(d&7){case fe.Region:{let a=(d&16)!=0?t.readStringRef():null,l=(d&32)!=0?t.readInt32():4294967295,f=(d&64)!=0?this.readSequence(t):null,m=(d&128)!=0?t.readFloat():0,u=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat(),y=t.readFloat(),w=t.readFloat();a||(a=r);let p=this.attachmentLoader.newRegionAttachment(i,r,a,f);return p?(p.path=a,p.x=u*h,p.y=g*h,p.scaleX=x,p.scaleY=b,p.rotation=m,p.width=y*h,p.height=w*h,N.rgba8888ToColor(p.color,l),p.sequence=f,f==null&&p.updateRegion(),p):null}case fe.BoundingBox:{let a=this.readVertices(t,(d&16)!=0),l=o?t.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(i,r);return f?(f.worldVerticesLength=a.length,f.vertices=a.vertices,f.bones=a.bones,o&&N.rgba8888ToColor(f.color,l),f):null}case fe.Mesh:{let a=(d&16)!=0?t.readStringRef():r,l=(d&32)!=0?t.readInt32():4294967295,f=(d&64)!=0?this.readSequence(t):null,m=t.readInt(!0),u=this.readVertices(t,(d&128)!=0),g=this.readFloatArray(t,u.length,1),x=this.readShortArray(t,(u.length-m-2)*3),b=[],y=0,w=0;o&&(b=this.readShortArray(t,t.readInt(!0)),y=t.readFloat(),w=t.readFloat()),a||(a=r);let p=this.attachmentLoader.newMeshAttachment(i,r,a,f);return p?(p.path=a,N.rgba8888ToColor(p.color,l),p.bones=u.bones,p.vertices=u.vertices,p.worldVerticesLength=u.length,p.triangles=x,p.regionUVs=g,f==null&&p.updateRegion(),p.hullLength=m<<1,p.sequence=f,o&&(p.edges=b,p.width=y*h,p.height=w*h),p):null}case fe.LinkedMesh:{let a=(d&16)!=0?t.readStringRef():r;if(a==null)throw new Error("Path of linked mesh must not be null");let l=(d&32)!=0?t.readInt32():4294967295,f=(d&64)!=0?this.readSequence(t):null,m=(d&128)!=0,u=t.readInt(!0),g=t.readStringRef(),x=0,b=0;o&&(x=t.readFloat(),b=t.readFloat());let y=this.attachmentLoader.newMeshAttachment(i,r,a,f);return y?(y.path=a,N.rgba8888ToColor(y.color,l),y.sequence=f,o&&(y.width=x*h,y.height=b*h),this.linkedMeshes.push(new qi(y,u,s,g,m)),y):null}case fe.Path:{let a=(d&16)!=0,l=(d&32)!=0,f=this.readVertices(t,(d&64)!=0),m=O.newArray(f.length/6,0);for(let x=0,b=m.length;x<b;x++)m[x]=t.readFloat()*h;let u=o?t.readInt32():0,g=this.attachmentLoader.newPathAttachment(i,r);return g?(g.closed=a,g.constantSpeed=l,g.worldVerticesLength=f.length,g.vertices=f.vertices,g.bones=f.bones,g.lengths=m,o&&N.rgba8888ToColor(g.color,u),g):null}case fe.Point:{let a=t.readFloat(),l=t.readFloat(),f=t.readFloat(),m=o?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(i,r);return u?(u.x=l*h,u.y=f*h,u.rotation=a,o&&N.rgba8888ToColor(u.color,m),u):null}case fe.Clipping:{let a=t.readInt(!0),l=this.readVertices(t,(d&16)!=0),f=o?t.readInt32():0,m=this.attachmentLoader.newClippingAttachment(i,r);return m?(m.endSlot=e.slots[a],m.worldVerticesLength=l.length,m.vertices=l.vertices,m.bones=l.bones,o&&N.rgba8888ToColor(m.color,f),m):null}}return null}readSequence(t){let e=new vs(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){let i=this.scale,s=t.readInt(!0),n=new Gi;if(n.length=s<<1,!e)return n.vertices=this.readFloatArray(t,n.length,i),n;let o=new Array,h=new Array;for(let d=0;d<s;d++){let r=t.readInt(!0);h.push(r);for(let a=0;a<r;a++)h.push(t.readInt(!0)),o.push(t.readFloat()*i),o.push(t.readFloat()*i),o.push(t.readFloat())}return n.vertices=O.toFloatArray(o),n.bones=h,n}readFloatArray(t,e,i){let s=new Array(e);if(i==1)for(let n=0;n<e;n++)s[n]=t.readFloat();else for(let n=0;n<e;n++)s[n]=t.readFloat()*i;return s}readShortArray(t,e){let i=new Array(e);for(let s=0;s<e;s++)i[s]=t.readInt(!0);return i}readAnimation(t,e,i){t.readInt(!0);let s=new Array,n=this.scale;for(let r=0,a=t.readInt(!0);r<a;r++){let l=t.readInt(!0);for(let f=0,m=t.readInt(!0);f<m;f++){let u=t.readByte(),g=t.readInt(!0),x=g-1;switch(u){case Er:{let b=new Ut(g,l);for(let y=0;y<g;y++)b.setFrame(y,t.readFloat(),t.readStringRef());s.push(b);break}case Yr:{let b=t.readInt(!0),y=new Ee(g,b,l),w=t.readFloat(),p=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let S=0,I=0;y.setFrame(S,w,p,C,v,M),S!=x;S++){let F=t.readFloat(),R=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case le:y.setStepped(S);break;case oe:ht(t,y,I++,S,0,w,F,p,R,1),ht(t,y,I++,S,1,w,F,C,V,1),ht(t,y,I++,S,2,w,F,v,X,1),ht(t,y,I++,S,3,w,F,M,Y,1)}w=F,p=R,C=V,v=X,M=Y}s.push(y);break}case Rr:{let b=t.readInt(!0),y=new Ye(g,b,l),w=t.readFloat(),p=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let M=0,S=0;y.setFrame(M,w,p,C,v),M!=x;M++){let I=t.readFloat(),F=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case le:y.setStepped(M);break;case oe:ht(t,y,S++,M,0,w,I,p,F,1),ht(t,y,S++,M,1,w,I,C,R,1),ht(t,y,S++,M,2,w,I,v,V,1)}w=I,p=F,C=R,v=V}s.push(y);break}case Fr:{let b=t.readInt(!0),y=new Fe(g,b,l),w=t.readFloat(),p=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255;for(let R=0,V=0;y.setFrame(R,w,p,C,v,M,S,I,F),R!=x;R++){let X=t.readFloat(),Y=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,nt=t.readUnsignedByte()/255,j=t.readUnsignedByte()/255,ct=t.readUnsignedByte()/255;switch(t.readByte()){case le:y.setStepped(R);break;case oe:ht(t,y,V++,R,0,w,X,p,Y,1),ht(t,y,V++,R,1,w,X,C,k,1),ht(t,y,V++,R,2,w,X,v,L,1),ht(t,y,V++,R,3,w,X,M,D,1),ht(t,y,V++,R,4,w,X,S,nt,1),ht(t,y,V++,R,5,w,X,I,j,1),ht(t,y,V++,R,6,w,X,F,ct,1)}w=X,p=Y,C=k,v=L,M=D,S=nt,I=j,F=ct}s.push(y);break}case kr:{let b=t.readInt(!0),y=new ke(g,b,l),w=t.readFloat(),p=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let F=0,R=0;y.setFrame(F,w,p,C,v,M,S,I),F!=x;F++){let V=t.readFloat(),X=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,nt=t.readUnsignedByte()/255;switch(t.readByte()){case le:y.setStepped(F);break;case oe:ht(t,y,R++,F,0,w,V,p,X,1),ht(t,y,R++,F,1,w,V,C,Y,1),ht(t,y,R++,F,2,w,V,v,k,1),ht(t,y,R++,F,3,w,V,M,L,1),ht(t,y,R++,F,4,w,V,S,D,1),ht(t,y,R++,F,5,w,V,I,nt,1)}w=V,p=X,C=Y,v=k,M=L,S=D,I=nt}s.push(y);break}case Xr:{let b=new Re(g,t.readInt(!0),l),y=t.readFloat(),w=t.readUnsignedByte()/255;for(let p=0,C=0;b.setFrame(p,y,w),p!=x;p++){let v=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case le:b.setStepped(p);break;case oe:ht(t,b,C++,p,0,y,v,w,M,1)}y=v,w=M}s.push(b)}}}}for(let r=0,a=t.readInt(!0);r<a;r++){let l=t.readInt(!0);for(let f=0,m=t.readInt(!0);f<m;f++){let u=t.readByte(),g=t.readInt(!0);if(u==Tr){let b=new Te(g,l);for(let y=0;y<g;y++)b.setFrame(y,t.readFloat(),t.readByte());s.push(b);continue}let x=t.readInt(!0);switch(u){case xr:s.push(Rt(t,new _t(g,x,l),1));break;case wr:s.push(Wi(t,new we(g,x,l),n));break;case br:s.push(Rt(t,new be(g,x,l),n));break;case yr:s.push(Rt(t,new ye(g,x,l),n));break;case vr:s.push(Wi(t,new ve(g,x,l),1));break;case Ar:s.push(Rt(t,new Ae(g,x,l),1));break;case Cr:s.push(Rt(t,new Ce(g,x,l),1));break;case Mr:s.push(Wi(t,new Me(g,x,l),1));break;case Sr:s.push(Rt(t,new Se(g,x,l),1));break;case Ir:s.push(Rt(t,new Ie(g,x,l),1))}}}for(let r=0,a=t.readInt(!0);r<a;r++){let l=t.readInt(!0),f=t.readInt(!0),m=f-1,u=new Le(f,t.readInt(!0),l),g=t.readByte(),x=t.readFloat(),b=(g&1)!=0?(g&2)!=0?t.readFloat():1:0,y=(g&4)!=0?t.readFloat()*n:0;for(let w=0,p=0;u.setFrame(w,x,b,y,(g&8)!=0?1:-1,(g&16)!=0,(g&32)!=0),w!=m;w++){g=t.readByte();let C=t.readFloat(),v=(g&1)!=0?(g&2)!=0?t.readFloat():1:0,M=(g&4)!=0?t.readFloat()*n:0;(g&64)!=0?u.setStepped(w):(g&128)!=0&&(ht(t,u,p++,w,0,x,C,b,v,1),ht(t,u,p++,w,1,x,C,y,M,n)),x=C,b=v,y=M}s.push(u)}for(let r=0,a=t.readInt(!0);r<a;r++){let l=t.readInt(!0),f=t.readInt(!0),m=f-1,u=new Pe(f,t.readInt(!0),l),g=t.readFloat(),x=t.readFloat(),b=t.readFloat(),y=t.readFloat(),w=t.readFloat(),p=t.readFloat(),C=t.readFloat();for(let v=0,M=0;u.setFrame(v,g,x,b,y,w,p,C),v!=m;v++){let S=t.readFloat(),I=t.readFloat(),F=t.readFloat(),R=t.readFloat(),V=t.readFloat(),X=t.readFloat(),Y=t.readFloat();switch(t.readByte()){case le:u.setStepped(v);break;case oe:ht(t,u,M++,v,0,g,S,x,I,1),ht(t,u,M++,v,1,g,S,b,F,1),ht(t,u,M++,v,2,g,S,y,R,1),ht(t,u,M++,v,3,g,S,w,V,1),ht(t,u,M++,v,4,g,S,p,X,1),ht(t,u,M++,v,5,g,S,C,Y,1)}g=S,x=I,b=F,y=R,w=V,p=X,C=Y}s.push(u)}for(let r=0,a=t.readInt(!0);r<a;r++){let l=t.readInt(!0),f=i.pathConstraints[l];for(let m=0,u=t.readInt(!0);m<u;m++){let g=t.readByte(),x=t.readInt(!0),b=t.readInt(!0);switch(g){case Br:s.push(Rt(t,new Be(x,b,l),f.positionMode==Lt.Fixed?n:1));break;case Vr:s.push(Rt(t,new Ve(x,b,l),f.spacingMode==bt.Length||f.spacingMode==bt.Fixed?n:1));break;case Or:let y=new Oe(x,b,l),w=t.readFloat(),p=t.readFloat(),C=t.readFloat(),v=t.readFloat();for(let M=0,S=0,I=y.getFrameCount()-1;y.setFrame(M,w,p,C,v),M!=I;M++){let F=t.readFloat(),R=t.readFloat(),V=t.readFloat(),X=t.readFloat();switch(t.readByte()){case le:y.setStepped(M);break;case oe:ht(t,y,S++,M,0,w,F,p,R,1),ht(t,y,S++,M,1,w,F,C,V,1),ht(t,y,S++,M,2,w,F,v,X,1)}w=F,p=R,C=V,v=X}s.push(y)}}}for(let r=0,a=t.readInt(!0);r<a;r++){let l=t.readInt(!0)-1;for(let f=0,m=t.readInt(!0);f<m;f++){let u=t.readByte(),g=t.readInt(!0);if(u==Hr){let b=new He(g,l);for(let y=0;y<g;y++)b.setFrame(y,t.readFloat());s.push(b);continue}let x=t.readInt(!0);switch(u){case Nr:s.push(Rt(t,new Ne(g,x,l),1));break;case Dr:s.push(Rt(t,new De(g,x,l),1));break;case Ur:s.push(Rt(t,new Ue(g,x,l),1));break;case zr:s.push(Rt(t,new ze(g,x,l),1));break;case Wr:s.push(Rt(t,new We(g,x,l),1));break;case qr:s.push(Rt(t,new qe(g,x,l),1));break;case Gr:s.push(Rt(t,new Ge(g,x,l),1))}}}for(let r=0,a=t.readInt(!0);r<a;r++){let l=i.skins[t.readInt(!0)];for(let f=0,m=t.readInt(!0);f<m;f++){let u=t.readInt(!0);for(let g=0,x=t.readInt(!0);g<x;g++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let y=l.getAttachment(u,b),w=t.readByte(),p=t.readInt(!0),C=p-1;switch(w){case Lr:{let v=y,M=v.bones,S=v.vertices,I=M?S.length/3*2:S.length,F=t.readInt(!0),R=new Xe(p,F,u,v),V=t.readFloat();for(let X=0,Y=0;;X++){let k,L=t.readInt(!0);if(L==0)k=M?O.newFloatArray(I):S;else{k=O.newFloatArray(I);let nt=t.readInt(!0);if(L+=nt,n==1)for(let j=nt;j<L;j++)k[j]=t.readFloat();else for(let j=nt;j<L;j++)k[j]=t.readFloat()*n;if(!M)for(let j=0,ct=k.length;j<ct;j++)k[j]+=S[j]}if(R.setFrame(X,V,k),X==C)break;let D=t.readFloat();switch(t.readByte()){case le:R.setStepped(X);break;case oe:ht(t,R,Y++,X,0,V,D,0,1,1)}V=D}s.push(R);break}case Pr:{let v=new je(p,u,y);for(let M=0;M<p;M++){let S=t.readFloat(),I=t.readInt32();v.setFrame(M,S,pi[I&15],I>>4,t.readFloat())}s.push(v);break}}}}}let o=t.readInt(!0);if(o>0){let r=new jt(o),a=i.slots.length;for(let l=0;l<o;l++){let f=t.readFloat(),m=t.readInt(!0),u=O.newArray(a,0);for(let y=a-1;y>=0;y--)u[y]=-1;let g=O.newArray(a-m,0),x=0,b=0;for(let y=0;y<m;y++){let w=t.readInt(!0);for(;x!=w;)g[b++]=x++;u[x+t.readInt(!0)]=x++}for(;x<a;)g[b++]=x++;for(let y=a-1;y>=0;y--)u[y]==-1&&(u[y]=g[--b]);r.setFrame(l,f,u)}s.push(r)}let h=t.readInt(!0);if(h>0){let r=new ne(h);for(let a=0;a<h;a++){let l=t.readFloat(),f=i.events[t.readInt(!0)],m=new Je(l,f);m.intValue=t.readInt(!1),m.floatValue=t.readFloat(),m.stringValue=t.readString(),m.stringValue==null&&(m.stringValue=f.stringValue),m.data.audioPath&&(m.volume=t.readFloat(),m.balance=t.readFloat()),r.setFrame(a,m)}s.push(r)}let d=0;for(let r=0,a=s.length;r<a;r++)d=Math.max(d,s[r].getDuration());return new re(e,s,d)}},ti=class{constructor(t,e=new Array,i=0,s=new DataView(t instanceof ArrayBuffer?t:t.buffer)){c(this,"strings");c(this,"index");c(this,"buffer");this.strings=e,this.index=i,this.buffer=s}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(),i=e&127;return(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<28)))),t?i:i>>>1^-(i&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",i=0;for(let s=0;s<t;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},qi=class{constructor(t,e,i,s,n){c(this,"parent");c(this,"skinIndex");c(this,"slotIndex");c(this,"mesh");c(this,"inheritTimeline");this.mesh=t,this.skinIndex=e,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}},Gi=class{constructor(t=null,e=null,i=0){c(this,"bones");c(this,"vertices");c(this,"length");this.bones=t,this.vertices=e,this.length=i}},fe;(function(A){A[A.Region=0]="Region",A[A.BoundingBox=1]="BoundingBox",A[A.Mesh=2]="Mesh",A[A.LinkedMesh=3]="LinkedMesh",A[A.Path=4]="Path",A[A.Point=5]="Point",A[A.Clipping=6]="Clipping"})(fe||(fe={}));function Rt(A,t,e){let i=A.readFloat(),s=A.readFloat()*e;for(let n=0,o=0,h=t.getFrameCount()-1;t.setFrame(n,i,s),n!=h;n++){let d=A.readFloat(),r=A.readFloat()*e;switch(A.readByte()){case le:t.setStepped(n);break;case oe:ht(A,t,o++,n,0,i,d,s,r,e)}i=d,s=r}return t}function Wi(A,t,e){let i=A.readFloat(),s=A.readFloat()*e,n=A.readFloat()*e;for(let o=0,h=0,d=t.getFrameCount()-1;t.setFrame(o,i,s,n),o!=d;o++){let r=A.readFloat(),a=A.readFloat()*e,l=A.readFloat()*e;switch(A.readByte()){case le:t.setStepped(o);break;case oe:ht(A,t,h++,o,0,i,r,s,a,e),ht(A,t,h++,o,1,i,r,n,l,e)}i=r,s=a,n=l}return t}function ht(A,t,e,i,s,n,o,h,d,r){t.setBezier(e,i,s,n,h,A.readFloat(),A.readFloat()*r,A.readFloat(),A.readFloat()*r,o,d)}var xr=0,wr=1,br=2,yr=3,vr=4,Ar=5,Cr=6,Mr=7,Sr=8,Ir=9,Tr=10,Er=0,Yr=1,Rr=2,Fr=3,kr=4,Xr=5,Lr=0,Pr=1,Br=0,Vr=1,Or=2,Nr=0,Dr=1,Ur=2,zr=4,Wr=5,qr=6,Gr=7,Hr=8;var le=1,oe=2;var Ps=class{constructor(){c(this,"minX",0);c(this,"minY",0);c(this,"maxX",0);c(this,"maxY",0);c(this,"boundingBoxes",new Array);c(this,"polygons",new Array);c(this,"polygonPool",new Qt(()=>O.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let i=this.boundingBoxes,s=this.polygons,n=this.polygonPool,o=t.slots,h=o.length;i.length=0,n.freeAll(s),s.length=0;for(let d=0;d<h;d++){let r=o[d];if(!r.bone.active)continue;let a=r.getAttachment();if(a instanceof Ze){let l=a;i.push(l);let f=n.obtain();f.length!=l.worldVerticesLength&&(f=O.newFloatArray(l.worldVerticesLength)),s.push(f),l.computeWorldVertices(r,0,l.worldVerticesLength,f,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,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=this.polygons;for(let o=0,h=n.length;o<h;o++){let d=n[o],r=d;for(let a=0,l=d.length;a<l;a+=2){let f=r[a],m=r[a+1];t=Math.min(t,f),e=Math.min(e,m),i=Math.max(i,f),s=Math.max(s,m)}}this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,i,s){let n=this.minX,o=this.minY,h=this.maxX,d=this.maxY;if(t<=n&&i<=n||e<=o&&s<=o||t>=h&&i>=h||e>=d&&s>=d)return!1;let r=(s-e)/(i-t),a=r*(n-t)+e;if(a>o&&a<d||(a=r*(h-t)+e,a>o&&a<d))return!0;let l=(o-e)/r+t;return l>n&&l<h||(l=(d-e)/r+t,l>n&&l<h)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let i=this.polygons;for(let s=0,n=i.length;s<n;s++)if(this.containsPointPolygon(i[s],t,e))return this.boundingBoxes[s];return null}containsPointPolygon(t,e,i){let s=t,n=t.length,o=n-2,h=!1;for(let d=0;d<n;d+=2){let r=s[d+1],a=s[o+1];if(r<i&&a>=i||a<i&&r>=i){let l=s[d];l+(i-r)/(a-r)*(s[o]-l)<e&&(h=!h)}o=d}return h}intersectsSegment(t,e,i,s){let n=this.polygons;for(let o=0,h=n.length;o<h;o++)if(this.intersectsSegmentPolygon(n[o],t,e,i,s))return this.boundingBoxes[o];return null}intersectsSegmentPolygon(t,e,i,s,n){let o=t,h=t.length,d=e-s,r=i-n,a=e*n-i*s,l=o[h-2],f=o[h-1];for(let m=0;m<h;m+=2){let u=o[m],g=o[m+1],x=l*g-f*u,b=l-u,y=f-g,w=d*y-r*b,p=(a*b-d*x)/w;if((p>=l&&p<=u||p>=u&&p<=l)&&(p>=e&&p<=s||p>=s&&p<=e)){let C=(a*y-r*x)/w;if((C>=f&&C<=g||C>=g&&C<=f)&&(C>=i&&C<=n||C>=n&&C<=i))return!0}l=u,f=g}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}};var Bs=class A{constructor(){c(this,"convexPolygons",new Array);c(this,"convexPolygonsIndices",new Array);c(this,"indicesArray",new Array);c(this,"isConcaveArray",new Array);c(this,"triangles",new Array);c(this,"polygonPool",new Qt(()=>new Array));c(this,"polygonIndicesPool",new Qt(()=>new Array))}triangulate(t){let e=t,i=t.length>>1,s=this.indicesArray;s.length=0;for(let h=0;h<i;h++)s[h]=h;let n=this.isConcaveArray;n.length=0;for(let h=0,d=i;h<d;++h)n[h]=A.isConcave(h,i,e,s);let o=this.triangles;for(o.length=0;i>3;){let h=i-1,d=0,r=1;for(;;){t:if(!n[d]){let f=s[h]<<1,m=s[d]<<1,u=s[r]<<1,g=e[f],x=e[f+1],b=e[m],y=e[m+1],w=e[u],p=e[u+1];for(let C=(r+1)%i;C!=h;C=(C+1)%i){if(!n[C])continue;let v=s[C]<<1,M=e[v],S=e[v+1];if(A.positiveArea(w,p,g,x,M,S)&&A.positiveArea(g,x,b,y,M,S)&&A.positiveArea(b,y,w,p,M,S))break t}break}if(r==0){do{if(!n[d])break;d--}while(d>0);break}h=d,d=r,r=(r+1)%i}o.push(s[(i+d-1)%i]),o.push(s[d]),o.push(s[(d+1)%i]),s.splice(d,1),n.splice(d,1),i--;let a=(i+d-1)%i,l=d==i?0:d;n[a]=A.isConcave(a,i,e,s),n[l]=A.isConcave(l,i,e,s)}return i==3&&(o.push(s[2]),o.push(s[0]),o.push(s[1])),o}decompose(t,e){let i=t,s=this.convexPolygons;this.polygonPool.freeAll(s),s.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let h=this.polygonPool.obtain();h.length=0;let d=-1,r=0;for(let a=0,l=e.length;a<l;a+=3){let f=e[a]<<1,m=e[a+1]<<1,u=e[a+2]<<1,g=i[f],x=i[f+1],b=i[m],y=i[m+1],w=i[u],p=i[u+1],C=!1;if(d==f){let v=h.length-4,M=A.winding(h[v],h[v+1],h[v+2],h[v+3],w,p),S=A.winding(w,p,h[0],h[1],h[2],h[3]);M==r&&S==r&&(h.push(w),h.push(p),o.push(u),C=!0)}C||(h.length>0?(s.push(h),n.push(o)):(this.polygonPool.free(h),this.polygonIndicesPool.free(o)),h=this.polygonPool.obtain(),h.length=0,h.push(g),h.push(x),h.push(b),h.push(y),h.push(w),h.push(p),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(m),o.push(u),r=A.winding(g,x,b,y,w,p),d=f)}h.length>0&&(s.push(h),n.push(o));for(let a=0,l=s.length;a<l;a++){if(o=n[a],o.length==0)continue;let f=o[0],m=o[o.length-1];h=s[a];let u=h.length-4,g=h[u],x=h[u+1],b=h[u+2],y=h[u+3],w=h[0],p=h[1],C=h[2],v=h[3],M=A.winding(g,x,b,y,w,p);for(let S=0;S<l;S++){if(S==a)continue;let I=n[S];if(I.length!=3)continue;let F=I[0],R=I[1],V=I[2],X=s[S],Y=X[X.length-2],k=X[X.length-1];if(F!=f||R!=m)continue;let L=A.winding(g,x,b,y,Y,k),D=A.winding(Y,k,w,p,C,v);L==M&&D==M&&(X.length=0,I.length=0,h.push(Y),h.push(k),o.push(V),g=b,x=y,b=Y,y=k,S=0)}}for(let a=s.length-1;a>=0;a--)h=s[a],h.length==0&&(s.splice(a,1),this.polygonPool.free(h),o=n[a],n.splice(a,1),this.polygonIndicesPool.free(o));return s}static isConcave(t,e,i,s){let n=s[(e+t-1)%e]<<1,o=s[t]<<1,h=s[(t+1)%e]<<1;return!this.positiveArea(i[n],i[n+1],i[o],i[o+1],i[h],i[h+1])}static positiveArea(t,e,i,s,n,o){return t*(o-s)+i*(e-o)+n*(s-e)>=0}static winding(t,e,i,s,n,o){let h=i-t,d=s-e;return n*d-o*h+h*e-t*d>=0?1:-1}};var Vs=class A{constructor(){c(this,"triangulator",new Bs);c(this,"clippingPolygon",new Array);c(this,"clipOutput",new Array);c(this,"clippedVertices",new Array);c(this,"clippedUVs",new Array);c(this,"clippedTriangles",new Array);c(this,"scratch",new Array);c(this,"clipAttachment",null);c(this,"clippingPolygons",null)}clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let i=e.worldVerticesLength,s=O.setArraySize(this.clippingPolygon,i);e.computeWorldVertices(t,0,i,s,0,2);let n=this.clippingPolygon;A.makeClockwise(n);let o=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let h=0,d=o.length;h<d;h++){let r=o[h];A.makeClockwise(r),r.push(r[0]),r.push(r[1])}return o.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 this.clipAttachment!=null}clipTriangles(t,e,i,s,n,o,h,d){let r,a,l,f,m,u;typeof e=="number"?(r=i,a=s,l=n,f=o,m=h,u=d):(r=e,a=i,l=s,f=n,m=o,u=h),l&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,r,a,l,f,m,u):this.clipTrianglesNoRender(t,r,a)}clipTrianglesNoRender(t,e,i){let s=this.clipOutput,n=this.clippedVertices,o=this.clippedTriangles,h=this.clippingPolygons,d=h.length,r=0;n.length=0,o.length=0;for(let a=0;a<i;a+=3){let l=e[a]<<1,f=t[l],m=t[l+1];l=e[a+1]<<1;let u=t[l],g=t[l+1];l=e[a+2]<<1;let x=t[l],b=t[l+1];for(let y=0;y<d;y++){let w=n.length;if(this.clip(f,m,u,g,x,b,h[y],s)){let p=s.length;if(p==0)continue;let C=p>>1,v=this.clipOutput,M=O.setArraySize(n,w+C*2);for(let I=0;I<p;I+=2,w+=2){let F=v[I],R=v[I+1];M[w]=F,M[w+1]=R}w=o.length;let S=O.setArraySize(o,w+3*(C-2));C--;for(let I=1;I<C;I++,w+=3)S[w]=r,S[w+1]=r+I,S[w+2]=r+I+1;r+=C+1}else{let p=O.setArraySize(n,w+6);p[w]=f,p[w+1]=m,p[w+2]=u,p[w+3]=g,p[w+4]=x,p[w+5]=b,w=o.length;let C=O.setArraySize(o,w+3);C[w]=r,C[w+1]=r+1,C[w+2]=r+2,r+=3;break}}}}clipTrianglesRender(t,e,i,s,n,o,h){let d=this.clipOutput,r=this.clippedVertices,a=this.clippedTriangles,l=this.clippingPolygons,f=l.length,m=h?12:8,u=0;r.length=0,a.length=0;for(let g=0;g<i;g+=3){let x=e[g]<<1,b=t[x],y=t[x+1],w=s[x],p=s[x+1];x=e[g+1]<<1;let C=t[x],v=t[x+1],M=s[x],S=s[x+1];x=e[g+2]<<1;let I=t[x],F=t[x+1],R=s[x],V=s[x+1];for(let X=0;X<f;X++){let Y=r.length;if(this.clip(b,y,C,v,I,F,l[X],d)){let k=d.length;if(k==0)continue;let L=v-F,D=I-C,nt=b-I,j=F-y,ct=1/(L*nt+D*(y-F)),mt=k>>1,pt=this.clipOutput,tt=O.setArraySize(r,Y+mt*m);for(let ot=0;ot<k;ot+=2,Y+=m){let Gt=pt[ot],Bt=pt[ot+1];tt[Y]=Gt,tt[Y+1]=Bt,tt[Y+2]=n.r,tt[Y+3]=n.g,tt[Y+4]=n.b,tt[Y+5]=n.a;let yt=Gt-I,Tt=Bt-F,Et=(L*yt+D*Tt)*ct,me=(j*yt+nt*Tt)*ct,qs=1-Et-me;tt[Y+6]=w*Et+M*me+R*qs,tt[Y+7]=p*Et+S*me+V*qs,h&&(tt[Y+8]=o.r,tt[Y+9]=o.g,tt[Y+10]=o.b,tt[Y+11]=o.a)}Y=a.length;let lt=O.setArraySize(a,Y+3*(mt-2));mt--;for(let ot=1;ot<mt;ot++,Y+=3)lt[Y]=u,lt[Y+1]=u+ot,lt[Y+2]=u+ot+1;u+=mt+1}else{let k=O.setArraySize(r,Y+3*m);k[Y]=b,k[Y+1]=y,k[Y+2]=n.r,k[Y+3]=n.g,k[Y+4]=n.b,k[Y+5]=n.a,h?(k[Y+6]=w,k[Y+7]=p,k[Y+8]=o.r,k[Y+9]=o.g,k[Y+10]=o.b,k[Y+11]=o.a,k[Y+12]=C,k[Y+13]=v,k[Y+14]=n.r,k[Y+15]=n.g,k[Y+16]=n.b,k[Y+17]=n.a,k[Y+18]=M,k[Y+19]=S,k[Y+20]=o.r,k[Y+21]=o.g,k[Y+22]=o.b,k[Y+23]=o.a,k[Y+24]=I,k[Y+25]=F,k[Y+26]=n.r,k[Y+27]=n.g,k[Y+28]=n.b,k[Y+29]=n.a,k[Y+30]=R,k[Y+31]=V,k[Y+32]=o.r,k[Y+33]=o.g,k[Y+34]=o.b,k[Y+35]=o.a):(k[Y+6]=w,k[Y+7]=p,k[Y+8]=C,k[Y+9]=v,k[Y+10]=n.r,k[Y+11]=n.g,k[Y+12]=n.b,k[Y+13]=n.a,k[Y+14]=M,k[Y+15]=S,k[Y+16]=I,k[Y+17]=F,k[Y+18]=n.r,k[Y+19]=n.g,k[Y+20]=n.b,k[Y+21]=n.a,k[Y+22]=R,k[Y+23]=V),Y=a.length;let L=O.setArraySize(a,Y+3);L[Y]=u,L[Y+1]=u+1,L[Y+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,e,i,s){let n=this.clipOutput,o=this.clippedVertices,h=this.clippedUVs,d=this.clippedTriangles,r=this.clippingPolygons,a=r.length,l=0;o.length=0,h.length=0,d.length=0;for(let f=0;f<i;f+=3){let m=e[f]<<1,u=t[m],g=t[m+1],x=s[m],b=s[m+1];m=e[f+1]<<1;let y=t[m],w=t[m+1],p=s[m],C=s[m+1];m=e[f+2]<<1;let v=t[m],M=t[m+1],S=s[m],I=s[m+1];for(let F=0;F<a;F++){let R=o.length;if(this.clip(u,g,y,w,v,M,r[F],n)){let V=n.length;if(V==0)continue;let X=w-M,Y=v-y,k=u-v,L=M-g,D=1/(X*k+Y*(g-M)),nt=V>>1,j=this.clipOutput,ct=O.setArraySize(o,R+nt*2),mt=O.setArraySize(h,R+nt*2);for(let tt=0;tt<V;tt+=2,R+=2){let lt=j[tt],ot=j[tt+1];ct[R]=lt,ct[R+1]=ot;let Gt=lt-v,Bt=ot-M,yt=(X*Gt+Y*Bt)*D,Tt=(L*Gt+k*Bt)*D,Et=1-yt-Tt;mt[R]=x*yt+p*Tt+S*Et,mt[R+1]=b*yt+C*Tt+I*Et}R=d.length;let pt=O.setArraySize(d,R+3*(nt-2));nt--;for(let tt=1;tt<nt;tt++,R+=3)pt[R]=l,pt[R+1]=l+tt,pt[R+2]=l+tt+1;l+=nt+1}else{let V=O.setArraySize(o,R+6);V[R]=u,V[R+1]=g,V[R+2]=y,V[R+3]=w,V[R+4]=v,V[R+5]=M;let X=O.setArraySize(h,R+6);X[R]=x,X[R+1]=b,X[R+2]=p,X[R+3]=C,X[R+4]=S,X[R+5]=I,R=d.length;let Y=O.setArraySize(d,R+3);Y[R]=l,Y[R+1]=l+1,Y[R+2]=l+2,l+=3;break}}}}clip(t,e,i,s,n,o,h,d){let r=d,a=!1,l;h.length%4>=2?(l=d,d=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(i),l.push(s),l.push(n),l.push(o),l.push(t),l.push(e),d.length=0;let f=h.length-4,m=h;for(let u=0;;u+=2){let g=m[u],x=m[u+1],b=g-m[u+2],y=x-m[u+3],w=d.length,p=l;for(let v=0,M=l.length-2;v<M;){let S=p[v],I=p[v+1];v+=2;let F=p[v],R=p[v+1],V=y*(g-F)>b*(x-R),X=y*(g-S)-b*(x-I);if(X>0){if(V){d.push(F),d.push(R);continue}let Y=F-S,k=R-I,L=X/(Y*y-k*b);if(L>=0&&L<=1)d.push(S+Y*L),d.push(I+k*L);else{d.push(F),d.push(R);continue}}else if(V){let Y=F-S,k=R-I,L=X/(Y*y-k*b);if(L>=0&&L<=1)d.push(S+Y*L),d.push(I+k*L),d.push(F),d.push(R);else{d.push(F),d.push(R);continue}}a=!0}if(w==d.length)return r.length=0,!0;if(d.push(d[0]),d.push(d[1]),u==f)break;let C=d;d=l,d.length=0,l=C}if(r!=d){r.length=0;for(let u=0,g=d.length-2;u<g;u++)r[u]=d[u]}else r.length=r.length-2;return a}static makeClockwise(t){let e=t,i=t.length,s=e[i-2]*e[1]-e[0]*e[i-1],n=0,o=0,h=0,d=0;for(let r=0,a=i-3;r<a;r+=2)n=e[r],o=e[r+1],h=e[r+2],d=e[r+3],s+=n*d-h*o;if(!(s<0))for(let r=0,a=i-2,l=i>>1;r<l;r+=2){let f=e[r],m=e[r+1],u=a-r;e[r]=e[u],e[r+1]=e[u+1],e[u]=f,e[u+1]=m}}};var Ri=class{constructor(t){c(this,"attachmentLoader");c(this,"scale",1);c(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){var o,h;let e=this.scale,i=new ts,s=typeof t=="string"?JSON.parse(t):t,n=s.skeleton;if(n&&(i.hash=n.hash,i.version=n.spine,i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height,i.referenceScale=E(n,"referenceScale",100)*e,i.fps=n.fps,i.imagesPath=(o=n.images)!=null?o:null,i.audioPath=(h=n.audio)!=null?h:null),s.bones)for(let d=0;d<s.bones.length;d++){let r=s.bones[d],a=null,l=E(r,"parent",null);l&&(a=i.findBone(l));let f=new Ke(i.bones.length,r.name,a);f.length=E(r,"length",0)*e,f.x=E(r,"x",0)*e,f.y=E(r,"y",0)*e,f.rotation=E(r,"rotation",0),f.scaleX=E(r,"scaleX",1),f.scaleY=E(r,"scaleY",1),f.shearX=E(r,"shearX",0),f.shearY=E(r,"shearY",0),f.inherit=O.enumValue(xt,E(r,"inherit","Normal")),f.skinRequired=E(r,"skin",!1);let m=E(r,"color",null);m&&f.color.setFromString(m),i.bones.push(f)}if(s.slots)for(let d=0;d<s.slots.length;d++){let r=s.slots[d],a=r.name,l=i.findBone(r.bone);if(!l)throw new Error(`Couldn't find bone ${r.bone} for slot ${a}`);let f=new es(i.slots.length,a,l),m=E(r,"color",null);m&&f.color.setFromString(m);let u=E(r,"dark",null);u&&(f.darkColor=N.fromString(u)),f.attachmentName=E(r,"attachment",null),f.blendMode=O.enumValue(qt,E(r,"blend","normal")),f.visible=E(r,"visible",!0),i.slots.push(f)}if(s.ik)for(let d=0;d<s.ik.length;d++){let r=s.ik[d],a=new _e(r.name);a.order=E(r,"order",0),a.skinRequired=E(r,"skin",!1);for(let f=0;f<r.bones.length;f++){let m=i.findBone(r.bones[f]);if(!m)throw new Error(`Couldn't find bone ${r.bones[f]} for IK constraint ${r.name}.`);a.bones.push(m)}let l=i.findBone(r.target);if(!l)throw new Error(`Couldn't find target bone ${r.target} for IK constraint ${r.name}.`);a.target=l,a.mix=E(r,"mix",1),a.softness=E(r,"softness",0)*e,a.bendDirection=E(r,"bendPositive",!0)?1:-1,a.compress=E(r,"compress",!1),a.stretch=E(r,"stretch",!1),a.uniform=E(r,"uniform",!1),i.ikConstraints.push(a)}if(s.transform)for(let d=0;d<s.transform.length;d++){let r=s.transform[d],a=new ss(r.name);a.order=E(r,"order",0),a.skinRequired=E(r,"skin",!1);for(let m=0;m<r.bones.length;m++){let u=r.bones[m],g=i.findBone(u);if(!g)throw new Error(`Couldn't find bone ${u} for transform constraint ${r.name}.`);a.bones.push(g)}let l=r.target,f=i.findBone(l);if(!f)throw new Error(`Couldn't find target bone ${l} for transform constraint ${r.name}.`);a.target=f,a.local=E(r,"local",!1),a.relative=E(r,"relative",!1),a.offsetRotation=E(r,"rotation",0),a.offsetX=E(r,"x",0)*e,a.offsetY=E(r,"y",0)*e,a.offsetScaleX=E(r,"scaleX",0),a.offsetScaleY=E(r,"scaleY",0),a.offsetShearY=E(r,"shearY",0),a.mixRotate=E(r,"mixRotate",1),a.mixX=E(r,"mixX",1),a.mixY=E(r,"mixY",a.mixX),a.mixScaleX=E(r,"mixScaleX",1),a.mixScaleY=E(r,"mixScaleY",a.mixScaleX),a.mixShearY=E(r,"mixShearY",1),i.transformConstraints.push(a)}if(s.path)for(let d=0;d<s.path.length;d++){let r=s.path[d],a=new $e(r.name);a.order=E(r,"order",0),a.skinRequired=E(r,"skin",!1);for(let m=0;m<r.bones.length;m++){let u=r.bones[m],g=i.findBone(u);if(!g)throw new Error(`Couldn't find bone ${u} for path constraint ${r.name}.`);a.bones.push(g)}let l=r.target,f=i.findSlot(l);if(!f)throw new Error(`Couldn't find target slot ${l} for path constraint ${r.name}.`);a.target=f,a.positionMode=O.enumValue(Lt,E(r,"positionMode","Percent")),a.spacingMode=O.enumValue(bt,E(r,"spacingMode","Length")),a.rotateMode=O.enumValue(te,E(r,"rotateMode","Tangent")),a.offsetRotation=E(r,"rotation",0),a.position=E(r,"position",0),a.positionMode==Lt.Fixed&&(a.position*=e),a.spacing=E(r,"spacing",0),(a.spacingMode==bt.Length||a.spacingMode==bt.Fixed)&&(a.spacing*=e),a.mixRotate=E(r,"mixRotate",1),a.mixX=E(r,"mixX",1),a.mixY=E(r,"mixY",a.mixX),i.pathConstraints.push(a)}if(s.physics)for(let d=0;d<s.physics.length;d++){let r=s.physics[d],a=new Xs(r.name);a.order=E(r,"order",0),a.skinRequired=E(r,"skin",!1);let l=r.bone,f=i.findBone(l);if(f==null)throw new Error("Physics bone not found: "+l);a.bone=f,a.x=E(r,"x",0),a.y=E(r,"y",0),a.rotate=E(r,"rotate",0),a.scaleX=E(r,"scaleX",0),a.shearX=E(r,"shearX",0),a.limit=E(r,"limit",5e3)*e,a.step=1/E(r,"fps",60),a.inertia=E(r,"inertia",1),a.strength=E(r,"strength",100),a.damping=E(r,"damping",1),a.massInverse=1/E(r,"mass",1),a.wind=E(r,"wind",0),a.gravity=E(r,"gravity",0),a.mix=E(r,"mix",1),a.inertiaGlobal=E(r,"inertiaGlobal",!1),a.strengthGlobal=E(r,"strengthGlobal",!1),a.dampingGlobal=E(r,"dampingGlobal",!1),a.massGlobal=E(r,"massGlobal",!1),a.windGlobal=E(r,"windGlobal",!1),a.gravityGlobal=E(r,"gravityGlobal",!1),a.mixGlobal=E(r,"mixGlobal",!1),i.physicsConstraints.push(a)}if(s.skins)for(let d=0;d<s.skins.length;d++){let r=s.skins[d],a=new de(r.name);if(r.bones)for(let l=0;l<r.bones.length;l++){let f=r.bones[l],m=i.findBone(f);if(!m)throw new Error(`Couldn't find bone ${f} for skin ${r.name}.`);a.bones.push(m)}if(r.ik)for(let l=0;l<r.ik.length;l++){let f=r.ik[l],m=i.findIkConstraint(f);if(!m)throw new Error(`Couldn't find IK constraint ${f} for skin ${r.name}.`);a.constraints.push(m)}if(r.transform)for(let l=0;l<r.transform.length;l++){let f=r.transform[l],m=i.findTransformConstraint(f);if(!m)throw new Error(`Couldn't find transform constraint ${f} for skin ${r.name}.`);a.constraints.push(m)}if(r.path)for(let l=0;l<r.path.length;l++){let f=r.path[l],m=i.findPathConstraint(f);if(!m)throw new Error(`Couldn't find path constraint ${f} for skin ${r.name}.`);a.constraints.push(m)}if(r.physics)for(let l=0;l<r.physics.length;l++){let f=r.physics[l],m=i.findPhysicsConstraint(f);if(!m)throw new Error(`Couldn't find physics constraint ${f} for skin ${r.name}.`);a.constraints.push(m)}for(let l in r.attachments){let f=i.findSlot(l);if(!f)throw new Error(`Couldn't find slot ${l} for skin ${r.name}.`);let m=r.attachments[l];for(let u in m){let g=this.readAttachment(m[u],a,f.index,u,i);g&&a.setAttachment(f.index,u,g)}}i.skins.push(a),a.name=="default"&&(i.defaultSkin=a)}for(let d=0,r=this.linkedMeshes.length;d<r;d++){let a=this.linkedMeshes[d],l=a.skin?i.findSkin(a.skin):i.defaultSkin;if(!l)throw new Error(`Skin not found: ${a.skin}`);let f=l.getAttachment(a.slotIndex,a.parent);if(!f)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?f:a.mesh,a.mesh.setParentMesh(f),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let d in s.events){let r=s.events[d],a=new Qe(d);a.intValue=E(r,"int",0),a.floatValue=E(r,"float",0),a.stringValue=E(r,"string",""),a.audioPath=E(r,"audio",null),a.audioPath&&(a.volume=E(r,"volume",1),a.balance=E(r,"balance",0)),i.events.push(a)}if(s.animations)for(let d in s.animations){let r=s.animations[d];this.readAnimation(r,d,i)}return i}readAttachment(t,e,i,s,n){let o=this.scale;switch(s=E(t,"name",s),E(t,"type","region")){case"region":{let h=E(t,"path",s),d=this.readSequence(E(t,"sequence",null)),r=this.attachmentLoader.newRegionAttachment(e,s,h,d);if(!r)return null;r.path=h,r.x=E(t,"x",0)*o,r.y=E(t,"y",0)*o,r.scaleX=E(t,"scaleX",1),r.scaleY=E(t,"scaleY",1),r.rotation=E(t,"rotation",0),r.width=t.width*o,r.height=t.height*o,r.sequence=d;let a=E(t,"color",null);return a&&r.color.setFromString(a),r.region!=null&&r.updateRegion(),r}case"boundingbox":{let h=this.attachmentLoader.newBoundingBoxAttachment(e,s);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);let d=E(t,"color",null);return d&&h.color.setFromString(d),h}case"mesh":case"linkedmesh":{let h=E(t,"path",s),d=this.readSequence(E(t,"sequence",null)),r=this.attachmentLoader.newMeshAttachment(e,s,h,d);if(!r)return null;r.path=h;let a=E(t,"color",null);a&&r.color.setFromString(a),r.width=E(t,"width",0)*o,r.height=E(t,"height",0)*o,r.sequence=d;let l=E(t,"parent",null);if(l)return this.linkedMeshes.push(new ji(r,E(t,"skin",null),i,l,E(t,"timelines",!0))),r;let f=t.uvs;return this.readVertices(t,r,f.length),r.triangles=t.triangles,r.regionUVs=f,r.region!=null&&r.updateRegion(),r.edges=E(t,"edges",null),r.hullLength=E(t,"hull",0)*2,r}case"path":{let h=this.attachmentLoader.newPathAttachment(e,s);if(!h)return null;h.closed=E(t,"closed",!1),h.constantSpeed=E(t,"constantSpeed",!0);let d=t.vertexCount;this.readVertices(t,h,d<<1);let r=O.newArray(d/3,0);for(let l=0;l<t.lengths.length;l++)r[l]=t.lengths[l]*o;h.lengths=r;let a=E(t,"color",null);return a&&h.color.setFromString(a),h}case"point":{let h=this.attachmentLoader.newPointAttachment(e,s);if(!h)return null;h.x=E(t,"x",0)*o,h.y=E(t,"y",0)*o,h.rotation=E(t,"rotation",0);let d=E(t,"color",null);return d&&h.color.setFromString(d),h}case"clipping":{let h=this.attachmentLoader.newClippingAttachment(e,s);if(!h)return null;let d=E(t,"end",null);d&&(h.endSlot=n.findSlot(d));let r=t.vertexCount;this.readVertices(t,h,r<<1);let a=E(t,"color",null);return a&&h.color.setFromString(a),h}}return null}readSequence(t){if(t==null)return null;let e=new vs(E(t,"count",0));return e.start=E(t,"start",1),e.digits=E(t,"digits",0),e.setupIndex=E(t,"setup",0),e}readVertices(t,e,i){let s=this.scale;e.worldVerticesLength=i;let n=t.vertices;if(i==n.length){let d=O.toFloatArray(n);if(s!=1)for(let r=0,a=n.length;r<a;r++)d[r]*=s;e.vertices=d;return}let o=new Array,h=new Array;for(let d=0,r=n.length;d<r;){let a=n[d++];h.push(a);for(let l=d+a*4;d<l;d+=4)h.push(n[d]),o.push(n[d+1]*s),o.push(n[d+2]*s),o.push(n[d+3])}e.bones=h,e.vertices=O.toFloatArray(o)}readAnimation(t,e,i){let s=this.scale,n=new Array;if(t.slots)for(let h in t.slots){let d=t.slots[h],r=i.findSlot(h);if(!r)throw new Error("Slot not found: "+h);let a=r.index;for(let l in d){let f=d[l];if(!f)continue;let m=f.length;if(l=="attachment"){let u=new Ut(m,a);for(let g=0;g<m;g++){let x=f[g];u.setFrame(g,E(x,"time",0),E(x,"name",null))}n.push(u)}else if(l=="rgba"){let u=new Ee(m,m<<2,a),g=f[0],x=E(g,"time",0),b=N.fromString(g.color);for(let y=0,w=0;;y++){u.setFrame(y,x,b.r,b.g,b.b,b.a);let p=f[y+1];if(!p){u.shrink(w);break}let C=E(p,"time",0),v=N.fromString(p.color),M=g.curve;M&&(w=ft(M,u,w,y,0,x,C,b.r,v.r,1),w=ft(M,u,w,y,1,x,C,b.g,v.g,1),w=ft(M,u,w,y,2,x,C,b.b,v.b,1),w=ft(M,u,w,y,3,x,C,b.a,v.a,1)),x=C,b=v,g=p}n.push(u)}else if(l=="rgb"){let u=new Ye(m,m*3,a),g=f[0],x=E(g,"time",0),b=N.fromString(g.color);for(let y=0,w=0;;y++){u.setFrame(y,x,b.r,b.g,b.b);let p=f[y+1];if(!p){u.shrink(w);break}let C=E(p,"time",0),v=N.fromString(p.color),M=g.curve;M&&(w=ft(M,u,w,y,0,x,C,b.r,v.r,1),w=ft(M,u,w,y,1,x,C,b.g,v.g,1),w=ft(M,u,w,y,2,x,C,b.b,v.b,1)),x=C,b=v,g=p}n.push(u)}else if(l=="alpha")n.push(ee(f,new Re(m,m,a),0,1));else if(l=="rgba2"){let u=new Fe(m,m*7,a),g=f[0],x=E(g,"time",0),b=N.fromString(g.light),y=N.fromString(g.dark);for(let w=0,p=0;;w++){u.setFrame(w,x,b.r,b.g,b.b,b.a,y.r,y.g,y.b);let C=f[w+1];if(!C){u.shrink(p);break}let v=E(C,"time",0),M=N.fromString(C.light),S=N.fromString(C.dark),I=g.curve;I&&(p=ft(I,u,p,w,0,x,v,b.r,M.r,1),p=ft(I,u,p,w,1,x,v,b.g,M.g,1),p=ft(I,u,p,w,2,x,v,b.b,M.b,1),p=ft(I,u,p,w,3,x,v,b.a,M.a,1),p=ft(I,u,p,w,4,x,v,y.r,S.r,1),p=ft(I,u,p,w,5,x,v,y.g,S.g,1),p=ft(I,u,p,w,6,x,v,y.b,S.b,1)),x=v,b=M,y=S,g=C}n.push(u)}else if(l=="rgb2"){let u=new ke(m,m*6,a),g=f[0],x=E(g,"time",0),b=N.fromString(g.light),y=N.fromString(g.dark);for(let w=0,p=0;;w++){u.setFrame(w,x,b.r,b.g,b.b,y.r,y.g,y.b);let C=f[w+1];if(!C){u.shrink(p);break}let v=E(C,"time",0),M=N.fromString(C.light),S=N.fromString(C.dark),I=g.curve;I&&(p=ft(I,u,p,w,0,x,v,b.r,M.r,1),p=ft(I,u,p,w,1,x,v,b.g,M.g,1),p=ft(I,u,p,w,2,x,v,b.b,M.b,1),p=ft(I,u,p,w,3,x,v,y.r,S.r,1),p=ft(I,u,p,w,4,x,v,y.g,S.g,1),p=ft(I,u,p,w,5,x,v,y.b,S.b,1)),x=v,b=M,y=S,g=C}n.push(u)}}}if(t.bones)for(let h in t.bones){let d=t.bones[h],r=i.findBone(h);if(!r)throw new Error("Bone not found: "+h);let a=r.index;for(let l in d){let f=d[l],m=f.length;if(m!=0){if(l==="rotate")n.push(ee(f,new _t(m,m,a),0,1));else if(l==="translate"){let u=new we(m,m<<1,a);n.push(Hi(f,u,"x","y",0,s))}else if(l==="translatex"){let u=new be(m,m,a);n.push(ee(f,u,0,s))}else if(l==="translatey"){let u=new ye(m,m,a);n.push(ee(f,u,0,s))}else if(l==="scale"){let u=new ve(m,m<<1,a);n.push(Hi(f,u,"x","y",1,1))}else if(l==="scalex"){let u=new Ae(m,m,a);n.push(ee(f,u,1,1))}else if(l==="scaley"){let u=new Ce(m,m,a);n.push(ee(f,u,1,1))}else if(l==="shear"){let u=new Me(m,m<<1,a);n.push(Hi(f,u,"x","y",0,1))}else if(l==="shearx"){let u=new Se(m,m,a);n.push(ee(f,u,0,1))}else if(l==="sheary"){let u=new Ie(m,m,a);n.push(ee(f,u,0,1))}else if(l==="inherit"){let u=new Te(m,r.index);for(let g=0;g<f.length;g++){let x=f[g];u.setFrame(g,E(x,"time",0),O.enumValue(xt,E(x,"inherit","Normal")))}n.push(u)}}}}if(t.ik)for(let h in t.ik){let d=t.ik[h],r=d[0];if(!r)continue;let a=i.findIkConstraint(h);if(!a)throw new Error("IK Constraint not found: "+h);let l=i.ikConstraints.indexOf(a),f=new Le(d.length,d.length<<1,l),m=E(r,"time",0),u=E(r,"mix",1),g=E(r,"softness",0)*s;for(let x=0,b=0;;x++){f.setFrame(x,m,u,g,E(r,"bendPositive",!0)?1:-1,E(r,"compress",!1),E(r,"stretch",!1));let y=d[x+1];if(!y){f.shrink(b);break}let w=E(y,"time",0),p=E(y,"mix",1),C=E(y,"softness",0)*s,v=r.curve;v&&(b=ft(v,f,b,x,0,m,w,u,p,1),b=ft(v,f,b,x,1,m,w,g,C,s)),m=w,u=p,g=C,r=y}n.push(f)}if(t.transform)for(let h in t.transform){let d=t.transform[h],r=d[0];if(!r)continue;let a=i.findTransformConstraint(h);if(!a)throw new Error("Transform constraint not found: "+h);let l=i.transformConstraints.indexOf(a),f=new Pe(d.length,d.length*6,l),m=E(r,"time",0),u=E(r,"mixRotate",1),g=E(r,"mixX",1),x=E(r,"mixY",g),b=E(r,"mixScaleX",1),y=E(r,"mixScaleY",b),w=E(r,"mixShearY",1);for(let p=0,C=0;;p++){f.setFrame(p,m,u,g,x,b,y,w);let v=d[p+1];if(!v){f.shrink(C);break}let M=E(v,"time",0),S=E(v,"mixRotate",1),I=E(v,"mixX",1),F=E(v,"mixY",I),R=E(v,"mixScaleX",1),V=E(v,"mixScaleY",R),X=E(v,"mixShearY",1),Y=r.curve;Y&&(C=ft(Y,f,C,p,0,m,M,u,S,1),C=ft(Y,f,C,p,1,m,M,g,I,1),C=ft(Y,f,C,p,2,m,M,x,F,1),C=ft(Y,f,C,p,3,m,M,b,R,1),C=ft(Y,f,C,p,4,m,M,y,V,1),C=ft(Y,f,C,p,5,m,M,w,X,1)),m=M,u=S,g=I,x=F,b=R,y=V,w=X,r=v}n.push(f)}if(t.path)for(let h in t.path){let d=t.path[h],r=i.findPathConstraint(h);if(!r)throw new Error("Path constraint not found: "+h);let a=i.pathConstraints.indexOf(r);for(let l in d){let f=d[l],m=f[0];if(!m)continue;let u=f.length;if(l==="position"){let g=new Be(u,u,a);n.push(ee(f,g,0,r.positionMode==Lt.Fixed?s:1))}else if(l==="spacing"){let g=new Ve(u,u,a);n.push(ee(f,g,0,r.spacingMode==bt.Length||r.spacingMode==bt.Fixed?s:1))}else if(l==="mix"){let g=new Oe(u,u*3,a),x=E(m,"time",0),b=E(m,"mixRotate",1),y=E(m,"mixX",1),w=E(m,"mixY",y);for(let p=0,C=0;;p++){g.setFrame(p,x,b,y,w);let v=f[p+1];if(!v){g.shrink(C);break}let M=E(v,"time",0),S=E(v,"mixRotate",1),I=E(v,"mixX",1),F=E(v,"mixY",I),R=m.curve;R&&(C=ft(R,g,C,p,0,x,M,b,S,1),C=ft(R,g,C,p,1,x,M,y,I,1),C=ft(R,g,C,p,2,x,M,w,F,1)),x=M,b=S,y=I,w=F,m=v}n.push(g)}}}if(t.physics)for(let h in t.physics){let d=t.physics[h],r=-1;if(h.length>0){let a=i.findPhysicsConstraint(h);if(!a)throw new Error("Physics constraint not found: "+h);r=i.physicsConstraints.indexOf(a)}for(let a in d){let l=d[a],f=l[0];if(!f)continue;let m=l.length;if(a=="reset"){let g=new He(m,r);for(let x=0;f!=null;f=l[x+1],x++)g.setFrame(x,E(f,"time",0));n.push(g);continue}let u;if(a=="inertia")u=new Ne(m,m,r);else if(a=="strength")u=new De(m,m,r);else if(a=="damping")u=new Ue(m,m,r);else if(a=="mass")u=new ze(m,m,r);else if(a=="wind")u=new We(m,m,r);else if(a=="gravity")u=new qe(m,m,r);else if(a=="mix")u=new Ge(m,m,r);else continue;n.push(ee(l,u,0,1))}}if(t.attachments)for(let h in t.attachments){let d=t.attachments[h],r=i.findSkin(h);if(!r)throw new Error("Skin not found: "+h);for(let a in d){let l=d[a],f=i.findSlot(a);if(!f)throw new Error("Slot not found: "+a);let m=f.index;for(let u in l){let g=l[u],x=r.getAttachment(m,u);for(let b in g){let y=g[b],w=y[0];if(w){if(b=="deform"){let p=x.bones,C=x.vertices,v=p?C.length/3*2:C.length,M=new Xe(y.length,y.length,m,x),S=E(w,"time",0);for(let I=0,F=0;;I++){let R,V=E(w,"vertices",null);if(!V)R=p?O.newFloatArray(v):C;else{R=O.newFloatArray(v);let L=E(w,"offset",0);if(O.arrayCopy(V,0,R,L,V.length),s!=1)for(let D=L,nt=D+V.length;D<nt;D++)R[D]*=s;if(!p)for(let D=0;D<v;D++)R[D]+=C[D]}M.setFrame(I,S,R);let X=y[I+1];if(!X){M.shrink(F);break}let Y=E(X,"time",0),k=w.curve;k&&(F=ft(k,M,F,I,0,S,Y,0,1,1)),S=Y,w=X}n.push(M)}else if(b=="sequence"){let p=new je(y.length,m,x),C=0;for(let v=0;v<y.length;v++){let M=E(w,"delay",C),S=E(w,"time",0),I=Ct[E(w,"mode","hold")],F=E(w,"index",0);p.setFrame(v,S,I,F,M),C=M,w=y[v+1]}n.push(p)}}}}}}if(t.drawOrder){let h=new jt(t.drawOrder.length),d=i.slots.length,r=0;for(let a=0;a<t.drawOrder.length;a++,r++){let l=t.drawOrder[a],f=null,m=E(l,"offsets",null);if(m){f=O.newArray(d,-1);let u=O.newArray(d-m.length,0),g=0,x=0;for(let b=0;b<m.length;b++){let y=m[b],w=i.findSlot(y.slot);if(!w)throw new Error("Slot not found: "+w);let p=w.index;for(;g!=p;)u[x++]=g++;f[g+y.offset]=g++}for(;g<d;)u[x++]=g++;for(let b=d-1;b>=0;b--)f[b]==-1&&(f[b]=u[--x])}h.setFrame(r,E(l,"time",0),f)}n.push(h)}if(t.events){let h=new ne(t.events.length),d=0;for(let r=0;r<t.events.length;r++,d++){let a=t.events[r],l=i.findEvent(a.name);if(!l)throw new Error("Event not found: "+a.name);let f=new Je(O.toSinglePrecision(E(a,"time",0)),l);f.intValue=E(a,"int",l.intValue),f.floatValue=E(a,"float",l.floatValue),f.stringValue=E(a,"string",l.stringValue),f.data.audioPath&&(f.volume=E(a,"volume",1),f.balance=E(a,"balance",0)),h.setFrame(d,f)}n.push(h)}let o=0;for(let h=0,d=n.length;h<d;h++)o=Math.max(o,n[h].getDuration());i.animations.push(new re(e,n,o))}},ji=class{constructor(t,e,i,s,n){c(this,"parent");c(this,"skin");c(this,"slotIndex");c(this,"mesh");c(this,"inheritTimeline");this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}};function ee(A,t,e,i){let s=A[0],n=E(s,"time",0),o=E(s,"value",e)*i,h=0;for(let d=0;;d++){t.setFrame(d,n,o);let r=A[d+1];if(!r)return t.shrink(h),t;let a=E(r,"time",0),l=E(r,"value",e)*i;s.curve&&(h=ft(s.curve,t,h,d,0,n,a,o,l,i)),n=a,o=l,s=r}}function Hi(A,t,e,i,s,n){let o=A[0],h=E(o,"time",0),d=E(o,e,s)*n,r=E(o,i,s)*n,a=0;for(let l=0;;l++){t.setFrame(l,h,d,r);let f=A[l+1];if(!f)return t.shrink(a),t;let m=E(f,"time",0),u=E(f,e,s)*n,g=E(f,i,s)*n,x=o.curve;x&&(a=ft(x,t,a,l,0,h,m,d,u,n),a=ft(x,t,a,l,1,h,m,r,g,n)),h=m,d=u,r=g,o=f}}function ft(A,t,e,i,s,n,o,h,d,r){if(A=="stepped")return t.setStepped(i),e;let a=s<<2,l=A[a],f=A[a+1]*r,m=A[a+2],u=A[a+3]*r;return t.setBezier(e,i,s,n,h,l,f,m,u,o,d),e+1}function E(A,t,e){return A[t]!==void 0?A[t]:e}typeof Math.fround=="undefined"&&(Math.fround=(function(A){return function(t){return A[0]=t,A[0]}})(new Float32Array(1)));var sr={};Ni(sr,{AlphaTimeline:()=>Re,Animation:()=>re,AnimationState:()=>yi,AnimationStateAdapter:()=>vi,AnimationStateData:()=>Si,AssetCache:()=>$s,AssetManager:()=>ei,AssetManagerBase:()=>Is,AtlasAttachmentLoader:()=>Ti,Attachment:()=>os,AttachmentTimeline:()=>Ut,BinaryInput:()=>ti,BlendMode:()=>qt,Bone:()=>us,BoneData:()=>Ke,BoundingBoxAttachment:()=>Ze,CURRENT:()=>Ui,CameraController:()=>Ki,ClippingAttachment:()=>Zt,Color:()=>N,Color2Attribute:()=>ii,ColorAttribute:()=>as,ConstraintData:()=>Jt,CurveTimeline:()=>Ot,CurveTimeline1:()=>Xt,CurveTimeline2:()=>hs,DebugUtils:()=>ui,DeformTimeline:()=>Xe,Downloader:()=>ms,DrawOrderTimeline:()=>jt,Event:()=>Je,EventData:()=>Qe,EventQueue:()=>Qs,EventTimeline:()=>ne,EventType:()=>Yt,FIRST:()=>Ai,FakeTexture:()=>Ii,GLTexture:()=>he,HOLD_FIRST:()=>Ks,HOLD_MIX:()=>Di,HOLD_SUBSEQUENT:()=>Ci,IkConstraint:()=>Ts,IkConstraintData:()=>_e,IkConstraintTimeline:()=>Le,Inherit:()=>xt,InheritTimeline:()=>Te,Input:()=>gs,IntSet:()=>di,Interpolation:()=>Hs,LoadingScreen:()=>tr,M00:()=>U,M01:()=>Z,M02:()=>K,M03:()=>z,M10:()=>J,M11:()=>W,M12:()=>Q,M13:()=>q,M20:()=>_,M21:()=>$,M22:()=>G,M23:()=>H,M30:()=>st,M31:()=>it,M32:()=>rt,M33:()=>et,ManagedWebGLRenderingContext:()=>wt,MathUtils:()=>B,Matrix4:()=>is,Mesh:()=>ps,MeshAttachment:()=>Nt,MixBlend:()=>P,MixDirection:()=>Mt,OrthoCamera:()=>si,PathAttachment:()=>zt,PathConstraint:()=>Es,PathConstraintData:()=>$e,PathConstraintMixTimeline:()=>Oe,PathConstraintPositionTimeline:()=>Be,PathConstraintSpacingTimeline:()=>Ve,Physics:()=>ae,PhysicsConstraintDampingTimeline:()=>Ue,PhysicsConstraintGravityTimeline:()=>qe,PhysicsConstraintInertiaTimeline:()=>Ne,PhysicsConstraintMassTimeline:()=>ze,PhysicsConstraintMixTimeline:()=>Ge,PhysicsConstraintResetTimeline:()=>He,PhysicsConstraintStrengthTimeline:()=>De,PhysicsConstraintTimeline:()=>$t,PhysicsConstraintWindTimeline:()=>We,PointAttachment:()=>Ms,PolygonBatcher:()=>Ds,Pool:()=>Qt,Position2Attribute:()=>ns,Position3Attribute:()=>Ji,PositionMode:()=>Lt,Pow:()=>js,PowOut:()=>fi,RGB2Timeline:()=>ke,RGBA2Timeline:()=>Fe,RGBATimeline:()=>Ee,RGBTimeline:()=>Ye,RegionAttachment:()=>Kt,ResizeMode:()=>xs,RotateMode:()=>te,RotateTimeline:()=>_t,SETUP:()=>Mi,SUBSEQUENT:()=>Zs,ScaleTimeline:()=>ve,ScaleXTimeline:()=>Ae,ScaleYTimeline:()=>Ce,SceneRenderer:()=>ai,SequenceTimeline:()=>je,Shader:()=>Pt,ShapeRenderer:()=>Us,ShapeType:()=>kt,ShearTimeline:()=>Me,ShearXTimeline:()=>Se,ShearYTimeline:()=>Ie,Skeleton:()=>Ys,SkeletonBinary:()=>Yi,SkeletonBounds:()=>Ps,SkeletonClipping:()=>Vs,SkeletonData:()=>ts,SkeletonDebugRenderer:()=>ri,SkeletonJson:()=>Ri,SkeletonRenderer:()=>ni,Skin:()=>de,SkinEntry:()=>Ls,Slot:()=>Rs,SlotData:()=>es,SpacingMode:()=>bt,SpineCanvas:()=>er,StringSet:()=>pe,TexCoordAttribute:()=>Ns,Texture:()=>cs,TextureAtlas:()=>ds,TextureAtlasPage:()=>_s,TextureAtlasRegion:()=>fs,TextureFilter:()=>St,TextureRegion:()=>Cs,TextureWrap:()=>ce,TimeKeeper:()=>xe,Timeline:()=>gt,Touch:()=>Fi,TrackEntry:()=>Js,TransformConstraint:()=>Fs,TransformConstraintData:()=>ss,TransformConstraintTimeline:()=>Pe,TranslateTimeline:()=>we,TranslateXTimeline:()=>be,TranslateYTimeline:()=>ye,Triangulator:()=>Bs,Utils:()=>O,Vector2:()=>Vt,Vector3:()=>It,VertexAttachment:()=>vt,VertexAttribute:()=>rs,VertexAttributeType:()=>ls,WindowedMean:()=>mi});var wt=class{constructor(t,e={alpha:!0}){c(this,"canvas");c(this,"gl");c(this,"restorables",[]);c(this,"contextLostHandler",t=>{t&&t.preventDefault()});c(this,"contextRestoredHandler",()=>{for(let t=0,e=this.restorables.length;t<e;t++)this.restorables[t].restore()});if(t instanceof WebGLRenderingContext||typeof WebGL2RenderingContext!="undefined"&&t instanceof WebGL2RenderingContext)this.gl=t,this.canvas=this.gl.canvas;else{let i=t;this.gl=i.getContext("webgl2",e)||i.getContext("webgl",e),this.canvas=i,i.addEventListener("webglcontextlost",this.contextLostHandler),i.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(t){this.restorables.push(t)}removeRestorable(t){let e=this.restorables.indexOf(t);e>-1&&this.restorables.splice(e,1)}};var Os=class Os extends cs{constructor(e,i,s=!1){super(i);c(this,"context");c(this,"texture",null);c(this,"boundUnit",0);c(this,"useMipMaps",!1);this.context=e instanceof wt?e:new wt(e),this.useMipMaps=s,this.restore(),this.context.addRestorable(this)}setFilters(e,i){let s=this.context.gl;this.bind(),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,Os.validateMagFilter(i)),this.useMipMaps=Os.usesMipMaps(e),this.useMipMaps&&s.generateMipmap(s.TEXTURE_2D)}static validateMagFilter(e){switch(e){case St.MipMapLinearLinear:case St.MipMapLinearNearest:case St.MipMapNearestLinear:case St.MipMapNearestNearest:return St.Linear;default:return e}}static usesMipMaps(e){switch(e){case St.MipMapLinearLinear:case St.MipMapLinearNearest:case St.MipMapNearestLinear:case St.MipMapNearestNearest:return!0;default:return!1}}setWraps(e,i){let s=this.context.gl;this.bind(),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,i)}update(e){let i=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Os.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,this._image),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,e?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),e&&i.generateMipmap(i.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(e=0){let i=this.context.gl;this.boundUnit=e,i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,this.texture)}unbind(){let e=this.context.gl;e.activeTexture(e.TEXTURE0+this.boundUnit),e.bindTexture(e.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}};c(Os,"DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL",!1);var he=Os;var ei=class extends Is{constructor(t,e="",i=new ms){super(s=>new he(t,s),e,i)}};var It=class{constructor(t=0,e=0,i=0){c(this,"x",0);c(this,"y",0);c(this,"z",0);this.x=t,this.y=e,this.z=i}setFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}set(t,e,i){return this.x=t,this.y=e,this.z=i,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}scale(t){return this.x*=t,this.y*=t,this.z*=t,this}normalize(){let t=this.length();return t==0?this:(t=1/t,this.x*=t,this.y*=t,this.z*=t,this)}cross(t){return this.set(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}multiply(t){let e=t.values;return this.set(this.x*e[U]+this.y*e[Z]+this.z*e[K]+e[z],this.x*e[J]+this.y*e[W]+this.z*e[Q]+e[q],this.x*e[_]+this.y*e[$]+this.z*e[G]+e[H])}project(t){let e=t.values,i=1/(this.x*e[st]+this.y*e[it]+this.z*e[rt]+e[et]);return this.set((this.x*e[U]+this.y*e[Z]+this.z*e[K]+e[z])*i,(this.x*e[J]+this.y*e[W]+this.z*e[Q]+e[q])*i,(this.x*e[_]+this.y*e[$]+this.z*e[G]+e[H])*i)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(t){let e=t.x-this.x,i=t.y-this.y,s=t.z-this.z;return Math.sqrt(e*e+i*i+s*s)}};var U=0,Z=4,K=8,z=12,J=1,W=5,Q=9,q=13,_=2,$=6,G=10,H=14,st=3,it=7,rt=11,et=15,Ft=class Ft{constructor(){c(this,"temp",new Float32Array(16));c(this,"values",new Float32Array(16));let t=this.values;t[U]=1,t[W]=1,t[G]=1,t[et]=1}set(t){return this.values.set(t),this}transpose(){let t=this.temp,e=this.values;return t[U]=e[U],t[Z]=e[J],t[K]=e[_],t[z]=e[st],t[J]=e[Z],t[W]=e[W],t[Q]=e[$],t[q]=e[it],t[_]=e[K],t[$]=e[Q],t[G]=e[G],t[H]=e[rt],t[st]=e[z],t[it]=e[q],t[rt]=e[H],t[et]=e[et],this.set(t)}identity(){let t=this.values;return t[U]=1,t[Z]=0,t[K]=0,t[z]=0,t[J]=0,t[W]=1,t[Q]=0,t[q]=0,t[_]=0,t[$]=0,t[G]=1,t[H]=0,t[st]=0,t[it]=0,t[rt]=0,t[et]=1,this}invert(){let t=this.values,e=this.temp,i=t[st]*t[$]*t[Q]*t[z]-t[_]*t[it]*t[Q]*t[z]-t[st]*t[W]*t[G]*t[z]+t[J]*t[it]*t[G]*t[z]+t[_]*t[W]*t[rt]*t[z]-t[J]*t[$]*t[rt]*t[z]-t[st]*t[$]*t[K]*t[q]+t[_]*t[it]*t[K]*t[q]+t[st]*t[Z]*t[G]*t[q]-t[U]*t[it]*t[G]*t[q]-t[_]*t[Z]*t[rt]*t[q]+t[U]*t[$]*t[rt]*t[q]+t[st]*t[W]*t[K]*t[H]-t[J]*t[it]*t[K]*t[H]-t[st]*t[Z]*t[Q]*t[H]+t[U]*t[it]*t[Q]*t[H]+t[J]*t[Z]*t[rt]*t[H]-t[U]*t[W]*t[rt]*t[H]-t[_]*t[W]*t[K]*t[et]+t[J]*t[$]*t[K]*t[et]+t[_]*t[Z]*t[Q]*t[et]-t[U]*t[$]*t[Q]*t[et]-t[J]*t[Z]*t[G]*t[et]+t[U]*t[W]*t[G]*t[et];if(i==0)throw new Error("non-invertible matrix");let s=1/i;return e[U]=t[Q]*t[H]*t[it]-t[q]*t[G]*t[it]+t[q]*t[$]*t[rt]-t[W]*t[H]*t[rt]-t[Q]*t[$]*t[et]+t[W]*t[G]*t[et],e[Z]=t[z]*t[G]*t[it]-t[K]*t[H]*t[it]-t[z]*t[$]*t[rt]+t[Z]*t[H]*t[rt]+t[K]*t[$]*t[et]-t[Z]*t[G]*t[et],e[K]=t[K]*t[q]*t[it]-t[z]*t[Q]*t[it]+t[z]*t[W]*t[rt]-t[Z]*t[q]*t[rt]-t[K]*t[W]*t[et]+t[Z]*t[Q]*t[et],e[z]=t[z]*t[Q]*t[$]-t[K]*t[q]*t[$]-t[z]*t[W]*t[G]+t[Z]*t[q]*t[G]+t[K]*t[W]*t[H]-t[Z]*t[Q]*t[H],e[J]=t[q]*t[G]*t[st]-t[Q]*t[H]*t[st]-t[q]*t[_]*t[rt]+t[J]*t[H]*t[rt]+t[Q]*t[_]*t[et]-t[J]*t[G]*t[et],e[W]=t[K]*t[H]*t[st]-t[z]*t[G]*t[st]+t[z]*t[_]*t[rt]-t[U]*t[H]*t[rt]-t[K]*t[_]*t[et]+t[U]*t[G]*t[et],e[Q]=t[z]*t[Q]*t[st]-t[K]*t[q]*t[st]-t[z]*t[J]*t[rt]+t[U]*t[q]*t[rt]+t[K]*t[J]*t[et]-t[U]*t[Q]*t[et],e[q]=t[K]*t[q]*t[_]-t[z]*t[Q]*t[_]+t[z]*t[J]*t[G]-t[U]*t[q]*t[G]-t[K]*t[J]*t[H]+t[U]*t[Q]*t[H],e[_]=t[W]*t[H]*t[st]-t[q]*t[$]*t[st]+t[q]*t[_]*t[it]-t[J]*t[H]*t[it]-t[W]*t[_]*t[et]+t[J]*t[$]*t[et],e[$]=t[z]*t[$]*t[st]-t[Z]*t[H]*t[st]-t[z]*t[_]*t[it]+t[U]*t[H]*t[it]+t[Z]*t[_]*t[et]-t[U]*t[$]*t[et],e[G]=t[Z]*t[q]*t[st]-t[z]*t[W]*t[st]+t[z]*t[J]*t[it]-t[U]*t[q]*t[it]-t[Z]*t[J]*t[et]+t[U]*t[W]*t[et],e[H]=t[z]*t[W]*t[_]-t[Z]*t[q]*t[_]-t[z]*t[J]*t[$]+t[U]*t[q]*t[$]+t[Z]*t[J]*t[H]-t[U]*t[W]*t[H],e[st]=t[Q]*t[$]*t[st]-t[W]*t[G]*t[st]-t[Q]*t[_]*t[it]+t[J]*t[G]*t[it]+t[W]*t[_]*t[rt]-t[J]*t[$]*t[rt],e[it]=t[Z]*t[G]*t[st]-t[K]*t[$]*t[st]+t[K]*t[_]*t[it]-t[U]*t[G]*t[it]-t[Z]*t[_]*t[rt]+t[U]*t[$]*t[rt],e[rt]=t[K]*t[W]*t[st]-t[Z]*t[Q]*t[st]-t[K]*t[J]*t[it]+t[U]*t[Q]*t[it]+t[Z]*t[J]*t[rt]-t[U]*t[W]*t[rt],e[et]=t[Z]*t[Q]*t[_]-t[K]*t[W]*t[_]+t[K]*t[J]*t[$]-t[U]*t[Q]*t[$]-t[Z]*t[J]*t[G]+t[U]*t[W]*t[G],t[U]=e[U]*s,t[Z]=e[Z]*s,t[K]=e[K]*s,t[z]=e[z]*s,t[J]=e[J]*s,t[W]=e[W]*s,t[Q]=e[Q]*s,t[q]=e[q]*s,t[_]=e[_]*s,t[$]=e[$]*s,t[G]=e[G]*s,t[H]=e[H]*s,t[st]=e[st]*s,t[it]=e[it]*s,t[rt]=e[rt]*s,t[et]=e[et]*s,this}determinant(){let t=this.values;return t[st]*t[$]*t[Q]*t[z]-t[_]*t[it]*t[Q]*t[z]-t[st]*t[W]*t[G]*t[z]+t[J]*t[it]*t[G]*t[z]+t[_]*t[W]*t[rt]*t[z]-t[J]*t[$]*t[rt]*t[z]-t[st]*t[$]*t[K]*t[q]+t[_]*t[it]*t[K]*t[q]+t[st]*t[Z]*t[G]*t[q]-t[U]*t[it]*t[G]*t[q]-t[_]*t[Z]*t[rt]*t[q]+t[U]*t[$]*t[rt]*t[q]+t[st]*t[W]*t[K]*t[H]-t[J]*t[it]*t[K]*t[H]-t[st]*t[Z]*t[Q]*t[H]+t[U]*t[it]*t[Q]*t[H]+t[J]*t[Z]*t[rt]*t[H]-t[U]*t[W]*t[rt]*t[H]-t[_]*t[W]*t[K]*t[et]+t[J]*t[$]*t[K]*t[et]+t[_]*t[Z]*t[Q]*t[et]-t[U]*t[$]*t[Q]*t[et]-t[J]*t[Z]*t[G]*t[et]+t[U]*t[W]*t[G]*t[et]}translate(t,e,i){let s=this.values;return s[z]+=t,s[q]+=e,s[H]+=i,this}copy(){return new Ft().set(this.values)}projection(t,e,i,s){this.identity();let n=1/Math.tan(i*(Math.PI/180)/2),o=(e+t)/(t-e),h=2*e*t/(t-e),d=this.values;return d[U]=n/s,d[J]=0,d[_]=0,d[st]=0,d[Z]=0,d[W]=n,d[$]=0,d[it]=0,d[K]=0,d[Q]=0,d[G]=o,d[rt]=-1,d[z]=0,d[q]=0,d[H]=h,d[et]=0,this}ortho2d(t,e,i,s){return this.ortho(t,t+i,e,e+s,0,1)}ortho(t,e,i,s,n,o){this.identity();let h=2/(e-t),d=2/(s-i),r=-2/(o-n),a=-(e+t)/(e-t),l=-(s+i)/(s-i),f=-(o+n)/(o-n),m=this.values;return m[U]=h,m[J]=0,m[_]=0,m[st]=0,m[Z]=0,m[W]=d,m[$]=0,m[it]=0,m[K]=0,m[Q]=0,m[G]=r,m[rt]=0,m[z]=a,m[q]=l,m[H]=f,m[et]=1,this}multiply(t){let e=this.temp,i=this.values,s=t.values;return e[U]=i[U]*s[U]+i[Z]*s[J]+i[K]*s[_]+i[z]*s[st],e[Z]=i[U]*s[Z]+i[Z]*s[W]+i[K]*s[$]+i[z]*s[it],e[K]=i[U]*s[K]+i[Z]*s[Q]+i[K]*s[G]+i[z]*s[rt],e[z]=i[U]*s[z]+i[Z]*s[q]+i[K]*s[H]+i[z]*s[et],e[J]=i[J]*s[U]+i[W]*s[J]+i[Q]*s[_]+i[q]*s[st],e[W]=i[J]*s[Z]+i[W]*s[W]+i[Q]*s[$]+i[q]*s[it],e[Q]=i[J]*s[K]+i[W]*s[Q]+i[Q]*s[G]+i[q]*s[rt],e[q]=i[J]*s[z]+i[W]*s[q]+i[Q]*s[H]+i[q]*s[et],e[_]=i[_]*s[U]+i[$]*s[J]+i[G]*s[_]+i[H]*s[st],e[$]=i[_]*s[Z]+i[$]*s[W]+i[G]*s[$]+i[H]*s[it],e[G]=i[_]*s[K]+i[$]*s[Q]+i[G]*s[G]+i[H]*s[rt],e[H]=i[_]*s[z]+i[$]*s[q]+i[G]*s[H]+i[H]*s[et],e[st]=i[st]*s[U]+i[it]*s[J]+i[rt]*s[_]+i[et]*s[st],e[it]=i[st]*s[Z]+i[it]*s[W]+i[rt]*s[$]+i[et]*s[it],e[rt]=i[st]*s[K]+i[it]*s[Q]+i[rt]*s[G]+i[et]*s[rt],e[et]=i[st]*s[z]+i[it]*s[q]+i[rt]*s[H]+i[et]*s[et],this.set(this.temp)}multiplyLeft(t){let e=this.temp,i=this.values,s=t.values;return e[U]=s[U]*i[U]+s[Z]*i[J]+s[K]*i[_]+s[z]*i[st],e[Z]=s[U]*i[Z]+s[Z]*i[W]+s[K]*i[$]+s[z]*i[it],e[K]=s[U]*i[K]+s[Z]*i[Q]+s[K]*i[G]+s[z]*i[rt],e[z]=s[U]*i[z]+s[Z]*i[q]+s[K]*i[H]+s[z]*i[et],e[J]=s[J]*i[U]+s[W]*i[J]+s[Q]*i[_]+s[q]*i[st],e[W]=s[J]*i[Z]+s[W]*i[W]+s[Q]*i[$]+s[q]*i[it],e[Q]=s[J]*i[K]+s[W]*i[Q]+s[Q]*i[G]+s[q]*i[rt],e[q]=s[J]*i[z]+s[W]*i[q]+s[Q]*i[H]+s[q]*i[et],e[_]=s[_]*i[U]+s[$]*i[J]+s[G]*i[_]+s[H]*i[st],e[$]=s[_]*i[Z]+s[$]*i[W]+s[G]*i[$]+s[H]*i[it],e[G]=s[_]*i[K]+s[$]*i[Q]+s[G]*i[G]+s[H]*i[rt],e[H]=s[_]*i[z]+s[$]*i[q]+s[G]*i[H]+s[H]*i[et],e[st]=s[st]*i[U]+s[it]*i[J]+s[rt]*i[_]+s[et]*i[st],e[it]=s[st]*i[Z]+s[it]*i[W]+s[rt]*i[$]+s[et]*i[it],e[rt]=s[st]*i[K]+s[it]*i[Q]+s[rt]*i[G]+s[et]*i[rt],e[et]=s[st]*i[z]+s[it]*i[q]+s[rt]*i[H]+s[et]*i[et],this.set(this.temp)}lookAt(t,e,i){let s=Ft.xAxis,n=Ft.yAxis,o=Ft.zAxis;o.setFrom(e).normalize(),s.setFrom(e).normalize(),s.cross(i).normalize(),n.setFrom(s).cross(o).normalize(),this.identity();let h=this.values;return h[U]=s.x,h[Z]=s.y,h[K]=s.z,h[J]=n.x,h[W]=n.y,h[Q]=n.z,h[_]=-o.x,h[$]=-o.y,h[G]=-o.z,Ft.tmpMatrix.identity(),Ft.tmpMatrix.values[z]=-t.x,Ft.tmpMatrix.values[q]=-t.y,Ft.tmpMatrix.values[H]=-t.z,this.multiply(Ft.tmpMatrix),this}};c(Ft,"xAxis",new It),c(Ft,"yAxis",new It),c(Ft,"zAxis",new It),c(Ft,"tmpMatrix",new Ft);var is=Ft;var si=class{constructor(t,e){c(this,"position",new It(0,0,0));c(this,"direction",new It(0,0,-1));c(this,"up",new It(0,1,0));c(this,"near",0);c(this,"far",100);c(this,"zoom",1);c(this,"viewportWidth",0);c(this,"viewportHeight",0);c(this,"projectionView",new is);c(this,"inverseProjectionView",new is);c(this,"projection",new is);c(this,"view",new is);this.viewportWidth=t,this.viewportHeight=e,this.update()}update(){let t=this.projection,e=this.view,i=this.projectionView,s=this.inverseProjectionView,n=this.zoom,o=this.viewportWidth,h=this.viewportHeight;t.ortho(n*(-o/2),n*(o/2),n*(-h/2),n*(h/2),this.near,this.far),e.lookAt(this.position,this.direction,this.up),i.set(t.values),i.multiply(e),s.set(i.values).invert()}screenToWorld(t,e,i){let s=t.x,n=i-t.y-1;return t.x=2*s/e-1,t.y=2*n/i-1,t.z=2*t.z-1,t.project(this.inverseProjectionView),t}worldToScreen(t,e,i){return t.project(this.projectionView),t.x=e*(t.x+1)/2,t.y=i*(t.y+1)/2,t.z=(t.z+1)/2,t}setViewport(t,e){this.viewportWidth=t,this.viewportHeight=e}};var gs=class{constructor(t,e=!0){c(this,"element");c(this,"mouseX",0);c(this,"mouseY",0);c(this,"buttonDown",!1);c(this,"touch0",null);c(this,"touch1",null);c(this,"initialPinchDistance",0);c(this,"listeners",new Array);c(this,"autoPreventDefault");c(this,"isTouch",!1);c(this,"callbacks");this.element=t,this.autoPreventDefault=e,this.callbacks=this.setupCallbacks(t)}setupCallbacks(t){let e=r=>{if(r instanceof MouseEvent&&!this.isTouch){let a=t.getBoundingClientRect();this.mouseX=r.clientX-a.left,this.mouseY=r.clientY-a.top,this.buttonDown=!0,this.listeners.map(l=>{l.down&&l.down(this.mouseX,this.mouseY,r)})}},i=r=>{if(r instanceof MouseEvent&&!this.isTouch){let a=t.getBoundingClientRect();this.mouseX=r.clientX-a.left,this.mouseY=r.clientY-a.top,this.listeners.map(l=>{this.buttonDown?l.dragged&&l.dragged(this.mouseX,this.mouseY,r):l.moved&&l.moved(this.mouseX,this.mouseY,r)})}},s=r=>{if(r instanceof MouseEvent&&!this.isTouch){let a=t.getBoundingClientRect();this.mouseX=r.clientX-a.left,this.mouseY=r.clientY-a.top,this.buttonDown=!1,this.listeners.map(l=>{l.up&&l.up(this.mouseX,this.mouseY,r)})}},n=r=>{this.autoPreventDefault&&r.preventDefault();let a=r.deltaY;r.deltaMode==WheelEvent.DOM_DELTA_LINE&&(a*=8),r.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(a*=24),this.listeners.map(l=>{l.wheel&&l.wheel(r.deltaY,r)})},o=r=>{if(this.isTouch=!0,!this.touch0||!this.touch1){var a=r.changedTouches;let l=a.item(0);if(!l)return;let f=t.getBoundingClientRect(),m=l.clientX-f.left,u=l.clientY-f.top,g=new Fi(l.identifier,m,u);if(this.mouseX=m,this.mouseY=u,this.buttonDown=!0,!this.touch0)this.touch0=g,this.listeners.map(x=>{x.down&&x.down(g.x,g.y,r)});else if(!this.touch1){this.touch1=g;let x=this.touch1.x-this.touch0.x,b=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(x*x+b*b),this.listeners.map(y=>{y.zoom&&y.zoom(this.initialPinchDistance,this.initialPinchDistance,r)})}}this.autoPreventDefault&&r.preventDefault()},h=r=>{if(this.isTouch=!0,this.touch0){var a=r.changedTouches;let m=t.getBoundingClientRect();for(var l=0;l<a.length;l++){var f=a[l];let u=f.clientX-m.left,g=f.clientY-m.top;this.touch0.identifier===f.identifier&&(this.touch0.x=this.mouseX=u,this.touch0.y=this.mouseY=g,this.listeners.map(x=>{x.dragged&&x.dragged(u,g,r)})),this.touch1&&this.touch1.identifier===f.identifier&&(this.touch1.x=this.mouseX=u,this.touch1.y=this.mouseY=g)}if(this.touch0&&this.touch1){let u=this.touch1.x-this.touch0.x,g=this.touch1.x-this.touch0.x,x=Math.sqrt(u*u+g*g);this.listeners.map(b=>{b.zoom&&b.zoom(this.initialPinchDistance,x,r)})}}this.autoPreventDefault&&r.preventDefault()},d=r=>{if(this.isTouch=!0,this.touch0){var a=r.changedTouches;let m=t.getBoundingClientRect();for(var l=0;l<a.length;l++){var f=a[l];let u=f.clientX-m.left,g=f.clientY-m.top;if(this.touch0.identifier===f.identifier)if(this.touch0=null,this.mouseX=u,this.mouseY=g,this.listeners.map(x=>{x.up&&x.up(u,g,r)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(x=>{x.down&&x.down(this.touch0.x,this.touch0.y,r)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}this.autoPreventDefault&&r.preventDefault()};return t.addEventListener("mousedown",e,!0),t.addEventListener("mousemove",i,!0),t.addEventListener("mouseup",s,!0),t.addEventListener("wheel",n,!0),t.addEventListener("touchstart",o,{passive:!1,capture:!1}),t.addEventListener("touchmove",h,{passive:!1,capture:!1}),t.addEventListener("touchend",d,{passive:!1,capture:!1}),t.addEventListener("touchcancel",d),{mouseDown:e,mouseMove:i,mouseUp:s,mouseWheel:n,touchStart:o,touchMove:h,touchEnd:d}}dispose(){let t=this.element;t.removeEventListener("mousedown",this.callbacks.mouseDown,!0),t.removeEventListener("mousemove",this.callbacks.mouseMove,!0),t.removeEventListener("mouseup",this.callbacks.mouseUp,!0),t.removeEventListener("wheel",this.callbacks.mouseWheel,!0),t.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),t.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),t.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),t.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(t){this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},Fi=class{constructor(t,e,i){c(this,"identifier");c(this,"x");c(this,"y");this.identifier=t,this.x=e,this.y=i}};var Ki=class{constructor(t,e){c(this,"canvas");c(this,"camera");this.canvas=t,this.camera=e;let i=0,s=0,n=0,o=0,h=0,d=0,r=0,a=0;new gs(t).addListener({down:(l,f)=>{i=e.position.x,s=e.position.y,o=d=l,h=r=f,a=e.zoom},dragged:(l,f)=>{let m=l-o,u=f-h,g=e.screenToWorld(new It(0,0),t.clientWidth,t.clientHeight),x=e.screenToWorld(new It(m,u),t.clientWidth,t.clientHeight).sub(g);e.position.set(i-x.x,s-x.y,0),e.update(),d=l,r=f},wheel:l=>{let f=l/200*e.zoom,m=e.zoom+f;if(m>0){let u=0,g=0;if(l<0)u=d,g=r;else{let y=new It(t.clientWidth/2+15,t.clientHeight/2),w=d-y.x,p=t.clientHeight-1-r-y.y;u=y.x-w,g=t.clientHeight-1-y.y+p}let x=e.screenToWorld(new It(u,g),t.clientWidth,t.clientHeight);e.zoom=m,e.update();let b=e.screenToWorld(new It(u,g),t.clientWidth,t.clientHeight);e.position.add(x.sub(b)),e.update()}},zoom:(l,f)=>{let m=l/f;e.zoom=a*m},up:(l,f)=>{d=l,r=f},moved:(l,f)=>{d=l,r=f}})}};var ut=class ut{constructor(t,e,i){c(this,"vertexShader");c(this,"fragmentShader");c(this,"context");c(this,"vs",null);c(this,"vsSource");c(this,"fs",null);c(this,"fsSource");c(this,"program",null);c(this,"tmp2x2",new Float32Array(4));c(this,"tmp3x3",new Float32Array(9));c(this,"tmp4x4",new Float32Array(16));this.vertexShader=e,this.fragmentShader=i,this.vsSource=e,this.fsSource=i,this.context=t instanceof wt?t:new wt(t),this.context.addRestorable(this),this.compile()}getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let t=this.context.gl;try{if(this.vs=this.compileShader(t.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(t.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(e){throw this.dispose(),e}}compileShader(t,e){let i=this.context.gl,s=i.createShader(t);if(!s)throw new Error("Couldn't create shader.");if(i.shaderSource(s,e),i.compileShader(s),!i.getShaderParameter(s,i.COMPILE_STATUS)){let n="Couldn't compile shader: "+i.getShaderInfoLog(s);if(i.deleteShader(s),!i.isContextLost())throw new Error(n)}return s}compileProgram(t,e){let i=this.context.gl,s=i.createProgram();if(!s)throw new Error("Couldn't compile program.");if(i.attachShader(s,t),i.attachShader(s,e),i.linkProgram(s),!i.getProgramParameter(s,i.LINK_STATUS)){let n="Couldn't compile shader program: "+i.getProgramInfoLog(s);if(i.deleteProgram(s),!i.isContextLost())throw new Error(n)}return s}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(t,e){this.context.gl.uniform1i(this.getUniformLocation(t),e)}setUniformf(t,e){this.context.gl.uniform1f(this.getUniformLocation(t),e)}setUniform2f(t,e,i){this.context.gl.uniform2f(this.getUniformLocation(t),e,i)}setUniform3f(t,e,i,s){this.context.gl.uniform3f(this.getUniformLocation(t),e,i,s)}setUniform4f(t,e,i,s,n){this.context.gl.uniform4f(this.getUniformLocation(t),e,i,s,n)}setUniform2x2f(t,e){let i=this.context.gl;this.tmp2x2.set(e),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,e){let i=this.context.gl;this.tmp3x3.set(e),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,e){let i=this.context.gl;this.tmp4x4.set(e),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){let e=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=e.getUniformLocation(this.program,t);if(!i&&!e.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){let e=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=e.getAttribLocation(this.program,t);if(i==-1&&!e.isContextLost())throw new Error(`Couldn't find location for attribute ${t}`);return i}dispose(){this.context.removeRestorable(this);let t=this.context.gl;this.vs&&(t.deleteShader(this.vs),this.vs=null),this.fs&&(t.deleteShader(this.fs),this.fs=null),this.program&&(t.deleteProgram(this.program),this.program=null)}static newColoredTextured(t){let e=`
attribute vec4 ${ut.POSITION};
attribute vec4 ${ut.COLOR};
attribute vec2 ${ut.TEXCOORDS};
uniform mat4 ${ut.MVP_MATRIX};
varying vec4 v_color;
varying vec2 v_texCoords;
void main () {
v_color = ${ut.COLOR};
v_texCoords = ${ut.TEXCOORDS};
gl_Position = ${ut.MVP_MATRIX} * ${ut.POSITION};
}
`,i=`
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
varying LOWP vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main () {
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
}
`;return new ut(t,e,i)}static newTwoColoredTextured(t){let e=`
attribute vec4 ${ut.POSITION};
attribute vec4 ${ut.COLOR};
attribute vec4 ${ut.COLOR2};
attribute vec2 ${ut.TEXCOORDS};
uniform mat4 ${ut.MVP_MATRIX};
varying vec4 v_light;
varying vec4 v_dark;
varying vec2 v_texCoords;
void main () {
v_light = ${ut.COLOR};
v_dark = ${ut.COLOR2};
v_texCoords = ${ut.TEXCOORDS};
gl_Position = ${ut.MVP_MATRIX} * ${ut.POSITION};
}
`,i=`
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
varying LOWP vec4 v_light;
varying LOWP vec4 v_dark;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main () {
vec4 texColor = texture2D(u_texture, v_texCoords);
gl_FragColor.a = texColor.a * v_light.a;
gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;
}
`;return new ut(t,e,i)}static newColored(t){let e=`
attribute vec4 ${ut.POSITION};
attribute vec4 ${ut.COLOR};
uniform mat4 ${ut.MVP_MATRIX};
varying vec4 v_color;
void main () {
v_color = ${ut.COLOR};
gl_Position = ${ut.MVP_MATRIX} * ${ut.POSITION};
}
`,i=`
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
varying LOWP vec4 v_color;
void main () {
gl_FragColor = v_color;
}
`;return new ut(t,e,i)}};c(ut,"MVP_MATRIX","u_projTrans"),c(ut,"POSITION","a_position"),c(ut,"COLOR","a_color"),c(ut,"COLOR2","a_color2"),c(ut,"TEXCOORDS","a_texCoords"),c(ut,"SAMPLER","u_texture");var Pt=ut;var ps=class{constructor(t,e,i,s){c(this,"attributes");c(this,"context");c(this,"vertices");c(this,"verticesBuffer",null);c(this,"verticesLength",0);c(this,"dirtyVertices",!1);c(this,"indices");c(this,"indicesBuffer",null);c(this,"indicesLength",0);c(this,"dirtyIndices",!1);c(this,"elementsPerVertex",0);this.attributes=e,this.context=t instanceof wt?t:new wt(t),this.elementsPerVertex=0;for(let n=0;n<e.length;n++)this.elementsPerVertex+=e[n].numElements;this.vertices=new Float32Array(i*this.elementsPerVertex),this.indices=new Uint16Array(s),this.context.addRestorable(this)}getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(t){this.dirtyVertices=!0,this.verticesLength=t}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(t){this.dirtyIndices=!0,this.indicesLength=t}getIndices(){return this.indices}getVertexSizeInFloats(){let t=0;for(var e=0;e<this.attributes.length;e++){let i=this.attributes[e];t+=i.numElements}return t}setVertices(t){if(this.dirtyVertices=!0,t.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(t,0),this.verticesLength=t.length}setIndices(t){if(this.dirtyIndices=!0,t.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(t,0),this.indicesLength=t.length}draw(t,e){this.drawWithOffset(t,e,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(t,e,i,s){let n=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(t),this.indicesLength>0?n.drawElements(e,s,n.UNSIGNED_SHORT,i*2):n.drawArrays(e,i,s),this.unbind(t)}bind(t){let e=this.context.gl;e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer);let i=0;for(let s=0;s<this.attributes.length;s++){let n=this.attributes[s],o=t.getAttributeLocation(n.name);e.enableVertexAttribArray(o),e.vertexAttribPointer(o,n.numElements,e.FLOAT,!1,this.elementsPerVertex*4,i*4),i+=n.numElements}this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(t){let e=this.context.gl;for(let i=0;i<this.attributes.length;i++){let s=this.attributes[i],n=t.getAttributeLocation(s.name);e.disableVertexAttribArray(n)}e.bindBuffer(e.ARRAY_BUFFER,null),this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}update(){let t=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),t.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=t.createBuffer()),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),t.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let t=this.context.gl;t.deleteBuffer(this.verticesBuffer),t.deleteBuffer(this.indicesBuffer)}},rs=class{constructor(t,e,i){c(this,"name");c(this,"type");c(this,"numElements");this.name=t,this.type=e,this.numElements=i}},ns=class extends rs{constructor(){super(Pt.POSITION,ls.Float,2)}},Ji=class extends rs{constructor(){super(Pt.POSITION,ls.Float,3)}},Ns=class extends rs{constructor(t=0){super(Pt.TEXCOORDS+(t==0?"":t),ls.Float,2)}},as=class extends rs{constructor(){super(Pt.COLOR,ls.Float,4)}},ii=class extends rs{constructor(){super(Pt.COLOR2,ls.Float,4)}},ls;(function(A){A[A.Float=0]="Float"})(ls||(ls={}));var ue=1,jr=769,or=770,hr=771;var cr=774,se=class se{constructor(t,e=!0,i=10920){c(this,"context");c(this,"drawCalls",0);c(this,"isDrawing",!1);c(this,"mesh");c(this,"shader",null);c(this,"lastTexture",null);c(this,"verticesLength",0);c(this,"indicesLength",0);c(this,"srcColorBlend");c(this,"srcAlphaBlend");c(this,"dstBlend");c(this,"cullWasEnabled",!1);if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=t instanceof wt?t:new wt(t);let s=e?[new ns,new as,new Ns,new ii]:[new ns,new as,new Ns];this.mesh=new ps(t,s,i,i*3);let n=this.context.gl;this.srcColorBlend=n.SRC_ALPHA,this.srcAlphaBlend=n.ONE,this.dstBlend=n.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=t,this.lastTexture=null,this.isDrawing=!0;let e=this.context.gl;e.enable(e.BLEND),e.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),se.disableCulling&&(this.cullWasEnabled=e.isEnabled(e.CULL_FACE),this.cullWasEnabled&&e.disable(e.CULL_FACE))}setBlendMode(t,e){let i=se.blendModesGL[t],s=e?i.srcRgbPma:i.srcRgb,n=i.srcAlpha,o=i.dstRgb;if(this.srcColorBlend==s&&this.srcAlphaBlend==n&&this.dstBlend==o)return;this.srcColorBlend=s,this.srcAlphaBlend=n,this.dstBlend=o,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(s,o,n,o)}draw(t,e,i){t!=this.lastTexture?(this.flush(),this.lastTexture=t):(this.verticesLength+e.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let s=this.mesh.numVertices();this.mesh.getVertices().set(e,this.verticesLength),this.verticesLength+=e.length,this.mesh.setVerticesLength(this.verticesLength);let n=this.mesh.getIndices();for(let o=this.indicesLength,h=0;h<i.length;o++,h++)n[o]=i[h]+s;this.indicesLength+=i.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!=0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,se.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let t=this.context.gl;t.disable(t.BLEND),se.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let t=se.globalDrawCalls;return se.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}};c(se,"disableCulling",!1),c(se,"globalDrawCalls",0),c(se,"blendModesGL",[{srcRgb:or,srcRgbPma:ue,dstRgb:hr,srcAlpha:ue},{srcRgb:or,srcRgbPma:ue,dstRgb:ue,srcAlpha:ue},{srcRgb:cr,srcRgbPma:cr,dstRgb:hr,srcAlpha:ue},{srcRgb:ue,srcRgbPma:ue,dstRgb:jr,srcAlpha:ue}]);var Ds=se;var Us=class{constructor(t,e=10920){c(this,"context");c(this,"isDrawing",!1);c(this,"mesh");c(this,"shapeType",kt.Filled);c(this,"color",new N(1,1,1,1));c(this,"shader",null);c(this,"vertexIndex",0);c(this,"tmp",new Vt);c(this,"srcColorBlend");c(this,"srcAlphaBlend");c(this,"dstBlend");if(e>10920)throw new Error("Can't have more than 10920 triangles per batch: "+e);this.context=t instanceof wt?t:new wt(t),this.mesh=new ps(t,[new ns,new as],e,0);let i=this.context.gl;this.srcColorBlend=i.SRC_ALPHA,this.srcAlphaBlend=i.ONE,this.dstBlend=i.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=t,this.vertexIndex=0,this.isDrawing=!0;let e=this.context.gl;e.enable(e.BLEND),e.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(t,e,i){this.srcColorBlend=t,this.srcAlphaBlend=e,this.dstBlend=i,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(t,i,e,i))}setColor(t){this.color.setFromColor(t)}setColorWith(t,e,i,s){this.color.set(t,e,i,s)}point(t,e,i){this.check(kt.Point,1),i||(i=this.color),this.vertex(t,e,i)}line(t,e,i,s,n){this.check(kt.Line,2);let o=this.mesh.getVertices(),h=this.vertexIndex;n||(n=this.color),this.vertex(t,e,n),this.vertex(i,s,n)}triangle(t,e,i,s,n,o,h,d,r,a){this.check(t?kt.Filled:kt.Line,3);let l=this.mesh.getVertices(),f=this.vertexIndex;d||(d=this.color),r||(r=this.color),a||(a=this.color),t?(this.vertex(e,i,d),this.vertex(s,n,r),this.vertex(o,h,a)):(this.vertex(e,i,d),this.vertex(s,n,r),this.vertex(s,n,d),this.vertex(o,h,r),this.vertex(o,h,d),this.vertex(e,i,r))}quad(t,e,i,s,n,o,h,d,r,a,l,f,m){this.check(t?kt.Filled:kt.Line,3);let u=this.mesh.getVertices(),g=this.vertexIndex;a||(a=this.color),l||(l=this.color),f||(f=this.color),m||(m=this.color),t?(this.vertex(e,i,a),this.vertex(s,n,l),this.vertex(o,h,f),this.vertex(o,h,f),this.vertex(d,r,m),this.vertex(e,i,a)):(this.vertex(e,i,a),this.vertex(s,n,l),this.vertex(s,n,l),this.vertex(o,h,f),this.vertex(o,h,f),this.vertex(d,r,m),this.vertex(d,r,m),this.vertex(e,i,a))}rect(t,e,i,s,n,o){this.quad(t,e,i,e+s,i,e+s,i+n,e,i+n,o,o,o,o)}rectLine(t,e,i,s,n,o,h){this.check(t?kt.Filled:kt.Line,8),h||(h=this.color);let d=this.tmp.set(n-i,e-s);d.normalize(),o*=.5;let r=d.x*o,a=d.y*o;t?(this.vertex(e+r,i+a,h),this.vertex(e-r,i-a,h),this.vertex(s+r,n+a,h),this.vertex(s-r,n-a,h),this.vertex(s+r,n+a,h),this.vertex(e-r,i-a,h)):(this.vertex(e+r,i+a,h),this.vertex(e-r,i-a,h),this.vertex(s+r,n+a,h),this.vertex(s-r,n-a,h),this.vertex(s+r,n+a,h),this.vertex(e+r,i+a,h),this.vertex(s-r,n-a,h),this.vertex(e-r,i-a,h))}x(t,e,i){this.line(t-i,e-i,t+i,e+i),this.line(t-i,e+i,t+i,e-i)}polygon(t,e,i,s){if(i<3)throw new Error("Polygon must contain at least 3 vertices");this.check(kt.Line,i*2),s||(s=this.color);let n=this.mesh.getVertices(),o=this.vertexIndex;e<<=1,i<<=1;let h=t[e],d=t[e+1],r=e+i;for(let a=e,l=e+i-2;a<l;a+=2){let f=t[a],m=t[a+1],u=0,g=0;a+2>=r?(u=h,g=d):(u=t[a+2],g=t[a+3]),this.vertex(f,m,s),this.vertex(u,g,s)}}circle(t,e,i,s,n,o=0){if(o==0&&(o=Math.max(1,6*B.cbrt(s)|0)),o<=0)throw new Error("segments must be > 0.");n||(n=this.color);let h=2*B.PI/o,d=Math.cos(h),r=Math.sin(h),a=s,l=0;if(t){this.check(kt.Filled,o*3+3),o--;for(let m=0;m<o;m++){this.vertex(e,i,n),this.vertex(e+a,i+l,n);let u=a;a=d*a-r*l,l=r*u+d*l,this.vertex(e+a,i+l,n)}this.vertex(e,i,n),this.vertex(e+a,i+l,n)}else{this.check(kt.Line,o*2+2);for(let m=0;m<o;m++){this.vertex(e+a,i+l,n);let u=a;a=d*a-r*l,l=r*u+d*l,this.vertex(e+a,i+l,n)}this.vertex(e+a,i+l,n)}let f=a;a=s,l=0,this.vertex(e+a,i+l,n)}curve(t,e,i,s,n,o,h,d,r,a){this.check(kt.Line,r*2+2),a||(a=this.color);let l=1/r,f=l*l,m=l*l*l,u=3*l,g=3*f,x=6*f,b=6*m,y=t-i*2+n,w=e-s*2+o,p=(i-n)*3-t+h,C=(s-o)*3-e+d,v=t,M=e,S=(i-t)*u+y*g+p*m,I=(s-e)*u+w*g+C*m,F=y*x+p*b,R=w*x+C*b,V=p*b,X=C*b;for(;r-- >0;)this.vertex(v,M,a),v+=S,M+=I,S+=F,I+=R,F+=V,R+=X,this.vertex(v,M,a);this.vertex(v,M,a),this.vertex(h,d,a)}vertex(t,e,i){let s=this.vertexIndex,n=this.mesh.getVertices();n[s++]=t,n[s++]=e,n[s++]=i.r,n[s++]=i.g,n[s++]=i.b,n[s++]=i.a,this.vertexIndex=s}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let t=this.context.gl;t.disable(t.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!=0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(t,e){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==t)if(this.mesh.maxVertices()-this.mesh.numVertices()<e)this.flush();else return;else this.flush(),this.shapeType=t}dispose(){this.mesh.dispose()}},kt;(function(A){A[A.Point=0]="Point",A[A.Line=1]="Line",A[A.Filled=4]="Filled"})(kt||(kt={}));var zs=class zs{constructor(t){c(this,"boneLineColor",new N(1,0,0,1));c(this,"boneOriginColor",new N(0,1,0,1));c(this,"attachmentLineColor",new N(0,0,1,.5));c(this,"triangleLineColor",new N(1,.64,0,.5));c(this,"pathColor",new N().setFromString("FF7F00"));c(this,"clipColor",new N(.8,0,0,2));c(this,"aabbColor",new N(0,1,0,.5));c(this,"drawBones",!0);c(this,"drawRegionAttachments",!0);c(this,"drawBoundingBoxes",!0);c(this,"drawMeshHull",!0);c(this,"drawMeshTriangles",!0);c(this,"drawPaths",!0);c(this,"drawSkeletonXY",!1);c(this,"drawClipping",!0);c(this,"premultipliedAlpha",!1);c(this,"scale",1);c(this,"boneWidth",2);c(this,"context");c(this,"bounds",new Ps);c(this,"temp",new Array);c(this,"vertices",O.newFloatArray(2*1024));this.context=t instanceof wt?t:new wt(t)}draw(t,e,i){let s=e.x,n=e.y,o=this.context.gl,h=this.premultipliedAlpha?o.ONE:o.SRC_ALPHA;t.setBlendMode(h,o.ONE,o.ONE_MINUS_SRC_ALPHA);let d=e.bones;if(this.drawBones){t.setColor(this.boneLineColor);for(let r=0,a=d.length;r<a;r++){let l=d[r];if(i&&i.indexOf(l.data.name)>-1||!l.parent)continue;let f=l.data.length*l.a+l.worldX,m=l.data.length*l.c+l.worldY;t.rectLine(!0,l.worldX,l.worldY,f,m,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(s,n,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);let r=e.slots;for(let a=0,l=r.length;a<l;a++){let f=r[a],m=f.getAttachment();if(m instanceof Kt){let u=m,g=this.vertices;u.computeWorldVertices(f,g,0,2),t.line(g[0],g[1],g[2],g[3]),t.line(g[2],g[3],g[4],g[5]),t.line(g[4],g[5],g[6],g[7]),t.line(g[6],g[7],g[0],g[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let r=e.slots;for(let a=0,l=r.length;a<l;a++){let f=r[a];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof Nt))continue;let u=m,g=this.vertices;u.computeWorldVertices(f,0,u.worldVerticesLength,g,0,2);let x=u.triangles,b=u.hullLength;if(this.drawMeshTriangles){t.setColor(this.triangleLineColor);for(let y=0,w=x.length;y<w;y+=3){let p=x[y]*2,C=x[y+1]*2,v=x[y+2]*2;t.triangle(!1,g[p],g[p+1],g[C],g[C+1],g[v],g[v+1])}}if(this.drawMeshHull&&b>0){t.setColor(this.attachmentLineColor),b=(b>>1)*2;let y=g[b-2],w=g[b-1];for(let p=0,C=b;p<C;p+=2){let v=g[p],M=g[p+1];t.line(v,M,y,w),y=v,w=M}}}}if(this.drawBoundingBoxes){let r=this.bounds;r.update(e,!0),t.setColor(this.aabbColor),t.rect(!1,r.minX,r.minY,r.getWidth(),r.getHeight());let a=r.polygons,l=r.boundingBoxes;for(let f=0,m=a.length;f<m;f++){let u=a[f];t.setColor(l[f].color),t.polygon(u,0,u.length)}}if(this.drawPaths){let r=e.slots;for(let a=0,l=r.length;a<l;a++){let f=r[a];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof zt))continue;let u=m,g=u.worldVerticesLength,x=this.temp=O.setArraySize(this.temp,g,0);u.computeWorldVertices(f,0,g,x,0,2);let b=this.pathColor,y=x[2],w=x[3],p=0,C=0;if(u.closed){t.setColor(b);let v=x[0],M=x[1],S=x[g-2],I=x[g-1];p=x[g-4],C=x[g-3],t.curve(y,w,v,M,S,I,p,C,32),t.setColor(zs.LIGHT_GRAY),t.line(y,w,v,M),t.line(p,C,S,I)}g-=4;for(let v=4;v<g;v+=6){let M=x[v],S=x[v+1],I=x[v+2],F=x[v+3];p=x[v+4],C=x[v+5],t.setColor(b),t.curve(y,w,M,S,I,F,p,C,32),t.setColor(zs.LIGHT_GRAY),t.line(y,w,M,S),t.line(p,C,I,F),y=p,w=C}}}if(this.drawBones){t.setColor(this.boneOriginColor);for(let r=0,a=d.length;r<a;r++){let l=d[r];i&&i.indexOf(l.data.name)>-1||t.circle(!0,l.worldX,l.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let r=e.slots;t.setColor(this.clipColor);for(let a=0,l=r.length;a<l;a++){let f=r[a];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof Zt))continue;let u=m,g=u.worldVerticesLength,x=this.temp=O.setArraySize(this.temp,g,0);u.computeWorldVertices(f,0,g,x,0,2);for(let b=0,y=x.length;b<y;b+=2){let w=x[b],p=x[b+1],C=x[(b+2)%x.length],v=x[(b+3)%x.length];t.line(w,p,C,v)}}}}dispose(){}};c(zs,"LIGHT_GRAY",new N(192/255,192/255,192/255,1)),c(zs,"GREEN",new N(0,1,0,1));var ri=zs;var Qi=class{constructor(t,e,i){c(this,"vertices");c(this,"numVertices");c(this,"numFloats");this.vertices=t,this.numVertices=e,this.numFloats=i}},ki=class ki{constructor(t,e=!0){c(this,"premultipliedAlpha",!1);c(this,"tempColor",new N);c(this,"tempColor2",new N);c(this,"vertices");c(this,"vertexSize",8);c(this,"twoColorTint",!1);c(this,"renderable",new Qi([],0,0));c(this,"clipper",new Vs);c(this,"temp",new Vt);c(this,"temp2",new Vt);c(this,"temp3",new N);c(this,"temp4",new N);c(this,"pmaAdditiveBatching",!1);this.twoColorTint=e,e&&(this.vertexSize+=4),this.vertices=O.newFloatArray(this.vertexSize*1024)}draw(t,e,i=-1,s=-1,n=null){let o=this.clipper,h=this.premultipliedAlpha,d=this.twoColorTint,r=null,a=this.renderable,l,f,m=e.drawOrder,u,g=e.color,x=d?12:8,b=!1;i==-1&&(b=!0);for(let y=0,w=m.length;y<w;y++){let p=o.isClipping()?2:x,C=m[y];if(!C.bone.active){o.clipEndWithSlot(C);continue}if(i>=0&&i==C.data.index&&(b=!0),!b){o.clipEndWithSlot(C);continue}s>=0&&s==C.data.index&&(b=!1);let v=C.getAttachment(),M;if(v instanceof Kt){let S=v;a.vertices=this.vertices,a.numVertices=4,a.numFloats=p<<2,S.computeWorldVertices(C,a.vertices,0,p),f=ki.QUAD_TRIANGLES,l=S.uvs,M=S.region.texture,u=S.color}else if(v instanceof Nt){let S=v;a.vertices=this.vertices,a.numVertices=S.worldVerticesLength>>1,a.numFloats=a.numVertices*p,a.numFloats>a.vertices.length&&(a.vertices=this.vertices=O.newFloatArray(a.numFloats)),S.computeWorldVertices(C,0,S.worldVerticesLength,a.vertices,0,p),f=S.triangles,M=S.region.texture,l=S.uvs,u=S.color}else if(v instanceof Zt){let S=v;o.clipStart(C,S);continue}else{o.clipEndWithSlot(C);continue}if(M){let S=C.color,I=this.tempColor,F=C.data.blendMode,R=this.pmaAdditiveBatching&&h&&F==qt.Additive,V=g.a*S.a*u.a;I.r=g.r*S.r*u.r,I.g=g.g*S.g*u.g,I.b=g.b*S.b*u.b,I.a=R?0:V,h&&(I.r*=V,I.g*=V,I.b*=V);let X=this.tempColor2;C.darkColor?(h?(X.r=C.darkColor.r*I.a,X.g=C.darkColor.g*I.a,X.b=C.darkColor.b*I.a):X.setFromColor(C.darkColor),X.a=h?1:0):X.set(0,0,0,1);let Y=R?qt.Normal:F;if(Y!=r&&(r=Y,t.setBlendMode(r,h)),o.isClipping()){o.clipTriangles(a.vertices,f,f.length,l,I,X,d);let k=new Float32Array(o.clippedVertices),L=o.clippedTriangles;n&&n(k,k.length,x),t.draw(M,k,L)}else{let k=a.vertices;if(d)for(let D=2,nt=0,j=a.numFloats;D<j;D+=x,nt+=2)k[D]=I.r,k[D+1]=I.g,k[D+2]=I.b,k[D+3]=I.a,k[D+4]=l[nt],k[D+5]=l[nt+1],k[D+6]=X.r,k[D+7]=X.g,k[D+8]=X.b,k[D+9]=X.a;else for(let D=2,nt=0,j=a.numFloats;D<j;D+=x,nt+=2)k[D]=I.r,k[D+1]=I.g,k[D+2]=I.b,k[D+3]=I.a,k[D+4]=l[nt],k[D+5]=l[nt+1];let L=a.vertices.subarray(0,a.numFloats);n&&n(a.vertices,a.numFloats,x),t.draw(M,L,f)}}o.clipEndWithSlot(C)}o.clipEnd()}getSkeletonClipping(){return this.clipper}};c(ki,"QUAD_TRIANGLES",[0,1,2,2,3,0]);var ni=ki;var T=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],Xi=[0,1,2,2,3,0],Li=new N(1,1,1,1),ai=class{constructor(t,e,i=!0){c(this,"context");c(this,"canvas");c(this,"camera");c(this,"batcher");c(this,"twoColorTint",!1);c(this,"batcherShader");c(this,"shapes");c(this,"shapesShader");c(this,"activeRenderer",null);c(this,"maxCanvasWidth",0);c(this,"maxCanvasHeight",0);c(this,"skeletonRenderer");c(this,"skeletonDebugRenderer");this.canvas=t,this.context=e instanceof wt?e:new wt(e),this.twoColorTint=i,this.camera=new si(t.width,t.height),this.batcherShader=i?Pt.newTwoColoredTextured(this.context):Pt.newColoredTextured(this.context),this.batcher=new Ds(this.context,i),this.shapesShader=Pt.newColored(this.context),this.shapes=new Us(this.context),this.skeletonRenderer=new ni(this.context,i),this.skeletonDebugRenderer=new ri(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(t,e=!1,i=-1,s=-1,n=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=e,this.skeletonRenderer.draw(this.batcher,t,i,s,n)}drawSkeletonDebug(t,e=!1,i){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=e,this.skeletonDebugRenderer.draw(this.shapes,t,i)}drawTexture(t,e,i,s,n,o){this.enableRenderer(this.batcher),o||(o=Li);var h=0;T[h++]=e,T[h++]=i,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=0,T[h++]=1,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h++]=0),T[h++]=e+s,T[h++]=i,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=1,T[h++]=1,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h++]=0),T[h++]=e+s,T[h++]=i+n,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=1,T[h++]=0,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h++]=0),T[h++]=e,T[h++]=i+n,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=0,T[h++]=0,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h]=0),this.batcher.draw(t,T,Xi)}drawTextureUV(t,e,i,s,n,o,h,d,r,a){this.enableRenderer(this.batcher),a||(a=Li);var l=0;T[l++]=e,T[l++]=i,T[l++]=a.r,T[l++]=a.g,T[l++]=a.b,T[l++]=a.a,T[l++]=o,T[l++]=h,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+s,T[l++]=i,T[l++]=a.r,T[l++]=a.g,T[l++]=a.b,T[l++]=a.a,T[l++]=d,T[l++]=h,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+s,T[l++]=i+n,T[l++]=a.r,T[l++]=a.g,T[l++]=a.b,T[l++]=a.a,T[l++]=d,T[l++]=r,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e,T[l++]=i+n,T[l++]=a.r,T[l++]=a.g,T[l++]=a.b,T[l++]=a.a,T[l++]=o,T[l++]=r,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(t,T,Xi)}drawTextureRotated(t,e,i,s,n,o,h,d,r){this.enableRenderer(this.batcher),r||(r=Li);let a=e+o,l=i+h,f=-o,m=-h,u=s-o,g=n-h,x=f,b=m,y=f,w=g,p=u,C=g,v=u,M=m,S=0,I=0,F=0,R=0,V=0,X=0,Y=0,k=0;if(d!=0){let D=B.cosDeg(d),nt=B.sinDeg(d);S=D*x-nt*b,I=nt*x+D*b,Y=D*y-nt*w,k=nt*y+D*w,V=D*p-nt*C,X=nt*p+D*C,F=V+(S-Y),R=X+(I-k)}else S=x,I=b,Y=y,k=w,V=p,X=C,F=v,R=M;S+=a,I+=l,F+=a,R+=l,V+=a,X+=l,Y+=a,k+=l;var L=0;T[L++]=S,T[L++]=I,T[L++]=r.r,T[L++]=r.g,T[L++]=r.b,T[L++]=r.a,T[L++]=0,T[L++]=1,this.twoColorTint&&(T[L++]=0,T[L++]=0,T[L++]=0,T[L++]=0),T[L++]=F,T[L++]=R,T[L++]=r.r,T[L++]=r.g,T[L++]=r.b,T[L++]=r.a,T[L++]=1,T[L++]=1,this.twoColorTint&&(T[L++]=0,T[L++]=0,T[L++]=0,T[L++]=0),T[L++]=V,T[L++]=X,T[L++]=r.r,T[L++]=r.g,T[L++]=r.b,T[L++]=r.a,T[L++]=1,T[L++]=0,this.twoColorTint&&(T[L++]=0,T[L++]=0,T[L++]=0,T[L++]=0),T[L++]=Y,T[L++]=k,T[L++]=r.r,T[L++]=r.g,T[L++]=r.b,T[L++]=r.a,T[L++]=0,T[L++]=0,this.twoColorTint&&(T[L++]=0,T[L++]=0,T[L++]=0,T[L]=0),this.batcher.draw(t,T,Xi)}drawRegion(t,e,i,s,n,o){this.enableRenderer(this.batcher),o||(o=Li);var h=0;T[h++]=e,T[h++]=i,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=t.u,T[h++]=t.v2,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h++]=0),T[h++]=e+s,T[h++]=i,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=t.u2,T[h++]=t.v2,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h++]=0),T[h++]=e+s,T[h++]=i+n,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=t.u2,T[h++]=t.v,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h++]=0),T[h++]=e,T[h++]=i+n,T[h++]=o.r,T[h++]=o.g,T[h++]=o.b,T[h++]=o.a,T[h++]=t.u,T[h++]=t.v,this.twoColorTint&&(T[h++]=0,T[h++]=0,T[h++]=0,T[h]=0),this.batcher.draw(t.page.texture,T,Xi)}line(t,e,i,s,n,o){this.enableRenderer(this.shapes),this.shapes.line(t,e,i,s,n)}triangle(t,e,i,s,n,o,h,d,r,a){this.enableRenderer(this.shapes),this.shapes.triangle(t,e,i,s,n,o,h,d,r,a)}quad(t,e,i,s,n,o,h,d,r,a,l,f,m){this.enableRenderer(this.shapes),this.shapes.quad(t,e,i,s,n,o,h,d,r,a,l,f,m)}rect(t,e,i,s,n,o){this.enableRenderer(this.shapes),this.shapes.rect(t,e,i,s,n,o)}rectLine(t,e,i,s,n,o,h){this.enableRenderer(this.shapes),this.shapes.rectLine(t,e,i,s,n,o,h)}polygon(t,e,i,s){this.enableRenderer(this.shapes),this.shapes.polygon(t,e,i,s)}circle(t,e,i,s,n,o=0){this.enableRenderer(this.shapes),this.shapes.circle(t,e,i,s,n,o)}curve(t,e,i,s,n,o,h,d,r,a){this.enableRenderer(this.shapes),this.shapes.curve(t,e,i,s,n,o,h,d,r,a)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(t){let e=this.canvas;var i=this.getSafeDevicePixelRatio(e.clientWidth,e.clientHeight),s=Math.round(e.clientWidth*i),n=Math.round(e.clientHeight*i);if((e.width!=s||e.height!=n)&&(e.width=s,e.height=n),this.context.gl.viewport(0,0,e.width,e.height),t===xs.Expand)this.camera.setViewport(s,n);else if(t===xs.Fit){let o=e.width,h=e.height,d=this.camera.viewportWidth,r=this.camera.viewportHeight,a=r/d,l=h/o,f=a<l?d/o:r/h;this.camera.setViewport(o*f,h*f)}this.camera.update()}getSafeDevicePixelRatio(t,e){let i=window.devicePixelRatio||1;if(t<=0||e<=0)return i;if(this.maxCanvasWidth===0||this.maxCanvasHeight===0){let s=this.context.gl,n=s.getParameter(s.MAX_RENDERBUFFER_SIZE),o=s.getParameter(s.MAX_VIEWPORT_DIMS);this.maxCanvasWidth=Math.min(n,o[0]),this.maxCanvasHeight=Math.min(n,o[1])}return Math.min(i,this.maxCanvasWidth/t,this.maxCanvasHeight/e)}enableRenderer(t){this.activeRenderer!==t&&(this.end(),t instanceof Ds?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Pt.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):t instanceof Us?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Pt.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},xs;(function(A){A[A.Stretch=0]="Stretch",A[A.Expand=1]="Expand",A[A.Fit=2]="Fit"})(xs||(xs={}));var Ws,ws,_i=0,Zr=1,$i=1,Pi=165,Bi=108,ie=163,tr=class{constructor(t){c(this,"renderer");c(this,"logo",null);c(this,"spinner",null);c(this,"angle",0);c(this,"fadeOut",0);c(this,"fadeIn",0);c(this,"timeKeeper",new xe);c(this,"backgroundColor",new N(.135,.135,.135,1));c(this,"tempColor",new N);if(this.renderer=t,this.timeKeeper.maxDelta=9,!ws){let e=navigator.userAgent.indexOf("Safari")>-1,i=()=>_i++;ws=new Image,ws.src=Jr,e||(ws.crossOrigin="anonymous"),ws.onload=i,Ws=new Image,Ws.src=Kr,e||(Ws.crossOrigin="anonymous"),Ws.onload=i}}dispose(){var t,e;(t=this.logo)==null||t.dispose(),(e=this.spinner)==null||e.dispose()}draw(t=!1){if(_i<2||t&&this.fadeOut>$i)return;this.timeKeeper.update();let e=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(e,5));let i=this.tempColor,s=this.renderer,n=s.canvas,o=s.context.gl;if(s.resize(xs.Expand),s.camera.position.set(n.width/2,n.height/2,0),s.batcher.setBlendMode(qt.Normal,!0),t){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>$i)return;i.setFromColor(this.backgroundColor),e=1-this.fadeOut/$i,e=1-(e-1)*(e-1),i.a*=e,i.a>0&&(s.camera.zoom=1,s.begin(),s.quad(!0,0,0,n.width,0,n.width,n.height,0,n.height,i,i,i,i),s.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(o.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),o.clear(o.COLOR_BUFFER_BIT)),e=1;e*=Math.min(this.fadeIn/Zr,1),i.set(e,e,e,e),this.logo||(this.logo=new he(s.context,ws),this.spinner=new he(s.context,Ws)),s.camera.zoom=Math.max(1,ie/n.height),s.begin(),s.drawTexture(this.logo,(n.width-Pi)/2,(n.height-Bi)/2,Pi,Bi,i),this.spinner&&s.drawTextureRotated(this.spinner,(n.width-ie)/2,(n.height-ie)/2,ie,ie,ie/2,ie/2,this.angle,i),s.end()}drawInCoordinates(t,e){if(_i<2)return;this.timeKeeper.update();let i=this.renderer;i.batcher.setBlendMode(qt.Normal,!0),this.logo||(this.logo=new he(i.context,ws),this.spinner=new he(i.context,Ws));let s=t-Pi/2,n=e-Bi/2;i.drawTexture(this.logo,s,n,Pi,Bi),this.angle-=this.timeKeeper.delta*500,this.spinner&&i.drawTextureRotated(this.spinner,s,n-25,ie,ie,ie/2,ie/2,this.angle)}},Kr="data:image/png;base64,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",Jr="data:image/png;base64,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";var er=class{constructor(t,e){c(this,"config");c(this,"context");c(this,"time",new xe);c(this,"htmlCanvas");c(this,"gl");c(this,"renderer");c(this,"assetManager");c(this,"input");c(this,"disposed",!1);this.config=e,e.pathPrefix||(e.pathPrefix=""),e.app||(e.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),e.webglConfig||(e.webglConfig={alpha:!0}),this.htmlCanvas=t,this.context=new wt(t,e.webglConfig),this.renderer=new ai(t,this.context),this.gl=this.context.gl,this.assetManager=new ei(this.context,e.pathPrefix),this.input=new gs(t),e.app.loadAssets&&e.app.loadAssets(this);let i=()=>{this.disposed||(requestAnimationFrame(i),this.time.update(),e.app.update&&e.app.update(this,this.time.delta),e.app.render&&e.app.render(this))},s=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?e.app.error&&e.app.error(this,this.assetManager.getErrors()):(e.app.initialize&&e.app.initialize(this),i());return}requestAnimationFrame(s)}};requestAnimationFrame(s)}clear(t,e,i,s){this.gl.clearColor(t,e,i,s),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};