text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Navigo",[],e):"object"==typeof exports?exports.Navigo=e():t.Navigo=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t){return t instanceof RegExp?t:t.replace(/\/+$/,"").replace(/^\/+/,"/")}function r(t,e){return 0===e.length?null:t?t.slice(1,t.length).reduce(function(t,n,o){return null===t&&(t={}),t[e[o]]=n,t},null):null}function i(t){var e,n=[];return e=t instanceof RegExp?t:new RegExp(o(t).replace(f,function(t,e,o){return n.push(o),h}).replace(d,g)+p),{regexp:e,paramNames:n}}function u(t){var e=arguments.length<=1||void 0===arguments[1]?[]:arguments[1];return e.map(function(e){var n=i(e.route),o=n.regexp,u=n.paramNames,a=t.match(o),s=r(a,u);return a?{match:a,route:e,params:s}:!1}).filter(function(t){return t})}function a(t,e){return u(t,e)[0]||!1}function s(t,e){var n=u(t,e.filter(function(t){var e=o(t.route);return""!==e&&"*"!==e})),r=o(t);return n.length>0?n.map(function(e){return o(t.substr(0,e.match.index))}).reduce(function(t,e){return e.length<t.length?e:t},r):r}function c(t,e){this._routes=[],this.root=t||null,this._ok=!e&&!("undefined"==typeof window||!window.history||!window.history.pushState),this._listen(),this.updatePageLinks()}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};Object.defineProperty(e,"__esModule",{value:!0});var f=/([:*])(\w+)/g,d=/\*/g,h="([^/]+)",g="(?:.*)",p="(?:/|$)";c.prototype={helpers:{match:a,root:s,clean:o},navigate:function(t,e){t=t||"",this._ok?(history.pushState({},"",(e?"":this._getRoot()+"/")+o(t)),this.resolve()):"undefined"!=typeof window&&(window.location.href=window.location.href.replace(/#(.*)$/,"")+"#"+t)},on:function(){if(2===arguments.length)this._add(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]);else if("object"===l(arguments.length<=0?void 0:arguments[0]))for(var t in arguments.length<=0?void 0:arguments[0])this._add(t,(arguments.length<=0?void 0:arguments[0])[t]);else"function"==typeof(arguments.length<=0?void 0:arguments[0])&&this._add("",arguments.length<=0?void 0:arguments[0]);this.resolve()},resolve:function(t){var e,o=(t||this._cLoc()).replace(this._getRoot(),""),r=a(o,this._routes);return r?(e=r.route.handler,r.route.route instanceof RegExp?e.apply(void 0,n(r.match.slice(1,r.match.length))):e(r.params),r):!1},destroy:function(){this._routes=[],clearTimeout(this._listenningInterval),"undefined"!=typeof window?window.onpopstate=null:null},updatePageLinks:function(){var t=this;"undefined"!=typeof document&&this._findLinks().forEach(function(e){var n="javascript:void(0);",r=e.getAttribute("href");"1"!==e.getAttribute("data-navigo-set")&&(r===n&&(r=e.getAttribute("data-navigo")),e.setAttribute("href",n),e.setAttribute("data-navigo",r),e.setAttribute("data-navigo-set","1"),e.addEventListener("click",function(e){e.preventDefault(),t.navigate(o(r))}))})},_add:function(t){var e=arguments.length<=1||void 0===arguments[1]?null:arguments[1];return this._routes.push({route:t,handler:e}),this._add},link:function(t){return this._getRoot()+t},_getRoot:function(){return null!==this.root?this.root:(this.root=s(this._cLoc(),this._routes),this.root)},_listen:function(){var t=this;this._ok?window.onpopstate=function(){t.resolve()}:!function(){var e=t._cLoc(),n=void 0,o=void 0;(o=function(){n=t._cLoc(),e!==n&&(e=n,t.resolve()),t._listenningInterval=setTimeout(o,200)})()}()},_cLoc:function(){return"undefined"!=typeof window?window.location.href:""},_findLinks:function(){return[].slice.call(document.querySelectorAll("[data-navigo]"))}},e["default"]=c,t.exports=e["default"]}])});
  //# sourceMappingURL=navigo.min.js.map