import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
const TAB = 9;
const ESC = 27;
class TabInterceptor {
  predictionActive = false;
  callbacks;
  constructor(callbacks) {
    this.callbacks = callbacks;
  }
  setPredictionActive(active) {
    this.predictionActive = active;
  }
  isPredictionActive() {
    return this.predictionActive;
  }
  process(data) {
    if (!this.predictionActive) {
      this.callbacks.onPassthrough(data);
      return;
    }
    if (data.length === 1 && data[0] === TAB) {
      this.callbacks.onAccept();
      return;
    }
    if (data.length === 1 && data[0] === ESC) {
      this.callbacks.onDismiss();
      return;
    }
    this.callbacks.onPassthrough(data);
  }
}
export {
  TabInterceptor
};
//# sourceMappingURL=tab-interceptor.js.map
