import t from"./path-to-regexp.js";const{hasOwnProperty:e}=Object.prototype,a=new Map;function decodeParam(t){try{return decodeURIComponent(t)}catch(e){return t}}function matchPath(n,r,o,c,s){const p=`${n}|${o=!!o}`;let d=a.get(p);if(!d){const e=[];d={keys:e,pattern:t(n,e,{end:o,strict:""===n})},a.set(p,d)}const m=d.pattern.exec(r);if(!m)return null;const i=Object.assign({},s);for(let t=1;t<m.length;t++){const a=d.keys[t-1],n=a.name,r=m[t];void 0===r&&e.call(i,n)||(a.repeat?i[n]=r?r.split(a.delimiter).map(decodeParam):[]:i[n]=r?decodeParam(r):r)}return{path:m[0],keys:(c||[]).concat(d.keys),params:i}}a.set("|false",{keys:[],pattern:/(?:)/});export default matchPath;