{"version":3,"sources":["../../../src/instrumentation/helpers/id-name-manager.ts"],"names":["IdNameManager","Map","name","count","get","set","getIds","path","id","runId","parentRunId","groupId","spanId","parentSpanId"],"mappings":";;;;AAwBO,MAAMA,aAAAA,CAAAA;EAxBb;;;;AA0BE,EAAA,eAAA,uBAAsBC,GAAAA,EAAAA;;AAEtB,EAAA,UAAA,uBAAiBA,GAAAA,EAAAA;;AAEjB,EAAA,SAAA,uBAAgBA,GAAAA,EAAAA;AAEhB,EAAA,gBAAA,CAAiBC,IAAY,EAAA;AAC3B,IAAA,MAAMC,KAAQ,GAAA,IAAA,CAAK,eAAgBC,CAAAA,GAAAA,CAAIF,IAAAA,CAAS,IAAA,CAAA;AAChD,IAAA,IAAA,CAAK,eAAgBG,CAAAA,GAAAA,CAAIH,IAAMC,EAAAA,KAAAA,GAAQ,CAAA,CAAA;AACvC,IAAA,OAAO,GAAGD,IAAAA,CAAAA,CAAAA,EAAQ,KAAK,eAAgBE,CAAAA,GAAAA,CAAIF,IAAAA,CAAAA,CAAAA,CAAAA;AAC7C;AAEAI,EAAAA,MAAAA,CAAO,EAAEC,IAAMC,EAAAA,EAAAA,EAAIC,KAAOC,EAAAA,WAAAA,EAAaC,SAAwB,EAAA;AAC7D,IAAK,IAAA,CAAA,SAAA,CAAUN,GAAII,CAAAA,KAAAA,EAAOD,EAAAA,CAAAA;AAC1B,IAAMI,MAAAA,MAAAA,GAAS,IAAK,CAAA,gBAAA,CAAiBL,IAAAA,CAAAA;AAErC,IAAK,IAAA,CAAA,UAAA,CAAWF,GAAIG,CAAAA,EAAAA,EAAII,MAAAA,CAAAA;AACxB,IAAMC,MAAAA,YAAAA,GAAeH,WACjB,GAAA,IAAA,CAAK,UAAWN,CAAAA,GAAAA,CAAI,IAAK,CAAA,SAAA,CAAUA,GAAIM,CAAAA,WAAAA,CAAgB,IAAA,EAAA,CACvDC,GAAAA,OAAAA;AAEJ,IAAO,OAAA;AACLC,MAAAA,MAAAA;AACAC,MAAAA;AACF,KAAA;AACF;AACF","file":"id-name-manager.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ninterface GetIdsProps {\n  path: string;\n  id: string;\n  runId: string;\n  parentRunId?: string;\n  groupId?: string;\n}\n\nexport class IdNameManager {\n  /** Current index for each event */\n  #idNamesCounter = new Map<string, number>();\n  /** The new span id names and the original framework emitter event ids dictionary */\n  #idNameMap = new Map<string, string>();\n  /** We need to map the run tree structure with duplicities to the event tree structure */\n  #runIdMap = new Map<string, string>();\n\n  #spanIdGenerator(name: string) {\n    const count = this.#idNamesCounter.get(name) || 0;\n    this.#idNamesCounter.set(name, count + 1);\n    return `${name}-${this.#idNamesCounter.get(name)}`;\n  }\n\n  getIds({ path, id, runId, parentRunId, groupId }: GetIdsProps) {\n    this.#runIdMap.set(runId, id);\n    const spanId = this.#spanIdGenerator(path);\n\n    this.#idNameMap.set(id, spanId);\n    const parentSpanId = parentRunId\n      ? this.#idNameMap.get(this.#runIdMap.get(parentRunId) || \"\")\n      : groupId;\n\n    return {\n      spanId,\n      parentSpanId,\n    };\n  }\n}\n"]}