{"version":3,"file":"setupDefaultInstrumentations.cjs","names":["GlobalExceptionInstrumentation","ClicksInstrumentation","RageClickInstrumentation","MaxScrollDepthInstrumentation","FirstInteractionInstrumentation","WebVitalsInstrumentation","LoafInstrumentation","UserTimingInstrumentation","ElementTimingInstrumentation","SoftNavigationPerformanceInstrumentation","DocumentLoadInstrumentation","NavigationInstrumentation","ServerTimingInstrumentation","FetchInstrumentation","XMLHttpRequestInstrumentation","EmptyRootInstrumentation","EmbraceInstrumentationBase"],"sources":["../../src/sdk/setupDefaultInstrumentations.ts"],"sourcesContent":["import type { Instrumentation } from '@opentelemetry/instrumentation';\nimport { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';\nimport { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';\nimport {\n  ClicksInstrumentation,\n  DocumentLoadInstrumentation,\n  ElementTimingInstrumentation,\n  EmbraceInstrumentationBase,\n  EmptyRootInstrumentation,\n  FirstInteractionInstrumentation,\n  GlobalExceptionInstrumentation,\n  LoafInstrumentation,\n  MaxScrollDepthInstrumentation,\n  NavigationInstrumentation,\n  RageClickInstrumentation,\n  ServerTimingInstrumentation,\n  SoftNavigationPerformanceInstrumentation,\n  UserTimingInstrumentation,\n  WebVitalsInstrumentation,\n} from '../instrumentations/index.ts';\nimport type {\n  DefaultInstrumentationConfig,\n  SetupDefaultInstrumentationsArgs,\n} from './types.ts';\n\nexport const setupDefaultInstrumentations = (\n  config: DefaultInstrumentationConfig = {},\n  {\n    logManager,\n    userSessionManager,\n    pageManager,\n    limitManager,\n    signalBuffer,\n  }: SetupDefaultInstrumentationsArgs,\n): Instrumentation[] => {\n  const instrumentations: Instrumentation[] = [];\n\n  if (!config.omit?.has('exception')) {\n    instrumentations.push(\n      new GlobalExceptionInstrumentation(config['exception']),\n    );\n  }\n\n  if (!config.omit?.has('click')) {\n    instrumentations.push(new ClicksInstrumentation(config['click']));\n  }\n\n  if (!config.omit?.has('rage-click')) {\n    instrumentations.push(new RageClickInstrumentation(config['rage-click']));\n  }\n\n  if (!config.omit?.has('max-scroll-depth')) {\n    instrumentations.push(\n      new MaxScrollDepthInstrumentation(config['max-scroll-depth']),\n    );\n  }\n\n  if (!config.omit?.has('first-interaction')) {\n    instrumentations.push(\n      new FirstInteractionInstrumentation(config['first-interaction']),\n    );\n  }\n\n  if (!config.omit?.has('web-vital')) {\n    instrumentations.push(\n      new WebVitalsInstrumentation({ ...config['web-vital'], pageManager }),\n    );\n  }\n\n  if (!config.omit?.has('loaf')) {\n    instrumentations.push(new LoafInstrumentation({ ...config['loaf'] }));\n  }\n\n  if (!config.omit?.has('user-timing')) {\n    instrumentations.push(new UserTimingInstrumentation(config['user-timing']));\n  }\n\n  if (!config.omit?.has('element-timing')) {\n    instrumentations.push(\n      new ElementTimingInstrumentation({\n        limitManager,\n        ...config['element-timing'],\n      }),\n    );\n  }\n\n  if (!config.omit?.has('soft-navigation-performance')) {\n    instrumentations.push(\n      new SoftNavigationPerformanceInstrumentation({\n        limitManager,\n        signalBuffer,\n        ...config['soft-navigation-performance'],\n      }),\n    );\n  }\n\n  if (!config.omit?.has('document-load')) {\n    instrumentations.push(\n      new DocumentLoadInstrumentation(config['document-load']),\n    );\n  }\n\n  instrumentations.push(\n    new NavigationInstrumentation({ pageManager, ...config['navigation'] }),\n  );\n\n  if (!config.omit?.has('server-timing')) {\n    instrumentations.push(\n      new ServerTimingInstrumentation({\n        limitManager,\n        ...config['server-timing'],\n      }),\n    );\n  }\n\n  if (!config.omit?.has('@opentelemetry/instrumentation-fetch')) {\n    instrumentations.push(\n      new FetchInstrumentation({\n        ...config['@opentelemetry/instrumentation-fetch'],\n        ignoreUrls: [\n          ...(config['network']?.ignoreUrls ?? []),\n          ...(config['@opentelemetry/instrumentation-fetch']?.ignoreUrls ?? []),\n        ],\n      }),\n    );\n  }\n\n  if (!config.omit?.has('@opentelemetry/instrumentation-xml-http-request')) {\n    instrumentations.push(\n      new XMLHttpRequestInstrumentation({\n        ...config['@opentelemetry/instrumentation-xml-http-request'],\n        ignoreUrls: [\n          ...(config['network']?.ignoreUrls ?? []),\n          ...(config['@opentelemetry/instrumentation-xml-http-request']\n            ?.ignoreUrls ?? []),\n        ],\n      }),\n    );\n  }\n\n  if (config['empty-root']) {\n    instrumentations.push(\n      new EmptyRootInstrumentation({ ...config['empty-root'] }),\n    );\n  }\n\n  for (const instrumentation of instrumentations) {\n    if (instrumentation instanceof EmbraceInstrumentationBase) {\n      if (userSessionManager) {\n        instrumentation.setUserSessionManager(userSessionManager);\n      }\n\n      if (logManager) {\n        instrumentation.setLogManager(logManager);\n      }\n\n      if (limitManager) {\n        instrumentation.setLimitManager(limitManager);\n      }\n    }\n  }\n\n  return instrumentations;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,MAAa,gCACX,SAAuC,CAAC,GACxC,EACE,YACA,oBACA,aACA,cACA,mBAEoB;CACtB,MAAM,mBAAsC,CAAC;CAE7C,IAAI,CAAC,OAAO,MAAM,IAAI,WAAW,GAC/B,iBAAiB,KACf,IAAIA,kGAAAA,+BAA+B,OAAO,YAAY,CACxD;CAGF,IAAI,CAAC,OAAO,MAAM,IAAI,OAAO,GAC3B,iBAAiB,KAAK,IAAIC,4EAAAA,sBAAsB,OAAO,QAAQ,CAAC;CAGlE,IAAI,CAAC,OAAO,MAAM,IAAI,YAAY,GAChC,iBAAiB,KAAK,IAAIC,sFAAAA,yBAAyB,OAAO,aAAa,CAAC;CAG1E,IAAI,CAAC,OAAO,MAAM,IAAI,kBAAkB,GACtC,iBAAiB,KACf,IAAIC,sGAAAA,8BAA8B,OAAO,mBAAmB,CAC9D;CAGF,IAAI,CAAC,OAAO,MAAM,IAAI,mBAAmB,GACvC,iBAAiB,KACf,IAAIC,2GAAAA,gCAAgC,OAAO,oBAAoB,CACjE;CAGF,IAAI,CAAC,OAAO,MAAM,IAAI,WAAW,GAC/B,iBAAiB,KACf,IAAIC,sFAAAA,yBAAyB;EAAE,GAAG,OAAO;EAAc;CAAY,CAAC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