"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_7PDWWFAB_exports = {};
__export(chunk_7PDWWFAB_exports, {
  getDatabaseVersionSafe: () => getDatabaseVersionSafe,
  init_getDatabaseVersionSafe: () => init_getDatabaseVersionSafe
});
module.exports = __toCommonJS(chunk_7PDWWFAB_exports);
var import_chunk_NXI7U4IE = require("./chunk-NXI7U4IE.js");
var import_chunk_FVJ3R4NJ = require("./chunk-FVJ3R4NJ.js");
var import_debug = __toESM(require("@prisma/debug"));
async function getDatabaseVersionSafe(args) {
  let engine;
  let dbVersion;
  try {
    engine = new import_chunk_NXI7U4IE.SchemaEngine({
      projectDir: process.cwd()
    });
    dbVersion = await engine.getDatabaseVersion(args);
  } catch (e) {
    debug(e);
  } finally {
    if (engine && engine.isRunning) {
      engine.stop();
    }
  }
  return dbVersion;
}
var debug;
var init_getDatabaseVersionSafe = (0, import_chunk_FVJ3R4NJ.__esm)({
  "src/utils/getDatabaseVersionSafe.ts"() {
    (0, import_chunk_NXI7U4IE.init_SchemaEngine)();
    debug = (0, import_debug.default)("prisma:cli");
  }
});
