{"version":3,"file":"detect-it-Cl3z-Nwf.js","sources":["../../node_modules/detect-it/lib/index.js"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _detectHover = require('detect-hover');\n\nvar _detectHover2 = _interopRequireDefault(_detectHover);\n\nvar _detectPointer = require('detect-pointer');\n\nvar _detectPointer2 = _interopRequireDefault(_detectPointer);\n\nvar _detectTouchEvents = require('detect-touch-events');\n\nvar _detectTouchEvents2 = _interopRequireDefault(_detectTouchEvents);\n\nvar _detectPassiveEvents = require('detect-passive-events');\n\nvar _detectPassiveEvents2 = _interopRequireDefault(_detectPassiveEvents);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\n * detectIt object structure\n * const detectIt = {\n * deviceType: 'mouseOnly' / 'touchOnly' / 'hybrid',\n * passiveEvents: boolean,\n * hasTouch: boolean,\n * hasMouse: boolean,\n * maxTouchPoints: number,\n * primaryHover: 'hover' / 'none',\n * primaryPointer: 'fine' / 'coarse' / 'none',\n * state: {\n * detectHover,\n * detectPointer,\n * detectTouchEvents,\n * detectPassiveEvents,\n * },\n * update() {...},\n * }\n */\n\nfunction determineDeviceType(hasTouch, anyHover, anyFine, state) {\n // A hybrid device is one that both hasTouch and any input device can hover\n // or has a fine pointer.\n if (hasTouch && (anyHover || anyFine)) return 'hybrid';\n\n // workaround for browsers that have the touch events api,\n // and have implemented Level 4 media queries but not the\n // hover and pointer media queries, so the tests are all false (notable Firefox)\n // if it hasTouch, no pointer and hover support, and on an android assume it's touchOnly\n // if it hasTouch, no pointer and hover support, and not on an android assume it's a hybrid\n if (hasTouch && Object.keys(state.detectHover).filter(function (key) {\n return key !== 'update';\n }).every(function (key) {\n return state.detectHover[key] === false;\n }) && Object.keys(state.detectPointer).filter(function (key) {\n return key !== 'update';\n }).every(function (key) {\n return state.detectPointer[key] === false;\n })) {\n if (window.navigator && /android/.test(window.navigator.userAgent.toLowerCase())) {\n return 'touchOnly';\n }\n return 'hybrid';\n }\n\n // In almost all cases a device that doesn’t support touch will have a mouse,\n // but there may be rare exceptions. Note that it doesn’t work to do additional tests\n // based on hover and pointer media queries as older browsers don’t support these.\n // Essentially, 'mouseOnly' is the default.\n return hasTouch ? 'touchOnly' : 'mouseOnly';\n}\n\nvar detectIt = {\n state: {\n detectHover: _detectHover2.default,\n detectPointer: _detectPointer2.default,\n detectTouchEvents: _detectTouchEvents2.default,\n detectPassiveEvents: _detectPassiveEvents2.default\n },\n update: function update() {\n detectIt.state.detectHover.update();\n detectIt.state.detectPointer.update();\n detectIt.state.detectTouchEvents.update();\n detectIt.state.detectPassiveEvents.update();\n detectIt.updateOnlyOwnProperties();\n },\n updateOnlyOwnProperties: function updateOnlyOwnProperties() {\n if (typeof window !== 'undefined') {\n detectIt.passiveEvents = detectIt.state.detectPassiveEvents.hasSupport || false;\n\n detectIt.hasTouch = detectIt.state.detectTouchEvents.hasSupport || false;\n\n detectIt.deviceType = determineDeviceType(detectIt.hasTouch, detectIt.state.detectHover.anyHover, detectIt.state.detectPointer.anyFine, detectIt.state);\n\n detectIt.hasMouse = detectIt.deviceType !== 'touchOnly';\n\n detectIt.primaryInput = detectIt.deviceType === 'mouseOnly' && 'mouse' || detectIt.deviceType === 'touchOnly' && 'touch' ||\n // deviceType is hybrid:\n detectIt.state.detectPointer.fine && 'mouse' || detectIt.state.detectPointer.coarse && 'touch' ||\n // if there's no support for hover media queries but detectIt determined it's\n // a hybrid device, then assume it's a mouse first device\n 'mouse';\n\n // issue with Windows Chrome on hybrid devices starting in version 59 where\n // media queries represent a touch only device, so if the browser is an\n // affected Windows Chrome version and hasTouch,\n // then assume it's a hybrid with primaryInput mouse\n // note that version 62 of Chrome fixes this issue\n // see https://github.com/rafgraph/detect-it/issues/8\n var inVersionRange = function inVersionRange(version) {\n return version >= 59 && version < 62;\n };\n var isAffectedWindowsChromeVersion = /windows/.test(window.navigator.userAgent.toLowerCase()) && /chrome/.test(window.navigator.userAgent.toLowerCase()) && inVersionRange(parseInt(/Chrome\\/([0-9.]+)/.exec(navigator.userAgent)[1], 10));\n\n if (isAffectedWindowsChromeVersion && detectIt.hasTouch) {\n detectIt.deviceType = 'hybrid';\n detectIt.hasMouse = true;\n detectIt.primaryInput = 'mouse';\n }\n }\n }\n};\n\ndetectIt.updateOnlyOwnProperties();\nexports.default = detectIt;"],"names":["lib","_detectHover","require$$0","_detectHover2","_interopRequireDefault","_detectPointer","require$$1","_detectPointer2","_detectTouchEvents","require$$2","_detectTouchEvents2","_detectPassiveEvents","require$$3","_detectPassiveEvents2","obj","determineDeviceType","hasTouch","anyHover","anyFine","state","key","detectIt","inVersionRange","version","isAffectedWindowsChromeVersion"],"mappings":"6jBAEA,OAAO,eAAeA,EAAS,aAAc,CAC3C,MAAO,EACT,CAAC,EAED,IAAIC,EAAeC,EAEfC,EAAgBC,EAAuBH,CAAY,EAEnDI,EAAiBC,EAEjBC,EAAkBH,EAAuBC,CAAc,EAEvDG,EAAqBC,EAErBC,EAAsBN,EAAuBI,CAAkB,EAE/DG,EAAuBC,EAEvBC,EAAwBT,EAAuBO,CAAoB,EAEvE,SAASP,EAAuBU,EAAK,CAAE,OAAOA,GAAOA,EAAI,WAAaA,EAAM,CAAE,QAASA,EAAM,CAsB7F,SAASC,EAAoBC,EAAUC,EAAUC,EAASC,EAAO,CAG/D,OAAIH,IAAaC,GAAYC,GAAiB,SAO1CF,GAAY,OAAO,KAAKG,EAAM,WAAW,EAAE,OAAO,SAAUC,EAAK,CACnE,OAAOA,IAAQ,QACnB,CAAG,EAAE,MAAM,SAAUA,EAAK,CACtB,OAAOD,EAAM,YAAYC,CAAG,IAAM,EACtC,CAAG,GAAK,OAAO,KAAKD,EAAM,aAAa,EAAE,OAAO,SAAUC,EAAK,CAC3D,OAAOA,IAAQ,QACnB,CAAG,EAAE,MAAM,SAAUA,EAAK,CACtB,OAAOD,EAAM,cAAcC,CAAG,IAAM,EACxC,CAAG,EACK,OAAO,WAAa,UAAU,KAAK,OA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