import{__exports as e}from"../../../../../../../_virtual/route-regex.js_commonjs-exports";export{__exports as default}from"../../../../../../../_virtual/route-regex.js_commonjs-exports";function t(e){return e.replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")}function r(e){const t=e.startsWith("[")&&e.endsWith("]");t&&(e=e.slice(1,-1));const r=e.startsWith("...");return r&&(e=e.slice(3)),{key:e,repeat:r,optional:t}}e.__esModule=!0,e.getRouteRegex=function(e){const o=(e.replace(/\/$/,"")||"/").slice(1).split("/"),n={};let s=1;const i=o.map((e=>{if(e.startsWith("[")&&e.endsWith("]")){const{key:t,optional:o,repeat:i}=r(e.slice(1,-1));return n[t]={pos:s++,repeat:i,optional:o},i?o?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)"}return`/${t(e)}`})).join("");if("undefined"==typeof window){let e=97,s=1;const p=()=>{let t="";for(let r=0;r<s;r++)t+=String.fromCharCode(e),e++,e>122&&(s++,e=97);return t},a={};let l=o.map((e=>{if(e.startsWith("[")&&e.endsWith("]")){const{key:t,optional:o,repeat:n}=r(e.slice(1,-1));let s=t.replace(/\W/g,""),i=!1;return(0===s.length||s.length>30)&&(i=!0),isNaN(parseInt(s.substr(0,1)))||(i=!0),i&&(s=p()),a[s]=t,n?o?`(?:/(?<${s}>.+?))?`:`/(?<${s}>.+?)`:`/(?<${s}>[^/]+?)`}return`/${t(e)}`})).join("");return{re:new RegExp(`^${i}(?:/)?$`),groups:n,routeKeys:a,namedRegex:`^${l}(?:/)?$`}}return{re:new RegExp(`^${i}(?:/)?$`),groups:n}};
//# sourceMappingURL=route-regex.js.map
