{"version":3,"names":["existingConfig","globalThis","focusTrapStack","logLevel","version","buildDate","revision","stampVersion","console","info","target","Object","defineProperty","value","writable"],"sources":["src/utils/config.ts"],"sourcesContent":["/**\n * This module allows custom configuration for components.\n */\n\nimport { Build } from \"@stencil/core\";\nimport { FocusTrap } from \"./focusTrapComponent\";\nimport { LogLevel } from \"./logger\";\n\nexport interface CalciteConfig {\n /**\n * Defines the global trap stack to use for focus-trapping components.\n *\n * This is useful if your application uses its own instance of `focus-trap` and both need to be aware of each other.\n *\n * @see https://github.com/focus-trap/focus-trap#createoptions\n */\n focusTrapStack: FocusTrap[];\n\n /**\n * Defines the global log level to use when logging messages.\n */\n logLevel: LogLevel;\n\n /**\n * Contains the version of the Calcite components.\n *\n * @readonly\n */\n version?: string;\n}\n\nconst existingConfig: CalciteConfig = globalThis[\"calciteConfig\"];\n\nexport const focusTrapStack: FocusTrap[] = existingConfig?.focusTrapStack || [];\n\nconst runningInE2ETest = Build.isTesting && Build.isBrowser;\nexport const logLevel: LogLevel = existingConfig?.logLevel || (runningInE2ETest ? \"error\" : \"info\");\n\n// the following placeholders are replaced by the build\nconst version = \"__CALCITE_VERSION__\";\nconst buildDate = \"__CALCITE_BUILD_DATE__\";\nconst revision = \"__CALCITE_REVISION__\";\n\n/**\n * Stamp the version onto the global config.\n */\nexport function stampVersion(): void {\n if (existingConfig && existingConfig.version) {\n return;\n }\n\n console.info(`Using Calcite Components ${version} [Date: ${buildDate}, Revision: ${revision}]`);\n\n const target = existingConfig || globalThis[\"calciteConfig\"] || {};\n\n Object.defineProperty(target, \"version\", {\n value: version,\n writable: false,\n });\n\n globalThis[\"calciteConfig\"] = target;\n}\n"],"mappings":";;;;;wBA+BA,MAAMA,EAAgCC,WAAW,iB,MAEpCC,EAA8BF,GAAgBE,gBAAkB,G,MAGhEC,EAAqBH,GAAgBG,UAAQ,OAG1D,MAAMC,EAAU,SAChB,MAAMC,EAAY,aAClB,MAAMC,EAAW,Y,SAKDC,IACd,GAAIP,GAAkBA,EAAeI,QAAS,CAC5C,M,CAGFI,QAAQC,KAAK,4BAA4BL,YAAkBC,gBAAwBC,MAEnF,MAAMI,EAASV,GAAkBC,WAAW,kBAAoB,GAEhEU,OAAOC,eAAeF,EAAQ,UAAW,CACvCG,MAAOT,EACPU,SAAU,QAGZb,WAAW,iBAAmBS,CAChC,Q","ignoreList":[]}