{"version":3,"file":"fetch.cjs","names":[],"sources":["../../src/singletons/fetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// Wrap the default fetch call due to issues with illegal invocations\n// in some environments:\n// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err\n// @ts-expect-error Broad typing to support a range of fetch implementations\nconst DEFAULT_FETCH_IMPLEMENTATION = (...args: any[]) => fetch(...args);\n\nconst LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for(\n  \"lg:fetch_implementation\"\n);\n\n/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport const overrideFetchImplementation = (fetch: (...args: any[]) => any) => {\n  (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;\n};\n\n/**\n * @internal\n */\nexport const _getFetchImplementation: () => (...args: any[]) => any = () => {\n  return (\n    (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??\n    DEFAULT_FETCH_IMPLEMENTATION\n  );\n};\n"],"mappings":";AAKA,MAAM,gCAAgC,GAAG,SAAgB,MAAM,GAAG,KAAK;AAEvE,MAAM,qCAAqC,OAAO,IAChD,0BACD;;;;;;;AAQD,MAAa,+BAA+B,UAAmC;AAC5E,YAAmB,sCAAsC;;;;;AAM5D,MAAa,gCAA+D;AAC1E,QACG,WAAmB,uCACpB"}