var spine=(()=>{var gr=Object.defineProperty;var Lr=Y=>gr(Y,"__esModule",{value:!0});var Vr=(Y,e)=>{Lr(Y);for(var r in e)gr(Y,r,{get:e[r],enumerable:!0})};var nn={};Vr(nn,{AlphaTimeline:()=>Ze,Animation:()=>Ye,AnimationState:()=>At,AnimationStateAdapter:()=>Ar,AnimationStateData:()=>vr,AssetManager:()=>Pr,AssetManagerBase:()=>Pt,AtlasAttachmentLoader:()=>Tr,Attachment:()=>xt,AttachmentTimeline:()=>de,BinaryInput:()=>ir,BlendMode:()=>St,Bone:()=>vt,BoneData:()=>ht,BoundingBoxAttachment:()=>Be,CURRENT:()=>kr,CanvasTexture:()=>Nt,ClippingAttachment:()=>ot,Color:()=>R,ConstraintData:()=>De,CurveTimeline:()=>me,CurveTimeline1:()=>ce,CurveTimeline2:()=>yt,DebugUtils:()=>pr,DeformTimeline:()=>tt,Downloader:()=>nr,DrawOrderTimeline:()=>fe,Event:()=>mt,EventData:()=>ct,EventQueue:()=>Jt,EventTimeline:()=>ve,EventType:()=>ae,FIRST:()=>Qt,FakeTexture:()=>Sr,HOLD_FIRST:()=>Ft,HOLD_MIX:()=>wr,HOLD_SUBSEQUENT:()=>Zt,IkConstraint:()=>Lt,IkConstraintData:()=>ut,IkConstraintTimeline:()=>rt,IntSet:()=>br,Interpolation:()=>qt,JitterEffect:()=>Er,MathUtils:()=>M,MeshAttachment:()=>se,MixBlend:()=>S,MixDirection:()=>re,PathAttachment:()=>ge,PathConstraint:()=>Ee,PathConstraintData:()=>dt,PathConstraintMixTimeline:()=>st,PathConstraintPositionTimeline:()=>it,PathConstraintSpacingTimeline:()=>at,PointAttachment:()=>lt,Pool:()=>we,PositionMode:()=>oe,Pow:()=>Ht,PowOut:()=>Yt,RGB2Timeline:()=>et,RGBA2Timeline:()=>Ke,RGBATimeline:()=>Je,RGBTimeline:()=>Qe,RegionAttachment:()=>V,RotateMode:()=>Se,RotateTimeline:()=>ke,SETUP:()=>Kt,SUBSEQUENT:()=>Xt,ScaleTimeline:()=>qe,ScaleXTimeline:()=>He,ScaleYTimeline:()=>Ge,ShearTimeline:()=>je,ShearXTimeline:()=>$e,ShearYTimeline:()=>_e,Skeleton:()=>Ir,SkeletonBinary:()=>Mr,SkeletonBounds:()=>Xr,SkeletonClipping:()=>Ct,SkeletonData:()=>ft,SkeletonJson:()=>Fr,SkeletonRenderer:()=>Ot,Skin:()=>Le,SkinEntry:()=>Ut,Slot:()=>Vt,SlotData:()=>gt,SpacingMode:()=>Z,StringSet:()=>Ne,SwirlEffect:()=>or,Texture:()=>wt,TextureAtlas:()=>Et,TextureAtlasPage:()=>tr,TextureAtlasRegion:()=>kt,TextureFilter:()=>Xe,TextureRegion:()=>Dt,TextureWrap:()=>Fe,TimeKeeper:()=>xr,Timeline:()=>Q,TrackEntry:()=>_t,TransformConstraint:()=>Rt,TransformConstraintData:()=>bt,TransformConstraintTimeline:()=>nt,TransformMode:()=>ee,TranslateTimeline:()=>Oe,TranslateXTimeline:()=>We,TranslateYTimeline:()=>ze,Triangulator:()=>ne,Utils:()=>P,Vector2:()=>Bt,VertexAttachment:()=>K,WindowedMean:()=>yr});var br=class{constructor(){this.array=new Array}add(e){let r=this.contains(e);return this.array[e|0]=e|0,!r}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Ne=class{constructor(){this.entries={};this.size=0}add(e){let r=this.entries[e];return this.entries[e]=!0,r?!1:(this.size++,!0)}addAll(e){let r=this.size;for(var t=0,a=e.length;t1&&(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(e,r){e.r=((r&4278190080)>>>24)/255,e.g=((r&16711680)>>>16)/255,e.b=((r&65280)>>>8)/255,e.a=(r&255)/255}static rgb888ToColor(e,r){e.r=((r&16711680)>>>16)/255,e.g=((r&65280)>>>8)/255,e.b=(r&255)/255}static fromString(e){return new Me().setFromString(e)}},R=Me;R.WHITE=new Me(1,1,1,1),R.RED=new Me(1,0,0,1),R.GREEN=new Me(0,1,0,1),R.BLUE=new Me(0,0,1,1),R.MAGENTA=new Me(1,0,1,1);var xe=class{static clamp(e,r,t){return et?t:e}static cosDeg(e){return Math.cos(e*xe.degRad)}static sinDeg(e){return Math.sin(e*xe.degRad)}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let r=Math.pow(Math.abs(e),1/3);return e<0?-r:r}static randomTriangular(e,r){return xe.randomTriangularWith(e,r,(e+r)*.5)}static randomTriangularWith(e,r,t){let a=Math.random(),i=r-e;return a<=(t-e)/i?e+Math.sqrt(a*i*(t-e)):r-Math.sqrt((1-a)*i*(r-t))}static isPowerOfTwo(e){return e&&(e&e-1)==0}},M=xe;M.PI=3.1415927,M.PI2=xe.PI*2,M.radiansToDegrees=180/xe.PI,M.radDeg=xe.radiansToDegrees,M.degreesToRadians=xe.PI/180,M.degRad=xe.degreesToRadians;var qt=class{apply(e,r,t){return e+(r-e)*this.applyInternal(t)}},Ht=class extends qt{constructor(e){super();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}},Yt=class extends Ht{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Pe=class{static arrayCopy(e,r,t,a,i){for(let m=r,s=a;m=r?e:Pe.setArraySize(e,r,t)}static newArray(e,r){let t=new Array(e);for(let a=0;a0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let r=0;rthis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},yr=class{constructor(e=32){this.addedValues=0;this.lastValue=0;this.mean=0;this.dirty=!0;this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let r=0;r>1)*m;let s=e.bone.skeleton,n=e.deform,l=this.vertices,o=this.bones;if(!o){n.length>0&&(l=n);let d=e.bone,f=d.worldX,b=d.worldY,y=d.a,A=d.b,g=d.c,p=d.d;for(let x=r,w=i;w0&&(r%=this.duration));let l=this.timelines;for(let o=0,h=l.length;or)return a-1;return t-1}static search(e,r,t){let a=e.length;for(let i=t;ir)return i-t;return a-t}},me=class extends Q{constructor(e,r,t){super(e,t);this.curves=P.newFloatArray(e+r*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let r=this.getFrameCount()+e*18;if(this.curves.length>r){let t=P.newFloatArray(r);P.arrayCopy(this.curves,0,t,0,r),this.curves=t}}setBezier(e,r,t,a,i,m,s,n,l,o,h){let c=this.curves,u=this.getFrameCount()+e*18;t==0&&(c[r]=2+u);let d=(a-m*2+n)*.03,f=(i-s*2+l)*.03,b=((m-n)*3-a+o)*.006,y=((s-l)*3-i+h)*.006,A=d*2+b,g=f*2+y,p=(m-a)*.3+d+b*.16666667,x=(s-i)*.3+f+y*.16666667,w=a+p,k=i+x;for(let v=u+18;ue){let l=this.frames[r],o=this.frames[r+t];return o+(e-l)/(i[a]-l)*(i[a+1]-o)}let m=a+18;for(a+=2;a=e){let l=i[a-2],o=i[a-1];return o+(e-l)/(i[a]-l)*(i[a+1]-o)}r+=this.getFrameEntries();let s=i[m-2],n=i[m-1];return n+(e-s)/(this.frames[r]-s)*(this.frames[r+t]-n)}},ce=class extends me{constructor(e,r,t){super(e,r,[t])}getFrameEntries(){return 2}setFrame(e,r,t){e<<=1,this.frames[e]=r,this.frames[e+1]=t}getCurveValue(e){let r=this.frames,t=r.length-2;for(let i=2;i<=t;i+=2)if(r[i]>e){t=i-2;break}let a=this.curves[t>>1];switch(a){case 0:let i=r[t],m=r[t+1];return m+(e-i)/(r[t+2]-i)*(r[t+2+1]-m);case 1:return r[t+1]}return this.getBezierValue(e,t,1,a-2)}},yt=class extends me{constructor(e,r,t,a){super(e,r,[t,a])}getFrameEntries(){return 3}setFrame(e,r,t,a){e*=3,this.frames[e]=r,this.frames[e+1]=t,this.frames[e+2]=a}},ke=class extends ce{constructor(e,r,t){super(e,r,_.rotate+"|"+t);this.boneIndex=0;this.boneIndex=t}apply(e,r,t,a,i,m,s){let n=e.bones[this.boneIndex];if(!n.active)return;let l=this.frames;if(t>2];switch(f){case 0:let b=l[d];h=l[d+1],c=l[d+2],u=l[d+3];let y=(t-b)/(l[d+4]-b);h+=(l[d+4+1]-h)*y,c+=(l[d+4+2]-c)*y,u+=(l[d+4+3]-u)*y;break;case 1:h=l[d+1],c=l[d+2],u=l[d+3];break;default:h=this.getBezierValue(t,d,1,f-2),c=this.getBezierValue(t,d,2,f+18-2),u=this.getBezierValue(t,d,3,f+18*2-2)}if(i==1)o.r=h,o.g=c,o.b=u;else{if(m==0){let b=n.data.color;o.r=b.r,o.g=b.g,o.b=b.b}o.r+=(h-o.r)*i,o.g+=(c-o.g)*i,o.b+=(u-o.b)*i}}},Ze=class extends ce{constructor(e,r,t){super(e,r,_.alpha+"|"+t);this.slotIndex=0;this.slotIndex=t}apply(e,r,t,a,i,m,s){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let l=n.color;if(t>3];switch(p){case 0:let x=l[g];c=l[g+1],u=l[g+2],d=l[g+3],f=l[g+4],b=l[g+5],y=l[g+6],A=l[g+7];let w=(t-x)/(l[g+8]-x);c+=(l[g+8+1]-c)*w,u+=(l[g+8+2]-u)*w,d+=(l[g+8+3]-d)*w,f+=(l[g+8+4]-f)*w,b+=(l[g+8+5]-b)*w,y+=(l[g+8+6]-y)*w,A+=(l[g+8+7]-A)*w;break;case 1:c=l[g+1],u=l[g+2],d=l[g+3],f=l[g+4],b=l[g+5],y=l[g+6],A=l[g+7];break;default:c=this.getBezierValue(t,g,1,p-2),u=this.getBezierValue(t,g,2,p+18-2),d=this.getBezierValue(t,g,3,p+18*2-2),f=this.getBezierValue(t,g,4,p+18*3-2),b=this.getBezierValue(t,g,5,p+18*4-2),y=this.getBezierValue(t,g,6,p+18*5-2),A=this.getBezierValue(t,g,7,p+18*6-2)}if(i==1)o.set(c,u,d,f),h.r=b,h.g=y,h.b=A;else{if(m==0){o.setFromColor(n.data.color);let x=n.data.darkColor;h.r=x.r,h.g=x.g,h.b=x.b}o.add((c-o.r)*i,(u-o.g)*i,(d-o.b)*i,(f-o.a)*i),h.r+=(b-h.r)*i,h.g+=(y-h.g)*i,h.b+=(A-h.b)*i}}},et=class extends me{constructor(e,r,t){super(e,r,[_.rgb+"|"+t,_.rgb2+"|"+t]);this.slotIndex=0;this.slotIndex=t}getFrameEntries(){return 7}setFrame(e,r,t,a,i,m,s,n){e*=7,this.frames[e]=r,this.frames[e+1]=t,this.frames[e+2]=a,this.frames[e+3]=i,this.frames[e+4]=m,this.frames[e+5]=s,this.frames[e+6]=n}apply(e,r,t,a,i,m,s){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let l=this.frames,o=n.color,h=n.darkColor;if(te){let n=this.frames[r];return t[a+1]*(e-n)/(t[a]-n)}let i=a+18;for(a+=2;a=e){let n=t[a-2],l=t[a-1];return l+(e-n)/(t[a]-n)*(t[a+1]-l)}let m=t[i-2],s=t[i-1];return s+(1-s)*(e-m)/(this.frames[r+this.getFrameEntries()]-m)}apply(e,r,t,a,i,m,s){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let l=n.getAttachment();if(!(l instanceof K)||l.deformAttachment!=this.attachment)return;let o=n.deform;o.length==0&&(m=0);let h=this.vertices,c=h[0].length,u=this.frames;if(t=u[u.length-1]){let g=h[u.length-1];if(i==1)if(m==3){let p=l;if(p.bones)for(let x=0;xt)this.apply(e,r,Number.MAX_VALUE,a,i,m,s),r=-1;else if(r>=n[l-1])return;if(t0&&n[o-1]==h;)o--}for(;o=n[o];o++)a.push(this.events[o])}},ve=jt;ve.propertyIds=[""+_.event];var $t=class extends Q{constructor(e){super(e,$t.propertyIds);this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,r,t){this.frames[e]=r,this.drawOrders[e]=t}apply(e,r,t,a,i,m,s){if(s==1){m==0&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(t>2];switch(d){case 0:let f=l[u];o=l[u+1],h=l[u+2],c=l[u+3];let b=(t-f)/(l[u+4]-f);o+=(l[u+4+1]-o)*b,h+=(l[u+4+2]-h)*b,c+=(l[u+4+3]-c)*b;break;case 1:o=l[u+1],h=l[u+2],c=l[u+3];break;default:o=this.getBezierValue(t,u,1,d-2),h=this.getBezierValue(t,u,2,d+18-2),c=this.getBezierValue(t,u,3,d+18*2-2)}if(m==0){let f=n.data;n.mixRotate=f.mixRotate+(o-f.mixRotate)*i,n.mixX=f.mixX+(h-f.mixX)*i,n.mixY=f.mixY+(c-f.mixY)*i}else n.mixRotate+=(o-n.mixRotate)*i,n.mixX+=(h-n.mixX)*i,n.mixY+=(c-n.mixY)*i}};var At=class{constructor(e){this.tracks=new Array;this.timeScale=1;this.unkeyedState=0;this.events=new Array;this.listeners=new Array;this.queue=new Jt(this);this.propertyIDs=new Ne;this.animationsChanged=!1;this.trackEntryPool=new we(()=>new _t);this.data=e}static emptyAnimation(){return er||(er=new Ye("",[],0)),er}update(e){e*=this.timeScale;let r=this.tracks;for(let t=0,a=r.length;t0){if(i.delay-=m,i.delay>0)continue;m=-i.delay,i.delay=0}let s=i.next;if(s){let n=i.trackLast-s.delay;if(n>=0){for(s.delay=0,s.trackTime+=i.timeScale==0?0:(n/i.timeScale+e)*s.timeScale,i.trackTime+=m,this.setCurrent(t,s,!0);s.mixingFrom;)s.mixTime+=e,s=s.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){r[t]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,e)){let n=i.mixingFrom;for(i.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}i.trackTime+=m}this.queue.drain()}updateMixingFrom(e,r){let t=e.mixingFrom;if(!t)return!0;let a=this.updateMixingFrom(t,r);return t.animationLast=t.nextAnimationLast,t.trackLast=t.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((t.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=t.mixingFrom,t.mixingFrom&&(t.mixingFrom.mixingTo=e),e.interruptAlpha=t.interruptAlpha,this.queue.end(t)),a):(t.trackTime+=r*t.timeScale,e.mixTime+=r,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let r=this.events,t=this.tracks,a=!1;for(let c=0,u=t.length;c0)continue;a=!0;let f=c==0?S.first:d.mixBlend,b=d.alpha;d.mixingFrom?b*=this.applyMixingFrom(d,e,f):d.trackTime>=d.trackEnd&&!d.next&&(b=0);let y=d.animationLast,A=d.getAnimationTime(),g=A,p=r;d.reverse&&(g=d.animation.duration-g,p=null);let x=d.animation.timelines,w=x.length;if(c==0&&b==1||f==S.add)for(let k=0;k1&&(i=1),t!=S.first&&(t=a.mixBlend));let m=i0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i}applyAttachmentTimeline(e,r,t,a,i){var m=r.slots[e.slotIndex];!m.bone.active||(t0,A=f>=0;M.signum(b)!=M.signum(d)&&Math.abs(b)<=90&&(Math.abs(f)>180&&(f+=360*M.signum(f)),A=y),u=d+f-f%360,A!=y&&(u+=360*M.signum(f)),m[s]=u}m[s+1]=d,l.rotation=h+u*a}queueEvents(e,r){let t=e.animationStart,a=e.animationEnd,i=a-t,m=e.trackLast%i,s=this.events,n=0,l=s.length;for(;na||this.queue.event(e,h)}let o=!1;for(e.loop?o=i==0||m>e.trackTime%i:o=r>=a&&e.animationLast=this.tracks.length)return;let r=this.tracks[e];if(!r)return;this.queue.end(r),this.clearNext(r);let t=r;for(;;){let a=t.mixingFrom;if(!a)break;this.queue.end(a),t.mixingFrom=null,t.mixingTo=null,t=a}this.tracks[r.trackIndex]=null,this.queue.drain()}setCurrent(e,r,t){let a=this.expandToIndex(e);this.tracks[e]=r,r.previous=null,a&&(t&&this.queue.interrupt(a),r.mixingFrom=a,a.mixingTo=r,r.mixTime=0,a.mixingFrom&&a.mixDuration>0&&(r.interruptAlpha*=Math.min(1,a.mixTime/a.mixDuration)),a.timelinesRotation.length=0),this.queue.start(r)}setAnimation(e,r,t=!1){let a=this.data.skeletonData.findAnimation(r);if(!a)throw new Error("Animation not found: "+r);return this.setAnimationWith(e,a,t)}setAnimationWith(e,r,t=!1){if(!r)throw new Error("animation cannot be null.");let a=!0,i=this.expandToIndex(e);i&&(i.nextTrackLast==-1?(this.tracks[e]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,a=!1):this.clearNext(i));let m=this.trackEntry(e,r,t,i);return this.setCurrent(e,m,a),this.queue.drain(),m}addAnimation(e,r,t=!1,a=0){let i=this.data.skeletonData.findAnimation(r);if(!i)throw new Error("Animation not found: "+r);return this.addAnimationWith(e,i,t,a)}addAnimationWith(e,r,t=!1,a=0){if(!r)throw new Error("animation cannot be null.");let i=this.expandToIndex(e);if(i)for(;i.next;)i=i.next;let m=this.trackEntry(e,r,t,i);return i?(i.next=m,m.previous=i,a<=0&&(a+=i.getTrackComplete()-m.mixDuration)):(this.setCurrent(e,m,!0),this.queue.drain()),m.delay=a,m}setEmptyAnimation(e,r=0){let t=this.setAnimationWith(e,At.emptyAnimation(),!1);return t.mixDuration=r,t.trackEnd=r,t}addEmptyAnimation(e,r=0,t=0){let a=this.addAnimationWith(e,At.emptyAnimation(),!1,t);return t<=0&&(a.delay+=a.mixDuration-r),a.mixDuration=r,a.trackEnd=r,a}setEmptyAnimations(e=0){let r=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,a=this.tracks.length;t0){i[n]=wr,m[n]=h;continue e}break}i[n]=Ft}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let r=this.listeners.indexOf(e);r>=0&&this.listeners.splice(r,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},_t=class{constructor(){this.mixBlend=S.replace;this.timelineMode=new Array;this.timelineHoldMix=new Array;this.timelinesRotation=new Array}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime{a.width=parseInt(t[1]),a.height=parseInt(t[2])},m.format=()=>{},m.filter=()=>{a.minFilter=P.enumValue(Xe,t[1]),a.magFilter=P.enumValue(Xe,t[2])},m.repeat=()=>{t[1].indexOf("x")!=-1&&(a.uWrap=Fe.Repeat),t[1].indexOf("y")!=-1&&(a.vWrap=Fe.Repeat)},m.pma=()=>{a.pma=t[1]=="true"};var s={};s.xy=()=>{i.x=parseInt(t[1]),i.y=parseInt(t[2])},s.size=()=>{i.width=parseInt(t[1]),i.height=parseInt(t[2])},s.bounds=()=>{i.x=parseInt(t[1]),i.y=parseInt(t[2]),i.width=parseInt(t[3]),i.height=parseInt(t[4])},s.offset=()=>{i.offsetX=parseInt(t[1]),i.offsetY=parseInt(t[2])},s.orig=()=>{i.originalWidth=parseInt(t[1]),i.originalHeight=parseInt(t[2])},s.offsets=()=>{i.offsetX=parseInt(t[1]),i.offsetY=parseInt(t[2]),i.originalWidth=parseInt(t[3]),i.originalHeight=parseInt(t[4])},s.rotate=()=>{let h=t[1];h=="true"?i.degrees=90:h!="false"&&(i.degrees=parseInt(h))},s.index=()=>{i.index=parseInt(t[1])};let n=r.readLine();for(;n&&n.trim().length==0;)n=r.readLine();for(;!(!n||n.trim().length==0||r.readEntry(t,n)==0);)n=r.readLine();let l=null,o=null;for(;n!==null;)if(n.trim().length==0)a=null,n=r.readLine();else if(a){for(i=new kt,i.page=a,i.name=n;;){let h=r.readEntry(t,n=r.readLine());if(h==0)break;let c=s[t[0]];if(c)c();else{l||(l=[],o=[]),l.push(t[0]);let u=[];for(let d=0;d0&&(i.names=l,i.values=o,l=null,o=null),i.u=i.x/a.width,i.v=i.y/a.height,i.degrees==90?(i.u2=(i.x+i.height)/a.width,i.v2=(i.y+i.width)/a.height):(i.u2=(i.x+i.width)/a.width,i.v2=(i.y+i.height)/a.height),this.regions.push(i)}else{for(a=new tr,a.name=n.trim();r.readEntry(t,n=r.readLine())!=0;){let h=m[t[0]];h&&h()}this.pages.push(a)}}findRegion(e){for(let r=0;r=this.lines.length?null:this.lines[this.index++]}readEntry(e,r){if(!r||(r=r.trim(),r.length==0))return 0;let t=r.indexOf(":");if(t==-1)return 0;e[0]=r.substr(0,t).trim();for(let a=1,i=t+1;;a++){let m=r.indexOf(",",i);if(m==-1)return e[a]=r.substr(i).trim(),a;if(e[a]=r.substr(i,m-i).trim(),i=m+1,a==4)return 4}}},tr=class{constructor(){this.minFilter=Xe.Nearest;this.magFilter=Xe.Nearest;this.uWrap=Fe.ClampToEdge;this.vWrap=Fe.ClampToEdge}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap)}},kt=class extends Dt{};var se=class extends K{constructor(e){super(e);this.color=new R(1,1,1,1);this.tempColor=new R(0,0,0,0)}updateUVs(){let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=P.newFloatArray(e.length));let r=this.uvs,t=this.uvs.length,a=this.region.u,i=this.region.v,m=0,s=0;if(this.region instanceof kt){let n=this.region,l=n.page.texture.getImage(),o=l.width,h=l.height;switch(n.degrees){case 90:a-=(n.originalHeight-n.offsetY-n.height)/o,i-=(n.originalWidth-n.offsetX-n.width)/h,m=n.originalHeight/o,s=n.originalWidth/h;for(let c=0;c= 0.");if(!r)throw new Error("name cannot be null.");this.index=e,this.name=r,this.parent=t}},ee;(function(i){i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection"})(ee||(ee={}));var vt=class{constructor(e,r,t){this.children=new Array;this.x=0;this.y=0;this.rotation=0;this.scaleX=0;this.scaleY=0;this.shearX=0;this.shearY=0;this.ax=0;this.ay=0;this.arotation=0;this.ascaleX=0;this.ascaleY=0;this.ashearX=0;this.ashearY=0;this.a=0;this.b=0;this.c=0;this.d=0;this.worldY=0;this.worldX=0;this.sorted=!1;this.active=!1;if(!e)throw new Error("data cannot be null.");if(!r)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=r,this.parent=t,this.setToSetupPose()}isActive(){return this.active}update(){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(e,r,t,a,i,m,s){this.ax=e,this.ay=r,this.arotation=t,this.ascaleX=a,this.ascaleY=i,this.ashearX=m,this.ashearY=s;let n=this.parent;if(!n){let u=this.skeleton,d=t+90+s,f=u.scaleX,b=u.scaleY;this.a=M.cosDeg(t+m)*a*f,this.b=M.cosDeg(d)*i*f,this.c=M.sinDeg(t+m)*a*b,this.d=M.sinDeg(d)*i*b,this.worldX=e*f+u.x,this.worldY=r*b+u.y;return}let l=n.a,o=n.b,h=n.c,c=n.d;switch(this.worldX=l*e+o*r+n.worldX,this.worldY=h*e+c*r+n.worldY,this.data.transformMode){case ee.Normal:{let u=t+90+s,d=M.cosDeg(t+m)*a,f=M.cosDeg(u)*i,b=M.sinDeg(t+m)*a,y=M.sinDeg(u)*i;this.a=l*d+o*b,this.b=l*f+o*y,this.c=h*d+c*b,this.d=h*f+c*y;return}case ee.OnlyTranslation:{let u=t+90+s;this.a=M.cosDeg(t+m)*a,this.b=M.cosDeg(u)*i,this.c=M.sinDeg(t+m)*a,this.d=M.sinDeg(u)*i;break}case ee.NoRotationOrReflection:{let u=l*l+h*h,d=0;u>1e-4?(u=Math.abs(l*c-o*h)/u,l/=this.skeleton.scaleX,h/=this.skeleton.scaleY,o=h*u,c=l*u,d=Math.atan2(h,l)*M.radDeg):(l=0,h=0,d=90-Math.atan2(c,o)*M.radDeg);let f=t+m-d,b=t+s-d+90,y=M.cosDeg(f)*a,A=M.cosDeg(b)*i,g=M.sinDeg(f)*a,p=M.sinDeg(b)*i;this.a=l*y-o*g,this.b=l*A-o*p,this.c=h*y+c*g,this.d=h*A+c*p;break}case ee.NoScale:case ee.NoScaleOrReflection:{let u=M.cosDeg(t),d=M.sinDeg(t),f=(l*u+o*d)/this.skeleton.scaleX,b=(h*u+c*d)/this.skeleton.scaleY,y=Math.sqrt(f*f+b*b);y>1e-5&&(y=1/y),f*=y,b*=y,y=Math.sqrt(f*f+b*b),this.data.transformMode==ee.NoScale&&l*c-o*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(y=-y);let A=Math.PI/2+Math.atan2(b,f),g=Math.cos(A)*y,p=Math.sin(A)*y,x=M.cosDeg(m)*a,w=M.cosDeg(90+s)*i,k=M.sinDeg(m)*a,v=M.sinDeg(90+s)*i;this.a=f*x+g*k,this.b=f*w+g*v,this.c=b*x+p*k,this.d=b*w+p*v;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY}getWorldRotationX(){return Math.atan2(this.c,this.a)*M.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*M.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)}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*M.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)*M.radDeg;return}let r=e.a,t=e.b,a=e.c,i=e.d,m=1/(r*i-t*a),s=this.worldX-e.worldX,n=this.worldY-e.worldY;this.ax=s*i*m-n*t*m,this.ay=n*r*m-s*a*m;let l=m*i,o=m*r,h=m*t,c=m*a,u=l*this.a-h*this.c,d=l*this.b-h*this.d,f=o*this.c-c*this.a,b=o*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){let y=u*b-d*f;this.ascaleY=y/this.ascaleX,this.ashearY=Math.atan2(u*d+f*b,y)*M.radDeg,this.arotation=Math.atan2(f,u)*M.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+b*b),this.ashearY=0,this.arotation=90-Math.atan2(b,d)*M.radDeg}worldToLocal(e){let r=1/(this.a*this.d-this.b*this.c),t=e.x-this.worldX,a=e.y-this.worldY;return e.x=t*this.d*r-a*this.b*r,e.y=a*this.a*r-t*this.c*r,e}localToWorld(e){let r=e.x,t=e.y;return e.x=r*this.a+t*this.b+this.worldX,e.y=r*this.c+t*this.d+this.worldY,e}worldToLocalRotation(e){let r=M.sinDeg(e),t=M.cosDeg(e);return Math.atan2(this.a*r-this.c*t,this.d*t-this.b*r)*M.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let r=M.sinDeg(e),t=M.cosDeg(e);return Math.atan2(t*this.c+r*this.d,t*this.a+r*this.b)*M.radDeg}rotateWorld(e){let r=this.a,t=this.b,a=this.c,i=this.d,m=M.cosDeg(e),s=M.sinDeg(e);this.a=m*r-s*a,this.b=m*t-s*i,this.c=s*r+m*a,this.d=s*t+m*i}};var De=class{constructor(e,r,t){this.name=e;this.order=r;this.skinRequired=t}};var Pt=class{constructor(e,r="",t=null){this.assets={};this.errors={};this.toLoad=0;this.loaded=0;this.textureLoader=e,this.pathPrefix=r,this.downloader=t||new nr}start(e){return this.toLoad++,this.pathPrefix+e}success(e,r,t){this.toLoad--,this.loaded++,this.assets[r]=t,e&&e(r,t)}error(e,r,t){this.toLoad--,this.loaded++,this.errors[r]=t,e&&e(r,t)}setRawDataURI(e,r){this.downloader.rawDataUris[this.pathPrefix+e]=r}loadBinary(e,r=null,t=null){e=this.start(e),this.downloader.downloadBinary(e,a=>{this.success(r,e,a)},(a,i)=>{this.error(t,e,`Couldn't load binary ${e}: status ${a}, ${i}`)})}loadText(e,r=null,t=null){e=this.start(e),this.downloader.downloadText(e,a=>{this.success(r,e,a)},(a,i)=>{this.error(t,e,`Couldn't load text ${e}: status ${a}, ${i}`)})}loadJson(e,r=null,t=null){e=this.start(e),this.downloader.downloadJson(e,a=>{this.success(r,e,a)},(a,i)=>{this.error(t,e,`Couldn't load JSON ${e}: status ${a}, ${i}`)})}loadTexture(e,r=null,t=null){if(e=this.start(e),!!!(typeof window!="undefined"&&typeof navigator!="undefined"&&window.document))fetch(e,{mode:"cors"}).then(m=>m.ok?m.blob():(this.error(t,e,`Couldn't load image: ${e}`),null)).then(m=>m?createImageBitmap(m,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(m=>{m&&this.success(r,e,this.textureLoader(m))});else{let m=new Image;m.crossOrigin="anonymous",m.onload=()=>{this.success(r,e,this.textureLoader(m))},m.onerror=()=>{this.error(t,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),m.src=e}}loadTextureAtlas(e,r=null,t=null){let a=e.lastIndexOf("/"),i=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,m=>{try{let s=new Et(m),n=s.pages.length,l=!1;for(let o of s.pages)this.loadTexture(i+o.name,(h,c)=>{l||(o.setTexture(c),--n==0&&this.success(r,e,s))},(h,c)=>{l||this.error(t,e,`Couldn't load texture atlas ${e} page image: ${h}`),l=!0})}catch(s){this.error(t,e,`Couldn't parse texture atlas ${e}: ${s.message}`)}},(m,s)=>{this.error(t,e,`Couldn't load texture atlas ${e}: status ${m}, ${s}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let r=this.assets[e];if(r)return r;let t=this.errors[e];throw Error("Asset not found: "+e+(t?` `+t:""))}remove(e){e=this.pathPrefix+e;let r=this.assets[e];return r.dispose&&r.dispose(),delete this.assets[e],r}removeAll(){for(let e in this.assets){let r=this.assets[e];r.dispose&&r.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},nr=class{constructor(){this.callbacks={};this.rawDataUris={}}downloadText(e,r,t){if(this.rawDataUris[e]&&(e=this.rawDataUris[e]),this.start(e,r,t))return;let a=new XMLHttpRequest;a.overrideMimeType("text/html"),a.open("GET",e,!0);let i=()=>{this.finish(e,a.status,a.responseText)};a.onload=i,a.onerror=i,a.send()}downloadJson(e,r,t){this.downloadText(e,a=>{r(JSON.parse(a))},t)}downloadBinary(e,r,t){if(this.rawDataUris[e]&&(e=this.rawDataUris[e]),this.start(e,r,t))return;let a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer";let i=()=>{this.finish(e,a.status,a.responseText)};a.onload=()=>{a.status==200?this.finish(e,200,new Uint8Array(a.response)):i()},a.onerror=i,a.send()}start(e,r,t){let a=this.callbacks[e];try{if(a)return!0;this.callbacks[e]=a=[]}finally{a.push(r,t)}}finish(e,r,t){let a=this.callbacks[e];delete this.callbacks[e];let i=r==200?[t]:[r,t];for(let m=i.length-1,s=a.length;m180?u-=360:u<-180&&(u+=360);let b=e.ascaleX,y=e.ascaleY;if(a||i){switch(e.data.transformMode){case ee.NoScale:case ee.NoScaleOrReflection:d=r-e.worldX,f=t-e.worldY}let A=e.data.length*b,g=Math.sqrt(d*d+f*f);if(a&&gA&&A>1e-4){let p=(g/A-1)*s+1;b*=p,m&&(y*=p)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+u*s,b,y,e.ashearX,e.ashearY)}apply2(e,r,t,a,i,m,s,n,l){let o=e.ax,h=e.ay,c=e.ascaleX,u=e.ascaleY,d=c,f=u,b=r.ascaleX,y=0,A=0,g=0;c<0?(c=-c,y=180,g=-1):(y=0,g=1),u<0&&(u=-u,g=-g),b<0?(b=-b,A=180):A=0;let p=r.ax,x=0,w=0,k=0,v=e.a,B=e.b,I=e.c,D=e.d,L=Math.abs(c-u)<=1e-4;!L||m?(x=0,w=v*p+e.worldX,k=I*p+e.worldY):(x=r.ay,w=v*p+B*x+e.worldX,k=I*p+D*x+e.worldY);let E=e.parent;v=E.a,B=E.b,I=E.c,D=E.d;let F=1/(v*D-B*I),T=w-E.worldX,X=k-E.worldY,W=(T*D-X*B)*F-o,H=(X*v-T*I)*F-h,U=Math.sqrt(W*W+H*H),G=r.data.length*b,J,j;if(U<1e-4){this.apply1(e,t,a,!1,m,!1,l),r.updateWorldTransformWith(p,x,0,r.ascaleX,r.ascaleY,r.ashearX,r.ashearY);return}T=t-E.worldX,X=a-E.worldY;let O=(T*D-X*B)*F-o,N=(X*v-T*I)*F-h,$=O*O+N*N;if(n!=0){n*=c*(b+1)*.5;let te=Math.sqrt($),le=te-U-G*c+n;if(le>0){let he=Math.min(1,le/(n*2))-1;he=(le-n*(1-he*he))/te,O-=he*O,N-=he*N,$=O*O+N*N}}e:if(L){G*=c;let te=($-U*U-G*G)/(2*U*G);te<-1?(te=-1,j=Math.PI*i):te>1?(te=1,j=0,m&&(v=(Math.sqrt($)/(U+G)-1)*l+1,d*=v,s&&(f*=v))):j=Math.acos(te)*i,v=U+G*te,B=G*Math.sin(j),J=Math.atan2(N*v-O*B,O*v+N*B)}else{v=c*G,B=u*G;let te=v*v,le=B*B,he=Math.atan2(N,O);I=le*U*U+te*$-te*le;let Ie=-2*le*U,Ve=le-te;if(D=Ie*Ie-4*Ve*I,D>=0){let Re=Math.sqrt(D);Ie<0&&(Re=-Re),Re=-(Ie+Re)*.5;let dr=Re/Ve,fr=I/Re,Ue=Math.abs(dr)=-1&&I<=1&&(I=Math.acos(I),T=v*Math.cos(I)+U,X=B*Math.sin(I),D=T*T+X*X,Dzt&&(cr=I,zt=D,Mt=T,ur=X)),$<=(Wt+zt)*.5?(J=he-Math.atan2(mr*i,It),j=pt*i):(J=he-Math.atan2(ur*i,Mt),j=cr*i)}let ie=Math.atan2(x,p)*g,ue=e.arotation;J=(J-ie)*M.radDeg+y-ue,J>180?J-=360:J<-180&&(J+=360),e.updateWorldTransformWith(o,h,ue+J*l,d,f,0,0),ue=r.arotation,j=((j+ie)*M.radDeg-r.ashearX)*g+A-ue,j>180?j-=360:j<-180&&(j+=360),r.updateWorldTransformWith(p,x,ue+j*l,r.ascaleX,r.ascaleY,r.ashearX,r.ashearY)}};var ut=class extends De{constructor(e){super(e,0,!1);this.bones=new Array;this.bendDirection=1;this.compress=!1;this.stretch=!1;this.uniform=!1;this.mix=1;this.softness=0}};var dt=class extends De{constructor(e){super(e,0,!1);this.bones=new Array;this.mixRotate=0;this.mixX=0;this.mixY=0}},oe;(function(r){r[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent"})(oe||(oe={}));var Z;(function(a){a[a.Length=0]="Length",a[a.Fixed=1]="Fixed",a[a.Percent=2]="Percent",a[a.Proportional=3]="Proportional"})(Z||(Z={}));var Se;(function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"})(Se||(Se={}));var ye=class{constructor(e,r){this.position=0;this.spacing=0;this.mixRotate=0;this.mixX=0;this.mixY=0;this.spaces=new Array;this.positions=new Array;this.world=new Array;this.curves=new Array;this.lengths=new Array;this.segments=new Array;this.active=!1;if(!e)throw new Error("data cannot be null.");if(!r)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let t=0,a=e.bones.length;t0){g=o/g*u;for(let x=1;x0?M.degRad:-M.degRad}for(let g=0,p=3;g0){let I=x.a,D=x.b,L=x.c,E=x.d,F=0,T=0,X=0;if(m?F=d[p-1]:h[g+1]==0?F=d[p+2]:F=Math.atan2(B,v),F-=Math.atan2(L,I),A){T=Math.cos(F),X=Math.sin(F);let W=x.data.length;f+=(W*(T*I-X*L)-v)*r,b+=(W*(X*I+T*L)-B)*r}else F+=y;F>M.PI?F-=M.PI2:F<-M.PI&&(F+=M.PI2),F*=r,T=Math.cos(F),X=Math.sin(F),x.a=T*I-X*L,x.b=T*D-X*E,x.c=X*I+T*L,x.d=X*D+T*E}x.updateAppliedTransform()}}computeWorldPositions(e,r,t){let a=this.target,i=this.position,m=this.spaces,s=P.setArraySize(this.positions,r*3+2),n=null,l=e.closed,o=e.worldVerticesLength,h=o/6,c=ye.NONE;if(!e.constantSpeed){let H=e.lengths;h-=l?1:2;let U=H[h];this.data.positionMode==oe.Percent&&(i*=U);let G;switch(this.data.spacingMode){case Z.Percent:G=U;break;case Z.Proportional:G=U/r;break;default:G=1}n=P.setArraySize(this.world,8);for(let J=0,j=0,O=0;JU){c!=ye.AFTER&&(c=ye.AFTER,e.computeWorldVertices(a,o-6,4,n,0,2)),this.addAfterPosition($-U,n,0,s,j);continue}for(;;O++){let ie=H[O];if(!($>ie)){if(O==0)$/=ie;else{let ue=H[O-1];$=($-ue)/(ie-ue)}break}}O!=c&&(c=O,l&&O==h?(e.computeWorldVertices(a,o-4,4,n,0,2),e.computeWorldVertices(a,0,4,n,4,2)):e.computeWorldVertices(a,O*6+2,8,n,0,2)),this.addCurvePosition($,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],s,j,t||J>0&&N==0)}return s}l?(o+=2,n=P.setArraySize(this.world,o),e.computeWorldVertices(a,2,o-4,n,0,2),e.computeWorldVertices(a,0,2,n,o-4,2),n[o-2]=n[0],n[o-1]=n[1]):(h--,o-=4,n=P.setArraySize(this.world,o),e.computeWorldVertices(a,2,o,n,0,2));let u=P.setArraySize(this.curves,h),d=0,f=n[0],b=n[1],y=0,A=0,g=0,p=0,x=0,w=0,k=0,v=0,B=0,I=0,D=0,L=0,E=0,F=0;for(let H=0,U=2;Hd){this.addAfterPosition(O-d,n,o-4,s,U);continue}for(;;G++){let N=u[G];if(!(O>N)){if(G==0)O/=N;else{let $=u[G-1];O=(O-$)/(N-$)}break}}if(G!=c){c=G;let N=G*6;for(f=n[N],b=n[N+1],y=n[N+2],A=n[N+3],g=n[N+4],p=n[N+5],x=n[N+6],w=n[N+7],k=(f-y*2+g)*.03,v=(b-A*2+p)*.03,B=((y-g)*3-f+x)*.006,I=((A-p)*3-b+w)*.006,D=k*2+B,L=v*2+I,E=(y-f)*.3+k+B*.16666667,F=(A-b)*.3+v+I*.16666667,W=Math.sqrt(E*E+F*F),X[0]=W,N=1;N<8;N++)E+=D,F+=L,D+=B,L+=I,W+=Math.sqrt(E*E+F*F),X[N]=W;E+=D,F+=L,W+=Math.sqrt(E*E+F*F),X[8]=W,E+=D+B,F+=L+I,W+=Math.sqrt(E*E+F*F),X[9]=W,J=0}for(O*=W;;J++){let N=X[J];if(!(O>N)){if(J==0)O/=N;else{let $=X[J-1];O=J+(O-$)/(N-$)}break}}this.addCurvePosition(O*.1,f,b,y,A,g,p,x,w,s,U,t||H>0&&j==0)}return s}addBeforePosition(e,r,t,a,i){let m=r[t],s=r[t+1],n=r[t+2]-m,l=r[t+3]-s,o=Math.atan2(l,n);a[i]=m+e*Math.cos(o),a[i+1]=s+e*Math.sin(o),a[i+2]=o}addAfterPosition(e,r,t,a,i){let m=r[t+2],s=r[t+3],n=m-r[t],l=s-r[t+1],o=Math.atan2(l,n);a[i]=m+e*Math.cos(o),a[i+1]=s+e*Math.sin(o),a[i+2]=o}addCurvePosition(e,r,t,a,i,m,s,n,l,o,h,c){if(e==0||isNaN(e)){o[h]=r,o[h+1]=t,o[h+2]=Math.atan2(i-t,a-r);return}let u=e*e,d=u*e,f=1-e,b=f*f,y=b*f,A=f*e,g=A*3,p=f*g,x=g*e,w=r*y+a*p+m*x+n*d,k=t*y+i*p+s*x+l*d;o[h]=w,o[h+1]=k,c&&(e<.001?o[h+2]=Math.atan2(i-t,a-r):o[h+2]=Math.atan2(k-(t*b+i*A*2+s*u),w-(r*b+a*A*2+m*u)))}},Ee=ye;Ee.NONE=-1,Ee.BEFORE=-2,Ee.AFTER=-3,Ee.epsilon=1e-5;var Vt=class{constructor(e,r){this.deform=new Array;if(!e)throw new Error("data cannot be null.");if(!r)throw new Error("bone cannot be null.");this.data=e,this.bone=r,this.color=new R,this.darkColor=e.darkColor?new R:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof K)||!(this.attachment instanceof K)||e.deformAttachment!=this.attachment.deformAttachment)&&(this.deform.length=0),this.attachment=e,this.attachmentTime=this.bone.skeleton.time)}setAttachmentTime(e){this.attachmentTime=this.bone.skeleton.time-e}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}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 Rt=class{constructor(e,r){this.mixRotate=0;this.mixX=0;this.mixY=0;this.mixScaleX=0;this.mixScaleY=0;this.mixShearY=0;this.temp=new Bt;this.active=!1;if(!e)throw new Error("data cannot be null.");if(!r)throw new Error("skeleton cannot be null.");this.data=e,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(let t=0;t0?M.degRad:-M.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,b=this.bones;for(let y=0,A=b.length;yM.PI?v-=M.PI2:v<-M.PI&&(v+=M.PI2),v*=e;let B=Math.cos(v),I=Math.sin(v);g.a=B*p-I*w,g.b=B*x-I*k,g.c=I*p+B*w,g.d=I*x+B*k}if(s){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(p.x-g.worldX)*r,g.worldY+=(p.y-g.worldY)*t}if(a!=0){let p=Math.sqrt(g.a*g.a+g.c*g.c);p!=0&&(p=(p+(Math.sqrt(l*l+h*h)-p+this.data.offsetScaleX)*a)/p),g.a*=p,g.c*=p}if(i!=0){let p=Math.sqrt(g.b*g.b+g.d*g.d);p!=0&&(p=(p+(Math.sqrt(o*o+c*c)-p+this.data.offsetScaleY)*i)/p),g.b*=p,g.d*=p}if(m>0){let p=g.b,x=g.d,w=Math.atan2(x,p),k=Math.atan2(c,o)-Math.atan2(h,l)-(w-Math.atan2(g.c,g.a));k>M.PI?k-=M.PI2:k<-M.PI&&(k+=M.PI2),k=w+(k+f)*m;let v=Math.sqrt(p*p+x*x);g.b=Math.cos(k)*v,g.d=Math.sin(k)*v}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,r=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,m=this.mixShearY,s=r!=0||t!=0,n=this.target,l=n.a,o=n.b,h=n.c,c=n.d,u=l*c-o*h>0?M.degRad:-M.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,b=this.bones;for(let y=0,A=b.length;yM.PI?v-=M.PI2:v<-M.PI&&(v+=M.PI2),v*=e;let B=Math.cos(v),I=Math.sin(v);g.a=B*p-I*w,g.b=B*x-I*k,g.c=I*p+B*w,g.d=I*x+B*k}if(s){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),g.worldX+=p.x*r,g.worldY+=p.y*t}if(a!=0){let p=(Math.sqrt(l*l+h*h)-1+this.data.offsetScaleX)*a+1;g.a*=p,g.c*=p}if(i!=0){let p=(Math.sqrt(o*o+c*c)-1+this.data.offsetScaleY)*i+1;g.b*=p,g.d*=p}if(m>0){let p=Math.atan2(c,o)-Math.atan2(h,l);p>M.PI?p-=M.PI2:p<-M.PI&&(p+=M.PI2);let x=g.b,w=g.d;p=Math.atan2(w,x)+(p-M.PI/2+f)*m;let k=Math.sqrt(x*x+w*w);g.b=Math.cos(p)*k,g.d=Math.sin(p)*k}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,r=this.mixX,t=this.mixY,a=this.mixScaleX,i=this.mixScaleY,m=this.mixShearY,s=this.target,n=this.bones;for(let l=0,o=n.length;l=a.length&&(a.length=e+1),a[e]||(a[e]={}),a[e][r]=t}addSkin(e){for(let a=0;a= 0.");if(!r)throw new Error("name cannot be null.");if(!t)throw new Error("boneData cannot be null.");this.index=e,this.name=r,this.boneData=t}},St;(function(a){a[a.Normal=0]="Normal",a[a.Additive=1]="Additive",a[a.Multiply=2]="Multiply",a[a.Screen=3]="Screen"})(St||(St={}));var bt=class extends De{constructor(e){super(e,0,!1);this.bones=new Array;this.mixRotate=0;this.mixX=0;this.mixY=0;this.mixScaleX=0;this.mixScaleY=0;this.mixShearY=0;this.offsetRotation=0;this.offsetX=0;this.offsetY=0;this.offsetScaleX=0;this.offsetScaleY=0;this.offsetShearY=0;this.relative=!1;this.local=!1}};var Mr=class{constructor(e){this.scale=1;this.linkedMeshes=new Array;this.attachmentLoader=e}readSkeletonData(e){let r=this.scale,t=new ft;t.name="";let a=new ir(e),i=a.readInt32(),m=a.readInt32();t.hash=m==0&&i==0?null:m.toString(16)+i.toString(16),t.version=a.readString(),t.x=a.readFloat(),t.y=a.readFloat(),t.width=a.readFloat(),t.height=a.readFloat();let s=a.readBoolean();s&&(t.fps=a.readFloat(),t.imagesPath=a.readString(),t.audioPath=a.readString());let n=0;n=a.readInt(!0);for(let o=0;o0){let h=new fe(n),c=t.slots.length;for(let u=0;u=0;p--)b[p]=-1;let y=P.newArray(c-f,0),A=0,g=0;for(let p=0;p=0;p--)b[p]==-1&&(b[p]=y[--g]);h.setFrame(u,d,b)}a.push(h)}let l=e.readInt(!0);if(l>0){let h=new ve(l);for(let c=0;c>>1^-(t&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let r="",t=0;for(let a=0;a>4){case 12:case 13:r+=String.fromCharCode((i&31)<<6|this.readByte()&63),a+=2;break;case 14:r+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),a+=3;break;default:r+=String.fromCharCode(i),a++}}return r}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Yr=class{constructor(e,r,t,a,i){this.mesh=e,this.skin=r,this.slotIndex=t,this.parent=a,this.inheritDeform=i}},Br=class{constructor(e=null,r=null){this.bones=e;this.vertices=r}},Ce;(function(s){s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping"})(Ce||(Ce={}));function Te(Y,e,r){let t=Y.readFloat(),a=Y.readFloat()*r;for(let i=0,m=0,s=e.getFrameCount()-1;e.setFrame(i,t,a),i!=s;i++){let n=Y.readFloat(),l=Y.readFloat()*r;switch(Y.readByte()){case be:e.setStepped(i);break;case pe:z(Y,e,m++,i,0,t,n,a,l,r)}t=n,a=l}return e}function ar(Y,e,r){let t=Y.readFloat(),a=Y.readFloat()*r,i=Y.readFloat()*r;for(let m=0,s=0,n=e.getFrameCount()-1;e.setFrame(m,t,a,i),m!=n;m++){let l=Y.readFloat(),o=Y.readFloat()*r,h=Y.readFloat()*r;switch(Y.readByte()){case be:e.setStepped(m);break;case pe:z(Y,e,s++,m,0,t,l,a,o,r),z(Y,e,s++,m,1,t,l,i,h,r)}t=l,a=o,i=h}return e}function z(Y,e,r,t,a,i,m,s,n,l){e.setBezier(r,t,a,i,s,Y.readFloat(),Y.readFloat()*l,Y.readFloat(),Y.readFloat()*l,m,n)}var Rr=0,Ur=1,Nr=2,Or=3,Wr=4,zr=5,qr=6,Hr=7,Gr=8,jr=9,$r=0,_r=1,Jr=2,Qr=3,Zr=4,Kr=5,en=0,tn=1,rn=2;var be=1,pe=2;var Xr=class{constructor(){this.minX=0;this.minY=0;this.maxX=0;this.maxY=0;this.boundingBoxes=new Array;this.polygons=new Array;this.polygonPool=new we(()=>P.newFloatArray(16))}update(e,r){if(!e)throw new Error("skeleton cannot be null.");let t=this.boundingBoxes,a=this.polygons,i=this.polygonPool,m=e.slots,s=m.length;t.length=0,i.freeAll(a),a.length=0;for(let n=0;n=this.minX&&e<=this.maxX&&r>=this.minY&&r<=this.maxY}aabbIntersectsSegment(e,r,t,a){let i=this.minX,m=this.minY,s=this.maxX,n=this.maxY;if(e<=i&&t<=i||r<=m&&a<=m||e>=s&&t>=s||r>=n&&a>=n)return!1;let l=(a-r)/(t-e),o=l*(i-e)+r;if(o>m&&om&&oi&&hi&&he.minX&&this.minYe.minY}containsPoint(e,r){let t=this.polygons;for(let a=0,i=t.length;a=t||o=t){let h=a[n];h+(t-l)/(o-l)*(a[m]-h)=h&&p<=d||p>=d&&p<=h)&&(p>=r&&p<=a||p>=a&&p<=r)){let x=(o*A-l*b)/g;if((x>=c&&x<=f||x>=f&&x<=c)&&(x>=t&&x<=i||x>=i&&x<=t))return!0}h=d,c=f}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let r=this.boundingBoxes.indexOf(e);return r==-1?null:this.polygons[r]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}};var ne=class{constructor(){this.convexPolygons=new Array;this.convexPolygonsIndices=new Array;this.indicesArray=new Array;this.isConcaveArray=new Array;this.triangles=new Array;this.polygonPool=new we(()=>new Array);this.polygonIndicesPool=new we(()=>new Array)}triangulate(e){let r=e,t=e.length>>1,a=this.indicesArray;a.length=0;for(let s=0;s3;){let s=t-1,n=0,l=1;for(;;){e:if(!i[n]){let c=a[s]<<1,u=a[n]<<1,d=a[l]<<1,f=r[c],b=r[c+1],y=r[u],A=r[u+1],g=r[d],p=r[d+1];for(let x=(l+1)%t;x!=s;x=(x+1)%t){if(!i[x])continue;let w=a[x]<<1,k=r[w],v=r[w+1];if(ne.positiveArea(g,p,f,b,k,v)&&ne.positiveArea(f,b,y,A,k,v)&&ne.positiveArea(y,A,g,p,k,v))break e}break}if(l==0){do{if(!i[n])break;n--}while(n>0);break}s=n,n=l,l=(l+1)%t}m.push(a[(t+n-1)%t]),m.push(a[n]),m.push(a[(n+1)%t]),a.splice(n,1),i.splice(n,1),t--;let o=(t+n-1)%t,h=n==t?0:n;i[o]=ne.isConcave(o,t,r,a),i[h]=ne.isConcave(h,t,r,a)}return t==3&&(m.push(a[2]),m.push(a[0]),m.push(a[1])),m}decompose(e,r){let t=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let m=this.polygonIndicesPool.obtain();m.length=0;let s=this.polygonPool.obtain();s.length=0;let n=-1,l=0;for(let o=0,h=r.length;o0?(a.push(s),i.push(m)):(this.polygonPool.free(s),this.polygonIndicesPool.free(m)),s=this.polygonPool.obtain(),s.length=0,s.push(f),s.push(b),s.push(y),s.push(A),s.push(g),s.push(p),m=this.polygonIndicesPool.obtain(),m.length=0,m.push(c),m.push(u),m.push(d),l=ne.winding(f,b,y,A,g,p),n=c)}s.length>0&&(a.push(s),i.push(m));for(let o=0,h=a.length;o=0;o--)s=a[o],s.length==0&&(a.splice(o,1),this.polygonPool.free(s),m=i[o],i.splice(o,1),this.polygonIndicesPool.free(m));return a}static isConcave(e,r,t,a){let i=a[(r+e-1)%r]<<1,m=a[e]<<1,s=a[(e+1)%r]<<1;return!this.positiveArea(t[i],t[i+1],t[m],t[m+1],t[s],t[s+1])}static positiveArea(e,r,t,a,i,m){return e*(m-a)+t*(r-m)+i*(a-r)>=0}static winding(e,r,t,a,i,m){let s=t-e,n=a-r;return i*n-m*s+s*r-e*n>=0?1:-1}};var Ct=class{constructor(){this.triangulator=new ne;this.clippingPolygon=new Array;this.clipOutput=new Array;this.clippedVertices=new Array;this.clippedTriangles=new Array;this.scratch=new Array}clipStart(e,r){if(this.clipAttachment)return 0;this.clipAttachment=r;let t=r.worldVerticesLength,a=P.setArraySize(this.clippingPolygon,t);r.computeWorldVertices(e,0,t,a,0,2);let i=this.clippingPolygon;Ct.makeClockwise(i);let m=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let s=0,n=m.length;s>1,O=this.clipOutput,N=P.setArraySize(o,T+j*d);for(let ie=0;ie=2?(h=n,n=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(r),h.push(t),h.push(a),h.push(i),h.push(m),h.push(e),h.push(r),n.length=0;let c=s,u=s.length-4;for(let d=0;;d+=2){let f=c[d],b=c[d+1],y=c[d+2],A=c[d+3],g=f-y,p=b-A,x=h,w=h.length-2,k=n.length;for(let B=0;B0;if(g*(D-A)-p*(I-y)>0){if(F){n.push(L),n.push(E);continue}let T=E-D,X=L-I,W=T*(y-f)-X*(A-b);if(Math.abs(W)>1e-6){let H=(X*(b-D)-T*(f-I))/W;n.push(f+(y-f)*H),n.push(b+(A-b)*H)}else n.push(f),n.push(b)}else if(F){let T=E-D,X=L-I,W=T*(y-f)-X*(A-b);if(Math.abs(W)>1e-6){let H=(X*(b-D)-T*(f-I))/W;n.push(f+(y-f)*H),n.push(b+(A-b)*H)}else n.push(f),n.push(b);n.push(L),n.push(E)}o=!0}if(k==n.length)return l.length=0,!0;if(n.push(n[0]),n.push(n[1]),d==u)break;let v=n;n=h,n.length=0,h=v}if(l!=n){l.length=0;for(let d=0,f=n.length-2;d>1;l=0;y--)c[y]==-1&&(c[y]=d[--b])}s.setFrame(l,C(h,"time",0),c)}i.push(s)}if(e.events){let s=new ve(e.events.length),n=0;for(let l=0;l{typeof Math.fround=="undefined"&&(Math.fround=function(Y){return function(e){return Y[0]=e,Y[0]}}(new Float32Array(1)))})();var Er=class{constructor(e,r){this.jitterX=0;this.jitterY=0;this.jitterX=e,this.jitterY=r}begin(e){}transform(e,r,t,a){e.x+=M.randomTriangular(-this.jitterX,this.jitterY),e.y+=M.randomTriangular(-this.jitterX,this.jitterY)}end(){}};var lr=class{constructor(e){this.centerX=0;this.centerY=0;this.radius=0;this.angle=0;this.worldX=0;this.worldY=0;this.radius=e}begin(e){this.worldX=e.x+this.centerX,this.worldY=e.y+this.centerY}transform(e,r,t,a){let i=this.angle*M.degreesToRadians,m=e.x-this.worldX,s=e.y-this.worldY,n=Math.sqrt(m*m+s*s);if(nnew Nt(t),e,r)}};var Tt=class{constructor(e){this.triangleRendering=!1;this.debugRendering=!1;this.vertices=P.newFloatArray(8*1024);this.tempColor=new R;this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let r=this.ctx,t=this.tempColor,a=e.color,i=e.drawOrder;this.debugRendering&&(r.strokeStyle="green");for(let m=0,s=i.length;m