{"version":3,"sources":["../src/platform.ts"],"names":["CDN_STUB_MARKER","detectPlatform","nav","getBluetoothAPI"],"mappings":"AAYO,IAAMA,CAAAA,CAAkB,kBAmBxB,SAASC,CAAAA,EAA2B,CACzC,GAAI,OAAO,SAAA,CAAc,GAAA,CAAa,OAAO,aAAA,CAG7C,IAAMC,CAAAA,CAAM,SAAA,CACZ,OAAIA,CAAAA,CAAI,MAAA,EAAQ,QAAA,GAAa,IAAA,CAAa,kBAAA,CAGtCA,CAAAA,CAAI,SAAA,EAAa,CAAEA,CAAAA,CAAI,SAAA,CAA4CF,CAAe,CAAA,CAAU,QAAA,CAEzF,aACT,CAaO,SAASG,CAAAA,EAAoC,CAClD,GAAI,OAAO,SAAA,CAAc,GAAA,CAAa,OAAO,IAAA,CAE7C,IAAMD,CAAAA,CAAM,SAAA,CAGZ,OAAIA,CAAAA,CAAI,MAAA,EAAQ,QAAA,GAAa,IAAA,CAAaA,CAAAA,CAAI,MAAA,CAG1CA,CAAAA,CAAI,SAAA,EAAa,CAAEA,CAAAA,CAAI,SAAA,CAA4CF,CAAe,CAAA,CAAUE,CAAAA,CAAI,SAAA,CAE7F,IACT","file":"chunk-BSOWECSQ.mjs","sourcesContent":["import type { Platform } from './types';\n\n/**\n * The own-property key our \"unsupported\" stub stamps on its faux\n * `navigator.bluetooth` (see auto.ts `createUnsupportedBluetoothStub`) so the\n * detectors below never mistake that stub for a real native implementation.\n *\n * Single-sourced here and consumed by every reader ({@link detectPlatform},\n * {@link getBluetoothAPI}, and browser-auto's banner gate) and by the writer in\n * auto.ts, so the native-vs-stub discriminator cannot silently drift apart. Pinned\n * by `tests/cdn-stub-marker.test.ts` (SB-TST-35).\n */\nexport const CDN_STUB_MARKER = '__beacioCDNStub';\n\n/**\n * Detect the current Web Bluetooth platform by probing `navigator`.\n *\n * **Detection order:**\n * 1. Safari extension -- `navigator.beacio?.__beacio === true`\n * 2. Native Web Bluetooth -- `navigator.bluetooth` exists (excluding CDN stubs)\n * 3. Unsupported -- No Web Bluetooth capability\n *\n * @returns The detected {@link Platform} value.\n *\n * @see {@link getBluetoothAPI} for getting the actual API object\n */\ninterface NavigatorWithBeacio {\n  beacio?: { __beacio?: boolean } & Bluetooth;\n  bluetooth?: Bluetooth;\n}\n\nexport function detectPlatform(): Platform {\n  if (typeof navigator === 'undefined') return 'unsupported';\n\n  // Safari extension: navigator.beacio with sentinel\n  const nav = navigator as NavigatorWithBeacio;\n  if (nav.beacio?.__beacio === true) return 'safari-extension';\n\n  // Native Web Bluetooth (Chrome, Edge, etc.) — exclude CDN stubs\n  if (nav.bluetooth && !(nav.bluetooth as { __beacioCDNStub?: boolean })[CDN_STUB_MARKER]) return 'native';\n\n  return 'unsupported';\n}\n\n/**\n * Get the `Bluetooth` API object for the current platform.\n *\n * Returns `navigator.beacio` for the Safari extension, `navigator.bluetooth` for\n * native Web Bluetooth, or `null` if unsupported. CDN stubs (from `@beacio/detect`)\n * are excluded.\n *\n * @returns The platform's `Bluetooth` API object, or `null` if unavailable.\n *\n * @see {@link detectPlatform} for identifying the platform without getting the API\n */\nexport function getBluetoothAPI(): Bluetooth | null {\n  if (typeof navigator === 'undefined') return null;\n\n  const nav = navigator as NavigatorWithBeacio;\n\n  // Safari extension provides full API on navigator.beacio\n  if (nav.beacio?.__beacio === true) return nav.beacio as Bluetooth;\n\n  // Native Web Bluetooth\n  if (nav.bluetooth && !(nav.bluetooth as { __beacioCDNStub?: boolean })[CDN_STUB_MARKER]) return nav.bluetooth;\n\n  return null;\n}\n"]}