// Prefer production build output shape first.
// Dev (tsx) fallback when running directly from src.
const adapterModule = (await (async () => {
    try {
        return (await import('./index.js'));
    }
    catch {
        return (await import('./index.js'));
    }
})());
export function registerMySqlAdapter(registry) {
    registry.register('mysql', (config) => adapterModule.MySQLAdapter.create(config));
}
const globalWithRegistry = globalThis;
const globalRegistry = globalWithRegistry.__zintrust_db_adapter_registry__ ??
    (globalWithRegistry.__zintrust_db_adapter_registry__ = new Map());
registerMySqlAdapter({
    register: (driver, factory) => {
        globalRegistry.set(driver, factory);
    },
});
// Side-effect registration when used as a published package.
// In monorepo/dev setups, @zintrust/core may not be resolvable; ignore if missing.
try {
    const core = (await import('../../../src/index.js'));
    if (core.DatabaseAdapterRegistry !== undefined) {
        registerMySqlAdapter(core.DatabaseAdapterRegistry);
    }
}
catch {
    // no-op
}
