blob: ac0844673f9f76716a1cc7954e912156ae86b6e4 [file] [log] [blame]
(function(window){"use strict";function Matrix(t){var e=this;e._t=e.transform,e.dimension=t,"2d"==t?(e.a=e.d=1,e.b=e.c=e.e=e.f=0,e.props=[1,0,0,1,0,0],e.a1=e.b1=e.c1=e.d1=e.e1=e.f1=0):(e.a=e.f=e.k=e.p=1,e.b=e.c=e.d=e.e=e.g=e.h=e.i=e.j=e.l=e.m=e.n=e.o=0,e.props=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e.a1=e.b1=e.c1=e.d1=e.e1=e.f1=e.g1=e.h1=e.i1=e.j1=e.k1=e.l1=e.m1=e.n1=e.o1=e.p1=0),e.cssParts=["matrix(","",")"],e.cssParts3d=["matrix3d(","",")"],e.cos=e.sin=0}function matrixManagerFunction(){var t=new Matrix("2d"),e=new Matrix("3d"),a=function(t,a,i,r,s,n,o,h,m){var p=e.reset().translate(o,h,m).rotateX(t).rotateY(a).rotateZ(i).scale(r,s,n).toCSS();return p},i=function(t,a,i,r,s,n,o,h,m,p,l,d){var c=e.reset().translate(-p,-l,-d).rotateZ(-i).rotateY(a).rotateX(t).scale(r,s,n).translate(o,h,-m).toCSS();return c},r=function(e,a,i,r,s){return t.reset().translate(r,s).rotate(e).scale(a,i).toCSS()},s=function(e,a,i,r,s){return t.reset().translate(r,s).rotate(e).scale(a,i).toArray()},n=function(t){return r(t.r,t.s[0],t.s[1],t.p[0],t.p[1])},o=function(t,e){return e?a(-t.tr.r[0],t.tr.r[1],t.tr.r[2],t.tr.s[0],t.tr.s[1],t.tr.s[2],t.tr.p[0],t.tr.p[1],t.tr.p[2]):r(t.tr.r[2],t.tr.s[0],t.tr.s[1],t.tr.p[0],t.tr.p[1])},h=function(t,e){return e?a(-t.rx[0],t.ry[1],t.rz[2],t.s[0],t.s[1],t.s[2],t.p[0],t.p[1],t.p[2],t.a[0],t.a[1],t.a[2]):r(t.r[2],t.s[0],t.s[1],t.p[0],t.p[1])},m=function(t,e){return e?null:s(t.r[2],t.s[0],t.s[1],t.p[0],t.p[1])};return{get2DMatrix:n,getMatrix:o,getMatrix2:h,getMatrixArray:m,getMatrixArrayFromParams:s,getMatrix2FromParams:r,getMatrix3FromParams:a,getAnchoredMatrix3FromParams:i}}function styleDiv(t){t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.backfaceVisibility=t.style.webkitBackfaceVisibility="visible",styleUnselectableDiv(t)}function styleUnselectableDiv(t){t.style.userSelect="none",t.style.MozUserSelect="none",t.style.webkitUserSelect="none",t.style.oUserSelect="none"}function randomString(t,e){void 0===e&&(e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");var a,i="";for(a=t;a>0;--a)i+=e[Math.round(Math.random()*(e.length-1))];return i}function componentToHex(t){var e=t.toString(16);return 1==e.length?"0"+e:e}function rgbToHex(t,e,a){return 0>t&&(t=0),0>e&&(e=0),0>a&&(a=0),"#"+colorMap[t]+colorMap[e]+colorMap[a]}function fillToRgba(t,e){if(!cachedColors[t]){var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);cachedColors[t]=parseInt(a[1],16)+","+parseInt(a[2],16)+","+parseInt(a[3],16)}return"rgba("+cachedColors[t]+","+e+")"}function createColorMap(){var t,e;for(t=0;256>t;t+=1)e=t.toString(16),colorMap[t]=1==e.length?"0"+e:e}function createElement(t,e,a){if(!e){var i=Object.create(t.prototype,a),r={};return i&&"[object Function]"===r.toString.call(i.init)&&i.init(),i}e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.parent=t.prototype}function defineDescriptor(t,e,a,i){var r={writable:!1,configurable:!1,enumerable:!1,value:a};if(i)for(var s in i)r[s]=i[s];var n={};t&&"[object Function]"===n.toString.call(t)&&(t=t.prototype),Object.defineProperty(t,e,r)}function defineAccessor(t,e,a){var i,r={enumerable:!1,configurable:!1,get:function(){return i},set:function(t){i=t}};if(a)for(var s in a)r[s]=a[s];var n={};t&&"[object Function]"===n.toString.call(t)&&(t=t.prototype),Object.defineProperty(t,e,r)}function bezFunction(){function t(t,e,a,i,r,s){return o.abs((a-t)*(s-e)-(r-t)*(i-e))<1e-5}function e(t){return s[t].fnc}function a(t,e,a,i,r){if(r||(r=("bez_"+t+"_"+e+"_"+a+"_"+i).replace(/\./g,"p")),s[r])return s[r];var n,o,h,m,p,l;return s[r]=function(r,s,d,c,u){for(var f,y=s/u,r=y,g=0;++g<14&&(h=3*t,o=3*(a-t)-h,n=1-h-o,f=r*(h+r*(o+r*n))-y,!(Math.abs(f)<.001));)r-=f/(h+r*(2*o+3*n*r));l=3*e,p=3*(i-e)-l,m=1-l-p;var v=r*(l+r*(p+r*m));return c*v+d},s[r]}function i(e,a,i,r){var s=(e.join("_")+"_"+a.join("_")+"_"+i.join("_")+"_"+r.join("_")).replace(/\./g,"p");if(n[s])return n[s];var o,h,m,p,l,d,c,u,f,y,g,v,E=500,x=0,b=null,C={points:[],segmentLength:0};for(t(e[0],e[1],a[0],a[1],i[0],i[1])&&t(e[0],e[1],a[0],a[1],r[0],r[1])&&(E=2),m=i.length,o=0;E>o;o+=1){for(v=[],y=o/(E-1),g=0,h=0;m>h;h+=1)p=e[h]+(i[h]-e[h])*y,l=i[h]+(r[h]-i[h])*y,d=r[h]+(a[h]-r[h])*y,c=p+(l-p)*y,u=l+(d-l)*y,f=c+(u-c)*y,v.push(f),null!==b&&(g+=Math.pow(v[h]-b[h],2));g=Math.sqrt(g),x+=g,C.points.push({partialLength:g,cumulatedLength:x,point:v}),b=v}return C.segmentLength=x,n[s]=C,C}function r(e){var a,i,r,s,n,o,h,m,p,l,d,c,u=e.s,f=e.e,y=e.to,g=e.ti,v=500,E=0,x=null,b={points:[],segmentLength:0};for(t(u[0],u[1],f[0],f[1],u[0]+y[0],u[1]+y[1])&&t(u[0],u[1],f[0],f[1],f[0]+g[0],f[1]+g[1])&&(v=2),r=y.length,a=0;v>a;a+=1){for(c=[],l=a/(v-1),d=0,i=0;r>i;i+=1)s=u[i]+y[i]*l,n=u[i]+y[i]+(f[i]+g[i]-(u[i]+y[i]))*l,o=f[i]+g[i]+-g[i]*l,h=s+(n-s)*l,m=n+(o-n)*l,p=h+(m-h)*l,c.push(p),null!==x&&(d+=Math.pow(c[i]-x[i],2));d=Math.sqrt(d),E+=d,b.points.push({partialLength:d,cumulatedLength:E,point:c}),x=c}b.segmentLength=E,e.bezierData=b}var s=[],n={},o=Math,h={getEasingCurve:a,getEasingCurveByIndex:e,drawBezierCurve:i,buildBezierData:r};return h}function dataFunctionManager(){function t(t,e,a){var i,r=n(t,e,a),s=[];for(i=0;e>i;i+=1)s.push(Math.floor(r[i]*f));return s}function e(t,e){var a,i,r,s=t.length;for(a=0;s>a;a+=1)if(void 0!==t[a].t)if(t[a].s instanceof Array)for(r=t[a].s.length,i=0;r>i;i+=1)t[a].s[i]*=e,t[a].e[i]*=e;else t[a].s&&(t[a].s*=e,t[a].e*=e);else t[a]=t[a]*e}function a(r,n,o){var h,m,p,l,d,c,u,f,y,g,E,x=r.length;for(u=0;x>u;u+=1){if(p=r[u],p.compWidth=n,p.compHeight=o,h=p.outPoint-p.startTime,m=p.startTime,p.layerName=s(p.layerName),p.parent&&(p.parent=s(p.parent)),p.renderedFrame={},p.renderedData={},l=[],d=-1,p.tm&&(p.tm=t(p.tm,h,m)),p.ks.o instanceof Array?e(p.ks.o,.01):p.ks.o/=100,p.ks.s instanceof Array?e(p.ks.s,.01):p.ks.s/=100,p.ks.r instanceof Array?e(p.ks.r,v):p.ks.r*=v,p.ks.rx instanceof Array?e(p.ks.rx,v):p.ks.rx*=v,p.ks.ry instanceof Array?e(p.ks.ry,v):p.ks.ry*=v,p.ks.rz instanceof Array?e(p.ks.rz,v):p.ks.rz*=v,p.hasMask){var b=p.masksProperties;for(y=b.length,f=0;y>f;f+=1)if(b[f].pt.i)i(b[f].pt);else for(E=b[f].pt.length,g=0;E>g;g+=1)b[f].pt[g].s&&i(b[f].pt[g].s[0]),b[f].pt[g].e&&i(b[f].pt[g].e[0])}if("PreCompLayer"==p.type)a(p.layers,p.width,p.height);else if("ShapeLayer"==p.type)for(y=p.shapes.length,f=0;y>f;f+=1)if(c=p.shapes[f],c.renderedData={},c.tr.o instanceof Array?e(c.tr.o,.01):c.tr.o/=100,c.tr.s instanceof Array?e(c.tr.s,.01):c.tr.s/=100,c.tr.r instanceof Array?e(c.tr.r,v):c.tr.r*=v,c.fl&&(c.fl.o instanceof Array?e(c.fl.o,.01):c.fl.o*=.01),c.st&&(c.st.o instanceof Array?e(c.st.o,.01):c.st.o*=.01),c.ks)if(c.ks.i)i(c.ks);else for(E=c.ks.length,g=0;E>g;g+=1)c.ks[g].s&&(i(c.ks[g].s[0]),i(c.ks[g].e[0]))}}function i(t){var e,a=t.i.length;for(e=0;a>e;e+=1)t.i[e][0]+=t.v[e][0],t.i[e][1]+=t.v[e][1],t.o[e][0]+=t.v[e][0],t.o[e][1]+=t.v[e][1]}function r(t){g[t._id]={data:t,renderedFrames:[]},f=t.animation.frameRate,a(t.animation.layers,t.animation.compWidth,t.animation.compHeight)}function s(t){return t=t.replace(/ /g,"_"),t=t.replace(/-/g,"_"),t=t.replace(/\./g,"_"),t=t.replace(/\//g,"_")}function n(t,e,a){var i,r,s=[];if(!(t instanceof Array)||null==t[0].t)return s.push(t),s;var n,o;s=[];var h,m,p,l=[];r=t.length;var d,c=1e3,u=[],f=[];for(i=0;r>i;i+=1)if(n=t[i],n.t-=a,n.to){var y,g,v,E,x,b,C,d,S,I,A=0,F=null,w={points:[],length:0};for(y=0;c>y;y+=1)I=[],d=y/(c-1),S=0,u=[],f=[],n.to.forEach(function(t,e){null==u[e]&&(u[e]=n.s[e]+n.to[e],f[e]=n.e[e]+n.ti[e]),g=n.s[e]+(u[e]-n.s[e])*d,v=u[e]+(f[e]-u[e])*d,E=f[e]+(n.e[e]-f[e])*d,x=g+(v-g)*d,b=v+(E-v)*d,C=x+(b-x)*d,I.push(C),null!==F&&(S+=Math.pow(I[e]-F[e],2))}),S=Math.sqrt(S),A+=S,w.points.push({partialLength:A,point:I}),F=I,n.bezierData=w;w.segmentLength=A}var k=0,D=0;for(i=0;e>i;i+=1){h=k;for(var M=!1;r-1>h;){if(n=t[h],o=t[h+1],i<n.t&&0==h){for(p=n.s.length,l=[],m=0;p>m;m+=1)l.push(n.s[m]);s.push(l),M=!0,k!=h&&(k=h,D=0);break}if(i>=n.t&&i<o.t){if(l=[],n.to){d=bez.getEasingCurve(n.o.x,n.o.y,n.i.x,n.i.y)("",i-n.t,0,1,o.t-n.t);var y,T,V,w=n.bezierData,z=w.segmentLength*d;for(m=D;m<w.points.length;){if(0==i||0==z||0==d){l=w.points[m].point,D=m;break}if(m==w.points.length-1)l=w.points[m].point;else if(z>w.points[m].partialLength&&z<w.points[m+1].partialLength){for(T=w.points[m].point.length,V=(z-w.points[m].partialLength)/(w.points[m+1].partialLength-w.points[m].partialLength),y=0;T>y;y+=1)l.push(w.points[m].point[y]+(w.points[m+1].point[y]-w.points[m].point[y])*V);D=m;break}m+=1}}else{var P,_,N,L;n.s.forEach(function(t,e){if(1!==n.h&&(n.o.x instanceof Array?(P=n.o.x[e],_=n.o.y[e],N=n.i.x[e],L=n.i.y[e]):(P=n.o.x,_=n.o.y,N=n.i.x,L=n.i.y),d=bez.getEasingCurve(P,_,N,L)("",i-n.t,0,1,o.t-n.t)),t.i){var a={i:[],o:[],v:[]};t.i.forEach(function(i,r){var s=[],o=[],h=[];i.forEach(function(a,i){1===n.h?(s.push(a),o.push(t.o[r][i]),h.push(t.v[r][i])):(s.push(a+(n.e[e].i[r][i]-a)*d),o.push(t.o[r][i]+(n.e[e].o[r][i]-t.o[r][i])*d),h.push(t.v[r][i]+(n.e[e].v[r][i]-t.v[r][i])*d))}),a.i.push(s),a.o.push(o),a.v.push(h)}),l.push(a)}else l.push(1===n.h?t:t+(n.e[e]-t)*d)})}s.push(l),M=!0,k!=h&&(k=h,D=0);break}h+=1}0==M&&(n=t[t.length-2],l=[],n.e.forEach(function(t){l.push(t)}),s.push(l))}for(h=s.length;e>h;)s.push(l),h+=1;return s}function o(t,e,a,i){var r,s,n,o,h,m;if(!t.length)return"p"==i.type?(x.px=t,x.py=t,i.threed&&(x.pz=t)):"s"==i.type?(x.sx=t,x.sy=t,i.threed&&(x.sz=t)):"r"==i.type&&(x.r=t),i.toArray?[t]:t;if(null==t[0].t)return"p"==i.type?(x.px=t[0],x.py=t[1],i.threed&&(x.pz=t[2])):"s"==i.type?(x.sx=t[0],x.sy=t[1],i.threed&&(x.sz=t[2])):"r"==i.type&&(x.r=t[0]),t;h=0,m=t.length-1;for(var p=1,l=!0;!(!l||(r=t[h],s=t[h+1],h==m-1&&e>=s.t-a)||s.t-a>e&&1==p);){if(s.t-a<e&&-1==p){h+=1,r=t[h],s=t[h+1];break}m-1>h&&1==p||h>0&&-1==p?h+=p:l=!1}r.to&&!r.bezierData&&bez.buildBezierData(r);var d,c,u,f,y=0;if("default"==i.type&&(n=[]),r.to){if(o=r.bezierData,e>=s.t-a)return"p"==i.type?(x.px=o.points[o.points.length-1].point[0],x.py=o.points[o.points.length-1].point[1],i.threed&&(x.pz=o.points[o.points.length-1].point[2])):"s"==i.type?(x.sx=o.points[o.points.length-1].point[0],x.sy=o.points[o.points.length-1].point[1],i.threed&&(x.pz=o.points[o.points.length-1].point[2])):"r"==i.type&&(x.r=o.points[o.points.length-1].point[0]),o.points[o.points.length-1].point;if(e<r.t-a)return"p"==i.type?(x.px=o.points[0].point[0],x.py=o.points[0].point[1],i.threed&&(x.pz=o.points[0].point[2])):"s"==i.type?(x.sx=o.points[0].point[0],x.sy=o.points[0].point[1],i.threed&&(x.sz=o.points[0].point[2])):"r"==i.type&&(x.r=o.points[0].point[0]),o.points[0].point;var g;r.__fnct?g=r.__fnct:(g=bez.getEasingCurve(r.o.x,r.o.y,r.i.x,r.i.y,r.n),r.__fnct=g),u=g("",e-(r.t-a),0,1,s.t-a-(r.t-a));var v,E=o.segmentLength*u,b=0;p=1,l=!0;for(var f=o.points.length;l;){if(b+=o.points[y].partialLength*p,0==E||0==u){"p"==i.type?(x.px=o.points[y].point[0],x.py=o.points[y].point[1],i.threed&&(x.pz=o.points[y].point[2])):"s"==i.type?(x.sx=o.points[y].point[0],x.sy=o.points[y].point[1],i.threed&&(x.sz=o.points[y].point[2])):"r"==i.type?x.r=o.points[y].point[0]:n=o.points[y].point;break}if(y==o.points.length-1){"p"==i.type?(x.px=o.points[y].point[0],x.py=o.points[y].point[1],i.threed&&(x.pz=o.points[y].point[2])):"s"==i.type?(x.sx=o.points[y].point[0],x.sy=o.points[y].point[1],i.threed&&(x.sz=o.points[y].point[2])):"r"==i.type?x.r=o.points[y].point[0]:n=o.points[y].point;break}if(E>b&&E<b+o.points[y+1].partialLength){if(v=(E-b)/o.points[y+1].partialLength,"p"==i.type)x.px=o.points[y].point[0]+(o.points[y+1].point[0]-o.points[y].point[0])*v,x.py=o.points[y].point[1]+(o.points[y+1].point[1]-o.points[y].point[1])*v,i.threed&&(x.pz=o.points[y].point[2]+(o.points[y+1].point[2]-o.points[y].point[2])*v);else if("s"==i.type)x.sx=o.points[y].point[0]+(o.points[y+1].point[0]-o.points[y].point[0])*v,x.sy=o.points[y].point[1]+(o.points[y+1].point[1]-o.points[y].point[1])*v,i.threed&&(x.sz=o.points[y].point[2]+(o.points[y+1].point[2]-o.points[y].point[2])*v);else if("r"==i.type)x.r=o.points[y].point[0]+(o.points[y+1].point[0]-o.points[y].point[0])*v;else for(c=o.points[y].point.length,d=0;c>d;d+=1)n.push(o.points[y].point[d]+(o.points[y+1].point[d]-o.points[y].point[d])*v);break}f-1>y&&1==p||y>0&&-1==p?y+=p:l=!1}}else{var C,S,I,A,F=!1;for(m=r.s.length,h=0;m>h;h+=1){if(1!==r.h){r.o.x instanceof Array?(F=!0,C=r.o.x[h]?r.o.x[h]:r.o.x[0],S=r.o.y[h]?r.o.y[h]:r.o.y[0],I=r.i.x[h]?r.i.x[h]:r.i.x[0],A=r.i.y[h]?r.i.y[h]:r.i.y[0],r.__fnct||(r.__fnct=[])):(F=!1,C=r.o.x,S=r.o.y,I=r.i.x,A=r.i.y);var g;F?r.__fnct[h]?g=r.__fnct[h]:(g=bez.getEasingCurve(C,S,I,A),r.__fnct[h]=g):r.__fnct?g=r.__fnct:(g=bez.getEasingCurve(C,S,I,A),r.__fnct=g),u=g("",e-(r.t-a),0,1,s.t-a-(r.t-a)),e>=s.t-a?u=1:e<r.t-a&&(u=0)}1===r.h?"p"==i.type?0==h?x.px=r.s[h]:1==h&&(x.py=r.s[h]):"s"==i.type?0==h?x.sx=r.s[h]:1==h&&(x.sy=r.s[h]):"r"==i.type?x.r=r.s[h]:n.push(r.s[h]):"p"==i.type?0==h?x.px=r.s[h]+(r.e[h]-r.s[h])*u:1==h&&(x.py=r.s[h]+(r.e[h]-r.s[h])*u):"s"==i.type?0==h?x.sx=r.s[h]+(r.e[h]-r.s[h])*u:1==h&&(x.sy=r.s[h]+(r.e[h]-r.s[h])*u):"r"==i.type?x.r=r.s[h]+(r.e[h]-r.s[h])*u:n.push(r.s[h]+(r.e[h]-r.s[h])*u)}}return n}function h(t,e,a,i,r){var s={};s.closed=r?t.cl:t.closed;var n=r?t.pt:t.ks;if(n.v)return"svg"==i?(n.__pathString||(n.__pathString=m(n,s.closed)),s.pathString=n.__pathString):s.pathNodes=n,s;var o,h,p,l,d,c,u,t={i:[],o:[],v:[]},f=[];if(e<n[0].t-a){for(h=n[0].s[0].i.length,o=0;h>o;o+=1){for(d=[],c=[],u=[],l=n[0].s[0].i[o].length,p=0;l>p;p+=1)d.push(n[0].s[0].i[o][p]),c.push(n[0].s[0].o[o][p]),u.push(n[0].s[0].v[o][p]);t.i.push(d),t.o.push(c),t.v.push(u)}return f.push(t),"svg"==i?(n.__minValue||(n.__minValue=m(f,s.closed)),s.pathString=n.__minValue):(n.__minValue||(n.__minValue=f),s.pathNodes=n.__minValue),s}if(e>n[n.length-1].t-a){var y=n.length-2;for(h=n[y].s[0].i.length,o=0;h>o;o+=1){for(d=[],c=[],u=[],l=n[y].s[0].i[o].length,p=0;l>p;p+=1)d.push(n[y].e[0].i[o][p]),c.push(n[y].e[0].o[o][p]),u.push(n[y].e[0].v[o][p]);t.i.push(d),t.o.push(c),t.v.push(u)}return f.push(t),"svg"==i?(n.__maxValue||(n.__maxValue=m(f,s.closed)),s.pathString=n.__maxValue):(n.__maxValue||(n.__maxValue=f),s.pathNodes=n.__maxValue),s}for(var g,v,E=0,x=n.length-1,b=1,C=!0;C&&(g=n[E],v=n[E+1],!(v.t-a>e&&1==b));)x-1>E&&1==b||E>0&&-1==b?E+=b:C=!1;var S,I,A,F,w;if(1!==g.h){S=g.o.x,I=g.o.y,A=g.i.x,F=g.i.y;var k;g.__fnct?k=g.__fnct:(k=bez.getEasingCurve(S,I,A,F),g.__fnct=k),w=k("",e-(g.t-a),0,1,v.t-a-(g.t-a)),e>=v.t-a?w=1:e<g.t-a&&(w=0)}if(1===g.h&&g.__hValue)f.push(g.__hValue);else for(t={i:[],o:[],v:[]},h=g.s[0].i.length,o=0;h>o;o+=1){for(d=[],c=[],u=[],l=g.s[0].i[o].length,p=0;l>p;p+=1)1===g.h?(d.push(g.s[0].i[o][p]),c.push(g.s[0].o[o][p]),u.push(g.s[0].v[o][p])):(d.push(g.s[0].i[o][p]+(g.e[0].i[o][p]-g.s[0].i[o][p])*w),c.push(g.s[0].o[o][p]+(g.e[0].o[o][p]-g.s[0].o[o][p])*w),u.push(g.s[0].v[o][p]+(g.e[0].v[o][p]-g.s[0].v[o][p])*w));t.i.push(d),t.o.push(c),t.v.push(u),1===g.h&&(g.__hValue=t),f.push(t)}return"svg"==i?s.pathString=m(f[0],s.closed):s.pathNodes=f[0],s}function m(t,e){var a,i,r,s,n,o,h,m,p,l="";if(!(t instanceof Array)){for(a=t.v,i=t.o,r=t.i,o=a.length,l+="M"+a[0][0]+","+a[0][1],n=1;o>n;n++)h=i[n-1],m=r[n],p=a[n],l+=" C"+h[0]+","+h[1]+" "+m[0]+","+m[1]+" "+p[0]+","+p[1];return e!==!1&&(h=i[n-1],m=r[0],p=a[0],l+=" C"+h[0]+","+h[1]+" "+m[0]+","+m[1]+" "+p[0]+","+p[1]),l}var d,c=t.length;for(l="",d=0;c>d;d+=1){for(s=t[d],a=s.v,i=s.o,r=s.i,o=a.length,l+="M"+a[0][0]+","+a[0][1],n=1;o>n;n++)h=i[n-1],m=r[n],p=a[n],l+=" C"+h[0]+","+h[1]+" "+m[0]+","+m[1]+" "+p[0]+","+p[1];e!==!1&&(h=i[n-1],m=r[0],p=a[0],l+=" C"+h[0]+","+h[1]+" "+m[0]+","+m[1]+" "+p[0]+","+p[1])}return l}function p(t,e,a){var i,r,s,n,m,d,c,u,f,g,v,b,C,S,I,A,F,w,k,D={},M=t.length;for(w=0;M>w;w+=1)if(k=t[w],C=e-k.startTime,!k.an[C]){if(i={},E.arrayFlag=!1,E.type="default",E.threed="threed"==a,i.a=o(k.ks.a,C,k.startTime,E),i.o=o(k.ks.o,C,k.startTime,E),E.arrayFlag=!1,E.type="p",o(k.ks.p,C,k.startTime,E),E.arrayFlag=!0,E.type="s",o(k.ks.s,C,k.startTime,E),"threed"!=a||k.threeD!==!0&&"CameraLayer"!=k.type?(E.arrayFlag=!0,E.type="r",o(k.ks.r,C,k.startTime,E)):(E.arrayFlag=!0,E.type="default",x.rx=o(k.ks.rx,C,k.startTime,E),x.rx=x.rx instanceof Array?x.rx[0]:x.rx,x.ry=o(k.ks.ry,C,k.startTime,E),x.ry=x.ry instanceof Array?x.ry[0]:x.ry,x.rz=o(k.ks.rz,C,k.startTime,E),x.rz=x.rz instanceof Array?x.rz[0]:x.rz),A={},A.an={tr:i},E.arrayFlag=!1,E.type="default","canvas"==a?A.an.matrixArray=y.getMatrixArrayFromParams(x.r,x.sx,x.sy,x.px,x.py):"threed"==a?"CameraLayer"==k.type?(A.an.matrixValue=y.getMatrix3FromParams(x.rx,x.ry,x.rz,x.sx,x.sy,x.sz,x.px,x.py,-x.pz)+" translate3d("+-i.a[0]+"px, "+-i.a[1]+"px, 0)",A.an.cameraValue=y.getMatrix3FromParams(-x.rx,-x.ry,x.rz,x.sx,x.sy,x.sz,-x.px,-x.py,k.pe+x.pz)+" translate3d("+i.a[0]+"px, "+i.a[1]+"px, 0)"):k.threeD?A.an.matrixValue=y.getAnchoredMatrix3FromParams(x.rx,x.ry,x.rz,x.sx,x.sy,x.sz,x.px,x.py,x.pz,i.a[0],i.a[1],0):A.an.matrixArray=y.getMatrixArrayFromParams(x.r,x.sx,x.sy,x.px,x.py):A.an.matrixValue=y.getMatrix2FromParams(x.r,x.sx,x.sy,x.px,x.py)+"translate("+-i.a[0]+" "+-i.a[1]+")",k.renderedData[C]=A,k.hasMask)for(r=k.masksProperties,I=r.length,S=0;I>S;S+=1)r[S].paths||(r[S].paths=[],r[S].opacity=[]),r[S].paths[C]=h(r[S],C,k.startTime,a,!0),r[S].opacity[C]=o(r[S].o,C,k.startTime,E),r[S].opacity[C]=r[S].opacity[C]instanceof Array?r[S].opacity[C][0]/100:r[S].opacity[C]/100;if(!(e<k.inPoint||e>k.outPoint))if("PreCompLayer"==k.type)e<k.inPoint||e>k.outPoint||(s=k.tm?k.tm[C]<0?0:k.tm[C]:C,p(k.layers,s,a));else if("ShapeLayer"==k.type)for(I=k.shapes.length,S=0;I>S;S+=1){if(F={},n=k.shapes[S],n.renderedData[C]=F,n._created||(n.an.tr=[],n.an.renderedFrame={},n.ks?n.an.path=[]:n.el?n.an.ell=[]:n.rc&&(n.an.rect=[]),n.fl&&(n.an.fill=[]),n.st&&(n.an.stroke=[])),n.trim&&!n._created&&(n.trim.an=[]),n.fl&&(d=o(n.fl.c,C,k.startTime,E),m=o(n.fl.o,C,k.startTime,E),F.fill={opacity:m instanceof Array?m[0]:m},"canvas"==a||"threed"==a&&k.threeD===!1?(l(d),F.fill.color=d):F.fill.color=rgbToHex(Math.round(d[0]),Math.round(d[1]),Math.round(d[2]))),n.ks){var T=a;"threed"==T&&(T=k.threeD===!0?"svg":"canvas"),F.path=h(n,C,k.startTime,T)}else n.el?(g=o(n.el.p,C,k.startTime,E),v=o(n.el.s,C,k.startTime,E),F.ell={p:g,size:v}):n.rc&&(g=o(n.rc.p,C,k.startTime,E),v=o(n.rc.s,C,k.startTime,E),b=o(n.rc.r,C,k.startTime,E),F.rect={position:g,size:v,roundness:b});if(n.st&&(c=o(n.st.c,C,k.startTime,E),u=o(n.st.o,C,k.startTime,E),f=o(n.st.w,C,k.startTime,E),F.stroke={opacity:u instanceof Array?u[0]:u,width:f instanceof Array?f[0]:f},"canvas"==a||"threed"==a&&k.threeD===!1?(l(c),F.stroke.color=c):F.stroke.color=rgbToHex(Math.round(c[0]),Math.round(c[1]),Math.round(c[2]))),D={},D.a=o(n.tr.a,C,k.startTime,E),D.o=o(n.tr.o,C,k.startTime,E),E.arrayFlag=!0,E.type="s",o(n.tr.s,C,k.startTime,E),E.arrayFlag=!0,E.type="r",o(n.tr.r,C,k.startTime,E),E.arrayFlag=!1,E.type="p",o(n.tr.p,C,k.startTime,E),E.arrayFlag=!1,E.type="default","canvas"==a||"threed"==a&&k.threeD===!1?D.mtArr=y.getMatrixArrayFromParams(x.r,x.sx,x.sy,x.px,x.py):D.mt=y.getMatrix2FromParams(x.r,x.sx,x.sy,x.px,x.py),n.an.tr[C]=D,F.tr=D,n.trim){var V=o(n.trim.s,C,k.startTime,E),z=o(n.trim.e,C,k.startTime,E),P=o(n.trim.o,C,k.startTime,E);F.trim={s:V,e:z,o:P}}n._created||(n._created=!0)}}}function l(t){var e,a=t.length;for(e=0;a>e;e+=1)t[e]=Math.round(t[e])}function d(t,e){for(var a=1;a>0;){if(e+=1,e>=t.data.animation.totalFrames){t.renderFinished=!0;break}t.renderedFrames[e]||(c(t.data._id,e),a-=1)}}function c(t,e){return 2==g[t].renderedFrames[e]?void(g[t].renderFinished||d(g[t],e)):(g[t].renderedFrames[e]=2,void p(g[t].data.animation.layers,e,g[t].data._animType))}function u(t){var e,a=g[t].data,i=a.animation.totalFrames,r=[];for(e=0;i>e;e+=1)r.push({num:e,data:c(t,e)})}var f=0,y=new MatrixManager,g={},v=Math.PI/180,E={arrayFlag:!1},x={r:0,rx:0,ry:0,rz:0,sx:1,sy:1,sz:1,px:0,py:0,pz:0},b={};return b.completeData=r,b.renderFrame=c,b.renderAllFrames=u,b}function SVGRenderer(t){this.animationItem=t,this.layers=null,this.lastFrame=-1}function CanvasRenderer(t,e){this.animationItem=t,this.renderConfig=e?e:{clearCanvas:!0,context:null,scaleMode:"fit"},this.lastFrame=-1}function DOMRenderer(t){this.animationItem=t,this.layers=null,this.camera=null}function MaskElement(){this.data=null,this.element=null,this.paths=[]}function ICompElement(t,e){this.parent.constructor.call(this,t,e),this.layers=t.layers}function IImageElement(t,e){this.animationItem=e,this.assets=this.animationItem.getAssets(),this.path=this.animationItem.getPath(),this.parent.constructor.call(this,t,e)}function IShapeElement(t,e){this.shapes=[],this.parent.constructor.call(this,t,e)}function ShapeItemElement(t){this.data=t,this.shapeG=document.createElementNS(svgNS,"g"),this.pathLength=0,this.cachedData=[],this.renderedFrame={path:"",stroke:{},fill:{},tr:{a:[]},trim:{},ellipse:{},rect:{}},"pathShape"===this.data.type?this.shape=document.createElementNS(svgNS,"path"):"rectShape"===this.data.type?this.shape=document.createElementNS(svgNS,"rect"):"ellipseShape"===this.data.type?(this.shape=document.createElementNS(svgNS,"ellipse"),this.data.trim&&this.adjustTrim()):this.shape=document.createElementNS(svgNS,"path"),this.data.trim?this.shape.setAttribute("stroke-linecap","round"):(this.shape.setAttribute("stroke-linejoin","round"),this.shape.setAttribute("stroke-linecap","round")),this.data.renderedData||(this.data.renderedData={}),this.shape.setAttribute("name",this.data.name),styleUnselectableDiv(this.shapeG),styleUnselectableDiv(this.shape),this.shapeG.appendChild(this.shape)}function ISolidElement(t,e){this.parent.constructor.call(this,t,e)}function ITextElement(t,e){this.parent.constructor.call(this,t,e)}function CVBaseElement(t,e){this.renderer=e,this.data=t,this.currentAnimData=null,this.renderFrame=!1,this.init()}function CVCompElement(t,e){this.parent.constructor.call(this,t,e),this.layers=t.layers}function CVImageElement(t,e){this.renderer=e,this.animationItem=e.animationItem,this.assets=this.animationItem.getAssets(),this.path=this.animationItem.getPath(),this.parent.constructor.call(this,t,e),this.animationItem.pendingElements+=1}function CVShapeElement(t,e){this.shapes=[],this.parent.constructor.call(this,t,e)}function CVShapeItemElement(t,e){this.data=t,this.renderer=e,this.frameNum=-1,this.renderedPaths={},this.trims=[]}function CVSolidElement(t,e){this.parent.constructor.call(this,t,e)}function CVTextElement(t,e){this.parent.constructor.call(this,t,e)}function CVMaskElement(){}function DImageElement(t,e){this.animationItem=e,this.assets=this.animationItem.getAssets(),this.path=this.animationItem.getPath(),this.parent.constructor.call(this,t,e)}function DShapeElement(t,e){this.shapes=[],this.parent.constructor.call(this,t,e)}function DSolidElement(t,e){this.parent.constructor.call(this,t,e)}function DCompElement(t,e){this.layers=t.layers,t.threeDComp=!1,this.parent.constructor.call(this,t,e)}var svgNS="http://www.w3.org/2000/svg";Matrix.prototype={concat:function(t){return this.clone()._t(t.a,t.b,t.c,t.d,t.e,t.f)},flipX:function(){return this._t(-1,0,0,1,0,0)},flipY:function(){return this._t(1,0,0,-1,0,0)},reflectVector:function(t,e){var a=this.applyToPoint(0,1),i=2*(a.x*t+a.y*e);return t-=i*a.x,e-=i*a.y,{x:t,y:e}},reset:function(){return"2d"==this.dimension?this.setTransform(1,0,0,1,0,0):this.setTransform(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},rotate:function(t){return 0==t?this:(this.cos=Math.cos(t),this.sin=Math.sin(t),this._t(this.cos,this.sin,-this.sin,this.cos,0,0))},rotateX:function(t){return 0==t?this:(this.cos=Math.cos(t),this.sin=Math.sin(t),this._t(1,0,0,0,0,this.cos,-this.sin,0,0,this.sin,this.cos,0,0,0,0,1))},rotateY:function(t){return 0==t?this:(this.cos=Math.cos(t),this.sin=Math.sin(t),this._t(this.cos,0,this.sin,0,0,1,0,0,-this.sin,0,this.cos,0,0,0,0,1))},rotateZ:function(t){return 0==t?this:(this.cos=Math.cos(t),this.sin=Math.sin(t),this._t(this.cos,-this.sin,0,0,this.sin,this.cos,0,0,0,0,1,0,0,0,0,1))},rotateFromVector:function(t,e){return this.rotate(Math.atan2(e,t))},rotateDeg:function(t){return this.rotate(t*Math.PI/180)},scaleU:function(t){return this._t(t,0,0,t,0,0)},scale:function(t,e,a){return 1!=t||1!=e||1!=a&&null!=a?"2d"==this.dimension?this._t(t,0,0,e,0,0):this._t(t,0,0,0,0,e,0,0,0,0,a,0,0,0,0,1):this},scaleX:function(t){return"2d"==this.dimension?this._t(t,0,0,1,0,0):this._t(t,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},scaleY:function(t){return"2d"==this.dimension?this._t(1,0,0,t,0,0):this._t(1,0,0,0,0,t,0,0,0,0,1,0,0,0,0,1)},scaleZ:function(t){return this._t(1,0,0,0,0,1,0,0,0,0,t,0,0,0,0,1)},shear:function(t,e){return this._t(1,e,t,1,0,0)},shearX:function(t){return this._t(1,0,t,1,0,0)},shearY:function(t){return this._t(1,t,0,1,0,0)},skew:function(t,e){return this.shear(Math.tan(t),Math.tan(e))},skewX:function(t){return this.shearX(Math.tan(t))},skewY:function(t){return this.shearY(Math.tan(t))},setTransform:function(t,e,a,i,r,s,n,o,h,m,p,l,d,c,u,f){return this.props[0]=t,this.props[1]=e,this.props[2]=a,this.props[3]=i,this.props[4]=r,this.props[5]=s,"3d"==this.dimension&&(this.props[6]=n,this.props[7]=o,this.props[8]=h,this.props[9]=m,this.props[10]=p,this.props[11]=l,this.props[12]=d,this.props[13]=c,this.props[14]=u,this.props[15]=f),this},translate:function(t,e,a){return"2d"==this.dimension?this._t(1,0,0,1,t,e):this._t(1,0,0,0,0,1,0,0,0,0,1,0,t,e,a,1)},translateX:function(t){return"2d"==this.dimension?this._t(1,0,0,1,t,0):this._t(1,0,0,0,0,1,0,0,0,0,1,0,t,0,0,1)},translateY:function(t){return"2d"==this.dimension?this._t(1,0,0,1,0,t):this._t(1,0,0,0,0,1,0,0,0,0,1,0,0,t,0,1)},translateY:function(){return this._t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,tz,1)},transform:function(t,e,a,i,r,s,n,o,h,m,p,l,d,c,u,f){return this.a1=this.props[0],this.b1=this.props[1],this.c1=this.props[2],this.d1=this.props[3],this.e1=this.props[4],this.f1=this.props[5],"3d"==this.dimension&&(this.g1=this.props[6],this.h1=this.props[7],this.i1=this.props[8],this.j1=this.props[9],this.k1=this.props[10],this.l1=this.props[11],this.m1=this.props[12],this.n1=this.props[13],this.o1=this.props[14],this.p1=this.props[15]),"2d"==this.dimension?(this.props[0]=this.a1*t+this.c1*e,this.props[1]=this.b1*t+this.d1*e,this.props[2]=this.a1*a+this.c1*i,this.props[3]=this.b1*a+this.d1*i,this.props[4]=this.a1*r+this.c1*s+this.e1,this.props[5]=this.b1*r+this.d1*s+this.f1):(this.props[0]=this.a1*t+this.b1*r+this.c1*h+this.d1*d,this.props[1]=this.a1*e+this.b1*s+this.c1*m+this.d1*c,this.props[2]=this.a1*a+this.b1*n+this.c1*p+this.d1*u,this.props[3]=this.a1*i+this.b1*o+this.c1*l+this.d1*f,this.props[4]=this.e1*t+this.f1*r+this.g1*h+this.h1*d,this.props[5]=this.e1*e+this.f1*s+this.g1*m+this.h1*c,this.props[6]=this.e1*a+this.f1*n+this.g1*p+this.h1*u,this.props[7]=this.e1*i+this.f1*o+this.g1*l+this.h1*f,this.props[8]=this.i1*t+this.j1*r+this.k1*h+this.l1*d,this.props[9]=this.i1*e+this.j1*s+this.k1*m+this.l1*c,this.props[10]=this.i1*a+this.j1*n+this.k1*p+this.l1*u,this.props[11]=this.i1*i+this.j1*o+this.k1*l+this.l1*f,this.props[12]=this.m1*t+this.n1*r+this.o1*h+this.p1*d,this.props[13]=this.m1*e+this.n1*s+this.o1*m+this.p1*c,this.props[14]=this.m1*a+this.n1*n+this.o1*p+this.p1*u,this.props[15]=this.m1*i+this.n1*o+this.o1*l+this.p1*f),this._x()},divide:function(t){if(!t.isInvertible())throw"Input matrix is not invertible";var e=t.inverse();return this._t(e.a,e.b,e.c,e.d,e.e,e.f)},divideScalar:function(t){var e=this;return e.a/=t,e.b/=t,e.c/=t,e.d/=t,e.e/=t,e.f/=t,e._x()},inverse:function(){if(this.isIdentity())return new Matrix;if(this.isInvertible()){var t=this,e=t.a,a=t.b,i=t.c,r=t.d,s=t.e,n=t.f,o=new Matrix,h=e*r-a*i;return o.a=r/h,o.b=-a/h,o.c=-i/h,o.d=e/h,o.e=(i*n-r*s)/h,o.f=-(e*n-a*s)/h,o}throw"Matrix is not invertible."},interpolate:function(t,e,a){var i=this,r=a?new Matrix(a):new Matrix;return r.a=i.a+(t.a-i.a)*e,r.b=i.b+(t.b-i.b)*e,r.c=i.c+(t.c-i.c)*e,r.d=i.d+(t.d-i.d)*e,r.e=i.e+(t.e-i.e)*e,r.f=i.f+(t.f-i.f)*e,r._x()},interpolateAnim:function(t,e,a){var i=this,r=a?new Matrix(a):new Matrix,s=i.decompose(),n=t.decompose(),o=s.rotation+(n.rotation-s.rotation)*e,h=s.translate.x+(n.translate.x-s.translate.x)*e,m=s.translate.y+(n.translate.y-s.translate.y)*e,p=s.scale.x+(n.scale.x-s.scale.x)*e,l=s.scale.y+(n.scale.y-s.scale.y)*e;return r.translate(h,m),r.rotate(o),r.scale(p,l),r._x()},decompose:function(t){var e=this,a=e.a,i=e.b,r=e.c,s=e.d,n=Math.acos,o=Math.atan,h=Math.sqrt,m=Math.PI,p={x:e.e,y:e.f},l=0,d={x:1,y:1},c={x:0,y:0},u=a*s-i*r;if(t)a?(c={x:o(r/a),y:o(i/a)},d={x:a,y:u/a}):i?(l=.5*m,d={x:i,y:u/i},c.x=o(s/i)):(d={x:r,y:s},c.x=.25*m);else if(a||i){var f=h(a*a+i*i);l=i>0?n(a/f):-n(a/f),d={x:f,y:u/f},c.x=o((a*r+i*s)/(f*f))}else if(r||s){var y=h(r*r+s*s);l=.5*m-(s>0?n(-r/y):-n(r/y)),d={x:u/y,y:y},c.y=o((a*r+i*s)/(y*y))}else d={x:0,y:0};return{scale:d,translate:p,rotation:l,skew:c}},determinant:function(){return this.a*this.d-this.b*this.c},applyToPoint:function(t,e){var a=this;return{x:t*a.a+e*a.c+a.e,y:t*a.b+e*a.d+a.f}},applyToArray:function(t){var e,a,i=0,r=[];if("number"==typeof t[0])for(a=t.length;a>i;)e=this.applyToPoint(t[i++],t[i++]),r.push(e.x,e.y);else for(;e=t[i];i++)r.push(this.applyToPoint(e.x,e.y));return r},applyToTypedArray:function(t,e){for(var a,i=0,r=t.length,s=e?new Float64Array(r):new Float32Array(r);r>i;)a=this.applyToPoint(t[i],t[i+1]),s[i++]=a.x,s[i++]=a.y;return s},applyToContext:function(t){var e=this;return t.setTransform(e.a,e.b,e.c,e.d,e.e,e.f),e},isIdentity:function(){var t=this;return t._q(t.a,1)&&t._q(t.b,0)&&t._q(t.c,0)&&t._q(t.d,1)&&t._q(t.e,0)&&t._q(t.f,0)},isInvertible:function(){return!this._q(this.determinant(),0)},isValid:function(){return!this._q(this.a*this.d,0)},clone:function(t){var e=this,a=new Matrix;return a.a=e.a,a.b=e.b,a.c=e.c,a.d=e.d,a.e=e.e,a.f=e.f,t||(a.context=e.context),a},isEqual:function(t){var e=this,a=e._q;return a(e.a,t.a)&&a(e.b,t.b)&&a(e.c,t.c)&&a(e.d,t.d)&&a(e.e,t.e)&&a(e.f,t.f)},toArray:function(){return"2d"==this.dimension?[this.props[0],this.props[1],this.props[2],this.props[3],this.props[4],this.props[5]]:[this.props[0],this.props[1],this.props[2],this.props[3],this.props[4],this.props[5],this.props[6],this.props[7],this.props[8],this.props[9],this.props[10],this.props[11],this.props[12],this.props[13],this.props[14],this.props[15]]},toCSS:function(){return"2d"==this.dimension?(this.cssParts[1]=this.props.join(","),this.cssParts.join("")):(this.cssParts3d[1]=this.props.join(","),this.cssParts3d.join(""))},toJSON:function(){var t=this;return'{"a":'+t.a+',"b":'+t.b+',"c":'+t.c+',"d":'+t.d+',"e":'+t.e+',"f":'+t.f+"}"},toString:function(){return""+this.toArray()},_q:function(t,e){return Math.abs(t-e)<1e-14},_x:function(){return this}};var MatrixManager=matrixManagerFunction;!function(){for(var t=0,e=["ms","moz","webkit","o"],a=0;a<e.length&&!window.requestAnimationFrame;++a)window.requestAnimationFrame=window[e[a]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[a]+"CancelAnimationFrame"]||window[e[a]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var a=(new Date).getTime(),i=Math.max(0,16-(a-t)),r=window.setTimeout(function(){e(a+i)},i);return t=a+i,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();var subframeEnabled=!1,supportsPath2D="function"==typeof Path2D,cachedColors={},colorMap=[],body,fillColorToString=function(){var t=[];return function(e,a){return t[e[0]]||(t[e[0]]=[]),t[e[0]][e[1]]||(t[e[0]][e[1]]=[]),t[e[0]][e[1]][e[2]]||(void 0!=a&&(e[3]=a),t[e[0]][e[1]][e[2]]="rgba("+e.join(",")+")"),t[e[0]][e[1]][e[2]]}}();createColorMap(),function(t){function e(){this.commandArrays=[]}void 0==CanvasRenderingContext2D.prototype.ellipse&&(CanvasRenderingContext2D.prototype.ellipse=function(t,e,a,i,r,s,n,o){this.save(),this.translate(t,e),this.rotate(r),this.scale(a,i),this.arc(0,0,1,s,n,o),this.restore()}),supportsPath2D||(e.prototype.moveTo=function(t,e){this.commandArrays.push({type:"move",coord:[t,e]})},e.prototype.lineTo=function(t,e){this.commandArrays.push({type:"line",coord:[t,e]})},e.prototype.bezierCurveTo=function(t,e,a,i,r,s){this.commandArrays.push({type:"bezierCurve",coord:[t,e,a,i,r,s]})},e.prototype.drawToContext=function(t){var e,a,i=this.commandArrays.length;
for(t.beginPath(),a=0;i>a;a+=1)switch(e=this.commandArrays[a],e.type){case"move":t.moveTo(e.coord[0],e.coord[1]);break;case"line":t.lineTo(e.coord[0],e.coord[1]);break;case"bezierCurve":t.bezierCurveTo(e.coord[0],e.coord[1],e.coord[2],e.coord[3],e.coord[4],e.coord[5])}},t.Path2D=e)}(window);var bez=bezFunction(),dataManager=dataFunctionManager();SVGRenderer.prototype.buildItems=function(t){var e,a=0,i=t.length;for(e=0;i>e;e++)"StillLayer"==t[e].type?(a++,this.createImage(t[e])):"PreCompLayer"==t[e].type?this.createComp(t[e]):"SolidLayer"==t[e].type?this.createSolid(t[e]):"ShapeLayer"==t[e].type?this.createShape(t[e]):"TextLayer"==t[e].type?this.createText(t[e]):console.log("NO TYPE: ",t[e])},SVGRenderer.prototype.createShape=function(t){t.element=new IShapeElement(t,this.animationItem)},SVGRenderer.prototype.createText=function(t){t.element=new ITextElement(t,this.animationItem)},SVGRenderer.prototype.createImage=function(t){t.element=new IImageElement(t,this.animationItem)},SVGRenderer.prototype.createComp=function(t){t.element=new ICompElement(t,this.animationItem),this.buildItems(t.layers)},SVGRenderer.prototype.createSolid=function(t){t.element=new ISolidElement(t,this.animationItem)},SVGRenderer.prototype.configAnimation=function(t){this.animationItem.container=document.createElementNS(svgNS,"svg"),this.animationItem.container.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.animationItem.container.setAttribute("width",t.animation.compWidth),this.animationItem.container.setAttribute("height",t.animation.compHeight),this.animationItem.container.setAttribute("viewBox","0 0 "+t.animation.compWidth+" "+t.animation.compHeight),this.animationItem.container.setAttribute("preserveAspectRatio","xMidYMid meet"),this.animationItem.container.style.width="100%",this.animationItem.container.style.height="100%",this.animationItem.container.style.transformOrigin=this.animationItem.container.style.mozTransformOrigin=this.animationItem.container.style.webkitTransformOrigin=this.animationItem.container.style["-webkit-transform"]="0px 0px 0px",this.animationItem.wrapper.appendChild(this.animationItem.container);var e=document.createElementNS(svgNS,"defs");this.animationItem.container.appendChild(e);var a=document.createElementNS(svgNS,"clipPath"),i=document.createElementNS(svgNS,"rect");i.setAttribute("width",t.animation.compWidth),i.setAttribute("height",t.animation.compHeight),i.setAttribute("x",0),i.setAttribute("y",0),a.setAttribute("id","animationMask"),a.appendChild(i);var r=document.createElementNS(svgNS,"g");r.setAttribute("clip-path","url(#animationMask)"),this.animationItem.container.appendChild(r),e.appendChild(a),this.animationItem.container=r,this.layers=t.animation.layers},SVGRenderer.prototype.buildStage=function(t,e){var a,i,r=e.length;for(a=r-1;a>=0;a--){if(i=e[a],i.parent){this.buildItemParenting(i,e,i.parent);var s=i.element.getDomElement();s.setAttribute("data-layer-name",i.layerName),t.appendChild(s),i.element.setMainElement(s)}else i.element.getDomElement().setAttribute("data-layer-name",i.layerName),t.appendChild(i.element.getDomElement()),i.element.setMainElement(i.element.getDomElement());"PreCompLayer"==i.type&&this.buildStage(i.element.getComposingElement(),i.layers,i.element.getType())}},SVGRenderer.prototype.buildItemParenting=function(t,e,a){t.parents||(t.parents=[]);for(var i=0,r=e.length;r>i;){if(e[i].layerName==a){t.parents.push({elem:e[i]}),e[i].parent&&this.buildItemParenting(t,e,e[i].parent);break}i+=1}},SVGRenderer.prototype.updateContainerSize=function(){},SVGRenderer.prototype.renderFrame=function(t){if(this.lastFrame!=t){this.lastFrame=t;var e,a=this.layers.length;for(e=0;a>e;e++)this.layers[e].element.prepareFrame(t-this.layers[e].startTime);for(e=0;a>e;e++)this.layers[e].element.renderFrame(t-this.layers[e].startTime)}},CanvasRenderer.prototype.buildItems=function(t){var e,a=0,i=t.length;for(e=0;i>e;e++)"StillLayer"==t[e].type?(a++,this.createImage(t[e])):"PreCompLayer"==t[e].type?this.createComp(t[e]):"SolidLayer"==t[e].type?this.createSolid(t[e]):"ShapeLayer"==t[e].type?this.createShape(t[e]):"TextLayer"==t[e].type?this.createText(t[e]):(this.createBase(t[e]),console.log("NO TYPE: ",t[e]))},CanvasRenderer.prototype.createBase=function(t){t.element=new CVBaseElement(t,this)},CanvasRenderer.prototype.createShape=function(t){t.element=new CVShapeElement(t,this)},CanvasRenderer.prototype.createText=function(t){t.element=new CVTextElement(t,this)},CanvasRenderer.prototype.createImage=function(t){t.element=new CVImageElement(t,this)},CanvasRenderer.prototype.createComp=function(t){t.element=new CVCompElement(t,this),this.buildItems(t.layers)},CanvasRenderer.prototype.createSolid=function(t){t.element=new CVSolidElement(t,this)},CanvasRenderer.prototype.configAnimation=function(t){this.animationItem.wrapper?(this.animationItem.container=document.createElement("canvas"),this.animationItem.container.style.width="100%",this.animationItem.container.style.height="100%",this.animationItem.container.style.transformOrigin=this.animationItem.container.style.mozTransformOrigin=this.animationItem.container.style.webkitTransformOrigin=this.animationItem.container.style["-webkit-transform"]="0px 0px 0px",this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d")):this.canvasContext=this.renderConfig.context,this.layers=t.animation.layers,this.transformCanvas={},this.transformCanvas.w=t.animation.compWidth,this.transformCanvas.h=t.animation.compHeight,this.updateContainerSize()},CanvasRenderer.prototype.updateContainerSize=function(){if(this.animationItem.wrapper&&this.animationItem.container){var t=this.animationItem.wrapper.offsetWidth,e=this.animationItem.wrapper.offsetHeight;this.animationItem.container.setAttribute("width",t),this.animationItem.container.setAttribute("height",e)}else var t=this.canvasContext.canvas.width,e=this.canvasContext.canvas.height;if("fit"==this.renderConfig.scaleMode){var a=t/e,i=this.transformCanvas.w/this.transformCanvas.h;i>a?(this.transformCanvas.sx=t/this.transformCanvas.w,this.transformCanvas.sy=t/this.transformCanvas.w,this.transformCanvas.tx=0,this.transformCanvas.ty=(e-this.transformCanvas.h*(t/this.transformCanvas.w))/2):(this.transformCanvas.sx=e/this.transformCanvas.h,this.transformCanvas.sy=e/this.transformCanvas.h,this.transformCanvas.tx=(t-this.transformCanvas.w*(e/this.transformCanvas.h))/2,this.transformCanvas.ty=0)}else this.transformCanvas.sx=1,this.transformCanvas.sy=1,this.transformCanvas.tx=0,this.transformCanvas.ty=0},CanvasRenderer.prototype.buildStage=function(t,e){var a,i,r=e.length;for(a=r-1;a>=0;a--)i=e[a],i.parent&&(i.parentHierarchy=[],this.buildItemHierarchy(i,e,i.parent)),"PreCompLayer"==i.type&&this.buildStage(null,i.layers)},CanvasRenderer.prototype.buildItemHierarchy=function(t,e,a){for(var i=0,r=e.length;r>i;){if(e[i].layerName==a){t.parentHierarchy.push(e[i]),void 0==e[i].parent||this.buildItemHierarchy(t,e,e[i].parent);break}i+=1}},CanvasRenderer.prototype.prepareFrame=function(t){var e,a=this.layers.length;for(e=0;a>e;e++)this.layers[e].element.prepareFrame(t-this.layers[e].startTime)},CanvasRenderer.prototype.draw=function(){var t,e=this.layers.length;for(t=e-1;t>=0;t-=1)this.layers[t].element.draw()},CanvasRenderer.prototype.renderFrame=function(t){this.lastFrame!=t&&(this.lastFrame=t,this.renderConfig.clearCanvas===!0?this.canvasContext.canvas.width=this.canvasContext.canvas.width:this.canvasContext.save(),this.canvasContext.transform(this.transformCanvas.sx,0,0,this.transformCanvas.sy,this.transformCanvas.tx,this.transformCanvas.ty),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.clip(),this.prepareFrame(t),this.draw(),this.renderConfig.clearCanvas!==!0&&this.canvasContext.restore())},DOMRenderer.prototype.buildItems=function(t){var e,a=0,i=t.length;for(e=0;i>e;e++)"StillLayer"==t[e].type?(a++,this.createImage(t[e])):"PreCompLayer"==t[e].type?this.createComp(t[e]):"SolidLayer"==t[e].type?this.createSolid(t[e]):"ShapeLayer"==t[e].type?this.createShape(t[e]):"TextLayer"==t[e].type?this.createText(t[e]):this.createBase(t[e])},DOMRenderer.prototype.createBase=function(t){t.element=new DBaseElement(t,this)},DOMRenderer.prototype.createShape=function(t){t.element=new DShapeElement(t,this.animationItem)},DOMRenderer.prototype.createText=function(t){t.element=new DTextElement(t,this.animationItem)},DOMRenderer.prototype.createImage=function(t){t.element=new DImageElement(t,this.animationItem)},DOMRenderer.prototype.createComp=function(t){t.element=new DCompElement(t,this.animationItem),t.threeDComp&&this.buildItems(t.layers)},DOMRenderer.prototype.createSolid=function(t){t.element=new DSolidElement(t,this.animationItem)},DOMRenderer.prototype.configAnimation=function(t){this.layers=t.animation.layers;for(var e=0,a=this.layers.length;a>e;){if("CameraLayer"==this.layers[e].type){this.camera=this.layers[e];break}e+=1}this.animationItem.wrapper.style.overflow="hidden",this.animationItem.wrapper.style.perspective=this.camera.pe+"px",this.animationItem.wrapper.style.transformStyle=this.animationItem.wrapper.style.webkitTransformStyle="preserve-3d",this.animationItem.wrapper.style.transformOrigin=this.animationItem.wrapper.style.mozTransformOrigin=this.animationItem.wrapper.style.webkitTransformOrigin=this.animationItem.wrapper.style["-webkit-transform"]="0 0 0",this.animationItem.container=document.createElement("div"),this.animationItem.container.style.transformOrigin=this.animationItem.container.style.mozTransformOrigin=this.animationItem.container.style.webkitTransformOrigin=this.animationItem.container.style["-webkit-transform"]="450px 275px "+this.camera.pe+"px",this.animationItem.container.style.transformStyle=this.animationItem.container.style.webkitTransformStyle="preserve-3d",this.animationItem.container.style.transform="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)",this.animationItem.container.style.position="absolute",this.animationItem.container.style.backfaceVisibility=this.animationItem.container.style.webkitBackfaceVisibility="hidden",this.animationItem.container.style.top=0,this.animationItem.container.style.left=0,this.animationItem.wrapper.appendChild(this.animationItem.container)},DOMRenderer.prototype.buildStage=function(t,e){var a,i,r=e.length;for(a=r-1;a>=0;a--)i=e[a],i.parent&&(i.parentHierarchy=[],this.buildItemHierarchy(i,e,i.parent)),"PreCompLayer"==i.type&&i.threeDComp&&this.buildStage(i.element.getComposingElement(),i.layers),t.appendChild(i.element.mainElement)},DOMRenderer.prototype.buildItemHierarchy=function(t,e,a){for(var i=0,r=e.length;r>i;){if(e[i].layerName==a){t.parentHierarchy.push(e[i]),void 0==e[i].parent||this.buildItemHierarchy(t,e,e[i].parent);break}i+=1}},DOMRenderer.prototype.updateContainerSize=function(){},DOMRenderer.prototype.renderCamera=function(){this.animationItem.container.style.transform=this.camera.element.currentAnimData.cameraValue},DOMRenderer.prototype.renderFrame=function(t){var e,a=this.layers.length;for(e=0;a>e;e++)this.layers[e].element.prepareFrame(t-this.layers[e].startTime);for(e=0;a>e;e++)this.layers[e].element.renderFrame(t-this.layers[e].startTime);this.renderCamera(t)},MaskElement.prototype.init=function(){this.registeredEffects=[],this.masksProperties=this.data.masksProperties,this.totalMasks=this.masksProperties.length;var t=this.element.maskingGroup,e=this.element.maskedElement,a=document.createElementNS(svgNS,"defs");t.appendChild(a);var i,r=this.masksProperties.length;this.layerSize=this.element.getLayerSize(),this.maskElement=document.createElementNS(svgNS,"clipPath");var s,n=this.data.masksProperties;for(i=0;r>i;i++)n[i].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),s=document.createElementNS(svgNS,"path"),n[i].cl?s.setAttribute("fill","#ffffff"):(s.setAttribute("fill","none"),s.setAttribute("stroke","#ffffff"),s.setAttribute("stroke-width","1"),s.setAttribute("stroke-miterlimit","10")),s.setAttribute("clip-rule","nonezero"),this.maskElement.appendChild(s),n[i].elem=s,n[i].lastPath="";var o=randomString(10);this.maskElement.setAttribute("id",o),e.setAttribute("clip-path","url(#"+o+")"),a.appendChild(this.maskElement)},MaskElement.prototype.renderFrame=function(t){var e,a=this.data.masksProperties.length;for(e=0;a>e;e++)this.drawPath(this.data.masksProperties[e],this.data.masksProperties[e].paths[t].pathString)},MaskElement.prototype.processMaskFromEffects=function(t,e){var a,i=this.registeredEffects.length;for(a=0;i>a;a++)this.registeredEffects[a].renderMask(t,e)},MaskElement.prototype.registerEffect=function(t){this.registeredEffects.push(t)},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var t="M0,0 ";return t+="h"+this.layerSize.w,t+="v"+this.layerSize.h,t+="h"+-this.layerSize.w,t+="v"+-this.layerSize.h},MaskElement.prototype.drawPath=function(t,e){t.lastPath!==e&&(t.inv?t.elem.setAttribute("d",this.solidPath+e):t.elem.setAttribute("d",e),t.lastPath=e)};var BaseElement=function(t,e){this.animationItem=e,this.data=t,this.transformChanged=!1,this.forceRender=!1,this.init()};BaseElement.prototype.init=function(){this.createElements(),this.data.hasMask&&this.addMasks(this.data),this.data.eff&&this.createEffectsManager(this.data)},BaseElement.prototype.createElements=function(){this.layerElement=document.createElementNS(svgNS,"g"),this.layerElement.setAttribute("id",this.data.layerName),this.maskingGroup=this.layerElement,this.maskedElement=this.layerElement},BaseElement.prototype.prepareFrame=function(t){this.currentAnimData=this.data.renderedData[t].an,this.data.renderedFrame.tr!==this.currentAnimData.matrixValue?(this.transformChanged=!0,this.data.renderedFrame.tr=this.currentAnimData.matrixValue):this.transformChanged=!1},BaseElement.prototype.renderFrame=function(t){if(this.data.inPoint-this.data.startTime<=t&&this.data.outPoint-this.data.startTime>t?this.isVisible!==!0&&(this.isVisible=!0,this.forceRender=!0,this.mainElement.setAttribute("opacity",1)):this.isVisible!==!1&&(this.isVisible=!1,this.mainElement.setAttribute("opacity",0)),this.data.eff&&this.effectsManager.renderFrame(t,this.currentAnimData.mk),t===this.data.renderedFrame.num)return this.isVisible;this.data.hasMask&&this.maskManager.renderFrame(t),this.data.renderedFrame.o!==this.currentAnimData.tr.o&&(this.data.renderedFrame.o=this.currentAnimData.tr.o,this.isVisible&&this.layerElement.setAttribute("opacity",this.currentAnimData.tr.o));var e="";if(this.data.parents){var a,i=!1,r=0,s=this.data.parents.length;if(this.transformChanged)i=!0;else for(;s>r;){if(this.data.parents[r].elem.element.transformChanged){i=!0;break}r+=1}if(i){for(r=s-1;r>=0;r-=1)a=this.data.parents[r].elem.element.currentAnimData,e+=a.matrixValue+" ";e+=this.currentAnimData.matrixValue,this.isVisible&&this.layerElement.setAttribute("transform",e),this.fullTransform=e}}else this.transformChanged&&(e+=this.currentAnimData.matrixValue,this.isVisible&&this.layerElement.setAttribute("transform",e),this.fullTransform=e);return this.forceRender&&(this.forceRender=!1,this.layerElement.setAttribute("opacity",this.currentAnimData.tr.o),this.layerElement.setAttribute("transform",this.fullTransform)),this.isVisible},BaseElement.prototype.getDomElement=function(){return this.layerElement},BaseElement.prototype.setMainElement=function(t){this.mainElement=t},BaseElement.prototype.getMaskManager=function(){return this.maskManager},BaseElement.prototype.addMasks=function(t){var e={data:{value:t},element:{value:this}};this.maskManager=createElement(MaskElement,null,e)},BaseElement.prototype.createEffectsManager=function(t){var e={effects:{value:t.eff},element:{value:this}};this.effectsManager=createElement(EffectsManager,null,e)},BaseElement.prototype.getType=function(){return this.type},BaseElement.prototype.getLayerSize=function(){return"TextLayer"==this.data.type?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}},createElement(BaseElement,ICompElement),ICompElement.prototype.createElements=function(){this.svgElem=document.createElementNS(svgNS,"g"),this.parent.createElements.call(this)},ICompElement.prototype.getComposingElement=function(){return this.layerElement},ICompElement.prototype.renderFrame=function(t){var e=this.parent.renderFrame.call(this,t);if(e!==!1){var a,i=this.layers.length,r=this.data.tm?this.data.tm[t]<0?0:this.data.tm[t]:t;for(a=0;i>a;a+=1)this.layers[a].element.prepareFrame(r-this.layers[a].startTime);for(a=0;i>a;a+=1)this.layers[a].element.renderFrame(r-this.layers[a].startTime)}},createElement(BaseElement,IImageElement),IImageElement.prototype.createElements=function(){var t=this,e=function(){t.image.setAttributeNS("http://www.w3.org/1999/xlink","href",t.path+t.assets[t.data.assetId].path),t.maskedElement=t.image,t.animationItem.elementLoaded()},a=new Image;a.addEventListener("load",e,!1),a.src=this.path+this.assets[this.data.assetId].path,this.svgElem=document.createElementNS(svgNS,"g"),this.parent.createElements.call(this),this.image=document.createElementNS(svgNS,"image"),this.image.setAttribute("width",this.data.width+"px"),this.image.setAttribute("height",this.data.height+"px"),this.svgElem.appendChild(this.image),this.layerElement.appendChild(this.svgElem),this.maskingGroup=this.svgElem,styleUnselectableDiv(this.image)},createElement(BaseElement,IShapeElement),IShapeElement.prototype.createElements=function(){this.parent.createElements.call(this);var t,e,a=this.data.shapes.length;for(t=a-1;t>=0;t--)this.data.trim&&(this.data.shapes[t].trim=this.data.trim),e=new ShapeItemElement(this.data.shapes[t]),this.layerElement.appendChild(e.getElement()),this.shapes.push(e)},IShapeElement.prototype.renderFrame=function(t){var e=this.parent.renderFrame.call(this,t);e!==!1&&this.renderShapes(t)},IShapeElement.prototype.renderShapes=function(t){var e,a,i,r=this.data.shapes.length;for(e=r-1;e>=0;e--)a=this.data.shapes[e],i=this.shapes[r-1-e],i.renderShape(t)},ShapeItemElement.prototype.adjustTrim=function(){var t,e=this.data.trim,a=e.length;for(t=0;a>t;t+=1)e[t].o&&(e[t].o-=90)},ShapeItemElement.prototype.getElement=function(){return this.shapeG},ShapeItemElement.prototype.renderShape=function(t){this.currentData=this.data.renderedData[t],"pathShape"==this.data.type?this.pathLength=this.renderPath(t):"rectShape"==this.data.type?this.renderRect(t):"ellipseShape"==this.data.type&&(this.pathLength=this.renderEllipse(t)),this.data.trim&&this.renderTrim(t),this.renderFill(t),this.renderStroke(t),this.renderTransform(t)},ShapeItemElement.prototype.renderPath=function(){var t=this.currentData,e=t.path;return e.pathString!=this.renderedFrame.path?(this.renderedFrame.path=e.pathString,this.shape.setAttribute("d",e.pathString),this.data.trim?(null==this.cachedData.pathLengths&&(this.cachedData.pathLengths={}),null==this.cachedData.pathLengths[e.pathString]&&(this.cachedData.pathLengths[e.pathString]=this.shape.getTotalLength()),this.cachedData.pathLengths[e.pathString]):void 0):this.data.trim?this.cachedData.pathLengths[e.pathString]:void 0},ShapeItemElement.prototype.renderEllipse=function(t){var e=this.currentData.ell;if(this.renderedFrame.ellipse.rx!=e.size[0]&&(this.shape.setAttribute("rx",e.size[0]/2),this.renderedFrame.ellipse.rx=e.size[0]),this.renderedFrame.ellipse.ry!=e.size[1]&&(this.shape.setAttribute("ry",e.size[1]/2),this.renderedFrame.ellipse.ry=e.size[1]),this.renderedFrame.ellipse.cx!=e.p[0]&&(this.shape.setAttribute("cx",e.p[0]),this.renderedFrame.ellipse.ry=e.p[0]),this.renderedFrame.ellipse.cy!=e.p[1]&&(this.shape.setAttribute("cy",e.p[1]),this.renderedFrame.ellipse.ry=e.p[1]),this.data.trim){if(null==this.cachedData.pathLengths&&(this.cachedData.pathLengths={}),null==this.cachedData.pathLengths["ellipse_"+t])if(e.size[0]==e.size[1])this.cachedData.pathLengths["ellipse_"+t]=Math.PI*e.size[0];else{var a=Math.max(e.size[0],e.size[1])/2,i=Math.max(e.size[0],e.size[1])/2,r=(a-i)/(a+i),s=(a+i)*Math.PI*(1+.25*r+1/64*Math.pow(r,2)+1/256*Math.pow(r,3));this.cachedData.pathLengths["ellipse_"+t]=s}return this.cachedData.pathLengths["ellipse_"+t]}},ShapeItemElement.prototype.renderRect=function(){var t=this.currentData;if(t.rect){var e=t.rect;this.renderedFrame.rect.rx!=e.roundness&&(this.shape.setAttribute("rx",e.roundness),this.shape.setAttribute("ry",e.roundness),this.renderedFrame.rect.rx=e.roundness),this.renderedFrame.rect.width!=e.size[0]&&(this.shape.setAttribute("width",e.size[0]),this.renderedFrame.rect.width=e.size[0]),this.renderedFrame.rect.height!=e.size[1]&&(this.shape.setAttribute("height",e.size[1]),this.renderedFrame.rect.height=e.size[1]),this.renderedFrame.rect.x!=e.position[0]-e.size[0]&&(this.shape.setAttribute("x",e.position[0]-e.size[0]/2),this.renderedFrame.rect.x=e.position[0]-e.size[0]),this.renderedFrame.rect.y!=e.position[1]-e.size[1]&&(this.shape.setAttribute("y",e.position[1]-e.size[1]/2),this.renderedFrame.rect.y=e.position[1]-e.size[1])}},ShapeItemElement.prototype.renderFill=function(){var t=this.currentData;if(t.fill){var e=t.fill;this.renderedFrame.fill.color!==e.color&&(this.shape.setAttribute("fill",e.color),this.renderedFrame.fill.color=e.color),this.data.fillEnabled!==!1?this.renderedFrame.fill.opacity!==e.opacity&&(this.shape.setAttribute("fill-opacity",e.opacity),this.renderedFrame.fill.opacity=e.opacity):0!==this.renderedFrame.fill.opacity&&(this.shape.setAttribute("fill-opacity",0),this.renderedFrame.fill.opacity=0)}else 0!==this.renderedFrame.fill.opacity&&(this.shape.setAttribute("fill-opacity",0),this.renderedFrame.fill.opacity=0)},ShapeItemElement.prototype.renderStroke=function(){var t=this.currentData;if(t.stroke){var e=t.stroke;this.renderedFrame.stroke.color!==e.color&&(this.renderedFrame.stroke.color=e.color,this.shape.setAttribute("stroke",e.color)),this.renderedFrame.stroke.width!==e.width&&(this.renderedFrame.stroke.width=e.width,this.shape.setAttribute("stroke-width",e.width)),this.data.strokeEnabled!==!1?this.renderedFrame.stroke.opacity!==e.opacity&&(this.renderedFrame.stroke.opacity=e.opacity,this.shape.setAttribute("stroke-opacity",e.opacity)):0!==this.renderedFrame.stroke.opacity&&(this.renderedFrame.stroke.opacity=0,this.shape.setAttribute("stroke-opacity",0))}},ShapeItemElement.prototype.renderTransform=function(){var t=this.currentData;if(t.tr){var e=t.tr;this.renderedFrame.tr.o!==e.o&&(this.renderedFrame.tr.o=e.o,this.shapeG.setAttribute("opacity",e.o)),this.renderedFrame.tr.mt!==e.mt&&(this.renderedFrame.tr.mt=e.mt,this.shapeG.setAttribute("transform",e.mt)),(this.renderedFrame.tr.a[0]!==e.a[0]||this.renderedFrame.tr.a[1]!==e.a[1])&&(this.renderedFrame.tr.a[0]=e.a[0],this.renderedFrame.tr.a[1]=e.a[1],this.shape.setAttribute("transform","translate("+-e.a[0]+", "+-e.a[1]+")"))}},ShapeItemElement.prototype.renderTrim=function(){var t=this.currentData.trim;if(0==this.pathLength)this.shape.setAttribute("stroke-opacity",0);else{this.renderedFrame.trim.e==t.e&&this.renderedFrame.trim.s==t.s&&this.renderedFrame.trim.o==t.o,this.renderedFrame.trim.e=t.e,this.renderedFrame.trim.s=t.s,this.renderedFrame.trim.o=t.o;var e=this.pathLength*(t.e-t.s)/100,a=this.pathLength-e,i=this.pathLength*t.s/100+this.pathLength*t.o/360,r=e+" , "+a;this.shape.setAttribute("stroke-dasharray",r),this.shape.setAttribute("stroke-dashoffset",this.pathLength-i),t.e==t.s?this.shape.setAttribute("stroke-opacity",0):this.currentData.stroke&&(this.data.strokeEnabled!==!1?this.shape.setAttribute("stroke-opacity",this.currentData.stroke.opacity):this.shape.setAttribute("stroke-opacity",0))}},createElement(BaseElement,ISolidElement),ISolidElement.prototype.createElements=function(){this.svgElem=document.createElementNS(svgNS,"g"),this.parent.createElements.call(this),this.layerElement.appendChild(this.svgElem);var t=document.createElementNS(svgNS,"rect");t.setAttribute("width",this.data.width),t.setAttribute("height",this.data.height),t.setAttribute("fill",this.data.color),this.svgElem.appendChild(t),styleUnselectableDiv(this.svgElem),styleUnselectableDiv(t),this.maskingGroup=this.svgElem,this.maskedElement=t},createElement(BaseElement,ITextElement),ITextElement.prototype.createElements=function(){this.svgElem=document.createElementNS(svgNS,"g");var t=document.createElementNS(svgNS,"text");t.textContent=this.data.textData.text,t.setAttribute("fill",this.data.textData.fillColor),t.setAttribute("x","0"),t.setAttribute("y",this.data.textData.height-(this.data.textData.fontSize-this.data.textData.height)/2),this.svgElem.setAttribute("width",this.data.textData.width),this.svgElem.setAttribute("height",this.data.textData.height),this.svgElem.style.transform="translate("+this.data.textData.xOffset+"px,"+this.data.textData.yOffset+"px)",this.svgElem.style["-webkit-transform"]="translate("+this.data.textData.xOffset+"px,"+this.data.textData.yOffset+"px)",t.setAttribute("font-size",this.data.textData.fontSize),t.setAttribute("font-family","Arial, sans-serif"),this.svgElem.appendChild(t),this.parent.createElements.call(this),this.anchorElement.appendChild(this.svgElem),this.maskingGroup=this.svgElem,this.maskedElement=t},CVBaseElement.prototype.init=function(){this.createElements(),this.data.hasMask&&this.addMasks(this.data),this.data.eff&&this.createEffectsManager(this.data)},CVBaseElement.prototype.createElements=function(){},CVBaseElement.prototype.prepareFrame=function(t){return this.data.inPoint-this.data.startTime<=t&&this.data.outPoint-this.data.startTime>t?(this.renderFrame=!0,this.currentAnimData=this.data.renderedData[t].an,void(this.data.hasMask&&this.maskManager.prepareFrame(t))):(this.renderFrame=!1,this.currentAnimData=this.data.renderedData[t].an,!1)},CVBaseElement.prototype.draw=function(t){if(t!==!1&&this.renderer.canvasContext.save(),!this.renderFrame)return!1;var e,a=this.renderer.canvasContext;if(this.data.parentHierarchy){var i,r,s=this.data.parentHierarchy.length;for(i=s-1;i>=0;i-=1)r=this.data.parentHierarchy[i].element.getCurrentAnimData(),e=r.matrixArray,a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),a.translate(-r.tr.a[0],-r.tr.a[1])}a.globalAlpha=a.globalAlpha*this.currentAnimData.tr.o,e=this.currentAnimData.matrixArray,a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),a.translate(-this.currentAnimData.tr.a[0],-this.currentAnimData.tr.a[1]),this.data.hasMask&&this.maskManager.draw(),t!==!1&&this.renderer.canvasContext.restore()},CVBaseElement.prototype.getCurrentAnimData=function(){return this.currentAnimData},CVBaseElement.prototype.addMasks=function(t){var e={data:{value:t},element:{value:this}};this.maskManager=createElement(CVMaskElement,null,e)},CVBaseElement.prototype.createEffectsManager=function(t){var e={effects:{value:t.eff},element:{value:this}};this.effectsManager=createElement(EffectsManager,null,e)},CVBaseElement.prototype.getType=function(){return this.type},CVBaseElement.prototype.getLayerSize=function(){return"TextLayer"==this.data.type?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}},createElement(CVBaseElement,CVCompElement),CVCompElement.prototype.prepareFrame=function(t){var e=this.parent.prepareFrame.call(this,t);if(e!==!1){var a,i=this.layers.length,r=this.data.tm?this.data.tm[t]<0?0:this.data.tm[t]:t;for(a=0;i>a;a+=1)this.layers[a].element.prepareFrame(r-this.layers[a].startTime)}},CVCompElement.prototype.draw=function(){if(this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1)return void this.renderer.canvasContext.restore();var t,e=this.layers.length;for(t=e-1;t>=0;t-=1)this.layers[t].element.draw();this.renderer.canvasContext.restore()},createElement(CVBaseElement,CVImageElement),CVImageElement.prototype.createElements=function(){var t=this,e=function(){t.animationItem.elementLoaded()};this.img=new Image,this.img.addEventListener("load",e,!1),this.img.src=this.path+this.assets[this.data.assetId].path,this.parent.createElements.call(this)},CVImageElement.prototype.draw=function(){if(this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1)return void this.renderer.canvasContext.restore();var t=this.renderer.canvasContext;t.drawImage(this.img,0,0),this.renderer.canvasContext.restore()},createElement(CVBaseElement,CVShapeElement),CVShapeElement.prototype.createElements=function(){this.parent.createElements.call(this);var t,e,a=this.data.shapes.length;for(t=a-1;t>=0;t--)this.data.trim&&(this.data.shapes[t].trim=this.data.trim),e=new CVShapeItemElement(this.data.shapes[t],this.renderer),this.shapes.push(e)},CVShapeElement.prototype.prepareFrame=function(t){var e=this.parent.prepareFrame.call(this,t);if(e!==!1){var a,i=this.data.shapes.length;for(a=i-1;a>=0;a--)this.shapes[i-1-a].prepareFrame(t)}},CVShapeElement.prototype.draw=function(){return this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1?void this.renderer.canvasContext.restore():(this.drawShapes(),void this.renderer.canvasContext.restore())},CVShapeElement.prototype.drawShapes=function(){var t,e=this.data.shapes.length;for(t=e-1;t>=0;t--)this.shapes[e-1-t].renderShape()},CVShapeItemElement.prototype.adjustTrim=function(){var t,e=this.data.trim,a=e.length;for(t=0;a>t;t+=1)e[t].o&&(e[t].o-=90)},CVShapeItemElement.prototype.renderShape=function(){if(""!==this.data.type){var t=this.frameNum;this.currentData=this.data.renderedData[t];var e=this.renderer.canvasContext,a=this.renderTransform(t);"pathShape"==this.data.type?this.data.trim?this.renderTrimPath(t):this.renderPath(t):"rectShape"==this.data.type?this.renderRect(t):"ellipseShape"==this.data.type&&(this.pathLength=this.renderEllipse(t)),this.renderFill(t),this.renderStroke(t),this.renderer.canvasContext.lineCap="round",this.renderer.canvasContext.lineJoin="round",this.renderedPaths[t]?supportsPath2D?(this.renderer.canvasContext.fill(this.renderedPaths[t]),this.renderer.canvasContext.stroke(this.renderedPaths[t])):(this.renderedPaths[t].drawToContext(this.renderer.canvasContext),this.renderer.canvasContext.fill(),this.renderer.canvasContext.stroke()):(this.renderer.canvasContext.fill(),this.renderer.canvasContext.stroke()),a&&e.restore()}},CVShapeItemElement.prototype.prepareFrame=function(t){this.frameNum=t},CVShapeItemElement.prototype.renderTransform=function(){var t=this.currentData;if(t.tr){var e=!1,a=this.renderer.canvasContext,i=t.tr,r=i.mtArr;return(1!==r[0]||0!==r[1]||0!==r[2]||1!==r[3]||0!==r[4]||0!==r[5])&&(a.save(),a.transform(r[0],r[1],r[2],r[3],r[4],r[5]),e=!0),(0!=i.a[0]||0!=i.a[1])&&(e||(a.save(),e=!0),a.translate(-i.a[0],-i.a[1])),i.o<1&&(e||(a.save(),e=!0),a.globalAlpha*=i.o),e}},CVShapeItemElement.prototype.addToTrim=function(t,e,a){this.trims[t]||this.trims.push({}),this.trims[t].s=e,this.trims[t].e=a,this.trims[t].ended=!1},CVShapeItemElement.prototype.renderTrimPath=function(t){var e=this.currentData.trim;if(e.e!=e.s&&!this.renderedPaths[t]){var a,i=new Path2D,r=this.currentData.path,s=r.pathNodes,n=[],o=0,h=s.v.length;for(a=0;h-1>a;a+=1)n.push(bez.drawBezierCurve(s.v[a],s.v[a+1],s.o[a],s.i[a+1])),o+=n[a].segmentLength;r.closed&&(n.push(bez.drawBezierCurve(s.v[a],s.v[0],s.o[a],s.i[0])),o+=n[a].segmentLength),h=n.length;var m=o*(e.e-e.s)/100;e.o=e.o%360,e.o<0&&(e.o+=360);var p=(e.s/100+e.o/360)%1*o,l=0;if(p+m-o>1e-5){var d=p+m-o;this.addToTrim(0,p,p+m-d),this.addToTrim(1,0,p+m-o),l+=2}else this.addToTrim(0,p,p+m),l+=1;var c,u,f,y,g,v=0,E=!1,x=this.trims.length;for(a=0;h>a&&!E;a+=1){for(u=n[a].points.length,y=!0,g=0;x>g;g+=1)v+n[a].segmentLength>this.trims[g].s&&(y=!1);if(y)v+=n[a].segmentLength;else{var b,C;for(c=0;u-1>c&&!E;c+=1)for(x=this.trims.length,b=n[a].points[c],C=n[a].points[c+1],v+=b.partialLength,g=0;x>g;g+=1)if(!this.trims[g].ended)if(this.trims[g].s>=v&&this.trims[g].s<v+C.partialLength&&(f=(this.trims[g].s-v)/C.partialLength,i.moveTo(b.point[0]+(C.point[0]-b.point[0])*f,b.point[1]+(C.point[1]-b.point[1])*f)),this.trims[g].e>v&&this.trims[g].e<=v+C.partialLength){if(f=(this.trims[g].e-v)/C.partialLength,i.lineTo(b.point[0]+(C.point[0]-b.point[0])*f,b.point[1]+(C.point[1]-b.point[1])*f),l-=1,this.trims[g].ended=!0,0==l){E=!0;
break}}else v>this.trims[g].s&&v<this.trims[g].e&&i.lineTo(b.point[0],b.point[1]);this.renderedPaths[t]=i}}}},CVShapeItemElement.prototype.renderPath=function(t){var e=this.currentData,a=e.path;if(!this.renderedPaths[t]){var i=new Path2D,r=this.renderer.canvasContext,s=a.pathNodes;s instanceof Array&&(s=s[0]);var n,o=s.i.length;for(r.beginPath(),i.moveTo(s.v[0][0],s.v[0][1]),n=1;o>n;n+=1)i.bezierCurveTo(s.o[n-1][0],s.o[n-1][1],s.i[n][0],s.i[n][1],s.v[n][0],s.v[n][1]);a.closed&&i.bezierCurveTo(s.o[n-1][0],s.o[n-1][1],s.i[0][0],s.i[0][1],s.v[0][0],s.v[0][1]),this.renderedPaths[t]=i}},CVShapeItemElement.prototype.renderEllipse=function(){var t=this.currentData.ell,e=this.renderer.canvasContext;e.beginPath(),e.ellipse(t.p[0],t.p[1],t.size[0]/2,t.size[1]/2,0,0,2*Math.PI,!0),e.closePath()},CVShapeItemElement.prototype.renderRect=function(){var t=this.currentData.rect,e=t.roundness,a=this.renderer.canvasContext;if(a.beginPath(),0==e)a.rect(t.position[0]-t.size[0]/2,t.position[1]-t.size[1]/2,t.size[0],t.size[1]);else{var i=t.position[0]-t.size[0]/2,r=t.position[1]-t.size[1]/2,s=t.size[0],n=t.size[1];e instanceof Array&&(e=e[0]),a.moveTo(i+e,r),a.lineTo(i+s-e,r),a.quadraticCurveTo(i+s,r,i+s,r+e),a.lineTo(i+s,r+n-e),a.quadraticCurveTo(i+s,r+n,i+s-e,r+n),a.lineTo(i+e,r+n),a.quadraticCurveTo(i,r+n,i,r+n-e),a.lineTo(i,r+e),a.quadraticCurveTo(i,r,i+e,r)}},CVShapeItemElement.prototype.renderFill=function(){var t=this.currentData;if(t.fill){var e=t.fill;if(this.data.fillEnabled!==!1)return void(this.renderer.canvasContext.fillStyle=e.opacity<1?fillColorToString(e.color,e.opacity):fillColorToString(e.color))}this.renderer.canvasContext.fillStyle="rgba(0,0,0,0)"},CVShapeItemElement.prototype.renderStroke=function(){var t=this.currentData;if(t.stroke){var e=t.stroke;if(this.renderer.canvasContext.lineWidth=e.width,this.data.strokeEnabled!==!1)return void(this.renderer.canvasContext.strokeStyle=e.opacity<1?fillColorToString(e.color,e.opacity):fillColorToString(e.color))}this.renderer.canvasContext.strokeStyle="rgba(0,0,0,0)"},createElement(CVBaseElement,CVSolidElement),CVSolidElement.prototype.draw=function(){if(this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1)return void this.renderer.canvasContext.restore();var t=this.renderer.canvasContext;t.fillStyle=this.data.color,t.fillRect(0,0,this.data.width,this.data.height),this.renderer.canvasContext.restore()},createElement(CVBaseElement,CVTextElement),CVTextElement.prototype.createElements=function(){this.svgElem=document.createElementNS(svgNS,"g");var t=document.createElementNS(svgNS,"text");t.textContent=this.data.textData.text,t.setAttribute("fill",this.data.textData.fillColor),t.setAttribute("x","0"),t.setAttribute("y",this.data.textData.height-(this.data.textData.fontSize-this.data.textData.height)/2),this.svgElem.setAttribute("width",this.data.textData.width),this.svgElem.setAttribute("height",this.data.textData.height),this.svgElem.style.transform="translate("+this.data.textData.xOffset+"px,"+this.data.textData.yOffset+"px)",this.svgElem.style["-webkit-transform"]="translate("+this.data.textData.xOffset+"px,"+this.data.textData.yOffset+"px)",t.setAttribute("font-size",this.data.textData.fontSize),t.setAttribute("font-family","Arial, sans-serif"),this.svgElem.appendChild(t),this.parent.createElements.call(this),this.anchorElement.appendChild(this.svgElem),this.maskingGroup=this.svgElem,this.maskedElement=t},CVMaskElement.prototype.init=function(){this.registeredEffects=[],this.masksProperties=this.data.masksProperties,this.totalMasks=this.masksProperties.length,this.ctx=this.element.renderer.canvasContext,this.layerSize=this.element.getLayerSize()},CVMaskElement.prototype.prepareFrame=function(t){this.frameNum=t},CVMaskElement.prototype.draw=function(){var t,e=this.data.masksProperties.length;for(this.ctx.beginPath(),t=0;e>t;t++)this.masksProperties[t].inv?this.createInvertedMask(this.ctx,this.masksProperties[t].pathVertices[this.frameNum][0]):this.drawShape(this.ctx,this.data.masksProperties[t].paths[this.frameNum].pathNodes);this.ctx.closePath(),this.ctx.clip()},CVMaskElement.prototype.createInvertedMask=function(t,e){t.beginPath();var a,i=t.canvas.width,r=t.canvas.height,s=e.v.length;for(t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,r),t.lineTo(0,r),t.lineTo(0,0),t.moveTo(e.v[0][0],e.v[0][1]),a=1;s>a;a++)t.bezierCurveTo(e.o[a-1][0],e.o[a-1][1],e.i[a][0],e.i[a][1],e.v[a][0],e.v[a][1]);t.bezierCurveTo(e.o[a-1][0],e.o[a-1][1],e.i[0][0],e.i[0][1],e.v[0][0],e.v[0][1]),t.closePath(),t.clip()},CVMaskElement.prototype.drawShape=function(t,e){var a,i=e.v.length;for(t.moveTo(e.v[0][0],e.v[0][1]),a=1;i>a;a++)t.bezierCurveTo(e.o[a-1][0],e.o[a-1][1],e.i[a][0],e.i[a][1],e.v[a][0],e.v[a][1]);t.bezierCurveTo(e.o[a-1][0],e.o[a-1][1],e.i[0][0],e.i[0][1],e.v[0][0],e.v[0][1])},CVMaskElement.prototype.createInvertedMask=function(){};var DBaseElement=function(t,e){this.animationItem=e,this.data=t,this.transformChanged=!1,this.forceRender=!1,this.init()};DBaseElement.prototype.init=function(){this.createElements(),this.data.hasMask&&this.addMasks(this.data),this.data.eff&&this.createEffectsManager(this.data)},DBaseElement.prototype.createElements=function(){this.layerElement=document.createElementNS(svgNS,"svg"),this.layerElement.style.position="absolute",this.layerElement.style.top=0,this.layerElement.style.left=0,this.layerElement.style.backfaceVisibility=this.layerElement.style.webkitBackfaceVisibility="hidden",this.layerElement.style.transformOrigin="0 0",this.layerElement.setAttribute("id",this.data.layerName),this.maskingGroup=this.layerElement,this.maskedElement=this.layerElement,this.mainElement=this.layerElement},DBaseElement.prototype.prepareFrame=function(t){this.currentAnimData=this.data.renderedData[t].an,this.data.renderedFrame.tr!==this.currentAnimData.matrixValue?(this.transformChanged=!0,this.data.renderedFrame.tr=this.currentAnimData.matrixValue):this.transformChanged=!1},DBaseElement.prototype.renderFrame=function(t){if(this.data.inPoint-this.data.startTime<=t&&this.data.outPoint-this.data.startTime>t?this.isVisible!==!0&&(this.isVisible=!0,this.forceRender=!0,this.mainElement.style.opacity=1):this.isVisible!==!1&&(this.isVisible=!1,this.mainElement.style.opacity=0),this.data.eff&&this.effectsManager.renderFrame(t,this.currentAnimData.mk),t===this.data.renderedFrame.num)return this.isVisible;this.data.hasMask&&this.maskManager.renderFrame(t),this.data.renderedFrame.o!==this.currentAnimData.tr.o&&(this.data.renderedFrame.o=this.currentAnimData.tr.o,this.isVisible&&(this.layerElement.style.opacity=this.currentAnimData.tr.o));var e="";if(this.data.parents){var a,i=!1,r=0,s=this.data.parents.length;if(this.transformChanged)i=!0;else for(;s>r;){if(this.data.parents[r].elem.element.transformChanged){i=!0;break}r+=1}if(i){for(r=s-1;r>=0;r-=1)a=this.data.parents[r].elem.element.currentAnimData,e+=a.matrixValue+" ";e+=this.currentAnimData.matrixValue,this.isVisible&&(this.layerElement.style.transform=e),this.fullTransform=e}}else this.transformChanged&&(e+=this.currentAnimData.matrixValue,this.isVisible&&(this.layerElement.style.transform=e),this.fullTransform=e);return this.forceRender&&(this.forceRender=!1,this.layerElement.style.opacity=this.currentAnimData.tr.o,this.layerElement.style.transform=this.fullTransform),this.isVisible},DBaseElement.prototype.getDomElement=function(){return this.layerElement},DBaseElement.prototype.setMainElement=function(t){this.mainElement=t},DBaseElement.prototype.getMaskManager=function(){return this.maskManager},DBaseElement.prototype.addMasks=function(t){var e={data:{value:t},element:{value:this}};this.maskManager=createElement(MaskElement,null,e)},DBaseElement.prototype.createEffectsManager=function(t){var e={effects:{value:t.eff},element:{value:this}};this.effectsManager=createElement(EffectsManager,null,e)},DBaseElement.prototype.getType=function(){return this.type},DBaseElement.prototype.getLayerSize=function(){return"TextLayer"==this.data.type?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}},createElement(DBaseElement,DImageElement),DImageElement.prototype.createElements=function(){console.log("innnit",this);var t=this,e=function(){t.animationItem.elementLoaded()},a=new Image;a.addEventListener("load",e,!1),a.src=this.path+this.assets[this.data.assetId].path,this.mainElement=a,styleDiv(this.mainElement)},createElement(DBaseElement,DShapeElement),DShapeElement.prototype.createElements=function(){this.parent.createElements.call(this),this.layerElement.setAttribute("width",2e3),this.layerElement.setAttribute("height",2e3),this.layerElement.setAttribute("viewBox",-this.data.compWidth/2+" "+-this.data.compHeight/2+" 2000 2000"),this.layerElement.setAttribute("preserveAspectRatio","xMidYMid meet");var t,e,a=this.data.shapes.length;for(t=a-1;t>=0;t--)this.data.trim&&(this.data.shapes[t].trim=this.data.trim),e=new ShapeItemElement(this.data.shapes[t]),this.layerElement.appendChild(e.getElement()),this.shapes.push(e)},DShapeElement.prototype.renderFrame=function(t){var e=this.parent.renderFrame.call(this,t);this.layerElement.style.transform=this.fullTransform+" translate("+-this.data.compWidth/2+"px, "+-this.data.compHeight/2+"px )",e!==!1&&this.renderShapes(t)},DShapeElement.prototype.renderShapes=function(t){var e,a,i,r=this.data.shapes.length;for(e=r-1;e>=0;e--)a=this.data.shapes[e],i=this.shapes[r-1-e],i.renderShape(t)},createElement(DBaseElement,DSolidElement),DSolidElement.prototype.createElements=function(){this.parent.createElements.call(this),this.layerElement.setAttribute("width",this.data.width),this.layerElement.setAttribute("height",this.data.height);var t=document.createElementNS(svgNS,"rect");t.setAttribute("width",this.data.width),t.setAttribute("height",this.data.height),t.setAttribute("fill",this.data.color),this.layerElement.appendChild(t),styleUnselectableDiv(t),this.maskingGroup=this.svgElem,this.maskedElement=t},createElement(DBaseElement,DCompElement),DCompElement.prototype.createElements=function(){for(var t=0,e=this.layers.length;e>t;){if(this.layers[t].threeD){this.data.threeDComp=!0;break}t+=1}if(this.data.threeDComp)this.layerElement=document.createElement("div"),this.layerElement.style.position="absolute",this.layerElement.style.top=0,this.layerElement.style.left=0,this.layerElement.style.backfaceVisibility=this.layerElement.style.webkitBackfaceVisibility="hidden",this.layerElement.style.transformStyle=this.animationItem.container.style.webkitTransformStyle="preserve-3d",this.layerElement.style.transformOrigin="0 0",this.layerElement.setAttribute("id",this.data.layerName);else{this.layerElement=document.createElement("canvas"),this.layerElement.style.position="absolute",this.layerElement.style.top=0,this.layerElement.style.left=0,this.layerElement.style.backfaceVisibility=this.layerElement.style.webkitBackfaceVisibility="hidden",this.layerElement.style.transformStyle=this.animationItem.container.style.webkitTransformStyle="preserve-3d",this.layerElement.style.transformOrigin="0 0",this.layerElement.setAttribute("width",this.data.width),this.layerElement.setAttribute("height",this.data.height),this.layerElement.setAttribute("id",this.data.layerName);var a={clearCanvas:!0,context:this.layerElement.getContext("2d"),scaleMode:"fit"};this.renderer=new CanvasRenderer(this,a),this.data.compWidth=this.data.width,this.data.compHeight=this.data.height,this.renderer.configAnimation({animation:this.data}),this.renderer.buildItems(this.data.layers),this.renderer.buildStage(this.layerElement,this.data.layers)}this.maskingGroup=this.layerElement,this.maskedElement=this.layerElement,this.mainElement=this.layerElement},DCompElement.prototype.getComposingElement=function(){return this.layerElement},DCompElement.prototype.renderFrame=function(t){var e=this.parent.renderFrame.call(this,t);if(e!==!1){var a=this.data.tm?this.data.tm[t]<0?0:this.data.tm[t]:t;if(this.data.threeDComp){var i,r=this.layers.length;for(i=0;r>i;i+=1)this.layers[i].element.prepareFrame(a-this.layers[i].startTime);for(i=0;r>i;i+=1)this.layers[i].element.renderFrame(a-this.layers[i].startTime)}else this.renderer.renderFrame(a)}};var animationManager=function(){function t(t){if(!t)return null;for(var e=0;v>e;){if(f[e].elem==t&&null!==f[e].elem)return f[e].animation;e+=1}var a=new AnimationItem;return a.setData(t),f.push({elem:t,animation:a}),v+=1,a}function e(t){var e=new AnimationItem;return e.setParams(t),f.push({elem:null,animation:e}),v+=1,e}function a(t,e){var a;for(a=0;v>a;a+=1)f[a].animation.setSpeed(t,e)}function i(t,e){var a;for(a=0;v>a;a+=1)f[a].animation.setDirection(t,e)}function r(t){var e;for(e=0;v>e;e+=1)f[e].animation.play(t)}function s(t,e){g=!1,y=Date.now();var a;for(a=0;v>a;a+=1)f[a].animation.moveFrame(t,e)}function n(){var t,e=Date.now(),a=e-y;for(t=0;v>t;t+=1)f[t].animation.advanceTime(a);y=e,requestAnimationFrame(n)}function o(t){var e;for(e=0;v>e;e+=1)f[e].animation.pause(t)}function h(t,e,a){var i;for(i=0;v>i;i+=1)f[i].animation.goToAndStop(t,e,a)}function m(t){var e;for(e=0;v>e;e+=1)f[e].animation.stop(t)}function p(t){var e;for(e=0;v>e;e+=1)f[e].animation.togglePause(t)}function l(){var e=document.getElementsByClassName("bodymovin");Array.prototype.forEach.call(e,t)}function d(){var t;for(t=0;v>t;t+=1)f[t].animation.resize()}function c(){y=Date.now(),requestAnimationFrame(n)}var u={},f=[],y=0,g=!0,v=0;return setTimeout(c,0),u.registerAnimation=t,u.loadAnimation=e,u.setSpeed=a,u.setDirection=i,u.play=r,u.moveFrame=s,u.pause=o,u.stop=m,u.togglePause=p,u.searchAnimations=l,u.resize=d,u.start=c,u.goToAndStop=h,u}(),AnimationItem=function(){this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.pendingElements=0,this.playCount=0,this.prerenderFramesFlag=!0,this.repeat="indefinite",this.animationData={},this.layers=[],this.assets=[],this.isPaused=!0,this.isScrolling=!1,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=randomString(10),this.renderedFrameCount=0,this.scaleMode="fit",this.math=Math};AnimationItem.prototype.setParams=function(t){var e=this;t.context&&(this.context=t.context),t.wrapper&&(this.wrapper=t.wrapper);var a=t.animType?t.animType:"canvas";switch(a){case"canvas":this.renderer=new CanvasRenderer(this,t.renderer);break;case"svg":this.renderer=new SVGRenderer(this,t.renderer);break;case"threed":this.renderer=new DOMRenderer(this,t.renderer)}if(this.animType=a,""===t.loop||null===t.loop||(this.loop=t.loop===!1?!1:t.loop===!0?!0:parseInt(t.loop)),this.autoplay="autoplay"in t?t.autoplay:!0,this.name=t.name?t.name:"",this.prerenderFramesFlag="prerender"in t?t.prerender:!0,t.animationData)e.configAnimation(t.animationData);else if(t.path){"json"!=t.path.substr(-4)&&("/"!=t.path.substr(-1,1)&&(t.path+="/"),t.path+="data.json");var i=new XMLHttpRequest;this.path=t.path.substr(0,t.path.lastIndexOf("/")+1),i.open("GET",t.path,!0),i.send(),i.onreadystatechange=function(){if(4==i.readyState)if(200==i.status)e.configAnimation(JSON.parse(i.responseText));else try{var t=JSON.parse(i.responseText);e.configAnimation(t)}catch(a){}}}},AnimationItem.prototype.setData=function(t){var e={wrapper:t},a=t.attributes;e.path=a.getNamedItem("data-animation-path")?a.getNamedItem("data-animation-path").value:a.getNamedItem("data-bm-path")?a.getNamedItem("data-bm-path").value:a.getNamedItem("bm-path")?a.getNamedItem("bm-path").value:"",e.animType=a.getNamedItem("data-anim-type")?a.getNamedItem("data-anim-type").value:a.getNamedItem("data-bm-type")?a.getNamedItem("data-bm-type").value:a.getNamedItem("bm-type")?a.getNamedItem("bm-type").value:"canvas";var i=a.getNamedItem("data-anim-loop")?a.getNamedItem("data-anim-loop").value:a.getNamedItem("data-bm-loop")?a.getNamedItem("data-bm-loop").value:a.getNamedItem("bm-loop")?a.getNamedItem("bm-loop").value:"";""==i||(e.loop="false"===i?!1:"true"===i?!0:parseInt(i)),e.name=a.getNamedItem("data-name")?a.getNamedItem("data-name").value:a.getNamedItem("data-bm-name")?a.getNamedItem("data-bm-name").value:a.getNamedItem("bm-name")?a.getNamedItem("bm-name").value:"";var r=a.getNamedItem("data-anim-prerender")?a.getNamedItem("data-anim-prerender").value:a.getNamedItem("data-bm-prerender")?a.getNamedItem("data-bm-prerender").value:a.getNamedItem("bm-prerender")?a.getNamedItem("bm-prerender").value:"";"false"===r&&(e.prerender=!1),this.setParams(e)},AnimationItem.prototype.configAnimation=function(t){this.renderer.configAnimation(t),this.animationData=t,this.animationData._id=this.animationID,this.animationData._animType=this.animType,this.layers=this.animationData.animation.layers,this.assets=this.animationData.assets,this.totalFrames=this.animationData.animation.totalFrames,this.frameRate=this.animationData.animation.frameRate,this.frameMult=this.animationData.animation.frameRate/1e3,dataManager.completeData(this.animationData),this.renderer.buildItems(this.animationData.animation.layers),this.updaFrameModifier(),this.checkLoaded()},AnimationItem.prototype.elementLoaded=function(){this.pendingElements--,this.checkLoaded()},AnimationItem.prototype.checkLoaded=function(){this.renderer.buildStage(this.container,this.layers),0==this.pendingElements&&(this.prerenderFramesFlag?(this.prerenderFrames(0),dataManager.renderFrame(this.animationID,this.currentFrame),this.renderer.renderFrame(this.currentFrame)):(this.isLoaded=!0,this.gotoFrame(),this.autoplay&&this.play()))},AnimationItem.prototype.prerenderFrames=function(t){t||(t=0),this.renderedFrameCount===this.totalFrames?(this.isLoaded=!0,this.gotoFrame(),this.autoplay&&this.play()):(dataManager.renderFrame(this.animationID,this.renderedFrameCount),this.renderedFrameCount+=1,t>4?setTimeout(this.prerenderFrames.bind(this),0):(t+=1,this.prerenderFrames(t)))},AnimationItem.prototype.resize=function(){this.renderer.updateContainerSize()},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=subframeEnabled?this.math.round(100*this.currentRawFrame)/100:this.math.floor(this.currentRawFrame),this.renderFrame()},AnimationItem.prototype.renderFrame=function(){this.isLoaded!==!1&&(dataManager.renderFrame(this.animationID,this.currentFrame),this.renderer.renderFrame(this.currentFrame))},AnimationItem.prototype.play=function(t){t&&this.name!=t||this.isPaused===!0&&(this.isPaused=!1)},AnimationItem.prototype.pause=function(t){t&&this.name!=t||this.isPaused===!1&&(this.isPaused=!0)},AnimationItem.prototype.togglePause=function(t){t&&this.name!=t||(this.isPaused===!0?(this.isPaused=!1,this.play()):(this.isPaused=!0,this.pause()))},AnimationItem.prototype.stop=function(t){t&&this.name!=t||(this.isPaused=!0,this.currentFrame=this.currentRawFrame=0,this.playCount=0,this.gotoFrame())},AnimationItem.prototype.goToAndStop=function(t,e,a){a&&this.name!=a||(this.setCurrentRawFrameValue(e?t:t*this.frameModifier),this.isPaused=!0)},AnimationItem.prototype.advanceTime=function(t){this.isPaused!==!0&&this.isScrolling!==!0&&this.isLoaded!==!1&&this.setCurrentRawFrameValue(this.currentRawFrame+t*this.frameModifier)},AnimationItem.prototype.updateAnimation=function(t){this.setCurrentRawFrameValue(this.totalFrames*t)},AnimationItem.prototype.moveFrame=function(t,e){e&&this.name!=e||this.setCurrentRawFrameValue(this.currentRawFrame+t)},AnimationItem.prototype.setCurrentRawFrameValue=function(t){if(this.currentRawFrame=t,this.currentRawFrame>=this.totalFrames){if(this.loop===!1)return this.currentRawFrame=this.totalFrames-1,this.gotoFrame(),void this.pause();if(this.playCount+=1,this.loop!==!0&&this.playCount==this.loop)return this.currentRawFrame=this.totalFrames-1,this.gotoFrame(),void this.pause()}else if(this.currentRawFrame<0)return this.playCount-=1,this.playCount<0&&(this.playCount=0),this.loop===!1?(this.currentRawFrame=0,this.gotoFrame(),void this.pause()):(this.currentRawFrame=this.totalFrames+this.currentRawFrame,void this.gotoFrame());this.currentRawFrame=this.currentRawFrame%this.totalFrames,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(t){this.playSpeed=t,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(t){this.playDirection=0>t?-1:1,this.updaFrameModifier()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssets=function(){return this.assets},function(t){function e(t){animationManager.play(t)}function a(t){animationManager.pause(t)}function i(t){animationManager.togglePause(t)}function r(t,e){animationManager.setSpeed(t,e)}function s(t,e){animationManager.setDirection(t,e)}function n(t){animationManager.stop(t)}function o(t){animationManager.moveFrame(t)}function h(){animationManager.searchAnimations()}function m(t){return animationManager.registerAnimation(t)}function p(){animationManager.resize()}function l(){animationManager.start()}function d(t,e,a){animationManager.goToAndStop(t,e,a)}function c(t){subframeEnabled=t}function u(t){return animationManager.loadAnimation(t)}function f(){"complete"===document.readyState&&(clearInterval(g),h())}var y={};y.play=e,y.pause=a,y.togglePause=i,y.setSpeed=r,y.setDirection=s,y.stop=n,y.moveFrame=o,y.searchAnimations=h,y.registerAnimation=m,y.loadAnimation=u,y.setSubframeRendering=c,y.resize=p,y.start=l,y.goToAndStop=d,y.checkReady=f,t.bodymovin=y;var g=setInterval(f,100)}(window);}(window));