import { fileURLToPath as __synFup } from "url";import { dirname as __synDn } from "path";import { createRequire as __synCr } from "module";const __filename = __synFup(import.meta.url);const __dirname = __synDn(__filename);const require = __synCr(import.meta.url);
import {
  __name
} from "./chunk-A22CWAKO.js";
const BIGINT_PREFIX = "bigint: Failed to load bindings";
const BIGINT_LINE_FRAGMENT = "bigint: Failed to load bindings, pure JS will be used";
const DISABLE_ENV = "SYNAPSEIA_DISABLE_BIGINT_FILTER";
let triggeredOnce = false;
function noteTriggered(source) {
  if (triggeredOnce) return;
  triggeredOnce = true;
  try {
    process.stderr.write(`[bigint-filter] triggered source=${source} \u2014 module still useful on this platform
`);
  } catch {
  }
}
__name(noteTriggered, "noteTriggered");
function muteBigintBindingConsoleWarn() {
  if (process.env[DISABLE_ENV] === "true") return;
  const original = console.warn.bind(console);
  console.warn = /* @__PURE__ */ __name(function patched(...args) {
    const first = args[0];
    if (typeof first === "string" && first.startsWith(BIGINT_PREFIX)) {
      noteTriggered("console.warn");
      return;
    }
    return original(...args);
  }, "patched");
}
__name(muteBigintBindingConsoleWarn, "muteBigintBindingConsoleWarn");
function muteBigintBindingStderrWrite() {
  if (process.env[DISABLE_ENV] === "true") return;
  const originalWrite = process.stderr.write.bind(process.stderr);
  process.stderr.write = /* @__PURE__ */ __name(function patched(chunk, ...rest) {
    const s = typeof chunk === "string" ? chunk : chunk?.toString?.() ?? "";
    if (s.includes(BIGINT_LINE_FRAGMENT)) {
      noteTriggered("stderr.write");
      return true;
    }
    return originalWrite(chunk, ...rest);
  }, "patched");
}
__name(muteBigintBindingStderrWrite, "muteBigintBindingStderrWrite");
export {
  muteBigintBindingConsoleWarn,
  muteBigintBindingStderrWrite
};
//# sourceMappingURL=bigint-warning-filter.js.map