"use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var a in e)if(e.hasOwnProperty(a))t[a]=e[a]};return function(e,a){t(e,a);function r(){this.constructor=e}e.prototype=a===null?Object.create(a):(r.prototype=a.prototype,new r)}}();var dragonBones;(function(t){})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function e(a){this._clock=new t.WorldClock;this._events=[];this._objects=[];this._eventManager=null;this._eventManager=a;console.info("DragonBones: "+e.VERSION+"\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/")}e.prototype.advanceTime=function(e){if(this._objects.length>0){for(var a=0,r=this._objects;a0){for(var n=0;na){i.length=a}t._maxCountMap[r]=a}else{t._defaultMaxCount=a;for(var r in t._poolsMap){var i=t._poolsMap[r];if(i.length>a){i.length=a}if(r in t._maxCountMap){t._maxCountMap[r]=a}}}};t.clearPool=function(e){if(e===void 0){e=null}if(e!==null){var a=String(e);var r=a in t._poolsMap?t._poolsMap[a]:null;if(r!==null&&r.length>0){r.length=0}}else{for(var i in t._poolsMap){var r=t._poolsMap[i];r.length=0}}};t.borrowObject=function(e){var a=String(e);var r=a in t._poolsMap?t._poolsMap[a]:null;if(r!==null&&r.length>0){var i=r.pop();i._isInPool=false;return i}var n=new e;n._onClear();return n};t.prototype.returnToPool=function(){this._onClear();t._returnObject(this)};t._hashCode=0;t._defaultMaxCount=3e3;t._maxCountMap={};t._poolsMap={};return t}();t.BaseObject=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function t(t,e,a,r,i,n){if(t===void 0){t=1}if(e===void 0){e=0}if(a===void 0){a=0}if(r===void 0){r=1}if(i===void 0){i=0}if(n===void 0){n=0}this.a=t;this.b=e;this.c=a;this.d=r;this.tx=i;this.ty=n}t.prototype.toString=function(){return"[object dragonBones.Matrix] a:"+this.a+" b:"+this.b+" c:"+this.c+" d:"+this.d+" tx:"+this.tx+" ty:"+this.ty};t.prototype.copyFrom=function(t){this.a=t.a;this.b=t.b;this.c=t.c;this.d=t.d;this.tx=t.tx;this.ty=t.ty;return this};t.prototype.copyFromArray=function(t,e){if(e===void 0){e=0}this.a=t[e];this.b=t[e+1];this.c=t[e+2];this.d=t[e+3];this.tx=t[e+4];this.ty=t[e+5];return this};t.prototype.identity=function(){this.a=this.d=1;this.b=this.c=0;this.tx=this.ty=0;return this};t.prototype.concat=function(t){var e=this.a*t.a;var a=0;var r=0;var i=this.d*t.d;var n=this.tx*t.a+t.tx;var s=this.ty*t.d+t.ty;if(this.b!==0||this.c!==0){e+=this.b*t.c;a+=this.b*t.d;r+=this.c*t.a;i+=this.c*t.b}if(t.b!==0||t.c!==0){a+=this.a*t.b;r+=this.d*t.c;n+=this.ty*t.c;s+=this.tx*t.b}this.a=e;this.b=a;this.c=r;this.d=i;this.tx=n;this.ty=s;return this};t.prototype.invert=function(){var t=this.a;var e=this.b;var a=this.c;var r=this.d;var i=this.tx;var n=this.ty;if(e===0&&a===0){this.b=this.c=0;if(t===0||r===0){this.a=this.b=this.tx=this.ty=0}else{t=this.a=1/t;r=this.d=1/r;this.tx=-t*i;this.ty=-r*n}return this}var s=t*r-e*a;if(s===0){this.a=this.d=1;this.b=this.c=0;this.tx=this.ty=0;return this}s=1/s;var o=this.a=r*s;e=this.b=-e*s;a=this.c=-a*s;r=this.d=t*s;this.tx=-(o*i+a*n);this.ty=-(e*i+r*n);return this};t.prototype.transformPoint=function(t,e,a,r){if(r===void 0){r=false}a.x=this.a*t+this.c*e;a.y=this.b*t+this.d*e;if(!r){a.x+=this.tx;a.y+=this.ty}};t.prototype.transformRectangle=function(t,e){if(e===void 0){e=false}var a=this.a;var r=this.b;var i=this.c;var n=this.d;var s=e?0:this.tx;var o=e?0:this.ty;var l=t.x;var h=t.y;var f=l+t.width;var u=h+t.height;var _=a*l+i*h+s;var c=r*l+n*h+o;var p=a*f+i*h+s;var m=r*f+n*h+o;var d=a*f+i*u+s;var v=r*f+n*u+o;var y=a*l+i*u+s;var g=r*l+n*u+o;var b=0;if(_>p){b=_;_=p;p=b}if(d>y){b=d;d=y;y=b}t.x=Math.floor(_y?p:y)-t.x);if(c>m){b=c;c=m;m=b}if(v>g){b=v;v=g;g=b}t.y=Math.floor(cg?m:g)-t.y)};return t}();t.Matrix=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function t(t,e,a,r,i,n){if(t===void 0){t=0}if(e===void 0){e=0}if(a===void 0){a=0}if(r===void 0){r=0}if(i===void 0){i=1}if(n===void 0){n=1}this.x=t;this.y=e;this.skew=a;this.rotation=r;this.scaleX=i;this.scaleY=n}t.normalizeRadian=function(t){t=(t+Math.PI)%(Math.PI*2);t+=t>0?-Math.PI:Math.PI;return t};t.prototype.toString=function(){return"[object dragonBones.Transform] x:"+this.x+" y:"+this.y+" skewX:"+this.skew*180/Math.PI+" skewY:"+this.rotation*180/Math.PI+" scaleX:"+this.scaleX+" scaleY:"+this.scaleY};t.prototype.copyFrom=function(t){this.x=t.x;this.y=t.y;this.skew=t.skew;this.rotation=t.rotation;this.scaleX=t.scaleX;this.scaleY=t.scaleY;return this};t.prototype.identity=function(){this.x=this.y=0;this.skew=this.rotation=0;this.scaleX=this.scaleY=1;return this};t.prototype.add=function(t){this.x+=t.x;this.y+=t.y;this.skew+=t.skew;this.rotation+=t.rotation;this.scaleX*=t.scaleX;this.scaleY*=t.scaleY;return this};t.prototype.minus=function(t){this.x-=t.x;this.y-=t.y;this.skew-=t.skew;this.rotation-=t.rotation;this.scaleX/=t.scaleX;this.scaleY/=t.scaleY;return this};t.prototype.fromMatrix=function(e){var a=this.scaleX,r=this.scaleY;var i=t.PI_Q;this.x=e.tx;this.y=e.ty;this.rotation=Math.atan(e.b/e.a);var n=Math.atan(-e.c/e.d);this.scaleX=this.rotation>-i&&this.rotation-i&&n=0&&this.scaleX<0){this.scaleX=-this.scaleX;this.rotation=this.rotation-Math.PI}if(r>=0&&this.scaleY<0){this.scaleY=-this.scaleY;n=n-Math.PI}this.skew=n-this.rotation;return this};t.prototype.toMatrix=function(t){if(this.rotation===0){t.a=1;t.b=0}else{t.a=Math.cos(this.rotation);t.b=Math.sin(this.rotation)}if(this.skew===0){t.c=-t.b;t.d=t.a}else{t.c=-Math.sin(this.skew+this.rotation);t.d=Math.cos(this.skew+this.rotation)}if(this.scaleX!==1){t.a*=this.scaleX;t.b*=this.scaleX}if(this.scaleY!==1){t.c*=this.scaleY;t.d*=this.scaleY}t.tx=this.x;t.ty=this.y;return this};t.PI=Math.PI;t.PI_D=Math.PI*2;t.PI_H=Math.PI/2;t.PI_Q=Math.PI/4;t.RAD_DEG=180/Math.PI;t.DEG_RAD=Math.PI/180;return t}();t.Transform=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function t(t,e,a,r,i,n,s,o){if(t===void 0){t=1}if(e===void 0){e=1}if(a===void 0){a=1}if(r===void 0){r=1}if(i===void 0){i=0}if(n===void 0){n=0}if(s===void 0){s=0}if(o===void 0){o=0}this.alphaMultiplier=t;this.redMultiplier=e;this.greenMultiplier=a;this.blueMultiplier=r;this.alphaOffset=i;this.redOffset=n;this.greenOffset=s;this.blueOffset=o}t.prototype.copyFrom=function(t){this.alphaMultiplier=t.alphaMultiplier;this.redMultiplier=t.redMultiplier;this.greenMultiplier=t.greenMultiplier;this.blueMultiplier=t.blueMultiplier;this.alphaOffset=t.alphaOffset;this.redOffset=t.redOffset;this.greenOffset=t.greenOffset;this.blueOffset=t.blueOffset};t.prototype.identity=function(){this.alphaMultiplier=this.redMultiplier=this.greenMultiplier=this.blueMultiplier=1;this.alphaOffset=this.redOffset=this.greenOffset=this.blueOffset=0};return t}();t.ColorTransform=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function t(t,e){if(t===void 0){t=0}if(e===void 0){e=0}this.x=t;this.y=e}t.prototype.copyFrom=function(t){this.x=t.x;this.y=t.y};t.prototype.clear=function(){this.x=this.y=0};return t}();t.Point=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function t(t,e,a,r){if(t===void 0){t=0}if(e===void 0){e=0}if(a===void 0){a=0}if(r===void 0){r=0}this.x=t;this.y=e;this.width=a;this.height=r}t.prototype.copyFrom=function(t){this.x=t.x;this.y=t.y;this.width=t.width;this.height=t.height};t.prototype.clear=function(){this.x=this.y=0;this.width=this.height=0};return t}();t.Rectangle=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.ints=[];e.floats=[];e.strings=[];return e}e.toString=function(){return"[class dragonBones.UserData]"};e.prototype._onClear=function(){this.ints.length=0;this.floats.length=0;this.strings.length=0};e.prototype.addInt=function(t){this.ints.push(t)};e.prototype.addFloat=function(t){this.floats.push(t)};e.prototype.addString=function(t){this.strings.push(t)};e.prototype.getInt=function(t){if(t===void 0){t=0}return t>=0&&t=0&&t=0&&t=t){a=0}if(this.sortedBones.indexOf(i)>=0){continue}var n=false;for(var s in this.constraints){var o=this.constraints[s];if(o.root===i&&this.sortedBones.indexOf(o.target)<0){n=true;break}}if(n){continue}if(i.parent!==null&&this.sortedBones.indexOf(i.parent)<0){continue}this.sortedBones.push(i);r++}};a.prototype.cacheFrames=function(t){if(this.cacheFrameRate>0){return}this.cacheFrameRate=t;for(var e in this.animations){this.animations[e].cacheFrames(this.cacheFrameRate)}};a.prototype.setCacheFrame=function(t,e){var a=this.parent.cachedFrames;var r=a.length;a.length+=10;a[r]=t.a;a[r+1]=t.b;a[r+2]=t.c;a[r+3]=t.d;a[r+4]=t.tx;a[r+5]=t.ty;a[r+6]=e.rotation;a[r+7]=e.skew;a[r+8]=e.scaleX;a[r+9]=e.scaleY;return r};a.prototype.getCacheFrame=function(t,e,a){var r=this.parent.cachedFrames;t.a=r[a];t.b=r[a+1];t.c=r[a+2];t.d=r[a+3];t.tx=r[a+4];t.ty=r[a+5];e.rotation=r[a+6];e.skew=r[a+7];e.scaleX=r[a+8];e.scaleY=r[a+9];e.x=t.tx;e.y=t.ty};a.prototype.addBone=function(t){if(t.name in this.bones){console.warn("Same bone: "+t.name);return}this.bones[t.name]=t;this.sortedBones.push(t)};a.prototype.addSlot=function(t){if(t.name in this.slots){console.warn("Same slot: "+t.name);return}this.slots[t.name]=t;this.sortedSlots.push(t)};a.prototype.addConstraint=function(t){if(t.name in this.constraints){console.warn("Same constraint: "+t.name);return}this.constraints[t.name]=t};a.prototype.addSkin=function(t){if(t.name in this.skins){console.warn("Same skin: "+t.name);return}t.parent=this;this.skins[t.name]=t;if(this.defaultSkin===null){this.defaultSkin=t}if(t.name==="default"){this.defaultSkin=t}};a.prototype.addAnimation=function(t){if(t.name in this.animations){console.warn("Same animation: "+t.name);return}t.parent=this;this.animations[t.name]=t;this.animationNames.push(t.name);if(this.defaultAnimation===null){this.defaultAnimation=t}};a.prototype.addAction=function(t,e){if(e){this.defaultActions.push(t)}else{this.actions.push(t)}};a.prototype.getBone=function(t){return t in this.bones?this.bones[t]:null};a.prototype.getSlot=function(t){return t in this.slots?this.slots[t]:null};a.prototype.getConstraint=function(t){return t in this.constraints?this.constraints[t]:null};a.prototype.getSkin=function(t){return t in this.skins?this.skins[t]:null};a.prototype.getMesh=function(t,e,a){var r=this.getSkin(t);if(r===null){return null}return r.getDisplay(e,a)};a.prototype.getAnimation=function(t){return t in this.animations?this.animations[t]:null};return a}(t.BaseObject);t.ArmatureData=e;var a=function(e){__extends(a,e);function a(){var a=e!==null&&e.apply(this,arguments)||this;a.transform=new t.Transform;a.userData=null;return a}a.toString=function(){return"[class dragonBones.BoneData]"};a.prototype._onClear=function(){if(this.userData!==null){this.userData.returnToPool()}this.inheritTranslation=false;this.inheritRotation=false;this.inheritScale=false;this.inheritReflection=false;this.type=0;this.length=0;this.name="";this.transform.identity();this.userData=null;this.parent=null};return a}(t.BaseObject);t.BoneData=a;var r=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.vertices=[];return e}e.toString=function(){return"[class dragonBones.SurfaceData]"};e.prototype._onClear=function(){t.prototype._onClear.call(this);this.type=1;this.segmentX=0;this.segmentY=0;this.vertices.length=0};return e}(a);t.SurfaceData=r;var i=function(e){__extends(a,e);function a(){var t=e!==null&&e.apply(this,arguments)||this;t.color=null;t.userData=null;return t}a.createColor=function(){return new t.ColorTransform};a.toString=function(){return"[class dragonBones.SlotData]"};a.prototype._onClear=function(){if(this.userData!==null){this.userData.returnToPool()}this.blendMode=0;this.displayIndex=0;this.zOrder=0;this.name="";this.color=null;this.userData=null;this.parent=null};a.DEFAULT_COLOR=new t.ColorTransform;return a}(t.BaseObject);t.SlotData=i})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.toString=function(){return"[class dragonBones.CanvasData]"};e.prototype._onClear=function(){this.hasBackground=false;this.color=0;this.x=0;this.y=0;this.width=0;this.height=0};return e}(t.BaseObject);t.CanvasData=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.displays={};return e}e.toString=function(){return"[class dragonBones.SkinData]"};e.prototype._onClear=function(){for(var t in this.displays){var e=this.displays[t];for(var a=0,r=e;ai){s|=2}if(en){s|=8}return s};e.rectangleIntersectsSegment=function(t,a,r,i,n,s,o,l,h,f,u){if(h===void 0){h=null}if(f===void 0){f=null}if(u===void 0){u=null}var _=t>n&&ts&&an&&rs&&i=-a&&t<=a){var r=this.height*.5;if(e>=-r&&e<=r){return true}}return false};e.prototype.intersectsSegment=function(t,a,r,i,n,s,o){if(n===void 0){n=null}if(s===void 0){s=null}if(o===void 0){o=null}var l=this.width*.5;var h=this.height*.5;var f=e.rectangleIntersectsSegment(t,a,r,i,-l,-h,l,h,n,s,o);return f};return e}(e);t.RectangleBoundingBoxData=a;var r=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.toString=function(){return"[class dragonBones.EllipseData]"};e.ellipseIntersectsSegment=function(t,e,a,r,i,n,s,o,l,h,f){if(l===void 0){l=null}if(h===void 0){h=null}if(f===void 0){f=null}var u=s/o;var _=u*u;e*=u;r*=u;var c=a-t;var p=r-e;var m=Math.sqrt(c*c+p*p);var d=c/m;var v=p/m;var y=(i-t)*d+(n-e)*v;var g=y*y;var b=t*t+e*e;var D=s*s;var T=D-b+g;var A=0;if(T>=0){var x=Math.sqrt(T);var P=y-x;var O=y+x;var S=P<0?-1:P<=m?0:1;var E=O<0?-1:O<=m?0:1;var M=S*E;if(M<0){return-1}else if(M===0){if(S===-1){A=2;a=t+O*d;r=(e+O*v)/u;if(l!==null){l.x=a;l.y=r}if(h!==null){h.x=a;h.y=r}if(f!==null){f.x=Math.atan2(r/D*_,a/D);f.y=f.x+Math.PI}}else if(E===1){A=1;t=t+P*d;e=(e+P*v)/u;if(l!==null){l.x=t;l.y=e}if(h!==null){h.x=t;h.y=e}if(f!==null){f.x=Math.atan2(e/D*_,t/D);f.y=f.x+Math.PI}}else{A=3;if(l!==null){l.x=t+P*d;l.y=(e+P*v)/u;if(f!==null){f.x=Math.atan2(l.y/D*_,l.x/D)}}if(h!==null){h.x=t+O*d;h.y=(e+O*v)/u;if(f!==null){f.y=Math.atan2(h.y/D*_,h.x/D)}}}}}return A};e.prototype._onClear=function(){t.prototype._onClear.call(this);this.type=1};e.prototype.containsPoint=function(t,e){var a=this.width*.5;if(t>=-a&&t<=a){var r=this.height*.5;if(e>=-r&&e<=r){e*=a/r;return Math.sqrt(t*t+e*e)<=a}}return false};e.prototype.intersectsSegment=function(t,a,r,i,n,s,o){if(n===void 0){n=null}if(s===void 0){s=null}if(o===void 0){o=null}var l=e.ellipseIntersectsSegment(t,a,r,i,0,0,this.width*.5,this.height*.5,n,s,o);return l};return e}(e);t.EllipseBoundingBoxData=r;var i=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.vertices=[];return e}e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"};e.polygonIntersectsSegment=function(t,e,a,r,i,n,s,o){if(n===void 0){n=null}if(s===void 0){s=null}if(o===void 0){o=null}if(t===a){t=a+1e-6}if(e===r){e=r+1e-6}var l=i.length;var h=t-a;var f=e-r;var u=t*r-e*a;var _=0;var c=i[l-2];var p=i[l-1];var m=0;var d=0;var v=0;var y=0;var g=0;var b=0;for(var D=0;D=c&&E<=T||E>=T&&E<=c)&&(h===0||E>=t&&E<=a||E>=a&&E<=t)){var M=(u*P-f*O)/S;if((M>=p&&M<=A||M>=A&&M<=p)&&(f===0||M>=e&&M<=r||M>=r&&M<=e)){if(s!==null){var B=E-t;if(B<0){B=-B}if(_===0){m=B;d=B;v=E;y=M;g=E;b=M;if(o!==null){o.x=Math.atan2(A-p,T-c)-Math.PI*.5;o.y=o.x}}else{if(Bd){d=B;g=E;b=M;if(o!==null){o.y=Math.atan2(A-p,T-c)-Math.PI*.5}}}_++}else{v=E;y=M;g=E;b=M;_++;if(o!==null){o.x=Math.atan2(A-p,T-c)-Math.PI*.5;o.y=o.x}break}}}c=T;p=A}if(_===1){if(n!==null){n.x=v;n.y=y}if(s!==null){s.x=v;s.y=y}if(o!==null){o.y=o.x+Math.PI}}else if(_>1){_++;if(n!==null){n.x=v;n.y=y}if(s!==null){s.x=g;s.y=b}}return _};e.prototype._onClear=function(){t.prototype._onClear.call(this);this.type=2;this.x=0;this.y=0;this.vertices.length=0};e.prototype.containsPoint=function(t,e){var a=false;if(t>=this.x&&t<=this.width&&e>=this.y&&e<=this.height){for(var r=0,i=this.vertices.length,n=i-2;r=e||s=e){var l=this.vertices[n];var h=this.vertices[r];if((e-o)*(l-h)/(s-o)+h0){return}this.cacheFrameRate=Math.max(Math.ceil(t*this.scale),1);var e=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=e;for(var a=0,r=this.cacheFrames.length;a=0};e.prototype.addBoneMask=function(t,e,a){if(a===void 0){a=true}var r=t.getBone(e);if(r===null){return}if(this.boneMask.indexOf(e)<0){this.boneMask.push(e)}if(a){for(var i=0,n=t.getBones();i=0){this.boneMask.splice(r,1)}if(a){var i=t.getBone(e);if(i!==null){if(this.boneMask.length>0){for(var n=0,s=t.getBones();n=0&&i.contains(o)){this.boneMask.splice(l,1)}}}else{for(var h=0,f=t.getBones();he._zOrder?1:-1};a.prototype._onClear=function(){if(this._clock!==null){this._clock.remove(this)}for(var t=0,e=this._bones;t=n){continue}var o=a[s];var l=this.getSlot(o.name);if(l!==null){l._setZorder(i)}}this._slotsDirty=true;this._zOrderDirty=!r}};a.prototype._addBone=function(t){if(this._bones.indexOf(t)<0){this._bones.push(t)}};a.prototype._addSlot=function(t){if(this._slots.indexOf(t)<0){this._slots.push(t)}};a.prototype._addConstraint=function(t){if(this._constraints.indexOf(t)<0){this._constraints.push(t)}};a.prototype._bufferAction=function(t,e){if(this._actions.indexOf(t)<0){if(e){this._actions.push(t)}else{this._actions.unshift(t)}}};a.prototype.dispose=function(){if(this._armatureData!==null){this._lockUpdate=true;this._dragonBones.bufferObject(this)}};a.prototype.init=function(e,a,r,i){if(this._armatureData!==null){return}this._armatureData=e;this._animation=t.BaseObject.borrowObject(t.Animation);this._proxy=a;this._display=r;this._dragonBones=i;this._proxy.dbInit(this);this._animation.init(this);this._animation.animations=this._armatureData.animations};a.prototype.advanceTime=function(t){if(this._lockUpdate){return}if(this._armatureData===null){console.warn("The armature has been disposed.");return}else if(this._armatureData.parent===null){console.warn("The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear().");return}var e=this._cacheFrameIndex;this._animation.advanceTime(t);if(this._slotsDirty){this._slotsDirty=false;this._slots.sort(a._onSortSlots)}if(this._cacheFrameIndex<0||this._cacheFrameIndex!==e){var r=0,i=0;for(r=0,i=this._bones.length;r0){this._lockUpdate=true;for(var n=0,s=this._actions;n0){var a=this.getBone(t);if(a!==null){a.invalidUpdate();if(e){for(var r=0,i=this._slots;r0){if(i!==null||n!==null){if(i!==null){var T=o?i.y-e:i.x-t;if(T<0){T=-T}if(d===null||Th){h=T;_=n.x;c=n.y;v=b;if(s!==null){m=s.y}}}}else{d=b;break}}}if(d!==null&&i!==null){i.x=f;i.y=u;if(s!==null){s.x=p}}if(v!==null&&n!==null){n.x=_;n.y=c;if(s!==null){s.y=m}}return d};a.prototype.getBone=function(t){for(var e=0,a=this._bones;e=0&&this._cachedFrameIndices!==null){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e){this._transformDirty=false}else if(e>=0){this._transformDirty=true;this._cachedFrameIndex=e}else{if(this._hasConstraint){for(var a=0,r=this._armature._constraints;a=0){this._transformDirty=false;this._cachedFrameIndices[t]=this._cachedFrameIndex}else{this._transformDirty=true;this._cachedFrameIndex=-1}}}else{if(this._hasConstraint){for(var n=0,s=this._armature._constraints;n=0;if(this._localDirty){this._updateGlobalTransformMatrix(o)}if(o&&this._cachedFrameIndices!==null){this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global)}}else{this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex)}}else if(this._childrenTransformDirty){this._childrenTransformDirty=false}this._localDirty=true};a.prototype.updateByConstraint=function(){if(this._localDirty){this._localDirty=false;if(this._transformDirty||this._parent!==null&&this._parent._childrenTransformDirty){this._updateGlobalTransformMatrix(true)}this._transformDirty=true}};a.prototype.invalidUpdate=function(){this._transformDirty=true};a.prototype.contains=function(t){if(t===this){return false}var e=t;while(e!==this&&e!==null){e=e.parent}return e===this};Object.defineProperty(a.prototype,"boneData",{get:function(){return this._boneData},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible===t){return}this._visible=t;for(var e=0,a=this._armature.getSlots();e=n){return this.globalTransformMatrix}i=a>this._kX*(t+n)+d;p=((o*(l+1)+o*2+l+c)*2+(i?1:0))*7;if(this._matrixCahce[p]>0){y.copyFromArray(v,p+1)}else{var g=c*(h+2);var b=this._hullCache[4];var D=this._hullCache[5];var T=this._hullCache[2]-(l-c)*b;var A=this._hullCache[3]-(l-c)*D;var x=this._vertices;if(i){this._getAffineTransform(-n,d+u,r-n,u,x[g+h+2],x[g+h+3],T+b,A+D,x[g],x[g+1],e._helpTransform,y,true)}else{this._getAffineTransform(-r,d,r-n,u,T,A,x[g],x[g+1],T+b,A+D,e._helpTransform,y,false)}v[p]=1;v[p+1]=y.a;v[p+2]=y.b;v[p+3]=y.c;v[p+4]=y.d;v[p+5]=y.tx;v[p+6]=y.ty}}else if(t>=n){if(a<-n||a>=n){return this.globalTransformMatrix}i=a>this._kX*(t-r)+d;p=((o*(l+1)+o+c)*2+(i?1:0))*7;if(this._matrixCahce[p]>0){y.copyFromArray(v,p+1)}else{var g=(c+1)*(h+2)-2;var b=this._hullCache[4];var D=this._hullCache[5];var T=this._hullCache[0]+c*b;var A=this._hullCache[1]+c*D;var x=this._vertices;if(i){this._getAffineTransform(r,d+u,r-n,u,T+b,A+D,x[g+h+2],x[g+h+3],T,A,e._helpTransform,y,true)}else{this._getAffineTransform(n,d,r-n,u,x[g],x[g+1],T,A,x[g+h+2],x[g+h+3],e._helpTransform,y,false)}v[p]=1;v[p+1]=y.a;v[p+2]=y.b;v[p+3]=y.c;v[p+4]=y.d;v[p+5]=y.tx;v[p+6]=y.ty}}else if(a<-n){if(t<-n||t>=n){return this.globalTransformMatrix}i=a>this._kY*(t-m-f)-r;p=(o*(l+1)+_*2+(i?1:0))*7;if(this._matrixCahce[p]>0){y.copyFromArray(v,p+1)}else{var g=_*2;var b=this._hullCache[10];var D=this._hullCache[11];var T=this._hullCache[8]+_*b;var A=this._hullCache[9]+_*D;var x=this._vertices;if(i){this._getAffineTransform(m+f,-n,f,r-n,x[g+2],x[g+3],x[g],x[g+1],T+b,A+D,e._helpTransform,y,true)}else{this._getAffineTransform(m,-r,f,r-n,T,A,T+b,A+D,x[g],x[g+1],e._helpTransform,y,false)}v[p]=1;v[p+1]=y.a;v[p+2]=y.b;v[p+3]=y.c;v[p+4]=y.d;v[p+5]=y.tx;v[p+6]=y.ty}}else if(a>=n){if(t<-n||t>=n){return this.globalTransformMatrix}i=a>this._kY*(t-m-f)+n;p=((o*(l+1)+o+l+c)*2+(i?1:0))*7;if(this._matrixCahce[p]>0){y.copyFromArray(v,p+1)}else{var g=l*(h+2)+_*2;var b=this._hullCache[10];var D=this._hullCache[11];var T=this._hullCache[6]-(o-_)*b;var A=this._hullCache[7]-(o-_)*D;var x=this._vertices;if(i){this._getAffineTransform(m+f,r,f,r-n,T+b,A+D,T,A,x[g+2],x[g+3],e._helpTransform,y,true)}else{this._getAffineTransform(m,n,f,r-n,x[g],x[g+1],x[g+2],x[g+3],T,A,e._helpTransform,y,false)}v[p]=1;v[p+1]=y.a;v[p+2]=y.b;v[p+3]=y.c;v[p+4]=y.d;v[p+5]=y.tx;v[p+6]=y.ty}}else{i=a>this._k*(t-m-f)+d;p=((o*c+_)*2+(i?1:0))*7;if(this._matrixCahce[p]>0){y.copyFromArray(v,p+1)}else{var g=_*2+c*(h+2);var x=this._vertices;if(i){this._getAffineTransform(m+f,d+u,f,u,x[g+h+4],x[g+h+5],x[g+h+2],x[g+h+3],x[g+2],x[g+3],e._helpTransform,y,true)}else{this._getAffineTransform(m,d,f,u,x[g],x[g+1],x[g+2],x[g+3],x[g+h+2],x[g+h+3],e._helpTransform,y,false)}v[p]=1;v[p+1]=y.a;v[p+2]=y.b;v[p+3]=y.c;v[p+4]=y.d;v[p+5]=y.tx;v[p+6]=y.ty}}return y};e.prototype.init=function(e,a){if(this._boneData!==null){return}t.prototype.init.call(this,e,a);var r=e.segmentX;var i=e.segmentY;var n=e.vertices.length;var s=1e3;var o=200;this._dX=o*2/r;this._dY=o*2/i;this._k=-this._dY/this._dX;this._kX=-this._dY/(s-o);this._kY=-(s-o)/this._dX;this._vertices.length=n;this._deformVertices.length=n;this._matrixCahce.length=(r*i+r*2+i*2)*2*7;this._hullCache.length=10;for(var l=0;l=0&&this._cachedFrameIndices!==null){var a=this._cachedFrameIndices[t];if(a>=0&&this._cachedFrameIndex===a){this._transformDirty=false}else if(a>=0){this._transformDirty=true;this._cachedFrameIndex=a}else{if(this._hasConstraint){for(var r=0,i=this._armature._constraints;r=0){this._transformDirty=false;this._cachedFrameIndices[t]=this._cachedFrameIndex}else{this._transformDirty=true;this._cachedFrameIndex=-1}}}else{if(this._hasConstraint){for(var s=0,o=this._armature._constraints;s=0;if(this._localDirty){this._updateGlobalTransformMatrix(f)}if(f&&this._cachedFrameIndices!==null){this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global)}}else{this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex)}var u=1e3;var _=200;var c=2*this.global.x;var p=2*this.global.y;var m=e._helpPoint;this.globalTransformMatrix.transformPoint(u,-_,m);this._hullCache[0]=m.x;this._hullCache[1]=m.y;this._hullCache[2]=c-m.x;this._hullCache[3]=p-m.y;this.globalTransformMatrix.transformPoint(0,this._dY,m,true);this._hullCache[4]=m.x;this._hullCache[5]=m.y;this.globalTransformMatrix.transformPoint(_,u,m);this._hullCache[6]=m.x;this._hullCache[7]=m.y;this._hullCache[8]=c-m.x;this._hullCache[9]=p-m.y;this.globalTransformMatrix.transformPoint(this._dX,0,m,true);this._hullCache[10]=m.x;this._hullCache[11]=m.y}else if(this._childrenTransformDirty){this._childrenTransformDirty=false}this._localDirty=true};return e}(t.Bone);t.Surface=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(e){__extends(a,e);function a(){var a=e!==null&&e.apply(this,arguments)||this;a._localMatrix=new t.Matrix;a._colorTransform=new t.ColorTransform;a._displayDatas=[];a._displayList=[];a._deformVertices=null;a._rawDisplay=null;a._meshDisplay=null;return a}a.prototype._onClear=function(){e.prototype._onClear.call(this);var a=[];for(var r=0,i=this._displayList;r=0){if(this._rawDisplayDatas!==null){n=this._displayIndex=0&&this._displayIndex=0&&this._rawDisplayDatas!==null){var s=this._displayIndex0){for(var o=0,l=n;o0){if(this._displayList.length!==e.length){this._displayList.length=e.length}for(var a=0,r=e.length;a0){this._displayList.length=0}if(this._displayIndex>=0&&this._displayIndex=0&&this._cachedFrameIndices!==null){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e){this._transformDirty=false}else if(e>=0){this._transformDirty=true;this._cachedFrameIndex=e}else if(this._transformDirty||this._parent._childrenTransformDirty){this._transformDirty=true;this._cachedFrameIndex=-1}else if(this._cachedFrameIndex>=0){this._transformDirty=false;this._cachedFrameIndices[t]=this._cachedFrameIndex}else{this._transformDirty=true;this._cachedFrameIndex=-1}}else if(this._transformDirty||this._parent._childrenTransformDirty){t=-1;this._transformDirty=true;this._cachedFrameIndex=-1}if(this._display===null){return}if(this._visibleDirty){this._visibleDirty=false;this._updateVisible()}if(this._blendModeDirty){this._blendModeDirty=false;this._updateBlendMode()}if(this._colorDirty){this._colorDirty=false;this._updateColor()}if(this._deformVertices!==null&&this._deformVertices.verticesData!==null&&this._display===this._meshDisplay){var a=this._deformVertices.verticesData.weight!==null;var r=this._parent._boneData.type!==0;if(this._deformVertices.verticesDirty||a&&this._deformVertices.isBonesUpdate()||r&&this._parent._childrenTransformDirty){this._deformVertices.verticesDirty=false;this._updateMesh()}if(a||r){return}}if(this._transformDirty){this._transformDirty=false;if(this._cachedFrameIndex<0){var i=t>=0;this._updateGlobalTransformMatrix(i);if(i&&this._cachedFrameIndices!==null){this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global)}}else{this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex)}this._updateTransform()}};a.prototype.updateTransformAndMatrix=function(){if(this._transformDirty){this._transformDirty=false;this._updateGlobalTransformMatrix(false)}};a.prototype.replaceDisplayData=function(t,e){if(e===void 0){e=-1}if(e<0){if(this._displayIndex<0){e=0}else{e=this._displayIndex}}if(this._displayDatas.length<=e){this._displayDatas.length=e+1;for(var a=0,r=this._displayDatas.length;a0){if(l===1||l===2){if(n!==null){this.globalTransformMatrix.transformPoint(n.x,n.y,n);if(s!==null){s.x=n.x;s.y=n.y}}else if(s!==null){this.globalTransformMatrix.transformPoint(s.x,s.y,s)}}else{if(n!==null){this.globalTransformMatrix.transformPoint(n.x,n.y,n)}if(s!==null){this.globalTransformMatrix.transformPoint(s.x,s.y,s)}}if(o!==null){this.globalTransformMatrix.transformPoint(Math.cos(o.x),Math.sin(o.x),a._helpPoint,true);o.x=Math.atan2(a._helpPoint.y,a._helpPoint.x);this.globalTransformMatrix.transformPoint(Math.cos(o.y),Math.sin(o.y),a._helpPoint,true);o.y=Math.atan2(a._helpPoint.y,a._helpPoint.x)}}return l};a.prototype.invalidUpdate=function(){this._displayDirty=true;this._transformDirty=true};Object.defineProperty(a.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible===t){return}this._visible=t;this._updateVisible()},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"displayIndex",{get:function(){return this._displayIndex},set:function(t){if(this._setDisplayIndex(t)){this.update(-1)}},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"name",{get:function(){return this._slotData.name},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"displayList",{get:function(){return this._displayList.concat()},set:function(e){var a=this._displayList.concat();var r=new Array;if(this._setDisplayList(e)){this.update(-1)}for(var i=0,n=a;id){continue}var T=0;for(;;b++){var A=v[b];if(m>A){continue}if(b===0){T=m/A}else{var x=v[b-1];T=(m-x)/(A-x)}break}if(b!==p){p=b;if(f&&b===c){this._computeVertices(_-4,4,0,u);this._computeVertices(0,4,4,u)}else{this._computeVertices(b*6+2,8,0,u)}}this.addCurvePosition(T,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],l,g,a)}return}if(f){_+=2;u.length=o;this._computeVertices(2,_-4,0,u);this._computeVertices(0,2,_-4,u);u[_-2]=u[0];u[_-1]=u[1]}else{c--;_-=4;u.length=_;this._computeVertices(2,_,0,u)}var P=new Array(c);d=0;var O=u[0],S=u[1],E=0,M=0,B=0,C=0,w=0,I=0;var F,N,R,k,j,L,V,U;for(var y=0,Y=2;yd){continue}for(;;b++){var W=P[b];if(G>W)continue;if(b===0)G/=W;else{var z=P[b-1];G=(G-z)/(W-z)}break}if(b!==p){p=b;var K=b*6;O=u[K];S=u[K+1];E=u[K+2];M=u[K+3];B=u[K+4];C=u[K+5];w=u[K+6];I=u[K+7];F=(O-E*2+B)*.03;N=(S-M*2+C)*.03;R=((E-B)*3-O+w)*.006;k=((M-C)*3-S+I)*.006;j=F*2+R;L=N*2+k;V=(E-O)*.3+F+R*.16666667;U=(M-S)*.3+N+k*.16666667;H=Math.sqrt(V*V+U*U);X[0]=H;for(K=1;K<8;K++){V+=j;U+=L;j+=R;L+=k;H+=Math.sqrt(V*V+U*U);X[K]=H}V+=j;U+=L;H+=Math.sqrt(V*V+U*U);X[8]=H;V+=j+R;U+=L+k;H+=Math.sqrt(V*V+U*U);X[9]=H;$=0}G*=H;for(;;$++){var Z=X[$];if(G>Z)continue;if($===0)G/=Z;else{var z=X[$-1];G=$+(G-z)/(Z-z)}break}this.addCurvePosition(G*.1,O,S,E,M,B,C,w,I,l,g,a)}};a.prototype.addCurvePosition=function(t,e,a,r,i,n,s,o,l,h,f,u){if(t===0){h[f]=e;h[f+1]=a;h[f+2]=0;return}if(t===1){h[f]=o;h[f+1]=l;h[f+2]=0;return}var _=1-t;var c=_*_;var p=t*t;var m=c*_;var d=c*t*3;var v=_*p*3;var y=t*p;var g=m*e+d*r+v*n+y*o;var b=m*a+d*i+v*s+y*l;h[f]=g;h[f+1]=b;if(u){h[f+2]=Math.atan2(b-(m*a+d*i+v*s),g-(m*e+d*r+v*n))}else{h[f+2]=0}};a.prototype.init=function(t,e){this._constraintData=t;this._armature=e;var a=t;this.pathOffset=a.pathDisplayData.vertices.offset;this.position=a.position;this.spacing=a.spacing;this.rotateOffset=a.rotateOffset;this.rotateMix=a.rotateMix;this.translateMix=a.translateMix;this._root=this._armature.getBone(a.root.name);this._target=this._armature.getBone(a.target.name);this._pathSlot=this._armature.getSlot(a.pathSlot.name);for(var r=0,i=a.bones.length;r0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD}}var B=this.rotateMix;var C=this.translateMix;for(var v=0,w=3;v0){var k=D.a,j=D.b,L=D.c,V=D.d,U=void 0,Y=void 0,X=void 0;if(_){U=P[w-1]}else{U=Math.atan2(F,I)}U-=Math.atan2(j,k);if(M){Y=Math.cos(U);X=Math.sin(U);var H=g._boneData.length;S+=(H*(Y*k-X*j)-I)*B;E+=(H*(X*k+Y*j)-F)*B}else{U+=O}if(U>t.Transform.PI){U-=t.Transform.PI_D}else if(U<-t.Transform.PI){U+=t.Transform.PI_D}U*=B;Y=Math.cos(U);X=Math.sin(U);D.a=Y*k-X*j;D.b=X*k+Y*j;D.c=Y*L-X*V;D.d=X*L+Y*V}g.global.fromMatrix(D)}this.dirty=false};a.prototype.invalidUpdate=function(){};return a}(e);t.PathConstraint=r})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function t(t){if(t===void 0){t=0}this.time=0;this.timeScale=1;this._systemTime=0;this._animatebles=[];this._clock=null;this.time=t;this._systemTime=(new Date).getTime()*.001}t.prototype.advanceTime=function(t){if(t!==t){t=0}var e=Date.now()*.001;if(t<0){t=e-this._systemTime}this._systemTime=e;if(this.timeScale!==1){t*=this.timeScale}if(t===0){return}if(t<0){this.time-=t}else{this.time+=t}var a=0,r=0,i=this._animatebles.length;for(;a0){this._animatebles[a-r]=n;this._animatebles[a]=null}n.advanceTime(t)}else{r++}}if(r>0){i=this._animatebles.length;for(;a=0){this._animatebles[e]=null;t.clock=null}};t.prototype.clear=function(){for(var t=0,e=this._animatebles;t0&&a._subFadeState>0){this._armature._dragonBones.bufferObject(a);this._animationStates.length=0;this._lastAnimationState=null}else{var r=a._animationData;var i=r.cacheFrameRate;if(this._animationDirty&&i>0){this._animationDirty=false;for(var n=0,s=this._armature.getBones();n0){var _=u[0];if(_!==null){if(_.parent===this._armature.armatureData.defaultSkin){f._cachedFrameIndices=r.getSlotCachedFrameIndices(f.name);continue}}}f._cachedFrameIndices=null}}a.advanceTime(t,i)}}else if(e>1){for(var c=0,p=0;c0&&a._subFadeState>0){p++;this._armature._dragonBones.bufferObject(a);this._animationDirty=true;if(this._lastAnimationState===a){this._lastAnimationState=null}}else{if(p>0){this._animationStates[c-p]=a}a.advanceTime(t,0)}if(c===e-1&&p>0){this._animationStates.length-=p;if(this._lastAnimationState===null&&this._animationStates.length>0){this._lastAnimationState=this._animationStates[this._animationStates.length-1]}}}this._armature._cacheFrameIndex=-1}else{this._armature._cacheFrameIndex=-1}};a.prototype.reset=function(){for(var t=0,e=this._animationStates;t1){if(e.position<0){e.position%=r.duration;e.position=r.duration-e.position}else if(e.position===r.duration){e.position-=1e-6}else if(e.position>r.duration){e.position%=r.duration}if(e.duration>0&&e.position+e.duration>r.duration){e.duration=r.duration-e.position}if(e.playTimes<0){e.playTimes=r.playTimes}}else{e.playTimes=1;e.position=0;if(e.duration>0){e.duration=0}}if(e.duration===0){e.duration=-1}this._fadeOut(e);var o=t.BaseObject.borrowObject(t.AnimationState);o.init(this._armature,r,e);this._animationDirty=true;this._armature._cacheFrameIndex=-1;if(this._animationStates.length>0){var l=false;for(var h=0,f=this._animationStates.length;hthis._animationStates[h].layer){l=true;this._animationStates.splice(h,0,o);break}else if(h!==f-1&&o.layer>this._animationStates[h+1].layer){l=true;this._animationStates.splice(h+1,0,o);break}}if(!l){this._animationStates.push(o)}}else{this._animationStates.push(o)}for(var u=0,_=this._armature.getSlots();u<_.length;u++){var c=_[u];var p=c.childArmature;if(p!==null&&p.inheritAnimation&&p.animation.hasAnimation(a)&&p.animation.getState(a)===null){p.animation.fadeIn(a)}}var m=false;for(var d in r.animationTimelines){if(!this._lockUpdate){m=true;this._lockUpdate=true}var v=this.fadeIn(d,e.fadeInTime,1,o.layer,null,0);if(v!==null){v.resetToPose=false;v._parent=o;v.stop()}}if(m){this._lockUpdate=false}if(!this._lockUpdate){if(e.fadeInTime<=0){this._armature.advanceTime(0)}this._lastAnimationState=o}return o};a.prototype.play=function(t,e){if(t===void 0){t=null}if(e===void 0){e=-1}this._animationConfig.clear();this._animationConfig.resetToPose=true;this._animationConfig.playTimes=e;this._animationConfig.fadeInTime=0;this._animationConfig.animation=t!==null?t:"";if(t!==null&&t.length>0){this.playConfig(this._animationConfig)}else if(this._lastAnimationState===null){var a=this._armature.armatureData.defaultAnimation;if(a!==null){this._animationConfig.animation=a.name;this.playConfig(this._animationConfig)}}else if(!this._lastAnimationState.isPlaying&&!this._lastAnimationState.isCompleted){this._lastAnimationState.play()}else{this._animationConfig.animation=this._lastAnimationState.name;this.playConfig(this._animationConfig)}return this._lastAnimationState};a.prototype.fadeIn=function(t,e,a,r,i,n){if(e===void 0){e=-1}if(a===void 0){a=-1}if(r===void 0){r=0}if(i===void 0){i=null}if(n===void 0){n=3}this._animationConfig.clear();this._animationConfig.fadeOutMode=n;this._animationConfig.playTimes=a;this._animationConfig.layer=r;this._animationConfig.fadeInTime=e;this._animationConfig.animation=t;this._animationConfig.group=i!==null?i:"";return this.playConfig(this._animationConfig)};a.prototype.gotoAndPlayByTime=function(t,e,a){if(e===void 0){e=0}if(a===void 0){a=-1}this._animationConfig.clear();this._animationConfig.resetToPose=true;this._animationConfig.playTimes=a;this._animationConfig.position=e;this._animationConfig.fadeInTime=0;this._animationConfig.animation=t;return this.playConfig(this._animationConfig)};a.prototype.gotoAndPlayByFrame=function(t,e,a){if(e===void 0){e=0}if(a===void 0){a=-1}this._animationConfig.clear();this._animationConfig.resetToPose=true;this._animationConfig.playTimes=a;this._animationConfig.fadeInTime=0;this._animationConfig.animation=t;var r=t in this._animations?this._animations[t]:null;if(r!==null){this._animationConfig.position=r.duration*e/r.frameCount}return this.playConfig(this._animationConfig)};a.prototype.gotoAndPlayByProgress=function(t,e,a){if(e===void 0){e=0}if(a===void 0){a=-1}this._animationConfig.clear();this._animationConfig.resetToPose=true;this._animationConfig.playTimes=a;this._animationConfig.fadeInTime=0;this._animationConfig.animation=t;var r=t in this._animations?this._animations[t]:null;if(r!==null){this._animationConfig.position=r.duration*(e>0?e:0)}return this.playConfig(this._animationConfig)};a.prototype.gotoAndStopByTime=function(t,e){if(e===void 0){e=0}var a=this.gotoAndPlayByTime(t,e,1);if(a!==null){a.stop()}return a};a.prototype.gotoAndStopByFrame=function(t,e){if(e===void 0){e=0}var a=this.gotoAndPlayByFrame(t,e,1);if(a!==null){a.stop()}return a};a.prototype.gotoAndStopByProgress=function(t,e){if(e===void 0){e=0}var a=this.gotoAndPlayByProgress(t,e,1);if(a!==null){a.stop()}return a};a.prototype.getState=function(t){var e=this._animationStates.length;while(e--){var a=this._animationStates[e];if(a.name===t){return a}}return null};a.prototype.hasAnimation=function(t){return t in this._animations};a.prototype.getStates=function(){return this._animationStates};Object.defineProperty(a.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t0},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"lastAnimationName",{get:function(){return this._lastAnimationState!==null?this._lastAnimationState.name:""},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"animations",{get:function(){return this._animations},set:function(t){if(this._animations===t){return}this._animationNames.length=0;for(var e in this._animations){delete this._animations[e]}for(var e in t){this._animationNames.push(e);this._animations[e]=t[e]}},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"animationConfig",{get:function(){this._animationConfig.clear();return this._animationConfig},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"lastAnimationState",{get:function(){return this._lastAnimationState},enumerable:true,configurable:true});a.prototype.gotoAndPlay=function(t,e,a,r,i,n,s,o,l){if(e===void 0){e=-1}if(a===void 0){a=-1}if(r===void 0){r=-1}if(i===void 0){i=0}if(n===void 0){n=null}if(s===void 0){s=3}if(o===void 0){o=true}if(l===void 0){l=true}console.warn("Deprecated.");o;l;this._animationConfig.clear();this._animationConfig.resetToPose=true;this._animationConfig.fadeOutMode=s;this._animationConfig.playTimes=r;this._animationConfig.layer=i;this._animationConfig.fadeInTime=e;this._animationConfig.animation=t;this._animationConfig.group=n!==null?n:"";var h=this._animations[t];if(h&&a>0){this._animationConfig.timeScale=h.duration/a}return this.playConfig(this._animationConfig)};a.prototype.gotoAndStop=function(t,e){if(e===void 0){e=0}console.warn("Deprecated.");return this.gotoAndStopByTime(t,e)};Object.defineProperty(a.prototype,"animationList",{get:function(){console.warn("Deprecated.");return this._animationNames},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"animationDataList",{get:function(){console.warn("Deprecated.");var t=[];for(var e=0,a=this._animationNames.length;e0;if(this._subFadeState<0){this._subFadeState=0;var r=a?t.EventObject.FADE_OUT:t.EventObject.FADE_IN;if(this._armature.eventDispatcher.hasDBEventListener(r)){var i=t.BaseObject.borrowObject(t.EventObject);i.type=r;i.armature=this._armature;i.animationState=this;this._armature._dragonBones.bufferEvent(i)}}if(e<0){e=-e}this._fadeTime+=e;if(this._fadeTime>=this.fadeTotalTime){this._subFadeState=1;this._fadeProgress=a?0:1}else if(this._fadeTime>0){this._fadeProgress=a?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime}else{this._fadeProgress=a?1:0}if(this._subFadeState>0){if(!a){this._playheadState|=1;this._fadeState=0}var r=a?t.EventObject.FADE_OUT_COMPLETE:t.EventObject.FADE_IN_COMPLETE;if(this._armature.eventDispatcher.hasDBEventListener(r)){var i=t.BaseObject.borrowObject(t.EventObject);i.type=r;i.armature=this._armature;i.animationState=this;this._armature._dragonBones.bufferEvent(i)}}};i.prototype.init=function(e,a,r){if(this._armature!==null){return}this._armature=e;this._animationData=a;this.resetToPose=r.resetToPose;this.additiveBlending=r.additiveBlending;this.displayControl=r.displayControl;this.actionEnabled=r.actionEnabled;this.layer=r.layer;this.playTimes=r.playTimes;this.timeScale=r.timeScale;this.fadeTotalTime=r.fadeInTime;this.autoFadeOutTime=r.autoFadeOutTime;this.weight=r.weight;this.name=r.name.length>0?r.name:r.animation;this.group=r.group;if(r.pauseFadeIn){this._playheadState=2}else{this._playheadState=3}if(r.duration<0){this._position=0;this._duration=this._animationData.duration;if(r.position!==0){if(this.timeScale>=0){this._time=r.position}else{this._time=r.position-this._duration}}else{this._time=0}}else{this._position=r.position;this._duration=r.duration;this._time=0}if(this.timeScale<0&&this._time===0){this._time=-1e-6}if(this.fadeTotalTime<=0){this._fadeProgress=.999999}if(r.boneMask.length>0){this._boneMask.length=r.boneMask.length;for(var i=0,n=this._boneMask.length;i0;var i=true;var n=true;var s=this._time;this._weightResult=this.weight*this._fadeProgress;if(this._parent!==null){this._weightResult*=this._parent._weightResult/this._parent._fadeProgress}if(this._actionTimeline.playState<=0){this._actionTimeline.update(s)}if(r){var o=a*2;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*o)/o}if(this._zOrderTimeline!==null&&this._zOrderTimeline.playState<=0){this._zOrderTimeline.update(s)}if(r){var l=Math.floor(this._actionTimeline.currentTime*a);if(this._armature._cacheFrameIndex===l){i=false;n=false}else{this._armature._cacheFrameIndex=l;if(this._animationData.cachedFrames[l]){n=false}else{this._animationData.cachedFrames[l]=true}}}if(i){if(n){for(var h=0,f=this._boneTimelines.length;h0){this._subFadeState=0;if(this._poseTimelines.length>0){for(var p=0,m=this._poseTimelines;p0){if(this.autoFadeOutTime>=0){this.fadeOut(this.autoFadeOutTime)}}}};i.prototype.play=function(){this._playheadState=3};i.prototype.stop=function(){this._playheadState&=1};i.prototype.fadeOut=function(t,e){if(e===void 0){e=true}if(t<0){t=0}if(e){this._playheadState&=2}if(this._fadeState>0){if(t>this.fadeTotalTime-this._fadeTime){return}}else{this._fadeState=1;this._subFadeState=-1;if(t<=0||this._fadeProgress<=0){this._fadeProgress=1e-6}for(var a=0,r=this._boneTimelines;a1e-6?t/this._fadeProgress:0;this._fadeTime=this.fadeTotalTime*(1-this._fadeProgress)};i.prototype.containsBoneMask=function(t){return this._boneMask.length===0||this._boneMask.indexOf(t)>=0};i.prototype.addBoneMask=function(t,e){if(e===void 0){e=true}var a=this._armature.getBone(t);if(a===null){return}if(this._boneMask.indexOf(t)<0){this._boneMask.push(t)}if(e){for(var r=0,i=this._armature.getBones();r=0){this._boneMask.splice(a,1)}if(e){var r=this._armature.getBone(t);if(r!==null){var i=this._armature.getBones();if(this._boneMask.length>0){for(var n=0,s=i;n=0&&r.contains(o)){this._boneMask.splice(l,1)}}}else{for(var h=0,f=i;h0},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"isFadeComplete",{get:function(){return this._fadeState===0},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"isPlaying",{get:function(){return(this._playheadState&2)!==0&&this._actionTimeline.playState<=0},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"isCompleted",{get:function(){return this._actionTimeline.playState>0},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"currentPlayTimes",{get:function(){return this._actionTimeline.currentPlayTimes},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"totalTime",{get:function(){return this._duration},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"currentTime",{get:function(){return this._actionTimeline.currentTime},set:function(t){var e=this._actionTimeline.currentPlayTimes-(this._actionTimeline.playState>0?1:0);if(t<0||this._duration0&&e===this.playTimes-1&&t===this._duration){t=this._duration-1e-6}if(this._time===t){return}this._time=t;this._actionTimeline.setCurrentTime(this._time);if(this._zOrderTimeline!==null){this._zOrderTimeline.playState=-1}for(var a=0,r=this._boneTimelines;a0){if(this.layer!==e){if(this.layerWeight>=this.leftWeight){this.leftWeight=0;return 0}else{this.layer=e;this.leftWeight-=this.layerWeight;this.layerWeight=0}}}else{return 0}t*=this.leftWeight;this.layerWeight+=t;this.blendWeight=t;return 2}this.dirty=true;this.layer=e;this.layerWeight=t;this.leftWeight=1;this.blendWeight=t;return 1};t.prototype.clear=function(){this.dirty=false;this.layer=0;this.leftWeight=0;this.layerWeight=0;this.blendWeight=0};return t}();t.BlendState=r})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._onClear=function(){this.playState=-1;this.currentPlayTimes=-1;this.currentTime=-1;this._tweenState=0;this._frameRate=0;this._frameValueOffset=0;this._frameCount=0;this._frameOffset=0;this._frameIndex=-1;this._frameRateR=0;this._position=0;this._duration=0;this._timeScale=1;this._timeOffset=0;this._dragonBonesData=null;this._animationData=null;this._timelineData=null;this._armature=null;this._animationState=null;this._actionTimeline=null;this._frameArray=null;this._frameIntArray=null;this._frameFloatArray=null;this._timelineArray=null;this._frameIndices=null};e.prototype._setCurrentTime=function(t){var e=this.playState;var a=this.currentPlayTimes;var r=this.currentTime;if(this._actionTimeline!==null&&this._frameCount<=1){this.playState=this._actionTimeline.playState>=0?1:-1;this.currentPlayTimes=1;this.currentTime=this._actionTimeline.currentTime}else if(this._actionTimeline===null||this._timeScale!==1||this._timeOffset!==0){var i=this._animationState.playTimes;var n=i*this._duration;t*=this._timeScale;if(this._timeOffset!==0){t+=this._timeOffset*this._animationData.duration}if(i>0&&(t>=n||t<=-n)){if(this.playState<=0&&this._animationState._playheadState===3){this.playState=1}this.currentPlayTimes=i;if(t<0){this.currentTime=0}else{this.currentTime=this._duration+1e-6}}else{if(this.playState!==0&&this._animationState._playheadState===3){this.playState=0}if(t<0){t=-t;this.currentPlayTimes=Math.floor(t/this._duration);this.currentTime=this._duration-t%this._duration}else{this.currentPlayTimes=Math.floor(t/this._duration);this.currentTime=t%this._duration}}this.currentTime+=this._position}else{this.playState=this._actionTimeline.playState;this.currentPlayTimes=this._actionTimeline.currentPlayTimes;this.currentTime=this._actionTimeline.currentTime}if(this.currentPlayTimes===a&&this.currentTime===r){return false}if(e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==a){this._frameIndex=-1}return true};e.prototype.init=function(t,e,a){this._armature=t;this._animationState=e;this._timelineData=a;this._actionTimeline=this._animationState._actionTimeline;if(this===this._actionTimeline){this._actionTimeline=null}this._animationData=this._animationState._animationData;this._frameRate=this._animationData.parent.frameRate;this._frameRateR=1/this._frameRate;this._position=this._animationState._position;this._duration=this._animationState._duration;this._dragonBonesData=this._animationData.parent.parent;if(this._timelineData!==null){this._frameIntArray=this._dragonBonesData.frameIntArray;this._frameFloatArray=this._dragonBonesData.frameFloatArray;this._frameArray=this._dragonBonesData.frameArray;this._timelineArray=this._dragonBonesData.timelineArray;this._frameIndices=this._dragonBonesData.frameIndices;this._frameCount=this._timelineArray[this._timelineData.offset+2];this._frameValueOffset=this._timelineArray[this._timelineData.offset+4];this._timeScale=100/this._timelineArray[this._timelineData.offset+0];this._timeOffset=this._timelineArray[this._timelineData.offset+1]*.01}};e.prototype.fadeOut=function(){};e.prototype.update=function(t){if(this._setCurrentTime(t)){if(this._frameCount>1){var e=Math.floor(this.currentTime*this._frameRate);var a=this._frameIndices[this._timelineData.frameIndicesOffset+e];if(this._frameIndex!==a){this._frameIndex=a;this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex];this._onArriveAtFrame()}}else if(this._frameIndex<0){this._frameIndex=0;if(this._timelineData!==null){this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5]}this._onArriveAtFrame()}if(this._tweenState!==0){this._onUpdateFrame()}}};return e}(t.BaseObject);t.TimelineState=e;var a=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e._getEasingValue=function(t,e,a){var r=e;switch(t){case 3:r=Math.pow(e,2);break;case 4:r=1-Math.pow(1-e,2);break;case 5:r=.5*(1-Math.cos(e*Math.PI));break}return(r-e)*a+e};e._getEasingCurveValue=function(t,e,a,r){if(t<=0){return 0}else if(t>=1){return 1}var i=a+1;var n=Math.floor(t*i);var s=n===0?0:e[r+n-1];var o=n===i-1?1e4:e[r+n];return(s+(o-s)*(t*i-n))*1e-4};e.prototype._onClear=function(){t.prototype._onClear.call(this);this._tweenType=0;this._curveCount=0;this._framePosition=0;this._frameDurationR=0;this._tweenProgress=0;this._tweenEasing=0};e.prototype._onArriveAtFrame=function(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||this._animationState.playTimes===0||this._animationState.currentPlayTimes0){this._frameDurationR=1/e}else{this._frameDurationR=0}}}else{this._tweenState=1}};e.prototype._onUpdateFrame=function(){if(this._tweenState===2){this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR;if(this._tweenType===2){this._tweenProgress=e._getEasingCurveValue(this._tweenProgress,this._frameArray,this._curveCount,this._frameOffset+3)}else if(this._tweenType!==1){this._tweenProgress=e._getEasingValue(this._tweenType,this._tweenProgress,this._tweenEasing)}}else{this._tweenProgress=0}};return e}(e);t.TweenTimelineState=a;var r=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._onClear=function(){t.prototype._onClear.call(this);this.bone=null;this.bonePose=null};e.prototype.blend=function(t){var e=this.bone._blendState.blendWeight;var a=this.bone.animationPose;var r=this.bonePose.result;if(t===2){a.x+=r.x*e;a.y+=r.y*e;a.rotation+=r.rotation*e;a.skew+=r.skew*e;a.scaleX+=(r.scaleX-1)*e;a.scaleY+=(r.scaleY-1)*e}else if(e!==1){a.x=r.x*e;a.y=r.y*e;a.rotation=r.rotation*e;a.skew=r.skew*e;a.scaleX=(r.scaleX-1)*e+1;a.scaleY=(r.scaleY-1)*e+1}else{a.x=r.x;a.y=r.y;a.rotation=r.rotation;a.skew=r.skew;a.scaleX=r.scaleX;a.scaleY=r.scaleY}if(this._animationState._fadeState!==0||this._animationState._subFadeState!==0){this.bone._transformDirty=true}};return e}(a);t.BoneTimelineState=r;var i=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._onClear=function(){t.prototype._onClear.call(this);this.slot=null};return e}(a);t.SlotTimelineState=i;var n=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._onClear=function(){t.prototype._onClear.call(this);this.constraint=null};return e}(a);t.ConstraintTimelineState=n})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(e){__extends(a,e);function a(){return e!==null&&e.apply(this,arguments)||this}a.toString=function(){return"[class dragonBones.ActionTimelineState]"};a.prototype._onCrossFrame=function(e){var a=this._armature.eventDispatcher;if(this._animationState.actionEnabled){var r=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+e];var i=this._frameArray[r+1];var n=this._animationData.parent.actions;for(var s=0;s0){if(n.hasDBEventListener(t.EventObject.COMPLETE)){h=t.BaseObject.borrowObject(t.EventObject);h.type=t.EventObject.COMPLETE;h.armature=this._armature;h.animationState=this._animationState}}}if(this._frameCount>1){var f=this._timelineData;var u=Math.floor(this.currentTime*this._frameRate);var _=this._frameIndices[f.frameIndicesOffset+u];if(this._frameIndex!==_){var c=this._frameIndex;this._frameIndex=_;if(this._timelineArray!==null){this._frameOffset=this._animationData.frameOffset+this._timelineArray[f.offset+5+this._frameIndex];if(o){if(c<0){var p=Math.floor(i*this._frameRate);c=this._frameIndices[f.frameIndicesOffset+p];if(this.currentPlayTimes===r){if(c===_){c=-1}}}while(c>=0){var m=this._animationData.frameOffset+this._timelineArray[f.offset+5+c];var d=this._frameArray[m]/this._frameRate;if(this._position<=d&&d<=this._position+this._duration){this._onCrossFrame(c)}if(l!==null&&c===0){this._armature._dragonBones.bufferEvent(l);l=null}if(c>0){c--}else{c=this._frameCount-1}if(c===_){break}}}else{if(c<0){var p=Math.floor(i*this._frameRate);c=this._frameIndices[f.frameIndicesOffset+p];var m=this._animationData.frameOffset+this._timelineArray[f.offset+5+c];var d=this._frameArray[m]/this._frameRate;if(this.currentPlayTimes===r){if(i<=d){if(c>0){c--}else{c=this._frameCount-1}}else if(c===_){c=-1}}}while(c>=0){if(c=0){var t=this._frameArray[this._frameOffset+1];if(t>0){this._armature._sortZOrder(this._frameArray,this._frameOffset+2)}else{this._armature._sortZOrder(null,0)}}};e.prototype._onUpdateFrame=function(){};return e}(t.TimelineState);t.ZOrderTimelineState=a;var r=function(e){__extends(a,e);function a(){return e!==null&&e.apply(this,arguments)||this}a.toString=function(){return"[class dragonBones.BoneAllTimelineState]"};a.prototype._onArriveAtFrame=function(){e.prototype._onArriveAtFrame.call(this);if(this._timelineData!==null){var t=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*6;var a=this._armature._armatureData.scale;var r=this._frameFloatArray;var i=this.bonePose.current;var n=this.bonePose.delta;i.x=r[t++]*a;i.y=r[t++]*a;i.rotation=r[t++];i.skew=r[t++];i.scaleX=r[t++];i.scaleY=r[t++];if(this._tweenState===2){if(this._frameIndex===this._frameCount-1){t=this._animationData.frameFloatOffset+this._frameValueOffset}n.x=r[t++]*a-i.x;n.y=r[t++]*a-i.y;n.rotation=r[t++]-i.rotation;n.skew=r[t++]-i.skew;n.scaleX=r[t++]-i.scaleX;n.scaleY=r[t++]-i.scaleY}else{n.x=0;n.y=0;n.rotation=0;n.skew=0;n.scaleX=0;n.scaleY=0}}else{var i=this.bonePose.current;var n=this.bonePose.delta;i.x=0;i.y=0;i.rotation=0;i.skew=0;i.scaleX=1;i.scaleY=1;n.x=0;n.y=0;n.rotation=0;n.skew=0;n.scaleX=0;n.scaleY=0}};a.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current;var a=this.bonePose.delta;var r=this.bonePose.result;this.bone._transformDirty=true;if(this._tweenState!==2){this._tweenState=0}r.x=t.x+a.x*this._tweenProgress;r.y=t.y+a.y*this._tweenProgress;r.rotation=t.rotation+a.rotation*this._tweenProgress;r.skew=t.skew+a.skew*this._tweenProgress;r.scaleX=t.scaleX+a.scaleX*this._tweenProgress;r.scaleY=t.scaleY+a.scaleY*this._tweenProgress};a.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation);e.skew=t.Transform.normalizeRadian(e.skew)};return a}(t.BoneTimelineState);t.BoneAllTimelineState=r;var i=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.toString=function(){return"[class dragonBones.BoneTranslateTimelineState]"};e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);if(this._timelineData!==null){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*2;var a=this._armature._armatureData.scale;var r=this._frameFloatArray;var i=this.bonePose.current;var n=this.bonePose.delta;i.x=r[e++]*a;i.y=r[e++]*a;if(this._tweenState===2){if(this._frameIndex===this._frameCount-1){e=this._animationData.frameFloatOffset+this._frameValueOffset}n.x=r[e++]*a-i.x;n.y=r[e++]*a-i.y}else{n.x=0;n.y=0}}else{var i=this.bonePose.current;var n=this.bonePose.delta;i.x=0;i.y=0;n.x=0;n.y=0}};e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current;var a=this.bonePose.delta;var r=this.bonePose.result;this.bone._transformDirty=true;if(this._tweenState!==2){this._tweenState=0}r.x=e.x+a.x*this._tweenProgress;r.y=e.y+a.y*this._tweenProgress};return e}(t.BoneTimelineState);t.BoneTranslateTimelineState=i;var n=function(e){__extends(a,e);function a(){return e!==null&&e.apply(this,arguments)||this}a.toString=function(){return"[class dragonBones.BoneRotateTimelineState]"};a.prototype._onArriveAtFrame=function(){e.prototype._onArriveAtFrame.call(this);if(this._timelineData!==null){var a=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*2;var r=this._frameFloatArray;var i=this.bonePose.current;var n=this.bonePose.delta;i.rotation=r[a++];i.skew=r[a++];if(this._tweenState===2){if(this._frameIndex===this._frameCount-1){a=this._animationData.frameFloatOffset+this._frameValueOffset;n.rotation=t.Transform.normalizeRadian(r[a++]-i.rotation)}else{n.rotation=r[a++]-i.rotation}n.skew=r[a++]-i.skew}else{n.rotation=0;n.skew=0}}else{var i=this.bonePose.current;var n=this.bonePose.delta;i.rotation=0;i.skew=0;n.rotation=0;n.skew=0}};a.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current;var a=this.bonePose.delta;var r=this.bonePose.result;this.bone._transformDirty=true;if(this._tweenState!==2){this._tweenState=0}r.rotation=t.rotation+a.rotation*this._tweenProgress;r.skew=t.skew+a.skew*this._tweenProgress};a.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation);e.skew=t.Transform.normalizeRadian(e.skew)};return a}(t.BoneTimelineState);t.BoneRotateTimelineState=n;var s=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.toString=function(){return"[class dragonBones.BoneScaleTimelineState]"};e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);if(this._timelineData!==null){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*2;var a=this._frameFloatArray;var r=this.bonePose.current;var i=this.bonePose.delta;r.scaleX=a[e++];r.scaleY=a[e++];if(this._tweenState===2){if(this._frameIndex===this._frameCount-1){e=this._animationData.frameFloatOffset+this._frameValueOffset}i.scaleX=a[e++]-r.scaleX;i.scaleY=a[e++]-r.scaleY}else{i.scaleX=0;i.scaleY=0}}else{var r=this.bonePose.current;var i=this.bonePose.delta;r.scaleX=1;r.scaleY=1;i.scaleX=0;i.scaleY=0}};e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current;var a=this.bonePose.delta;var r=this.bonePose.result;this.bone._transformDirty=true;if(this._tweenState!==2){this._tweenState=0}r.scaleX=e.scaleX+a.scaleX*this._tweenProgress;r.scaleY=e.scaleY+a.scaleY*this._tweenProgress};return e}(t.BoneTimelineState);t.BoneScaleTimelineState=s;var o=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e._current=[];e._delta=[];e._result=[];return e}e.toString=function(){return"[class dragonBones.SurfaceTimelineState]"};e.prototype._onClear=function(){t.prototype._onClear.call(this);this.surface=null;this._frameFloatOffset=0;this._valueCount=0;this._deformCount=0;this._valueOffset=0;this._current.length=0;this._delta.length=0;this._result.length=0};e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);if(this._timelineData!==null){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount;var a=this._armature._armatureData.scale;var r=this._frameFloatArray;if(this._tweenState===2){var i=e+this._valueCount;if(this._frameIndex===this._frameCount-1){i=this._animationData.frameFloatOffset+this._frameValueOffset}for(var n=0;n=0){var t=this._timelineData!==null?this._frameArray[this._frameOffset+1]:this.slot._slotData.displayIndex;if(this.slot.displayIndex!==t){this.slot._setDisplayIndex(t,true)}}};return e}(t.SlotTimelineState);t.SlotDislayTimelineState=l;var h=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e._current=[0,0,0,0,0,0,0,0];e._delta=[0,0,0,0,0,0,0,0];e._result=[0,0,0,0,0,0,0,0];return e}e.toString=function(){return"[class dragonBones.SlotColorTimelineState]"};e.prototype._onClear=function(){t.prototype._onClear.call(this);this._dirty=false};e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);if(this._timelineData!==null){var e=this._dragonBonesData.intArray;var a=this._frameIntArray;var r=this._animationData.frameIntOffset+this._frameValueOffset+this._frameIndex*1;var i=a[r];if(i<0){i+=65536}this._current[0]=e[i++];this._current[1]=e[i++];this._current[2]=e[i++];this._current[3]=e[i++];this._current[4]=e[i++];this._current[5]=e[i++];this._current[6]=e[i++];this._current[7]=e[i++];if(this._tweenState===2){if(this._frameIndex===this._frameCount-1){i=a[this._animationData.frameIntOffset+this._frameValueOffset]}else{i=a[r+1*1]}if(i<0){i+=65536}this._delta[0]=e[i++]-this._current[0];this._delta[1]=e[i++]-this._current[1];this._delta[2]=e[i++]-this._current[2];this._delta[3]=e[i++]-this._current[3];this._delta[4]=e[i++]-this._current[4];this._delta[5]=e[i++]-this._current[5];this._delta[6]=e[i++]-this._current[6];this._delta[7]=e[i++]-this._current[7]}}else{var n=this.slot._slotData.color;this._current[0]=n.alphaMultiplier*100;this._current[1]=n.redMultiplier*100;this._current[2]=n.greenMultiplier*100;this._current[3]=n.blueMultiplier*100;this._current[4]=n.alphaOffset;this._current[5]=n.redOffset;this._current[6]=n.greenOffset;this._current[7]=n.blueOffset}};e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);this._dirty=true;if(this._tweenState!==2){this._tweenState=0}this._result[0]=(this._current[0]+this._delta[0]*this._tweenProgress)*.01;this._result[1]=(this._current[1]+this._delta[1]*this._tweenProgress)*.01;this._result[2]=(this._current[2]+this._delta[2]*this._tweenProgress)*.01;this._result[3]=(this._current[3]+this._delta[3]*this._tweenProgress)*.01;this._result[4]=this._current[4]+this._delta[4]*this._tweenProgress;this._result[5]=this._current[5]+this._delta[5]*this._tweenProgress;this._result[6]=this._current[6]+this._delta[6]*this._tweenProgress;this._result[7]=this._current[7]+this._delta[7]*this._tweenProgress};e.prototype.fadeOut=function(){this._tweenState=0;this._dirty=false};e.prototype.update=function(e){t.prototype.update.call(this,e);if(this._tweenState!==0||this._dirty){var a=this.slot._colorTransform;if(this._animationState._fadeState!==0||this._animationState._subFadeState!==0){if(a.alphaMultiplier!==this._result[0]||a.redMultiplier!==this._result[1]||a.greenMultiplier!==this._result[2]||a.blueMultiplier!==this._result[3]||a.alphaOffset!==this._result[4]||a.redOffset!==this._result[5]||a.greenOffset!==this._result[6]||a.blueOffset!==this._result[7]){var r=Math.pow(this._animationState._fadeProgress,4);a.alphaMultiplier+=(this._result[0]-a.alphaMultiplier)*r;a.redMultiplier+=(this._result[1]-a.redMultiplier)*r;a.greenMultiplier+=(this._result[2]-a.greenMultiplier)*r;a.blueMultiplier+=(this._result[3]-a.blueMultiplier)*r;a.alphaOffset+=(this._result[4]-a.alphaOffset)*r;a.redOffset+=(this._result[5]-a.redOffset)*r;a.greenOffset+=(this._result[6]-a.greenOffset)*r;a.blueOffset+=(this._result[7]-a.blueOffset)*r;this.slot._colorDirty=true}}else if(this._dirty){this._dirty=false;if(a.alphaMultiplier!==this._result[0]||a.redMultiplier!==this._result[1]||a.greenMultiplier!==this._result[2]||a.blueMultiplier!==this._result[3]||a.alphaOffset!==this._result[4]||a.redOffset!==this._result[5]||a.greenOffset!==this._result[6]||a.blueOffset!==this._result[7]){a.alphaMultiplier=this._result[0];a.redMultiplier=this._result[1];a.greenMultiplier=this._result[2];a.blueMultiplier=this._result[3];a.alphaOffset=this._result[4];a.redOffset=this._result[5];a.greenOffset=this._result[6];a.blueOffset=this._result[7];this.slot._colorDirty=true}}}};return e}(t.SlotTimelineState);t.SlotColorTimelineState=h;var f=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e._current=[];e._delta=[];e._result=[];return e}e.toString=function(){return"[class dragonBones.DeformTimelineState]"};e.prototype._onClear=function(){t.prototype._onClear.call(this);this.vertexOffset=0;this._dirty=false;this._frameFloatOffset=0;this._valueCount=0;this._deformCount=0;this._valueOffset=0;this._current.length=0;this._delta.length=0;this._result.length=0};e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);if(this._timelineData!==null){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount;var a=this._armature._armatureData.scale;var r=this._frameFloatArray;if(this._tweenState===2){var i=e+this._valueCount;if(this._frameIndex===this._frameCount-1){i=this._animationData.frameFloatOffset+this._frameValueOffset}for(var n=0;n=0){this._floats[2]=this._floats[0]+this._floats[1]*this._tweenProgress}this._floats[5]=this._floats[3]+this._floats[4]*this._tweenProgress};e.prototype.blend=function(t){var e=this.animationState;var a=e._blendState.blendWeight;if(t===2){e.weight+=this._floats[5]*a;e.currentTime+=this._floats[2]*a}else{e.weight=this._floats[5]*a;e.currentTime=this._floats[2]*a}};return e}(t.TweenTimelineState);t.AnimationTimelineState=_})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.actionDataToInstance=function(t,a,r){if(t.type===0){a.type=e.FRAME_EVENT}else{a.type=t.type===10?e.FRAME_EVENT:e.SOUND_EVENT}a.name=t.name;a.armature=r;a.actionData=t;a.data=t.data;if(t.bone!==null){a.bone=r.getBone(t.bone.name)}if(t.slot!==null){a.slot=r.getSlot(t.slot.name)}};e.toString=function(){return"[class dragonBones.EventObject]"};e.prototype._onClear=function(){this.time=0;this.type="";this.name="";this.armature=null;this.bone=null;this.slot=null;this.animationState=null;this.actionData=null;this.data=null};e.START="start";e.LOOP_COMPLETE="loopComplete";e.COMPLETE="complete";e.FADE_IN="fadeIn";e.FADE_IN_COMPLETE="fadeInComplete";e.FADE_OUT="fadeOut";e.FADE_OUT_COMPLETE="fadeOutComplete";e.FRAME_EVENT="frameEvent";e.SOUND_EVENT="soundEvent";return e}(t.BaseObject);t.EventObject=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(){function e(){}e._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":return 0;case"movieclip":return 1;default:return 0}};e._getBoneType=function(t){switch(t.toLowerCase()){case"bone":return 0;case"surface":return 1;default:return 0}};e._getDisplayType=function(t){switch(t.toLowerCase()){case"image":return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4;default:return 0}};e._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":return 0;case"ellipse":return 1;case"polygon":return 2;default:return 0}};e._getActionType=function(t){switch(t.toLowerCase()){case"play":return 0;case"frame":return 10;case"sound":return 11;default:return 0}};e._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"overlay":return 11;case"screen":return 12;case"subtract":return 13;default:return 0}};e._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":return 1;case"fixed":return 0;default:return 1}};e._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":return 0;case"percent":return 2;case"fixed":return 1;default:return 0}};e._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":return 0;case"chain":return 1;case"chainscale":return 2;default:return 0}};e.parseDragonBonesData=function(e){console.warn("Deprecated.");if(e instanceof ArrayBuffer){return t.BinaryDataParser.getInstance().parseDragonBonesData(e)}else{return t.ObjectDataParser.getInstance().parseDragonBonesData(e)}};e.parseTextureAtlasData=function(a,r){if(r===void 0){r=1}console.warn("已废弃");var i={};var n=a[e.SUB_TEXTURE];for(var s=0,o=n.length;s255){return encodeURI(i)}}}return i}return String(i)}return r};r.prototype._getCurvePoint=function(t,e,a,r,i,n,s,o,l,h){var f=1-l;var u=f*f;var _=l*l;var c=f*u;var p=3*l*u;var m=3*f*_;var d=l*_;h.x=c*t+p*a+m*i+d*s;h.y=c*e+p*r+m*n+d*o};r.prototype._samplingEasingCurve=function(t,e){var a=t.length;var r=-2;for(var i=0,n=e.length;i=0&&r+61e-4){var y=(v+d)*.5;this._getCurvePoint(l,h,f,u,_,c,p,m,y,this._helpPoint);if(s-this._helpPoint.x>0){d=y}else{v=y}}e[i]=this._helpPoint.y}};r.prototype._parseActionDataInFrame=function(e,a,r,i){if(t.DataParser.EVENT in e){this._mergeActionFrame(e[t.DataParser.EVENT],a,10,r,i)}if(t.DataParser.SOUND in e){this._mergeActionFrame(e[t.DataParser.SOUND],a,11,r,i)}if(t.DataParser.ACTION in e){this._mergeActionFrame(e[t.DataParser.ACTION],a,0,r,i)}if(t.DataParser.EVENTS in e){this._mergeActionFrame(e[t.DataParser.EVENTS],a,10,r,i)}if(t.DataParser.ACTIONS in e){this._mergeActionFrame(e[t.DataParser.ACTIONS],a,0,r,i)}};r.prototype._mergeActionFrame=function(e,r,i,n,s){var o=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length;var l=this._parseActionData(e,i,n,s);var h=0;var f=null;for(var u=0,_=l;u<_.length;u++){var c=_[u];this._armature.addAction(c,false)}if(this._actionFrames.length===0){f=new a;f.frameStart=0;this._actionFrames.push(f);f=null}for(var p=0,m=this._actionFrames;pr){break}h++}if(f===null){f=new a;f.frameStart=r;this._actionFrames.splice(h+1,0,f)}for(var v=0;v0){var p=i.getBone(_);if(p!==null){c.parent=p}else{if(!(_ in this._cacheBones)){this._cacheBones[_]=[]}this._cacheBones[_].push(c)}}if(c.name in this._cacheBones){for(var m=0,d=this._cacheBones[c.name];m0&&a.parent!==null){n.root=a.parent;n.bone=a}else{n.root=a;n.bone=null}return n};r.prototype._parsePathConstraint=function(e){var a=this._armature.getSlot(r._getString(e,t.DataParser.TARGET,""));if(a===null){return null}var i=this._armature.defaultSkin;if(i===null){return null}var n=i.getDisplay(a.name,r._getString(e,t.DataParser.TARGET_DISPLAY,a.name));if(n===null||!(n instanceof t.PathDisplayData)){return null}var s=e[t.DataParser.BONES];if(s===null||s.length===0){return null}var o=t.BaseObject.borrowObject(t.PathConstraintData);o.name=r._getString(e,t.DataParser.NAME,"");o.type=1;o.pathSlot=a;o.pathDisplayData=n;o.target=a.parent;o.positionMode=t.DataParser._getPositionMode(r._getString(e,t.DataParser.POSITION_MODE,""));o.spacingMode=t.DataParser._getSpacingMode(r._getString(e,t.DataParser.SPACING_MODE,""));o.rotateMode=t.DataParser._getRotateMode(r._getString(e,t.DataParser.ROTATE_MODE,""));o.position=r._getNumber(e,t.DataParser.POSITION,0);o.spacing=r._getNumber(e,t.DataParser.SPACING,0);o.rotateOffset=r._getNumber(e,t.DataParser.ROTATE_OFFSET,0);o.rotateMix=r._getNumber(e,t.DataParser.ROTATE_MIX,1);o.translateMix=r._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var l=0,h=s;l0?i:a;this._parsePivot(e,o);break;case 1:var l=s=t.BaseObject.borrowObject(t.ArmatureDisplayData);l.name=a;l.path=i.length>0?i:a;l.inheritAnimation=true;if(t.DataParser.ACTIONS in e){var h=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);for(var f=0,u=h;f0?i:a;d.vertices.data=this._data;if(t.DataParser.SHARE in e){this._cacheRawMeshes.push(e);this._cacheMeshes.push(d)}else{this._parseMesh(e,d)}if(t.DataParser.GLUE_WEIGHTS in e&&t.DataParser.GLUE_MESHES in e){this._cacheRawMeshes.push(e);this._cacheMeshes.push(d)}break;case 3:var v=this._parseBoundingBox(e);if(v!==null){var y=s=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);y.name=a;y.path=i.length>0?i:a;y.boundingBox=v}break;case 4:var g=e[t.DataParser.LENGTHS];var b=s=t.BaseObject.borrowObject(t.PathDisplayData);b.closed=r._getBoolean(e,t.DataParser.CLOSED,false);b.constantSpeed=r._getBoolean(e,t.DataParser.CONSTANT_SPEED,false);b.name=a;b.path=i.length>0?i:a;b.vertices.data=this._data;b.curveLengths.length=g.length;for(var D=0,T=g.length;Da.width){a.width=l}if(ha.height){a.height=h}}}a.width-=a.x;a.height-=a.y}else{console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.")}return a};r.prototype._parseAnimation=function(e){var a=t.BaseObject.borrowObject(t.AnimationData);a.frameCount=Math.max(r._getNumber(e,t.DataParser.DURATION,1),1);a.playTimes=r._getNumber(e,t.DataParser.PLAY_TIMES,1);a.duration=a.frameCount/this._armature.frameRate;a.fadeInTime=r._getNumber(e,t.DataParser.FADE_IN_TIME,0);a.scale=r._getNumber(e,t.DataParser.SCALE,1);a.name=r._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME);if(a.name.length===0){a.name=t.DataParser.DEFAULT_NAME}a.frameIntOffset=this._frameIntArray.length;a.frameFloatOffset=this._frameFloatArray.length;a.frameOffset=this._frameArray.length;this._animation=a;if(t.DataParser.FRAME in e){var i=e[t.DataParser.FRAME];var n=i.length;if(n>0){for(var s=0,o=0;s0){this._animation.actionTimeline=this._parseTimeline(null,this._actionFrames,"",0,false,false,0,this._parseActionFrame);this._actionFrames.length=0}this._animation=null;return a};r.prototype._parseTimeline=function(e,i,n,s,o,l,h,f){if(e!==null&&n.length>0&&n in e){i=e[n]}if(i===null){return null}var u=i.length;if(u===0){return null}var _=this._frameIntArray.length;var c=this._frameFloatArray.length;var p=t.BaseObject.borrowObject(t.TimelineData);var m=this._timelineArray.length;this._timelineArray.length+=1+1+1+1+1+u;if(e!==null){this._timelineArray[m+0]=Math.round(r._getNumber(e,t.DataParser.SCALE,1)*100);this._timelineArray[m+1]=Math.round(r._getNumber(e,t.DataParser.OFFSET,0)*100)}else{this._timelineArray[m+0]=100;this._timelineArray[m+1]=0}this._timelineArray[m+2]=u;this._timelineArray[m+3]=h;if(o){this._timelineArray[m+4]=_-this._animation.frameIntOffset}else if(l){this._timelineArray[m+4]=c-this._animation.frameFloatOffset}else{this._timelineArray[m+4]=0}this._timeline=p;p.type=s;p.offset=m;if(u===1){p.frameIndicesOffset=-1;this._timelineArray[m+5+0]=f.call(this,i[0],0,0)-this._animation.frameOffset}else{var d=this._animation.frameCount+1;var v=this._data.frameIndices;var y=0;if(t.DragonBones.webAssembly){y=v.size();v.resize(y+d,0)}else{y=v.length;v.length+=d}p.frameIndicesOffset=y;for(var g=0,b=0,D=0,T=0;g0){if(t.DataParser.CURVE in e){var s=i+1;this._helpArray.length=s;this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray);this._frameArray.length+=1+1+this._helpArray.length;this._frameArray[n+1]=2;this._frameArray[n+2]=s;for(var o=0;o0){var s=this._armature.sortedSlots.length;var o=new Array(s-n.length/2);var l=new Array(s);for(var h=0;h0?n>=this._prevRotation:n<=this._prevRotation){this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1}n=this._prevRotation+n-this._prevRotation+t.Transform.PI_D*this._prevClockwise}}this._prevClockwise=r._getNumber(e,t.DataParser.TWEEN_ROTATE,0);this._prevRotation=n;var s=this._parseTweenFrame(e,a,i);var o=this._frameFloatArray.length;this._frameFloatArray.length+=6;this._frameFloatArray[o++]=this._helpTransform.x;this._frameFloatArray[o++]=this._helpTransform.y;this._frameFloatArray[o++]=n;this._frameFloatArray[o++]=this._helpTransform.skew;this._frameFloatArray[o++]=this._helpTransform.scaleX;this._frameFloatArray[o++]=this._helpTransform.scaleY;this._parseActionDataInFrame(e,a,this._bone,this._slot);return s};r.prototype._parseBoneTranslateFrame=function(e,a,i){var n=this._parseTweenFrame(e,a,i);var s=this._frameFloatArray.length;this._frameFloatArray.length+=2;this._frameFloatArray[s++]=r._getNumber(e,t.DataParser.X,0);this._frameFloatArray[s++]=r._getNumber(e,t.DataParser.Y,0);return n};r.prototype._parseBoneRotateFrame=function(e,a,i){var n=r._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD;if(a!==0){if(this._prevClockwise===0){n=this._prevRotation+t.Transform.normalizeRadian(n-this._prevRotation)}else{if(this._prevClockwise>0?n>=this._prevRotation:n<=this._prevRotation){this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1}n=this._prevRotation+n-this._prevRotation+t.Transform.PI_D*this._prevClockwise}}this._prevClockwise=r._getNumber(e,t.DataParser.CLOCK_WISE,0);this._prevRotation=n;var s=this._parseTweenFrame(e,a,i);var o=this._frameFloatArray.length;this._frameFloatArray.length+=2;this._frameFloatArray[o++]=n;this._frameFloatArray[o++]=r._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD;return s};r.prototype._parseBoneScaleFrame=function(e,a,i){var n=this._parseTweenFrame(e,a,i);var s=this._frameFloatArray.length;this._frameFloatArray.length+=2;this._frameFloatArray[s++]=r._getNumber(e,t.DataParser.X,1);this._frameFloatArray[s++]=r._getNumber(e,t.DataParser.Y,1);return n};r.prototype._parseSurfaceFrame=function(e,a,i){var n=this._frameFloatArray.length;var s=this._parseTweenFrame(e,a,i);var o=e[t.DataParser.VERTICES];var l=r._getNumber(e,t.DataParser.OFFSET,0);var h=this._surface.vertices.length/2;var f=0;var u=0;this._frameFloatArray.length+=h*2;for(var _=0;_=o.length){f=0}else{f=o[_-l]}if(_+1=o.length){u=0}else{u=o[_+1-l]}this._frameFloatArray[n+_]=f;this._frameFloatArray[n+_+1]=u}if(a===0){var c=this._frameIntArray.length;this._frameIntArray.length+=1+1+1+1+1;this._frameIntArray[c+0]=0;this._frameIntArray[c+1]=this._frameFloatArray.length-n;this._frameIntArray[c+2]=this._frameFloatArray.length-n;this._frameIntArray[c+3]=0;this._frameIntArray[c+4]=n-this._animation.frameFloatOffset;this._timelineArray[this._timeline.offset+3]=c-this._animation.frameIntOffset}return s};r.prototype._parseSlotDisplayFrame=function(e,a,i){var n=this._parseFrame(e,a,i);this._frameArray.length+=1;if(t.DataParser.VALUE in e){this._frameArray[n+1]=r._getNumber(e,t.DataParser.VALUE,0)}else{this._frameArray[n+1]=r._getNumber(e,t.DataParser.DISPLAY_INDEX,0)}this._parseActionDataInFrame(e,a,this._slot.parent,this._slot);return n};r.prototype._parseSlotColorFrame=function(e,a,r){var i=this._parseTweenFrame(e,a,r);var n=-1;if(t.DataParser.VALUE in e||t.DataParser.COLOR in e){var s=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var o in s){o;this._parseColorTransform(s,this._helpColorTransform);n=this._intArray.length;this._intArray.length+=8;this._intArray[n++]=Math.round(this._helpColorTransform.alphaMultiplier*100);this._intArray[n++]=Math.round(this._helpColorTransform.redMultiplier*100);this._intArray[n++]=Math.round(this._helpColorTransform.greenMultiplier*100);this._intArray[n++]=Math.round(this._helpColorTransform.blueMultiplier*100);this._intArray[n++]=Math.round(this._helpColorTransform.alphaOffset);this._intArray[n++]=Math.round(this._helpColorTransform.redOffset);this._intArray[n++]=Math.round(this._helpColorTransform.greenOffset);this._intArray[n++]=Math.round(this._helpColorTransform.blueOffset);n-=8;break}}if(n<0){if(this._defaultColorOffset<0){this._defaultColorOffset=n=this._intArray.length;this._intArray.length+=8;this._intArray[n++]=100;this._intArray[n++]=100;this._intArray[n++]=100;this._intArray[n++]=100;this._intArray[n++]=0;this._intArray[n++]=0;this._intArray[n++]=0;this._intArray[n++]=0}n=this._defaultColorOffset}var l=this._frameIntArray.length;this._frameIntArray.length+=1;this._frameIntArray[l]=n;return i};r.prototype._parseSlotFFDFrame=function(e,a,i){var n=this._frameFloatArray.length;var s=this._parseTweenFrame(e,a,i);var o=t.DataParser.VERTICES in e?e[t.DataParser.VERTICES]:null;var l=r._getNumber(e,t.DataParser.OFFSET,0);var h=this._intArray[this._mesh.vertices.offset+0];var f=this._mesh.parent.name+"_"+this._slot.name+"_"+this._mesh.name;var u=this._mesh.vertices.weight;var _=0;var c=0;var p=0;var m=0;if(u!==null){var d=this._weightSlotPose[f];this._helpMatrixA.copyFromArray(d,0);this._frameFloatArray.length+=u.count*2;p=u.offset+2+u.bones.length}else{this._frameFloatArray.length+=h*2}for(var v=0;v=o.length){_=0}else{_=o[v-l]}if(v+1=o.length){c=0}else{c=o[v+1-l]}}if(u!==null){var y=this._weightBonePoses[f];var g=this._intArray[p++];this._helpMatrixA.transformPoint(_,c,this._helpPoint,true);_=this._helpPoint.x;c=this._helpPoint.y;for(var b=0;b=0||t.DataParser.DATA_VERSIONS.indexOf(n)>=0){var s=t.BaseObject.borrowObject(t.DragonBonesData);s.version=i;s.name=r._getString(e,t.DataParser.NAME,"");s.frameRate=r._getNumber(e,t.DataParser.FRAME_RATE,24);if(s.frameRate===0){s.frameRate=24}if(t.DataParser.ARMATURE in e){this._data=s;this._parseArray(e);var o=e[t.DataParser.ARMATURE];for(var l=0,h=o;l0){s.stage=s.getArmature(s.armatureNames[0])}this._data=null}if(t.DataParser.TEXTURE_ATLAS in e){this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]}return s}else{console.assert(false,"Nonsupport data version: "+i+"\n"+"Please convert DragonBones data to support version.\n"+"Read more: https://github.com/DragonBones/Tools/")}return null};r.prototype.parseTextureAtlasData=function(e,a,i){if(i===void 0){i=1}console.assert(e!==undefined);if(e===null){if(this._rawTextureAtlases===null||this._rawTextureAtlases.length===0){return false}var n=this._rawTextureAtlases[this._rawTextureAtlasIndex++];this.parseTextureAtlasData(n,a,i);if(this._rawTextureAtlasIndex>=this._rawTextureAtlases.length){this._rawTextureAtlasIndex=0;this._rawTextureAtlases=null}return true}a.width=r._getNumber(e,t.DataParser.WIDTH,0);a.height=r._getNumber(e,t.DataParser.HEIGHT,0);a.scale=i===1?1/r._getNumber(e,t.DataParser.SCALE,1):i;a.name=r._getString(e,t.DataParser.NAME,"");a.imagePath=r._getString(e,t.DataParser.IMAGE_PATH,"");if(t.DataParser.SUB_TEXTURE in e){var s=e[t.DataParser.SUB_TEXTURE];for(var o=0,l=s.length;o0&&_>0){f.frame=t.TextureData.createRectangle();f.frame.x=r._getNumber(h,t.DataParser.FRAME_X,0);f.frame.y=r._getNumber(h,t.DataParser.FRAME_Y,0);f.frame.width=u;f.frame.height=_}a.addTexture(f)}}return true};r.getInstance=function(){if(r._objectDataParserInstance===null){r._objectDataParserInstance=new r}return r._objectDataParserInstance};r._objectDataParserInstance=null;return r}(t.DataParser);t.ObjectDataParser=e;var a=function(){function t(){this.frameStart=0;this.actions=[]}return t}();t.ActionFrame=a})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(e){__extends(a,e);function a(){return e!==null&&e.apply(this,arguments)||this}a.prototype._inRange=function(t,e,a){return e<=t&&t<=a};a.prototype._decodeUTF8=function(t){var e=-1;var a=-1;var r=65533;var i=0;var n="";var s;var o=0;var l=0;var h=0;var f=0;while(t.length>i){var u=t[i++];if(u===e){if(l!==0){s=r}else{s=a}}else{if(l===0){if(this._inRange(u,0,127)){s=u}else{if(this._inRange(u,194,223)){l=1;f=128;o=u-192}else if(this._inRange(u,224,239)){l=2;f=2048;o=u-224}else if(this._inRange(u,240,244)){l=3;f=65536;o=u-240}else{}o=o*Math.pow(64,l);s=null}}else if(!this._inRange(u,128,191)){o=0;l=0;h=0;f=0;i--;s=u}else{h+=1;o=o+(u-128)*Math.pow(64,l-h);if(h!==l){s=null}else{var _=o;var c=f;o=0;l=0;h=0;f=0;if(this._inRange(_,c,1114111)&&!this._inRange(_,55296,57343)){s=_}else{s=u}}}}if(s!==null&&s!==a){if(s<=65535){if(s>0)n+=String.fromCharCode(s)}else{s-=65536;n+=String.fromCharCode(55296+(s>>10&1023));n+=String.fromCharCode(56320+(s&1023))}}}return n};a.prototype._getUTF16Key=function(t){for(var e=0,a=t.length;e255){return encodeURI(t)}}return t};a.prototype._parseBinaryTimeline=function(e,a,r){if(r===void 0){r=null}var i=r!==null?r:t.BaseObject.borrowObject(t.TimelineData);i.type=e;i.offset=a;this._timeline=i;var n=this._timelineArrayBuffer[i.offset+2];if(n===1){i.frameIndicesOffset=-1}else{var s=0;var o=this._animation.frameCount+1;var l=this._data.frameIndices;if(t.DragonBones.webAssembly){s=l.size();l.resize(s+o,0)}else{s=l.length;l.length+=o}i.frameIndicesOffset=s;for(var h=0,f=0,u=0,_=0;h=0){var i=t.BaseObject.borrowObject(t.WeightData);var n=this._intArrayBuffer[a.offset+0];var s=this._intArrayBuffer[r+0];i.offset=r;for(var o=0;o0){if(e in this._dragonBonesDataMap){n=this._dragonBonesDataMap[e];s=n.getArmature(a)}}if(s===null&&(e.length===0||this.autoSearch)){for(var o in this._dragonBonesDataMap){n=this._dragonBonesDataMap[o];if(e.length===0||n.autoSearch){s=n.getArmature(a);if(s!==null){e=o;break}}}}if(s!==null){t.dataName=e;t.textureAtlasName=i;t.data=n;t.armature=s;t.skin=null;if(r.length>0){t.skin=s.getSkin(r);if(t.skin===null&&this.autoSearch){for(var o in this._dragonBonesDataMap){var l=this._dragonBonesDataMap[o];var h=l.getArmature(r);if(h!==null){t.skin=h.defaultSkin;break}}}}if(t.skin===null){t.skin=s.defaultSkin}return true}return false};e.prototype._buildBones=function(e,a){for(var r=0,i=e.armature.sortedBones;r0){o.texture=this._getTextureData(e.textureAtlasName,a.path)}if(r!==null&&r.type===2&&this._isSupportMesh()){s=i.meshDisplay}else{s=i.rawDisplay}break}case 2:{var l=a;if(l.texture===null){l.texture=this._getTextureData(n,l.path)}else if(e!==null&&e.textureAtlasName.length>0){l.texture=this._getTextureData(e.textureAtlasName,l.path)}if(this._isSupportMesh()){s=i.meshDisplay}else{s=i.rawDisplay}break}case 1:{var h=a;var f=this._buildChildArmature(e,i,a);if(f!==null){f.inheritAnimation=h.inheritAnimation;if(!f.inheritAnimation){var u=h.actions.length>0?h.actions:f.armatureData.defaultActions;if(u.length>0){for(var _=0,c=u;_=0){continue}var f=a.getDisplays(h.name);if(!f){if(s!==null&&a!==s){f=s.getDisplays(h.name)}if(!f){if(r){h.rawDisplayDatas=null;h.displayList=[]}continue}}var u=t.DragonBones.webAssembly?f.size():f.length;var _=h.displayList;_.length=u;for(var c=0,p=u;c0?this.width:e.width;var r=this.height>0?this.height:e.height;for(var i in this.textures){var n=egret.$TextureScaleFactor;var s=this.textures[i];var o=s.region.width;var l=s.region.height;if(s.renderTexture===null){s.renderTexture=new egret.Texture}s.renderTexture.bitmapData=e;if(s.rotated){s.renderTexture.$initData(s.region.x*n,s.region.y*n,l*n,o*n,0,0,l*n,o*n,a,r,s.rotated)}else{s.renderTexture.$initData(s.region.x*n,s.region.y*n,o*n,l*n,0,0,o*n,l*n,a,r)}}}else{for(var i in this.textures){var s=this.textures[i];s.renderTexture=null}}},enumerable:true,configurable:true});r.prototype.dispose=function(){console.warn("已废弃。");this.returnToPool()};Object.defineProperty(r.prototype,"texture",{get:function(){console.warn("已废弃。");return this.renderTexture},enumerable:true,configurable:true});return r}(t.TextureAtlasData);t.EgretTextureAtlasData=e;var a=function(t){__extends(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.renderTexture=null;return e}e.toString=function(){return"[class dragonBones.EgretTextureData]"};e.prototype._onClear=function(){t.prototype._onClear.call(this);if(this.renderTexture!==null){}this.renderTexture=null};return e}(t.TextureData);t.EgretTextureData=a})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(e){__extends(a,e);function a(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(a.prototype,"eventObject",{get:function(){return this.data},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"animationName",{get:function(){var t=this.eventObject.animationState;return t!==null?t.name:""},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"armature",{get:function(){return this.eventObject.armature},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"bone",{get:function(){return this.eventObject.bone},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"slot",{get:function(){return this.eventObject.slot},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"animationState",{get:function(){return this.eventObject.animationState},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"frameLabel",{get:function(){return this.eventObject.name},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"sound",{get:function(){return this.eventObject.name},enumerable:true,configurable:true});Object.defineProperty(a.prototype,"movementID",{get:function(){return this.animationName},enumerable:true,configurable:true});a.START=t.EventObject.START;a.LOOP_COMPLETE=t.EventObject.LOOP_COMPLETE;a.COMPLETE=t.EventObject.COMPLETE;a.FADE_IN=t.EventObject.FADE_IN;a.FADE_IN_COMPLETE=t.EventObject.FADE_IN_COMPLETE;a.FADE_OUT=t.EventObject.FADE_OUT;a.FADE_OUT_COMPLETE=t.EventObject.FADE_OUT_COMPLETE;a.FRAME_EVENT=t.EventObject.FRAME_EVENT;a.SOUND_EVENT=t.EventObject.SOUND_EVENT;a.ANIMATION_FRAME_EVENT=t.EventObject.FRAME_EVENT;a.BONE_FRAME_EVENT=t.EventObject.FRAME_EVENT;a.MOVEMENT_FRAME_EVENT=t.EventObject.FRAME_EVENT;a.SOUND=t.EventObject.SOUND_EVENT;return a}(egret.Event);t.EgretEvent=e;var a=function(a){__extends(r,a);function r(){var t=a!==null&&a.apply(this,arguments)||this;t.debugDraw=false;t._batchEnabled=!(global["nativeRender"]||global["bricks"]);t._childDirty=true;t._debugDraw=false;t._armature=null;t._bounds=null;t._debugDrawer=null;return t}r._cleanBeforeRender=function(){};r.prototype.dbInit=function(t){this._armature=t;if(this._batchEnabled){this.$renderNode=new egret.sys.GroupNode;this.$renderNode.cleanBeforeRender=r._cleanBeforeRender}};r.prototype.dbClear=function(){this._armature=null;this._bounds=null;this._debugDrawer=null};r.prototype.dbUpdate=function(){var e=t.DragonBones.debugDraw||this.debugDraw;if(e||this._debugDraw){this._debugDraw=e;if(this._debugDraw){if(this._debugDrawer===null){this._debugDrawer=new egret.Sprite}if(this._debugDrawer.parent!==this){this.addChild(this._debugDrawer)}var a=2;var r=this._debugDrawer.graphics;r.clear();for(var i=0,n=this._armature.getBones();i0){i.setTo(999999,999999,-999999,-999999);for(var u=0,_=f.length;u<_;u+=2){var c=f[u];var p=f[u+1];if(i.x>c)i.x=c;if(i.widthp)i.y=p;if(i.heighte.width){e.width=g}if(b>e.height){e.height=b}}}e.width-=e.x;e.height-=e.y;if(t.isV5){if(this._bounds===null){this._bounds=new egret.Rectangle}this._bounds.copyFrom(e)}}else if(t.isV5){if(this._bounds===null){this._bounds=new egret.Rectangle}e.copyFrom(this._bounds)}return e}return a.prototype.$measureContentBounds.call(this,e)};r.prototype.hasEvent=function(t){return this.hasDBEventListener(t)};r.prototype.addEvent=function(t,e,a){this.addDBEventListener(t,e,a)};r.prototype.removeEvent=function(t,e,a){this.removeDBEventListener(t,e,a)};r.prototype.advanceTimeBySelf=function(e){if(e){this._armature.clock=t.EgretFactory.factory.clock}else{this._armature.clock=null}};return r}(egret.DisplayObjectContainer);t.EgretArmatureDisplay=a;var r=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(e);t.Event=r;var i=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(e);t.ArmatureEvent=i;var n=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(e);t.AnimationEvent=n;var s=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(e);t.FrameEvent=s;var o=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(e);t.SoundEvent=o;var l=function(e){__extends(a,e);function a(a,r,i){if(i===void 0){i=1}var n=e.call(this)||this;console.warn("已废弃");n._onClear();t.ObjectDataParser.getInstance().parseTextureAtlasData(r,n,i);n.renderTexture=a;return n}a.toString=function(){return"[class dragonBones.EgretTextureAtlas]"};return a}(t.EgretTextureAtlasData);t.EgretTextureAtlas=l;var h=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(l);t.EgretSheetAtlas=h;var f=function(){function e(){}e.getInstance=function(){console.warn("已废弃");return t.EgretFactory.factory.soundEventManager};return e}();t.SoundEventManager=f;var u=function(){function t(){console.warn("已废弃")}return t}();t.AnimationCacheManager=u})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=function(e){__extends(a,e);function a(){var t=e!==null&&e.apply(this,arguments)||this;t.transformUpdateEnabled=false;t._armatureDisplay=null;t._renderDisplay=null;t._colorFilter=null;return t}a.toString=function(){return"[class dragonBones.EgretSlot]"};a.prototype.init=function(a,r,i,n){e.prototype.init.call(this,a,r,i,n);if(t.isV5){this._updateTransform=this._updateTransformV5}else{this._updateTransform=this._updateTransformV4}};a.prototype._onClear=function(){e.prototype._onClear.call(this);this._armatureDisplay=null;this._renderDisplay=null;this._colorFilter=null};a.prototype._initDisplay=function(t,e){t;e};a.prototype._disposeDisplay=function(t,e){t;e};a.prototype._onUpdateDisplay=function(){this._armatureDisplay=this._armature.display;this._renderDisplay=this._display!==null?this._display:this._rawDisplay;if(t.isV5&&this._armatureDisplay._batchEnabled){if(this._renderDisplay===this._rawDisplay&&!(this._renderDisplay.$renderNode instanceof egret.sys.BitmapNode)){this._renderDisplay.$renderNode=new egret.sys.BitmapNode}}if(this._armatureDisplay._batchEnabled){if(this._renderDisplay!==this._rawDisplay&&this._renderDisplay!==this._meshDisplay){this._armatureDisplay.disableBatch()}else{var e=this._renderDisplay.$renderNode;if(!e.matrix){e.matrix=new egret.Matrix}}}};a.prototype._addDisplay=function(){if(this._armatureDisplay._batchEnabled){this._armatureDisplay.$renderNode.addNode(this._renderDisplay.$renderNode)}else{this._armatureDisplay.addChild(this._renderDisplay)}};a.prototype._replaceDisplay=function(t){var e=t;if(this._armatureDisplay._batchEnabled){var a=this._armatureDisplay.$renderNode.drawData;a[a.indexOf(e.$renderNode)]=this._renderDisplay.$renderNode}else{this._armatureDisplay.addChild(this._renderDisplay);this._armatureDisplay.swapChildren(this._renderDisplay,e);this._armatureDisplay.removeChild(e)}};a.prototype._removeDisplay=function(){if(this._armatureDisplay._batchEnabled){var t=this._armatureDisplay.$renderNode.drawData;t.splice(t.indexOf(this._renderDisplay.$renderNode),1)}else{this._renderDisplay.parent.removeChild(this._renderDisplay)}};a.prototype._updateZOrder=function(){if(this._armatureDisplay._batchEnabled){var t=this._armatureDisplay.$renderNode.drawData;t[this._zOrder]=this._renderDisplay.$renderNode}else{var e=this._armatureDisplay.getChildIndex(this._renderDisplay);if(e===this._zOrder){return}this._armatureDisplay.addChildAt(this._renderDisplay,this._zOrder)}};a.prototype._updateVisible=function(){var t=this._parent.visible&&this._visible;if(this._armatureDisplay._batchEnabled){var e=this._renderDisplay.$renderNode;e.alpha=t?1:0}else{this._renderDisplay.visible=t}};a.prototype._updateBlendMode=function(){switch(this._blendMode){case 0:this._renderDisplay.blendMode=egret.BlendMode.NORMAL;break;case 1:this._renderDisplay.blendMode=egret.BlendMode.ADD;break;case 5:this._renderDisplay.blendMode=egret.BlendMode.ERASE;break;default:break}if(this._armatureDisplay._batchEnabled){var t=this._renderDisplay.$renderNode;t.blendMode=egret.sys.blendModeToNumber(this._renderDisplay.blendMode)}};a.prototype._updateColor=function(){if(this._colorTransform.redMultiplier!==1||this._colorTransform.greenMultiplier!==1||this._colorTransform.blueMultiplier!==1||this._colorTransform.redOffset!==0||this._colorTransform.greenOffset!==0||this._colorTransform.blueOffset!==0||this._colorTransform.alphaOffset!==0){if(this._colorFilter===null){this._colorFilter=new egret.ColorMatrixFilter}var t=this._colorFilter.matrix;t[0]=this._colorTransform.redMultiplier;t[6]=this._colorTransform.greenMultiplier;t[12]=this._colorTransform.blueMultiplier;t[18]=this._colorTransform.alphaMultiplier;t[4]=this._colorTransform.redOffset;t[9]=this._colorTransform.greenOffset;t[14]=this._colorTransform.blueOffset;t[19]=this._colorTransform.alphaOffset;this._colorFilter.matrix=t;if(this._armatureDisplay._batchEnabled){var e=this._renderDisplay.$renderNode;e.filter=this._colorFilter;e.alpha=1}var a=this._renderDisplay.filters;if(!a){a=[]}if(a.indexOf(this._colorFilter)<0){a.push(this._colorFilter)}this._renderDisplay.filters=a;this._renderDisplay.alpha=1}else{if(this._armatureDisplay._batchEnabled){var e=this._renderDisplay.$renderNode;e.filter=null;e.alpha=this._colorTransform.alphaMultiplier}this._renderDisplay.filters=null;this._renderDisplay.alpha=this._colorTransform.alphaMultiplier}};a.prototype._updateFrame=function(){var e=this._deformVertices!==null&&this._display===this._meshDisplay?this._deformVertices.verticesData:null;var a=this._textureData;if(this._displayIndex>=0&&this._display!==null&&a!==null){if(this._armature.replacedTexture!==null&&this._rawDisplayDatas!==null&&this._rawDisplayDatas.indexOf(this._displayData)>=0){var r=a.parent;if(this._armature._replaceTextureAtlasData===null){r=t.BaseObject.borrowObject(t.EgretTextureAtlasData);r.copyFrom(a.parent);r.renderTexture=this._armature.replacedTexture;this._armature._replaceTextureAtlasData=r}else{r=this._armature._replaceTextureAtlasData}a=r.getTexture(a.name)}if(a.renderTexture!==null){if(e!==null){var i=e.data;var n=i.intArray;var s=i.floatArray;var o=n[e.offset+0];var l=n[e.offset+1];var h=n[e.offset+2];if(h<0){h+=65536}var f=h+o*2;var u=this._armature._armatureData.scale;var _=this._renderDisplay;var c=_.$renderNode;c.uvs.length=o*2;c.vertices.length=o*2;c.indices.length=l*3;for(var p=0,m=o*2;p0&&i.inheritDeform;var o=this._renderDisplay;var l=o.$renderNode;if(n!==null){var h=i.data;var f=h.intArray;var u=h.floatArray;var _=f[i.offset+0];var c=f[n.offset+1];if(c<0){c+=65536}for(var p=0,m=0,d=n.offset+2+r.length,v=c,y=0;p<_;++p){var g=f[d++];var b=0,D=0;for(var T=0;T=5.1;var e=function(e){__extends(a,e);function a(r){if(r===void 0){r=null}var i=e.call(this,r)||this;if(a._dragonBonesInstance===null){var n=new t.EgretArmatureDisplay;a._dragonBonesInstance=new t.DragonBones(n);a._time=egret.getTimer()*.001;egret.startTick(a._clockHandler,a)}i._dragonBones=a._dragonBonesInstance;return i}a._clockHandler=function(t){t*=.001;var e=t-this._time;a._dragonBonesInstance.advanceTime(e);this._time=t;return false};Object.defineProperty(a,"factory",{get:function(){if(a._factory===null){a._factory=new a}return a._factory},enumerable:true,configurable:true});a.prototype._isSupportMesh=function(){if(egret.Capabilities.renderMode==="webgl"||egret.Capabilities.runtimeType===egret.RuntimeType.NATIVE){return true}console.warn("Canvas can not support mesh, please change renderMode to webgl.");return false};a.prototype._buildTextureAtlasData=function(e,a){if(e!==null){if(a instanceof egret.Texture){e.renderTexture=a}else{var r=new egret.Texture;r.bitmapData=new egret.BitmapData(a);e.disposeEnabled=true;e.renderTexture=r}}else{e=t.BaseObject.borrowObject(t.EgretTextureAtlasData)}return e};a.prototype._buildArmature=function(e){var a=t.BaseObject.borrowObject(t.Armature);var r=new t.EgretArmatureDisplay;a.init(e.armature,r,r,this._dragonBones);return a};a.prototype._buildSlot=function(e,a,r){e;var i=t.BaseObject.borrowObject(t.EgretSlot);i.init(a,r,new egret.Bitmap,new egret.Mesh);return i};a.prototype.buildArmatureDisplay=function(t,e,a,r){if(e===void 0){e=""}if(a===void 0){a=""}if(r===void 0){r=""}var i=this.buildArmature(t,e||"",a||"",r||"");if(i!==null){this._dragonBones.clock.add(i);return i.display}return null};a.prototype.getTextureDisplay=function(t,e){if(e===void 0){e=null}var a=this._getTextureData(e!==null?e:"",t);if(a!==null&&a.renderTexture!==null){var r=a.renderTexture;var i=new egret.Bitmap(r);i.width=r.textureWidth*a.parent.scale;i.height=r.textureHeight*a.parent.scale;return i}return null};Object.defineProperty(a.prototype,"soundEventManager",{get:function(){return this._dragonBones.eventManager},enumerable:true,configurable:true});Object.defineProperty(a,"clock",{get:function(){return a.factory.clock},enumerable:true,configurable:true});a.prototype.addSkeletonData=function(t,e){if(e===void 0){e=null}console.warn("已废弃");this.addDragonBonesData(t,e)};a.prototype.getSkeletonData=function(t){console.warn("已废弃");return this.getDragonBonesData(t)};a.prototype.removeSkeletonData=function(t){console.warn("已废弃");this.removeDragonBonesData(t)};a.prototype.addTextureAtlas=function(t,e){if(e===void 0){e=null}console.warn("已废弃");this.addTextureAtlasData(t,e)};a.prototype.getTextureAtlas=function(t){console.warn("已废弃");return this.getTextureAtlasData(t)};a.prototype.removeTextureAtlas=function(t){console.warn("已废弃");this.removeTextureAtlasData(t)};a.prototype.buildFastArmature=function(t,e,a){if(e===void 0){e=""}if(a===void 0){a=""}console.warn("已废弃");return this.buildArmature(t,e||"",a||"")};a.prototype.dispose=function(){console.warn("已废弃");this.clear()};a._time=0;a._dragonBonesInstance=null;a._factory=null;return a}(t.BaseFactory);t.EgretFactory=e})(dragonBones||(dragonBones={}));var dragonBones;(function(t){var e=new egret.Rectangle;var a=new egret.Matrix;var r={};function i(t,e){for(var a=0,r=t.length;a=0){e.displayConfig=this._groupConfig.display[e.displayIndex];if(e.displayConfig.type===1){var i=e.displayConfig.name in e.childMovies?e.childMovies[e.displayConfig.name]:null;if(!i){i=f(e.displayConfig.name,this._groupConfig.name);if(i){e.childMovies[e.displayConfig.name]=i}}if(i){e.display=i;e.childMovie=i}else{e.display=e.rawDisplay;e.childMovie=null}}else{e.display=e.rawDisplay;e.childMovie=null}}else{e.displayConfig=null;e.display=e.rawDisplay;e.childMovie=null}if(e.display!==a){if(a){this.addChild(e.display);this.swapChildren(e.display,a);this.removeChild(a)}this._updateSlotBlendMode(e)}if(e.display===e.rawDisplay){if(e.displayConfig&&e.displayConfig.regionIndex!==null&&e.displayConfig.regionIndex!==undefined){if(!e.displayConfig.texture){var n=this._groupConfig.textures[e.displayConfig.textureIndex||0];var s=e.displayConfig.regionIndex*4;var o=this._groupConfig.rectangleArray[s];var l=this._groupConfig.rectangleArray[s+1];var h=this._groupConfig.rectangleArray[s+2];var u=this._groupConfig.rectangleArray[s+3];e.displayConfig.texture=new egret.Texture;e.displayConfig.texture.bitmapData=n.bitmapData;e.displayConfig.texture.$initData(o,l,Math.min(h,n.textureWidth-o),Math.min(u,n.textureHeight-l),0,0,Math.min(h,n.textureWidth-o),Math.min(u,n.textureHeight-l),n.textureWidth,n.textureHeight)}if(this._batchEnabled){var _=e.displayConfig.texture;var c=e.rawDisplay.$renderNode;egret.sys.RenderNode.prototype.cleanBeforeRender.call(e.rawDisplay.$renderNode);c.image=_.bitmapData;if(t.isV5){c.drawImage(_.$bitmapX,_.$bitmapY,_.$bitmapWidth,_.$bitmapHeight,_.$offsetX,_.$offsetY,_.textureWidth,_.textureHeight);c.imageWidth=_._sourceWidth;c.imageHeight=_._sourceHeight}else{var p=_;c.drawImage(p._bitmapX,p._bitmapY,p._bitmapWidth,p._bitmapHeight,p._offsetX,p._offsetY,_.textureWidth,_.textureHeight);c.imageWidth=p._sourceWidth;c.imageHeight=p._sourceHeight}}else{e.rawDisplay.visible=true;e.rawDisplay.$setBitmapData(e.displayConfig.texture)}}else{if(this._batchEnabled){e.rawDisplay.$renderNode.image=null}else{e.rawDisplay.visible=false;e.rawDisplay.$setBitmapData(null)}}}if(e.childMovie!==r){if(r){r.stop();this._childMovies.slice(this._childMovies.indexOf(r),1)}if(e.childMovie){if(this._childMovies.indexOf(e.childMovie)<0){this._childMovies.push(e.childMovie)}if(e.config.action){e.childMovie.play(e.config.action)}else{e.childMovie.play(e.childMovie._config.action)}}}};i.prototype._getSlot=function(t){for(var e=0,a=this._slots.length;e0&&(s>=n||s<=-n)){this._isCompleted=true;o=this._playTimes;if(s<0){s=0}else{s=i}}else{this._isCompleted=false;if(s<0){o=Math.floor(-s/i);s=i- -s%i}else{o=Math.floor(s/i);s%=i}if(this._playTimes>0&&o>this._playTimes){o=this._playTimes}}if(this._currentTime===s){return}var l=Math.floor(s*this._clipConfig.cacheTimeToFrameScale);if(this._cacheFrameIndex!==l){this._cacheFrameIndex=l;var h=this._groupConfig.displayFrameArray;var f=this._groupConfig.transformArray;var u=this._groupConfig.colorArray;var c=true;var p=false;var m=false;var d=this._cacheRectangle;this._cacheRectangle=this._clipConfig.cacheRectangles[this._cacheFrameIndex];if(this._batchEnabled&&!this._cacheRectangle){m=true;this._cacheRectangle=new egret.Rectangle;this._clipConfig.cacheRectangles[this._cacheFrameIndex]=this._cacheRectangle}for(var v=0,y=this._slots.length;v=this._clipArray.length){b=this._frameSize*(this._cacheFrameIndex-1)+v*2}var D=this._clipArray[b]*2;if(D>=0){var T=h[D];var A=h[D+1]*8;var x=this._clipArray[b+1]*6;var P=false;if(g.displayIndex!==T){g.displayIndex=T;P=true;this._updateSlotDisplay(g)}if(g.colorIndex!==A||P){g.colorIndex=A;if(g.colorIndex>=0){this._updateSlotColor(g,u[A]*.01,u[A+1]*.01,u[A+2]*.01,u[A+3]*.01,u[A+4],u[A+5],u[A+6],u[A+7])}else{this._updateSlotColor(g,1,1,1,1,0,0,0,0)}}p=true;if(g.transformIndex!==x){g.transformIndex=x;if(this._batchEnabled){var O=g.display.$renderNode.matrix;if(!O){O=g.display.$renderNode.matrix=new egret.Matrix}O.a=f[x];O.b=f[x+1];O.c=f[x+2];O.d=f[x+3];O.tx=f[x+4];O.ty=f[x+5]}else{a.a=f[x];a.b=f[x+1];a.c=f[x+2];a.d=f[x+3];a.tx=f[x+4];a.ty=f[x+5];g.display.$setMatrix(a)}}if(this._batchEnabled&&m&&g.displayConfig){var O=g.display.$renderNode.matrix;e.x=0;e.y=0;e.width=g.displayConfig.texture.textureWidth;e.height=g.displayConfig.texture.textureHeight;O.$transformBounds(e);if(c){c=false;this._cacheRectangle.x=e.x;this._cacheRectangle.width=e.x+e.width;this._cacheRectangle.y=e.y;this._cacheRectangle.height=e.y+e.height}else{this._cacheRectangle.x=Math.min(this._cacheRectangle.x,e.x);this._cacheRectangle.width=Math.max(this._cacheRectangle.width,e.x+e.width);this._cacheRectangle.y=Math.min(this._cacheRectangle.y,e.y);this._cacheRectangle.height=Math.max(this._cacheRectangle.height,e.y+e.height)}}}else if(g.displayIndex!==-1){g.displayIndex=-1;this._updateSlotDisplay(g)}}if(this._cacheRectangle){if(p&&m&&c&&d){this._cacheRectangle.x=d.x;this._cacheRectangle.y=d.y;this._cacheRectangle.width=d.width;this._cacheRectangle.height=d.height}if(!t.isV5){this.$invalidateContentBounds()}}}if(this._isCompleted){this._isPlaying=false}if(!this._isStarted){this._isStarted=true;if(this.hasEventListener(_.START)){var S=egret.Event.create(_,_.START);S.movie=this;S.clipName=this._clipConfig.name;S.name="";S.slotName="";this.dispatchEvent(S)}}this._isReversing=this._currentTime>s&&this._currentPlayTimes===o;this._currentTime=s;var E=this._clipConfig.frame?this._clipConfig.frame.length:0;if(E>0){var M=Math.floor(this._currentTime*this._config.frameRate);var B=this._groupConfig.frame[this._clipConfig.frame[M]];if(this._currentFrameConfig!==B){if(E>1){var C=this._currentFrameConfig;this._currentFrameConfig=B;if(!C){var w=Math.floor(this._currentTime*this._config.frameRate);C=this._groupConfig.frame[this._clipConfig.frame[w]];if(this._isReversing){}else{if(this._currentTime<=C.position||this._currentPlayTimes!==o){C=this._groupConfig.frame[C.prev]}}}if(this._isReversing){while(C!==B){this._onCrossFrame(C);C=this._groupConfig.frame[C.prev]}}else{while(C!==B){C=this._groupConfig.frame[C.next];this._onCrossFrame(C)}}}else{this._currentFrameConfig=B;if(this._currentFrameConfig){this._onCrossFrame(this._currentFrameConfig)}}}}if(this._currentPlayTimes!==o){this._currentPlayTimes=o;if(this.hasEventListener(_.LOOP_COMPLETE)){var I=egret.Event.create(_,_.LOOP_COMPLETE);I.movie=this;I.clipName=this._clipConfig.name;I.name="";I.slotName="";this.dispatchEvent(I);egret.Event.release(I)}if(this._isCompleted&&this.hasEventListener(_.COMPLETE)){var F=egret.Event.create(_,_.COMPLETE);F.movie=this;F.clipName=this._clipConfig.name;F.name="";F.slotName="";this.dispatchEvent(F);egret.Event.release(F)}}}this._isLockDispose=false;if(this._isDelayDispose){this.dispose()}};i.prototype.play=function(t,e){if(t===void 0){t=null}if(e===void 0){e=-1}if(t){var a=null;for(var r=0,i=this._config.clip.length;r