{"version":3,"file":"subgraph.cjs","names":[],"sources":["../../../src/pregel/utils/subgraph.ts"],"sourcesContent":["import {\n  RunnableSequence,\n  Runnable,\n  RunnableLike,\n} from \"@langchain/core/runnables\";\nimport type { PregelInterface } from \"../types.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction isRunnableSequence(\n  x: RunnableSequence | Runnable\n): x is RunnableSequence {\n  return \"steps\" in x && Array.isArray(x.steps);\n}\n\nexport function isPregelLike(\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  x: PregelInterface<any, any> | RunnableLike<any, any, any>\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): x is PregelInterface<any, any> {\n  return \"lg_is_pregel\" in x && x.lg_is_pregel === true;\n}\n\nexport function findSubgraphPregel(\n  candidate: Runnable\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): PregelInterface<any, any> | undefined {\n  const candidates = [candidate];\n  for (const candidate of candidates) {\n    if (isPregelLike(candidate)) {\n      return candidate;\n    } else if (isRunnableSequence(candidate)) {\n      candidates.push(...candidate.steps);\n    }\n  }\n  return undefined;\n}\n"],"mappings":";AAQA,SAAS,mBACP,GACuB;AACvB,QAAO,WAAW,KAAK,MAAM,QAAQ,EAAE,MAAM;;AAG/C,SAAgB,aAEd,GAEgC;AAChC,QAAO,kBAAkB,KAAK,EAAE,iBAAiB;;AAGnD,SAAgB,mBACd,WAEuC;CACvC,MAAM,aAAa,CAAC,UAAU;AAC9B,MAAK,MAAM,aAAa,WACtB,KAAI,aAAa,UAAU,CACzB,QAAO;UACE,mBAAmB,UAAU,CACtC,YAAW,KAAK,GAAG,UAAU,MAAM"}