{"version":3,"sources":["webpack:///src/components/UI/AnimatedNumber.vue","webpack:///./src/components/UI/AnimatedNumber.vue","webpack:///./src/components/UI/AnimatedNumber.vue?f182","webpack:///./src/components/UI/AnimatedNumber.vue?18fa","webpack:///./src/components/UI/AnimatedNumber.vue?e6b0"],"names":["props","value","Number","formatter","type","Function","default","x","Math","round","toString","replace","html","Boolean","speed","validator","data","displayValue","computed","parsedValue","parseFloat","endTimeInterval","changeDecayRatio","methods","updateDisplayValue","abs","$emit","change","ceil","floor","timeOut","window","setTimeout","mounted","watch","isNaN","render","_vm","_c","_self","domProps","innerHTML","_s","_v","staticRenderFns","_withStripped"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASe;EACfA,KAAA;IACA;IACAC,KAAA,EAAAC,MAAA;IACA;IACA;IACAC,SAAA;MACAC,IAAA,EAAAC,QAAA;MACAC,OAAA,WAAAA,SAAAC,CAAA;QAAA,OACA,CAAAC,IAAA,CAAAC,KAAA,CAAAF,CAAA,eACAG,QAAA,GACAC,OAAA;MAAA;IACA;IACA;IACA;IACAC,IAAA;MACAR,IAAA,EAAAS,OAAA;MACAP,OAAA;IACA;IACA;IACAQ,KAAA;MACAV,IAAA,EAAAF,MAAA;MACAI,OAAA;MACAS,SAAA,WAAAA,UAAAd,KAAA;QACA,IAAAA,KAAA,SAAAA,KAAA;UACA;UACA;UACA;UACA;QACA;UACA;QACA;MACA;IACA;EACA;EACA;EACAe,IAAA,WAAAA,KAAA;IACA;MACAC,YAAA;IACA;EACA;EACA;EACA;EACAC,QAAA;IACAC,WAAA,WAAAA,YAAA;MACA,OAAAC,UAAA,MAAAnB,KAAA;IACA;IACA;IACAoB,eAAA,WAAAA,gBAAA;MACA,uBAAAP,KAAA;IACA;IACA;IACAQ,gBAAA,WAAAA,iBAAA;MACA,qBAAAR,KAAA;IACA;EACA;EACA;EACAS,OAAA;IACAC,kBAAA,WAAAA,mBAAA;MACA;MACA;MACA,IAAAhB,IAAA,CAAAiB,GAAA,MAAAR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AG,CAAClC,SAAS,CAACkC,GAAG,CAACpB,YAAY,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AAC/E,CAAC;AACD,IAAI2B,eAAe,GAAG,EAAE;AACxBR,MAAM,CAACS,aAAa,GAAG,IAAI;;;;;;;;;;;;;;ACV3B;AAAA;AAAA;AAAA;AAA4F;AAC3B;AACL;;;AAG5D;AAC6F;AAC7F,gBAAgB,mHAAU;AAC1B,EAAE,2FAAM;AACR,EAAE,gGAAM;AACR,EAAE,yGAAe;AACjB;AACA;AACA;AACA;;AAEA;;AAEA;AACA,IAAI,KAAU,EAAE,YAiBf;AACD;AACe,gF;;;;;;;;;;;;;ACtCf;AAAsS,CAAgB,gVAAG,EAAC,C;;;;;;;;;;;;;ACA1T;AAAA;AAAA;AAAA;AAAA","file":"js/86.js?id=90723d1811cb322f4b55","sourcesContent":["<template>\n  <!-- if we are formatting the value as html -->\n  <span v-if=\"html\" v-html=\"formatter(displayValue)\"></span>\n\n  <!-- otherwise just the bare value -->\n  <span v-else> {{ formatter(displayValue) }} </span>\n</template>\n\n<script>\nexport default {\n  props: {\n    // the value to display\n    value: Number,\n    // formatter function for the value, default is\n    // to put commas every 3 digits and round number to 2 dp\n    formatter: {\n      type: Function,\n      default: x =>\n        (Math.round(x * 100) / 100)\n          .toString()\n          .replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")\n    },\n    // whether or not to render the value as html\n    // maps to Vue's v-html directive\n    html: {\n      type: Boolean,\n      default: false\n    },\n    // a number from 1 - 10 of how quickly to animate the changes\n    speed: {\n      type: Number,\n      default: 5,\n      validator: function(value) {\n        if (value >= 1 && value <= 10) {\n          // console.warn(\n          //   'Prop \"speed\" for component  \"AnimatedNumber\" needs to be an integer between 1 and 10'\n          // );\n          return true;\n        } else {\n          return false;\n        }\n      }\n    }\n  },\n  // initialize to 0\n  data() {\n    return {\n      displayValue: 0\n    };\n  },\n  // in case prop type check fails (e.g. a string is parsed)\n  // try figure it out here\n  computed: {\n    parsedValue: function() {\n      return parseFloat(this.value);\n    },\n    // will range from 60 => 150\n    endTimeInterval: function() {\n      return 50 + 100 / this.speed;\n    },\n    // will range from 2 => 11\n    changeDecayRatio: function() {\n      return 1 + 10 / this.speed;\n    }\n  },\n  // function to update the display value in an animated fashiion\n  methods: {\n    updateDisplayValue() {\n      // if the difference is under one, set them equal to avoid asymptotic\n      // approach (this can happen if the initial value is < 1)\n      if (Math.abs(this.displayValue - this.parsedValue) < 1) {\n        this.displayValue = this.parsedValue;\n      }\n      // if the real value already matches the display one, return and emit event\n      // this is the recursive base case\n      if (this.parsedValue === this.displayValue) {\n        this.$emit(\"finished-update\");\n      }\n      // otherwise calculate value change and time interval, and make the recursive call\n      else {\n        // change is the current difference, divided by our ratio\n        // this will result in logarithmic decay\n        // note that we ensure to floor or ceiling the value depending on whether it\n        // is negative or positive, in order to avoid asymptotic approaches\n        let change =\n          (this.parsedValue - this.displayValue) / this.changeDecayRatio;\n        change = change >= 0 ? Math.ceil(change) : Math.floor(change);\n        this.displayValue += change;\n        // timeout is minInterval plus the difference to max interval, scaled by the\n        // inverse of change. Thus we will begin at minInterval and eventually reach maxInterval\n        let timeOut = 30 + (this.endTimeInterval - 30) / Math.abs(change);\n        window.setTimeout(this.updateDisplayValue, timeOut);\n      }\n    }\n  },\n  // initialize to target value on mount\n  mounted() {\n    this.displayValue = this.parsedValue;\n  },\n  // call the update function when value changes\n  // also handle the case where we're going from an invalid value\n  // to a valid one, by setting displayValue to 0\n  watch: {\n    value: function() {\n      if (isNaN(this.displayValue)) {\n        this.displayValue = 0;\n      }\n      window.setTimeout(this.updateDisplayValue, 0);\n      this.$emit(\"started-update\");\n    }\n  }\n};\n</script>\n","var render = function render() {\n  var _vm = this,\n    _c = _vm._self._c\n  return _vm.html\n    ? _c(\"span\", {\n        domProps: { innerHTML: _vm._s(_vm.formatter(_vm.displayValue)) },\n      })\n    : _c(\"span\", [_vm._v(\" \" + _vm._s(_vm.formatter(_vm.displayValue)) + \" \")])\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","import { render, staticRenderFns } from \"./AnimatedNumber.vue?vue&type=template&id=ca508f32\"\nimport script from \"./AnimatedNumber.vue?vue&type=script&lang=js\"\nexport * from \"./AnimatedNumber.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\n/* hot reload */\nif (module.hot) {\n  var api = require(\"/github/workspace/node_modules/vue-hot-reload-api/dist/index.js\")\n  api.install(require('vue'))\n  if (api.compatible) {\n    module.hot.accept()\n    if (!api.isRecorded('ca508f32')) {\n      api.createRecord('ca508f32', component.options)\n    } else {\n      api.reload('ca508f32', component.options)\n    }\n    module.hot.accept(\"./AnimatedNumber.vue?vue&type=template&id=ca508f32\", function () {\n      api.rerender('ca508f32', {\n        render: render,\n        staticRenderFns: staticRenderFns\n      })\n    })\n  }\n}\ncomponent.options.__file = \"src/components/UI/AnimatedNumber.vue\"\nexport default component.exports","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AnimatedNumber.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AnimatedNumber.vue?vue&type=script&lang=js\"","export * from \"-!../../../node_modules/cache-loader/dist/cjs.js?{\\\"cacheDirectory\\\":\\\"node_modules/.cache/vue-loader\\\",\\\"cacheIdentifier\\\":\\\"381a4baa-vue-loader-template\\\"}!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AnimatedNumber.vue?vue&type=template&id=ca508f32\""],"sourceRoot":""}