{"version":3,"file":"stackStateUtils.js","names":[],"sources":["esm/router/web/stackStateUtils.js"],"sourcesContent":["const OVERLAY_PRESENTATIONS = [\n  \"modal\",\n  \"transparentModal\",\n  \"fullScreenModal\",\n  \"formSheet\",\n  \"pageSheet\",\n  \"containedModal\",\n  \"containedTransparentModal\"\n];\nfunction isOverlayPresentation(options) {\n  const presentation = options?.presentation;\n  if (!presentation) return false;\n  return OVERLAY_PRESENTATIONS.includes(presentation);\n}\nfunction isTransparentOverlay(options) {\n  const presentation = options?.presentation;\n  return presentation === \"transparentModal\" || presentation === \"containedTransparentModal\";\n}\nfunction convertStackStateToNonOverlayState(state, descriptors, isOverlay = isOverlayPresentation) {\n  const lastNonOverlay = findLastNonOverlayIndex(state, descriptors, isOverlay);\n  const routes = state.routes.slice(0, lastNonOverlay + 1);\n  let index = state.index;\n  if (index >= routes.length) {\n    index = routes.length > 0 ? routes.length - 1 : 0;\n  }\n  return { routes, index };\n}\nfunction findLastNonOverlayIndex(state, descriptors, isOverlay = isOverlayPresentation) {\n  for (let i = state.index; i >= 0; i--) {\n    if (!isOverlay(descriptors[state.routes[i].key]?.options)) {\n      return i;\n    }\n  }\n  return -1;\n}\nexport {\n  convertStackStateToNonOverlayState,\n  findLastNonOverlayIndex,\n  isOverlayPresentation,\n  isTransparentOverlay\n};\n//# sourceMappingURL=stackStateUtils.js.map\n"],"mappings":";AAAA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,sBAAsB,SAAS;CACtC,MAAM,eAAe,SAAS;CAC9B,IAAI,CAAC,cAAc,OAAO;CAC1B,OAAO,sBAAsB,SAAS,YAAY;AACpD;AACA,SAAS,qBAAqB,SAAS;CACrC,MAAM,eAAe,SAAS;CAC9B,OAAO,iBAAiB,sBAAsB,iBAAiB;AACjE;AACA,SAAS,mCAAmC,OAAO,aAAa,YAAY,uBAAuB;CACjG,MAAM,iBAAiB,wBAAwB,OAAO,aAAa,SAAS;CAC5E,MAAM,SAAS,MAAM,OAAO,MAAM,GAAG,iBAAiB,CAAC;CACvD,IAAI,QAAQ,MAAM;CAClB,IAAI,SAAS,OAAO,QAAQ;EAC1B,QAAQ,OAAO,SAAS,IAAI,OAAO,SAAS,IAAI;CAClD;CACA,OAAO;EAAE;EAAQ;CAAM;AACzB;AACA,SAAS,wBAAwB,OAAO,aAAa,YAAY,uBAAuB;CACtF,KAAK,IAAI,IAAI,MAAM,OAAO,KAAK,GAAG,KAAK;EACrC,IAAI,CAAC,UAAU,YAAY,MAAM,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG;GACzD,OAAO;EACT;CACF;CACA,OAAO,CAAC;AACV"}