"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const uint = require("../../../base/common/uint.js");
class CharacterClassifier {
  constructor(_defaultValue) {
    const defaultValue = uint.toUint8(_defaultValue);
    this._defaultValue = defaultValue;
    this._asciiMap = CharacterClassifier._createAsciiMap(defaultValue);
    this._map = /* @__PURE__ */ new Map();
  }
  static _createAsciiMap(defaultValue) {
    const asciiMap = new Uint8Array(256);
    for (let i = 0; i < 256; i++) {
      asciiMap[i] = defaultValue;
    }
    return asciiMap;
  }
  set(charCode, _value) {
    const value = uint.toUint8(_value);
    if (charCode >= 0 && charCode < 256) {
      this._asciiMap[charCode] = value;
    } else {
      this._map.set(charCode, value);
    }
  }
  get(charCode) {
    if (charCode >= 0 && charCode < 256) {
      return this._asciiMap[charCode];
    } else {
      return this._map.get(charCode) || this._defaultValue;
    }
  }
}
class CharacterSet {
  constructor() {
    this._actual = new CharacterClassifier(
      0
      /* False */
    );
  }
  add(charCode) {
    this._actual.set(
      charCode,
      1
      /* True */
    );
  }
  has(charCode) {
    return this._actual.get(charCode) === 1;
  }
}
exports.CharacterClassifier = CharacterClassifier;
exports.CharacterSet = CharacterSet;
