!function(t,e,i){function s(e,i,s){this.index=s,this.element=e,this.config=t.extend({},o,i),this._defaults=o,this._name=n,this.init()}var r=0,n="svgprogress",o={figure:"hexagon",endFill:100,unitsOutput:"%",progressFill:"#fcbf02",progressFillGradient:[],progressWidth:2,background:"transparent",emptyFill:"#999",emptyFillOpacity:.3,animationDuration:2,onProgressState:function(){},onAnimationComplate:function(){}};s.prototype.init=function(){var e=0,s=function(i,r){if(e<o.endFill&&r!==!0)setTimeout(s,i,i),e++,o.onProgressState(e),t(n).find(".svg-progress-output").html(e+o.unitsOutput);else{if(!(r===!0&&e>0))return o.onAnimationComplate(),void(e=0);setTimeout(s,i,i,!0),e--,o.onProgressState(e),t(n).find(".svg-progress-output").html(e+o.unitsOutput)}},n=this.element,o=this.config,a=this.index,h={width:t(n).width(),height:t(n).height(),getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},startProgress:function(t){if(0===e){var i=t.getTotalLength(),r=o.endFill>100?100:o.endFill;this.pathLength=i,t.style.transition=t.style.WebkitTransition="none",t.style.strokeDasharray=i+" "+i,t.style.strokeDashoffset=i,t.getBoundingClientRect(),t.style.transition=t.style.WebkitTransition="stroke-dashoffset "+o.animationDuration+"s ease-in-out",t.style.strokeDashoffset=(i*(100-r)/100).toString(),s(1e3*o.animationDuration/o.endFill)}},reverseProgress:function(t){if(0!==this.pathLength&&0===e){var i=t.getTotalLength(),r=o.endFill>100?100:o.endFill;this.pathLength=0,e=r,t.style.transition=t.style.WebkitTransition="stroke-dashoffset "+o.animationDuration+"s ease-in-out",t.style.strokeDashoffset=i,s(1e3*o.animationDuration/r,!0)}},destroyProgress:function(t){if(0!==this.pathLength){var e=t.getTotalLength();this.pathLength=0,t.style.transition=t.style.WebkitTransition="none",t.style.strokeDashoffset=e}},selectFigure:function(){var t=this.width/4,e=0==this.height?this.width/4:this.height/4,i=null;if("string"==typeof o.figure)switch(o.figure){case"hexagon":i="M0 "+3*e+" 0 "+e+"L 0 "+e+" "+2*t+" 0L "+4*t+" "+e+"L "+4*t+" "+3*e+"L "+4*t+" "+3*e+" "+2*t+" "+4*e+" 0 "+3*e+" Z";break;case"rhomb":i="M0 "+2*e+" "+2*t+" 0L "+2*t+" 0 "+4*t+" "+2*e+"L "+4*t+" "+2*e+" "+2*t+" "+4*e+" 0 "+2*e+" Z";break;case"rect":i="M0 "+4*e+" 0 0L "+4*t+" 0 "+4*t+" "+4*e+"L 0 "+4*e+" 0 "+4*e+" Z";break;case"triangle":i="M"+2*t+" 0 "+4*t+" "+4*e+"L "+4*t+" "+4*e+"L 0 "+4*e+" Z";break;case"pentagon":i="M0 "+2*e+" "+2*t+" 0L "+2*t+" 0 "+4*t+" "+2*e+"L "+3*t+" "+4*e+"  "+t+" "+4*e+" Z";break;case"circle":i="M 0,"+2*t+" a "+2*t+","+2*t+" 0 1,0 "+4*t+",0a"+2*t+" ,"+2*t+" 0 1 0 -"+4*t+" 0"}else i=o.figure.path;return i},createMarkup:function(){var t=this.selectFigure(),e="string"==typeof o.figure?o.figure:"path";this.height===!1?(this.width,o.progressWidth):(this.height,o.progressWidth);return gradient="",strokeFill=null,o.progressFillGradient.length>0&&o.progressFillGradient.length<3?(gradient='<defs><linearGradient id="linear'+e+"-progress"+a+r+'" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%"   stop-color="'+o.progressFillGradient[0]+'"/><stop offset="100%" stop-color="'+o.progressFillGradient[1]+'"/></linearGradient></defs>',strokeFill="url(#linear"+e+"-progress"+a+r+")"):strokeFill=o.progressFill,newSvg='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"width="'+this.width+'px" height="'+this.height+'px" viewBox="'+-o.progressWidth/2+" "+-o.progressWidth/2+" "+(this.width+o.progressWidth)+" "+(0==this.height?this.width+o.progressWidth:this.height+o.progressWidth)+'"preserveAspectRatio="xMidYMid meet" class="'+e+"-progress"+a+r+'" xmlns:svg="http://www.w3.org/2000/svg">'+gradient+'<path stroke="'+strokeFill+'" class="polygon" style="stroke-width: '+o.progressWidth+'px;" d="'+t+'" fill="'+o.background+'"></path></svg>'},bildProgressFigure:function(){"circle"===o.figure&&(t(n).css("height",this.width+"px"),this.height=this.width),t(n).append(this.createMarkup()).find(".svg-progress-output").html("0"+o.unitsOutput);var e="string"==typeof o.figure?o.figure:"path",s=i.querySelector("."+e+"-progress"+a+r+" path"),l=s.getTotalLength();t(s).clone().appendTo(t(n).find("svg")).attr({"stroke-opacity":o.emptyFillOpacity,stroke:o.emptyFill}),s.style.strokeDasharray=l+" "+l,s.style.strokeDashoffset=l,t(n).on("redraw",function(){h.startProgress(s)}).on("reverse",function(){h.reverseProgress(s)}).on("destroy",function(){t(this).find(".svg-progress-output").html("0"+o.unitsOutput),h.destroyProgress(s)}),r++},init:function(){var t=n.getAttribute("data-progress-value");o.endFill=null===t?o.endFill:t-0,this.bildProgressFigure()}};h.init()},t.fn[n]=function(e){return this.each(function(i){t.data(this,"plugin_"+n)||t.data(this,"plugin_"+n,new s(this,e,i))})}}(jQuery,window,document);