(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[1],{

/***/ "./node_modules/lottie-web-vue/dist/lottie-web-vue.esm.js":
/*!****************************************************************!*\
  !*** ./node_modules/lottie-web-vue/dist/lottie-web-vue.esm.js ***!
  \****************************************************************/
/*! exports provided: default, install */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"install\", function() { return install; });\n/* harmony import */ var lottie_web__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lottie-web */ \"./node_modules/lottie-web-vue/node_modules/lottie-web/build/player/lottie.js\");\n/* harmony import */ var lottie_web__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lottie_web__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar this$1 = undefined;\n\nvar script = {\n  props: {\n    animationData: { type: [Object, String], required: true },\n    loop: { type: [Boolean, Number], default: false },\n    autoPlay: { type: Boolean, default: true },\n    renderer: { type: String, default: 'svg' },\n    speed: { type: Number, default: 1 },\n  }, \n  data: function data() {\n    return {\n      anim: null\n    }\n  },\n  watch: {\n    animationData: function () {\n      this$1.init();\n    }\n  },\n  mounted: function mounted() {\n    this.init();\n  },\n  beforeDestroy: function beforeDestroy() {\n    if (this.anim) \n      { this.anim.destroy(); }\n  },\n  methods: {\n    init: function init() {\n      var this$1 = this;\n\n      var settings = {\n        container: this.$refs.animation,\n        renderer: this.renderer,\n        loop: this.loop,\n        autoplay: this.autoPlay,\n        animationData: this.animationData\n      };\n\n      this.anim = lottie_web__WEBPACK_IMPORTED_MODULE_0___default.a.loadAnimation(settings);\n\n      this.anim.addEventListener('loopComplete', function () {\n        this$1.$emit('loopComplete', this$1.anim);\n      });\n      this.anim.addEventListener('complete', function () {\n        this$1.$emit('complete', this$1.anim);\n      });\n      this.anim.addEventListener('enterFrame', function () {\n        this$1.$emit('enterFrame', this$1.anim);\n      });\n    },\n    play: function play() {\n      if(this.anim)\n        { this.anim.play(); }\n    },\n    stop: function stop() {\n      if(this.anim)\n        { this.anim.stop(); }\n    },\n    pause: function pause() {\n      if(this.anim)\n        { this.anim.pause(); }\n    }\n  }\n};\n\nfunction normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {\r\n    if (typeof shadowMode !== 'boolean') {\r\n        createInjectorSSR = createInjector;\r\n        createInjector = shadowMode;\r\n        shadowMode = false;\r\n    }\r\n    // Vue.extend constructor export interop.\r\n    var options = typeof script === 'function' ? script.options : script;\r\n    // render functions\r\n    if (template && template.render) {\r\n        options.render = template.render;\r\n        options.staticRenderFns = template.staticRenderFns;\r\n        options._compiled = true;\r\n        // functional template\r\n        if (isFunctionalTemplate) {\r\n            options.functional = true;\r\n        }\r\n    }\r\n    // scopedId\r\n    if (scopeId) {\r\n        options._scopeId = scopeId;\r\n    }\r\n    var hook;\r\n    if (moduleIdentifier) {\r\n        // server build\r\n        hook = function (context) {\r\n            // 2.3 injection\r\n            context =\r\n                context || // cached call\r\n                    (this.$vnode && this.$vnode.ssrContext) || // stateful\r\n                    (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional\r\n            // 2.2 with runInNewContext: true\r\n            if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\r\n                context = __VUE_SSR_CONTEXT__;\r\n            }\r\n            // inject component styles\r\n            if (style) {\r\n                style.call(this, createInjectorSSR(context));\r\n            }\r\n            // register component module identifier for async chunk inference\r\n            if (context && context._registeredComponents) {\r\n                context._registeredComponents.add(moduleIdentifier);\r\n            }\r\n        };\r\n        // used by ssr in case component is cached and beforeCreate\r\n        // never gets called\r\n        options._ssrRegister = hook;\r\n    }\r\n    else if (style) {\r\n        hook = shadowMode\r\n            ? function (context) {\r\n                style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));\r\n            }\r\n            : function (context) {\r\n                style.call(this, createInjector(context));\r\n            };\r\n    }\r\n    if (hook) {\r\n        if (options.functional) {\r\n            // register for functional component in vue file\r\n            var originalRender = options.render;\r\n            options.render = function renderWithStyleInjection(h, context) {\r\n                hook.call(context);\r\n                return originalRender(h, context);\r\n            };\r\n        }\r\n        else {\r\n            // inject component registration as beforeCreate hook\r\n            var existing = options.beforeCreate;\r\n            options.beforeCreate = existing ? [].concat(existing, hook) : [hook];\r\n        }\r\n    }\r\n    return script;\r\n}\n\n/* script */\nvar __vue_script__ = script;\n\n/* template */\nvar __vue_render__ = function() {\n  var _vm = this;\n  var _h = _vm.$createElement;\n  var _c = _vm._self._c || _h;\n  return _c(\"div\", { ref: \"animation\" })\n};\nvar __vue_staticRenderFns__ = [];\n__vue_render__._withStripped = true;\n\n  /* style */\n  var __vue_inject_styles__ = undefined;\n  /* scoped */\n  var __vue_scope_id__ = undefined;\n  /* module identifier */\n  var __vue_module_identifier__ = undefined;\n  /* functional template */\n  var __vue_is_functional_template__ = false;\n  /* style inject */\n  \n  /* style inject SSR */\n  \n  /* style inject shadow dom */\n  \n\n  \n  var __vue_component__ = /*#__PURE__*/normalizeComponent(\n    { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },\n    __vue_inject_styles__,\n    __vue_script__,\n    __vue_scope_id__,\n    __vue_is_functional_template__,\n    __vue_module_identifier__,\n    false,\n    undefined,\n    undefined,\n    undefined\n  );\n\n// Declare install function executed by Vue.use()\nfunction install(Vue) {\n\tif (install.installed) { return; }\n\tinstall.installed = true;\n\tVue.component('LottieWebVue', __vue_component__);\n}\n\n// Create module definition for Vue.use()\nvar plugin = {\n\tinstall: install,\n};\n\n// Auto-install when vue is found (eg. in browser via <script> tag)\nvar GlobalVue = null;\nif (typeof window !== 'undefined') {\n\tGlobalVue = window.Vue;\n} else if (typeof global !== 'undefined') {\n\tGlobalVue = global.Vue;\n}\nif (GlobalVue) {\n\tGlobalVue.use(plugin);\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (__vue_component__);\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/lottie-web-vue/dist/lottie-web-vue.esm.js?");

/***/ }),

/***/ "./node_modules/lottie-web-vue/node_modules/lottie-web/build/player/lottie.js":
/*!************************************************************************************!*\
  !*** ./node_modules/lottie-web-vue/node_modules/lottie-web/build/player/lottie.js ***!
  \************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var __WEBPACK_AMD_DEFINE_RESULT__;(typeof navigator !== \"undefined\") && (function(root, factory) {\n    if (true) {\n        !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {\n            return factory(root);\n        }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n    } else {}\n}((window || {}), function(window) {\n\t/* global locationHref:writable, animationManager, subframeEnabled:writable, defaultCurveSegments:writable, roundValues,\r\nexpressionsPlugin:writable, PropertyFactory, ShapePropertyFactory, Matrix, idPrefix:writable */\r\n/* exported locationHref, subframeEnabled, expressionsPlugin, idPrefix */\r\n\r\n'use strict';\r\n\r\n/* exported svgNS, locationHref, initialDefaultFrame */\r\n\r\nvar svgNS = 'http://www.w3.org/2000/svg';\r\n\r\nvar locationHref = '';\r\n\r\nvar initialDefaultFrame = -999999;\r\n\r\n/* global createSizedArray */\r\n/* exported subframeEnabled, expressionsPlugin, isSafari, cachedColors, bmPow, bmSqrt, bmFloor, bmMax, bmMin, ProjectInterface,\r\ndefaultCurveSegments, degToRads, roundCorner, bmRnd, styleDiv, BMEnterFrameEvent, BMCompleteEvent, BMCompleteLoopEvent,\r\nBMSegmentStartEvent, BMDestroyEvent, BMRenderFrameErrorEvent, BMConfigErrorEvent, BMAnimationConfigErrorEvent, createElementID,\r\naddSaturationToRGB, addBrightnessToRGB, addHueToRGB, rgbToHex */\r\n\r\nvar subframeEnabled = true;\r\nvar idPrefix = '';\r\nvar expressionsPlugin;\r\nvar isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\nvar cachedColors = {};\r\nvar bmRnd;\r\nvar bmPow = Math.pow;\r\nvar bmSqrt = Math.sqrt;\r\nvar bmFloor = Math.floor;\r\nvar bmMax = Math.max;\r\nvar bmMin = Math.min;\r\n\r\nvar BMMath = {};\r\n(function () {\r\n  var propertyNames = ['abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'atan2', 'ceil', 'cbrt', 'expm1', 'clz32', 'cos', 'cosh', 'exp', 'floor', 'fround', 'hypot', 'imul', 'log', 'log1p', 'log2', 'log10', 'max', 'min', 'pow', 'random', 'round', 'sign', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2'];\r\n  var i;\r\n  var len = propertyNames.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    BMMath[propertyNames[i]] = Math[propertyNames[i]];\r\n  }\r\n}());\r\n\r\nfunction ProjectInterface() { return {}; }\r\n\r\nBMMath.random = Math.random;\r\nBMMath.abs = function (val) {\r\n  var tOfVal = typeof val;\r\n  if (tOfVal === 'object' && val.length) {\r\n    var absArr = createSizedArray(val.length);\r\n    var i;\r\n    var len = val.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      absArr[i] = Math.abs(val[i]);\r\n    }\r\n    return absArr;\r\n  }\r\n  return Math.abs(val);\r\n};\r\nvar defaultCurveSegments = 150;\r\nvar degToRads = Math.PI / 180;\r\nvar roundCorner = 0.5519;\r\n\r\nfunction roundValues(flag) {\r\n  if (flag) {\r\n    bmRnd = Math.round;\r\n  } else {\r\n    bmRnd = function (val) {\r\n      return val;\r\n    };\r\n  }\r\n}\r\nroundValues(false);\r\n\r\nfunction styleDiv(element) {\r\n  element.style.position = 'absolute';\r\n  element.style.top = 0;\r\n  element.style.left = 0;\r\n  element.style.display = 'block';\r\n  element.style.transformOrigin = '0 0';\r\n  element.style.webkitTransformOrigin = '0 0';\r\n  element.style.backfaceVisibility = 'visible';\r\n  element.style.webkitBackfaceVisibility = 'visible';\r\n  element.style.transformStyle = 'preserve-3d';\r\n  element.style.webkitTransformStyle = 'preserve-3d';\r\n  element.style.mozTransformStyle = 'preserve-3d';\r\n}\r\n\r\nfunction BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {\r\n  this.type = type;\r\n  this.currentTime = currentTime;\r\n  this.totalTime = totalTime;\r\n  this.direction = frameMultiplier < 0 ? -1 : 1;\r\n}\r\n\r\nfunction BMCompleteEvent(type, frameMultiplier) {\r\n  this.type = type;\r\n  this.direction = frameMultiplier < 0 ? -1 : 1;\r\n}\r\n\r\nfunction BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {\r\n  this.type = type;\r\n  this.currentLoop = currentLoop;\r\n  this.totalLoops = totalLoops;\r\n  this.direction = frameMultiplier < 0 ? -1 : 1;\r\n}\r\n\r\nfunction BMSegmentStartEvent(type, firstFrame, totalFrames) {\r\n  this.type = type;\r\n  this.firstFrame = firstFrame;\r\n  this.totalFrames = totalFrames;\r\n}\r\n\r\nfunction BMDestroyEvent(type, target) {\r\n  this.type = type;\r\n  this.target = target;\r\n}\r\n\r\nfunction BMRenderFrameErrorEvent(nativeError, currentTime) {\r\n  this.type = 'renderFrameError';\r\n  this.nativeError = nativeError;\r\n  this.currentTime = currentTime;\r\n}\r\n\r\nfunction BMConfigErrorEvent(nativeError) {\r\n  this.type = 'configError';\r\n  this.nativeError = nativeError;\r\n}\r\n\r\nfunction BMAnimationConfigErrorEvent(type, nativeError) {\r\n  this.type = type;\r\n  this.nativeError = nativeError;\r\n}\r\n\r\nvar createElementID = (function () {\r\n  var _count = 0;\r\n  return function createID() {\r\n    _count += 1;\r\n    return idPrefix + '__lottie_element_' + _count;\r\n  };\r\n}());\r\n\r\nfunction HSVtoRGB(h, s, v) {\r\n  var r;\r\n  var g;\r\n  var b;\r\n  var i;\r\n  var f;\r\n  var p;\r\n  var q;\r\n  var t;\r\n  i = Math.floor(h * 6);\r\n  f = h * 6 - i;\r\n  p = v * (1 - s);\r\n  q = v * (1 - f * s);\r\n  t = v * (1 - (1 - f) * s);\r\n  switch (i % 6) {\r\n    case 0: r = v; g = t; b = p; break;\r\n    case 1: r = q; g = v; b = p; break;\r\n    case 2: r = p; g = v; b = t; break;\r\n    case 3: r = p; g = q; b = v; break;\r\n    case 4: r = t; g = p; b = v; break;\r\n    case 5: r = v; g = p; b = q; break;\r\n    default: break;\r\n  }\r\n  return [r,\r\n    g,\r\n    b];\r\n}\r\n\r\nfunction RGBtoHSV(r, g, b) {\r\n  var max = Math.max(r, g, b);\r\n  var min = Math.min(r, g, b);\r\n  var d = max - min;\r\n  var h;\r\n  var s = (max === 0 ? 0 : d / max);\r\n  var v = max / 255;\r\n\r\n  switch (max) {\r\n    case min: h = 0; break;\r\n    case r: h = (g - b) + d * (g < b ? 6 : 0); h /= 6 * d; break;\r\n    case g: h = (b - r) + d * 2; h /= 6 * d; break;\r\n    case b: h = (r - g) + d * 4; h /= 6 * d; break;\r\n    default: break;\r\n  }\r\n\r\n  return [\r\n    h,\r\n    s,\r\n    v,\r\n  ];\r\n}\r\n\r\nfunction addSaturationToRGB(color, offset) {\r\n  var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\r\n  hsv[1] += offset;\r\n  if (hsv[1] > 1) {\r\n    hsv[1] = 1;\r\n  } else if (hsv[1] <= 0) {\r\n    hsv[1] = 0;\r\n  }\r\n  return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\r\n}\r\n\r\nfunction addBrightnessToRGB(color, offset) {\r\n  var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\r\n  hsv[2] += offset;\r\n  if (hsv[2] > 1) {\r\n    hsv[2] = 1;\r\n  } else if (hsv[2] < 0) {\r\n    hsv[2] = 0;\r\n  }\r\n  return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\r\n}\r\n\r\nfunction addHueToRGB(color, offset) {\r\n  var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\r\n  hsv[0] += offset / 360;\r\n  if (hsv[0] > 1) {\r\n    hsv[0] -= 1;\r\n  } else if (hsv[0] < 0) {\r\n    hsv[0] += 1;\r\n  }\r\n  return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\r\n}\r\n\r\nvar rgbToHex = (function () {\r\n  var colorMap = [];\r\n  var i;\r\n  var hex;\r\n  for (i = 0; i < 256; i += 1) {\r\n    hex = i.toString(16);\r\n    colorMap[i] = hex.length === 1 ? '0' + hex : hex;\r\n  }\r\n\r\n  return function (r, g, b) {\r\n    if (r < 0) {\r\n      r = 0;\r\n    }\r\n    if (g < 0) {\r\n      g = 0;\r\n    }\r\n    if (b < 0) {\r\n      b = 0;\r\n    }\r\n    return '#' + colorMap[r] + colorMap[g] + colorMap[b];\r\n  };\r\n}());\r\n\r\nfunction BaseEvent() {}\r\nBaseEvent.prototype = {\r\n  triggerEvent: function (eventName, args) {\r\n    if (this._cbs[eventName]) {\r\n      var callbacks = this._cbs[eventName];\r\n      for (var i = 0; i < callbacks.length; i += 1) {\r\n        callbacks[i](args);\r\n      }\r\n    }\r\n  },\r\n  addEventListener: function (eventName, callback) {\r\n    if (!this._cbs[eventName]) {\r\n      this._cbs[eventName] = [];\r\n    }\r\n    this._cbs[eventName].push(callback);\r\n\r\n    return function () {\r\n      this.removeEventListener(eventName, callback);\r\n    }.bind(this);\r\n  },\r\n  removeEventListener: function (eventName, callback) {\r\n    if (!callback) {\r\n      this._cbs[eventName] = null;\r\n    } else if (this._cbs[eventName]) {\r\n      var i = 0;\r\n      var len = this._cbs[eventName].length;\r\n      while (i < len) {\r\n        if (this._cbs[eventName][i] === callback) {\r\n          this._cbs[eventName].splice(i, 1);\r\n          i -= 1;\r\n          len -= 1;\r\n        }\r\n        i += 1;\r\n      }\r\n      if (!this._cbs[eventName].length) {\r\n        this._cbs[eventName] = null;\r\n      }\r\n    }\r\n  },\r\n};\r\n\r\n/* exported createTypedArray, createSizedArray */\r\n\r\nvar createTypedArray = (function () {\r\n  function createRegularArray(type, len) {\r\n    var i = 0;\r\n    var arr = [];\r\n    var value;\r\n    switch (type) {\r\n      case 'int16':\r\n      case 'uint8c':\r\n        value = 1;\r\n        break;\r\n      default:\r\n        value = 1.1;\r\n        break;\r\n    }\r\n    for (i = 0; i < len; i += 1) {\r\n      arr.push(value);\r\n    }\r\n    return arr;\r\n  }\r\n  function createTypedArrayFactory(type, len) {\r\n    if (type === 'float32') {\r\n      return new Float32Array(len);\r\n    } if (type === 'int16') {\r\n      return new Int16Array(len);\r\n    } if (type === 'uint8c') {\r\n      return new Uint8ClampedArray(len);\r\n    }\r\n    return createRegularArray(type, len);\r\n  }\r\n  if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {\r\n    return createTypedArrayFactory;\r\n  }\r\n  return createRegularArray;\r\n}());\r\n\r\nfunction createSizedArray(len) {\r\n  return Array.apply(null, { length: len });\r\n}\r\n\r\n/* global svgNS */\r\n/* exported createNS */\r\n\r\nfunction createNS(type) {\r\n  // return {appendChild:function(){},setAttribute:function(){},style:{}}\r\n  return document.createElementNS(svgNS, type);\r\n}\r\n\r\n/* exported createTag */\r\n\r\nfunction createTag(type) {\r\n  // return {appendChild:function(){},setAttribute:function(){},style:{}}\r\n  return document.createElement(type);\r\n}\r\n\r\nfunction DynamicPropertyContainer() {}\r\nDynamicPropertyContainer.prototype = {\r\n  addDynamicProperty: function (prop) {\r\n    if (this.dynamicProperties.indexOf(prop) === -1) {\r\n      this.dynamicProperties.push(prop);\r\n      this.container.addDynamicProperty(this);\r\n      this._isAnimated = true;\r\n    }\r\n  },\r\n  iterateDynamicProperties: function () {\r\n    this._mdf = false;\r\n    var i;\r\n    var len = this.dynamicProperties.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.dynamicProperties[i].getValue();\r\n      if (this.dynamicProperties[i]._mdf) {\r\n        this._mdf = true;\r\n      }\r\n    }\r\n  },\r\n  initDynamicPropertyContainer: function (container) {\r\n    this.container = container;\r\n    this.dynamicProperties = [];\r\n    this._mdf = false;\r\n    this._isAnimated = false;\r\n  },\r\n};\r\n\r\n/* exported getBlendMode */\r\n\r\nvar getBlendMode = (function () {\r\n  var blendModeEnums = {\r\n    0: 'source-over',\r\n    1: 'multiply',\r\n    2: 'screen',\r\n    3: 'overlay',\r\n    4: 'darken',\r\n    5: 'lighten',\r\n    6: 'color-dodge',\r\n    7: 'color-burn',\r\n    8: 'hard-light',\r\n    9: 'soft-light',\r\n    10: 'difference',\r\n    11: 'exclusion',\r\n    12: 'hue',\r\n    13: 'saturation',\r\n    14: 'color',\r\n    15: 'luminosity',\r\n  };\r\n\r\n  return function (mode) {\r\n    return blendModeEnums[mode] || '';\r\n  };\r\n}());\r\n\r\n/* exported lineCapEnum, lineJoinEnum */\r\n\r\nvar lineCapEnum = {\r\n  1: 'butt',\r\n  2: 'round',\r\n  3: 'square',\r\n};\r\n\r\nvar lineJoinEnum = {\r\n  1: 'miter',\r\n  2: 'round',\r\n  3: 'bevel',\r\n};\r\n\r\n/* global createTypedArray */\r\n\r\n/*!\r\n Transformation Matrix v2.0\r\n (c) Epistemex 2014-2015\r\n www.epistemex.com\r\n By Ken Fyrstenberg\r\n Contributions by leeoniya.\r\n License: MIT, header required.\r\n */\r\n\r\n/**\r\n * 2D transformation matrix object initialized with identity matrix.\r\n *\r\n * The matrix can synchronize a canvas context by supplying the context\r\n * as an argument, or later apply current absolute transform to an\r\n * existing context.\r\n *\r\n * All values are handled as floating point values.\r\n *\r\n * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix\r\n * @prop {number} a - scale x\r\n * @prop {number} b - shear y\r\n * @prop {number} c - shear x\r\n * @prop {number} d - scale y\r\n * @prop {number} e - translate x\r\n * @prop {number} f - translate y\r\n * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context\r\n * @constructor\r\n */\r\n\r\nvar Matrix = (function () {\r\n  var _cos = Math.cos;\r\n  var _sin = Math.sin;\r\n  var _tan = Math.tan;\r\n  var _rnd = Math.round;\r\n\r\n  function reset() {\r\n    this.props[0] = 1;\r\n    this.props[1] = 0;\r\n    this.props[2] = 0;\r\n    this.props[3] = 0;\r\n    this.props[4] = 0;\r\n    this.props[5] = 1;\r\n    this.props[6] = 0;\r\n    this.props[7] = 0;\r\n    this.props[8] = 0;\r\n    this.props[9] = 0;\r\n    this.props[10] = 1;\r\n    this.props[11] = 0;\r\n    this.props[12] = 0;\r\n    this.props[13] = 0;\r\n    this.props[14] = 0;\r\n    this.props[15] = 1;\r\n    return this;\r\n  }\r\n\r\n  function rotate(angle) {\r\n    if (angle === 0) {\r\n      return this;\r\n    }\r\n    var mCos = _cos(angle);\r\n    var mSin = _sin(angle);\r\n    return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n  }\r\n\r\n  function rotateX(angle) {\r\n    if (angle === 0) {\r\n      return this;\r\n    }\r\n    var mCos = _cos(angle);\r\n    var mSin = _sin(angle);\r\n    return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);\r\n  }\r\n\r\n  function rotateY(angle) {\r\n    if (angle === 0) {\r\n      return this;\r\n    }\r\n    var mCos = _cos(angle);\r\n    var mSin = _sin(angle);\r\n    return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);\r\n  }\r\n\r\n  function rotateZ(angle) {\r\n    if (angle === 0) {\r\n      return this;\r\n    }\r\n    var mCos = _cos(angle);\r\n    var mSin = _sin(angle);\r\n    return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n  }\r\n\r\n  function shear(sx, sy) {\r\n    return this._t(1, sy, sx, 1, 0, 0);\r\n  }\r\n\r\n  function skew(ax, ay) {\r\n    return this.shear(_tan(ax), _tan(ay));\r\n  }\r\n\r\n  function skewFromAxis(ax, angle) {\r\n    var mCos = _cos(angle);\r\n    var mSin = _sin(angle);\r\n    return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\r\n      ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\r\n      ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n    // return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);\r\n  }\r\n\r\n  function scale(sx, sy, sz) {\r\n    if (!sz && sz !== 0) {\r\n      sz = 1;\r\n    }\r\n    if (sx === 1 && sy === 1 && sz === 1) {\r\n      return this;\r\n    }\r\n    return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);\r\n  }\r\n\r\n  function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {\r\n    this.props[0] = a;\r\n    this.props[1] = b;\r\n    this.props[2] = c;\r\n    this.props[3] = d;\r\n    this.props[4] = e;\r\n    this.props[5] = f;\r\n    this.props[6] = g;\r\n    this.props[7] = h;\r\n    this.props[8] = i;\r\n    this.props[9] = j;\r\n    this.props[10] = k;\r\n    this.props[11] = l;\r\n    this.props[12] = m;\r\n    this.props[13] = n;\r\n    this.props[14] = o;\r\n    this.props[15] = p;\r\n    return this;\r\n  }\r\n\r\n  function translate(tx, ty, tz) {\r\n    tz = tz || 0;\r\n    if (tx !== 0 || ty !== 0 || tz !== 0) {\r\n      return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1);\r\n    }\r\n    return this;\r\n  }\r\n\r\n  function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {\r\n    var _p = this.props;\r\n\r\n    if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) {\r\n      // NOTE: commenting this condition because TurboFan deoptimizes code when present\r\n      // if(m2 !== 0 || n2 !== 0 || o2 !== 0){\r\n      _p[12] = _p[12] * a2 + _p[15] * m2;\r\n      _p[13] = _p[13] * f2 + _p[15] * n2;\r\n      _p[14] = _p[14] * k2 + _p[15] * o2;\r\n      _p[15] *= p2;\r\n      // }\r\n      this._identityCalculated = false;\r\n      return this;\r\n    }\r\n\r\n    var a1 = _p[0];\r\n    var b1 = _p[1];\r\n    var c1 = _p[2];\r\n    var d1 = _p[3];\r\n    var e1 = _p[4];\r\n    var f1 = _p[5];\r\n    var g1 = _p[6];\r\n    var h1 = _p[7];\r\n    var i1 = _p[8];\r\n    var j1 = _p[9];\r\n    var k1 = _p[10];\r\n    var l1 = _p[11];\r\n    var m1 = _p[12];\r\n    var n1 = _p[13];\r\n    var o1 = _p[14];\r\n    var p1 = _p[15];\r\n\r\n    /* matrix order (canvas compatible):\r\n         * ace\r\n         * bdf\r\n         * 001\r\n         */\r\n    _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;\r\n    _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2;\r\n    _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2;\r\n    _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2;\r\n\r\n    _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2;\r\n    _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2;\r\n    _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2;\r\n    _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2;\r\n\r\n    _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2;\r\n    _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2;\r\n    _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2;\r\n    _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2;\r\n\r\n    _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2;\r\n    _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2;\r\n    _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2;\r\n    _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2;\r\n\r\n    this._identityCalculated = false;\r\n    return this;\r\n  }\r\n\r\n  function isIdentity() {\r\n    if (!this._identityCalculated) {\r\n      this._identity = !(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);\r\n      this._identityCalculated = true;\r\n    }\r\n    return this._identity;\r\n  }\r\n\r\n  function equals(matr) {\r\n    var i = 0;\r\n    while (i < 16) {\r\n      if (matr.props[i] !== this.props[i]) {\r\n        return false;\r\n      }\r\n      i += 1;\r\n    }\r\n    return true;\r\n  }\r\n\r\n  function clone(matr) {\r\n    var i;\r\n    for (i = 0; i < 16; i += 1) {\r\n      matr.props[i] = this.props[i];\r\n    }\r\n    return matr;\r\n  }\r\n\r\n  function cloneFromProps(props) {\r\n    var i;\r\n    for (i = 0; i < 16; i += 1) {\r\n      this.props[i] = props[i];\r\n    }\r\n  }\r\n\r\n  function applyToPoint(x, y, z) {\r\n    return {\r\n      x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\r\n      y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\r\n      z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],\r\n    };\r\n    /* return {\r\n         x: x * me.a + y * me.c + me.e,\r\n         y: x * me.b + y * me.d + me.f\r\n         }; */\r\n  }\r\n  function applyToX(x, y, z) {\r\n    return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];\r\n  }\r\n  function applyToY(x, y, z) {\r\n    return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];\r\n  }\r\n  function applyToZ(x, y, z) {\r\n    return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];\r\n  }\r\n\r\n  function getInverseMatrix() {\r\n    var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];\r\n    var a = this.props[5] / determinant;\r\n    var b = -this.props[1] / determinant;\r\n    var c = -this.props[4] / determinant;\r\n    var d = this.props[0] / determinant;\r\n    var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant;\r\n    var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant;\r\n    var inverseMatrix = new Matrix();\r\n    inverseMatrix.props[0] = a;\r\n    inverseMatrix.props[1] = b;\r\n    inverseMatrix.props[4] = c;\r\n    inverseMatrix.props[5] = d;\r\n    inverseMatrix.props[12] = e;\r\n    inverseMatrix.props[13] = f;\r\n    return inverseMatrix;\r\n  }\r\n\r\n  function inversePoint(pt) {\r\n    var inverseMatrix = this.getInverseMatrix();\r\n    return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0);\r\n  }\r\n\r\n  function inversePoints(pts) {\r\n    var i;\r\n    var len = pts.length;\r\n    var retPts = [];\r\n    for (i = 0; i < len; i += 1) {\r\n      retPts[i] = inversePoint(pts[i]);\r\n    }\r\n    return retPts;\r\n  }\r\n\r\n  function applyToTriplePoints(pt1, pt2, pt3) {\r\n    var arr = createTypedArray('float32', 6);\r\n    if (this.isIdentity()) {\r\n      arr[0] = pt1[0];\r\n      arr[1] = pt1[1];\r\n      arr[2] = pt2[0];\r\n      arr[3] = pt2[1];\r\n      arr[4] = pt3[0];\r\n      arr[5] = pt3[1];\r\n    } else {\r\n      var p0 = this.props[0];\r\n      var p1 = this.props[1];\r\n      var p4 = this.props[4];\r\n      var p5 = this.props[5];\r\n      var p12 = this.props[12];\r\n      var p13 = this.props[13];\r\n      arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;\r\n      arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;\r\n      arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;\r\n      arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;\r\n      arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;\r\n      arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;\r\n    }\r\n    return arr;\r\n  }\r\n\r\n  function applyToPointArray(x, y, z) {\r\n    var arr;\r\n    if (this.isIdentity()) {\r\n      arr = [x, y, z];\r\n    } else {\r\n      arr = [\r\n        x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\r\n        x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\r\n        x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],\r\n      ];\r\n    }\r\n    return arr;\r\n  }\r\n\r\n  function applyToPointStringified(x, y) {\r\n    if (this.isIdentity()) {\r\n      return x + ',' + y;\r\n    }\r\n    var _p = this.props;\r\n    return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;\r\n  }\r\n\r\n  function toCSS() {\r\n    // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\r\n    /* if(this.isIdentity()) {\r\n            return '';\r\n        } */\r\n    var i = 0;\r\n    var props = this.props;\r\n    var cssValue = 'matrix3d(';\r\n    var v = 10000;\r\n    while (i < 16) {\r\n      cssValue += _rnd(props[i] * v) / v;\r\n      cssValue += i === 15 ? ')' : ',';\r\n      i += 1;\r\n    }\r\n    return cssValue;\r\n  }\r\n\r\n  function roundMatrixProperty(val) {\r\n    var v = 10000;\r\n    if ((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {\r\n      return _rnd(val * v) / v;\r\n    }\r\n    return val;\r\n  }\r\n\r\n  function to2dCSS() {\r\n    // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\r\n    /* if(this.isIdentity()) {\r\n            return '';\r\n        } */\r\n    var props = this.props;\r\n    var _a = roundMatrixProperty(props[0]);\r\n    var _b = roundMatrixProperty(props[1]);\r\n    var _c = roundMatrixProperty(props[4]);\r\n    var _d = roundMatrixProperty(props[5]);\r\n    var _e = roundMatrixProperty(props[12]);\r\n    var _f = roundMatrixProperty(props[13]);\r\n    return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')';\r\n  }\r\n\r\n  return function () {\r\n    this.reset = reset;\r\n    this.rotate = rotate;\r\n    this.rotateX = rotateX;\r\n    this.rotateY = rotateY;\r\n    this.rotateZ = rotateZ;\r\n    this.skew = skew;\r\n    this.skewFromAxis = skewFromAxis;\r\n    this.shear = shear;\r\n    this.scale = scale;\r\n    this.setTransform = setTransform;\r\n    this.translate = translate;\r\n    this.transform = transform;\r\n    this.applyToPoint = applyToPoint;\r\n    this.applyToX = applyToX;\r\n    this.applyToY = applyToY;\r\n    this.applyToZ = applyToZ;\r\n    this.applyToPointArray = applyToPointArray;\r\n    this.applyToTriplePoints = applyToTriplePoints;\r\n    this.applyToPointStringified = applyToPointStringified;\r\n    this.toCSS = toCSS;\r\n    this.to2dCSS = to2dCSS;\r\n    this.clone = clone;\r\n    this.cloneFromProps = cloneFromProps;\r\n    this.equals = equals;\r\n    this.inversePoints = inversePoints;\r\n    this.inversePoint = inversePoint;\r\n    this.getInverseMatrix = getInverseMatrix;\r\n    this._t = this.transform;\r\n    this.isIdentity = isIdentity;\r\n    this._identity = true;\r\n    this._identityCalculated = false;\r\n\r\n    this.props = createTypedArray('float32', 16);\r\n    this.reset();\r\n  };\r\n}());\r\n\r\n/* eslint-disable */\r\n/*\r\n Copyright 2014 David Bau.\r\n\r\n Permission is hereby granted, free of charge, to any person obtaining\r\n a copy of this software and associated documentation files (the\r\n \"Software\"), to deal in the Software without restriction, including\r\n without limitation the rights to use, copy, modify, merge, publish,\r\n distribute, sublicense, and/or sell copies of the Software, and to\r\n permit persons to whom the Software is furnished to do so, subject to\r\n the following conditions:\r\n\r\n The above copyright notice and this permission notice shall be\r\n included in all copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n */\r\n\r\n(function (pool, math) {\r\n//\r\n// The following constants are related to IEEE 754 limits.\r\n//\r\n    var global = this,\r\n        width = 256,        // each RC4 output is 0 <= x < 256\r\n        chunks = 6,         // at least six RC4 outputs for each double\r\n        digits = 52,        // there are 52 significant digits in a double\r\n        rngname = 'random', // rngname: name for Math.random and Math.seedrandom\r\n        startdenom = math.pow(width, chunks),\r\n        significance = math.pow(2, digits),\r\n        overflow = significance * 2,\r\n        mask = width - 1,\r\n        nodecrypto;         // node.js crypto module, initialized at the bottom.\r\n\r\n//\r\n// seedrandom()\r\n// This is the seedrandom function described above.\r\n//\r\n    function seedrandom(seed, options, callback) {\r\n        var key = [];\r\n        options = (options === true) ? { entropy: true } : (options || {});\r\n\r\n        // Flatten the seed string or build one from local entropy if needed.\r\n        var shortseed = mixkey(flatten(\r\n            options.entropy ? [seed, tostring(pool)] :\r\n                (seed === null) ? autoseed() : seed, 3), key);\r\n\r\n        // Use the seed to initialize an ARC4 generator.\r\n        var arc4 = new ARC4(key);\r\n\r\n        // This function returns a random double in [0, 1) that contains\r\n        // randomness in every bit of the mantissa of the IEEE 754 value.\r\n        var prng = function() {\r\n            var n = arc4.g(chunks),             // Start with a numerator n < 2 ^ 48\r\n                d = startdenom,                 //   and denominator d = 2 ^ 48.\r\n                x = 0;                          //   and no 'extra last byte'.\r\n            while (n < significance) {          // Fill up all significant digits by\r\n                n = (n + x) * width;              //   shifting numerator and\r\n                d *= width;                       //   denominator and generating a\r\n                x = arc4.g(1);                    //   new least-significant-byte.\r\n            }\r\n            while (n >= overflow) {             // To avoid rounding up, before adding\r\n                n /= 2;                           //   last byte, shift everything\r\n                d /= 2;                           //   right using integer math until\r\n                x >>>= 1;                         //   we have exactly the desired bits.\r\n            }\r\n            return (n + x) / d;                 // Form the number within [0, 1).\r\n        };\r\n\r\n        prng.int32 = function() { return arc4.g(4) | 0; };\r\n        prng.quick = function() { return arc4.g(4) / 0x100000000; };\r\n        prng.double = prng;\r\n\r\n        // Mix the randomness into accumulated entropy.\r\n        mixkey(tostring(arc4.S), pool);\r\n\r\n        // Calling convention: what to return as a function of prng, seed, is_math.\r\n        return (options.pass || callback ||\r\n        function(prng, seed, is_math_call, state) {\r\n            if (state) {\r\n                // Load the arc4 state from the given state if it has an S array.\r\n                if (state.S) { copy(state, arc4); }\r\n                // Only provide the .state method if requested via options.state.\r\n                prng.state = function() { return copy(arc4, {}); };\r\n            }\r\n\r\n            // If called as a method of Math (Math.seedrandom()), mutate\r\n            // Math.random because that is how seedrandom.js has worked since v1.0.\r\n            if (is_math_call) { math[rngname] = prng; return seed; }\r\n\r\n            // Otherwise, it is a newer calling convention, so return the\r\n            // prng directly.\r\n            else return prng;\r\n        })(\r\n            prng,\r\n            shortseed,\r\n            'global' in options ? options.global : (this == math),\r\n            options.state);\r\n    }\r\n    math['seed' + rngname] = seedrandom;\r\n\r\n//\r\n// ARC4\r\n//\r\n// An ARC4 implementation.  The constructor takes a key in the form of\r\n// an array of at most (width) integers that should be 0 <= x < (width).\r\n//\r\n// The g(count) method returns a pseudorandom integer that concatenates\r\n// the next (count) outputs from ARC4.  Its return value is a number x\r\n// that is in the range 0 <= x < (width ^ count).\r\n//\r\n    function ARC4(key) {\r\n        var t, keylen = key.length,\r\n            me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\r\n\r\n        // The empty key [] is treated as [0].\r\n        if (!keylen) { key = [keylen++]; }\r\n\r\n        // Set up S using the standard key scheduling algorithm.\r\n        while (i < width) {\r\n            s[i] = i++;\r\n        }\r\n        for (i = 0; i < width; i++) {\r\n            s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\r\n            s[j] = t;\r\n        }\r\n\r\n        // The \"g\" method returns the next (count) outputs as one number.\r\n        me.g = function(count) {\r\n            // Using instance members instead of closure state nearly doubles speed.\r\n            var t, r = 0,\r\n                i = me.i, j = me.j, s = me.S;\r\n            while (count--) {\r\n                t = s[i = mask & (i + 1)];\r\n                r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\r\n            }\r\n            me.i = i; me.j = j;\r\n            return r;\r\n            // For robust unpredictability, the function call below automatically\r\n            // discards an initial batch of values.  This is called RC4-drop[256].\r\n            // See http://google.com/search?q=rsa+fluhrer+response&btnI\r\n        };\r\n    }\r\n\r\n//\r\n// copy()\r\n// Copies internal state of ARC4 to or from a plain object.\r\n//\r\n    function copy(f, t) {\r\n        t.i = f.i;\r\n        t.j = f.j;\r\n        t.S = f.S.slice();\r\n        return t;\r\n    }\r\n\r\n//\r\n// flatten()\r\n// Converts an object tree to nested arrays of strings.\r\n//\r\n    function flatten(obj, depth) {\r\n        var result = [], typ = (typeof obj), prop;\r\n        if (depth && typ == 'object') {\r\n            for (prop in obj) {\r\n                try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\r\n            }\r\n        }\r\n        return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\r\n    }\r\n\r\n//\r\n// mixkey()\r\n// Mixes a string seed into a key that is an array of integers, and\r\n// returns a shortened string seed that is equivalent to the result key.\r\n//\r\n    function mixkey(seed, key) {\r\n        var stringseed = seed + '', smear, j = 0;\r\n        while (j < stringseed.length) {\r\n            key[mask & j] =\r\n                mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\r\n        }\r\n        return tostring(key);\r\n    }\r\n\r\n//\r\n// autoseed()\r\n// Returns an object for autoseeding, using window.crypto and Node crypto\r\n// module if available.\r\n//\r\n    function autoseed() {\r\n        try {\r\n            if (nodecrypto) { return tostring(nodecrypto.randomBytes(width)); }\r\n            var out = new Uint8Array(width);\r\n            (global.crypto || global.msCrypto).getRandomValues(out);\r\n            return tostring(out);\r\n        } catch (e) {\r\n            var browser = global.navigator,\r\n                plugins = browser && browser.plugins;\r\n            return [+new Date(), global, plugins, global.screen, tostring(pool)];\r\n        }\r\n    }\r\n\r\n//\r\n// tostring()\r\n// Converts an array of charcodes to a string\r\n//\r\n    function tostring(a) {\r\n        return String.fromCharCode.apply(0, a);\r\n    }\r\n\r\n//\r\n// When seedrandom.js is loaded, we immediately mix a few bits\r\n// from the built-in RNG into the entropy pool.  Because we do\r\n// not want to interfere with deterministic PRNG state later,\r\n// seedrandom will not call math.random on its own again after\r\n// initialization.\r\n//\r\n    mixkey(math.random(), pool);\r\n\r\n//\r\n// Nodejs and AMD support: export the implementation as a module using\r\n// either convention.\r\n//\r\n\r\n// End anonymous scope, and pass initial values.\r\n})(\r\n    [],     // pool: entropy pool starts empty\r\n    BMMath    // math: package containing random, pow, and seedrandom\r\n);\r\n/* eslint-disable */\r\nvar BezierFactory = (function () {\r\n  /**\r\n     * BezierEasing - use bezier curve for transition easing function\r\n     * by Gaëtan Renaudeau 2014 - 2015 – MIT License\r\n     *\r\n     * Credits: is based on Firefox's nsSMILKeySpline.cpp\r\n     * Usage:\r\n     * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])\r\n     * spline.get(x) => returns the easing value | x must be in [0, 1] range\r\n     *\r\n     */\r\n\r\n  var ob = {};\r\n  ob.getBezierEasing = getBezierEasing;\r\n  var beziers = {};\r\n\r\n  function getBezierEasing(a, b, c, d, nm) {\r\n    var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\\./g, 'p');\r\n    if (beziers[str]) {\r\n      return beziers[str];\r\n    }\r\n    var bezEasing = new BezierEasing([a, b, c, d]);\r\n    beziers[str] = bezEasing;\r\n    return bezEasing;\r\n  }\r\n\r\n  // These values are established by empiricism with tests (tradeoff: performance VS precision)\r\n  var NEWTON_ITERATIONS = 4;\r\n  var NEWTON_MIN_SLOPE = 0.001;\r\n  var SUBDIVISION_PRECISION = 0.0000001;\r\n  var SUBDIVISION_MAX_ITERATIONS = 10;\r\n\r\n  var kSplineTableSize = 11;\r\n  var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);\r\n\r\n  var float32ArraySupported = typeof Float32Array === 'function';\r\n\r\n  function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }\r\n  function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }\r\n  function C(aA1) { return 3.0 * aA1; }\r\n\r\n  // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\r\n  function calcBezier(aT, aA1, aA2) {\r\n    return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;\r\n  }\r\n\r\n  // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\r\n  function getSlope(aT, aA1, aA2) {\r\n    return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);\r\n  }\r\n\r\n  function binarySubdivide(aX, aA, aB, mX1, mX2) {\r\n    var currentX,\r\n      currentT,\r\n      i = 0;\r\n    do {\r\n      currentT = aA + (aB - aA) / 2.0;\r\n      currentX = calcBezier(currentT, mX1, mX2) - aX;\r\n      if (currentX > 0.0) {\r\n        aB = currentT;\r\n      } else {\r\n        aA = currentT;\r\n      }\r\n    } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);\r\n    return currentT;\r\n  }\r\n\r\n  function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\r\n    for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\r\n      var currentSlope = getSlope(aGuessT, mX1, mX2);\r\n      if (currentSlope === 0.0) return aGuessT;\r\n      var currentX = calcBezier(aGuessT, mX1, mX2) - aX;\r\n      aGuessT -= currentX / currentSlope;\r\n    }\r\n    return aGuessT;\r\n  }\r\n\r\n  /**\r\n     * points is an array of [ mX1, mY1, mX2, mY2 ]\r\n     */\r\n  function BezierEasing(points) {\r\n    this._p = points;\r\n    this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);\r\n    this._precomputed = false;\r\n\r\n    this.get = this.get.bind(this);\r\n  }\r\n\r\n  BezierEasing.prototype = {\r\n\r\n    get: function (x) {\r\n      var mX1 = this._p[0],\r\n        mY1 = this._p[1],\r\n        mX2 = this._p[2],\r\n        mY2 = this._p[3];\r\n      if (!this._precomputed) this._precompute();\r\n      if (mX1 === mY1 && mX2 === mY2) return x; // linear\r\n      // Because JavaScript number are imprecise, we should guarantee the extremes are right.\r\n      if (x === 0) return 0;\r\n      if (x === 1) return 1;\r\n      return calcBezier(this._getTForX(x), mY1, mY2);\r\n    },\r\n\r\n    // Private part\r\n\r\n    _precompute: function () {\r\n      var mX1 = this._p[0],\r\n        mY1 = this._p[1],\r\n        mX2 = this._p[2],\r\n        mY2 = this._p[3];\r\n      this._precomputed = true;\r\n      if (mX1 !== mY1 || mX2 !== mY2) { this._calcSampleValues(); }\r\n    },\r\n\r\n    _calcSampleValues: function () {\r\n      var mX1 = this._p[0],\r\n        mX2 = this._p[2];\r\n      for (var i = 0; i < kSplineTableSize; ++i) {\r\n        this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\r\n      }\r\n    },\r\n\r\n    /**\r\n         * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.\r\n         */\r\n    _getTForX: function (aX) {\r\n      var mX1 = this._p[0],\r\n        mX2 = this._p[2],\r\n        mSampleValues = this._mSampleValues;\r\n\r\n      var intervalStart = 0.0;\r\n      var currentSample = 1;\r\n      var lastSample = kSplineTableSize - 1;\r\n\r\n      for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {\r\n        intervalStart += kSampleStepSize;\r\n      }\r\n      --currentSample;\r\n\r\n      // Interpolate to provide an initial guess for t\r\n      var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]);\r\n      var guessForT = intervalStart + dist * kSampleStepSize;\r\n\r\n      var initialSlope = getSlope(guessForT, mX1, mX2);\r\n      if (initialSlope >= NEWTON_MIN_SLOPE) {\r\n        return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\r\n      } if (initialSlope === 0.0) {\r\n        return guessForT;\r\n      }\r\n      return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);\r\n    },\r\n  };\r\n\r\n  return ob;\r\n}());\r\n\r\n(function () {\r\n  var lastTime = 0;\r\n  var vendors = ['ms', 'moz', 'webkit', 'o'];\r\n  for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { // eslint-disable-line no-plusplus\r\n    window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];\r\n    window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];\r\n  }\r\n  if (!window.requestAnimationFrame) {\r\n    window.requestAnimationFrame = function (callback) {\r\n      var currTime = new Date().getTime();\r\n      var timeToCall = Math.max(0, 16 - (currTime - lastTime));\r\n      var id = setTimeout(function () {\r\n        callback(currTime + timeToCall);\r\n      },\r\n      timeToCall);\r\n      lastTime = currTime + timeToCall;\r\n      return id;\r\n    };\r\n  }\r\n  if (!window.cancelAnimationFrame) {\r\n    window.cancelAnimationFrame = function (id) {\r\n      clearTimeout(id);\r\n    };\r\n  }\r\n}());\r\n\r\n/* exported extendPrototype, getDescriptor, createProxyFunction */\r\n\r\nfunction extendPrototype(sources, destination) {\r\n  var i;\r\n  var len = sources.length;\r\n  var sourcePrototype;\r\n  for (i = 0; i < len; i += 1) {\r\n    sourcePrototype = sources[i].prototype;\r\n    for (var attr in sourcePrototype) {\r\n      if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr)) destination.prototype[attr] = sourcePrototype[attr];\r\n    }\r\n  }\r\n}\r\n\r\nfunction getDescriptor(object, prop) {\r\n  return Object.getOwnPropertyDescriptor(object, prop);\r\n}\r\n\r\nfunction createProxyFunction(prototype) {\r\n  function ProxyFunction() {}\r\n  ProxyFunction.prototype = prototype;\r\n  return ProxyFunction;\r\n}\r\n\r\n/* global segmentsLengthPool, defaultCurveSegments, createSizedArray, bmPow, bmSqrt, bmFloor, createTypedArray, bezierLengthPool */\r\n/* exported bez */\r\n\r\nfunction bezFunction() {\r\n  var math = Math;\r\n\r\n  function pointOnLine2D(x1, y1, x2, y2, x3, y3) {\r\n    var det1 = (x1 * y2) + (y1 * x3) + (x2 * y3) - (x3 * y2) - (y3 * x1) - (x2 * y1);\r\n    return det1 > -0.001 && det1 < 0.001;\r\n  }\r\n\r\n  function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {\r\n    if (z1 === 0 && z2 === 0 && z3 === 0) {\r\n      return pointOnLine2D(x1, y1, x2, y2, x3, y3);\r\n    }\r\n    var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2));\r\n    var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2));\r\n    var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2));\r\n    var diffDist;\r\n    if (dist1 > dist2) {\r\n      if (dist1 > dist3) {\r\n        diffDist = dist1 - dist2 - dist3;\r\n      } else {\r\n        diffDist = dist3 - dist2 - dist1;\r\n      }\r\n    } else if (dist3 > dist2) {\r\n      diffDist = dist3 - dist2 - dist1;\r\n    } else {\r\n      diffDist = dist2 - dist1 - dist3;\r\n    }\r\n    return diffDist > -0.0001 && diffDist < 0.0001;\r\n  }\r\n\r\n  var getBezierLength = (function () {\r\n    return function (pt1, pt2, pt3, pt4) {\r\n      var curveSegments = defaultCurveSegments;\r\n      var k;\r\n      var i;\r\n      var len;\r\n      var ptCoord;\r\n      var perc;\r\n      var addedLength = 0;\r\n      var ptDistance;\r\n      var point = [];\r\n      var lastPoint = [];\r\n      var lengthData = bezierLengthPool.newElement();\r\n      len = pt3.length;\r\n      for (k = 0; k < curveSegments; k += 1) {\r\n        perc = k / (curveSegments - 1);\r\n        ptDistance = 0;\r\n        for (i = 0; i < len; i += 1) {\r\n          ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] + bmPow(perc, 3) * pt2[i];\r\n          point[i] = ptCoord;\r\n          if (lastPoint[i] !== null) {\r\n            ptDistance += bmPow(point[i] - lastPoint[i], 2);\r\n          }\r\n          lastPoint[i] = point[i];\r\n        }\r\n        if (ptDistance) {\r\n          ptDistance = bmSqrt(ptDistance);\r\n          addedLength += ptDistance;\r\n        }\r\n        lengthData.percents[k] = perc;\r\n        lengthData.lengths[k] = addedLength;\r\n      }\r\n      lengthData.addedLength = addedLength;\r\n      return lengthData;\r\n    };\r\n  }());\r\n\r\n  function getSegmentsLength(shapeData) {\r\n    var segmentsLength = segmentsLengthPool.newElement();\r\n    var closed = shapeData.c;\r\n    var pathV = shapeData.v;\r\n    var pathO = shapeData.o;\r\n    var pathI = shapeData.i;\r\n    var i;\r\n    var len = shapeData._length;\r\n    var lengths = segmentsLength.lengths;\r\n    var totalLength = 0;\r\n    for (i = 0; i < len - 1; i += 1) {\r\n      lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]);\r\n      totalLength += lengths[i].addedLength;\r\n    }\r\n    if (closed && len) {\r\n      lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]);\r\n      totalLength += lengths[i].addedLength;\r\n    }\r\n    segmentsLength.totalLength = totalLength;\r\n    return segmentsLength;\r\n  }\r\n\r\n  function BezierData(length) {\r\n    this.segmentLength = 0;\r\n    this.points = new Array(length);\r\n  }\r\n\r\n  function PointData(partial, point) {\r\n    this.partialLength = partial;\r\n    this.point = point;\r\n  }\r\n\r\n  var buildBezierData = (function () {\r\n    var storedData = {};\r\n\r\n    return function (pt1, pt2, pt3, pt4) {\r\n      var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\\./g, 'p');\r\n      if (!storedData[bezierName]) {\r\n        var curveSegments = defaultCurveSegments;\r\n        var k;\r\n        var i;\r\n        var len;\r\n        var ptCoord;\r\n        var perc;\r\n        var addedLength = 0;\r\n        var ptDistance;\r\n        var point;\r\n        var lastPoint = null;\r\n        if (pt1.length === 2 && (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) {\r\n          curveSegments = 2;\r\n        }\r\n        var bezierData = new BezierData(curveSegments);\r\n        len = pt3.length;\r\n        for (k = 0; k < curveSegments; k += 1) {\r\n          point = createSizedArray(len);\r\n          perc = k / (curveSegments - 1);\r\n          ptDistance = 0;\r\n          for (i = 0; i < len; i += 1) {\r\n            ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) + bmPow(perc, 3) * pt2[i];\r\n            point[i] = ptCoord;\r\n            if (lastPoint !== null) {\r\n              ptDistance += bmPow(point[i] - lastPoint[i], 2);\r\n            }\r\n          }\r\n          ptDistance = bmSqrt(ptDistance);\r\n          addedLength += ptDistance;\r\n          bezierData.points[k] = new PointData(ptDistance, point);\r\n          lastPoint = point;\r\n        }\r\n        bezierData.segmentLength = addedLength;\r\n        storedData[bezierName] = bezierData;\r\n      }\r\n      return storedData[bezierName];\r\n    };\r\n  }());\r\n\r\n  function getDistancePerc(perc, bezierData) {\r\n    var percents = bezierData.percents;\r\n    var lengths = bezierData.lengths;\r\n    var len = percents.length;\r\n    var initPos = bmFloor((len - 1) * perc);\r\n    var lengthPos = perc * bezierData.addedLength;\r\n    var lPerc = 0;\r\n    if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {\r\n      return percents[initPos];\r\n    }\r\n    var dir = lengths[initPos] > lengthPos ? -1 : 1;\r\n    var flag = true;\r\n    while (flag) {\r\n      if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {\r\n        lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]);\r\n        flag = false;\r\n      } else {\r\n        initPos += dir;\r\n      }\r\n      if (initPos < 0 || initPos >= len - 1) {\r\n        // FIX for TypedArrays that don't store floating point values with enough accuracy\r\n        if (initPos === len - 1) {\r\n          return percents[initPos];\r\n        }\r\n        flag = false;\r\n      }\r\n    }\r\n    return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc;\r\n  }\r\n\r\n  function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {\r\n    var t1 = getDistancePerc(percent, bezierData);\r\n    var u1 = 1 - t1;\r\n    var ptX = math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000;\r\n    var ptY = math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000;\r\n    return [ptX, ptY];\r\n  }\r\n\r\n  var bezierSegmentPoints = createTypedArray('float32', 8);\r\n\r\n  function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {\r\n    if (startPerc < 0) {\r\n      startPerc = 0;\r\n    } else if (startPerc > 1) {\r\n      startPerc = 1;\r\n    }\r\n    var t0 = getDistancePerc(startPerc, bezierData);\r\n    endPerc = endPerc > 1 ? 1 : endPerc;\r\n    var t1 = getDistancePerc(endPerc, bezierData);\r\n    var i;\r\n    var len = pt1.length;\r\n    var u0 = 1 - t0;\r\n    var u1 = 1 - t1;\r\n    var u0u0u0 = u0 * u0 * u0;\r\n    var t0u0u0_3 = t0 * u0 * u0 * 3; // eslint-disable-line camelcase\r\n    var t0t0u0_3 = t0 * t0 * u0 * 3; // eslint-disable-line camelcase\r\n    var t0t0t0 = t0 * t0 * t0;\r\n    //\r\n    var u0u0u1 = u0 * u0 * u1;\r\n    var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1; // eslint-disable-line camelcase\r\n    var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1; // eslint-disable-line camelcase\r\n    var t0t0t1 = t0 * t0 * t1;\r\n    //\r\n    var u0u1u1 = u0 * u1 * u1;\r\n    var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1; // eslint-disable-line camelcase\r\n    var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1; // eslint-disable-line camelcase\r\n    var t0t1t1 = t0 * t1 * t1;\r\n    //\r\n    var u1u1u1 = u1 * u1 * u1;\r\n    var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1; // eslint-disable-line camelcase\r\n    var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1; // eslint-disable-line camelcase\r\n    var t1t1t1 = t1 * t1 * t1;\r\n    for (i = 0; i < len; i += 1) {\r\n      bezierSegmentPoints[i * 4] = math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n      bezierSegmentPoints[i * 4 + 1] = math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n      bezierSegmentPoints[i * 4 + 2] = math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n      bezierSegmentPoints[i * 4 + 3] = math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n    }\r\n\r\n    return bezierSegmentPoints;\r\n  }\r\n\r\n  return {\r\n    getSegmentsLength: getSegmentsLength,\r\n    getNewSegment: getNewSegment,\r\n    getPointInSegment: getPointInSegment,\r\n    buildBezierData: buildBezierData,\r\n    pointOnLine2D: pointOnLine2D,\r\n    pointOnLine3D: pointOnLine3D,\r\n  };\r\n}\r\n\r\nvar bez = bezFunction();\r\n\r\n/* exported dataManager */\r\n\r\nfunction dataFunctionManager() {\r\n  // var tCanvasHelper = createTag('canvas').getContext('2d');\r\n\r\n  function completeLayers(layers, comps, fontManager) {\r\n    var layerData;\r\n    var i;\r\n    var len = layers.length;\r\n    var j;\r\n    var jLen;\r\n    var k;\r\n    var kLen;\r\n    for (i = 0; i < len; i += 1) {\r\n      layerData = layers[i];\r\n      if (('ks' in layerData) && !layerData.completed) {\r\n        layerData.completed = true;\r\n        if (layerData.tt) {\r\n          layers[i - 1].td = layerData.tt;\r\n        }\r\n        if (layerData.hasMask) {\r\n          var maskProps = layerData.masksProperties;\r\n          jLen = maskProps.length;\r\n          for (j = 0; j < jLen; j += 1) {\r\n            if (maskProps[j].pt.k.i) {\r\n              convertPathsToAbsoluteValues(maskProps[j].pt.k);\r\n            } else {\r\n              kLen = maskProps[j].pt.k.length;\r\n              for (k = 0; k < kLen; k += 1) {\r\n                if (maskProps[j].pt.k[k].s) {\r\n                  convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);\r\n                }\r\n                if (maskProps[j].pt.k[k].e) {\r\n                  convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        if (layerData.ty === 0) {\r\n          layerData.layers = findCompLayers(layerData.refId, comps);\r\n          completeLayers(layerData.layers, comps, fontManager);\r\n        } else if (layerData.ty === 4) {\r\n          completeShapes(layerData.shapes);\r\n        } else if (layerData.ty === 5) {\r\n          completeText(layerData, fontManager);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  function findCompLayers(id, comps) {\r\n    var i = 0;\r\n    var len = comps.length;\r\n    while (i < len) {\r\n      if (comps[i].id === id) {\r\n        if (!comps[i].layers.__used) {\r\n          comps[i].layers.__used = true;\r\n          return comps[i].layers;\r\n        }\r\n        return JSON.parse(JSON.stringify(comps[i].layers));\r\n      }\r\n      i += 1;\r\n    }\r\n    return null;\r\n  }\r\n\r\n  function completeShapes(arr) {\r\n    var i;\r\n    var len = arr.length;\r\n    var j;\r\n    var jLen;\r\n    for (i = len - 1; i >= 0; i -= 1) {\r\n      if (arr[i].ty === 'sh') {\r\n        if (arr[i].ks.k.i) {\r\n          convertPathsToAbsoluteValues(arr[i].ks.k);\r\n        } else {\r\n          jLen = arr[i].ks.k.length;\r\n          for (j = 0; j < jLen; j += 1) {\r\n            if (arr[i].ks.k[j].s) {\r\n              convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);\r\n            }\r\n            if (arr[i].ks.k[j].e) {\r\n              convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);\r\n            }\r\n          }\r\n        }\r\n      } else if (arr[i].ty === 'gr') {\r\n        completeShapes(arr[i].it);\r\n      }\r\n    }\r\n  }\r\n\r\n  function convertPathsToAbsoluteValues(path) {\r\n    var i;\r\n    var len = path.i.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      path.i[i][0] += path.v[i][0];\r\n      path.i[i][1] += path.v[i][1];\r\n      path.o[i][0] += path.v[i][0];\r\n      path.o[i][1] += path.v[i][1];\r\n    }\r\n  }\r\n\r\n  function checkVersion(minimum, animVersionString) {\r\n    var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100];\r\n    if (minimum[0] > animVersion[0]) {\r\n      return true;\r\n    } if (animVersion[0] > minimum[0]) {\r\n      return false;\r\n    }\r\n    if (minimum[1] > animVersion[1]) {\r\n      return true;\r\n    } if (animVersion[1] > minimum[1]) {\r\n      return false;\r\n    }\r\n    if (minimum[2] > animVersion[2]) {\r\n      return true;\r\n    } if (animVersion[2] > minimum[2]) {\r\n      return false;\r\n    }\r\n    return null;\r\n  }\r\n\r\n  var checkText = (function () {\r\n    var minimumVersion = [4, 4, 14];\r\n\r\n    function updateTextLayer(textLayer) {\r\n      var documentData = textLayer.t.d;\r\n      textLayer.t.d = {\r\n        k: [\r\n          {\r\n            s: documentData,\r\n            t: 0,\r\n          },\r\n        ],\r\n      };\r\n    }\r\n\r\n    function iterateLayers(layers) {\r\n      var i;\r\n      var len = layers.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        if (layers[i].ty === 5) {\r\n          updateTextLayer(layers[i]);\r\n        }\r\n      }\r\n    }\r\n\r\n    return function (animationData) {\r\n      if (checkVersion(minimumVersion, animationData.v)) {\r\n        iterateLayers(animationData.layers);\r\n        if (animationData.assets) {\r\n          var i;\r\n          var len = animationData.assets.length;\r\n          for (i = 0; i < len; i += 1) {\r\n            if (animationData.assets[i].layers) {\r\n              iterateLayers(animationData.assets[i].layers);\r\n            }\r\n          }\r\n        }\r\n      }\r\n    };\r\n  }());\r\n\r\n  var checkChars = (function () {\r\n    var minimumVersion = [4, 7, 99];\r\n    return function (animationData) {\r\n      if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {\r\n        var i;\r\n        var len = animationData.chars.length;\r\n        var j;\r\n        var jLen;\r\n        var pathData;\r\n        var paths;\r\n        for (i = 0; i < len; i += 1) {\r\n          if (animationData.chars[i].data && animationData.chars[i].data.shapes) {\r\n            paths = animationData.chars[i].data.shapes[0].it;\r\n            jLen = paths.length;\r\n\r\n            for (j = 0; j < jLen; j += 1) {\r\n              pathData = paths[j].ks.k;\r\n              if (!pathData.__converted) {\r\n                convertPathsToAbsoluteValues(paths[j].ks.k);\r\n                pathData.__converted = true;\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    };\r\n  }());\r\n\r\n  var checkPathProperties = (function () {\r\n    var minimumVersion = [5, 7, 15];\r\n\r\n    function updateTextLayer(textLayer) {\r\n      var pathData = textLayer.t.p;\r\n      if (typeof pathData.a === 'number') {\r\n        pathData.a = {\r\n          a: 0,\r\n          k: pathData.a,\r\n        };\r\n      }\r\n      if (typeof pathData.p === 'number') {\r\n        pathData.p = {\r\n          a: 0,\r\n          k: pathData.p,\r\n        };\r\n      }\r\n      if (typeof pathData.r === 'number') {\r\n        pathData.r = {\r\n          a: 0,\r\n          k: pathData.r,\r\n        };\r\n      }\r\n    }\r\n\r\n    function iterateLayers(layers) {\r\n      var i;\r\n      var len = layers.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        if (layers[i].ty === 5) {\r\n          updateTextLayer(layers[i]);\r\n        }\r\n      }\r\n    }\r\n\r\n    return function (animationData) {\r\n      if (checkVersion(minimumVersion, animationData.v)) {\r\n        iterateLayers(animationData.layers);\r\n        if (animationData.assets) {\r\n          var i;\r\n          var len = animationData.assets.length;\r\n          for (i = 0; i < len; i += 1) {\r\n            if (animationData.assets[i].layers) {\r\n              iterateLayers(animationData.assets[i].layers);\r\n            }\r\n          }\r\n        }\r\n      }\r\n    };\r\n  }());\r\n\r\n  var checkColors = (function () {\r\n    var minimumVersion = [4, 1, 9];\r\n\r\n    function iterateShapes(shapes) {\r\n      var i;\r\n      var len = shapes.length;\r\n      var j;\r\n      var jLen;\r\n      for (i = 0; i < len; i += 1) {\r\n        if (shapes[i].ty === 'gr') {\r\n          iterateShapes(shapes[i].it);\r\n        } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {\r\n          if (shapes[i].c.k && shapes[i].c.k[0].i) {\r\n            jLen = shapes[i].c.k.length;\r\n            for (j = 0; j < jLen; j += 1) {\r\n              if (shapes[i].c.k[j].s) {\r\n                shapes[i].c.k[j].s[0] /= 255;\r\n                shapes[i].c.k[j].s[1] /= 255;\r\n                shapes[i].c.k[j].s[2] /= 255;\r\n                shapes[i].c.k[j].s[3] /= 255;\r\n              }\r\n              if (shapes[i].c.k[j].e) {\r\n                shapes[i].c.k[j].e[0] /= 255;\r\n                shapes[i].c.k[j].e[1] /= 255;\r\n                shapes[i].c.k[j].e[2] /= 255;\r\n                shapes[i].c.k[j].e[3] /= 255;\r\n              }\r\n            }\r\n          } else {\r\n            shapes[i].c.k[0] /= 255;\r\n            shapes[i].c.k[1] /= 255;\r\n            shapes[i].c.k[2] /= 255;\r\n            shapes[i].c.k[3] /= 255;\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    function iterateLayers(layers) {\r\n      var i;\r\n      var len = layers.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        if (layers[i].ty === 4) {\r\n          iterateShapes(layers[i].shapes);\r\n        }\r\n      }\r\n    }\r\n\r\n    return function (animationData) {\r\n      if (checkVersion(minimumVersion, animationData.v)) {\r\n        iterateLayers(animationData.layers);\r\n        if (animationData.assets) {\r\n          var i;\r\n          var len = animationData.assets.length;\r\n          for (i = 0; i < len; i += 1) {\r\n            if (animationData.assets[i].layers) {\r\n              iterateLayers(animationData.assets[i].layers);\r\n            }\r\n          }\r\n        }\r\n      }\r\n    };\r\n  }());\r\n\r\n  var checkShapes = (function () {\r\n    var minimumVersion = [4, 4, 18];\r\n\r\n    function completeClosingShapes(arr) {\r\n      var i;\r\n      var len = arr.length;\r\n      var j;\r\n      var jLen;\r\n      for (i = len - 1; i >= 0; i -= 1) {\r\n        if (arr[i].ty === 'sh') {\r\n          if (arr[i].ks.k.i) {\r\n            arr[i].ks.k.c = arr[i].closed;\r\n          } else {\r\n            jLen = arr[i].ks.k.length;\r\n            for (j = 0; j < jLen; j += 1) {\r\n              if (arr[i].ks.k[j].s) {\r\n                arr[i].ks.k[j].s[0].c = arr[i].closed;\r\n              }\r\n              if (arr[i].ks.k[j].e) {\r\n                arr[i].ks.k[j].e[0].c = arr[i].closed;\r\n              }\r\n            }\r\n          }\r\n        } else if (arr[i].ty === 'gr') {\r\n          completeClosingShapes(arr[i].it);\r\n        }\r\n      }\r\n    }\r\n\r\n    function iterateLayers(layers) {\r\n      var layerData;\r\n      var i;\r\n      var len = layers.length;\r\n      var j;\r\n      var jLen;\r\n      var k;\r\n      var kLen;\r\n      for (i = 0; i < len; i += 1) {\r\n        layerData = layers[i];\r\n        if (layerData.hasMask) {\r\n          var maskProps = layerData.masksProperties;\r\n          jLen = maskProps.length;\r\n          for (j = 0; j < jLen; j += 1) {\r\n            if (maskProps[j].pt.k.i) {\r\n              maskProps[j].pt.k.c = maskProps[j].cl;\r\n            } else {\r\n              kLen = maskProps[j].pt.k.length;\r\n              for (k = 0; k < kLen; k += 1) {\r\n                if (maskProps[j].pt.k[k].s) {\r\n                  maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;\r\n                }\r\n                if (maskProps[j].pt.k[k].e) {\r\n                  maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        if (layerData.ty === 4) {\r\n          completeClosingShapes(layerData.shapes);\r\n        }\r\n      }\r\n    }\r\n\r\n    return function (animationData) {\r\n      if (checkVersion(minimumVersion, animationData.v)) {\r\n        iterateLayers(animationData.layers);\r\n        if (animationData.assets) {\r\n          var i;\r\n          var len = animationData.assets.length;\r\n          for (i = 0; i < len; i += 1) {\r\n            if (animationData.assets[i].layers) {\r\n              iterateLayers(animationData.assets[i].layers);\r\n            }\r\n          }\r\n        }\r\n      }\r\n    };\r\n  }());\r\n\r\n  function completeData(animationData, fontManager) {\r\n    if (animationData.__complete) {\r\n      return;\r\n    }\r\n    checkColors(animationData);\r\n    checkText(animationData);\r\n    checkChars(animationData);\r\n    checkPathProperties(animationData);\r\n    checkShapes(animationData);\r\n    completeLayers(animationData.layers, animationData.assets, fontManager);\r\n    animationData.__complete = true;\r\n  }\r\n\r\n  function completeText(data) {\r\n    if (data.t.a.length === 0 && !('m' in data.t.p)) {\r\n      data.singleShape = true;\r\n    }\r\n  }\r\n\r\n  var moduleOb = {};\r\n  moduleOb.completeData = completeData;\r\n  moduleOb.checkColors = checkColors;\r\n  moduleOb.checkChars = checkChars;\r\n  moduleOb.checkPathProperties = checkPathProperties;\r\n  moduleOb.checkShapes = checkShapes;\r\n  moduleOb.completeLayers = completeLayers;\r\n\r\n  return moduleOb;\r\n}\r\n\r\nvar dataManager = dataFunctionManager();\r\n\r\n/* exported getFontProperties */\r\n\r\nfunction getFontProperties(fontData) {\r\n  var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];\r\n\r\n  var fWeight = 'normal'; var\r\n    fStyle = 'normal';\r\n  var len = styles.length;\r\n  var styleName;\r\n  for (var i = 0; i < len; i += 1) {\r\n    styleName = styles[i].toLowerCase();\r\n    switch (styleName) {\r\n      case 'italic':\r\n        fStyle = 'italic';\r\n        break;\r\n      case 'bold':\r\n        fWeight = '700';\r\n        break;\r\n      case 'black':\r\n        fWeight = '900';\r\n        break;\r\n      case 'medium':\r\n        fWeight = '500';\r\n        break;\r\n      case 'regular':\r\n      case 'normal':\r\n        fWeight = '400';\r\n        break;\r\n      case 'light':\r\n      case 'thin':\r\n        fWeight = '200';\r\n        break;\r\n      default:\r\n        break;\r\n    }\r\n  }\r\n\r\n  return {\r\n    style: fStyle,\r\n    weight: fontData.fWeight || fWeight,\r\n  };\r\n}\r\n\r\n/* global createNS, createTag, getFontProperties */\r\n/* exported FontManager */\r\n\r\nvar FontManager = (function () {\r\n  var maxWaitingTime = 5000;\r\n  var emptyChar = {\r\n    w: 0,\r\n    size: 0,\r\n    shapes: [],\r\n  };\r\n  var combinedCharacters = [];\r\n  // Hindi characters\r\n  combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366,\r\n    2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379,\r\n    2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);\r\n\r\n  var surrogateModifiers = [\r\n    'd83cdffb',\r\n    'd83cdffc',\r\n    'd83cdffd',\r\n    'd83cdffe',\r\n    'd83cdfff',\r\n  ];\r\n\r\n  var zeroWidthJoiner = [65039, 8205];\r\n\r\n  function trimFontOptions(font) {\r\n    var familyArray = font.split(',');\r\n    var i;\r\n    var len = familyArray.length;\r\n    var enabledFamilies = [];\r\n    for (i = 0; i < len; i += 1) {\r\n      if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {\r\n        enabledFamilies.push(familyArray[i]);\r\n      }\r\n    }\r\n    return enabledFamilies.join(',');\r\n  }\r\n\r\n  function setUpNode(font, family) {\r\n    var parentNode = createTag('span');\r\n    // Node is invisible to screen readers.\r\n    parentNode.setAttribute('aria-hidden', true);\r\n    parentNode.style.fontFamily = family;\r\n    var node = createTag('span');\r\n    // Characters that vary significantly among different fonts\r\n    node.innerText = 'giItT1WQy@!-/#';\r\n    // Visible - so we can measure it - but not on the screen\r\n    parentNode.style.position = 'absolute';\r\n    parentNode.style.left = '-10000px';\r\n    parentNode.style.top = '-10000px';\r\n    // Large font size makes even subtle changes obvious\r\n    parentNode.style.fontSize = '300px';\r\n    // Reset any font properties\r\n    parentNode.style.fontVariant = 'normal';\r\n    parentNode.style.fontStyle = 'normal';\r\n    parentNode.style.fontWeight = 'normal';\r\n    parentNode.style.letterSpacing = '0';\r\n    parentNode.appendChild(node);\r\n    document.body.appendChild(parentNode);\r\n\r\n    // Remember width with no applied web font\r\n    var width = node.offsetWidth;\r\n    node.style.fontFamily = trimFontOptions(font) + ', ' + family;\r\n    return { node: node, w: width, parent: parentNode };\r\n  }\r\n\r\n  function checkLoadedFonts() {\r\n    var i;\r\n    var len = this.fonts.length;\r\n    var node;\r\n    var w;\r\n    var loadedCount = len;\r\n    for (i = 0; i < len; i += 1) {\r\n      if (this.fonts[i].loaded) {\r\n        loadedCount -= 1;\r\n      } else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {\r\n        this.fonts[i].loaded = true;\r\n      } else {\r\n        node = this.fonts[i].monoCase.node;\r\n        w = this.fonts[i].monoCase.w;\r\n        if (node.offsetWidth !== w) {\r\n          loadedCount -= 1;\r\n          this.fonts[i].loaded = true;\r\n        } else {\r\n          node = this.fonts[i].sansCase.node;\r\n          w = this.fonts[i].sansCase.w;\r\n          if (node.offsetWidth !== w) {\r\n            loadedCount -= 1;\r\n            this.fonts[i].loaded = true;\r\n          }\r\n        }\r\n        if (this.fonts[i].loaded) {\r\n          this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);\r\n          this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);\r\n        }\r\n      }\r\n    }\r\n\r\n    if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {\r\n      setTimeout(this.checkLoadedFontsBinded, 20);\r\n    } else {\r\n      setTimeout(this.setIsLoadedBinded, 10);\r\n    }\r\n  }\r\n\r\n  function createHelper(def, fontData) {\r\n    var tHelper = createNS('text');\r\n    tHelper.style.fontSize = '100px';\r\n    // tHelper.style.fontFamily = fontData.fFamily;\r\n\r\n    var fontProps = getFontProperties(fontData);\r\n    tHelper.setAttribute('font-family', fontData.fFamily);\r\n    tHelper.setAttribute('font-style', fontProps.style);\r\n    tHelper.setAttribute('font-weight', fontProps.weight);\r\n    tHelper.textContent = '1';\r\n    if (fontData.fClass) {\r\n      tHelper.style.fontFamily = 'inherit';\r\n      tHelper.setAttribute('class', fontData.fClass);\r\n    } else {\r\n      tHelper.style.fontFamily = fontData.fFamily;\r\n    }\r\n    def.appendChild(tHelper);\r\n    var tCanvasHelper = createTag('canvas').getContext('2d');\r\n    tCanvasHelper.font = fontData.fWeight + ' ' + fontData.fStyle + ' 100px ' + fontData.fFamily;\r\n    // tCanvasHelper.font = ' 100px '+ fontData.fFamily;\r\n    return tHelper;\r\n  }\r\n\r\n  function addFonts(fontData, defs) {\r\n    if (!fontData) {\r\n      this.isLoaded = true;\r\n      return;\r\n    }\r\n    if (this.chars) {\r\n      this.isLoaded = true;\r\n      this.fonts = fontData.list;\r\n      return;\r\n    }\r\n\r\n    var fontArr = fontData.list;\r\n    var i;\r\n    var len = fontArr.length;\r\n    var _pendingFonts = len;\r\n    for (i = 0; i < len; i += 1) {\r\n      var shouldLoadFont = true;\r\n      var loadedSelector;\r\n      var j;\r\n      fontArr[i].loaded = false;\r\n      fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace');\r\n      fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif');\r\n      if (!fontArr[i].fPath) {\r\n        fontArr[i].loaded = true;\r\n        _pendingFonts -= 1;\r\n      } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {\r\n        loadedSelector = document.querySelectorAll('style[f-forigin=\"p\"][f-family=\"' + fontArr[i].fFamily + '\"], style[f-origin=\"3\"][f-family=\"' + fontArr[i].fFamily + '\"]');\r\n\r\n        if (loadedSelector.length > 0) {\r\n          shouldLoadFont = false;\r\n        }\r\n\r\n        if (shouldLoadFont) {\r\n          var s = createTag('style');\r\n          s.setAttribute('f-forigin', fontArr[i].fOrigin);\r\n          s.setAttribute('f-origin', fontArr[i].origin);\r\n          s.setAttribute('f-family', fontArr[i].fFamily);\r\n          s.type = 'text/css';\r\n          s.innerText = '@font-face {font-family: ' + fontArr[i].fFamily + \"; font-style: normal; src: url('\" + fontArr[i].fPath + \"');}\";\r\n          defs.appendChild(s);\r\n        }\r\n      } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {\r\n        loadedSelector = document.querySelectorAll('link[f-forigin=\"g\"], link[f-origin=\"1\"]');\r\n\r\n        for (j = 0; j < loadedSelector.length; j += 1) {\r\n          if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {\r\n            // Font is already loaded\r\n            shouldLoadFont = false;\r\n          }\r\n        }\r\n\r\n        if (shouldLoadFont) {\r\n          var l = createTag('link');\r\n          l.setAttribute('f-forigin', fontArr[i].fOrigin);\r\n          l.setAttribute('f-origin', fontArr[i].origin);\r\n          l.type = 'text/css';\r\n          l.rel = 'stylesheet';\r\n          l.href = fontArr[i].fPath;\r\n          document.body.appendChild(l);\r\n        }\r\n      } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {\r\n        loadedSelector = document.querySelectorAll('script[f-forigin=\"t\"], script[f-origin=\"2\"]');\r\n\r\n        for (j = 0; j < loadedSelector.length; j += 1) {\r\n          if (fontArr[i].fPath === loadedSelector[j].src) {\r\n            // Font is already loaded\r\n            shouldLoadFont = false;\r\n          }\r\n        }\r\n\r\n        if (shouldLoadFont) {\r\n          var sc = createTag('link');\r\n          sc.setAttribute('f-forigin', fontArr[i].fOrigin);\r\n          sc.setAttribute('f-origin', fontArr[i].origin);\r\n          sc.setAttribute('rel', 'stylesheet');\r\n          sc.setAttribute('href', fontArr[i].fPath);\r\n          defs.appendChild(sc);\r\n        }\r\n      }\r\n      fontArr[i].helper = createHelper(defs, fontArr[i]);\r\n      fontArr[i].cache = {};\r\n      this.fonts.push(fontArr[i]);\r\n    }\r\n    if (_pendingFonts === 0) {\r\n      this.isLoaded = true;\r\n    } else {\r\n      // On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.\r\n      // Adding this timeout seems to fix it\r\n      setTimeout(this.checkLoadedFonts.bind(this), 100);\r\n    }\r\n  }\r\n\r\n  function addChars(chars) {\r\n    if (!chars) {\r\n      return;\r\n    }\r\n    if (!this.chars) {\r\n      this.chars = [];\r\n    }\r\n    var i;\r\n    var len = chars.length;\r\n    var j;\r\n    var jLen = this.chars.length;\r\n    var found;\r\n    for (i = 0; i < len; i += 1) {\r\n      j = 0;\r\n      found = false;\r\n      while (j < jLen) {\r\n        if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) {\r\n          found = true;\r\n        }\r\n        j += 1;\r\n      }\r\n      if (!found) {\r\n        this.chars.push(chars[i]);\r\n        jLen += 1;\r\n      }\r\n    }\r\n  }\r\n\r\n  function getCharData(char, style, font) {\r\n    var i = 0;\r\n    var len = this.chars.length;\r\n    while (i < len) {\r\n      if (this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font) {\r\n        return this.chars[i];\r\n      }\r\n      i += 1;\r\n    }\r\n    if (((typeof char === 'string' && char.charCodeAt(0) !== 13) || !char)\r\n            && console\r\n            && console.warn // eslint-disable-line no-console\r\n            && !this._warned\r\n    ) {\r\n      this._warned = true;\r\n      console.warn('Missing character from exported characters list: ', char, style, font); // eslint-disable-line no-console\r\n    }\r\n    return emptyChar;\r\n  }\r\n\r\n  function measureText(char, fontName, size) {\r\n    var fontData = this.getFontByName(fontName);\r\n    var index = char.charCodeAt(0);\r\n    if (!fontData.cache[index + 1]) {\r\n      var tHelper = fontData.helper;\r\n      // Canvas version\r\n      // fontData.cache[index] = tHelper.measureText(char).width / 100;\r\n      // SVG version\r\n      // console.log(tHelper.getBBox().width)\r\n      if (char === ' ') {\r\n        tHelper.textContent = '|' + char + '|';\r\n        var doubleSize = tHelper.getComputedTextLength();\r\n        tHelper.textContent = '||';\r\n        var singleSize = tHelper.getComputedTextLength();\r\n        fontData.cache[index + 1] = (doubleSize - singleSize) / 100;\r\n      } else {\r\n        tHelper.textContent = char;\r\n        fontData.cache[index + 1] = (tHelper.getComputedTextLength()) / 100;\r\n      }\r\n    }\r\n    return fontData.cache[index + 1] * size;\r\n  }\r\n\r\n  function getFontByName(name) {\r\n    var i = 0;\r\n    var len = this.fonts.length;\r\n    while (i < len) {\r\n      if (this.fonts[i].fName === name) {\r\n        return this.fonts[i];\r\n      }\r\n      i += 1;\r\n    }\r\n    return this.fonts[0];\r\n  }\r\n\r\n  function isModifier(firstCharCode, secondCharCode) {\r\n    var sum = firstCharCode.toString(16) + secondCharCode.toString(16);\r\n    return surrogateModifiers.indexOf(sum) !== -1;\r\n  }\r\n\r\n  function isZeroWidthJoiner(firstCharCode, secondCharCode) {\r\n    if (!secondCharCode) {\r\n      return firstCharCode === zeroWidthJoiner[1];\r\n    }\r\n    return firstCharCode === zeroWidthJoiner[0] && secondCharCode === zeroWidthJoiner[1];\r\n  }\r\n\r\n  function isCombinedCharacter(char) {\r\n    return combinedCharacters.indexOf(char) !== -1;\r\n  }\r\n\r\n  function setIsLoaded() {\r\n    this.isLoaded = true;\r\n  }\r\n\r\n  var Font = function () {\r\n    this.fonts = [];\r\n    this.chars = null;\r\n    this.typekitLoaded = 0;\r\n    this.isLoaded = false;\r\n    this._warned = false;\r\n    this.initTime = Date.now();\r\n    this.setIsLoadedBinded = this.setIsLoaded.bind(this);\r\n    this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this);\r\n  };\r\n  Font.isModifier = isModifier;\r\n  Font.isZeroWidthJoiner = isZeroWidthJoiner;\r\n  Font.isCombinedCharacter = isCombinedCharacter;\r\n\r\n  var fontPrototype = {\r\n    addChars: addChars,\r\n    addFonts: addFonts,\r\n    getCharData: getCharData,\r\n    getFontByName: getFontByName,\r\n    measureText: measureText,\r\n    checkLoadedFonts: checkLoadedFonts,\r\n    setIsLoaded: setIsLoaded,\r\n  };\r\n\r\n  Font.prototype = fontPrototype;\r\n\r\n  return Font;\r\n}());\r\n\r\n/* global initialDefaultFrame, BezierFactory, degToRads, bez, createTypedArray */\r\n/* exported PropertyFactory */\r\n\r\nvar PropertyFactory = (function () {\r\n  var initFrame = initialDefaultFrame;\r\n  var mathAbs = Math.abs;\r\n\r\n  function interpolateValue(frameNum, caching) {\r\n    var offsetTime = this.offsetTime;\r\n    var newValue;\r\n    if (this.propType === 'multidimensional') {\r\n      newValue = createTypedArray('float32', this.pv.length);\r\n    }\r\n    var iterationIndex = caching.lastIndex;\r\n    var i = iterationIndex;\r\n    var len = this.keyframes.length - 1;\r\n    var flag = true;\r\n    var keyData;\r\n    var nextKeyData;\r\n\r\n    while (flag) {\r\n      keyData = this.keyframes[i];\r\n      nextKeyData = this.keyframes[i + 1];\r\n      if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {\r\n        if (keyData.h) {\r\n          keyData = nextKeyData;\r\n        }\r\n        iterationIndex = 0;\r\n        break;\r\n      }\r\n      if ((nextKeyData.t - offsetTime) > frameNum) {\r\n        iterationIndex = i;\r\n        break;\r\n      }\r\n      if (i < len - 1) {\r\n        i += 1;\r\n      } else {\r\n        iterationIndex = 0;\r\n        flag = false;\r\n      }\r\n    }\r\n\r\n    var k;\r\n    var kLen;\r\n    var perc;\r\n    var jLen;\r\n    var j;\r\n    var fnc;\r\n    var nextKeyTime = nextKeyData.t - offsetTime;\r\n    var keyTime = keyData.t - offsetTime;\r\n    var endValue;\r\n    if (keyData.to) {\r\n      if (!keyData.bezierData) {\r\n        keyData.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);\r\n      }\r\n      var bezierData = keyData.bezierData;\r\n      if (frameNum >= nextKeyTime || frameNum < keyTime) {\r\n        var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;\r\n        kLen = bezierData.points[ind].point.length;\r\n        for (k = 0; k < kLen; k += 1) {\r\n          newValue[k] = bezierData.points[ind].point[k];\r\n        }\r\n        // caching._lastKeyframeIndex = -1;\r\n      } else {\r\n        if (keyData.__fnct) {\r\n          fnc = keyData.__fnct;\r\n        } else {\r\n          fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;\r\n          keyData.__fnct = fnc;\r\n        }\r\n        perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\r\n        var distanceInLine = bezierData.segmentLength * perc;\r\n\r\n        var segmentPerc;\r\n        var addedLength = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastAddedLength : 0;\r\n        j = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastPoint : 0;\r\n        flag = true;\r\n        jLen = bezierData.points.length;\r\n        while (flag) {\r\n          addedLength += bezierData.points[j].partialLength;\r\n          if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {\r\n            kLen = bezierData.points[j].point.length;\r\n            for (k = 0; k < kLen; k += 1) {\r\n              newValue[k] = bezierData.points[j].point[k];\r\n            }\r\n            break;\r\n          } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {\r\n            segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;\r\n            kLen = bezierData.points[j].point.length;\r\n            for (k = 0; k < kLen; k += 1) {\r\n              newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;\r\n            }\r\n            break;\r\n          }\r\n          if (j < jLen - 1) {\r\n            j += 1;\r\n          } else {\r\n            flag = false;\r\n          }\r\n        }\r\n        caching._lastPoint = j;\r\n        caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;\r\n        caching._lastKeyframeIndex = i;\r\n      }\r\n    } else {\r\n      var outX;\r\n      var outY;\r\n      var inX;\r\n      var inY;\r\n      var keyValue;\r\n      len = keyData.s.length;\r\n      endValue = nextKeyData.s || keyData.e;\r\n      if (this.sh && keyData.h !== 1) {\r\n        if (frameNum >= nextKeyTime) {\r\n          newValue[0] = endValue[0];\r\n          newValue[1] = endValue[1];\r\n          newValue[2] = endValue[2];\r\n        } else if (frameNum <= keyTime) {\r\n          newValue[0] = keyData.s[0];\r\n          newValue[1] = keyData.s[1];\r\n          newValue[2] = keyData.s[2];\r\n        } else {\r\n          var quatStart = createQuaternion(keyData.s);\r\n          var quatEnd = createQuaternion(endValue);\r\n          var time = (frameNum - keyTime) / (nextKeyTime - keyTime);\r\n          quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));\r\n        }\r\n      } else {\r\n        for (i = 0; i < len; i += 1) {\r\n          if (keyData.h !== 1) {\r\n            if (frameNum >= nextKeyTime) {\r\n              perc = 1;\r\n            } else if (frameNum < keyTime) {\r\n              perc = 0;\r\n            } else {\r\n              if (keyData.o.x.constructor === Array) {\r\n                if (!keyData.__fnct) {\r\n                  keyData.__fnct = [];\r\n                }\r\n                if (!keyData.__fnct[i]) {\r\n                  outX = (typeof keyData.o.x[i] === 'undefined') ? keyData.o.x[0] : keyData.o.x[i];\r\n                  outY = (typeof keyData.o.y[i] === 'undefined') ? keyData.o.y[0] : keyData.o.y[i];\r\n                  inX = (typeof keyData.i.x[i] === 'undefined') ? keyData.i.x[0] : keyData.i.x[i];\r\n                  inY = (typeof keyData.i.y[i] === 'undefined') ? keyData.i.y[0] : keyData.i.y[i];\r\n                  fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\r\n                  keyData.__fnct[i] = fnc;\r\n                } else {\r\n                  fnc = keyData.__fnct[i];\r\n                }\r\n              } else if (!keyData.__fnct) {\r\n                outX = keyData.o.x;\r\n                outY = keyData.o.y;\r\n                inX = keyData.i.x;\r\n                inY = keyData.i.y;\r\n                fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\r\n                keyData.__fnct = fnc;\r\n              } else {\r\n                fnc = keyData.__fnct;\r\n              }\r\n              perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\r\n            }\r\n          }\r\n\r\n          endValue = nextKeyData.s || keyData.e;\r\n          keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;\r\n\r\n          if (this.propType === 'multidimensional') {\r\n            newValue[i] = keyValue;\r\n          } else {\r\n            newValue = keyValue;\r\n          }\r\n        }\r\n      }\r\n    }\r\n    caching.lastIndex = iterationIndex;\r\n    return newValue;\r\n  }\r\n\r\n  // based on @Toji's https://github.com/toji/gl-matrix/\r\n  function slerp(a, b, t) {\r\n    var out = [];\r\n    var ax = a[0];\r\n    var ay = a[1];\r\n    var az = a[2];\r\n    var aw = a[3];\r\n    var bx = b[0];\r\n    var by = b[1];\r\n    var bz = b[2];\r\n    var bw = b[3];\r\n\r\n    var omega;\r\n    var cosom;\r\n    var sinom;\r\n    var scale0;\r\n    var scale1;\r\n\r\n    cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n    if (cosom < 0.0) {\r\n      cosom = -cosom;\r\n      bx = -bx;\r\n      by = -by;\r\n      bz = -bz;\r\n      bw = -bw;\r\n    }\r\n    if ((1.0 - cosom) > 0.000001) {\r\n      omega = Math.acos(cosom);\r\n      sinom = Math.sin(omega);\r\n      scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n      scale1 = Math.sin(t * omega) / sinom;\r\n    } else {\r\n      scale0 = 1.0 - t;\r\n      scale1 = t;\r\n    }\r\n    out[0] = scale0 * ax + scale1 * bx;\r\n    out[1] = scale0 * ay + scale1 * by;\r\n    out[2] = scale0 * az + scale1 * bz;\r\n    out[3] = scale0 * aw + scale1 * bw;\r\n\r\n    return out;\r\n  }\r\n\r\n  function quaternionToEuler(out, quat) {\r\n    var qx = quat[0];\r\n    var qy = quat[1];\r\n    var qz = quat[2];\r\n    var qw = quat[3];\r\n    var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz);\r\n    var attitude = Math.asin(2 * qx * qy + 2 * qz * qw);\r\n    var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz);\r\n    out[0] = heading / degToRads;\r\n    out[1] = attitude / degToRads;\r\n    out[2] = bank / degToRads;\r\n  }\r\n\r\n  function createQuaternion(values) {\r\n    var heading = values[0] * degToRads;\r\n    var attitude = values[1] * degToRads;\r\n    var bank = values[2] * degToRads;\r\n    var c1 = Math.cos(heading / 2);\r\n    var c2 = Math.cos(attitude / 2);\r\n    var c3 = Math.cos(bank / 2);\r\n    var s1 = Math.sin(heading / 2);\r\n    var s2 = Math.sin(attitude / 2);\r\n    var s3 = Math.sin(bank / 2);\r\n    var w = c1 * c2 * c3 - s1 * s2 * s3;\r\n    var x = s1 * s2 * c3 + c1 * c2 * s3;\r\n    var y = s1 * c2 * c3 + c1 * s2 * s3;\r\n    var z = c1 * s2 * c3 - s1 * c2 * s3;\r\n\r\n    return [x, y, z, w];\r\n  }\r\n\r\n  function getValueAtCurrentTime() {\r\n    var frameNum = this.comp.renderedFrame - this.offsetTime;\r\n    var initTime = this.keyframes[0].t - this.offsetTime;\r\n    var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\r\n    if (!(frameNum === this._caching.lastFrame || (this._caching.lastFrame !== initFrame && ((this._caching.lastFrame >= endTime && frameNum >= endTime) || (this._caching.lastFrame < initTime && frameNum < initTime))))) {\r\n      if (this._caching.lastFrame >= frameNum) {\r\n        this._caching._lastKeyframeIndex = -1;\r\n        this._caching.lastIndex = 0;\r\n      }\r\n\r\n      var renderResult = this.interpolateValue(frameNum, this._caching);\r\n      this.pv = renderResult;\r\n    }\r\n    this._caching.lastFrame = frameNum;\r\n    return this.pv;\r\n  }\r\n\r\n  function setVValue(val) {\r\n    var multipliedValue;\r\n    if (this.propType === 'unidimensional') {\r\n      multipliedValue = val * this.mult;\r\n      if (mathAbs(this.v - multipliedValue) > 0.00001) {\r\n        this.v = multipliedValue;\r\n        this._mdf = true;\r\n      }\r\n    } else {\r\n      var i = 0;\r\n      var len = this.v.length;\r\n      while (i < len) {\r\n        multipliedValue = val[i] * this.mult;\r\n        if (mathAbs(this.v[i] - multipliedValue) > 0.00001) {\r\n          this.v[i] = multipliedValue;\r\n          this._mdf = true;\r\n        }\r\n        i += 1;\r\n      }\r\n    }\r\n  }\r\n\r\n  function processEffectsSequence() {\r\n    if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {\r\n      return;\r\n    }\r\n    if (this.lock) {\r\n      this.setVValue(this.pv);\r\n      return;\r\n    }\r\n    this.lock = true;\r\n    this._mdf = this._isFirstFrame;\r\n    var i;\r\n    var len = this.effectsSequence.length;\r\n    var finalValue = this.kf ? this.pv : this.data.k;\r\n    for (i = 0; i < len; i += 1) {\r\n      finalValue = this.effectsSequence[i](finalValue);\r\n    }\r\n    this.setVValue(finalValue);\r\n    this._isFirstFrame = false;\r\n    this.lock = false;\r\n    this.frameId = this.elem.globalData.frameId;\r\n  }\r\n\r\n  function addEffect(effectFunction) {\r\n    this.effectsSequence.push(effectFunction);\r\n    this.container.addDynamicProperty(this);\r\n  }\r\n\r\n  function ValueProperty(elem, data, mult, container) {\r\n    this.propType = 'unidimensional';\r\n    this.mult = mult || 1;\r\n    this.data = data;\r\n    this.v = mult ? data.k * mult : data.k;\r\n    this.pv = data.k;\r\n    this._mdf = false;\r\n    this.elem = elem;\r\n    this.container = container;\r\n    this.comp = elem.comp;\r\n    this.k = false;\r\n    this.kf = false;\r\n    this.vel = 0;\r\n    this.effectsSequence = [];\r\n    this._isFirstFrame = true;\r\n    this.getValue = processEffectsSequence;\r\n    this.setVValue = setVValue;\r\n    this.addEffect = addEffect;\r\n  }\r\n\r\n  function MultiDimensionalProperty(elem, data, mult, container) {\r\n    this.propType = 'multidimensional';\r\n    this.mult = mult || 1;\r\n    this.data = data;\r\n    this._mdf = false;\r\n    this.elem = elem;\r\n    this.container = container;\r\n    this.comp = elem.comp;\r\n    this.k = false;\r\n    this.kf = false;\r\n    this.frameId = -1;\r\n    var i;\r\n    var len = data.k.length;\r\n    this.v = createTypedArray('float32', len);\r\n    this.pv = createTypedArray('float32', len);\r\n    this.vel = createTypedArray('float32', len);\r\n    for (i = 0; i < len; i += 1) {\r\n      this.v[i] = data.k[i] * this.mult;\r\n      this.pv[i] = data.k[i];\r\n    }\r\n    this._isFirstFrame = true;\r\n    this.effectsSequence = [];\r\n    this.getValue = processEffectsSequence;\r\n    this.setVValue = setVValue;\r\n    this.addEffect = addEffect;\r\n  }\r\n\r\n  function KeyframedValueProperty(elem, data, mult, container) {\r\n    this.propType = 'unidimensional';\r\n    this.keyframes = data.k;\r\n    this.offsetTime = elem.data.st;\r\n    this.frameId = -1;\r\n    this._caching = {\r\n      lastFrame: initFrame, lastIndex: 0, value: 0, _lastKeyframeIndex: -1,\r\n    };\r\n    this.k = true;\r\n    this.kf = true;\r\n    this.data = data;\r\n    this.mult = mult || 1;\r\n    this.elem = elem;\r\n    this.container = container;\r\n    this.comp = elem.comp;\r\n    this.v = initFrame;\r\n    this.pv = initFrame;\r\n    this._isFirstFrame = true;\r\n    this.getValue = processEffectsSequence;\r\n    this.setVValue = setVValue;\r\n    this.interpolateValue = interpolateValue;\r\n    this.effectsSequence = [getValueAtCurrentTime.bind(this)];\r\n    this.addEffect = addEffect;\r\n  }\r\n\r\n  function KeyframedMultidimensionalProperty(elem, data, mult, container) {\r\n    this.propType = 'multidimensional';\r\n    var i;\r\n    var len = data.k.length;\r\n    var s;\r\n    var e;\r\n    var to;\r\n    var ti;\r\n    for (i = 0; i < len - 1; i += 1) {\r\n      if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {\r\n        s = data.k[i].s;\r\n        e = data.k[i + 1].s;\r\n        to = data.k[i].to;\r\n        ti = data.k[i].ti;\r\n        if ((s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1])) || (s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2]))) {\r\n          data.k[i].to = null;\r\n          data.k[i].ti = null;\r\n        }\r\n        if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {\r\n          if (s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {\r\n            data.k[i].to = null;\r\n            data.k[i].ti = null;\r\n          }\r\n        }\r\n      }\r\n    }\r\n    this.effectsSequence = [getValueAtCurrentTime.bind(this)];\r\n    this.data = data;\r\n    this.keyframes = data.k;\r\n    this.offsetTime = elem.data.st;\r\n    this.k = true;\r\n    this.kf = true;\r\n    this._isFirstFrame = true;\r\n    this.mult = mult || 1;\r\n    this.elem = elem;\r\n    this.container = container;\r\n    this.comp = elem.comp;\r\n    this.getValue = processEffectsSequence;\r\n    this.setVValue = setVValue;\r\n    this.interpolateValue = interpolateValue;\r\n    this.frameId = -1;\r\n    var arrLen = data.k[0].s.length;\r\n    this.v = createTypedArray('float32', arrLen);\r\n    this.pv = createTypedArray('float32', arrLen);\r\n    for (i = 0; i < arrLen; i += 1) {\r\n      this.v[i] = initFrame;\r\n      this.pv[i] = initFrame;\r\n    }\r\n    this._caching = { lastFrame: initFrame, lastIndex: 0, value: createTypedArray('float32', arrLen) };\r\n    this.addEffect = addEffect;\r\n  }\r\n\r\n  function getProp(elem, data, type, mult, container) {\r\n    var p;\r\n    if (!data.k.length) {\r\n      p = new ValueProperty(elem, data, mult, container);\r\n    } else if (typeof (data.k[0]) === 'number') {\r\n      p = new MultiDimensionalProperty(elem, data, mult, container);\r\n    } else {\r\n      switch (type) {\r\n        case 0:\r\n          p = new KeyframedValueProperty(elem, data, mult, container);\r\n          break;\r\n        case 1:\r\n          p = new KeyframedMultidimensionalProperty(elem, data, mult, container);\r\n          break;\r\n        default:\r\n          break;\r\n      }\r\n    }\r\n    if (p.effectsSequence.length) {\r\n      container.addDynamicProperty(p);\r\n    }\r\n    return p;\r\n  }\r\n\r\n  var ob = {\r\n    getProp: getProp,\r\n  };\r\n  return ob;\r\n}());\r\n\r\n/* global Matrix, degToRads, PropertyFactory, extendPrototype, DynamicPropertyContainer */\r\n/* exported TransformPropertyFactory */\r\n\r\nvar TransformPropertyFactory = (function () {\r\n  var defaultVector = [0, 0];\r\n\r\n  function applyToMatrix(mat) {\r\n    var _mdf = this._mdf;\r\n    this.iterateDynamicProperties();\r\n    this._mdf = this._mdf || _mdf;\r\n    if (this.a) {\r\n      mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\r\n    }\r\n    if (this.s) {\r\n      mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\r\n    }\r\n    if (this.sk) {\r\n      mat.skewFromAxis(-this.sk.v, this.sa.v);\r\n    }\r\n    if (this.r) {\r\n      mat.rotate(-this.r.v);\r\n    } else {\r\n      mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2])\r\n        .rotateY(this.or.v[1])\r\n        .rotateX(this.or.v[0]);\r\n    }\r\n    if (this.data.p.s) {\r\n      if (this.data.p.z) {\r\n        mat.translate(this.px.v, this.py.v, -this.pz.v);\r\n      } else {\r\n        mat.translate(this.px.v, this.py.v, 0);\r\n      }\r\n    } else {\r\n      mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\r\n    }\r\n  }\r\n  function processKeys(forceRender) {\r\n    if (this.elem.globalData.frameId === this.frameId) {\r\n      return;\r\n    }\r\n    if (this._isDirty) {\r\n      this.precalculateMatrix();\r\n      this._isDirty = false;\r\n    }\r\n\r\n    this.iterateDynamicProperties();\r\n\r\n    if (this._mdf || forceRender) {\r\n      var frameRate;\r\n      this.v.cloneFromProps(this.pre.props);\r\n      if (this.appliedTransformations < 1) {\r\n        this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\r\n      }\r\n      if (this.appliedTransformations < 2) {\r\n        this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\r\n      }\r\n      if (this.sk && this.appliedTransformations < 3) {\r\n        this.v.skewFromAxis(-this.sk.v, this.sa.v);\r\n      }\r\n      if (this.r && this.appliedTransformations < 4) {\r\n        this.v.rotate(-this.r.v);\r\n      } else if (!this.r && this.appliedTransformations < 4) {\r\n        this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2])\r\n          .rotateY(this.or.v[1])\r\n          .rotateX(this.or.v[0]);\r\n      }\r\n      if (this.autoOriented) {\r\n        var v1;\r\n        var v2;\r\n        frameRate = this.elem.globalData.frameRate;\r\n        if (this.p && this.p.keyframes && this.p.getValueAtTime) {\r\n          if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {\r\n            v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0);\r\n            v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);\r\n          } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {\r\n            v1 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t / frameRate), 0);\r\n            v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0);\r\n          } else {\r\n            v1 = this.p.pv;\r\n            v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);\r\n          }\r\n        } else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {\r\n          v1 = [];\r\n          v2 = [];\r\n          var px = this.px;\r\n          var py = this.py;\r\n          if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {\r\n            v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0);\r\n            v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0);\r\n            v2[0] = px.getValueAtTime((px.keyframes[0].t) / frameRate, 0);\r\n            v2[1] = py.getValueAtTime((py.keyframes[0].t) / frameRate, 0);\r\n          } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {\r\n            v1[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t / frameRate), 0);\r\n            v1[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t / frameRate), 0);\r\n            v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0);\r\n            v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0);\r\n          } else {\r\n            v1 = [px.pv, py.pv];\r\n            v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime);\r\n            v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime);\r\n          }\r\n        } else {\r\n          v2 = defaultVector;\r\n          v1 = v2;\r\n        }\r\n        this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));\r\n      }\r\n      if (this.data.p && this.data.p.s) {\r\n        if (this.data.p.z) {\r\n          this.v.translate(this.px.v, this.py.v, -this.pz.v);\r\n        } else {\r\n          this.v.translate(this.px.v, this.py.v, 0);\r\n        }\r\n      } else {\r\n        this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\r\n      }\r\n    }\r\n    this.frameId = this.elem.globalData.frameId;\r\n  }\r\n\r\n  function precalculateMatrix() {\r\n    if (!this.a.k) {\r\n      this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\r\n      this.appliedTransformations = 1;\r\n    } else {\r\n      return;\r\n    }\r\n    if (!this.s.effectsSequence.length) {\r\n      this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\r\n      this.appliedTransformations = 2;\r\n    } else {\r\n      return;\r\n    }\r\n    if (this.sk) {\r\n      if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {\r\n        this.pre.skewFromAxis(-this.sk.v, this.sa.v);\r\n        this.appliedTransformations = 3;\r\n      } else {\r\n        return;\r\n      }\r\n    }\r\n    if (this.r) {\r\n      if (!this.r.effectsSequence.length) {\r\n        this.pre.rotate(-this.r.v);\r\n        this.appliedTransformations = 4;\r\n      }\r\n    } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {\r\n      this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2])\r\n        .rotateY(this.or.v[1])\r\n        .rotateX(this.or.v[0]);\r\n      this.appliedTransformations = 4;\r\n    }\r\n  }\r\n\r\n  function autoOrient() {\r\n    //\r\n    // var prevP = this.getValueAtTime();\r\n  }\r\n\r\n  function addDynamicProperty(prop) {\r\n    this._addDynamicProperty(prop);\r\n    this.elem.addDynamicProperty(prop);\r\n    this._isDirty = true;\r\n  }\r\n\r\n  function TransformProperty(elem, data, container) {\r\n    this.elem = elem;\r\n    this.frameId = -1;\r\n    this.propType = 'transform';\r\n    this.data = data;\r\n    this.v = new Matrix();\r\n    // Precalculated matrix with non animated properties\r\n    this.pre = new Matrix();\r\n    this.appliedTransformations = 0;\r\n    this.initDynamicPropertyContainer(container || elem);\r\n    if (data.p && data.p.s) {\r\n      this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this);\r\n      this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this);\r\n      if (data.p.z) {\r\n        this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this);\r\n      }\r\n    } else {\r\n      this.p = PropertyFactory.getProp(elem, data.p || { k: [0, 0, 0] }, 1, 0, this);\r\n    }\r\n    if (data.rx) {\r\n      this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);\r\n      this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);\r\n      this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);\r\n      if (data.or.k[0].ti) {\r\n        var i;\r\n        var len = data.or.k.length;\r\n        for (i = 0; i < len; i += 1) {\r\n          data.or.k[i].to = null;\r\n          data.or.k[i].ti = null;\r\n        }\r\n      }\r\n      this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this);\r\n      // sh Indicates it needs to be capped between -180 and 180\r\n      this.or.sh = true;\r\n    } else {\r\n      this.r = PropertyFactory.getProp(elem, data.r || { k: 0 }, 0, degToRads, this);\r\n    }\r\n    if (data.sk) {\r\n      this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);\r\n      this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);\r\n    }\r\n    this.a = PropertyFactory.getProp(elem, data.a || { k: [0, 0, 0] }, 1, 0, this);\r\n    this.s = PropertyFactory.getProp(elem, data.s || { k: [100, 100, 100] }, 1, 0.01, this);\r\n    // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.\r\n    if (data.o) {\r\n      this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem);\r\n    } else {\r\n      this.o = { _mdf: false, v: 1 };\r\n    }\r\n    this._isDirty = true;\r\n    if (!this.dynamicProperties.length) {\r\n      this.getValue(true);\r\n    }\r\n  }\r\n\r\n  TransformProperty.prototype = {\r\n    applyToMatrix: applyToMatrix,\r\n    getValue: processKeys,\r\n    precalculateMatrix: precalculateMatrix,\r\n    autoOrient: autoOrient,\r\n  };\r\n\r\n  extendPrototype([DynamicPropertyContainer], TransformProperty);\r\n  TransformProperty.prototype.addDynamicProperty = addDynamicProperty;\r\n  TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;\r\n\r\n  function getTransformProperty(elem, data, container) {\r\n    return new TransformProperty(elem, data, container);\r\n  }\r\n\r\n  return {\r\n    getTransformProperty: getTransformProperty,\r\n  };\r\n}());\r\n\r\n/* global createSizedArray, createSizedArray, pointPool */\r\n\r\nfunction ShapePath() {\r\n  this.c = false;\r\n  this._length = 0;\r\n  this._maxLength = 8;\r\n  this.v = createSizedArray(this._maxLength);\r\n  this.o = createSizedArray(this._maxLength);\r\n  this.i = createSizedArray(this._maxLength);\r\n}\r\n\r\nShapePath.prototype.setPathData = function (closed, len) {\r\n  this.c = closed;\r\n  this.setLength(len);\r\n  var i = 0;\r\n  while (i < len) {\r\n    this.v[i] = pointPool.newElement();\r\n    this.o[i] = pointPool.newElement();\r\n    this.i[i] = pointPool.newElement();\r\n    i += 1;\r\n  }\r\n};\r\n\r\nShapePath.prototype.setLength = function (len) {\r\n  while (this._maxLength < len) {\r\n    this.doubleArrayLength();\r\n  }\r\n  this._length = len;\r\n};\r\n\r\nShapePath.prototype.doubleArrayLength = function () {\r\n  this.v = this.v.concat(createSizedArray(this._maxLength));\r\n  this.i = this.i.concat(createSizedArray(this._maxLength));\r\n  this.o = this.o.concat(createSizedArray(this._maxLength));\r\n  this._maxLength *= 2;\r\n};\r\n\r\nShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {\r\n  var arr;\r\n  this._length = Math.max(this._length, pos + 1);\r\n  if (this._length >= this._maxLength) {\r\n    this.doubleArrayLength();\r\n  }\r\n  switch (type) {\r\n    case 'v':\r\n      arr = this.v;\r\n      break;\r\n    case 'i':\r\n      arr = this.i;\r\n      break;\r\n    case 'o':\r\n      arr = this.o;\r\n      break;\r\n    default:\r\n      arr = [];\r\n      break;\r\n  }\r\n  if (!arr[pos] || (arr[pos] && !replace)) {\r\n    arr[pos] = pointPool.newElement();\r\n  }\r\n  arr[pos][0] = x;\r\n  arr[pos][1] = y;\r\n};\r\n\r\nShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {\r\n  this.setXYAt(vX, vY, 'v', pos, replace);\r\n  this.setXYAt(oX, oY, 'o', pos, replace);\r\n  this.setXYAt(iX, iY, 'i', pos, replace);\r\n};\r\n\r\nShapePath.prototype.reverse = function () {\r\n  var newPath = new ShapePath();\r\n  newPath.setPathData(this.c, this._length);\r\n  var vertices = this.v;\r\n  var outPoints = this.o;\r\n  var inPoints = this.i;\r\n  var init = 0;\r\n  if (this.c) {\r\n    newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);\r\n    init = 1;\r\n  }\r\n  var cnt = this._length - 1;\r\n  var len = this._length;\r\n\r\n  var i;\r\n  for (i = init; i < len; i += 1) {\r\n    newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);\r\n    cnt -= 1;\r\n  }\r\n  return newPath;\r\n};\r\n\r\n/* global extendPrototype, roundCorner, BezierFactory, shapePool, degToRads,\r\n  shapeCollectionPool, PropertyFactory, bmMin, DynamicPropertyContainer */\r\n/* exported ShapePropertyFactory */\r\n\r\nvar ShapePropertyFactory = (function () {\r\n  var initFrame = -999999;\r\n\r\n  function interpolateShape(frameNum, previousValue, caching) {\r\n    var iterationIndex = caching.lastIndex;\r\n    var keyPropS;\r\n    var keyPropE;\r\n    var isHold;\r\n    var j;\r\n    var k;\r\n    var jLen;\r\n    var kLen;\r\n    var perc;\r\n    var vertexValue;\r\n    var kf = this.keyframes;\r\n    if (frameNum < kf[0].t - this.offsetTime) {\r\n      keyPropS = kf[0].s[0];\r\n      isHold = true;\r\n      iterationIndex = 0;\r\n    } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {\r\n      keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];\r\n      /* if(kf[kf.length - 1].s){\r\n                keyPropS = kf[kf.length - 1].s[0];\r\n            }else{\r\n                keyPropS = kf[kf.length - 2].e[0];\r\n            } */\r\n      isHold = true;\r\n    } else {\r\n      var i = iterationIndex;\r\n      var len = kf.length - 1;\r\n      var flag = true;\r\n      var keyData;\r\n      var nextKeyData;\r\n      while (flag) {\r\n        keyData = kf[i];\r\n        nextKeyData = kf[i + 1];\r\n        if ((nextKeyData.t - this.offsetTime) > frameNum) {\r\n          break;\r\n        }\r\n        if (i < len - 1) {\r\n          i += 1;\r\n        } else {\r\n          flag = false;\r\n        }\r\n      }\r\n      isHold = keyData.h === 1;\r\n      iterationIndex = i;\r\n      if (!isHold) {\r\n        if (frameNum >= nextKeyData.t - this.offsetTime) {\r\n          perc = 1;\r\n        } else if (frameNum < keyData.t - this.offsetTime) {\r\n          perc = 0;\r\n        } else {\r\n          var fnc;\r\n          if (keyData.__fnct) {\r\n            fnc = keyData.__fnct;\r\n          } else {\r\n            fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get;\r\n            keyData.__fnct = fnc;\r\n          }\r\n          perc = fnc((frameNum - (keyData.t - this.offsetTime)) / ((nextKeyData.t - this.offsetTime) - (keyData.t - this.offsetTime)));\r\n        }\r\n        keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];\r\n      }\r\n      keyPropS = keyData.s[0];\r\n    }\r\n    jLen = previousValue._length;\r\n    kLen = keyPropS.i[0].length;\r\n    caching.lastIndex = iterationIndex;\r\n\r\n    for (j = 0; j < jLen; j += 1) {\r\n      for (k = 0; k < kLen; k += 1) {\r\n        vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc;\r\n        previousValue.i[j][k] = vertexValue;\r\n        vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc;\r\n        previousValue.o[j][k] = vertexValue;\r\n        vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc;\r\n        previousValue.v[j][k] = vertexValue;\r\n      }\r\n    }\r\n  }\r\n\r\n  function interpolateShapeCurrentTime() {\r\n    var frameNum = this.comp.renderedFrame - this.offsetTime;\r\n    var initTime = this.keyframes[0].t - this.offsetTime;\r\n    var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\r\n    var lastFrame = this._caching.lastFrame;\r\n    if (!(lastFrame !== initFrame && ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime)))) {\r\n      /// /\r\n      this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;\r\n      this.interpolateShape(frameNum, this.pv, this._caching);\r\n      /// /\r\n    }\r\n    this._caching.lastFrame = frameNum;\r\n    return this.pv;\r\n  }\r\n\r\n  function resetShape() {\r\n    this.paths = this.localShapeCollection;\r\n  }\r\n\r\n  function shapesEqual(shape1, shape2) {\r\n    if (shape1._length !== shape2._length || shape1.c !== shape2.c) {\r\n      return false;\r\n    }\r\n    var i;\r\n    var len = shape1._length;\r\n    for (i = 0; i < len; i += 1) {\r\n      if (shape1.v[i][0] !== shape2.v[i][0]\r\n            || shape1.v[i][1] !== shape2.v[i][1]\r\n            || shape1.o[i][0] !== shape2.o[i][0]\r\n            || shape1.o[i][1] !== shape2.o[i][1]\r\n            || shape1.i[i][0] !== shape2.i[i][0]\r\n            || shape1.i[i][1] !== shape2.i[i][1]) {\r\n        return false;\r\n      }\r\n    }\r\n    return true;\r\n  }\r\n\r\n  function setVValue(newPath) {\r\n    if (!shapesEqual(this.v, newPath)) {\r\n      this.v = shapePool.clone(newPath);\r\n      this.localShapeCollection.releaseShapes();\r\n      this.localShapeCollection.addShape(this.v);\r\n      this._mdf = true;\r\n      this.paths = this.localShapeCollection;\r\n    }\r\n  }\r\n\r\n  function processEffectsSequence() {\r\n    if (this.elem.globalData.frameId === this.frameId) {\r\n      return;\r\n    } if (!this.effectsSequence.length) {\r\n      this._mdf = false;\r\n      return;\r\n    }\r\n    if (this.lock) {\r\n      this.setVValue(this.pv);\r\n      return;\r\n    }\r\n    this.lock = true;\r\n    this._mdf = false;\r\n    var finalValue;\r\n    if (this.kf) {\r\n      finalValue = this.pv;\r\n    } else if (this.data.ks) {\r\n      finalValue = this.data.ks.k;\r\n    } else {\r\n      finalValue = this.data.pt.k;\r\n    }\r\n    var i;\r\n    var len = this.effectsSequence.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      finalValue = this.effectsSequence[i](finalValue);\r\n    }\r\n    this.setVValue(finalValue);\r\n    this.lock = false;\r\n    this.frameId = this.elem.globalData.frameId;\r\n  }\r\n\r\n  function ShapeProperty(elem, data, type) {\r\n    this.propType = 'shape';\r\n    this.comp = elem.comp;\r\n    this.container = elem;\r\n    this.elem = elem;\r\n    this.data = data;\r\n    this.k = false;\r\n    this.kf = false;\r\n    this._mdf = false;\r\n    var pathData = type === 3 ? data.pt.k : data.ks.k;\r\n    this.v = shapePool.clone(pathData);\r\n    this.pv = shapePool.clone(this.v);\r\n    this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n    this.paths = this.localShapeCollection;\r\n    this.paths.addShape(this.v);\r\n    this.reset = resetShape;\r\n    this.effectsSequence = [];\r\n  }\r\n\r\n  function addEffect(effectFunction) {\r\n    this.effectsSequence.push(effectFunction);\r\n    this.container.addDynamicProperty(this);\r\n  }\r\n\r\n  ShapeProperty.prototype.interpolateShape = interpolateShape;\r\n  ShapeProperty.prototype.getValue = processEffectsSequence;\r\n  ShapeProperty.prototype.setVValue = setVValue;\r\n  ShapeProperty.prototype.addEffect = addEffect;\r\n\r\n  function KeyframedShapeProperty(elem, data, type) {\r\n    this.propType = 'shape';\r\n    this.comp = elem.comp;\r\n    this.elem = elem;\r\n    this.container = elem;\r\n    this.offsetTime = elem.data.st;\r\n    this.keyframes = type === 3 ? data.pt.k : data.ks.k;\r\n    this.k = true;\r\n    this.kf = true;\r\n    var len = this.keyframes[0].s[0].i.length;\r\n    this.v = shapePool.newElement();\r\n    this.v.setPathData(this.keyframes[0].s[0].c, len);\r\n    this.pv = shapePool.clone(this.v);\r\n    this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n    this.paths = this.localShapeCollection;\r\n    this.paths.addShape(this.v);\r\n    this.lastFrame = initFrame;\r\n    this.reset = resetShape;\r\n    this._caching = { lastFrame: initFrame, lastIndex: 0 };\r\n    this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];\r\n  }\r\n  KeyframedShapeProperty.prototype.getValue = processEffectsSequence;\r\n  KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;\r\n  KeyframedShapeProperty.prototype.setVValue = setVValue;\r\n  KeyframedShapeProperty.prototype.addEffect = addEffect;\r\n\r\n  var EllShapeProperty = (function () {\r\n    var cPoint = roundCorner;\r\n\r\n    function EllShapePropertyFactory(elem, data) {\r\n      /* this.v = {\r\n                v: createSizedArray(4),\r\n                i: createSizedArray(4),\r\n                o: createSizedArray(4),\r\n                c: true\r\n            }; */\r\n      this.v = shapePool.newElement();\r\n      this.v.setPathData(true, 4);\r\n      this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n      this.paths = this.localShapeCollection;\r\n      this.localShapeCollection.addShape(this.v);\r\n      this.d = data.d;\r\n      this.elem = elem;\r\n      this.comp = elem.comp;\r\n      this.frameId = -1;\r\n      this.initDynamicPropertyContainer(elem);\r\n      this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\r\n      this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\r\n      if (this.dynamicProperties.length) {\r\n        this.k = true;\r\n      } else {\r\n        this.k = false;\r\n        this.convertEllToPath();\r\n      }\r\n    }\r\n\r\n    EllShapePropertyFactory.prototype = {\r\n      reset: resetShape,\r\n      getValue: function () {\r\n        if (this.elem.globalData.frameId === this.frameId) {\r\n          return;\r\n        }\r\n        this.frameId = this.elem.globalData.frameId;\r\n        this.iterateDynamicProperties();\r\n\r\n        if (this._mdf) {\r\n          this.convertEllToPath();\r\n        }\r\n      },\r\n      convertEllToPath: function () {\r\n        var p0 = this.p.v[0];\r\n        var p1 = this.p.v[1];\r\n        var s0 = this.s.v[0] / 2;\r\n        var s1 = this.s.v[1] / 2;\r\n        var _cw = this.d !== 3;\r\n        var _v = this.v;\r\n        _v.v[0][0] = p0;\r\n        _v.v[0][1] = p1 - s1;\r\n        _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;\r\n        _v.v[1][1] = p1;\r\n        _v.v[2][0] = p0;\r\n        _v.v[2][1] = p1 + s1;\r\n        _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;\r\n        _v.v[3][1] = p1;\r\n        _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\r\n        _v.i[0][1] = p1 - s1;\r\n        _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;\r\n        _v.i[1][1] = p1 - s1 * cPoint;\r\n        _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\r\n        _v.i[2][1] = p1 + s1;\r\n        _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;\r\n        _v.i[3][1] = p1 + s1 * cPoint;\r\n        _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\r\n        _v.o[0][1] = p1 - s1;\r\n        _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;\r\n        _v.o[1][1] = p1 + s1 * cPoint;\r\n        _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\r\n        _v.o[2][1] = p1 + s1;\r\n        _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;\r\n        _v.o[3][1] = p1 - s1 * cPoint;\r\n      },\r\n    };\r\n\r\n    extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory);\r\n\r\n    return EllShapePropertyFactory;\r\n  }());\r\n\r\n  var StarShapeProperty = (function () {\r\n    function StarShapePropertyFactory(elem, data) {\r\n      this.v = shapePool.newElement();\r\n      this.v.setPathData(true, 0);\r\n      this.elem = elem;\r\n      this.comp = elem.comp;\r\n      this.data = data;\r\n      this.frameId = -1;\r\n      this.d = data.d;\r\n      this.initDynamicPropertyContainer(elem);\r\n      if (data.sy === 1) {\r\n        this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this);\r\n        this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this);\r\n        this.convertToPath = this.convertStarToPath;\r\n      } else {\r\n        this.convertToPath = this.convertPolygonToPath;\r\n      }\r\n      this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this);\r\n      this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\r\n      this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this);\r\n      this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this);\r\n      this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this);\r\n      this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n      this.localShapeCollection.addShape(this.v);\r\n      this.paths = this.localShapeCollection;\r\n      if (this.dynamicProperties.length) {\r\n        this.k = true;\r\n      } else {\r\n        this.k = false;\r\n        this.convertToPath();\r\n      }\r\n    }\r\n\r\n    StarShapePropertyFactory.prototype = {\r\n      reset: resetShape,\r\n      getValue: function () {\r\n        if (this.elem.globalData.frameId === this.frameId) {\r\n          return;\r\n        }\r\n        this.frameId = this.elem.globalData.frameId;\r\n        this.iterateDynamicProperties();\r\n        if (this._mdf) {\r\n          this.convertToPath();\r\n        }\r\n      },\r\n      convertStarToPath: function () {\r\n        var numPts = Math.floor(this.pt.v) * 2;\r\n        var angle = (Math.PI * 2) / numPts;\r\n        /* this.v.v.length = numPts;\r\n                this.v.i.length = numPts;\r\n                this.v.o.length = numPts; */\r\n        var longFlag = true;\r\n        var longRad = this.or.v;\r\n        var shortRad = this.ir.v;\r\n        var longRound = this.os.v;\r\n        var shortRound = this.is.v;\r\n        var longPerimSegment = (2 * Math.PI * longRad) / (numPts * 2);\r\n        var shortPerimSegment = (2 * Math.PI * shortRad) / (numPts * 2);\r\n        var i;\r\n        var rad;\r\n        var roundness;\r\n        var perimSegment;\r\n        var currentAng = -Math.PI / 2;\r\n        currentAng += this.r.v;\r\n        var dir = this.data.d === 3 ? -1 : 1;\r\n        this.v._length = 0;\r\n        for (i = 0; i < numPts; i += 1) {\r\n          rad = longFlag ? longRad : shortRad;\r\n          roundness = longFlag ? longRound : shortRound;\r\n          perimSegment = longFlag ? longPerimSegment : shortPerimSegment;\r\n          var x = rad * Math.cos(currentAng);\r\n          var y = rad * Math.sin(currentAng);\r\n          var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\r\n          var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\r\n          x += +this.p.v[0];\r\n          y += +this.p.v[1];\r\n          this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\r\n\r\n          /* this.v.v[i] = [x,y];\r\n                    this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];\r\n                    this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];\r\n                    this.v._length = numPts; */\r\n          longFlag = !longFlag;\r\n          currentAng += angle * dir;\r\n        }\r\n      },\r\n      convertPolygonToPath: function () {\r\n        var numPts = Math.floor(this.pt.v);\r\n        var angle = (Math.PI * 2) / numPts;\r\n        var rad = this.or.v;\r\n        var roundness = this.os.v;\r\n        var perimSegment = (2 * Math.PI * rad) / (numPts * 4);\r\n        var i;\r\n        var currentAng = -Math.PI * 0.5;\r\n        var dir = this.data.d === 3 ? -1 : 1;\r\n        currentAng += this.r.v;\r\n        this.v._length = 0;\r\n        for (i = 0; i < numPts; i += 1) {\r\n          var x = rad * Math.cos(currentAng);\r\n          var y = rad * Math.sin(currentAng);\r\n          var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\r\n          var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\r\n          x += +this.p.v[0];\r\n          y += +this.p.v[1];\r\n          this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\r\n          currentAng += angle * dir;\r\n        }\r\n        this.paths.length = 0;\r\n        this.paths[0] = this.v;\r\n      },\r\n\r\n    };\r\n    extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory);\r\n\r\n    return StarShapePropertyFactory;\r\n  }());\r\n\r\n  var RectShapeProperty = (function () {\r\n    function RectShapePropertyFactory(elem, data) {\r\n      this.v = shapePool.newElement();\r\n      this.v.c = true;\r\n      this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n      this.localShapeCollection.addShape(this.v);\r\n      this.paths = this.localShapeCollection;\r\n      this.elem = elem;\r\n      this.comp = elem.comp;\r\n      this.frameId = -1;\r\n      this.d = data.d;\r\n      this.initDynamicPropertyContainer(elem);\r\n      this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\r\n      this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\r\n      this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this);\r\n      if (this.dynamicProperties.length) {\r\n        this.k = true;\r\n      } else {\r\n        this.k = false;\r\n        this.convertRectToPath();\r\n      }\r\n    }\r\n\r\n    RectShapePropertyFactory.prototype = {\r\n      convertRectToPath: function () {\r\n        var p0 = this.p.v[0];\r\n        var p1 = this.p.v[1];\r\n        var v0 = this.s.v[0] / 2;\r\n        var v1 = this.s.v[1] / 2;\r\n        var round = bmMin(v0, v1, this.r.v);\r\n        var cPoint = round * (1 - roundCorner);\r\n        this.v._length = 0;\r\n\r\n        if (this.d === 2 || this.d === 1) {\r\n          this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true);\r\n          this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true);\r\n          if (round !== 0) {\r\n            this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true);\r\n            this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true);\r\n            this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true);\r\n            this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true);\r\n            this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true);\r\n            this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true);\r\n          } else {\r\n            this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2);\r\n            this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3);\r\n          }\r\n        } else {\r\n          this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true);\r\n          if (round !== 0) {\r\n            this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true);\r\n            this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true);\r\n            this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true);\r\n            this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true);\r\n            this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true);\r\n            this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true);\r\n            this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true);\r\n          } else {\r\n            this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true);\r\n            this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true);\r\n            this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true);\r\n          }\r\n        }\r\n      },\r\n      getValue: function () {\r\n        if (this.elem.globalData.frameId === this.frameId) {\r\n          return;\r\n        }\r\n        this.frameId = this.elem.globalData.frameId;\r\n        this.iterateDynamicProperties();\r\n        if (this._mdf) {\r\n          this.convertRectToPath();\r\n        }\r\n      },\r\n      reset: resetShape,\r\n    };\r\n    extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory);\r\n\r\n    return RectShapePropertyFactory;\r\n  }());\r\n\r\n  function getShapeProp(elem, data, type) {\r\n    var prop;\r\n    if (type === 3 || type === 4) {\r\n      var dataProp = type === 3 ? data.pt : data.ks;\r\n      var keys = dataProp.k;\r\n      if (keys.length) {\r\n        prop = new KeyframedShapeProperty(elem, data, type);\r\n      } else {\r\n        prop = new ShapeProperty(elem, data, type);\r\n      }\r\n    } else if (type === 5) {\r\n      prop = new RectShapeProperty(elem, data);\r\n    } else if (type === 6) {\r\n      prop = new EllShapeProperty(elem, data);\r\n    } else if (type === 7) {\r\n      prop = new StarShapeProperty(elem, data);\r\n    }\r\n    if (prop.k) {\r\n      elem.addDynamicProperty(prop);\r\n    }\r\n    return prop;\r\n  }\r\n\r\n  function getConstructorFunction() {\r\n    return ShapeProperty;\r\n  }\r\n\r\n  function getKeyframedConstructorFunction() {\r\n    return KeyframedShapeProperty;\r\n  }\r\n\r\n  var ob = {};\r\n  ob.getShapeProp = getShapeProp;\r\n  ob.getConstructorFunction = getConstructorFunction;\r\n  ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;\r\n  return ob;\r\n}());\r\n\r\n/* global shapeCollectionPool, initialDefaultFrame, extendPrototype, DynamicPropertyContainer */\r\n/* exported ShapeModifiers */\r\n\r\nvar ShapeModifiers = (function () {\r\n  var ob = {};\r\n  var modifiers = {};\r\n  ob.registerModifier = registerModifier;\r\n  ob.getModifier = getModifier;\r\n\r\n  function registerModifier(nm, factory) {\r\n    if (!modifiers[nm]) {\r\n      modifiers[nm] = factory;\r\n    }\r\n  }\r\n\r\n  function getModifier(nm, elem, data) {\r\n    return new modifiers[nm](elem, data);\r\n  }\r\n\r\n  return ob;\r\n}());\r\n\r\nfunction ShapeModifier() {}\r\nShapeModifier.prototype.initModifierProperties = function () {};\r\nShapeModifier.prototype.addShapeToModifier = function () {};\r\nShapeModifier.prototype.addShape = function (data) {\r\n  if (!this.closed) {\r\n    // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.\r\n    data.sh.container.addDynamicProperty(data.sh);\r\n    var shapeData = { shape: data.sh, data: data, localShapeCollection: shapeCollectionPool.newShapeCollection() };\r\n    this.shapes.push(shapeData);\r\n    this.addShapeToModifier(shapeData);\r\n    if (this._isAnimated) {\r\n      data.setAsAnimated();\r\n    }\r\n  }\r\n};\r\nShapeModifier.prototype.init = function (elem, data) {\r\n  this.shapes = [];\r\n  this.elem = elem;\r\n  this.initDynamicPropertyContainer(elem);\r\n  this.initModifierProperties(elem, data);\r\n  this.frameId = initialDefaultFrame;\r\n  this.closed = false;\r\n  this.k = false;\r\n  if (this.dynamicProperties.length) {\r\n    this.k = true;\r\n  } else {\r\n    this.getValue(true);\r\n  }\r\n};\r\nShapeModifier.prototype.processKeys = function () {\r\n  if (this.elem.globalData.frameId === this.frameId) {\r\n    return;\r\n  }\r\n  this.frameId = this.elem.globalData.frameId;\r\n  this.iterateDynamicProperties();\r\n};\r\n\r\nextendPrototype([DynamicPropertyContainer], ShapeModifier);\r\n\r\n/* global extendPrototype, ShapeModifier, PropertyFactory, segmentsLengthPool, bez, shapePool, ShapeModifiers */\r\n\r\nfunction TrimModifier() {\r\n}\r\nextendPrototype([ShapeModifier], TrimModifier);\r\nTrimModifier.prototype.initModifierProperties = function (elem, data) {\r\n  this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);\r\n  this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);\r\n  this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);\r\n  this.sValue = 0;\r\n  this.eValue = 0;\r\n  this.getValue = this.processKeys;\r\n  this.m = data.m;\r\n  this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;\r\n};\r\n\r\nTrimModifier.prototype.addShapeToModifier = function (shapeData) {\r\n  shapeData.pathsData = [];\r\n};\r\n\r\nTrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {\r\n  var segments = [];\r\n  if (e <= 1) {\r\n    segments.push({\r\n      s: s,\r\n      e: e,\r\n    });\r\n  } else if (s >= 1) {\r\n    segments.push({\r\n      s: s - 1,\r\n      e: e - 1,\r\n    });\r\n  } else {\r\n    segments.push({\r\n      s: s,\r\n      e: 1,\r\n    });\r\n    segments.push({\r\n      s: 0,\r\n      e: e - 1,\r\n    });\r\n  }\r\n  var shapeSegments = [];\r\n  var i;\r\n  var len = segments.length;\r\n  var segmentOb;\r\n  for (i = 0; i < len; i += 1) {\r\n    segmentOb = segments[i];\r\n    if (!(segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength)) {\r\n      var shapeS;\r\n      var shapeE;\r\n      if (segmentOb.s * totalModifierLength <= addedLength) {\r\n        shapeS = 0;\r\n      } else {\r\n        shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;\r\n      }\r\n      if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {\r\n        shapeE = 1;\r\n      } else {\r\n        shapeE = ((segmentOb.e * totalModifierLength - addedLength) / shapeLength);\r\n      }\r\n      shapeSegments.push([shapeS, shapeE]);\r\n    }\r\n  }\r\n  if (!shapeSegments.length) {\r\n    shapeSegments.push([0, 0]);\r\n  }\r\n  return shapeSegments;\r\n};\r\n\r\nTrimModifier.prototype.releasePathsData = function (pathsData) {\r\n  var i;\r\n  var len = pathsData.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    segmentsLengthPool.release(pathsData[i]);\r\n  }\r\n  pathsData.length = 0;\r\n  return pathsData;\r\n};\r\n\r\nTrimModifier.prototype.processShapes = function (_isFirstFrame) {\r\n  var s;\r\n  var e;\r\n  if (this._mdf || _isFirstFrame) {\r\n    var o = (this.o.v % 360) / 360;\r\n    if (o < 0) {\r\n      o += 1;\r\n    }\r\n    if (this.s.v > 1) {\r\n      s = 1 + o;\r\n    } else if (this.s.v < 0) {\r\n      s = 0 + o;\r\n    } else {\r\n      s = this.s.v + o;\r\n    }\r\n    if (this.e.v > 1) {\r\n      e = 1 + o;\r\n    } else if (this.e.v < 0) {\r\n      e = 0 + o;\r\n    } else {\r\n      e = this.e.v + o;\r\n    }\r\n\r\n    if (s > e) {\r\n      var _s = s;\r\n      s = e;\r\n      e = _s;\r\n    }\r\n    s = Math.round(s * 10000) * 0.0001;\r\n    e = Math.round(e * 10000) * 0.0001;\r\n    this.sValue = s;\r\n    this.eValue = e;\r\n  } else {\r\n    s = this.sValue;\r\n    e = this.eValue;\r\n  }\r\n  var shapePaths;\r\n  var i;\r\n  var len = this.shapes.length;\r\n  var j;\r\n  var jLen;\r\n  var pathsData;\r\n  var pathData;\r\n  var totalShapeLength;\r\n  var totalModifierLength = 0;\r\n\r\n  if (e === s) {\r\n    for (i = 0; i < len; i += 1) {\r\n      this.shapes[i].localShapeCollection.releaseShapes();\r\n      this.shapes[i].shape._mdf = true;\r\n      this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;\r\n      if (this._mdf) {\r\n        this.shapes[i].pathsData.length = 0;\r\n      }\r\n    }\r\n  } else if (!((e === 1 && s === 0) || (e === 0 && s === 1))) {\r\n    var segments = [];\r\n    var shapeData;\r\n    var localShapeCollection;\r\n    for (i = 0; i < len; i += 1) {\r\n      shapeData = this.shapes[i];\r\n      // if shape hasn't changed and trim properties haven't changed, cached previous path can be used\r\n      if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {\r\n        shapeData.shape.paths = shapeData.localShapeCollection;\r\n      } else {\r\n        shapePaths = shapeData.shape.paths;\r\n        jLen = shapePaths._length;\r\n        totalShapeLength = 0;\r\n        if (!shapeData.shape._mdf && shapeData.pathsData.length) {\r\n          totalShapeLength = shapeData.totalShapeLength;\r\n        } else {\r\n          pathsData = this.releasePathsData(shapeData.pathsData);\r\n          for (j = 0; j < jLen; j += 1) {\r\n            pathData = bez.getSegmentsLength(shapePaths.shapes[j]);\r\n            pathsData.push(pathData);\r\n            totalShapeLength += pathData.totalLength;\r\n          }\r\n          shapeData.totalShapeLength = totalShapeLength;\r\n          shapeData.pathsData = pathsData;\r\n        }\r\n\r\n        totalModifierLength += totalShapeLength;\r\n        shapeData.shape._mdf = true;\r\n      }\r\n    }\r\n    var shapeS = s;\r\n    var shapeE = e;\r\n    var addedLength = 0;\r\n    var edges;\r\n    for (i = len - 1; i >= 0; i -= 1) {\r\n      shapeData = this.shapes[i];\r\n      if (shapeData.shape._mdf) {\r\n        localShapeCollection = shapeData.localShapeCollection;\r\n        localShapeCollection.releaseShapes();\r\n        // if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group\r\n        if (this.m === 2 && len > 1) {\r\n          edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);\r\n          addedLength += shapeData.totalShapeLength;\r\n        } else {\r\n          edges = [[shapeS, shapeE]];\r\n        }\r\n        jLen = edges.length;\r\n        for (j = 0; j < jLen; j += 1) {\r\n          shapeS = edges[j][0];\r\n          shapeE = edges[j][1];\r\n          segments.length = 0;\r\n          if (shapeE <= 1) {\r\n            segments.push({\r\n              s: shapeData.totalShapeLength * shapeS,\r\n              e: shapeData.totalShapeLength * shapeE,\r\n            });\r\n          } else if (shapeS >= 1) {\r\n            segments.push({\r\n              s: shapeData.totalShapeLength * (shapeS - 1),\r\n              e: shapeData.totalShapeLength * (shapeE - 1),\r\n            });\r\n          } else {\r\n            segments.push({\r\n              s: shapeData.totalShapeLength * shapeS,\r\n              e: shapeData.totalShapeLength,\r\n            });\r\n            segments.push({\r\n              s: 0,\r\n              e: shapeData.totalShapeLength * (shapeE - 1),\r\n            });\r\n          }\r\n          var newShapesData = this.addShapes(shapeData, segments[0]);\r\n          if (segments[0].s !== segments[0].e) {\r\n            if (segments.length > 1) {\r\n              var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];\r\n              if (lastShapeInCollection.c) {\r\n                var lastShape = newShapesData.pop();\r\n                this.addPaths(newShapesData, localShapeCollection);\r\n                newShapesData = this.addShapes(shapeData, segments[1], lastShape);\r\n              } else {\r\n                this.addPaths(newShapesData, localShapeCollection);\r\n                newShapesData = this.addShapes(shapeData, segments[1]);\r\n              }\r\n            }\r\n            this.addPaths(newShapesData, localShapeCollection);\r\n          }\r\n        }\r\n        shapeData.shape.paths = localShapeCollection;\r\n      }\r\n    }\r\n  } else if (this._mdf) {\r\n    for (i = 0; i < len; i += 1) {\r\n      // Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.\r\n      // Don't remove this even if it's losing cached info.\r\n      this.shapes[i].pathsData.length = 0;\r\n      this.shapes[i].shape._mdf = true;\r\n    }\r\n  }\r\n};\r\n\r\nTrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {\r\n  var i;\r\n  var len = newPaths.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    localShapeCollection.addShape(newPaths[i]);\r\n  }\r\n};\r\n\r\nTrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {\r\n  shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);\r\n  shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);\r\n  if (newShape) {\r\n    shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);\r\n  }\r\n  shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);\r\n};\r\n\r\nTrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {\r\n  shapePath.setXYAt(points[1], points[5], 'o', pos);\r\n  shapePath.setXYAt(points[2], points[6], 'i', pos + 1);\r\n  if (newShape) {\r\n    shapePath.setXYAt(points[0], points[4], 'v', pos);\r\n  }\r\n  shapePath.setXYAt(points[3], points[7], 'v', pos + 1);\r\n};\r\n\r\nTrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {\r\n  var pathsData = shapeData.pathsData;\r\n  var shapePaths = shapeData.shape.paths.shapes;\r\n  var i;\r\n  var len = shapeData.shape.paths._length;\r\n  var j;\r\n  var jLen;\r\n  var addedLength = 0;\r\n  var currentLengthData;\r\n  var segmentCount;\r\n  var lengths;\r\n  var segment;\r\n  var shapes = [];\r\n  var initPos;\r\n  var newShape = true;\r\n  if (!shapePath) {\r\n    shapePath = shapePool.newElement();\r\n    segmentCount = 0;\r\n    initPos = 0;\r\n  } else {\r\n    segmentCount = shapePath._length;\r\n    initPos = shapePath._length;\r\n  }\r\n  shapes.push(shapePath);\r\n  for (i = 0; i < len; i += 1) {\r\n    lengths = pathsData[i].lengths;\r\n    shapePath.c = shapePaths[i].c;\r\n    jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;\r\n    for (j = 1; j < jLen; j += 1) {\r\n      currentLengthData = lengths[j - 1];\r\n      if (addedLength + currentLengthData.addedLength < shapeSegment.s) {\r\n        addedLength += currentLengthData.addedLength;\r\n        shapePath.c = false;\r\n      } else if (addedLength > shapeSegment.e) {\r\n        shapePath.c = false;\r\n        break;\r\n      } else {\r\n        if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {\r\n          this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);\r\n          newShape = false;\r\n        } else {\r\n          segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]);\r\n          this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);\r\n          // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\r\n          newShape = false;\r\n          shapePath.c = false;\r\n        }\r\n        addedLength += currentLengthData.addedLength;\r\n        segmentCount += 1;\r\n      }\r\n    }\r\n    if (shapePaths[i].c && lengths.length) {\r\n      currentLengthData = lengths[j - 1];\r\n      if (addedLength <= shapeSegment.e) {\r\n        var segmentLength = lengths[j - 1].addedLength;\r\n        if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {\r\n          this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);\r\n          newShape = false;\r\n        } else {\r\n          segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);\r\n          this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);\r\n          // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\r\n          newShape = false;\r\n          shapePath.c = false;\r\n        }\r\n      } else {\r\n        shapePath.c = false;\r\n      }\r\n      addedLength += currentLengthData.addedLength;\r\n      segmentCount += 1;\r\n    }\r\n    if (shapePath._length) {\r\n      shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);\r\n      shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1);\r\n    }\r\n    if (addedLength > shapeSegment.e) {\r\n      break;\r\n    }\r\n    if (i < len - 1) {\r\n      shapePath = shapePool.newElement();\r\n      newShape = true;\r\n      shapes.push(shapePath);\r\n      segmentCount = 0;\r\n    }\r\n  }\r\n  return shapes;\r\n};\r\n\r\nShapeModifiers.registerModifier('tm', TrimModifier);\r\n\r\n/* global extendPrototype, ShapeModifier, PropertyFactory, shapePool, roundCorner, ShapeModifiers */\r\n\r\nfunction RoundCornersModifier() {}\r\nextendPrototype([ShapeModifier], RoundCornersModifier);\r\nRoundCornersModifier.prototype.initModifierProperties = function (elem, data) {\r\n  this.getValue = this.processKeys;\r\n  this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this);\r\n  this._isAnimated = !!this.rd.effectsSequence.length;\r\n};\r\n\r\nRoundCornersModifier.prototype.processPath = function (path, round) {\r\n  var clonedPath = shapePool.newElement();\r\n  clonedPath.c = path.c;\r\n  var i;\r\n  var len = path._length;\r\n  var currentV;\r\n  var currentI;\r\n  var currentO;\r\n  var closerV;\r\n  var distance;\r\n  var newPosPerc;\r\n  var index = 0;\r\n  var vX;\r\n  var vY;\r\n  var oX;\r\n  var oY;\r\n  var iX;\r\n  var iY;\r\n  for (i = 0; i < len; i += 1) {\r\n    currentV = path.v[i];\r\n    currentO = path.o[i];\r\n    currentI = path.i[i];\r\n    if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) {\r\n      if ((i === 0 || i === len - 1) && !path.c) {\r\n        clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index);\r\n        /* clonedPath.v[index] = currentV;\r\n                clonedPath.o[index] = currentO;\r\n                clonedPath.i[index] = currentI; */\r\n        index += 1;\r\n      } else {\r\n        if (i === 0) {\r\n          closerV = path.v[len - 1];\r\n        } else {\r\n          closerV = path.v[i - 1];\r\n        }\r\n        distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\r\n        newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\r\n        iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\r\n        vX = iX;\r\n        iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc;\r\n        vY = iY;\r\n        oX = vX - (vX - currentV[0]) * roundCorner;\r\n        oY = vY - (vY - currentV[1]) * roundCorner;\r\n        clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\r\n        index += 1;\r\n\r\n        if (i === len - 1) {\r\n          closerV = path.v[0];\r\n        } else {\r\n          closerV = path.v[i + 1];\r\n        }\r\n        distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\r\n        newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\r\n        oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\r\n        vX = oX;\r\n        oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc;\r\n        vY = oY;\r\n        iX = vX - (vX - currentV[0]) * roundCorner;\r\n        iY = vY - (vY - currentV[1]) * roundCorner;\r\n        clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\r\n        index += 1;\r\n      }\r\n    } else {\r\n      clonedPath.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index);\r\n      index += 1;\r\n    }\r\n  }\r\n  return clonedPath;\r\n};\r\n\r\nRoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {\r\n  var shapePaths;\r\n  var i;\r\n  var len = this.shapes.length;\r\n  var j;\r\n  var jLen;\r\n  var rd = this.rd.v;\r\n\r\n  if (rd !== 0) {\r\n    var shapeData;\r\n    var localShapeCollection;\r\n    for (i = 0; i < len; i += 1) {\r\n      shapeData = this.shapes[i];\r\n      localShapeCollection = shapeData.localShapeCollection;\r\n      if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\r\n        localShapeCollection.releaseShapes();\r\n        shapeData.shape._mdf = true;\r\n        shapePaths = shapeData.shape.paths.shapes;\r\n        jLen = shapeData.shape.paths._length;\r\n        for (j = 0; j < jLen; j += 1) {\r\n          localShapeCollection.addShape(this.processPath(shapePaths[j], rd));\r\n        }\r\n      }\r\n      shapeData.shape.paths = shapeData.localShapeCollection;\r\n    }\r\n  }\r\n  if (!this.dynamicProperties.length) {\r\n    this._mdf = false;\r\n  }\r\n};\r\n\r\nShapeModifiers.registerModifier('rd', RoundCornersModifier);\r\n\r\n/* global extendPrototype, ShapeModifier, PropertyFactory, shapePool, ShapeModifiers */\r\n\r\nfunction PuckerAndBloatModifier() {}\r\nextendPrototype([ShapeModifier], PuckerAndBloatModifier);\r\nPuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {\r\n  this.getValue = this.processKeys;\r\n  this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);\r\n  this._isAnimated = !!this.amount.effectsSequence.length;\r\n};\r\n\r\nPuckerAndBloatModifier.prototype.processPath = function (path, amount) {\r\n  var percent = amount / 100;\r\n  var centerPoint = [0, 0];\r\n  var pathLength = path._length;\r\n  var i = 0;\r\n  for (i = 0; i < pathLength; i += 1) {\r\n    centerPoint[0] += path.v[i][0];\r\n    centerPoint[1] += path.v[i][1];\r\n  }\r\n  centerPoint[0] /= pathLength;\r\n  centerPoint[1] /= pathLength;\r\n  var clonedPath = shapePool.newElement();\r\n  clonedPath.c = path.c;\r\n  var vX;\r\n  var vY;\r\n  var oX;\r\n  var oY;\r\n  var iX;\r\n  var iY;\r\n  for (i = 0; i < pathLength; i += 1) {\r\n    vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent;\r\n    vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent;\r\n    oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent;\r\n    oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent;\r\n    iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent;\r\n    iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent;\r\n    clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i);\r\n  }\r\n  return clonedPath;\r\n};\r\n\r\nPuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {\r\n  var shapePaths;\r\n  var i;\r\n  var len = this.shapes.length;\r\n  var j;\r\n  var jLen;\r\n  var amount = this.amount.v;\r\n\r\n  if (amount !== 0) {\r\n    var shapeData;\r\n    var localShapeCollection;\r\n    for (i = 0; i < len; i += 1) {\r\n      shapeData = this.shapes[i];\r\n      localShapeCollection = shapeData.localShapeCollection;\r\n      if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\r\n        localShapeCollection.releaseShapes();\r\n        shapeData.shape._mdf = true;\r\n        shapePaths = shapeData.shape.paths.shapes;\r\n        jLen = shapeData.shape.paths._length;\r\n        for (j = 0; j < jLen; j += 1) {\r\n          localShapeCollection.addShape(this.processPath(shapePaths[j], amount));\r\n        }\r\n      }\r\n      shapeData.shape.paths = shapeData.localShapeCollection;\r\n    }\r\n  }\r\n  if (!this.dynamicProperties.length) {\r\n    this._mdf = false;\r\n  }\r\n};\r\nShapeModifiers.registerModifier('pb', PuckerAndBloatModifier);\r\n\r\n/* global extendPrototype, ShapeModifier, TransformPropertyFactory, PropertyFactory, Matrix, ShapeModifiers */\r\n\r\nfunction RepeaterModifier() {}\r\nextendPrototype([ShapeModifier], RepeaterModifier);\r\n\r\nRepeaterModifier.prototype.initModifierProperties = function (elem, data) {\r\n  this.getValue = this.processKeys;\r\n  this.c = PropertyFactory.getProp(elem, data.c, 0, null, this);\r\n  this.o = PropertyFactory.getProp(elem, data.o, 0, null, this);\r\n  this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this);\r\n  this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this);\r\n  this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this);\r\n  this.data = data;\r\n  if (!this.dynamicProperties.length) {\r\n    this.getValue(true);\r\n  }\r\n  this._isAnimated = !!this.dynamicProperties.length;\r\n  this.pMatrix = new Matrix();\r\n  this.rMatrix = new Matrix();\r\n  this.sMatrix = new Matrix();\r\n  this.tMatrix = new Matrix();\r\n  this.matrix = new Matrix();\r\n};\r\n\r\nRepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {\r\n  var dir = inv ? -1 : 1;\r\n  var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);\r\n  var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);\r\n  pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);\r\n  rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\r\n  rMatrix.rotate(-transform.r.v * dir * perc);\r\n  rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\r\n  sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\r\n  sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY);\r\n  sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\r\n};\r\n\r\nRepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {\r\n  this.elem = elem;\r\n  this.arr = arr;\r\n  this.pos = pos;\r\n  this.elemsData = elemsData;\r\n  this._currentCopies = 0;\r\n  this._elements = [];\r\n  this._groups = [];\r\n  this.frameId = -1;\r\n  this.initDynamicPropertyContainer(elem);\r\n  this.initModifierProperties(elem, arr[pos]);\r\n  while (pos > 0) {\r\n    pos -= 1;\r\n    // this._elements.unshift(arr.splice(pos,1)[0]);\r\n    this._elements.unshift(arr[pos]);\r\n  }\r\n  if (this.dynamicProperties.length) {\r\n    this.k = true;\r\n  } else {\r\n    this.getValue(true);\r\n  }\r\n};\r\n\r\nRepeaterModifier.prototype.resetElements = function (elements) {\r\n  var i;\r\n  var len = elements.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    elements[i]._processed = false;\r\n    if (elements[i].ty === 'gr') {\r\n      this.resetElements(elements[i].it);\r\n    }\r\n  }\r\n};\r\n\r\nRepeaterModifier.prototype.cloneElements = function (elements) {\r\n  var newElements = JSON.parse(JSON.stringify(elements));\r\n  this.resetElements(newElements);\r\n  return newElements;\r\n};\r\n\r\nRepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {\r\n  var i;\r\n  var len = elements.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    elements[i]._render = renderFlag;\r\n    if (elements[i].ty === 'gr') {\r\n      this.changeGroupRender(elements[i].it, renderFlag);\r\n    }\r\n  }\r\n};\r\n\r\nRepeaterModifier.prototype.processShapes = function (_isFirstFrame) {\r\n  var items;\r\n  var itemsTransform;\r\n  var i;\r\n  var dir;\r\n  var cont;\r\n  var hasReloaded = false;\r\n  if (this._mdf || _isFirstFrame) {\r\n    var copies = Math.ceil(this.c.v);\r\n    if (this._groups.length < copies) {\r\n      while (this._groups.length < copies) {\r\n        var group = {\r\n          it: this.cloneElements(this._elements),\r\n          ty: 'gr',\r\n        };\r\n        group.it.push({\r\n          a: { a: 0, ix: 1, k: [0, 0] }, nm: 'Transform', o: { a: 0, ix: 7, k: 100 }, p: { a: 0, ix: 2, k: [0, 0] }, r: { a: 1, ix: 6, k: [{ s: 0, e: 0, t: 0 }, { s: 0, e: 0, t: 1 }] }, s: { a: 0, ix: 3, k: [100, 100] }, sa: { a: 0, ix: 5, k: 0 }, sk: { a: 0, ix: 4, k: 0 }, ty: 'tr',\r\n        });\r\n\r\n        this.arr.splice(0, 0, group);\r\n        this._groups.splice(0, 0, group);\r\n        this._currentCopies += 1;\r\n      }\r\n      this.elem.reloadShapes();\r\n      hasReloaded = true;\r\n    }\r\n    cont = 0;\r\n    var renderFlag;\r\n    for (i = 0; i <= this._groups.length - 1; i += 1) {\r\n      renderFlag = cont < copies;\r\n      this._groups[i]._render = renderFlag;\r\n      this.changeGroupRender(this._groups[i].it, renderFlag);\r\n      if (!renderFlag) {\r\n        var elems = this.elemsData[i].it;\r\n        var transformData = elems[elems.length - 1];\r\n        if (transformData.transform.op.v !== 0) {\r\n          transformData.transform.op._mdf = true;\r\n          transformData.transform.op.v = 0;\r\n        } else {\r\n          transformData.transform.op._mdf = false;\r\n        }\r\n      }\r\n      cont += 1;\r\n    }\r\n\r\n    this._currentCopies = copies;\r\n    /// /\r\n\r\n    var offset = this.o.v;\r\n    var offsetModulo = offset % 1;\r\n    var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);\r\n    var pProps = this.pMatrix.props;\r\n    var rProps = this.rMatrix.props;\r\n    var sProps = this.sMatrix.props;\r\n    this.pMatrix.reset();\r\n    this.rMatrix.reset();\r\n    this.sMatrix.reset();\r\n    this.tMatrix.reset();\r\n    this.matrix.reset();\r\n    var iteration = 0;\r\n\r\n    if (offset > 0) {\r\n      while (iteration < roundOffset) {\r\n        this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\r\n        iteration += 1;\r\n      }\r\n      if (offsetModulo) {\r\n        this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);\r\n        iteration += offsetModulo;\r\n      }\r\n    } else if (offset < 0) {\r\n      while (iteration > roundOffset) {\r\n        this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);\r\n        iteration -= 1;\r\n      }\r\n      if (offsetModulo) {\r\n        this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true);\r\n        iteration -= offsetModulo;\r\n      }\r\n    }\r\n    i = this.data.m === 1 ? 0 : this._currentCopies - 1;\r\n    dir = this.data.m === 1 ? 1 : -1;\r\n    cont = this._currentCopies;\r\n    var j;\r\n    var jLen;\r\n    while (cont) {\r\n      items = this.elemsData[i].it;\r\n      itemsTransform = items[items.length - 1].transform.mProps.v.props;\r\n      jLen = itemsTransform.length;\r\n      items[items.length - 1].transform.mProps._mdf = true;\r\n      items[items.length - 1].transform.op._mdf = true;\r\n      items[items.length - 1].transform.op.v = this._currentCopies === 1\r\n        ? this.so.v\r\n        : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));\r\n\r\n      if (iteration !== 0) {\r\n        if ((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)) {\r\n          this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\r\n        }\r\n        this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]);\r\n        this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]);\r\n        this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]);\r\n\r\n        for (j = 0; j < jLen; j += 1) {\r\n          itemsTransform[j] = this.matrix.props[j];\r\n        }\r\n        this.matrix.reset();\r\n      } else {\r\n        this.matrix.reset();\r\n        for (j = 0; j < jLen; j += 1) {\r\n          itemsTransform[j] = this.matrix.props[j];\r\n        }\r\n      }\r\n      iteration += 1;\r\n      cont -= 1;\r\n      i += dir;\r\n    }\r\n  } else {\r\n    cont = this._currentCopies;\r\n    i = 0;\r\n    dir = 1;\r\n    while (cont) {\r\n      items = this.elemsData[i].it;\r\n      itemsTransform = items[items.length - 1].transform.mProps.v.props;\r\n      items[items.length - 1].transform.mProps._mdf = false;\r\n      items[items.length - 1].transform.op._mdf = false;\r\n      cont -= 1;\r\n      i += dir;\r\n    }\r\n  }\r\n  return hasReloaded;\r\n};\r\n\r\nRepeaterModifier.prototype.addShape = function () {};\r\n\r\nShapeModifiers.registerModifier('rp', RepeaterModifier);\r\n\r\n/* global createSizedArray, shapePool */\r\n\r\nfunction ShapeCollection() {\r\n  this._length = 0;\r\n  this._maxLength = 4;\r\n  this.shapes = createSizedArray(this._maxLength);\r\n}\r\n\r\nShapeCollection.prototype.addShape = function (shapeData) {\r\n  if (this._length === this._maxLength) {\r\n    this.shapes = this.shapes.concat(createSizedArray(this._maxLength));\r\n    this._maxLength *= 2;\r\n  }\r\n  this.shapes[this._length] = shapeData;\r\n  this._length += 1;\r\n};\r\n\r\nShapeCollection.prototype.releaseShapes = function () {\r\n  var i;\r\n  for (i = 0; i < this._length; i += 1) {\r\n    shapePool.release(this.shapes[i]);\r\n  }\r\n  this._length = 0;\r\n};\r\n\r\n/* global createSizedArray, createTypedArray, PropertyFactory, extendPrototype, DynamicPropertyContainer */\r\n\r\nfunction DashProperty(elem, data, renderer, container) {\r\n  this.elem = elem;\r\n  this.frameId = -1;\r\n  this.dataProps = createSizedArray(data.length);\r\n  this.renderer = renderer;\r\n  this.k = false;\r\n  this.dashStr = '';\r\n  this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);\r\n  this.dashoffset = createTypedArray('float32', 1);\r\n  this.initDynamicPropertyContainer(container);\r\n  var i;\r\n  var len = data.length || 0;\r\n  var prop;\r\n  for (i = 0; i < len; i += 1) {\r\n    prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this);\r\n    this.k = prop.k || this.k;\r\n    this.dataProps[i] = { n: data[i].n, p: prop };\r\n  }\r\n  if (!this.k) {\r\n    this.getValue(true);\r\n  }\r\n  this._isAnimated = this.k;\r\n}\r\n\r\nDashProperty.prototype.getValue = function (forceRender) {\r\n  if (this.elem.globalData.frameId === this.frameId && !forceRender) {\r\n    return;\r\n  }\r\n  this.frameId = this.elem.globalData.frameId;\r\n  this.iterateDynamicProperties();\r\n  this._mdf = this._mdf || forceRender;\r\n  if (this._mdf) {\r\n    var i = 0;\r\n    var len = this.dataProps.length;\r\n    if (this.renderer === 'svg') {\r\n      this.dashStr = '';\r\n    }\r\n    for (i = 0; i < len; i += 1) {\r\n      if (this.dataProps[i].n !== 'o') {\r\n        if (this.renderer === 'svg') {\r\n          this.dashStr += ' ' + this.dataProps[i].p.v;\r\n        } else {\r\n          this.dashArray[i] = this.dataProps[i].p.v;\r\n        }\r\n      } else {\r\n        this.dashoffset[0] = this.dataProps[i].p.v;\r\n      }\r\n    }\r\n  }\r\n};\r\nextendPrototype([DynamicPropertyContainer], DashProperty);\r\n\r\n/* global createTypedArray, PropertyFactory, extendPrototype, DynamicPropertyContainer */\r\nfunction GradientProperty(elem, data, container) {\r\n  this.data = data;\r\n  this.c = createTypedArray('uint8c', data.p * 4);\r\n  var cLength = data.k.k[0].s ? (data.k.k[0].s.length - data.p * 4) : data.k.k.length - data.p * 4;\r\n  this.o = createTypedArray('float32', cLength);\r\n  this._cmdf = false;\r\n  this._omdf = false;\r\n  this._collapsable = this.checkCollapsable();\r\n  this._hasOpacity = cLength;\r\n  this.initDynamicPropertyContainer(container);\r\n  this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this);\r\n  this.k = this.prop.k;\r\n  this.getValue(true);\r\n}\r\n\r\nGradientProperty.prototype.comparePoints = function (values, points) {\r\n  var i = 0;\r\n  var len = this.o.length / 2;\r\n  var diff;\r\n  while (i < len) {\r\n    diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]);\r\n    if (diff > 0.01) {\r\n      return false;\r\n    }\r\n    i += 1;\r\n  }\r\n  return true;\r\n};\r\n\r\nGradientProperty.prototype.checkCollapsable = function () {\r\n  if (this.o.length / 2 !== this.c.length / 4) {\r\n    return false;\r\n  }\r\n  if (this.data.k.k[0].s) {\r\n    var i = 0;\r\n    var len = this.data.k.k.length;\r\n    while (i < len) {\r\n      if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {\r\n        return false;\r\n      }\r\n      i += 1;\r\n    }\r\n  } else if (!this.comparePoints(this.data.k.k, this.data.p)) {\r\n    return false;\r\n  }\r\n  return true;\r\n};\r\n\r\nGradientProperty.prototype.getValue = function (forceRender) {\r\n  this.prop.getValue();\r\n  this._mdf = false;\r\n  this._cmdf = false;\r\n  this._omdf = false;\r\n  if (this.prop._mdf || forceRender) {\r\n    var i;\r\n    var len = this.data.p * 4;\r\n    var mult;\r\n    var val;\r\n    for (i = 0; i < len; i += 1) {\r\n      mult = i % 4 === 0 ? 100 : 255;\r\n      val = Math.round(this.prop.v[i] * mult);\r\n      if (this.c[i] !== val) {\r\n        this.c[i] = val;\r\n        this._cmdf = !forceRender;\r\n      }\r\n    }\r\n    if (this.o.length) {\r\n      len = this.prop.v.length;\r\n      for (i = this.data.p * 4; i < len; i += 1) {\r\n        mult = i % 2 === 0 ? 100 : 1;\r\n        val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i];\r\n        if (this.o[i - this.data.p * 4] !== val) {\r\n          this.o[i - this.data.p * 4] = val;\r\n          this._omdf = !forceRender;\r\n        }\r\n      }\r\n    }\r\n    this._mdf = !forceRender;\r\n  }\r\n};\r\n\r\nextendPrototype([DynamicPropertyContainer], GradientProperty);\r\n\r\n/* exported buildShapeString */\r\n\r\nvar buildShapeString = function (pathNodes, length, closed, mat) {\r\n  if (length === 0) {\r\n    return '';\r\n  }\r\n  var _o = pathNodes.o;\r\n  var _i = pathNodes.i;\r\n  var _v = pathNodes.v;\r\n  var i;\r\n  var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\r\n  for (i = 1; i < length; i += 1) {\r\n    shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[i][0], _i[i][1]) + ' ' + mat.applyToPointStringified(_v[i][0], _v[i][1]);\r\n  }\r\n  if (closed && length) {\r\n    shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[0][0], _i[0][1]) + ' ' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\r\n    shapeString += 'z';\r\n  }\r\n  return shapeString;\r\n};\r\n\r\n/* global Howl */\r\n/* exported audioControllerFactory */\r\n\r\nvar audioControllerFactory = (function () {\r\n  function AudioController(audioFactory) {\r\n    this.audios = [];\r\n    this.audioFactory = audioFactory;\r\n    this._volume = 1;\r\n    this._isMuted = false;\r\n  }\r\n\r\n  AudioController.prototype = {\r\n    addAudio: function (audio) {\r\n      this.audios.push(audio);\r\n    },\r\n    pause: function () {\r\n      var i;\r\n      var len = this.audios.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        this.audios[i].pause();\r\n      }\r\n    },\r\n    resume: function () {\r\n      var i;\r\n      var len = this.audios.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        this.audios[i].resume();\r\n      }\r\n    },\r\n    setRate: function (rateValue) {\r\n      var i;\r\n      var len = this.audios.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        this.audios[i].setRate(rateValue);\r\n      }\r\n    },\r\n    createAudio: function (assetPath) {\r\n      if (this.audioFactory) {\r\n        return this.audioFactory(assetPath);\r\n      } if (Howl) {\r\n        return new Howl({\r\n          src: [assetPath],\r\n        });\r\n      }\r\n      return {\r\n        isPlaying: false,\r\n        play: function () { this.isPlaying = true; },\r\n        seek: function () { this.isPlaying = false; },\r\n        playing: function () {},\r\n        rate: function () {},\r\n        setVolume: function () {},\r\n      };\r\n    },\r\n    setAudioFactory: function (audioFactory) {\r\n      this.audioFactory = audioFactory;\r\n    },\r\n    setVolume: function (value) {\r\n      this._volume = value;\r\n      this._updateVolume();\r\n    },\r\n    mute: function () {\r\n      this._isMuted = true;\r\n      this._updateVolume();\r\n    },\r\n    unmute: function () {\r\n      this._isMuted = false;\r\n      this._updateVolume();\r\n    },\r\n    getVolume: function () {\r\n      return this._volume;\r\n    },\r\n    _updateVolume: function () {\r\n      var i;\r\n      var len = this.audios.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1));\r\n      }\r\n    },\r\n  };\r\n\r\n  return function () {\r\n    return new AudioController();\r\n  };\r\n}());\r\n\r\n/* global createTag, createNS, isSafari, assetLoader */\r\n/* exported ImagePreloader */\r\n\r\nvar ImagePreloader = (function () {\r\n  var proxyImage = (function () {\r\n    var canvas = createTag('canvas');\r\n    canvas.width = 1;\r\n    canvas.height = 1;\r\n    var ctx = canvas.getContext('2d');\r\n    ctx.fillStyle = 'rgba(0,0,0,0)';\r\n    ctx.fillRect(0, 0, 1, 1);\r\n    return canvas;\r\n  }());\r\n\r\n  function imageLoaded() {\r\n    this.loadedAssets += 1;\r\n    if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\r\n      if (this.imagesLoadedCb) {\r\n        this.imagesLoadedCb(null);\r\n      }\r\n    }\r\n  }\r\n  function footageLoaded() {\r\n    this.loadedFootagesCount += 1;\r\n    if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\r\n      if (this.imagesLoadedCb) {\r\n        this.imagesLoadedCb(null);\r\n      }\r\n    }\r\n  }\r\n\r\n  function getAssetsPath(assetData, assetsPath, originalPath) {\r\n    var path = '';\r\n    if (assetData.e) {\r\n      path = assetData.p;\r\n    } else if (assetsPath) {\r\n      var imagePath = assetData.p;\r\n      if (imagePath.indexOf('images/') !== -1) {\r\n        imagePath = imagePath.split('/')[1];\r\n      }\r\n      path = assetsPath + imagePath;\r\n    } else {\r\n      path = originalPath;\r\n      path += assetData.u ? assetData.u : '';\r\n      path += assetData.p;\r\n    }\r\n    return path;\r\n  }\r\n\r\n  function testImageLoaded(img) {\r\n    var _count = 0;\r\n    var intervalId = setInterval(function () {\r\n      var box = img.getBBox();\r\n      if (box.width || _count > 500) {\r\n        this._imageLoaded();\r\n        clearInterval(intervalId);\r\n      }\r\n      _count += 1;\r\n    }.bind(this), 50);\r\n  }\r\n\r\n  function createImageData(assetData) {\r\n    var path = getAssetsPath(assetData, this.assetsPath, this.path);\r\n    var img = createNS('image');\r\n    if (isSafari) {\r\n      this.testImageLoaded(img);\r\n    } else {\r\n      img.addEventListener('load', this._imageLoaded, false);\r\n    }\r\n    img.addEventListener('error', function () {\r\n      ob.img = proxyImage;\r\n      this._imageLoaded();\r\n    }.bind(this), false);\r\n    img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);\r\n    if (this._elementHelper.append) {\r\n      this._elementHelper.append(img);\r\n    } else {\r\n      this._elementHelper.appendChild(img);\r\n    }\r\n    var ob = {\r\n      img: img,\r\n      assetData: assetData,\r\n    };\r\n    return ob;\r\n  }\r\n\r\n  function createImgData(assetData) {\r\n    var path = getAssetsPath(assetData, this.assetsPath, this.path);\r\n    var img = createTag('img');\r\n    img.crossOrigin = 'anonymous';\r\n    img.addEventListener('load', this._imageLoaded, false);\r\n    img.addEventListener('error', function () {\r\n      ob.img = proxyImage;\r\n      this._imageLoaded();\r\n    }.bind(this), false);\r\n    img.src = path;\r\n    var ob = {\r\n      img: img,\r\n      assetData: assetData,\r\n    };\r\n    return ob;\r\n  }\r\n\r\n  function createFootageData(data) {\r\n    var ob = {\r\n      assetData: data,\r\n    };\r\n    var path = getAssetsPath(data, this.assetsPath, this.path);\r\n    assetLoader.load(path, function (footageData) {\r\n      ob.img = footageData;\r\n      this._footageLoaded();\r\n    }.bind(this), function () {\r\n      ob.img = {};\r\n      this._footageLoaded();\r\n    }.bind(this));\r\n    return ob;\r\n  }\r\n\r\n  function loadAssets(assets, cb) {\r\n    this.imagesLoadedCb = cb;\r\n    var i;\r\n    var len = assets.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      if (!assets[i].layers) {\r\n        if (!assets[i].t || assets[i].t === 'seq') {\r\n          this.totalImages += 1;\r\n          this.images.push(this._createImageData(assets[i]));\r\n        } else if (assets[i].t === 3) {\r\n          this.totalFootages += 1;\r\n          this.images.push(this.createFootageData(assets[i]));\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  function setPath(path) {\r\n    this.path = path || '';\r\n  }\r\n\r\n  function setAssetsPath(path) {\r\n    this.assetsPath = path || '';\r\n  }\r\n\r\n  function getAsset(assetData) {\r\n    var i = 0;\r\n    var len = this.images.length;\r\n    while (i < len) {\r\n      if (this.images[i].assetData === assetData) {\r\n        return this.images[i].img;\r\n      }\r\n      i += 1;\r\n    }\r\n    return null;\r\n  }\r\n\r\n  function destroy() {\r\n    this.imagesLoadedCb = null;\r\n    this.images.length = 0;\r\n  }\r\n\r\n  function loadedImages() {\r\n    return this.totalImages === this.loadedAssets;\r\n  }\r\n\r\n  function loadedFootages() {\r\n    return this.totalFootages === this.loadedFootagesCount;\r\n  }\r\n\r\n  function setCacheType(type, elementHelper) {\r\n    if (type === 'svg') {\r\n      this._elementHelper = elementHelper;\r\n      this._createImageData = this.createImageData.bind(this);\r\n    } else {\r\n      this._createImageData = this.createImgData.bind(this);\r\n    }\r\n  }\r\n\r\n  function ImagePreloaderFactory() {\r\n    this._imageLoaded = imageLoaded.bind(this);\r\n    this._footageLoaded = footageLoaded.bind(this);\r\n    this.testImageLoaded = testImageLoaded.bind(this);\r\n    this.createFootageData = createFootageData.bind(this);\r\n    this.assetsPath = '';\r\n    this.path = '';\r\n    this.totalImages = 0;\r\n    this.totalFootages = 0;\r\n    this.loadedAssets = 0;\r\n    this.loadedFootagesCount = 0;\r\n    this.imagesLoadedCb = null;\r\n    this.images = [];\r\n  }\r\n\r\n  ImagePreloaderFactory.prototype = {\r\n    loadAssets: loadAssets,\r\n    setAssetsPath: setAssetsPath,\r\n    setPath: setPath,\r\n    loadedImages: loadedImages,\r\n    loadedFootages: loadedFootages,\r\n    destroy: destroy,\r\n    getAsset: getAsset,\r\n    createImgData: createImgData,\r\n    createImageData: createImageData,\r\n    imageLoaded: imageLoaded,\r\n    footageLoaded: footageLoaded,\r\n    setCacheType: setCacheType,\r\n  };\r\n\r\n  return ImagePreloaderFactory;\r\n}());\r\n\r\n/* exported featureSupport */\r\n\r\nvar featureSupport = (function () {\r\n  var ob = {\r\n    maskType: true,\r\n  };\r\n  if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\\/\\d./i.test(navigator.userAgent)) {\r\n    ob.maskType = false;\r\n  }\r\n  return ob;\r\n}());\r\n\r\n/* global createNS */\r\n/* exported filtersFactory */\r\n\r\nvar filtersFactory = (function () {\r\n  var ob = {};\r\n  ob.createFilter = createFilter;\r\n  ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;\r\n\r\n  function createFilter(filId, skipCoordinates) {\r\n    var fil = createNS('filter');\r\n    fil.setAttribute('id', filId);\r\n    if (skipCoordinates !== true) {\r\n      fil.setAttribute('filterUnits', 'objectBoundingBox');\r\n      fil.setAttribute('x', '0%');\r\n      fil.setAttribute('y', '0%');\r\n      fil.setAttribute('width', '100%');\r\n      fil.setAttribute('height', '100%');\r\n    }\r\n    return fil;\r\n  }\r\n\r\n  function createAlphaToLuminanceFilter() {\r\n    var feColorMatrix = createNS('feColorMatrix');\r\n    feColorMatrix.setAttribute('type', 'matrix');\r\n    feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\r\n    feColorMatrix.setAttribute('values', '0 0 0 1 0  0 0 0 1 0  0 0 0 1 0  0 0 0 1 1');\r\n    return feColorMatrix;\r\n  }\r\n\r\n  return ob;\r\n}());\r\n\r\n/* exported assetLoader */\r\n\r\nvar assetLoader = (function () {\r\n  function formatResponse(xhr) {\r\n    if (xhr.response && typeof xhr.response === 'object') {\r\n      return xhr.response;\r\n    } if (xhr.response && typeof xhr.response === 'string') {\r\n      return JSON.parse(xhr.response);\r\n    } if (xhr.responseText) {\r\n      return JSON.parse(xhr.responseText);\r\n    }\r\n    return null;\r\n  }\r\n\r\n  function loadAsset(path, callback, errorCallback) {\r\n    var response;\r\n    var xhr = new XMLHttpRequest();\r\n    // set responseType after calling open or IE will break.\r\n    try {\r\n      // This crashes on Android WebView prior to KitKat\r\n      xhr.responseType = 'json';\r\n    } catch (err) {} // eslint-disable-line no-empty\r\n    xhr.onreadystatechange = function () {\r\n      if (xhr.readyState === 4) {\r\n        if (xhr.status === 200) {\r\n          response = formatResponse(xhr);\r\n          callback(response);\r\n        } else {\r\n          try {\r\n            response = formatResponse(xhr);\r\n            callback(response);\r\n          } catch (err) {\r\n            if (errorCallback) {\r\n              errorCallback(err);\r\n            }\r\n          }\r\n        }\r\n      }\r\n    };\r\n    xhr.open('GET', path, true);\r\n    xhr.send();\r\n  }\r\n  return {\r\n    load: loadAsset,\r\n  };\r\n}());\r\n\r\n/* global createSizedArray, PropertyFactory, TextAnimatorDataProperty, bez, addHueToRGB,\r\n  addSaturationToRGB, addBrightnessToRGB, LetterProps, Matrix, extendPrototype, DynamicPropertyContainer */\r\n\r\nfunction TextAnimatorProperty(textData, renderType, elem) {\r\n  this._isFirstFrame = true;\r\n  this._hasMaskedPath = false;\r\n  this._frameId = -1;\r\n  this._textData = textData;\r\n  this._renderType = renderType;\r\n  this._elem = elem;\r\n  this._animatorsData = createSizedArray(this._textData.a.length);\r\n  this._pathData = {};\r\n  this._moreOptions = {\r\n    alignment: {},\r\n  };\r\n  this.renderedLetters = [];\r\n  this.lettersChangedFlag = false;\r\n  this.initDynamicPropertyContainer(elem);\r\n}\r\n\r\nTextAnimatorProperty.prototype.searchProperties = function () {\r\n  var i;\r\n  var len = this._textData.a.length;\r\n  var animatorProps;\r\n  var getProp = PropertyFactory.getProp;\r\n  for (i = 0; i < len; i += 1) {\r\n    animatorProps = this._textData.a[i];\r\n    this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);\r\n  }\r\n  if (this._textData.p && 'm' in this._textData.p) {\r\n    this._pathData = {\r\n      a: getProp(this._elem, this._textData.p.a, 0, 0, this),\r\n      f: getProp(this._elem, this._textData.p.f, 0, 0, this),\r\n      l: getProp(this._elem, this._textData.p.l, 0, 0, this),\r\n      r: getProp(this._elem, this._textData.p.r, 0, 0, this),\r\n      p: getProp(this._elem, this._textData.p.p, 0, 0, this),\r\n      m: this._elem.maskManager.getMaskProperty(this._textData.p.m),\r\n    };\r\n    this._hasMaskedPath = true;\r\n  } else {\r\n    this._hasMaskedPath = false;\r\n  }\r\n  this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this);\r\n};\r\n\r\nTextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {\r\n  this.lettersChangedFlag = lettersChangedFlag;\r\n  if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {\r\n    return;\r\n  }\r\n  this._isFirstFrame = false;\r\n  var alignment = this._moreOptions.alignment.v;\r\n  var animators = this._animatorsData;\r\n  var textData = this._textData;\r\n  var matrixHelper = this.mHelper;\r\n  var renderType = this._renderType;\r\n  var renderedLettersCount = this.renderedLetters.length;\r\n  var xPos;\r\n  var yPos;\r\n  var i;\r\n  var len;\r\n  var letters = documentData.l;\r\n  var pathInfo;\r\n  var currentLength;\r\n  var currentPoint;\r\n  var segmentLength;\r\n  var flag;\r\n  var pointInd;\r\n  var segmentInd;\r\n  var prevPoint;\r\n  var points;\r\n  var segments;\r\n  var partialLength;\r\n  var totalLength;\r\n  var perc;\r\n  var tanAngle;\r\n  var mask;\r\n  if (this._hasMaskedPath) {\r\n    mask = this._pathData.m;\r\n    if (!this._pathData.n || this._pathData._mdf) {\r\n      var paths = mask.v;\r\n      if (this._pathData.r.v) {\r\n        paths = paths.reverse();\r\n      }\r\n      // TODO: release bezier data cached from previous pathInfo: this._pathData.pi\r\n      pathInfo = {\r\n        tLength: 0,\r\n        segments: [],\r\n      };\r\n      len = paths._length - 1;\r\n      var bezierData;\r\n      totalLength = 0;\r\n      for (i = 0; i < len; i += 1) {\r\n        bezierData = bez.buildBezierData(paths.v[i],\r\n          paths.v[i + 1],\r\n          [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],\r\n          [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);\r\n        pathInfo.tLength += bezierData.segmentLength;\r\n        pathInfo.segments.push(bezierData);\r\n        totalLength += bezierData.segmentLength;\r\n      }\r\n      i = len;\r\n      if (mask.v.c) {\r\n        bezierData = bez.buildBezierData(paths.v[i],\r\n          paths.v[0],\r\n          [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],\r\n          [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);\r\n        pathInfo.tLength += bezierData.segmentLength;\r\n        pathInfo.segments.push(bezierData);\r\n        totalLength += bezierData.segmentLength;\r\n      }\r\n      this._pathData.pi = pathInfo;\r\n    }\r\n    pathInfo = this._pathData.pi;\r\n\r\n    currentLength = this._pathData.f.v;\r\n    segmentInd = 0;\r\n    pointInd = 1;\r\n    segmentLength = 0;\r\n    flag = true;\r\n    segments = pathInfo.segments;\r\n    if (currentLength < 0 && mask.v.c) {\r\n      if (pathInfo.tLength < Math.abs(currentLength)) {\r\n        currentLength = -Math.abs(currentLength) % pathInfo.tLength;\r\n      }\r\n      segmentInd = segments.length - 1;\r\n      points = segments[segmentInd].points;\r\n      pointInd = points.length - 1;\r\n      while (currentLength < 0) {\r\n        currentLength += points[pointInd].partialLength;\r\n        pointInd -= 1;\r\n        if (pointInd < 0) {\r\n          segmentInd -= 1;\r\n          points = segments[segmentInd].points;\r\n          pointInd = points.length - 1;\r\n        }\r\n      }\r\n    }\r\n    points = segments[segmentInd].points;\r\n    prevPoint = points[pointInd - 1];\r\n    currentPoint = points[pointInd];\r\n    partialLength = currentPoint.partialLength;\r\n  }\r\n\r\n  len = letters.length;\r\n  xPos = 0;\r\n  yPos = 0;\r\n  var yOff = documentData.finalSize * 1.2 * 0.714;\r\n  var firstLine = true;\r\n  var animatorProps;\r\n  var animatorSelector;\r\n  var j;\r\n  var jLen;\r\n  var letterValue;\r\n\r\n  jLen = animators.length;\r\n\r\n  var mult;\r\n  var ind = -1;\r\n  var offf;\r\n  var xPathPos;\r\n  var yPathPos;\r\n  var initPathPos = currentLength;\r\n  var initSegmentInd = segmentInd;\r\n  var initPointInd = pointInd;\r\n  var currentLine = -1;\r\n  var elemOpacity;\r\n  var sc;\r\n  var sw;\r\n  var fc;\r\n  var k;\r\n  var letterSw;\r\n  var letterSc;\r\n  var letterFc;\r\n  var letterM = '';\r\n  var letterP = this.defaultPropsArray;\r\n  var letterO;\r\n\r\n  //\r\n  if (documentData.j === 2 || documentData.j === 1) {\r\n    var animatorJustifyOffset = 0;\r\n    var animatorFirstCharOffset = 0;\r\n    var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;\r\n    var lastIndex = 0;\r\n    var isNewLine = true;\r\n\r\n    for (i = 0; i < len; i += 1) {\r\n      if (letters[i].n) {\r\n        if (animatorJustifyOffset) {\r\n          animatorJustifyOffset += animatorFirstCharOffset;\r\n        }\r\n        while (lastIndex < i) {\r\n          letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\r\n          lastIndex += 1;\r\n        }\r\n        animatorJustifyOffset = 0;\r\n        isNewLine = true;\r\n      } else {\r\n        for (j = 0; j < jLen; j += 1) {\r\n          animatorProps = animators[j].a;\r\n          if (animatorProps.t.propType) {\r\n            if (isNewLine && documentData.j === 2) {\r\n              animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;\r\n            }\r\n            animatorSelector = animators[j].s;\r\n            mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n            if (mult.length) {\r\n              animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult;\r\n            } else {\r\n              animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult;\r\n            }\r\n          }\r\n        }\r\n        isNewLine = false;\r\n      }\r\n    }\r\n    if (animatorJustifyOffset) {\r\n      animatorJustifyOffset += animatorFirstCharOffset;\r\n    }\r\n    while (lastIndex < i) {\r\n      letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\r\n      lastIndex += 1;\r\n    }\r\n  }\r\n  //\r\n\r\n  for (i = 0; i < len; i += 1) {\r\n    matrixHelper.reset();\r\n    elemOpacity = 1;\r\n    if (letters[i].n) {\r\n      xPos = 0;\r\n      yPos += documentData.yOffset;\r\n      yPos += firstLine ? 1 : 0;\r\n      currentLength = initPathPos;\r\n      firstLine = false;\r\n      if (this._hasMaskedPath) {\r\n        segmentInd = initSegmentInd;\r\n        pointInd = initPointInd;\r\n        points = segments[segmentInd].points;\r\n        prevPoint = points[pointInd - 1];\r\n        currentPoint = points[pointInd];\r\n        partialLength = currentPoint.partialLength;\r\n        segmentLength = 0;\r\n      }\r\n      letterM = '';\r\n      letterFc = '';\r\n      letterSw = '';\r\n      letterO = '';\r\n      letterP = this.defaultPropsArray;\r\n    } else {\r\n      if (this._hasMaskedPath) {\r\n        if (currentLine !== letters[i].line) {\r\n          switch (documentData.j) {\r\n            case 1:\r\n              currentLength += totalLength - documentData.lineWidths[letters[i].line];\r\n              break;\r\n            case 2:\r\n              currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2;\r\n              break;\r\n            default:\r\n              break;\r\n          }\r\n          currentLine = letters[i].line;\r\n        }\r\n        if (ind !== letters[i].ind) {\r\n          if (letters[ind]) {\r\n            currentLength += letters[ind].extra;\r\n          }\r\n          currentLength += letters[i].an / 2;\r\n          ind = letters[i].ind;\r\n        }\r\n        currentLength += (alignment[0] * letters[i].an) * 0.005;\r\n        var animatorOffset = 0;\r\n        for (j = 0; j < jLen; j += 1) {\r\n          animatorProps = animators[j].a;\r\n          if (animatorProps.p.propType) {\r\n            animatorSelector = animators[j].s;\r\n            mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n            if (mult.length) {\r\n              animatorOffset += animatorProps.p.v[0] * mult[0];\r\n            } else {\r\n              animatorOffset += animatorProps.p.v[0] * mult;\r\n            }\r\n          }\r\n          if (animatorProps.a.propType) {\r\n            animatorSelector = animators[j].s;\r\n            mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n            if (mult.length) {\r\n              animatorOffset += animatorProps.a.v[0] * mult[0];\r\n            } else {\r\n              animatorOffset += animatorProps.a.v[0] * mult;\r\n            }\r\n          }\r\n        }\r\n        flag = true;\r\n        // Force alignment only works with a single line for now\r\n        if (this._pathData.a.v) {\r\n          currentLength = letters[0].an * 0.5 + ((totalLength - this._pathData.f.v - letters[0].an * 0.5 - letters[letters.length - 1].an * 0.5) * ind) / (len - 1);\r\n          currentLength += this._pathData.f.v;\r\n        }\r\n        while (flag) {\r\n          if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {\r\n            perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;\r\n            xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;\r\n            yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;\r\n            matrixHelper.translate((-alignment[0] * letters[i].an) * 0.005, -(alignment[1] * yOff) * 0.01);\r\n            flag = false;\r\n          } else if (points) {\r\n            segmentLength += currentPoint.partialLength;\r\n            pointInd += 1;\r\n            if (pointInd >= points.length) {\r\n              pointInd = 0;\r\n              segmentInd += 1;\r\n              if (!segments[segmentInd]) {\r\n                if (mask.v.c) {\r\n                  pointInd = 0;\r\n                  segmentInd = 0;\r\n                  points = segments[segmentInd].points;\r\n                } else {\r\n                  segmentLength -= currentPoint.partialLength;\r\n                  points = null;\r\n                }\r\n              } else {\r\n                points = segments[segmentInd].points;\r\n              }\r\n            }\r\n            if (points) {\r\n              prevPoint = currentPoint;\r\n              currentPoint = points[pointInd];\r\n              partialLength = currentPoint.partialLength;\r\n            }\r\n          }\r\n        }\r\n        offf = letters[i].an / 2 - letters[i].add;\r\n        matrixHelper.translate(-offf, 0, 0);\r\n      } else {\r\n        offf = letters[i].an / 2 - letters[i].add;\r\n        matrixHelper.translate(-offf, 0, 0);\r\n\r\n        // Grouping alignment\r\n        matrixHelper.translate((-alignment[0] * letters[i].an) * 0.005, (-alignment[1] * yOff) * 0.01, 0);\r\n      }\r\n\r\n      for (j = 0; j < jLen; j += 1) {\r\n        animatorProps = animators[j].a;\r\n        if (animatorProps.t.propType) {\r\n          animatorSelector = animators[j].s;\r\n          mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n          // This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean \"isNewLine\"\r\n          if (xPos !== 0 || documentData.j !== 0) {\r\n            if (this._hasMaskedPath) {\r\n              if (mult.length) {\r\n                currentLength += animatorProps.t.v * mult[0];\r\n              } else {\r\n                currentLength += animatorProps.t.v * mult;\r\n              }\r\n            } else if (mult.length) {\r\n              xPos += animatorProps.t.v * mult[0];\r\n            } else {\r\n              xPos += animatorProps.t.v * mult;\r\n            }\r\n          }\r\n        }\r\n      }\r\n      if (documentData.strokeWidthAnim) {\r\n        sw = documentData.sw || 0;\r\n      }\r\n      if (documentData.strokeColorAnim) {\r\n        if (documentData.sc) {\r\n          sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];\r\n        } else {\r\n          sc = [0, 0, 0];\r\n        }\r\n      }\r\n      if (documentData.fillColorAnim && documentData.fc) {\r\n        fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];\r\n      }\r\n      for (j = 0; j < jLen; j += 1) {\r\n        animatorProps = animators[j].a;\r\n        if (animatorProps.a.propType) {\r\n          animatorSelector = animators[j].s;\r\n          mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n          if (mult.length) {\r\n            matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]);\r\n          } else {\r\n            matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult);\r\n          }\r\n        }\r\n      }\r\n      for (j = 0; j < jLen; j += 1) {\r\n        animatorProps = animators[j].a;\r\n        if (animatorProps.s.propType) {\r\n          animatorSelector = animators[j].s;\r\n          mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n          if (mult.length) {\r\n            matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult[0]), 1 + ((animatorProps.s.v[1] - 1) * mult[1]), 1);\r\n          } else {\r\n            matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult), 1 + ((animatorProps.s.v[1] - 1) * mult), 1);\r\n          }\r\n        }\r\n      }\r\n      for (j = 0; j < jLen; j += 1) {\r\n        animatorProps = animators[j].a;\r\n        animatorSelector = animators[j].s;\r\n        mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n        if (animatorProps.sk.propType) {\r\n          if (mult.length) {\r\n            matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);\r\n          } else {\r\n            matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);\r\n          }\r\n        }\r\n        if (animatorProps.r.propType) {\r\n          if (mult.length) {\r\n            matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);\r\n          } else {\r\n            matrixHelper.rotateZ(-animatorProps.r.v * mult);\r\n          }\r\n        }\r\n        if (animatorProps.ry.propType) {\r\n          if (mult.length) {\r\n            matrixHelper.rotateY(animatorProps.ry.v * mult[1]);\r\n          } else {\r\n            matrixHelper.rotateY(animatorProps.ry.v * mult);\r\n          }\r\n        }\r\n        if (animatorProps.rx.propType) {\r\n          if (mult.length) {\r\n            matrixHelper.rotateX(animatorProps.rx.v * mult[0]);\r\n          } else {\r\n            matrixHelper.rotateX(animatorProps.rx.v * mult);\r\n          }\r\n        }\r\n        if (animatorProps.o.propType) {\r\n          if (mult.length) {\r\n            elemOpacity += ((animatorProps.o.v) * mult[0] - elemOpacity) * mult[0];\r\n          } else {\r\n            elemOpacity += ((animatorProps.o.v) * mult - elemOpacity) * mult;\r\n          }\r\n        }\r\n        if (documentData.strokeWidthAnim && animatorProps.sw.propType) {\r\n          if (mult.length) {\r\n            sw += animatorProps.sw.v * mult[0];\r\n          } else {\r\n            sw += animatorProps.sw.v * mult;\r\n          }\r\n        }\r\n        if (documentData.strokeColorAnim && animatorProps.sc.propType) {\r\n          for (k = 0; k < 3; k += 1) {\r\n            if (mult.length) {\r\n              sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0];\r\n            } else {\r\n              sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult;\r\n            }\r\n          }\r\n        }\r\n        if (documentData.fillColorAnim && documentData.fc) {\r\n          if (animatorProps.fc.propType) {\r\n            for (k = 0; k < 3; k += 1) {\r\n              if (mult.length) {\r\n                fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0];\r\n              } else {\r\n                fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult;\r\n              }\r\n            }\r\n          }\r\n          if (animatorProps.fh.propType) {\r\n            if (mult.length) {\r\n              fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]);\r\n            } else {\r\n              fc = addHueToRGB(fc, animatorProps.fh.v * mult);\r\n            }\r\n          }\r\n          if (animatorProps.fs.propType) {\r\n            if (mult.length) {\r\n              fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]);\r\n            } else {\r\n              fc = addSaturationToRGB(fc, animatorProps.fs.v * mult);\r\n            }\r\n          }\r\n          if (animatorProps.fb.propType) {\r\n            if (mult.length) {\r\n              fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]);\r\n            } else {\r\n              fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult);\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n      for (j = 0; j < jLen; j += 1) {\r\n        animatorProps = animators[j].a;\r\n\r\n        if (animatorProps.p.propType) {\r\n          animatorSelector = animators[j].s;\r\n          mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n          if (this._hasMaskedPath) {\r\n            if (mult.length) {\r\n              matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);\r\n            } else {\r\n              matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\r\n            }\r\n          } else if (mult.length) {\r\n            matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);\r\n          } else {\r\n            matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\r\n          }\r\n        }\r\n      }\r\n      if (documentData.strokeWidthAnim) {\r\n        letterSw = sw < 0 ? 0 : sw;\r\n      }\r\n      if (documentData.strokeColorAnim) {\r\n        letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')';\r\n      }\r\n      if (documentData.fillColorAnim && documentData.fc) {\r\n        letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')';\r\n      }\r\n\r\n      if (this._hasMaskedPath) {\r\n        matrixHelper.translate(0, -documentData.ls);\r\n\r\n        matrixHelper.translate(0, (alignment[1] * yOff) * 0.01 + yPos, 0);\r\n        if (this._pathData.p.v) {\r\n          tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);\r\n          var rot = (Math.atan(tanAngle) * 180) / Math.PI;\r\n          if (currentPoint.point[0] < prevPoint.point[0]) {\r\n            rot += 180;\r\n          }\r\n          matrixHelper.rotate((-rot * Math.PI) / 180);\r\n        }\r\n        matrixHelper.translate(xPathPos, yPathPos, 0);\r\n        currentLength -= (alignment[0] * letters[i].an) * 0.005;\r\n        if (letters[i + 1] && ind !== letters[i + 1].ind) {\r\n          currentLength += letters[i].an / 2;\r\n          currentLength += (documentData.tr * 0.001) * documentData.finalSize;\r\n        }\r\n      } else {\r\n        matrixHelper.translate(xPos, yPos, 0);\r\n\r\n        if (documentData.ps) {\r\n          // matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);\r\n          matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\r\n        }\r\n        switch (documentData.j) {\r\n          case 1:\r\n            matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0);\r\n            break;\r\n          case 2:\r\n            matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0);\r\n            break;\r\n          default:\r\n            break;\r\n        }\r\n        matrixHelper.translate(0, -documentData.ls);\r\n        matrixHelper.translate(offf, 0, 0);\r\n        matrixHelper.translate((alignment[0] * letters[i].an) * 0.005, (alignment[1] * yOff) * 0.01, 0);\r\n        xPos += letters[i].l + (documentData.tr * 0.001) * documentData.finalSize;\r\n      }\r\n      if (renderType === 'html') {\r\n        letterM = matrixHelper.toCSS();\r\n      } else if (renderType === 'svg') {\r\n        letterM = matrixHelper.to2dCSS();\r\n      } else {\r\n        letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]];\r\n      }\r\n      letterO = elemOpacity;\r\n    }\r\n\r\n    if (renderedLettersCount <= i) {\r\n      letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP);\r\n      this.renderedLetters.push(letterValue);\r\n      renderedLettersCount += 1;\r\n      this.lettersChangedFlag = true;\r\n    } else {\r\n      letterValue = this.renderedLetters[i];\r\n      this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;\r\n    }\r\n  }\r\n};\r\n\r\nTextAnimatorProperty.prototype.getValue = function () {\r\n  if (this._elem.globalData.frameId === this._frameId) {\r\n    return;\r\n  }\r\n  this._frameId = this._elem.globalData.frameId;\r\n  this.iterateDynamicProperties();\r\n};\r\n\r\nTextAnimatorProperty.prototype.mHelper = new Matrix();\r\nTextAnimatorProperty.prototype.defaultPropsArray = [];\r\nextendPrototype([DynamicPropertyContainer], TextAnimatorProperty);\r\n\r\n/* global PropertyFactory, degToRads, TextSelectorProp */\r\n/* exported TextAnimatorDataProperty */\r\n\r\nfunction TextAnimatorDataProperty(elem, animatorProps, container) {\r\n  var defaultData = { propType: false };\r\n  var getProp = PropertyFactory.getProp;\r\n  var textAnimatorAnimatables = animatorProps.a;\r\n  this.a = {\r\n    r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData,\r\n    rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData,\r\n    ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData,\r\n    sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData,\r\n    sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData,\r\n    s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData,\r\n    a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData,\r\n    o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData,\r\n    p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData,\r\n    sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData,\r\n    sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData,\r\n    fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData,\r\n    fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData,\r\n    fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData,\r\n    fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData,\r\n    t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData,\r\n  };\r\n\r\n  this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container);\r\n  this.s.t = animatorProps.s.t;\r\n}\r\n\r\nfunction LetterProps(o, sw, sc, fc, m, p) {\r\n  this.o = o;\r\n  this.sw = sw;\r\n  this.sc = sc;\r\n  this.fc = fc;\r\n  this.m = m;\r\n  this.p = p;\r\n  this._mdf = {\r\n    o: true,\r\n    sw: !!sw,\r\n    sc: !!sc,\r\n    fc: !!fc,\r\n    m: true,\r\n    p: true,\r\n  };\r\n}\r\n\r\nLetterProps.prototype.update = function (o, sw, sc, fc, m, p) {\r\n  this._mdf.o = false;\r\n  this._mdf.sw = false;\r\n  this._mdf.sc = false;\r\n  this._mdf.fc = false;\r\n  this._mdf.m = false;\r\n  this._mdf.p = false;\r\n  var updated = false;\r\n\r\n  if (this.o !== o) {\r\n    this.o = o;\r\n    this._mdf.o = true;\r\n    updated = true;\r\n  }\r\n  if (this.sw !== sw) {\r\n    this.sw = sw;\r\n    this._mdf.sw = true;\r\n    updated = true;\r\n  }\r\n  if (this.sc !== sc) {\r\n    this.sc = sc;\r\n    this._mdf.sc = true;\r\n    updated = true;\r\n  }\r\n  if (this.fc !== fc) {\r\n    this.fc = fc;\r\n    this._mdf.fc = true;\r\n    updated = true;\r\n  }\r\n  if (this.m !== m) {\r\n    this.m = m;\r\n    this._mdf.m = true;\r\n    updated = true;\r\n  }\r\n  if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {\r\n    this.p = p;\r\n    this._mdf.p = true;\r\n    updated = true;\r\n  }\r\n  return updated;\r\n};\r\n\r\n/* global FontManager, initialDefaultFrame, getFontProperties */\r\n/* exported TextProperty */\r\n\r\nfunction TextProperty(elem, data) {\r\n  this._frameId = initialDefaultFrame;\r\n  this.pv = '';\r\n  this.v = '';\r\n  this.kf = false;\r\n  this._isFirstFrame = true;\r\n  this._mdf = false;\r\n  this.data = data;\r\n  this.elem = elem;\r\n  this.comp = this.elem.comp;\r\n  this.keysIndex = 0;\r\n  this.canResize = false;\r\n  this.minimumFontSize = 1;\r\n  this.effectsSequence = [];\r\n  this.currentData = {\r\n    ascent: 0,\r\n    boxWidth: this.defaultBoxWidth,\r\n    f: '',\r\n    fStyle: '',\r\n    fWeight: '',\r\n    fc: '',\r\n    j: '',\r\n    justifyOffset: '',\r\n    l: [],\r\n    lh: 0,\r\n    lineWidths: [],\r\n    ls: '',\r\n    of: '',\r\n    s: '',\r\n    sc: '',\r\n    sw: 0,\r\n    t: 0,\r\n    tr: 0,\r\n    sz: 0,\r\n    ps: null,\r\n    fillColorAnim: false,\r\n    strokeColorAnim: false,\r\n    strokeWidthAnim: false,\r\n    yOffset: 0,\r\n    finalSize: 0,\r\n    finalText: [],\r\n    finalLineHeight: 0,\r\n    __complete: false,\r\n\r\n  };\r\n  this.copyData(this.currentData, this.data.d.k[0].s);\r\n\r\n  if (!this.searchProperty()) {\r\n    this.completeTextData(this.currentData);\r\n  }\r\n}\r\n\r\nTextProperty.prototype.defaultBoxWidth = [0, 0];\r\n\r\nTextProperty.prototype.copyData = function (obj, data) {\r\n  for (var s in data) {\r\n    if (Object.prototype.hasOwnProperty.call(data, s)) {\r\n      obj[s] = data[s];\r\n    }\r\n  }\r\n  return obj;\r\n};\r\n\r\nTextProperty.prototype.setCurrentData = function (data) {\r\n  if (!data.__complete) {\r\n    this.completeTextData(data);\r\n  }\r\n  this.currentData = data;\r\n  this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;\r\n  this._mdf = true;\r\n};\r\n\r\nTextProperty.prototype.searchProperty = function () {\r\n  return this.searchKeyframes();\r\n};\r\n\r\nTextProperty.prototype.searchKeyframes = function () {\r\n  this.kf = this.data.d.k.length > 1;\r\n  if (this.kf) {\r\n    this.addEffect(this.getKeyframeValue.bind(this));\r\n  }\r\n  return this.kf;\r\n};\r\n\r\nTextProperty.prototype.addEffect = function (effectFunction) {\r\n  this.effectsSequence.push(effectFunction);\r\n  this.elem.addDynamicProperty(this);\r\n};\r\n\r\nTextProperty.prototype.getValue = function (_finalValue) {\r\n  if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {\r\n    return;\r\n  }\r\n  this.currentData.t = this.data.d.k[this.keysIndex].s.t;\r\n  var currentValue = this.currentData;\r\n  var currentIndex = this.keysIndex;\r\n  if (this.lock) {\r\n    this.setCurrentData(this.currentData);\r\n    return;\r\n  }\r\n  this.lock = true;\r\n  this._mdf = false;\r\n  var i; var\r\n    len = this.effectsSequence.length;\r\n  var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;\r\n  for (i = 0; i < len; i += 1) {\r\n    // Checking if index changed to prevent creating a new object every time the expression updates.\r\n    if (currentIndex !== this.keysIndex) {\r\n      finalValue = this.effectsSequence[i](finalValue, finalValue.t);\r\n    } else {\r\n      finalValue = this.effectsSequence[i](this.currentData, finalValue.t);\r\n    }\r\n  }\r\n  if (currentValue !== finalValue) {\r\n    this.setCurrentData(finalValue);\r\n  }\r\n  this.v = this.currentData;\r\n  this.pv = this.v;\r\n  this.lock = false;\r\n  this.frameId = this.elem.globalData.frameId;\r\n};\r\n\r\nTextProperty.prototype.getKeyframeValue = function () {\r\n  var textKeys = this.data.d.k;\r\n  var frameNum = this.elem.comp.renderedFrame;\r\n  var i = 0; var\r\n    len = textKeys.length;\r\n  while (i <= len - 1) {\r\n    if (i === len - 1 || textKeys[i + 1].t > frameNum) {\r\n      break;\r\n    }\r\n    i += 1;\r\n  }\r\n  if (this.keysIndex !== i) {\r\n    this.keysIndex = i;\r\n  }\r\n  return this.data.d.k[this.keysIndex].s;\r\n};\r\n\r\nTextProperty.prototype.buildFinalText = function (text) {\r\n  var charactersArray = [];\r\n  var i = 0;\r\n  var len = text.length;\r\n  var charCode;\r\n  var secondCharCode;\r\n  var shouldCombine = false;\r\n  while (i < len) {\r\n    charCode = text.charCodeAt(i);\r\n    if (FontManager.isCombinedCharacter(charCode)) {\r\n      charactersArray[charactersArray.length - 1] += text.charAt(i);\r\n    } else if (charCode >= 0xD800 && charCode <= 0xDBFF) {\r\n      secondCharCode = text.charCodeAt(i + 1);\r\n      if (secondCharCode >= 0xDC00 && secondCharCode <= 0xDFFF) {\r\n        if (shouldCombine || FontManager.isModifier(charCode, secondCharCode)) {\r\n          charactersArray[charactersArray.length - 1] += text.substr(i, 2);\r\n          shouldCombine = false;\r\n        } else {\r\n          charactersArray.push(text.substr(i, 2));\r\n        }\r\n        i += 1;\r\n      } else {\r\n        charactersArray.push(text.charAt(i));\r\n      }\r\n    } else if (charCode > 0xDBFF) {\r\n      secondCharCode = text.charCodeAt(i + 1);\r\n      if (FontManager.isZeroWidthJoiner(charCode, secondCharCode)) {\r\n        shouldCombine = true;\r\n        charactersArray[charactersArray.length - 1] += text.substr(i, 2);\r\n        i += 1;\r\n      } else {\r\n        charactersArray.push(text.charAt(i));\r\n      }\r\n    } else if (FontManager.isZeroWidthJoiner(charCode)) {\r\n      charactersArray[charactersArray.length - 1] += text.charAt(i);\r\n      shouldCombine = true;\r\n    } else {\r\n      charactersArray.push(text.charAt(i));\r\n    }\r\n    i += 1;\r\n  }\r\n  return charactersArray;\r\n};\r\n\r\nTextProperty.prototype.completeTextData = function (documentData) {\r\n  documentData.__complete = true;\r\n  var fontManager = this.elem.globalData.fontManager;\r\n  var data = this.data;\r\n  var letters = [];\r\n  var i; var\r\n    len;\r\n  var newLineFlag; var index = 0; var\r\n    val;\r\n  var anchorGrouping = data.m.g;\r\n  var currentSize = 0; var currentPos = 0; var currentLine = 0; var\r\n    lineWidths = [];\r\n  var lineWidth = 0;\r\n  var maxLineWidth = 0;\r\n  var j; var\r\n    jLen;\r\n  var fontData = fontManager.getFontByName(documentData.f);\r\n  var charData; var\r\n    cLength = 0;\r\n\r\n  var fontProps = getFontProperties(fontData);\r\n  documentData.fWeight = fontProps.weight;\r\n  documentData.fStyle = fontProps.style;\r\n  documentData.finalSize = documentData.s;\r\n  documentData.finalText = this.buildFinalText(documentData.t);\r\n  len = documentData.finalText.length;\r\n  documentData.finalLineHeight = documentData.lh;\r\n  var trackingOffset = (documentData.tr / 1000) * documentData.finalSize;\r\n  var charCode;\r\n  if (documentData.sz) {\r\n    var flag = true;\r\n    var boxWidth = documentData.sz[0];\r\n    var boxHeight = documentData.sz[1];\r\n    var currentHeight; var\r\n      finalText;\r\n    while (flag) {\r\n      finalText = this.buildFinalText(documentData.t);\r\n      currentHeight = 0;\r\n      lineWidth = 0;\r\n      len = finalText.length;\r\n      trackingOffset = (documentData.tr / 1000) * documentData.finalSize;\r\n      var lastSpaceIndex = -1;\r\n      for (i = 0; i < len; i += 1) {\r\n        charCode = finalText[i].charCodeAt(0);\r\n        newLineFlag = false;\r\n        if (finalText[i] === ' ') {\r\n          lastSpaceIndex = i;\r\n        } else if (charCode === 13 || charCode === 3) {\r\n          lineWidth = 0;\r\n          newLineFlag = true;\r\n          currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\r\n        }\r\n        if (fontManager.chars) {\r\n          charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);\r\n          cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100;\r\n        } else {\r\n          // tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;\r\n          cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);\r\n        }\r\n        if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {\r\n          if (lastSpaceIndex === -1) {\r\n            len += 1;\r\n          } else {\r\n            i = lastSpaceIndex;\r\n          }\r\n          currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\r\n          finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\\r');\r\n          // finalText = finalText.substr(0,i) + \"\\r\" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);\r\n          lastSpaceIndex = -1;\r\n          lineWidth = 0;\r\n        } else {\r\n          lineWidth += cLength;\r\n          lineWidth += trackingOffset;\r\n        }\r\n      }\r\n      currentHeight += (fontData.ascent * documentData.finalSize) / 100;\r\n      if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {\r\n        documentData.finalSize -= 1;\r\n        documentData.finalLineHeight = (documentData.finalSize * documentData.lh) / documentData.s;\r\n      } else {\r\n        documentData.finalText = finalText;\r\n        len = documentData.finalText.length;\r\n        flag = false;\r\n      }\r\n    }\r\n  }\r\n  lineWidth = -trackingOffset;\r\n  cLength = 0;\r\n  var uncollapsedSpaces = 0;\r\n  var currentChar;\r\n  for (i = 0; i < len; i += 1) {\r\n    newLineFlag = false;\r\n    currentChar = documentData.finalText[i];\r\n    charCode = currentChar.charCodeAt(0);\r\n    if (charCode === 13 || charCode === 3) {\r\n      uncollapsedSpaces = 0;\r\n      lineWidths.push(lineWidth);\r\n      maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\r\n      lineWidth = -2 * trackingOffset;\r\n      val = '';\r\n      newLineFlag = true;\r\n      currentLine += 1;\r\n    } else {\r\n      val = currentChar;\r\n    }\r\n    if (fontManager.chars) {\r\n      charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);\r\n      cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100;\r\n    } else {\r\n      // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);\r\n      // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;\r\n      cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);\r\n    }\r\n\r\n    //\r\n    if (currentChar === ' ') {\r\n      uncollapsedSpaces += cLength + trackingOffset;\r\n    } else {\r\n      lineWidth += cLength + trackingOffset + uncollapsedSpaces;\r\n      uncollapsedSpaces = 0;\r\n    }\r\n    letters.push({\r\n      l: cLength, an: cLength, add: currentSize, n: newLineFlag, anIndexes: [], val: val, line: currentLine, animatorJustifyOffset: 0,\r\n    });\r\n    if (anchorGrouping == 2) { // eslint-disable-line eqeqeq\r\n      currentSize += cLength;\r\n      if (val === '' || val === ' ' || i === len - 1) {\r\n        if (val === '' || val === ' ') {\r\n          currentSize -= cLength;\r\n        }\r\n        while (currentPos <= i) {\r\n          letters[currentPos].an = currentSize;\r\n          letters[currentPos].ind = index;\r\n          letters[currentPos].extra = cLength;\r\n          currentPos += 1;\r\n        }\r\n        index += 1;\r\n        currentSize = 0;\r\n      }\r\n    } else if (anchorGrouping == 3) { // eslint-disable-line eqeqeq\r\n      currentSize += cLength;\r\n      if (val === '' || i === len - 1) {\r\n        if (val === '') {\r\n          currentSize -= cLength;\r\n        }\r\n        while (currentPos <= i) {\r\n          letters[currentPos].an = currentSize;\r\n          letters[currentPos].ind = index;\r\n          letters[currentPos].extra = cLength;\r\n          currentPos += 1;\r\n        }\r\n        currentSize = 0;\r\n        index += 1;\r\n      }\r\n    } else {\r\n      letters[index].ind = index;\r\n      letters[index].extra = 0;\r\n      index += 1;\r\n    }\r\n  }\r\n  documentData.l = letters;\r\n  maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\r\n  lineWidths.push(lineWidth);\r\n  if (documentData.sz) {\r\n    documentData.boxWidth = documentData.sz[0];\r\n    documentData.justifyOffset = 0;\r\n  } else {\r\n    documentData.boxWidth = maxLineWidth;\r\n    switch (documentData.j) {\r\n      case 1:\r\n        documentData.justifyOffset = -documentData.boxWidth;\r\n        break;\r\n      case 2:\r\n        documentData.justifyOffset = -documentData.boxWidth / 2;\r\n        break;\r\n      default:\r\n        documentData.justifyOffset = 0;\r\n    }\r\n  }\r\n  documentData.lineWidths = lineWidths;\r\n\r\n  var animators = data.a; var animatorData; var\r\n    letterData;\r\n  jLen = animators.length;\r\n  var based; var ind; var\r\n    indexes = [];\r\n  for (j = 0; j < jLen; j += 1) {\r\n    animatorData = animators[j];\r\n    if (animatorData.a.sc) {\r\n      documentData.strokeColorAnim = true;\r\n    }\r\n    if (animatorData.a.sw) {\r\n      documentData.strokeWidthAnim = true;\r\n    }\r\n    if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {\r\n      documentData.fillColorAnim = true;\r\n    }\r\n    ind = 0;\r\n    based = animatorData.s.b;\r\n    for (i = 0; i < len; i += 1) {\r\n      letterData = letters[i];\r\n      letterData.anIndexes[j] = ind;\r\n      if ((based == 1 && letterData.val !== '') || (based == 2 && letterData.val !== '' && letterData.val !== ' ') || (based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1)) || (based == 4 && (letterData.n || i == len - 1))) { // eslint-disable-line eqeqeq\r\n        if (animatorData.s.rn === 1) {\r\n          indexes.push(ind);\r\n        }\r\n        ind += 1;\r\n      }\r\n    }\r\n    data.a[j].s.totalChars = ind;\r\n    var currentInd = -1; var\r\n      newInd;\r\n    if (animatorData.s.rn === 1) {\r\n      for (i = 0; i < len; i += 1) {\r\n        letterData = letters[i];\r\n        if (currentInd != letterData.anIndexes[j]) { // eslint-disable-line eqeqeq\r\n          currentInd = letterData.anIndexes[j];\r\n          newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0];\r\n        }\r\n        letterData.anIndexes[j] = newInd;\r\n      }\r\n    }\r\n  }\r\n  documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2;\r\n  documentData.ls = documentData.ls || 0;\r\n  documentData.ascent = (fontData.ascent * documentData.finalSize) / 100;\r\n};\r\n\r\nTextProperty.prototype.updateDocumentData = function (newData, index) {\r\n  index = index === undefined ? this.keysIndex : index;\r\n  var dData = this.copyData({}, this.data.d.k[index].s);\r\n  dData = this.copyData(dData, newData);\r\n  this.data.d.k[index].s = dData;\r\n  this.recalculate(index);\r\n  this.elem.addDynamicProperty(this);\r\n};\r\n\r\nTextProperty.prototype.recalculate = function (index) {\r\n  var dData = this.data.d.k[index].s;\r\n  dData.__complete = false;\r\n  this.keysIndex = 0;\r\n  this._isFirstFrame = true;\r\n  this.getValue(dData);\r\n};\r\n\r\nTextProperty.prototype.canResizeFont = function (_canResize) {\r\n  this.canResize = _canResize;\r\n  this.recalculate(this.keysIndex);\r\n  this.elem.addDynamicProperty(this);\r\n};\r\n\r\nTextProperty.prototype.setMinimumFontSize = function (_fontValue) {\r\n  this.minimumFontSize = Math.floor(_fontValue) || 1;\r\n  this.recalculate(this.keysIndex);\r\n  this.elem.addDynamicProperty(this);\r\n};\r\n\r\n/* global extendPrototype, BezierFactory, PropertyFactory, DynamicPropertyContainer */\r\n/* exported TextSelectorProp */\r\n\r\nvar TextSelectorProp = (function () {\r\n  var max = Math.max;\r\n  var min = Math.min;\r\n  var floor = Math.floor;\r\n\r\n  function TextSelectorPropFactory(elem, data) {\r\n    this._currentTextLength = -1;\r\n    this.k = false;\r\n    this.data = data;\r\n    this.elem = elem;\r\n    this.comp = elem.comp;\r\n    this.finalS = 0;\r\n    this.finalE = 0;\r\n    this.initDynamicPropertyContainer(elem);\r\n    this.s = PropertyFactory.getProp(elem, data.s || { k: 0 }, 0, 0, this);\r\n    if ('e' in data) {\r\n      this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this);\r\n    } else {\r\n      this.e = { v: 100 };\r\n    }\r\n    this.o = PropertyFactory.getProp(elem, data.o || { k: 0 }, 0, 0, this);\r\n    this.xe = PropertyFactory.getProp(elem, data.xe || { k: 0 }, 0, 0, this);\r\n    this.ne = PropertyFactory.getProp(elem, data.ne || { k: 0 }, 0, 0, this);\r\n    this.sm = PropertyFactory.getProp(elem, data.sm || { k: 100 }, 0, 0, this);\r\n    this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this);\r\n    if (!this.dynamicProperties.length) {\r\n      this.getValue();\r\n    }\r\n  }\r\n\r\n  TextSelectorPropFactory.prototype = {\r\n    getMult: function (ind) {\r\n      if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {\r\n        this.getValue();\r\n      }\r\n      // var easer = bez.getEasingCurve(this.ne.v/100,0,1-this.xe.v/100,1);\r\n      var x1 = 0;\r\n      var y1 = 0;\r\n      var x2 = 1;\r\n      var y2 = 1;\r\n      if (this.ne.v > 0) {\r\n        x1 = this.ne.v / 100.0;\r\n      } else {\r\n        y1 = -this.ne.v / 100.0;\r\n      }\r\n      if (this.xe.v > 0) {\r\n        x2 = 1.0 - this.xe.v / 100.0;\r\n      } else {\r\n        y2 = 1.0 + this.xe.v / 100.0;\r\n      }\r\n      var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get;\r\n\r\n      var mult = 0;\r\n      var s = this.finalS;\r\n      var e = this.finalE;\r\n      var type = this.data.sh;\r\n      if (type === 2) {\r\n        if (e === s) {\r\n          mult = ind >= e ? 1 : 0;\r\n        } else {\r\n          mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\r\n        }\r\n        mult = easer(mult);\r\n      } else if (type === 3) {\r\n        if (e === s) {\r\n          mult = ind >= e ? 0 : 1;\r\n        } else {\r\n          mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\r\n        }\r\n\r\n        mult = easer(mult);\r\n      } else if (type === 4) {\r\n        if (e === s) {\r\n          mult = 0;\r\n        } else {\r\n          mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\r\n          if (mult < 0.5) {\r\n            mult *= 2;\r\n          } else {\r\n            mult = 1 - 2 * (mult - 0.5);\r\n          }\r\n        }\r\n        mult = easer(mult);\r\n      } else if (type === 5) {\r\n        if (e === s) {\r\n          mult = 0;\r\n        } else {\r\n          var tot = e - s;\r\n          /* ind += 0.5;\r\n                    mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */\r\n          ind = min(max(0, ind + 0.5 - s), e - s);\r\n          var x = -tot / 2 + ind;\r\n          var a = tot / 2;\r\n          mult = Math.sqrt(1 - (x * x) / (a * a));\r\n        }\r\n        mult = easer(mult);\r\n      } else if (type === 6) {\r\n        if (e === s) {\r\n          mult = 0;\r\n        } else {\r\n          ind = min(max(0, ind + 0.5 - s), e - s);\r\n          mult = (1 + (Math.cos((Math.PI + Math.PI * 2 * (ind) / (e - s))))) / 2; // eslint-disable-line\r\n        }\r\n        mult = easer(mult);\r\n      } else {\r\n        if (ind >= floor(s)) {\r\n          if (ind - s < 0) {\r\n            mult = max(0, min(min(e, 1) - (s - ind), 1));\r\n          } else {\r\n            mult = max(0, min(e - ind, 1));\r\n          }\r\n        }\r\n        mult = easer(mult);\r\n      }\r\n      // Smoothness implementation.\r\n      // The smoothness represents a reduced range of the original [0; 1] range.\r\n      // if smoothness is 25%, the new range will be [0.375; 0.625]\r\n      // Steps are:\r\n      // - find the lower value of the new range (threshold)\r\n      // - if multiplier is smaller than that value, floor it to 0\r\n      // - if it is larger,\r\n      //     - subtract the threshold\r\n      //     - divide it by the smoothness (this will return the range to [0; 1])\r\n      // Note: If it doesn't work on some scenarios, consider applying it before the easer.\r\n      if (this.sm.v !== 100) {\r\n        var smoothness = this.sm.v * 0.01;\r\n        if (smoothness === 0) {\r\n          smoothness = 0.00000001;\r\n        }\r\n        var threshold = 0.5 - smoothness * 0.5;\r\n        if (mult < threshold) {\r\n          mult = 0;\r\n        } else {\r\n          mult = (mult - threshold) / smoothness;\r\n          if (mult > 1) {\r\n            mult = 1;\r\n          }\r\n        }\r\n      }\r\n      return mult * this.a.v;\r\n    },\r\n    getValue: function (newCharsFlag) {\r\n      this.iterateDynamicProperties();\r\n      this._mdf = newCharsFlag || this._mdf;\r\n      this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;\r\n      if (newCharsFlag && this.data.r === 2) {\r\n        this.e.v = this._currentTextLength;\r\n      }\r\n      var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;\r\n      var o = this.o.v / divisor;\r\n      var s = this.s.v / divisor + o;\r\n      var e = (this.e.v / divisor) + o;\r\n      if (s > e) {\r\n        var _s = s;\r\n        s = e;\r\n        e = _s;\r\n      }\r\n      this.finalS = s;\r\n      this.finalE = e;\r\n    },\r\n  };\r\n  extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory);\r\n\r\n  function getTextSelectorProp(elem, data, arr) {\r\n    return new TextSelectorPropFactory(elem, data, arr);\r\n  }\r\n\r\n  return {\r\n    getTextSelectorProp: getTextSelectorProp,\r\n  };\r\n}());\r\n\r\n/* global createSizedArray, pooling */\r\n/* exported poolFactory */\r\n\r\nvar poolFactory = (function () {\r\n  return function (initialLength, _create, _release) {\r\n    var _length = 0;\r\n    var _maxLength = initialLength;\r\n    var pool = createSizedArray(_maxLength);\r\n\r\n    var ob = {\r\n      newElement: newElement,\r\n      release: release,\r\n    };\r\n\r\n    function newElement() {\r\n      var element;\r\n      if (_length) {\r\n        _length -= 1;\r\n        element = pool[_length];\r\n      } else {\r\n        element = _create();\r\n      }\r\n      return element;\r\n    }\r\n\r\n    function release(element) {\r\n      if (_length === _maxLength) {\r\n        pool = pooling.double(pool);\r\n        _maxLength *= 2;\r\n      }\r\n      if (_release) {\r\n        _release(element);\r\n      }\r\n      pool[_length] = element;\r\n      _length += 1;\r\n    }\r\n\r\n    return ob;\r\n  };\r\n}());\r\n\r\n/* global createSizedArray */\r\n/* exported pooling */\r\n\r\nvar pooling = (function () {\r\n  function double(arr) {\r\n    return arr.concat(createSizedArray(arr.length));\r\n  }\r\n\r\n  return {\r\n    double: double,\r\n  };\r\n}());\r\n\r\n/* global createTypedArray, poolFactory */\r\n/* exported pointPool */\r\n\r\nvar pointPool = (function () {\r\n  function create() {\r\n    return createTypedArray('float32', 2);\r\n  }\r\n  return poolFactory(8, create);\r\n}());\r\n\r\n/* global ShapePath, pointPool, poolFactory */\r\n/* exported shapePool */\r\n\r\nvar shapePool = (function () {\r\n  function create() {\r\n    return new ShapePath();\r\n  }\r\n\r\n  function release(shapePath) {\r\n    var len = shapePath._length;\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      pointPool.release(shapePath.v[i]);\r\n      pointPool.release(shapePath.i[i]);\r\n      pointPool.release(shapePath.o[i]);\r\n      shapePath.v[i] = null;\r\n      shapePath.i[i] = null;\r\n      shapePath.o[i] = null;\r\n    }\r\n    shapePath._length = 0;\r\n    shapePath.c = false;\r\n  }\r\n\r\n  function clone(shape) {\r\n    var cloned = factory.newElement();\r\n    var i;\r\n    var len = shape._length === undefined ? shape.v.length : shape._length;\r\n    cloned.setLength(len);\r\n    cloned.c = shape.c;\r\n\r\n    for (i = 0; i < len; i += 1) {\r\n      cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i);\r\n    }\r\n    return cloned;\r\n  }\r\n\r\n  var factory = poolFactory(4, create, release);\r\n  factory.clone = clone;\r\n\r\n  return factory;\r\n}());\r\n\r\n/* global createSizedArray, ShapeCollection, shapePool, pooling */\r\n/* exported shapeCollectionPool */\r\n\r\nvar shapeCollectionPool = (function () {\r\n  var ob = {\r\n    newShapeCollection: newShapeCollection,\r\n    release: release,\r\n  };\r\n\r\n  var _length = 0;\r\n  var _maxLength = 4;\r\n  var pool = createSizedArray(_maxLength);\r\n\r\n  function newShapeCollection() {\r\n    var shapeCollection;\r\n    if (_length) {\r\n      _length -= 1;\r\n      shapeCollection = pool[_length];\r\n    } else {\r\n      shapeCollection = new ShapeCollection();\r\n    }\r\n    return shapeCollection;\r\n  }\r\n\r\n  function release(shapeCollection) {\r\n    var i;\r\n    var len = shapeCollection._length;\r\n    for (i = 0; i < len; i += 1) {\r\n      shapePool.release(shapeCollection.shapes[i]);\r\n    }\r\n    shapeCollection._length = 0;\r\n\r\n    if (_length === _maxLength) {\r\n      pool = pooling.double(pool);\r\n      _maxLength *= 2;\r\n    }\r\n    pool[_length] = shapeCollection;\r\n    _length += 1;\r\n  }\r\n\r\n  return ob;\r\n}());\r\n\r\n/* global poolFactory, bezierLengthPool */\r\n/* exported segmentsLengthPool */\r\n\r\nvar segmentsLengthPool = (function () {\r\n  function create() {\r\n    return {\r\n      lengths: [],\r\n      totalLength: 0,\r\n    };\r\n  }\r\n\r\n  function release(element) {\r\n    var i;\r\n    var len = element.lengths.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      bezierLengthPool.release(element.lengths[i]);\r\n    }\r\n    element.lengths.length = 0;\r\n  }\r\n\r\n  return poolFactory(8, create, release);\r\n}());\r\n\r\n/* global createTypedArray, defaultCurveSegments, poolFactory */\r\n/* exported bezierLengthPool */\r\n\r\nvar bezierLengthPool = (function () {\r\n  function create() {\r\n    return {\r\n      addedLength: 0,\r\n      percents: createTypedArray('float32', defaultCurveSegments),\r\n      lengths: createTypedArray('float32', defaultCurveSegments),\r\n    };\r\n  }\r\n  return poolFactory(8, create);\r\n}());\r\n\r\n/* exported markerParser */\r\n\r\nvar markerParser = (\r\n\r\n  function () {\r\n    function parsePayloadLines(payload) {\r\n      var lines = payload.split('\\r\\n');\r\n      var keys = {};\r\n      var line;\r\n      var keysCount = 0;\r\n      for (var i = 0; i < lines.length; i += 1) {\r\n        line = lines[i].split(':');\r\n        if (line.length === 2) {\r\n          keys[line[0]] = line[1].trim();\r\n          keysCount += 1;\r\n        }\r\n      }\r\n      if (keysCount === 0) {\r\n        throw new Error();\r\n      }\r\n      return keys;\r\n    }\r\n\r\n    return function (_markers) {\r\n      var markers = [];\r\n      for (var i = 0; i < _markers.length; i += 1) {\r\n        var _marker = _markers[i];\r\n        var markerData = {\r\n          time: _marker.tm,\r\n          duration: _marker.dr,\r\n        };\r\n        try {\r\n          markerData.payload = JSON.parse(_markers[i].cm);\r\n        } catch (_) {\r\n          try {\r\n            markerData.payload = parsePayloadLines(_markers[i].cm);\r\n          } catch (__) {\r\n            markerData.payload = {\r\n              name: _markers[i],\r\n            };\r\n          }\r\n        }\r\n        markers.push(markerData);\r\n      }\r\n      return markers;\r\n    };\r\n  }());\r\n\r\n/* global AudioElement, FootageElement, FontManager */\r\n\r\nfunction BaseRenderer() {}\r\nBaseRenderer.prototype.checkLayers = function (num) {\r\n  var i;\r\n  var len = this.layers.length;\r\n  var data;\r\n  this.completeLayers = true;\r\n  for (i = len - 1; i >= 0; i -= 1) {\r\n    if (!this.elements[i]) {\r\n      data = this.layers[i];\r\n      if (data.ip - data.st <= (num - this.layers[i].st) && data.op - data.st > (num - this.layers[i].st)) {\r\n        this.buildItem(i);\r\n      }\r\n    }\r\n    this.completeLayers = this.elements[i] ? this.completeLayers : false;\r\n  }\r\n  this.checkPendingElements();\r\n};\r\n\r\nBaseRenderer.prototype.createItem = function (layer) {\r\n  switch (layer.ty) {\r\n    case 2:\r\n      return this.createImage(layer);\r\n    case 0:\r\n      return this.createComp(layer);\r\n    case 1:\r\n      return this.createSolid(layer);\r\n    case 3:\r\n      return this.createNull(layer);\r\n    case 4:\r\n      return this.createShape(layer);\r\n    case 5:\r\n      return this.createText(layer);\r\n    case 6:\r\n      return this.createAudio(layer);\r\n    case 13:\r\n      return this.createCamera(layer);\r\n    case 15:\r\n      return this.createFootage(layer);\r\n    default:\r\n      return this.createNull(layer);\r\n  }\r\n};\r\n\r\nBaseRenderer.prototype.createCamera = function () {\r\n  throw new Error('You\\'re using a 3d camera. Try the html renderer.');\r\n};\r\n\r\nBaseRenderer.prototype.createAudio = function (data) {\r\n  return new AudioElement(data, this.globalData, this);\r\n};\r\n\r\nBaseRenderer.prototype.createFootage = function (data) {\r\n  return new FootageElement(data, this.globalData, this);\r\n};\r\n\r\nBaseRenderer.prototype.buildAllItems = function () {\r\n  var i;\r\n  var len = this.layers.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.buildItem(i);\r\n  }\r\n  this.checkPendingElements();\r\n};\r\n\r\nBaseRenderer.prototype.includeLayers = function (newLayers) {\r\n  this.completeLayers = false;\r\n  var i;\r\n  var len = newLayers.length;\r\n  var j;\r\n  var jLen = this.layers.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    j = 0;\r\n    while (j < jLen) {\r\n      if (this.layers[j].id === newLayers[i].id) {\r\n        this.layers[j] = newLayers[i];\r\n        break;\r\n      }\r\n      j += 1;\r\n    }\r\n  }\r\n};\r\n\r\nBaseRenderer.prototype.setProjectInterface = function (pInterface) {\r\n  this.globalData.projectInterface = pInterface;\r\n};\r\n\r\nBaseRenderer.prototype.initItems = function () {\r\n  if (!this.globalData.progressiveLoad) {\r\n    this.buildAllItems();\r\n  }\r\n};\r\nBaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {\r\n  var elements = this.elements;\r\n  var layers = this.layers;\r\n  var i = 0;\r\n  var len = layers.length;\r\n  while (i < len) {\r\n    if (layers[i].ind == parentName) { // eslint-disable-line eqeqeq\r\n      if (!elements[i] || elements[i] === true) {\r\n        this.buildItem(i);\r\n        this.addPendingElement(element);\r\n      } else {\r\n        hierarchy.push(elements[i]);\r\n        elements[i].setAsParent();\r\n        if (layers[i].parent !== undefined) {\r\n          this.buildElementParenting(element, layers[i].parent, hierarchy);\r\n        } else {\r\n          element.setHierarchy(hierarchy);\r\n        }\r\n      }\r\n    }\r\n    i += 1;\r\n  }\r\n};\r\n\r\nBaseRenderer.prototype.addPendingElement = function (element) {\r\n  this.pendingElements.push(element);\r\n};\r\n\r\nBaseRenderer.prototype.searchExtraCompositions = function (assets) {\r\n  var i;\r\n  var len = assets.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (assets[i].xt) {\r\n      var comp = this.createComp(assets[i]);\r\n      comp.initExpressions();\r\n      this.globalData.projectInterface.registerComposition(comp);\r\n    }\r\n  }\r\n};\r\n\r\nBaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {\r\n  this.globalData.fontManager = new FontManager();\r\n  this.globalData.fontManager.addChars(animData.chars);\r\n  this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);\r\n  this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);\r\n  this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);\r\n  this.globalData.imageLoader = this.animationItem.imagePreloader;\r\n  this.globalData.audioController = this.animationItem.audioController;\r\n  this.globalData.frameId = 0;\r\n  this.globalData.frameRate = animData.fr;\r\n  this.globalData.nm = animData.nm;\r\n  this.globalData.compSize = {\r\n    w: animData.w,\r\n    h: animData.h,\r\n  };\r\n};\r\n\r\n/* global createElementID, extendPrototype, BaseRenderer, NullElement, SVGShapeElement, SVGTextLottieElement,\r\nIImageElement, SVGCompElement, ISolidElement, createNS, locationHref, createSizedArray, expressionsPlugin */\r\n\r\nfunction SVGRenderer(animationItem, config) {\r\n  this.animationItem = animationItem;\r\n  this.layers = null;\r\n  this.renderedFrame = -1;\r\n  this.svgElement = createNS('svg');\r\n  var ariaLabel = '';\r\n  if (config && config.title) {\r\n    var titleElement = createNS('title');\r\n    var titleId = createElementID();\r\n    titleElement.setAttribute('id', titleId);\r\n    titleElement.textContent = config.title;\r\n    this.svgElement.appendChild(titleElement);\r\n    ariaLabel += titleId;\r\n  }\r\n  if (config && config.description) {\r\n    var descElement = createNS('desc');\r\n    var descId = createElementID();\r\n    descElement.setAttribute('id', descId);\r\n    descElement.textContent = config.description;\r\n    this.svgElement.appendChild(descElement);\r\n    ariaLabel += ' ' + descId;\r\n  }\r\n  if (ariaLabel) {\r\n    this.svgElement.setAttribute('aria-labelledby', ariaLabel);\r\n  }\r\n  var defs = createNS('defs');\r\n  this.svgElement.appendChild(defs);\r\n  var maskElement = createNS('g');\r\n  this.svgElement.appendChild(maskElement);\r\n  this.layerElement = maskElement;\r\n  this.renderConfig = {\r\n    preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\r\n    imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\r\n    progressiveLoad: (config && config.progressiveLoad) || false,\r\n    hideOnTransparent: !((config && config.hideOnTransparent === false)),\r\n    viewBoxOnly: (config && config.viewBoxOnly) || false,\r\n    viewBoxSize: (config && config.viewBoxSize) || false,\r\n    className: (config && config.className) || '',\r\n    id: (config && config.id) || '',\r\n    focusable: config && config.focusable,\r\n    filterSize: {\r\n      width: (config && config.filterSize && config.filterSize.width) || '100%',\r\n      height: (config && config.filterSize && config.filterSize.height) || '100%',\r\n      x: (config && config.filterSize && config.filterSize.x) || '0%',\r\n      y: (config && config.filterSize && config.filterSize.y) || '0%',\r\n    },\r\n  };\r\n\r\n  this.globalData = {\r\n    _mdf: false,\r\n    frameNum: -1,\r\n    defs: defs,\r\n    renderConfig: this.renderConfig,\r\n  };\r\n  this.elements = [];\r\n  this.pendingElements = [];\r\n  this.destroyed = false;\r\n  this.rendererType = 'svg';\r\n}\r\n\r\nextendPrototype([BaseRenderer], SVGRenderer);\r\n\r\nSVGRenderer.prototype.createNull = function (data) {\r\n  return new NullElement(data, this.globalData, this);\r\n};\r\n\r\nSVGRenderer.prototype.createShape = function (data) {\r\n  return new SVGShapeElement(data, this.globalData, this);\r\n};\r\n\r\nSVGRenderer.prototype.createText = function (data) {\r\n  return new SVGTextLottieElement(data, this.globalData, this);\r\n};\r\n\r\nSVGRenderer.prototype.createImage = function (data) {\r\n  return new IImageElement(data, this.globalData, this);\r\n};\r\n\r\nSVGRenderer.prototype.createComp = function (data) {\r\n  return new SVGCompElement(data, this.globalData, this);\r\n};\r\n\r\nSVGRenderer.prototype.createSolid = function (data) {\r\n  return new ISolidElement(data, this.globalData, this);\r\n};\r\n\r\nSVGRenderer.prototype.configAnimation = function (animData) {\r\n  this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\r\n  if (this.renderConfig.viewBoxSize) {\r\n    this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);\r\n  } else {\r\n    this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h);\r\n  }\r\n\r\n  if (!this.renderConfig.viewBoxOnly) {\r\n    this.svgElement.setAttribute('width', animData.w);\r\n    this.svgElement.setAttribute('height', animData.h);\r\n    this.svgElement.style.width = '100%';\r\n    this.svgElement.style.height = '100%';\r\n    this.svgElement.style.transform = 'translate3d(0,0,0)';\r\n  }\r\n  if (this.renderConfig.className) {\r\n    this.svgElement.setAttribute('class', this.renderConfig.className);\r\n  }\r\n  if (this.renderConfig.id) {\r\n    this.svgElement.setAttribute('id', this.renderConfig.id);\r\n  }\r\n  if (this.renderConfig.focusable !== undefined) {\r\n    this.svgElement.setAttribute('focusable', this.renderConfig.focusable);\r\n  }\r\n  this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio);\r\n  // this.layerElement.style.transform = 'translate3d(0,0,0)';\r\n  // this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = \"0px 0px 0px\";\r\n  this.animationItem.wrapper.appendChild(this.svgElement);\r\n  // Mask animation\r\n  var defs = this.globalData.defs;\r\n\r\n  this.setupGlobalData(animData, defs);\r\n  this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\r\n  this.data = animData;\r\n\r\n  var maskElement = createNS('clipPath');\r\n  var rect = createNS('rect');\r\n  rect.setAttribute('width', animData.w);\r\n  rect.setAttribute('height', animData.h);\r\n  rect.setAttribute('x', 0);\r\n  rect.setAttribute('y', 0);\r\n  var maskId = createElementID();\r\n  maskElement.setAttribute('id', maskId);\r\n  maskElement.appendChild(rect);\r\n  this.layerElement.setAttribute('clip-path', 'url(' + locationHref + '#' + maskId + ')');\r\n\r\n  defs.appendChild(maskElement);\r\n  this.layers = animData.layers;\r\n  this.elements = createSizedArray(animData.layers.length);\r\n};\r\n\r\nSVGRenderer.prototype.destroy = function () {\r\n  if (this.animationItem.wrapper) {\r\n    this.animationItem.wrapper.innerText = '';\r\n  }\r\n  this.layerElement = null;\r\n  this.globalData.defs = null;\r\n  var i;\r\n  var len = this.layers ? this.layers.length : 0;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.elements[i]) {\r\n      this.elements[i].destroy();\r\n    }\r\n  }\r\n  this.elements.length = 0;\r\n  this.destroyed = true;\r\n  this.animationItem = null;\r\n};\r\n\r\nSVGRenderer.prototype.updateContainerSize = function () {\r\n};\r\n\r\nSVGRenderer.prototype.buildItem = function (pos) {\r\n  var elements = this.elements;\r\n  if (elements[pos] || this.layers[pos].ty === 99) {\r\n    return;\r\n  }\r\n  elements[pos] = true;\r\n  var element = this.createItem(this.layers[pos]);\r\n\r\n  elements[pos] = element;\r\n  if (expressionsPlugin) {\r\n    if (this.layers[pos].ty === 0) {\r\n      this.globalData.projectInterface.registerComposition(element);\r\n    }\r\n    element.initExpressions();\r\n  }\r\n  this.appendElementInPos(element, pos);\r\n  if (this.layers[pos].tt) {\r\n    if (!this.elements[pos - 1] || this.elements[pos - 1] === true) {\r\n      this.buildItem(pos - 1);\r\n      this.addPendingElement(element);\r\n    } else {\r\n      element.setMatte(elements[pos - 1].layerId);\r\n    }\r\n  }\r\n};\r\n\r\nSVGRenderer.prototype.checkPendingElements = function () {\r\n  while (this.pendingElements.length) {\r\n    var element = this.pendingElements.pop();\r\n    element.checkParenting();\r\n    if (element.data.tt) {\r\n      var i = 0;\r\n      var len = this.elements.length;\r\n      while (i < len) {\r\n        if (this.elements[i] === element) {\r\n          element.setMatte(this.elements[i - 1].layerId);\r\n          break;\r\n        }\r\n        i += 1;\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\nSVGRenderer.prototype.renderFrame = function (num) {\r\n  if (this.renderedFrame === num || this.destroyed) {\r\n    return;\r\n  }\r\n  if (num === null) {\r\n    num = this.renderedFrame;\r\n  } else {\r\n    this.renderedFrame = num;\r\n  }\r\n  // console.log('-------');\r\n  // console.log('FRAME ',num);\r\n  this.globalData.frameNum = num;\r\n  this.globalData.frameId += 1;\r\n  this.globalData.projectInterface.currentFrame = num;\r\n  this.globalData._mdf = false;\r\n  var i;\r\n  var len = this.layers.length;\r\n  if (!this.completeLayers) {\r\n    this.checkLayers(num);\r\n  }\r\n  for (i = len - 1; i >= 0; i -= 1) {\r\n    if (this.completeLayers || this.elements[i]) {\r\n      this.elements[i].prepareFrame(num - this.layers[i].st);\r\n    }\r\n  }\r\n  if (this.globalData._mdf) {\r\n    for (i = 0; i < len; i += 1) {\r\n      if (this.completeLayers || this.elements[i]) {\r\n        this.elements[i].renderFrame();\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\nSVGRenderer.prototype.appendElementInPos = function (element, pos) {\r\n  var newElement = element.getBaseElement();\r\n  if (!newElement) {\r\n    return;\r\n  }\r\n  var i = 0;\r\n  var nextElement;\r\n  while (i < pos) {\r\n    if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {\r\n      nextElement = this.elements[i].getBaseElement();\r\n    }\r\n    i += 1;\r\n  }\r\n  if (nextElement) {\r\n    this.layerElement.insertBefore(newElement, nextElement);\r\n  } else {\r\n    this.layerElement.appendChild(newElement);\r\n  }\r\n};\r\n\r\nSVGRenderer.prototype.hide = function () {\r\n  this.layerElement.style.display = 'none';\r\n};\r\n\r\nSVGRenderer.prototype.show = function () {\r\n  this.layerElement.style.display = 'block';\r\n};\r\n\r\n/* global CVContextData, Matrix, extendPrototype, BaseRenderer, CVShapeElement, CVTextElement,\r\nCVImageElement, CVCompElement, CVSolidElement, SVGRenderer, createTag, createSizedArray */\r\n\r\nfunction CanvasRenderer(animationItem, config) {\r\n  this.animationItem = animationItem;\r\n  this.renderConfig = {\r\n    clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true,\r\n    context: (config && config.context) || null,\r\n    progressiveLoad: (config && config.progressiveLoad) || false,\r\n    preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\r\n    imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\r\n    className: (config && config.className) || '',\r\n    id: (config && config.id) || '',\r\n  };\r\n  this.renderConfig.dpr = (config && config.dpr) || 1;\r\n  if (this.animationItem.wrapper) {\r\n    this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1;\r\n  }\r\n  this.renderedFrame = -1;\r\n  this.globalData = {\r\n    frameNum: -1,\r\n    _mdf: false,\r\n    renderConfig: this.renderConfig,\r\n    currentGlobalAlpha: -1,\r\n  };\r\n  this.contextData = new CVContextData();\r\n  this.elements = [];\r\n  this.pendingElements = [];\r\n  this.transformMat = new Matrix();\r\n  this.completeLayers = false;\r\n  this.rendererType = 'canvas';\r\n}\r\nextendPrototype([BaseRenderer], CanvasRenderer);\r\n\r\nCanvasRenderer.prototype.createShape = function (data) {\r\n  return new CVShapeElement(data, this.globalData, this);\r\n};\r\n\r\nCanvasRenderer.prototype.createText = function (data) {\r\n  return new CVTextElement(data, this.globalData, this);\r\n};\r\n\r\nCanvasRenderer.prototype.createImage = function (data) {\r\n  return new CVImageElement(data, this.globalData, this);\r\n};\r\n\r\nCanvasRenderer.prototype.createComp = function (data) {\r\n  return new CVCompElement(data, this.globalData, this);\r\n};\r\n\r\nCanvasRenderer.prototype.createSolid = function (data) {\r\n  return new CVSolidElement(data, this.globalData, this);\r\n};\r\n\r\nCanvasRenderer.prototype.createNull = SVGRenderer.prototype.createNull;\r\n\r\nCanvasRenderer.prototype.ctxTransform = function (props) {\r\n  if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {\r\n    return;\r\n  }\r\n  if (!this.renderConfig.clearCanvas) {\r\n    this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]);\r\n    return;\r\n  }\r\n  this.transformMat.cloneFromProps(props);\r\n  var cProps = this.contextData.cTr.props;\r\n  this.transformMat.transform(cProps[0], cProps[1], cProps[2], cProps[3], cProps[4], cProps[5], cProps[6], cProps[7], cProps[8], cProps[9], cProps[10], cProps[11], cProps[12], cProps[13], cProps[14], cProps[15]);\r\n  // this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);\r\n  this.contextData.cTr.cloneFromProps(this.transformMat.props);\r\n  var trProps = this.contextData.cTr.props;\r\n  this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]);\r\n};\r\n\r\nCanvasRenderer.prototype.ctxOpacity = function (op) {\r\n  /* if(op === 1){\r\n        return;\r\n    } */\r\n  if (!this.renderConfig.clearCanvas) {\r\n    this.canvasContext.globalAlpha *= op < 0 ? 0 : op;\r\n    this.globalData.currentGlobalAlpha = this.contextData.cO;\r\n    return;\r\n  }\r\n  this.contextData.cO *= op < 0 ? 0 : op;\r\n  if (this.globalData.currentGlobalAlpha !== this.contextData.cO) {\r\n    this.canvasContext.globalAlpha = this.contextData.cO;\r\n    this.globalData.currentGlobalAlpha = this.contextData.cO;\r\n  }\r\n};\r\n\r\nCanvasRenderer.prototype.reset = function () {\r\n  if (!this.renderConfig.clearCanvas) {\r\n    this.canvasContext.restore();\r\n    return;\r\n  }\r\n  this.contextData.reset();\r\n};\r\n\r\nCanvasRenderer.prototype.save = function (actionFlag) {\r\n  if (!this.renderConfig.clearCanvas) {\r\n    this.canvasContext.save();\r\n    return;\r\n  }\r\n  if (actionFlag) {\r\n    this.canvasContext.save();\r\n  }\r\n  var props = this.contextData.cTr.props;\r\n  if (this.contextData._length <= this.contextData.cArrPos) {\r\n    this.contextData.duplicate();\r\n  }\r\n  var i;\r\n  var arr = this.contextData.saved[this.contextData.cArrPos];\r\n  for (i = 0; i < 16; i += 1) {\r\n    arr[i] = props[i];\r\n  }\r\n  this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO;\r\n  this.contextData.cArrPos += 1;\r\n};\r\n\r\nCanvasRenderer.prototype.restore = function (actionFlag) {\r\n  if (!this.renderConfig.clearCanvas) {\r\n    this.canvasContext.restore();\r\n    return;\r\n  }\r\n  if (actionFlag) {\r\n    this.canvasContext.restore();\r\n    this.globalData.blendMode = 'source-over';\r\n  }\r\n  this.contextData.cArrPos -= 1;\r\n  var popped = this.contextData.saved[this.contextData.cArrPos];\r\n  var i;\r\n  var arr = this.contextData.cTr.props;\r\n  for (i = 0; i < 16; i += 1) {\r\n    arr[i] = popped[i];\r\n  }\r\n  this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13]);\r\n  popped = this.contextData.savedOp[this.contextData.cArrPos];\r\n  this.contextData.cO = popped;\r\n  if (this.globalData.currentGlobalAlpha !== popped) {\r\n    this.canvasContext.globalAlpha = popped;\r\n    this.globalData.currentGlobalAlpha = popped;\r\n  }\r\n};\r\n\r\nCanvasRenderer.prototype.configAnimation = function (animData) {\r\n  if (this.animationItem.wrapper) {\r\n    this.animationItem.container = createTag('canvas');\r\n    var containerStyle = this.animationItem.container.style;\r\n    containerStyle.width = '100%';\r\n    containerStyle.height = '100%';\r\n    var origin = '0px 0px 0px';\r\n    containerStyle.transformOrigin = origin;\r\n    containerStyle.mozTransformOrigin = origin;\r\n    containerStyle.webkitTransformOrigin = origin;\r\n    containerStyle['-webkit-transform'] = origin;\r\n    this.animationItem.wrapper.appendChild(this.animationItem.container);\r\n    this.canvasContext = this.animationItem.container.getContext('2d');\r\n    if (this.renderConfig.className) {\r\n      this.animationItem.container.setAttribute('class', this.renderConfig.className);\r\n    }\r\n    if (this.renderConfig.id) {\r\n      this.animationItem.container.setAttribute('id', this.renderConfig.id);\r\n    }\r\n  } else {\r\n    this.canvasContext = this.renderConfig.context;\r\n  }\r\n  this.data = animData;\r\n  this.layers = animData.layers;\r\n  this.transformCanvas = {\r\n    w: animData.w,\r\n    h: animData.h,\r\n    sx: 0,\r\n    sy: 0,\r\n    tx: 0,\r\n    ty: 0,\r\n  };\r\n  this.setupGlobalData(animData, document.body);\r\n  this.globalData.canvasContext = this.canvasContext;\r\n  this.globalData.renderer = this;\r\n  this.globalData.isDashed = false;\r\n  this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\r\n  this.globalData.transformCanvas = this.transformCanvas;\r\n  this.elements = createSizedArray(animData.layers.length);\r\n\r\n  this.updateContainerSize();\r\n};\r\n\r\nCanvasRenderer.prototype.updateContainerSize = function () {\r\n  this.reset();\r\n  var elementWidth;\r\n  var elementHeight;\r\n  if (this.animationItem.wrapper && this.animationItem.container) {\r\n    elementWidth = this.animationItem.wrapper.offsetWidth;\r\n    elementHeight = this.animationItem.wrapper.offsetHeight;\r\n    this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr);\r\n    this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr);\r\n  } else {\r\n    elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr;\r\n    elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr;\r\n  }\r\n  var elementRel;\r\n  var animationRel;\r\n  if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {\r\n    var par = this.renderConfig.preserveAspectRatio.split(' ');\r\n    var fillType = par[1] || 'meet';\r\n    var pos = par[0] || 'xMidYMid';\r\n    var xPos = pos.substr(0, 4);\r\n    var yPos = pos.substr(4);\r\n    elementRel = elementWidth / elementHeight;\r\n    animationRel = this.transformCanvas.w / this.transformCanvas.h;\r\n    if ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice')) {\r\n      this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\r\n      this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\r\n    } else {\r\n      this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\r\n      this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\r\n    }\r\n\r\n    if (xPos === 'xMid' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {\r\n      this.transformCanvas.tx = ((elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2) * this.renderConfig.dpr;\r\n    } else if (xPos === 'xMax' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {\r\n      this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr;\r\n    } else {\r\n      this.transformCanvas.tx = 0;\r\n    }\r\n    if (yPos === 'YMid' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {\r\n      this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2) * this.renderConfig.dpr;\r\n    } else if (yPos === 'YMax' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {\r\n      this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w))) * this.renderConfig.dpr;\r\n    } else {\r\n      this.transformCanvas.ty = 0;\r\n    }\r\n  } else if (this.renderConfig.preserveAspectRatio === 'none') {\r\n    this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\r\n    this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\r\n    this.transformCanvas.tx = 0;\r\n    this.transformCanvas.ty = 0;\r\n  } else {\r\n    this.transformCanvas.sx = this.renderConfig.dpr;\r\n    this.transformCanvas.sy = this.renderConfig.dpr;\r\n    this.transformCanvas.tx = 0;\r\n    this.transformCanvas.ty = 0;\r\n  }\r\n  this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1];\r\n  /* var i, len = this.elements.length;\r\n    for(i=0;i<len;i+=1){\r\n        if(this.elements[i] && this.elements[i].data.ty === 0){\r\n            this.elements[i].resize(this.globalData.transformCanvas);\r\n        }\r\n    } */\r\n  this.ctxTransform(this.transformCanvas.props);\r\n  this.canvasContext.beginPath();\r\n  this.canvasContext.rect(0, 0, this.transformCanvas.w, this.transformCanvas.h);\r\n  this.canvasContext.closePath();\r\n  this.canvasContext.clip();\r\n\r\n  this.renderFrame(this.renderedFrame, true);\r\n};\r\n\r\nCanvasRenderer.prototype.destroy = function () {\r\n  if (this.renderConfig.clearCanvas && this.animationItem.wrapper) {\r\n    this.animationItem.wrapper.innerText = '';\r\n  }\r\n  var i;\r\n  var len = this.layers ? this.layers.length : 0;\r\n  for (i = len - 1; i >= 0; i -= 1) {\r\n    if (this.elements[i]) {\r\n      this.elements[i].destroy();\r\n    }\r\n  }\r\n  this.elements.length = 0;\r\n  this.globalData.canvasContext = null;\r\n  this.animationItem.container = null;\r\n  this.destroyed = true;\r\n};\r\n\r\nCanvasRenderer.prototype.renderFrame = function (num, forceRender) {\r\n  if ((this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) || this.destroyed || num === -1) {\r\n    return;\r\n  }\r\n  this.renderedFrame = num;\r\n  this.globalData.frameNum = num - this.animationItem._isFirstFrame;\r\n  this.globalData.frameId += 1;\r\n  this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;\r\n  this.globalData.projectInterface.currentFrame = num;\r\n\r\n  // console.log('--------');\r\n  // console.log('NEW: ',num);\r\n  var i;\r\n  var len = this.layers.length;\r\n  if (!this.completeLayers) {\r\n    this.checkLayers(num);\r\n  }\r\n\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.completeLayers || this.elements[i]) {\r\n      this.elements[i].prepareFrame(num - this.layers[i].st);\r\n    }\r\n  }\r\n  if (this.globalData._mdf) {\r\n    if (this.renderConfig.clearCanvas === true) {\r\n      this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);\r\n    } else {\r\n      this.save();\r\n    }\r\n    for (i = len - 1; i >= 0; i -= 1) {\r\n      if (this.completeLayers || this.elements[i]) {\r\n        this.elements[i].renderFrame();\r\n      }\r\n    }\r\n    if (this.renderConfig.clearCanvas !== true) {\r\n      this.restore();\r\n    }\r\n  }\r\n};\r\n\r\nCanvasRenderer.prototype.buildItem = function (pos) {\r\n  var elements = this.elements;\r\n  if (elements[pos] || this.layers[pos].ty === 99) {\r\n    return;\r\n  }\r\n  var element = this.createItem(this.layers[pos], this, this.globalData);\r\n  elements[pos] = element;\r\n  element.initExpressions();\r\n  /* if(this.layers[pos].ty === 0){\r\n        element.resize(this.globalData.transformCanvas);\r\n    } */\r\n};\r\n\r\nCanvasRenderer.prototype.checkPendingElements = function () {\r\n  while (this.pendingElements.length) {\r\n    var element = this.pendingElements.pop();\r\n    element.checkParenting();\r\n  }\r\n};\r\n\r\nCanvasRenderer.prototype.hide = function () {\r\n  this.animationItem.container.style.display = 'none';\r\n};\r\n\r\nCanvasRenderer.prototype.show = function () {\r\n  this.animationItem.container.style.display = 'block';\r\n};\r\n\r\n/* global extendPrototype, BaseRenderer, SVGRenderer, SVGShapeElement, HShapeElement, SVGTextLottieElement,\r\nHTextElement, HCameraElement, IImageElement, HImageElement, SVGCompElement, HCompElement, ISolidElement,\r\nHSolidElement, styleDiv, createTag, createNS */\r\n\r\nfunction HybridRenderer(animationItem, config) {\r\n  this.animationItem = animationItem;\r\n  this.layers = null;\r\n  this.renderedFrame = -1;\r\n  this.renderConfig = {\r\n    className: (config && config.className) || '',\r\n    imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\r\n    hideOnTransparent: !(config && config.hideOnTransparent === false),\r\n    filterSize: {\r\n      width: (config && config.filterSize && config.filterSize.width) || '400%',\r\n      height: (config && config.filterSize && config.filterSize.height) || '400%',\r\n      x: (config && config.filterSize && config.filterSize.x) || '-100%',\r\n      y: (config && config.filterSize && config.filterSize.y) || '-100%',\r\n    },\r\n  };\r\n  this.globalData = {\r\n    _mdf: false,\r\n    frameNum: -1,\r\n    renderConfig: this.renderConfig,\r\n  };\r\n  this.pendingElements = [];\r\n  this.elements = [];\r\n  this.threeDElements = [];\r\n  this.destroyed = false;\r\n  this.camera = null;\r\n  this.supports3d = true;\r\n  this.rendererType = 'html';\r\n}\r\n\r\nextendPrototype([BaseRenderer], HybridRenderer);\r\n\r\nHybridRenderer.prototype.buildItem = SVGRenderer.prototype.buildItem;\r\n\r\nHybridRenderer.prototype.checkPendingElements = function () {\r\n  while (this.pendingElements.length) {\r\n    var element = this.pendingElements.pop();\r\n    element.checkParenting();\r\n  }\r\n};\r\n\r\nHybridRenderer.prototype.appendElementInPos = function (element, pos) {\r\n  var newDOMElement = element.getBaseElement();\r\n  if (!newDOMElement) {\r\n    return;\r\n  }\r\n  var layer = this.layers[pos];\r\n  if (!layer.ddd || !this.supports3d) {\r\n    if (this.threeDElements) {\r\n      this.addTo3dContainer(newDOMElement, pos);\r\n    } else {\r\n      var i = 0;\r\n      var nextDOMElement;\r\n      var nextLayer;\r\n      var tmpDOMElement;\r\n      while (i < pos) {\r\n        if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement) {\r\n          nextLayer = this.elements[i];\r\n          tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();\r\n          nextDOMElement = tmpDOMElement || nextDOMElement;\r\n        }\r\n        i += 1;\r\n      }\r\n      if (nextDOMElement) {\r\n        if (!layer.ddd || !this.supports3d) {\r\n          this.layerElement.insertBefore(newDOMElement, nextDOMElement);\r\n        }\r\n      } else if (!layer.ddd || !this.supports3d) {\r\n        this.layerElement.appendChild(newDOMElement);\r\n      }\r\n    }\r\n  } else {\r\n    this.addTo3dContainer(newDOMElement, pos);\r\n  }\r\n};\r\n\r\nHybridRenderer.prototype.createShape = function (data) {\r\n  if (!this.supports3d) {\r\n    return new SVGShapeElement(data, this.globalData, this);\r\n  }\r\n  return new HShapeElement(data, this.globalData, this);\r\n};\r\n\r\nHybridRenderer.prototype.createText = function (data) {\r\n  if (!this.supports3d) {\r\n    return new SVGTextLottieElement(data, this.globalData, this);\r\n  }\r\n  return new HTextElement(data, this.globalData, this);\r\n};\r\n\r\nHybridRenderer.prototype.createCamera = function (data) {\r\n  this.camera = new HCameraElement(data, this.globalData, this);\r\n  return this.camera;\r\n};\r\n\r\nHybridRenderer.prototype.createImage = function (data) {\r\n  if (!this.supports3d) {\r\n    return new IImageElement(data, this.globalData, this);\r\n  }\r\n  return new HImageElement(data, this.globalData, this);\r\n};\r\n\r\nHybridRenderer.prototype.createComp = function (data) {\r\n  if (!this.supports3d) {\r\n    return new SVGCompElement(data, this.globalData, this);\r\n  }\r\n  return new HCompElement(data, this.globalData, this);\r\n};\r\n\r\nHybridRenderer.prototype.createSolid = function (data) {\r\n  if (!this.supports3d) {\r\n    return new ISolidElement(data, this.globalData, this);\r\n  }\r\n  return new HSolidElement(data, this.globalData, this);\r\n};\r\n\r\nHybridRenderer.prototype.createNull = SVGRenderer.prototype.createNull;\r\n\r\nHybridRenderer.prototype.getThreeDContainerByPos = function (pos) {\r\n  var i = 0;\r\n  var len = this.threeDElements.length;\r\n  while (i < len) {\r\n    if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {\r\n      return this.threeDElements[i].perspectiveElem;\r\n    }\r\n    i += 1;\r\n  }\r\n  return null;\r\n};\r\n\r\nHybridRenderer.prototype.createThreeDContainer = function (pos, type) {\r\n  var perspectiveElem = createTag('div');\r\n  var style;\r\n  var containerStyle;\r\n  styleDiv(perspectiveElem);\r\n  var container = createTag('div');\r\n  styleDiv(container);\r\n  if (type === '3d') {\r\n    style = perspectiveElem.style;\r\n    style.width = this.globalData.compSize.w + 'px';\r\n    style.height = this.globalData.compSize.h + 'px';\r\n    var center = '50% 50%';\r\n    style.webkitTransformOrigin = center;\r\n    style.mozTransformOrigin = center;\r\n    style.transformOrigin = center;\r\n    containerStyle = container.style;\r\n    var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\r\n    containerStyle.transform = matrix;\r\n    containerStyle.webkitTransform = matrix;\r\n  }\r\n\r\n  perspectiveElem.appendChild(container);\r\n  // this.resizerElem.appendChild(perspectiveElem);\r\n  var threeDContainerData = {\r\n    container: container,\r\n    perspectiveElem: perspectiveElem,\r\n    startPos: pos,\r\n    endPos: pos,\r\n    type: type,\r\n  };\r\n  this.threeDElements.push(threeDContainerData);\r\n  return threeDContainerData;\r\n};\r\n\r\nHybridRenderer.prototype.build3dContainers = function () {\r\n  var i;\r\n  var len = this.layers.length;\r\n  var lastThreeDContainerData;\r\n  var currentContainer = '';\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.layers[i].ddd && this.layers[i].ty !== 3) {\r\n      if (currentContainer !== '3d') {\r\n        currentContainer = '3d';\r\n        lastThreeDContainerData = this.createThreeDContainer(i, '3d');\r\n      }\r\n      lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\r\n    } else {\r\n      if (currentContainer !== '2d') {\r\n        currentContainer = '2d';\r\n        lastThreeDContainerData = this.createThreeDContainer(i, '2d');\r\n      }\r\n      lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\r\n    }\r\n  }\r\n  len = this.threeDElements.length;\r\n  for (i = len - 1; i >= 0; i -= 1) {\r\n    this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);\r\n  }\r\n};\r\n\r\nHybridRenderer.prototype.addTo3dContainer = function (elem, pos) {\r\n  var i = 0;\r\n  var len = this.threeDElements.length;\r\n  while (i < len) {\r\n    if (pos <= this.threeDElements[i].endPos) {\r\n      var j = this.threeDElements[i].startPos;\r\n      var nextElement;\r\n      while (j < pos) {\r\n        if (this.elements[j] && this.elements[j].getBaseElement) {\r\n          nextElement = this.elements[j].getBaseElement();\r\n        }\r\n        j += 1;\r\n      }\r\n      if (nextElement) {\r\n        this.threeDElements[i].container.insertBefore(elem, nextElement);\r\n      } else {\r\n        this.threeDElements[i].container.appendChild(elem);\r\n      }\r\n      break;\r\n    }\r\n    i += 1;\r\n  }\r\n};\r\n\r\nHybridRenderer.prototype.configAnimation = function (animData) {\r\n  var resizerElem = createTag('div');\r\n  var wrapper = this.animationItem.wrapper;\r\n  var style = resizerElem.style;\r\n  style.width = animData.w + 'px';\r\n  style.height = animData.h + 'px';\r\n  this.resizerElem = resizerElem;\r\n  styleDiv(resizerElem);\r\n  style.transformStyle = 'flat';\r\n  style.mozTransformStyle = 'flat';\r\n  style.webkitTransformStyle = 'flat';\r\n  if (this.renderConfig.className) {\r\n    resizerElem.setAttribute('class', this.renderConfig.className);\r\n  }\r\n  wrapper.appendChild(resizerElem);\r\n\r\n  style.overflow = 'hidden';\r\n  var svg = createNS('svg');\r\n  svg.setAttribute('width', '1');\r\n  svg.setAttribute('height', '1');\r\n  styleDiv(svg);\r\n  this.resizerElem.appendChild(svg);\r\n  var defs = createNS('defs');\r\n  svg.appendChild(defs);\r\n  this.data = animData;\r\n  // Mask animation\r\n  this.setupGlobalData(animData, svg);\r\n  this.globalData.defs = defs;\r\n  this.layers = animData.layers;\r\n  this.layerElement = this.resizerElem;\r\n  this.build3dContainers();\r\n  this.updateContainerSize();\r\n};\r\n\r\nHybridRenderer.prototype.destroy = function () {\r\n  if (this.animationItem.wrapper) {\r\n    this.animationItem.wrapper.innerText = '';\r\n  }\r\n  this.animationItem.container = null;\r\n  this.globalData.defs = null;\r\n  var i;\r\n  var len = this.layers ? this.layers.length : 0;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.elements[i].destroy();\r\n  }\r\n  this.elements.length = 0;\r\n  this.destroyed = true;\r\n  this.animationItem = null;\r\n};\r\n\r\nHybridRenderer.prototype.updateContainerSize = function () {\r\n  var elementWidth = this.animationItem.wrapper.offsetWidth;\r\n  var elementHeight = this.animationItem.wrapper.offsetHeight;\r\n  var elementRel = elementWidth / elementHeight;\r\n  var animationRel = this.globalData.compSize.w / this.globalData.compSize.h;\r\n  var sx;\r\n  var sy;\r\n  var tx;\r\n  var ty;\r\n  if (animationRel > elementRel) {\r\n    sx = elementWidth / (this.globalData.compSize.w);\r\n    sy = elementWidth / (this.globalData.compSize.w);\r\n    tx = 0;\r\n    ty = ((elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2);\r\n  } else {\r\n    sx = elementHeight / (this.globalData.compSize.h);\r\n    sy = elementHeight / (this.globalData.compSize.h);\r\n    tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2;\r\n    ty = 0;\r\n  }\r\n  var style = this.resizerElem.style;\r\n  style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)';\r\n  style.transform = style.webkitTransform;\r\n};\r\n\r\nHybridRenderer.prototype.renderFrame = SVGRenderer.prototype.renderFrame;\r\n\r\nHybridRenderer.prototype.hide = function () {\r\n  this.resizerElem.style.display = 'none';\r\n};\r\n\r\nHybridRenderer.prototype.show = function () {\r\n  this.resizerElem.style.display = 'block';\r\n};\r\n\r\nHybridRenderer.prototype.initItems = function () {\r\n  this.buildAllItems();\r\n  if (this.camera) {\r\n    this.camera.setup();\r\n  } else {\r\n    var cWidth = this.globalData.compSize.w;\r\n    var cHeight = this.globalData.compSize.h;\r\n    var i;\r\n    var len = this.threeDElements.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      var style = this.threeDElements[i].perspectiveElem.style;\r\n      style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px';\r\n      style.perspective = style.webkitPerspective;\r\n    }\r\n  }\r\n};\r\n\r\nHybridRenderer.prototype.searchExtraCompositions = function (assets) {\r\n  var i;\r\n  var len = assets.length;\r\n  var floatingContainer = createTag('div');\r\n  for (i = 0; i < len; i += 1) {\r\n    if (assets[i].xt) {\r\n      var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null);\r\n      comp.initExpressions();\r\n      this.globalData.projectInterface.registerComposition(comp);\r\n    }\r\n  }\r\n};\r\n\r\n/* global createSizedArray, createElementID, PropertyFactory, ShapePropertyFactory, createNS, locationHref */\r\n\r\nfunction MaskElement(data, element, globalData) {\r\n  this.data = data;\r\n  this.element = element;\r\n  this.globalData = globalData;\r\n  this.storedData = [];\r\n  this.masksProperties = this.data.masksProperties || [];\r\n  this.maskElement = null;\r\n  var defs = this.globalData.defs;\r\n  var i;\r\n  var len = this.masksProperties ? this.masksProperties.length : 0;\r\n  this.viewData = createSizedArray(len);\r\n  this.solidPath = '';\r\n\r\n  var path;\r\n  var properties = this.masksProperties;\r\n  var count = 0;\r\n  var currentMasks = [];\r\n  var j;\r\n  var jLen;\r\n  var layerId = createElementID();\r\n  var rect;\r\n  var expansor;\r\n  var feMorph;\r\n  var x;\r\n  var maskType = 'clipPath';\r\n  var maskRef = 'clip-path';\r\n  for (i = 0; i < len; i += 1) {\r\n    if ((properties[i].mode !== 'a' && properties[i].mode !== 'n') || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) {\r\n      maskType = 'mask';\r\n      maskRef = 'mask';\r\n    }\r\n\r\n    if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) {\r\n      rect = createNS('rect');\r\n      rect.setAttribute('fill', '#ffffff');\r\n      rect.setAttribute('width', this.element.comp.data.w || 0);\r\n      rect.setAttribute('height', this.element.comp.data.h || 0);\r\n      currentMasks.push(rect);\r\n    } else {\r\n      rect = null;\r\n    }\r\n\r\n    path = createNS('path');\r\n    if (properties[i].mode === 'n') {\r\n      // TODO move this to a factory or to a constructor\r\n      this.viewData[i] = {\r\n        op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\r\n        prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\r\n        elem: path,\r\n        lastPath: '',\r\n      };\r\n      defs.appendChild(path);\r\n    } else {\r\n      count += 1;\r\n\r\n      path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff');\r\n      path.setAttribute('clip-rule', 'nonzero');\r\n      var filterID;\r\n\r\n      if (properties[i].x.k !== 0) {\r\n        maskType = 'mask';\r\n        maskRef = 'mask';\r\n        x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element);\r\n        filterID = createElementID();\r\n        expansor = createNS('filter');\r\n        expansor.setAttribute('id', filterID);\r\n        feMorph = createNS('feMorphology');\r\n        feMorph.setAttribute('operator', 'erode');\r\n        feMorph.setAttribute('in', 'SourceGraphic');\r\n        feMorph.setAttribute('radius', '0');\r\n        expansor.appendChild(feMorph);\r\n        defs.appendChild(expansor);\r\n        path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff');\r\n      } else {\r\n        feMorph = null;\r\n        x = null;\r\n      }\r\n\r\n      // TODO move this to a factory or to a constructor\r\n      this.storedData[i] = {\r\n        elem: path,\r\n        x: x,\r\n        expan: feMorph,\r\n        lastPath: '',\r\n        lastOperator: '',\r\n        filterId: filterID,\r\n        lastRadius: 0,\r\n      };\r\n      if (properties[i].mode === 'i') {\r\n        jLen = currentMasks.length;\r\n        var g = createNS('g');\r\n        for (j = 0; j < jLen; j += 1) {\r\n          g.appendChild(currentMasks[j]);\r\n        }\r\n        var mask = createNS('mask');\r\n        mask.setAttribute('mask-type', 'alpha');\r\n        mask.setAttribute('id', layerId + '_' + count);\r\n        mask.appendChild(path);\r\n        defs.appendChild(mask);\r\n        g.setAttribute('mask', 'url(' + locationHref + '#' + layerId + '_' + count + ')');\r\n\r\n        currentMasks.length = 0;\r\n        currentMasks.push(g);\r\n      } else {\r\n        currentMasks.push(path);\r\n      }\r\n      if (properties[i].inv && !this.solidPath) {\r\n        this.solidPath = this.createLayerSolidPath();\r\n      }\r\n      // TODO move this to a factory or to a constructor\r\n      this.viewData[i] = {\r\n        elem: path,\r\n        lastPath: '',\r\n        op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\r\n        prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\r\n        invRect: rect,\r\n      };\r\n      if (!this.viewData[i].prop.k) {\r\n        this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]);\r\n      }\r\n    }\r\n  }\r\n\r\n  this.maskElement = createNS(maskType);\r\n\r\n  len = currentMasks.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.maskElement.appendChild(currentMasks[i]);\r\n  }\r\n\r\n  if (count > 0) {\r\n    this.maskElement.setAttribute('id', layerId);\r\n    this.element.maskedElement.setAttribute(maskRef, 'url(' + locationHref + '#' + layerId + ')');\r\n    defs.appendChild(this.maskElement);\r\n  }\r\n  if (this.viewData.length) {\r\n    this.element.addRenderableComponent(this);\r\n  }\r\n}\r\n\r\nMaskElement.prototype.getMaskProperty = function (pos) {\r\n  return this.viewData[pos].prop;\r\n};\r\n\r\nMaskElement.prototype.renderFrame = function (isFirstFrame) {\r\n  var finalMat = this.element.finalTransform.mat;\r\n  var i;\r\n  var len = this.masksProperties.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.viewData[i].prop._mdf || isFirstFrame) {\r\n      this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]);\r\n    }\r\n    if (this.viewData[i].op._mdf || isFirstFrame) {\r\n      this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v);\r\n    }\r\n    if (this.masksProperties[i].mode !== 'n') {\r\n      if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {\r\n        this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS());\r\n      }\r\n      if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {\r\n        var feMorph = this.storedData[i].expan;\r\n        if (this.storedData[i].x.v < 0) {\r\n          if (this.storedData[i].lastOperator !== 'erode') {\r\n            this.storedData[i].lastOperator = 'erode';\r\n            this.storedData[i].elem.setAttribute('filter', 'url(' + locationHref + '#' + this.storedData[i].filterId + ')');\r\n          }\r\n          feMorph.setAttribute('radius', -this.storedData[i].x.v);\r\n        } else {\r\n          if (this.storedData[i].lastOperator !== 'dilate') {\r\n            this.storedData[i].lastOperator = 'dilate';\r\n            this.storedData[i].elem.setAttribute('filter', null);\r\n          }\r\n          this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2);\r\n        }\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\nMaskElement.prototype.getMaskelement = function () {\r\n  return this.maskElement;\r\n};\r\n\r\nMaskElement.prototype.createLayerSolidPath = function () {\r\n  var path = 'M0,0 ';\r\n  path += ' h' + this.globalData.compSize.w;\r\n  path += ' v' + this.globalData.compSize.h;\r\n  path += ' h-' + this.globalData.compSize.w;\r\n  path += ' v-' + this.globalData.compSize.h + ' ';\r\n  return path;\r\n};\r\n\r\nMaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {\r\n  var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\r\n  var i;\r\n  var len;\r\n  len = pathNodes._length;\r\n  for (i = 1; i < len; i += 1) {\r\n    // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[i][0]+','+pathNodes.i[i][1] + \" \"+pathNodes.v[i][0]+','+pathNodes.v[i][1];\r\n    pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + ' ' + pathNodes.v[i][0] + ',' + pathNodes.v[i][1];\r\n  }\r\n  // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[0][0]+','+pathNodes.i[0][1] + \" \"+pathNodes.v[0][0]+','+pathNodes.v[0][1];\r\n  if (pathNodes.c && len > 1) {\r\n    pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + ' ' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\r\n  }\r\n  // pathNodes.__renderedString = pathString;\r\n\r\n  if (viewData.lastPath !== pathString) {\r\n    var pathShapeValue = '';\r\n    if (viewData.elem) {\r\n      if (pathNodes.c) {\r\n        pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;\r\n      }\r\n      viewData.elem.setAttribute('d', pathShapeValue);\r\n    }\r\n    viewData.lastPath = pathString;\r\n  }\r\n};\r\n\r\nMaskElement.prototype.destroy = function () {\r\n  this.element = null;\r\n  this.globalData = null;\r\n  this.maskElement = null;\r\n  this.data = null;\r\n  this.masksProperties = null;\r\n};\r\n\r\n/**\r\n * @file\r\n * Handles AE's layer parenting property.\r\n *\r\n */\r\n\r\nfunction HierarchyElement() {}\r\n\r\nHierarchyElement.prototype = {\r\n  /**\r\n     * @function\r\n     * Initializes hierarchy properties\r\n     *\r\n     */\r\n  initHierarchy: function () {\r\n    // element's parent list\r\n    this.hierarchy = [];\r\n    // if element is parent of another layer _isParent will be true\r\n    this._isParent = false;\r\n    this.checkParenting();\r\n  },\r\n  /**\r\n     * @function\r\n     * Sets layer's hierarchy.\r\n     * @param {array} hierarch\r\n     * layer's parent list\r\n     *\r\n     */\r\n  setHierarchy: function (hierarchy) {\r\n    this.hierarchy = hierarchy;\r\n  },\r\n  /**\r\n     * @function\r\n     * Sets layer as parent.\r\n     *\r\n     */\r\n  setAsParent: function () {\r\n    this._isParent = true;\r\n  },\r\n  /**\r\n     * @function\r\n     * Searches layer's parenting chain\r\n     *\r\n     */\r\n  checkParenting: function () {\r\n    if (this.data.parent !== undefined) {\r\n      this.comp.buildElementParenting(this, this.data.parent, []);\r\n    }\r\n  },\r\n};\r\n\r\n/**\r\n * @file\r\n * Handles element's layer frame update.\r\n * Checks layer in point and out point\r\n *\r\n */\r\n\r\nfunction FrameElement() {}\r\n\r\nFrameElement.prototype = {\r\n  /**\r\n     * @function\r\n     * Initializes frame related properties.\r\n     *\r\n     */\r\n  initFrame: function () {\r\n    // set to true when inpoint is rendered\r\n    this._isFirstFrame = false;\r\n    // list of animated properties\r\n    this.dynamicProperties = [];\r\n    // If layer has been modified in current tick this will be true\r\n    this._mdf = false;\r\n  },\r\n  /**\r\n     * @function\r\n     * Calculates all dynamic values\r\n     *\r\n     * @param {number} num\r\n     * current frame number in Layer's time\r\n     * @param {boolean} isVisible\r\n     * if layers is currently in range\r\n     *\r\n     */\r\n  prepareProperties: function (num, isVisible) {\r\n    var i;\r\n    var len = this.dynamicProperties.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {\r\n        this.dynamicProperties[i].getValue();\r\n        if (this.dynamicProperties[i]._mdf) {\r\n          this.globalData._mdf = true;\r\n          this._mdf = true;\r\n        }\r\n      }\r\n    }\r\n  },\r\n  addDynamicProperty: function (prop) {\r\n    if (this.dynamicProperties.indexOf(prop) === -1) {\r\n      this.dynamicProperties.push(prop);\r\n    }\r\n  },\r\n};\r\n\r\n/* global TransformPropertyFactory, Matrix */\r\n\r\nfunction TransformElement() {}\r\n\r\nTransformElement.prototype = {\r\n  initTransform: function () {\r\n    this.finalTransform = {\r\n      mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { o: 0 },\r\n      _matMdf: false,\r\n      _opMdf: false,\r\n      mat: new Matrix(),\r\n    };\r\n    if (this.data.ao) {\r\n      this.finalTransform.mProp.autoOriented = true;\r\n    }\r\n\r\n    // TODO: check TYPE 11: Guided elements\r\n    if (this.data.ty !== 11) {\r\n      // this.createElements();\r\n    }\r\n  },\r\n  renderTransform: function () {\r\n    this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;\r\n    this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;\r\n\r\n    if (this.hierarchy) {\r\n      var mat;\r\n      var finalMat = this.finalTransform.mat;\r\n      var i = 0;\r\n      var len = this.hierarchy.length;\r\n      // Checking if any of the transformation matrices in the hierarchy chain has changed.\r\n      if (!this.finalTransform._matMdf) {\r\n        while (i < len) {\r\n          if (this.hierarchy[i].finalTransform.mProp._mdf) {\r\n            this.finalTransform._matMdf = true;\r\n            break;\r\n          }\r\n          i += 1;\r\n        }\r\n      }\r\n\r\n      if (this.finalTransform._matMdf) {\r\n        mat = this.finalTransform.mProp.v.props;\r\n        finalMat.cloneFromProps(mat);\r\n        for (i = 0; i < len; i += 1) {\r\n          mat = this.hierarchy[i].finalTransform.mProp.v.props;\r\n          finalMat.transform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]);\r\n        }\r\n      }\r\n    }\r\n  },\r\n  globalToLocal: function (pt) {\r\n    var transforms = [];\r\n    transforms.push(this.finalTransform);\r\n    var flag = true;\r\n    var comp = this.comp;\r\n    while (flag) {\r\n      if (comp.finalTransform) {\r\n        if (comp.data.hasMask) {\r\n          transforms.splice(0, 0, comp.finalTransform);\r\n        }\r\n        comp = comp.comp;\r\n      } else {\r\n        flag = false;\r\n      }\r\n    }\r\n    var i;\r\n    var len = transforms.length;\r\n    var ptNew;\r\n    for (i = 0; i < len; i += 1) {\r\n      ptNew = transforms[i].mat.applyToPointArray(0, 0, 0);\r\n      // ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);\r\n      pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];\r\n    }\r\n    return pt;\r\n  },\r\n  mHelper: new Matrix(),\r\n};\r\n\r\nfunction RenderableElement() {\r\n\r\n}\r\n\r\nRenderableElement.prototype = {\r\n  initRenderable: function () {\r\n    // layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange\r\n    this.isInRange = false;\r\n    // layer's display state\r\n    this.hidden = false;\r\n    // If layer's transparency equals 0, it can be hidden\r\n    this.isTransparent = false;\r\n    // list of animated components\r\n    this.renderableComponents = [];\r\n  },\r\n  addRenderableComponent: function (component) {\r\n    if (this.renderableComponents.indexOf(component) === -1) {\r\n      this.renderableComponents.push(component);\r\n    }\r\n  },\r\n  removeRenderableComponent: function (component) {\r\n    if (this.renderableComponents.indexOf(component) !== -1) {\r\n      this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);\r\n    }\r\n  },\r\n  prepareRenderableFrame: function (num) {\r\n    this.checkLayerLimits(num);\r\n  },\r\n  checkTransparency: function () {\r\n    if (this.finalTransform.mProp.o.v <= 0) {\r\n      if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {\r\n        this.isTransparent = true;\r\n        this.hide();\r\n      }\r\n    } else if (this.isTransparent) {\r\n      this.isTransparent = false;\r\n      this.show();\r\n    }\r\n  },\r\n  /**\r\n     * @function\r\n     * Initializes frame related properties.\r\n     *\r\n     * @param {number} num\r\n     * current frame number in Layer's time\r\n     *\r\n     */\r\n  checkLayerLimits: function (num) {\r\n    if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {\r\n      if (this.isInRange !== true) {\r\n        this.globalData._mdf = true;\r\n        this._mdf = true;\r\n        this.isInRange = true;\r\n        this.show();\r\n      }\r\n    } else if (this.isInRange !== false) {\r\n      this.globalData._mdf = true;\r\n      this.isInRange = false;\r\n      this.hide();\r\n    }\r\n  },\r\n  renderRenderable: function () {\r\n    var i;\r\n    var len = this.renderableComponents.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.renderableComponents[i].renderFrame(this._isFirstFrame);\r\n    }\r\n    /* this.maskManager.renderFrame(this.finalTransform.mat);\r\n        this.renderableEffectsManager.renderFrame(this._isFirstFrame); */\r\n  },\r\n  sourceRectAtTime: function () {\r\n    return {\r\n      top: 0,\r\n      left: 0,\r\n      width: 100,\r\n      height: 100,\r\n    };\r\n  },\r\n  getLayerSize: function () {\r\n    if (this.data.ty === 5) {\r\n      return { w: this.data.textData.width, h: this.data.textData.height };\r\n    }\r\n    return { w: this.data.width, h: this.data.height };\r\n  },\r\n};\r\n\r\n/* global extendPrototype, RenderableElement, createProxyFunction */\r\n\r\nfunction RenderableDOMElement() {}\r\n\r\n(function () {\r\n  var _prototype = {\r\n    initElement: function (data, globalData, comp) {\r\n      this.initFrame();\r\n      this.initBaseData(data, globalData, comp);\r\n      this.initTransform(data, globalData, comp);\r\n      this.initHierarchy();\r\n      this.initRenderable();\r\n      this.initRendererElement();\r\n      this.createContainerElements();\r\n      this.createRenderableComponents();\r\n      this.createContent();\r\n      this.hide();\r\n    },\r\n    hide: function () {\r\n      if (!this.hidden && (!this.isInRange || this.isTransparent)) {\r\n        var elem = this.baseElement || this.layerElement;\r\n        elem.style.display = 'none';\r\n        this.hidden = true;\r\n      }\r\n    },\r\n    show: function () {\r\n      if (this.isInRange && !this.isTransparent) {\r\n        if (!this.data.hd) {\r\n          var elem = this.baseElement || this.layerElement;\r\n          elem.style.display = 'block';\r\n        }\r\n        this.hidden = false;\r\n        this._isFirstFrame = true;\r\n      }\r\n    },\r\n    renderFrame: function () {\r\n      // If it is exported as hidden (data.hd === true) no need to render\r\n      // If it is not visible no need to render\r\n      if (this.data.hd || this.hidden) {\r\n        return;\r\n      }\r\n      this.renderTransform();\r\n      this.renderRenderable();\r\n      this.renderElement();\r\n      this.renderInnerContent();\r\n      if (this._isFirstFrame) {\r\n        this._isFirstFrame = false;\r\n      }\r\n    },\r\n    renderInnerContent: function () {},\r\n    prepareFrame: function (num) {\r\n      this._mdf = false;\r\n      this.prepareRenderableFrame(num);\r\n      this.prepareProperties(num, this.isInRange);\r\n      this.checkTransparency();\r\n    },\r\n    destroy: function () {\r\n      this.innerElem = null;\r\n      this.destroyBaseElement();\r\n    },\r\n  };\r\n  extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);\r\n}());\r\n\r\n/* exported ProcessedElement */\r\n\r\nfunction ProcessedElement(element, position) {\r\n  this.elem = element;\r\n  this.pos = position;\r\n}\r\n\r\n/* global createNS */\r\n\r\nfunction SVGStyleData(data, level) {\r\n  this.data = data;\r\n  this.type = data.ty;\r\n  this.d = '';\r\n  this.lvl = level;\r\n  this._mdf = false;\r\n  this.closed = data.hd === true;\r\n  this.pElem = createNS('path');\r\n  this.msElem = null;\r\n}\r\n\r\nSVGStyleData.prototype.reset = function () {\r\n  this.d = '';\r\n  this._mdf = false;\r\n};\r\n\r\nfunction SVGShapeData(transformers, level, shape) {\r\n  this.caches = [];\r\n  this.styles = [];\r\n  this.transformers = transformers;\r\n  this.lStr = '';\r\n  this.sh = shape;\r\n  this.lvl = level;\r\n  // TODO find if there are some cases where _isAnimated can be false.\r\n  // For now, since shapes add up with other shapes. They have to be calculated every time.\r\n  // One way of finding out is checking if all styles associated to this shape depend only of this shape\r\n  this._isAnimated = !!shape.k;\r\n  // TODO: commenting this for now since all shapes are animated\r\n  var i = 0;\r\n  var len = transformers.length;\r\n  while (i < len) {\r\n    if (transformers[i].mProps.dynamicProperties.length) {\r\n      this._isAnimated = true;\r\n      break;\r\n    }\r\n    i += 1;\r\n  }\r\n}\r\n\r\nSVGShapeData.prototype.setAsAnimated = function () {\r\n  this._isAnimated = true;\r\n};\r\n\r\n/* exported SVGTransformData */\r\n\r\nfunction SVGTransformData(mProps, op, container) {\r\n  this.transform = {\r\n    mProps: mProps,\r\n    op: op,\r\n    container: container,\r\n  };\r\n  this.elements = [];\r\n  this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;\r\n}\r\n\r\n/* global DashProperty, PropertyFactory, extendPrototype, DynamicPropertyContainer */\r\n\r\nfunction SVGStrokeStyleData(elem, data, styleOb) {\r\n  this.initDynamicPropertyContainer(elem);\r\n  this.getValue = this.iterateDynamicProperties;\r\n  this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\r\n  this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\r\n  this.d = new DashProperty(elem, data.d || {}, 'svg', this);\r\n  this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\r\n  this.style = styleOb;\r\n  this._isAnimated = !!this._isAnimated;\r\n}\r\n\r\nextendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);\r\n\r\n/* global PropertyFactory, extendPrototype, DynamicPropertyContainer */\r\n\r\nfunction SVGFillStyleData(elem, data, styleOb) {\r\n  this.initDynamicPropertyContainer(elem);\r\n  this.getValue = this.iterateDynamicProperties;\r\n  this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\r\n  this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\r\n  this.style = styleOb;\r\n}\r\n\r\nextendPrototype([DynamicPropertyContainer], SVGFillStyleData);\r\n\r\n/* global PropertyFactory, degToRads, GradientProperty, createElementID, createNS, locationHref,\r\nextendPrototype, DynamicPropertyContainer, lineCapEnum, lineJoinEnum */\r\n\r\nfunction SVGGradientFillStyleData(elem, data, styleOb) {\r\n  this.initDynamicPropertyContainer(elem);\r\n  this.getValue = this.iterateDynamicProperties;\r\n  this.initGradientData(elem, data, styleOb);\r\n}\r\n\r\nSVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {\r\n  this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\r\n  this.s = PropertyFactory.getProp(elem, data.s, 1, null, this);\r\n  this.e = PropertyFactory.getProp(elem, data.e, 1, null, this);\r\n  this.h = PropertyFactory.getProp(elem, data.h || { k: 0 }, 0, 0.01, this);\r\n  this.a = PropertyFactory.getProp(elem, data.a || { k: 0 }, 0, degToRads, this);\r\n  this.g = new GradientProperty(elem, data.g, this);\r\n  this.style = styleOb;\r\n  this.stops = [];\r\n  this.setGradientData(styleOb.pElem, data);\r\n  this.setGradientOpacity(data, styleOb);\r\n  this._isAnimated = !!this._isAnimated;\r\n};\r\n\r\nSVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {\r\n  var gradientId = createElementID();\r\n  var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\r\n  gfill.setAttribute('id', gradientId);\r\n  gfill.setAttribute('spreadMethod', 'pad');\r\n  gfill.setAttribute('gradientUnits', 'userSpaceOnUse');\r\n  var stops = [];\r\n  var stop;\r\n  var j;\r\n  var jLen;\r\n  jLen = data.g.p * 4;\r\n  for (j = 0; j < jLen; j += 4) {\r\n    stop = createNS('stop');\r\n    gfill.appendChild(stop);\r\n    stops.push(stop);\r\n  }\r\n  pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + gradientId + ')');\r\n  this.gf = gfill;\r\n  this.cst = stops;\r\n};\r\n\r\nSVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {\r\n  if (this.g._hasOpacity && !this.g._collapsable) {\r\n    var stop;\r\n    var j;\r\n    var jLen;\r\n    var mask = createNS('mask');\r\n    var maskElement = createNS('path');\r\n    mask.appendChild(maskElement);\r\n    var opacityId = createElementID();\r\n    var maskId = createElementID();\r\n    mask.setAttribute('id', maskId);\r\n    var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\r\n    opFill.setAttribute('id', opacityId);\r\n    opFill.setAttribute('spreadMethod', 'pad');\r\n    opFill.setAttribute('gradientUnits', 'userSpaceOnUse');\r\n    jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;\r\n    var stops = this.stops;\r\n    for (j = data.g.p * 4; j < jLen; j += 2) {\r\n      stop = createNS('stop');\r\n      stop.setAttribute('stop-color', 'rgb(255,255,255)');\r\n      opFill.appendChild(stop);\r\n      stops.push(stop);\r\n    }\r\n    maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + opacityId + ')');\r\n    if (data.ty === 'gs') {\r\n      maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\r\n      maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\r\n      if (data.lj === 1) {\r\n        maskElement.setAttribute('stroke-miterlimit', data.ml);\r\n      }\r\n    }\r\n    this.of = opFill;\r\n    this.ms = mask;\r\n    this.ost = stops;\r\n    this.maskId = maskId;\r\n    styleOb.msElem = maskElement;\r\n  }\r\n};\r\n\r\nextendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);\r\n\r\n/* global PropertyFactory, DashProperty, extendPrototype, SVGGradientFillStyleData, DynamicPropertyContainer */\r\n\r\nfunction SVGGradientStrokeStyleData(elem, data, styleOb) {\r\n  this.initDynamicPropertyContainer(elem);\r\n  this.getValue = this.iterateDynamicProperties;\r\n  this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\r\n  this.d = new DashProperty(elem, data.d || {}, 'svg', this);\r\n  this.initGradientData(elem, data, styleOb);\r\n  this._isAnimated = !!this._isAnimated;\r\n}\r\n\r\nextendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);\r\n\r\n/* global createNS */\r\n/* exported ShapeGroupData */\r\n\r\nfunction ShapeGroupData() {\r\n  this.it = [];\r\n  this.prevViewData = [];\r\n  this.gr = createNS('g');\r\n}\r\n\r\n/* global Matrix, buildShapeString, bmFloor */\r\n/* exported SVGElementsRenderer */\r\n\r\nvar SVGElementsRenderer = (function () {\r\n  var _identityMatrix = new Matrix();\r\n  var _matrixHelper = new Matrix();\r\n\r\n  var ob = {\r\n    createRenderFunction: createRenderFunction,\r\n  };\r\n\r\n  function createRenderFunction(data) {\r\n    switch (data.ty) {\r\n      case 'fl':\r\n        return renderFill;\r\n      case 'gf':\r\n        return renderGradient;\r\n      case 'gs':\r\n        return renderGradientStroke;\r\n      case 'st':\r\n        return renderStroke;\r\n      case 'sh':\r\n      case 'el':\r\n      case 'rc':\r\n      case 'sr':\r\n        return renderPath;\r\n      case 'tr':\r\n        return renderContentTransform;\r\n      default:\r\n        return null;\r\n    }\r\n  }\r\n\r\n  function renderContentTransform(styleData, itemData, isFirstFrame) {\r\n    if (isFirstFrame || itemData.transform.op._mdf) {\r\n      itemData.transform.container.setAttribute('opacity', itemData.transform.op.v);\r\n    }\r\n    if (isFirstFrame || itemData.transform.mProps._mdf) {\r\n      itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS());\r\n    }\r\n  }\r\n\r\n  function renderPath(styleData, itemData, isFirstFrame) {\r\n    var j;\r\n    var jLen;\r\n    var pathStringTransformed;\r\n    var redraw;\r\n    var pathNodes;\r\n    var l;\r\n    var lLen = itemData.styles.length;\r\n    var lvl = itemData.lvl;\r\n    var paths;\r\n    var mat;\r\n    var props;\r\n    var iterations;\r\n    var k;\r\n    for (l = 0; l < lLen; l += 1) {\r\n      redraw = itemData.sh._mdf || isFirstFrame;\r\n      if (itemData.styles[l].lvl < lvl) {\r\n        mat = _matrixHelper.reset();\r\n        iterations = lvl - itemData.styles[l].lvl;\r\n        k = itemData.transformers.length - 1;\r\n        while (!redraw && iterations > 0) {\r\n          redraw = itemData.transformers[k].mProps._mdf || redraw;\r\n          iterations -= 1;\r\n          k -= 1;\r\n        }\r\n        if (redraw) {\r\n          iterations = lvl - itemData.styles[l].lvl;\r\n          k = itemData.transformers.length - 1;\r\n          while (iterations > 0) {\r\n            props = itemData.transformers[k].mProps.v.props;\r\n            mat.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);\r\n            iterations -= 1;\r\n            k -= 1;\r\n          }\r\n        }\r\n      } else {\r\n        mat = _identityMatrix;\r\n      }\r\n      paths = itemData.sh.paths;\r\n      jLen = paths._length;\r\n      if (redraw) {\r\n        pathStringTransformed = '';\r\n        for (j = 0; j < jLen; j += 1) {\r\n          pathNodes = paths.shapes[j];\r\n          if (pathNodes && pathNodes._length) {\r\n            pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);\r\n          }\r\n        }\r\n        itemData.caches[l] = pathStringTransformed;\r\n      } else {\r\n        pathStringTransformed = itemData.caches[l];\r\n      }\r\n      itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;\r\n      itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;\r\n    }\r\n  }\r\n\r\n  function renderFill(styleData, itemData, isFirstFrame) {\r\n    var styleElem = itemData.style;\r\n\r\n    if (itemData.c._mdf || isFirstFrame) {\r\n      styleElem.pElem.setAttribute('fill', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\r\n    }\r\n    if (itemData.o._mdf || isFirstFrame) {\r\n      styleElem.pElem.setAttribute('fill-opacity', itemData.o.v);\r\n    }\r\n  }\r\n\r\n  function renderGradientStroke(styleData, itemData, isFirstFrame) {\r\n    renderGradient(styleData, itemData, isFirstFrame);\r\n    renderStroke(styleData, itemData, isFirstFrame);\r\n  }\r\n\r\n  function renderGradient(styleData, itemData, isFirstFrame) {\r\n    var gfill = itemData.gf;\r\n    var hasOpacity = itemData.g._hasOpacity;\r\n    var pt1 = itemData.s.v;\r\n    var pt2 = itemData.e.v;\r\n\r\n    if (itemData.o._mdf || isFirstFrame) {\r\n      var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';\r\n      itemData.style.pElem.setAttribute(attr, itemData.o.v);\r\n    }\r\n    if (itemData.s._mdf || isFirstFrame) {\r\n      var attr1 = styleData.t === 1 ? 'x1' : 'cx';\r\n      var attr2 = attr1 === 'x1' ? 'y1' : 'cy';\r\n      gfill.setAttribute(attr1, pt1[0]);\r\n      gfill.setAttribute(attr2, pt1[1]);\r\n      if (hasOpacity && !itemData.g._collapsable) {\r\n        itemData.of.setAttribute(attr1, pt1[0]);\r\n        itemData.of.setAttribute(attr2, pt1[1]);\r\n      }\r\n    }\r\n    var stops;\r\n    var i;\r\n    var len;\r\n    var stop;\r\n    if (itemData.g._cmdf || isFirstFrame) {\r\n      stops = itemData.cst;\r\n      var cValues = itemData.g.c;\r\n      len = stops.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        stop = stops[i];\r\n        stop.setAttribute('offset', cValues[i * 4] + '%');\r\n        stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')');\r\n      }\r\n    }\r\n    if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {\r\n      var oValues = itemData.g.o;\r\n      if (itemData.g._collapsable) {\r\n        stops = itemData.cst;\r\n      } else {\r\n        stops = itemData.ost;\r\n      }\r\n      len = stops.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        stop = stops[i];\r\n        if (!itemData.g._collapsable) {\r\n          stop.setAttribute('offset', oValues[i * 2] + '%');\r\n        }\r\n        stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);\r\n      }\r\n    }\r\n    if (styleData.t === 1) {\r\n      if (itemData.e._mdf || isFirstFrame) {\r\n        gfill.setAttribute('x2', pt2[0]);\r\n        gfill.setAttribute('y2', pt2[1]);\r\n        if (hasOpacity && !itemData.g._collapsable) {\r\n          itemData.of.setAttribute('x2', pt2[0]);\r\n          itemData.of.setAttribute('y2', pt2[1]);\r\n        }\r\n      }\r\n    } else {\r\n      var rad;\r\n      if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {\r\n        rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\r\n        gfill.setAttribute('r', rad);\r\n        if (hasOpacity && !itemData.g._collapsable) {\r\n          itemData.of.setAttribute('r', rad);\r\n        }\r\n      }\r\n      if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {\r\n        if (!rad) {\r\n          rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\r\n        }\r\n        var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\r\n\r\n        var percent = itemData.h.v;\r\n        if (percent >= 1) {\r\n          percent = 0.99;\r\n        } else if (percent <= -1) {\r\n          percent = -0.99;\r\n        }\r\n        var dist = rad * percent;\r\n        var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\r\n        var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\r\n        gfill.setAttribute('fx', x);\r\n        gfill.setAttribute('fy', y);\r\n        if (hasOpacity && !itemData.g._collapsable) {\r\n          itemData.of.setAttribute('fx', x);\r\n          itemData.of.setAttribute('fy', y);\r\n        }\r\n      }\r\n      // gfill.setAttribute('fy','200');\r\n    }\r\n  }\r\n\r\n  function renderStroke(styleData, itemData, isFirstFrame) {\r\n    var styleElem = itemData.style;\r\n    var d = itemData.d;\r\n    if (d && (d._mdf || isFirstFrame) && d.dashStr) {\r\n      styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);\r\n      styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);\r\n    }\r\n    if (itemData.c && (itemData.c._mdf || isFirstFrame)) {\r\n      styleElem.pElem.setAttribute('stroke', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\r\n    }\r\n    if (itemData.o._mdf || isFirstFrame) {\r\n      styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);\r\n    }\r\n    if (itemData.w._mdf || isFirstFrame) {\r\n      styleElem.pElem.setAttribute('stroke-width', itemData.w.v);\r\n      if (styleElem.msElem) {\r\n        styleElem.msElem.setAttribute('stroke-width', itemData.w.v);\r\n      }\r\n    }\r\n  }\r\n\r\n  return ob;\r\n}());\r\n\r\n/* global Matrix */\r\n\r\nfunction ShapeTransformManager() {\r\n  this.sequences = {};\r\n  this.sequenceList = [];\r\n  this.transform_key_count = 0;\r\n}\r\n\r\nShapeTransformManager.prototype = {\r\n  addTransformSequence: function (transforms) {\r\n    var i;\r\n    var len = transforms.length;\r\n    var key = '_';\r\n    for (i = 0; i < len; i += 1) {\r\n      key += transforms[i].transform.key + '_';\r\n    }\r\n    var sequence = this.sequences[key];\r\n    if (!sequence) {\r\n      sequence = {\r\n        transforms: [].concat(transforms),\r\n        finalTransform: new Matrix(),\r\n        _mdf: false,\r\n      };\r\n      this.sequences[key] = sequence;\r\n      this.sequenceList.push(sequence);\r\n    }\r\n    return sequence;\r\n  },\r\n  processSequence: function (sequence, isFirstFrame) {\r\n    var i = 0;\r\n    var len = sequence.transforms.length;\r\n    var _mdf = isFirstFrame;\r\n    while (i < len && !isFirstFrame) {\r\n      if (sequence.transforms[i].transform.mProps._mdf) {\r\n        _mdf = true;\r\n        break;\r\n      }\r\n      i += 1;\r\n    }\r\n    if (_mdf) {\r\n      var props;\r\n      sequence.finalTransform.reset();\r\n      for (i = len - 1; i >= 0; i -= 1) {\r\n        props = sequence.transforms[i].transform.mProps.v.props;\r\n        sequence.finalTransform.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);\r\n      }\r\n    }\r\n    sequence._mdf = _mdf;\r\n  },\r\n  processSequences: function (isFirstFrame) {\r\n    var i;\r\n    var len = this.sequenceList.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.processSequence(this.sequenceList[i], isFirstFrame);\r\n    }\r\n  },\r\n  getNewKey: function () {\r\n    this.transform_key_count += 1;\r\n    return '_' + this.transform_key_count;\r\n  },\r\n};\r\n\r\n/* global ShapePropertyFactory, SVGShapeData */\r\n\r\nfunction CVShapeData(element, data, styles, transformsManager) {\r\n  this.styledShapes = [];\r\n  this.tr = [0, 0, 0, 0, 0, 0];\r\n  var ty = 4;\r\n  if (data.ty === 'rc') {\r\n    ty = 5;\r\n  } else if (data.ty === 'el') {\r\n    ty = 6;\r\n  } else if (data.ty === 'sr') {\r\n    ty = 7;\r\n  }\r\n  this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);\r\n  var i;\r\n  var len = styles.length;\r\n  var styledShape;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (!styles[i].closed) {\r\n      styledShape = {\r\n        transforms: transformsManager.addTransformSequence(styles[i].transforms),\r\n        trNodes: [],\r\n      };\r\n      this.styledShapes.push(styledShape);\r\n      styles[i].elements.push(styledShape);\r\n    }\r\n  }\r\n}\r\n\r\nCVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;\r\n\r\n/* global LayerExpressionInterface, EffectsExpressionInterface, CompExpressionInterface, ShapeExpressionInterface,\r\nTextExpressionInterface, getBlendMode,createElementID, EffectsManager */\r\n\r\nfunction BaseElement() {\r\n}\r\n\r\nBaseElement.prototype = {\r\n  checkMasks: function () {\r\n    if (!this.data.hasMask) {\r\n      return false;\r\n    }\r\n    var i = 0;\r\n    var len = this.data.masksProperties.length;\r\n    while (i < len) {\r\n      if ((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) {\r\n        return true;\r\n      }\r\n      i += 1;\r\n    }\r\n    return false;\r\n  },\r\n  initExpressions: function () {\r\n    this.layerInterface = LayerExpressionInterface(this);\r\n    if (this.data.hasMask && this.maskManager) {\r\n      this.layerInterface.registerMaskInterface(this.maskManager);\r\n    }\r\n    var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface);\r\n    this.layerInterface.registerEffectsInterface(effectsInterface);\r\n\r\n    if (this.data.ty === 0 || this.data.xt) {\r\n      this.compInterface = CompExpressionInterface(this);\r\n    } else if (this.data.ty === 4) {\r\n      this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface);\r\n      this.layerInterface.content = this.layerInterface.shapeInterface;\r\n    } else if (this.data.ty === 5) {\r\n      this.layerInterface.textInterface = TextExpressionInterface(this);\r\n      this.layerInterface.text = this.layerInterface.textInterface;\r\n    }\r\n  },\r\n  setBlendMode: function () {\r\n    var blendModeValue = getBlendMode(this.data.bm);\r\n    var elem = this.baseElement || this.layerElement;\r\n\r\n    elem.style['mix-blend-mode'] = blendModeValue;\r\n  },\r\n  initBaseData: function (data, globalData, comp) {\r\n    this.globalData = globalData;\r\n    this.comp = comp;\r\n    this.data = data;\r\n    this.layerId = createElementID();\r\n\r\n    // Stretch factor for old animations missing this property.\r\n    if (!this.data.sr) {\r\n      this.data.sr = 1;\r\n    }\r\n    // effects manager\r\n    this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties);\r\n  },\r\n  getType: function () {\r\n    return this.type;\r\n  },\r\n  sourceRectAtTime: function () {},\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, HierarchyElement, FrameElement */\r\n\r\nfunction NullElement(data, globalData, comp) {\r\n  this.initFrame();\r\n  this.initBaseData(data, globalData, comp);\r\n  this.initFrame();\r\n  this.initTransform(data, globalData, comp);\r\n  this.initHierarchy();\r\n}\r\n\r\nNullElement.prototype.prepareFrame = function (num) {\r\n  this.prepareProperties(num, true);\r\n};\r\n\r\nNullElement.prototype.renderFrame = function () {\r\n};\r\n\r\nNullElement.prototype.getBaseElement = function () {\r\n  return null;\r\n};\r\n\r\nNullElement.prototype.destroy = function () {\r\n};\r\n\r\nNullElement.prototype.sourceRectAtTime = function () {\r\n};\r\n\r\nNullElement.prototype.hide = function () {\r\n};\r\n\r\nextendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement);\r\n\r\n/* global filtersFactory, featureSupport, filtersFactory, createElementID, createNS, MaskElement, SVGEffects, locationHref */\r\n\r\nfunction SVGBaseElement() {\r\n}\r\n\r\nSVGBaseElement.prototype = {\r\n  initRendererElement: function () {\r\n    this.layerElement = createNS('g');\r\n  },\r\n  createContainerElements: function () {\r\n    this.matteElement = createNS('g');\r\n    this.transformedElement = this.layerElement;\r\n    this.maskedElement = this.layerElement;\r\n    this._sizeChanged = false;\r\n    var layerElementParent = null;\r\n    // If this layer acts as a mask for the following layer\r\n    var filId;\r\n    var fil;\r\n    var gg;\r\n    if (this.data.td) {\r\n      if (this.data.td == 3 || this.data.td == 1) { // eslint-disable-line eqeqeq\r\n        var masker = createNS('mask');\r\n        masker.setAttribute('id', this.layerId);\r\n        masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha'); // eslint-disable-line eqeqeq\r\n        masker.appendChild(this.layerElement);\r\n        layerElementParent = masker;\r\n        this.globalData.defs.appendChild(masker);\r\n        // This is only for IE and Edge when mask if of type alpha\r\n        if (!featureSupport.maskType && this.data.td == 1) { // eslint-disable-line eqeqeq\r\n          masker.setAttribute('mask-type', 'luminance');\r\n          filId = createElementID();\r\n          fil = filtersFactory.createFilter(filId);\r\n          this.globalData.defs.appendChild(fil);\r\n          fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\r\n          gg = createNS('g');\r\n          gg.appendChild(this.layerElement);\r\n          layerElementParent = gg;\r\n          masker.appendChild(gg);\r\n          gg.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');\r\n        }\r\n      } else if (this.data.td == 2) { // eslint-disable-line eqeqeq\r\n        var maskGroup = createNS('mask');\r\n        maskGroup.setAttribute('id', this.layerId);\r\n        maskGroup.setAttribute('mask-type', 'alpha');\r\n        var maskGrouper = createNS('g');\r\n        maskGroup.appendChild(maskGrouper);\r\n        filId = createElementID();\r\n        fil = filtersFactory.createFilter(filId);\r\n        /// /\r\n\r\n        // This solution doesn't work on Android when meta tag with viewport attribute is set\r\n        /* var feColorMatrix = createNS('feColorMatrix');\r\n                feColorMatrix.setAttribute('type', 'matrix');\r\n                feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\r\n                feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');\r\n                fil.appendChild(feColorMatrix); */\r\n        /// /\r\n        var feCTr = createNS('feComponentTransfer');\r\n        feCTr.setAttribute('in', 'SourceGraphic');\r\n        fil.appendChild(feCTr);\r\n        var feFunc = createNS('feFuncA');\r\n        feFunc.setAttribute('type', 'table');\r\n        feFunc.setAttribute('tableValues', '1.0 0.0');\r\n        feCTr.appendChild(feFunc);\r\n        /// /\r\n        this.globalData.defs.appendChild(fil);\r\n        var alphaRect = createNS('rect');\r\n        alphaRect.setAttribute('width', this.comp.data.w);\r\n        alphaRect.setAttribute('height', this.comp.data.h);\r\n        alphaRect.setAttribute('x', '0');\r\n        alphaRect.setAttribute('y', '0');\r\n        alphaRect.setAttribute('fill', '#ffffff');\r\n        alphaRect.setAttribute('opacity', '0');\r\n        maskGrouper.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');\r\n        maskGrouper.appendChild(alphaRect);\r\n        maskGrouper.appendChild(this.layerElement);\r\n        layerElementParent = maskGrouper;\r\n        if (!featureSupport.maskType) {\r\n          maskGroup.setAttribute('mask-type', 'luminance');\r\n          fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\r\n          gg = createNS('g');\r\n          maskGrouper.appendChild(alphaRect);\r\n          gg.appendChild(this.layerElement);\r\n          layerElementParent = gg;\r\n          maskGrouper.appendChild(gg);\r\n        }\r\n        this.globalData.defs.appendChild(maskGroup);\r\n      }\r\n    } else if (this.data.tt) {\r\n      this.matteElement.appendChild(this.layerElement);\r\n      layerElementParent = this.matteElement;\r\n      this.baseElement = this.matteElement;\r\n    } else {\r\n      this.baseElement = this.layerElement;\r\n    }\r\n    if (this.data.ln) {\r\n      this.layerElement.setAttribute('id', this.data.ln);\r\n    }\r\n    if (this.data.cl) {\r\n      this.layerElement.setAttribute('class', this.data.cl);\r\n    }\r\n    // Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped\r\n    if (this.data.ty === 0 && !this.data.hd) {\r\n      var cp = createNS('clipPath');\r\n      var pt = createNS('path');\r\n      pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');\r\n      var clipId = createElementID();\r\n      cp.setAttribute('id', clipId);\r\n      cp.appendChild(pt);\r\n      this.globalData.defs.appendChild(cp);\r\n\r\n      if (this.checkMasks()) {\r\n        var cpGroup = createNS('g');\r\n        cpGroup.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');\r\n        cpGroup.appendChild(this.layerElement);\r\n        this.transformedElement = cpGroup;\r\n        if (layerElementParent) {\r\n          layerElementParent.appendChild(this.transformedElement);\r\n        } else {\r\n          this.baseElement = this.transformedElement;\r\n        }\r\n      } else {\r\n        this.layerElement.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');\r\n      }\r\n    }\r\n    if (this.data.bm !== 0) {\r\n      this.setBlendMode();\r\n    }\r\n  },\r\n  renderElement: function () {\r\n    if (this.finalTransform._matMdf) {\r\n      this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS());\r\n    }\r\n    if (this.finalTransform._opMdf) {\r\n      this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v);\r\n    }\r\n  },\r\n  destroyBaseElement: function () {\r\n    this.layerElement = null;\r\n    this.matteElement = null;\r\n    this.maskManager.destroy();\r\n  },\r\n  getBaseElement: function () {\r\n    if (this.data.hd) {\r\n      return null;\r\n    }\r\n    return this.baseElement;\r\n  },\r\n  createRenderableComponents: function () {\r\n    this.maskManager = new MaskElement(this.data, this, this.globalData);\r\n    this.renderableEffectsManager = new SVGEffects(this);\r\n  },\r\n  setMatte: function (id) {\r\n    if (!this.matteElement) {\r\n      return;\r\n    }\r\n    this.matteElement.setAttribute('mask', 'url(' + locationHref + '#' + id + ')');\r\n  },\r\n};\r\n\r\n/* global ProcessedElement */\r\n\r\nfunction IShapeElement() {\r\n}\r\n\r\nIShapeElement.prototype = {\r\n  addShapeToModifiers: function (data) {\r\n    var i;\r\n    var len = this.shapeModifiers.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.shapeModifiers[i].addShape(data);\r\n    }\r\n  },\r\n  isShapeInAnimatedModifiers: function (data) {\r\n    var i = 0;\r\n    var len = this.shapeModifiers.length;\r\n    while (i < len) {\r\n      if (this.shapeModifiers[i].isAnimatedWithShape(data)) {\r\n        return true;\r\n      }\r\n    }\r\n    return false;\r\n  },\r\n  renderModifiers: function () {\r\n    if (!this.shapeModifiers.length) {\r\n      return;\r\n    }\r\n    var i;\r\n    var len = this.shapes.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.shapes[i].sh.reset();\r\n    }\r\n\r\n    len = this.shapeModifiers.length;\r\n    var shouldBreakProcess;\r\n    for (i = len - 1; i >= 0; i -= 1) {\r\n      shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame);\r\n      // workaround to fix cases where a repeater resets the shape so the following processes get called twice\r\n      // TODO: find a better solution for this\r\n      if (shouldBreakProcess) {\r\n        break;\r\n      }\r\n    }\r\n  },\r\n\r\n  searchProcessedElement: function (elem) {\r\n    var elements = this.processedElements;\r\n    var i = 0;\r\n    var len = elements.length;\r\n    while (i < len) {\r\n      if (elements[i].elem === elem) {\r\n        return elements[i].pos;\r\n      }\r\n      i += 1;\r\n    }\r\n    return 0;\r\n  },\r\n  addProcessedElement: function (elem, pos) {\r\n    var elements = this.processedElements;\r\n    var i = elements.length;\r\n    while (i) {\r\n      i -= 1;\r\n      if (elements[i].elem === elem) {\r\n        elements[i].pos = pos;\r\n        return;\r\n      }\r\n    }\r\n    elements.push(new ProcessedElement(elem, pos));\r\n  },\r\n  prepareFrame: function (num) {\r\n    this.prepareRenderableFrame(num);\r\n    this.prepareProperties(num, this.isInRange);\r\n  },\r\n};\r\n\r\n/* global TextProperty, TextAnimatorProperty, buildShapeString, LetterProps */\r\n\r\nfunction ITextElement() {\r\n}\r\n\r\nITextElement.prototype.initElement = function (data, globalData, comp) {\r\n  this.lettersChangedFlag = true;\r\n  this.initFrame();\r\n  this.initBaseData(data, globalData, comp);\r\n  this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);\r\n  this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);\r\n  this.initTransform(data, globalData, comp);\r\n  this.initHierarchy();\r\n  this.initRenderable();\r\n  this.initRendererElement();\r\n  this.createContainerElements();\r\n  this.createRenderableComponents();\r\n  this.createContent();\r\n  this.hide();\r\n  this.textAnimator.searchProperties(this.dynamicProperties);\r\n};\r\n\r\nITextElement.prototype.prepareFrame = function (num) {\r\n  this._mdf = false;\r\n  this.prepareRenderableFrame(num);\r\n  this.prepareProperties(num, this.isInRange);\r\n  if (this.textProperty._mdf || this.textProperty._isFirstFrame) {\r\n    this.buildNewText();\r\n    this.textProperty._isFirstFrame = false;\r\n    this.textProperty._mdf = false;\r\n  }\r\n};\r\n\r\nITextElement.prototype.createPathShape = function (matrixHelper, shapes) {\r\n  var j;\r\n  var jLen = shapes.length;\r\n  var pathNodes;\r\n  var shapeStr = '';\r\n  for (j = 0; j < jLen; j += 1) {\r\n    pathNodes = shapes[j].ks.k;\r\n    shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);\r\n  }\r\n  return shapeStr;\r\n};\r\n\r\nITextElement.prototype.updateDocumentData = function (newData, index) {\r\n  this.textProperty.updateDocumentData(newData, index);\r\n};\r\n\r\nITextElement.prototype.canResizeFont = function (_canResize) {\r\n  this.textProperty.canResizeFont(_canResize);\r\n};\r\n\r\nITextElement.prototype.setMinimumFontSize = function (_fontSize) {\r\n  this.textProperty.setMinimumFontSize(_fontSize);\r\n};\r\n\r\nITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {\r\n  if (documentData.ps) {\r\n    matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\r\n  }\r\n  matrixHelper.translate(0, -documentData.ls, 0);\r\n  switch (documentData.j) {\r\n    case 1:\r\n      matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0);\r\n      break;\r\n    case 2:\r\n      matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0);\r\n      break;\r\n    default:\r\n      break;\r\n  }\r\n  matrixHelper.translate(xPos, yPos, 0);\r\n};\r\n\r\nITextElement.prototype.buildColor = function (colorData) {\r\n  return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')';\r\n};\r\n\r\nITextElement.prototype.emptyProp = new LetterProps();\r\n\r\nITextElement.prototype.destroy = function () {\r\n\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement */\r\n\r\nfunction ICompElement() {}\r\n\r\nextendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);\r\n\r\nICompElement.prototype.initElement = function (data, globalData, comp) {\r\n  this.initFrame();\r\n  this.initBaseData(data, globalData, comp);\r\n  this.initTransform(data, globalData, comp);\r\n  this.initRenderable();\r\n  this.initHierarchy();\r\n  this.initRendererElement();\r\n  this.createContainerElements();\r\n  this.createRenderableComponents();\r\n  if (this.data.xt || !globalData.progressiveLoad) {\r\n    this.buildAllItems();\r\n  }\r\n  this.hide();\r\n};\r\n\r\n/* ICompElement.prototype.hide = function(){\r\n    if(!this.hidden){\r\n        this.hideElement();\r\n        var i,len = this.elements.length;\r\n        for( i = 0; i < len; i+=1 ){\r\n            if(this.elements[i]){\r\n                this.elements[i].hide();\r\n            }\r\n        }\r\n    }\r\n}; */\r\n\r\nICompElement.prototype.prepareFrame = function (num) {\r\n  this._mdf = false;\r\n  this.prepareRenderableFrame(num);\r\n  this.prepareProperties(num, this.isInRange);\r\n  if (!this.isInRange && !this.data.xt) {\r\n    return;\r\n  }\r\n\r\n  if (!this.tm._placeholder) {\r\n    var timeRemapped = this.tm.v;\r\n    if (timeRemapped === this.data.op) {\r\n      timeRemapped = this.data.op - 1;\r\n    }\r\n    this.renderedFrame = timeRemapped;\r\n  } else {\r\n    this.renderedFrame = num / this.data.sr;\r\n  }\r\n  var i;\r\n  var len = this.elements.length;\r\n  if (!this.completeLayers) {\r\n    this.checkLayers(this.renderedFrame);\r\n  }\r\n  // This iteration needs to be backwards because of how expressions connect between each other\r\n  for (i = len - 1; i >= 0; i -= 1) {\r\n    if (this.completeLayers || this.elements[i]) {\r\n      this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);\r\n      if (this.elements[i]._mdf) {\r\n        this._mdf = true;\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\nICompElement.prototype.renderInnerContent = function () {\r\n  var i;\r\n  var len = this.layers.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.completeLayers || this.elements[i]) {\r\n      this.elements[i].renderFrame();\r\n    }\r\n  }\r\n};\r\n\r\nICompElement.prototype.setElements = function (elems) {\r\n  this.elements = elems;\r\n};\r\n\r\nICompElement.prototype.getElements = function () {\r\n  return this.elements;\r\n};\r\n\r\nICompElement.prototype.destroyElements = function () {\r\n  var i;\r\n  var len = this.layers.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.elements[i]) {\r\n      this.elements[i].destroy();\r\n    }\r\n  }\r\n};\r\n\r\nICompElement.prototype.destroy = function () {\r\n  this.destroyElements();\r\n  this.destroyBaseElement();\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, createNS */\r\n\r\nfunction IImageElement(data, globalData, comp) {\r\n  this.assetData = globalData.getAssetData(data.refId);\r\n  this.initElement(data, globalData, comp);\r\n  this.sourceRect = {\r\n    top: 0, left: 0, width: this.assetData.w, height: this.assetData.h,\r\n  };\r\n}\r\n\r\nextendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement);\r\n\r\nIImageElement.prototype.createContent = function () {\r\n  var assetPath = this.globalData.getAssetsPath(this.assetData);\r\n\r\n  this.innerElem = createNS('image');\r\n  this.innerElem.setAttribute('width', this.assetData.w + 'px');\r\n  this.innerElem.setAttribute('height', this.assetData.h + 'px');\r\n  this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);\r\n  this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\r\n\r\n  this.layerElement.appendChild(this.innerElem);\r\n};\r\n\r\nIImageElement.prototype.sourceRectAtTime = function () {\r\n  return this.sourceRect;\r\n};\r\n\r\n/* global extendPrototype, IImageElement, createNS */\r\n\r\nfunction ISolidElement(data, globalData, comp) {\r\n  this.initElement(data, globalData, comp);\r\n}\r\nextendPrototype([IImageElement], ISolidElement);\r\n\r\nISolidElement.prototype.createContent = function () {\r\n  var rect = createNS('rect');\r\n  /// /rect.style.width = this.data.sw;\r\n  /// /rect.style.height = this.data.sh;\r\n  /// /rect.style.fill = this.data.sc;\r\n  rect.setAttribute('width', this.data.sw);\r\n  rect.setAttribute('height', this.data.sh);\r\n  rect.setAttribute('fill', this.data.sc);\r\n  this.layerElement.appendChild(rect);\r\n};\r\n\r\n/* global PropertyFactory, extendPrototype, RenderableElement, BaseElement, FrameElement */\r\n\r\nfunction AudioElement(data, globalData, comp) {\r\n  this.initFrame();\r\n  this.initRenderable();\r\n  this.assetData = globalData.getAssetData(data.refId);\r\n  this.initBaseData(data, globalData, comp);\r\n  this._isPlaying = false;\r\n  this._canPlay = false;\r\n  var assetPath = this.globalData.getAssetsPath(this.assetData);\r\n  this.audio = this.globalData.audioController.createAudio(assetPath);\r\n  this._currentTime = 0;\r\n  this.globalData.audioController.addAudio(this);\r\n  this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };\r\n}\r\n\r\nAudioElement.prototype.prepareFrame = function (num) {\r\n  this.prepareRenderableFrame(num, true);\r\n  this.prepareProperties(num, true);\r\n  if (!this.tm._placeholder) {\r\n    var timeRemapped = this.tm.v;\r\n    this._currentTime = timeRemapped;\r\n  } else {\r\n    this._currentTime = num / this.data.sr;\r\n  }\r\n};\r\n\r\nextendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement);\r\n\r\nAudioElement.prototype.renderFrame = function () {\r\n  if (this.isInRange && this._canPlay) {\r\n    if (!this._isPlaying) {\r\n      this.audio.play();\r\n      this.audio.seek(this._currentTime / this.globalData.frameRate);\r\n      this._isPlaying = true;\r\n    } else if (!this.audio.playing()\r\n      || Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1\r\n    ) {\r\n      this.audio.seek(this._currentTime / this.globalData.frameRate);\r\n    }\r\n  }\r\n};\r\n\r\nAudioElement.prototype.show = function () {\r\n  // this.audio.play()\r\n};\r\n\r\nAudioElement.prototype.hide = function () {\r\n  this.audio.pause();\r\n  this._isPlaying = false;\r\n};\r\n\r\nAudioElement.prototype.pause = function () {\r\n  this.audio.pause();\r\n  this._isPlaying = false;\r\n  this._canPlay = false;\r\n};\r\n\r\nAudioElement.prototype.resume = function () {\r\n  this._canPlay = true;\r\n};\r\n\r\nAudioElement.prototype.setRate = function (rateValue) {\r\n  this.audio.rate(rateValue);\r\n};\r\n\r\nAudioElement.prototype.volume = function (volumeValue) {\r\n  this.audio.volume(volumeValue);\r\n};\r\n\r\nAudioElement.prototype.getBaseElement = function () {\r\n  return null;\r\n};\r\n\r\nAudioElement.prototype.destroy = function () {\r\n};\r\n\r\nAudioElement.prototype.sourceRectAtTime = function () {\r\n};\r\n\r\nAudioElement.prototype.initExpressions = function () {\r\n};\r\n\r\n/* global extendPrototype, RenderableElement, BaseElement, FrameElement, FootageInterface */\r\n\r\nfunction FootageElement(data, globalData, comp) {\r\n  this.initFrame();\r\n  this.initRenderable();\r\n  this.assetData = globalData.getAssetData(data.refId);\r\n  this.footageData = globalData.imageLoader.getAsset(this.assetData);\r\n  this.initBaseData(data, globalData, comp);\r\n}\r\n\r\nFootageElement.prototype.prepareFrame = function () {\r\n};\r\n\r\nextendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement);\r\n\r\nFootageElement.prototype.getBaseElement = function () {\r\n  return null;\r\n};\r\n\r\nFootageElement.prototype.renderFrame = function () {\r\n};\r\n\r\nFootageElement.prototype.destroy = function () {\r\n};\r\n\r\nFootageElement.prototype.initExpressions = function () {\r\n  this.layerInterface = FootageInterface(this);\r\n};\r\n\r\nFootageElement.prototype.getFootageData = function () {\r\n  return this.footageData;\r\n};\r\n\r\n/* global createSizedArray, PropertyFactory, extendPrototype, SVGRenderer, ICompElement, SVGBaseElement */\r\n\r\nfunction SVGCompElement(data, globalData, comp) {\r\n  this.layers = data.layers;\r\n  this.supports3d = true;\r\n  this.completeLayers = false;\r\n  this.pendingElements = [];\r\n  this.elements = this.layers ? createSizedArray(this.layers.length) : [];\r\n  // this.layerElement = createNS('g');\r\n  this.initElement(data, globalData, comp);\r\n  this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };\r\n}\r\n\r\nextendPrototype([SVGRenderer, ICompElement, SVGBaseElement], SVGCompElement);\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement,\r\nRenderableDOMElement, ITextElement, createSizedArray, createNS */\r\n\r\nfunction SVGTextLottieElement(data, globalData, comp) {\r\n  this.textSpans = [];\r\n  this.renderType = 'svg';\r\n  this.initElement(data, globalData, comp);\r\n}\r\n\r\nextendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextLottieElement);\r\n\r\nSVGTextLottieElement.prototype.createContent = function () {\r\n  if (this.data.singleShape && !this.globalData.fontManager.chars) {\r\n    this.textContainer = createNS('text');\r\n  }\r\n};\r\n\r\nSVGTextLottieElement.prototype.buildTextContents = function (textArray) {\r\n  var i = 0;\r\n  var len = textArray.length;\r\n  var textContents = [];\r\n  var currentTextContent = '';\r\n  while (i < len) {\r\n    if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {\r\n      textContents.push(currentTextContent);\r\n      currentTextContent = '';\r\n    } else {\r\n      currentTextContent += textArray[i];\r\n    }\r\n    i += 1;\r\n  }\r\n  textContents.push(currentTextContent);\r\n  return textContents;\r\n};\r\n\r\nSVGTextLottieElement.prototype.buildNewText = function () {\r\n  var i;\r\n  var len;\r\n\r\n  var documentData = this.textProperty.currentData;\r\n  this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);\r\n  if (documentData.fc) {\r\n    this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));\r\n  } else {\r\n    this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');\r\n  }\r\n  if (documentData.sc) {\r\n    this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));\r\n    this.layerElement.setAttribute('stroke-width', documentData.sw);\r\n  }\r\n  this.layerElement.setAttribute('font-size', documentData.finalSize);\r\n  var fontData = this.globalData.fontManager.getFontByName(documentData.f);\r\n  if (fontData.fClass) {\r\n    this.layerElement.setAttribute('class', fontData.fClass);\r\n  } else {\r\n    this.layerElement.setAttribute('font-family', fontData.fFamily);\r\n    var fWeight = documentData.fWeight;\r\n    var fStyle = documentData.fStyle;\r\n    this.layerElement.setAttribute('font-style', fStyle);\r\n    this.layerElement.setAttribute('font-weight', fWeight);\r\n  }\r\n  this.layerElement.setAttribute('aria-label', documentData.t);\r\n\r\n  var letters = documentData.l || [];\r\n  var usesGlyphs = !!this.globalData.fontManager.chars;\r\n  len = letters.length;\r\n\r\n  var tSpan;\r\n  var matrixHelper = this.mHelper;\r\n  var shapes;\r\n  var shapeStr = '';\r\n  var singleShape = this.data.singleShape;\r\n  var xPos = 0;\r\n  var yPos = 0;\r\n  var firstLine = true;\r\n  var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\r\n  if (singleShape && !usesGlyphs && !documentData.sz) {\r\n    var tElement = this.textContainer;\r\n    var justify = 'start';\r\n    switch (documentData.j) {\r\n      case 1:\r\n        justify = 'end';\r\n        break;\r\n      case 2:\r\n        justify = 'middle';\r\n        break;\r\n      default:\r\n        justify = 'start';\r\n        break;\r\n    }\r\n    tElement.setAttribute('text-anchor', justify);\r\n    tElement.setAttribute('letter-spacing', trackingOffset);\r\n    var textContent = this.buildTextContents(documentData.finalText);\r\n    len = textContent.length;\r\n    yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;\r\n    for (i = 0; i < len; i += 1) {\r\n      tSpan = this.textSpans[i] || createNS('tspan');\r\n      tSpan.textContent = textContent[i];\r\n      tSpan.setAttribute('x', 0);\r\n      tSpan.setAttribute('y', yPos);\r\n      tSpan.style.display = 'inherit';\r\n      tElement.appendChild(tSpan);\r\n      this.textSpans[i] = tSpan;\r\n      yPos += documentData.finalLineHeight;\r\n    }\r\n\r\n    this.layerElement.appendChild(tElement);\r\n  } else {\r\n    var cachedSpansLength = this.textSpans.length;\r\n    var shapeData;\r\n    var charData;\r\n    for (i = 0; i < len; i += 1) {\r\n      if (!usesGlyphs || !singleShape || i === 0) {\r\n        tSpan = cachedSpansLength > i ? this.textSpans[i] : createNS(usesGlyphs ? 'path' : 'text');\r\n        if (cachedSpansLength <= i) {\r\n          tSpan.setAttribute('stroke-linecap', 'butt');\r\n          tSpan.setAttribute('stroke-linejoin', 'round');\r\n          tSpan.setAttribute('stroke-miterlimit', '4');\r\n          this.textSpans[i] = tSpan;\r\n          this.layerElement.appendChild(tSpan);\r\n        }\r\n        tSpan.style.display = 'inherit';\r\n      }\r\n\r\n      matrixHelper.reset();\r\n      matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\r\n      if (singleShape) {\r\n        if (letters[i].n) {\r\n          xPos = -trackingOffset;\r\n          yPos += documentData.yOffset;\r\n          yPos += firstLine ? 1 : 0;\r\n          firstLine = false;\r\n        }\r\n        this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\r\n        xPos += letters[i].l || 0;\r\n        // xPos += letters[i].val === ' ' ? 0 : trackingOffset;\r\n        xPos += trackingOffset;\r\n      }\r\n      if (usesGlyphs) {\r\n        charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\r\n        shapeData = (charData && charData.data) || {};\r\n        shapes = shapeData.shapes ? shapeData.shapes[0].it : [];\r\n        if (!singleShape) {\r\n          tSpan.setAttribute('d', this.createPathShape(matrixHelper, shapes));\r\n        } else {\r\n          shapeStr += this.createPathShape(matrixHelper, shapes);\r\n        }\r\n      } else {\r\n        if (singleShape) {\r\n          tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')');\r\n        }\r\n        tSpan.textContent = letters[i].val;\r\n        tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\r\n      }\r\n      //\r\n    }\r\n    if (singleShape && tSpan) {\r\n      tSpan.setAttribute('d', shapeStr);\r\n    }\r\n  }\r\n  while (i < this.textSpans.length) {\r\n    this.textSpans[i].style.display = 'none';\r\n    i += 1;\r\n  }\r\n\r\n  this._sizeChanged = true;\r\n};\r\n\r\nSVGTextLottieElement.prototype.sourceRectAtTime = function () {\r\n  this.prepareFrame(this.comp.renderedFrame - this.data.st);\r\n  this.renderInnerContent();\r\n  if (this._sizeChanged) {\r\n    this._sizeChanged = false;\r\n    var textBox = this.layerElement.getBBox();\r\n    this.bbox = {\r\n      top: textBox.y,\r\n      left: textBox.x,\r\n      width: textBox.width,\r\n      height: textBox.height,\r\n    };\r\n  }\r\n  return this.bbox;\r\n};\r\n\r\nSVGTextLottieElement.prototype.renderInnerContent = function () {\r\n  if (!this.data.singleShape) {\r\n    this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\r\n    if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {\r\n      this._sizeChanged = true;\r\n      var i;\r\n      var len;\r\n      var renderedLetters = this.textAnimator.renderedLetters;\r\n\r\n      var letters = this.textProperty.currentData.l;\r\n\r\n      len = letters.length;\r\n      var renderedLetter;\r\n      var textSpan;\r\n      for (i = 0; i < len; i += 1) {\r\n        if (!letters[i].n) {\r\n          renderedLetter = renderedLetters[i];\r\n          textSpan = this.textSpans[i];\r\n          if (renderedLetter._mdf.m) {\r\n            textSpan.setAttribute('transform', renderedLetter.m);\r\n          }\r\n          if (renderedLetter._mdf.o) {\r\n            textSpan.setAttribute('opacity', renderedLetter.o);\r\n          }\r\n          if (renderedLetter._mdf.sw) {\r\n            textSpan.setAttribute('stroke-width', renderedLetter.sw);\r\n          }\r\n          if (renderedLetter._mdf.sc) {\r\n            textSpan.setAttribute('stroke', renderedLetter.sc);\r\n          }\r\n          if (renderedLetter._mdf.fc) {\r\n            textSpan.setAttribute('fill', renderedLetter.fc);\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement,\r\nFrameElement, RenderableDOMElement, Matrix, SVGStyleData, SVGStrokeStyleData, SVGFillStyleData,\r\nSVGGradientFillStyleData, SVGGradientStrokeStyleData, locationHref, getBlendMode, ShapeGroupData,\r\nTransformPropertyFactory, SVGTransformData, ShapePropertyFactory, SVGShapeData, SVGElementsRenderer, ShapeModifiers,\r\nlineCapEnum, lineJoinEnum */\r\n\r\nfunction SVGShapeElement(data, globalData, comp) {\r\n  // List of drawable elements\r\n  this.shapes = [];\r\n  // Full shape data\r\n  this.shapesData = data.shapes;\r\n  // List of styles that will be applied to shapes\r\n  this.stylesList = [];\r\n  // List of modifiers that will be applied to shapes\r\n  this.shapeModifiers = [];\r\n  // List of items in shape tree\r\n  this.itemsData = [];\r\n  // List of items in previous shape tree\r\n  this.processedElements = [];\r\n  // List of animated components\r\n  this.animatedContents = [];\r\n  this.initElement(data, globalData, comp);\r\n  // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\r\n  // List of elements that have been created\r\n  this.prevViewData = [];\r\n  // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\r\n}\r\n\r\nextendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement);\r\n\r\nSVGShapeElement.prototype.initSecondaryElement = function () {\r\n};\r\n\r\nSVGShapeElement.prototype.identityMatrix = new Matrix();\r\n\r\nSVGShapeElement.prototype.buildExpressionInterface = function () {};\r\n\r\nSVGShapeElement.prototype.createContent = function () {\r\n  this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\r\n  this.filterUniqueShapes();\r\n};\r\n\r\n/*\r\nThis method searches for multiple shapes that affect a single element and one of them is animated\r\n*/\r\nSVGShapeElement.prototype.filterUniqueShapes = function () {\r\n  var i;\r\n  var len = this.shapes.length;\r\n  var shape;\r\n  var j;\r\n  var jLen = this.stylesList.length;\r\n  var style;\r\n  var tempShapes = [];\r\n  var areAnimated = false;\r\n  for (j = 0; j < jLen; j += 1) {\r\n    style = this.stylesList[j];\r\n    areAnimated = false;\r\n    tempShapes.length = 0;\r\n    for (i = 0; i < len; i += 1) {\r\n      shape = this.shapes[i];\r\n      if (shape.styles.indexOf(style) !== -1) {\r\n        tempShapes.push(shape);\r\n        areAnimated = shape._isAnimated || areAnimated;\r\n      }\r\n    }\r\n    if (tempShapes.length > 1 && areAnimated) {\r\n      this.setShapesAsAnimated(tempShapes);\r\n    }\r\n  }\r\n};\r\n\r\nSVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {\r\n  var i;\r\n  var len = shapes.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    shapes[i].setAsAnimated();\r\n  }\r\n};\r\n\r\nSVGShapeElement.prototype.createStyleElement = function (data, level) {\r\n  // TODO: prevent drawing of hidden styles\r\n  var elementData;\r\n  var styleOb = new SVGStyleData(data, level);\r\n\r\n  var pathElement = styleOb.pElem;\r\n  if (data.ty === 'st') {\r\n    elementData = new SVGStrokeStyleData(this, data, styleOb);\r\n  } else if (data.ty === 'fl') {\r\n    elementData = new SVGFillStyleData(this, data, styleOb);\r\n  } else if (data.ty === 'gf' || data.ty === 'gs') {\r\n    var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;\r\n    elementData = new GradientConstructor(this, data, styleOb);\r\n    this.globalData.defs.appendChild(elementData.gf);\r\n    if (elementData.maskId) {\r\n      this.globalData.defs.appendChild(elementData.ms);\r\n      this.globalData.defs.appendChild(elementData.of);\r\n      pathElement.setAttribute('mask', 'url(' + locationHref + '#' + elementData.maskId + ')');\r\n    }\r\n  }\r\n\r\n  if (data.ty === 'st' || data.ty === 'gs') {\r\n    pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\r\n    pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\r\n    pathElement.setAttribute('fill-opacity', '0');\r\n    if (data.lj === 1) {\r\n      pathElement.setAttribute('stroke-miterlimit', data.ml);\r\n    }\r\n  }\r\n\r\n  if (data.r === 2) {\r\n    pathElement.setAttribute('fill-rule', 'evenodd');\r\n  }\r\n\r\n  if (data.ln) {\r\n    pathElement.setAttribute('id', data.ln);\r\n  }\r\n  if (data.cl) {\r\n    pathElement.setAttribute('class', data.cl);\r\n  }\r\n  if (data.bm) {\r\n    pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);\r\n  }\r\n  this.stylesList.push(styleOb);\r\n  this.addToAnimatedContents(data, elementData);\r\n  return elementData;\r\n};\r\n\r\nSVGShapeElement.prototype.createGroupElement = function (data) {\r\n  var elementData = new ShapeGroupData();\r\n  if (data.ln) {\r\n    elementData.gr.setAttribute('id', data.ln);\r\n  }\r\n  if (data.cl) {\r\n    elementData.gr.setAttribute('class', data.cl);\r\n  }\r\n  if (data.bm) {\r\n    elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);\r\n  }\r\n  return elementData;\r\n};\r\n\r\nSVGShapeElement.prototype.createTransformElement = function (data, container) {\r\n  var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this);\r\n  var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);\r\n  this.addToAnimatedContents(data, elementData);\r\n  return elementData;\r\n};\r\n\r\nSVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {\r\n  var ty = 4;\r\n  if (data.ty === 'rc') {\r\n    ty = 5;\r\n  } else if (data.ty === 'el') {\r\n    ty = 6;\r\n  } else if (data.ty === 'sr') {\r\n    ty = 7;\r\n  }\r\n  var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this);\r\n  var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);\r\n  this.shapes.push(elementData);\r\n  this.addShapeToModifiers(elementData);\r\n  this.addToAnimatedContents(data, elementData);\r\n  return elementData;\r\n};\r\n\r\nSVGShapeElement.prototype.addToAnimatedContents = function (data, element) {\r\n  var i = 0;\r\n  var len = this.animatedContents.length;\r\n  while (i < len) {\r\n    if (this.animatedContents[i].element === element) {\r\n      return;\r\n    }\r\n    i += 1;\r\n  }\r\n  this.animatedContents.push({\r\n    fn: SVGElementsRenderer.createRenderFunction(data),\r\n    element: element,\r\n    data: data,\r\n  });\r\n};\r\n\r\nSVGShapeElement.prototype.setElementStyles = function (elementData) {\r\n  var arr = elementData.styles;\r\n  var j;\r\n  var jLen = this.stylesList.length;\r\n  for (j = 0; j < jLen; j += 1) {\r\n    if (!this.stylesList[j].closed) {\r\n      arr.push(this.stylesList[j]);\r\n    }\r\n  }\r\n};\r\n\r\nSVGShapeElement.prototype.reloadShapes = function () {\r\n  this._isFirstFrame = true;\r\n  var i;\r\n  var len = this.itemsData.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.prevViewData[i] = this.itemsData[i];\r\n  }\r\n  this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\r\n  this.filterUniqueShapes();\r\n  len = this.dynamicProperties.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.dynamicProperties[i].getValue();\r\n  }\r\n  this.renderModifiers();\r\n};\r\n\r\nSVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) {\r\n  var ownTransformers = [].concat(transformers);\r\n  var i;\r\n  var len = arr.length - 1;\r\n  var j;\r\n  var jLen;\r\n  var ownStyles = [];\r\n  var ownModifiers = [];\r\n  var currentTransform;\r\n  var modifier;\r\n  var processedPos;\r\n  for (i = len; i >= 0; i -= 1) {\r\n    processedPos = this.searchProcessedElement(arr[i]);\r\n    if (!processedPos) {\r\n      arr[i]._render = render;\r\n    } else {\r\n      itemsData[i] = prevViewData[processedPos - 1];\r\n    }\r\n    if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {\r\n      if (!processedPos) {\r\n        itemsData[i] = this.createStyleElement(arr[i], level);\r\n      } else {\r\n        itemsData[i].style.closed = false;\r\n      }\r\n      if (arr[i]._render) {\r\n        container.appendChild(itemsData[i].style.pElem);\r\n      }\r\n      ownStyles.push(itemsData[i].style);\r\n    } else if (arr[i].ty === 'gr') {\r\n      if (!processedPos) {\r\n        itemsData[i] = this.createGroupElement(arr[i]);\r\n      } else {\r\n        jLen = itemsData[i].it.length;\r\n        for (j = 0; j < jLen; j += 1) {\r\n          itemsData[i].prevViewData[j] = itemsData[i].it[j];\r\n        }\r\n      }\r\n      this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render);\r\n      if (arr[i]._render) {\r\n        container.appendChild(itemsData[i].gr);\r\n      }\r\n    } else if (arr[i].ty === 'tr') {\r\n      if (!processedPos) {\r\n        itemsData[i] = this.createTransformElement(arr[i], container);\r\n      }\r\n      currentTransform = itemsData[i].transform;\r\n      ownTransformers.push(currentTransform);\r\n    } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\r\n      if (!processedPos) {\r\n        itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);\r\n      }\r\n      this.setElementStyles(itemsData[i]);\r\n    } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb') {\r\n      if (!processedPos) {\r\n        modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n        modifier.init(this, arr[i]);\r\n        itemsData[i] = modifier;\r\n        this.shapeModifiers.push(modifier);\r\n      } else {\r\n        modifier = itemsData[i];\r\n        modifier.closed = false;\r\n      }\r\n      ownModifiers.push(modifier);\r\n    } else if (arr[i].ty === 'rp') {\r\n      if (!processedPos) {\r\n        modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n        itemsData[i] = modifier;\r\n        modifier.init(this, arr, i, itemsData);\r\n        this.shapeModifiers.push(modifier);\r\n        render = false;\r\n      } else {\r\n        modifier = itemsData[i];\r\n        modifier.closed = true;\r\n      }\r\n      ownModifiers.push(modifier);\r\n    }\r\n    this.addProcessedElement(arr[i], i + 1);\r\n  }\r\n  len = ownStyles.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    ownStyles[i].closed = true;\r\n  }\r\n  len = ownModifiers.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    ownModifiers[i].closed = true;\r\n  }\r\n};\r\n\r\nSVGShapeElement.prototype.renderInnerContent = function () {\r\n  this.renderModifiers();\r\n  var i;\r\n  var len = this.stylesList.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.stylesList[i].reset();\r\n  }\r\n  this.renderShape();\r\n\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.stylesList[i]._mdf || this._isFirstFrame) {\r\n      if (this.stylesList[i].msElem) {\r\n        this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d);\r\n        // Adding M0 0 fixes same mask bug on all browsers\r\n        this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;\r\n      }\r\n      this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');\r\n    }\r\n  }\r\n};\r\n\r\nSVGShapeElement.prototype.renderShape = function () {\r\n  var i;\r\n  var len = this.animatedContents.length;\r\n  var animatedContent;\r\n  for (i = 0; i < len; i += 1) {\r\n    animatedContent = this.animatedContents[i];\r\n    if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {\r\n      animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);\r\n    }\r\n  }\r\n};\r\n\r\nSVGShapeElement.prototype.destroy = function () {\r\n  this.destroyBaseElement();\r\n  this.shapesData = null;\r\n  this.itemsData = null;\r\n};\r\n\r\n/* global createNS */\r\n\r\nfunction SVGTintFilter(filter, filterManager) {\r\n  this.filterManager = filterManager;\r\n  var feColorMatrix = createNS('feColorMatrix');\r\n  feColorMatrix.setAttribute('type', 'matrix');\r\n  feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\r\n  feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');\r\n  feColorMatrix.setAttribute('result', 'f1');\r\n  filter.appendChild(feColorMatrix);\r\n  feColorMatrix = createNS('feColorMatrix');\r\n  feColorMatrix.setAttribute('type', 'matrix');\r\n  feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\r\n  feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\r\n  feColorMatrix.setAttribute('result', 'f2');\r\n  filter.appendChild(feColorMatrix);\r\n  this.matrixFilter = feColorMatrix;\r\n  if (filterManager.effectElements[2].p.v !== 100 || filterManager.effectElements[2].p.k) {\r\n    var feMerge = createNS('feMerge');\r\n    filter.appendChild(feMerge);\r\n    var feMergeNode;\r\n    feMergeNode = createNS('feMergeNode');\r\n    feMergeNode.setAttribute('in', 'SourceGraphic');\r\n    feMerge.appendChild(feMergeNode);\r\n    feMergeNode = createNS('feMergeNode');\r\n    feMergeNode.setAttribute('in', 'f2');\r\n    feMerge.appendChild(feMergeNode);\r\n  }\r\n}\r\n\r\nSVGTintFilter.prototype.renderFrame = function (forceRender) {\r\n  if (forceRender || this.filterManager._mdf) {\r\n    var colorBlack = this.filterManager.effectElements[0].p.v;\r\n    var colorWhite = this.filterManager.effectElements[1].p.v;\r\n    var opacity = this.filterManager.effectElements[2].p.v / 100;\r\n    this.matrixFilter.setAttribute('values', (colorWhite[0] - colorBlack[0]) + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 ' + opacity + ' 0');\r\n  }\r\n};\r\n\r\n/* global createNS */\r\n\r\nfunction SVGFillFilter(filter, filterManager) {\r\n  this.filterManager = filterManager;\r\n  var feColorMatrix = createNS('feColorMatrix');\r\n  feColorMatrix.setAttribute('type', 'matrix');\r\n  feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\r\n  feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\r\n  filter.appendChild(feColorMatrix);\r\n  this.matrixFilter = feColorMatrix;\r\n}\r\nSVGFillFilter.prototype.renderFrame = function (forceRender) {\r\n  if (forceRender || this.filterManager._mdf) {\r\n    var color = this.filterManager.effectElements[2].p.v;\r\n    var opacity = this.filterManager.effectElements[6].p.v;\r\n    this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0');\r\n  }\r\n};\r\n\r\n/* global createNS */\r\n\r\nfunction SVGGaussianBlurEffect(filter, filterManager) {\r\n  // Outset the filter region by 100% on all sides to accommodate blur expansion.\r\n  filter.setAttribute('x', '-100%');\r\n  filter.setAttribute('y', '-100%');\r\n  filter.setAttribute('width', '300%');\r\n  filter.setAttribute('height', '300%');\r\n\r\n  this.filterManager = filterManager;\r\n  var feGaussianBlur = createNS('feGaussianBlur');\r\n  filter.appendChild(feGaussianBlur);\r\n  this.feGaussianBlur = feGaussianBlur;\r\n}\r\n\r\nSVGGaussianBlurEffect.prototype.renderFrame = function (forceRender) {\r\n  if (forceRender || this.filterManager._mdf) {\r\n    // Empirical value, matching AE's blur appearance.\r\n    var kBlurrinessToSigma = 0.3;\r\n    var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma;\r\n\r\n    // Dimensions mapping:\r\n    //\r\n    //   1 -> horizontal & vertical\r\n    //   2 -> horizontal only\r\n    //   3 -> vertical only\r\n    //\r\n    var dimensions = this.filterManager.effectElements[1].p.v;\r\n    var sigmaX = (dimensions == 3) ? 0 : sigma; // eslint-disable-line eqeqeq\r\n    var sigmaY = (dimensions == 2) ? 0 : sigma; // eslint-disable-line eqeqeq\r\n\r\n    this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + ' ' + sigmaY);\r\n\r\n    // Repeat edges mapping:\r\n    //\r\n    //   0 -> off -> duplicate\r\n    //   1 -> on  -> wrap\r\n    var edgeMode = (this.filterManager.effectElements[2].p.v == 1) ? 'wrap' : 'duplicate'; // eslint-disable-line eqeqeq\r\n    this.feGaussianBlur.setAttribute('edgeMode', edgeMode);\r\n  }\r\n};\r\n\r\n/* global createNS, createElementID, locationHref, bmFloor */\r\n\r\nfunction SVGStrokeEffect(elem, filterManager) {\r\n  this.initialized = false;\r\n  this.filterManager = filterManager;\r\n  this.elem = elem;\r\n  this.paths = [];\r\n}\r\n\r\nSVGStrokeEffect.prototype.initialize = function () {\r\n  var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\r\n  var path;\r\n  var groupPath;\r\n  var i;\r\n  var len;\r\n  if (this.filterManager.effectElements[1].p.v === 1) {\r\n    len = this.elem.maskManager.masksProperties.length;\r\n    i = 0;\r\n  } else {\r\n    i = this.filterManager.effectElements[0].p.v - 1;\r\n    len = i + 1;\r\n  }\r\n  groupPath = createNS('g');\r\n  groupPath.setAttribute('fill', 'none');\r\n  groupPath.setAttribute('stroke-linecap', 'round');\r\n  groupPath.setAttribute('stroke-dashoffset', 1);\r\n  for (i; i < len; i += 1) {\r\n    path = createNS('path');\r\n    groupPath.appendChild(path);\r\n    this.paths.push({ p: path, m: i });\r\n  }\r\n  if (this.filterManager.effectElements[10].p.v === 3) {\r\n    var mask = createNS('mask');\r\n    var id = createElementID();\r\n    mask.setAttribute('id', id);\r\n    mask.setAttribute('mask-type', 'alpha');\r\n    mask.appendChild(groupPath);\r\n    this.elem.globalData.defs.appendChild(mask);\r\n    var g = createNS('g');\r\n    g.setAttribute('mask', 'url(' + locationHref + '#' + id + ')');\r\n    while (elemChildren[0]) {\r\n      g.appendChild(elemChildren[0]);\r\n    }\r\n    this.elem.layerElement.appendChild(g);\r\n    this.masker = mask;\r\n    groupPath.setAttribute('stroke', '#fff');\r\n  } else if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\r\n    if (this.filterManager.effectElements[10].p.v === 2) {\r\n      elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\r\n      while (elemChildren.length) {\r\n        this.elem.layerElement.removeChild(elemChildren[0]);\r\n      }\r\n    }\r\n    this.elem.layerElement.appendChild(groupPath);\r\n    this.elem.layerElement.removeAttribute('mask');\r\n    groupPath.setAttribute('stroke', '#fff');\r\n  }\r\n  this.initialized = true;\r\n  this.pathMasker = groupPath;\r\n};\r\n\r\nSVGStrokeEffect.prototype.renderFrame = function (forceRender) {\r\n  if (!this.initialized) {\r\n    this.initialize();\r\n  }\r\n  var i;\r\n  var len = this.paths.length;\r\n  var mask;\r\n  var path;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.paths[i].m !== -1) {\r\n      mask = this.elem.maskManager.viewData[this.paths[i].m];\r\n      path = this.paths[i].p;\r\n      if (forceRender || this.filterManager._mdf || mask.prop._mdf) {\r\n        path.setAttribute('d', mask.lastPath);\r\n      }\r\n      if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) {\r\n        var dasharrayValue;\r\n        if (this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100) {\r\n          var s = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\r\n          var e = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\r\n          var l = path.getTotalLength();\r\n          dasharrayValue = '0 0 0 ' + l * s + ' ';\r\n          var lineLength = l * (e - s);\r\n          var segment = 1 + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\r\n          var units = Math.floor(lineLength / segment);\r\n          var j;\r\n          for (j = 0; j < units; j += 1) {\r\n            dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01 + ' ';\r\n          }\r\n          dasharrayValue += '0 ' + l * 10 + ' 0 0';\r\n        } else {\r\n          dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\r\n        }\r\n        path.setAttribute('stroke-dasharray', dasharrayValue);\r\n      }\r\n    }\r\n  }\r\n  if (forceRender || this.filterManager.effectElements[4].p._mdf) {\r\n    this.pathMasker.setAttribute('stroke-width', this.filterManager.effectElements[4].p.v * 2);\r\n  }\r\n\r\n  if (forceRender || this.filterManager.effectElements[6].p._mdf) {\r\n    this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v);\r\n  }\r\n  if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\r\n    if (forceRender || this.filterManager.effectElements[3].p._mdf) {\r\n      var color = this.filterManager.effectElements[3].p.v;\r\n      this.pathMasker.setAttribute('stroke', 'rgb(' + bmFloor(color[0] * 255) + ',' + bmFloor(color[1] * 255) + ',' + bmFloor(color[2] * 255) + ')');\r\n    }\r\n  }\r\n};\r\n\r\n/* global createNS */\r\n\r\nfunction SVGTritoneFilter(filter, filterManager) {\r\n  this.filterManager = filterManager;\r\n  var feColorMatrix = createNS('feColorMatrix');\r\n  feColorMatrix.setAttribute('type', 'matrix');\r\n  feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\r\n  feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');\r\n  feColorMatrix.setAttribute('result', 'f1');\r\n  filter.appendChild(feColorMatrix);\r\n  var feComponentTransfer = createNS('feComponentTransfer');\r\n  feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\r\n  filter.appendChild(feComponentTransfer);\r\n  this.matrixFilter = feComponentTransfer;\r\n  var feFuncR = createNS('feFuncR');\r\n  feFuncR.setAttribute('type', 'table');\r\n  feComponentTransfer.appendChild(feFuncR);\r\n  this.feFuncR = feFuncR;\r\n  var feFuncG = createNS('feFuncG');\r\n  feFuncG.setAttribute('type', 'table');\r\n  feComponentTransfer.appendChild(feFuncG);\r\n  this.feFuncG = feFuncG;\r\n  var feFuncB = createNS('feFuncB');\r\n  feFuncB.setAttribute('type', 'table');\r\n  feComponentTransfer.appendChild(feFuncB);\r\n  this.feFuncB = feFuncB;\r\n}\r\n\r\nSVGTritoneFilter.prototype.renderFrame = function (forceRender) {\r\n  if (forceRender || this.filterManager._mdf) {\r\n    var color1 = this.filterManager.effectElements[0].p.v;\r\n    var color2 = this.filterManager.effectElements[1].p.v;\r\n    var color3 = this.filterManager.effectElements[2].p.v;\r\n    var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];\r\n    var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];\r\n    var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];\r\n    this.feFuncR.setAttribute('tableValues', tableR);\r\n    this.feFuncG.setAttribute('tableValues', tableG);\r\n    this.feFuncB.setAttribute('tableValues', tableB);\r\n    // var opacity = this.filterManager.effectElements[2].p.v/100;\r\n    // this.matrixFilter.setAttribute('values',(colorWhite[0]- colorBlack[0])+' 0 0 0 '+ colorBlack[0] +' '+ (colorWhite[1]- colorBlack[1]) +' 0 0 0 '+ colorBlack[1] +' '+ (colorWhite[2]- colorBlack[2]) +' 0 0 0 '+ colorBlack[2] +' 0 0 0 ' + opacity + ' 0');\r\n  }\r\n};\r\n\r\n/* global createNS */\r\n\r\nfunction SVGProLevelsFilter(filter, filterManager) {\r\n  this.filterManager = filterManager;\r\n  var effectElements = this.filterManager.effectElements;\r\n  var feComponentTransfer = createNS('feComponentTransfer');\r\n\r\n  if (effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1) {\r\n    this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);\r\n  }\r\n  if (effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1) {\r\n    this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);\r\n  }\r\n  if (effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1) {\r\n    this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);\r\n  }\r\n  if (effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1) {\r\n    this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);\r\n  }\r\n\r\n  if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) {\r\n    feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\r\n    filter.appendChild(feComponentTransfer);\r\n    feComponentTransfer = createNS('feComponentTransfer');\r\n  }\r\n\r\n  if (effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1) {\r\n    feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\r\n    filter.appendChild(feComponentTransfer);\r\n    this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);\r\n    this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);\r\n    this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);\r\n  }\r\n}\r\n\r\nSVGProLevelsFilter.prototype.createFeFunc = function (type, feComponentTransfer) {\r\n  var feFunc = createNS(type);\r\n  feFunc.setAttribute('type', 'table');\r\n  feComponentTransfer.appendChild(feFunc);\r\n  return feFunc;\r\n};\r\n\r\nSVGProLevelsFilter.prototype.getTableValue = function (inputBlack, inputWhite, gamma, outputBlack, outputWhite) {\r\n  var cnt = 0;\r\n  var segments = 256;\r\n  var perc;\r\n  var min = Math.min(inputBlack, inputWhite);\r\n  var max = Math.max(inputBlack, inputWhite);\r\n  var table = Array.call(null, { length: segments });\r\n  var colorValue;\r\n  var pos = 0;\r\n  var outputDelta = outputWhite - outputBlack;\r\n  var inputDelta = inputWhite - inputBlack;\r\n  while (cnt <= 256) {\r\n    perc = cnt / 256;\r\n    if (perc <= min) {\r\n      colorValue = inputDelta < 0 ? outputWhite : outputBlack;\r\n    } else if (perc >= max) {\r\n      colorValue = inputDelta < 0 ? outputBlack : outputWhite;\r\n    } else {\r\n      colorValue = (outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma));\r\n    }\r\n    table[pos] = colorValue;\r\n    pos += 1;\r\n    cnt += 256 / (segments - 1);\r\n  }\r\n  return table.join(' ');\r\n};\r\n\r\nSVGProLevelsFilter.prototype.renderFrame = function (forceRender) {\r\n  if (forceRender || this.filterManager._mdf) {\r\n    var val;\r\n    var effectElements = this.filterManager.effectElements;\r\n    if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) {\r\n      val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v);\r\n      this.feFuncRComposed.setAttribute('tableValues', val);\r\n      this.feFuncGComposed.setAttribute('tableValues', val);\r\n      this.feFuncBComposed.setAttribute('tableValues', val);\r\n    }\r\n\r\n    if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) {\r\n      val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v);\r\n      this.feFuncR.setAttribute('tableValues', val);\r\n    }\r\n\r\n    if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) {\r\n      val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v);\r\n      this.feFuncG.setAttribute('tableValues', val);\r\n    }\r\n\r\n    if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) {\r\n      val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v);\r\n      this.feFuncB.setAttribute('tableValues', val);\r\n    }\r\n\r\n    if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) {\r\n      val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v);\r\n      this.feFuncA.setAttribute('tableValues', val);\r\n    }\r\n  }\r\n};\r\n\r\n/* global createNS, rgbToHex, degToRads */\r\n\r\nfunction SVGDropShadowEffect(filter, filterManager) {\r\n  var filterSize = filterManager.container.globalData.renderConfig.filterSize;\r\n  filter.setAttribute('x', filterSize.x);\r\n  filter.setAttribute('y', filterSize.y);\r\n  filter.setAttribute('width', filterSize.width);\r\n  filter.setAttribute('height', filterSize.height);\r\n  this.filterManager = filterManager;\r\n\r\n  var feGaussianBlur = createNS('feGaussianBlur');\r\n  feGaussianBlur.setAttribute('in', 'SourceAlpha');\r\n  feGaussianBlur.setAttribute('result', 'drop_shadow_1');\r\n  feGaussianBlur.setAttribute('stdDeviation', '0');\r\n  this.feGaussianBlur = feGaussianBlur;\r\n  filter.appendChild(feGaussianBlur);\r\n\r\n  var feOffset = createNS('feOffset');\r\n  feOffset.setAttribute('dx', '25');\r\n  feOffset.setAttribute('dy', '0');\r\n  feOffset.setAttribute('in', 'drop_shadow_1');\r\n  feOffset.setAttribute('result', 'drop_shadow_2');\r\n  this.feOffset = feOffset;\r\n  filter.appendChild(feOffset);\r\n  var feFlood = createNS('feFlood');\r\n  feFlood.setAttribute('flood-color', '#00ff00');\r\n  feFlood.setAttribute('flood-opacity', '1');\r\n  feFlood.setAttribute('result', 'drop_shadow_3');\r\n  this.feFlood = feFlood;\r\n  filter.appendChild(feFlood);\r\n\r\n  var feComposite = createNS('feComposite');\r\n  feComposite.setAttribute('in', 'drop_shadow_3');\r\n  feComposite.setAttribute('in2', 'drop_shadow_2');\r\n  feComposite.setAttribute('operator', 'in');\r\n  feComposite.setAttribute('result', 'drop_shadow_4');\r\n  filter.appendChild(feComposite);\r\n\r\n  var feMerge = createNS('feMerge');\r\n  filter.appendChild(feMerge);\r\n  var feMergeNode;\r\n  feMergeNode = createNS('feMergeNode');\r\n  feMerge.appendChild(feMergeNode);\r\n  feMergeNode = createNS('feMergeNode');\r\n  feMergeNode.setAttribute('in', 'SourceGraphic');\r\n  this.feMergeNode = feMergeNode;\r\n  this.feMerge = feMerge;\r\n  this.originalNodeAdded = false;\r\n  feMerge.appendChild(feMergeNode);\r\n}\r\n\r\nSVGDropShadowEffect.prototype.renderFrame = function (forceRender) {\r\n  if (forceRender || this.filterManager._mdf) {\r\n    if (forceRender || this.filterManager.effectElements[4].p._mdf) {\r\n      this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);\r\n    }\r\n    if (forceRender || this.filterManager.effectElements[0].p._mdf) {\r\n      var col = this.filterManager.effectElements[0].p.v;\r\n      this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(col[0] * 255), Math.round(col[1] * 255), Math.round(col[2] * 255)));\r\n    }\r\n    if (forceRender || this.filterManager.effectElements[1].p._mdf) {\r\n      this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255);\r\n    }\r\n    if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) {\r\n      var distance = this.filterManager.effectElements[3].p.v;\r\n      var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;\r\n      var x = distance * Math.cos(angle);\r\n      var y = distance * Math.sin(angle);\r\n      this.feOffset.setAttribute('dx', x);\r\n      this.feOffset.setAttribute('dy', y);\r\n    }\r\n    /* if(forceRender || this.filterManager.effectElements[5].p._mdf){\r\n            if(this.filterManager.effectElements[5].p.v === 1 && this.originalNodeAdded) {\r\n                this.feMerge.removeChild(this.feMergeNode);\r\n                this.originalNodeAdded = false;\r\n            } else if(this.filterManager.effectElements[5].p.v === 0 && !this.originalNodeAdded) {\r\n                this.feMerge.appendChild(this.feMergeNode);\r\n                this.originalNodeAdded = true;\r\n            }\r\n        } */\r\n  }\r\n};\r\n\r\n/* global createElementID, createNS */\r\n\r\nvar _svgMatteSymbols = [];\r\n\r\nfunction SVGMatte3Effect(filterElem, filterManager, elem) {\r\n  this.initialized = false;\r\n  this.filterManager = filterManager;\r\n  this.filterElem = filterElem;\r\n  this.elem = elem;\r\n  elem.matteElement = createNS('g');\r\n  elem.matteElement.appendChild(elem.layerElement);\r\n  elem.matteElement.appendChild(elem.transformedElement);\r\n  elem.baseElement = elem.matteElement;\r\n}\r\n\r\nSVGMatte3Effect.prototype.findSymbol = function (mask) {\r\n  var i = 0;\r\n  var len = _svgMatteSymbols.length;\r\n  while (i < len) {\r\n    if (_svgMatteSymbols[i] === mask) {\r\n      return _svgMatteSymbols[i];\r\n    }\r\n    i += 1;\r\n  }\r\n  return null;\r\n};\r\n\r\nSVGMatte3Effect.prototype.replaceInParent = function (mask, symbolId) {\r\n  var parentNode = mask.layerElement.parentNode;\r\n  if (!parentNode) {\r\n    return;\r\n  }\r\n  var children = parentNode.children;\r\n  var i = 0;\r\n  var len = children.length;\r\n  while (i < len) {\r\n    if (children[i] === mask.layerElement) {\r\n      break;\r\n    }\r\n    i += 1;\r\n  }\r\n  var nextChild;\r\n  if (i <= len - 2) {\r\n    nextChild = children[i + 1];\r\n  }\r\n  var useElem = createNS('use');\r\n  useElem.setAttribute('href', '#' + symbolId);\r\n  if (nextChild) {\r\n    parentNode.insertBefore(useElem, nextChild);\r\n  } else {\r\n    parentNode.appendChild(useElem);\r\n  }\r\n};\r\n\r\nSVGMatte3Effect.prototype.setElementAsMask = function (elem, mask) {\r\n  if (!this.findSymbol(mask)) {\r\n    var symbolId = createElementID();\r\n    var masker = createNS('mask');\r\n    masker.setAttribute('id', mask.layerId);\r\n    masker.setAttribute('mask-type', 'alpha');\r\n    _svgMatteSymbols.push(mask);\r\n    var defs = elem.globalData.defs;\r\n    defs.appendChild(masker);\r\n    var symbol = createNS('symbol');\r\n    symbol.setAttribute('id', symbolId);\r\n    this.replaceInParent(mask, symbolId);\r\n    symbol.appendChild(mask.layerElement);\r\n    defs.appendChild(symbol);\r\n    var useElem = createNS('use');\r\n    useElem.setAttribute('href', '#' + symbolId);\r\n    masker.appendChild(useElem);\r\n    mask.data.hd = false;\r\n    mask.show();\r\n  }\r\n  elem.setMatte(mask.layerId);\r\n};\r\n\r\nSVGMatte3Effect.prototype.initialize = function () {\r\n  var ind = this.filterManager.effectElements[0].p.v;\r\n  var elements = this.elem.comp.elements;\r\n  var i = 0;\r\n  var len = elements.length;\r\n  while (i < len) {\r\n    if (elements[i] && elements[i].data.ind === ind) {\r\n      this.setElementAsMask(this.elem, elements[i]);\r\n    }\r\n    i += 1;\r\n  }\r\n  this.initialized = true;\r\n};\r\n\r\nSVGMatte3Effect.prototype.renderFrame = function () {\r\n  if (!this.initialized) {\r\n    this.initialize();\r\n  }\r\n};\r\n\r\n/* global createElementID, filtersFactory, SVGTintFilter, SVGFillFilter, SVGStrokeEffect, SVGTritoneFilter,\r\nSVGProLevelsFilter, SVGDropShadowEffect, SVGMatte3Effect, SVGGaussianBlurEffect, locationHref */\r\n\r\nfunction SVGEffects(elem) {\r\n  var i;\r\n  var len = elem.data.ef ? elem.data.ef.length : 0;\r\n  var filId = createElementID();\r\n  var fil = filtersFactory.createFilter(filId, true);\r\n  var count = 0;\r\n  this.filters = [];\r\n  var filterManager;\r\n  for (i = 0; i < len; i += 1) {\r\n    filterManager = null;\r\n    if (elem.data.ef[i].ty === 20) {\r\n      count += 1;\r\n      filterManager = new SVGTintFilter(fil, elem.effectsManager.effectElements[i]);\r\n    } else if (elem.data.ef[i].ty === 21) {\r\n      count += 1;\r\n      filterManager = new SVGFillFilter(fil, elem.effectsManager.effectElements[i]);\r\n    } else if (elem.data.ef[i].ty === 22) {\r\n      filterManager = new SVGStrokeEffect(elem, elem.effectsManager.effectElements[i]);\r\n    } else if (elem.data.ef[i].ty === 23) {\r\n      count += 1;\r\n      filterManager = new SVGTritoneFilter(fil, elem.effectsManager.effectElements[i]);\r\n    } else if (elem.data.ef[i].ty === 24) {\r\n      count += 1;\r\n      filterManager = new SVGProLevelsFilter(fil, elem.effectsManager.effectElements[i]);\r\n    } else if (elem.data.ef[i].ty === 25) {\r\n      count += 1;\r\n      filterManager = new SVGDropShadowEffect(fil, elem.effectsManager.effectElements[i]);\r\n    } else if (elem.data.ef[i].ty === 28) {\r\n      // count += 1;\r\n      filterManager = new SVGMatte3Effect(fil, elem.effectsManager.effectElements[i], elem);\r\n    } else if (elem.data.ef[i].ty === 29) {\r\n      count += 1;\r\n      filterManager = new SVGGaussianBlurEffect(fil, elem.effectsManager.effectElements[i]);\r\n    }\r\n    if (filterManager) {\r\n      this.filters.push(filterManager);\r\n    }\r\n  }\r\n  if (count) {\r\n    elem.globalData.defs.appendChild(fil);\r\n    elem.layerElement.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');\r\n  }\r\n  if (this.filters.length) {\r\n    elem.addRenderableComponent(this);\r\n  }\r\n}\r\n\r\nSVGEffects.prototype.renderFrame = function (_isFirstFrame) {\r\n  var i;\r\n  var len = this.filters.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.filters[i].renderFrame(_isFirstFrame);\r\n  }\r\n};\r\n\r\n/* global Matrix, createTypedArray */\r\n\r\nfunction CVContextData() {\r\n  this.saved = [];\r\n  this.cArrPos = 0;\r\n  this.cTr = new Matrix();\r\n  this.cO = 1;\r\n  var i;\r\n  var len = 15;\r\n  this.savedOp = createTypedArray('float32', len);\r\n  for (i = 0; i < len; i += 1) {\r\n    this.saved[i] = createTypedArray('float32', 16);\r\n  }\r\n  this._length = len;\r\n}\r\n\r\nCVContextData.prototype.duplicate = function () {\r\n  var newLength = this._length * 2;\r\n  var currentSavedOp = this.savedOp;\r\n  this.savedOp = createTypedArray('float32', newLength);\r\n  this.savedOp.set(currentSavedOp);\r\n  var i = 0;\r\n  for (i = this._length; i < newLength; i += 1) {\r\n    this.saved[i] = createTypedArray('float32', 16);\r\n  }\r\n  this._length = newLength;\r\n};\r\n\r\nCVContextData.prototype.reset = function () {\r\n  this.cArrPos = 0;\r\n  this.cTr.reset();\r\n  this.cO = 1;\r\n};\r\n\r\n/* global CVEffects, getBlendMode, CVMaskElement, Matrix */\r\n\r\nfunction CVBaseElement() {\r\n}\r\n\r\nCVBaseElement.prototype = {\r\n  createElements: function () {},\r\n  initRendererElement: function () {},\r\n  createContainerElements: function () {\r\n    this.canvasContext = this.globalData.canvasContext;\r\n    this.renderableEffectsManager = new CVEffects(this);\r\n  },\r\n  createContent: function () {},\r\n  setBlendMode: function () {\r\n    var globalData = this.globalData;\r\n    if (globalData.blendMode !== this.data.bm) {\r\n      globalData.blendMode = this.data.bm;\r\n      var blendModeValue = getBlendMode(this.data.bm);\r\n      globalData.canvasContext.globalCompositeOperation = blendModeValue;\r\n    }\r\n  },\r\n  createRenderableComponents: function () {\r\n    this.maskManager = new CVMaskElement(this.data, this);\r\n  },\r\n  hideElement: function () {\r\n    if (!this.hidden && (!this.isInRange || this.isTransparent)) {\r\n      this.hidden = true;\r\n    }\r\n  },\r\n  showElement: function () {\r\n    if (this.isInRange && !this.isTransparent) {\r\n      this.hidden = false;\r\n      this._isFirstFrame = true;\r\n      this.maskManager._isFirstFrame = true;\r\n    }\r\n  },\r\n  renderFrame: function () {\r\n    if (this.hidden || this.data.hd) {\r\n      return;\r\n    }\r\n    this.renderTransform();\r\n    this.renderRenderable();\r\n    this.setBlendMode();\r\n    var forceRealStack = this.data.ty === 0;\r\n    this.globalData.renderer.save(forceRealStack);\r\n    this.globalData.renderer.ctxTransform(this.finalTransform.mat.props);\r\n    this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v);\r\n    this.renderInnerContent();\r\n    this.globalData.renderer.restore(forceRealStack);\r\n    if (this.maskManager.hasMasks) {\r\n      this.globalData.renderer.restore(true);\r\n    }\r\n    if (this._isFirstFrame) {\r\n      this._isFirstFrame = false;\r\n    }\r\n  },\r\n  destroy: function () {\r\n    this.canvasContext = null;\r\n    this.data = null;\r\n    this.globalData = null;\r\n    this.maskManager.destroy();\r\n  },\r\n  mHelper: new Matrix(),\r\n};\r\nCVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;\r\nCVBaseElement.prototype.show = CVBaseElement.prototype.showElement;\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, CVBaseElement,HierarchyElement, FrameElement,\r\nRenderableElement, SVGShapeElement, IImageElement, createTag */\r\n\r\nfunction CVImageElement(data, globalData, comp) {\r\n  this.assetData = globalData.getAssetData(data.refId);\r\n  this.img = globalData.imageLoader.getAsset(this.assetData);\r\n  this.initElement(data, globalData, comp);\r\n}\r\nextendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);\r\n\r\nCVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;\r\nCVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\r\n\r\nCVImageElement.prototype.createContent = function () {\r\n  if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {\r\n    var canvas = createTag('canvas');\r\n    canvas.width = this.assetData.w;\r\n    canvas.height = this.assetData.h;\r\n    var ctx = canvas.getContext('2d');\r\n\r\n    var imgW = this.img.width;\r\n    var imgH = this.img.height;\r\n    var imgRel = imgW / imgH;\r\n    var canvasRel = this.assetData.w / this.assetData.h;\r\n    var widthCrop;\r\n    var heightCrop;\r\n    var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;\r\n    if ((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {\r\n      heightCrop = imgH;\r\n      widthCrop = heightCrop * canvasRel;\r\n    } else {\r\n      widthCrop = imgW;\r\n      heightCrop = widthCrop / canvasRel;\r\n    }\r\n    ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h);\r\n    this.img = canvas;\r\n  }\r\n};\r\n\r\nCVImageElement.prototype.renderInnerContent = function () {\r\n  this.canvasContext.drawImage(this.img, 0, 0);\r\n};\r\n\r\nCVImageElement.prototype.destroy = function () {\r\n  this.img = null;\r\n};\r\n\r\n/* global createSizedArray, PropertyFactory, extendPrototype, CanvasRenderer, ICompElement, CVBaseElement */\r\n\r\nfunction CVCompElement(data, globalData, comp) {\r\n  this.completeLayers = false;\r\n  this.layers = data.layers;\r\n  this.pendingElements = [];\r\n  this.elements = createSizedArray(this.layers.length);\r\n  this.initElement(data, globalData, comp);\r\n  this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };\r\n}\r\n\r\nextendPrototype([CanvasRenderer, ICompElement, CVBaseElement], CVCompElement);\r\n\r\nCVCompElement.prototype.renderInnerContent = function () {\r\n  var ctx = this.canvasContext;\r\n  ctx.beginPath();\r\n  ctx.moveTo(0, 0);\r\n  ctx.lineTo(this.data.w, 0);\r\n  ctx.lineTo(this.data.w, this.data.h);\r\n  ctx.lineTo(0, this.data.h);\r\n  ctx.lineTo(0, 0);\r\n  ctx.clip();\r\n  var i;\r\n  var len = this.layers.length;\r\n  for (i = len - 1; i >= 0; i -= 1) {\r\n    if (this.completeLayers || this.elements[i]) {\r\n      this.elements[i].renderFrame();\r\n    }\r\n  }\r\n};\r\n\r\nCVCompElement.prototype.destroy = function () {\r\n  var i;\r\n  var len = this.layers.length;\r\n  for (i = len - 1; i >= 0; i -= 1) {\r\n    if (this.elements[i]) {\r\n      this.elements[i].destroy();\r\n    }\r\n  }\r\n  this.layers = null;\r\n  this.elements = null;\r\n};\r\n\r\n/* global createSizedArray, ShapePropertyFactory, MaskElement */\r\n\r\nfunction CVMaskElement(data, element) {\r\n  this.data = data;\r\n  this.element = element;\r\n  this.masksProperties = this.data.masksProperties || [];\r\n  this.viewData = createSizedArray(this.masksProperties.length);\r\n  var i;\r\n  var len = this.masksProperties.length;\r\n  var hasMasks = false;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.masksProperties[i].mode !== 'n') {\r\n      hasMasks = true;\r\n    }\r\n    this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3);\r\n  }\r\n  this.hasMasks = hasMasks;\r\n  if (hasMasks) {\r\n    this.element.addRenderableComponent(this);\r\n  }\r\n}\r\n\r\nCVMaskElement.prototype.renderFrame = function () {\r\n  if (!this.hasMasks) {\r\n    return;\r\n  }\r\n  var transform = this.element.finalTransform.mat;\r\n  var ctx = this.element.canvasContext;\r\n  var i;\r\n  var len = this.masksProperties.length;\r\n  var pt;\r\n  var pts;\r\n  var data;\r\n  ctx.beginPath();\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.masksProperties[i].mode !== 'n') {\r\n      if (this.masksProperties[i].inv) {\r\n        ctx.moveTo(0, 0);\r\n        ctx.lineTo(this.element.globalData.compSize.w, 0);\r\n        ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);\r\n        ctx.lineTo(0, this.element.globalData.compSize.h);\r\n        ctx.lineTo(0, 0);\r\n      }\r\n      data = this.viewData[i].v;\r\n      pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0);\r\n      ctx.moveTo(pt[0], pt[1]);\r\n      var j;\r\n      var jLen = data._length;\r\n      for (j = 1; j < jLen; j += 1) {\r\n        pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);\r\n        ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\r\n      }\r\n      pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);\r\n      ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\r\n    }\r\n  }\r\n  this.element.globalData.renderer.save(true);\r\n  ctx.clip();\r\n};\r\n\r\nCVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;\r\n\r\nCVMaskElement.prototype.destroy = function () {\r\n  this.element = null;\r\n};\r\n\r\n/* global ShapeTransformManager, extendPrototype, BaseElement, TransformElement, CVBaseElement, IShapeElement,\r\nHierarchyElement, FrameElement, RenderableElement, RenderableDOMElement, PropertyFactory, degToRads, GradientProperty,\r\nDashProperty, TransformPropertyFactory, CVShapeData, ShapeModifiers, bmFloor, lineCapEnum, lineJoinEnum */\r\n\r\nfunction CVShapeElement(data, globalData, comp) {\r\n  this.shapes = [];\r\n  this.shapesData = data.shapes;\r\n  this.stylesList = [];\r\n  this.itemsData = [];\r\n  this.prevViewData = [];\r\n  this.shapeModifiers = [];\r\n  this.processedElements = [];\r\n  this.transformsManager = new ShapeTransformManager();\r\n  this.initElement(data, globalData, comp);\r\n}\r\n\r\nextendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement);\r\n\r\nCVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;\r\n\r\nCVShapeElement.prototype.transformHelper = { opacity: 1, _opMdf: false };\r\n\r\nCVShapeElement.prototype.dashResetter = [];\r\n\r\nCVShapeElement.prototype.createContent = function () {\r\n  this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\r\n};\r\n\r\nCVShapeElement.prototype.createStyleElement = function (data, transforms) {\r\n  var styleElem = {\r\n    data: data,\r\n    type: data.ty,\r\n    preTransforms: this.transformsManager.addTransformSequence(transforms),\r\n    transforms: [],\r\n    elements: [],\r\n    closed: data.hd === true,\r\n  };\r\n  var elementData = {};\r\n  if (data.ty === 'fl' || data.ty === 'st') {\r\n    elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this);\r\n    if (!elementData.c.k) {\r\n      styleElem.co = 'rgb(' + bmFloor(elementData.c.v[0]) + ',' + bmFloor(elementData.c.v[1]) + ',' + bmFloor(elementData.c.v[2]) + ')';\r\n    }\r\n  } else if (data.ty === 'gf' || data.ty === 'gs') {\r\n    elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this);\r\n    elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this);\r\n    elementData.h = PropertyFactory.getProp(this, data.h || { k: 0 }, 0, 0.01, this);\r\n    elementData.a = PropertyFactory.getProp(this, data.a || { k: 0 }, 0, degToRads, this);\r\n    elementData.g = new GradientProperty(this, data.g, this);\r\n  }\r\n  elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this);\r\n  if (data.ty === 'st' || data.ty === 'gs') {\r\n    styleElem.lc = lineCapEnum[data.lc || 2];\r\n    styleElem.lj = lineJoinEnum[data.lj || 2];\r\n    if (data.lj == 1) { // eslint-disable-line eqeqeq\r\n      styleElem.ml = data.ml;\r\n    }\r\n    elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this);\r\n    if (!elementData.w.k) {\r\n      styleElem.wi = elementData.w.v;\r\n    }\r\n    if (data.d) {\r\n      var d = new DashProperty(this, data.d, 'canvas', this);\r\n      elementData.d = d;\r\n      if (!elementData.d.k) {\r\n        styleElem.da = elementData.d.dashArray;\r\n        styleElem.do = elementData.d.dashoffset[0];\r\n      }\r\n    }\r\n  } else {\r\n    styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';\r\n  }\r\n  this.stylesList.push(styleElem);\r\n  elementData.style = styleElem;\r\n  return elementData;\r\n};\r\n\r\nCVShapeElement.prototype.createGroupElement = function () {\r\n  var elementData = {\r\n    it: [],\r\n    prevViewData: [],\r\n  };\r\n  return elementData;\r\n};\r\n\r\nCVShapeElement.prototype.createTransformElement = function (data) {\r\n  var elementData = {\r\n    transform: {\r\n      opacity: 1,\r\n      _opMdf: false,\r\n      key: this.transformsManager.getNewKey(),\r\n      op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),\r\n      mProps: TransformPropertyFactory.getTransformProperty(this, data, this),\r\n    },\r\n  };\r\n  return elementData;\r\n};\r\n\r\nCVShapeElement.prototype.createShapeElement = function (data) {\r\n  var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);\r\n\r\n  this.shapes.push(elementData);\r\n  this.addShapeToModifiers(elementData);\r\n  return elementData;\r\n};\r\n\r\nCVShapeElement.prototype.reloadShapes = function () {\r\n  this._isFirstFrame = true;\r\n  var i;\r\n  var len = this.itemsData.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.prevViewData[i] = this.itemsData[i];\r\n  }\r\n  this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\r\n  len = this.dynamicProperties.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    this.dynamicProperties[i].getValue();\r\n  }\r\n  this.renderModifiers();\r\n  this.transformsManager.processSequences(this._isFirstFrame);\r\n};\r\n\r\nCVShapeElement.prototype.addTransformToStyleList = function (transform) {\r\n  var i;\r\n  var len = this.stylesList.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (!this.stylesList[i].closed) {\r\n      this.stylesList[i].transforms.push(transform);\r\n    }\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.removeTransformFromStyleList = function () {\r\n  var i;\r\n  var len = this.stylesList.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (!this.stylesList[i].closed) {\r\n      this.stylesList[i].transforms.pop();\r\n    }\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.closeStyles = function (styles) {\r\n  var i;\r\n  var len = styles.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    styles[i].closed = true;\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {\r\n  var i;\r\n  var len = arr.length - 1;\r\n  var j;\r\n  var jLen;\r\n  var ownStyles = [];\r\n  var ownModifiers = [];\r\n  var processedPos;\r\n  var modifier;\r\n  var currentTransform;\r\n  var ownTransforms = [].concat(transforms);\r\n  for (i = len; i >= 0; i -= 1) {\r\n    processedPos = this.searchProcessedElement(arr[i]);\r\n    if (!processedPos) {\r\n      arr[i]._shouldRender = shouldRender;\r\n    } else {\r\n      itemsData[i] = prevViewData[processedPos - 1];\r\n    }\r\n    if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {\r\n      if (!processedPos) {\r\n        itemsData[i] = this.createStyleElement(arr[i], ownTransforms);\r\n      } else {\r\n        itemsData[i].style.closed = false;\r\n      }\r\n\r\n      ownStyles.push(itemsData[i].style);\r\n    } else if (arr[i].ty === 'gr') {\r\n      if (!processedPos) {\r\n        itemsData[i] = this.createGroupElement(arr[i]);\r\n      } else {\r\n        jLen = itemsData[i].it.length;\r\n        for (j = 0; j < jLen; j += 1) {\r\n          itemsData[i].prevViewData[j] = itemsData[i].it[j];\r\n        }\r\n      }\r\n      this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms);\r\n    } else if (arr[i].ty === 'tr') {\r\n      if (!processedPos) {\r\n        currentTransform = this.createTransformElement(arr[i]);\r\n        itemsData[i] = currentTransform;\r\n      }\r\n      ownTransforms.push(itemsData[i]);\r\n      this.addTransformToStyleList(itemsData[i]);\r\n    } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\r\n      if (!processedPos) {\r\n        itemsData[i] = this.createShapeElement(arr[i]);\r\n      }\r\n    } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb') {\r\n      if (!processedPos) {\r\n        modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n        modifier.init(this, arr[i]);\r\n        itemsData[i] = modifier;\r\n        this.shapeModifiers.push(modifier);\r\n      } else {\r\n        modifier = itemsData[i];\r\n        modifier.closed = false;\r\n      }\r\n      ownModifiers.push(modifier);\r\n    } else if (arr[i].ty === 'rp') {\r\n      if (!processedPos) {\r\n        modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n        itemsData[i] = modifier;\r\n        modifier.init(this, arr, i, itemsData);\r\n        this.shapeModifiers.push(modifier);\r\n        shouldRender = false;\r\n      } else {\r\n        modifier = itemsData[i];\r\n        modifier.closed = true;\r\n      }\r\n      ownModifiers.push(modifier);\r\n    }\r\n    this.addProcessedElement(arr[i], i + 1);\r\n  }\r\n  this.removeTransformFromStyleList();\r\n  this.closeStyles(ownStyles);\r\n  len = ownModifiers.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    ownModifiers[i].closed = true;\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.renderInnerContent = function () {\r\n  this.transformHelper.opacity = 1;\r\n  this.transformHelper._opMdf = false;\r\n  this.renderModifiers();\r\n  this.transformsManager.processSequences(this._isFirstFrame);\r\n  this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true);\r\n};\r\n\r\nCVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {\r\n  if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {\r\n    groupTransform.opacity = parentTransform.opacity;\r\n    groupTransform.opacity *= groupTransform.op.v;\r\n    groupTransform._opMdf = true;\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.drawLayer = function () {\r\n  var i;\r\n  var len = this.stylesList.length;\r\n  var j;\r\n  var jLen;\r\n  var k;\r\n  var kLen;\r\n  var elems;\r\n  var nodes;\r\n  var renderer = this.globalData.renderer;\r\n  var ctx = this.globalData.canvasContext;\r\n  var type;\r\n  var currentStyle;\r\n  for (i = 0; i < len; i += 1) {\r\n    currentStyle = this.stylesList[i];\r\n    type = currentStyle.type;\r\n\r\n    // Skipping style when\r\n    // Stroke width equals 0\r\n    // style should not be rendered (extra unused repeaters)\r\n    // current opacity equals 0\r\n    // global opacity equals 0\r\n    if (!(((type === 'st' || type === 'gs') && currentStyle.wi === 0) || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0)) {\r\n      renderer.save();\r\n      elems = currentStyle.elements;\r\n      if (type === 'st' || type === 'gs') {\r\n        ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;\r\n        ctx.lineWidth = currentStyle.wi;\r\n        ctx.lineCap = currentStyle.lc;\r\n        ctx.lineJoin = currentStyle.lj;\r\n        ctx.miterLimit = currentStyle.ml || 0;\r\n      } else {\r\n        ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;\r\n      }\r\n      renderer.ctxOpacity(currentStyle.coOp);\r\n      if (type !== 'st' && type !== 'gs') {\r\n        ctx.beginPath();\r\n      }\r\n      renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);\r\n      jLen = elems.length;\r\n      for (j = 0; j < jLen; j += 1) {\r\n        if (type === 'st' || type === 'gs') {\r\n          ctx.beginPath();\r\n          if (currentStyle.da) {\r\n            ctx.setLineDash(currentStyle.da);\r\n            ctx.lineDashOffset = currentStyle.do;\r\n          }\r\n        }\r\n        nodes = elems[j].trNodes;\r\n        kLen = nodes.length;\r\n\r\n        for (k = 0; k < kLen; k += 1) {\r\n          if (nodes[k].t === 'm') {\r\n            ctx.moveTo(nodes[k].p[0], nodes[k].p[1]);\r\n          } else if (nodes[k].t === 'c') {\r\n            ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]);\r\n          } else {\r\n            ctx.closePath();\r\n          }\r\n        }\r\n        if (type === 'st' || type === 'gs') {\r\n          ctx.stroke();\r\n          if (currentStyle.da) {\r\n            ctx.setLineDash(this.dashResetter);\r\n          }\r\n        }\r\n      }\r\n      if (type !== 'st' && type !== 'gs') {\r\n        ctx.fill(currentStyle.r);\r\n      }\r\n      renderer.restore();\r\n    }\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {\r\n  var i;\r\n  var len = items.length - 1;\r\n  var groupTransform;\r\n  groupTransform = parentTransform;\r\n  for (i = len; i >= 0; i -= 1) {\r\n    if (items[i].ty === 'tr') {\r\n      groupTransform = data[i].transform;\r\n      this.renderShapeTransform(parentTransform, groupTransform);\r\n    } else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') {\r\n      this.renderPath(items[i], data[i]);\r\n    } else if (items[i].ty === 'fl') {\r\n      this.renderFill(items[i], data[i], groupTransform);\r\n    } else if (items[i].ty === 'st') {\r\n      this.renderStroke(items[i], data[i], groupTransform);\r\n    } else if (items[i].ty === 'gf' || items[i].ty === 'gs') {\r\n      this.renderGradientFill(items[i], data[i], groupTransform);\r\n    } else if (items[i].ty === 'gr') {\r\n      this.renderShape(groupTransform, items[i].it, data[i].it);\r\n    } else if (items[i].ty === 'tm') {\r\n      //\r\n    }\r\n  }\r\n  if (isMain) {\r\n    this.drawLayer();\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {\r\n  if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {\r\n    var shapeNodes = styledShape.trNodes;\r\n    var paths = shape.paths;\r\n    var i;\r\n    var len;\r\n    var j;\r\n    var jLen = paths._length;\r\n    shapeNodes.length = 0;\r\n    var groupTransformMat = styledShape.transforms.finalTransform;\r\n    for (j = 0; j < jLen; j += 1) {\r\n      var pathNodes = paths.shapes[j];\r\n      if (pathNodes && pathNodes.v) {\r\n        len = pathNodes._length;\r\n        for (i = 1; i < len; i += 1) {\r\n          if (i === 1) {\r\n            shapeNodes.push({\r\n              t: 'm',\r\n              p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),\r\n            });\r\n          }\r\n          shapeNodes.push({\r\n            t: 'c',\r\n            pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i]),\r\n          });\r\n        }\r\n        if (len === 1) {\r\n          shapeNodes.push({\r\n            t: 'm',\r\n            p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),\r\n          });\r\n        }\r\n        if (pathNodes.c && len) {\r\n          shapeNodes.push({\r\n            t: 'c',\r\n            pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0]),\r\n          });\r\n          shapeNodes.push({\r\n            t: 'z',\r\n          });\r\n        }\r\n      }\r\n    }\r\n    styledShape.trNodes = shapeNodes;\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.renderPath = function (pathData, itemData) {\r\n  if (pathData.hd !== true && pathData._shouldRender) {\r\n    var i;\r\n    var len = itemData.styledShapes.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.renderStyledShape(itemData.styledShapes[i], itemData.sh);\r\n    }\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {\r\n  var styleElem = itemData.style;\r\n\r\n  if (itemData.c._mdf || this._isFirstFrame) {\r\n    styleElem.co = 'rgb('\r\n        + bmFloor(itemData.c.v[0]) + ','\r\n        + bmFloor(itemData.c.v[1]) + ','\r\n        + bmFloor(itemData.c.v[2]) + ')';\r\n  }\r\n  if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\r\n    styleElem.coOp = itemData.o.v * groupTransform.opacity;\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {\r\n  var styleElem = itemData.style;\r\n  var grd;\r\n  if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))) {\r\n    var ctx = this.globalData.canvasContext;\r\n    var pt1 = itemData.s.v;\r\n    var pt2 = itemData.e.v;\r\n    if (styleData.t === 1) {\r\n      grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);\r\n    } else {\r\n      var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\r\n      var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\r\n\r\n      var percent = itemData.h.v;\r\n      if (percent >= 1) {\r\n        percent = 0.99;\r\n      } else if (percent <= -1) {\r\n        percent = -0.99;\r\n      }\r\n      var dist = rad * percent;\r\n      var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\r\n      var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\r\n      grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);\r\n    }\r\n\r\n    var i;\r\n    var len = styleData.g.p;\r\n    var cValues = itemData.g.c;\r\n    var opacity = 1;\r\n\r\n    for (i = 0; i < len; i += 1) {\r\n      if (itemData.g._hasOpacity && itemData.g._collapsable) {\r\n        opacity = itemData.g.o[i * 2 + 1];\r\n      }\r\n      grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')');\r\n    }\r\n    styleElem.grd = grd;\r\n  }\r\n  styleElem.coOp = itemData.o.v * groupTransform.opacity;\r\n};\r\n\r\nCVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {\r\n  var styleElem = itemData.style;\r\n  var d = itemData.d;\r\n  if (d && (d._mdf || this._isFirstFrame)) {\r\n    styleElem.da = d.dashArray;\r\n    styleElem.do = d.dashoffset[0];\r\n  }\r\n  if (itemData.c._mdf || this._isFirstFrame) {\r\n    styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';\r\n  }\r\n  if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\r\n    styleElem.coOp = itemData.o.v * groupTransform.opacity;\r\n  }\r\n  if (itemData.w._mdf || this._isFirstFrame) {\r\n    styleElem.wi = itemData.w.v;\r\n  }\r\n};\r\n\r\nCVShapeElement.prototype.destroy = function () {\r\n  this.shapesData = null;\r\n  this.globalData = null;\r\n  this.canvasContext = null;\r\n  this.stylesList.length = 0;\r\n  this.itemsData.length = 0;\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement,\r\nSVGShapeElement, IImageElement */\r\n\r\nfunction CVSolidElement(data, globalData, comp) {\r\n  this.initElement(data, globalData, comp);\r\n}\r\nextendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);\r\n\r\nCVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;\r\nCVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\r\n\r\nCVSolidElement.prototype.renderInnerContent = function () {\r\n  var ctx = this.canvasContext;\r\n  ctx.fillStyle = this.data.sc;\r\n  ctx.fillRect(0, 0, this.data.sw, this.data.sh);\r\n  //\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement,\r\nRenderableElement, ITextElement, createTag, createSizedArray */\r\n\r\nfunction CVTextElement(data, globalData, comp) {\r\n  this.textSpans = [];\r\n  this.yOffset = 0;\r\n  this.fillColorAnim = false;\r\n  this.strokeColorAnim = false;\r\n  this.strokeWidthAnim = false;\r\n  this.stroke = false;\r\n  this.fill = false;\r\n  this.justifyOffset = 0;\r\n  this.currentRender = null;\r\n  this.renderType = 'canvas';\r\n  this.values = {\r\n    fill: 'rgba(0,0,0,0)',\r\n    stroke: 'rgba(0,0,0,0)',\r\n    sWidth: 0,\r\n    fValue: '',\r\n  };\r\n  this.initElement(data, globalData, comp);\r\n}\r\nextendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement);\r\n\r\nCVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');\r\n\r\nCVTextElement.prototype.buildNewText = function () {\r\n  var documentData = this.textProperty.currentData;\r\n  this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\r\n\r\n  var hasFill = false;\r\n  if (documentData.fc) {\r\n    hasFill = true;\r\n    this.values.fill = this.buildColor(documentData.fc);\r\n  } else {\r\n    this.values.fill = 'rgba(0,0,0,0)';\r\n  }\r\n  this.fill = hasFill;\r\n  var hasStroke = false;\r\n  if (documentData.sc) {\r\n    hasStroke = true;\r\n    this.values.stroke = this.buildColor(documentData.sc);\r\n    this.values.sWidth = documentData.sw;\r\n  }\r\n  var fontData = this.globalData.fontManager.getFontByName(documentData.f);\r\n  var i;\r\n  var len;\r\n  var letters = documentData.l;\r\n  var matrixHelper = this.mHelper;\r\n  this.stroke = hasStroke;\r\n  this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily;\r\n  len = documentData.finalText.length;\r\n  // this.tHelper.font = this.values.fValue;\r\n  var charData;\r\n  var shapeData;\r\n  var k;\r\n  var kLen;\r\n  var shapes;\r\n  var j;\r\n  var jLen;\r\n  var pathNodes;\r\n  var commands;\r\n  var pathArr;\r\n  var singleShape = this.data.singleShape;\r\n  var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\r\n  var xPos = 0;\r\n  var yPos = 0;\r\n  var firstLine = true;\r\n  var cnt = 0;\r\n  for (i = 0; i < len; i += 1) {\r\n    charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\r\n    shapeData = (charData && charData.data) || {};\r\n    matrixHelper.reset();\r\n    if (singleShape && letters[i].n) {\r\n      xPos = -trackingOffset;\r\n      yPos += documentData.yOffset;\r\n      yPos += firstLine ? 1 : 0;\r\n      firstLine = false;\r\n    }\r\n\r\n    shapes = shapeData.shapes ? shapeData.shapes[0].it : [];\r\n    jLen = shapes.length;\r\n    matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\r\n    if (singleShape) {\r\n      this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\r\n    }\r\n    commands = createSizedArray(jLen);\r\n    for (j = 0; j < jLen; j += 1) {\r\n      kLen = shapes[j].ks.k.i.length;\r\n      pathNodes = shapes[j].ks.k;\r\n      pathArr = [];\r\n      for (k = 1; k < kLen; k += 1) {\r\n        if (k === 1) {\r\n          pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\r\n        }\r\n        pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0));\r\n      }\r\n      pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\r\n      commands[j] = pathArr;\r\n    }\r\n    if (singleShape) {\r\n      xPos += letters[i].l;\r\n      xPos += trackingOffset;\r\n    }\r\n    if (this.textSpans[cnt]) {\r\n      this.textSpans[cnt].elem = commands;\r\n    } else {\r\n      this.textSpans[cnt] = { elem: commands };\r\n    }\r\n    cnt += 1;\r\n  }\r\n};\r\n\r\nCVTextElement.prototype.renderInnerContent = function () {\r\n  var ctx = this.canvasContext;\r\n  ctx.font = this.values.fValue;\r\n  ctx.lineCap = 'butt';\r\n  ctx.lineJoin = 'miter';\r\n  ctx.miterLimit = 4;\r\n\r\n  if (!this.data.singleShape) {\r\n    this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\r\n  }\r\n\r\n  var i;\r\n  var len;\r\n  var j;\r\n  var jLen;\r\n  var k;\r\n  var kLen;\r\n  var renderedLetters = this.textAnimator.renderedLetters;\r\n\r\n  var letters = this.textProperty.currentData.l;\r\n\r\n  len = letters.length;\r\n  var renderedLetter;\r\n  var lastFill = null;\r\n  var lastStroke = null;\r\n  var lastStrokeW = null;\r\n  var commands;\r\n  var pathArr;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (!letters[i].n) {\r\n      renderedLetter = renderedLetters[i];\r\n      if (renderedLetter) {\r\n        this.globalData.renderer.save();\r\n        this.globalData.renderer.ctxTransform(renderedLetter.p);\r\n        this.globalData.renderer.ctxOpacity(renderedLetter.o);\r\n      }\r\n      if (this.fill) {\r\n        if (renderedLetter && renderedLetter.fc) {\r\n          if (lastFill !== renderedLetter.fc) {\r\n            lastFill = renderedLetter.fc;\r\n            ctx.fillStyle = renderedLetter.fc;\r\n          }\r\n        } else if (lastFill !== this.values.fill) {\r\n          lastFill = this.values.fill;\r\n          ctx.fillStyle = this.values.fill;\r\n        }\r\n        commands = this.textSpans[i].elem;\r\n        jLen = commands.length;\r\n        this.globalData.canvasContext.beginPath();\r\n        for (j = 0; j < jLen; j += 1) {\r\n          pathArr = commands[j];\r\n          kLen = pathArr.length;\r\n          this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\r\n          for (k = 2; k < kLen; k += 6) {\r\n            this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\r\n          }\r\n        }\r\n        this.globalData.canvasContext.closePath();\r\n        this.globalData.canvasContext.fill();\r\n        /// ctx.fillText(this.textSpans[i].val,0,0);\r\n      }\r\n      if (this.stroke) {\r\n        if (renderedLetter && renderedLetter.sw) {\r\n          if (lastStrokeW !== renderedLetter.sw) {\r\n            lastStrokeW = renderedLetter.sw;\r\n            ctx.lineWidth = renderedLetter.sw;\r\n          }\r\n        } else if (lastStrokeW !== this.values.sWidth) {\r\n          lastStrokeW = this.values.sWidth;\r\n          ctx.lineWidth = this.values.sWidth;\r\n        }\r\n        if (renderedLetter && renderedLetter.sc) {\r\n          if (lastStroke !== renderedLetter.sc) {\r\n            lastStroke = renderedLetter.sc;\r\n            ctx.strokeStyle = renderedLetter.sc;\r\n          }\r\n        } else if (lastStroke !== this.values.stroke) {\r\n          lastStroke = this.values.stroke;\r\n          ctx.strokeStyle = this.values.stroke;\r\n        }\r\n        commands = this.textSpans[i].elem;\r\n        jLen = commands.length;\r\n        this.globalData.canvasContext.beginPath();\r\n        for (j = 0; j < jLen; j += 1) {\r\n          pathArr = commands[j];\r\n          kLen = pathArr.length;\r\n          this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\r\n          for (k = 2; k < kLen; k += 6) {\r\n            this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\r\n          }\r\n        }\r\n        this.globalData.canvasContext.closePath();\r\n        this.globalData.canvasContext.stroke();\r\n        /// ctx.strokeText(letters[i].val,0,0);\r\n      }\r\n      if (renderedLetter) {\r\n        this.globalData.renderer.restore();\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\nfunction CVEffects() {\r\n\r\n}\r\nCVEffects.prototype.renderFrame = function () {};\r\n\r\n/* global createTag, createNS, styleDiv, CVEffects, MaskElement, SVGBaseElement, HybridRenderer */\r\n\r\nfunction HBaseElement() {}\r\nHBaseElement.prototype = {\r\n  checkBlendMode: function () {},\r\n  initRendererElement: function () {\r\n    this.baseElement = createTag(this.data.tg || 'div');\r\n    if (this.data.hasMask) {\r\n      this.svgElement = createNS('svg');\r\n      this.layerElement = createNS('g');\r\n      this.maskedElement = this.layerElement;\r\n      this.svgElement.appendChild(this.layerElement);\r\n      this.baseElement.appendChild(this.svgElement);\r\n    } else {\r\n      this.layerElement = this.baseElement;\r\n    }\r\n    styleDiv(this.baseElement);\r\n  },\r\n  createContainerElements: function () {\r\n    this.renderableEffectsManager = new CVEffects(this);\r\n    this.transformedElement = this.baseElement;\r\n    this.maskedElement = this.layerElement;\r\n    if (this.data.ln) {\r\n      this.layerElement.setAttribute('id', this.data.ln);\r\n    }\r\n    if (this.data.cl) {\r\n      this.layerElement.setAttribute('class', this.data.cl);\r\n    }\r\n    if (this.data.bm !== 0) {\r\n      this.setBlendMode();\r\n    }\r\n  },\r\n  renderElement: function () {\r\n    var transformedElementStyle = this.transformedElement ? this.transformedElement.style : {};\r\n    if (this.finalTransform._matMdf) {\r\n      var matrixValue = this.finalTransform.mat.toCSS();\r\n      transformedElementStyle.transform = matrixValue;\r\n      transformedElementStyle.webkitTransform = matrixValue;\r\n    }\r\n    if (this.finalTransform._opMdf) {\r\n      transformedElementStyle.opacity = this.finalTransform.mProp.o.v;\r\n    }\r\n  },\r\n  renderFrame: function () {\r\n    // If it is exported as hidden (data.hd === true) no need to render\r\n    // If it is not visible no need to render\r\n    if (this.data.hd || this.hidden) {\r\n      return;\r\n    }\r\n    this.renderTransform();\r\n    this.renderRenderable();\r\n    this.renderElement();\r\n    this.renderInnerContent();\r\n    if (this._isFirstFrame) {\r\n      this._isFirstFrame = false;\r\n    }\r\n  },\r\n  destroy: function () {\r\n    this.layerElement = null;\r\n    this.transformedElement = null;\r\n    if (this.matteElement) {\r\n      this.matteElement = null;\r\n    }\r\n    if (this.maskManager) {\r\n      this.maskManager.destroy();\r\n      this.maskManager = null;\r\n    }\r\n  },\r\n  createRenderableComponents: function () {\r\n    this.maskManager = new MaskElement(this.data, this, this.globalData);\r\n  },\r\n  addEffects: function () {\r\n  },\r\n  setMatte: function () {},\r\n};\r\nHBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;\r\nHBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;\r\nHBaseElement.prototype.buildElementParenting = HybridRenderer.prototype.buildElementParenting;\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement,\r\nRenderableDOMElement, createNS, createTag */\r\n\r\nfunction HSolidElement(data, globalData, comp) {\r\n  this.initElement(data, globalData, comp);\r\n}\r\nextendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement);\r\n\r\nHSolidElement.prototype.createContent = function () {\r\n  var rect;\r\n  if (this.data.hasMask) {\r\n    rect = createNS('rect');\r\n    rect.setAttribute('width', this.data.sw);\r\n    rect.setAttribute('height', this.data.sh);\r\n    rect.setAttribute('fill', this.data.sc);\r\n    this.svgElement.setAttribute('width', this.data.sw);\r\n    this.svgElement.setAttribute('height', this.data.sh);\r\n  } else {\r\n    rect = createTag('div');\r\n    rect.style.width = this.data.sw + 'px';\r\n    rect.style.height = this.data.sh + 'px';\r\n    rect.style.backgroundColor = this.data.sc;\r\n  }\r\n  this.layerElement.appendChild(rect);\r\n};\r\n\r\n/* global createSizedArray, PropertyFactory, extendPrototype, HybridRenderer, ICompElement, HBaseElement */\r\n\r\nfunction HCompElement(data, globalData, comp) {\r\n  this.layers = data.layers;\r\n  this.supports3d = !data.hasMask;\r\n  this.completeLayers = false;\r\n  this.pendingElements = [];\r\n  this.elements = this.layers ? createSizedArray(this.layers.length) : [];\r\n  this.initElement(data, globalData, comp);\r\n  this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true };\r\n}\r\n\r\nextendPrototype([HybridRenderer, ICompElement, HBaseElement], HCompElement);\r\nHCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;\r\n\r\nHCompElement.prototype.createContainerElements = function () {\r\n  this._createBaseContainerElements();\r\n  // divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';\r\n  if (this.data.hasMask) {\r\n    this.svgElement.setAttribute('width', this.data.w);\r\n    this.svgElement.setAttribute('height', this.data.h);\r\n    this.transformedElement = this.baseElement;\r\n  } else {\r\n    this.transformedElement = this.layerElement;\r\n  }\r\n};\r\n\r\nHCompElement.prototype.addTo3dContainer = function (elem, pos) {\r\n  var j = 0;\r\n  var nextElement;\r\n  while (j < pos) {\r\n    if (this.elements[j] && this.elements[j].getBaseElement) {\r\n      nextElement = this.elements[j].getBaseElement();\r\n    }\r\n    j += 1;\r\n  }\r\n  if (nextElement) {\r\n    this.layerElement.insertBefore(elem, nextElement);\r\n  } else {\r\n    this.layerElement.appendChild(elem);\r\n  }\r\n};\r\n\r\n/* global createNS, extendPrototype, BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement,\r\nHierarchyElement, FrameElement, RenderableElement, createNS, bmMin, bmSqrt, bmMin, bmMax, bmPow */\r\n\r\nfunction HShapeElement(data, globalData, comp) {\r\n  // List of drawable elements\r\n  this.shapes = [];\r\n  // Full shape data\r\n  this.shapesData = data.shapes;\r\n  // List of styles that will be applied to shapes\r\n  this.stylesList = [];\r\n  // List of modifiers that will be applied to shapes\r\n  this.shapeModifiers = [];\r\n  // List of items in shape tree\r\n  this.itemsData = [];\r\n  // List of items in previous shape tree\r\n  this.processedElements = [];\r\n  // List of animated components\r\n  this.animatedContents = [];\r\n  this.shapesContainer = createNS('g');\r\n  this.initElement(data, globalData, comp);\r\n  // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\r\n  // List of elements that have been created\r\n  this.prevViewData = [];\r\n  this.currentBBox = {\r\n    x: 999999,\r\n    y: -999999,\r\n    h: 0,\r\n    w: 0,\r\n  };\r\n}\r\nextendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement);\r\nHShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;\r\n\r\nHShapeElement.prototype.createContent = function () {\r\n  var cont;\r\n  this.baseElement.style.fontSize = 0;\r\n  if (this.data.hasMask) {\r\n    this.layerElement.appendChild(this.shapesContainer);\r\n    cont = this.svgElement;\r\n  } else {\r\n    cont = createNS('svg');\r\n    var size = this.comp.data ? this.comp.data : this.globalData.compSize;\r\n    cont.setAttribute('width', size.w);\r\n    cont.setAttribute('height', size.h);\r\n    cont.appendChild(this.shapesContainer);\r\n    this.layerElement.appendChild(cont);\r\n  }\r\n\r\n  this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true);\r\n  this.filterUniqueShapes();\r\n  this.shapeCont = cont;\r\n};\r\n\r\nHShapeElement.prototype.getTransformedPoint = function (transformers, point) {\r\n  var i;\r\n  var len = transformers.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);\r\n  }\r\n  return point;\r\n};\r\n\r\nHShapeElement.prototype.calculateShapeBoundingBox = function (item, boundingBox) {\r\n  var shape = item.sh.v;\r\n  var transformers = item.transformers;\r\n  var i;\r\n  var len = shape._length;\r\n  var vPoint;\r\n  var oPoint;\r\n  var nextIPoint;\r\n  var nextVPoint;\r\n  if (len <= 1) {\r\n    return;\r\n  }\r\n  for (i = 0; i < len - 1; i += 1) {\r\n    vPoint = this.getTransformedPoint(transformers, shape.v[i]);\r\n    oPoint = this.getTransformedPoint(transformers, shape.o[i]);\r\n    nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);\r\n    nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);\r\n    this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\r\n  }\r\n  if (shape.c) {\r\n    vPoint = this.getTransformedPoint(transformers, shape.v[i]);\r\n    oPoint = this.getTransformedPoint(transformers, shape.o[i]);\r\n    nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);\r\n    nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);\r\n    this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\r\n  }\r\n};\r\n\r\nHShapeElement.prototype.checkBounds = function (vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {\r\n  this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);\r\n  var bounds = this.shapeBoundingBox;\r\n  boundingBox.x = bmMin(bounds.left, boundingBox.x);\r\n  boundingBox.xMax = bmMax(bounds.right, boundingBox.xMax);\r\n  boundingBox.y = bmMin(bounds.top, boundingBox.y);\r\n  boundingBox.yMax = bmMax(bounds.bottom, boundingBox.yMax);\r\n};\r\n\r\nHShapeElement.prototype.shapeBoundingBox = {\r\n  left: 0,\r\n  right: 0,\r\n  top: 0,\r\n  bottom: 0,\r\n};\r\n\r\nHShapeElement.prototype.tempBoundingBox = {\r\n  x: 0,\r\n  xMax: 0,\r\n  y: 0,\r\n  yMax: 0,\r\n  width: 0,\r\n  height: 0,\r\n};\r\n\r\nHShapeElement.prototype.getBoundsOfCurve = function (p0, p1, p2, p3) {\r\n  var bounds = [[p0[0], p3[0]], [p0[1], p3[1]]];\r\n\r\n  for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) { // eslint-disable-line no-plusplus\r\n    b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];\r\n    a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];\r\n    c = 3 * p1[i] - 3 * p0[i];\r\n\r\n    b |= 0; // eslint-disable-line no-bitwise\r\n    a |= 0; // eslint-disable-line no-bitwise\r\n    c |= 0; // eslint-disable-line no-bitwise\r\n\r\n    if (a === 0 && b === 0) {\r\n      //\r\n    } else if (a === 0) {\r\n      t = -c / b;\r\n\r\n      if (t > 0 && t < 1) {\r\n        bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i));\r\n      }\r\n    } else {\r\n      b2ac = b * b - 4 * c * a;\r\n\r\n      if (b2ac >= 0) {\r\n        t1 = (-b + bmSqrt(b2ac)) / (2 * a);\r\n        if (t1 > 0 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i));\r\n        t2 = (-b - bmSqrt(b2ac)) / (2 * a);\r\n        if (t2 > 0 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i));\r\n      }\r\n    }\r\n  }\r\n\r\n  this.shapeBoundingBox.left = bmMin.apply(null, bounds[0]);\r\n  this.shapeBoundingBox.top = bmMin.apply(null, bounds[1]);\r\n  this.shapeBoundingBox.right = bmMax.apply(null, bounds[0]);\r\n  this.shapeBoundingBox.bottom = bmMax.apply(null, bounds[1]);\r\n};\r\n\r\nHShapeElement.prototype.calculateF = function (t, p0, p1, p2, p3, i) {\r\n  return bmPow(1 - t, 3) * p0[i]\r\n        + 3 * bmPow(1 - t, 2) * t * p1[i]\r\n        + 3 * (1 - t) * bmPow(t, 2) * p2[i]\r\n        + bmPow(t, 3) * p3[i];\r\n};\r\n\r\nHShapeElement.prototype.calculateBoundingBox = function (itemsData, boundingBox) {\r\n  var i;\r\n  var len = itemsData.length;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (itemsData[i] && itemsData[i].sh) {\r\n      this.calculateShapeBoundingBox(itemsData[i], boundingBox);\r\n    } else if (itemsData[i] && itemsData[i].it) {\r\n      this.calculateBoundingBox(itemsData[i].it, boundingBox);\r\n    }\r\n  }\r\n};\r\n\r\nHShapeElement.prototype.currentBoxContains = function (box) {\r\n  return this.currentBBox.x <= box.x\r\n    && this.currentBBox.y <= box.y\r\n    && this.currentBBox.width + this.currentBBox.x >= box.x + box.width\r\n    && this.currentBBox.height + this.currentBBox.y >= box.y + box.height;\r\n};\r\n\r\nHShapeElement.prototype.renderInnerContent = function () {\r\n  this._renderShapeFrame();\r\n\r\n  if (!this.hidden && (this._isFirstFrame || this._mdf)) {\r\n    var tempBoundingBox = this.tempBoundingBox;\r\n    var max = 999999;\r\n    tempBoundingBox.x = max;\r\n    tempBoundingBox.xMax = -max;\r\n    tempBoundingBox.y = max;\r\n    tempBoundingBox.yMax = -max;\r\n    this.calculateBoundingBox(this.itemsData, tempBoundingBox);\r\n    tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;\r\n    tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y;\r\n    // var tempBoundingBox = this.shapeCont.getBBox();\r\n    if (this.currentBoxContains(tempBoundingBox)) {\r\n      return;\r\n    }\r\n    var changed = false;\r\n    if (this.currentBBox.w !== tempBoundingBox.width) {\r\n      this.currentBBox.w = tempBoundingBox.width;\r\n      this.shapeCont.setAttribute('width', tempBoundingBox.width);\r\n      changed = true;\r\n    }\r\n    if (this.currentBBox.h !== tempBoundingBox.height) {\r\n      this.currentBBox.h = tempBoundingBox.height;\r\n      this.shapeCont.setAttribute('height', tempBoundingBox.height);\r\n      changed = true;\r\n    }\r\n    if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) {\r\n      this.currentBBox.w = tempBoundingBox.width;\r\n      this.currentBBox.h = tempBoundingBox.height;\r\n      this.currentBBox.x = tempBoundingBox.x;\r\n      this.currentBBox.y = tempBoundingBox.y;\r\n\r\n      this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\r\n      var shapeStyle = this.shapeCont.style;\r\n      var shapeTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\r\n      shapeStyle.transform = shapeTransform;\r\n      shapeStyle.webkitTransform = shapeTransform;\r\n    }\r\n  }\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement,\r\nRenderableDOMElement, ITextElement, createSizedArray, createTag, styleDiv, createNS, lineJoinEnum, lineCapEnum */\r\n\r\nfunction HTextElement(data, globalData, comp) {\r\n  this.textSpans = [];\r\n  this.textPaths = [];\r\n  this.currentBBox = {\r\n    x: 999999,\r\n    y: -999999,\r\n    h: 0,\r\n    w: 0,\r\n  };\r\n  this.renderType = 'svg';\r\n  this.isMasked = false;\r\n  this.initElement(data, globalData, comp);\r\n}\r\nextendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement);\r\n\r\nHTextElement.prototype.createContent = function () {\r\n  this.isMasked = this.checkMasks();\r\n  if (this.isMasked) {\r\n    this.renderType = 'svg';\r\n    this.compW = this.comp.data.w;\r\n    this.compH = this.comp.data.h;\r\n    this.svgElement.setAttribute('width', this.compW);\r\n    this.svgElement.setAttribute('height', this.compH);\r\n    var g = createNS('g');\r\n    this.maskedElement.appendChild(g);\r\n    this.innerElem = g;\r\n  } else {\r\n    this.renderType = 'html';\r\n    this.innerElem = this.layerElement;\r\n  }\r\n\r\n  this.checkParenting();\r\n};\r\n\r\nHTextElement.prototype.buildNewText = function () {\r\n  var documentData = this.textProperty.currentData;\r\n  this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\r\n  var innerElemStyle = this.innerElem.style;\r\n  var textColor = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';\r\n  innerElemStyle.fill = textColor;\r\n  innerElemStyle.color = textColor;\r\n  if (documentData.sc) {\r\n    innerElemStyle.stroke = this.buildColor(documentData.sc);\r\n    innerElemStyle.strokeWidth = documentData.sw + 'px';\r\n  }\r\n  var fontData = this.globalData.fontManager.getFontByName(documentData.f);\r\n  if (!this.globalData.fontManager.chars) {\r\n    innerElemStyle.fontSize = documentData.finalSize + 'px';\r\n    innerElemStyle.lineHeight = documentData.finalSize + 'px';\r\n    if (fontData.fClass) {\r\n      this.innerElem.className = fontData.fClass;\r\n    } else {\r\n      innerElemStyle.fontFamily = fontData.fFamily;\r\n      var fWeight = documentData.fWeight;\r\n      var fStyle = documentData.fStyle;\r\n      innerElemStyle.fontStyle = fStyle;\r\n      innerElemStyle.fontWeight = fWeight;\r\n    }\r\n  }\r\n  var i;\r\n  var len;\r\n\r\n  var letters = documentData.l;\r\n  len = letters.length;\r\n  var tSpan;\r\n  var tParent;\r\n  var tCont;\r\n  var matrixHelper = this.mHelper;\r\n  var shapes;\r\n  var shapeStr = '';\r\n  var cnt = 0;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (this.globalData.fontManager.chars) {\r\n      if (!this.textPaths[cnt]) {\r\n        tSpan = createNS('path');\r\n        tSpan.setAttribute('stroke-linecap', lineCapEnum[1]);\r\n        tSpan.setAttribute('stroke-linejoin', lineJoinEnum[2]);\r\n        tSpan.setAttribute('stroke-miterlimit', '4');\r\n      } else {\r\n        tSpan = this.textPaths[cnt];\r\n      }\r\n      if (!this.isMasked) {\r\n        if (this.textSpans[cnt]) {\r\n          tParent = this.textSpans[cnt];\r\n          tCont = tParent.children[0];\r\n        } else {\r\n          tParent = createTag('div');\r\n          tParent.style.lineHeight = 0;\r\n          tCont = createNS('svg');\r\n          tCont.appendChild(tSpan);\r\n          styleDiv(tParent);\r\n        }\r\n      }\r\n    } else if (!this.isMasked) {\r\n      if (this.textSpans[cnt]) {\r\n        tParent = this.textSpans[cnt];\r\n        tSpan = this.textPaths[cnt];\r\n      } else {\r\n        tParent = createTag('span');\r\n        styleDiv(tParent);\r\n        tSpan = createTag('span');\r\n        styleDiv(tSpan);\r\n        tParent.appendChild(tSpan);\r\n      }\r\n    } else {\r\n      tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');\r\n    }\r\n    // tSpan.setAttribute('visibility', 'hidden');\r\n    if (this.globalData.fontManager.chars) {\r\n      var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\r\n      var shapeData;\r\n      if (charData) {\r\n        shapeData = charData.data;\r\n      } else {\r\n        shapeData = null;\r\n      }\r\n      matrixHelper.reset();\r\n      if (shapeData && shapeData.shapes) {\r\n        shapes = shapeData.shapes[0].it;\r\n        matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\r\n        shapeStr = this.createPathShape(matrixHelper, shapes);\r\n        tSpan.setAttribute('d', shapeStr);\r\n      }\r\n      if (!this.isMasked) {\r\n        this.innerElem.appendChild(tParent);\r\n        if (shapeData && shapeData.shapes) {\r\n          // document.body.appendChild is needed to get exact measure of shape\r\n          document.body.appendChild(tCont);\r\n          var boundingBox = tCont.getBBox();\r\n          tCont.setAttribute('width', boundingBox.width + 2);\r\n          tCont.setAttribute('height', boundingBox.height + 2);\r\n          tCont.setAttribute('viewBox', (boundingBox.x - 1) + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2));\r\n          var tContStyle = tCont.style;\r\n          var tContTranslation = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)';\r\n          tContStyle.transform = tContTranslation;\r\n          tContStyle.webkitTransform = tContTranslation;\r\n\r\n          letters[i].yOffset = boundingBox.y - 1;\r\n        } else {\r\n          tCont.setAttribute('width', 1);\r\n          tCont.setAttribute('height', 1);\r\n        }\r\n        tParent.appendChild(tCont);\r\n      } else {\r\n        this.innerElem.appendChild(tSpan);\r\n      }\r\n    } else {\r\n      tSpan.textContent = letters[i].val;\r\n      tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\r\n      if (!this.isMasked) {\r\n        this.innerElem.appendChild(tParent);\r\n        //\r\n        var tStyle = tSpan.style;\r\n        var tSpanTranslation = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)';\r\n        tStyle.transform = tSpanTranslation;\r\n        tStyle.webkitTransform = tSpanTranslation;\r\n      } else {\r\n        this.innerElem.appendChild(tSpan);\r\n      }\r\n    }\r\n    //\r\n    if (!this.isMasked) {\r\n      this.textSpans[cnt] = tParent;\r\n    } else {\r\n      this.textSpans[cnt] = tSpan;\r\n    }\r\n    this.textSpans[cnt].style.display = 'block';\r\n    this.textPaths[cnt] = tSpan;\r\n    cnt += 1;\r\n  }\r\n  while (cnt < this.textSpans.length) {\r\n    this.textSpans[cnt].style.display = 'none';\r\n    cnt += 1;\r\n  }\r\n};\r\n\r\nHTextElement.prototype.renderInnerContent = function () {\r\n  var svgStyle;\r\n  if (this.data.singleShape) {\r\n    if (!this._isFirstFrame && !this.lettersChangedFlag) {\r\n      return;\r\n    } if (this.isMasked && this.finalTransform._matMdf) {\r\n      // Todo Benchmark if using this is better than getBBox\r\n      this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH);\r\n      svgStyle = this.svgElement.style;\r\n      var translation = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';\r\n      svgStyle.transform = translation;\r\n      svgStyle.webkitTransform = translation;\r\n    }\r\n  }\r\n\r\n  this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\r\n  if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) {\r\n    return;\r\n  }\r\n  var i;\r\n  var len;\r\n  var count = 0;\r\n  var renderedLetters = this.textAnimator.renderedLetters;\r\n\r\n  var letters = this.textProperty.currentData.l;\r\n\r\n  len = letters.length;\r\n  var renderedLetter;\r\n  var textSpan;\r\n  var textPath;\r\n  for (i = 0; i < len; i += 1) {\r\n    if (letters[i].n) {\r\n      count += 1;\r\n    } else {\r\n      textSpan = this.textSpans[i];\r\n      textPath = this.textPaths[i];\r\n      renderedLetter = renderedLetters[count];\r\n      count += 1;\r\n      if (renderedLetter._mdf.m) {\r\n        if (!this.isMasked) {\r\n          textSpan.style.webkitTransform = renderedLetter.m;\r\n          textSpan.style.transform = renderedLetter.m;\r\n        } else {\r\n          textSpan.setAttribute('transform', renderedLetter.m);\r\n        }\r\n      }\r\n      /// /textSpan.setAttribute('opacity',renderedLetter.o);\r\n      textSpan.style.opacity = renderedLetter.o;\r\n      if (renderedLetter.sw && renderedLetter._mdf.sw) {\r\n        textPath.setAttribute('stroke-width', renderedLetter.sw);\r\n      }\r\n      if (renderedLetter.sc && renderedLetter._mdf.sc) {\r\n        textPath.setAttribute('stroke', renderedLetter.sc);\r\n      }\r\n      if (renderedLetter.fc && renderedLetter._mdf.fc) {\r\n        textPath.setAttribute('fill', renderedLetter.fc);\r\n        textPath.style.color = renderedLetter.fc;\r\n      }\r\n    }\r\n  }\r\n\r\n  if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) {\r\n    var boundingBox = this.innerElem.getBBox();\r\n\r\n    if (this.currentBBox.w !== boundingBox.width) {\r\n      this.currentBBox.w = boundingBox.width;\r\n      this.svgElement.setAttribute('width', boundingBox.width);\r\n    }\r\n    if (this.currentBBox.h !== boundingBox.height) {\r\n      this.currentBBox.h = boundingBox.height;\r\n      this.svgElement.setAttribute('height', boundingBox.height);\r\n    }\r\n\r\n    var margin = 1;\r\n    if (this.currentBBox.w !== (boundingBox.width + margin * 2) || this.currentBBox.h !== (boundingBox.height + margin * 2) || this.currentBBox.x !== (boundingBox.x - margin) || this.currentBBox.y !== (boundingBox.y - margin)) {\r\n      this.currentBBox.w = boundingBox.width + margin * 2;\r\n      this.currentBBox.h = boundingBox.height + margin * 2;\r\n      this.currentBBox.x = boundingBox.x - margin;\r\n      this.currentBBox.y = boundingBox.y - margin;\r\n\r\n      this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\r\n      svgStyle = this.svgElement.style;\r\n      var svgTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\r\n      svgStyle.transform = svgTransform;\r\n      svgStyle.webkitTransform = svgTransform;\r\n    }\r\n  }\r\n};\r\n\r\n/* global extendPrototype, BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement,\r\nFrameElement, RenderableElement, createNS */\r\n\r\nfunction HImageElement(data, globalData, comp) {\r\n  this.assetData = globalData.getAssetData(data.refId);\r\n  this.initElement(data, globalData, comp);\r\n}\r\n\r\nextendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement);\r\n\r\nHImageElement.prototype.createContent = function () {\r\n  var assetPath = this.globalData.getAssetsPath(this.assetData);\r\n  var img = new Image();\r\n\r\n  if (this.data.hasMask) {\r\n    this.imageElem = createNS('image');\r\n    this.imageElem.setAttribute('width', this.assetData.w + 'px');\r\n    this.imageElem.setAttribute('height', this.assetData.h + 'px');\r\n    this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\r\n    this.layerElement.appendChild(this.imageElem);\r\n    this.baseElement.setAttribute('width', this.assetData.w);\r\n    this.baseElement.setAttribute('height', this.assetData.h);\r\n  } else {\r\n    this.layerElement.appendChild(img);\r\n  }\r\n  img.crossOrigin = 'anonymous';\r\n  img.src = assetPath;\r\n  if (this.data.ln) {\r\n    this.baseElement.setAttribute('id', this.data.ln);\r\n  }\r\n};\r\n\r\n/* global PropertyFactory, degToRads, Matrix, extendPrototype, BaseElement, FrameElement, HierarchyElement */\r\n\r\nfunction HCameraElement(data, globalData, comp) {\r\n  this.initFrame();\r\n  this.initBaseData(data, globalData, comp);\r\n  this.initHierarchy();\r\n  var getProp = PropertyFactory.getProp;\r\n  this.pe = getProp(this, data.pe, 0, 0, this);\r\n  if (data.ks.p.s) {\r\n    this.px = getProp(this, data.ks.p.x, 1, 0, this);\r\n    this.py = getProp(this, data.ks.p.y, 1, 0, this);\r\n    this.pz = getProp(this, data.ks.p.z, 1, 0, this);\r\n  } else {\r\n    this.p = getProp(this, data.ks.p, 1, 0, this);\r\n  }\r\n  if (data.ks.a) {\r\n    this.a = getProp(this, data.ks.a, 1, 0, this);\r\n  }\r\n  if (data.ks.or.k.length && data.ks.or.k[0].to) {\r\n    var i;\r\n    var len = data.ks.or.k.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      data.ks.or.k[i].to = null;\r\n      data.ks.or.k[i].ti = null;\r\n    }\r\n  }\r\n  this.or = getProp(this, data.ks.or, 1, degToRads, this);\r\n  this.or.sh = true;\r\n  this.rx = getProp(this, data.ks.rx, 0, degToRads, this);\r\n  this.ry = getProp(this, data.ks.ry, 0, degToRads, this);\r\n  this.rz = getProp(this, data.ks.rz, 0, degToRads, this);\r\n  this.mat = new Matrix();\r\n  this._prevMat = new Matrix();\r\n  this._isFirstFrame = true;\r\n\r\n  // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.\r\n  this.finalTransform = {\r\n    mProp: this,\r\n  };\r\n}\r\nextendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);\r\n\r\nHCameraElement.prototype.setup = function () {\r\n  var i;\r\n  var len = this.comp.threeDElements.length;\r\n  var comp;\r\n  var perspectiveStyle;\r\n  var containerStyle;\r\n  for (i = 0; i < len; i += 1) {\r\n    // [perspectiveElem,container]\r\n    comp = this.comp.threeDElements[i];\r\n    if (comp.type === '3d') {\r\n      perspectiveStyle = comp.perspectiveElem.style;\r\n      containerStyle = comp.container.style;\r\n      var perspective = this.pe.v + 'px';\r\n      var origin = '0px 0px 0px';\r\n      var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\r\n      perspectiveStyle.perspective = perspective;\r\n      perspectiveStyle.webkitPerspective = perspective;\r\n      containerStyle.transformOrigin = origin;\r\n      containerStyle.mozTransformOrigin = origin;\r\n      containerStyle.webkitTransformOrigin = origin;\r\n      perspectiveStyle.transform = matrix;\r\n      perspectiveStyle.webkitTransform = matrix;\r\n    }\r\n  }\r\n};\r\n\r\nHCameraElement.prototype.createElements = function () {\r\n};\r\n\r\nHCameraElement.prototype.hide = function () {\r\n};\r\n\r\nHCameraElement.prototype.renderFrame = function () {\r\n  var _mdf = this._isFirstFrame;\r\n  var i;\r\n  var len;\r\n  if (this.hierarchy) {\r\n    len = this.hierarchy.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;\r\n    }\r\n  }\r\n  if (_mdf || this.pe._mdf || (this.p && this.p._mdf) || (this.px && (this.px._mdf || this.py._mdf || this.pz._mdf)) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || (this.a && this.a._mdf)) {\r\n    this.mat.reset();\r\n\r\n    if (this.hierarchy) {\r\n      len = this.hierarchy.length - 1;\r\n      for (i = len; i >= 0; i -= 1) {\r\n        var mTransf = this.hierarchy[i].finalTransform.mProp;\r\n        this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]);\r\n        this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);\r\n        this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);\r\n        this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]);\r\n        this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]);\r\n      }\r\n    }\r\n    if (this.p) {\r\n      this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]);\r\n    } else {\r\n      this.mat.translate(-this.px.v, -this.py.v, this.pz.v);\r\n    }\r\n    if (this.a) {\r\n      var diffVector;\r\n      if (this.p) {\r\n        diffVector = [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]];\r\n      } else {\r\n        diffVector = [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]];\r\n      }\r\n      var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2));\r\n      // var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));\r\n      var lookDir = [diffVector[0] / mag, diffVector[1] / mag, diffVector[2] / mag];\r\n      var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]);\r\n      var mRotationX = (Math.atan2(lookDir[1], lookLengthOnXZ));\r\n      var mRotationY = (Math.atan2(lookDir[0], -lookDir[2]));\r\n      this.mat.rotateY(mRotationY).rotateX(-mRotationX);\r\n    }\r\n    this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);\r\n    this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);\r\n    this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0);\r\n    this.mat.translate(0, 0, this.pe.v);\r\n\r\n    var hasMatrixChanged = !this._prevMat.equals(this.mat);\r\n    if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {\r\n      len = this.comp.threeDElements.length;\r\n      var comp;\r\n      var perspectiveStyle;\r\n      var containerStyle;\r\n      for (i = 0; i < len; i += 1) {\r\n        comp = this.comp.threeDElements[i];\r\n        if (comp.type === '3d') {\r\n          if (hasMatrixChanged) {\r\n            var matValue = this.mat.toCSS();\r\n            containerStyle = comp.container.style;\r\n            containerStyle.transform = matValue;\r\n            containerStyle.webkitTransform = matValue;\r\n          }\r\n          if (this.pe._mdf) {\r\n            perspectiveStyle = comp.perspectiveElem.style;\r\n            perspectiveStyle.perspective = this.pe.v + 'px';\r\n            perspectiveStyle.webkitPerspective = this.pe.v + 'px';\r\n          }\r\n        }\r\n      }\r\n      this.mat.clone(this._prevMat);\r\n    }\r\n  }\r\n  this._isFirstFrame = false;\r\n};\r\n\r\nHCameraElement.prototype.prepareFrame = function (num) {\r\n  this.prepareProperties(num, true);\r\n};\r\n\r\nHCameraElement.prototype.destroy = function () {\r\n};\r\nHCameraElement.prototype.getBaseElement = function () { return null; };\r\n\r\nfunction HEffects() {\r\n}\r\nHEffects.prototype.renderFrame = function () {};\r\n\r\n/* global createTag, AnimationItem */\r\n/* exported animationManager */\r\n\r\nvar animationManager = (function () {\r\n  var moduleOb = {};\r\n  var registeredAnimations = [];\r\n  var initTime = 0;\r\n  var len = 0;\r\n  var playingAnimationsNum = 0;\r\n  var _stopped = true;\r\n  var _isFrozen = false;\r\n\r\n  function removeElement(ev) {\r\n    var i = 0;\r\n    var animItem = ev.target;\r\n    while (i < len) {\r\n      if (registeredAnimations[i].animation === animItem) {\r\n        registeredAnimations.splice(i, 1);\r\n        i -= 1;\r\n        len -= 1;\r\n        if (!animItem.isPaused) {\r\n          subtractPlayingCount();\r\n        }\r\n      }\r\n      i += 1;\r\n    }\r\n  }\r\n\r\n  function registerAnimation(element, animationData) {\r\n    if (!element) {\r\n      return null;\r\n    }\r\n    var i = 0;\r\n    while (i < len) {\r\n      if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) {\r\n        return registeredAnimations[i].animation;\r\n      }\r\n      i += 1;\r\n    }\r\n    var animItem = new AnimationItem();\r\n    setupAnimation(animItem, element);\r\n    animItem.setData(element, animationData);\r\n    return animItem;\r\n  }\r\n\r\n  function getRegisteredAnimations() {\r\n    var i;\r\n    var lenAnims = registeredAnimations.length;\r\n    var animations = [];\r\n    for (i = 0; i < lenAnims; i += 1) {\r\n      animations.push(registeredAnimations[i].animation);\r\n    }\r\n    return animations;\r\n  }\r\n\r\n  function addPlayingCount() {\r\n    playingAnimationsNum += 1;\r\n    activate();\r\n  }\r\n\r\n  function subtractPlayingCount() {\r\n    playingAnimationsNum -= 1;\r\n  }\r\n\r\n  function setupAnimation(animItem, element) {\r\n    animItem.addEventListener('destroy', removeElement);\r\n    animItem.addEventListener('_active', addPlayingCount);\r\n    animItem.addEventListener('_idle', subtractPlayingCount);\r\n    registeredAnimations.push({ elem: element, animation: animItem });\r\n    len += 1;\r\n  }\r\n\r\n  function loadAnimation(params) {\r\n    var animItem = new AnimationItem();\r\n    setupAnimation(animItem, null);\r\n    animItem.setParams(params);\r\n    return animItem;\r\n  }\r\n\r\n  function setSpeed(val, animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.setSpeed(val, animation);\r\n    }\r\n  }\r\n\r\n  function setDirection(val, animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.setDirection(val, animation);\r\n    }\r\n  }\r\n\r\n  function play(animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.play(animation);\r\n    }\r\n  }\r\n  function resume(nowTime) {\r\n    var elapsedTime = nowTime - initTime;\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.advanceTime(elapsedTime);\r\n    }\r\n    initTime = nowTime;\r\n    if (playingAnimationsNum && !_isFrozen) {\r\n      window.requestAnimationFrame(resume);\r\n    } else {\r\n      _stopped = true;\r\n    }\r\n  }\r\n\r\n  function first(nowTime) {\r\n    initTime = nowTime;\r\n    window.requestAnimationFrame(resume);\r\n  }\r\n\r\n  function pause(animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.pause(animation);\r\n    }\r\n  }\r\n\r\n  function goToAndStop(value, isFrame, animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.goToAndStop(value, isFrame, animation);\r\n    }\r\n  }\r\n\r\n  function stop(animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.stop(animation);\r\n    }\r\n  }\r\n\r\n  function togglePause(animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.togglePause(animation);\r\n    }\r\n  }\r\n\r\n  function destroy(animation) {\r\n    var i;\r\n    for (i = (len - 1); i >= 0; i -= 1) {\r\n      registeredAnimations[i].animation.destroy(animation);\r\n    }\r\n  }\r\n\r\n  function searchAnimations(animationData, standalone, renderer) {\r\n    var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')),\r\n      [].slice.call(document.getElementsByClassName('bodymovin')));\r\n    var i;\r\n    var lenAnims = animElements.length;\r\n    for (i = 0; i < lenAnims; i += 1) {\r\n      if (renderer) {\r\n        animElements[i].setAttribute('data-bm-type', renderer);\r\n      }\r\n      registerAnimation(animElements[i], animationData);\r\n    }\r\n    if (standalone && lenAnims === 0) {\r\n      if (!renderer) {\r\n        renderer = 'svg';\r\n      }\r\n      var body = document.getElementsByTagName('body')[0];\r\n      body.innerText = '';\r\n      var div = createTag('div');\r\n      div.style.width = '100%';\r\n      div.style.height = '100%';\r\n      div.setAttribute('data-bm-type', renderer);\r\n      body.appendChild(div);\r\n      registerAnimation(div, animationData);\r\n    }\r\n  }\r\n\r\n  function resize() {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.resize();\r\n    }\r\n  }\r\n\r\n  function activate() {\r\n    if (!_isFrozen && playingAnimationsNum) {\r\n      if (_stopped) {\r\n        window.requestAnimationFrame(first);\r\n        _stopped = false;\r\n      }\r\n    }\r\n  }\r\n\r\n  function freeze() {\r\n    _isFrozen = true;\r\n  }\r\n\r\n  function unfreeze() {\r\n    _isFrozen = false;\r\n    activate();\r\n  }\r\n\r\n  function setVolume(val, animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.setVolume(val, animation);\r\n    }\r\n  }\r\n\r\n  function mute(animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.mute(animation);\r\n    }\r\n  }\r\n\r\n  function unmute(animation) {\r\n    var i;\r\n    for (i = 0; i < len; i += 1) {\r\n      registeredAnimations[i].animation.unmute(animation);\r\n    }\r\n  }\r\n\r\n  moduleOb.registerAnimation = registerAnimation;\r\n  moduleOb.loadAnimation = loadAnimation;\r\n  moduleOb.setSpeed = setSpeed;\r\n  moduleOb.setDirection = setDirection;\r\n  moduleOb.play = play;\r\n  moduleOb.pause = pause;\r\n  moduleOb.stop = stop;\r\n  moduleOb.togglePause = togglePause;\r\n  moduleOb.searchAnimations = searchAnimations;\r\n  moduleOb.resize = resize;\r\n  // moduleOb.start = start;\r\n  moduleOb.goToAndStop = goToAndStop;\r\n  moduleOb.destroy = destroy;\r\n  moduleOb.freeze = freeze;\r\n  moduleOb.unfreeze = unfreeze;\r\n  moduleOb.setVolume = setVolume;\r\n  moduleOb.mute = mute;\r\n  moduleOb.unmute = unmute;\r\n  moduleOb.getRegisteredAnimations = getRegisteredAnimations;\r\n  return moduleOb;\r\n}());\r\n\r\n/* global createElementID, subframeEnabled, ProjectInterface, ImagePreloader, audioControllerFactory, extendPrototype, BaseEvent,\r\nCanvasRenderer, SVGRenderer, HybridRenderer, assetLoader, dataManager, expressionsPlugin, BMEnterFrameEvent, BMCompleteLoopEvent,\r\nBMCompleteEvent, BMSegmentStartEvent, BMDestroyEvent, BMEnterFrameEvent, BMCompleteLoopEvent, BMCompleteEvent, BMSegmentStartEvent,\r\nBMDestroyEvent, BMRenderFrameErrorEvent, BMConfigErrorEvent, markerParser */\r\n\r\nvar AnimationItem = function () {\r\n  this._cbs = [];\r\n  this.name = '';\r\n  this.path = '';\r\n  this.isLoaded = false;\r\n  this.currentFrame = 0;\r\n  this.currentRawFrame = 0;\r\n  this.firstFrame = 0;\r\n  this.totalFrames = 0;\r\n  this.frameRate = 0;\r\n  this.frameMult = 0;\r\n  this.playSpeed = 1;\r\n  this.playDirection = 1;\r\n  this.playCount = 0;\r\n  this.animationData = {};\r\n  this.assets = [];\r\n  this.isPaused = true;\r\n  this.autoplay = false;\r\n  this.loop = true;\r\n  this.renderer = null;\r\n  this.animationID = createElementID();\r\n  this.assetsPath = '';\r\n  this.timeCompleted = 0;\r\n  this.segmentPos = 0;\r\n  this.isSubframeEnabled = subframeEnabled;\r\n  this.segments = [];\r\n  this._idle = true;\r\n  this._completedLoop = false;\r\n  this.projectInterface = ProjectInterface();\r\n  this.imagePreloader = new ImagePreloader();\r\n  this.audioController = audioControllerFactory();\r\n  this.markers = [];\r\n};\r\n\r\nextendPrototype([BaseEvent], AnimationItem);\r\n\r\nAnimationItem.prototype.setParams = function (params) {\r\n  if (params.wrapper || params.container) {\r\n    this.wrapper = params.wrapper || params.container;\r\n  }\r\n  var animType = 'svg';\r\n  if (params.animType) {\r\n    animType = params.animType;\r\n  } else if (params.renderer) {\r\n    animType = params.renderer;\r\n  }\r\n  switch (animType) {\r\n    case 'canvas':\r\n      this.renderer = new CanvasRenderer(this, params.rendererSettings);\r\n      break;\r\n    case 'svg':\r\n      this.renderer = new SVGRenderer(this, params.rendererSettings);\r\n      break;\r\n    default:\r\n      this.renderer = new HybridRenderer(this, params.rendererSettings);\r\n      break;\r\n  }\r\n  this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs);\r\n  this.renderer.setProjectInterface(this.projectInterface);\r\n  this.animType = animType;\r\n  if (params.loop === ''\r\n        || params.loop === null\r\n        || params.loop === undefined\r\n        || params.loop === true) {\r\n    this.loop = true;\r\n  } else if (params.loop === false) {\r\n    this.loop = false;\r\n  } else {\r\n    this.loop = parseInt(params.loop, 10);\r\n  }\r\n  this.autoplay = 'autoplay' in params ? params.autoplay : true;\r\n  this.name = params.name ? params.name : '';\r\n  this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments') ? params.autoloadSegments : true;\r\n  this.assetsPath = params.assetsPath;\r\n  this.initialSegment = params.initialSegment;\r\n  if (params.audioFactory) {\r\n    this.audioController.setAudioFactory(params.audioFactory);\r\n  }\r\n  if (params.animationData) {\r\n    this.configAnimation(params.animationData);\r\n  } else if (params.path) {\r\n    if (params.path.lastIndexOf('\\\\') !== -1) {\r\n      this.path = params.path.substr(0, params.path.lastIndexOf('\\\\') + 1);\r\n    } else {\r\n      this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1);\r\n    }\r\n    this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1);\r\n    this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'));\r\n\r\n    assetLoader.load(params.path, this.configAnimation.bind(this), function () {\r\n      this.trigger('data_failed');\r\n    }.bind(this));\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.setData = function (wrapper, animationData) {\r\n  if (animationData) {\r\n    if (typeof animationData !== 'object') {\r\n      animationData = JSON.parse(animationData);\r\n    }\r\n  }\r\n  var params = {\r\n    wrapper: wrapper,\r\n    animationData: animationData,\r\n  };\r\n  var wrapperAttributes = wrapper.attributes;\r\n\r\n  params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary\r\n    ? wrapperAttributes.getNamedItem('data-animation-path').value\r\n    : wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary\r\n      ? wrapperAttributes.getNamedItem('data-bm-path').value\r\n      : wrapperAttributes.getNamedItem('bm-path')\r\n        ? wrapperAttributes.getNamedItem('bm-path').value\r\n        : '';\r\n  params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary\r\n    ? wrapperAttributes.getNamedItem('data-anim-type').value\r\n    : wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary\r\n      ? wrapperAttributes.getNamedItem('data-bm-type').value\r\n      : wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary\r\n        ? wrapperAttributes.getNamedItem('bm-type').value\r\n        : wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary\r\n          ? wrapperAttributes.getNamedItem('data-bm-renderer').value\r\n          : wrapperAttributes.getNamedItem('bm-renderer')\r\n            ? wrapperAttributes.getNamedItem('bm-renderer').value\r\n            : 'canvas';\r\n\r\n  var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary\r\n    ? wrapperAttributes.getNamedItem('data-anim-loop').value\r\n    : wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary\r\n      ? wrapperAttributes.getNamedItem('data-bm-loop').value\r\n      : wrapperAttributes.getNamedItem('bm-loop')\r\n        ? wrapperAttributes.getNamedItem('bm-loop').value\r\n        : '';\r\n  if (loop === 'false') {\r\n    params.loop = false;\r\n  } else if (loop === 'true') {\r\n    params.loop = true;\r\n  } else if (loop !== '') {\r\n    params.loop = parseInt(loop, 10);\r\n  }\r\n  var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary\r\n    ? wrapperAttributes.getNamedItem('data-anim-autoplay').value\r\n    : wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary\r\n      ? wrapperAttributes.getNamedItem('data-bm-autoplay').value\r\n      : wrapperAttributes.getNamedItem('bm-autoplay')\r\n        ? wrapperAttributes.getNamedItem('bm-autoplay').value\r\n        : true;\r\n  params.autoplay = autoplay !== 'false';\r\n\r\n  params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary\r\n    ? wrapperAttributes.getNamedItem('data-name').value\r\n    : wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary\r\n      ? wrapperAttributes.getNamedItem('data-bm-name').value\r\n      : wrapperAttributes.getNamedItem('bm-name')\r\n        ? wrapperAttributes.getNamedItem('bm-name').value\r\n        : '';\r\n  var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary\r\n    ? wrapperAttributes.getNamedItem('data-anim-prerender').value\r\n    : wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary\r\n      ? wrapperAttributes.getNamedItem('data-bm-prerender').value\r\n      : wrapperAttributes.getNamedItem('bm-prerender')\r\n        ? wrapperAttributes.getNamedItem('bm-prerender').value\r\n        : '';\r\n\r\n  if (prerender === 'false') {\r\n    params.prerender = false;\r\n  }\r\n  this.setParams(params);\r\n};\r\n\r\nAnimationItem.prototype.includeLayers = function (data) {\r\n  if (data.op > this.animationData.op) {\r\n    this.animationData.op = data.op;\r\n    this.totalFrames = Math.floor(data.op - this.animationData.ip);\r\n  }\r\n  var layers = this.animationData.layers;\r\n  var i;\r\n  var len = layers.length;\r\n  var newLayers = data.layers;\r\n  var j;\r\n  var jLen = newLayers.length;\r\n  for (j = 0; j < jLen; j += 1) {\r\n    i = 0;\r\n    while (i < len) {\r\n      if (layers[i].id === newLayers[j].id) {\r\n        layers[i] = newLayers[j];\r\n        break;\r\n      }\r\n      i += 1;\r\n    }\r\n  }\r\n  if (data.chars || data.fonts) {\r\n    this.renderer.globalData.fontManager.addChars(data.chars);\r\n    this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);\r\n  }\r\n  if (data.assets) {\r\n    len = data.assets.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.animationData.assets.push(data.assets[i]);\r\n    }\r\n  }\r\n  this.animationData.__complete = false;\r\n  dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);\r\n  this.renderer.includeLayers(data.layers);\r\n  if (expressionsPlugin) {\r\n    expressionsPlugin.initExpressions(this);\r\n  }\r\n  this.loadNextSegment();\r\n};\r\n\r\nAnimationItem.prototype.loadNextSegment = function () {\r\n  var segments = this.animationData.segments;\r\n  if (!segments || segments.length === 0 || !this.autoloadSegments) {\r\n    this.trigger('data_ready');\r\n    this.timeCompleted = this.totalFrames;\r\n    return;\r\n  }\r\n  var segment = segments.shift();\r\n  this.timeCompleted = segment.time * this.frameRate;\r\n  var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json';\r\n  this.segmentPos += 1;\r\n  assetLoader.load(segmentPath, this.includeLayers.bind(this), function () {\r\n    this.trigger('data_failed');\r\n  }.bind(this));\r\n};\r\n\r\nAnimationItem.prototype.loadSegments = function () {\r\n  var segments = this.animationData.segments;\r\n  if (!segments) {\r\n    this.timeCompleted = this.totalFrames;\r\n  }\r\n  this.loadNextSegment();\r\n};\r\n\r\nAnimationItem.prototype.imagesLoaded = function () {\r\n  this.trigger('loaded_images');\r\n  this.checkLoaded();\r\n};\r\n\r\nAnimationItem.prototype.preloadImages = function () {\r\n  this.imagePreloader.setAssetsPath(this.assetsPath);\r\n  this.imagePreloader.setPath(this.path);\r\n  this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));\r\n};\r\n\r\nAnimationItem.prototype.configAnimation = function (animData) {\r\n  if (!this.renderer) {\r\n    return;\r\n  }\r\n  try {\r\n    this.animationData = animData;\r\n\r\n    if (this.initialSegment) {\r\n      this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]);\r\n      this.firstFrame = Math.round(this.initialSegment[0]);\r\n    } else {\r\n      this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);\r\n      this.firstFrame = Math.round(this.animationData.ip);\r\n    }\r\n    this.renderer.configAnimation(animData);\r\n    if (!animData.assets) {\r\n      animData.assets = [];\r\n    }\r\n\r\n    this.assets = this.animationData.assets;\r\n    this.frameRate = this.animationData.fr;\r\n    this.frameMult = this.animationData.fr / 1000;\r\n    this.renderer.searchExtraCompositions(animData.assets);\r\n    this.markers = markerParser(animData.markers || []);\r\n    this.trigger('config_ready');\r\n    this.preloadImages();\r\n    this.loadSegments();\r\n    this.updaFrameModifier();\r\n    this.waitForFontsLoaded();\r\n    if (this.isPaused) {\r\n      this.audioController.pause();\r\n    }\r\n  } catch (error) {\r\n    this.triggerConfigError(error);\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.waitForFontsLoaded = function () {\r\n  if (!this.renderer) {\r\n    return;\r\n  }\r\n  if (this.renderer.globalData.fontManager.isLoaded) {\r\n    this.checkLoaded();\r\n  } else {\r\n    setTimeout(this.waitForFontsLoaded.bind(this), 20);\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.checkLoaded = function () {\r\n  if (!this.isLoaded\r\n        && this.renderer.globalData.fontManager.isLoaded\r\n        && (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas')\r\n        && (this.imagePreloader.loadedFootages())\r\n  ) {\r\n    this.isLoaded = true;\r\n    dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);\r\n    if (expressionsPlugin) {\r\n      expressionsPlugin.initExpressions(this);\r\n    }\r\n    this.renderer.initItems();\r\n    setTimeout(function () {\r\n      this.trigger('DOMLoaded');\r\n    }.bind(this), 0);\r\n    this.gotoFrame();\r\n    if (this.autoplay) {\r\n      this.play();\r\n    }\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.resize = function () {\r\n  this.renderer.updateContainerSize();\r\n};\r\n\r\nAnimationItem.prototype.setSubframe = function (flag) {\r\n  this.isSubframeEnabled = !!flag;\r\n};\r\n\r\nAnimationItem.prototype.gotoFrame = function () {\r\n  this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame; // eslint-disable-line no-bitwise\r\n\r\n  if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {\r\n    this.currentFrame = this.timeCompleted;\r\n  }\r\n  this.trigger('enterFrame');\r\n  this.renderFrame();\r\n};\r\n\r\nAnimationItem.prototype.renderFrame = function () {\r\n  if (this.isLoaded === false || !this.renderer) {\r\n    return;\r\n  }\r\n  try {\r\n    this.renderer.renderFrame(this.currentFrame + this.firstFrame);\r\n  } catch (error) {\r\n    this.triggerRenderFrameError(error);\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.play = function (name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  if (this.isPaused === true) {\r\n    this.isPaused = false;\r\n    this.audioController.resume();\r\n    if (this._idle) {\r\n      this._idle = false;\r\n      this.trigger('_active');\r\n    }\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.pause = function (name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  if (this.isPaused === false) {\r\n    this.isPaused = true;\r\n    this._idle = true;\r\n    this.trigger('_idle');\r\n    this.audioController.pause();\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.togglePause = function (name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  if (this.isPaused === true) {\r\n    this.play();\r\n  } else {\r\n    this.pause();\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.stop = function (name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  this.pause();\r\n  this.playCount = 0;\r\n  this._completedLoop = false;\r\n  this.setCurrentRawFrameValue(0);\r\n};\r\n\r\nAnimationItem.prototype.getMarkerData = function (markerName) {\r\n  var marker;\r\n  for (var i = 0; i < this.markers.length; i += 1) {\r\n    marker = this.markers[i];\r\n    if (marker.payload && marker.payload.name === markerName) {\r\n      return marker;\r\n    }\r\n  }\r\n  return null;\r\n};\r\n\r\nAnimationItem.prototype.goToAndStop = function (value, isFrame, name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  var numValue = Number(value);\r\n  if (isNaN(numValue)) {\r\n    var marker = this.getMarkerData(value);\r\n    if (marker) {\r\n      this.goToAndStop(marker.time, true);\r\n    }\r\n  } else if (isFrame) {\r\n    this.setCurrentRawFrameValue(value);\r\n  } else {\r\n    this.setCurrentRawFrameValue(value * this.frameModifier);\r\n  }\r\n  this.pause();\r\n};\r\n\r\nAnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  var numValue = Number(value);\r\n  if (isNaN(numValue)) {\r\n    var marker = this.getMarkerData(value);\r\n    if (marker) {\r\n      if (!marker.duration) {\r\n        this.goToAndStop(marker.time, true);\r\n      } else {\r\n        this.playSegments([marker.time, marker.time + marker.duration], true);\r\n      }\r\n    }\r\n  } else {\r\n    this.goToAndStop(numValue, isFrame, name);\r\n  }\r\n  this.play();\r\n};\r\n\r\nAnimationItem.prototype.advanceTime = function (value) {\r\n  if (this.isPaused === true || this.isLoaded === false) {\r\n    return;\r\n  }\r\n  var nextValue = this.currentRawFrame + value * this.frameModifier;\r\n  var _isComplete = false;\r\n  // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.\r\n  // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.\r\n  if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {\r\n    if (!this.loop || this.playCount === this.loop) {\r\n      if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {\r\n        _isComplete = true;\r\n        nextValue = this.totalFrames - 1;\r\n      }\r\n    } else if (nextValue >= this.totalFrames) {\r\n      this.playCount += 1;\r\n      if (!this.checkSegments(nextValue % this.totalFrames)) {\r\n        this.setCurrentRawFrameValue(nextValue % this.totalFrames);\r\n        this._completedLoop = true;\r\n        this.trigger('loopComplete');\r\n      }\r\n    } else {\r\n      this.setCurrentRawFrameValue(nextValue);\r\n    }\r\n  } else if (nextValue < 0) {\r\n    if (!this.checkSegments(nextValue % this.totalFrames)) {\r\n      if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) { // eslint-disable-line no-plusplus\r\n        this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames));\r\n        if (!this._completedLoop) {\r\n          this._completedLoop = true;\r\n        } else {\r\n          this.trigger('loopComplete');\r\n        }\r\n      } else {\r\n        _isComplete = true;\r\n        nextValue = 0;\r\n      }\r\n    }\r\n  } else {\r\n    this.setCurrentRawFrameValue(nextValue);\r\n  }\r\n  if (_isComplete) {\r\n    this.setCurrentRawFrameValue(nextValue);\r\n    this.pause();\r\n    this.trigger('complete');\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.adjustSegment = function (arr, offset) {\r\n  this.playCount = 0;\r\n  if (arr[1] < arr[0]) {\r\n    if (this.frameModifier > 0) {\r\n      if (this.playSpeed < 0) {\r\n        this.setSpeed(-this.playSpeed);\r\n      } else {\r\n        this.setDirection(-1);\r\n      }\r\n    }\r\n    this.totalFrames = arr[0] - arr[1];\r\n    this.timeCompleted = this.totalFrames;\r\n    this.firstFrame = arr[1];\r\n    this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);\r\n  } else if (arr[1] > arr[0]) {\r\n    if (this.frameModifier < 0) {\r\n      if (this.playSpeed < 0) {\r\n        this.setSpeed(-this.playSpeed);\r\n      } else {\r\n        this.setDirection(1);\r\n      }\r\n    }\r\n    this.totalFrames = arr[1] - arr[0];\r\n    this.timeCompleted = this.totalFrames;\r\n    this.firstFrame = arr[0];\r\n    this.setCurrentRawFrameValue(0.001 + offset);\r\n  }\r\n  this.trigger('segmentStart');\r\n};\r\nAnimationItem.prototype.setSegment = function (init, end) {\r\n  var pendingFrame = -1;\r\n  if (this.isPaused) {\r\n    if (this.currentRawFrame + this.firstFrame < init) {\r\n      pendingFrame = init;\r\n    } else if (this.currentRawFrame + this.firstFrame > end) {\r\n      pendingFrame = end - init;\r\n    }\r\n  }\r\n\r\n  this.firstFrame = init;\r\n  this.totalFrames = end - init;\r\n  this.timeCompleted = this.totalFrames;\r\n  if (pendingFrame !== -1) {\r\n    this.goToAndStop(pendingFrame, true);\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.playSegments = function (arr, forceFlag) {\r\n  if (forceFlag) {\r\n    this.segments.length = 0;\r\n  }\r\n  if (typeof arr[0] === 'object') {\r\n    var i;\r\n    var len = arr.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      this.segments.push(arr[i]);\r\n    }\r\n  } else {\r\n    this.segments.push(arr);\r\n  }\r\n  if (this.segments.length && forceFlag) {\r\n    this.adjustSegment(this.segments.shift(), 0);\r\n  }\r\n  if (this.isPaused) {\r\n    this.play();\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.resetSegments = function (forceFlag) {\r\n  this.segments.length = 0;\r\n  this.segments.push([this.animationData.ip, this.animationData.op]);\r\n  // this.segments.push([this.animationData.ip*this.frameRate,Math.floor(this.animationData.op - this.animationData.ip+this.animationData.ip*this.frameRate)]);\r\n  if (forceFlag) {\r\n    this.checkSegments(0);\r\n  }\r\n};\r\nAnimationItem.prototype.checkSegments = function (offset) {\r\n  if (this.segments.length) {\r\n    this.adjustSegment(this.segments.shift(), offset);\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n\r\nAnimationItem.prototype.destroy = function (name) {\r\n  if ((name && this.name !== name) || !this.renderer) {\r\n    return;\r\n  }\r\n  this.renderer.destroy();\r\n  this.imagePreloader.destroy();\r\n  this.trigger('destroy');\r\n  this._cbs = null;\r\n  this.onEnterFrame = null;\r\n  this.onLoopComplete = null;\r\n  this.onComplete = null;\r\n  this.onSegmentStart = null;\r\n  this.onDestroy = null;\r\n  this.renderer = null;\r\n  this.renderer = null;\r\n  this.imagePreloader = null;\r\n  this.projectInterface = null;\r\n};\r\n\r\nAnimationItem.prototype.setCurrentRawFrameValue = function (value) {\r\n  this.currentRawFrame = value;\r\n  this.gotoFrame();\r\n};\r\n\r\nAnimationItem.prototype.setSpeed = function (val) {\r\n  this.playSpeed = val;\r\n  this.updaFrameModifier();\r\n};\r\n\r\nAnimationItem.prototype.setDirection = function (val) {\r\n  this.playDirection = val < 0 ? -1 : 1;\r\n  this.updaFrameModifier();\r\n};\r\n\r\nAnimationItem.prototype.setVolume = function (val, name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  this.audioController.setVolume(val);\r\n};\r\n\r\nAnimationItem.prototype.getVolume = function () {\r\n  return this.audioController.getVolume();\r\n};\r\n\r\nAnimationItem.prototype.mute = function (name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  this.audioController.mute();\r\n};\r\n\r\nAnimationItem.prototype.unmute = function (name) {\r\n  if (name && this.name !== name) {\r\n    return;\r\n  }\r\n  this.audioController.unmute();\r\n};\r\n\r\nAnimationItem.prototype.updaFrameModifier = function () {\r\n  this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;\r\n  this.audioController.setRate(this.playSpeed * this.playDirection);\r\n};\r\n\r\nAnimationItem.prototype.getPath = function () {\r\n  return this.path;\r\n};\r\n\r\nAnimationItem.prototype.getAssetsPath = function (assetData) {\r\n  var path = '';\r\n  if (assetData.e) {\r\n    path = assetData.p;\r\n  } else if (this.assetsPath) {\r\n    var imagePath = assetData.p;\r\n    if (imagePath.indexOf('images/') !== -1) {\r\n      imagePath = imagePath.split('/')[1];\r\n    }\r\n    path = this.assetsPath + imagePath;\r\n  } else {\r\n    path = this.path;\r\n    path += assetData.u ? assetData.u : '';\r\n    path += assetData.p;\r\n  }\r\n  return path;\r\n};\r\n\r\nAnimationItem.prototype.getAssetData = function (id) {\r\n  var i = 0;\r\n  var len = this.assets.length;\r\n  while (i < len) {\r\n    if (id === this.assets[i].id) {\r\n      return this.assets[i];\r\n    }\r\n    i += 1;\r\n  }\r\n  return null;\r\n};\r\n\r\nAnimationItem.prototype.hide = function () {\r\n  this.renderer.hide();\r\n};\r\n\r\nAnimationItem.prototype.show = function () {\r\n  this.renderer.show();\r\n};\r\n\r\nAnimationItem.prototype.getDuration = function (isFrame) {\r\n  return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;\r\n};\r\n\r\nAnimationItem.prototype.trigger = function (name) {\r\n  if (this._cbs && this._cbs[name]) {\r\n    switch (name) {\r\n      case 'enterFrame':\r\n        this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier));\r\n        break;\r\n      case 'loopComplete':\r\n        this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\r\n        break;\r\n      case 'complete':\r\n        this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult));\r\n        break;\r\n      case 'segmentStart':\r\n        this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\r\n        break;\r\n      case 'destroy':\r\n        this.triggerEvent(name, new BMDestroyEvent(name, this));\r\n        break;\r\n      default:\r\n        this.triggerEvent(name);\r\n    }\r\n  }\r\n  if (name === 'enterFrame' && this.onEnterFrame) {\r\n    this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult));\r\n  }\r\n  if (name === 'loopComplete' && this.onLoopComplete) {\r\n    this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\r\n  }\r\n  if (name === 'complete' && this.onComplete) {\r\n    this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult));\r\n  }\r\n  if (name === 'segmentStart' && this.onSegmentStart) {\r\n    this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\r\n  }\r\n  if (name === 'destroy' && this.onDestroy) {\r\n    this.onDestroy.call(this, new BMDestroyEvent(name, this));\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.triggerRenderFrameError = function (nativeError) {\r\n  var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame);\r\n  this.triggerEvent('error', error);\r\n\r\n  if (this.onError) {\r\n    this.onError.call(this, error);\r\n  }\r\n};\r\n\r\nAnimationItem.prototype.triggerConfigError = function (nativeError) {\r\n  var error = new BMConfigErrorEvent(nativeError, this.currentFrame);\r\n  this.triggerEvent('error', error);\r\n\r\n  if (this.onError) {\r\n    this.onError.call(this, error);\r\n  }\r\n};\r\n\r\n/* global CompExpressionInterface, expressionsPlugin: writable */\r\n/* exported expressionsPlugin */\r\n\r\nvar Expressions = (function () {\r\n  var ob = {};\r\n  ob.initExpressions = initExpressions;\r\n\r\n  function initExpressions(animation) {\r\n    var stackCount = 0;\r\n    var registers = [];\r\n\r\n    function pushExpression() {\r\n      stackCount += 1;\r\n    }\r\n\r\n    function popExpression() {\r\n      stackCount -= 1;\r\n      if (stackCount === 0) {\r\n        releaseInstances();\r\n      }\r\n    }\r\n\r\n    function registerExpressionProperty(expression) {\r\n      if (registers.indexOf(expression) === -1) {\r\n        registers.push(expression);\r\n      }\r\n    }\r\n\r\n    function releaseInstances() {\r\n      var i;\r\n      var len = registers.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        registers[i].release();\r\n      }\r\n      registers.length = 0;\r\n    }\r\n\r\n    animation.renderer.compInterface = CompExpressionInterface(animation.renderer);\r\n    animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);\r\n    animation.renderer.globalData.pushExpression = pushExpression;\r\n    animation.renderer.globalData.popExpression = popExpression;\r\n    animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;\r\n  }\r\n  return ob;\r\n}());\r\n\r\nexpressionsPlugin = Expressions;\r\n\r\n/* eslint-disable camelcase, no-unused-vars */\r\n/* global BMMath, BezierFactory, createTypedArray, degToRads, shapePool */\r\n\r\nvar ExpressionManager = (function () {\r\n  'use strict';\r\n\r\n  var ob = {};\r\n  var Math = BMMath;\r\n  var window = null;\r\n  var document = null;\r\n  var XMLHttpRequest = null;\r\n  var fetch = null;\r\n\r\n  function $bm_isInstanceOfArray(arr) {\r\n    return arr.constructor === Array || arr.constructor === Float32Array;\r\n  }\r\n\r\n  function isNumerable(tOfV, v) {\r\n    return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number;\r\n  }\r\n\r\n  function $bm_neg(a) {\r\n    var tOfA = typeof a;\r\n    if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) {\r\n      return -a;\r\n    }\r\n    if ($bm_isInstanceOfArray(a)) {\r\n      var i;\r\n      var lenA = a.length;\r\n      var retArr = [];\r\n      for (i = 0; i < lenA; i += 1) {\r\n        retArr[i] = -a[i];\r\n      }\r\n      return retArr;\r\n    }\r\n    if (a.propType) {\r\n      return a.v;\r\n    }\r\n    return -a;\r\n  }\r\n\r\n  var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get;\r\n  var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get;\r\n  var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get;\r\n\r\n  function sum(a, b) {\r\n    var tOfA = typeof a;\r\n    var tOfB = typeof b;\r\n    if (tOfA === 'string' || tOfB === 'string') {\r\n      return a + b;\r\n    }\r\n    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n      return a + b;\r\n    }\r\n    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n      a = a.slice(0);\r\n      a[0] += b;\r\n      return a;\r\n    }\r\n    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n      b = b.slice(0);\r\n      b[0] = a + b[0];\r\n      return b;\r\n    }\r\n    if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\r\n      var i = 0;\r\n      var lenA = a.length;\r\n      var lenB = b.length;\r\n      var retArr = [];\r\n      while (i < lenA || i < lenB) {\r\n        if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\r\n          retArr[i] = a[i] + b[i];\r\n        } else {\r\n          retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\r\n        }\r\n        i += 1;\r\n      }\r\n      return retArr;\r\n    }\r\n    return 0;\r\n  }\r\n  var add = sum;\r\n\r\n  function sub(a, b) {\r\n    var tOfA = typeof a;\r\n    var tOfB = typeof b;\r\n    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n      if (tOfA === 'string') {\r\n        a = parseInt(a, 10);\r\n      }\r\n      if (tOfB === 'string') {\r\n        b = parseInt(b, 10);\r\n      }\r\n      return a - b;\r\n    }\r\n    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n      a = a.slice(0);\r\n      a[0] -= b;\r\n      return a;\r\n    }\r\n    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n      b = b.slice(0);\r\n      b[0] = a - b[0];\r\n      return b;\r\n    }\r\n    if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\r\n      var i = 0;\r\n      var lenA = a.length;\r\n      var lenB = b.length;\r\n      var retArr = [];\r\n      while (i < lenA || i < lenB) {\r\n        if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\r\n          retArr[i] = a[i] - b[i];\r\n        } else {\r\n          retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\r\n        }\r\n        i += 1;\r\n      }\r\n      return retArr;\r\n    }\r\n    return 0;\r\n  }\r\n\r\n  function mul(a, b) {\r\n    var tOfA = typeof a;\r\n    var tOfB = typeof b;\r\n    var arr;\r\n    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n      return a * b;\r\n    }\r\n\r\n    var i;\r\n    var len;\r\n    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n      len = a.length;\r\n      arr = createTypedArray('float32', len);\r\n      for (i = 0; i < len; i += 1) {\r\n        arr[i] = a[i] * b;\r\n      }\r\n      return arr;\r\n    }\r\n    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n      len = b.length;\r\n      arr = createTypedArray('float32', len);\r\n      for (i = 0; i < len; i += 1) {\r\n        arr[i] = a * b[i];\r\n      }\r\n      return arr;\r\n    }\r\n    return 0;\r\n  }\r\n\r\n  function div(a, b) {\r\n    var tOfA = typeof a;\r\n    var tOfB = typeof b;\r\n    var arr;\r\n    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n      return a / b;\r\n    }\r\n    var i;\r\n    var len;\r\n    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n      len = a.length;\r\n      arr = createTypedArray('float32', len);\r\n      for (i = 0; i < len; i += 1) {\r\n        arr[i] = a[i] / b;\r\n      }\r\n      return arr;\r\n    }\r\n    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n      len = b.length;\r\n      arr = createTypedArray('float32', len);\r\n      for (i = 0; i < len; i += 1) {\r\n        arr[i] = a / b[i];\r\n      }\r\n      return arr;\r\n    }\r\n    return 0;\r\n  }\r\n  function mod(a, b) {\r\n    if (typeof a === 'string') {\r\n      a = parseInt(a, 10);\r\n    }\r\n    if (typeof b === 'string') {\r\n      b = parseInt(b, 10);\r\n    }\r\n    return a % b;\r\n  }\r\n  var $bm_sum = sum;\r\n  var $bm_sub = sub;\r\n  var $bm_mul = mul;\r\n  var $bm_div = div;\r\n  var $bm_mod = mod;\r\n\r\n  function clamp(num, min, max) {\r\n    if (min > max) {\r\n      var mm = max;\r\n      max = min;\r\n      min = mm;\r\n    }\r\n    return Math.min(Math.max(num, min), max);\r\n  }\r\n\r\n  function radiansToDegrees(val) {\r\n    return val / degToRads;\r\n  }\r\n  var radians_to_degrees = radiansToDegrees;\r\n\r\n  function degreesToRadians(val) {\r\n    return val * degToRads;\r\n  }\r\n  var degrees_to_radians = radiansToDegrees;\r\n\r\n  var helperLengthArray = [0, 0, 0, 0, 0, 0];\r\n\r\n  function length(arr1, arr2) {\r\n    if (typeof arr1 === 'number' || arr1 instanceof Number) {\r\n      arr2 = arr2 || 0;\r\n      return Math.abs(arr1 - arr2);\r\n    }\r\n    if (!arr2) {\r\n      arr2 = helperLengthArray;\r\n    }\r\n    var i;\r\n    var len = Math.min(arr1.length, arr2.length);\r\n    var addedLength = 0;\r\n    for (i = 0; i < len; i += 1) {\r\n      addedLength += Math.pow(arr2[i] - arr1[i], 2);\r\n    }\r\n    return Math.sqrt(addedLength);\r\n  }\r\n\r\n  function normalize(vec) {\r\n    return div(vec, length(vec));\r\n  }\r\n\r\n  function rgbToHsl(val) {\r\n    var r = val[0]; var g = val[1]; var b = val[2];\r\n    var max = Math.max(r, g, b);\r\n    var min = Math.min(r, g, b);\r\n    var h;\r\n    var s;\r\n    var l = (max + min) / 2;\r\n\r\n    if (max === min) {\r\n      h = 0; // achromatic\r\n      s = 0; // achromatic\r\n    } else {\r\n      var d = max - min;\r\n      s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\r\n      switch (max) {\r\n        case r: h = (g - b) / d + (g < b ? 6 : 0); break;\r\n        case g: h = (b - r) / d + 2; break;\r\n        case b: h = (r - g) / d + 4; break;\r\n        default: break;\r\n      }\r\n      h /= 6;\r\n    }\r\n\r\n    return [h, s, l, val[3]];\r\n  }\r\n\r\n  function hue2rgb(p, q, t) {\r\n    if (t < 0) t += 1;\r\n    if (t > 1) t -= 1;\r\n    if (t < 1 / 6) return p + (q - p) * 6 * t;\r\n    if (t < 1 / 2) return q;\r\n    if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\r\n    return p;\r\n  }\r\n\r\n  function hslToRgb(val) {\r\n    var h = val[0];\r\n    var s = val[1];\r\n    var l = val[2];\r\n\r\n    var r;\r\n    var g;\r\n    var b;\r\n\r\n    if (s === 0) {\r\n      r = l; // achromatic\r\n      b = l; // achromatic\r\n      g = l; // achromatic\r\n    } else {\r\n      var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n      var p = 2 * l - q;\r\n      r = hue2rgb(p, q, h + 1 / 3);\r\n      g = hue2rgb(p, q, h);\r\n      b = hue2rgb(p, q, h - 1 / 3);\r\n    }\r\n\r\n    return [r, g, b, val[3]];\r\n  }\r\n\r\n  function linear(t, tMin, tMax, value1, value2) {\r\n    if (value1 === undefined || value2 === undefined) {\r\n      value1 = tMin;\r\n      value2 = tMax;\r\n      tMin = 0;\r\n      tMax = 1;\r\n    }\r\n    if (tMax < tMin) {\r\n      var _tMin = tMax;\r\n      tMax = tMin;\r\n      tMin = _tMin;\r\n    }\r\n    if (t <= tMin) {\r\n      return value1;\r\n    } if (t >= tMax) {\r\n      return value2;\r\n    }\r\n    var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin);\r\n    if (!value1.length) {\r\n      return value1 + (value2 - value1) * perc;\r\n    }\r\n    var i;\r\n    var len = value1.length;\r\n    var arr = createTypedArray('float32', len);\r\n    for (i = 0; i < len; i += 1) {\r\n      arr[i] = value1[i] + (value2[i] - value1[i]) * perc;\r\n    }\r\n    return arr;\r\n  }\r\n  function random(min, max) {\r\n    if (max === undefined) {\r\n      if (min === undefined) {\r\n        min = 0;\r\n        max = 1;\r\n      } else {\r\n        max = min;\r\n        min = undefined;\r\n      }\r\n    }\r\n    if (max.length) {\r\n      var i;\r\n      var len = max.length;\r\n      if (!min) {\r\n        min = createTypedArray('float32', len);\r\n      }\r\n      var arr = createTypedArray('float32', len);\r\n      var rnd = BMMath.random();\r\n      for (i = 0; i < len; i += 1) {\r\n        arr[i] = min[i] + rnd * (max[i] - min[i]);\r\n      }\r\n      return arr;\r\n    }\r\n    if (min === undefined) {\r\n      min = 0;\r\n    }\r\n    var rndm = BMMath.random();\r\n    return min + rndm * (max - min);\r\n  }\r\n\r\n  function createPath(points, inTangents, outTangents, closed) {\r\n    var i;\r\n    var len = points.length;\r\n    var path = shapePool.newElement();\r\n    path.setPathData(!!closed, len);\r\n    var arrPlaceholder = [0, 0];\r\n    var inVertexPoint;\r\n    var outVertexPoint;\r\n    for (i = 0; i < len; i += 1) {\r\n      inVertexPoint = (inTangents && inTangents[i]) ? inTangents[i] : arrPlaceholder;\r\n      outVertexPoint = (outTangents && outTangents[i]) ? outTangents[i] : arrPlaceholder;\r\n      path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true);\r\n    }\r\n    return path;\r\n  }\r\n\r\n  function initiateExpression(elem, data, property) {\r\n    var val = data.x;\r\n    var needsVelocity = /velocity(?![\\w\\d])/.test(val);\r\n    var _needsRandom = val.indexOf('random') !== -1;\r\n    var elemType = elem.data.ty;\r\n    var transform;\r\n    var $bm_transform;\r\n    var content;\r\n    var effect;\r\n    var thisProperty = property;\r\n    thisProperty.valueAtTime = thisProperty.getValueAtTime;\r\n    Object.defineProperty(thisProperty, 'value', {\r\n      get: function () {\r\n        return thisProperty.v;\r\n      },\r\n    });\r\n    elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate;\r\n    elem.comp.displayStartTime = 0;\r\n    var inPoint = elem.data.ip / elem.comp.globalData.frameRate;\r\n    var outPoint = elem.data.op / elem.comp.globalData.frameRate;\r\n    var width = elem.data.sw ? elem.data.sw : 0;\r\n    var height = elem.data.sh ? elem.data.sh : 0;\r\n    var name = elem.data.nm;\r\n    var loopIn;\r\n    var loop_in;\r\n    var loopOut;\r\n    var loop_out;\r\n    var smooth;\r\n    var toWorld;\r\n    var fromWorld;\r\n    var fromComp;\r\n    var toComp;\r\n    var fromCompToSurface;\r\n    var position;\r\n    var rotation;\r\n    var anchorPoint;\r\n    var scale;\r\n    var thisLayer;\r\n    var thisComp;\r\n    var mask;\r\n    var valueAtTime;\r\n    var velocityAtTime;\r\n\r\n    var scoped_bm_rt;\r\n    // val = val.replace(/(\\\\?\"|')((http)(s)?(:\\/))?\\/.*?(\\\\?\"|')/g, \"\\\"\\\"\"); // deter potential network calls\r\n    var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0]; // eslint-disable-line no-eval\r\n    var numKeys = property.kf ? data.k.length : 0;\r\n\r\n    var active = !this.data || this.data.hd !== true;\r\n\r\n    var wiggle = function wiggle(freq, amp) {\r\n      var iWiggle;\r\n      var j;\r\n      var lenWiggle = this.pv.length ? this.pv.length : 1;\r\n      var addedAmps = createTypedArray('float32', lenWiggle);\r\n      freq = 5;\r\n      var iterations = Math.floor(time * freq);\r\n      iWiggle = 0;\r\n      j = 0;\r\n      while (iWiggle < iterations) {\r\n        // var rnd = BMMath.random();\r\n        for (j = 0; j < lenWiggle; j += 1) {\r\n          addedAmps[j] += -amp + amp * 2 * BMMath.random();\r\n          // addedAmps[j] += -amp + amp*2*rnd;\r\n        }\r\n        iWiggle += 1;\r\n      }\r\n      // var rnd2 = BMMath.random();\r\n      var periods = time * freq;\r\n      var perc = periods - Math.floor(periods);\r\n      var arr = createTypedArray('float32', lenWiggle);\r\n      if (lenWiggle > 1) {\r\n        for (j = 0; j < lenWiggle; j += 1) {\r\n          arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc;\r\n          // arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;\r\n          // arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);\r\n        }\r\n        return arr;\r\n      }\r\n      return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc;\r\n    }.bind(this);\r\n\r\n    if (thisProperty.loopIn) {\r\n      loopIn = thisProperty.loopIn.bind(thisProperty);\r\n      loop_in = loopIn;\r\n    }\r\n\r\n    if (thisProperty.loopOut) {\r\n      loopOut = thisProperty.loopOut.bind(thisProperty);\r\n      loop_out = loopOut;\r\n    }\r\n\r\n    if (thisProperty.smooth) {\r\n      smooth = thisProperty.smooth.bind(thisProperty);\r\n    }\r\n\r\n    function loopInDuration(type, duration) {\r\n      return loopIn(type, duration, true);\r\n    }\r\n\r\n    function loopOutDuration(type, duration) {\r\n      return loopOut(type, duration, true);\r\n    }\r\n\r\n    if (this.getValueAtTime) {\r\n      valueAtTime = this.getValueAtTime.bind(this);\r\n    }\r\n\r\n    if (this.getVelocityAtTime) {\r\n      velocityAtTime = this.getVelocityAtTime.bind(this);\r\n    }\r\n\r\n    var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);\r\n\r\n    function lookAt(elem1, elem2) {\r\n      var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]];\r\n      var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads;\r\n      var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads;\r\n      return [yaw, pitch, 0];\r\n    }\r\n\r\n    function easeOut(t, tMin, tMax, val1, val2) {\r\n      return applyEase(easeOutBez, t, tMin, tMax, val1, val2);\r\n    }\r\n\r\n    function easeIn(t, tMin, tMax, val1, val2) {\r\n      return applyEase(easeInBez, t, tMin, tMax, val1, val2);\r\n    }\r\n\r\n    function ease(t, tMin, tMax, val1, val2) {\r\n      return applyEase(easeInOutBez, t, tMin, tMax, val1, val2);\r\n    }\r\n\r\n    function applyEase(fn, t, tMin, tMax, val1, val2) {\r\n      if (val1 === undefined) {\r\n        val1 = tMin;\r\n        val2 = tMax;\r\n      } else {\r\n        t = (t - tMin) / (tMax - tMin);\r\n      }\r\n      if (t > 1) {\r\n        t = 1;\r\n      } else if (t < 0) {\r\n        t = 0;\r\n      }\r\n      var mult = fn(t);\r\n      if ($bm_isInstanceOfArray(val1)) {\r\n        var iKey;\r\n        var lenKey = val1.length;\r\n        var arr = createTypedArray('float32', lenKey);\r\n        for (iKey = 0; iKey < lenKey; iKey += 1) {\r\n          arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey];\r\n        }\r\n        return arr;\r\n      }\r\n      return (val2 - val1) * mult + val1;\r\n    }\r\n\r\n    function nearestKey(time) {\r\n      var iKey;\r\n      var lenKey = data.k.length;\r\n      var index;\r\n      var keyTime;\r\n      if (!data.k.length || typeof (data.k[0]) === 'number') {\r\n        index = 0;\r\n        keyTime = 0;\r\n      } else {\r\n        index = -1;\r\n        time *= elem.comp.globalData.frameRate;\r\n        if (time < data.k[0].t) {\r\n          index = 1;\r\n          keyTime = data.k[0].t;\r\n        } else {\r\n          for (iKey = 0; iKey < lenKey - 1; iKey += 1) {\r\n            if (time === data.k[iKey].t) {\r\n              index = iKey + 1;\r\n              keyTime = data.k[iKey].t;\r\n              break;\r\n            } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) {\r\n              if (time - data.k[iKey].t > data.k[iKey + 1].t - time) {\r\n                index = iKey + 2;\r\n                keyTime = data.k[iKey + 1].t;\r\n              } else {\r\n                index = iKey + 1;\r\n                keyTime = data.k[iKey].t;\r\n              }\r\n              break;\r\n            }\r\n          }\r\n          if (index === -1) {\r\n            index = iKey + 1;\r\n            keyTime = data.k[iKey].t;\r\n          }\r\n        }\r\n      }\r\n      var obKey = {};\r\n      obKey.index = index;\r\n      obKey.time = keyTime / elem.comp.globalData.frameRate;\r\n      return obKey;\r\n    }\r\n\r\n    function key(ind) {\r\n      var obKey;\r\n      var iKey;\r\n      var lenKey;\r\n      if (!data.k.length || typeof (data.k[0]) === 'number') {\r\n        throw new Error('The property has no keyframe at index ' + ind);\r\n      }\r\n      ind -= 1;\r\n      obKey = {\r\n        time: data.k[ind].t / elem.comp.globalData.frameRate,\r\n        value: [],\r\n      };\r\n      var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e;\r\n\r\n      lenKey = arr.length;\r\n      for (iKey = 0; iKey < lenKey; iKey += 1) {\r\n        obKey[iKey] = arr[iKey];\r\n        obKey.value[iKey] = arr[iKey];\r\n      }\r\n      return obKey;\r\n    }\r\n\r\n    function framesToTime(frames, fps) {\r\n      if (!fps) {\r\n        fps = elem.comp.globalData.frameRate;\r\n      }\r\n      return frames / fps;\r\n    }\r\n\r\n    function timeToFrames(t, fps) {\r\n      if (!t && t !== 0) {\r\n        t = time;\r\n      }\r\n      if (!fps) {\r\n        fps = elem.comp.globalData.frameRate;\r\n      }\r\n      return t * fps;\r\n    }\r\n\r\n    function seedRandom(seed) {\r\n      BMMath.seedrandom(randSeed + seed);\r\n    }\r\n\r\n    function sourceRectAtTime() {\r\n      return elem.sourceRectAtTime();\r\n    }\r\n\r\n    function substring(init, end) {\r\n      if (typeof value === 'string') {\r\n        if (end === undefined) {\r\n          return value.substring(init);\r\n        }\r\n        return value.substring(init, end);\r\n      }\r\n      return '';\r\n    }\r\n\r\n    function substr(init, end) {\r\n      if (typeof value === 'string') {\r\n        if (end === undefined) {\r\n          return value.substr(init);\r\n        }\r\n        return value.substr(init, end);\r\n      }\r\n      return '';\r\n    }\r\n\r\n    function posterizeTime(framesPerSecond) {\r\n      time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond;\r\n      value = valueAtTime(time);\r\n    }\r\n\r\n    var time;\r\n    var velocity;\r\n    var value;\r\n    var text;\r\n    var textIndex;\r\n    var textTotal;\r\n    var selectorValue;\r\n    var index = elem.data.ind;\r\n    var hasParent = !!(elem.hierarchy && elem.hierarchy.length);\r\n    var parent;\r\n    var randSeed = Math.floor(Math.random() * 1000000);\r\n    var globalData = elem.globalData;\r\n    function executeExpression(_value) {\r\n      // globalData.pushExpression();\r\n      value = _value;\r\n      if (_needsRandom) {\r\n        seedRandom(randSeed);\r\n      }\r\n      if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {\r\n        return value;\r\n      }\r\n      if (this.propType === 'textSelector') {\r\n        textIndex = this.textIndex;\r\n        textTotal = this.textTotal;\r\n        selectorValue = this.selectorValue;\r\n      }\r\n      if (!thisLayer) {\r\n        text = elem.layerInterface.text;\r\n        thisLayer = elem.layerInterface;\r\n        thisComp = elem.comp.compInterface;\r\n        toWorld = thisLayer.toWorld.bind(thisLayer);\r\n        fromWorld = thisLayer.fromWorld.bind(thisLayer);\r\n        fromComp = thisLayer.fromComp.bind(thisLayer);\r\n        toComp = thisLayer.toComp.bind(thisLayer);\r\n        mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;\r\n        fromCompToSurface = fromComp;\r\n      }\r\n      if (!transform) {\r\n        transform = elem.layerInterface('ADBE Transform Group');\r\n        $bm_transform = transform;\r\n        if (transform) {\r\n          anchorPoint = transform.anchorPoint;\r\n          /* position = transform.position;\r\n                    rotation = transform.rotation;\r\n                    scale = transform.scale; */\r\n        }\r\n      }\r\n\r\n      if (elemType === 4 && !content) {\r\n        content = thisLayer('ADBE Root Vectors Group');\r\n      }\r\n      if (!effect) {\r\n        effect = thisLayer(4);\r\n      }\r\n      hasParent = !!(elem.hierarchy && elem.hierarchy.length);\r\n      if (hasParent && !parent) {\r\n        parent = elem.hierarchy[0].layerInterface;\r\n      }\r\n      time = this.comp.renderedFrame / this.comp.globalData.frameRate;\r\n      if (needsVelocity) {\r\n        velocity = velocityAtTime(time);\r\n      }\r\n      expression_function();\r\n      this.frameExpressionId = elem.globalData.frameId;\r\n\r\n      // TODO: Check if it's possible to return on ShapeInterface the .v value\r\n      if (scoped_bm_rt.propType === 'shape') {\r\n        scoped_bm_rt = scoped_bm_rt.v;\r\n      }\r\n      // globalData.popExpression();\r\n      return scoped_bm_rt;\r\n    }\r\n    return executeExpression;\r\n  }\r\n\r\n  ob.initiateExpression = initiateExpression;\r\n  return ob;\r\n}());\r\n\r\n/* global ExpressionManager, createTypedArray */\r\n/* exported expressionHelpers */\r\n\r\nvar expressionHelpers = (function () {\r\n  function searchExpressions(elem, data, prop) {\r\n    if (data.x) {\r\n      prop.k = true;\r\n      prop.x = true;\r\n      prop.initiateExpression = ExpressionManager.initiateExpression;\r\n      prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop));\r\n    }\r\n  }\r\n\r\n  function getValueAtTime(frameNum) {\r\n    frameNum *= this.elem.globalData.frameRate;\r\n    frameNum -= this.offsetTime;\r\n    if (frameNum !== this._cachingAtTime.lastFrame) {\r\n      this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;\r\n      this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);\r\n      this._cachingAtTime.lastFrame = frameNum;\r\n    }\r\n    return this._cachingAtTime.value;\r\n  }\r\n\r\n  function getSpeedAtTime(frameNum) {\r\n    var delta = -0.01;\r\n    var v1 = this.getValueAtTime(frameNum);\r\n    var v2 = this.getValueAtTime(frameNum + delta);\r\n    var speed = 0;\r\n    if (v1.length) {\r\n      var i;\r\n      for (i = 0; i < v1.length; i += 1) {\r\n        speed += Math.pow(v2[i] - v1[i], 2);\r\n      }\r\n      speed = Math.sqrt(speed) * 100;\r\n    } else {\r\n      speed = 0;\r\n    }\r\n    return speed;\r\n  }\r\n\r\n  function getVelocityAtTime(frameNum) {\r\n    if (this.vel !== undefined) {\r\n      return this.vel;\r\n    }\r\n    var delta = -0.001;\r\n    // frameNum += this.elem.data.st;\r\n    var v1 = this.getValueAtTime(frameNum);\r\n    var v2 = this.getValueAtTime(frameNum + delta);\r\n    var velocity;\r\n    if (v1.length) {\r\n      velocity = createTypedArray('float32', v1.length);\r\n      var i;\r\n      for (i = 0; i < v1.length; i += 1) {\r\n        // removing frameRate\r\n        // if needed, don't add it here\r\n        // velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);\r\n        velocity[i] = (v2[i] - v1[i]) / delta;\r\n      }\r\n    } else {\r\n      velocity = (v2 - v1) / delta;\r\n    }\r\n    return velocity;\r\n  }\r\n\r\n  function getStaticValueAtTime() {\r\n    return this.pv;\r\n  }\r\n\r\n  function setGroupProperty(propertyGroup) {\r\n    this.propertyGroup = propertyGroup;\r\n  }\r\n\r\n  return {\r\n    searchExpressions: searchExpressions,\r\n    getSpeedAtTime: getSpeedAtTime,\r\n    getVelocityAtTime: getVelocityAtTime,\r\n    getValueAtTime: getValueAtTime,\r\n    getStaticValueAtTime: getStaticValueAtTime,\r\n    setGroupProperty: setGroupProperty,\r\n  };\r\n}());\r\n\r\n/* global createTypedArray, Matrix, TransformPropertyFactory, expressionHelpers, PropertyFactory, expressionHelpers,\r\ninitialDefaultFrame, shapePool, ShapePropertyFactory, bez, extendPrototype, ExpressionManager, createSizedArray */\r\n\r\n(function addPropertyDecorator() {\r\n  function loopOut(type, duration, durationFlag) {\r\n    if (!this.k || !this.keyframes) {\r\n      return this.pv;\r\n    }\r\n    type = type ? type.toLowerCase() : '';\r\n    var currentFrame = this.comp.renderedFrame;\r\n    var keyframes = this.keyframes;\r\n    var lastKeyFrame = keyframes[keyframes.length - 1].t;\r\n    if (currentFrame <= lastKeyFrame) {\r\n      return this.pv;\r\n    }\r\n    var cycleDuration;\r\n    var firstKeyFrame;\r\n    if (!durationFlag) {\r\n      if (!duration || duration > keyframes.length - 1) {\r\n        duration = keyframes.length - 1;\r\n      }\r\n      firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;\r\n      cycleDuration = lastKeyFrame - firstKeyFrame;\r\n    } else {\r\n      if (!duration) {\r\n        cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip);\r\n      } else {\r\n        cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration);\r\n      }\r\n      firstKeyFrame = lastKeyFrame - cycleDuration;\r\n    }\r\n    var i;\r\n    var len;\r\n    var ret;\r\n    if (type === 'pingpong') {\r\n      var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\r\n      if (iterations % 2 !== 0) {\r\n          return this.getValueAtTime(((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n      }\r\n    } else if (type === 'offset') {\r\n      var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\r\n      var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\r\n        var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n      var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\r\n      if (this.pv.length) {\r\n        ret = new Array(initV.length);\r\n        len = ret.length;\r\n        for (i = 0; i < len; i += 1) {\r\n          ret[i] = (endV[i] - initV[i]) * repeats + current[i];\r\n        }\r\n        return ret;\r\n      }\r\n      return (endV - initV) * repeats + current;\r\n    } else if (type === 'continue') {\r\n      var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\r\n      var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);\r\n      if (this.pv.length) {\r\n        ret = new Array(lastValue.length);\r\n        len = ret.length;\r\n        for (i = 0; i < len; i += 1) {\r\n            ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005; // eslint-disable-line\r\n        }\r\n        return ret;\r\n      }\r\n      return lastValue + (lastValue - nextLastValue) * (((currentFrame - lastKeyFrame)) / 0.001);\r\n    }\r\n      return this.getValueAtTime((((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n\r\n  }\r\n\r\n  function loopIn(type, duration, durationFlag) {\r\n    if (!this.k) {\r\n      return this.pv;\r\n    }\r\n    type = type ? type.toLowerCase() : '';\r\n    var currentFrame = this.comp.renderedFrame;\r\n    var keyframes = this.keyframes;\r\n    var firstKeyFrame = keyframes[0].t;\r\n    if (currentFrame >= firstKeyFrame) {\r\n      return this.pv;\r\n    }\r\n    var cycleDuration;\r\n    var lastKeyFrame;\r\n    if (!durationFlag) {\r\n      if (!duration || duration > keyframes.length - 1) {\r\n        duration = keyframes.length - 1;\r\n      }\r\n      lastKeyFrame = keyframes[duration].t;\r\n      cycleDuration = lastKeyFrame - firstKeyFrame;\r\n    } else {\r\n      if (!duration) {\r\n        cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame);\r\n      } else {\r\n        cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration);\r\n      }\r\n      lastKeyFrame = firstKeyFrame + cycleDuration;\r\n    }\r\n    var i;\r\n    var len;\r\n    var ret;\r\n    if (type === 'pingpong') {\r\n      var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration);\r\n      if (iterations % 2 === 0) {\r\n          return this.getValueAtTime((((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n      }\r\n    } else if (type === 'offset') {\r\n      var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\r\n      var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\r\n      var current = this.getValueAtTime((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate, 0);\r\n      var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1;\r\n      if (this.pv.length) {\r\n        ret = new Array(initV.length);\r\n        len = ret.length;\r\n        for (i = 0; i < len; i += 1) {\r\n          ret[i] = current[i] - (endV[i] - initV[i]) * repeats;\r\n        }\r\n        return ret;\r\n      }\r\n      return current - (endV - initV) * repeats;\r\n    } else if (type === 'continue') {\r\n      var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\r\n      var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);\r\n      if (this.pv.length) {\r\n        ret = new Array(firstValue.length);\r\n        len = ret.length;\r\n        for (i = 0; i < len; i += 1) {\r\n          ret[i] = firstValue[i] + ((firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame)) / 0.001;\r\n        }\r\n        return ret;\r\n      }\r\n      return firstValue + ((firstValue - nextFirstValue) * (firstKeyFrame - currentFrame)) / 0.001;\r\n    }\r\n      return this.getValueAtTime(((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame))) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n\r\n  }\r\n\r\n  function smooth(width, samples) {\r\n    if (!this.k) {\r\n      return this.pv;\r\n    }\r\n    width = (width || 0.4) * 0.5;\r\n    samples = Math.floor(samples || 5);\r\n    if (samples <= 1) {\r\n      return this.pv;\r\n    }\r\n    var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;\r\n    var initFrame = currentTime - width;\r\n    var endFrame = currentTime + width;\r\n    var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;\r\n    var i = 0;\r\n    var j = 0;\r\n    var value;\r\n    if (this.pv.length) {\r\n      value = createTypedArray('float32', this.pv.length);\r\n    } else {\r\n      value = 0;\r\n    }\r\n    var sampleValue;\r\n    while (i < samples) {\r\n      sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);\r\n      if (this.pv.length) {\r\n        for (j = 0; j < this.pv.length; j += 1) {\r\n          value[j] += sampleValue[j];\r\n        }\r\n      } else {\r\n        value += sampleValue;\r\n      }\r\n      i += 1;\r\n    }\r\n    if (this.pv.length) {\r\n      for (j = 0; j < this.pv.length; j += 1) {\r\n        value[j] /= samples;\r\n      }\r\n    } else {\r\n      value /= samples;\r\n    }\r\n    return value;\r\n  }\r\n\r\n  function getTransformValueAtTime(time) {\r\n    if (!this._transformCachingAtTime) {\r\n      this._transformCachingAtTime = {\r\n        v: new Matrix(),\r\n      };\r\n    }\r\n    /// /\r\n    var matrix = this._transformCachingAtTime.v;\r\n    matrix.cloneFromProps(this.pre.props);\r\n    if (this.appliedTransformations < 1) {\r\n      var anchor = this.a.getValueAtTime(time);\r\n      matrix.translate(\r\n        -anchor[0] * this.a.mult,\r\n        -anchor[1] * this.a.mult,\r\n        anchor[2] * this.a.mult\r\n      );\r\n    }\r\n    if (this.appliedTransformations < 2) {\r\n      var scale = this.s.getValueAtTime(time);\r\n      matrix.scale(\r\n        scale[0] * this.s.mult,\r\n        scale[1] * this.s.mult,\r\n        scale[2] * this.s.mult\r\n      );\r\n    }\r\n    if (this.sk && this.appliedTransformations < 3) {\r\n      var skew = this.sk.getValueAtTime(time);\r\n      var skewAxis = this.sa.getValueAtTime(time);\r\n      matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult);\r\n    }\r\n    if (this.r && this.appliedTransformations < 4) {\r\n      var rotation = this.r.getValueAtTime(time);\r\n      matrix.rotate(-rotation * this.r.mult);\r\n    } else if (!this.r && this.appliedTransformations < 4) {\r\n      var rotationZ = this.rz.getValueAtTime(time);\r\n      var rotationY = this.ry.getValueAtTime(time);\r\n      var rotationX = this.rx.getValueAtTime(time);\r\n      var orientation = this.or.getValueAtTime(time);\r\n      matrix.rotateZ(-rotationZ * this.rz.mult)\r\n        .rotateY(rotationY * this.ry.mult)\r\n        .rotateX(rotationX * this.rx.mult)\r\n        .rotateZ(-orientation[2] * this.or.mult)\r\n        .rotateY(orientation[1] * this.or.mult)\r\n        .rotateX(orientation[0] * this.or.mult);\r\n    }\r\n    if (this.data.p && this.data.p.s) {\r\n      var positionX = this.px.getValueAtTime(time);\r\n      var positionY = this.py.getValueAtTime(time);\r\n      if (this.data.p.z) {\r\n        var positionZ = this.pz.getValueAtTime(time);\r\n        matrix.translate(\r\n          positionX * this.px.mult,\r\n          positionY * this.py.mult,\r\n          -positionZ * this.pz.mult\r\n        );\r\n      } else {\r\n        matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0);\r\n      }\r\n    } else {\r\n      var position = this.p.getValueAtTime(time);\r\n      matrix.translate(\r\n        position[0] * this.p.mult,\r\n        position[1] * this.p.mult,\r\n        -position[2] * this.p.mult\r\n      );\r\n    }\r\n    return matrix;\r\n    /// /\r\n  }\r\n\r\n  function getTransformStaticValueAtTime() {\r\n    return this.v.clone(new Matrix());\r\n  }\r\n\r\n  var getTransformProperty = TransformPropertyFactory.getTransformProperty;\r\n  TransformPropertyFactory.getTransformProperty = function (elem, data, container) {\r\n    var prop = getTransformProperty(elem, data, container);\r\n    if (prop.dynamicProperties.length) {\r\n      prop.getValueAtTime = getTransformValueAtTime.bind(prop);\r\n    } else {\r\n      prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);\r\n    }\r\n    prop.setGroupProperty = expressionHelpers.setGroupProperty;\r\n    return prop;\r\n  };\r\n\r\n  var propertyGetProp = PropertyFactory.getProp;\r\n  PropertyFactory.getProp = function (elem, data, type, mult, container) {\r\n    var prop = propertyGetProp(elem, data, type, mult, container);\r\n    // prop.getVelocityAtTime = getVelocityAtTime;\r\n    // prop.loopOut = loopOut;\r\n    // prop.loopIn = loopIn;\r\n    if (prop.kf) {\r\n      prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);\r\n    } else {\r\n      prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);\r\n    }\r\n    prop.setGroupProperty = expressionHelpers.setGroupProperty;\r\n    prop.loopOut = loopOut;\r\n    prop.loopIn = loopIn;\r\n    prop.smooth = smooth;\r\n    prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);\r\n    prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);\r\n    prop.numKeys = data.a === 1 ? data.k.length : 0;\r\n    prop.propertyIndex = data.ix;\r\n    var value = 0;\r\n    if (type !== 0) {\r\n      value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);\r\n    }\r\n    prop._cachingAtTime = {\r\n      lastFrame: initialDefaultFrame,\r\n      lastIndex: 0,\r\n      value: value,\r\n    };\r\n    expressionHelpers.searchExpressions(elem, data, prop);\r\n    if (prop.k) {\r\n      container.addDynamicProperty(prop);\r\n    }\r\n\r\n    return prop;\r\n  };\r\n\r\n  function getShapeValueAtTime(frameNum) {\r\n    // For now this caching object is created only when needed instead of creating it when the shape is initialized.\r\n    if (!this._cachingAtTime) {\r\n      this._cachingAtTime = {\r\n        shapeValue: shapePool.clone(this.pv),\r\n        lastIndex: 0,\r\n        lastTime: initialDefaultFrame,\r\n      };\r\n    }\r\n\r\n    frameNum *= this.elem.globalData.frameRate;\r\n    frameNum -= this.offsetTime;\r\n    if (frameNum !== this._cachingAtTime.lastTime) {\r\n      this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;\r\n      this._cachingAtTime.lastTime = frameNum;\r\n      this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);\r\n    }\r\n    return this._cachingAtTime.shapeValue;\r\n  }\r\n\r\n  var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();\r\n  var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();\r\n\r\n  function ShapeExpressions() {}\r\n  ShapeExpressions.prototype = {\r\n    vertices: function (prop, time) {\r\n      if (this.k) {\r\n        this.getValue();\r\n      }\r\n      var shapePath = this.v;\r\n      if (time !== undefined) {\r\n        shapePath = this.getValueAtTime(time, 0);\r\n      }\r\n      var i;\r\n      var len = shapePath._length;\r\n      var vertices = shapePath[prop];\r\n      var points = shapePath.v;\r\n      var arr = createSizedArray(len);\r\n      for (i = 0; i < len; i += 1) {\r\n        if (prop === 'i' || prop === 'o') {\r\n          arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];\r\n        } else {\r\n          arr[i] = [vertices[i][0], vertices[i][1]];\r\n        }\r\n      }\r\n      return arr;\r\n    },\r\n    points: function (time) {\r\n      return this.vertices('v', time);\r\n    },\r\n    inTangents: function (time) {\r\n      return this.vertices('i', time);\r\n    },\r\n    outTangents: function (time) {\r\n      return this.vertices('o', time);\r\n    },\r\n    isClosed: function () {\r\n      return this.v.c;\r\n    },\r\n    pointOnPath: function (perc, time) {\r\n      var shapePath = this.v;\r\n      if (time !== undefined) {\r\n        shapePath = this.getValueAtTime(time, 0);\r\n      }\r\n      if (!this._segmentsLength) {\r\n        this._segmentsLength = bez.getSegmentsLength(shapePath);\r\n      }\r\n\r\n      var segmentsLength = this._segmentsLength;\r\n      var lengths = segmentsLength.lengths;\r\n      var lengthPos = segmentsLength.totalLength * perc;\r\n      var i = 0;\r\n      var len = lengths.length;\r\n      var accumulatedLength = 0;\r\n      var pt;\r\n      while (i < len) {\r\n        if (accumulatedLength + lengths[i].addedLength > lengthPos) {\r\n          var initIndex = i;\r\n          var endIndex = (shapePath.c && i === len - 1) ? 0 : i + 1;\r\n          var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength;\r\n          pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);\r\n          break;\r\n        } else {\r\n          accumulatedLength += lengths[i].addedLength;\r\n        }\r\n        i += 1;\r\n      }\r\n      if (!pt) {\r\n        pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]];\r\n      }\r\n      return pt;\r\n    },\r\n    vectorOnPath: function (perc, time, vectorType) {\r\n      // perc doesn't use triple equality because it can be a Number object as well as a primitive.\r\n      if (perc == 1) { // eslint-disable-line eqeqeq\r\n        perc = this.v.c;\r\n      } else if (perc == 0) { // eslint-disable-line eqeqeq\r\n        perc = 0.999;\r\n      }\r\n      var pt1 = this.pointOnPath(perc, time);\r\n      var pt2 = this.pointOnPath(perc + 0.001, time);\r\n      var xLength = pt2[0] - pt1[0];\r\n      var yLength = pt2[1] - pt1[1];\r\n      var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2));\r\n      if (magnitude === 0) {\r\n        return [0, 0];\r\n      }\r\n      var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude];\r\n      return unitVector;\r\n    },\r\n    tangentOnPath: function (perc, time) {\r\n      return this.vectorOnPath(perc, time, 'tangent');\r\n    },\r\n    normalOnPath: function (perc, time) {\r\n      return this.vectorOnPath(perc, time, 'normal');\r\n    },\r\n    setGroupProperty: expressionHelpers.setGroupProperty,\r\n    getValueAtTime: expressionHelpers.getStaticValueAtTime,\r\n  };\r\n  extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);\r\n  extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);\r\n  KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;\r\n  KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;\r\n\r\n  var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;\r\n  ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {\r\n    var prop = propertyGetShapeProp(elem, data, type, arr, trims);\r\n    prop.propertyIndex = data.ix;\r\n    prop.lock = false;\r\n    if (type === 3) {\r\n      expressionHelpers.searchExpressions(elem, data.pt, prop);\r\n    } else if (type === 4) {\r\n      expressionHelpers.searchExpressions(elem, data.ks, prop);\r\n    }\r\n    if (prop.k) {\r\n      elem.addDynamicProperty(prop);\r\n    }\r\n    return prop;\r\n  };\r\n}());\r\n\r\n/* global ExpressionManager, TextProperty */\r\n\r\n(function addDecorator() {\r\n  function searchExpressions() {\r\n    if (this.data.d.x) {\r\n      this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this);\r\n      this.addEffect(this.getExpressionValue.bind(this));\r\n      return true;\r\n    }\r\n    return null;\r\n  }\r\n\r\n  TextProperty.prototype.getExpressionValue = function (currentValue, text) {\r\n    var newValue = this.calculateExpression(text);\r\n    if (currentValue.t !== newValue) {\r\n      var newData = {};\r\n      this.copyData(newData, currentValue);\r\n      newData.t = newValue.toString();\r\n      newData.__complete = false;\r\n      return newData;\r\n    }\r\n    return currentValue;\r\n  };\r\n\r\n  TextProperty.prototype.searchProperty = function () {\r\n    var isKeyframed = this.searchKeyframes();\r\n    var hasExpressions = this.searchExpressions();\r\n    this.kf = isKeyframed || hasExpressions;\r\n    return this.kf;\r\n  };\r\n\r\n  TextProperty.prototype.searchExpressions = searchExpressions;\r\n}());\r\n\r\n/* global propertyGroupFactory, PropertyInterface */\r\n/* exported ShapePathInterface */\r\n\r\nvar ShapePathInterface = (\r\n\r\n  function () {\r\n    return function pathInterfaceFactory(shape, view, propertyGroup) {\r\n      var prop = view.sh;\r\n\r\n      function interfaceFunction(val) {\r\n        if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) {\r\n          return interfaceFunction.path;\r\n        }\r\n        return null;\r\n      }\r\n\r\n      var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n      prop.setGroupProperty(PropertyInterface('Path', _propertyGroup));\r\n      Object.defineProperties(interfaceFunction, {\r\n        path: {\r\n          get: function () {\r\n            if (prop.k) {\r\n              prop.getValue();\r\n            }\r\n            return prop;\r\n          },\r\n        },\r\n        shape: {\r\n          get: function () {\r\n            if (prop.k) {\r\n              prop.getValue();\r\n            }\r\n            return prop;\r\n          },\r\n        },\r\n        _name: { value: shape.nm },\r\n        ix: { value: shape.ix },\r\n        propertyIndex: { value: shape.ix },\r\n        mn: { value: shape.mn },\r\n        propertyGroup: { value: propertyGroup },\r\n      });\r\n      return interfaceFunction;\r\n    };\r\n  }()\r\n);\r\n\r\n/* exported propertyGroupFactory */\r\n\r\nvar propertyGroupFactory = (function () {\r\n  return function (interfaceFunction, parentPropertyGroup) {\r\n    return function (val) {\r\n      val = val === undefined ? 1 : val;\r\n      if (val <= 0) {\r\n        return interfaceFunction;\r\n      }\r\n      return parentPropertyGroup(val - 1);\r\n    };\r\n  };\r\n}());\r\n\r\n/* exported PropertyInterface */\r\n\r\nvar PropertyInterface = (function () {\r\n  return function (propertyName, propertyGroup) {\r\n    var interfaceFunction = {\r\n      _name: propertyName,\r\n    };\r\n\r\n    function _propertyGroup(val) {\r\n      val = val === undefined ? 1 : val;\r\n      if (val <= 0) {\r\n        return interfaceFunction;\r\n      }\r\n      return propertyGroup(val - 1);\r\n    }\r\n\r\n    return _propertyGroup;\r\n  };\r\n}());\r\n\r\n/* global ExpressionPropertyInterface, PropertyInterface, propertyGroupFactory, ShapePathInterface */\r\n/* exported ShapeExpressionInterface */\r\n\r\nvar ShapeExpressionInterface = (function () {\r\n  function iterateElements(shapes, view, propertyGroup) {\r\n    var arr = [];\r\n    var i;\r\n    var len = shapes ? shapes.length : 0;\r\n    for (i = 0; i < len; i += 1) {\r\n      if (shapes[i].ty === 'gr') {\r\n        arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'fl') {\r\n        arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'st') {\r\n        arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'tm') {\r\n        arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'tr') {\r\n        // arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));\r\n      } else if (shapes[i].ty === 'el') {\r\n        arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'sr') {\r\n        arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'sh') {\r\n        arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'rc') {\r\n        arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'rd') {\r\n        arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'rp') {\r\n        arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else if (shapes[i].ty === 'gf') {\r\n        arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      } else {\r\n        arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n      }\r\n    }\r\n    return arr;\r\n  }\r\n\r\n  function contentsInterfaceFactory(shape, view, propertyGroup) {\r\n    var interfaces;\r\n    var interfaceFunction = function _interfaceFunction(value) {\r\n      var i = 0;\r\n      var len = interfaces.length;\r\n      while (i < len) {\r\n        if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) {\r\n          return interfaces[i];\r\n        }\r\n        i += 1;\r\n      }\r\n      if (typeof value === 'number') {\r\n        return interfaces[value - 1];\r\n      }\r\n      return null;\r\n    };\r\n\r\n    interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);\r\n    interfaceFunction.numProperties = interfaces.length;\r\n    var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\r\n    interfaceFunction.transform = transformInterface;\r\n    interfaceFunction.propertyIndex = shape.cix;\r\n    interfaceFunction._name = shape.nm;\r\n\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function groupInterfaceFactory(shape, view, propertyGroup) {\r\n    var interfaceFunction = function _interfaceFunction(value) {\r\n      switch (value) {\r\n        case 'ADBE Vectors Group':\r\n        case 'Contents':\r\n        case 2:\r\n          return interfaceFunction.content;\r\n          // Not necessary for now. Keeping them here in case a new case appears\r\n          // case 'ADBE Vector Transform Group':\r\n          // case 3:\r\n        default:\r\n          return interfaceFunction.transform;\r\n      }\r\n    };\r\n    interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup);\r\n    var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\r\n    interfaceFunction.content = content;\r\n    interfaceFunction.transform = transformInterface;\r\n    Object.defineProperty(interfaceFunction, '_name', {\r\n      get: function () {\r\n        return shape.nm;\r\n      },\r\n    });\r\n    // interfaceFunction.content = interfaceFunction;\r\n    interfaceFunction.numProperties = shape.np;\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n    interfaceFunction.nm = shape.nm;\r\n    interfaceFunction.mn = shape.mn;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function fillInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(val) {\r\n      if (val === 'Color' || val === 'color') {\r\n        return interfaceFunction.color;\r\n      } if (val === 'Opacity' || val === 'opacity') {\r\n        return interfaceFunction.opacity;\r\n      }\r\n      return null;\r\n    }\r\n    Object.defineProperties(interfaceFunction, {\r\n      color: {\r\n        get: ExpressionPropertyInterface(view.c),\r\n      },\r\n      opacity: {\r\n        get: ExpressionPropertyInterface(view.o),\r\n      },\r\n      _name: { value: shape.nm },\r\n      mn: { value: shape.mn },\r\n    });\r\n\r\n    view.c.setGroupProperty(PropertyInterface('Color', propertyGroup));\r\n    view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function gradientFillInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(val) {\r\n      if (val === 'Start Point' || val === 'start point') {\r\n        return interfaceFunction.startPoint;\r\n      }\r\n      if (val === 'End Point' || val === 'end point') {\r\n        return interfaceFunction.endPoint;\r\n      }\r\n      if (val === 'Opacity' || val === 'opacity') {\r\n        return interfaceFunction.opacity;\r\n      }\r\n      return null;\r\n    }\r\n    Object.defineProperties(interfaceFunction, {\r\n      startPoint: {\r\n        get: ExpressionPropertyInterface(view.s),\r\n      },\r\n      endPoint: {\r\n        get: ExpressionPropertyInterface(view.e),\r\n      },\r\n      opacity: {\r\n        get: ExpressionPropertyInterface(view.o),\r\n      },\r\n      type: {\r\n        get: function () {\r\n          return 'a';\r\n        },\r\n      },\r\n      _name: { value: shape.nm },\r\n      mn: { value: shape.mn },\r\n    });\r\n\r\n    view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup));\r\n    view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup));\r\n    view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\r\n    return interfaceFunction;\r\n  }\r\n  function defaultInterfaceFactory() {\r\n    function interfaceFunction() {\r\n      return null;\r\n    }\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function strokeInterfaceFactory(shape, view, propertyGroup) {\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup);\r\n    function addPropertyToDashOb(i) {\r\n      Object.defineProperty(dashOb, shape.d[i].nm, {\r\n        get: ExpressionPropertyInterface(view.d.dataProps[i].p),\r\n      });\r\n    }\r\n    var i;\r\n    var len = shape.d ? shape.d.length : 0;\r\n    var dashOb = {};\r\n    for (i = 0; i < len; i += 1) {\r\n      addPropertyToDashOb(i);\r\n      view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);\r\n    }\r\n\r\n    function interfaceFunction(val) {\r\n      if (val === 'Color' || val === 'color') {\r\n        return interfaceFunction.color;\r\n      } if (val === 'Opacity' || val === 'opacity') {\r\n        return interfaceFunction.opacity;\r\n      } if (val === 'Stroke Width' || val === 'stroke width') {\r\n        return interfaceFunction.strokeWidth;\r\n      }\r\n      return null;\r\n    }\r\n    Object.defineProperties(interfaceFunction, {\r\n      color: {\r\n        get: ExpressionPropertyInterface(view.c),\r\n      },\r\n      opacity: {\r\n        get: ExpressionPropertyInterface(view.o),\r\n      },\r\n      strokeWidth: {\r\n        get: ExpressionPropertyInterface(view.w),\r\n      },\r\n      dash: {\r\n        get: function () {\r\n          return dashOb;\r\n        },\r\n      },\r\n      _name: { value: shape.nm },\r\n      mn: { value: shape.mn },\r\n    });\r\n\r\n    view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup));\r\n    view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\r\n    view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup));\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function trimInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(val) {\r\n      if (val === shape.e.ix || val === 'End' || val === 'end') {\r\n        return interfaceFunction.end;\r\n      }\r\n      if (val === shape.s.ix) {\r\n        return interfaceFunction.start;\r\n      }\r\n      if (val === shape.o.ix) {\r\n        return interfaceFunction.offset;\r\n      }\r\n      return null;\r\n    }\r\n\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n\r\n    view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup));\r\n    view.e.setGroupProperty(PropertyInterface('End', _propertyGroup));\r\n    view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n    interfaceFunction.propertyGroup = propertyGroup;\r\n\r\n    Object.defineProperties(interfaceFunction, {\r\n      start: {\r\n        get: ExpressionPropertyInterface(view.s),\r\n      },\r\n      end: {\r\n        get: ExpressionPropertyInterface(view.e),\r\n      },\r\n      offset: {\r\n        get: ExpressionPropertyInterface(view.o),\r\n      },\r\n      _name: { value: shape.nm },\r\n    });\r\n    interfaceFunction.mn = shape.mn;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function transformInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(value) {\r\n      if (shape.a.ix === value || value === 'Anchor Point') {\r\n        return interfaceFunction.anchorPoint;\r\n      }\r\n      if (shape.o.ix === value || value === 'Opacity') {\r\n        return interfaceFunction.opacity;\r\n      }\r\n      if (shape.p.ix === value || value === 'Position') {\r\n        return interfaceFunction.position;\r\n      }\r\n      if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {\r\n        return interfaceFunction.rotation;\r\n      }\r\n      if (shape.s.ix === value || value === 'Scale') {\r\n        return interfaceFunction.scale;\r\n      }\r\n      if ((shape.sk && shape.sk.ix === value) || value === 'Skew') {\r\n        return interfaceFunction.skew;\r\n      }\r\n      if ((shape.sa && shape.sa.ix === value) || value === 'Skew Axis') {\r\n        return interfaceFunction.skewAxis;\r\n      }\r\n      return null;\r\n    }\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\r\n    view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n    view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup));\r\n    view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup));\r\n    view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\r\n    if (view.transform.mProps.sk) {\r\n      view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup));\r\n      view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup));\r\n    }\r\n    view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\r\n    Object.defineProperties(interfaceFunction, {\r\n      opacity: {\r\n        get: ExpressionPropertyInterface(view.transform.mProps.o),\r\n      },\r\n      position: {\r\n        get: ExpressionPropertyInterface(view.transform.mProps.p),\r\n      },\r\n      anchorPoint: {\r\n        get: ExpressionPropertyInterface(view.transform.mProps.a),\r\n      },\r\n      scale: {\r\n        get: ExpressionPropertyInterface(view.transform.mProps.s),\r\n      },\r\n      rotation: {\r\n        get: ExpressionPropertyInterface(view.transform.mProps.r),\r\n      },\r\n      skew: {\r\n        get: ExpressionPropertyInterface(view.transform.mProps.sk),\r\n      },\r\n      skewAxis: {\r\n        get: ExpressionPropertyInterface(view.transform.mProps.sa),\r\n      },\r\n      _name: { value: shape.nm },\r\n    });\r\n    interfaceFunction.ty = 'tr';\r\n    interfaceFunction.mn = shape.mn;\r\n    interfaceFunction.propertyGroup = propertyGroup;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function ellipseInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(value) {\r\n      if (shape.p.ix === value) {\r\n        return interfaceFunction.position;\r\n      }\r\n      if (shape.s.ix === value) {\r\n        return interfaceFunction.size;\r\n      }\r\n      return null;\r\n    }\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n    var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\r\n    prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\r\n    prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n\r\n    Object.defineProperties(interfaceFunction, {\r\n      size: {\r\n        get: ExpressionPropertyInterface(prop.s),\r\n      },\r\n      position: {\r\n        get: ExpressionPropertyInterface(prop.p),\r\n      },\r\n      _name: { value: shape.nm },\r\n    });\r\n    interfaceFunction.mn = shape.mn;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function starInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(value) {\r\n      if (shape.p.ix === value) {\r\n        return interfaceFunction.position;\r\n      }\r\n      if (shape.r.ix === value) {\r\n        return interfaceFunction.rotation;\r\n      }\r\n      if (shape.pt.ix === value) {\r\n        return interfaceFunction.points;\r\n      }\r\n      if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') {\r\n        return interfaceFunction.outerRadius;\r\n      }\r\n      if (shape.os.ix === value) {\r\n        return interfaceFunction.outerRoundness;\r\n      }\r\n      if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) {\r\n        return interfaceFunction.innerRadius;\r\n      }\r\n      if (shape.is && shape.is.ix === value) {\r\n        return interfaceFunction.innerRoundness;\r\n      }\r\n      return null;\r\n    }\r\n\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n    prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup));\r\n    prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup));\r\n    prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup));\r\n    prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n    prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\r\n    if (shape.ir) {\r\n      prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup));\r\n      prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup));\r\n    }\r\n\r\n    Object.defineProperties(interfaceFunction, {\r\n      position: {\r\n        get: ExpressionPropertyInterface(prop.p),\r\n      },\r\n      rotation: {\r\n        get: ExpressionPropertyInterface(prop.r),\r\n      },\r\n      points: {\r\n        get: ExpressionPropertyInterface(prop.pt),\r\n      },\r\n      outerRadius: {\r\n        get: ExpressionPropertyInterface(prop.or),\r\n      },\r\n      outerRoundness: {\r\n        get: ExpressionPropertyInterface(prop.os),\r\n      },\r\n      innerRadius: {\r\n        get: ExpressionPropertyInterface(prop.ir),\r\n      },\r\n      innerRoundness: {\r\n        get: ExpressionPropertyInterface(prop.is),\r\n      },\r\n      _name: { value: shape.nm },\r\n    });\r\n    interfaceFunction.mn = shape.mn;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function rectInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(value) {\r\n      if (shape.p.ix === value) {\r\n        return interfaceFunction.position;\r\n      }\r\n      if (shape.r.ix === value) {\r\n        return interfaceFunction.roundness;\r\n      }\r\n      if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {\r\n        return interfaceFunction.size;\r\n      }\r\n      return null;\r\n    }\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n    var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n    prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n    prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\r\n    prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\r\n\r\n    Object.defineProperties(interfaceFunction, {\r\n      position: {\r\n        get: ExpressionPropertyInterface(prop.p),\r\n      },\r\n      roundness: {\r\n        get: ExpressionPropertyInterface(prop.r),\r\n      },\r\n      size: {\r\n        get: ExpressionPropertyInterface(prop.s),\r\n      },\r\n      _name: { value: shape.nm },\r\n    });\r\n    interfaceFunction.mn = shape.mn;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function roundedInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(value) {\r\n      if (shape.r.ix === value || value === 'Round Corners 1') {\r\n        return interfaceFunction.radius;\r\n      }\r\n      return null;\r\n    }\r\n\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    var prop = view;\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n    prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup));\r\n\r\n    Object.defineProperties(interfaceFunction, {\r\n      radius: {\r\n        get: ExpressionPropertyInterface(prop.rd),\r\n      },\r\n      _name: { value: shape.nm },\r\n    });\r\n    interfaceFunction.mn = shape.mn;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  function repeaterInterfaceFactory(shape, view, propertyGroup) {\r\n    function interfaceFunction(value) {\r\n      if (shape.c.ix === value || value === 'Copies') {\r\n        return interfaceFunction.copies;\r\n      } if (shape.o.ix === value || value === 'Offset') {\r\n        return interfaceFunction.offset;\r\n      }\r\n      return null;\r\n    }\r\n\r\n    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n    var prop = view;\r\n    interfaceFunction.propertyIndex = shape.ix;\r\n    prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup));\r\n    prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\r\n    Object.defineProperties(interfaceFunction, {\r\n      copies: {\r\n        get: ExpressionPropertyInterface(prop.c),\r\n      },\r\n      offset: {\r\n        get: ExpressionPropertyInterface(prop.o),\r\n      },\r\n      _name: { value: shape.nm },\r\n    });\r\n    interfaceFunction.mn = shape.mn;\r\n    return interfaceFunction;\r\n  }\r\n\r\n  return function (shapes, view, propertyGroup) {\r\n    var interfaces;\r\n    function _interfaceFunction(value) {\r\n      if (typeof value === 'number') {\r\n        value = value === undefined ? 1 : value;\r\n        if (value === 0) {\r\n          return propertyGroup;\r\n        }\r\n        return interfaces[value - 1];\r\n      }\r\n      var i = 0;\r\n      var len = interfaces.length;\r\n      while (i < len) {\r\n        if (interfaces[i]._name === value) {\r\n          return interfaces[i];\r\n        }\r\n        i += 1;\r\n      }\r\n      return null;\r\n    }\r\n    function parentGroupWrapper() {\r\n      return propertyGroup;\r\n    }\r\n    _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper);\r\n    interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup);\r\n    _interfaceFunction.numProperties = interfaces.length;\r\n    _interfaceFunction._name = 'Contents';\r\n    return _interfaceFunction;\r\n  };\r\n}());\r\n\r\n/* exported TextExpressionInterface */\r\n\r\nvar TextExpressionInterface = (function () {\r\n  return function (elem) {\r\n    var _prevValue;\r\n    var _sourceText;\r\n    function _thisLayerFunction(name) {\r\n      switch (name) {\r\n        case 'ADBE Text Document':\r\n          return _thisLayerFunction.sourceText;\r\n        default:\r\n          return null;\r\n      }\r\n    }\r\n    Object.defineProperty(_thisLayerFunction, 'sourceText', {\r\n      get: function () {\r\n        elem.textProperty.getValue();\r\n        var stringValue = elem.textProperty.currentData.t;\r\n        if (stringValue !== _prevValue) {\r\n          elem.textProperty.currentData.t = _prevValue;\r\n          _sourceText = new String(stringValue); // eslint-disable-line no-new-wrappers\r\n          // If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive\r\n          _sourceText.value = stringValue || new String(stringValue); // eslint-disable-line no-new-wrappers\r\n        }\r\n        return _sourceText;\r\n      },\r\n    });\r\n    return _thisLayerFunction;\r\n  };\r\n}());\r\n\r\n/* global Matrix, MaskManagerInterface, TransformExpressionInterface, getDescriptor */\r\n/* exported LayerExpressionInterface */\r\n\r\nvar LayerExpressionInterface = (function () {\r\n  function getMatrix(time) {\r\n    var toWorldMat = new Matrix();\r\n    if (time !== undefined) {\r\n      var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time);\r\n      propMatrix.clone(toWorldMat);\r\n    } else {\r\n      var transformMat = this._elem.finalTransform.mProp;\r\n      transformMat.applyToMatrix(toWorldMat);\r\n    }\r\n    return toWorldMat;\r\n  }\r\n\r\n  function toWorldVec(arr, time) {\r\n    var toWorldMat = this.getMatrix(time);\r\n    toWorldMat.props[12] = 0;\r\n    toWorldMat.props[13] = 0;\r\n    toWorldMat.props[14] = 0;\r\n    return this.applyPoint(toWorldMat, arr);\r\n  }\r\n\r\n  function toWorld(arr, time) {\r\n    var toWorldMat = this.getMatrix(time);\r\n    return this.applyPoint(toWorldMat, arr);\r\n  }\r\n\r\n  function fromWorldVec(arr, time) {\r\n    var toWorldMat = this.getMatrix(time);\r\n    toWorldMat.props[12] = 0;\r\n    toWorldMat.props[13] = 0;\r\n    toWorldMat.props[14] = 0;\r\n    return this.invertPoint(toWorldMat, arr);\r\n  }\r\n\r\n  function fromWorld(arr, time) {\r\n    var toWorldMat = this.getMatrix(time);\r\n    return this.invertPoint(toWorldMat, arr);\r\n  }\r\n\r\n  function applyPoint(matrix, arr) {\r\n    if (this._elem.hierarchy && this._elem.hierarchy.length) {\r\n      var i;\r\n      var len = this._elem.hierarchy.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\r\n      }\r\n    }\r\n    return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0);\r\n  }\r\n\r\n  function invertPoint(matrix, arr) {\r\n    if (this._elem.hierarchy && this._elem.hierarchy.length) {\r\n      var i;\r\n      var len = this._elem.hierarchy.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\r\n      }\r\n    }\r\n    return matrix.inversePoint(arr);\r\n  }\r\n\r\n  function fromComp(arr) {\r\n    var toWorldMat = new Matrix();\r\n    toWorldMat.reset();\r\n    this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);\r\n    if (this._elem.hierarchy && this._elem.hierarchy.length) {\r\n      var i;\r\n      var len = this._elem.hierarchy.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);\r\n      }\r\n      return toWorldMat.inversePoint(arr);\r\n    }\r\n    return toWorldMat.inversePoint(arr);\r\n  }\r\n\r\n  function sampleImage() {\r\n    return [1, 1, 1, 1];\r\n  }\r\n\r\n  return function (elem) {\r\n    var transformInterface;\r\n\r\n    function _registerMaskInterface(maskManager) {\r\n      _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);\r\n    }\r\n    function _registerEffectsInterface(effects) {\r\n      _thisLayerFunction.effect = effects;\r\n    }\r\n\r\n    function _thisLayerFunction(name) {\r\n      switch (name) {\r\n        case 'ADBE Root Vectors Group':\r\n        case 'Contents':\r\n        case 2:\r\n          return _thisLayerFunction.shapeInterface;\r\n        case 1:\r\n        case 6:\r\n        case 'Transform':\r\n        case 'transform':\r\n        case 'ADBE Transform Group':\r\n          return transformInterface;\r\n        case 4:\r\n        case 'ADBE Effect Parade':\r\n        case 'effects':\r\n        case 'Effects':\r\n          return _thisLayerFunction.effect;\r\n        case 'ADBE Text Properties':\r\n          return _thisLayerFunction.textInterface;\r\n        default:\r\n          return null;\r\n      }\r\n    }\r\n    _thisLayerFunction.getMatrix = getMatrix;\r\n    _thisLayerFunction.invertPoint = invertPoint;\r\n    _thisLayerFunction.applyPoint = applyPoint;\r\n    _thisLayerFunction.toWorld = toWorld;\r\n    _thisLayerFunction.toWorldVec = toWorldVec;\r\n    _thisLayerFunction.fromWorld = fromWorld;\r\n    _thisLayerFunction.fromWorldVec = fromWorldVec;\r\n    _thisLayerFunction.toComp = toWorld;\r\n    _thisLayerFunction.fromComp = fromComp;\r\n    _thisLayerFunction.sampleImage = sampleImage;\r\n    _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);\r\n    _thisLayerFunction._elem = elem;\r\n    transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);\r\n    var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');\r\n    Object.defineProperties(_thisLayerFunction, {\r\n      hasParent: {\r\n        get: function () {\r\n          return elem.hierarchy.length;\r\n        },\r\n      },\r\n      parent: {\r\n        get: function () {\r\n          return elem.hierarchy[0].layerInterface;\r\n        },\r\n      },\r\n      rotation: getDescriptor(transformInterface, 'rotation'),\r\n      scale: getDescriptor(transformInterface, 'scale'),\r\n      position: getDescriptor(transformInterface, 'position'),\r\n      opacity: getDescriptor(transformInterface, 'opacity'),\r\n      anchorPoint: anchorPointDescriptor,\r\n      anchor_point: anchorPointDescriptor,\r\n      transform: {\r\n        get: function () {\r\n          return transformInterface;\r\n        },\r\n      },\r\n      active: {\r\n        get: function () {\r\n          return elem.isInRange;\r\n        },\r\n      },\r\n    });\r\n\r\n    _thisLayerFunction.startTime = elem.data.st;\r\n    _thisLayerFunction.index = elem.data.ind;\r\n    _thisLayerFunction.source = elem.data.refId;\r\n    _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;\r\n    _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;\r\n    _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate;\r\n    _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate;\r\n    _thisLayerFunction._name = elem.data.nm;\r\n\r\n    _thisLayerFunction.registerMaskInterface = _registerMaskInterface;\r\n    _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;\r\n    return _thisLayerFunction;\r\n  };\r\n}());\r\n\r\n/* global */\r\n/* exported FootageInterface */\r\n\r\nvar FootageInterface = (function () {\r\n  var outlineInterfaceFactory = (function (elem) {\r\n    var currentPropertyName = '';\r\n    var currentProperty = elem.getFootageData();\r\n    function init() {\r\n      currentPropertyName = '';\r\n      currentProperty = elem.getFootageData();\r\n      return searchProperty;\r\n    }\r\n    function searchProperty(value) {\r\n      if (currentProperty[value]) {\r\n        currentPropertyName = value;\r\n        currentProperty = currentProperty[value];\r\n        if (typeof currentProperty === 'object') {\r\n          return searchProperty;\r\n        }\r\n        return currentProperty;\r\n      }\r\n      var propertyNameIndex = value.indexOf(currentPropertyName);\r\n      if (propertyNameIndex !== -1) {\r\n        var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10);\r\n        currentProperty = currentProperty[index];\r\n        if (typeof currentProperty === 'object') {\r\n          return searchProperty;\r\n        }\r\n        return currentProperty;\r\n      }\r\n      return '';\r\n    }\r\n    return init;\r\n  });\r\n\r\n  var dataInterfaceFactory = function (elem) {\r\n    function interfaceFunction(value) {\r\n      if (value === 'Outline') {\r\n        return interfaceFunction.outlineInterface();\r\n      }\r\n      return null;\r\n    }\r\n\r\n    interfaceFunction._name = 'Outline';\r\n    interfaceFunction.outlineInterface = outlineInterfaceFactory(elem);\r\n    return interfaceFunction;\r\n  };\r\n\r\n  return function (elem) {\r\n    function _interfaceFunction(value) {\r\n      if (value === 'Data') {\r\n        return _interfaceFunction.dataInterface;\r\n      }\r\n      return null;\r\n    }\r\n\r\n    _interfaceFunction._name = 'Data';\r\n    _interfaceFunction.dataInterface = dataInterfaceFactory(elem);\r\n    return _interfaceFunction;\r\n  };\r\n}());\r\n\r\n/* exported CompExpressionInterface */\r\n\r\nvar CompExpressionInterface = (function () {\r\n  return function (comp) {\r\n    function _thisLayerFunction(name) {\r\n      var i = 0;\r\n      var len = comp.layers.length;\r\n      while (i < len) {\r\n        if (comp.layers[i].nm === name || comp.layers[i].ind === name) {\r\n          return comp.elements[i].layerInterface;\r\n        }\r\n        i += 1;\r\n      }\r\n      return null;\r\n      // return {active:false};\r\n    }\r\n    Object.defineProperty(_thisLayerFunction, '_name', { value: comp.data.nm });\r\n    _thisLayerFunction.layer = _thisLayerFunction;\r\n    _thisLayerFunction.pixelAspect = 1;\r\n    _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;\r\n    _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;\r\n    _thisLayerFunction.pixelAspect = 1;\r\n    _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;\r\n    _thisLayerFunction.displayStartTime = 0;\r\n    _thisLayerFunction.numLayers = comp.layers.length;\r\n    return _thisLayerFunction;\r\n  };\r\n}());\r\n\r\n/* global ExpressionPropertyInterface */\r\n/* exported TransformExpressionInterface */\r\n\r\nvar TransformExpressionInterface = (function () {\r\n  return function (transform) {\r\n    function _thisFunction(name) {\r\n      switch (name) {\r\n        case 'scale':\r\n        case 'Scale':\r\n        case 'ADBE Scale':\r\n        case 6:\r\n          return _thisFunction.scale;\r\n        case 'rotation':\r\n        case 'Rotation':\r\n        case 'ADBE Rotation':\r\n        case 'ADBE Rotate Z':\r\n        case 10:\r\n          return _thisFunction.rotation;\r\n        case 'ADBE Rotate X':\r\n          return _thisFunction.xRotation;\r\n        case 'ADBE Rotate Y':\r\n          return _thisFunction.yRotation;\r\n        case 'position':\r\n        case 'Position':\r\n        case 'ADBE Position':\r\n        case 2:\r\n          return _thisFunction.position;\r\n        case 'ADBE Position_0':\r\n          return _thisFunction.xPosition;\r\n        case 'ADBE Position_1':\r\n          return _thisFunction.yPosition;\r\n        case 'ADBE Position_2':\r\n          return _thisFunction.zPosition;\r\n        case 'anchorPoint':\r\n        case 'AnchorPoint':\r\n        case 'Anchor Point':\r\n        case 'ADBE AnchorPoint':\r\n        case 1:\r\n          return _thisFunction.anchorPoint;\r\n        case 'opacity':\r\n        case 'Opacity':\r\n        case 11:\r\n          return _thisFunction.opacity;\r\n        default:\r\n          return null;\r\n      }\r\n    }\r\n    Object.defineProperty(_thisFunction, 'rotation', {\r\n      get: ExpressionPropertyInterface(transform.r || transform.rz),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'zRotation', {\r\n      get: ExpressionPropertyInterface(transform.rz || transform.r),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'xRotation', {\r\n      get: ExpressionPropertyInterface(transform.rx),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'yRotation', {\r\n      get: ExpressionPropertyInterface(transform.ry),\r\n    });\r\n    Object.defineProperty(_thisFunction, 'scale', {\r\n      get: ExpressionPropertyInterface(transform.s),\r\n    });\r\n    var _px;\r\n    var _py;\r\n    var _pz;\r\n    var _transformFactory;\r\n    if (transform.p) {\r\n      _transformFactory = ExpressionPropertyInterface(transform.p);\r\n    } else {\r\n      _px = ExpressionPropertyInterface(transform.px);\r\n      _py = ExpressionPropertyInterface(transform.py);\r\n      if (transform.pz) {\r\n        _pz = ExpressionPropertyInterface(transform.pz);\r\n      }\r\n    }\r\n    Object.defineProperty(_thisFunction, 'position', {\r\n      get: function () {\r\n        if (transform.p) {\r\n          return _transformFactory();\r\n        }\r\n        return [\r\n          _px(),\r\n          _py(),\r\n          _pz ? _pz() : 0];\r\n      },\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'xPosition', {\r\n      get: ExpressionPropertyInterface(transform.px),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'yPosition', {\r\n      get: ExpressionPropertyInterface(transform.py),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'zPosition', {\r\n      get: ExpressionPropertyInterface(transform.pz),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'anchorPoint', {\r\n      get: ExpressionPropertyInterface(transform.a),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'opacity', {\r\n      get: ExpressionPropertyInterface(transform.o),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'skew', {\r\n      get: ExpressionPropertyInterface(transform.sk),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'skewAxis', {\r\n      get: ExpressionPropertyInterface(transform.sa),\r\n    });\r\n\r\n    Object.defineProperty(_thisFunction, 'orientation', {\r\n      get: ExpressionPropertyInterface(transform.or),\r\n    });\r\n\r\n    return _thisFunction;\r\n  };\r\n}());\r\n\r\n/* exported ProjectInterface */\r\n\r\nvar ProjectInterface = (function () {\r\n  function registerComposition(comp) {\r\n    this.compositions.push(comp);\r\n  }\r\n\r\n  return function () {\r\n    function _thisProjectFunction(name) {\r\n      var i = 0;\r\n      var len = this.compositions.length;\r\n      while (i < len) {\r\n        if (this.compositions[i].data && this.compositions[i].data.nm === name) {\r\n          if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {\r\n            this.compositions[i].prepareFrame(this.currentFrame);\r\n          }\r\n          return this.compositions[i].compInterface;\r\n        }\r\n        i += 1;\r\n      }\r\n      return null;\r\n    }\r\n\r\n    _thisProjectFunction.compositions = [];\r\n    _thisProjectFunction.currentFrame = 0;\r\n\r\n    _thisProjectFunction.registerComposition = registerComposition;\r\n\r\n    return _thisProjectFunction;\r\n  };\r\n}());\r\n\r\n/* global propertyGroupFactory, ExpressionPropertyInterface, PropertyInterface */\r\n/* exported EffectsExpressionInterface */\r\n\r\nvar EffectsExpressionInterface = (function () {\r\n  var ob = {\r\n    createEffectsInterface: createEffectsInterface,\r\n  };\r\n\r\n  function createEffectsInterface(elem, propertyGroup) {\r\n    if (elem.effectsManager) {\r\n      var effectElements = [];\r\n      var effectsData = elem.data.ef;\r\n      var i;\r\n      var len = elem.effectsManager.effectElements.length;\r\n      for (i = 0; i < len; i += 1) {\r\n        effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem));\r\n      }\r\n\r\n      var effects = elem.data.ef || [];\r\n      var groupInterface = function (name) {\r\n        i = 0;\r\n        len = effects.length;\r\n        while (i < len) {\r\n          if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\r\n            return effectElements[i];\r\n          }\r\n          i += 1;\r\n        }\r\n        return null;\r\n      };\r\n      Object.defineProperty(groupInterface, 'numProperties', {\r\n        get: function () {\r\n          return effects.length;\r\n        },\r\n      });\r\n      return groupInterface;\r\n    }\r\n    return null;\r\n  }\r\n\r\n  function createGroupInterface(data, elements, propertyGroup, elem) {\r\n    function groupInterface(name) {\r\n      var effects = data.ef;\r\n      var i = 0;\r\n      var len = effects.length;\r\n      while (i < len) {\r\n        if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\r\n          if (effects[i].ty === 5) {\r\n            return effectElements[i];\r\n          }\r\n          return effectElements[i]();\r\n        }\r\n        i += 1;\r\n      }\r\n      throw new Error();\r\n    }\r\n    var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup);\r\n\r\n    var effectElements = [];\r\n    var i;\r\n    var len = data.ef.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      if (data.ef[i].ty === 5) {\r\n        effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem));\r\n      } else {\r\n        effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup));\r\n      }\r\n    }\r\n\r\n    if (data.mn === 'ADBE Color Control') {\r\n      Object.defineProperty(groupInterface, 'color', {\r\n        get: function () {\r\n          return effectElements[0]();\r\n        },\r\n      });\r\n    }\r\n    Object.defineProperties(groupInterface, {\r\n      numProperties: {\r\n        get: function () {\r\n          return data.np;\r\n        },\r\n      },\r\n      _name: { value: data.nm },\r\n      propertyGroup: { value: _propertyGroup },\r\n    });\r\n    groupInterface.enabled = data.en !== 0;\r\n    groupInterface.active = groupInterface.enabled;\r\n    return groupInterface;\r\n  }\r\n\r\n  function createValueInterface(element, type, elem, propertyGroup) {\r\n    var expressionProperty = ExpressionPropertyInterface(element.p);\r\n    function interfaceFunction() {\r\n      if (type === 10) {\r\n        return elem.comp.compInterface(element.p.v);\r\n      }\r\n      return expressionProperty();\r\n    }\r\n\r\n    if (element.p.setGroupProperty) {\r\n      element.p.setGroupProperty(PropertyInterface('', propertyGroup));\r\n    }\r\n\r\n    return interfaceFunction;\r\n  }\r\n\r\n  return ob;\r\n}());\r\n\r\n/* global createSizedArray */\r\n/* exported MaskManagerInterface */\r\n\r\nvar MaskManagerInterface = (function () {\r\n  function MaskInterface(mask, data) {\r\n    this._mask = mask;\r\n    this._data = data;\r\n  }\r\n  Object.defineProperty(MaskInterface.prototype, 'maskPath', {\r\n    get: function () {\r\n      if (this._mask.prop.k) {\r\n        this._mask.prop.getValue();\r\n      }\r\n      return this._mask.prop;\r\n    },\r\n  });\r\n  Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {\r\n    get: function () {\r\n      if (this._mask.op.k) {\r\n        this._mask.op.getValue();\r\n      }\r\n      return this._mask.op.v * 100;\r\n    },\r\n  });\r\n\r\n  var MaskManager = function (maskManager) {\r\n    var _masksInterfaces = createSizedArray(maskManager.viewData.length);\r\n    var i;\r\n    var len = maskManager.viewData.length;\r\n    for (i = 0; i < len; i += 1) {\r\n      _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);\r\n    }\r\n\r\n    var maskFunction = function (name) {\r\n      i = 0;\r\n      while (i < len) {\r\n        if (maskManager.masksProperties[i].nm === name) {\r\n          return _masksInterfaces[i];\r\n        }\r\n        i += 1;\r\n      }\r\n      return null;\r\n    };\r\n    return maskFunction;\r\n  };\r\n  return MaskManager;\r\n}());\r\n\r\n/* global createTypedArray */\r\n/* exported ExpressionPropertyInterface */\r\n\r\nvar ExpressionPropertyInterface = (function () {\r\n  var defaultUnidimensionalValue = { pv: 0, v: 0, mult: 1 };\r\n  var defaultMultidimensionalValue = { pv: [0, 0, 0], v: [0, 0, 0], mult: 1 };\r\n\r\n  function completeProperty(expressionValue, property, type) {\r\n    Object.defineProperty(expressionValue, 'velocity', {\r\n      get: function () {\r\n        return property.getVelocityAtTime(property.comp.currentFrame);\r\n      },\r\n    });\r\n    expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;\r\n    expressionValue.key = function (pos) {\r\n      if (!expressionValue.numKeys) {\r\n        return 0;\r\n      }\r\n      var value = '';\r\n      if ('s' in property.keyframes[pos - 1]) {\r\n        value = property.keyframes[pos - 1].s;\r\n      } else if ('e' in property.keyframes[pos - 2]) {\r\n        value = property.keyframes[pos - 2].e;\r\n      } else {\r\n        value = property.keyframes[pos - 2].s;\r\n      }\r\n      var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value); // eslint-disable-line no-new-wrappers\r\n      valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate;\r\n      valueProp.value = type === 'unidimensional' ? value[0] : value;\r\n      return valueProp;\r\n    };\r\n    expressionValue.valueAtTime = property.getValueAtTime;\r\n    expressionValue.speedAtTime = property.getSpeedAtTime;\r\n    expressionValue.velocityAtTime = property.getVelocityAtTime;\r\n    expressionValue.propertyGroup = property.propertyGroup;\r\n  }\r\n\r\n  function UnidimensionalPropertyInterface(property) {\r\n    if (!property || !('pv' in property)) {\r\n      property = defaultUnidimensionalValue;\r\n    }\r\n    var mult = 1 / property.mult;\r\n    var val = property.pv * mult;\r\n    var expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\r\n    expressionValue.value = val;\r\n    completeProperty(expressionValue, property, 'unidimensional');\r\n\r\n    return function () {\r\n      if (property.k) {\r\n        property.getValue();\r\n      }\r\n      val = property.v * mult;\r\n      if (expressionValue.value !== val) {\r\n        expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\r\n        expressionValue.value = val;\r\n        completeProperty(expressionValue, property, 'unidimensional');\r\n      }\r\n      return expressionValue;\r\n    };\r\n  }\r\n\r\n  function MultidimensionalPropertyInterface(property) {\r\n    if (!property || !('pv' in property)) {\r\n      property = defaultMultidimensionalValue;\r\n    }\r\n    var mult = 1 / property.mult;\r\n    var len = (property.data && property.data.l) || property.pv.length;\r\n    var expressionValue = createTypedArray('float32', len);\r\n    var arrValue = createTypedArray('float32', len);\r\n    expressionValue.value = arrValue;\r\n    completeProperty(expressionValue, property, 'multidimensional');\r\n\r\n    return function () {\r\n      if (property.k) {\r\n        property.getValue();\r\n      }\r\n      for (var i = 0; i < len; i += 1) {\r\n        arrValue[i] = property.v[i] * mult;\r\n        expressionValue[i] = arrValue[i];\r\n      }\r\n      return expressionValue;\r\n    };\r\n  }\r\n\r\n  // TODO: try to avoid using this getter\r\n  function defaultGetter() {\r\n    return defaultUnidimensionalValue;\r\n  }\r\n\r\n  return function (property) {\r\n    if (!property) {\r\n      return defaultGetter;\r\n    } if (property.propType === 'unidimensional') {\r\n      return UnidimensionalPropertyInterface(property);\r\n    }\r\n    return MultidimensionalPropertyInterface(property);\r\n  };\r\n}());\r\n\r\n/* global expressionHelpers, TextSelectorProp, ExpressionManager */\r\n/* exported TextExpressionSelectorPropFactory */\r\n\r\nvar TextExpressionSelectorPropFactory = (function () { // eslint-disable-line no-unused-vars\r\n  function getValueProxy(index, total) {\r\n    this.textIndex = index + 1;\r\n    this.textTotal = total;\r\n    this.v = this.getValue() * this.mult;\r\n    return this.v;\r\n  }\r\n\r\n  return function (elem, data) {\r\n    this.pv = 1;\r\n    this.comp = elem.comp;\r\n    this.elem = elem;\r\n    this.mult = 0.01;\r\n    this.propType = 'textSelector';\r\n    this.textTotal = data.totalChars;\r\n    this.selectorValue = 100;\r\n    this.lastValue = [1, 1, 1];\r\n    this.k = true;\r\n    this.x = true;\r\n    this.getValue = ExpressionManager.initiateExpression.bind(this)(elem, data, this);\r\n    this.getMult = getValueProxy;\r\n    this.getVelocityAtTime = expressionHelpers.getVelocityAtTime;\r\n    if (this.kf) {\r\n      this.getValueAtTime = expressionHelpers.getValueAtTime.bind(this);\r\n    } else {\r\n      this.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(this);\r\n    }\r\n    this.setGroupProperty = expressionHelpers.setGroupProperty;\r\n  };\r\n}());\r\n\r\nvar propertyGetTextProp = TextSelectorProp.getTextSelectorProp;\r\nTextSelectorProp.getTextSelectorProp = function (elem, data, arr) {\r\n  if (data.t === 1) {\r\n    return new TextExpressionSelectorPropFactory(elem, data, arr); // eslint-disable-line no-undef\r\n  }\r\n  return propertyGetTextProp(elem, data, arr);\r\n};\r\n\r\n/* global PropertyFactory */\r\n/* exported SliderEffect, AngleEffect, ColorEffect, PointEffect, LayerIndexEffect, MaskIndexEffect, CheckboxEffect, NoValueEffect */\r\n\r\nfunction SliderEffect(data, elem, container) {\r\n  this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n}\r\nfunction AngleEffect(data, elem, container) {\r\n  this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n}\r\nfunction ColorEffect(data, elem, container) {\r\n  this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\r\n}\r\nfunction PointEffect(data, elem, container) {\r\n  this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\r\n}\r\nfunction LayerIndexEffect(data, elem, container) {\r\n  this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n}\r\nfunction MaskIndexEffect(data, elem, container) {\r\n  this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n}\r\nfunction CheckboxEffect(data, elem, container) {\r\n  this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n}\r\nfunction NoValueEffect() {\r\n  this.p = {};\r\n}\r\n\r\n/* global extendPrototype, SliderEffect, AngleEffect, ColorEffect, PointEffect, CheckboxEffect, LayerIndexEffect,\r\nMaskIndexEffect, NoValueEffect, DynamicPropertyContainer */\r\n\r\nfunction EffectsManager(data, element) {\r\n  var effects = data.ef || [];\r\n  this.effectElements = [];\r\n  var i;\r\n  var len = effects.length;\r\n  var effectItem;\r\n  for (i = 0; i < len; i += 1) {\r\n    effectItem = new GroupEffect(effects[i], element);\r\n    this.effectElements.push(effectItem);\r\n  }\r\n}\r\n\r\nfunction GroupEffect(data, element) {\r\n  this.init(data, element);\r\n}\r\n\r\nextendPrototype([DynamicPropertyContainer], GroupEffect);\r\n\r\nGroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;\r\n\r\nGroupEffect.prototype.init = function (data, element) {\r\n  this.data = data;\r\n  this.effectElements = [];\r\n  this.initDynamicPropertyContainer(element);\r\n  var i;\r\n  var len = this.data.ef.length;\r\n  var eff;\r\n  var effects = this.data.ef;\r\n  for (i = 0; i < len; i += 1) {\r\n    eff = null;\r\n    switch (effects[i].ty) {\r\n      case 0:\r\n        eff = new SliderEffect(effects[i], element, this);\r\n        break;\r\n      case 1:\r\n        eff = new AngleEffect(effects[i], element, this);\r\n        break;\r\n      case 2:\r\n        eff = new ColorEffect(effects[i], element, this);\r\n        break;\r\n      case 3:\r\n        eff = new PointEffect(effects[i], element, this);\r\n        break;\r\n      case 4:\r\n      case 7:\r\n        eff = new CheckboxEffect(effects[i], element, this);\r\n        break;\r\n      case 10:\r\n        eff = new LayerIndexEffect(effects[i], element, this);\r\n        break;\r\n      case 11:\r\n        eff = new MaskIndexEffect(effects[i], element, this);\r\n        break;\r\n      case 5:\r\n        eff = new EffectsManager(effects[i], element, this);\r\n        break;\r\n        // case 6:\r\n      default:\r\n        eff = new NoValueEffect(effects[i], element, this);\r\n        break;\r\n    }\r\n    if (eff) {\r\n      this.effectElements.push(eff);\r\n    }\r\n  }\r\n};\r\n\r\n\r\nvar lottie = {};\r\n\r\nfunction setLocationHref(href) {\r\n  locationHref = href;\r\n}\r\n\r\nfunction searchAnimations() {\r\n  if (standalone === true) {\r\n    animationManager.searchAnimations(animationData, standalone, renderer);\r\n  } else {\r\n    animationManager.searchAnimations();\r\n  }\r\n}\r\n\r\nfunction setSubframeRendering(flag) {\r\n  subframeEnabled = flag;\r\n}\r\n\r\nfunction setIDPrefix(prefix) {\r\n  idPrefix = prefix;\r\n}\r\n\r\nfunction loadAnimation(params) {\r\n  if (standalone === true) {\r\n    params.animationData = JSON.parse(animationData);\r\n  }\r\n  return animationManager.loadAnimation(params);\r\n}\r\n\r\nfunction setQuality(value) {\r\n  if (typeof value === 'string') {\r\n    switch (value) {\r\n      case 'high':\r\n        defaultCurveSegments = 200;\r\n        break;\r\n      default:\r\n      case 'medium':\r\n        defaultCurveSegments = 50;\r\n        break;\r\n      case 'low':\r\n        defaultCurveSegments = 10;\r\n        break;\r\n    }\r\n  } else if (!isNaN(value) && value > 1) {\r\n    defaultCurveSegments = value;\r\n  }\r\n  if (defaultCurveSegments >= 50) {\r\n    roundValues(false);\r\n  } else {\r\n    roundValues(true);\r\n  }\r\n}\r\n\r\nfunction inBrowser() {\r\n  return typeof navigator !== 'undefined';\r\n}\r\n\r\nfunction installPlugin(type, plugin) {\r\n  if (type === 'expressions') {\r\n    expressionsPlugin = plugin;\r\n  }\r\n}\r\n\r\nfunction getFactory(name) {\r\n  switch (name) {\r\n    case 'propertyFactory':\r\n      return PropertyFactory;\r\n    case 'shapePropertyFactory':\r\n      return ShapePropertyFactory;\r\n    case 'matrix':\r\n      return Matrix;\r\n    default:\r\n      return null;\r\n  }\r\n}\r\n\r\nlottie.play = animationManager.play;\r\nlottie.pause = animationManager.pause;\r\nlottie.setLocationHref = setLocationHref;\r\nlottie.togglePause = animationManager.togglePause;\r\nlottie.setSpeed = animationManager.setSpeed;\r\nlottie.setDirection = animationManager.setDirection;\r\nlottie.stop = animationManager.stop;\r\nlottie.searchAnimations = searchAnimations;\r\nlottie.registerAnimation = animationManager.registerAnimation;\r\nlottie.loadAnimation = loadAnimation;\r\nlottie.setSubframeRendering = setSubframeRendering;\r\nlottie.resize = animationManager.resize;\r\n// lottie.start = start;\r\nlottie.goToAndStop = animationManager.goToAndStop;\r\nlottie.destroy = animationManager.destroy;\r\nlottie.setQuality = setQuality;\r\nlottie.inBrowser = inBrowser;\r\nlottie.installPlugin = installPlugin;\r\nlottie.freeze = animationManager.freeze;\r\nlottie.unfreeze = animationManager.unfreeze;\r\nlottie.setVolume = animationManager.setVolume;\r\nlottie.mute = animationManager.mute;\r\nlottie.unmute = animationManager.unmute;\r\nlottie.getRegisteredAnimations = animationManager.getRegisteredAnimations;\r\nlottie.setIDPrefix = setIDPrefix;\r\nlottie.__getFactory = getFactory;\r\nlottie.version = '5.7.14';\r\n\r\nfunction checkReady() {\r\n  if (document.readyState === 'complete') {\r\n    clearInterval(readyStateCheckInterval);\r\n    searchAnimations();\r\n  }\r\n}\r\n\r\nfunction getQueryVariable(variable) {\r\n  var vars = queryString.split('&');\r\n  for (var i = 0; i < vars.length; i += 1) {\r\n    var pair = vars[i].split('=');\r\n    if (decodeURIComponent(pair[0]) == variable) { // eslint-disable-line eqeqeq\r\n      return decodeURIComponent(pair[1]);\r\n    }\r\n  }\r\n  return null;\r\n}\r\nvar standalone = '__[STANDALONE]__';\r\nvar animationData = '__[ANIMATIONDATA]__';\r\nvar renderer = '';\r\nvar queryString;\r\nif (standalone) {\r\n  var scripts = document.getElementsByTagName('script');\r\n  var index = scripts.length - 1;\r\n  var myScript = scripts[index] || {\r\n    src: '',\r\n  };\r\n  queryString = myScript.src.replace(/^[^\\?]+\\??/, ''); // eslint-disable-line no-useless-escape\r\n  renderer = getQueryVariable('renderer');\r\n}\r\nvar readyStateCheckInterval = setInterval(checkReady, 100);\r\n\nreturn lottie;\n}));\n\n//# sourceURL=webpack:///./node_modules/lottie-web-vue/node_modules/lottie-web/build/player/lottie.js?");

/***/ }),

/***/ "./node_modules/vue-smooth-reflow/dist/vue-smooth-reflow.min.js":
/*!**********************************************************************!*\
  !*** ./node_modules/vue-smooth-reflow/dist/vue-smooth-reflow.min.js ***!
  \**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("!function(t,e){ true?module.exports=e():undefined}(\"undefined\"!=typeof self?self:this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,\"a\",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=\"\",n(n.s=44)}([function(t,e,n){var r=n(28)(\"wks\"),o=n(14),i=n(1).Symbol,u=\"function\"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)(\"Symbol.\"+t))}).store=r},function(t,e){var n=t.exports=\"undefined\"!=typeof window&&window.Math==Math?window:\"undefined\"!=typeof self&&self.Math==Math?self:Function(\"return this\")();\"number\"==typeof __g&&(__g=n)},function(t,e,n){var r=n(1),o=n(7),i=n(3),u=n(19),s=n(24),f=function(t,e,n){var a,c,l,p,v=t&f.F,h=t&f.G,y=t&f.S,d=t&f.P,m=t&f.B,g=h?r:y?r[e]||(r[e]={}):(r[e]||{}).prototype,b=h?o:o[e]||(o[e]={}),S=b.prototype||(b.prototype={});for(a in h&&(n=e),n)l=((c=!v&&g&&void 0!==g[a])?g:n)[a],p=m&&c?s(l,r):d&&\"function\"==typeof l?s(Function.call,l):l,g&&u(g,a,l,t&f.U),b[a]!=l&&i(b,a,p),d&&S[a]!=l&&(S[a]=l)};r.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,e,n){var r=n(4),o=n(13);t.exports=n(8)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(12),o=n(34),i=n(23),u=Object.defineProperty;e.f=n(8)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(t){}if(\"get\"in n||\"set\"in n)throw TypeError(\"Accessors not supported!\");return\"value\"in n&&(t[e]=n.value),t}},function(t,e){t.exports=function(t){return\"object\"==typeof t?null!==t:\"function\"==typeof t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e){var n=t.exports={version:\"2.5.7\"};\"number\"==typeof __e&&(__e=n)},function(t,e,n){t.exports=!n(9)(function(){return 7!=Object.defineProperty({},\"a\",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(37),o=n(29);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(25),o=n(17);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(5);t.exports=function(t){if(!r(t))throw TypeError(t+\" is not an object!\");return t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return\"Symbol(\".concat(void 0===t?\"\":t,\")_\",(++n+r).toString(36))}},function(t,e){t.exports={}},function(t,e,n){var r=n(17);t.exports=function(t){return Object(r(t))}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError(\"Can't call method on  \"+t);return t}},function(t,e){t.exports=!1},function(t,e,n){var r=n(1),o=n(3),i=n(6),u=n(14)(\"src\"),s=Function.toString,f=(\"\"+s).split(\"toString\");n(7).inspectSource=function(t){return s.call(t)},(t.exports=function(t,e,n,s){var a=\"function\"==typeof n;a&&(i(n,\"name\")||o(n,\"name\",e)),t[e]!==n&&(a&&(i(n,u)||o(n,u,t[e]?\"\"+t[e]:f.join(String(e)))),t===r?t[e]=n:s?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,\"toString\",function(){return\"function\"==typeof this&&this[u]||s.call(this)})},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(5);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&\"function\"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if(\"function\"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&\"function\"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError(\"Can't convert object to primitive value\")}},function(t,e,n){var r=n(47);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(20);t.exports=Object(\"z\").propertyIsEnumerable(0)?Object:function(t){return\"String\"==r(t)?t.split(\"\"):Object(t)}},function(t,e,n){var r=n(22),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(28)(\"keys\"),o=n(14);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(7),o=n(1),i=o[\"__core-js_shared__\"]||(o[\"__core-js_shared__\"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})(\"versions\",[]).push({version:r.version,mode:n(18)?\"pure\":\"global\",copyright:\"© 2018 Denis Pushkarev (zloirock.ru)\"})},function(t,e){t.exports=\"constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf\".split(\",\")},function(t,e,n){var r=n(4).f,o=n(6),i=n(0)(\"toStringTag\");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){var r=n(0)(\"unscopables\"),o=Array.prototype;void 0==o[r]&&n(3)(o,r,{}),t.exports=function(t){o[r][t]=!0}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){\"use strict\";var r=n(18),o=n(2),i=n(19),u=n(3),s=n(15),f=n(48),a=n(30),c=n(52),l=n(0)(\"iterator\"),p=!([].keys&&\"next\"in[].keys()),v=function(){return this};t.exports=function(t,e,n,h,y,d,m){f(n,e,h);var g,b,S,x=function(t){if(!p&&t in j)return j[t];switch(t){case\"keys\":case\"values\":return function(){return new n(this,t)}}return function(){return new n(this,t)}},w=e+\" Iterator\",E=\"values\"==y,O=!1,j=t.prototype,_=j[l]||j[\"@@iterator\"]||y&&j[y],T=_||x(y),A=y?E?x(\"entries\"):T:void 0,P=\"Array\"==e&&j.entries||_;if(P&&(S=c(P.call(new t)))!==Object.prototype&&S.next&&(a(S,w,!0),r||\"function\"==typeof S[l]||u(S,l,v)),E&&_&&\"values\"!==_.name&&(O=!0,T=function(){return _.call(this)}),r&&!m||!p&&!O&&j[l]||u(j,l,T),s[e]=T,s[w]=v,y)if(g={values:E?T:x(\"values\"),keys:d?T:x(\"keys\"),entries:A},m)for(b in g)b in j||i(j,b,g[b]);else o(o.P+o.F*(p||O),e,g);return g}},function(t,e,n){t.exports=!n(8)&&!n(9)(function(){return 7!=Object.defineProperty(n(35)(\"div\"),\"a\",{get:function(){return 7}}).a})},function(t,e,n){var r=n(5),o=n(1).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(12),o=n(49),i=n(29),u=n(27)(\"IE_PROTO\"),s=function(){},f=function(){var t,e=n(35)(\"iframe\"),r=i.length;for(e.style.display=\"none\",n(51).appendChild(e),e.src=\"javascript:\",(t=e.contentWindow.document).open(),t.write(\"<script>document.F=Object<\\/script>\"),t.close(),f=t.F;r--;)delete f.prototype[i[r]];return f()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[u]=t):n=f(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(6),o=n(11),i=n(38)(!1),u=n(27)(\"IE_PROTO\");t.exports=function(t,e){var n,s=o(t),f=0,a=[];for(n in s)n!=u&&r(s,n)&&a.push(n);for(;e.length>f;)r(s,n=e[f++])&&(~i(a,n)||a.push(n));return a}},function(t,e,n){var r=n(11),o=n(26),i=n(50);t.exports=function(t){return function(e,n,u){var s,f=r(e),a=o(f.length),c=i(u,a);if(t&&n!=n){for(;a>c;)if((s=f[c++])!=s)return!0}else for(;a>c;c++)if((t||c in f)&&f[c]===n)return t||c||0;return!t&&-1}}},function(t,e,n){\"use strict\";var r=n(31),o=n(65),i=n(15),u=n(11);t.exports=n(33)(Array,\"Array\",function(t,e){this._t=u(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):o(0,\"keys\"==e?n:\"values\"==e?t[n]:[n,t[n]])},\"values\"),i.Arguments=i.Array,r(\"keys\"),r(\"values\"),r(\"entries\")},function(t,e,n){var r=n(20);t.exports=Array.isArray||function(t){return\"Array\"==r(t)}},function(t,e,n){var r=n(1),o=n(7),i=n(18),u=n(42),s=n(4).f;t.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});\"_\"==t.charAt(0)||t in e||s(e,t,{value:u.f(t)})}},function(t,e,n){e.f=n(0)},function(t,e,n){var r=n(37),o=n(29).concat(\"length\",\"prototype\");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,e,n){\"use strict\";n.r(e);n(45),n(53),n(60),n(61),n(39),n(66),n(68),n(70),n(74),n(75),n(80);function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,\"value\"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o={methods:{$smoothReflow:function(t){var e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._smoothElements.push(new a(t))}.bind(this);Array.isArray(t)?t.forEach(e):e(t)},$unsmoothReflow:function(t){var e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f(),e=this.$el,n=this._smoothElements.findIndex(function(n){return u(e,n.options.el)===u(e,t.el)});if(-1===n)return void console.error(\"VSR_ERROR: $unsmoothReflow failed due to invalid el option\");this._smoothElements[n].scheduleRemoval()}.bind(this);Array.isArray(t)?t.forEach(e):e(t)}},beforeMount:function(){var t=this;this._smoothElements=[],this._endListener=function(e){var n=!0,r=!1,o=void 0;try{for(var i,u=t._smoothElements[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){i.value.endListener(e)}}catch(t){r=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(r)throw o}}}},mounted:function(){this.$el.addEventListener(\"transitionend\",this._endListener,{passive:!0})},destroyed:function(){this.$el.removeEventListener(\"transitionend\",this._endListener,{passive:!0})},beforeUpdate:function(){this.$el.addEventListener(\"transitionend\",this._endListener,{passive:!0}),i(this);var t=!0,e=!1,n=void 0;try{for(var r,o=this._smoothElements[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var s=r.value,f=u(this.$el,s.options.el);s.setSmoothElement(f),s.setBeforeValues()}}catch(t){e=!0,n=t}finally{try{t||null==o.return||o.return()}finally{if(e)throw n}}},updated:function(){var t=this;this.$nextTick(function(){var e=!0,n=!1,r=void 0;try{for(var o,s=t._smoothElements[Symbol.iterator]();!(e=(o=s.next()).done);e=!0){var f=o.value,a=u(t.$el,f.options.el);f.setSmoothElement(a),f.doSmoothReflow()}}catch(t){n=!0,r=t}finally{try{e||null==s.return||s.return()}finally{if(n)throw r}}i(t)})}};function i(t){for(var e=t._smoothElements.length;e--;){var n=t._smoothElements[e];n.isRemoved&&(n.stopTransition(),t._smoothElements.splice(e,1))}}function u(t,e){return!t||t instanceof Node&&t.nodeType===Node.COMMENT_NODE?null:null===e?t:function(t,e){return\"string\"==typeof e?t.matches(e)?t:t.querySelector(e):e}(t,e)}var s={INACTIVE:\"INACTIVE\",ACTIVE:\"ACTIVE\"},f=function(){return{el:null,property:\"height\",transitionEvent:null,hideOverflow:!0,debug:!1}},a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t);var n=f();Object.assign(n,e);var r=this.parsePropertyOption(n.property);n.transition||(n.transition=r.map(function(t){return\"\".concat(t,\" .5s\")}).join(\",\"));var o={$smoothEl:null,properties:r,beforeRect:{},state:s.INACTIVE,isRemoved:!1};Object.assign(this,{options:n},o),this.endListener=this.endListener.bind(this),this.debug=this.debug.bind(this)}return function(t,e,n){e&&r(t.prototype,e),n&&r(t,n)}(t,[{key:\"setSmoothElement\",value:function(t){this.$smoothEl=t}},{key:\"transitionTo\",value:function(t){this.state=t}},{key:\"parsePropertyOption\",value:function(t){return\"string\"==typeof t?[t]:Array.isArray(t)?t:[]}},{key:\"setBeforeValues\",value:function(){var t=this.$smoothEl;if(this.beforeRect={},t){var e=window.getComputedStyle(t)||{},n=e.transition,r=e.overflowX,o=e.overflowY;this.computedTransition=n,this.overflowX=r,this.overflowY=o,this.beforeRect=c(t),this.state===s.ACTIVE&&(this.stopTransition(),this.debug(\"Transition was interrupted.\"))}}},{key:\"didValuesChange\",value:function(t,e){var n=t,r=e;if(0===Object.keys(t).length)return!1;var o=!0,i=!1,u=void 0;try{for(var s,f=this.properties[Symbol.iterator]();!(o=(s=f.next()).done);o=!0){var a=s.value;if(\"transform\"===a&&(n.top!==r.top||n.left!==r.left))return!0;if(n[a]!==r[a])return!0}}catch(t){i=!0,u=t}finally{try{o||null==f.return||f.return()}finally{if(i)throw u}}return!1}},{key:\"doSmoothReflow\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"data update\",e=this.$smoothEl;if(!e)return this.debug(\"Could not find registered el to perform doSmoothReflow.\"),void this.transitionTo(s.INACTIVE);if(this.state!==s.ACTIVE){var n=this.beforeRect,r=this.properties,o=this.options,i=this.overflowX,u=this.overflowY,f=this.debug;this.transitionTo(s.ACTIVE),f(\"doSmoothReflow triggered by:\",\"string\"==typeof t?t:t.target);var a=c(e);if(!this.didValuesChange(n,a))return f(\"Property values did not change.\"),void this.transitionTo(s.INACTIVE);f(\"beforeRect\",n),f(\"afterRect\",a),this.saveOverflowValues(e,i,u);var l=!0,p=!1,v=void 0;try{for(var h,y=r[Symbol.iterator]();!(l=(h=y.next()).done);l=!0){var d=h.value;if(\"transform\"===d){var m=n.left-a.left,g=n.top-a.top;e.style.transform=\"translate(\".concat(m,\"px, \").concat(g,\"px)\")}else e.style[d]=n[d]+\"px\"}}catch(t){p=!0,v=t}finally{try{l||null==y.return||y.return()}finally{if(p)throw v}}e.offsetHeight,e.style.transition=[this.computedTransition,o.transition].filter(function(t){return t}).join(\",\");var b=!0,S=!1,x=void 0;try{for(var w,E=r[Symbol.iterator]();!(b=(w=E.next()).done);b=!0){var O=w.value;\"transform\"===O?e.style.transform=\"\":e.style[O]=a[O]+\"px\"}}catch(t){S=!0,x=t}finally{try{b||null==E.return||E.return()}finally{if(S)throw x}}}}},{key:\"endListener\",value:function(t){var e=this.$smoothEl,n=this.properties;e===t.target?n.includes(t.propertyName)&&(this.stopTransition(),this.hasRegisteredEventEmitter()&&this.setBeforeValues()):this.isRegisteredEventEmitter(e,t)&&this.doSmoothReflow(t)}},{key:\"hasRegisteredEventEmitter\",value:function(){var t=this.options.transitionEvent;return null!==t&&Object.keys(t).length>0}},{key:\"isRegisteredEventEmitter\",value:function(t,e){if(!this.hasRegisteredEventEmitter())return!1;var n=e.target,r=this.options.transitionEvent,o=r.selector,i=r.propertyName;if(null!=i&&i!==e.propertyName)return!1;if(null!=o&&!n.matches(o))return!1;if(-1===this.properties.indexOf(\"transform\")){var u=!1,s=e.composedPath?e.composedPath():[],f=!0,a=!1,c=void 0;try{for(var l,p=s[Symbol.iterator]();!(f=(l=p.next()).done);f=!0){if(t===l.value){u=!0;break}}}catch(t){a=!0,c=t}finally{try{f||null==p.return||p.return()}finally{if(a)throw c}}if(!u)return!1}return!0}},{key:\"saveOverflowValues\",value:function(t,e,n){this.options.hideOverflow&&(this.overflowX=e,this.overflowY=n,t.style.overflowX=\"hidden\",t.style.overflowY=\"hidden\")}},{key:\"restoreOverflowValues\",value:function(t){var e=this.options,n=this.overflowX,r=this.overflowY;e.hideOverflow&&(t.style.overflowX=n,t.style.overflowY=r)}},{key:\"stopTransition\",value:function(){var t=this.$smoothEl,e=this.properties,n=!0,r=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var f=i.value;t.style[f]=null}}catch(t){r=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(r)throw o}}this.restoreOverflowValues(t),t.style.transition=null,this.transitionTo(s.INACTIVE)}},{key:\"scheduleRemoval\",value:function(){this.isRemoved=!0}},{key:\"debug\",value:function(){if(this.options.debug){var t=[\"VSR_DEBUG:\"].concat(Array.from(arguments));console.log.apply(null,t)}}}]),t}(),c=function(t){t.style.overflow=\"hidden\";var e=t.getBoundingClientRect(),n=e.top,r=e.right,o=e.bottom,i=e.left,u=e.width,s=e.height,f=e.x,a=e.y;return t.style.overflow=null,{top:n,right:r,bottom:o,left:i,width:u,height:s,x:f,y:a}};\"undefined\"!=typeof Element&&Element.prototype&&!Element.prototype.matches&&(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;--n>=0&&e.item(n)!==this;);return n>-1}),e.default=o},function(t,e,n){\"use strict\";var r=n(46)(!0);n(33)(String,\"String\",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var r=n(22),o=n(17);t.exports=function(t){return function(e,n){var i,u,s=String(o(e)),f=r(n),a=s.length;return f<0||f>=a?t?\"\":void 0:(i=s.charCodeAt(f))<55296||i>56319||f+1===a||(u=s.charCodeAt(f+1))<56320||u>57343?t?s.charAt(f):i:t?s.slice(f,f+2):u-56320+(i-55296<<10)+65536}}},function(t,e){t.exports=function(t){if(\"function\"!=typeof t)throw TypeError(t+\" is not a function!\");return t}},function(t,e,n){\"use strict\";var r=n(36),o=n(13),i=n(30),u={};n(3)(u,n(0)(\"iterator\"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(u,{next:o(1,n)}),i(t,e+\" Iterator\")}},function(t,e,n){var r=n(4),o=n(12),i=n(10);t.exports=n(8)?Object.defineProperties:function(t,e){o(t);for(var n,u=i(e),s=u.length,f=0;s>f;)r.f(t,n=u[f++],e[n]);return t}},function(t,e,n){var r=n(22),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=r(t))<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(1).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(6),o=n(16),i=n(27)(\"IE_PROTO\"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:\"function\"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,e,n){\"use strict\";var r=n(24),o=n(2),i=n(16),u=n(54),s=n(55),f=n(26),a=n(56),c=n(57);o(o.S+o.F*!n(59)(function(t){Array.from(t)}),\"Array\",{from:function(t){var e,n,o,l,p=i(t),v=\"function\"==typeof this?this:Array,h=arguments.length,y=h>1?arguments[1]:void 0,d=void 0!==y,m=0,g=c(p);if(d&&(y=r(y,h>2?arguments[2]:void 0,2)),void 0==g||v==Array&&s(g))for(n=new v(e=f(p.length));e>m;m++)a(n,m,d?y(p[m],m):p[m]);else for(l=g.call(p),n=new v;!(o=l.next()).done;m++)a(n,m,d?u(l,y,[o.value,m],!0):o.value);return n.length=m,n}})},function(t,e,n){var r=n(12);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},function(t,e,n){var r=n(15),o=n(0)(\"iterator\"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},function(t,e,n){\"use strict\";var r=n(4),o=n(13);t.exports=function(t,e,n){e in t?r.f(t,e,o(0,n)):t[e]=n}},function(t,e,n){var r=n(58),o=n(0)(\"iterator\"),i=n(15);t.exports=n(7).getIteratorMethod=function(t){if(void 0!=t)return t[o]||t[\"@@iterator\"]||i[r(t)]}},function(t,e,n){var r=n(20),o=n(0)(\"toStringTag\"),i=\"Arguments\"==r(function(){return arguments}());t.exports=function(t){var e,n,u;return void 0===t?\"Undefined\":null===t?\"Null\":\"string\"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?n:i?r(e):\"Object\"==(u=r(e))&&\"function\"==typeof e.callee?\"Arguments\":u}},function(t,e,n){var r=n(0)(\"iterator\"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],u=i[r]();u.next=function(){return{done:n=!0}},i[r]=function(){return u},t(i)}catch(t){}return n}},function(t,e,n){\"use strict\";var r=n(2),o=n(38)(!0);r(r.P,\"Array\",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),n(31)(\"includes\")},function(t,e,n){\"use strict\";var r=n(2),o=n(62);r(r.P+r.F*n(64)(\"includes\"),\"String\",{includes:function(t){return!!~o(this,t,\"includes\").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(63),o=n(17);t.exports=function(t,e,n){if(r(e))throw TypeError(\"String#\"+n+\" doesn't accept regex!\");return String(o(t))}},function(t,e,n){var r=n(5),o=n(20),i=n(0)(\"match\");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[i])?!!e:\"RegExp\"==o(t))}},function(t,e,n){var r=n(0)(\"match\");t.exports=function(t){var e=/./;try{\"/./\"[t](e)}catch(n){try{return e[r]=!1,!\"/./\"[t](e)}catch(t){}}return!0}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var r=n(16),o=n(10);n(67)(\"keys\",function(){return function(t){return o(r(t))}})},function(t,e,n){var r=n(2),o=n(7),i=n(9);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],u={};u[t]=e(n),r(r.S+r.F*i(function(){n(1)}),\"Object\",u)}},function(t,e,n){var r=n(2);r(r.S+r.F,\"Object\",{assign:n(69)})},function(t,e,n){\"use strict\";var r=n(10),o=n(32),i=n(21),u=n(16),s=n(25),f=Object.assign;t.exports=!f||n(9)(function(){var t={},e={},n=Symbol(),r=\"abcdefghijklmnopqrst\";return t[n]=7,r.split(\"\").forEach(function(t){e[t]=t}),7!=f({},t)[n]||Object.keys(f({},e)).join(\"\")!=r})?function(t,e){for(var n=u(t),f=arguments.length,a=1,c=o.f,l=i.f;f>a;)for(var p,v=s(arguments[a++]),h=c?r(v).concat(c(v)):r(v),y=h.length,d=0;y>d;)l.call(v,p=h[d++])&&(n[p]=v[p]);return n}:f},function(t,e,n){\"use strict\";var r=n(2),o=n(71)(6),i=\"findIndex\",u=!0;i in[]&&Array(1)[i](function(){u=!1}),r(r.P+r.F*u,\"Array\",{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),n(31)(i)},function(t,e,n){var r=n(24),o=n(25),i=n(16),u=n(26),s=n(72);t.exports=function(t,e){var n=1==t,f=2==t,a=3==t,c=4==t,l=6==t,p=5==t||l,v=e||s;return function(e,s,h){for(var y,d,m=i(e),g=o(m),b=r(s,h,3),S=u(g.length),x=0,w=n?v(e,S):f?v(e,0):void 0;S>x;x++)if((p||x in g)&&(d=b(y=g[x],x,m),t))if(n)w[x]=d;else if(d)switch(t){case 3:return!0;case 5:return y;case 6:return x;case 2:w.push(y)}else if(c)return!1;return l?-1:a||c?c:w}}},function(t,e,n){var r=n(73);t.exports=function(t,e){return new(r(t))(e)}},function(t,e,n){var r=n(5),o=n(40),i=n(0)(\"species\");t.exports=function(t){var e;return o(t)&&(\"function\"!=typeof(e=t.constructor)||e!==Array&&!o(e.prototype)||(e=void 0),r(e)&&null===(e=e[i])&&(e=void 0)),void 0===e?Array:e}},function(t,e,n){n(41)(\"asyncIterator\")},function(t,e,n){\"use strict\";var r=n(1),o=n(6),i=n(8),u=n(2),s=n(19),f=n(76).KEY,a=n(9),c=n(28),l=n(30),p=n(14),v=n(0),h=n(42),y=n(41),d=n(77),m=n(40),g=n(12),b=n(5),S=n(11),x=n(23),w=n(13),E=n(36),O=n(78),j=n(79),_=n(4),T=n(10),A=j.f,P=_.f,k=O.f,R=r.Symbol,L=r.JSON,I=L&&L.stringify,M=v(\"_hidden\"),C=v(\"toPrimitive\"),N={}.propertyIsEnumerable,V=c(\"symbol-registry\"),F=c(\"symbols\"),$=c(\"op-symbols\"),D=Object.prototype,G=\"function\"==typeof R,Y=r.QObject,B=!Y||!Y.prototype||!Y.prototype.findChild,X=i&&a(function(){return 7!=E(P({},\"a\",{get:function(){return P(this,\"a\",{value:7}).a}})).a})?function(t,e,n){var r=A(D,e);r&&delete D[e],P(t,e,n),r&&t!==D&&P(D,e,r)}:P,H=function(t){var e=F[t]=E(R.prototype);return e._k=t,e},U=G&&\"symbol\"==typeof R.iterator?function(t){return\"symbol\"==typeof t}:function(t){return t instanceof R},W=function(t,e,n){return t===D&&W($,e,n),g(t),e=x(e,!0),g(n),o(F,e)?(n.enumerable?(o(t,M)&&t[M][e]&&(t[M][e]=!1),n=E(n,{enumerable:w(0,!1)})):(o(t,M)||P(t,M,w(1,{})),t[M][e]=!0),X(t,e,n)):P(t,e,n)},q=function(t,e){g(t);for(var n,r=d(e=S(e)),o=0,i=r.length;i>o;)W(t,n=r[o++],e[n]);return t},z=function(t){var e=N.call(this,t=x(t,!0));return!(this===D&&o(F,t)&&!o($,t))&&(!(e||!o(this,t)||!o(F,t)||o(this,M)&&this[M][t])||e)},J=function(t,e){if(t=S(t),e=x(e,!0),t!==D||!o(F,e)||o($,e)){var n=A(t,e);return!n||!o(F,e)||o(t,M)&&t[M][e]||(n.enumerable=!0),n}},K=function(t){for(var e,n=k(S(t)),r=[],i=0;n.length>i;)o(F,e=n[i++])||e==M||e==f||r.push(e);return r},Q=function(t){for(var e,n=t===D,r=k(n?$:S(t)),i=[],u=0;r.length>u;)!o(F,e=r[u++])||n&&!o(D,e)||i.push(F[e]);return i};G||(s((R=function(){if(this instanceof R)throw TypeError(\"Symbol is not a constructor!\");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===D&&e.call($,n),o(this,M)&&o(this[M],t)&&(this[M][t]=!1),X(this,t,w(1,n))};return i&&B&&X(D,t,{configurable:!0,set:e}),H(t)}).prototype,\"toString\",function(){return this._k}),j.f=J,_.f=W,n(43).f=O.f=K,n(21).f=z,n(32).f=Q,i&&!n(18)&&s(D,\"propertyIsEnumerable\",z,!0),h.f=function(t){return H(v(t))}),u(u.G+u.W+u.F*!G,{Symbol:R});for(var Z=\"hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables\".split(\",\"),tt=0;Z.length>tt;)v(Z[tt++]);for(var et=T(v.store),nt=0;et.length>nt;)y(et[nt++]);u(u.S+u.F*!G,\"Symbol\",{for:function(t){return o(V,t+=\"\")?V[t]:V[t]=R(t)},keyFor:function(t){if(!U(t))throw TypeError(t+\" is not a symbol!\");for(var e in V)if(V[e]===t)return e},useSetter:function(){B=!0},useSimple:function(){B=!1}}),u(u.S+u.F*!G,\"Object\",{create:function(t,e){return void 0===e?E(t):q(E(t),e)},defineProperty:W,defineProperties:q,getOwnPropertyDescriptor:J,getOwnPropertyNames:K,getOwnPropertySymbols:Q}),L&&u(u.S+u.F*(!G||a(function(){var t=R();return\"[null]\"!=I([t])||\"{}\"!=I({a:t})||\"{}\"!=I(Object(t))})),\"JSON\",{stringify:function(t){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=e=r[1],(b(e)||void 0!==t)&&!U(t))return m(e)||(e=function(t,e){if(\"function\"==typeof n&&(e=n.call(this,t,e)),!U(e))return e}),r[1]=e,I.apply(L,r)}}),R.prototype[C]||n(3)(R.prototype,C,R.prototype.valueOf),l(R,\"Symbol\"),l(Math,\"Math\",!0),l(r.JSON,\"JSON\",!0)},function(t,e,n){var r=n(14)(\"meta\"),o=n(5),i=n(6),u=n(4).f,s=0,f=Object.isExtensible||function(){return!0},a=!n(9)(function(){return f(Object.preventExtensions({}))}),c=function(t){u(t,r,{value:{i:\"O\"+ ++s,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!o(t))return\"symbol\"==typeof t?t:(\"string\"==typeof t?\"S\":\"P\")+t;if(!i(t,r)){if(!f(t))return\"F\";if(!e)return\"E\";c(t)}return t[r].i},getWeak:function(t,e){if(!i(t,r)){if(!f(t))return!0;if(!e)return!1;c(t)}return t[r].w},onFreeze:function(t){return a&&l.NEED&&f(t)&&!i(t,r)&&c(t),t}}},function(t,e,n){var r=n(10),o=n(32),i=n(21);t.exports=function(t){var e=r(t),n=o.f;if(n)for(var u,s=n(t),f=i.f,a=0;s.length>a;)f.call(t,u=s[a++])&&e.push(u);return e}},function(t,e,n){var r=n(11),o=n(43).f,i={}.toString,u=\"object\"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&\"[object Window]\"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(r(t))}},function(t,e,n){var r=n(21),o=n(13),i=n(11),u=n(23),s=n(6),f=n(34),a=Object.getOwnPropertyDescriptor;e.f=n(8)?a:function(t,e){if(t=i(t),e=u(e,!0),f)try{return a(t,e)}catch(t){}if(s(t,e))return o(!r.f.call(t,e),t[e])}},function(t,e,n){for(var r=n(39),o=n(10),i=n(19),u=n(1),s=n(3),f=n(15),a=n(0),c=a(\"iterator\"),l=a(\"toStringTag\"),p=f.Array,v={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=o(v),y=0;y<h.length;y++){var d,m=h[y],g=v[m],b=u[m],S=b&&b.prototype;if(S&&(S[c]||s(S,c,p),S[l]||s(S,l,m),f[m]=p,g))for(d in r)S[d]||i(S,d,r[d],!0)}}]).default});\n\n//# sourceURL=webpack:///./node_modules/vue-smooth-reflow/dist/vue-smooth-reflow.min.js?");

/***/ }),

/***/ "./src/assets/img/wuji.svg":
/*!*********************************!*\
  !*** ./src/assets/img/wuji.svg ***!
  \*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("module.exports = __webpack_require__.p + \"img/wuji.b6d17cf2.svg\";\n\n//# sourceURL=webpack:///./src/assets/img/wuji.svg?");

/***/ })

}]);