(function(Y,c){"use strict";class at{}at.Skeleton=null,at.AnimationTemplet=null,at.Templet=null;class wt{}class Ft{}class bt{}class Ct{static parse(t,e,r){var a=e.__getBuffer(),s,n,i,o,l,h,u,f=e.readUTFString();t._aniClassName=f;var d=e.readUTFString().split(` `),v=e.getUint8(),p=e.getUint32(),_=e.getUint32(),x;p>0&&(x=a.slice(p,_));var g=new c.Byte(x);_>0&&(t._publicExtData=a.slice(_,a.byteLength)),t._useParent=!!e.getUint8(),t._anis.length=v;let I=()=>{A==s?(A++,m()):console.warn("\u89E3\u6790\u52A8\u753B\u5361\u987F\uFF1A",s)},m=y=>{var D=t._anis[s]=new wt;D.nodes=[];var T=D.name=d[e.getUint16()];t._aniMap[T]=s,D.bone3DMap={},D.playTime=e.getFloat32();var E=D.nodes.length=e.getUint8();for(D.totalKeyframeDatasLength=0,n=0;n=0&&(M.name=d[C],D.bone3DMap[M.name]=n),M.keyFrame=[],M.parentIndex=e.getInt16(),M.parentIndex==-1?M.parent=null:M.parent=D.nodes[M.parentIndex],M.lerpType=e.getUint8();var B=e.getUint32();g.pos=B;var S=M.keyframeWidth=g.getUint16();if(D.totalKeyframeDatasLength+=S,M.lerpType===0||M.lerpType===1)for(M.interpolationMethod=[],M.interpolationMethod.length=S,i=0;i0&&(M.extenData=a.slice(e.pos,e.pos+P),e.pos+=P);var N=e.getUint16();M.keyFrame.length=N;var b=0,w;for(i=0,o=N;i=v&&(c.timer.clear(this,I),r&&r())},A=1;s=0,m(0),v>1&&c.timer.loop(10,this,I)}}class k{static READ_DATA(){k._DATA.offset=k._reader.getUint32(),k._DATA.size=k._reader.getUint32()}static READ_BLOCK(){for(var t=k._BLOCK.count=k._reader.getUint16(),e=k._BLOCK.blockStarts=[],r=k._BLOCK.blockLengths=[],a=0;a=0&&(d.name=k._strings[v],h.bone3DMap[d.name]=a),d.keyFrame=[],d.parentIndex=t.getInt16(),d.parentIndex==-1?d.parent=null:d.parent=h.nodes[d.parentIndex],h.totalKeyframeDatasLength+=i,d.interpolationMethod=o,d.parent!=null&&d.parent.childs.push(d);var p=t.getUint16();d.keyFrame.length=p;var _=null,x=null;for(s=0,n=p;sthis._playEnd)throw new Error("AnimationPlayer:value must large than playStartTime,small than playEndTime.");this._startUpdateLoopCount=c.Stat.loopCount;var e=this._cacheFrameRateInterval*this._cachePlayRate;this._currentTime=t,this._currentKeyframeIndex=Math.floor(this.currentPlayTime/e),this._currentFrameTime=this._currentKeyframeIndex*e}}get paused(){return this._paused}set paused(t){this._paused=t,t&&this.event(c.Event.PAUSED)}get cacheFrameRateInterval(){return this._cacheFrameRateInterval}get state(){return this._currentAnimationClipIndex===-1?ct.stopped:this._paused?ct.paused:ct.playing}get destroyed(){return this._destroyed}_onTempletLoadedComputeFullKeyframeIndices(t,e,r){this._templet===r&&this._cachePlayRate===t&&this._cacheFrameRate===e&&this._computeFullKeyframeIndices()}_computeFullKeyframeIndices(){var t=this._templet;if(!t._fullFrames)for(var e=this._templet._fullFrames=[],r=this._cacheFrameRateInterval*this._cachePlayRate,a=0,s=t.getAnimationCount();a0&&(f=x),x<=h&&(u[x]=v)}var g=0;for(v=f;vt&&(this._playEnd=t),this._playDuration=this._playEnd-this._playStart}}_setPlayParams(t,e){this._currentTime=t,this._currentKeyframeIndex=Math.floor(this.currentPlayTime/e+.01),this._currentFrameTime=this._currentKeyframeIndex*e}_setPlayParamsWhenStop(t,e,r=-1){this._currentTime=t;var a=r>0?r:t;this._currentKeyframeIndex=Math.floor(a/e+.01),this._currentKeyframeIndex=Math.floor(t/e+.01),this._currentFrameTime=this._currentKeyframeIndex*e,this._currentAnimationClipIndex=-1}_update(t){if(!(this._currentAnimationClipIndex===-1||this._paused||!this._templet)){var e=this._cacheFrameRateInterval*this._cachePlayRate,r=0;this._startUpdateLoopCount!==c.Stat.loopCount&&(r=t*this.playbackRate,this._elapsedPlaybackTime+=r);var a=this.playDuration;if(r+=this._currentTime,this._overallDuration!==0&&this._elapsedPlaybackTime>=this._overallDuration||this._overallDuration===0&&this._elapsedPlaybackTime>=a||this._overallDuration===0&&r>=this.playEnd){this._setPlayParamsWhenStop(a,e,this.playEnd),this.event(c.Event.STOPPED);return}if(a>0)if(r>=a)if(this._stopWhenCircleFinish){this._setPlayParamsWhenStop(a,e),this._stopWhenCircleFinish=!1,this.event(c.Event.STOPPED);return}else{r=r%a,this._setPlayParams(r,e),this.event(c.Event.COMPLETE);return}else this._setPlayParams(r,e);else{if(this._stopWhenCircleFinish){this._setPlayParamsWhenStop(a,e),this._stopWhenCircleFinish=!1,this.event(c.Event.STOPPED);return}this._currentTime=this._currentFrameTime=this._currentKeyframeIndex=0,this.event(c.Event.COMPLETE)}}}_destroy(){this.offAll(),this._templet=null,this._destroyed=!0}play(t=0,e=1,r=2147483647,a=0,s=0){if(!this._templet)throw new Error("AnimationPlayer:templet must not be null,maybe you need to set url.");if(r<0||a<0||s<0)throw new Error("AnimationPlayer:overallDuration,playStart and playEnd must large than zero.");if(s!==0&&a>s)throw new Error("AnimationPlayer:start must less than end.");this._currentTime=0,this._currentFrameTime=0,this._elapsedPlaybackTime=0,this.playbackRate=e,this._overallDuration=r,this._playStart=a,this._playEnd=s,this._paused=!1,this._currentAnimationClipIndex=t,this._currentKeyframeIndex=0,this._startUpdateLoopCount=c.Stat.loopCount,this.event(c.Event.PLAYED),this._calculatePlayDuration(),this._update(0)}playByFrame(t=0,e=1,r=2147483647,a=0,s=0,n=30){var i=1e3/n;this.play(t,e,r,a*i,s*i)}stop(t=!0){t?(this._currentTime=this._currentFrameTime=this._currentKeyframeIndex=0,this._currentAnimationClipIndex=-1,this.event(c.Event.STOPPED)):this._stopWhenCircleFinish=!0}destroy(){}}class st{constructor(){}static getBezierRate(t,e,r,a,s){var n=st._getBezierParamKey(e,r,a,s),i=n*100+t;if(st._bezierResultCache[i])return st._bezierResultCache[i];var o=st._getBezierPoints(e,r,a,s,n),l,h;for(h=o.length,l=0;l=s)&&(a=this._boneCurKeyFrm[e]=0);var n=t[a],i=n.startTime,o=r-i;if(o==0||o>0&&n.duration>o)return a;var l=0;if(o>0){for(r=r+.01,l=a+1;lr)return this._boneCurKeyFrm[e]=l,l;return s-1}else{for(l=0;lr)return this._boneCurKeyFrm[e]=l,l;return a}return 0}getOriginalData(t,e,r,a,s){var n=this._anis[t],i=n.nodes,o=this._boneCurKeyFrm;o.lengththis.unfixedCurrentTimes[s]);)this.unfixedCurrentFrameIndexes[s]++;this.unfixedCurrentFrameIndexes[s]--}return this.unfixedCurrentFrameIndexes}getOriginalDataUnfixedRate(t,e,r){var a=this._anis[t],s=a.nodes;t!==this.unfixedLastAniIndex&&(this.unfixedCurrentFrameIndexes=new Uint32Array(s.length),this.unfixedCurrentTimes=new Float32Array(s.length),this.unfixedKeyframes=[],this.unfixedLastAniIndex=t);for(var n=0,i=0,o=s.length,l=0;ithis.unfixedCurrentTimes[i]);)this.unfixedKeyframes[i]=h.keyFrame[this.unfixedCurrentFrameIndexes[i]],this.unfixedCurrentFrameIndexes[i]++;var u=this.unfixedKeyframes[i];h.dataOffset=l;var f=r-u.startTime,d=h.lerpType;if(d)switch(h.lerpType){case 0:case 1:for(n=0;n-1&&tthis.currDisplayData.uvs[5]&&(h.d=-1),this.currDisplayData.uvs[0]>this.currDisplayData.uvs[4]&&this.currDisplayData.uvs[1]>this.currDisplayData.uvs[5]&&(o=!0,h.rotate(-Math.PI/2)),c.Matrix.mul(h,c.Matrix.TEMP,l)}else c.Matrix.TEMP.copyTo(l);r||(l=this.getSaveMatrix(l)),l._checkTransform(),o?t.drawTexture(s,-this.currDisplayData.height/2,-this.currDisplayData.width/2,this.currDisplayData.height,this.currDisplayData.width,l,a):t.drawTexture(s,-this.currDisplayData.width/2,-this.currDisplayData.height/2,this.currDisplayData.width,this.currDisplayData.height,l,a,null,this.blendMode)}}}break;case 1:if(r?(this._skinSprite==null&&(this._skinSprite=Q.createSkinMesh()),n=this._skinSprite):n=Q.createSkinMesh(),n==null)return;var u;if(this.currDisplayData.bones==null){var f=this.currDisplayData.weights;this.deformData&&(f=this.deformData);var d;this._diyTexture?(this._curDiyUV||(this._curDiyUV=[]),this._curDiyUV.length==0&&(this._curDiyUV=At.getRelativeUV(this.currTexture.uv,this.currDisplayData.uvs,this._curDiyUV),this._curDiyUV=At.getAbsoluteUV(this._diyTexture.uv,this._curDiyUV,this._curDiyUV)),d=this._curDiyUV):d=this.currDisplayData.uvs,this._mVerticleArr=f;var v=this.currDisplayData.triangles.length/3;u=this.currDisplayData.triangles,this.deformData&&(r||(this._mVerticleArr=this.getSaveVerticle(this._mVerticleArr))),n.init2(s,u,this._mVerticleArr,d);var p=this.getDisplayMatrix();if(this._parentMatrix&&p){c.Matrix.mul(p,this._parentMatrix,c.Matrix.TEMP);var _;r?(this._resultMatrix==null&&(this._resultMatrix=new c.Matrix),_=this._resultMatrix):_=Q._tempResultMatrix,c.Matrix.TEMP.copyTo(_),r||(_=this.getSaveMatrix(_)),n.transform=_}}else this.skinMesh(e,n);t.drawSkin(n,a,this.blendMode);break;case 2:if(r?(this._skinSprite==null&&(this._skinSprite=Q.createSkinMesh()),n=this._skinSprite):n=Q.createSkinMesh(),n==null)return;this.skinMesh(e,n),t.drawSkin(n,a,this.blendMode);break;case 3:break}}}skinMesh(t,e){var r=this.currTexture,a=this.currDisplayData.bones,s;this._diyTexture?(r=this._diyTexture,this._curDiyUV||(this._curDiyUV=[]),this._curDiyUV.length==0&&(this._curDiyUV=At.getRelativeUV(this.currTexture.uv,this.currDisplayData.uvs,this._curDiyUV),this._curDiyUV=At.getAbsoluteUV(this._diyTexture.uv,this._curDiyUV,this._curDiyUV)),s=this._curDiyUV):s=this.currDisplayData.uvs;var n=this.currDisplayData.weights,i=this.currDisplayData.triangles,o,l=0,h=0,u=0,f,d,v,p=0,_=0,x,g=0,I=0;if(Q._tempVerticleArr.length=0,x=Q._tempVerticleArr,this.deformData&&this.deformData.length>0){var m=0;for(g=0,I=a.length;g>>1;;){if(t[Math.floor(s+1)]<=e?r=s+1:a=s,r==a)return r+1;s=r+a>>>1}return 0}apply(t,e,r=1){if(t+=.05,!(this.timeList.length<=0)){var a=0,s=this.timeList[0];if(!(t=this.timeList[this.timeList.length-1]){var l=this.vectices[this.vectices.length-1];if(r<1)for(a=0;a180?u-=360:u<-180&&(u+=360),t.transform.skX=t.transform.skY=t.transform.skX+u*a,t.update()}updatePos(t,e){this._sp&&this._sp.pos(t,e)}_applyIk2(t,e,r,a,s,n){if(n!=0){var i=t.resultTransform.x,o=t.resultTransform.y,l=t.transform.scX,h=t.transform.scY,u=e.transform.scX,f,d,v;l<0?(l=-l,f=180,v=-1):(f=0,v=1),h<0&&(h=-h,v=-v),u<0?(u=-u,d=180):d=0;var p=e.resultTransform.x,_,x,g,I=t.resultMatrix.a,m=t.resultMatrix.c,A=t.resultMatrix.b,y=t.resultMatrix.d,D=Math.abs(l-h)<=1e-4;D?(_=e.resultTransform.y,x=I*p+m*_+t.resultMatrix.tx,g=A*p+y*_+t.resultMatrix.ty):(_=0,x=I*p+t.resultMatrix.tx,g=A*p+t.resultMatrix.ty),this.isDebug&&(this._sp||(this._sp=new c.Sprite,c.ILaya.stage.addChild(this._sp)),this._sp.graphics.clear(),this._sp.graphics.drawCircle(r,a,15,"#ffff00"),this._sp.graphics.drawCircle(x,g,15,"#ff00ff")),t.setRotation(Math.atan2(g-t.resultMatrix.ty,x-t.resultMatrix.tx));var T=t.parentBone;I=T.resultMatrix.a,m=T.resultMatrix.c,A=T.resultMatrix.b,y=T.resultMatrix.d;var E=1/(I*y-m*A),M=r-T.resultMatrix.tx,C=a-T.resultMatrix.ty,B=(M*y-C*m)*E-i,S=(C*I-M*A)*E-o;M=x-T.resultMatrix.tx,C=g-T.resultMatrix.ty;var P=(M*y-C*m)*E-i,N=(C*I-M*A)*E-o,b=Math.sqrt(P*P+N*N),w=e.length*u,R,U;if(D){w*=l;var O=(B*B+S*S-b*b-w*w)/(2*b*w);O<-1?O=-1:O>1&&(O=1),U=Math.acos(O)*s,I=b+w*O,m=w*Math.sin(U),R=Math.atan2(S*I-B*m,B*I+S*m)}else{I=l*w,m=h*w;var L=I*I,F=m*m,z=B*B+S*S,J=Math.atan2(S,B);A=F*b*b+L*z-L*F;var K=-2*F*b,X=F-L;if(y=K*K-4*X*A,y>0){var V=Math.sqrt(y);K<0&&(V=-V),V=-(K+V)/2;var j=V/X,it=A/V,et=Math.abs(j)ut&&(nt=0,ut=y,rt=M),M=b-I,y=M*M,yut&&(nt=tt,ut=y,rt=M,vt=C),z<=(H+ut)/2?(R=J-Math.atan2(yt*s,pt),U=W*s):(R=J-Math.atan2(vt*s,rt),U=nt*s)}var lt=Math.atan2(_,p)*v,_t=t.resultTransform.skX;R=(R-lt)*ot.radDeg+f-_t,R>180?R-=360:R<-180&&(R+=360),t.resultTransform.x=i,t.resultTransform.y=o,t.resultTransform.skX=t.resultTransform.skY=_t+R*n,_t=e.resultTransform.skX,_t=_t%360,U=((U+lt)*ot.radDeg-0)*v+d-_t,U>180?U-=360:U<-180&&(U+=360),e.resultTransform.x=p,e.resultTransform.y=_,e.resultTransform.skX=e.resultTransform.skY=e.resultTransform.skY+U*n,t.update()}}_applyIk3(t,e,r,a,s,n){if(n==0)return;var i,o;const l=e.resultMatrix.a*e.length,h=e.resultMatrix.b*e.length,u=l*l+h*h,f=Math.sqrt(u);var d=t.resultMatrix.tx,v=t.resultMatrix.ty,p=e.resultMatrix.tx,_=e.resultMatrix.ty,x=p-d,g=_-v;const I=x*x+g*g,m=Math.sqrt(I);x=r-t.resultMatrix.tx,g=a-t.resultMatrix.ty;const A=x*x+g*g,y=Math.sqrt(A);if(f+m<=y||y+f<=m||y+m<=f){var D;f+m<=y?D=1:D=-1,p=d+D*(r-d)*m/y,_=v+D*(a-v)*m/y}else{const B=(I-u+A)/(2*A),S=Math.sqrt(I-B*B*A)/y,P=d+x*B,N=v+g*B,b=-g*S,w=x*S;s>0?(p=P-b,_=N-w):(p=P+b,_=N+w)}i=p,o=_,this.isDebug&&(this._sp||(this._sp=new c.Sprite,c.ILaya.stage.addChild(this._sp)),this._sp.graphics.clear(),this._sp.graphics.drawCircle(d,v,15,"#ff00ff"),this._sp.graphics.drawCircle(r,a,15,"#ffff00"),this._sp.graphics.drawCircle(i,o,15,"#ff00ff"));var T;T=Math.atan2(o-t.resultMatrix.ty,i-t.resultMatrix.tx),t.setRotation(T);var E;E=ot._tempMatrix,E.identity(),E.rotate(T),E.scale(t.resultMatrix.getScaleX(),t.resultMatrix.getScaleY()),E.translate(t.resultMatrix.tx,t.resultMatrix.ty),E.copyTo(t.resultMatrix),t.updateChild();var M;M=Math.atan2(a-o,r-i),e.setRotation(M);var C;C=ot._tempMatrix,C.identity(),C.rotate(M),C.scale(e.resultMatrix.getScaleX(),e.resultMatrix.getScaleY()),C.translate(i,o),E.copyTo(e.resultMatrix),e.updateChild()}}ot.radDeg=180/Math.PI,ot.degRad=Math.PI/180,ot._tempMatrix=new c.Matrix;class Ot{constructor(){this.boneNames=[],this.bendDirection=1,this.mix=1,this.isSpine=!0,this.targetBoneIndex=-1,this.boneIndexs=[]}}class dt{constructor(t,e){this._debugKey=!1,this._segments=[],this._curves=[],this.data=t,this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.bones=[];for(var r=this.data.bones,a=0,s=r.length;a0,n=this.data.spacingMode,i=n=="length",o=this.data.rotateMode,l=o=="tangent",h=o=="chainScale",u=[],f=this.bones.length,d=l?f:f+1,v=[];this._spaces=v,v[0]=this.position;var p=this.spacing;if(h||i)for(var _=0,x=d-1;_Math.PI?O-=Math.PI*2:O<-Math.PI&&(O+=Math.PI*2),O*=a,L=Math.cos(O),F=Math.sin(O),g.resultMatrix.a=L*b-F*R,g.resultMatrix.c=L*w-F*U,g.resultMatrix.b=F*b+L*R,g.resultMatrix.d=F*w+L*U}}}}computeWorldVertices2(t,e,r,a,s,n){var i=t.currDisplayData.bones,o=t.currDisplayData.weights,l=t.currDisplayData.triangles,h,u=0,f=0,d=0,v=0,p=0,_=0,x=0,g=0,I=0,m=0,A,y;if(i==null){l||(l=o),t.deformData&&(l=t.deformData);var D;if(D=t.parent,e){for(y=e.length,u=0;um){this.addAfterPosition(D-m,_,d-4,x,A);continue}for(;;y++)if(M=C[y],!(D>M)){y==0?D/=M:(E=C[y-1],D=(D-E)/(M-E));break}if(y!=I){I=y;var H=y*6;for(B=_[H],S=_[H+1],P=_[H+2],N=_[H+3],b=_[H+4],w=_[H+5],R=_[H+6],U=_[H+7],O=(B-P*2+b)*.03,L=(S-N*2+w)*.03,F=((P-b)*3-B+R)*.006,z=((N-w)*3-S+U)*.006,J=O*2+F,K=L*2+z,X=(P-B)*.3+O+F*.16666667,V=(N-S)*.3+L+z*.16666667,et=Math.sqrt(X*X+V*V),it[0]=et,H=1;H<8;H++)X+=J,V+=K,J+=F,K+=z,et+=Math.sqrt(X*X+V*V),it[H]=et;X+=J,V+=K,et+=Math.sqrt(X*X+V*V),it[8]=et,X+=J+F,V+=K+z,et+=Math.sqrt(X*X+V*V),it[9]=et,W=0}for(D*=et;;W++)if(M=it[W],!(D>M)){W==0?D/=M:(E=it[W-1],D=W+(D-E)/(M-E));break}this.addCurvePosition(D*.1,B,S,P,N,b,w,R,U,x,A,s||f>0&&T==0)}return x}addBeforePosition(t,e,r,a,s){var n=e[r],i=e[r+1],o=e[r+2]-n,l=e[r+3]-i,h=Math.atan2(l,o);a[s]=n+t*Math.cos(h),a[s+1]=i+t*Math.sin(h),a[s+2]=h}addAfterPosition(t,e,r,a,s){var n=e[r+2],i=e[r+3],o=n-e[r],l=i-e[r+1],h=Math.atan2(l,o);a[s]=n+t*Math.cos(h),a[s+1]=i+t*Math.sin(h),a[s+2]=h}addCurvePosition(t,e,r,a,s,n,i,o,l,h,u,f){t==0&&(t=1e-4);var d=t*t,v=d*t,p=1-t,_=p*p,x=_*p,g=p*t,I=g*3,m=p*I,A=I*t,y=e*x+a*m+n*A+o*v,D=r*x+s*m+i*A+l*v;h[u]=y,h[u+1]=D,f?h[u+2]=Math.atan2(D-(r*_+s*g*2+i*d),y-(e*_+a*g*2+n*d)):h[u+2]=0}}dt.BEFORE=-2,dt.AFTER=-3,dt._tempMt=new c.Matrix;class Yt{constructor(){this.bones=[]}}class re{constructor(t,e){this._temp=[],this._data=t,this._bones==null&&(this._bones=[]),this.target=e[t.targetIndex];var r,a;for(r=0,a=t.boneIndexs.length;r0){var o=t.resultMatrix.a,l=t.resultMatrix.b,h=t.resultMatrix.c,u=t.resultMatrix.d,f=Math.atan2(a,e)-Math.atan2(h,o)+this._data.offsetRotation*Math.PI/180;f>Math.PI?f-=Math.PI*2:f<-Math.PI&&(f+=Math.PI*2),f*=this.rotateMix;var d=Math.cos(f),v=Math.sin(f);t.resultMatrix.a=d*o-v*h,t.resultMatrix.b=d*l-v*u,t.resultMatrix.c=v*o+d*h,t.resultMatrix.d=v*l+d*u}if(this.translateMix&&(this._temp[0]=this._data.offsetX,this._temp[1]=this._data.offsetY,this.target.localToWorld(this._temp),t.resultMatrix.tx+=(this._temp[0]-t.resultMatrix.tx)*this.translateMix,t.resultMatrix.ty+=(this._temp[1]-t.resultMatrix.ty)*this.translateMix,t.updateChild()),this.scaleMix>0){var p=Math.sqrt(t.resultMatrix.a*t.resultMatrix.a+t.resultMatrix.c*t.resultMatrix.c),_=Math.sqrt(e*e+a*a),x=p>1e-5?(p+(_-p+this._data.offsetScaleX)*this.scaleMix)/p:0;t.resultMatrix.a*=x,t.resultMatrix.c*=x,p=Math.sqrt(t.resultMatrix.b*t.resultMatrix.b+t.resultMatrix.d*t.resultMatrix.d),_=Math.sqrt(r*r+s*s),x=p>1e-5?(p+(_-p+this._data.offsetScaleY)*this.scaleMix)/p:0,t.resultMatrix.b*=x,t.resultMatrix.d*=x}if(this.shearMix>0){l=t.resultMatrix.b,u=t.resultMatrix.d;var g=Math.atan2(u,l);f=Math.atan2(s,r)-Math.atan2(a,e)-(g-Math.atan2(t.resultMatrix.c,t.resultMatrix.a)),f>Math.PI?f-=Math.PI*2:f<-Math.PI&&(f+=Math.PI*2),f=g+(f+this._data.offsetShearY*Math.PI/180)*this.shearMix,x=Math.sqrt(l*l+u*u),t.resultMatrix.b=Math.cos(f)*x,t.resultMatrix.d=Math.sin(f)*x}}}}class xt extends c.Sprite{constructor(t=null,e=0){super(),this._boneMatrixArray=[],this._lastTime=0,this._currAniIndex=-1,this._pause=!0,this._aniClipIndex=-1,this._clipIndex=-1,this._skinIndex=0,this._skinName="default",this._aniMode=0,this._index=-1,this._total=-1,this._indexControl=!1,this._eventIndex=0,this._drawOrderIndex=0,this._drawOrder=null,this._lastAniClipIndex=-1,this._lastUpdateAniClipIndex=-1,this._playAudio=!0,this._soundChannelArr=[],t&&this.init(t,e)}init(t,e=0){var r=0,a;if(e==1)for(this._graphicsCache=[],r=0,a=t.getAnimationCount();r0)for(this._ikArr=[],r=0,a=t.ikArr.length;r0){var s,n;this._pathDic==null&&(this._pathDic={});var i;for(r=0,a=t.pathArr.length;r0)for(this._tfArr=[],r=0,a=t.tfArr.length;r0){var o=this._templet.skinDataArray[this._skinIndex];this._skinName=o.name}this._player.on(c.Event.PLAYED,this,this._onPlay),this._player.on(c.Event.STOPPED,this,this._onStop),this._player.on(c.Event.PAUSED,this,this._onPause)}get url(){return this._aniPath}set url(t){this.load(t)}load(t,e=null,r=0){this._aniPath=t,this._complete=e,this._loadAniMode=r,c.ILaya.loader.load([{url:t,type:c.ILaya.Loader.BUFFER}],c.Handler.create(this,this._onLoaded))}_onLoaded(){var t=c.ILaya.Loader.getRes(this._aniPath);if(t!=null){at.Templet.TEMPLET_DICTIONARY==null&&(at.Templet.TEMPLET_DICTIONARY={});var e;e=at.Templet.TEMPLET_DICTIONARY[this._aniPath],e?e.isParseFail?this._parseFail():e.isParserComplete?this._parseComplete():(e.on(c.Event.COMPLETE,this,this._parseComplete),e.on(c.Event.ERROR,this,this._parseFail)):(e=new at.Templet,e._setCreateURL(this._aniPath),at.Templet.TEMPLET_DICTIONARY[this._aniPath]=e,e.on(c.Event.COMPLETE,this,this._parseComplete),e.on(c.Event.ERROR,this,this._parseFail),e.isParserComplete=!1,e.parseData(null,t))}}_parseComplete(){var t=at.Templet.TEMPLET_DICTIONARY[this._aniPath];t&&(this.init(t,this._loadAniMode),this.play(0,!0)),this._complete&&this._complete.runWith(this)}_parseFail(){console.log("[Error]:"+this._aniPath+"\u89E3\u6790\u5931\u8D25")}_onPlay(){this.event(c.Event.PLAYED)}_onStop(){var t,e=this._templet.eventAniArr,r=e[this._aniClipIndex];if(r&&this._eventIndex=this._player.playStart&&t.time<=this._player.playEnd&&this.event(c.Event.LABEL,t);this._drawOrder=null,this.event(c.Event.STOPPED)}_onPause(){this.event(c.Event.PAUSED)}_parseSrcBoneMatrix(){var t=0,e=0;for(e=this._templet.srcBoneMatrixArr.length,t=0;t=this._player.playStart&&o.time<=this._player.playEnd&&this.event(c.Event.LABEL,o)}}_update(t=!0){if(!this._pause&&!(t&&this._indexControl)){var e=this.timer.currTimer,r=this._player.currentKeyframeIndex,a=e-this._lastTime;if(t?this._player._update(a):r=-1,this._lastTime=e,!!this._player&&(this._index=this._clipIndex=this._player.currentKeyframeIndex,!(this._index<0)&&!(a>0&&this._clipIndex==r&&this._lastUpdateAniClipIndex==this._aniClipIndex))){this._lastUpdateAniClipIndex=this._aniClipIndex,r>this._clipIndex&&this._eventIndex!=0&&(this._emitMissedEvents(this._player.playStart,this._player.playEnd,this._eventIndex),this._eventIndex=0);var s=this._templet.eventAniArr[this._aniClipIndex],n;if(s&&this._eventIndex=this._player.playStart&&i.time<=this._player.playEnd?this._player.currentPlayTime>=i.time&&(this.event(c.Event.LABEL,i),this._eventIndex++,this._playAudio&&i.audioValue&&i.audioValue!=="null"&&i.audioValue!=="undefined"&&(n=c.SoundManager.playSound(this._player.templet._path+i.audioValue,1,c.Handler.create(this,this._onAniSoundStoped)),c.SoundManager.playbackRate=this._player.playbackRate,n&&this._soundChannelArr.push(n))):i.time0)for(this._drawOrderIndex=0,r=s[this._drawOrderIndex];e>=r.time&&(this._drawOrder=r.drawOrder,this._drawOrderIndex++,!(this._drawOrderIndex>=s.length));)r=s[this._drawOrderIndex];this._aniMode==0||this._aniMode==1?this.graphics=ft.create():this.graphics instanceof ft?this.graphics.clear():this.graphics=ft.create();var n=this.graphics,i=this._templet.getNodes(this._aniClipIndex),o=this._player.state==0;this._templet.getOriginalData(this._aniClipIndex,this._curOriginalData,null,t,o?e+this._player.cacheFrameRateInterval:e);var l=this._aniSectionDic[this._aniClipIndex],h=0,u=0,f=0,d=0,v=0,p,_,x,g,I=this._templet.srcBoneMatrixArr.length,m=this._curOriginalData;for(u=0,v=l[0];u0){if(this._lastAniClipIndex!=this._aniClipIndex)for(this._lastAniClipIndex=this._aniClipIndex,u=0,v=this._boneSlotArray.length;u0?o:-o)*180/Math.PI;s[t.name][a*100+r]={x:n.tx,y:n.ty,scaleX:i,scaleY:n.getScaleY(),alpha:e,rotation:l}}_checkIsAllParsed(t){var e,r;for(r=Math.floor(.01+this._templet.getAniDuration(t)/1e3*this._player.cacheFrameRate),e=0;e-1&&o0&&this._onAniSoundStoped(!0),this.timer.clear(this,this._update))}playbackRate(t){this._player&&(this._player.playbackRate=t)}paused(){if(!this._pause){if(this._pause=!0,this._player&&(this._player.paused=!0),this._soundChannelArr.length>0)for(var t,e=this._soundChannelArr.length,r=0;r0)for(var t,e=this._soundChannelArr.length,r=0;r0&&this._onAniSoundStoped(!0)}get index(){return this._index}set index(t){this.player&&(this._index=t,this._player.currentTime=this._index*1e3/this._player.cacheFrameRate,this._indexControl=!0,this._update(!1))}get total(){return this._templet&&this._player?this._total=Math.floor(this._templet.getAniDuration(this._player.currentAnimationClipIndex)/1e3*this._player.cacheFrameRate):this._total=-1,this._total}get player(){return this._player}get templet(){return this._templet}}xt.useSimpleMeshInCanvas=!1,at.Skeleton=xt,c.ILaya.regClass(xt),c.ClassUtils.regClass("laya.ani.bone.Skeleton",xt),c.ClassUtils.regClass("Laya.Skeleton",xt);class Kt{constructor(){this.slotArr=[]}}class Xt{createTexture(t){return this.texture?this.texture:(this.texture=new c.Texture(t.bitmap,this.uvs),this.uvs[0]>this.uvs[4]&&this.uvs[1]>this.uvs[5]?(this.texture.width=t.height,this.texture.height=t.width,this.texture.offsetX=-t.offsetX,this.texture.offsetY=-t.offsetY,this.texture.sourceWidth=t.sourceHeight,this.texture.sourceHeight=t.sourceWidth):(this.texture.width=t.width,this.texture.height=t.height,this.texture.offsetX=-t.offsetX,this.texture.offsetY=-t.offsetY,this.texture.sourceWidth=t.sourceWidth,this.texture.sourceHeight=t.sourceHeight),this.texture)}destory(){this.texture&&this.texture.destroy()}}class Wt{constructor(){this.displayArr=[]}getDisplayByName(t){for(var e,r=0,a=this.displayArr.length;r0?this._path=a.slice(0,s)+"/":this._path=""}}this._mainTexture=t,this._rate=r,this.parse(e)}buildArmature(t=0){return new xt(this,t)}parse(t){t=Z._$c0(t,this._skBufferUrl||this._relativeUrl||"");var e=new c.Byte(t),r=this._aniVersion=e.readUTFString();r=="LAYAANIMATION:03"?(this.parseSk(e),this._mainTexture?this._textureComplete03():c.loader.load(this._loadList,c.Handler.create(this,this._textureComplete03))):Ct.parse(this,e,()=>{this.event(c.Event.LOADED,this),r===Z.LAYA_ANIMATION_VISION?this._isParseAudio=!0:r!=Z.LAYA_ANIMATION_160_VISION&&console.log("[Error] \u7248\u672C\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u4F7F\u7528IDE\u7248\u672C\u914D\u5957\u7684\u91CD\u65B0\u5BFC\u51FA"+r+"->"+Z.LAYA_ANIMATION_VISION),this._mainTexture?this._parsePublicExtData():this._parseTexturePath()})}parseSk(t){this.reader=t,this._aniClassName=t.readUTFString(),this._loadList=[this._path+t.readUTFString()];var e=this.readStr(t);this.strList=e.split(` `);var r=t._d_,a=t._pos_,s=r.getUint32(a,!0);a+=4;var n=r.buffer.slice(a,a+s);a+=s;var i=r.getUint16(a,!0);a+=2;for(var o=new Array(i),l=0,h=0;h>>14,d=u&16383;if(f==3)o[h]=new Float32Array(n,l,d),l+=d*4;else if(f==2)o[h]=new Int16Array(n,l,d),d%2==0?l+=d*2:l+=(d+1)*2;else{f==1?o[h]=new Int8Array(n,l,d):o[h]=new Uint8Array(n,l,d),l+=d;let v=d%4;v>0&&(l+=4-v)}}this.arrayList=o,t._pos_=a,this._parseAni()}_parseAni(){var t=this.reader,e=t._d_,r=t._u8d_,a=t._pos_,s=this.strList,n=this.arrayList;Z.slotInterpolationMethod==null&&(Z.slotInterpolationMethod=[q.interpolation[5],q.interpolation[0],q.interpolation[0],q.interpolation[0],q.interpolation[0],q.interpolation[0]]);for(var i=e.getUint8(a++,!0),o=this.tMatrixDataLen=r[a++],l=r[a++],h=0;h=l?1:2;var g=_.keyframeWidth=_.lerpType==1?6:o;u.totalKeyframeDatasLength+=g,(_.lerpType===0||_.lerpType===1)&&(_.interpolationMethod=Z.slotInterpolationMethod),_.parent!=null&&_.parent.childs.push(_);var I=r[a++];_.keyFrame=new Array(I);for(var m=0,A=I-1;m<=A;m++){var y=_.keyFrame[m]=new bt;m==0?y.startTime=0:(m==A?(y.startTime=u.playTime,y.duration=0):(y.startTime=e.getFloat32(a,!0),a+=4),_.keyFrame[m-1].duration=y.startTime-_.keyFrame[m-1].startTime),_.lerpType===2&&(y.interpolationData=n[this.readVaruint(a)],a=t._pos_);var D=this.readVaruint(a);y.data=n[D],a=t._pos_}_.playTime=u.playTime,this._calculateKeyFrame(_,I,g)}}t._pos_=a}_parsePublicExtData03(){var t=0,e=0,r=0,a=0,s=this._anis.length;for(t=0;t0)for(this.attachmentNames=new Array(it),t=0;t0)for(this.attachmentNames=[],t=0;t0)for(G.bones=[],a=0;a0)for(G.uvs=[],a=0;a0)for(G.weights=[],a=0;a<$t;a++)G.weights.push(i.getFloat32());if(Qt=i.getUint16(),Qt>0)for(G.triangles=[],a=0;a0)for(G.vertices=[],a=0;a0)for(G.lengths=[],a=0;a=this.skinDataArray.length)return!1;var a,s,n,i,o=this.skinDataArray[e];if(o){for(a=0,s=o.slotArr.length;a=this._count){if(!this.loop){this._playIndex--,this.stop();return}this._playIndex=0}if(this._parseFrame(this._playIndex),this._labels&&this._labels[this._playIndex]&&this.event(c.Event.LABEL,this._labels[this._playIndex]),this._endFrame!=-1&&this._endFrame==this._playIndex){if(this._endFrame=-1,this._completeHandler!=null){var t=this._completeHandler;this._completeHandler=null,t.run()}this.stop()}}}stop(){this._playing=!1}gotoAndStop(t){this.index=t,this.stop()}_clear(){if(this.stop(),this._idOfSprite.length=0,!this._parentMovieClip){this.timer.clear(this,this.updates);var t,e;for(e=this._movieClipList.length,t=0;tt&&this._reset(),this._parseFrame(t))}_reset(t=!0){t&&this._curIndex!=1&&this.removeChildren(),this._preIndex=this._curIndex=-1,this._Pos=this._start}_parseFrame(t){var e,r,a,s,n,i,o=!1,l=this._idOfSprite,h=this._data,u;for(this._ended&&this._reset(),h.pos=this._Pos,this._ended=!1,this._playIndex=t,this._curIndex>t&&t0;break;case 7:r=l[h.getUint16()];var _=r.transform||c.Matrix.create();_.setTo(h.getFloat32(),h.getFloat32(),h.getFloat32(),h.getFloat32(),h.getFloat32(),h.getFloat32()),r.transform=_;break;case 8:l[h.getUint16()].setPos(h.getFloat32(),h.getFloat32());break;case 9:l[h.getUint16()].setSize(h.getFloat32(),h.getFloat32());break;case 10:l[h.getUint16()].alpha=h.getFloat32();break;case 11:l[h.getUint16()].setScale(h.getFloat32(),h.getFloat32());break;case 98:u=h.getString(),this.event(u),u=="stop"&&this.stop();break;case 99:this._curIndex=h.getUint16(),o&&this.updateZOrder();break;case 100:this._count=this._curIndex+1,this._ended=!0,this._playing&&(this.event(c.Event.FRAME),this.event(c.Event.END),this.event(c.Event.COMPLETE)),this._reset(!1);break}this._playing&&!this._ended&&this.event(c.Event.FRAME),this._Pos=h.pos}_setData(t,e){this._data=t,this._start=e+3}set url(t){this.load(t)}load(t,e=!1,r=null){this._url=t,e&&(this._atlasPath=r||t.split(".swf")[0]+".json"),this.stop(),this._clear(),this._movieClipList=[this];var a;a=[{url:t,type:c.ILaya.Loader.BUFFER}],this._atlasPath&&a.push({url:this._atlasPath,type:c.ILaya.Loader.ATLAS}),c.ILaya.loader.load(a,c.Handler.create(this,this._onLoaded))}_onLoaded(){var t;if(t=c.ILaya.Loader.getRes(this._url),!t){this.event(c.Event.ERROR,"file not find");return}if(this._atlasPath&&!c.ILaya.Loader.getAtlas(this._atlasPath)){this.event(c.Event.ERROR,"Atlas not find");return}this.basePath=this._atlasPath?c.ILaya.Loader.getAtlas(this._atlasPath).dir:this._url.split(".swf")[0]+"/image/",this._initData(t)}_initState(){this._reset(),this._ended=!1;var t=this._playing;for(this._playing=!1,this._curIndex=0;!this._ended;)this._parseFrame(++this._curIndex);this._playing=t}_initData(t){this._data=new c.Byte(t);var e,r=this._data.getUint16();for(e=0;e