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;i1&&(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 ti?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?t:ge.setArraySize(t,e,i)}static newArray(t,e){let i=new Array(t);for(let s=0;s0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;ethis.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.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e>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=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;e0&&(e%=this.duration));let r=this.timelines;for(let a=0,l=r.length;ae)return s-1;return i-1}static search(t,e,i){let s=t.length;for(let n=i;ne)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;ue){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=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>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>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(se){let r=this.frames[i];return s[n+1]*(e-r)/(s[n]-r)}let o=n+18;for(n+=2;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[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;vs)this.apply(e,i,Number.MAX_VALUE,n,o,h,d),i=-1;else if(i>=r[a-1])return;if(s0&&r[l-1]==f;)l--}for(;l=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>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[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>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;i0){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;f0)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;S1&&(n=1),i!=P.first&&(i=s.mixBlend));let o=n=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=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(;ds||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=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;i0){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("",[],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=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{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;u0&&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.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= 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{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;o180?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&&wy*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)=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,ROi&&(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;s0){p=l/p*u;for(let v=1;v0?B.degRad:-B.degRad}for(let p=0,C=3;p0){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;mtj){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&<==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;ntu){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,m0){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;s0?B.degRad:-B.degRad,u=this.data.offsetRotation*m,g=this.data.offsetShearY*m,x=this.bones;for(let b=0,y=x.length;bB.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;bB.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;ri.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=s.length&&(s.length=t+1),s[t]||(s[t]={}),s[t][e]=i}addSkin(t){for(let s=0;s= 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>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>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=0;y--)u[y]=-1;let g=O.newArray(a-m,0),x=0,b=0;for(let y=0;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>>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>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=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&&ao&&an&&ln&&lt.minX&&this.minYt.minY}containsPoint(t,e){let i=this.polygons;for(let s=0,n=i.length;s=i||a=i){let l=s[d];l+(i-r)/(a-r)*(s[o]-l)=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;h3;){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;a0?(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=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>1,v=this.clipOutput,M=O.setArraySize(n,w+C*2);for(let I=0;I>1,pt=this.clipOutput,tt=O.setArraySize(r,Y+mt*m);for(let ot=0;ot>1,j=this.clipOutput,ct=O.setArraySize(o,R+nt*2),mt=O.setArraySize(h,R+nt*2);for(let tt=0;tt=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;vb*(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>1;r0){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=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;rRe,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-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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]*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{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{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;nthis.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;s0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(t){let e=this.context.gl;for(let i=0;i0&&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;h0||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=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;m0;)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()-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;a0){t.setColor(this.attachmentLineColor),b=(b>>1)*2;let y=g[b-2],w=g[b-1];for(let p=0,C=b;p-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=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-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,iVBORw0KGgoAAAANSUhEUgAAAKMAAACjCAYAAADmbK6AAAALKElEQVR42u2de2iW5R/GPzuqcwfnnKfNmafl5tTNHWzqNi3DEMQykcAoJSsySkspjSIk0iD/07Kf4R+FnVBDUTshZGpWUEJaaiWFgZlUFmXmIe3HNXthyebeZ77P9H13ffBG8Y8H7ut7vff93N/7fu4vGGPiFZiez/Qtw9lytJajfzfw9z/j+efPOv7cV8W+lUNY2a8T/ayTCRsWFLJA5rtUO1LLkV5p9LJeJizQiHeqnlOtmVFtdTGrrZkJCxYXsTgaI6r9MY4/UpNItW4mFDaXsTlaM6qVZlBq3UwofFrJp0HMWJ9DvXUzobCznJ1BzFjWlTLrZkJh/TDWBzFjTgo51s2EgnKI0Rrx+FiOWzNzVaym91Syx5qZsGBWb2ZFa0ZN6dbMhAWTcpkUrRmXD2K5NTNhgVbH0Zpxbl/mWjMTFvRIo0e0Zpzcnc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FZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=";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}};