"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_primordials_object = require('../primordials/object.js');
const require_objects_predicates = require('./predicates.js');

//#region src/objects/inspect.ts
/**
* @file Object inspection helpers — `getKeys`, `getOwn`,
*   `getOwnPropertyValues`. Safe accessors that return empty / undefined on
*   null inputs instead of throwing.
*/
/**
* Get the enumerable own property keys of an object.
*
* This is a safe wrapper around `Object.keys()` that returns an empty array for
* non-object values instead of throwing an error.
*
* @example
*   ;```ts
*   getKeys({ a: 1, b: 2 }) // ['a', 'b']
*   getKeys([10, 20, 30]) // ['0', '1', '2']
*   getKeys(null) // []
*   getKeys('hello') // []
*   ```
*
* @param obj - The value to get keys from.
*
* @returns Array of enumerable string keys, or empty array for non-objects
*/
/*@__NO_SIDE_EFFECTS__*/
function getKeys(obj) {
	return /* @__PURE__ */ require_objects_predicates.isObject(obj) ? require_primordials_object.ObjectKeys(obj) : [];
}
/**
* Get an own property value from an object safely.
*
* Returns `undefined` if the value is null/undefined or if the property doesn't
* exist as an own property (not inherited). This avoids prototype chain lookups
* and prevents errors on null/undefined values.
*
* @example
*   ;```ts
*   const obj = { name: 'Alice', age: 30 }
*   getOwn(obj, 'name') // 'Alice'
*   getOwn(obj, 'missing') // undefined
*   getOwn(obj, 'toString') // undefined (inherited)
*   getOwn(null, 'name') // undefined
*   ```
*
* @param obj - The object to get the property from.
* @param propKey - The property key to look up.
*
* @returns The property value, or `undefined` if not found or obj is
*   null/undefined.
*/
/*@__NO_SIDE_EFFECTS__*/
function getOwn(obj, propKey) {
	if (obj === null || obj === void 0) return;
	return require_primordials_object.ObjectHasOwn(obj, propKey) ? obj[propKey] : void 0;
}
/**
* Get all own property values from an object.
*
* Returns values for all own properties (enumerable and non-enumerable), but
* not inherited properties. Returns an empty array for null/undefined.
*
* @example
*   ;```ts
*   getOwnPropertyValues({ a: 1, b: 2, c: 3 }) // [1, 2, 3]
*   getOwnPropertyValues([10, 20, 30]) // [10, 20, 30]
*   getOwnPropertyValues(null) // []
*   ```
*
* @param obj - The object to get values from.
*
* @returns Array of all own property values, or empty array for null/undefined
*/
/*@__NO_SIDE_EFFECTS__*/
function getOwnPropertyValues(obj) {
	if (obj === null || obj === void 0) return [];
	const keys = require_primordials_object.ObjectGetOwnPropertyNames(obj);
	const { length } = keys;
	const values = Array(length);
	for (let i = 0; i < length; i += 1) values[i] = obj[keys[i]];
	return values;
}

//#endregion
exports.getKeys = getKeys;
exports.getOwn = getOwn;
exports.getOwnPropertyValues = getOwnPropertyValues;