{"version":3,"sources":["jsdelivr-header.js","/npm/react-native-open-wifi@0.2.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACFA,IAAI,WAAE,YAAe,QAAQ,gBAAgB,cAEzC,SAAW,CACb,QAAS,cACT,oBAAqB,qBAGvB,MAAM,WAAa,IACb,kBAAoB,IAE1B,SAAS,cAAe,GAAM,QAAE,EAAU,GAAK,YAAe,CAAC,EAAG,GAChE,OAAO,IAAI,SAAQ,CAAC,EAAS,KAC3B,WAAW,SAAS,IAClB,GAAI,IAAgB,EAApB,CAKA,WAAW,QAAQ,GAEnB,IAAI,EAAc,GAClB,SAAS,IACP,YAAW,WACT,GAAe,kBACf,WAAW,SAAS,IAClB,WAAW,QAAO,IAEZ,IAAgB,GAAmB,cAAX,EAC1B,IACS,GAAe,EACxB,EAAO,IAAI,MAAM,8BAEjB,GACF,GACA,GAEN,GAAG,kBACL,CACA,EAtBA,MAFE,GAwBS,GACX,GAEN,CAEA,SAAS,sBACP,OAAO,IAAI,SAAQ,CAAC,EAAS,KAC3B,WAAW,qBAAoB,IAC7B,EAAQ,EAAU,GAClB,GAEN,CAEA,OAAO,QAAU","file":"/npm/react-native-open-wifi@0.2.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-native-open-wifi@0.2.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * @providesModule react-native-open-wifi\n */\n\nvar { RNOpenWifi } = require('react-native').NativeModules;\n\nvar OpenWifi = {\n  connect: connectToSsid,\n  isMobileDataEnabled: isMobileDataEnabled\n};\n\nconst ONE_SECOND = 1000;\nconst POLLING_FREQUENCY = 500;\n\nfunction connectToSsid (ssid, { timeout = 10 * ONE_SECOND } = {}, debug) {\n  return new Promise((resolve, reject) => {\n    RNOpenWifi.getSSID((currentSsid) => {\n      if (currentSsid === ssid) {\n        resolve();\n        return;\n      }\n      // Connect to WiFi network\n      RNOpenWifi.connect(ssid);\n      // Check every 500 milliseconds if we are connected to the right SSID\n      var timeElapsed = 0;\n      function checkSSID () {\n        setTimeout(function () {\n          timeElapsed += POLLING_FREQUENCY;\n          RNOpenWifi.getSSID((currentSsid) => {\n            RNOpenWifi.status(status => {\n              // console.log('ssid:', currentSsid, 'status:', status);\n              if (currentSsid === ssid && status === 'COMPLETED') {\n                resolve();\n              } else if (timeElapsed >= timeout) {\n                reject(new Error('Couldn\\'t find the network'));\n              } else {\n                checkSSID();\n              }\n            });\n          });\n        }, POLLING_FREQUENCY);\n      }\n      checkSSID();\n    });\n  });\n}\n\nfunction isMobileDataEnabled () {\n  return new Promise((resolve, reject) => {\n    RNOpenWifi.isMobileDataEnabled(isEnabled => {\n      resolve(isEnabled);\n    });\n  });\n}\n\nmodule.exports = OpenWifi;\n"]}