{"version":3,"file":"device.es.mjs","names":[],"sources":["../src/device/hasIosStaffbaseRuntime.ts","../src/device/isIOSTouchDevice.ts","../src/device/isMobileOrWebview.ts","../src/device/isMobileViewport.ts","../src/device/isMobile.ts","../src/device/isMobilePlatform.ts","../src/device/isNativeApp.ts"],"sourcesContent":["/**\n * True when the Staffbase runtime (`window.we`) reports the platform as iOS.\n *\n * `window.we.platform` is the canonical signal exposed by the Staffbase shell,\n * so reading it directly avoids user-agent ambiguity inside the app. Returns\n * false outside the Staffbase shell or when there is no DOM.\n * @returns {boolean} True when the runtime explicitly reports iOS.\n */\nexport const hasIosStaffbaseRuntime = (): boolean => {\n  if (typeof window === 'undefined') return false\n\n  const we = (window as { we?: { platform?: string } }).we\n  return we?.platform === 'ios'\n}\n","import { hasIosStaffbaseRuntime } from './hasIosStaffbaseRuntime'\n\n/**\n * Returns true when running on an iOS touch device (iPhone / iPad / iPod).\n *\n * Detection order: (1) the Staffbase runtime platform flag (authoritative\n * inside the shell), (2) legacy iOS user-agent (webviews and older Safari),\n * (3) iPadOS 13+ which reports a macOS user-agent but exposes multi-touch.\n * @returns {boolean} Whether the current device is iOS with touch.\n */\nexport const isIOSTouchDevice = (): boolean => {\n  if (hasIosStaffbaseRuntime()) return true\n  if (typeof navigator === 'undefined') return false\n\n  const ua = navigator.userAgent\n  if (/iPhone|iPad|iPod/.test(ua)) return true\n\n  // iPadOS desktop mode: UA says \"Macintosh\" but touch is available.\n  return /Macintosh/.test(ua) && navigator.maxTouchPoints > 1\n}\n","/**\n * Detects if the current environment is a mobile device or running inside a\n * webview, using userAgent heuristics common on iOS/Android and webviews.\n * Guards against non-browser environments (SSR/tests without navigator).\n * @returns {boolean} True if likely mobile or webview.\n */\nexport const isMobileOrWebview = (): boolean => {\n  if (typeof navigator === 'undefined') return false\n\n  const userAgent = navigator.userAgent.toLowerCase()\n  const isMobilePlatform =\n    /mobile|android|ios|iphone|ipad|ipod|windows phone/i.test(userAgent)\n  const isWebview = /wv|webview/i.test(userAgent)\n\n  return isMobilePlatform || isWebview\n}\n","/**\n * Checks if the viewport width is mobile-sized (<= 768px).\n * Guards against non-browser environments (SSR/tests without window).\n * @returns {boolean} True if the viewport width is 768px or less.\n */\nexport const isMobileViewport = (): boolean => {\n  if (typeof window === 'undefined') return false\n  return window.innerWidth <= 768\n}\n","import { isMobileOrWebview } from './isMobileOrWebview'\nimport { isMobileViewport } from './isMobileViewport'\n\n/**\n * Checks if the device is mobile either by user agent/webview or viewport size.\n * @returns {boolean} True if either a mobile/webview UA or a mobile viewport.\n */\nexport const isMobile = (): boolean => isMobileOrWebview() || isMobileViewport()\n","import type { WindowWithStaffbaseRuntime } from '../types/device/WindowWithStaffbaseRuntime'\nimport { isMobile } from './isMobile'\n\n/**\n * Whether the app is running on a mobile platform, per the `window.we.mobile`\n * runtime flag or device detection. Returns false outside a browser.\n * @returns {boolean} True when running on a mobile platform.\n */\nexport const isMobilePlatform = (): boolean => {\n  if (typeof window === 'undefined') return false\n\n  return (\n    (window as unknown as WindowWithStaffbaseRuntime).we?.mobile === true ||\n    isMobile()\n  )\n}\n","import type { WindowWithStaffbaseRuntime } from '../types/device/WindowWithStaffbaseRuntime'\n\n/**\n * Whether the app is running inside the Staffbase native shell, per the\n * `window.we.native` runtime flag. Returns false outside a browser.\n * @returns {boolean} True when running in the native app.\n */\nexport const isNativeApp = (): boolean => {\n  if (typeof window === 'undefined') return false\n\n  return (window as unknown as WindowWithStaffbaseRuntime).we?.native === true\n}\n"],"mappings":";AAQA,IAAa,UACP,OAAO,SAAW,MAAoB,KAE9B,OAA0C,IAC3C,aAAa,OCFb,UAAkC;CAC7C,IAAI,EAAuB,GAAG,OAAO;CACrC,IAAI,OAAO,YAAc,KAAa,OAAO;CAE7C,IAAM,IAAK,UAAU;CAIrB,OAHI,mBAAmB,KAAK,CAAE,IAAU,KAGjC,YAAY,KAAK,CAAE,KAAK,UAAU,iBAAiB;AAC5D,GCba,UAAmC;CAC9C,IAAI,OAAO,YAAc,KAAa,OAAO;CAE7C,IAAM,IAAY,UAAU,UAAU,YAAY,GAC5C,IACJ,qDAAqD,KAAK,CAAS,GAC/D,IAAY,cAAc,KAAK,CAAS;CAE9C,OAAO,KAAoB;AAC7B,GCVa,UACP,OAAO,SAAW,MAAoB,KACnC,OAAO,cAAc,KCAjB,UAA0B,EAAkB,KAAK,EAAiB,GCClE,UACP,OAAO,SAAW,MAAoB,KAGvC,OAAiD,IAAI,WAAW,MACjE,EAAS,GCNA,UACP,OAAO,SAAW,MAAoB,KAElC,OAAiD,IAAI,WAAW"}