try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`2598b100-ba3e-4e30-943e-35e909452969`,e._sentryDebugIdIdentifier=`sentry-dbid-2598b100-ba3e-4e30-943e-35e909452969`)}catch{}import"./rolldown-runtime-nx40z1zs.js";import{yg as e}from"./entry.client-mpghtlrl.js";import{connectDevice as t,startScan as n,stopScan as r}from"./src-kv81py4k.js";var i=class{logger=new e(`WebOSBluetoothAdaptor`);async deviceScan(e,t,i){let a=!0;this.logger.info(`Starting Bluetooth scan`),i.addEventListener(`abort`,async()=>{a&&(a=!1,this.logger.info(`Scanning aborted by caller`),r())});let o=n(t=>{a&&t.devices&&(a=!1,this.logger.debug(`Found ${t.devices.length} devices`),e(t.devices.map(e=>({name:e.name,macAddress:e.address}))),o.cancel(),r())},e=>{t(Error(e.errorCode))})}async pairDevice(e,n,r,i){this.logger.info(`Pairing with device`),t(e,e=>{if(e?.event===`onConnectionStateChange`){let t=e?.values;t?.connected===!0&&t?.connecting===!1&&(this.logger.info(`Pairing successful`),n())}},e=>{r(Error(e.errorText))})}};export{i as WebOSBluetoothAdaptor};