/*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).UniversalRouter=r()}(this,function(){"use strict";function n(e,r){void 0===r&&(r={});for(var n=function(e){for(var r=[],t=0;t)?(?!\?)/g,n=0,i=t.exec(e.source);i;)r.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=t.exec(e.source);return e}(e,r):Array.isArray(e)?(n=e,i=r,o=t,n=e.map(function(e){return u(e,i,o).source}),new RegExp("(?:"+n.join("|")+")",x(o))):a(e,r,t);var n,i,o}function t(r){try{return decodeURIComponent(r)}catch(e){return r}}function p(e,r){if("function"==typeof e.route.action)return e.route.action(e,r)}function e(e,r){if(!e||"object"!=typeof e)throw new TypeError("Invalid routes");this.options=Object.assign({decode:t},r),this.baseUrl=this.options.baseUrl||"",this.root=Array.isArray(e)?{path:"",children:e,parent:null}:e,this.root.parent=null}return e.prototype.resolve=function(e){var n,i,r=this,o=Object.assign({router:this},this.options.context,"string"==typeof e?{pathname:e}:e),a=function i(o,a,u,f,s){var p,l,d=0;return{next:function(e){if(o===e)return{done:!0,value:!1};if(!p){var r=o,t=!r.children;if(r.match||(r.match=c(r.path||"",Object.assign({end:t},u))),p=r.match(f))return r=p.path,p.path=t||"/"!==r.charAt(r.length-1)?r:r.substr(1),p.params=Object.assign({},s,p.params),{done:!1,value:{route:o,baseUrl:a,path:p.path,params:p.params}}}if(p&&o.children)for(;d