Liferay.Loader.define("frontend-js-spa-web@5.0.36/util/pathParser",["module","exports","require"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.parse=parse,t.toRegex=function toRegex(e){return convertTokensToRegex(parse(e))},t.extractData=function extractData(e,t){const n={},r=parse(e),o=t.match(convertTokensToRegex(r));if(!o)return null;let a=1;for(let e=0;e<r.length;e++)if("string"!=typeof r[e]){let t=o[a++];void 0!==t&&(r[e].repeat&&(t=t.split("/")),n[r[e].name]=t)}return n};const e=/([/])?(?:(?::(\w+)(?:\(((?:\\.|[^\\()])*)\))?|\(((?:\\.|[^\\()])+)\))([+*?])?)/g;function convertMatchesToObj(e){return{match:e[0],modifier:e[5],name:e[2],paramPattern:e[3],prefix:e[1],unnamedPattern:e[4]}}function convertTokensToRegex(e){let t="";for(let n=0;n<e.length;n++)if("string"==typeof e[n])t+=escape(e[n]);else{let r=encloseNonCapturingGroup(e[n].pattern);e[n].repeat&&(r+=encloseNonCapturingGroup("\\/"+r)+"*"),r=escape(e[n].prefix)+"(".concat(r,")"),e[n].optional&&(e[n].partial||(r=encloseNonCapturingGroup(r)),r+="?"),t+=r}return new RegExp("^"+function makeTrailingSlashOptional(e){e.endsWith("/")?e+="?":e+="\\/?";return e}(t)+"$")}function encloseNonCapturingGroup(e){return"(?:".concat(e,")")}function escape(e){return e.replace(/([.+*?=^!:${}()[]|\/\\])/g,"\\$1")}function parse(t){if("string"!=typeof t)return t;const n=t;let r=0;const o=[];let a="",i=0,p=e.exec(n);for(;p;){const t=convertMatchesToObj(p);a=n.slice(i,p.index),i=p.index+t.match.length,o.push(a),o.push({name:t.name?t.name:""+r++,optional:"*"===t.modifier||"?"===t.modifier,partial:n[i]&&n[i]!==t.prefix,pattern:t.paramPattern||t.unnamedPattern||"[^\\/]+",prefix:t.prefix||"",repeat:"*"===t.modifier||"+"===t.modifier}),p=e.exec(n)}return i<n.length&&o.push(n.substr(i)),o}}}));
//# sourceMappingURL=pathParser.js.map