{"version":3,"sources":["../src/chainMapDefaults.ts"],"sourcesContent":["import type { ChainContext } from './queue.js';\n\n/**\n * Built-in chain mapping: pass the previous step's output directly as the next step's input.\n * Falls back to `initialInput` if there are no previous outputs.\n *\n * Use via `chain: 'passthrough'` on a queue step — no need to reference this directly.\n */\nexport function defaultMapChainPassthrough(ctx: ChainContext): unknown {\n  const { initialInput, previousOutputs } = ctx;\n  if (previousOutputs.length > 0) {\n    return previousOutputs[previousOutputs.length - 1]?.output;\n  }\n  return initialInput;\n}\n\n/**\n * Built-in chain mapping for same-worker \"continue\" rounds.\n * Maps `{ current, history, ... }` from the last step output into\n * `{ mode: 'continue', current, history, nextNumber: 0, operator: 'add' }`.\n *\n * Use via `chain: 'continueFromPrevious'` on a queue step.\n */\nexport function defaultMapChainContinueFromPrevious(ctx: ChainContext): unknown {\n  const { previousOutputs } = ctx;\n  const prev = previousOutputs[previousOutputs.length - 1]?.output as {\n    current?: number;\n    history?: string[];\n  } | null;\n  if (!prev || typeof prev.current !== 'number') {\n    return {\n      mode: 'continue' as const,\n      current: 0,\n      history: [] as string[],\n      nextNumber: 0,\n      operator: 'add' as const,\n    };\n  }\n  return {\n    mode: 'continue' as const,\n    current: prev.current,\n    history: prev.history ?? [],\n    nextNumber: 0,\n    operator: 'add' as const,\n  };\n}\n"],"mappings":";AAQO,SAAS,2BAA2B,KAA4B;AACrE,QAAM,EAAE,cAAc,gBAAgB,IAAI;AAC1C,MAAI,gBAAgB,SAAS,GAAG;AAC9B,WAAO,gBAAgB,gBAAgB,SAAS,CAAC,GAAG;AAAA,EACtD;AACA,SAAO;AACT;AASO,SAAS,oCAAoC,KAA4B;AAC9E,QAAM,EAAE,gBAAgB,IAAI;AAC5B,QAAM,OAAO,gBAAgB,gBAAgB,SAAS,CAAC,GAAG;AAI1D,MAAI,CAAC,QAAQ,OAAO,KAAK,YAAY,UAAU;AAC7C,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS,CAAC;AAAA,MACV,YAAY;AAAA,MACZ,UAAU;AAAA,IACZ;AAAA,EACF;AACA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,KAAK;AAAA,IACd,SAAS,KAAK,WAAW,CAAC;AAAA,IAC1B,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AACF;","names":[]}