LocalCDN-Firefox-Chrome-Brave/resources/bodymovin/4.13.0/bodymovin.min.jsm

10 lines
248 KiB
JavaScript
Raw Normal View History

!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):"object"==typeof module&&module.exports?module.exports=e(t):t.bodymovin=e(t)}(window||{},function(window){function ProjectInterface(){return{}}function roundValues(t){bm_rnd=t?Math.round:function(t){return t}}function roundTo2Decimals(t){return Math.round(1e4*t)/1e4}function roundTo3Decimals(t){return Math.round(100*t)/100}function styleDiv(t){t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.display="block",t.style.transformOrigin=t.style.webkitTransformOrigin="0 0",t.style.backfaceVisibility=t.style.webkitBackfaceVisibility="visible",t.style.transformStyle=t.style.webkitTransformStyle=t.style.mozTransformStyle="preserve-3d"}function styleUnselectableDiv(t){t.style.userSelect="none",t.style.MozUserSelect="none",t.style.webkitUserSelect="none",t.style.oUserSelect="none"}function BMEnterFrameEvent(t,e,s,r){this.type=t,this.currentTime=e,this.totalTime=s,this.direction=0>r?-1:1}function BMCompleteEvent(t,e){this.type=t,this.direction=0>e?-1:1}function BMCompleteLoopEvent(t,e,s,r){this.type=t,this.currentLoop=e,this.totalLoops=s,this.direction=0>r?-1:1}function BMSegmentStartEvent(t,e,s){this.type=t,this.firstFrame=e,this.totalFrames=s}function BMDestroyEvent(t,e){this.type=t,this.target=e}function _addEventListener(t,e){return this._cbs[t]||(this._cbs[t]=[]),this._cbs[t].push(e),function(){this.removeEventListener(t,e)}.bind(this)}function _removeEventListener(t,e){if(e){if(this._cbs[t]){for(var s=0,r=this._cbs[t].length;r>s;)this._cbs[t][s]===e&&(this._cbs[t].splice(s,1),s-=1,r-=1),s+=1;this._cbs[t].length||(this._cbs[t]=null)}}else this._cbs[t]=null}function _triggerEvent(t,e){if(this._cbs[t])for(var s=this._cbs[t].length,r=0;s>r;r++)this._cbs[t][r](e)}function randomString(t,e){void 0===e&&(e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");var s,r="";for(s=t;s>0;--s)r+=e[Math.round(Math.random()*(e.length-1))];return r}function HSVtoRGB(t,e,s){var r,i,a,n,o,h,l,p;switch(1===arguments.length&&(e=t.s,s=t.v,t=t.h),n=Math.floor(6*t),o=6*t-n,h=s*(1-e),l=s*(1-o*e),p=s*(1-(1-o)*e),n%6){case 0:r=s,i=p,a=h;break;case 1:r=l,i=s,a=h;break;case 2:r=h,i=s,a=p;break;case 3:r=h,i=l,a=s;break;case 4:r=p,i=h,a=s;break;case 5:r=s,i=h,a=l}return[r,i,a]}function RGBtoHSV(t,e,s){1===arguments.length&&(e=t.g,s=t.b,t=t.r);var r,i=Math.max(t,e,s),a=Math.min(t,e,s),n=i-a,o=0===i?0:n/i,h=i/255;switch(i){case a:r=0;break;case t:r=e-s+n*(s>e?6:0),r/=6*n;break;case e:r=s-t+2*n,r/=6*n;break;case s:r=t-e+4*n,r/=6*n}return[r,o,h]}function addSaturationToRGB(t,e){var s=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return s[1]+=e,s[1]>1?s[1]=1:s[1]<=0&&(s[1]=0),HSVtoRGB(s[0],s[1],s[2])}function addBrightnessToRGB(t,e){var s=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return s[2]+=e,s[2]>1?s[2]=1:s[2]<0&&(s[2]=0),HSVtoRGB(s[0],s[1],s[2])}function addHueToRGB(t,e){var s=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return s[0]+=e/360,s[0]>1?s[0]-=1:s[0]<0&&(s[0]+=1),HSVtoRGB(s[0],s[1],s[2])}function componentToHex(t){var e=t.toString(16);return 1==e.length?"0"+e:e}function fillToRgba(t,e){if(!cachedColors[t]){var s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);cachedColors[t]=parseInt(s[1],16)+","+parseInt(s[2],16)+","+parseInt(s[3],16)}return"rgba("+cachedColors[t]+","+e+")"}function RenderedFrame(t,e){this.tr=t,this.o=e}function iterateDynamicProperties(t){var e,s=this.dynamicProperties;for(e=0;s>e;e+=1)this.dynamicProperties[e].getValue(t)}function reversePath(t){var e,s,r=[],i=[],a=[],n={},o=0;t.c&&(r[0]=t.o[0],i[0]=t.i[0],a[0]=t.v[0],o=1),s=t.i.length;var h=s-1;for(e=o;s>e;e+=1)r.push(t.o[h]),i.push(t.i[h]),a.push(t.v[h]),h-=1;return n.i=r,n.o=i,n.v=a,n}function Matrix(){}function createElement(t,e,s){if(!e){var r=Object.create(t.prototype,s),i={};return r&&"[object Function]"===i.toString.call(r.init)&&r.init(),r}e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype._parent=t.prototype}function extendPrototype(t,e){for(var s in t.prototype)t.prototype.hasOwnProperty(s)&&(e.prototype[s]=t.prototype[s])}function bezFunction(){func
t[e[0]][e[1]][e[2]][e[3]]||(t[e[0]][e[1]][e[2]][e[3]]="rgba("+e.join(",")+")"),t[e[0]][e[1]][e[2]][e[3]]}}(),Matrix=function(){function t(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function e(t){if(0===t)return this;var e=Math.cos(t),s=Math.sin(t);return this._t(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1)}function s(t){if(0===t)return this;var e=Math.cos(t),s=Math.sin(t);return this._t(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1)}function r(t){if(0===t)return this;var e=Math.cos(t),s=Math.sin(t);return this._t(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1)}function i(t){if(0===t)return this;var e=Math.cos(t),s=Math.sin(t);return this._t(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1)}function a(t,e){return this._t(1,e,t,1,0,0)}function n(t,e){return this.shear(Math.tan(t),Math.tan(e))}function o(t,e){var s=Math.cos(e),r=Math.sin(e);return this._t(s,r,0,0,-r,s,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,Math.tan(t),1,0,0,0,0,1,0,0,0,0,1)._t(s,-r,0,0,r,s,0,0,0,0,1,0,0,0,0,1)}function h(t,e,s){return s=isNaN(s)?1:s,1==t&&1==e&&1==s?this:this._t(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1)}function l(t,e,s,r,i,a,n,o,h,l,p,m,f,c,d,u){return this.props[0]=t,this.props[1]=e,this.props[2]=s,this.props[3]=r,this.props[4]=i,this.props[5]=a,this.props[6]=n,this.props[7]=o,this.props[8]=h,this.props[9]=l,this.props[10]=p,this.props[11]=m,this.props[12]=f,this.props[13]=c,this.props[14]=d,this.props[15]=u,this}function p(t,e,s){return s=s||0,0!==t||0!==e||0!==s?this._t(1,0,0,0,0,1,0,0,0,0,1,0,t,e,s,1):this}function m(t,e,s,r,i,a,n,o,h,l,p,m,f,c,d,u){if(1===t&&0===e&&0===s&&0===r&&0===i&&1===a&&0===n&&0===o&&0===h&&0===l&&1===p&&0===m)return(0!==f||0!==c||0!==d)&&(this.props[12]=this.props[12]*t+this.props[13]*i+this.props[14]*h+this.props[15]*f,this.props[13]=this.props[12]*e+this.props[13]*a+this.props[14]*l+this.props[15]*c,this.props[14]=this.props[12]*s+this.props[13]*n+this.props[14]*p+this.props[15]*d,this.props[15]=this.props[12]*r+this.props[13]*o+this.props[14]*m+this.props[15]*u),this._identityCalculated=!1,this;var y=this.props[0],g=this.props[1],v=this.props[2],b=this.props[3],E=this.props[4],P=this.props[5],x=this.props[6],S=this.props[7],C=this.props[8],k=this.props[9],A=this.props[10],M=this.props[11],D=this.props[12],T=this.props[13],w=this.props[14],_=this.props[15];return this.props[0]=y*t+g*i+v*h+b*f,this.props[1]=y*e+g*a+v*l+b*c,this.props[2]=y*s+g*n+v*p+b*d,this.props[3]=y*r+g*o+v*m+b*u,this.props[4]=E*t+P*i+x*h+S*f,this.props[5]=E*e+P*a+x*l+S*c,this.props[6]=E*s+P*n+x*p+S*d,this.props[7]=E*r+P*o+x*m+S*u,this.props[8]=C*t+k*i+A*h+M*f,this.props[9]=C*e+k*a+A*l+M*c,this.props[10]=C*s+k*n+A*p+M*d,this.props[11]=C*r+k*o+A*m+M*u,this.props[12]=D*t+T*i+w*h+_*f,this.props[13]=D*e+T*a+w*l+_*c,this.props[14]=D*s+T*n+w*p+_*d,this.props[15]=D*r+T*o+w*m+_*u,this._identityCalculated=!1,this}function f(){return this._identityCalculated||(this._identity=!(1!==this.props[0]||0!==this.props[1]||0!==this.props[2]||0!==this.props[3]||0!==this.props[4]||1!==this.props[5]||0!==this.props[6]||0!==this.props[7]||0!==this.props[8]||0!==this.props[9]||1!==this.props[10]||0!==this.props[11]||0!==this.props[12]||0!==this.props[13]||0!==this.props[14]||1!==this.props[15]),this._identityCalculated=!0),this._identity}function c(t){var e;for(e=0;16>e;e+=1)t.props[e]=this.props[e]}function d(t){var e;for(e=0;16>e;e+=1)this.props[e]=t[e]}function u(t,e,s){return{x:t*this.props[0]+e*this.props[4]+s*this.props[8]+this.props[12],y:t*this.props[1]+e*this.props[5]+s*this.props[9]+this.props[13],z:t*this.props[2]+e*this.props[6]+s*this.props[10]+this.props[14]}}function y(t,e,s){return t*this.props[0]+e*this.props[4]+s*this.props[8]+this.props[12]}function g(t,e,s){return t*this.props[1]+e*this.props[5]+s*this.props[9]+this.props[13]}function v(t,e,s){return t*this.props[2]+e*this.props[6]+s*this.props[10]+this.props[14]}function b(t){var e=this.props[0]*this.props[5]-this.props[1]*this.props
var o=3===s?e.pt:e.ks,h=o.k;n=1===o.a||h.length?new a(t,e,s):new i(t,e,s)}else 5===s?n=new f(t,e):6===s?n=new p(t,e):7===s&&(n=new m(t,e));return n.k&&r.push(n),n}function o(){return i}function h(){return a}var l=-999999;i.prototype.interpolateShape=t,i.prototype.getValue=s,a.prototype.getValue=e,a.prototype.interpolateShape=t;var p=function(){function t(){var t=this.p.v[0],e=this.p.v[1],r=this.s.v[0]/2,i=this.s.v[1]/2;3!==this.d?(this.v.v[0][0]=t,this.v.v[0][1]=e-i,this.v.v[1][0]=t+r,this.v.v[1][1]=e,this.v.v[2][0]=t,this.v.v[2][1]=e+i,this.v.v[3][0]=t-r,this.v.v[3][1]=e,this.v.i[0][0]=t-r*s,this.v.i[0][1]=e-i,this.v.i[1][0]=t+r,this.v.i[1][1]=e-i*s,this.v.i[2][0]=t+r*s,this.v.i[2][1]=e+i,this.v.i[3][0]=t-r,this.v.i[3][1]=e+i*s,this.v.o[0][0]=t+r*s,this.v.o[0][1]=e-i,this.v.o[1][0]=t+r,this.v.o[1][1]=e+i*s,this.v.o[2][0]=t-r*s,this.v.o[2][1]=e+i,this.v.o[3][0]=t-r,this.v.o[3][1]=e-i*s):(this.v.v[0][0]=t,this.v.v[0][1]=e-i,this.v.v[1][0]=t-r,this.v.v[1][1]=e,this.v.v[2][0]=t,this.v.v[2][1]=e+i,this.v.v[3][0]=t+r,this.v.v[3][1]=e,this.v.i[0][0]=t+r*s,this.v.i[0][1]=e-i,this.v.i[1][0]=t-r,this.v.i[1][1]=e-i*s,this.v.i[2][0]=t-r*s,this.v.i[2][1]=e+i,this.v.i[3][0]=t+r,this.v.i[3][1]=e+i*s,this.v.o[0][0]=t-r*s,this.v.o[0][1]=e-i,this.v.o[1][0]=t-r,this.v.o[1][1]=e+i*s,this.v.o[2][0]=t+r*s,this.v.o[2][1]=e+i,this.v.o[3][0]=t+r,this.v.o[3][1]=e-i*s)}function e(t){var e,s=this.dynamicProperties.length;if(this.elem.globalData.frameId!==this.frameId){for(this.mdf=!1,this.frameId=this.elem.globalData.frameId,e=0;s>e;e+=1)this.dynamicProperties[e].getValue(t),this.dynamicProperties[e].mdf&&(this.mdf=!0);this.mdf&&this.convertEllToPath()}}var s=roundCorner;return function(s,i){this.v=shape_pool.newShape(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollection_pool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=i.d,this.dynamicProperties=[],this.elem=s,this.comp=s.comp,this.frameId=-1,this.mdf=!1,this.getValue=e,this.convertEllToPath=t,this.reset=r,this.p=PropertyFactory.getProp(s,i.p,1,0,this.dynamicProperties),this.s=PropertyFactory.getProp(s,i.s,1,0,this.dynamicProperties),this.dynamicProperties.length?this.k=!0:this.convertEllToPath()}}(),m=function(){function t(){var t,e=Math.floor(this.pt.v),s=2*Math.PI/e,r=this.or.v,i=this.os.v,a=2*Math.PI*r/(4*e),n=-Math.PI/2,o=3===this.data.d?-1:1;for(n+=this.r.v,this.v._length=0,t=0;e>t;t+=1){var h=r*Math.cos(n),l=r*Math.sin(n),p=0===h&&0===l?0:l/Math.sqrt(h*h+l*l),m=0===h&&0===l?0:-h/Math.sqrt(h*h+l*l);h+=+this.p.v[0],l+=+this.p.v[1],this.v.setTripleAt(h,l,h-p*a*i*o,l-m*a*i*o,h+p*a*i*o,l+m*a*i*o,t,!0),n+=s*o}this.paths.length=0,this.paths[0]=this.v}function e(){var t,e,s,r,i=2*Math.floor(this.pt.v),a=2*Math.PI/i,n=!0,o=this.or.v,h=this.ir.v,l=this.os.v,p=this.is.v,m=2*Math.PI*o/(2*i),f=2*Math.PI*h/(2*i),c=-Math.PI/2;c+=this.r.v;var d=3===this.data.d?-1:1;for(this.v._length=0,t=0;i>t;t+=1){e=n?o:h,s=n?l:p,r=n?m:f;var u=e*Math.cos(c),y=e*Math.sin(c),g=0===u&&0===y?0:y/Math.sqrt(u*u+y*y),v=0===u&&0===y?0:-u/Math.sqrt(u*u+y*y);u+=+this.p.v[0],y+=+this.p.v[1],this.v.setTripleAt(u,y,u-g*r*s*d,y-v*r*s*d,u+g*r*s*d,y+v*r*s*d,t,!0),n=!n,c+=a*d}}function s(){if(this.elem.globalData.frameId!==this.frameId){this.mdf=!1,this.frameId=this.elem.globalData.frameId;var t,e=this.dynamicProperties.length;for(t=0;e>t;t+=1)this.dynamicProperties[t].getValue(),this.dynamicProperties[t].mdf&&(this.mdf=!0);this.mdf&&this.convertToPath()}}return function(i,a){this.v=shape_pool.newShape(),this.v.setPathData(!0,0),this.elem=i,this.comp=i.comp,this.data=a,this.frameId=-1,this.d=a.d,this.dynamicProperties=[],this.mdf=!1,this.getValue=s,this.reset=r,1===a.sy?(this.ir=PropertyFactory.getProp(i,a.ir,0,0,this.dynamicProperties),this.is=PropertyFactory.getProp(i,a.is,0,.01,this.dynamicProperties),this.convertToPath=e):this.convertToPath=t,this.pt=PropertyFactory.getProp(i,a.pt,0,0,this.dynamicProperties),this.p=PropertyFactory.getProp(i,a.p,1,0,this.dynamicProperties),this.r=PropertyFactory.getProp(i,a.r,0,degToRads,this.dynamicProperties),this.or=Pro
(w.a.fc||w.a.fh||w.a.fs||w.a.fb)&&(t.fillColorAnim=!0),V=0,F=w.s.b,e=0;s>e;e+=1)_=p[e],_.anIndexes[a]=V,(1==F&&""!=_.val||2==F&&""!=_.val&&"\xa0"!=_.val||3==F&&(_.n||"\xa0"==_.val||e==s-1)||4==F&&(_.n||e==s-1))&&(1===w.s.rn&&R.push(V),V+=1);l.a[a].s.totalChars=V;var N,B=-1;if(1===w.s.rn)for(e=0;s>e;e+=1)_=p[e],B!=_.anIndexes[a]&&(B=_.anIndexes[a],N=R.splice(Math.floor(Math.random()*R.length),1)[0]),_.anIndexes[a]=N}t.yOffset=t.lh||1.2*t.s,t.ls=t.ls||0,t.ascent=b.ascent*t.s/100},TextProperty.prototype.updateDocumentData=function(t,e){e=void 0===e?this.keysIndex:e;var s=this.data.d.k[e].s;s.__complete=!1,s.t=t.t,this.keysIndex=-1,this.firstFrame=!0,this.getValue()};var pooling=function(){function t(t){return t.concat(Array.apply(null,{length:t.length}))}return{"double":t}}(),point_pool=function(){function t(){var t;return r?(r-=1,t=a[r]):t=[.1,.1],t}function e(t){r===i&&(a=pooling["double"](a),i=2*i),a[r]=t,r+=1}var s={newPoint:t,release:e},r=0,i=8,a=Array.apply(null,{length:i});return s}(),shape_pool=function(){function t(){var t;return a?(a-=1,t=o[a]):t=new ShapePath,t}function e(t){a===n&&(o=pooling["double"](o),n=2*n);var e,s=t._length;for(e=0;s>e;e+=1)point_pool.release(t.v[e]),point_pool.release(t.i[e]),point_pool.release(t.o[e]),t.v[e]=null,t.i[e]=null,t.o[e]=null;t._length=0,t.c=!1,o[a]=t,a+=1}function s(t,s){for(;s--;)e(t[s])}function r(e,s){var r,i=void 0===e._length?e.v.length:e._length,a=t();a.setLength(i),a.c=e.c;var n;for(r=0;i>r;r+=1)s?(n=s.applyToPointArray(e.v[r][0],e.v[r][1],0,2),a.setXYAt(n[0],n[1],"v",r),point_pool.release(n),n=s.applyToPointArray(e.o[r][0],e.o[r][1],0,2),a.setXYAt(n[0],n[1],"o",r),point_pool.release(n),n=s.applyToPointArray(e.i[r][0],e.i[r][1],0,2),a.setXYAt(n[0],n[1],"i",r),point_pool.release(n)):a.setTripleAt(e.v[r][0],e.v[r][1],e.o[r][0],e.o[r][1],e.i[r][0],e.i[r][1],r);return a}var i={clone:r,newShape:t,release:e,releaseArray:s},a=0,n=4,o=Array.apply(null,{length:n});return i}(),shapeCollection_pool=function(){function t(){var t;return i?(i-=1,t=n[i]):t=new ShapeCollection,t}function e(t){var e,s=t._length;for(e=0;s>e;e+=1)shape_pool.release(t.shapes[e]);t._length=0,i===a&&(n=pooling["double"](n),a=2*a),n[i]=t,i+=1}function s(t,s){e(t),i===a&&(n=pooling["double"](n),a=2*a),n[i]=t,i+=1}var r={newShapeCollection:t,release:e,clone:s},i=0,a=4,n=Array.apply(null,{length:a});return r}();BaseRenderer.prototype.checkLayers=function(t){var e,s,r=this.layers.length;for(this.completeLayers=!0,e=r-1;e>=0;e--)this.elements[e]||(s=this.layers[e],s.ip-s.st<=t-this.layers[e].st&&s.op-s.st>t-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(t){switch(t.ty){case 2:return this.createImage(t);case 0:return this.createComp(t);case 1:return this.createSolid(t);case 4:return this.createShape(t);case 5:return this.createText(t);case 13:return this.createCamera(t);case 99:return null}return this.createBase(t)},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.buildAllItems=function(){var t,e=this.layers.length;for(t=0;e>t;t+=1)this.buildItem(t);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(t){this.completeLayers=!1;var e,s,r=t.length,i=this.layers.length;for(e=0;r>e;e+=1)for(s=0;i>s;){if(this.layers[s].id==t[e].id){this.layers[s]=t[e];break}s+=1}},BaseRenderer.prototype.setProjectInterface=function(t){this.globalData.projectInterface=t},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(t,e,s){s=s||[];for(var r=this.elements,i=this.layers,a=0,n=i.length;n>a;)i[a].ind==e&&(r[a]&&r[a]!==!0?void 0!==i[a].parent?(s.push(r[a]),r[a]._isParent=!0,this.buildElementParenting(t,i[a].parent,s)):(s.push(r[a]),r[a]._isParent=!0,t.setHierarchy(s)):(this.buildItem(a),this.addPendingElement(t))),a+=1},BaseRenderer.prototype.addPendingElement=function(t){this.pendingElements.push(t)},exte
u||(u=Math.sqrt(Math.pow(i[0]-a[0],2)+Math.pow(i[1]-a[1],2)));var y=Math.atan2(a[1]-i[1],a[0]-i[0]),g=e.h.v>=1?.99:e.h.v<=-1?-.99:e.h.v,v=u*g,b=Math.cos(y+e.a.v)*v+i[0],E=Math.sin(y+e.a.v)*v+i[1];s.setAttribute("fx",b),s.setAttribute("fy",E),r&&(r.setAttribute("fx",b),r.setAttribute("fy",E))}}},IShapeElement.prototype.renderStroke=function(t,e){var s=e.style,r=e.d;r&&r.k&&(r.mdf||this.firstFrame)&&(s.pElem.setAttribute("stroke-dasharray",r.dasharray),s.pElem.setAttribute("stroke-dashoffset",r.dashoffset)),e.c&&(e.c.mdf||this.firstFrame)&&s.pElem.setAttribute("stroke","rgb("+bm_floor(e.c.v[0])+","+bm_floor(e.c.v[1])+","+bm_floor(e.c.v[2])+")"),(e.o.mdf||this.firstFrame)&&s.pElem.setAttribute("stroke-opacity",e.o.v),(e.w.mdf||this.firstFrame)&&(s.pElem.setAttribute("stroke-width",e.w.v),s.msElem&&s.msElem.setAttribute("stroke-width",e.w.v))},IShapeElement.prototype.destroy=function(){this._parent.destroy.call(this._parent),this.shapeData=null,this.itemsData=null,this.parentContainer=null,this.placeholder=null},ITextElement.prototype.init=function(){this.lettersChangedFlag=!0,this.dynamicProperties=this.dynamicProperties||[],this.textAnimator=new TextAnimatorProperty(this.data.t,this.renderType,this),this.textProperty=new TextProperty(this,this.data.t,this.dynamicProperties),this._parent.init.call(this),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(t){this._parent.prepareFrame.call(this,t),(this.textProperty.mdf||this.textProperty.firstFrame)&&(this.buildNewText(),this.textProperty.firstFrame=!1)},ITextElement.prototype.createPathShape=function(t,e){var s,r,i=e.length,a="";for(s=0;i>s;s+=1)r=e[s].ks.k,a+=this.buildShapeString(r,r.i.length,!0,t);return a},ITextElement.prototype.updateDocumentData=function(t,e){this.textProperty.updateDocumentData(t,e)},ITextElement.prototype.applyTextPropertiesToMatrix=function(t,e,s,r,i){switch(t.ps&&e.translate(t.ps[0],t.ps[1]+t.ascent,0),e.translate(0,-t.ls,0),t.j){case 1:e.translate(t.justifyOffset+(t.boxWidth-t.lineWidths[s]),0,0);break;case 2:e.translate(t.justifyOffset+(t.boxWidth-t.lineWidths[s])/2,0,0)}e.translate(r,i,0)},ITextElement.prototype.buildColor=function(t){return"rgb("+Math.round(255*t[0])+","+Math.round(255*t[1])+","+Math.round(255*t[2])+")"},ITextElement.prototype.buildShapeString=IShapeElement.prototype.buildShapeString,ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){this._parent.destroy.call(this._parent)},createElement(SVGBaseElement,SVGTextElement),extendPrototype(ITextElement,SVGTextElement),SVGTextElement.prototype.createElements=function(){this._parent.createElements.call(this),this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=document.createElementNS(svgNS,"text"))},SVGTextElement.prototype.buildNewText=function(){var t,e,s=this.textProperty.currentData;this.renderedLetters=Array.apply(null,{length:s?s.l.length:0}),s.fc?this.layerElement.setAttribute("fill",this.buildColor(s.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),s.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(s.sc)),this.layerElement.setAttribute("stroke-width",s.sw)),this.layerElement.setAttribute("font-size",s.s);var r=this.globalData.fontManager.getFontByName(s.f);if(r.fClass)this.layerElement.setAttribute("class",r.fClass);else{this.layerElement.setAttribute("font-family",r.fFamily);var i=s.fWeight,a=s.fStyle;this.layerElement.setAttribute("font-style",a),this.layerElement.setAttribute("font-weight",i)}var n=s.l||[],o=this.globalData.fontManager.chars;if(e=n.length){var h,l,p=this.mHelper,m="",f=this.data.singleShape,c=0,d=0,u=!0,y=s.tr/1e3*s.s;if(f&&!o){var g=this.textContainer,v="";switch(s.j){case 1:v="end";break;case 2:v="middle";break;case 2:v="start"}g.setAttribute("text-anchor",v),g.setAttribute("letter-spacing",y);var b=s.t.split(String.fromCharCode(13));e=b.length;var d=s.ps?s.ps[1]+s.ascent:0;for(t=0;e>t
},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(t){var e="";if(this.assetsPath){var s=t.p;-1!==s.indexOf("images/")&&(s=s.split("/")[1]),e=this.assetsPath+s}else e=this.path,e+=t.u?t.u:"",e+=t.p;return e},AnimationItem.prototype.getAssetData=function(t){for(var e=0,s=this.assets.length;s>e;){if(t==this.assets[e].id)return this.assets[e];e+=1}},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getAssets=function(){return this.assets},AnimationItem.prototype.trigger=function(t){if(this._cbs&&this._cbs[t])switch(t){case"enterFrame":this.triggerEvent(t,new BMEnterFrameEvent(t,this.currentFrame,this.totalFrames,this.frameMult));break;case"loopComplete":this.triggerEvent(t,new BMCompleteLoopEvent(t,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(t,new BMCompleteEvent(t,this.frameMult));break;case"segmentStart":this.triggerEvent(t,new BMSegmentStartEvent(t,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(t,new BMDestroyEvent(t,this));break;default:this.triggerEvent(t)}"enterFrame"===t&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(t,this.currentFrame,this.totalFrames,this.frameMult)),"loopComplete"===t&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(t,this.loop,this.playCount,this.frameMult)),"complete"===t&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(t,this.frameMult)),"segmentStart"===t&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(t,this.firstFrame,this.totalFrames)),"destroy"===t&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(t,this))},AnimationItem.prototype.addEventListener=_addEventListener,AnimationItem.prototype.removeEventListener=_removeEventListener,AnimationItem.prototype.triggerEvent=_triggerEvent,extendPrototype(BaseRenderer,CanvasRenderer),CanvasRenderer.prototype.createBase=function(t){return new CVBaseElement(t,this,this.globalData)},CanvasRenderer.prototype.createShape=function(t){return new CVShapeElement(t,this,this.globalData)},CanvasRenderer.prototype.createText=function(t){return new CVTextElement(t,this,this.globalData)},CanvasRenderer.prototype.createImage=function(t){return new CVImageElement(t,this,this.globalData)},CanvasRenderer.prototype.createComp=function(t){return new CVCompElement(t,this,this.globalData)},CanvasRenderer.prototype.createSolid=function(t){return new CVSolidElement(t,this,this.globalData)},CanvasRenderer.prototype.ctxTransform=function(t){if(1!==t[0]||0!==t[1]||0!==t[4]||1!==t[5]||0!==t[12]||0!==t[13]){if(!this.renderConfig.clearCanvas)return void this.canvasContext.transform(t[0],t[1],t[4],t[5],t[12],t[13]);this.transformMat.cloneFromProps(t),this.transformMat.transform(this.contextData.cTr.props[0],this.contextData.cTr.props[1],this.contextData.cTr.props[2],this.contextData.cTr.props[3],this.contextData.cTr.props[4],this.contextData.cTr.props[5],this.contextData.cTr.props[6],this.contextData.cTr.props[7],this.contextData.cTr.props[8],this.contextData.cTr.props[9],this.contextData.cTr.props[10],this.contextData.cTr.props[11],this.contextData.cTr.props[12],this.contextData.cTr.props[13],this.contextData.cTr.props[14],this.contextData.cTr.props[15]),this.contextData.cTr.cloneFromProps(this.transformMat.props);var e=this.contextData.cTr.props;this.canvasContext.setTransform(e[0],e[1],e[4],e[5],e[12],e[13])}},CanvasRenderer.prototype.ctxOpacity=function(t){if(1!==t){if(!this.renderConfig.clearCanvas)return void(this.canvasContext.globalAlpha*=0>t?0:t);this.contextData.cO*=0>t?0:t,this.canvasContext.globalAlpha=this.contextData.cO}},CanvasRenderer.prototype.reset=function(){return this.renderConfig.clearCanvas?(this.contextData.cArrPos=0,this.contextData.cTr.reset(),void(this.contextData.cO=1)):void this.canvasContext.restore()},CanvasRen
"st"===y?(v.strokeStyle=this.stylesList[i].co,v.lineWidth=this.stylesList[i].wi,v.lineCap=this.stylesList[i].lc,v.lineJoin=this.stylesList[i].lj,v.miterLimit=this.stylesList[i].ml||0):v.fillStyle=this.stylesList[i].co,g.ctxOpacity(this.stylesList[i].coOp),"st"!==y&&v.beginPath(),m=d.length,p=0;m>p;p+=1){for("st"===y&&(v.beginPath(),this.stylesList[i].da?(v.setLineDash(this.stylesList[i].da),v.lineDashOffset=this.stylesList[i]["do"],this.globalData.isDashed=!0):this.globalData.isDashed&&(v.setLineDash(this.dashResetter),this.globalData.isDashed=!1)),u=d[p].trNodes,c=u.length,f=0;c>f;f+=1)"m"==u[f].t?v.moveTo(u[f].p[0],u[f].p[1]):"c"==u[f].t?v.bezierCurveTo(u[f].p1[0],u[f].p1[1],u[f].p2[0],u[f].p2[1],u[f].p3[0],u[f].p3[1]):v.closePath();"st"===y&&v.stroke()}"st"!==y&&v.fill(this.stylesList[i].r),g.restore()}g.restore(),this.firstFrame&&(this.firstFrame=!1)}},CVShapeElement.prototype.renderPath=function(t,e,s){var r,i,a,n,o=s.matMdf||e.sh.mdf||this.firstFrame;if(o){var h=e.sh.paths,l=s.mat;n=h._length;var p=e.trNodes;for(p.length=0,a=0;n>a;a+=1){var m=h.shapes[a];if(m&&m.v){for(r=m._length,i=1;r>i;i+=1)1==i&&p.push({t:"m",p:l.applyToPointArray(m.v[0][0],m.v[0][1],0)}),p.push({t:"c",p1:l.applyToPointArray(m.o[i-1][0],m.o[i-1][1],0),p2:l.applyToPointArray(m.i[i][0],m.i[i][1],0),p3:l.applyToPointArray(m.v[i][0],m.v[i][1],0)});1==r&&p.push({t:"m",p:l.applyToPointArray(m.v[0][0],m.v[0][1],0)}),m.c&&r&&(p.push({t:"c",p1:l.applyToPointArray(m.o[i-1][0],m.o[i-1][1],0),p2:l.applyToPointArray(m.i[0][0],m.i[0][1],0),p3:l.applyToPointArray(m.v[0][0],m.v[0][1],0)}),p.push({t:"z"})),e.lStr=p}}if(e.st)for(i=0;16>i;i+=1)e.tr[i]=s.mat.props[i];e.trNodes=p}},CVShapeElement.prototype.renderFill=function(t,e,s){var r=e.style;(e.c.mdf||this.firstFrame)&&(r.co="rgb("+bm_floor(e.c.v[0])+","+bm_floor(e.c.v[1])+","+bm_floor(e.c.v[2])+")"),(e.o.mdf||s.opMdf||this.firstFrame)&&(r.coOp=e.o.v*s.opacity)},CVShapeElement.prototype.renderStroke=function(t,e,s){var r=e.style,i=e.d;i&&(i.mdf||this.firstFrame)&&(r.da=i.dasharray,r["do"]=i.dashoffset),(e.c.mdf||this.firstFrame)&&(r.co="rgb("+bm_floor(e.c.v[0])+","+bm_floor(e.c.v[1])+","+bm_floor(e.c.v[2])+")"),(e.o.mdf||s.opMdf||this.firstFrame)&&(r.coOp=e.o.v*s.opacity),(e.w.mdf||this.firstFrame)&&(r.wi=e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemData.length=0,this._parent.destroy.call(this._parent)},createElement(CVBaseElement,CVSolidElement),CVSolidElement.prototype.renderFrame=function(t){if(this._parent.renderFrame.call(this,t)!==!1){var e=this.canvasContext;this.globalData.renderer.save(),this.globalData.renderer.ctxTransform(this.finalTransform.mat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.opacity),e.fillStyle=this.data.sc,e.fillRect(0,0,this.data.sw,this.data.sh),this.globalData.renderer.restore(this.data.hasMask),this.firstFrame&&(this.firstFrame=!1)}},createElement(CVBaseElement,CVTextElement),extendPrototype(ITextElement,CVTextElement),CVTextElement.prototype.tHelper=document.createElement("canvas").getContext("2d"),CVTextElement.prototype.createElements=function(){this._parent.createElements.call(this)},CVTextElement.prototype.buildNewText=function(){var t=this.textProperty.currentData;this.renderedLetters=Array.apply(null,{length:t.l?t.l.length:0});var e=!1;t.fc?(e=!0,this.values.fill=this.buildColor(t.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=e;var s=!1;t.sc&&(s=!0,this.values.stroke=this.buildColor(t.sc),this.values.sWidth=t.sw);var r,i,a=this.globalData.fontManager.getFontByName(t.f),n=t.l,o=this.mHelper;this.stroke=s,this.values.fValue=t.s+"px "+this.globalData.fontManager.getFontByName(t.f).fFamily,i=t.t.length;var h,l,p,m,f,c,d,u,y,g,v=this.data.singleShape,b=t.tr/1e3*t.s,E=0,P=0,x=!0,S=0;for(r=0;i>r;r+=1){for(h=this.globalData.fontManager.getCharData(t.t.charAt(r),a.fStyle,this.globalData.fontManager.getFontByName(t.f).fFamily),l=h&&h.data||{},o.reset(),v&&n[r].n&&(E=-b,P+=t.yOffset,P+=x?1:0,x=!1),f=l.shapes?l.shapes[0].it:[],d=f.length,o.scale(t.s/100,t.s
return r}function shapesEqual(t,e){if(t._length!==e._length||t.c!==e.c)return!1;var s,r=t._length;for(s=0;r>s;s+=1)if(t.v[s][0]!==e.v[s][0]||t.v[s][1]!==e.v[s][1]||t.o[s][0]!==e.o[s][0]||t.o[s][1]!==e.o[s][1]||t.i[s][0]!==e.i[s][0]||t.i[s][1]!==e.i[s][1])return!1;return!0}function $bm_neg(t){var e=typeof t;if("number"===e||"boolean"===e||t instanceof Number)return-t;if(t.constructor===Array){var s,r=t.length,i=[];for(s=0;r>s;s+=1)i[s]=-t[s];return i}}function sum(t,e){var s=typeof t,r=typeof e;if("string"===s||"string"===r)return t+e;if(("number"===s||"boolean"===s||"string"===s||t instanceof Number)&&("number"===r||"boolean"===r||"string"===r||e instanceof Number))return t+e;if(t.constructor===Array&&("number"===r||"boolean"===r||"string"===r||e instanceof Number))return t[0]=t[0]+e,t;if(("number"===s||"boolean"===s||"string"===s||t instanceof Number)&&e.constructor===Array)return e[0]=t+e[0],e;if(t.constructor===Array&&e.constructor===Array){for(var i=0,a=t.length,n=e.length,o=[];a>i||n>i;)o[i]=("number"==typeof t[i]||t[i]instanceof Number)&&("number"==typeof e[i]||e[i]instanceof Number)?t[i]+e[i]:void 0==e[i]?t[i]:t[i]||e[i],i+=1;return o}return 0}function sub(t,e){var s=typeof t,r=typeof e;if(("number"===s||"boolean"===s||"string"===s||t instanceof Number)&&("number"===r||"boolean"===r||"string"===r||e instanceof Number))return"string"===s&&(t=parseInt(t)),"string"===r&&(e=parseInt(e)),t-e;if(t.constructor===Array&&("number"===r||"boolean"===r||"string"===r||e instanceof Number))return t[0]=t[0]-e,t;if(("number"===s||"boolean"===s||"string"===s||t instanceof Number)&&e.constructor===Array)return e[0]=t-e[0],e;if(t.constructor===Array&&e.constructor===Array){for(var i=0,a=t.length,n=e.length,o=[];a>i||n>i;)o[i]="number"==typeof t[i]||t[i]instanceof Number?t[i]-e[i]:void 0==e[i]?t[i]:t[i]||e[i],i+=1;return o}return 0}function mul(t,e){var s,r=typeof t,i=typeof e;if(("number"===r||"boolean"===r||"string"===r||t instanceof Number)&&("number"===i||"boolean"===i||"string"===i||e instanceof Number))return t*e;var a,n;if(t.constructor===Array&&("number"===i||"boolean"===i||"string"===i||e instanceof Number)){for(n=t.length,s=Array.apply(null,{length:n}),a=0;n>a;a+=1)s[a]=t[a]*e;return s}if(("number"===r||"boolean"===r||"string"===r||t instanceof Number)&&e.constructor===Array){for(n=e.length,s=Array.apply(null,{length:n}),a=0;n>a;a+=1)s[a]=t*e[a];return s}return 0}function div(t,e){var s,r=typeof t,i=typeof e;if(("number"===r||"boolean"===r||"string"===r||t instanceof Number)&&("number"===i||"boolean"===i||"string"===i||e instanceof Number))return t/e;var a,n;if(t.constructor===Array&&("number"===i||"boolean"===i||"string"===i||e instanceof Number)){for(n=t.length,s=Array.apply(null,{length:n}),a=0;n>a;a+=1)s[a]=t[a]/e;return s}if(("number"===r||"boolean"===r||"string"===r||t instanceof Number)&&e.constructor===Array){for(n=e.length,s=Array.apply(null,{length:n}),a=0;n>a;a+=1)s[a]=t/e[a];return s}return 0}function mod(t,e){return"string"==typeof t&&(t=parseInt(t)),"string"==typeof e&&(e=parseInt(e)),t%e}function clamp(t,e,s){if(e>s){var r=s;s=e,e=r}return Math.min(Math.max(t,e),s)}function radiansToDegrees(t){return t/degToRads}function degreesToRadians(t){return t*degToRads}function length(t,e){if("number"==typeof t||t instanceof Number)return e=e||0,Math.abs(t-e);e||(e=helperLengthArray);var s,r=Math.min(t.length,e.length),i=0;for(s=0;r>s;s+=1)i+=Math.pow(e[s]-t[s],2);return Math.sqrt(i)}function normalize(t){return div(t,length(t))}function rgbToHsl(t){var e,s,r=t[0],i=t[1],a=t[2],n=Math.max(r,i,a),o=Math.min(r,i,a),h=(n+o)/2;if(n==o)e=s=0;else{var l=n-o;switch(s=h>.5?l/(2-n-o):l/(n+o),n){case r:e=(i-a)/l+(a>i?6:0);break;case i:e=(a-r)/l+2;break;case a:e=(r-i)/l+4}e/=6}return[e,s,h,t[3]]}function hslToRgb(t){function e(t,e,s){return 0>s&&(s+=1),s>1&&(s-=1),1/6>s?t+6*(e-t)*s:.5>s?e:2/3>s?t+(e-t)*(2/3-s)*6:t}var s,r,i,a=t[0],n=t[1],o=t[2];if(0==n)s=r=i=o;else{var h=.5>o?o*(1+n):o+n-o*n,l=2*o-h;s=e(l,h,a+1/3),r=e(l,h,a),i=e(l,h,a-1/3)}return[s,r,i,t[3]]}function linear(t,e,s,r,i){if(void 0===r||void 0===i)return linear(t,0,