"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../_virtual/_rolldown/runtime.js');
const require_primordials_map_set = require('../primordials/map-set.js');
const require_primordials_reflect = require('../primordials/reflect.js');
const require_logger_default = require('../logger/default.js');
const require_node_util = require('../node/util.js');
let src_external__socketregistry_is_unicode_supported = require("../external/@socketregistry/is-unicode-supported");
src_external__socketregistry_is_unicode_supported = require_runtime.__toESM(src_external__socketregistry_is_unicode_supported);
let src_external_debug = require("../external/debug");
src_external_debug = require_runtime.__toESM(src_external_debug);

//#region src/debug/_internal.ts
/**
* @file Private internals for `debug/*` modules — the cached logger instance,
*   lazy `node:util` accessor, the `debugByNamespace` cache that
*   `namespace.getDebugJsInstance` fills, the lazy `pointingTriangle` glyph
*   used by every output function, and `customLog` (the `debug-js` log-writer
*   override). Co-located so the namespace / output / caller-info leaves don't
*   fragment ownership of this shared module state.
*/
const logger = require_logger_default.getDefaultLogger();
const debugByNamespace = new require_primordials_map_set.MapCtor();
let _pointingTriangle;
/**
* Custom log function for debug output.
*
* @private
*/
/* c8 ignore start - customLog is assigned to debugJs instances and
only fires when debugJs emits, which requires DEBUG=* env var
set at the right module-load timing. Tests use the SOCKET_DEBUG
path which writes via logger.info directly. */
/*@__NO_SIDE_EFFECTS__*/
function customLog(...args) {
	const util = /* @__PURE__ */ require_node_util.getNodeUtil();
	const inspectOpts = src_external_debug.default.inspectOpts ? {
		...src_external_debug.default.inspectOpts,
		showHidden: src_external_debug.default.inspectOpts.showHidden === null ? void 0 : src_external_debug.default.inspectOpts.showHidden,
		depth: src_external_debug.default.inspectOpts.depth === null || typeof src_external_debug.default.inspectOpts.depth === "boolean" ? void 0 : src_external_debug.default.inspectOpts.depth
	} : {};
	require_primordials_reflect.ReflectApply(logger.info, logger, [util.formatWithOptions(inspectOpts, ...args)]);
}
/* c8 ignore stop */
/**
* Lazily resolve the "pointing triangle" glyph — `▸` on terminals with unicode
* support, `>` everywhere else. Initialised on first call by the output
* functions.
*
* @private
*/
/* c8 ignore start - First-call init for module-level glyph; only
one of the 5 debug functions hits the body. The unicode-fallback
arm also fires only on terminals without unicode support. */
/*@__NO_SIDE_EFFECTS__*/
function getPointingTriangle() {
	if (_pointingTriangle === void 0) _pointingTriangle = (0, src_external__socketregistry_is_unicode_supported.default)() ? "▸" : ">";
	return _pointingTriangle;
}
/* c8 ignore stop */

//#endregion
exports.customLog = customLog;
exports.debugByNamespace = debugByNamespace;
exports.getPointingTriangle = getPointingTriangle;
exports.getUtil = require_node_util.getNodeUtil;
exports.logger = logger;