!function(t,e){"function"==typeof define&&define.amd?define(["angular","chartist"],e):"object"==typeof exports?module.exports=e(require("angular"),require("chartist")):t.angularChartist=e(t.angular,t.Chartist)}(this,function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(){return{restrict:"EA",scope:{data:"=chartistData",chartType:"@chartistChartType",events:"&chartistEvents",chartOptions:"&chartistChartOptions",responsiveOptions:"&chartistResponsiveOptions"},controller:"AngularChartistCtrl",link:function(t,e,n,r){r.element=e[0]}}}var i=function(){function t(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)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function(){function t(e){var r=this;n(this,t),this.data=e.data,this.chartType=e.chartType,this.events=e.events()||{},this.options=e.chartOptions()||null,this.responsiveOptions=e.responsiveOptions()||null,e.$watch(function(){return{data:e.data,chartType:e.chartType,chartOptions:e.chartOptions()}},this.update.bind(this),!0),e.$on("$destroy",function(){r.chart&&r.chart.detach()})}return i(t,[{key:"bindEvents",value:function(){var t=this;Object.keys(this.events).forEach(function(e){t.chart.on(e,t.events[e])})}},{key:"renderChart",value:function(){return this.data?(this.chart=e[this.chartType](this.element,this.data,this.options,this.responsiveOptions),this.bindEvents(),this.chart):void 0}},{key:"update",value:function(t,e){this.chartType=t.chartType,this.data=t.data,this.options=t.chartOptions,this.chart&&t.chartType===e.chartType?this.chart.update(this.data,this.options):this.renderChart()}},{key:"element",set:function(t){this._element=t,this.renderChart()},get:function(){return this._element}}]),t}();a.$inject=["$scope"],r.$inject=[];var s=t.module("angular-chartist",[]).controller("AngularChartistCtrl",a).directive("chartist",r);return s});