/**handles:twbbwg-circle**/ !function(i){var t;"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?(i(t=require("jquery")),module.exports=t):i(jQuery)}(function(u){function s(i){this.init(i)}s.prototype={value:0,size:100,startAngle:-Math.PI,thickness:"auto",fill:{gradient:["#3aeabb","#fdd250"]},emptyFill:"rgba(0, 0, 0, .1)",animation:{duration:1200,easing:"circleProgressEasing"},animationStartValue:0,reverse:!1,lineCap:"butt",insertMode:"prepend",constructor:s,el:null,canvas:null,ctx:null,radius:0,arcFill:null,lastFrameValue:0,init:function(i){u.extend(this,i),this.radius=this.size/2,this.initWidget(),this.initFill(),this.draw(),this.el.trigger("circle-inited")},initWidget:function(){this.canvas||(this.canvas=u("")["prepend"==this.insertMode?"prependTo":"appendTo"](this.el)[0]);var i=this.canvas,t;i.width=this.size,i.height=this.size,this.ctx=i.getContext("2d"),1")[0];i.width=t.size,i.height=t.size,i.getContext("2d").drawImage(n,0,0,a,a),t.arcFill=t.ctx.createPattern(i,"no-repeat"),t.drawFrame(t.lastFrameValue)}i.image&&(i.image instanceof Image?n=i.image:(n=new Image).src=i.image,n.complete?d():n.onload=d)},draw:function(){this.animation?this.drawAnimated(this.value):this.drawFrame(this.value)},drawFrame:function(i){this.lastFrameValue=i,this.ctx.clearRect(0,0,this.size,this.size),this.drawEmptyArc(i),this.drawArc(i)},drawArc:function(i){var t,e,a,n;0!==i&&(t=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle,t.save(),t.beginPath(),this.reverse?t.arc(e,e,e-a/2,n-2*Math.PI*i,n):t.arc(e,e,e-a/2,n,n+2*Math.PI*i),t.lineWidth=a,t.lineCap=this.lineCap,t.strokeStyle=this.arcFill,t.stroke(),t.restore())},drawEmptyArc:function(i){var t=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle;i<1&&(t.save(),t.beginPath(),i<=0?t.arc(e,e,e-a/2,0,2*Math.PI):this.reverse?t.arc(e,e,e-a/2,n,n-2*Math.PI*i):t.arc(e,e,e-a/2,n+2*Math.PI*i,n),t.lineWidth=a,t.strokeStyle=this.emptyFill,t.stroke(),t.restore())},drawAnimated:function(e){var a=this,n=this.el,i=u(this.canvas);i.stop(!0,!1),n.trigger("circle-animation-start"),i.css({animationProgress:0}).animate({animationProgress:1},u.extend({},this.animation,{step:function(i){var t=a.animationStartValue*(1-i)+e*i;a.drawFrame(t),n.trigger("circle-animation-progress",[i,t])}})).promise().always(function(){n.trigger("circle-animation-end")})},getThickness:function(){return u.isNumeric(this.thickness)?this.thickness:this.size/14},getValue:function(){return this.value},setValue:function(i){this.animation&&(this.animationStartValue=this.lastFrameValue),this.value=i,this.draw()}},u.circleProgress={defaults:s.prototype},u.easing.circleProgressEasing=function(i){return i<.5?.5*(i*=2)*i*i:1-.5*(i=2-2*i)*i*i},u.fn.circleProgress=function(n,i){var r="circle-progress",t=this.data(r);if("widget"==n){if(!t)throw Error('Calling "widget" method on not initialized instance is forbidden');return t.canvas}if("value"!=n)return this.each(function(){var i=u(this),t=i.data(r),e=u.isPlainObject(n)?n:{},a;t?t.init(e):("string"==typeof(a=u.extend({},i.data())).fill&&(a.fill=JSON.parse(a.fill)),"string"==typeof a.animation&&(a.animation=JSON.parse(a.animation)),(e=u.extend(a,e)).el=i,t=new s(e),i.data(r,t))});if(!t)throw Error('Calling "value" method on not initialized instance is forbidden');if(void 0===i)return t.getValue();var e=i;return this.each(function(){u(this).data(r).setValue(e)})}});