Files
lifeRestart/public/libs/laya/min/laya.ani.min.js

1 line
84 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(P){P.un,P.uns;var e=P.static,n=P.class,a=P.getset,f=P.__newvec,r=laya.maths.Bezier,c=laya.utils.Browser,Ct=laya.utils.Byte,i=(laya.events.Event,laya.events.EventDispatcher),t=laya.display.Graphics,s=laya.resource.HTMLCanvas,l=laya.utils.Handler,h=laya.net.Loader,u=laya.maths.MathUtil,St=laya.maths.Matrix,o=(laya.display.Node,laya.maths.Point,laya.maths.Rectangle),d=laya.renders.Render,_=(laya.renders.RenderContext,laya.resource.Resource),p=laya.utils.RunDriver,m=(laya.media.SoundChannel,laya.media.SoundManager),B=laya.display.Sprite,y=laya.utils.Stat,wt=laya.resource.Texture,x=(laya.net.URL,laya.utils.Utils),A=(n(g,"laya.ani.AnimationContent"),g);function g(){this.nodes=null,this.name=null,this.playTime=NaN,this.bone3DMap=null,this.totalKeyframeDatasLength=0}var T=(n(v,"laya.ani.AnimationNodeContent"),v);function v(){this.name=null,this.parentIndex=0,this.parent=null,this.keyframeWidth=0,this.lerpType=0,this.interpolationMethod=null,this.childs=null,this.keyFrame=null,this.playTime=NaN,this.extenData=null,this.dataOffset=0}var D=(n(M,"laya.ani.AnimationParser01"),M.parse=function(t,e){var i=e.__getBuffer(),a=0,s=0,r=0,n=0,h=0,l=0,o=0,u=e.readUTFString();t._aniClassName=u;var c,d=e.readUTFString().split("\n"),_=e.getUint8(),p=e.getUint32(),u=e.getUint32();0<p&&(c=i.slice(p,u));var f=new Ct(c);for(0<u&&(t._publicExtData=i.slice(u,i.byteLength)),t._useParent=!!e.getUint8(),t._anis.length=_,a=0;a<_;a++){var m=t._anis[a]=new A;m.nodes=new Array;var y=m.name=d[e.getUint16()];t._aniMap[y]=a,m.bone3DMap={},m.playTime=e.getFloat32();for(var x=m.nodes.length=e.getUint8(),s=m.totalKeyframeDatasLength=0;s<x;s++){var g=m.nodes[s]=new T;g.childs=[];var v=e.getInt16();0<=v&&(g.name=d[v],m.bone3DMap[g.name]=s),g.keyFrame=new Array,g.parentIndex=e.getInt16(),-1==g.parentIndex?g.parent=null:g.parent=m.nodes[g.parentIndex],g.lerpType=e.getUint8();v=e.getUint32();f.pos=v;var D=g.keyframeWidth=f.getUint16();if(m.totalKeyframeDatasLength+=D,0===g.lerpType||1===g.lerpType)for(g.interpolationMethod=[],g.interpolationMethod.length=D,r=0;r<D;r++)g.interpolationMethod[r]=st.interpolation[f.getUint8()];null!=g.parent&&g.parent.childs.push(g);v=e.getUint16();0<v&&(g.extenData=i.slice(e.pos,e.pos+v),e.pos+=v);for(var M,v=e.getUint16(),I=0,r=0,n=g.keyFrame.length=v;r<n;r++){if((M=g.keyFrame[r]=new Z).duration=e.getFloat32(),M.startTime=I,2===g.lerpType){M.interpolationData=[];var b=e.getUint8(),N=0;switch(N=e.getFloat32()){case 254:for(M.interpolationData.length=D,o=0;o<D;o++)M.interpolationData[o]=0;break;case 255:for(M.interpolationData.length=D,o=0;o<D;o++)M.interpolationData[o]=5;break;default:for(M.interpolationData.push(N),l=1;l<b;l++)M.interpolationData.push(e.getFloat32())}}for(M.data=new Float32Array(D),h=0;h<D;h++)M.data[h]=e.getFloat32(),-1e-8<M.data[h]&&M.data[h]<1e-8&&(M.data[h]=0);I+=M.duration}M.startTime=m.playTime,g.playTime=m.playTime,t._calculateKeyFrame(g,v,D)}}},M);function M(){}var I=(n(b,"laya.ani.AnimationParser02"),b.READ_DATA=function(){b._DATA.offset=b._reader.getUint32(),b._DATA.size=b._reader.getUint32()},b.READ_BLOCK=function(){for(var t=b._BLOCK.count=b._reader.getUint16(),e=b._BLOCK.blockStarts=[],i=b._BLOCK.blockLengths=[],a=0;a<t;a++)e.push(b._reader.getUint32()),i.push(b._reader.getUint32())},b.READ_STRINGS=function(){var t=b._reader.getUint32(),e=b._reader.getUint16(),i=b._reader.pos;b._reader.pos=t+b._DATA.offset;for(var a=0;a<e;a++)b._strings[a]=b._reader.readUTFString();b._reader.pos=i},b.parse=function(t,e){b._templet=t;(b._reader=e).__getBuffer();b.READ_DATA(),b.READ_BLOCK(),b.READ_STRINGS();for(var i=0,a=b._BLOCK.count;i<a;i++){var s=e.getUint16(),r=b._strings[s],n=b["READ_"+r];if(null==n)throw new Error("model file err,no this function:"+s+" "+r);n.call()}},b.READ_ANIMATIONS=function(){var t=b._reader,e=t.__getBuffer(),i=0,a=0,s=0,r=0,n=t.getUint16(),h=[];for(h.length=n,i=0;i<n;i++)h[i]=st.interpolation[t.getByte()];var l=t.getUint8();for(b._templet._anis.length=l,i=0;i<l;i++){var o=b._templet._anis[i]={};o.nodes=new Array;var u=o.name=b._strings[t.getUint16()];b._templet._aniMap[u]=i,o.bone3DMap={},o.playTime=t.getFloat32();for(var c=o.nodes.length=t.getInt16(),a=o.totalKeyframeDatasLength=0;a<c;a++){var d=o.nodes[a]={};d.keyframeWidth=n,d.childs=[];var _=t.getUint16();0<=_&&(d.name=b._strings[_],o.bone3DMap[d.name]=a),d.keyFrame=new Array,d.parentIndex=t.getInt16(),-1==d.parentIndex?d.parent=null:d.parent=o.nodes[d.parentIndex],o.totalKeyframeDatasLength+=n,d.interpolationMethod=h,null!=d.parent&&d.parent.childs.push(d);for(var _=t.getUint16(),p=null,f=null,s=0,r=d.keyFrame.length=_;s<r;s++){(p=d.keyFrame[s]={}).startTime=t.getFloat32(),f&&(f.duration=p.startTime-f.startTime);var m=b._DATA.offset,y=t.getUint32(),y=e.slice(m+y,m+y+4*n);p.data=new Float32Array(y),f=p}p.duration=0,d.playTime=o.playTime,b._templet._calculateKeyFrame(d,_,n)}}},b._templet=null,b._reader=null,b._strings=[],e(b,["_BLOCK",function(){return this._BLOCK={count:0}},"_DATA",function(){return this._DATA={offset:0,size:0}}]),b);function b(){}n(N,"laya.ani.AnimationState"),N.stopped=0,N.paused=1,N.playing=2;function N(){}var Ft=function(){function s(){this.name=null,this.root=null,this.parentBone=null,this.length=10,this.transform=null,this.inheritScale=!0,this.inheritRotation=!0,this.rotation=NaN,this.resultRotation=NaN,this.d=-1,this._tempMatrix=null,this._sprite=null,this.resultTransform=new Xt,this.resultMatrix=new St,this._children=[]}n(s,"laya.ani.bone.Bone");var t=s.prototype;return t.setTempMatrix=function(t){this._tempMatrix=t;for(var e=0,e=0,i=this._children.length;e<i;e++)this._children[e].setTempMatrix(this._tempMatrix)},t.update=function(t){var e,i,a,s,r,n,h;this.rotation=this.transform.skX,t?(r=this.resultTransform.getMatrix(),St.mul(r,t,this.resultMatrix),this.resultRotation=this.rotation):(this.resultRotation=this.rotation+this.parentBone.resultRotation,this.parentBone?this.inheritRotation&&this.inheritScale?(r=this.resultTransform.getMatrix(),St.mul(r,this.parentBone.resultMatrix,this.resultMatrix)):(e=this.parentBone,s=a=i=NaN,h=this.parentBone.resultMatrix,r=this.resultTransform.getMatrix(),n=h.a*r.tx+h.c*r.ty+h.tx,t=h.b*r.tx+h.d*r.ty+h.ty,h=new St,this.inheritRotation?(i=Math.atan2(e.resultMatrix.b,e.resultMatrix.a),a=Math.cos(i),s=Math.sin(i),h.setTo(a,s,-s,a,0,0),St.mul(this._tempMatrix,h,St.TEMP),St.TEMP.copyTo(h),r=this.resultTransform.getMatrix(),St.mul(r,h,this.resultMatrix),this.resultTransform.scX*this.resultTransform.scY<0&&this.resultMatrix.rotate(.5*Math.PI)):(this.inheritScale,r=this.resultTransform.getMatrix(),St.TEMP.identity(),St.TEMP.d=this.d,St.mul(r,St.TEMP,this.resultMatrix)),this.resultMatrix.tx=n,this.resultMatrix.ty=t):(r=this.resultTransform.getMatrix()).copyTo(this.resultMatrix));for(var l=0,l=0,o=this._children.length;l<o;l++)this._children[l].update()},t.updateChild=function(){for(var t=0,t=0,e=this._children.length;t<e;t++)this._children[t].update()},t.setRotation=function(t){this._sprite&&(this._sprite.rotation=180*t/Math.PI)},t.updateDraw=function(t,e){s.ShowBones&&!s.ShowBones[this.name]||(this._sprite||(this._sprite=new B,this._sprite.graphics.drawCircle(0,0,5,"#ff0000"),this._sprite.graphics.drawLine(0,0,this.length,0,"#00ff00"),this._sprite.graphics.fillText(this.name,0,0,"20px Arial","#00ff00","center"),P.stage.addChild(this._sprite)),this._sprite.x=t+this.resultMatrix.tx,this._sprite.y=e+this.resultMatrix.ty);for(var i=0,i=0,a=this._children.length;i<a;i++)this._children[i].updateDraw(t,e)},t.addChild=function(t){this._children.push(t),t.parentBone=this},t.findBone=function(t){if(this.name==t)return this;for(var e,i=0,i=0,a=this._children.length;i<a;i++)if(e=this._children[i].findBone(t))return e;return null},t.localToWorld=function(t){var e=t[0],i=t[1];t[0]=e*this.resultMatrix.a+i*this.resultMatrix.c+this.resultMatrix.tx,t[1]=e*this.resultMatrix.b+i*this.resultMatrix.d+this.resultMatrix.ty},s.ShowBones={},s}(),kt=function(){function o(){this.name=null,this.parent=null,this.attachmentName=null,this.srcDisplayIndex=-1,this.type="src",this.templet=null,this.currSlotData=null,this.currTexture=null,this.currDisplayData=null,this.displayIndex=-1,this.originalIndex=-1,this._diyTexture=null,this._parentMatrix=null,this._resultMatrix=null,this._replaceDic={},this._curDiyUV=null,this._curDiyVS=null,this._skinSprite=null,this.deformData=null,this._mVerticleArr=null}n(o,"laya.ani.bone.BoneSlot");var t=o.prototype;return t.showSlotData=function(t,e){void 0===e&&(e=!0),this.currSlotData=t,e&&(this.displayIndex=this.srcDisplayIndex),this.currDisplayData=null,this.currTexture=null},t.showDisplayByName=function(t){this.currSlotData&&this.showDisplayByIndex(this.currSlotData.getDisplayByName(t))},t.replaceDisplayByName=function(t,e){var i;this.currSlotData&&(i=0,i=this.currSlotData.getDisplayByName(t),t=0,t=this.currSlotData.getDisplayByName(e),this.replaceDisplayByIndex(i,t))},t.replaceDisplayByIndex=function(t,e){this.currSlotData&&(this._replaceDic[t]=e,this.originalIndex==t&&this.showDisplayByIndex(t))},t.showDisplayByIndex=function(t){this.originalIndex=t,null!=this._replaceDic[t]&&(t=this._replaceDic[t]),this.currSlotData&&-1<t&&t<this.currSlotData.displayArr.length?(this.displayIndex=t,this.currDisplayData=this.currSlotData.displayArr[t],this.currDisplayData&&(t=this.currDisplayData.name,this.currTexture=this.templet.getTexture(t),this.currTexture&&0==this.currDisplayData.type&&this.currDisplayData.uvs&&(!d.isConchApp||d.isConchApp&&"0.9.15"<B.RUNTIMEVERION)&&(this.currTexture=this.currDisplayData.createTexture(this.currTexture)))):(this.displayIndex=-1,this.currDisplayData=null,this.currTexture=null)},t.replaceSkin=function(t){this._diyTexture=t,this._curDiyUV&&(this._curDiyUV.length=0),this.currDisplayData&&this._diyTexture==this.currDisplayData.texture&&(this._diyTexture=null)},t.setParentMatrix=function(t){this._parentMatrix=t},t.draw=function(t,e,i,a){if(void 0===i&&(i=!1),void 0===a&&(a=1),(null!=this._diyTexture||null!=this.currTexture)&&null!=this.currDisplayData||this.currDisplayData&&3==this.currDisplayData.type){var s,r,n=this.currTexture;switch(this._diyTexture&&(n=this._diyTexture),this.currDisplayData.type){case 0:t&&(r=this.getDisplayMatrix(),this._parentMatrix&&(h=!1,r&&(St.mul(r,this._parentMatrix,St.TEMP),l=i?(null==this._resultMatrix&&(this._resultMatrix=new St),this._resultMatrix):new St,!d.isWebGL&&this.currDisplayData.uvs||d.isWebGL&&this._diyTexture&&this.currDisplayData.uvs?((r=o._tempMatrix).identity(),this.currDisplayData.uvs[1]>this.currDisplayData.uvs[5]&&(r.d=-1),this.currDisplayData.uvs[0]>this.currDisplayData.uvs[4]&&this.currDisplayData.uvs[1]>this.currDisplayData.uvs[5]&&(h=!0,r.rotate(-Math.PI/2)),St.mul(r,St.TEMP,l)):St.TEMP.copyTo(l),h?t.drawTexture(n,-this.currDisplayData.height/2,-this.currDisplayData.width/2,this.currDisplayData.height,this.currDisplayData.width,l):t.drawTexture(n,-this.currDisplayData.width/2,-this.currDisplayData.height/2,this.currDisplayData.width,this.currDisplayData.height,l))));break;case 1:if(null==(s=i?(null==this._skinSprite&&(this._skinSprite=o.createSkinMesh()),this._skinSprite):o.createSkinMesh()))return;var h,l;null==this.currDisplayData.bones?(h=this.currDisplayData.weights,this.deformData&&(h=this.deformData),l=this._diyTexture?(this._curDiyUV||(this._curDiyUV=[]),0==this._curDiyUV.length&&(this._curDiyUV=H.getRelativeUV(this.currTexture.uv,this.currDisplayData.uvs,this._curDiyUV),this._curDiyUV=H.getAbsoluteUV(this._diyTexture.uv,this._curDiyUV,this._curDiyUV)),this._curDiyUV):this.currDisplayData.uvs,this._mVerticleArr=h,this.currDisplayData.triangles.length,h=this.currDisplayData.triangles,s.init2(n,null,h,this._mVerticleArr,l),l=this.getDisplayMatrix(),this._parentMatrix&&l&&(St.mul(l,this._parentMatrix,St.TEMP),l=i?(null==this._resultMatrix&&(this._resultMatrix=new St),this._resultMatrix):new St,St.TEMP.copyTo(l),s.transform=l)):this.skinMesh(e,s,a),t.drawSkin(s);break;case 2:if(null==(s=i?(null==this._skinSprite&&(this._skinSprite=o.createSkinMesh()),this._skinSprite):o.createSkinMesh()))return;this.skinMesh(e,s,a),t.drawSkin(s)}}},t.skinMesh=function(t,e,i){var a,s=this.currTexture,r=this.currDisplayData.bones,n=this._diyTexture?(s=this._diyTexture,this._curDiyUV||(this._curDiyUV=[]),0==this._curDiyUV.length&&(this._curDiyUV=H.getRelativeUV(this.currTexture.uv,this.currDisplayData.uvs,this._curDiyUV),this._curDiyUV=H.getAbsoluteUV(this._diyTexture.uv,this._curDiyUV,this._curDiyUV)),this._curDiyUV):this.currDisplayData.uvs,h=this.currDisplayData.weights,l=this.currDisplayData.triangles,o=0,u=0,c=0,d=NaN,_=NaN,p=0,f=0,m=[],y=0,x=0;if(this.deformData&&0<this.deformData.length)for(var g=0,y=0,x=r.length;y<x;){for(c=r[y++]+y,u=o=0;y<c;y++)a=t[r[y]],d=h[p]+this.deformData[g++],_=h[p+1]+this.deformData[g++],f=h[p+2],o+=(d*a.a+_*a.c+a.tx)*f,u+=(d*a.b+_*a.d+a.ty)*f,p+=3;m.push(o,u)}else for(y=0,x=r.length;y<x;){for(c=r[y++]+y,u=o=0;y<c;y++)a=t[r[y]],d=h[p],_=h[p+1],f=h[p+2],o+=(d*a.a+_*a.c+a.tx)*f,u+=(d*a.b+_*a.d+a.ty)*f,p+=3;m.push(o,u)}this._mVerticleArr=m,e.init2(s,null,l,this._mVerticleArr,n)},t.drawBonePoint=function(t){t&&this._parentMatrix&&t.drawCircle(this._parentMatrix.tx,this._parentMatrix.ty,5,"#ff0000")},t.getDisplayMatrix=function(){return this.currDisplayData?this.currDisplayData.transform.getMatrix():null},t.getMatrix=function(){return this._resultMatrix},t.copy=function(){var t=new o;return t.type="copy",t.name=this.name,t.attachmentName=this.attachmentName,t.srcDisplayIndex=this.srcDisplayIndex,t.parent=this.parent,t.displayIndex=this.displayIndex,t.templet=this.templet,t.currSlotData=this.currSlotData,t.currTexture=this.currTexture,t.currDisplayData=this.currDisplayData,t},o.createSkinMesh=function(){return d.isWebGL||d.isConchApp?p.skinAniSprite():d.isWebGL?null:new(nt.useSimpleMeshInCanvas?rt:at)},e(o,["_tempMatrix",function(){return this._tempMatrix=new St}]),o}(),C=function(){function t(){this.mesh=null,this.transform=null,this.context=null,this.mode=0}n(t,"laya.ani.bone.canvasmesh.CanvasMeshRender");var e=t.prototype;return e.renderToContext=function(t){this.context=t.ctx||t,this.mesh&&(0==this.mode?this._renderWithIndexes(this.mesh):this._renderNoIndexes(this.mesh))},e._renderNoIndexes=function(t){for(var e,i=0,a=t.vertices.length/2,i=0;i<a-2;i++)this._renderDrawTriangle(t,e=2*i,2+e,4+e)},e._renderWithIndexes=function(t){for(var e=t.indexes,i=0,a=e.length,i=0;i<a;i+=3){var s=2*e[i],r=2*e[i+1],n=2*e[i+2];this._renderDrawTriangle(t,s,r,n)}},e._renderDrawTriangle=function(t,e,i,a){var s=this.context,r=t.uvs,n=t.vertices,h=t.texture,l=h.bitmap,o=l.source,u=h.width,c=h.height,d=l.width,_=l.height,p=NaN,f=NaN,m=NaN,y=NaN,x=NaN,g=NaN;g=t.useUvTransform?(v=t.uvTransform,p=(r[e]*v.a+r[e+1]*v.c+v.tx)*d,f=(r[i]*v.a+r[i+1]*v.c+v.tx)*d,m=(r[a]*v.a+r[a+1]*v.c+v.tx)*d,y=(r[e]*v.b+r[e+1]*v.d+v.ty)*_,x=(r[i]*v.b+r[i+1]*v.d+v.ty)*_,(r[a]*v.b+r[a+1]*v.d+v.ty)*_):(p=r[e]*d,f=r[i]*d,m=r[a]*d,y=r[e+1]*_,x=r[i+1]*_,r[a+1]*_);var v,D=n[e],M=n[i],I=n[a],b=n[e+1],N=n[i+1],l=n[a+1];0<t.canvasPadding&&(v=t.canvasPadding,r=t.canvasPadding,i=b-(e=(b+N+l)/3),D=(n=(D+M+I)/3)+(a=D-n)/(t=Math.sqrt(a*a+i*i))*(t+v),b=e+i/t*(t+r),i=N-e,M=n+(a=M-n)/(t=Math.sqrt(a*a+i*i))*(t+v),N=e+i/t*(t+r),i=l-e,I=n+(a=I-n)/(t=Math.sqrt(a*a+i*i))*(t+v),l=e+i/t*(t+r)),s.save(),this.transform&&(A=this.transform,s.transform(A.a,A.b,A.c,A.d,A.tx,A.ty)),s.beginPath(),s.moveTo(D,b),s.lineTo(M,N),s.lineTo(I,l),s.closePath(),s.clip();var A=1/(p*x+y*m+f*g-x*m-y*f-p*g);s.transform((D*x+y*I+M*g-x*I-y*M-D*g)*A,(b*x+y*l+N*g-x*l-y*N-b*g)*A,(p*M+D*m+f*I-M*m-D*f-p*I)*A,(p*N+b*m+f*l-N*m-b*f-p*l)*A,(p*x*I+y*M*m+D*f*g-D*x*m-y*f*I-p*M*g)*A,(p*x*l+y*N*m+b*f*g-b*x*m-y*f*l-p*N*g)*A),s.drawImage(o,h.uv[0]*d,h.uv[1]*_,u,c,h.uv[0]*d,h.uv[1]*_,u,c),s.restore()},t}(),S=(n(w,"laya.ani.bone.canvasmesh.MeshData"),w.prototype.getBounds=function(){return o._getWrapRec(this.vertices)},w);function w(){this.texture=null,this.uvs=[0,0,1,0,1,1,0,1],this.vertices=[0,0,100,0,100,100,0,100],this.indexes=[0,1,3,3,1,2],this.uvTransform=null,this.useUvTransform=!1,this.canvasPadding=1}var Pt=(n(F,"laya.ani.bone.DeformAniData"),F);function F(){this.skinName=null,this.deformSlotDataList=[]}var Bt=(n(k,"laya.ani.bone.DeformSlotData"),k);function k(){this.deformSlotDisplayList=[]}var Ut=function(){function t(){this.boneSlot=null,this.slotIndex=-1,this.attachment=null,this.deformData=null,this.frameIndex=0,this.timeList=[],this.vectices=[],this.tweenKeyList=[]}n(t,"laya.ani.bone.DeformSlotDisplayData");var e=t.prototype;return e.binarySearch1=function(t,e){var i=0,a=t.length-2;if(0==a)return 1;for(var s=a>>>1;;){if(t[Math.floor(s+1)]<=e?i=s+1:a=s,i==a)return i+1;s=i+a>>>1}return 0},e.apply=function(t,e,i){if(void 0===i&&(i=1),t+=.05,!(this.timeList.length<=0)){var a=0;if(!(t<this.timeList[0])){var s=this.vectices[0].length,r=[],n=this.binarySearch1(this.timeList,t);if(this.frameIndex=n,t>=this.timeList[this.timeList.length-1]){var h=this.vectices[this.vectices.length-1];if(i<1)for(a=0;a<s;a++)r[a]+=(h[a]-r[a])*i;else for(a=0;a<s;a++)r[a]=h[a];this.deformData=r}else{this.tweenKeyList[this.frameIndex];var l=this.vectices[this.frameIndex-1],o=this.vectices[this.frameIndex],u=this.timeList[this.frameIndex-1],c=this.timeList[this.frameIndex];i=this.tweenKeyList[n-1]?(t-u)/(c-u):0;for(var d,a=0;a<s;a++)d=l[a],r[a]=d+(o[a]-d)*i;this.deformData=r}}}},t}(),Lt=(n(U,"laya.ani.bone.DrawOrderData"),U);function U(){this.time=NaN,this.drawOrder=[]}var Rt=(n(L,"laya.ani.bone.EventData"),L);function L(){this.name=null,this.intValue=0,this.floatValue=NaN,this.stringValue=null,this.audioValue=null,this.time=NaN}var R=function(){function k(t,e){this._targetBone=null,this._bones=null,this._data=null,this.name=null,this.mix=NaN,this.bendDirection=NaN,this.isSpine=!0,this._sp=null,this.isDebug=!1,this._data=t,this._targetBone=e[t.targetBoneIndex],this.isSpine=t.isSpine,null==this._bones&&(this._bones=[]);for(var i=this._bones.length=0,a=t.boneIndexs.length;i<a;i++)this._bones.push(e[t.boneIndexs[i]]);this.name=t.name,this.mix=t.mix,this.bendDirection=t.bendDirection}n(k,"laya.ani.bone.IkConstraint");var t=k.prototype;return t.apply=function(){switch(this._bones.length){case 1:this._applyIk1(this._bones[0],this._targetBone.resultMatrix.tx,this._targetBone.resultMatrix.ty,this.mix);break;case 2:this.isSpine?this._applyIk2(this._bones[0],this._bones[1],this._targetBone.resultMatrix.tx,this._targetBone.resultMatrix.ty,this.bendDirection,this.mix):this._applyIk3(this._bones[0],this._bones[1],this._targetBone.resultMatrix.tx,this._targetBone.resultMatrix.ty,this.bendDirection,this.mix)}},t._applyIk1=function(t,e,i,a){var s=t.parentBone,r=1/(s.resultMatrix.a*s.resultMatrix.d-s.resultMatrix.b*s.resultMatrix.c),n=e-s.resultMatrix.tx,e=i-s.resultMatrix.ty,i=(n*s.resultMatrix.d-e*s.resultMatrix.c)*r-t.transform.x,r=(e*s.resultMatrix.a-n*s.resultMatrix.b)*r-t.transform.y,i=Math.atan2(r,i)*k.radDeg-t.transform.skX;t.transform.scX<0&&(i+=180),180<i?i-=360:i<-180&&(i+=360),t.transform.skX=t.transform.skY=t.transform.skX+i*a,t.update()},t.updatePos=function(t,e){this._sp&&this._sp.pos(t,e)},t._applyIk2=function(t,e,i,a,s,r){var n,h,l,o,u,c,d,_,p,f,m,y,x,g,v,D,M,I,b,N,A,T,C,S,w,F;0!=r&&(n=t.resultTransform.x,h=t.resultTransform.y,o=(M=t.transform.scX)<(o=u=l=0)?(M=-M,l=180,-1):(l=0,1),(A=t.transform.scY)<0&&(A=-A,o=-o),u=(x=e.transform.scX)<0?(x=-x,180):0,c=e.resultTransform.x,f=F=d=NaN,m=t.resultMatrix.a,y=t.resultMatrix.c,I=t.resultMatrix.b,D=t.resultMatrix.d,f=(S=Math.abs(M-A)<=1e-4)?(F=m*c+y*(d=e.resultTransform.y)+t.resultMatrix.tx,I*c+D*d+t.resultMatrix.ty):(d=0,F=m*c+t.resultMatrix.tx,I*c+t.resultMatrix.ty),this.isDebug&&(this._sp||(this._sp=new B,P.stage.addChild(this._sp)),this._sp.graphics.clear(),this._sp.graphics.drawCircle(i,a,15,"#ffff00"),this._sp.graphics.drawCircle(F,f,15,"#ff00ff")),t.setRotation(Math.atan2(f-t.resultMatrix.ty,F-t.resultMatrix.tx)),m=(p=t.parentBone).resultMatrix.a,y=p.resultMatrix.c,I=p.resultMatrix.b,v=1/(m*(D=p.resultMatrix.d)-y*I),i=((C=i-p.resultMatrix.tx)*D-(_=a-p.resultMatrix.ty)*y)*v-n,a=(_*m-C*I)*v-h,F=((C=F-p.resultMatrix.tx)*D-(_=f-p.resultMatrix.ty)*y)*v-n,f=(_*m-C*I)*v-h,p=Math.sqrt(F*F+f*f),v=e.length*x,f=F=NaN,S?((g=(i*i+a*a-p*p-(v*=M)*v)/(2*p*v))<-1?g=-1:1<g&&(g=1),f=Math.acos(g)*s,m=p+v*g,y=v*Math.sin(f),F=Math.atan2(a*m-i*y,i*m+a*y)):(x=(m=M*v)*m,S=(y=A*v)*y,g=i*i+a*a,v=Math.atan2(a,i),0<(D=(a=-2*S*p)*a-4*(i=S-x)*(I=S*p*p+x*g-x*S))&&(b=Math.sqrt(D),w=(b=-(a+(b=a<0?-b:b))/2)/i,N=I/b,(T=Math.abs(w)<Math.abs(N)?w:N)*T<=g&&(_=Math.sqrt(g-T*T)*s,F=v-Math.atan2(_,T),f=Math.atan2(_/A,(T-p)/M))),T=A=N=w=b=I=i=0,N<(D=(C=p+m)*C)&&(w=0,N=D,A=C),(D=(C=p-m)*C)<(M=Number.MAX_VALUE)&&(i=Math.PI,M=D,I=C),S=Math.acos(-m*p/(x-S)),(D=(C=m*Math.cos(S)+p)*C+(_=y*Math.sin(S))*_)<M&&(i=S,M=D,I=C,b=_),N<D&&(w=S,N=D,A=C,T=_),f=g<=(M+N)/2?(F=v-Math.atan2(b*s,I),i*s):(F=v-Math.atan2(T*s,A),w*s)),w=Math.atan2(d,c)*o,s=t.resultTransform.skX,180<(F=(F-w)*k.radDeg+l-s)?F-=360:F<-180&&(F+=360),t.resultTransform.x=n,t.resultTransform.y=h,t.resultTransform.skX=t.resultTransform.skY=s+F*r,s=e.resultTransform.skX,180<(f=(f+w)*k.radDeg*o+u-(s%=360))?f-=360:f<-180&&(f+=360),e.resultTransform.x=c,e.resultTransform.y=d,e.resultTransform.skX=e.resultTransform.skY=e.resultTransform.skY+f*r,t.update())},t._applyIk3=function(t,e,i,a,s,r){var n,h,l,o,u,c,d,_,p,f,m,y,x,g;0!=r&&(h=n=NaN,f=(y=e.resultMatrix.a*e.length)*y+(m=e.resultMatrix.b*e.length)*m,l=Math.sqrt(f),g=t.resultMatrix.tx,x=t.resultMatrix.ty,o=(u=(d=e.resultMatrix.tx)-g)*u+(c=(_=e.resultMatrix.ty)-x)*c,r=Math.sqrt(o),y=(u=i-t.resultMatrix.tx)*u+(c=a-t.resultMatrix.ty)*c,_=l+r<=(m=Math.sqrt(y))||m+l<=r||m+r<=l?(p=NaN,d=g+(p=l+r<=m?1:-1)*(i-g)*r/m,x+p*(a-x)*r/m):(r=g+u*(p=(o-f+y)/(2*y)),f=x+c*p,m=-c*(y=Math.sqrt(o-p*p*y)/m),y=u*y,0<s?(d=r-m,f-y):(d=r+m,f+y)),n=d,h=_,this.isDebug&&(this._sp||(this._sp=new B,P.stage.addChild(this._sp)),this._sp.graphics.clear(),this._sp.graphics.drawCircle(g,x,15,"#ff00ff"),this._sp.graphics.drawCircle(i,a,15,"#ffff00"),this._sp.graphics.drawCircle(n,h,15,"#ff00ff")),g=NaN,g=Math.atan2(h-t.resultMatrix.ty,n-t.resultMatrix.tx),t.setRotation(g),(x=k._tempMatrix).identity(),x.rotate(g),x.scale(t.resultMatrix.getScaleX(),t.resultMatrix.getScaleY()),x.translate(t.resultMatrix.tx,t.resultMatrix.ty),x.copyTo(t.resultMatrix),t.updateChild(),t=NaN,t=Math.atan2(a-h,i-n),e.setRotation(t),(i=k._tempMatrix).identity(),i.rotate(t),i.scale(e.resultMatrix.getScaleX(),e.resultMatrix.getScaleY()),i.translate(n,h),x.copyTo(e.resultMatrix),e.updateChild())},e(k,["radDeg",function(){return this.radDeg=180/Math.PI},"degRad",function(){return this.degRad=Math.PI/180},"_tempMatrix",function(){return this._tempMatrix=new St}]),k}(),Ot=(n(O,"laya.ani.bone.IkConstraintData"),O);function O(){this.name=null,this.targetBoneName=null,this.bendDirection=1,this.mix=1,this.isSpine=!0,this.targetBoneIndex=-1,this.boneNames=[],this.boneIndexs=[]}var E=(n(V,"laya.ani.bone.MeshTools"),V.findEdge=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!0);for(var a=0,s=0,r=t.length,s=-1,a=0;a<r;a+=2)(s<0||i==t[s+e]<t[a+e])&&(s=a);return s},V.findBestTriangle=function(t){var e=V.findEdge(t,1,!0),i=V.findEdge(t,1,!1),a=V.findEdge(t,0,!0),s=V.findEdge(t,0,!1),t=V._bestTriangle;return t.length=0,t.push(a,s),t.indexOf(e)<0&&t.push(e),t.indexOf(i)<0&&t.push(i),t},V.solveMesh=function(t,e){(e=e||[]).length=0;var i,a=t.uvs,s=t.vertices,r=(i=V.findBestTriangle(a))[0],n=i[1],h=i[2];return V._absArr.length=0,V.isNormalUV(t.texture.uv)&&V.adptTexture(t),a=V.solvePoints(t.texture.uv,a[r],a[r+1],a[n]-a[r],a[n+1]-a[r+1],a[h]-a[r],a[h+1]-a[r+1],V._absArr),V.transPoints(a,s[r],s[r+1],s[n]-s[r],s[n+1]-s[r+1],s[h]-s[r],s[h+1]-s[r+1],e)},V.findWrapRect=function(t){var e=0,e=V.findEdge(t,1,!0),i=V.findEdge(t,1,!1),a=V.findEdge(t,0,!0),s=V.findEdge(t,0,!1),r=t[a],a=t[s],s=t[e+1],e=NaN;return[a,e=t[i+1],r-a,s-e]},V.adptTexture=function(t){var e=V.findWrapRect(t.uvs),i=t.texture,a=i.width,s=i.height,s=wt.create(i,e[0]*a,e[1]*s,e[2]*a,e[3]*s);t.texture=s},V.isNormalUV=function(t){return 0==t[0]&&0==t[1]&&1==t[4]&&1==t[5]},V.solvePoints=function(t,e,i,a,s,r,n,h){h=h||[];for(var l,o=0,u=t.length,o=0;o<u;o+=2)l=V.solve2(t[o],t[o+1],e,i,a,s,r,n),h.push(l[0],l[1]);return h},V.transPoints=function(t,e,i,a,s,r,n,h){h=h||[];for(var l=0,o=t.length,l=0;l<o;l+=2)V.transPoint(t[l],t[l+1],e,i,a,s,r,n,h);return h},V.transPoint=function(t,e,i,a,s,r,n,h,l){return(l=l||[]).push(i+s*t+n*e,a+r*t+h*e),l},V.solve2=function(t,e,i,a,s,r,n,h,l,o){void 0===l&&(l=!1),o=o||[];var u=NaN;if(0==s)return V.solve2(t,e,i,a,n,h,s,r,!0,o);var c=NaN,d=((c=t-i)-(u=(e-a-c*r/s)/(h-n*r/s))*n)/s;return l?o.push(u,d):o.push(d,u),o},V.solve=function(t,e,i,a){return V.solve2(t.x,t.y,e.x,e.y,i.x,i.y,a.x,a.y)},V._bestTriangle=[],V._absArr=[],V);function V(){}var K=function(){function k(t,e){this.target=null,this.data=null,this.bones=null,this.position=NaN,this.spacing=NaN,this.rotateMix=NaN,this.translateMix=NaN,this._debugKey=!1,this._spaces=null,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 i=this.data.bones,a=0,s=i.length;a<s;a++)this.bones.push(e[i[a]])}n(k,"laya.ani.bone.PathConstraint");var t=k.prototype;return t.apply=function(t,e){if(this.target){var i=this.translateMix,a=this.translateMix,s=0<a,r=this.data.spacingMode,n="length"==r,h=this.data.rotateMode,l="tangent"==h,o="chainScale"==h,u=[],c=this.bones.length,d=l?c:c+1,_=[];(this._spaces=_)[0]=this.position;var p=this.spacing;if(o||n)for(var f=0,m=d-1;f<m;){var y=this.bones[f],x=(v=y.length)*y.resultMatrix.a,g=v*y.resultMatrix.b,v=Math.sqrt(x*x+g*g);o&&(u[f]=v),_[++f]=n?Math.max(0,v+p):p}else for(f=1;f<d;f++)_[f]=p;var D=this.computeWorldPositions(this.target,t,e,d,l,"percent"==this.data.positionMode,"percent"==r);if(this._debugKey){for(f=0;f<D.length;f++)e.drawCircle(D[f++],D[f++],5,"#00ff00");for(var M=[],f=0;f<D.length;f++)M.push(D[f++],D[f++]);e.drawLines(0,0,M,"#ff0000")}var I=D[0],b=D[1],N=this.data.offsetRotation,A="chain"==h&&0==N,T=NaN;for(f=0,T=3;f<c;f++,T+=3){(y=this.bones[f]).resultMatrix.tx+=(I-y.resultMatrix.tx)*i,y.resultMatrix.ty+=(b-y.resultMatrix.ty)*i;var C,S,w,F,k,P,B,U=(x=D[T])-I,L=(g=D[T+1])-b;o&&0!=(v=u[f])&&(P=(Math.sqrt(U*U+L*L)/v-1)*a+1,y.resultMatrix.a*=P,y.resultMatrix.c*=P),I=x,b=g,s&&(C=y.resultMatrix.a,S=y.resultMatrix.c,w=y.resultMatrix.b,F=y.resultMatrix.d,P=k=B=NaN,B=l?D[T-1]:0==_[f+1]?D[T+2]:Math.atan2(L,U),B-=Math.atan2(w,C)-N/180*Math.PI,A&&(k=Math.cos(B),P=Math.sin(B),I+=((v=y.length)*(k*C-P*w)-U)*a,b+=(v*(P*C+k*w)-L)*a),B>Math.PI?B-=2*Math.PI:B<-Math.PI&&(B+=2*Math.PI),B*=a,k=Math.cos(B),P=Math.sin(B),y.resultMatrix.a=k*C-P*w,y.resultMatrix.c=k*S-P*F,y.resultMatrix.b=P*C+k*w,y.resultMatrix.d=P*S+k*F)}}},t.computeWorldVertices2=function(t,e,i,a,s,r){var n,h,l=t.currDisplayData.bones,o=t.currDisplayData.weights,u=t.currDisplayData.triangles,c=0,d=0,_=0,p=0,f=0,m=0,y=0,x=0,g=0,v=0;if(null!=l){for(c=0;c<i;c+=2)d+=(p=l[d])+1,_+=p;for(var D=e,f=r,m=3*_;f<a;f+=2){for(x=y=0,p=l[d++],p+=d;d<p;d++,m+=3){var M=D[l[d]].resultMatrix,g=o[m],v=o[m+1],I=o[m+2];y+=(g*M.a+v*M.c+M.tx)*I,x+=(g*M.b+v*M.d+M.ty)*I}s[f]=y,s[f+1]=x}}else{var b,u=u||o;if(t.deformData&&(u=t.deformData),b=t.parent,e)for(h=e.length,c=0;c<h;c++)if(e[c].name==b){n=e[c];break}var N,A=(N=(N=n?n.resultMatrix:N)||k._tempMt).tx,T=N.ty,C=N.a,S=N.b,w=N.c,F=N.d;for(n&&(F*=n.d),d=i,f=r;f<a;d+=2,f+=2)g=u[d],v=u[d+1],s[f]=g*C+v*S+A,s[f+1]=-(g*w+v*F+T)}},t.computeWorldPositions=function(t,e,i,a,s,r,n){t.currDisplayData.bones,t.currDisplayData.weights,t.currDisplayData.triangles;var h=[],l=0,o=t.currDisplayData.verLen,u=this.position,c=this._spaces,d=[],_=[],p=o/6,f=-1,m=NaN,y=0,x=0,g=NaN,v=NaN,D=NaN,M=NaN;if(0,p--,this.computeWorldVertices2(t,e,2,o-=4,h,0),this._debugKey)for(l=0;l<h.length;)i.drawCircle(h[l++],h[l++],10,"#ff0000");d=h,this._curves.length=p;for(var I=this._curves,b=d[m=0],N=d[1],A=0,T=0,C=0,S=0,w=0,F=0,k=NaN,P=NaN,B=NaN,U=NaN,L=NaN,R=NaN,O=NaN,E=NaN,V=0,l=0,V=2;l<p;l++,V+=6)A=d[V],T=d[V+1],C=d[V+2],S=d[V+3],L=2*(k=.1875*(b-2*A+C))+(B=.09375*(3*(A-C)-b+(w=d[V+4]))),R=2*(P=.1875*(N-2*T+S))+(U=.09375*(3*(T-S)-N+(F=d[V+5]))),O=.75*(A-b)+k+.16666667*B,E=.75*(T-N)+P+.16666667*U,m+=Math.sqrt(O*O+E*E),O+=L,E+=R,L+=B,R+=U,m+=Math.sqrt(O*O+E*E),O+=L,E+=R,m+=Math.sqrt(O*O+E*E),O+=L+B,E+=R+U,m+=Math.sqrt(O*O+E*E),I[l]=m,b=w,N=F;if(r&&(u*=m),n)for(l=0;l<a;l++)c[l]*=m;for(var K=this._segments,Y=0,W=0,W=x=y=l=0;l<a;l++,y+=3)if((g=u+=v=c[l])<0)this.addBeforePosition(g,d,0,_,y);else if(m<g)this.addAfterPosition(g-m,d,o-4,_,y);else{for(;;x++)if(!((M=I[x])<g)){0==x?g/=M:g=(g-(D=I[x-1]))/(M-D);break}if(x!=f){var f=x,X=6*x,b=d[X],N=d[X+1],A=d[X+2],T=d[X+3],C=d[X+4],S=d[X+5],L=2*(k=.03*(b-2*A+C))+(B=.006*(3*(A-C)-b+(w=d[X+6]))),R=2*(P=.03*(N-2*T+S))+(U=.006*(3*(T-S)-N+(F=d[X+7]))),O=.3*(A-b)+k+.16666667*B,E=.3*(T-N)+P+.16666667*U,Y=Math.sqrt(O*O+E*E);for(K[0]=Y,X=1;X<8;X++)O+=L,E+=R,L+=B,R+=U,Y+=Math.sqrt(O*O+E*E),K[X]=Y;O+=L,E+=R,Y+=Math.sqrt(O*O+E*E),K[8]=Y,O+=L+B,E+=R+U,Y+=Math.sqrt(O*O+E*E),K[9]=Y,W=0}for(g*=Y;;W++)if(!((M=K[W])<g)){0==W?g/=M:g=W+(g-(D=K[W-1]))/(M-D);break}this.addCurvePosition(.1*g,b,N,A,T,C,S,w,F,_,y,s||0<l&&0==v)}return _},t.addBeforePosition=function(t,e,i,a,s){var r=e[i],n=e[i+1],h=e[i+2]-r,i=e[i+3]-n,h=Math.atan2(i,h);a[s]=r+t*Math.cos(h),a[s+1]=n+t*Math.sin(h),a[s+2]=h},t.addAfterPosition=function(t,e,i,a,s){var r=e[i+2],n=e[i+3],h=r-e[i],i=n-e[i+1],h=Math.atan2(i,h);a[s]=r+t*Math.cos(h),a[s+1]=n+t*Math.sin(h),a[s+2]=h},t.addCurvePosition=function(t,e,i,a,s,r,n,h,l,o,u,c){var d=(t=0==t?1e-4:t)*t,_=d*t,p=1-t,f=p*p,m=f*p,y=p*t,x=3*y,p=p*x,t=x*t,h=e*m+a*p+r*t+h*_,_=i*m+s*p+n*t+l*_;o[u]=h,o[u+1]=_,o[u+2]=c?Math.atan2(_-(i*f+s*y*2+n*d),h-(e*f+a*y*2+r*d)):0},k.NONE=-1,k.BEFORE=-2,k.AFTER=-3,e(k,["_tempMt",function(){return this._tempMt=new St}]),k}(),Et=(n(Y,"laya.ani.bone.PathConstraintData"),Y);function Y(){this.name=null,this.target=null,this.positionMode=null,this.spacingMode=null,this.rotateMode=null,this.offsetRotation=NaN,this.position=NaN,this.spacing=NaN,this.rotateMix=NaN,this.translateMix=NaN,this.bones=[]}var Vt=(n(W,"laya.ani.bone.SkinData"),W);function W(){this.name=null,this.slotArr=[]}var Kt=function(){function t(){this.name=null,this.attachmentName=null,this.type=0,this.transform=null,this.width=NaN,this.height=NaN,this.texture=null,this.bones=null,this.uvs=null,this.weights=null,this.triangles=null,this.vertices=null,this.lengths=null,this.verLen=0}n(t,"laya.ani.bone.SkinSlotDisplayData");var e=t.prototype;return e.createTexture=function(t){return this.texture||(this.texture=new wt(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),d.isWebGL||this.uvs[1]>this.uvs[5]&&(this.texture.offsetY=this.texture.sourceHeight-this.texture.height-this.texture.offsetY),this.texture)},e.destory=function(){this.texture&&this.texture.destroy()},t}(),Yt=(n(X,"laya.ani.bone.SlotData"),X.prototype.getDisplayByName=function(t){for(var e=0,i=this.displayArr.length;e<i;e++)if(this.displayArr[e].attachmentName==t)return e;return-1},X);function X(){this.name=null,this.displayArr=[]}var z=(n(q,"laya.ani.bone.TfConstraint"),q.prototype.apply=function(){for(var t=this.target.resultMatrix.a,e=this.target.resultMatrix.b,i=this.target.resultMatrix.c,a=this.target.resultMatrix.d,s=0,r=this._bones.length;s<r;s++){var n,h,l,o,u,c,d,_,p,f=this._bones[s];0<this.rotateMix&&(n=f.resultMatrix.a,c=f.resultMatrix.b,h=f.resultMatrix.c,d=f.resultMatrix.d,(p=Math.atan2(i,t)-Math.atan2(h,n)+this._data.offsetRotation*Math.PI/180)>Math.PI?p-=2*Math.PI:p<-Math.PI&&(p+=2*Math.PI),p*=this.rotateMix,o=Math.cos(p),l=Math.sin(p),f.resultMatrix.a=o*n-l*h,f.resultMatrix.b=o*c-l*d,f.resultMatrix.c=l*n+o*h,f.resultMatrix.d=l*c+o*d),this.translateMix&&(this._temp[0]=this._data.offsetX,this._temp[1]=this._data.offsetY,this.target.localToWorld(this._temp),f.resultMatrix.tx+=(this._temp[0]-f.resultMatrix.tx)*this.translateMix,f.resultMatrix.ty+=(this._temp[1]-f.resultMatrix.ty)*this.translateMix,f.updateChild()),0<this.scaleMix&&(_=Math.sqrt(f.resultMatrix.a*f.resultMatrix.a+f.resultMatrix.c*f.resultMatrix.c),o=Math.sqrt(t*t+i*i),u=1e-5<_?(_+(o-_+this._data.offsetScaleX)*this.scaleMix)/_:0,f.resultMatrix.a*=u,f.resultMatrix.c*=u,_=Math.sqrt(f.resultMatrix.b*f.resultMatrix.b+f.resultMatrix.d*f.resultMatrix.d),o=Math.sqrt(e*e+a*a),u=1e-5<_?(_+(o-_+this._data.offsetScaleY)*this.scaleMix)/_:0,f.resultMatrix.b*=u,f.resultMatrix.d*=u),0<this.shearMix&&(c=f.resultMatrix.b,d=f.resultMatrix.d,_=Math.atan2(d,c),(p=Math.atan2(a,e)-Math.atan2(i,t)-(_-Math.atan2(f.resultMatrix.c,f.resultMatrix.a)))>Math.PI?p-=2*Math.PI:p<-Math.PI&&(p+=2*Math.PI),p=_+(p+this._data.offsetShearY*Math.PI/180)*this.shearMix,u=Math.sqrt(c*c+d*d),f.resultMatrix.b=Math.cos(p)*u,f.resultMatrix.d=Math.sin(p)*u)}},q);function q(t,e){this._data=null,this._bones=null,this.target=null,this.rotateMix=NaN,this.translateMix=NaN,this.scaleMix=NaN,this.shearMix=NaN,this._temp=f(2,0),this._data=t,null==this._bones&&(this._bones=[]),this.target=e[t.targetIndex];for(var i=0,i=0,a=t.boneIndexs.length;i<a;i++)this._bones.push(e[t.boneIndexs[i]]);this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix}var Wt=(n(G,"laya.ani.bone.TfConstraintData"),G);function G(){this.name=null,this.targetIndex=0,this.rotateMix=NaN,this.translateMix=NaN,this.scaleMix=NaN,this.shearMix=NaN,this.offsetRotation=NaN,this.offsetX=NaN,this.offsetY=NaN,this.offsetScaleX=NaN,this.offsetScaleY=NaN,this.offsetShearY=NaN,this.boneIndexs=[]}var Xt=function(){function t(){this.skX=0,this.skY=0,this.scX=1,this.scY=1,this.x=0,this.y=0,this.skewX=0,this.skewY=0,this.mMatrix=null}n(t,"laya.ani.bone.Transform");var e=t.prototype;return e.initData=function(t){null!=t.x&&(this.x=t.x),null!=t.y&&(this.y=t.y),null!=t.skX&&(this.skX=t.skX),null!=t.skY&&(this.skY=t.skY),null!=t.scX&&(this.scX=t.scX),null!=t.scY&&(this.scY=t.scY)},e.getMatrix=function(){var t=this.mMatrix||(this.mMatrix=new St);return t.identity(),t.scale(this.scX,this.scY),(this.skewX||this.skewY)&&this.skew(t,this.skewX*Math.PI/180,this.skewY*Math.PI/180),t.rotate(this.skX*Math.PI/180),t.translate(this.x,this.y),t},e.skew=function(t,e,i){var a=Math.sin(i),s=Math.cos(i),i=Math.sin(e),e=Math.cos(e);return t.setTo(t.a*e-t.b*a,t.a*i+t.b*s,t.c*e-t.d*a,t.c*i+t.d*s,t.tx*e-t.ty*a,t.tx*i+t.ty*s),t},t}(),H=(n(Q,"laya.ani.bone.UVTools"),Q.getRelativeUV=function(t,e,i){var a=t[0],s=t[2]-t[0],r=t[1],t=t[5]-t[1];(i=i||[]).length=e.length;for(var n=0,h=i.length,l=1/s,o=1/t,n=0;n<h;n+=2)i[n]=(e[n]-a)*l,i[n+1]=(e[n+1]-r)*o;return i},Q.getAbsoluteUV=function(t,e,i){if(0==t[0]&&0==t[1]&&1==t[4]&&1==t[5])return i?(x.copyArray(i,e),i):e;var a=t[0],s=t[2]-t[0],r=t[1],n=t[5]-t[1];(i=i||[]).length=e.length;for(var h=0,l=i.length,h=0;h<l;h+=2)i[h]=e[h]*s+a,i[h+1]=e[h+1]*n+r;return i},Q);function Q(){}var Z=(n(j,"laya.ani.KeyFramesContent"),j);function j(){this.startTime=NaN,this.duration=NaN,this.interpolationData=null,this.data=null,this.nextData=null}var $=(n(J,"laya.ani.math.BezierLerp"),J.getBezierRate=function(t,e,i,a,s){var r=J._getBezierParamKey(e,i,a,s),n=100*r+t;if(J._bezierResultCache[n])return J._bezierResultCache[n];for(var h=J._getBezierPoints(e,i,a,s,r),l=0,o=h.length,l=0;l<o;l+=2)if(t<=h[l])return J._bezierResultCache[n]=h[l+1],h[l+1];return J._bezierResultCache[n]=1},J._getBezierParamKey=function(t,e,i,a){return 100*(100*(100*(100*t+e)+i)+a)},J._getBezierPoints=function(t,e,i,a,s){if(J._bezierPointsCache[s])return J._bezierPointsCache[s];var a=[0,0,t,e,i,a,1,1],a=(new r).getBezierPoints(a,100,3);return J._bezierPointsCache[s]=a},J._bezierResultCache={},J._bezierPointsCache={},J);function J(){}var tt=function(){function t(){this._destroyed=!1,this._templet=null,this._currentTime=NaN,this._currentFrameTime=NaN,this._playStart=NaN,this._playEnd=NaN,this._playDuration=NaN,this._overallDuration=NaN,this._stopWhenCircleFinish=!1,this._elapsedPlaybackTime=NaN,this._startUpdateLoopCount=NaN,this._currentAnimationClipIndex=0,this._currentKeyframeIndex=0,this._paused=!1,this._cacheFrameRate=0,this._cacheFrameRateInterval=NaN,this._cachePlayRate=NaN,this._fullFrames=null,this.isCache=!0,this.playbackRate=1,this.returnToZeroStopped=!1,t.__super.call(this),this._destroyed=!1,this._currentAnimationClipIndex=-1,this._currentKeyframeIndex=-1,this._currentTime=0,this._overallDuration=Number.MAX_VALUE,this._stopWhenCircleFinish=!1,this._elapsedPlaybackTime=0,this._startUpdateLoopCount=-1,this._cachePlayRate=1,this.cacheFrameRate=60,this.returnToZeroStopped=!1}n(t,"laya.ani.AnimationPlayer",i);var e=t.prototype;return P.imps(e,{"laya.resource.IDestroy":!0}),e._onTempletLoadedComputeFullKeyframeIndices=function(t,e,i){this._templet===i&&this._cachePlayRate===t&&this._cacheFrameRate===e&&this._computeFullKeyframeIndices()},e._computeFullKeyframeIndices=function(){for(var t=this._fullFrames=[],e=this._templet,i=this._cacheFrameRateInterval*this._cachePlayRate,a=0,s=e.getAnimationCount();a<s;a++){for(var r=[],n=0,h=e.getAnimation(a).nodes.length;n<h;n++){for(var l=e.getAnimation(a).nodes[n],o=Math.floor(l.playTime/i+.01),u=new Uint16Array(o+1),c=-1,d=0,_=l.keyFrame.length;d<_;d++){var p=l.keyFrame[d],f=p.startTime,m=f+p.duration+i;do{for(var y=Math.floor(f/i+.5),x=c+1;x<y;x++)u[x]=d}while(u[c=y]=d,(f+=i)<=m)}r.push(u)}t.push(r)}},e._onAnimationTempletLoaded=function(){this.destroyed||this._calculatePlayDuration()},e._calculatePlayDuration=function(){var t;0!==this.state&&(t=this._templet.getAniDuration(this._currentAnimationClipIndex),0===this._playEnd&&(this._playEnd=t),this._playEnd>t&&(this._playEnd=t),this._playDuration=this._playEnd-this._playStart)},e._setPlayParams=function(t,e){this._currentTime=t,this._currentKeyframeIndex=Math.max(Math.floor(this.currentPlayTime/e+.01),0),this._currentFrameTime=this._currentKeyframeIndex*e},e._setPlayParamsWhenStop=function(t,e,i){void 0===i&&(i=-1),this._currentTime=t,this._currentKeyframeIndex=Math.max(Math.floor((0<i?i:t)/e+.01),0),this._currentFrameTime=this._currentKeyframeIndex*e,this._currentAnimationClipIndex=-1},e._update=function(t){if(-1!==this._currentAnimationClipIndex&&!this._paused&&this._templet&&this._templet.loaded){var e=this._cacheFrameRateInterval*this._cachePlayRate,i=0;this._startUpdateLoopCount!==y.loopCount&&(i=t*this.playbackRate,this._elapsedPlaybackTime+=i);var a=this.playDuration;if(i+=this._currentTime,0!==this._overallDuration&&this._elapsedPlaybackTime>=this._overallDuration||0===this._overallDuration&&this._elapsedPlaybackTime>=a||0===this._overallDuration&&i>=this.playEnd)return this._setPlayParamsWhenStop(a,e,this.playEnd),void this.event("stopped");if(0<a)if(a<=i){do{if(i-=a,this._stopWhenCircleFinish)return this._setPlayParamsWhenStop(a,e),this._stopWhenCircleFinish=!1,void this.event("stopped")}while(i<a&&(this._setPlayParams(i,e),this.event("complete")),a<=i)}else this._setPlayParams(i,e);else{if(this._stopWhenCircleFinish)return this._setPlayParamsWhenStop(a,e),this._stopWhenCircleFinish=!1,void this.event("stopped");this._currentTime=this._currentFrameTime=this._currentKeyframeIndex=0,this.event("complete")}}},e._destroy=function(){this.offAll(),this._templet=null,this._fullFrames=null,this._destroyed=!0},e.play=function(t,e,i,a,s){if(void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=2147483647),void 0===a&&(a=0),void 0===s&&(s=0),!this._templet)throw new Error("AnimationPlayer:templet must not be null,maybe you need to set url.");if(i<0||a<0||s<0)throw new Error("AnimationPlayer:overallDuration,playStart and playEnd must large than zero.");if(0!==s&&s<a)throw new Error("AnimationPlayer:start must less than end.");this._currentTime=0,this._currentFrameTime=0,this._elapsedPlaybackTime=0,this.playbackRate=e,this._overallDuration=i,this._playStart=a,this._playEnd=s,this._paused=!1,this._currentAnimationClipIndex=t,this._currentKeyframeIndex=0,this._startUpdateLoopCount=y.loopCount,this.event("played"),this._templet.loaded?this._calculatePlayDuration():this._templet.once("loaded",this,this._onAnimationTempletLoaded),this._update(0)},e.playByFrame=function(t,e,i,a,s,r){r=1e3/(r=void 0===r?30:r);this.play(t=void 0===t?0:t,e=void 0===e?1:e,i=void 0===i?2147483647:i,(a=void 0===a?0:a)*r,(s=void 0===s?0:s)*r)},e.stop=function(t){(t=void 0===t?!0:t)?(this._currentTime=this._currentFrameTime=this._currentKeyframeIndex=0,this._currentAnimationClipIndex=-1,this.event("stopped")):this._stopWhenCircleFinish=!0},a(0,e,"playEnd",function(){return this._playEnd}),a(0,e,"templet",function(){return this._templet},function(t){0===!this.state&&this.stop(!0),this._templet!==t&&((this._templet=t).loaded?this._computeFullKeyframeIndices():t.once("loaded",this,this._onTempletLoadedComputeFullKeyframeIndices,[this._cachePlayRate,this._cacheFrameRate]))}),a(0,e,"playStart",function(){return this._playStart}),a(0,e,"playDuration",function(){return this._playDuration}),a(0,e,"state",function(){return-1===this._currentAnimationClipIndex?0:this._paused?1:2}),a(0,e,"currentKeyframeIndex",function(){return this._currentKeyframeIndex}),a(0,e,"overallDuration",function(){return this._overallDuration}),a(0,e,"currentFrameTime",function(){return this._currentFrameTime}),a(0,e,"currentAnimationClipIndex",function(){return this._currentAnimationClipIndex}),a(0,e,"currentPlayTime",function(){return this._currentTime+this._playStart}),a(0,e,"cachePlayRate",function(){return this._cachePlayRate},function(t){this._cachePlayRate!==t&&(this._cachePlayRate=t,this._templet&&(this._templet.loaded?this._computeFullKeyframeIndices():this._templet.once("loaded",this,this._onTempletLoadedComputeFullKeyframeIndices,[t,this._cacheFrameRate])))}),a(0,e,"cacheFrameRate",function(){return this._cacheFrameRate},function(t){this._cacheFrameRate!==t&&(this._cacheFrameRate=t,this._cacheFrameRateInterval=1e3/this._cacheFrameRate,this._templet&&(this._templet.loaded?this._computeFullKeyframeIndices():this._templet.once("loaded",this,this._onTempletLoadedComputeFullKeyframeIndices,[this._cachePlayRate,t])))}),a(0,e,"currentTime",null,function(t){if(-1!==this._currentAnimationClipIndex&&this._templet&&this._templet.loaded){if(t<this._playStart||t>this._playEnd)throw new Error("AnimationPlayer:value must large than playStartTime,small than playEndTime.");this._startUpdateLoopCount=y.loopCount;var e=this._cacheFrameRateInterval*this._cachePlayRate;this._currentTime=t,this._currentKeyframeIndex=Math.max(Math.floor(this.currentPlayTime/e),0),this._currentFrameTime=this._currentKeyframeIndex*e}}),a(0,e,"paused",function(){return this._paused},function(t){(this._paused=t)&&this.event("paused")}),a(0,e,"cacheFrameRateInterval",function(){return this._cacheFrameRateInterval}),a(0,e,"destroyed",function(){return this._destroyed}),t}(),et=(n(it,"laya.ani.GraphicsAni",t),it.prototype.drawSkin=function(t){this._saveToCmd(d._context._drawSkin,[t])},it.create=function(){return it._caches.pop()||new it},it.recycle=function(t){t.clear(),it._caches.push(t)},it._caches=[],it);function it(){it.__super.call(this),d.isConchNode&&(this.drawSkin=function(t){t.transform||(t.transform=St.EMPTY),this._addCmd([t]),this.setSkinMesh&&this.setSkinMesh(t._ps,t.mVBData,t.mEleNum,0,t.mTexture,t.transform)})}var at=function(){function a(){a.__super.call(this),this.mesh=new S}n(a,"laya.ani.bone.canvasmesh.SkinMeshCanvas",C);var t=a.prototype;return t.init2=function(t,e,i,a,s){var r;this.transform&&(this.transform=null),i?r=i:(r=[]).push(0,1,3,3,1,2),this.mesh.texture=t,this.mesh.indexes=r,this.mesh.vertices=a,this.mesh.uvs=s},t.render=function(t,e,i){this.mesh.texture&&(this.transform?(this.transform.translate(e,i),this.renderToContext(t),this.transform.translate(-e,-i)):(this.transform=a._tempMatrix,this.transform.identity(),this.transform.translate(e,i),this.renderToContext(t),this.transform.translate(-e,-i),this.transform=null))},e(a,["_tempMatrix",function(){return this._tempMatrix=new St}]),a}(),st=function(){function x(){this._aniMap={},this.unfixedLastAniIndex=-1,x.__super.call(this),this._anis=new Array}n(x,"laya.ani.AnimationTemplet",_);var t=x.prototype;return t.parse=function(t){t=new Ct(t);this._aniVersion=t.readUTFString(),D.parse(this,t)},t._calculateKeyFrame=function(t,e,i){var a=t.keyFrame;a[e]=a[0];for(var s=0;s<e;s++){var r=a[s];r.nextData=(0===r.duration?r:a[s+1]).data}a.length--},t.onAsynLoaded=function(t,e,i){e=new Ct(e);this._aniVersion=e.readUTFString(),("LAYAANIMATION:02"===this._aniVersion?I:D).parse(this,e),this._endLoaded()},t.disposeResource=function(){this._aniVersion=null,this._anis=null,this._aniMap=null,this._publicExtData=null,this.unfixedCurrentFrameIndexes=null,this.unfixedCurrentTimes=null,this.unfixedKeyframes=null,this._aniClassName=null,this._animationDatasCache=null},t.getAnimationCount=function(){return this._anis.length},t.getAnimation=function(t){return this._anis[t]},t.getAniDuration=function(t){return this._anis[t].playTime},t.getNodes=function(t){return this._anis[t].nodes},t.getNodeIndexWithName=function(t,e){return this._anis[t].bone3DMap[e]},t.getNodeCount=function(t){return this._anis[t].nodes.length},t.getTotalkeyframesLength=function(t){return this._anis[t].totalKeyframeDatasLength},t.getPublicExtData=function(){return this._publicExtData},t.getAnimationDataWithCache=function(t,e,i,a){i=e[i];if(i){t=i[t];return t?t[a]:null}return null},t.setAnimationDataWithCache=function(t,e,i,a,s){i=e[i]||(e[i]={});(i[t]||(i[t]=[]))[a]=s},t.getOriginalData=function(t,e,i,a,s){for(var r=this._anis[t].nodes,n=0,h=0,l=r.length,o=0;h<l;h++){var u=r[h],c=u.keyFrame[i[h][a]];u.dataOffset=o;var d=s-c.startTime,_=u.lerpType;if(_)switch(_){case 0:case 1:for(n=0;n<u.keyframeWidth;)n+=u.interpolationMethod[n](u,n,e,o+n,c.data,d,null,c.duration,c.nextData);break;case 2:for(var p=c.interpolationData,f=p.length,m=0,n=0;n<f;){var y=p[n];switch(y){case 6:case 7:n+=x.interpolation[y](u,m,e,o+m,c.data,d,null,c.duration,c.nextData,p,n+1);break;default:n+=x.interpolation[y](u,m,e,o+m,c.data,d,null,c.duration,c.nextData)}m++}}else for(n=0;n<u.keyframeWidth;)n+=u.interpolationMethod[n](u,n,e,o+n,c.data,d,null,c.duration,c.nextData);o+=u.keyframeWidth}},t.getNodesCurrentFrameIndex=function(t,e){var i=this._anis[t].nodes;t!==this.unfixedLastAniIndex&&(this.unfixedCurrentFrameIndexes=new Uint32Array(i.length),this.unfixedCurrentTimes=new Float32Array(i.length),this.unfixedLastAniIndex=t);for(var a=0,s=i.length;a<s;a++){var r=i[a];for(e<this.unfixedCurrentTimes[a]&&(this.unfixedCurrentFrameIndexes[a]=0),this.unfixedCurrentTimes[a]=e;this.unfixedCurrentFrameIndexes[a]<r.keyFrame.length&&!(r.keyFrame[this.unfixedCurrentFrameIndexes[a]].startTime>this.unfixedCurrentTimes[a]);)this.unfixedCurrentFrameIndexes[a]++;this.unfixedCurrentFrameIndexes[a]--}return this.unfixedCurrentFrameIndexes},t.getOriginalDataUnfixedRate=function(t,e,i){var a=this._anis[t].nodes;t!==this.unfixedLastAniIndex&&(this.unfixedCurrentFrameIndexes=new Uint32Array(a.length),this.unfixedCurrentTimes=new Float32Array(a.length),this.unfixedKeyframes=f(a.length),this.unfixedLastAniIndex=t);for(var s=0,r=0,n=a.length,h=0;r<n;r++){var l=a[r];for(i<this.unfixedCurrentTimes[r]&&(this.unfixedCurrentFrameIndexes[r]=0),this.unfixedCurrentTimes[r]=i;this.unfixedCurrentFrameIndexes[r]<l.keyFrame.length&&!(l.keyFrame[this.unfixedCurrentFrameIndexes[r]].startTime>this.unfixedCurrentTimes[r]);)this.unfixedKeyframes[r]=l.keyFrame[this.unfixedCurrentFrameIndexes[r]],this.unfixedCurrentFrameIndexes[r]++;var o=this.unfixedKeyframes[r];l.dataOffset=h;var u=i-o.startTime;if(l.lerpType)switch(l.lerpType){case 0:case 1:for(s=0;s<l.keyframeWidth;)s+=l.interpolationMethod[s](l,s,e,h+s,o.data,u,null,o.duration,o.nextData);break;case 2:for(var c=o.interpolationData,d=c.length,_=0,s=0;s<d;){var p=c[s];switch(p){case 6:case 7:s+=x.interpolation[p](l,_,e,h+_,o.data,u,null,o.duration,o.nextData,c,s+1);break;default:s+=x.interpolation[p](l,_,e,h+_,o.data,u,null,o.duration,o.nextData)}_++}}else for(s=0;s<l.keyframeWidth;)s+=l.interpolationMethod[s](l,s,e,h+s,o.data,u,null,o.duration,o.nextData);h+=l.keyframeWidth}},x._LinearInterpolation_0=function(t,e,i,a,s,r,n,h,l,o){h=0===h?0:r/h;return i[a]=(1-h)*s[e]+h*l[e],1},x._QuaternionInterpolation_1=function(t,e,i,a,s,r,n,h,l,o){return u.slerpQuaternionArray(s,e,l,e,0===h?0:r/h,i,a),4},x._AngleInterpolation_2=function(t,e,i,a,s,r,n,h,l,o){return 0},x._RadiansInterpolation_3=function(t,e,i,a,s,r,n,h,l,o){return 0},x._Matrix4x4Interpolation_4=function(t,e,i,a,s,r,n,h,l,o){for(var u=0;u<16;u++,e++)i[a+u]=s[e]+r*n[e];return 16},x._NoInterpolation_5=function(t,e,i,a,s,r,n,h,l,o){return i[a]=s[e],1},x._BezierInterpolation_6=function(t,e,i,a,s,r,n,h,l,o,u){return i[a]=s[e]+(l[e]-s[e])*$.getBezierRate(r/h,o[u=void 0===u?0:u],o[u+1],o[u+2],o[u+3]),5},x._BezierInterpolation_7=function(t,e,i,a,s,r,n,h,l,o,u){return i[a]=o[(u=void 0===u?0:u)+4]+o[u+5]*$.getBezierRate((.001*r+o[u+6])/o[u+7],o[u],o[u+1],o[u+2],o[u+3]),9},x.load=function(t){return P.loader.create(t,null,null,x)},x.interpolation=[x._LinearInterpolation_0,x._QuaternionInterpolation_1,x._AngleInterpolation_2,x._RadiansInterpolation_3,x._Matrix4x4Interpolation_4,x._NoInterpolation_5,x._BezierInterpolation_6,x._BezierInterpolation_7],x}(),rt=(function(){function a(){this.isCached=!1,this.canvas=null,this.tex=null,this.rec=null,a.__super.call(this)}n(a,"laya.ani.bone.canvasmesh.CacheAbleSkinMesh",at);var t=a.prototype;t.getCanvasPic=function(){var t,e=new s("2D"),i=e.getContext("2d");return this.rec=this.mesh.getBounds(),e.size(this.rec.width,this.rec.height),t=this.transform,this.transform=a.tempMt,this.transform.identity(),this.transform.translate(-this.rec.x,-this.rec.y),this.renderToContext(i),this.transform.translate(+this.rec.x,+this.rec.y),this.transform=t,new wt(e)},t.render=function(t,e,i){this.mesh.texture&&(this.isCached||(this.isCached=!0,this.tex=this.getCanvasPic()),this.transform?(this.transform.translate(e,i),this._renderTextureToContext(t),this.transform.translate(-e,-i)):(this.transform=at._tempMatrix,this.transform.identity(),this.transform.translate(e,i),this._renderTextureToContext(t),this.transform.translate(-e,-i),this.transform=null))},t._renderTextureToContext=function(t){var e,i;this.context=t.ctx||t,t.save(),e=this.tex,this.transform&&(i=this.transform,t.transform(i.a,i.b,i.c,i.d,i.tx,i.ty)),this.rec=this.mesh.getBounds(),t.translate(this.rec.x,this.rec.y),t.drawTexture(e,0,0,e.width,e.height,0,0),t.restore()},e(a,["tempMt",function(){return this.tempMt=new St}])}(),function(r){function t(){this.cacheOK=!1,this.cacheCmdOK=!1,this.transformCmds=[],this.drawCmds=[],t.__super.call(this),this.tempMesh=new S}n(t,"laya.ani.bone.canvasmesh.SimpleSkinMeshCanvas",r);var e=t.prototype;return e.init2=function(t,e,i,a,s){r.prototype.init2.call(this,t,e,i,a,s),this.cacheOK=!1,this.cacheCmdOK=!1,this.transformCmds.length=6,this.drawCmds.length=9},e.renderToContext=function(t){this.context=t.ctx||t,this.mesh&&(this.mesh.uvs.length<=8?0==this.mode?this._renderWithIndexes(this.mesh):this._renderNoIndexes(this.mesh):(this.cacheOK||(this.tempMesh.texture=this.mesh.texture,this.tempMesh.uvs=this.mesh.texture.uv,this.tempMesh.vertices=E.solveMesh(this.mesh,this.tempMesh.vertices),this.cacheOK=!0),0==this.mode?this._renderWithIndexes(this.tempMesh):this._renderNoIndexes(this.tempMesh)))},e._renderWithIndexes=function(t){if(this.cacheCmdOK)this.renderByCache(t);else{var e=t.indexes,i=0,a=e.length;for(1<a&&(a=1),i=0;i<a;i+=3){var s=2*e[i],r=2*e[i+1],n=2*e[i+2];this._renderDrawTriangle(t,s,r,n)}this.cacheCmdOK=!0}},e._renderDrawTriangle=function(t,e,i,a){var s=this.context,r=t.uvs,n=t.vertices,h=t.texture,l=h.bitmap,o=l.source,u=h.width,c=h.height,d=l.width,_=l.height,p=NaN,f=NaN,m=NaN,y=NaN,x=NaN,g=NaN;g=t.useUvTransform?(I=t.uvTransform,p=(r[e]*I.a+r[e+1]*I.c+I.tx)*d,f=(r[i]*I.a+r[i+1]*I.c+I.tx)*d,m=(r[a]*I.a+r[a+1]*I.c+I.tx)*d,y=(r[e]*I.b+r[e+1]*I.d+I.ty)*_,x=(r[i]*I.b+r[i+1]*I.d+I.ty)*_,(r[a]*I.b+r[a+1]*I.d+I.ty)*_):(p=r[e]*d,f=r[i]*d,m=r[a]*d,y=r[e+1]*_,x=r[i+1]*_,r[a+1]*_);var v=n[e],D=n[i],M=n[a],l=n[e+1],t=n[i+1],I=n[a+1],r=1/(p*x+y*m+f*g-x*m-y*f-p*g),e=p*D+v*m+f*M-D*m-v*f-p*M,i=p*x*M+y*D*m+v*f*g-v*x*m-y*f*M-p*D*g,n=l*x+y*I+t*g-x*I-y*t-l*g,a=p*t+l*m+f*I-t*m-l*f-p*I,t=p*x*I+y*t*m+l*f*g-l*x*m-y*f*I-p*t*g;this.transformCmds[0]=(v*x+y*M+D*g-x*M-y*D-v*g)*r,this.transformCmds[1]=n*r,this.transformCmds[2]=e*r,this.transformCmds[3]=a*r,this.transformCmds[4]=i*r,this.transformCmds[5]=t*r,this.drawCmds[0]=o,this.drawCmds[1]=h.uv[0]*d,this.drawCmds[2]=h.uv[1]*_,this.drawCmds[3]=u,this.drawCmds[4]=c,this.drawCmds[5]=h.uv[0]*d,this.drawCmds[6]=h.uv[1]*_,this.drawCmds[7]=u,this.drawCmds[8]=c,s.save(),this.transform&&(c=this.transform,s.transform(c.a,c.b,c.c,c.d,c.tx,c.ty)),s.transform.apply(s,this.transformCmds),s.drawImage.apply(s,this.drawCmds),s.restore()},e.renderByCache=function(t){var e,i=this.context;i.save(),this.transform&&(e=this.transform,i.transform(e.a,e.b,e.c,e.d,e.tx,e.ty)),i.transform.apply(i,this.transformCmds),i.drawImage.apply(i,this.drawCmds),i.restore()},t}(at)),nt=function(e){function i(t,e){this._templet=null,this._player=null,this._curOriginalData=null,this._boneMatrixArray=[],this._lastTime=0,this._currAniName=null,this._currAniIndex=-1,this._pause=!0,this._aniClipIndex=-1,this._clipIndex=-1,this._skinIndex=0,this._skinName="default",this._aniMode=0,this._graphicsCache=null,this._boneSlotDic=null,this._bindBoneBoneSlotDic=null,this._boneSlotArray=null,this._index=-1,this._total=-1,this._indexControl=!1,this._aniPath=null,this._texturePath=null,this._complete=null,this._loadAniMode=0,this._yReverseMatrix=null,this._ikArr=null,this._tfArr=null,this._pathDic=null,this._rootBone=null,this._boneList=null,this._aniSectionDic=null,this._eventIndex=0,this._drawOrderIndex=0,this._drawOrder=null,this._lastAniClipIndex=-1,this._lastUpdateAniClipIndex=-1,this._playAudio=!0,this._soundChannelArr=[],i.__super.call(this),void 0===e&&(e=0),t&&this.init(t,e)}n(i,"laya.ani.bone.Skeleton",e);var t=i.prototype;return t.init=function(t,e){var i,a,s,r=0,n=0;if(1==(e=void 0===e?0:e))for(this._graphicsCache=[],r=0,n=t.getAnimationCount();r<n;r++)this._graphicsCache.push([]);if(this._yReverseMatrix=t.yReverseMatrix,this._aniMode=e,this._templet=t,this._player=new tt,this._player.cacheFrameRate=t.rate,this._player.templet=t,this._player.play(),this._parseSrcBoneMatrix(),this._boneList=t.mBoneArr,this._rootBone=t.mRootBone,this._aniSectionDic=t.aniSectionDic,0<t.ikArr.length)for(this._ikArr=[],r=0,n=t.ikArr.length;r<n;r++)this._ikArr.push(new R(t.ikArr[r],this._boneList));if(0<t.pathArr.length)for(null==this._pathDic&&(this._pathDic={}),r=0,n=t.pathArr.length;r<n;r++)i=t.pathArr[r],a=new K(i,this._boneList),(s=this._boneSlotDic[i.name])&&((a=new K(i,this._boneList)).target=s),this._pathDic[i.name]=a;if(0<t.tfArr.length)for(this._tfArr=[],r=0,n=t.tfArr.length;r<n;r++)this._tfArr.push(new z(t.tfArr[r],this._boneList));0<t.skinDataArray.length&&(e=this._templet.skinDataArray[this._skinIndex],this._skinName=e.name),this._player.on("played",this,this._onPlay),this._player.on("stopped",this,this._onStop),this._player.on("paused",this,this._onPause)},t.load=function(t,e,i){void 0===i&&(i=0),this._aniPath=t,this._complete=e,this._loadAniMode=i,P.loader.load([{url:t,type:"arraybuffer"}],l.create(this,this._onLoaded))},t._onLoaded=function(){var t,e=h.getRes(this._aniPath);null!=e&&(null==ht.TEMPLET_DICTIONARY&&(ht.TEMPLET_DICTIONARY={}),(t=ht.TEMPLET_DICTIONARY[this._aniPath])?t.isParseFail?this._parseFail():t.isParserComplete?this._parseComplete():(t.on("complete",this,this._parseComplete),t.on("error",this,this._parseFail)):((t=new ht)._setUrl(this._aniPath),(ht.TEMPLET_DICTIONARY[this._aniPath]=t).on("complete",this,this._parseComplete),t.on("error",this,this._parseFail),t.isParserComplete=!1,t.parseData(null,e)))},t._parseComplete=function(){var t=ht.TEMPLET_DICTIONARY[this._aniPath];t&&(this.init(t,this._loadAniMode),this.play(0,!0)),this._complete&&this._complete.runWith(this)},t._parseFail=function(){console.log("[Error]:"+this._aniPath+"解析失败")},t._onPlay=function(){this.event("played")},t._onStop=function(){var t,e=this._templet.eventAniArr[this._aniClipIndex];if(e&&this._eventIndex<e.length)for(;this._eventIndex<e.length;this._eventIndex++)(t=e[this._eventIndex]).time>=this._player.playStart&&t.time<=this._player.playEnd&&this.event("label",t);this._drawOrder=null,this.event("stopped")},t._onPause=function(){this.event("paused")},t._parseSrcBoneMatrix=function(){var t=0,e=0;for(e=this._templet.srcBoneMatrixArr.length,t=0;t<e;t++)this._boneMatrixArray.push(new St);if(0==this._aniMode)this._boneSlotDic=this._templet.boneSlotDic,this._bindBoneBoneSlotDic=this._templet.bindBoneBoneSlotDic,this._boneSlotArray=this._templet.boneSlotArray;else{null==this._boneSlotDic&&(this._boneSlotDic={}),null==this._bindBoneBoneSlotDic&&(this._bindBoneBoneSlotDic={}),null==this._boneSlotArray&&(this._boneSlotArray=[]);for(var i,a,s=this._templet.boneSlotArray,t=0,e=s.length;t<e;t++)i=s[t],null==(a=this._bindBoneBoneSlotDic[i.parent])&&(this._bindBoneBoneSlotDic[i.parent]=a=[]),this._boneSlotDic[i.name]=i=i.copy(),a.push(i),this._boneSlotArray.push(i)}},t._emitMissedEvents=function(t,e,i){void 0===i&&(i=0);var a=this._templet.eventAniArr[this._player.currentAnimationClipIndex];if(a)for(var s,r=0,n=a.length,r=i;r<n;r++)(s=a[r]).time>=this._player.playStart&&s.time<=this._player.playEnd&&this.event("label",s)},t._update=function(t){if(void 0===t&&(t=!0),!(this._pause||t&&this._indexControl)){var e=this.timer.currTimer,i=this._player.currentKeyframeIndex,a=e-this._lastTime;if(t?this._player._update(a):i=-1,this._lastTime=e,this._player&&(this._index=this._clipIndex=this._player.currentKeyframeIndex,!(this._index<0||0<a&&this._clipIndex==i&&this._lastUpdateAniClipIndex==this._aniClipIndex))){this._lastUpdateAniClipIndex=this._aniClipIndex,i>this._clipIndex&&0!=this._eventIndex&&(this._emitMissedEvents(this._player.playStart,this._player.playEnd,this._eventIndex),this._eventIndex=0);var s,r,i=this._templet.eventAniArr[this._aniClipIndex];if(i&&this._eventIndex<i.length&&((i=i[this._eventIndex]).time>=this._player.playStart&&i.time<=this._player.playEnd?this._player.currentPlayTime>=i.time&&(this.event("label",i),this._eventIndex++,this._playAudio&&i.audioValue&&"null"!==i.audioValue&&(s=m.playSound(this._player.templet._path+i.audioValue,1,l.create(this,this._onAniSoundStoped)),m.playbackRate=this._player.playbackRate,s&&this._soundChannelArr.push(s))):i.time<this._player.playStart&&this._playAudio&&i.audioValue&&"null"!==i.audioValue?(this._eventIndex++,s=m.playSound(this._player.templet._path+i.audioValue,1,l.create(this,this._onAniSoundStoped),null,(this._player.currentPlayTime-i.time)/1e3),m.playbackRate=this._player.playbackRate,s&&this._soundChannelArr.push(s)):this._eventIndex++),0==this._aniMode){if(r=this._templet.getGrahicsDataWithCache(this._aniClipIndex,this._clipIndex))return void(this.graphics!=r&&(this.graphics=r));for(var n=0,h=0,h=this._clipIndex;!this._templet.getGrahicsDataWithCache(this._aniClipIndex,h-1)&&0<h;)h--;if(h<this._clipIndex)for(n=h;n<this._clipIndex;n++)this._createGraphics(n)}else if(1==this._aniMode){if(r=this._getGrahicsDataWithCache(this._aniClipIndex,this._clipIndex))return void(this.graphics!=r&&(this.graphics=r));for(h=this._clipIndex;!this._getGrahicsDataWithCache(this._aniClipIndex,h-1)&&0<h;)h--;if(h<this._clipIndex)for(n=h;n<this._clipIndex;n++)this._createGraphics(n)}this._createGraphics()}}},t._onAniSoundStoped=function(t){for(var e,i=this._soundChannelArr.length,a=0;a<i;a++)((e=this._soundChannelArr[a]).isStopped||t)&&(e.isStopped||e.stop(),this._soundChannelArr.splice(a,1),i--,a--)},t._createGraphics=function(t){var e,i=(t=-1==(t=void 0===t?-1:t)?this._clipIndex:t)*this._player.cacheFrameRateInterval,a=this._templet.drawOrderAniArr[this._aniClipIndex];if(a&&0<a.length)for(this._drawOrderIndex=0,e=a[this._drawOrderIndex];i>=e.time&&(this._drawOrder=e.drawOrder,this._drawOrderIndex++,!(this._drawOrderIndex>=a.length));)e=a[this._drawOrderIndex];0!=this._aniMode&&1!=this._aniMode&&this.graphics instanceof laya.ani.GraphicsAni?this.graphics.clear():this.graphics=et.create();var s=this.graphics,r=this._templet.getNodes(this._aniClipIndex);this._templet.getOriginalData(this._aniClipIndex,this._curOriginalData,this._player._fullFrames[this._aniClipIndex],t,i);var n,h,l,o,u=this._aniSectionDic[this._aniClipIndex],c=0,d=0,_=0,p=0,f=0,m=this._templet.srcBoneMatrixArr.length;for(f=u[d=0];d<m;d++)o=this._boneList[d],l=this._templet.srcBoneMatrixArr[d],o.resultTransform.scX=l.scX*this._curOriginalData[c++],o.resultTransform.skX=l.skX+this._curOriginalData[c++],o.resultTransform.skY=l.skY+this._curOriginalData[c++],o.resultTransform.scY=l.scY*this._curOriginalData[c++],o.resultTransform.x=l.x+this._curOriginalData[c++],o.resultTransform.y=l.y+this._curOriginalData[c++],8===this._templet.tMatrixDataLen&&(o.resultTransform.skewX=l.skewX+this._curOriginalData[c++],o.resultTransform.skewY=l.skewY+this._curOriginalData[c++]);var y={},x={};for(f+=u[1];d<f;d++)y[(D=r[d]).name]=this._curOriginalData[c++],x[D.name]=this._curOriginalData[c++],this._curOriginalData[c++],this._curOriginalData[c++],this._curOriginalData[c++],this._curOriginalData[c++];var g={},v={};for(f+=u[2];d<f;d++)g[(D=r[d]).name]=this._curOriginalData[c++],v[D.name]=this._curOriginalData[c++],this._curOriginalData[c++],this._curOriginalData[c++],this._curOriginalData[c++],this._curOriginalData[c++];if(this._pathDic)for(f+=u[3];d<f;d++){var D=r[d],M=this._pathDic[D.name];if(M)switch(new Ct(D.extenData).getByte()){case 1:M.position=this._curOriginalData[c++];break;case 2:M.spacing=this._curOriginalData[c++];break;case 3:M.rotateMix=this._curOriginalData[c++],M.translateMix=this._curOriginalData[c++]}}if(this._yReverseMatrix?this._rootBone.update(this._yReverseMatrix):this._rootBone.update(St.TEMP.identity()),this._ikArr)for(var I,d=0,f=this._ikArr.length;d<f;d++)I=this._ikArr[d],g.hasOwnProperty(I.name)&&(I.bendDirection=g[I.name]),v.hasOwnProperty(I.name)&&(I.mix=v[I.name]),I.apply();if(this._pathDic)for(var b in this._pathDic)(M=this._pathDic[b]).apply(this._boneList,s);if(this._tfArr)for(d=0,p=this._tfArr.length;d<p;d++)this._tfArr[d].apply();for(d=0,p=this._boneList.length;d<p;d++)if(o=this._boneList[d],h=this._bindBoneBoneSlotDic[o.name],o.resultMatrix.copyTo(this._boneMatrixArray[d]),h)for(_=0,f=h.length;_<f;_++)(n=h[_])&&n.setParentMatrix(o.resultMatrix);var N,A,T,C={},u=this._templet.deformAniArr;if(u&&0<u.length){if(this._lastAniClipIndex!=this._aniClipIndex)for(this._lastAniClipIndex=this._aniClipIndex,d=0,f=this._boneSlotArray.length;d<f;d++)(n=this._boneSlotArray[d]).deformData=null;var S,w=u[this._aniClipIndex],F=w.default;for(S in this._setDeform(F,C,this._boneSlotArray,i),w)"default"!=S&&S!=this._skinName&&(F=w[S],this._setDeform(F,C,this._boneSlotArray,i));F=w[this._skinName],this._setDeform(F,C,this._boneSlotArray,i)}if(this._drawOrder)for(d=0,f=this._drawOrder.length;d<f;d++)N=y[(n=this._boneSlotArray[this._drawOrder[d]]).name],A=x[n.name],isNaN(A)||(s.save(),s.alpha(A)),isNaN(N)||-2==N||(this._templet.attachmentNames?n.showDisplayByName(this._templet.attachmentNames[N]):n.showDisplayByIndex(N)),C[this._drawOrder[d]]?(T=C[this._drawOrder[d]],n.currDisplayData&&T[n.currDisplayData.attachmentName]?n.deformData=T[n.currDisplayData.attachmentName]:n.deformData=null):n.deformData=null,isNaN(A)?n.draw(s,this._boneMatrixArray,2==this._aniMode):n.draw(s,this._boneMatrixArray,2==this._aniMode,A),isNaN(A)||s.restore();else for(d=0,f=this._boneSlotArray.length;d<f;d++)N=y[(n=this._boneSlotArray[d]).name],A=x[n.name],isNaN(A)||(s.save(),s.alpha(A)),isNaN(N)||-2==N||(this._templet.attachmentNames?n.showDisplayByName(this._templet.attachmentNames[N]):n.showDisplayByIndex(N)),C[d]?(T=C[d],n.currDisplayData&&T[n.currDisplayData.attachmentName]?n.deformData=T[n.currDisplayData.attachmentName]:n.deformData=null):n.deformData=null,isNaN(A)?n.draw(s,this._boneMatrixArray,2==this._aniMode):n.draw(s,this._boneMatrixArray,2==this._aniMode,A),isNaN(A)||s.restore();0==this._aniMode?this._templet.setGrahicsDataWithCache(this._aniClipIndex,t,s):1==this._aniMode&&this._setGrahicsDataWithCache(this._aniClipIndex,t,s)},t._setDeform=function(t,e,i,a){if(t){var s,r,n,h,l=0,o=0;if(t)for(l=0,h=t.deformSlotDataList.length;l<h;l++)for(s=t.deformSlotDataList[l],o=0;o<s.deformSlotDisplayList.length;o++)n=i[(r=s.deformSlotDisplayList[o]).slotIndex],r.apply(a,n),e[r.slotIndex]||(e[r.slotIndex]={}),e[r.slotIndex][r.attachment]=r.deformData}},t.getAnimNum=function(){return this._templet.getAnimationCount()},t.getAniNameByIndex=function(t){return this._templet.getAniNameByIndex(t)},t.getSlotByName=function(t){return this._boneSlotDic[t]},t.showSkinByName=function(t,e){void 0===e&&(e=!0),this.showSkinByIndex(this._templet.getSkinIndexByName(t),e)},t.showSkinByIndex=function(t,e){void 0===e&&(e=!0);for(var i,a=0;a<this._boneSlotArray.length;a++)this._boneSlotArray[a].showSlotData(null,e);this._templet.showSkinByIndex(this._boneSlotDic,t,e)&&(i=this._templet.skinDataArray[t],this._skinIndex=t,this._skinName=i.name),this._clearCache()},t.showSlotSkinByIndex=function(t,e){0!=this._aniMode&&((t=this.getSlotByName(t))&&t.showDisplayByIndex(e),this._clearCache())},t.showSlotSkinByName=function(t,e){0!=this._aniMode&&((t=this.getSlotByName(t))&&t.showDisplayByName(e),this._clearCache())},t.replaceSlotSkinName=function(t,e,i){0!=this._aniMode&&((t=this.getSlotByName(t))&&t.replaceDisplayByName(e,i),this._clearCache())},t.replaceSlotSkinByIndex=function(t,e,i){0!=this._aniMode&&((t=this.getSlotByName(t))&&t.replaceDisplayByIndex(e,i),this._clearCache())},t.setSlotSkin=function(t,e){0!=this._aniMode&&((t=this.getSlotByName(t))&&t.replaceSkin(e),this._clearCache())},t._clearCache=function(){if(1==this._aniMode)for(var t=0,e=this._graphicsCache.length;t<e;t++){for(var i=0,a=this._graphicsCache[t].length;i<a;i++){var s=this._graphicsCache[t][i];s!=this.graphics&&et.recycle(s)}this._graphicsCache[t].length=0}},t.play=function(t,e,i,a,s,r,n){void 0===i&&(i=!0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===r&&(r=!0),this._playAudio=n=void 0===n?!0:n,this._indexControl=!1;var h=-1,n=NaN,n=e?2147483647:0;if("string"==typeof t)for(var l=0,o=this._templet.getAnimationCount();l<o;l++){var u=this._templet.getAnimation(l);if(u&&t==u.name){h=l;break}}else h=t;-1<h&&h<this.getAnimNum()&&(this._aniClipIndex=h,(i||this._pause||this._currAniIndex!=h)&&(this._currAniIndex=h,this._curOriginalData=new Float32Array(this._templet.getTotalkeyframesLength(h)),this._drawOrder=null,this._eventIndex=0,this._player.play(h,this._player.playbackRate,n,a,s),r&&this._templet.showSkinByIndex(this._boneSlotDic,this._skinIndex),this._pause&&(this._pause=!1,this._lastTime=c.now(),this.timer.frameLoop(1,this,this._update,null,!0)),this._update()))},t.stop=function(){this._pause||(this._pause=!0,this._player&&this._player.stop(!0),0<this._soundChannelArr.length&&this._onAniSoundStoped(!0),this.timer.clear(this,this._update))},t.playbackRate=function(t){this._player&&(this._player.playbackRate=t)},t.paused=function(){if(!this._pause){if(this._pause=!0,this._player&&(this._player.paused=!0),0<this._soundChannelArr.length)for(var t,e=this._soundChannelArr.length,i=0;i<e;i++)(t=this._soundChannelArr[i]).isStopped||t.pause();this.timer.clear(this,this._update)}},t.resume=function(){if(this._indexControl=!1,this._pause){if(this._pause=!1,this._player&&(this._player.paused=!1),0<this._soundChannelArr.length)for(var t,e=this._soundChannelArr.length,i=0;i<e;i++)(t=this._soundChannelArr[i]).audioBuffer&&t.resume();this._lastTime=c.now(),this.timer.frameLoop(1,this,this._update,null,!0)}},t._getGrahicsDataWithCache=function(t,e){return this._graphicsCache[t][e]},t._setGrahicsDataWithCache=function(t,e,i){this._graphicsCache[t][e]=i},t.destroy=function(t){e.prototype.destroy.call(this,t=void 0===t?!0:t),this._templet=null,this._player&&this._player.offAll(),this._player=null,this._curOriginalData=null,this._boneMatrixArray.length=0,this._lastTime=0,this.timer.clear(this,this._update),0<this._soundChannelArr.length&&this._onAniSoundStoped(!0)},a(0,t,"url",function(){return this._aniPath},function(t){this.load(t)}),a(0,t,"index",function(){return this._index},function(t){this.player&&(this._index=t,this._player.currentTime=1e3*this._index/this._player.cacheFrameRate,this._indexControl=!0,this._update(!1))}),a(0,t,"total",function(){return this._templet&&this._player?this._total=Math.floor(this._templet.getAniDuration(this._player.currentAnimationClipIndex)/1e3*this._player.cacheFrameRate):this._total=-1,this._total}),a(0,t,"templet",function(){return this._templet}),a(0,t,"player",function(){return this._player}),i.useSimpleMeshInCanvas=!1,i}(B),ht=(function(e){function _(t){this._start=0,this._Pos=0,this._data=null,this._curIndex=0,this._preIndex=0,this._playIndex=0,this._playing=!1,this._ended=!0,this._count=0,this._ids=null,this._loadedImage={},this._idOfSprite=null,this._parentMovieClip=null,this._movieClipList=null,this._labels=null,this.basePath=null,this._atlasPath=null,this._url=null,this._isRoot=!1,this._completeHandler=null,this._endFrame=-1,this.interval=30,this.loop=!1,_.__super.call(this),this._ids={},this._idOfSprite=[],this._reset(),this._playing=!1,(this._parentMovieClip=t)?(this._isRoot=!1,this._movieClipList=t._movieClipList,this._movieClipList.push(this)):(this._movieClipList=[this],this._isRoot=!0,this._setUpNoticeType(1))}n(_,"laya.ani.swf.MovieClip",e);var t=_.prototype;t.destroy=function(t){void 0===t&&(t=!0),this._clear(),e.prototype.destroy.call(this,t)},t._setDisplay=function(t){e.prototype._setDisplay.call(this,t),this._isRoot&&this._$3__onDisplay(t)},t._$3__onDisplay=function(t){t?this.timer.loop(this.interval,this,this.updates,null,!0):this.timer.clear(this,this.updates)},t.updates=function(){if(!this._parentMovieClip)for(var t=0,e=this._movieClipList.length,t=0;t<e;t++)this._movieClipList[t]&&this._movieClipList[t]._update()},t.addLabel=function(t,e){this._labels||(this._labels={}),this._labels[e]=t},t.removeLabel=function(t){if(t){if(!this._labels)for(var e in this._labels)if(this._labels[e]===t){delete this._labels[e];break}}else this._labels=null},t._update=function(){if(this._data&&this._playing){if(this._playIndex++,this._playIndex>=this._count){if(!this.loop)return this._playIndex--,void this.stop();this._playIndex=0}var t;this._parse(this._playIndex),this._labels&&this._labels[this._playIndex]&&this.event("label",this._labels[this._playIndex]),-1!=this._endFrame&&this._endFrame==this._playIndex&&(this._endFrame=-1,null!=this._completeHandler&&(t=this._completeHandler,this._completeHandler=null,t.run()),this.stop())}},t.stop=function(){this._playing=!1},t.gotoAndStop=function(t){this.index=t,this.stop()},t._clear=function(){if(this.stop(),this._idOfSprite.length=0,!this._parentMovieClip){this.timer.clear(this,this.updates);for(var t=0,e=this._movieClipList.length,t=0;t<e;t++)this._movieClipList[t]!=this&&this._movieClipList[t]._clear();this._movieClipList.length=0}for(var i in this._atlasPath&&h.clearRes(this._atlasPath),this._loadedImage)this._loadedImage[i]&&(h.clearRes(i),this._loadedImage[i]=!1);this.removeChildren(),this.graphics=null,this._parentMovieClip=null},t.play=function(t,e){void 0===t&&(t=0),this.loop=e=void 0===e?!0:e,this._playing=!0,this._data&&this._displayFrame(t)},t._displayFrame=function(t){-1!=(t=void 0===t?-1:t)&&(this._curIndex>t&&this._reset(),this._parse(t))},t._reset=function(t){(t=void 0===t?!0:t)&&1!=this._curIndex&&this.removeChildren(),this._preIndex=this._curIndex=-1,this._Pos=this._start},t._parse=function(t){var e,i=!1,a=this._idOfSprite,s=this._data;for(this._ended&&this._reset(),s.pos=this._Pos,this._ended=!1,this._playIndex=t,this._curIndex>t&&t<this._preIndex&&(this._reset(!0),s.pos=this._Pos);this._curIndex<=t&&!this._ended;)switch(s.getUint16()){case 12:var r,n,h,l,o=s.getUint16(),u=this._ids[s.getUint16()];this._Pos=s.pos,s.pos=u,0==(e=s.getUint8())?(r=s.getUint16(),(n=a[o])||(n=a[o]=new B,(h=new B).loadImage(this.basePath+r+".png"),this._loadedImage[this.basePath+r+".png"]=!0,n.addChild(h),h.size(s.getFloat32(),s.getFloat32()),l=s._getMatrix(),h.transform=l),n.alpha=1):1==e&&((l=a[o])||(a[o]=l=new _(this),l.interval=this.interval,l._ids=this._ids,l.basePath=this.basePath,l._setData(s,u),l._initState(),l.play(0)),l.alpha=1),s.pos=this._Pos;break;case 3:var c=a[s.getUint16()];c&&(this.addChild(c),c.zOrder=s.getUint16(),i=!0);break;case 4:(c=a[s.getUint16()])&&c.removeSelf();break;case 5:a[s.getUint16()][_._ValueList[s.getUint16()]]=s.getFloat32();break;case 6:a[s.getUint16()].visible=0<s.getUint8();break;case 7:var d=(n=a[s.getUint16()]).transform||St.create();d.setTo(s.getFloat32(),s.getFloat32(),s.getFloat32(),s.getFloat32(),s.getFloat32(),s.getFloat32()),n.transform=d;break;case 8:a[s.getUint16()].setPos(s.getFloat32(),s.getFloat32());break;case 9:a[s.getUint16()].setSize(s.getFloat32(),s.getFloat32());break;case 10:a[s.getUint16()].alpha=s.getFloat32();break;case 11:a[s.getUint16()].setScale(s.getFloat32(),s.getFloat32());break;case 98:d=s.getString(),this.event(d),"stop"==d&&this.stop();break;case 99:this._curIndex=s.getUint16(),i&&this.updateZOrder();break;case 100:this._count=this._curIndex+1,this._ended=!0,this._playing&&(this.event("enterframe"),this.event("end"),this.event("complete")),this._reset(!1)}this._playing&&!this._ended&&this.event("enterframe"),this._Pos=s.pos},t._setData=function(t,e){this._data=t,this._start=e+3},t.load=function(t,e,i){void 0===e&&(e=!1),this._url=t,e&&(this._atlasPath=i||t.split(".swf")[0]+".json"),this.stop(),this._clear(),this._movieClipList=[this],t=[{url:t,type:"arraybuffer"}],this._atlasPath&&t.push({url:this._atlasPath,type:"atlas"}),P.loader.load(t,l.create(this,this._onLoaded))},t._onLoaded=function(){var t=h.getRes(this._url);t?!this._atlasPath||h.getAtlas(this._atlasPath)?(this.basePath=this._atlasPath?h.getAtlas(this._atlasPath).dir:this._url.split(".swf")[0]+"/image/",this._initData(t)):this.event("error","Atlas not find"):this.event("error","file not find")},t._initState=function(){this._reset(),this._ended=!1;var t=this._playing;for(this._playing=!1,this._curIndex=0;!this._ended;)this._parse(++this._curIndex);this._playing=t},t._initData=function(t){this._data=new Ct(t);for(var e=0,i=this._data.getUint16(),e=0;e<i;e++)this._ids[this._data.getInt16()]=this._data.getInt32();this.interval=1e3/this._data.getUint16(),this._setData(this._data,this._ids[32767]),this._initState(),this.play(0),this.event("loaded"),this._parentMovieClip||this.timer.loop(this.interval,this,this.updates,null,!0)},t.playTo=function(t,e,i){this._completeHandler=i,this._endFrame=e,this.play(t,!1)},a(0,t,"index",function(){return this._playIndex},function(t){this._playIndex=t,this._data&&this._displayFrame(this._playIndex),this._labels&&this._labels[t]&&this.event("label",this._labels[t])}),a(0,t,"count",function(){return this._count}),a(0,t,"playing",function(){return this._playing}),a(0,t,"url",null,function(t){this.load(t)}),_._ValueList=["x","y","width","height","scaleX","scaleY","rotation","alpha"]}(B),function(e){function s(){this._mainTexture=null,this._textureJson=null,this._graphicsCache=[],this.srcBoneMatrixArr=[],this.ikArr=[],this.tfArr=[],this.pathArr=[],this.boneSlotDic={},this.bindBoneBoneSlotDic={},this.boneSlotArray=[],this.skinDataArray=[],this.skinDic={},this.subTextureDic={},this.isParseFail=!1,this.yReverseMatrix=null,this.drawOrderAniArr=[],this.eventAniArr=[],this.attachmentNames=null,this.deformAniArr=[],this._isParseAudio=!1,this._isDestroyed=!1,this._rate=30,this.isParserComplete=!1,this.aniSectionDic={},this._skBufferUrl=null,this._textureDic={},this._loadList=null,this._path=null,this.tMatrixDataLen=0,this.mRootBone=null,s.__super.call(this),this.skinSlotDisplayDataArr=[],this.mBoneArr=[]}n(s,"laya.ani.bone.Templet",e);var t=s.prototype;return t.loadAni=function(t){this._skBufferUrl=t,P.loader.load(t,l.create(this,this.onComplete),null,"arraybuffer")},t.onComplete=function(t){var e;this._isDestroyed?this.destroy():(e=h.getRes(this._skBufferUrl))?(this._path=this._skBufferUrl.slice(0,this._skBufferUrl.lastIndexOf("/"))+"/",this.parseData(null,e)):this.event("error","load failed:"+this._skBufferUrl)},t.parseData=function(t,e,i){void 0===i&&(i=30),!this._path&&this.url&&(this._path=this.url.slice(0,this.url.lastIndexOf("/"))+"/"),this._mainTexture=t,this._mainTexture&&d.isWebGL&&t.bitmap&&(t.bitmap.enableMerageInAtlas=!1),this._rate=i,this.parse(e)},t.buildArmature=function(t){return new nt(this,t=void 0===t?0:t)},t.parse=function(t){e.prototype.parse.call(this,t),this._endLoaded(),this._aniVersion===s.LAYA_ANIMATION_VISION?this._isParseAudio=!0:this._aniVersion!=s.LAYA_ANIMATION_160_VISION&&(console.log("[Error] 版本不一致请使用IDE版本配套的重新导出"+this._aniVersion+"->"+s.LAYA_ANIMATION_VISION),this._loaded=!1),this.loaded?this._mainTexture?this._parsePublicExtData():this._parseTexturePath():(this.event("error",this),this.isParseFail=!0)},t._parseTexturePath=function(){if(this._isDestroyed)this.destroy();else{var t=0;this._loadList=[];for(var e,i,a,s=new Ct(this.getPublicExtData()),r=0,n=s.getInt32(),h=s.readUTFString().split("\n"),t=0;t<n;t++)a=this._path+h[2*t],h[2*t+1],s.getFloat32(),s.getFloat32(),e=s.getFloat32(),i=s.getFloat32(),r=s.getFloat32(),isNaN(r),r=s.getFloat32(),isNaN(r),r=s.getFloat32(),isNaN(r),r=s.getFloat32(),isNaN(r),-1==this._loadList.indexOf(a)&&this._loadList.push(a);P.loader.load(this._loadList,l.create(this,this._textureComplete))}},t._textureComplete=function(){for(var t,e=0,i=this._loadList.length;e<i;e++)t=this._loadList[e],t=this._textureDic[t]=h.getRes(t),d.isWebGL&&t&&t.bitmap&&(t.bitmap.enableMerageInAtlas=!1);this._parsePublicExtData()},t._parsePublicExtData=function(){for(var t=0,e=0,i=0,a=0,s=0,t=0,s=this.getAnimationCount();t<s;t++)this._graphicsCache.push([]);var r,n,h,l,o,u,c,d,_,p,f="Dragon"!=this._aniClassName,m=new Ct(this.getPublicExtData()),y=0,x=m.getInt32(),g=m.readUTFString(),v=g.split("\n");for(t=0;t<x;t++){if(_=this._mainTexture,p=this._path+v[2*t],g=v[2*t+1],!(_=null==this._mainTexture?this._textureDic[p]:_))return this.event("error",this),void(this.isParseFail=!0);r=m.getFloat32(),n=m.getFloat32(),h=m.getFloat32(),l=m.getFloat32(),y=m.getFloat32(),o=isNaN(y)?0:y,y=m.getFloat32(),u=isNaN(y)?0:y,y=m.getFloat32(),c=isNaN(y)?h:y,y=m.getFloat32(),d=isNaN(y)?l:y,this.subTextureDic[g]=wt.create(_,r,n,h,l,-o,-u,c,d)}this._mainTexture=_;var D,M,I,b,N=m.getUint16();for(t=0;t<N;t++)(D=[]).push(m.getUint16()),D.push(m.getUint16()),D.push(m.getUint16()),D.push(m.getUint16()),this.aniSectionDic[t]=D;var A,T=m.getInt16(),C={};for(t=0;t<T;t++)M=new Ft,0==t?A=M:M.root=A,M.d=f?-1:1,I=m.readUTFString(),b=m.readUTFString(),M.length=m.getFloat32(),1==m.getByte()&&(M.inheritRotation=!1),1==m.getByte()&&(M.inheritScale=!1),M.name=I,b&&((b=C[b])?b.addChild(M):this.mRootBone=M),C[I]=M,this.mBoneArr.push(M);this.tMatrixDataLen=m.getUint16();var S,w,F=m.getUint16(),k=Math.floor(F/this.tMatrixDataLen),P=this.srcBoneMatrixArr;for(t=0;t<k;t++)(S=new Xt).scX=m.getFloat32(),S.skX=m.getFloat32(),S.skY=m.getFloat32(),S.scY=m.getFloat32(),S.x=m.getFloat32(),S.y=m.getFloat32(),8===this.tMatrixDataLen&&(S.skewX=m.getFloat32(),S.skewY=m.getFloat32()),P.push(S),(M=this.mBoneArr[t]).transform=S;var B,U,L=m.getUint16();for(t=0;t<L;t++){for(w=new Ot,B=m.getUint16(),e=0;e<B;e++)w.boneNames.push(m.readUTFString()),w.boneIndexs.push(m.getInt16());w.name=m.readUTFString(),w.targetBoneName=m.readUTFString(),w.targetBoneIndex=m.getInt16(),w.bendDirection=m.getFloat32(),w.mix=m.getFloat32(),w.isSpine=f,this.ikArr.push(w)}var R,O,E=m.getUint16();for(t=0;t<E;t++){for(U=new Wt,R=m.getUint16(),e=0;e<R;e++)U.boneIndexs.push(m.getInt16());U.name=m.getUTFString(),U.targetIndex=m.getInt16(),U.rotateMix=m.getFloat32(),U.translateMix=m.getFloat32(),U.scaleMix=m.getFloat32(),U.shearMix=m.getFloat32(),U.offsetRotation=m.getFloat32(),U.offsetX=m.getFloat32(),U.offsetY=m.getFloat32(),U.offsetScaleX=m.getFloat32(),U.offsetScaleY=m.getFloat32(),U.offsetShearY=m.getFloat32(),this.tfArr.push(U)}var V,K=m.getUint16();for(t=0;t<K;t++){for((O=new Et).name=m.readUTFString(),V=m.getUint16(),e=0;e<V;e++)O.bones.push(m.getInt16());O.target=m.readUTFString(),O.positionMode=m.readUTFString(),O.spacingMode=m.readUTFString(),O.rotateMode=m.readUTFString(),O.offsetRotation=m.getFloat32(),O.position=m.getFloat32(),O.spacing=m.getFloat32(),O.rotateMix=m.getFloat32(),O.translateMix=m.getFloat32(),this.pathArr.push(O)}var Y,W,X,z,q,G,H,Q,Z,j,$=m.getInt16();for(t=0;t<$;t++){var J=m.getUint8(),tt={};this.deformAniArr.push(tt);for(var et=0;et<J;et++)for((G=new Pt).skinName=m.getUTFString(),tt[G.skinName]=G,Y=m.getInt16(),e=0;e<Y;e++)for(H=new Bt,G.deformSlotDataList.push(H),W=m.getInt16(),i=0;i<W;i++)for(Q=new Ut,H.deformSlotDisplayList.push(Q),Q.slotIndex=m.getInt16(),Q.attachment=m.getUTFString(),X=m.getInt16(),a=0;a<X;a++)for(1==m.getByte()?Q.tweenKeyList.push(!0):Q.tweenKeyList.push(!1),z=m.getFloat32(),Q.timeList.push(z),Q.vectices.push(Z=[]),q=m.getInt16(),s=0;s<q;s++)Z.push(m.getFloat32())}var it,at,st,rt,nt=m.getInt16();for(t=0;t<nt;t++){for(it=m.getInt16(),j=[],e=0;e<it;e++){for((at=new Lt).time=m.getFloat32(),st=m.getInt16(),i=0;i<st;i++)at.drawOrder.push(m.getInt16());j.push(at)}this.drawOrderAniArr.push(j)}var ht,lt,ot=m.getInt16();for(t=0;t<ot;t++){for(ht=m.getInt16(),rt=[],e=0;e<ht;e++)(lt=new Rt).name=m.getUTFString(),this._isParseAudio&&(lt.audioValue=m.getUTFString()),lt.intValue=m.getInt32(),lt.floatValue=m.getFloat32(),lt.stringValue=m.getUTFString(),lt.time=m.getFloat32(),rt.push(lt);this.eventAniArr.push(rt)}var ut=m.getInt16();if(0<ut)for(this.attachmentNames=[],t=0;t<ut;t++)this.attachmentNames.push(m.getUTFString());var ct,dt,_t=m.getInt16();for(t=0;t<_t;t++)(ct=new kt).name=m.readUTFString(),ct.parent=m.readUTFString(),ct.attachmentName=m.readUTFString(),ct.srcDisplayIndex=ct.displayIndex=m.getInt16(),(ct.templet=this).boneSlotDic[ct.name]=ct,null==(dt=this.bindBoneBoneSlotDic[ct.parent])&&(this.bindBoneBoneSlotDic[ct.parent]=dt=[]),dt.push(ct),this.boneSlotArray.push(ct);var pt,ft,mt,yt,xt,gt,vt,Dt,Mt,It,bt=m.readUTFString().split("\n"),Nt=0,At=m.getUint8();for(t=0;t<At;t++){for((pt=new Vt).name=bt[Nt++],yt=m.getUint8(),e=0;e<yt;e++){for((ft=new Yt).name=bt[Nt++],ct=this.boneSlotDic[ft.name],xt=m.getUint8(),i=0;i<xt;i++){if(mt=new Kt,this.skinSlotDisplayDataArr.push(mt),mt.name=bt[Nt++],mt.attachmentName=bt[Nt++],mt.transform=new Xt,mt.transform.scX=m.getFloat32(),mt.transform.skX=m.getFloat32(),mt.transform.skY=m.getFloat32(),mt.transform.scY=m.getFloat32(),mt.transform.x=m.getFloat32(),mt.transform.y=m.getFloat32(),ft.displayArr.push(mt),mt.width=m.getFloat32(),mt.height=m.getFloat32(),mt.type=m.getUint8(),mt.verLen=m.getUint16(),0<(T=m.getUint16()))for(mt.bones=[],a=0;a<T;a++){var Tt=m.getUint16();mt.bones.push(Tt)}if(0<(gt=m.getUint16()))for(mt.uvs=[],a=0;a<gt;a++)mt.uvs.push(m.getFloat32());if(0<(vt=m.getUint16()))for(mt.weights=[],a=0;a<vt;a++)mt.weights.push(m.getFloat32());if(0<(Dt=m.getUint16()))for(mt.triangles=[],a=0;a<Dt;a++)mt.triangles.push(m.getUint16());if(0<(Mt=m.getUint16()))for(mt.vertices=[],a=0;a<Mt;a++)mt.vertices.push(m.getFloat32());if(0<(It=m.getUint16()))for(mt.lengths=[],a=0;a<It;a++)mt.lengths.push(m.getFloat32())}pt.slotArr.push(ft)}this.skinDic[pt.name]=pt,this.skinDataArray.push(pt)}1==m.getUint8()?(this.yReverseMatrix=new St(1,0,0,-1,0,0),A&&A.setTempMatrix(this.yReverseMatrix)):A&&A.setTempMatrix(new St),this.showSkinByIndex(this.boneSlotDic,0),this.isParserComplete=!0,this.event("complete",this)},t.getTexture=function(t){var e=this.subTextureDic[t];return null==(e=e||this.subTextureDic[t.substr(0,t.length-1)])?this._mainTexture:e},t.showSkinByIndex=function(t,e,i){if(void 0===i&&(i=!0),e<0&&e>=this.skinDataArray.length)return!1;var a,s,r,n=0,h=this.skinDataArray[e];if(h){for(n=0,a=h.slotArr.length;n<a;n++)(r=h.slotArr[n])&&(s=t[r.name])&&(s.showSlotData(r,i),i&&"undefined"!=s.attachmentName&&"null"!=s.attachmentName?s.showDisplayByName(s.attachmentName):s.showDisplayByIndex(s.displayIndex));return!0}return!1},t.getSkinIndexByName=function(t){for(var e=0,i=this.skinDataArray.length;e<i;e++)if(this.skinDataArray[e].name==t)return e;return-1},t.getGrahicsDataWithCache=function(t,e){return this._graphicsCache[t]&&this._graphicsCache[t][e]?this._graphicsCache[t][e]:null},t.setGrahicsDataWithCache=function(t,e,i){this._graphicsCache[t][e]=i},t.destroy=function(){var t,e;for(e in this._isDestroyed=!0,this.subTextureDic)(t=this.subTextureDic[e])&&t.destroy();for(e in this._textureDic)(t=this._textureDic[e])&&t.destroy();for(var i=0,a=this.skinSlotDisplayDataArr.length;i<a;i++)this.skinSlotDisplayDataArr[i].destory();this.skinSlotDisplayDataArr.length=0,this.url&&delete s.TEMPLET_DICTIONARY[this.url],laya.resource.Resource.prototype.destroy.call(this)},t.getAniNameByIndex=function(t){t=this.getAnimation(t);return t?t.name:null},a(0,t,"rate",function(){return this._rate},function(t){this._rate=t}),s.LAYA_ANIMATION_160_VISION="LAYAANIMATION:1.6.0",s.LAYA_ANIMATION_VISION="LAYAANIMATION:1.7.0",s.TEMPLET_DICTIONARY=null,s}(st))}((window,document,Laya)),"function"==typeof define&&define.amd&&define("laya.core",["require","exports"],function(t,e){"use strict";for(var i in Object.defineProperty(e,"__esModule",{value:!0}),Laya){var a=Laya[i];a&&a.__isclass&&(e[i]=a)}});