(function(e,n){if(typeof define==="function"&&define.amd){define(n)}else if(typeof exports==="object"){module.exports=n()}else{e.NProgress=n()}})(this,function(){var o={};o.version="0.2.0";var a=o.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:true,trickleRate:.02,trickleSpeed:800,showSpinner:true,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};o.configure=function(e){var n,t;for(n in e){t=e[n];if(t!==undefined&&e.hasOwnProperty(n))a[n]=t}return this};o.status=null;o.set=function(n){var e=o.isStarted();n=u(n,a.minimum,1);o.status=n===1?null:n;var t=o.render(!e),r=t.querySelector(a.barSelector),i=a.speed,s=a.easing;t.offsetWidth;l(function(e){if(a.positionUsing==="")a.positionUsing=o.getPositioningCSS();d(r,c(n,i,s));if(n===1){d(t,{transition:"none",opacity:1});t.offsetWidth;setTimeout(function(){d(t,{transition:"all "+i+"ms linear",opacity:0});setTimeout(function(){o.remove();e()},i)},i)}else{setTimeout(e,i)}});return this};o.isStarted=function(){return typeof o.status==="number"};o.start=function(){if(!o.status)o.set(0);var e=function(){setTimeout(function(){if(!o.status)return;o.trickle();e()},a.trickleSpeed)};if(a.trickle)e();return this};o.done=function(e){if(!e&&!o.status)return this;return o.inc(.3+.5*Math.random()).set(1)};o.inc=function(e){var n=o.status;if(!n){return o.start()}else{if(typeof e!=="number"){e=(1-n)*u(Math.random()*n,.1,.95)}n=u(n+e,0,.994);return o.set(n)}};o.trickle=function(){return o.inc(Math.random()*a.trickleRate)};(function(){var n=0,t=0;o.promise=function(e){if(!e||e.state()==="resolved"){return this}if(t===0){o.start()}n++;t++;e.always(function(){t--;if(t===0){n=0;o.done()}else{o.set((n-t)/n)}});return this}})();o.render=function(e){if(o.isRendered())return document.getElementById("nprogress");m(document.documentElement,"nprogress-busy");var n=document.createElement("div");n.id="nprogress";n.innerHTML=a.template;var t=n.querySelector(a.barSelector),r=e?"-100":f(o.status||0),i=document.querySelector(a.parent),s;d(t,{transition:"all 0 linear",transform:"translate3d("+r+"%,0,0)"});if(!a.showSpinner){s=n.querySelector(a.spinnerSelector);s&&p(s)}if(i!=document.body){m(i,"nprogress-custom-parent")}i.appendChild(n);return n};o.remove=function(){n(document.documentElement,"nprogress-busy");n(document.querySelector(a.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)};o.isRendered=function(){return!!document.getElementById("nprogress")};o.getPositioningCSS=function(){var e=document.body.style;var n="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";if(n+"Perspective"in e){return"translate3d"}else if(n+"Transform"in e){return"translate"}else{return"margin"}};function u(e,n,t){if(e<n)return n;if(e>t)return t;return e}function f(e){return(-1+e)*100}function c(e,n,t){var r;if(a.positionUsing==="translate3d"){r={transform:"translate3d("+f(e)+"%,0,0)"}}else if(a.positionUsing==="translate"){r={transform:"translate("+f(e)+"%,0)"}}else{r={"margin-left":f(e)+"%"}}r.transition="all "+n+"ms "+t;return r}var l=function(){var n=[];function t(){var e=n.shift();if(e){e(t)}}return function(e){n.push(e);if(n.length==1)t()}}();var d=function(){var s=["Webkit","O","Moz","ms"],n={};function t(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(e,n){return n.toUpperCase()})}function r(e){var n=document.body.style;if(e in n)return e;var t=s.length,r=e.charAt(0).toUpperCase()+e.slice(1),i;while(t--){i=s[t]+r;if(i in n)return i}return e}function i(e){e=t(e);return n[e]||(n[e]=r(e))}function o(e,n,t){n=i(n);e.style[n]=t}return function(e,n){var t=arguments,r,i;if(t.length==2){for(r in n){i=n[r];if(i!==undefined&&n.hasOwnProperty(r))o(e,r,i)}}else{o(e,t[1],t[2])}}}();function i(e,n){var t=typeof e=="string"?e:s(e);return t.indexOf(" "+n+" ")>=0}function m(e,n){var t=s(e),r=t+n;if(i(t,n))return;e.className=r.substring(1)}function n(e,n){var t=s(e),r;if(!i(e,n))return;r=t.replace(" "+n+" "," ");e.className=r.substring(1,r.length-1)}function s(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return o});