{"version":3,"file":"webSdkResource.cjs","names":["ATTR_SERVICE_NAME","EMBRACE_SERVICE_NAME","ATTR_TELEMETRY_SDK_NAME","SDK_VERSION","ATTR_TELEMETRY_SDK_VERSION","ATTR_TELEMETRY_SDK_LANGUAGE","KEY_EMB_APP_INSTANCE_ID","getAppInstanceId","ATTR_USER_AGENT_ORIGINAL"],"sources":["../../src/resources/webSdkResource.ts"],"sourcesContent":["import type { Resource } from '@opentelemetry/resources';\nimport { resourceFromAttributes } from '@opentelemetry/resources';\nimport {\n  ATTR_SERVICE_NAME,\n  ATTR_TELEMETRY_SDK_LANGUAGE,\n  ATTR_TELEMETRY_SDK_NAME,\n  ATTR_TELEMETRY_SDK_VERSION,\n  ATTR_USER_AGENT_ORIGINAL,\n} from '@opentelemetry/semantic-conventions';\nimport { KEY_EMB_APP_INSTANCE_ID } from '../constants/index.ts';\nimport { getAppInstanceId } from './appInstanceId.ts';\nimport {\n  EMBRACE_SERVICE_NAME,\n  NATIVE_FRAMEWORK,\n  SDK_VERSION,\n} from './constants/index.ts';\nimport type { GetWebSDKResourceArgs } from './types.ts';\n\n/**\n * Returns resource attributes that users are allowed to override via the `resource` option in `initSDK`.\n * These defaults are applied first in the merge chain so user-provided values take precedence.\n */\nexport const getWebSDKOverridableResource = (): Resource => {\n  return resourceFromAttributes({\n    [ATTR_SERVICE_NAME]: EMBRACE_SERVICE_NAME,\n  });\n};\n\n/**\n * Returns SDK resource attributes that must not be overridden by user-provided resources.\n * These are applied last in the merge chain so they always take precedence.\n */\nexport const getWebSDKResource = ({\n  diagLogger,\n  appVersion,\n  pageSessionStorage,\n}: GetWebSDKResourceArgs): Resource => {\n  return resourceFromAttributes({\n    [ATTR_TELEMETRY_SDK_NAME]: EMBRACE_SERVICE_NAME,\n    // NOTE: `appVersion` may originate from TEMPLATE_APP_VERSION, which is padded\n    // with whitespace by the CLI to keep sourcemap offsets stable. The padding is\n    // intentionally trimmed earlier (see validateAppVersion in utils.ts), so by the\n    // time it is passed here `appVersion` should already be a normalized value.\n    app_version: appVersion,\n    app_framework: NATIVE_FRAMEWORK,\n    sdk_version: SDK_VERSION,\n    [ATTR_TELEMETRY_SDK_VERSION]: SDK_VERSION,\n    sdk_simple_version: 1,\n    sdk_platform: 'web',\n    [ATTR_TELEMETRY_SDK_LANGUAGE]: 'webjs',\n    [KEY_EMB_APP_INSTANCE_ID]: getAppInstanceId(pageSessionStorage, diagLogger),\n    [ATTR_USER_AGENT_ORIGINAL]: window.navigator.userAgent,\n    screen_resolution: `${window.screen.width}x${window.screen.height}`,\n  });\n};\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,qCAA+C;AAC1D,SAAA,GAAA,yBAAA,wBAA8B,GAC3BA,oCAAAA,oBAAoBC,kCAAAA,sBACtB,CAAC;;;;;;AAOJ,MAAa,qBAAqB,EAChC,YACA,YACA,yBACqC;AACrC,SAAA,GAAA,yBAAA,wBAA8B;GAC3BC,oCAAAA,0BAA0BD,kCAAAA;EAK3B,aAAa;EACb,eAAA;EACA,aAAaE,kCAAAA;GACZC,oCAAAA,6BAA6BD,kCAAAA;EAC9B,oBAAoB;EACpB,cAAc;GACbE,oCAAAA,8BAA8B;GAC9BC,6BAAAA,0BAA0BC,gCAAAA,iBAAiB,oBAAoB,WAAW;GAC1EC,oCAAAA,2BAA2B,OAAO,UAAU;EAC7C,mBAAmB,GAAG,OAAO,OAAO,MAAM,GAAG,OAAO,OAAO;EAC5D,CAAC"}