!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("preact"),require("preact/hooks")):"function"==typeof define&&define.amd?define(["preact","preact/hooks"],t):(n||self).preactRouter=t(n.preact,n.hooks)}(this,function(n,t){var e={};function r(n,t){for(var e in t)n[e]=t[e];return n}function i(n,t,r){var i,o=/(?:\?([^#]*))?(#.*)?$/,u=n.match(o),c={};if(u&&u[1])for(var a=u[1].split("&"),s=0;st.rank?-1:n.index-t.index}function u(n,t){return n.index=t,n.rank=function(n){return n.props.default?0:f(n.props.path).map(c).join("")}(n),n.props}function f(n){return n.replace(/(^\/+|\/+$)/g,"").split("/")}function c(n){return":"==n.charAt(0)?1+"*+?".indexOf(n.charAt(n.length-1))||4:5}var a={},s=[],h=[],d=null,l={url:p()},v=n.createContext(l);function p(){var n;return""+((n=d&&d.location?d.location:d&&d.getCurrentLocation?d.getCurrentLocation():"undefined"!=typeof location?location:a).pathname||"")+(n.search||"")}function m(n,t){return void 0===t&&(t=!1),"string"!=typeof n&&n.url&&(t=n.replace,n=n.url),function(n){for(var t=s.length;t--;)if(s[t].canRoute(n))return!0;return!1}(n)&&function(n,t){void 0===t&&(t="push"),d&&d[t]?d[t](n):"undefined"!=typeof history&&history[t+"State"]&&history[t+"State"](null,null,n)}(n,t?"replace":"push"),y(n)}function y(n){for(var t=!1,e=0;e