{"version":3,"file":"platform.mjs","names":[],"sources":["../../../src/helpers/platform.ts"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport type OperatingSystem = 'mac' | 'windows' | 'linux';\n\n/**\n * `navigator.platform` comes first because it describes the machine the\n * keyboard is attached to, while the user agent and its client hints can be\n * pinned to another platform by the embedder.\n */\nfunction getPlatformHint(): string {\n  if (typeof navigator === 'undefined') {\n    return '';\n  }\n  const navigatorWithHints = navigator as Navigator & {\n    userAgentData?: { platform?: string };\n  };\n  return (\n    navigator.platform ||\n    navigatorWithHints.userAgentData?.platform ||\n    navigator.userAgent ||\n    ''\n  );\n}\n\n/** Detects the operating system the keyboard is attached to. */\nexport function detectOS(): OperatingSystem {\n  const platform = getPlatformHint();\n  if (/mac|iphone|ipad|ipod/i.test(platform)) {\n    return 'mac';\n  }\n  if (/win/i.test(platform)) {\n    return 'windows';\n  }\n  return 'linux';\n}\n\n/**\n * Apple platforms take `Cmd` where the rest take `Ctrl`, since `Ctrl` + click\n * is the macOS context menu gesture.\n */\nexport function isApplePlatform(): boolean {\n  return detectOS() === 'mac';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,kBAA0B;;CACjC,IAAI,OAAO,cAAc,aACvB,OAAO;CAET,MAAM,qBAAqB;CAG3B,OACE,UAAU,cAAA,wBACV,mBAAmB,mBAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAe,aAClC,UAAU,aACV;AAEJ;;AAGA,SAAgB,WAA4B;CAC1C,MAAM,WAAW,gBAAgB;CACjC,IAAI,wBAAwB,KAAK,QAAQ,GACvC,OAAO;CAET,IAAI,OAAO,KAAK,QAAQ,GACtB,OAAO;CAET,OAAO;AACT;;;;;AAMA,SAAgB,kBAA2B;CACzC,OAAO,SAAS,MAAM;AACxB"}