{"version":3,"sources":["../../src/lib/redirect-status.ts"],"sourcesContent":["import { RedirectStatusCode } from '../client/components/redirect-status-code'\n\nexport const allowedStatusCodes = new Set([301, 302, 303, 307, 308])\n\nexport function getRedirectStatus(route: {\n  statusCode?: number\n  permanent?: boolean\n}): number {\n  return (\n    route.statusCode ||\n    (route.permanent\n      ? RedirectStatusCode.PermanentRedirect\n      : RedirectStatusCode.TemporaryRedirect)\n  )\n}\n\n// for redirects we restrict matching /_next and for all routes\n// we add an optional trailing slash at the end for easier\n// configuring between trailingSlash: true/false\nexport function modifyRouteRegex(regex: string, restrictedPaths?: string[]) {\n  if (restrictedPaths) {\n    regex = regex.replace(\n      /\\^/,\n      `^(?!${restrictedPaths\n        .map((path) => path.replace(/\\//g, '\\\\/'))\n        .join('|')})`\n    )\n  }\n  regex = regex.replace(/\\$$/, '(?:\\\\/)?$')\n  return regex\n}\n"],"names":["RedirectStatusCode","allowedStatusCodes","Set","getRedirectStatus","route","statusCode","permanent","PermanentRedirect","TemporaryRedirect","modifyRouteRegex","regex","restrictedPaths","replace","map","path","join"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,4CAA2C;AAE9E,OAAO,MAAMC,qBAAqB,IAAIC,IAAI;IAAC;IAAK;IAAK;IAAK;IAAK;CAAI,EAAC;AAEpE,OAAO,SAASC,kBAAkBC,KAGjC;IACC,OACEA,MAAMC,UAAU,IACfD,CAAAA,MAAME,SAAS,GACZN,mBAAmBO,iBAAiB,GACpCP,mBAAmBQ,iBAAiB,AAAD;AAE3C;AAEA,+DAA+D;AAC/D,0DAA0D;AAC1D,gDAAgD;AAChD,OAAO,SAASC,iBAAiBC,KAAa,EAAEC,eAA0B;IACxE,IAAIA,iBAAiB;QACnBD,QAAQA,MAAME,OAAO,CACnB,MACA,CAAC,IAAI,EAAED,gBACJE,GAAG,CAAC,CAACC,OAASA,KAAKF,OAAO,CAAC,OAAO,QAClCG,IAAI,CAAC,KAAK,CAAC,CAAC;IAEnB;IACAL,QAAQA,MAAME,OAAO,CAAC,OAAO;IAC7B,OAAOF;AACT","ignoreList":[0]}