{"version":3,"sources":["../../../src/build/file-classifier.ts"],"sourcesContent":["import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport { isParallelRouteSegment } from '../shared/lib/segment'\n\n// Slot information for parallel routes\nexport type SlotInfo = { name: string; parent: string }\n\n// Route information for route manifests\nexport type RouteInfo = { route: string; filePath: string }\n\n/**\n * Extract slot info from a page path if it contains a parallel route\n */\nexport function extractSlotFromPath(pagePath: string): SlotInfo | undefined {\n  const segments = pagePath.split('/')\n  for (let i = segments.length - 1; i >= 0; i--) {\n    const segment = segments[i]\n    if (isParallelRouteSegment(segment)) {\n      return {\n        name: segment.slice(1),\n        parent: normalizeAppPath(segments.slice(0, i).join('/')),\n      }\n    }\n  }\n  return undefined\n}\n\n/**\n * Add a slot to the slots array if it doesn't already exist\n */\nexport function addSlotIfNew(slots: SlotInfo[], pagePath: string): boolean {\n  const slot = extractSlotFromPath(pagePath)\n  if (!slot) return false\n  if (slots.some((s) => s.name === slot.name && s.parent === slot.parent))\n    return false\n  slots.push(slot)\n  return true\n}\n\n/**\n * Extract slots from a route mapping object\n */\nexport function extractSlotsFromRoutes(\n  routes: { [page: string]: string },\n  skipRoutes?: Set<string>\n): SlotInfo[] {\n  const slots: SlotInfo[] = []\n  for (const [route] of Object.entries(routes)) {\n    if (skipRoutes?.has(route)) continue\n    addSlotIfNew(slots, route)\n  }\n  return slots\n}\n\n/**\n * Combine and deduplicate slot arrays\n */\nexport function combineSlots(...slotArrays: SlotInfo[][]): SlotInfo[] {\n  const slotSet = new Set<string>()\n  const result: SlotInfo[] = []\n  for (const slots of slotArrays) {\n    for (const slot of slots) {\n      const key = `${slot.name}:${slot.parent}`\n      if (!slotSet.has(key)) {\n        slotSet.add(key)\n        result.push(slot)\n      }\n    }\n  }\n  return result\n}\n"],"names":["normalizeAppPath","isParallelRouteSegment","extractSlotFromPath","pagePath","segments","split","i","length","segment","name","slice","parent","join","undefined","addSlotIfNew","slots","slot","some","s","push","extractSlotsFromRoutes","routes","skipRoutes","route","Object","entries","has","combineSlots","slotArrays","slotSet","Set","result","key","add"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,sBAAsB,QAAQ,wBAAuB;AAQ9D;;CAEC,GACD,OAAO,SAASC,oBAAoBC,QAAgB;IAClD,MAAMC,WAAWD,SAASE,KAAK,CAAC;IAChC,IAAK,IAAIC,IAAIF,SAASG,MAAM,GAAG,GAAGD,KAAK,GAAGA,IAAK;QAC7C,MAAME,UAAUJ,QAAQ,CAACE,EAAE;QAC3B,IAAIL,uBAAuBO,UAAU;YACnC,OAAO;gBACLC,MAAMD,QAAQE,KAAK,CAAC;gBACpBC,QAAQX,iBAAiBI,SAASM,KAAK,CAAC,GAAGJ,GAAGM,IAAI,CAAC;YACrD;QACF;IACF;IACA,OAAOC;AACT;AAEA;;CAEC,GACD,OAAO,SAASC,aAAaC,KAAiB,EAAEZ,QAAgB;IAC9D,MAAMa,OAAOd,oBAAoBC;IACjC,IAAI,CAACa,MAAM,OAAO;IAClB,IAAID,MAAME,IAAI,CAAC,CAACC,IAAMA,EAAET,IAAI,KAAKO,KAAKP,IAAI,IAAIS,EAAEP,MAAM,KAAKK,KAAKL,MAAM,GACpE,OAAO;IACTI,MAAMI,IAAI,CAACH;IACX,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASI,uBACdC,MAAkC,EAClCC,UAAwB;IAExB,MAAMP,QAAoB,EAAE;IAC5B,KAAK,MAAM,CAACQ,MAAM,IAAIC,OAAOC,OAAO,CAACJ,QAAS;QAC5C,IAAIC,8BAAAA,WAAYI,GAAG,CAACH,QAAQ;QAC5BT,aAAaC,OAAOQ;IACtB;IACA,OAAOR;AACT;AAEA;;CAEC,GACD,OAAO,SAASY,aAAa,GAAGC,UAAwB;IACtD,MAAMC,UAAU,IAAIC;IACpB,MAAMC,SAAqB,EAAE;IAC7B,KAAK,MAAMhB,SAASa,WAAY;QAC9B,KAAK,MAAMZ,QAAQD,MAAO;YACxB,MAAMiB,MAAM,GAAGhB,KAAKP,IAAI,CAAC,CAAC,EAAEO,KAAKL,MAAM,EAAE;YACzC,IAAI,CAACkB,QAAQH,GAAG,CAACM,MAAM;gBACrBH,QAAQI,GAAG,CAACD;gBACZD,OAAOZ,IAAI,CAACH;YACd;QACF;IACF;IACA,OAAOe;AACT","ignoreList":[0]}