{"version":3,"file":"platform.cjs","names":[],"sources":["../../src/utils/platform.ts"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\n/**\n * Gets the platform on which the application is running.\n * If the userAgent could not be determined, this will default to \"other\"\n */\nexport function getPlatform(): \"android\" | \"ios\" | \"other\" {\n  // The granularity of this value is kind of arbitrary: it distinguishes exactly\n  // the platforms that this library needs to know about in order to correctly\n  // implement the designs.\n\n  // Some SSR environments don't provide access to this.\n  const userAgent = globalThis.navigator?.userAgent;\n\n  if (/android/i.test(userAgent)) {\n    return \"android\";\n    // We include 'Mac' here and double-check for touch support because iPads on\n    // iOS 13 pretend to be a MacOS desktop\n  } else if (\n    /iPad|iPhone|iPod|Mac/.test(userAgent) &&\n    \"ontouchend\" in document\n  ) {\n    return \"ios\";\n  } else {\n    return \"other\";\n  }\n}\n"],"mappings":";;;;;AAWA,SAAgB,cAA2C;CAMzD,MAAM,YAAY,WAAW,WAAW;AAExC,KAAI,WAAW,KAAK,UAAU,CAC5B,QAAO;UAIP,uBAAuB,KAAK,UAAU,IACtC,gBAAgB,SAEhB,QAAO;KAEP,QAAO"}