@neurosity/sdk 6.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/dist/browser/neurosity.iife.js +48736 -0
- package/dist/browser/neurosity.js +672 -0
- package/dist/browser/neurosity.js.map +1 -0
- package/dist/cjs/Notion.d.ts +619 -0
- package/dist/cjs/Notion.js +1291 -0
- package/dist/cjs/api/bluetooth/BluetoothClient.d.ts +59 -0
- package/dist/cjs/api/bluetooth/BluetoothClient.js +287 -0
- package/dist/cjs/api/bluetooth/BluetoothTransport.d.ts +32 -0
- package/dist/cjs/api/bluetooth/BluetoothTransport.js +2 -0
- package/dist/cjs/api/bluetooth/constants.d.ts +4 -0
- package/dist/cjs/api/bluetooth/constants.js +9 -0
- package/dist/cjs/api/bluetooth/index.d.ts +4 -0
- package/dist/cjs/api/bluetooth/index.js +20 -0
- package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.d.ts +65 -0
- package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.js +386 -0
- package/dist/cjs/api/bluetooth/react-native/types/BleManagerTypes.d.ts +63 -0
- package/dist/cjs/api/bluetooth/react-native/types/BleManagerTypes.js +11 -0
- package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +180 -0
- package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.js +10 -0
- package/dist/cjs/api/bluetooth/types/index.d.ts +31 -0
- package/dist/cjs/api/bluetooth/types/index.js +22 -0
- package/dist/cjs/api/bluetooth/utils/create6DigitPin.d.ts +1 -0
- package/dist/cjs/api/bluetooth/utils/create6DigitPin.js +8 -0
- package/dist/cjs/api/bluetooth/utils/csvBufferToEpoch.d.ts +11 -0
- package/dist/cjs/api/bluetooth/utils/csvBufferToEpoch.js +36 -0
- package/dist/cjs/api/bluetooth/utils/encoding.d.ts +3 -0
- package/dist/cjs/api/bluetooth/utils/encoding.js +22 -0
- package/dist/cjs/api/bluetooth/utils/osHasBluetoothSupport.d.ts +2 -0
- package/dist/cjs/api/bluetooth/utils/osHasBluetoothSupport.js +23 -0
- package/dist/cjs/api/bluetooth/utils/stitch.d.ts +5 -0
- package/dist/cjs/api/bluetooth/utils/stitch.js +22 -0
- package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.d.ts +47 -0
- package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.js +412 -0
- package/dist/cjs/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +1 -0
- package/dist/cjs/api/bluetooth/web/isMaybeWebWorkerContext.js +8 -0
- package/dist/cjs/api/bluetooth/web/isWebBluetoothSupported.d.ts +1 -0
- package/dist/cjs/api/bluetooth/web/isWebBluetoothSupported.js +11 -0
- package/dist/cjs/api/firebase/FirebaseApp.d.ts +20 -0
- package/dist/cjs/api/firebase/FirebaseApp.js +70 -0
- package/dist/cjs/api/firebase/FirebaseDevice.d.ts +68 -0
- package/dist/cjs/api/firebase/FirebaseDevice.js +146 -0
- package/dist/cjs/api/firebase/FirebaseUser.d.ts +53 -0
- package/dist/cjs/api/firebase/FirebaseUser.js +434 -0
- package/dist/cjs/api/firebase/config.d.ts +8 -0
- package/dist/cjs/api/firebase/config.js +11 -0
- package/dist/cjs/api/firebase/deviceStore.d.ts +26 -0
- package/dist/cjs/api/firebase/deviceStore.js +191 -0
- package/dist/cjs/api/firebase/index.d.ts +3 -0
- package/dist/cjs/api/firebase/index.js +19 -0
- package/dist/cjs/api/https/config.d.ts +1 -0
- package/dist/cjs/api/https/config.js +4 -0
- package/dist/cjs/api/https/createOAuthURL.d.ts +3 -0
- package/dist/cjs/api/https/createOAuthURL.js +18 -0
- package/dist/cjs/api/https/getOAuthToken.d.ts +3 -0
- package/dist/cjs/api/https/getOAuthToken.js +34 -0
- package/dist/cjs/api/https/utils.d.ts +2 -0
- package/dist/cjs/api/https/utils.js +13 -0
- package/dist/cjs/api/index.d.ts +108 -0
- package/dist/cjs/api/index.js +306 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/skills/NotionOnDevice.d.ts +7 -0
- package/dist/cjs/skills/NotionOnDevice.js +25 -0
- package/dist/cjs/skills/createSkill.d.ts +7 -0
- package/dist/cjs/skills/createSkill.js +40 -0
- package/dist/cjs/skills/index.d.ts +2 -0
- package/dist/cjs/skills/index.js +18 -0
- package/dist/cjs/subscriptions/SubscriptionManager.d.ts +11 -0
- package/dist/cjs/subscriptions/SubscriptionManager.js +27 -0
- package/dist/cjs/timesync/Timesync.d.ts +20 -0
- package/dist/cjs/timesync/Timesync.js +78 -0
- package/dist/cjs/timesync/index.d.ts +1 -0
- package/dist/cjs/timesync/index.js +17 -0
- package/dist/cjs/types/accelerometer.d.ts +10 -0
- package/dist/cjs/types/accelerometer.js +2 -0
- package/dist/cjs/types/actions.d.ts +16 -0
- package/dist/cjs/types/actions.js +2 -0
- package/dist/cjs/types/awareness.d.ts +1 -0
- package/dist/cjs/types/awareness.js +2 -0
- package/dist/cjs/types/brainwaves.d.ts +26 -0
- package/dist/cjs/types/brainwaves.js +2 -0
- package/dist/cjs/types/calm.d.ts +6 -0
- package/dist/cjs/types/calm.js +2 -0
- package/dist/cjs/types/client.d.ts +22 -0
- package/dist/cjs/types/client.js +2 -0
- package/dist/cjs/types/credentials.d.ts +12 -0
- package/dist/cjs/types/credentials.js +2 -0
- package/dist/cjs/types/deviceInfo.d.ts +18 -0
- package/dist/cjs/types/deviceInfo.js +2 -0
- package/dist/cjs/types/epoch.d.ts +12 -0
- package/dist/cjs/types/epoch.js +2 -0
- package/dist/cjs/types/experiment.d.ts +9 -0
- package/dist/cjs/types/experiment.js +2 -0
- package/dist/cjs/types/focus.d.ts +6 -0
- package/dist/cjs/types/focus.js +2 -0
- package/dist/cjs/types/hapticEffects.d.ts +125 -0
- package/dist/cjs/types/hapticEffects.js +2 -0
- package/dist/cjs/types/kinesis.d.ts +6 -0
- package/dist/cjs/types/kinesis.js +2 -0
- package/dist/cjs/types/marker.d.ts +7 -0
- package/dist/cjs/types/marker.js +2 -0
- package/dist/cjs/types/metrics.d.ts +21 -0
- package/dist/cjs/types/metrics.js +2 -0
- package/dist/cjs/types/oauth.d.ts +20 -0
- package/dist/cjs/types/oauth.js +2 -0
- package/dist/cjs/types/options.d.ts +51 -0
- package/dist/cjs/types/options.js +2 -0
- package/dist/cjs/types/sample.d.ts +15 -0
- package/dist/cjs/types/sample.js +2 -0
- package/dist/cjs/types/settings.d.ts +13 -0
- package/dist/cjs/types/settings.js +2 -0
- package/dist/cjs/types/signalQuality.d.ts +13 -0
- package/dist/cjs/types/signalQuality.js +2 -0
- package/dist/cjs/types/skill.d.ts +68 -0
- package/dist/cjs/types/skill.js +2 -0
- package/dist/cjs/types/status.d.ts +26 -0
- package/dist/cjs/types/status.js +22 -0
- package/dist/cjs/types/streaming.d.ts +15 -0
- package/dist/cjs/types/streaming.js +20 -0
- package/dist/cjs/types/subscriptions.d.ts +23 -0
- package/dist/cjs/types/subscriptions.js +2 -0
- package/dist/cjs/types/training.d.ts +19 -0
- package/dist/cjs/types/training.js +2 -0
- package/dist/cjs/types/user.d.ts +12 -0
- package/dist/cjs/types/user.js +2 -0
- package/dist/cjs/utils/errors.d.ts +5 -0
- package/dist/cjs/utils/errors.js +17 -0
- package/dist/cjs/utils/filterInternalKeys.d.ts +3 -0
- package/dist/cjs/utils/filterInternalKeys.js +21 -0
- package/dist/cjs/utils/hapticEffects.d.ts +123 -0
- package/dist/cjs/utils/hapticEffects.js +130 -0
- package/dist/cjs/utils/heartbeat.d.ts +4 -0
- package/dist/cjs/utils/heartbeat.js +34 -0
- package/dist/cjs/utils/is-node.d.ts +1 -0
- package/dist/cjs/utils/is-node.js +9 -0
- package/dist/cjs/utils/metrics.d.ts +1 -0
- package/dist/cjs/utils/metrics.js +56 -0
- package/dist/cjs/utils/oauth.d.ts +9 -0
- package/dist/cjs/utils/oauth.js +92 -0
- package/dist/cjs/utils/pick.d.ts +1 -0
- package/dist/cjs/utils/pick.js +5 -0
- package/dist/cjs/utils/pipes.d.ts +46 -0
- package/dist/cjs/utils/pipes.js +71 -0
- package/dist/cjs/utils/platform.d.ts +30 -0
- package/dist/cjs/utils/platform.js +47 -0
- package/dist/cjs/utils/subscription.d.ts +6 -0
- package/dist/cjs/utils/subscription.js +55 -0
- package/dist/cjs/utils/transferDevice.d.ts +9 -0
- package/dist/cjs/utils/transferDevice.js +2 -0
- package/dist/cjs/utils/whileOnline.d.ts +8 -0
- package/dist/cjs/utils/whileOnline.js +15 -0
- package/dist/electron/index.js +92 -0
- package/dist/electron/index.js.map +1 -0
- package/dist/esm/Notion.d.ts +619 -0
- package/dist/esm/Notion.js +1260 -0
- package/dist/esm/api/bluetooth/BluetoothClient.d.ts +59 -0
- package/dist/esm/api/bluetooth/BluetoothClient.js +283 -0
- package/dist/esm/api/bluetooth/BluetoothTransport.d.ts +32 -0
- package/dist/esm/api/bluetooth/BluetoothTransport.js +1 -0
- package/dist/esm/api/bluetooth/constants.d.ts +4 -0
- package/dist/esm/api/bluetooth/constants.js +6 -0
- package/dist/esm/api/bluetooth/index.d.ts +4 -0
- package/dist/esm/api/bluetooth/index.js +4 -0
- package/dist/esm/api/bluetooth/react-native/ReactNativeTransport.d.ts +65 -0
- package/dist/esm/api/bluetooth/react-native/ReactNativeTransport.js +382 -0
- package/dist/esm/api/bluetooth/react-native/types/BleManagerTypes.d.ts +63 -0
- package/dist/esm/api/bluetooth/react-native/types/BleManagerTypes.js +8 -0
- package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +180 -0
- package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.js +9 -0
- package/dist/esm/api/bluetooth/types/index.d.ts +31 -0
- package/dist/esm/api/bluetooth/types/index.js +19 -0
- package/dist/esm/api/bluetooth/utils/create6DigitPin.d.ts +1 -0
- package/dist/esm/api/bluetooth/utils/create6DigitPin.js +4 -0
- package/dist/esm/api/bluetooth/utils/csvBufferToEpoch.d.ts +11 -0
- package/dist/esm/api/bluetooth/utils/csvBufferToEpoch.js +31 -0
- package/dist/esm/api/bluetooth/utils/encoding.d.ts +3 -0
- package/dist/esm/api/bluetooth/utils/encoding.js +17 -0
- package/dist/esm/api/bluetooth/utils/osHasBluetoothSupport.d.ts +2 -0
- package/dist/esm/api/bluetooth/utils/osHasBluetoothSupport.js +16 -0
- package/dist/esm/api/bluetooth/utils/stitch.d.ts +5 -0
- package/dist/esm/api/bluetooth/utils/stitch.js +18 -0
- package/dist/esm/api/bluetooth/web/WebBluetoothTransport.d.ts +47 -0
- package/dist/esm/api/bluetooth/web/WebBluetoothTransport.js +408 -0
- package/dist/esm/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +1 -0
- package/dist/esm/api/bluetooth/web/isMaybeWebWorkerContext.js +4 -0
- package/dist/esm/api/bluetooth/web/isWebBluetoothSupported.d.ts +1 -0
- package/dist/esm/api/bluetooth/web/isWebBluetoothSupported.js +7 -0
- package/dist/esm/api/firebase/FirebaseApp.d.ts +20 -0
- package/dist/esm/api/firebase/FirebaseApp.js +63 -0
- package/dist/esm/api/firebase/FirebaseDevice.d.ts +68 -0
- package/dist/esm/api/firebase/FirebaseDevice.js +139 -0
- package/dist/esm/api/firebase/FirebaseUser.d.ts +53 -0
- package/dist/esm/api/firebase/FirebaseUser.js +426 -0
- package/dist/esm/api/firebase/config.d.ts +8 -0
- package/dist/esm/api/firebase/config.js +8 -0
- package/dist/esm/api/firebase/deviceStore.d.ts +26 -0
- package/dist/esm/api/firebase/deviceStore.js +184 -0
- package/dist/esm/api/firebase/index.d.ts +3 -0
- package/dist/esm/api/firebase/index.js +3 -0
- package/dist/esm/api/https/config.d.ts +1 -0
- package/dist/esm/api/https/config.js +1 -0
- package/dist/esm/api/https/createOAuthURL.d.ts +3 -0
- package/dist/esm/api/https/createOAuthURL.js +11 -0
- package/dist/esm/api/https/getOAuthToken.d.ts +3 -0
- package/dist/esm/api/https/getOAuthToken.js +27 -0
- package/dist/esm/api/https/utils.d.ts +2 -0
- package/dist/esm/api/https/utils.js +9 -0
- package/dist/esm/api/index.d.ts +108 -0
- package/dist/esm/api/index.js +299 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/neurosity.mjs +48722 -0
- package/dist/esm/skills/NotionOnDevice.d.ts +7 -0
- package/dist/esm/skills/NotionOnDevice.js +21 -0
- package/dist/esm/skills/createSkill.d.ts +7 -0
- package/dist/esm/skills/createSkill.js +36 -0
- package/dist/esm/skills/index.d.ts +2 -0
- package/dist/esm/skills/index.js +2 -0
- package/dist/esm/subscriptions/SubscriptionManager.d.ts +11 -0
- package/dist/esm/subscriptions/SubscriptionManager.js +23 -0
- package/dist/esm/timesync/Timesync.d.ts +20 -0
- package/dist/esm/timesync/Timesync.js +71 -0
- package/dist/esm/timesync/index.d.ts +1 -0
- package/dist/esm/timesync/index.js +1 -0
- package/dist/esm/types/accelerometer.d.ts +10 -0
- package/dist/esm/types/accelerometer.js +1 -0
- package/dist/esm/types/actions.d.ts +16 -0
- package/dist/esm/types/actions.js +1 -0
- package/dist/esm/types/awareness.d.ts +1 -0
- package/dist/esm/types/awareness.js +1 -0
- package/dist/esm/types/brainwaves.d.ts +26 -0
- package/dist/esm/types/brainwaves.js +1 -0
- package/dist/esm/types/calm.d.ts +6 -0
- package/dist/esm/types/calm.js +1 -0
- package/dist/esm/types/client.d.ts +22 -0
- package/dist/esm/types/client.js +1 -0
- package/dist/esm/types/credentials.d.ts +12 -0
- package/dist/esm/types/credentials.js +1 -0
- package/dist/esm/types/deviceInfo.d.ts +18 -0
- package/dist/esm/types/deviceInfo.js +1 -0
- package/dist/esm/types/epoch.d.ts +12 -0
- package/dist/esm/types/epoch.js +1 -0
- package/dist/esm/types/experiment.d.ts +9 -0
- package/dist/esm/types/experiment.js +1 -0
- package/dist/esm/types/focus.d.ts +6 -0
- package/dist/esm/types/focus.js +1 -0
- package/dist/esm/types/hapticEffects.d.ts +125 -0
- package/dist/esm/types/hapticEffects.js +1 -0
- package/dist/esm/types/kinesis.d.ts +6 -0
- package/dist/esm/types/kinesis.js +1 -0
- package/dist/esm/types/marker.d.ts +7 -0
- package/dist/esm/types/marker.js +1 -0
- package/dist/esm/types/metrics.d.ts +21 -0
- package/dist/esm/types/metrics.js +1 -0
- package/dist/esm/types/oauth.d.ts +20 -0
- package/dist/esm/types/oauth.js +1 -0
- package/dist/esm/types/options.d.ts +51 -0
- package/dist/esm/types/options.js +1 -0
- package/dist/esm/types/sample.d.ts +15 -0
- package/dist/esm/types/sample.js +1 -0
- package/dist/esm/types/settings.d.ts +13 -0
- package/dist/esm/types/settings.js +1 -0
- package/dist/esm/types/signalQuality.d.ts +13 -0
- package/dist/esm/types/signalQuality.js +1 -0
- package/dist/esm/types/skill.d.ts +68 -0
- package/dist/esm/types/skill.js +1 -0
- package/dist/esm/types/status.d.ts +26 -0
- package/dist/esm/types/status.js +19 -0
- package/dist/esm/types/streaming.d.ts +15 -0
- package/dist/esm/types/streaming.js +17 -0
- package/dist/esm/types/subscriptions.d.ts +23 -0
- package/dist/esm/types/subscriptions.js +1 -0
- package/dist/esm/types/training.d.ts +19 -0
- package/dist/esm/types/training.js +1 -0
- package/dist/esm/types/user.d.ts +12 -0
- package/dist/esm/types/user.js +1 -0
- package/dist/esm/utils/errors.d.ts +5 -0
- package/dist/esm/utils/errors.js +11 -0
- package/dist/esm/utils/filterInternalKeys.d.ts +3 -0
- package/dist/esm/utils/filterInternalKeys.js +17 -0
- package/dist/esm/utils/hapticEffects.d.ts +123 -0
- package/dist/esm/utils/hapticEffects.js +125 -0
- package/dist/esm/utils/heartbeat.d.ts +4 -0
- package/dist/esm/utils/heartbeat.js +29 -0
- package/dist/esm/utils/is-node.d.ts +1 -0
- package/dist/esm/utils/is-node.js +5 -0
- package/dist/esm/utils/metrics.d.ts +1 -0
- package/dist/esm/utils/metrics.js +52 -0
- package/dist/esm/utils/oauth.d.ts +9 -0
- package/dist/esm/utils/oauth.js +64 -0
- package/dist/esm/utils/pick.d.ts +1 -0
- package/dist/esm/utils/pick.js +1 -0
- package/dist/esm/utils/pipes.d.ts +46 -0
- package/dist/esm/utils/pipes.js +65 -0
- package/dist/esm/utils/platform.d.ts +30 -0
- package/dist/esm/utils/platform.js +41 -0
- package/dist/esm/utils/subscription.d.ts +6 -0
- package/dist/esm/utils/subscription.js +24 -0
- package/dist/esm/utils/transferDevice.d.ts +9 -0
- package/dist/esm/utils/transferDevice.js +1 -0
- package/dist/esm/utils/whileOnline.d.ts +8 -0
- package/dist/esm/utils/whileOnline.js +11 -0
- package/dist/examples/auth.html +32 -0
- package/dist/examples/cloud.html +17 -0
- package/dist/examples/index.html +1 -0
- package/dist/examples/neurosity.iife.js +48736 -0
- package/dist/examples/neurosity.js +672 -0
- package/dist/examples/neurosity.mjs +48722 -0
- package/dist/examples/training.html +49 -0
- package/package.json +78 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
process.env.HMR_PORT=0;process.env.HMR_HOSTNAME="localhost";parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"TX5A":[function(require,module,exports) {
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.config=void 0,exports.config={apiKey:"AIzaSyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8",authDomain:"neurosity-device.firebaseapp.com",databaseURL:"https://neurosity-device.firebaseio.com",projectId:"neurosity-device",storageBucket:"neurosity-device.appspot.com",messagingSenderId:"212595049674"};
|
|
3
|
+
},{}],"OERo":[function(require,module,exports) {
|
|
4
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FirebaseApp=exports.SERVER_TIMESTAMP=void 0;const t=e(require("firebase/app"));require("firebase/database"),require("firebase/auth"),require("firebase/functions"),require("firebase/firestore");const a=require("./config");exports.SERVER_TIMESTAMP=t.default.database.ServerValue.TIMESTAMP;class i{constructor(e){this.app=this.getApp(e.deviceId),this.standalone=this.app.name===e.deviceId,e.emulator&&this.connectEmulators(e)}getApp(e){const i=t.default.apps,s="undefined"!=typeof window&&"firebase"in window&&"apps"in window.firebase?window.firebase.apps:[],r=[...i,...s].find(e=>"[DEFAULT]"===e.name&&e.options.databaseURL===a.config.databaseURL);if(r)return r;if(e){const s=e,r=i.find(e=>e.name===s);return r||t.default.initializeApp(a.config,s)}return t.default.initializeApp(a.config)}connectEmulators(e){const{emulatorHost:t,emulatorAuthPort:a,emulatorDatabasePort:i,emulatorFunctionsPort:s,emulatorFirestorePort:r,emulatorOptions:o}=e;this.app.auth().useEmulator(`http://${t}:${a}`),this.app.database().useEmulator(t,i,o),this.app.functions().useEmulator(t,s),this.app.firestore().useEmulator(t,r,o)}goOnline(){this.app.database().goOnline()}goOffline(){this.app.database().goOffline()}disconnect(){return this.standalone?this.app.delete():Promise.resolve()}}exports.FirebaseApp=i;
|
|
5
|
+
},{"./config":"TX5A"}],"Cc51":[function(require,module,exports) {
|
|
6
|
+
"use strict";var e=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(function(n,s){function a(e){try{c(r.next(e))}catch(t){s(t)}}function o(e){try{c(r.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,o)}c((r=r.apply(e,t||[])).next())})},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FirebaseUser=exports.createUser=exports.credentialWithLink=void 0;const i=require("rxjs"),r=require("rxjs/operators"),n=t(require("firebase/app")),s=n.default.database.ServerValue.TIMESTAMP;function a(...e){return new n.default.User(...e)}exports.credentialWithLink=n.default.auth.EmailAuthProvider.credentialWithLink,exports.createUser=a;class o{constructor(e){this.app=e.app,this.app.auth().onAuthStateChanged(e=>{this.user=e})}auth(){return this.app.auth()}createAccount(t){return e(this,void 0,void 0,function*(){const{email:e,password:i}=t,[r,n]=yield this.app.auth().createUserWithEmailAndPassword(e,i).then(e=>[null,e]).catch(e=>[e,null]);return r?Promise.reject(r):n})}deleteAccount(){return e(this,void 0,void 0,function*(){const e=this.app.auth().currentUser;if(!e)return Promise.reject(new Error("You are trying to delete an account that is not authenticated. To delete an account, the account must have signed in recently."));const[t,i]=yield this.getDevices().then(e=>[null,e]).catch(e=>[e,null]);if(t)return Promise.reject(t);if(i.length){const e=yield Promise.all(i.map(e=>this.removeDevice(e.deviceId))).then(()=>null).catch(e=>e);if(e)return Promise.reject(e)}return e.delete()})}onAuthStateChanged(){return new i.Observable(e=>{try{this.app.auth().onAuthStateChanged(t=>{e.next(t)},t=>{e.error(t)})}catch(t){e.error(t)}})}onLogin(){return new i.Observable(e=>{const t=this.app.auth().onAuthStateChanged(t=>{t&&(e.next(t),e.complete())});return()=>t()})}login(e){if("customToken"in e){const{customToken:t}=e;return this.app.auth().signInWithCustomToken(t)}if("idToken"in e&&"providerId"in e){const t=new n.default.auth.OAuthProvider(e.providerId).credential(e.idToken);return this.app.auth().signInWithCredential(t)}if("email"in e&&"password"in e){const{email:t,password:i}=e;return this.app.auth().signInWithEmailAndPassword(t,i)}throw new Error("Either {email,password}, {customToken}, or {idToken,providerId} is required")}logout(){return this.app.auth().signOut()}createCustomToken(){return e(this,void 0,void 0,function*(){const[e,t]=yield this.app.functions().httpsCallable("createCustomToken")().then(({data:e})=>[null,e]).catch(e=>[e,null]);return e?Promise.reject(e):t})}removeOAuthAccess(){var t;return e(this,void 0,void 0,function*(){if(!(null===(t=this.user)||void 0===t?void 0:t.uid))return Promise.reject("OAuth access can only be removed while logged in via OAuth.");const[e,i]=yield this.app.functions().httpsCallable("removeAccessOAuthApp")().then(({data:e})=>[null,e]).catch(e=>[e,null]);if(e)return Promise.reject(e);const r=yield this.logout().then(()=>!1).catch(e=>e);return r?Promise.reject(r):i})}getDevices(){var t;return e(this,void 0,void 0,function*(){if(!(null===(t=this.user)||void 0===t?void 0:t.uid))return Promise.reject("Please login.");const e=(yield this.app.database().ref(this.getUserDevicesPath()).once("value")).val();return this.userDevicesToDeviceInfoList(e)})}addDevice(t){var i;return e(this,void 0,void 0,function*(){const e=null===(i=this.user)||void 0===i?void 0:i.uid;if(!e)return Promise.reject("Please login.");const r=yield this.getDevices().catch(e=>{console.log(e)});if(r&&r.length&&r.map(({deviceId:e})=>e).includes(t))return Promise.reject("The device is already added to this account.");const[n,a]=yield this.isDeviceIdValid(t).then(e=>[e]).catch(e=>[!1,e]);if(!n)return Promise.reject(a);const o=this.getDeviceClaimedByPath(t),c=this.getUserClaimedDevicePath(t),[u,d]=yield this.app.database().ref().update({[o]:e,[c]:{claimedOn:s}}).then(()=>[!1]).catch(e=>[!0,e]);return u?Promise.reject(d):void 0})}removeDevice(t){var i;return e(this,void 0,void 0,function*(){if(!(null===(i=this.user)||void 0===i?void 0:i.uid))return Promise.reject("Please login.");const e=this.getDeviceClaimedByPath(t),r=this.getUserClaimedDevicePath(t),n=this.app.database().ref(e),s=this.app.database().ref(r),[a,o]=yield Promise.all([n.remove(),s.remove()]).then(()=>[!1]).catch(e=>[!0,e]);return a?Promise.reject(o):void 0})}transferDevice(t){var i;return e(this,void 0,void 0,function*(){if(!(null===(i=this.user)||void 0===i?void 0:i.uid))return Promise.reject(new Error("transferDevice: auth is required."));if(!("recipientsEmail"in t||"recipientsUserId"in t))return Promise.reject(new Error("transferDevice: either 'recipientsEmail' or 'recipientsUserId' key is required."));if(!(null==t?void 0:t.deviceId))return Promise.reject(new Error("transferDevice: a deviceId is required."));const[e,r]=yield this.app.functions().httpsCallable("transferDeviceOwnership")(t).then(({data:e})=>[null,e]).catch(e=>[e,null]);return e?Promise.reject(e):void 0})}isDeviceIdValid(t){return e(this,void 0,void 0,function*(){if(!t||32!==t.length||!/[0-9A-Fa-f]{32}/g.test(t))return Promise.reject("The device id is incorrectly formatted.");const e=this.getDeviceClaimedByPath(t),i=this.app.database().ref(e),r=yield i.once("value").catch(()=>null);return!(!r||r.exists())||Promise.reject("The device has already been claimed.")})}onUserDevicesChange(){return this.onAuthStateChanged().pipe((0,r.switchMap)(e=>{if(!e)return i.EMPTY;const t=this.getUserDevicesPath(),n=this.app.database().ref(t);return(0,i.fromEventPattern)(e=>n.on("value",e),e=>n.off("value",e)).pipe((0,r.map)(([e])=>e.val()),(0,r.switchMap)(e=>(0,i.from)(this.userDevicesToDeviceInfoList(e))))}))}onUserClaimsChange(){return this.onAuthStateChanged().pipe((0,r.switchMap)(e=>{if(!e)return i.EMPTY;const t=this.getUserClaimsUpdatedOnPath(),n=this.app.database().ref(t);return(0,i.fromEventPattern)(e=>n.on("value",e),e=>n.off("value",e)).pipe((0,r.map)(([e])=>e.val()),(0,r.switchMap)(()=>(0,i.from)(this.getIdToken(!0)).pipe((0,r.switchMap)(()=>(0,i.from)(this.getClaims())))))}))}getIdToken(t=!1){var i;return e(this,void 0,void 0,function*(){const e=null===(i=this.app.auth())||void 0===i?void 0:i.currentUser;if(!e)return Promise.reject("getUserIdToken: unable to get currentUser");yield e.getIdToken(t).catch(e=>{console.error(e)})})}getClaims(){var e;const t=null===(e=this.app.auth())||void 0===e?void 0:e.currentUser;return t?t.getIdTokenResult().then(e=>e.claims).catch(e=>(console.error(e),null)):Promise.reject("getUserClaims: unable to get currentUser")}userDevicesToDeviceInfoList(t){return e(this,void 0,void 0,function*(){const e=Object.keys(null!=t?t:{}).map(e=>this.app.database().ref(this.getDeviceInfoPath(e)).once("value")),i=(yield Promise.all(e).then(e=>e.map(e=>e.val()))).filter(e=>!!e);return i.sort((e,i)=>t[e.deviceId].claimedOn-t[i.deviceId].claimedOn),i})}hasDevicePermission(t){return e(this,void 0,void 0,function*(){const e=this.getDeviceInfoPath(t);return yield this.app.database().ref(e).once("value").then(()=>!0).catch(()=>!1)})}getDeviceClaimedByPath(e){return`devices/${e}/status/claimedBy`}getUserClaimedDevicePath(e){return`users/${this.user.uid}/devices/${e}`}getUserDevicesPath(){return`users/${this.user.uid}/devices`}getUserClaimsUpdatedOnPath(){return`users/${this.user.uid}/claimsUpdatedOn`}getDeviceInfoPath(e){return`devices/${e}/info`}onUserExperiments(){return this.onAuthStateChanged().pipe((0,r.switchMap)(e=>{if(!e)return i.EMPTY;const t=this.user.uid,n=this.app.database().ref("experiments").orderByChild("userId").equalTo(t).limitToFirst(100);return(0,i.fromEventPattern)(e=>n.on("value",e),e=>n.off("value",e)).pipe((0,r.map)(([e])=>e.val()),(0,r.map)(e=>Object.entries(null!=e?e:{}).map(([e,t])=>{var i;return Object.assign({id:null!==(i=null==t?void 0:t.id)&&void 0!==i?i:e},t)}).sort((e,t)=>new Date(null==t?void 0:t.timestamp).getTime()-new Date(null==e?void 0:e.timestamp).getTime())))}))}deleteUserExperiment(t){return e(this,void 0,void 0,function*(){if(!t)return Promise.reject("deleteUserExperiment: please provide an experiment id");yield Promise.all([(e=>this.app.database().ref("experiments").child(e).remove())(t),(e=>this.app.functions().httpsCallable("removeRelations")({experimentId:e}))(t)]).catch(()=>{})})}}exports.FirebaseUser=o;
|
|
7
|
+
},{}],"mSvX":[function(require,module,exports) {
|
|
8
|
+
"use strict";var e=this&&this.__awaiter||function(e,t,i,o){return new(i||(i=Promise))(function(n,c){function s(e){try{u(o.next(e))}catch(t){c(t)}}function r(e){try{u(o.throw(e))}catch(t){c(t)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,r)}u((o=o.apply(e,t||[])).next())})},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createDeviceStore=void 0;const i=t(require("firebase/app")),o=i.default.database.ServerValue.TIMESTAMP,n=(t,i,n)=>{const c=t.database().ref(`devices/${i}`),s=c.child("subscriptions").push().key,r=c.child(`clients/${s}`);let u=[];const a=(e,t)=>c.child(e).set(t),l=(e,t)=>c.child(e).update(t),d=(e="value",t,i)=>{const o=c.child(t).on(e,e=>{i(e.val(),e)});return u.push(()=>{c.child(t).off(e,o)}),o},v=(e,t,i)=>{i?c.child(e).off(t,i):c.child(e).off(t)},f=t.database().ref(".info/connected").on("value",e=>{e.val()&&r.onDisconnect().remove().then(()=>{r.set(o),l("subscriptions",n.get()).then(()=>{n.toList().forEach(e=>{const t=`subscriptions/${e.id}`;c.child(t).onDisconnect().remove()})})})});return u.push(()=>{t.database().ref(".info/connected").off("value",f)}),{set:a,once:(t,i="value")=>e(void 0,void 0,void 0,function*(){return(yield c.child(t).once(i)).val()}),update:l,lastOfChildValue:(t,i,o)=>e(void 0,void 0,void 0,function*(){const e=(yield c.child(t).orderByChild(i).equalTo(o).limitToLast(1).once("value")).val(),[n]=Object.values(e||{});return n||null}),onNamespace:(e,t)=>d("value",e,e=>{t(e)}),offNamespace:(e,t)=>{v(e,"value",t)},dispatchAction:t=>e(void 0,void 0,void 0,function*(){const e=yield((e,t)=>c.child(e).push(t))("actions",t),i=e.key,o=`actions/${i}`;if(e.onDisconnect().remove(),t.responseRequired){const i=t.responseTimeout||6e5,n=new Promise((t,o)=>{const n=setTimeout(()=>{clearTimeout(n),e.remove(),o(`Action response timed out in ${i}ms.`)},i)}),c=new Promise(e=>{((e,t,i,o)=>{d(e,t,n=>{null!==n&&(v(t,e),i(o||n))})})("value",`${o}/response`,e)});return Promise.race([c,n])}return i}),nextMetric:(t,i)=>e(void 0,void 0,void 0,function*(){a(`metrics/${t}`,i)}),onMetric:(e,t)=>{const{atomic:i,metric:o,labels:n}=e,c=i?`metrics/${o}`:`metrics/${o}/${n[0]}`;return d("value",c,e=>{null!==e&&t(e)})},subscribeToMetric:e=>{const t=c.child("subscriptions").push().key,i=`subscriptions/${t}`,o=Object.assign({id:t,clientId:s},e);return a(i,o),c.child(i).onDisconnect().remove(),o},unsubscribeFromMetric:e=>{(e=>{c.child(e).remove()})(`subscriptions/${e.id}`)},removeMetricListener(e,t){const{atomic:i,metric:o,labels:n}=e,c=i?`metrics/${o}`:`metrics/${o}/${n[0]}`;v(c,"value",t)},disconnect(){r.remove(),u.forEach(e=>{e()}),n.toList().filter(e=>e.clientId===s).forEach(e=>{const t=`subscriptions/${e.id}`;c.child(t).remove()})}}};exports.createDeviceStore=n;
|
|
9
|
+
},{}],"KzOJ":[function(require,module,exports) {
|
|
10
|
+
"use strict";var e=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(function(n,o){function s(e){try{d(r.next(e))}catch(t){o(t)}}function c(e){try{d(r.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,c)}d((r=r.apply(e,t||[])).next())})},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FirebaseDevice=void 0;const i=t(require("firebase/app")),r=require("./deviceStore"),n=i.default.database.ServerValue.TIMESTAMP;class o{constructor({deviceId:e,firebaseApp:t,dependencies:i}){if(!e)throw new Error("No Device ID provided.");this.deviceId=e,this.app=t.app,this.deviceStore=(0,r.createDeviceStore)(this.app,e,i.subscriptionManager)}get timestamp(){return n}dispatchAction(e){return this.deviceStore.dispatchAction(e)}getInfo(){return e(this,void 0,void 0,function*(){return yield this.deviceStore.once("info")})}onNamespace(e,t){return this.deviceStore.onNamespace(e,t)}onceNamespace(t){return e(this,void 0,void 0,function*(){return yield this.deviceStore.once(t)})}offNamespace(e,t){this.deviceStore.offNamespace(e,t)}getTimesync(){return e(this,void 0,void 0,function*(){return(yield this.dispatchAction({command:"timesync",action:"get",responseRequired:!0,responseTimeout:250})).timestamp})}nextMetric(e,t){this.deviceStore.nextMetric(e,t)}onMetric(e,t){return this.deviceStore.onMetric(e,t)}subscribeToMetric(e){return this.deviceStore.subscribeToMetric(Object.assign(Object.assign({},e),{serverType:o.serverType}))}unsubscribeFromMetric(e){this.deviceStore.unsubscribeFromMetric(e)}removeMetricListener(e,t){this.deviceStore.removeMetricListener(e,t)}changeSettings(t){return e(this,void 0,void 0,function*(){return this.deviceStore.update("settings",t)})}getSkill(t){return e(this,void 0,void 0,function*(){return yield this.deviceStore.lastOfChildValue("skills","bundleId",t)})}createBluetoothToken(){var t;return e(this,void 0,void 0,function*(){const[e,i]=yield this.app.functions().httpsCallable("createBluetoothToken")({deviceId:this.deviceId}).then(({data:e})=>[null,null==e?void 0:e.token]).catch(e=>[e,null]);return e?Promise.reject(null!==(t=null==e?void 0:e.message)&&void 0!==t?t:e):i||Promise.reject("Failed to create Bluetooth token.")})}disconnect(){this.deviceStore.disconnect()}}exports.FirebaseDevice=o,o.serverType="firebase";
|
|
11
|
+
},{"./deviceStore":"mSvX"}],"kM30":[function(require,module,exports) {
|
|
12
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&("get"in o?r.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,o)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),r=this&&this.__exportStar||function(r,t){for(var i in r)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||e(t,r,i)};Object.defineProperty(exports,"__esModule",{value:!0}),r(require("./FirebaseApp"),exports),r(require("./FirebaseUser"),exports),r(require("./FirebaseDevice"),exports);
|
|
13
|
+
},{"./FirebaseApp":"OERo","./FirebaseUser":"Cc51","./FirebaseDevice":"KzOJ"}],"s7Vt":[function(require,module,exports) {
|
|
14
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.whileOnline=void 0;const e=require("rxjs"),r=require("rxjs/operators");function t({status$:t,allowWhileOnSleepMode:i}){return(0,e.pipe)((0,r.withLatestFrom)(t),(0,r.mergeMap)(([r,t])=>o(t,i)?(0,e.of)(r):e.EMPTY))}function o(e,r){return!("online"!==e.state||!r&&e.sleepMode)}exports.whileOnline=t;
|
|
15
|
+
},{}],"iVIU":[function(require,module,exports) {
|
|
16
|
+
"use strict";var t=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))(function(s,n){function o(t){try{u(r.next(t))}catch(e){n(e)}}function a(t){try{u(r.throw(t))}catch(e){n(e)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}u((r=r.apply(t,e||[])).next())})},e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Timesync=void 0;const i=require("rxjs"),r=require("rxjs/operators"),s=require("rxjs/operators"),n=e(require("outliers")),o=require("../utils/whileOnline"),a={bufferSize:100,updateInterval:6e4};class u{constructor(t){this._offset=0,this.options=Object.assign(Object.assign({},a),t),this.start()}start(){const{bufferSize:t,updateInterval:e,status$:n}=this.options,a=(0,i.range)(0,t),u=(0,i.timer)(e,e).pipe((0,r.map)(e=>t+e),(0,o.whileOnline)({status$:n,allowWhileOnSleepMode:!0}));n.pipe((0,r.filter)(t=>"online"===t.state),(0,r.take)(1)).pipe((0,s.switchMap)(()=>a.pipe((0,r.concatWith)(u),this.toOffset(),(0,s.bufferCount)(t,1),this.filterOutliers(),(0,r.map)(t=>this.average(t))))).subscribe(t=>{this._offset=t})}filterOutliers(){return(0,i.pipe)((0,r.map)(t=>t.filter((0,n.default)())))}toOffset(){const{getTimesync:e}=this.options;return(0,i.pipe)((0,s.concatMap)(()=>t(this,void 0,void 0,function*(){const t=Date.now(),[i,r]=yield e().then(t=>[null,t]).catch(t=>[t]);if(i)return 0;const s=Date.now();return s-(s-t)/2-r})))}average(t){return Math.round(t.reduce((t,e)=>t+e)/t.length)}get offset(){return this._offset}get timestamp(){return Date.now()+this._offset}}exports.Timesync=u;
|
|
17
|
+
},{"../utils/whileOnline":"s7Vt"}],"CXqr":[function(require,module,exports) {
|
|
18
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&("get"in n?t.__esModule:!n.writable&&!n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(r,i)||e(r,t,i)};Object.defineProperty(exports,"__esModule",{value:!0}),t(require("./Timesync"),exports);
|
|
19
|
+
},{"./Timesync":"iVIU"}],"BX8M":[function(require,module,exports) {
|
|
20
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubscriptionManager=void 0;class s{constructor(){this._subscriptions={}}get(){return this._subscriptions}toList(){return Object.values(this._subscriptions)}add(s){this._subscriptions[s.id]=s}remove(s){s.id in this._subscriptions&&Reflect.deleteProperty(this._subscriptions,s.id)}}exports.SubscriptionManager=s;
|
|
21
|
+
},{}],"ImaE":[function(require,module,exports) {
|
|
22
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.deviceHasLostHeartbeat=exports.offlineIfLostHeartbeat=void 0;const t=require("rxjs"),e=require("rxjs/operators"),r=3e4,s=3,i=5e3,n=95e3;function o(){return(0,t.pipe)((0,e.switchMap)(r=>(0,t.timer)(0,n).pipe((0,e.map)(()=>a(r)?Object.assign(Object.assign({},r),{state:"offline"}):r))),(0,e.distinctUntilChanged)(f))}function a(t){if(!("lastHeartbeat"in t))return!1;const{lastHeartbeat:e}=t;return Date.now()-e>n}function f(t,e){return JSON.stringify(t).split("").sort().join("")===JSON.stringify(e).split("").sort().join("")}exports.offlineIfLostHeartbeat=o,exports.deviceHasLostHeartbeat=a;
|
|
23
|
+
},{}],"qny3":[function(require,module,exports) {
|
|
24
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterInternalKeys=void 0;const e=require("rxjs"),r=require("rxjs/operators");function t(){return(0,e.pipe)((0,r.map)(e=>{if(!e)return e;return Object.entries(e).reduce((e,[r,t])=>(r.startsWith("__")||(e[r]=t),e),{})}))}exports.filterInternalKeys=t;
|
|
25
|
+
},{}],"LXvB":[function(require,module,exports) {
|
|
26
|
+
"use strict";var e=this&&this.__awaiter||function(e,i,t,s){return new(t||(t=Promise))(function(r,n){function c(e){try{a(s.next(e))}catch(i){n(i)}}function o(e){try{a(s.throw(e))}catch(i){n(i)}}function a(e){var i;e.done?r(e.value):(i=e.value,i instanceof t?i:new t(function(e){e(i)})).then(c,o)}a((s=s.apply(e,i||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CloudClient=exports.SERVER_TIMESTAMP=exports.createUser=exports.credentialWithLink=void 0;const i=require("rxjs"),t=require("rxjs"),s=require("rxjs/operators"),r=require("./firebase"),n=require("../timesync"),c=require("../subscriptions/SubscriptionManager"),o=require("../utils/heartbeat"),a=require("../utils/filterInternalKeys");var u=require("./firebase");Object.defineProperty(exports,"credentialWithLink",{enumerable:!0,get:function(){return u.credentialWithLink}}),Object.defineProperty(exports,"createUser",{enumerable:!0,get:function(){return u.createUser}}),Object.defineProperty(exports,"SERVER_TIMESTAMP",{enumerable:!0,get:function(){return u.SERVER_TIMESTAMP}});class d{constructor(e){this._selectedDevice=new i.ReplaySubject(1),this.options=e,this.subscriptionManager=new c.SubscriptionManager,this.firebaseApp=new r.FirebaseApp(e),this.firebaseUser=new r.FirebaseUser(this.firebaseApp),this._selectedDevice.next(void 0),this.firebaseUser.onAuthStateChanged().subscribe(e=>{this.user=e}),this.firebaseUser.onUserClaimsChange().subscribe(e=>{this.userClaims=e}),this.onDeviceChange().subscribe(e=>{this.firebaseDevice&&this.firebaseDevice.disconnect(),e&&(this.firebaseDevice=new r.FirebaseDevice({deviceId:e.deviceId,firebaseApp:this.firebaseApp,dependencies:{subscriptionManager:this.subscriptionManager}}),this.options.timesync&&(this.timesync=new n.Timesync({status$:this.status(),getTimesync:this.firebaseDevice.getTimesync.bind(this.firebaseDevice)})))})}onDeviceChange(){return this._selectedDevice.asObservable().pipe((0,s.filter)(e=>void 0!==e))}setAutoSelectedDevice(){return e(this,void 0,void 0,function*(){return this.options.deviceId?yield this.selectDevice(e=>e.find(e=>e.deviceId===this.options.deviceId)):!this.options.deviceId&&this.options.autoSelectDevice?yield this.selectDevice(e=>e[0]):null})}get actions(){return{dispatch:e=>this.firebaseDevice.dispatchAction(e)}}dispatchAction(i){return e(this,void 0,void 0,function*(){return yield this.firebaseDevice.dispatchAction(i)})}disconnect(){return e(this,void 0,void 0,function*(){return this.firebaseApp.disconnect()})}getInfo(){return e(this,void 0,void 0,function*(){return yield this.firebaseDevice.getInfo()})}login(i){return e(this,void 0,void 0,function*(){if(this.user)return Promise.reject("Already logged in.");const e=yield this.firebaseUser.login(i),t=yield this.setAutoSelectedDevice();return Object.assign(Object.assign({},e),{selectedDevice:t})})}logout(){return e(this,void 0,void 0,function*(){return this.firebaseDevice&&this.firebaseDevice.disconnect(),yield this.firebaseUser.logout()})}onAuthStateChanged(){return this.firebaseUser.onAuthStateChanged().pipe((0,s.switchMap)(i=>e(this,void 0,void 0,function*(){if(!i)return null;const e=this.didSelectDevice()?yield this.getSelectedDevice():yield this.setAutoSelectedDevice();return Object.assign(Object.assign({},i),{selectedDevice:e})})))}getDevices(){return this.firebaseUser.getDevices()}addDevice(e){return this.firebaseUser.addDevice(e)}removeDevice(i){return e(this,void 0,void 0,function*(){const[e,t]=yield this.firebaseUser.removeDevice(i).then(()=>[!1]).catch(e=>[!0,e]);if(e)return Promise.reject(t);const s=yield this.getSelectedDevice();(null==s?void 0:s.deviceId)===i&&this._selectedDevice.next(null)})}transferDevice(i){return e(this,void 0,void 0,function*(){const[e,t]=yield this.firebaseUser.transferDevice(i).then(()=>[!1]).catch(e=>[!0,e]);if(e)return Promise.reject(t);const s=yield this.getSelectedDevice();(null==s?void 0:s.deviceId)===i.deviceId&&this._selectedDevice.next(null)})}onUserDevicesChange(){return this.firebaseUser.onUserDevicesChange()}onUserClaimsChange(){return this.firebaseUser.onUserClaimsChange()}didSelectDevice(){return e(this,void 0,void 0,function*(){return!!(yield this.getSelectedDevice())})}selectDevice(i){return e(this,void 0,void 0,function*(){const e=yield this.getDevices();if(!e)return Promise.reject("Did not find any devices for this user. Make sure your device is claimed by your Neurosity account.");const t="function"==typeof i?i(e):(e=>e.find(e=>{if(!Array.isArray(i))return!1;const[t,s]=i;return JSON.stringify(null==e?void 0:e[t])===JSON.stringify(s)}))(e);return t?(yield this.firebaseUser.hasDevicePermission(t.deviceId))?(this._selectedDevice.next(t),t):Promise.reject("Rejected device access due to permissions."):Promise.reject("A device was not provided. Try returning a device from the devicesList provided in the callback.")})}getSelectedDevice(){return e(this,void 0,void 0,function*(){return yield(0,t.firstValueFrom)(this._selectedDevice)})}status(){return this.observeNamespace("status").pipe((0,o.offlineIfLostHeartbeat)(),(0,a.filterInternalKeys)())}observeNamespace(e){const r=(0,t.fromEventPattern)(i=>this.firebaseDevice.onNamespace(e,i),i=>this.firebaseDevice.offNamespace(e,i));return this.onDeviceChange().pipe((0,s.switchMap)(e=>e?r:i.EMPTY))}onceNamespace(i){return e(this,void 0,void 0,function*(){return yield this.firebaseDevice.onceNamespace(i)})}get metrics(){return{next:(e,i)=>{this.firebaseDevice.nextMetric(e,i)},on:(e,i)=>this.firebaseDevice.onMetric(e,i),subscribe:e=>{const i=this.firebaseDevice.subscribeToMetric(e);return this.subscriptionManager.add(i),i},unsubscribe:(e,i)=>{this.subscriptionManager.remove(e),this.firebaseDevice.unsubscribeFromMetric(e),this.firebaseDevice.removeMetricListener(e,i)}}}createAccount(e){return this.firebaseUser.createAccount(e)}deleteAccount(){return this.firebaseUser.deleteAccount()}createBluetoothToken(){return this.firebaseDevice.createBluetoothToken()}createCustomToken(){return this.firebaseUser.createCustomToken()}removeOAuthAccess(){return this.firebaseUser.removeOAuthAccess()}onUserExperiments(){return this.firebaseUser.onUserExperiments()}deleteUserExperiment(e){return this.firebaseUser.deleteUserExperiment(e)}get skills(){return{get:i=>e(this,void 0,void 0,function*(){return this.firebaseDevice.getSkill(i)})}}get timestamp(){return this.options.timesync?this.timesync.timestamp:Date.now()}getTimesyncOffset(){return this.timesync.offset}changeSettings(e){return this.firebaseDevice.changeSettings(e)}goOffline(){this.firebaseApp.goOffline()}goOnline(){this.firebaseApp.goOnline()}__getApp(){return this.firebaseApp.app}}exports.CloudClient=d;
|
|
27
|
+
},{"./firebase":"kM30","../timesync":"CXqr","../subscriptions/SubscriptionManager":"BX8M","../utils/heartbeat":"ImaE","../utils/filterInternalKeys":"qny3"}],"rekm":[function(require,module,exports) {
|
|
28
|
+
"use strict";var t,o;Object.defineProperty(exports,"__esModule",{value:!0}),exports.STREAMING_MODE=exports.STREAMING_TYPE=void 0,function(t){t.WIFI="wifi",t.BLUETOOTH="bluetooth"}(t=exports.STREAMING_TYPE||(exports.STREAMING_TYPE={})),function(t){t.WIFI_ONLY="wifi-only",t.WIFI_WITH_BLUETOOTH_FALLBACK="wifi-with-bluetooth-fallback",t.BLUETOOTH_WITH_WIFI_FALLBACK="bluetooth-with-wifi-fallback"}(o=exports.STREAMING_MODE||(exports.STREAMING_MODE={}));
|
|
29
|
+
},{}],"WDyG":[function(require,module,exports) {
|
|
30
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.exceededMaxItems=exports.locationNotFound=exports.metricNotSupportedByModel=exports.mustSelectDevice=exports.prefix=void 0,exports.prefix="Neurosity SDK: ",exports.mustSelectDevice=new Error(`${exports.prefix}A device must be selected. Make sure to call "neurosity.selectDevice()"`);const e=(e,o)=>new Error(`${exports.prefix}${e} not supported on model version ${o}. See docs.neurosity.co for more info.`);exports.metricNotSupportedByModel=e;const o=(e,o)=>new Error(`${exports.prefix}${e} location not supported on model version ${o}. Check spelling or see docs.neurosity.co for more info.`);exports.locationNotFound=o;const r=e=>new Error(`${exports.prefix}Maximum items in array is ${e}`);exports.exceededMaxItems=r;
|
|
31
|
+
},{}],"yLLB":[function(require,module,exports) {
|
|
32
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&("get"in i?t.__esModule:!i.writable&&!i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,i)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var s={};if(null!=r)for(var i in r)"default"!==i&&Object.prototype.hasOwnProperty.call(r,i)&&e(s,r,i);return t(s,r),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.validate=exports.isMetricDisallowed=exports.hasInvalidLabels=exports.getLabels=exports.isMetric=void 0;const s=require("@neurosity/ipk"),i=r(require("../utils/errors")),o=e=>Object.keys(s.metrics).includes(e);exports.isMetric=o;const l=e=>Object.keys(s.metrics[e]);exports.getLabels=l;const n=(e,t)=>{const r=(0,exports.getLabels)(e);return!t.every(e=>r.includes(e))};exports.hasInvalidLabels=n;const a=(e,t)=>"skill"in t&&"metrics"in t.skill&&!t.skill.metrics.includes(e);exports.isMetricDisallowed=a;const c=(e,t,r)=>{const s=(0,exports.getLabels)(e).join(", ");return t.length?(0,exports.isMetricDisallowed)(e,r)?new Error(`${i.prefix}No permission to access the ${e} metric. To access this metric, edit the skill's permissions`):!!(0,exports.hasInvalidLabels)(e,t)&&new Error(`${i.prefix}One ore more labels provided to ${e} are invalid. The valid labels for ${e} are ${s}`):new Error(`${i.prefix}At least one label is required for ${e} metric. Please add one of the following labels: ${s}`)};exports.validate=c;
|
|
33
|
+
},{"../utils/errors":"WDyG"}],"Ttuy":[function(require,module,exports) {
|
|
34
|
+
"use strict";var t,e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SLEEP_MODE_REASON=exports.STATUS=void 0,function(t){t.ONLINE="online",t.OFFLINE="offline",t.UPDATING="updating",t.BOOTING="booting",t.SHUTTING_OFF="shuttingOff"}(t=exports.STATUS||(exports.STATUS={})),function(t){t.UPDATING="updating",t.CHARGING="charging"}(e=exports.SLEEP_MODE_REASON||(exports.SLEEP_MODE_REASON={}));
|
|
35
|
+
},{}],"wAkn":[function(require,module,exports) {
|
|
36
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPlatformHapticMotors=exports.supportsAccel=exports.supportsHaptics=exports.platformConfigByModelVersion=exports.platformFeaturesByModelVersion=exports.HAPTIC_P8=exports.HAPTIC_P7=exports.FEATURE_ACCEL=exports.FEATURE_HAPTICS=exports.MODEL_VERSION_3=exports.MODEL_VERSION_2=exports.MODEL_VERSION_1=void 0,exports.MODEL_VERSION_1="1",exports.MODEL_VERSION_2="2",exports.MODEL_VERSION_3="3",exports.FEATURE_HAPTICS="haptics",exports.FEATURE_ACCEL="accel",exports.HAPTIC_P7="P7",exports.HAPTIC_P8="P8",exports.platformFeaturesByModelVersion={[exports.MODEL_VERSION_1]:[],[exports.MODEL_VERSION_2]:[exports.FEATURE_HAPTICS,exports.FEATURE_ACCEL],[exports.MODEL_VERSION_3]:[exports.FEATURE_HAPTICS,exports.FEATURE_ACCEL]},exports.platformConfigByModelVersion={[exports.MODEL_VERSION_1]:{},[exports.MODEL_VERSION_2]:{motorByMotorName:{[exports.HAPTIC_P7]:[],[exports.HAPTIC_P8]:[]}},[exports.MODEL_VERSION_3]:{motorByMotorName:{[exports.HAPTIC_P7]:[],[exports.HAPTIC_P8]:[]}}};const o=o=>{return exports.platformFeaturesByModelVersion[o].includes(exports.FEATURE_HAPTICS)};exports.supportsHaptics=o;const e=o=>{return exports.platformFeaturesByModelVersion[o].includes(exports.FEATURE_ACCEL)};exports.supportsAccel=e;const t=o=>{var e;const t=exports.platformConfigByModelVersion[o],r=null!==(e=null==t?void 0:t.motorByMotorName)&&void 0!==e?e:{};return Object.assign({},r)};exports.getPlatformHapticMotors=t;
|
|
37
|
+
},{}],"lLai":[function(require,module,exports) {
|
|
38
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buzz4_40=exports.buzz3_60=exports.buzz2_80=exports.buzz1_100=exports.longDoubleSharpTick3_60=exports.longDoubleSharpTick2_80=exports.longDoubleSharpTick1_100=exports.longDoubleSharpClickMedium3_60=exports.longDoubleSharpClickMedium2_80=exports.longDoubleSharpClickMedium1_100=exports.longDoubleSharpClickStrong4_30=exports.longDoubleSharpClickStrong3_60=exports.longDoubleSharpClickStrong2_80=exports.longDoubleSharpClickStrong1_100=exports.shortDoubleSharpTick3_60=exports.shortDoubleSharpTick2_80=exports.shortDoubleSharpTick1_100=exports.shortDoubleClickMedium3_60=exports.shortDoubleClickMedium2_80=exports.shortDoubleClickMedium1_100=exports.shortDoubleClickStrong4_30=exports.shortDoubleClickStrong3_60=exports.shortDoubleClickStrong2_80=exports.shortDoubleClickStrong1_100=exports.sharpTick3_60=exports.sharpTick2_80=exports.sharpTick1_100=exports.mediumClick3_60=exports.mediumClick2_80=exports.mediumClick1_100=exports.strongClick4_30=exports.strongClick3_60=exports.strongClick2_80=exports.strongClick1_100=exports.alert1000ms=exports.alert750ms=exports.strongBuzz100=exports.softFuzz60=exports.tripleClick100=exports.doubleClick60=exports.doubleClick100=exports.softBump30=exports.softBump60=exports.softBump100=exports.sharpClick30=exports.sharpClick60=exports.sharpClick100=exports.strongClick30=exports.strongClick60=exports.strongClick100=void 0,exports.transitionRampDownLongSharp1_50_to_0=exports.transitionRampDownShortSmooth2_50_to_0=exports.transitionRampDownShortSmooth1_50_to_0=exports.transitionRampDownMediumSmooth2_50_to_0=exports.transitionRampDownMediumSmooth1_50_to_0=exports.transitionRampDownLongSmooth2_50_to_0=exports.transitionRampDownLongSmooth1_50_to_0=exports.transitionRampUpShortSharp2_0_to_100=exports.transitionRampUpShortSharp1_0_to_100=exports.transitionRampUpMediumSharp2_0_to_100=exports.transitionRampUpMediumSharp1_0_to_100=exports.transitionRampUpLongSharp2_0_to_100=exports.transitionRampUpLongSharp1_0_to_100=exports.transitionRampUpShortSmooth2_0_to_100=exports.transitionRampUpShortSmooth1_0_to_100=exports.transitionRampUpMediumSmooth2_0_to_100=exports.transitionRampUpMediumSmooth1_0_to_100=exports.transitionRampUpLongSmooth2_0_to_100=exports.transitionRampUpLongSmooth1_0_to_100=exports.transitionRampDownShortSharp2_100_to_0=exports.transitionRampDownShortSharp1_100_to_0=exports.transitionRampDownLongMedium2_100_to_0=exports.transitionRampDownLongMedium1_100_to_0=exports.transitionRampDownLongSharp2_100_to_0=exports.transitionRampDownLongSharp1_100_to_0=exports.transitionRampDownShortSmooth2_100_to_0=exports.transitionRampDownShortSmooth1_100_to_0=exports.transitionRampDownMediumSmooth2_100_to_0=exports.transitionRampDownMediumSmooth1_100_to_0=exports.transitionRampDownLongSmooth2_100_to_0=exports.transitionRampDownLongSmooth1_100_to_0=exports.transistionHum6_10=exports.transistionHum5_20=exports.transistionHum4_40=exports.transistionHum3_60=exports.transistionHum2_80=exports.transistionHum1_100=exports.transistionClick6_10=exports.transistionClick5_20=exports.transistionClick4_40=exports.transistionClick3_60=exports.transistionClick2_80=exports.transistionClick1_100=exports.pulsingSharp2_60=exports.pulsingSharp1_100=exports.pulsingMedium2_60=exports.pulsingMedium1_100=exports.pulsingStong2_60=exports.pulsingStong1_100=exports.buzz5_20=void 0,exports.smoothHum5_10=exports.smoothHum4_20=exports.smoothHum3_30=exports.smoothHum2_40=exports.smoothHum1_50=exports.longBuzzForProgrammaticStopping_100=exports.transitionRampUpShortSharp2_0_to_50=exports.transitionRampUpShortSharp1_0_to_50=exports.transitionRampUpMediumSharp2_0_to_50=exports.transitionRampUpMediumSharp1_0_to_50=exports.transitionRampUpLongSharp2_0_to_50=exports.transitionRampUpLongSharp1_0_to_50=exports.transitionRampUpShortSmooth2_0_to_50=exports.transitionRampUpShortSmooth1_0_to_50=exports.transitionRampUpMediumSmooth2_0_to_50=exports.transitionRampUpMediumSmooth1_0_to_50=exports.transitionRampUpLongSmooth2_0_to_50=exports.transitionRampUpLongSmooth1_0_to_50=exports.transitionRampDownShortSharp2_50_to_0=exports.transitionRampDownShortSharp1_50_to_0=exports.transitionRampDownMediumSharp2_50_to_0=exports.transitionRampDownMediumSharp1_50_to_0=exports.transitionRampDownLongSharp2_50_to_0=void 0,exports.strongClick100="strongClick100",exports.strongClick60="strongClick60",exports.strongClick30="strongClick30",exports.sharpClick100="sharpClick100",exports.sharpClick60="sharpClick60",exports.sharpClick30="sharpClick30",exports.softBump100="softBump100",exports.softBump60="softBump60",exports.softBump30="softBump30",exports.doubleClick100="doubleClick100",exports.doubleClick60="doubleClick60",exports.tripleClick100="tripleClick100",exports.softFuzz60="softFuzz60",exports.strongBuzz100="strongBuzz100",exports.alert750ms="alert750ms",exports.alert1000ms="alert1000ms",exports.strongClick1_100="strongClick1_100",exports.strongClick2_80="strongClick2_80",exports.strongClick3_60="strongClick3_60",exports.strongClick4_30="strongClick4_30",exports.mediumClick1_100="mediumClick1_100",exports.mediumClick2_80="mediumClick2_80",exports.mediumClick3_60="mediumClick3_60",exports.sharpTick1_100="sharpTick1_100",exports.sharpTick2_80="sharpTick2_80",exports.sharpTick3_60="sharpTick3_60",exports.shortDoubleClickStrong1_100="shortDoubleClickStrong1_100",exports.shortDoubleClickStrong2_80="shortDoubleClickStrong2_80",exports.shortDoubleClickStrong3_60="shortDoubleClickStrong3_60",exports.shortDoubleClickStrong4_30="shortDoubleClickStrong4_30",exports.shortDoubleClickMedium1_100="shortDoubleClickMedium1_100",exports.shortDoubleClickMedium2_80="shortDoubleClickMedium2_80",exports.shortDoubleClickMedium3_60="shortDoubleClickMedium3_60",exports.shortDoubleSharpTick1_100="shortDoubleSharpTick1_100",exports.shortDoubleSharpTick2_80="shortDoubleSharpTick2_80",exports.shortDoubleSharpTick3_60="shortDoubleSharpTick3_60",exports.longDoubleSharpClickStrong1_100="longDoubleSharpClickStrong1_100",exports.longDoubleSharpClickStrong2_80="longDoubleSharpClickStrong2_80",exports.longDoubleSharpClickStrong3_60="longDoubleSharpClickStrong3_60",exports.longDoubleSharpClickStrong4_30="longDoubleSharpClickStrong4_30",exports.longDoubleSharpClickMedium1_100="longDoubleSharpClickMedium1_100",exports.longDoubleSharpClickMedium2_80="longDoubleSharpClickMedium2_80",exports.longDoubleSharpClickMedium3_60="longDoubleSharpClickMedium3_60",exports.longDoubleSharpTick1_100="longDoubleSharpTick1_100",exports.longDoubleSharpTick2_80="longDoubleSharpTick2_80",exports.longDoubleSharpTick3_60="longDoubleSharpTick3_60",exports.buzz1_100="buzz1_100",exports.buzz2_80="buzz2_80",exports.buzz3_60="buzz3_60",exports.buzz4_40="buzz4_40",exports.buzz5_20="buzz5_20",exports.pulsingStong1_100="pulsingStong1_100",exports.pulsingStong2_60="pulsingStong2_60",exports.pulsingMedium1_100="pulsingMedium1_100",exports.pulsingMedium2_60="pulsingMedium2_60",exports.pulsingSharp1_100="pulsingSharp1_100",exports.pulsingSharp2_60="pulsingSharp2_60",exports.transistionClick1_100="transistionClick1_100",exports.transistionClick2_80="transistionClick2_80",exports.transistionClick3_60="transistionClick3_60",exports.transistionClick4_40="transistionClick4_40",exports.transistionClick5_20="transistionClick5_20",exports.transistionClick6_10="transistionClick6_10",exports.transistionHum1_100="transistionHum1_100",exports.transistionHum2_80="transistionHum2_80",exports.transistionHum3_60="transistionHum3_60",exports.transistionHum4_40="transistionHum4_40",exports.transistionHum5_20="transistionHum5_20",exports.transistionHum6_10="transistionHum6_10",exports.transitionRampDownLongSmooth1_100_to_0="transitionRampDownLongSmooth1_100_to_0",exports.transitionRampDownLongSmooth2_100_to_0="transitionRampDownLongSmooth2_100_to_0",exports.transitionRampDownMediumSmooth1_100_to_0="transitionRampDownMediumSmooth1_100_to_0",exports.transitionRampDownMediumSmooth2_100_to_0="transitionRampDownMediumSmooth2_100_to_0",exports.transitionRampDownShortSmooth1_100_to_0="transitionRampDownShortSmooth1_100_to_0",exports.transitionRampDownShortSmooth2_100_to_0="transitionRampDownShortSmooth2_100_to_0",exports.transitionRampDownLongSharp1_100_to_0="transitionRampDownLongSharp1_100_to_0",exports.transitionRampDownLongSharp2_100_to_0="transitionRampDownLongSharp2_100_to_0",exports.transitionRampDownLongMedium1_100_to_0="transitionRampDownLongMedium1_100_to_0",exports.transitionRampDownLongMedium2_100_to_0="transitionRampDownLongMedium2_100_to_0",exports.transitionRampDownShortSharp1_100_to_0="transitionRampDownShortSharp1_100_to_0",exports.transitionRampDownShortSharp2_100_to_0="transitionRampDownShortSharp2_100_to_0",exports.transitionRampUpLongSmooth1_0_to_100="transitionRampUpLongSmooth1_0_to_100",exports.transitionRampUpLongSmooth2_0_to_100="transitionRampUpLongSmooth2_0_to_100",exports.transitionRampUpMediumSmooth1_0_to_100="transitionRampUpMediumSmooth1_0_to_100",exports.transitionRampUpMediumSmooth2_0_to_100="transitionRampUpMediumSmooth2_0_to_100",exports.transitionRampUpShortSmooth1_0_to_100="transitionRampUpShortSmooth1_0_to_100",exports.transitionRampUpShortSmooth2_0_to_100="transitionRampUpShortSmooth2_0_to_100",exports.transitionRampUpLongSharp1_0_to_100="transitionRampUpLongSharp1_0_to_100",exports.transitionRampUpLongSharp2_0_to_100="transitionRampUpLongSharp2_0_to_100",exports.transitionRampUpMediumSharp1_0_to_100="transitionRampUpMediumSharp1_0_to_100",exports.transitionRampUpMediumSharp2_0_to_100="transitionRampUpMediumSharp2_0_to_100",exports.transitionRampUpShortSharp1_0_to_100="transitionRampUpShortSharp1_0_to_100",exports.transitionRampUpShortSharp2_0_to_100="transitionRampUpShortSharp2_0_to_100",exports.transitionRampDownLongSmooth1_50_to_0="transitionRampDownLongSmooth1_50_to_0",exports.transitionRampDownLongSmooth2_50_to_0="transitionRampDownLongSmooth2_50_to_0",exports.transitionRampDownMediumSmooth1_50_to_0="transitionRampDownMediumSmooth1_50_to_0",exports.transitionRampDownMediumSmooth2_50_to_0="transitionRampDownMediumSmooth2_50_to_0",exports.transitionRampDownShortSmooth1_50_to_0="transitionRampDownShortSmooth1_50_to_0",exports.transitionRampDownShortSmooth2_50_to_0="transitionRampDownShortSmooth2_50_to_0",exports.transitionRampDownLongSharp1_50_to_0="transitionRampDownLongSharp1_50_to_0",exports.transitionRampDownLongSharp2_50_to_0="transitionRampDownLongSharp2_50_to_0",exports.transitionRampDownMediumSharp1_50_to_0="transitionRampDownMediumSharp1_50_to_0",exports.transitionRampDownMediumSharp2_50_to_0="transitionRampDownMediumSharp2_50_to_0",exports.transitionRampDownShortSharp1_50_to_0="transitionRampDownShortSharp1_50_to_0",exports.transitionRampDownShortSharp2_50_to_0="transitionRampDownShortSharp2_50_to_0",exports.transitionRampUpLongSmooth1_0_to_50="transitionRampUpLongSmooth1_0_to_50",exports.transitionRampUpLongSmooth2_0_to_50="transitionRampUpLongSmooth2_0_to_50",exports.transitionRampUpMediumSmooth1_0_to_50="transitionRampUpMediumSmooth1_0_to_50",exports.transitionRampUpMediumSmooth2_0_to_50="transitionRampUpMediumSmooth2_0_to_50",exports.transitionRampUpShortSmooth1_0_to_50="transitionRampUpShortSmooth1_0_to_50",exports.transitionRampUpShortSmooth2_0_to_50="transitionRampUpShortSmooth2_0_to_50",exports.transitionRampUpLongSharp1_0_to_50="transitionRampUpLongSharp1_0_to_50",exports.transitionRampUpLongSharp2_0_to_50="transitionRampUpLongSharp2_0_to_50",exports.transitionRampUpMediumSharp1_0_to_50="transitionRampUpMediumSharp1_0_to_50",exports.transitionRampUpMediumSharp2_0_to_50="transitionRampUpMediumSharp2_0_to_50",exports.transitionRampUpShortSharp1_0_to_50="transitionRampUpShortSharp1_0_to_50",exports.transitionRampUpShortSharp2_0_to_50="transitionRampUpShortSharp2_0_to_50",exports.longBuzzForProgrammaticStopping_100="longBuzzForProgrammaticStopping_100",exports.smoothHum1_50="smoothHum1_50",exports.smoothHum2_40="smoothHum2_40",exports.smoothHum3_30="smoothHum3_30",exports.smoothHum4_20="smoothHum4_20",exports.smoothHum5_10="smoothHum5_10";
|
|
39
|
+
},{}],"xIH5":[function(require,module,exports) {
|
|
40
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var n=Object.getOwnPropertyDescriptor(t,i);n&&("get"in n?t.__esModule:!n.writable&&!n.configurable)||(n={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,n)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(i){if(i&&i.__esModule)return i;var r={};if(null!=i)for(var n in i)"default"!==n&&Object.prototype.hasOwnProperty.call(i,n)&&e(r,i,n);return t(r,i),r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateOAuthScopeForFunctionName=exports.validateOAuthScopeForAction=void 0;const r=i(require("../utils/errors")),n={"marker/add":"write:brainwave-markers","brainwaves/record":"write:brainwaves","haptics/queue":"write:haptics","training/record":"write:kinesis","training/stop":"write:kinesis","training/stopAll":"write:kinesis","wifi/reset":"write:wifi-settings"},s={accelerometer:"read:accelerometer",brainwaves:"read:brainwaves",calm:"read:calm",focus:"read:focus",kinesis:"read:kinesis",predictions:"read:kinesis",signalQuality:"read:signal-quality",getInfo:"read:devices-info",getSelectedDevice:"read:devices-info",selectDevice:"read:devices-info",onDeviceChange:"read:devices-info",onUserDevicesChange:"read:devices-info",settings:"read:devices-settings",changeSettings:"write:devices-settings",status:"read:devices-status",addDevice:"write:devices-add",removeDevice:"write:devices-remove",transferDevice:"write:devices-remove"};function a(e,t){const{oauth:i,scopes:r}=null!=e?e:{};if(!i)return[!1,null];const s=r.split(","),{command:a,action:o}=t,u=n[`${a}/${o}`];return s.includes(u)?[!1,null]:[!0,c(u)]}function o(e,t){const{oauth:i,scopes:r}=null!=e?e:{};if(!i)return[!1,null];const n=r.split(","),a=s[t];return n.includes(a)?[!1,null]:[!0,c(a)]}function c(...e){return new Error(`${r.prefix}You are trying to access data with an OAuth token without access to the following scopes: ${e.join(", ")}.`)}exports.validateOAuthScopeForAction=a,exports.validateOAuthScopeForFunctionName=o;
|
|
41
|
+
},{"../utils/errors":"WDyG"}],"kRnD":[function(require,module,exports) {
|
|
42
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.prodFunctionsBaseUrl=void 0,exports.prodFunctionsBaseUrl="https://us-central1-neurosity-device.cloudfunctions.net";
|
|
43
|
+
},{}],"RIhy":[function(require,module,exports) {
|
|
44
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFunctionsBaseURL=void 0;const e=require("./config");function t(t){if(!t.emulator)return e.prodFunctionsBaseUrl;const{emulatorHost:o,emulatorFunctionsPort:r}=t;return`http://${o}:${r}/neurosity-device/us-central1`}exports.getFunctionsBaseURL=t;
|
|
45
|
+
},{"./config":"kRnD"}],"MDrB":[function(require,module,exports) {
|
|
46
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createOAuthURL=void 0;const t=e(require("axios")),r=require("./utils");function s(e,s){const{clientId:i,clientSecret:c,responseType:n,redirectUri:o,scope:u,state:a}=e,l=(0,r.getFunctionsBaseURL)(s);return t.default.get(`${l}/authorize/entry`,{params:Object.assign(Object.assign({client_id:i},c?{client_secret:c}:{}),{response_type:n,redirect_uri:o,scope:u.join(","),state:a,redirect:"false"})}).then(e=>`${l}${e.data.url}`)}exports.createOAuthURL=s;
|
|
47
|
+
},{"./utils":"RIhy"}],"nfg4":[function(require,module,exports) {
|
|
48
|
+
"use strict";var t=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function u(t){try{c(o.next(t))}catch(e){i(e)}}function s(t){try{c(o.throw(t))}catch(e){i(e)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(u,s)}c((o=o.apply(t,e||[])).next())})},e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getOAuthToken=void 0;const n=e(require("axios")),o=require("./utils");function r(e,r){return t(this,void 0,void 0,function*(){const t=(0,o.getFunctionsBaseURL)(r),i=(yield n.default.post(`${t}/getOAuthRefreshToken`,e)).data;return n.default.post(`${t}/token`,{grant_type:"refresh_token",refresh_token:i.data,client_id:e.clientId,client_secret:e.clientSecret}).then(t=>JSON.parse(t.data).access_token)})}exports.getOAuthToken=r;
|
|
49
|
+
},{"./utils":"RIhy"}],"vsps":[function(require,module,exports) {
|
|
50
|
+
"use strict";function e(){return"undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isNode=void 0,exports.isNode=e;
|
|
51
|
+
},{}],"DCuD":[function(require,module,exports) {
|
|
52
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCloudMetric=void 0;const e=require("rxjs"),r=require("rxjs/operators"),t=require("./whileOnline"),i=require("./subscription");function s(s,o){const{options:c,cloudClient:n,onDeviceChange:l,status:u}=s,{metric:a,labels:p,atomic:b}=o,m=(0,i.validate)(a,p,c);if(m)return(0,e.throwError)(()=>m);const d=new e.Observable(e=>{const r=(b?[n.metrics.subscribe({metric:a,labels:p,atomic:b})]:p.map(e=>n.metrics.subscribe({metric:a,labels:[e],atomic:b}))).map(r=>({subscription:r,listener:n.metrics.on(r,(...r)=>{e.next(...r)})}));return()=>{r.forEach(({subscription:e,listener:r})=>{n.metrics.unsubscribe(e,r)})}});return l().pipe((0,r.switchMap)(r=>r?d.pipe((0,t.whileOnline)({status$:u(),allowWhileOnSleepMode:!1})):e.EMPTY))}exports.getCloudMetric=s;
|
|
53
|
+
},{"./whileOnline":"s7Vt","./subscription":"yLLB"}],"VusC":[function(require,module,exports) {
|
|
54
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isMaybeWebWorkerContext=void 0;const e=this,o=()=>e&&void 0===(null==e?void 0:e.document);exports.isMaybeWebWorkerContext=o;
|
|
55
|
+
},{}],"ljun":[function(require,module,exports) {
|
|
56
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isWebBluetoothSupported=void 0;const e=require("./isMaybeWebWorkerContext");function o(){var o;return"undefined"!=typeof window&&(null===(o=null===window||void 0===window?void 0:window.navigator)||void 0===o?void 0:o.bluetooth)&&!(0,e.isMaybeWebWorkerContext)()}exports.isWebBluetoothSupported=o;
|
|
57
|
+
},{"./isMaybeWebWorkerContext":"VusC"}],"UDAB":[function(require,module,exports) {
|
|
58
|
+
"use strict";function e(){return Math.floor(1e5+9e5*Math.random())}Object.defineProperty(exports,"__esModule",{value:!0}),exports.create6DigitPin=void 0,exports.create6DigitPin=e;
|
|
59
|
+
},{}],"V73a":[function(require,module,exports) {
|
|
60
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.stitchChunks=void 0;const e=require("rxjs"),t=require("rxjs/operators");function r({delimiter:r}){return(0,e.pipe)((0,t.scan)(([e],t)=>{const s=e+t;if(!s.includes(r))return[s,""];if(s.endsWith(r))return["",s];const i=s.lastIndexOf(r)+r.length,n=s.slice(0,i);return[s.slice(i),n]},["",""]),(0,t.map)(([,e])=>e.slice(0,-r.length)),(0,t.filter)(e=>!!e.length))}exports.stitchChunks=r;
|
|
61
|
+
},{}],"iwtf":[function(require,module,exports) {
|
|
62
|
+
"use strict";var N,e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TRANSPORT_TYPE=exports.BLUETOOTH_CONNECTION=void 0,function(N){N.SCANNING="scanning",N.CONNECTED="connected",N.CONNECTING="connecting",N.DISCONNECTING="disconnecting",N.DISCONNECTED="disconnected"}(N=exports.BLUETOOTH_CONNECTION||(exports.BLUETOOTH_CONNECTION={})),function(N){N.WEB="web",N.REACT_NATIVE="reactNative"}(e=exports.TRANSPORT_TYPE||(exports.TRANSPORT_TYPE={}));
|
|
63
|
+
},{}],"jTvL":[function(require,module,exports) {
|
|
64
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode=exports.encode=void 0;const e=require("../types"),o=new TextEncoder,t=new TextDecoder("utf-8");function r(t,r){return t===e.TRANSPORT_TYPE.REACT_NATIVE?[...o.encode(r)]:o.encode(r)}function d(o,r){return o===e.TRANSPORT_TYPE.REACT_NATIVE?t.decode(new Uint8Array(r)):t.decode(r)}exports.encode=r,exports.decode=d;
|
|
65
|
+
},{"../types":"iwtf"}],"dGLb":[function(require,module,exports) {
|
|
66
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CHARACTERISTIC_UUIDS_TO_NAMES=exports.DEFAULT_ACTION_RESPONSE_TIMEOUT=exports.REACT_NATIVE_MAX_BYTE_SIZE=exports.ANDROID_MAX_MTU=void 0;const e=require("@neurosity/ipk");exports.ANDROID_MAX_MTU=512,exports.REACT_NATIVE_MAX_BYTE_SIZE=512,exports.DEFAULT_ACTION_RESPONSE_TIMEOUT=6e4,exports.CHARACTERISTIC_UUIDS_TO_NAMES=Object.fromEntries(Object.entries(e.BLUETOOTH_CHARACTERISTICS).map(e=>e.reverse()));
|
|
67
|
+
},{}],"rH2Y":[function(require,module,exports) {
|
|
68
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.osHasBluetoothSupport=void 0;const t=e(require("semver/functions/gte"));function o(e){if(!e)return!1;return Number(e.modelVersion)>=3&&(!!!(null==e?void 0:e.emulator)&&(0,t.default)(e.osVersion,"16.0.0"))}exports.osHasBluetoothSupport=o;
|
|
69
|
+
},{}],"ouKb":[function(require,module,exports) {
|
|
70
|
+
"use strict";var t=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(r,s){function c(t){try{a(n.next(t))}catch(e){s(e)}}function o(t){try{a(n.throw(t))}catch(e){s(e)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(c,o)}a((n=n.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebBluetoothTransport=void 0;const e=require("@neurosity/ipk"),i=require("@neurosity/ipk"),n=require("@neurosity/ipk"),r=require("@neurosity/ipk"),s=require("rxjs"),c=require("rxjs"),o=require("rxjs/operators"),a=require("rxjs/operators"),d=require("rxjs/operators"),h=require("./isWebBluetoothSupported"),u=require("../utils/create6DigitPin"),v=require("../utils/stitch"),l=require("../utils/encoding"),p=require("../types"),g=require("../constants"),f=require("../constants"),N=require("../utils/osHasBluetoothSupport");class E{constructor(){if(this.type=p.TRANSPORT_TYPE.WEB,this.characteristicsByName={},this.connection$=new s.BehaviorSubject(p.BLUETOOTH_CONNECTION.DISCONNECTED),this.pendingActions$=new s.BehaviorSubject([]),this.logs$=new s.ReplaySubject(10),this.onDisconnected$=this._onDisconnected().pipe((0,d.share)()),this.connectionStream$=this.connection$.asObservable().pipe((0,o.filter)(t=>!!t),(0,a.distinctUntilChanged)(),(0,a.shareReplay)(1)),!(0,h.isWebBluetoothSupported)()){const t="Web Bluetooth is not supported";throw this.addLog(t),new Error(t)}this.connection$.asObservable().subscribe(t=>{this.addLog(`connection status is ${t}`)}),this.onDisconnected$.subscribe(()=>{this.connection$.next(p.BLUETOOTH_CONNECTION.DISCONNECTED)})}_getPairedDevices(){return t(this,void 0,void 0,function*(){return yield navigator.bluetooth.getDevices()})}_autoConnect(e){return(0,s.merge)(e,this.onDisconnected$.pipe((0,o.switchMap)(()=>e))).pipe((0,o.switchMap)(t=>(0,N.osHasBluetoothSupport)(t)?(0,s.of)(t):c.EMPTY),(0,o.switchMap)(e=>t(this,void 0,void 0,function*(){var t;const{deviceNickname:i}=e,[n,r]=yield this._getPairedDevices().then(t=>[null,t]).catch(t=>[t,null]);if(n)throw new Error(`failed to get devices: ${null!==(t=null==n?void 0:n.message)&&void 0!==t?t:n}`);this.addLog(`Auto connect: found ${r.length} devices ${r.map(({name:t})=>t).join(", ")}`);const s=r.findLast(t=>t.name===i);if(!s)throw new Error("couldn't find selected device in the list of paired devices.");return this.addLog(`Auto connect: ${i} was detected and previously paired`),s})),(0,o.tap)(()=>{this.connection$.next(p.BLUETOOTH_CONNECTION.SCANNING)}),(0,o.switchMap)(t=>m(t)),(0,o.switchMap)(e=>t(this,void 0,void 0,function*(){return this.addLog(`Advertisement received for ${e.device.name}`),yield this.getServerServiceAndCharacteristics(e.device)})))}addLog(t){this.logs$.next(t)}isConnected(){return this.connection$.getValue()===p.BLUETOOTH_CONNECTION.CONNECTED}connection(){return this.connectionStream$}connect(e){return t(this,void 0,void 0,function*(){try{const i=yield this.requestDevice(e);yield this.getServerServiceAndCharacteristics(i)}catch(t){return Promise.reject(t)}})}requestDevice(i){return t(this,void 0,void 0,function*(){try{this.addLog("Requesting Bluetooth Device...");const s=n.BLUETOOTH_DEVICE_NAME_PREFIXES.map(t=>({namePrefix:t})),c=i?[{name:i}]:s;return yield window.navigator.bluetooth.requestDevice({filters:[...c,{manufacturerData:[{companyIdentifier:r.BLUETOOTH_COMPANY_IDENTIFIER_HEX}]}],optionalServices:[e.BLUETOOTH_PRIMARY_SERVICE_UUID_HEX]})}catch(t){return Promise.reject(t)}})}getServerServiceAndCharacteristics(i){return t(this,void 0,void 0,function*(){try{this.device=i,this.connection$.getValue()===p.BLUETOOTH_CONNECTION.CONNECTING||this.connection$.next(p.BLUETOOTH_CONNECTION.CONNECTING),this.server=yield i.gatt.connect(),this.addLog("Getting service..."),this.service=yield this.server.getPrimaryService(e.BLUETOOTH_PRIMARY_SERVICE_UUID_HEX),this.addLog(`Got service ${this.service.uuid}, getting characteristics...`);const n=yield this.service.getCharacteristics();this.addLog("Got characteristics"),this.characteristicsByName=Object.fromEntries(n.map(t=>[f.CHARACTERISTIC_UUIDS_TO_NAMES[t.uuid],t])),this.connection$.next(p.BLUETOOTH_CONNECTION.CONNECTED)}catch(t){return Promise.reject(t)}})}_onDisconnected(){return this.connection$.asObservable().pipe((0,o.switchMap)(t=>t===p.BLUETOOTH_CONNECTION.CONNECTED?O(this.device,"gattserverdisconnected"):c.NEVER))}disconnect(){var e,i;return t(this,void 0,void 0,function*(){(null===(i=null===(e=null==this?void 0:this.device)||void 0===e?void 0:e.gatt)||void 0===i?void 0:i.connected)&&this.device.gatt.disconnect()})}getCharacteristicByName(e){var i;return t(this,void 0,void 0,function*(){return null===(i=this.characteristicsByName)||void 0===i?void 0:i[e]})}subscribeToCharacteristic({characteristicName:e,manageNotifications:n=!0}){const r=(0,s.defer)(()=>this.getCharacteristicByName(e)).pipe((0,o.switchMap)(i=>t(this,void 0,void 0,function*(){var t;if(this.isConnected()&&n)try{yield i.startNotifications(),this.addLog(`Started notifications for ${e} characteristic`)}catch(r){this.addLog(`Attemped to stop notifications for ${e} characteristic: ${null!==(t=null==r?void 0:r.message)&&void 0!==t?t:r}`)}return i})),(0,o.switchMap)(i=>O(i,"characteristicvaluechanged",()=>t(this,void 0,void 0,function*(){var t;if(this.isConnected()&&n)try{yield i.stopNotifications(),this.addLog(`Stopped notifications for ${e} characteristic`)}catch(r){this.addLog(`Attemped to stop notifications for ${e} characteristic: ${null!==(t=null==r?void 0:r.message)&&void 0!==t?t:r}`)}}))),(0,o.map)(t=>{const i=t.target.value,n=(0,l.decode)(this.type,i);return this.addLog(`Received chunk with buffer size of ${i.byteLength} and decoded size ${n.length} for ${e} characteristic: \n${n}`),n}),(0,v.stitchChunks)({delimiter:i.BLUETOOTH_CHUNK_DELIMITER}),(0,o.map)(t=>{var i;try{return JSON.parse(t)}catch(n){return this.addLog(`Failed to parse JSON for ${e} characteristic. Falling back to unparsed string. ${null!==(i=null==n?void 0:n.message)&&void 0!==i?i:n}`),t}}));return this.connection$.pipe((0,o.switchMap)(t=>t===p.BLUETOOTH_CONNECTION.CONNECTED?r:c.NEVER))}readCharacteristic(e,i=!1){return t(this,void 0,void 0,function*(){try{this.addLog(`Reading characteristic: ${e}`);const n=yield this.getCharacteristicByName(e);if(!n)return this.addLog(`Did not fund ${e} characteristic`),Promise.reject(`Did not find characteristic by the name: ${e}`);const r=yield n.readValue(),s=(0,l.decode)(this.type,r),c=i?JSON.parse(s):s;return this.addLog(`Received read data from ${e} characteristic: \n${c}`),c}catch(t){return Promise.reject(`Error reading characteristic: ${t.message}`)}})}writeCharacteristic(e,i){return t(this,void 0,void 0,function*(){this.addLog(`Writing characteristic: ${e}`);const t=yield this.getCharacteristicByName(e);if(!t)return this.addLog(`Did not fund ${e} characteristic`),Promise.reject(`Did not find characteristic by the name: ${e}`);const n=(0,l.encode)(this.type,i);yield t.writeValueWithResponse(n)})}_addPendingAction(t){const e=this.pendingActions$.getValue();this.pendingActions$.next([...e,t])}_removePendingAction(t){const e=this.pendingActions$.getValue();this.pendingActions$.next(e.filter(e=>e!==t))}_autoToggleActionNotifications(e){return t(this,void 0,void 0,function*(){let i,n=!1;const r=this.connection$.asObservable().pipe((0,o.switchMap)(t=>t===p.BLUETOOTH_CONNECTION.CONNECTED?(0,s.defer)(()=>this.getCharacteristicByName("actions")).pipe((0,o.switchMap)(t=>(i=t,this.pendingActions$))):c.NEVER),(0,o.tap)(e=>t(this,void 0,void 0,function*(){var t,r;const s=!!e.length;if(s&&!n){n=!0;try{yield i.startNotifications(),this.addLog("Started notifications for [actions] characteristic")}catch(c){this.addLog(`Attemped to start notifications for [actions] characteristic: ${null!==(t=null==c?void 0:c.message)&&void 0!==t?t:c}`)}}if(!s&&n){n=!1;try{yield i.stopNotifications(),this.addLog("Stopped notifications for actions characteristic")}catch(c){this.addLog(`Attemped to stop notifications for [actions] characteristic: ${null!==(r=null==c?void 0:c.message)&&void 0!==r?r:c}`)}}})));e.pipe((0,o.switchMap)(t=>(0,N.osHasBluetoothSupport)(t)?r:c.EMPTY)).subscribe()})}dispatchAction({characteristicName:e,action:i}){return t(this,void 0,void 0,function*(){const{responseRequired:n=!1,responseTimeout:r=g.DEFAULT_ACTION_RESPONSE_TIMEOUT}=i;return new Promise((c,a)=>t(this,void 0,void 0,function*(){if(!(yield this.getCharacteristicByName(e).catch(()=>{a(`Did not find characteristic by the name: ${e}`)})))return;const t=(0,u.create6DigitPin)(),h=JSON.stringify(Object.assign({actionId:t},i));if(this.addLog(`Dispatched action with id ${t}`),n&&r){this._addPendingAction(t);const i=(0,s.timer)(r).subscribe(()=>{this._removePendingAction(t),a(`Action with id ${t} timed out after ${r}ms`)});this.subscribeToCharacteristic({characteristicName:e,manageNotifications:!1}).pipe((0,o.filter)(e=>(null==e?void 0:e.actionId)===t),(0,d.take)(1)).subscribe(e=>{i.unsubscribe(),this._removePendingAction(t),c(e)}),this.writeCharacteristic(e,h).catch(e=>{this._removePendingAction(t),a(e.message)})}else this.writeCharacteristic(e,h).then(()=>{c(null)}).catch(t=>{a(t.message)})}))})}}function O(e,i,n){return(0,c.fromEventPattern)(t=>{e.addEventListener(i,t)},r=>t(this,void 0,void 0,function*(){n&&(yield n()),e.removeEventListener(i,r)}))}function m(t){return new c.Observable(e=>{const i=new AbortController,{signal:n}=i,r=t.addEventListener("advertisementreceived",t=>{i.abort(),e.next(t),e.complete()},{once:!0});try{t.watchAdvertisements({signal:n})}catch(s){e.error(s)}return()=>{i.abort(),t.removeEventListener("advertisementreceived",r)}})}exports.WebBluetoothTransport=E;
|
|
71
|
+
},{"./isWebBluetoothSupported":"ljun","../utils/create6DigitPin":"UDAB","../utils/stitch":"V73a","../utils/encoding":"jTvL","../types":"iwtf","../constants":"dGLb","../utils/osHasBluetoothSupport":"rH2Y"}],"FtS5":[function(require,module,exports) {
|
|
72
|
+
"use strict";var t=this&&this.__awaiter||function(t,i,e,r){return new(e||(e=Promise))(function(n,a){function s(t){try{c(r.next(t))}catch(i){a(i)}}function o(t){try{c(r.throw(t))}catch(i){a(i)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e(function(t){t(i)})).then(s,o)}c((r=r.apply(t,i||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReactNativeTransport=void 0;const i=require("@neurosity/ipk"),e=require("@neurosity/ipk"),r=require("@neurosity/ipk"),n=require("rxjs"),a=require("rxjs"),s=require("rxjs/operators"),o=require("rxjs/operators"),c=require("rxjs/operators"),d=require("../utils/create6DigitPin"),h=require("../utils/stitch"),l=require("../utils/encoding"),u=require("../types"),v=require("../constants"),p=require("../constants"),g=require("../constants"),f=require("../constants"),N=require("../utils/osHasBluetoothSupport");class E{constructor(t){this.type=u.TRANSPORT_TYPE.REACT_NATIVE,this.characteristicsByName={},this.connection$=new n.BehaviorSubject(u.BLUETOOTH_CONNECTION.DISCONNECTED),this.pendingActions$=new n.BehaviorSubject([]),this.logs$=new n.ReplaySubject(10),this.connectionStream$=this.connection$.asObservable().pipe((0,s.filter)(t=>!!t),(0,o.distinctUntilChanged)(),(0,o.shareReplay)(1));const{BleManager:i,bleManagerEmitter:e,platform:r}=t;if(!i){const t="React Native option: BleManager not provided.";throw this.addLog(t),new Error(t)}if(!e){const t="React Native option: bleManagerEmitter not provided.";throw this.addLog(t),new Error(t)}if(!r){const t="React Native option: platform not provided.";throw this.addLog(t),new Error(t)}this.BleManager=i,this.bleManagerEmitter=e,this.platform=r,this.bleEvents={stopScan$:this._fromEvent("BleManagerStopScan"),discoverPeripheral$:this._fromEvent("BleManagerDiscoverPeripheral"),connectPeripheral$:this._fromEvent("BleManagerConnectPeripheral"),disconnectPeripheral$:this._fromEvent("BleManagerDisconnectPeripheral"),didUpdateValueForCharacteristic$:this._fromEvent("BleManagerDidUpdateValueForCharacteristic")},this.onDisconnected$=this.bleEvents.disconnectPeripheral$.pipe((0,c.share)()),this.BleManager.start({showAlert:!1}).then(()=>{this.addLog("BleManger started")}).catch(t=>{var i;this.addLog(`BleManger failed to start. ${null!==(i=null==t?void 0:t.message)&&void 0!==i?i:t}`)}),this.connection$.asObservable().subscribe(t=>{this.addLog(`connection status is ${t}`)}),this.onDisconnected$.subscribe(()=>{this.connection$.next(u.BLUETOOTH_CONNECTION.DISCONNECTED)})}addLog(t){this.logs$.next(t)}isConnected(){return this.connection$.getValue()===u.BLUETOOTH_CONNECTION.CONNECTED}_autoConnect(i){const e=this.onDisconnected$.pipe((0,s.switchMap)(()=>i));return(0,n.merge)(i,e).pipe((0,s.switchMap)(t=>(0,N.osHasBluetoothSupport)(t)?this.scan().pipe((0,s.switchMap)(i=>{const e=i.find(i=>i.name===(null==t?void 0:t.deviceNickname));return e?(0,n.of)(e):a.NEVER}),(0,c.distinct)(t=>t.id),(0,c.take)(1)):a.NEVER),(0,s.switchMap)(i=>t(this,void 0,void 0,function*(){return yield this.connect(i)})))}connection(){return this.connectionStream$}_fromEvent(t){return(0,a.fromEventPattern)(i=>{this.bleManagerEmitter.addListener(t,i)},()=>{this.bleManagerEmitter.removeAllListeners(t)}).pipe((0,c.share)())}scan(t){var e,d;const h=null!==(e=null==t?void 0:t.seconds)&&void 0!==e?e:10,v=null!==(d=null==t?void 0:t.once)&&void 0!==d&&d,p=[i.BLUETOOTH_PRIMARY_SERVICE_UUID_STRING],g={},f=new a.Observable(t=>{var i;try{this.BleManager.scan(p,h,!0,g).then(()=>{this.addLog(`BleManger scanning ${v?"once":"indefintely"}`),t.next()})}catch(e){this.addLog(`BleManger scanning ${v?"once":"indefintely"} failed. ${null!==(i=null==e?void 0:e.message)&&void 0!==i?i:e}`),t.error(e)}return()=>{this.BleManager.stopScan()}});return(v?f:(0,n.timer)(0,1e4).pipe((0,s.switchMap)(()=>f))).pipe((0,s.tap)(()=>{this.connection$.next(u.BLUETOOTH_CONNECTION.SCANNING)}),(0,s.takeUntil)(this.onDisconnected$),(0,s.switchMap)(()=>this.bleEvents.discoverPeripheral$),(0,s.filter)(t=>{var i,e,n;const a=null!==(n=null!==(e=null===(i=null==t?void 0:t.advertising)||void 0===i?void 0:i.localName)&&void 0!==e?e:t.name)&&void 0!==n?n:"";return!!a&&-1!==r.BLUETOOTH_DEVICE_NAME_PREFIXES.findIndex(t=>a.startsWith(t))}),(0,c.scan)((t,i)=>{var e,r,n,a,s,o,c,d;const h=null!==(n=null!==(r=null===(e=null==i?void 0:i.advertising)||void 0===e?void 0:e.localName)&&void 0!==r?r:i.name)&&void 0!==n?n:"",u=null===(d=null===(c=(0,l.decode)(this.type,null!==(o=null===(s=null===(a=null==i?void 0:i.advertising)||void 0===a?void 0:a.manufacturerData)||void 0===s?void 0:s.bytes)&&void 0!==o?o:[]))||void 0===c?void 0:c.slice)||void 0===d?void 0:d.call(c,2);return Object.assign(Object.assign({},t),{[i.id]:Object.assign(Object.assign({},i),{name:h,manufactureDataString:u})})},{}),(0,o.distinctUntilChanged)((t,i)=>JSON.stringify(t)===JSON.stringify(i)),(0,s.map)(t=>Object.values(t)),(0,c.share)())}connect(e){return t(this,void 0,void 0,function*(){return new Promise((r,n)=>t(this,void 0,void 0,function*(){try{if(!e)return void this.addLog("Peripheral not found");this.connection$.next(u.BLUETOOTH_CONNECTION.CONNECTING),yield this.BleManager.connect(e.id),this.addLog("Getting service...");const a=yield this.BleManager.retrieveServices(e.id,[i.BLUETOOTH_PRIMARY_SERVICE_UUID_STRING]);if(!a)return this.addLog("Could not retreive services"),void n("Could not retreive services");this.addLog(`Got service ${i.BLUETOOTH_PRIMARY_SERVICE_UUID_STRING}, getting characteristics...`),this.device=e,this.characteristicsByName=Object.fromEntries(a.characteristics.map(t=>[p.CHARACTERISTIC_UUIDS_TO_NAMES[t.characteristic.toLowerCase()],{characteristicUUID:t.characteristic,serviceUUID:t.service,peripheralId:e.id}])),this.addLog("Got characteristics."),"android"===this.platform&&(this.addLog(`Setting Android MTU to ${g.ANDROID_MAX_MTU}`),yield this.BleManager.requestMTU(e.id,g.ANDROID_MAX_MTU)),this.addLog(`Successfully connected to peripheral ${e.id}`),this.connection$.next(u.BLUETOOTH_CONNECTION.CONNECTED),r()}catch(t){n(t)}}))})}disconnect(){var i;return t(this,void 0,void 0,function*(){try{this.isConnected()&&(null===(i=null==this?void 0:this.device)||void 0===i?void 0:i.id)&&(yield this.BleManager.disconnect(this.device.id))}catch(t){return Promise.reject(t)}})}getCharacteristicByName(t){var i;if(!(t in this.characteristicsByName))throw new Error(`Characteristic by name ${t} is not found`);return null===(i=this.characteristicsByName)||void 0===i?void 0:i[t]}subscribeToCharacteristic({characteristicName:i,manageNotifications:r=!0}){const c=({peripheralId:a,serviceUUID:c,characteristicUUID:d})=>(0,n.defer)(()=>t(this,void 0,void 0,function*(){var t;if(r)try{yield this.BleManager.startNotification(a,c,d),this.addLog(`Started notifications for ${i} characteristic`)}catch(e){this.addLog(`Attemped to stop notifications for ${i} characteristic: ${null!==(t=null==e?void 0:e.message)&&void 0!==t?t:e}`)}})).pipe((0,s.switchMap)(()=>this.bleEvents.didUpdateValueForCharacteristic$),(0,o.finalize)(()=>t(this,void 0,void 0,function*(){var t;if(r)try{yield this.BleManager.stopNotification(a,c,d),this.addLog(`Stopped notifications for ${i} characteristic`)}catch(e){this.addLog(`Attemped to stop notifications for ${i} characteristic: ${null!==(t=null==e?void 0:e.message)&&void 0!==t?t:e}`)}})),(0,s.filter)(({characteristic:t})=>t===d),(0,s.map)(({value:t})=>(0,l.decode)(this.type,t)),(0,h.stitchChunks)({delimiter:e.BLUETOOTH_CHUNK_DELIMITER}),(0,s.map)(t=>{var e;try{return JSON.parse(t)}catch(r){return this.addLog(`Failed to parse JSON for ${i} characteristic. Falling back to unparsed string. ${null!==(e=null==r?void 0:r.message)&&void 0!==e?e:r}`),t}}));return this.connection$.pipe((0,s.switchMap)(t=>t===u.BLUETOOTH_CONNECTION.CONNECTED?c(this.getCharacteristicByName(i)):a.NEVER))}readCharacteristic(i,e=!1){var r;return t(this,void 0,void 0,function*(){this.addLog(`Reading characteristic: ${i}`);const{peripheralId:t,serviceUUID:n,characteristicUUID:a}=this.getCharacteristicByName(i);if(!a)return Promise.reject(`Did not find characteristic matching ${i}`);try{const o=yield this.BleManager.read(t,n,a),c=(0,l.decode)(this.type,o),d=e?JSON.parse(c):c;return this.addLog(`Received read data from ${i} characteristic: \n${d}`),d}catch(s){return Promise.reject(`readCharacteristic ${i} error. ${null!==(r=null==s?void 0:s.message)&&void 0!==r?r:s}`)}})}writeCharacteristic(i,e){return t(this,void 0,void 0,function*(){this.addLog(`Writing characteristic: ${i}`);const{peripheralId:t,serviceUUID:r,characteristicUUID:n}=this.getCharacteristicByName(i);if(!n)return Promise.reject(`Did not find characteristic matching ${i}`);const a=(0,l.encode)(this.type,e);yield this.BleManager.write(t,r,n,a,f.REACT_NATIVE_MAX_BYTE_SIZE)})}_addPendingAction(t){const i=this.pendingActions$.getValue();this.pendingActions$.next([...i,t])}_removePendingAction(t){const i=this.pendingActions$.getValue();this.pendingActions$.next(i.filter(i=>i!==t))}_autoToggleActionNotifications(i){return t(this,void 0,void 0,function*(){let e=!1;const r=this.connection$.asObservable().pipe((0,s.switchMap)(t=>t===u.BLUETOOTH_CONNECTION.CONNECTED?this.pendingActions$:a.NEVER),(0,s.tap)(i=>t(this,void 0,void 0,function*(){var t,r;const{peripheralId:n,serviceUUID:a,characteristicUUID:s}=this.getCharacteristicByName("actions"),o=!!i.length;if(o&&!e){e=!0;try{yield this.BleManager.startNotification(n,a,s),this.addLog("Started notifications for [actions] characteristic")}catch(c){this.addLog(`Attemped to start notifications for [actions] characteristic: ${null!==(t=null==c?void 0:c.message)&&void 0!==t?t:c}`)}}if(!o&&e){e=!1;try{yield this.BleManager.stopNotification(n,a,s),this.addLog("Stopped notifications for actions characteristic")}catch(c){this.addLog(`Attemped to stop notifications for [actions] characteristic: ${null!==(r=null==c?void 0:c.message)&&void 0!==r?r:c}`)}}})));i.pipe((0,s.switchMap)(t=>(0,N.osHasBluetoothSupport)(t)?r:a.EMPTY)).subscribe()})}dispatchAction({characteristicName:i,action:e}){return t(this,void 0,void 0,function*(){const{responseRequired:r=!1,responseTimeout:a=v.DEFAULT_ACTION_RESPONSE_TIMEOUT}=e;return new Promise((o,h)=>t(this,void 0,void 0,function*(){const t=(0,d.create6DigitPin)(),l=JSON.stringify(Object.assign({actionId:t},e));if(this.addLog(`Dispatched action with id ${t}`),r&&a){this._addPendingAction(t);const e=(0,n.timer)(a).subscribe(()=>{this._removePendingAction(t),h(`Action with id ${t} timed out after ${a}ms`)});this.subscribeToCharacteristic({characteristicName:i,manageNotifications:!1}).pipe((0,s.filter)(i=>(null==i?void 0:i.actionId)===t),(0,c.take)(1)).subscribe(i=>{e.unsubscribe(),this._removePendingAction(t),o(i)}),this.writeCharacteristic(i,l).catch(i=>{this._removePendingAction(t),h(i.message)})}else this.writeCharacteristic(i,l).then(()=>{o(null)}).catch(t=>{h(t.message)})}))})}}exports.ReactNativeTransport=E;
|
|
73
|
+
},{"../utils/create6DigitPin":"UDAB","../utils/stitch":"V73a","../utils/encoding":"jTvL","../types":"iwtf","../constants":"dGLb","../utils/osHasBluetoothSupport":"rH2Y"}],"Oj1i":[function(require,module,exports) {
|
|
74
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.epoch=exports.bufferToEpoch=exports.addInfo=void 0;const e=require("rxjs"),t=require("rxjs/operators"),a="data",o=256,n=e=>e instanceof Object&&e===Object(e),s=e=>"function"==typeof e,i=e=>t=>{var a;return Object.assign(Object.assign({},e),{info:Object.assign(Object.assign({},null!==(a=null==e?void 0:e.info)&&void 0!==a?a:{}),t||{})})},r=a=>(0,e.pipe)((0,t.map)(e=>{if(!n(e)||!n(a)&&!s(a))return e;const t=s(a)?a(e):a;return i(e)(t)}));exports.addInfo=r;const p=(e,t="data")=>e[0][t].map((a,o)=>e.map(e=>e[t][o])),c=({samplingRate:a=256,dataProp:o="data"}={})=>(0,e.pipe)((0,t.map)(e=>({[o]:p(e,o),info:Object.assign(Object.assign({},e[0]&&e[0].info?e[0].info:{}),{startTime:e[0].timestamp,samplingRate:e[0].info&&e[0].info.samplingRate?e[0].info.samplingRate:a})})));exports.bufferToEpoch=c;const f=({duration:a,interval:o,samplingRate:n,dataProp:s="data"})=>(0,e.pipe)((0,t.bufferCount)(o),(0,t.scan)((e,t)=>e.concat(t).slice(e.length<a?0:-a)),(0,t.filter)(e=>e.length===a),(0,exports.bufferToEpoch)({samplingRate:n,dataProp:s}));exports.epoch=f;
|
|
75
|
+
},{}],"WTrV":[function(require,module,exports) {
|
|
76
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.csvBufferToSamples=exports.csvBufferToEpoch=void 0;const e=require("rxjs"),r=require("rxjs/operators"),a=require("../../../utils/pipes"),s=16,t=256;function o(r){var o;return(null==r?void 0:r.samplingRate)||console.warn(`Didn't receive a sampling rate, defaulting to ${t}`),(0,e.pipe)(n(),(0,a.epoch)({duration:s,interval:s,samplingRate:null!==(o=null==r?void 0:r.samplingRate)&&void 0!==o?o:t}),(0,a.addInfo)({channelNames:r.channelNames,samplingRate:r.samplingRate}))}function n(){return(0,e.pipe)((0,r.mergeMap)(r=>(0,e.from)(r)),(0,r.map)(([e,r,...a])=>({timestamp:e,data:a})))}exports.csvBufferToEpoch=o,exports.csvBufferToSamples=n;
|
|
77
|
+
},{"../../../utils/pipes":"Oj1i"}],"fihV":[function(require,module,exports) {
|
|
78
|
+
"use strict";var t=this&&this.__awaiter||function(t,e,i,s){return new(i||(i=Promise))(function(r,n){function o(t){try{a(s.next(t))}catch(e){n(e)}}function c(t){try{a(s.throw(t))}catch(e){n(e)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,c)}a((s=s.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BluetoothClient=void 0;const e=require("rxjs"),i=require("rxjs"),s=require("rxjs/operators"),r=require("rxjs/operators"),n=require("./web/WebBluetoothTransport"),o=require("./react-native/ReactNativeTransport"),c=require("./utils/csvBufferToEpoch"),a=require("./types"),u=require("./utils/osHasBluetoothSupport");class h{constructor(t){this.selectedDevice$=new i.ReplaySubject(1),this.isAuthenticated$=new i.ReplaySubject(1);const{transport:e,selectedDevice$:s,createBluetoothToken:r}=null!=t?t:{};if(!e)throw new Error("No bluetooth transport provided.");this.transport=e,s&&s.subscribe(this.selectedDevice$),this.transport._autoConnect(this.selectedDevice$).subscribe({error:t=>{var e;this.transport.addLog(`Auto connect: error -> ${null!==(e=null==t?void 0:t.message)&&void 0!==e?e:t}`)}}),"function"==typeof r?(this.transport.addLog("Auto authentication enabled"),this._autoAuthenticate(r).subscribe()):this.transport.addLog("Auto authentication not enabled"),this.transport._autoToggleActionNotifications(this.selectedDevice$)}_autoAuthenticate(r){const n=(0,e.timer)(0,36e5).pipe((0,s.tap)(()=>{this.transport.addLog("Auto authentication in progress...")}));return this.selectedDevice$.pipe((0,s.switchMap)(e=>(0,u.osHasBluetoothSupport)(e)?this.connection().pipe((0,s.switchMap)(t=>t===a.BLUETOOTH_CONNECTION.CONNECTED?n:i.EMPTY),(0,s.switchMap)(()=>t(this,void 0,void 0,function*(){return yield this.isAuthenticated()})),(0,s.tap)(([e])=>t(this,void 0,void 0,function*(){if(e)this.transport.addLog("Already authenticated");else{const t=yield r();yield this.authenticate(t)}}))):i.EMPTY))}_hasBluetoothSupport(){return t(this,void 0,void 0,function*(){const t=yield(0,e.firstValueFrom)(this.selectedDevice$);return(0,u.osHasBluetoothSupport)(t)})}authenticate(e){return t(this,void 0,void 0,function*(){if(!(yield this._hasBluetoothSupport())){const t="authenticate method: The OS version does not support Bluetooth.";return this.transport.addLog(t),Promise.reject(t)}yield this.transport.writeCharacteristic("auth",e);const t=yield this.isAuthenticated(),[i]=t;return this.transport.addLog(`Authentication ${i?"succeeded":"failed"}`),this.isAuthenticated$.next(i),t})}isAuthenticated(){return t(this,void 0,void 0,function*(){const[t,e]=yield this.transport.readCharacteristic("auth",!0);return this.isAuthenticated$.next(t),[t,e]})}scan(t){if(this.transport instanceof o.ReactNativeTransport)return this.transport.scan(t);if(this.transport instanceof n.WebBluetoothTransport)throw new Error("scan method is compatibly with the React Native transport only");throw new Error("unknown transport")}connect(t){return this.transport instanceof o.ReactNativeTransport?this.transport.connect(t):this.transport instanceof n.WebBluetoothTransport?t?this.transport.connect(t):this.transport.connect():void 0}disconnect(){return this.transport.disconnect()}connection(){return this.transport.connection()}logs(){return this.transport.logs$.asObservable()}getDeviceId(){return t(this,void 0,void 0,function*(){return this.transport.readCharacteristic("deviceId")})}_withAuthentication(i){return t(this,void 0,void 0,function*(){if(!(yield this._hasBluetoothSupport())){const t="The OS version does not support Bluetooth.";return this.transport.addLog(t),Promise.reject(t)}if(!(yield(0,e.firstValueFrom)(this.isAuthenticated$))){const t="Authentication required.";return this.transport.addLog(t),Promise.reject(t)}return yield i()})}_subscribeWhileAuthenticated(t){return this.selectedDevice$.pipe((0,s.switchMap)(e=>(0,u.osHasBluetoothSupport)(e)?this.isAuthenticated$.pipe((0,r.distinctUntilChanged)(),(0,s.switchMap)(e=>e?this.transport.subscribeToCharacteristic({characteristicName:t}):i.EMPTY)):i.EMPTY))}focus(){return this._subscribeWhileAuthenticated("focus")}calm(){return this._subscribeWhileAuthenticated("calm")}accelerometer(){return this._subscribeWhileAuthenticated("accelerometer")}brainwaves(t){switch(t){case"raw":case"rawUnfiltered":return(0,e.defer)(()=>this.getInfo()).pipe((0,s.switchMap)(e=>this._subscribeWhileAuthenticated(t).pipe((0,c.csvBufferToEpoch)(e))));default:return this._subscribeWhileAuthenticated(t)}}signalQuality(){return this._subscribeWhileAuthenticated("signalQuality")}addMarker(e){return t(this,void 0,void 0,function*(){yield this.dispatchAction({action:"marker",command:"add",message:{timestamp:Date.now(),label:e}})})}getInfo(){return t(this,void 0,void 0,function*(){return yield this._withAuthentication(()=>(0,e.firstValueFrom)(this.transport.subscribeToCharacteristic({characteristicName:"deviceInfo"})))})}status(){return this._subscribeWhileAuthenticated("status")}dispatchAction(e){return t(this,void 0,void 0,function*(){return yield this._withAuthentication(()=>this.transport.dispatchAction({characteristicName:"actions",action:e}))})}settings(){return this._subscribeWhileAuthenticated("settings")}haptics(t){return this.dispatchAction({action:"haptics",command:"queue",responseRequired:!0,responseTimeout:4e3,message:{effects:t}})}get wifi(){return{nearbyNetworks:()=>this._subscribeWhileAuthenticated("wifiNearbyNetworks"),connections:()=>this._subscribeWhileAuthenticated("wifiConnections"),connect:(t,e)=>t?this.dispatchAction({action:"wifi",command:"connect",responseRequired:!0,responseTimeout:12e4,message:{ssid:t,password:null!=e?e:null}}):Promise.reject("Missing ssid"),forgetConnection:t=>t?this.dispatchAction({action:"wifi",command:"forget-connection",responseRequired:!0,responseTimeout:15e3,message:{ssid:t}}):Promise.reject("Missing ssid"),reset:()=>this.dispatchAction({action:"wifi",command:"reset",responseRequired:!0,responseTimeout:3e4,message:{respondOnSuccess:!0}}),speedTest:()=>this.dispatchAction({action:"wifi",command:"speed-test",responseRequired:!0,responseTimeout:6e4})}}}exports.BluetoothClient=h;
|
|
79
|
+
},{"./web/WebBluetoothTransport":"ouKb","./react-native/ReactNativeTransport":"FtS5","./utils/csvBufferToEpoch":"WTrV","./types":"iwtf","./utils/osHasBluetoothSupport":"rH2Y"}],"TICO":[function(require,module,exports) {
|
|
80
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&("get"in i?t.__esModule:!i.writable&&!i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var o in t)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||e(r,t,o)};Object.defineProperty(exports,"__esModule",{value:!0}),t(require("./BluetoothClient"),exports),t(require("./web/WebBluetoothTransport"),exports),t(require("./react-native/ReactNativeTransport"),exports),t(require("./utils/osHasBluetoothSupport"),exports);
|
|
81
|
+
},{"./BluetoothClient":"fihV","./web/WebBluetoothTransport":"ouKb","./react-native/ReactNativeTransport":"FtS5","./utils/osHasBluetoothSupport":"rH2Y"}],"KQ4u":[function(require,module,exports) {
|
|
82
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,i,o){void 0===o&&(o=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&("get"in s?t.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,o,s)}:function(e,t,i,o){void 0===o&&(o=i),e[o]=t[i]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(null!=i)for(var s in i)"default"!==s&&Object.prototype.hasOwnProperty.call(i,s)&&e(o,i,s);return t(o,i),o},o=this&&this.__awaiter||function(e,t,i,o){return new(i||(i=Promise))(function(s,r){function n(e){try{l(o.next(e))}catch(t){r(t)}}function c(e){try{l(o.throw(e))}catch(t){r(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(n,c)}l((o=o.apply(e,t||[])).next())})},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Notion=exports.Neurosity=void 0;const r=require("rxjs"),n=require("rxjs"),c=require("rxjs/operators"),l=s(require("fast-deep-equal")),u=require("./api/index"),a=require("./api/index"),d=require("./types/streaming"),h=require("./utils/subscription"),m=require("./types/status"),C=i(require("./utils/errors")),p=i(require("./utils/platform")),v=i(require("./utils/hapticEffects")),g=require("./utils/oauth"),f=require("./utils/oauth"),b=require("./api/https/createOAuthURL"),O=require("./api/https/getOAuthToken"),S=require("./utils/is-node"),M=require("./utils/metrics"),E=require("./api/bluetooth"),T=require("./api/bluetooth/types"),_={timesync:!1,autoSelectDevice:!0,streamingMode:d.STREAMING_MODE.WIFI_ONLY,emulator:!1,emulatorHost:"localhost",emulatorAuthPort:9099,emulatorDatabasePort:9e3,emulatorFunctionsPort:5001,emulatorFirestorePort:8080,emulatorOptions:{}};class A{constructor(e={}){this.streamingMode$=new n.ReplaySubject(1);const{streamingMode:t,bluetoothTransport:i}=e;this.options=Object.freeze(Object.assign(Object.assign({},_),e)),this.cloudClient=new u.CloudClient(this.options),i&&(this.bluetoothClient=new E.BluetoothClient({selectedDevice$:this.onDeviceChange(),createBluetoothToken:this.createBluetoothToken.bind(this),transport:i})),this._initStreamingMode(t,!!i)}_initStreamingMode(e,t){const i=[d.STREAMING_MODE.BLUETOOTH_WITH_WIFI_FALLBACK,d.STREAMING_MODE.WIFI_WITH_BLUETOOTH_FALLBACK].includes(e),o=!Object.values(d.STREAMING_MODE).includes(e),s=i&&!t;this.isMissingBluetoothTransport=s,!e||o||s?this.streamingMode$.next(d.STREAMING_MODE.WIFI_ONLY):this.streamingMode$.next(e)}streamingState(){const e=e=>[m.STATUS.ONLINE,m.STATUS.UPDATING].includes(e);return this.streamingMode$.pipe((0,c.switchMap)(t=>this.isMissingBluetoothTransport?this.cloudClient.status().pipe((0,c.map)(({state:i})=>({connected:e(i),streamingMode:t,activeMode:d.STREAMING_TYPE.WIFI}))):this.onDeviceChange().pipe((0,c.switchMap)(i=>i?(0,r.combineLatest)({wifiStatus:this.cloudClient.status(),bluetoothConnection:(null==this?void 0:this.bluetoothClient)?this.bluetoothClient.connection():(0,r.of)(T.BLUETOOTH_CONNECTION.DISCONNECTED)}).pipe((0,c.map)(({wifiStatus:i,bluetoothConnection:o})=>{const s=o===T.BLUETOOTH_CONNECTION.CONNECTED;switch(t){default:case d.STREAMING_MODE.WIFI_ONLY:return{connected:e(i.state),streamingMode:t,activeMode:d.STREAMING_TYPE.WIFI};case d.STREAMING_MODE.WIFI_WITH_BLUETOOTH_FALLBACK:return{connected:e(i.state)||!s?e(i.state):s,streamingMode:t,activeMode:e(i.state)||!s?d.STREAMING_TYPE.WIFI:d.STREAMING_TYPE.BLUETOOTH};case d.STREAMING_MODE.BLUETOOTH_WITH_WIFI_FALLBACK:return{connected:!!s||e(i.state),streamingMode:t,activeMode:s?d.STREAMING_TYPE.BLUETOOTH:d.STREAMING_TYPE.WIFI}}}),(0,c.distinctUntilChanged)((e,t)=>(0,l.default)(e,t))):n.EMPTY))))}_withStreamingModeObservable(e){const{wifi:t,bluetooth:i}=e;return this.streamingState().pipe((0,c.switchMap)(({activeMode:e})=>{switch(e){case d.STREAMING_TYPE.WIFI:return t();case d.STREAMING_TYPE.BLUETOOTH:return i();default:return t()}}))}_withStreamingModePromise(e){return o(this,void 0,void 0,function*(){const{wifi:t,bluetooth:i}=e,{activeMode:o}=yield(0,n.firstValueFrom)(this.streamingState());switch(o){case d.STREAMING_TYPE.WIFI:return yield t();case d.STREAMING_TYPE.BLUETOOTH:return yield i();default:return yield t()}})}get bluetooth(){return null==this?void 0:this.bluetoothClient}_getCloudMetricDependencies(){return{options:this.options,cloudClient:this.cloudClient,onDeviceChange:this.onDeviceChange.bind(this),status:this.status.bind(this)}}login(e){return o(this,void 0,void 0,function*(){return yield this.cloudClient.login(e)})}logout(){return o(this,void 0,void 0,function*(){return yield this.cloudClient.logout()})}__getApp(){return this.cloudClient.__getApp()}onAuthStateChanged(){return this.cloudClient.onAuthStateChanged()}addDevice(e){const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"addDevice");return t?Promise.reject(i):this.cloudClient.addDevice(e)}removeDevice(e){const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"removeDevice");return t?Promise.reject(i):this.cloudClient.removeDevice(e)}transferDevice(e){const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"transferDevice");return t?Promise.reject(i):this.cloudClient.transferDevice(e)}onUserDevicesChange(){const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"onUserDevicesChange");return e?(0,r.throwError)(()=>t):this.cloudClient.onUserDevicesChange()}onUserClaimsChange(){return this.cloudClient.onUserClaimsChange()}getDevices(){return o(this,void 0,void 0,function*(){return yield this.cloudClient.getDevices()})}selectDevice(e){return o(this,void 0,void 0,function*(){const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"selectDevice");return t?Promise.reject(i):yield this.cloudClient.selectDevice(e)})}getSelectedDevice(){return o(this,void 0,void 0,function*(){const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"getSelectedDevice");return e?Promise.reject(t):yield this.cloudClient.getSelectedDevice()})}getInfo(){return o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))return Promise.reject(C.mustSelectDevice);const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"getInfo");return e?Promise.reject(t):yield this._withStreamingModePromise({wifi:()=>this.cloudClient.getInfo(),bluetooth:()=>this.bluetoothClient.getInfo()})})}onDeviceChange(){const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"onDeviceChange");return e?(0,r.throwError)(()=>t):this.cloudClient.onDeviceChange()}disconnect(){return o(this,void 0,void 0,function*(){return yield this._withStreamingModePromise({wifi:()=>this.cloudClient.disconnect(),bluetooth:()=>this.bluetoothClient.disconnect()})})}dispatchAction(e){return o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))return Promise.reject(C.mustSelectDevice);const[t,i]=(0,f.validateOAuthScopeForAction)(this.cloudClient.userClaims,e);return t?Promise.reject(i):yield this._withStreamingModePromise({wifi:()=>this.cloudClient.dispatchAction(e),bluetooth:()=>this.bluetoothClient.dispatchAction(e)})})}addMarker(e){return o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))throw C.mustSelectDevice;if(!e)throw new Error(`${C.prefix}A label is required for addMarker`);return yield this._withStreamingModePromise({wifi:()=>this.cloudClient.dispatchAction({command:"marker",action:"add",message:{label:e,timestamp:this.cloudClient.timestamp}}),bluetooth:()=>this.bluetoothClient.addMarker(e)})})}haptics(e){var t;return o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))return Promise.reject(C.mustSelectDevice);const i=null===(t=yield this.getSelectedDevice())||void 0===t?void 0:t.modelVersion;if(!p.supportsHaptics(i))return Promise.reject(C.metricNotSupportedByModel("haptics",i));const o=p.getPlatformHapticMotors(i);for(const t in e){if(!Object.keys(o).includes(t))return Promise.reject(C.locationNotFound(t,i));const s=e[t],r=7;if(s.length>r)return Promise.reject(C.exceededMaxItems(r));o[t]=s}const s={command:"haptics",action:"queue",responseRequired:!0,responseTimeout:1e3,message:{effects:o}};return yield this._withStreamingModePromise({wifi:()=>this.cloudClient.dispatchAction(s),bluetooth:()=>this.bluetoothClient.dispatchAction(s)})})}getHapticEffects(){return v}accelerometer(){const e="accelerometer",[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,e);return t?(0,r.throwError)(()=>i):this.onDeviceChange().pipe((0,c.switchMap)(t=>{const i=(null==t?void 0:t.modelVersion)||p.MODEL_VERSION_1;return p.supportsAccel(i)?this._withStreamingModeObservable({wifi:()=>(0,M.getCloudMetric)(this._getCloudMetricDependencies(),{metric:e,labels:(0,h.getLabels)(e),atomic:!0}),bluetooth:()=>this.bluetoothClient.accelerometer()}):(0,r.throwError)(()=>C.metricNotSupportedByModel(e,i))}))}brainwaves(e){const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"brainwaves");return t?(0,r.throwError)(()=>i):this._withStreamingModeObservable({wifi:()=>(0,M.getCloudMetric)(this._getCloudMetricDependencies(),{metric:"brainwaves",labels:e?[e]:[],atomic:!1}),bluetooth:()=>this.bluetoothClient.brainwaves(e)})}calm(){const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"calm");return e?(0,r.throwError)(()=>t):this._withStreamingModeObservable({wifi:()=>(0,M.getCloudMetric)(this._getCloudMetricDependencies(),{metric:"awareness",labels:["calm"],atomic:!1}),bluetooth:()=>this.bluetoothClient.calm()})}signalQuality(){const e="signalQuality",[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,e);return t?(0,r.throwError)(()=>i):this._withStreamingModeObservable({wifi:()=>(0,M.getCloudMetric)(this._getCloudMetricDependencies(),{metric:e,labels:(0,h.getLabels)(e),atomic:!0}),bluetooth:()=>this.bluetoothClient.signalQuality()})}settings(){const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"settings");return e?(0,r.throwError)(()=>t):this.cloudClient.observeNamespace("settings")}focus(){const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"focus");return e?(0,r.throwError)(()=>t):this._withStreamingModeObservable({wifi:()=>(0,M.getCloudMetric)(this._getCloudMetricDependencies(),{metric:"awareness",labels:["focus"],atomic:!1}),bluetooth:()=>this.bluetoothClient.focus()})}kinesis(e){const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"kinesis");return t?(0,r.throwError)(()=>i):(0,M.getCloudMetric)(this._getCloudMetricDependencies(),{metric:"kinesis",labels:e?[e]:[],atomic:!1})}predictions(e){const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"predictions");return t?(0,r.throwError)(()=>i):(0,M.getCloudMetric)(this._getCloudMetricDependencies(),{metric:"predictions",labels:e?[e]:[],atomic:!1})}status(){const[e,t]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"status");return e?(0,r.throwError)(()=>t):this._withStreamingModeObservable({wifi:()=>this.cloudClient.status(),bluetooth:()=>this.bluetoothClient.status()})}changeSettings(e){return o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))return Promise.reject(C.mustSelectDevice);const[t,i]=(0,g.validateOAuthScopeForFunctionName)(this.cloudClient.userClaims,"changeSettings");return t?Promise.reject(i):yield this.cloudClient.changeSettings(e)})}get training(){return{record:e=>o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))throw C.mustSelectDevice;const t=this.cloudClient.user&&"uid"in this.cloudClient.user?this.cloudClient.user.uid:null,i=Object.assign(Object.assign({fit:!1,baseline:!1,timestamp:this.cloudClient.timestamp},e),{userId:t});yield this.cloudClient.actions.dispatch({command:"training",action:"record",message:i})}),stop:e=>o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))throw C.mustSelectDevice;yield this.cloudClient.actions.dispatch({command:"training",action:"stop",message:Object.assign({},e)})}),stopAll:()=>o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))throw C.mustSelectDevice;yield this.cloudClient.actions.dispatch({command:"training",action:"stopAll",message:{}})})}}goOffline(){this.cloudClient.goOffline()}goOnline(){this.cloudClient.goOnline()}createAccount(e){return this.cloudClient.createAccount(e)}deleteAccount(){return this.cloudClient.deleteAccount()}createBluetoothToken(){return this.cloudClient.createBluetoothToken()}createCustomToken(){return this.cloudClient.createCustomToken()}getTimesyncOffset(){return this.options.timesync||console.warn("getTimesyncOffset() requires options.timesync to be true."),this.options.timesync?this.cloudClient.getTimesyncOffset():0}createOAuthURL(e){return S.isNode?(0,b.createOAuthURL)(e,this.options):Promise.reject(new Error(`${C.prefix}the createOAuthURL method must be used on the server side (node.js) for security reasons.`))}getOAuthToken(e){return S.isNode?(0,O.getOAuthToken)(e,this.options):Promise.reject(new Error(`${C.prefix}the getOAuthToken method must be used on the server side (node.js) for security reasons.`))}removeOAuthAccess(){return this.cloudClient.removeOAuthAccess()}skill(e){return o(this,void 0,void 0,function*(){if(!(yield this.cloudClient.didSelectDevice()))return Promise.reject(C.mustSelectDevice);const t=yield this.cloudClient.skills.get(e);return null===t?Promise.reject(new Error(`${C.prefix}Access denied for: ${e}. Make sure the skill is installed.`)):{metric:e=>{const i=`skill~${t.id}~${e}`,o=new r.Observable(t=>{const o=this.cloudClient.metrics.subscribe({metric:i,labels:[e],atomic:!0}),s=this.cloudClient.metrics.on(o,(...e)=>{t.next(...e)});return()=>{this.cloudClient.metrics.unsubscribe(o,s)}}).pipe((0,c.map)(t=>t[e]));return Object.defineProperty(o,"next",{value:t=>{this.cloudClient.metrics.next(i,{[e]:t})}}),o}}})}onUserExperiments(){return this.cloudClient.onUserExperiments()}deleteUserExperiment(e){return this.cloudClient.deleteUserExperiment(e)}}exports.Neurosity=A,A.credentialWithLink=a.credentialWithLink,A.createUser=u.createUser,A.SERVER_TIMESTAMP=a.SERVER_TIMESTAMP;class w extends A{constructor(e={}){super(e),console.log("The Notion class is deprecated and will be removed in the next version of the SDK. Please use the Neurosity class instead. e.g. new Notion() => new Neurosity()")}}exports.Notion=w;
|
|
83
|
+
},{"./api/index":"LXvB","./types/streaming":"rekm","./utils/subscription":"yLLB","./types/status":"Ttuy","./utils/errors":"WDyG","./utils/platform":"wAkn","./utils/hapticEffects":"lLai","./utils/oauth":"xIH5","./api/https/createOAuthURL":"MDrB","./api/https/getOAuthToken":"nfg4","./utils/is-node":"vsps","./utils/metrics":"DCuD","./api/bluetooth":"TICO","./api/bluetooth/types":"iwtf"}],"DCNc":[function(require,module,exports) {
|
|
84
|
+
"use strict";var e=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{u(i.next(e))}catch(t){r(t)}}function c(e){try{u(i.throw(e))}catch(t){r(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,c)}u((i=i.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createNotionOnDevice=void 0;const t=require("../Notion");function n(n){return e(this,void 0,void 0,function*(){const e=new t.Neurosity(n),i=Object.assign(Object.assign({},yield e.skill(n.skill.bundleId)),{props:"props"in n.skill?n.skill.props:{}});return delete e.skill,[e,i]})}exports.createNotionOnDevice=n;
|
|
85
|
+
},{"../Notion":"KQ4u"}],"T9Vd":[function(require,module,exports) {
|
|
86
|
+
"use strict";var n=this&&this.__awaiter||function(n,t,e,i){return new(e||(e=Promise))(function(o,c){function r(n){try{s(i.next(n))}catch(t){c(t)}}function u(n){try{s(i.throw(n))}catch(t){c(t)}}function s(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e(function(n){n(t)})).then(r,u)}s((i=i.apply(n,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createSkill=void 0;const t=require("./NotionOnDevice");function e(e){return{subscribe:i=>n(this,void 0,void 0,function*(){const[o,c]=yield(0,t.createNotionOnDevice)(Object.assign({},i)),r=e(o,c);return{unsubscribe:()=>n(this,void 0,void 0,function*(){if(yield o.disconnect(),r&&"then"in r){const n=yield r;"function"==typeof n&&n()}return"function"==typeof r&&"then"in r()?yield r():"function"==typeof r?r():r})}})}}exports.createSkill=e;
|
|
87
|
+
},{"./NotionOnDevice":"DCNc"}],"d8ek":[function(require,module,exports) {
|
|
88
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&("get"in o?t.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(r,i)||e(r,t,i)};Object.defineProperty(exports,"__esModule",{value:!0}),t(require("./createSkill"),exports),t(require("./NotionOnDevice"),exports);
|
|
89
|
+
},{"./createSkill":"T9Vd","./NotionOnDevice":"DCNc"}],"QCba":[function(require,module,exports) {
|
|
90
|
+
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&("get"in o?t.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(r,i)||e(r,t,i)};Object.defineProperty(exports,"__esModule",{value:!0}),t(require("./Notion"),exports),t(require("./api/bluetooth"),exports),t(require("./skills"),exports);
|
|
91
|
+
},{"./Notion":"KQ4u","./api/bluetooth":"TICO","./skills":"d8ek"}]},{},["QCba"], null)
|
|
92
|
+
//# sourceMappingURL=/index.js.map
|