{"version":3,"file":"utils.cjs","names":["TEMPLATE_APP_VERSION"],"sources":["../../src/sdk/utils.ts"],"sourcesContent":["import { TEMPLATE_APP_VERSION } from '../resources/constants/index.ts';\n\nexport const validateAppID = (appID: unknown): string | undefined => {\n  if (appID === undefined) return undefined;\n  if (typeof appID !== 'string') {\n    throw new Error(\n      `appID must be a string, or omitted if not using Embrace. Received ${String(appID)}`,\n    );\n  }\n  if (appID.length !== 5) {\n    throw new Error(\n      `appID should be 5 characters long, or omitted if not using Embrace. Received \"${appID}\"`,\n    );\n  }\n  return appID;\n};\n\nexport const validateAppVersion = (appVersion: unknown): string => {\n  if (appVersion === undefined) {\n    // TEMPLATE_APP_VERSION is rewritten by the CLI at build time and may be empty\n    const trimmedTemplate = TEMPLATE_APP_VERSION.trim();\n    if (trimmedTemplate === '') {\n      return 'unspecified';\n    }\n    return trimmedTemplate;\n  }\n  if (typeof appVersion !== 'string') {\n    throw new Error(\n      `if appVersion is specified, it must be a string. Received ${String(appVersion)}`,\n    );\n  }\n  const trimmedAppVersion = appVersion.trim();\n  if (trimmedAppVersion === '') {\n    throw new Error(\n      'if appVersion is specified, it cannot be an empty string.',\n    );\n  }\n  return trimmedAppVersion;\n};\n"],"mappings":";;;AAEA,MAAa,iBAAiB,UAAuC;AACnE,KAAI,UAAU,KAAA,EAAW,QAAO,KAAA;AAChC,KAAI,OAAO,UAAU,SACnB,OAAM,IAAI,MACR,qEAAqE,OAAO,MAAM,GACnF;AAEH,KAAI,MAAM,WAAW,EACnB,OAAM,IAAI,MACR,iFAAiF,MAAM,GACxF;AAEH,QAAO;;AAGT,MAAa,sBAAsB,eAAgC;AACjE,KAAI,eAAe,KAAA,GAAW;EAE5B,MAAM,kBAAkBA,kCAAAA,qBAAqB,MAAM;AACnD,MAAI,oBAAoB,GACtB,QAAO;AAET,SAAO;;AAET,KAAI,OAAO,eAAe,SACxB,OAAM,IAAI,MACR,6DAA6D,OAAO,WAAW,GAChF;CAEH,MAAM,oBAAoB,WAAW,MAAM;AAC3C,KAAI,sBAAsB,GACxB,OAAM,IAAI,MACR,4DACD;AAEH,QAAO"}