(() => { const result = []; const seen = new Set(); function walk(path, object, depth) { if ( object === null || (typeof object !== "object" && typeof object !== "function") || seen.has(object) || depth > 3 ) return; seen.add(object); const prototype = Object.getPrototypeOf(object); result.push(JSON.stringify([ path, Object.isExtensible(object), Object.isFrozen(object), prototype === null ? null : prototype.constructor?.name, ])); const keys = Reflect.ownKeys(object).map((key) => [key, String(key)]); keys.sort((a, b) => a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0); for (const [key, name] of keys) { const descriptor = Object.getOwnPropertyDescriptor(object, key); const child = `${path}.${name}`; result.push(JSON.stringify([ child, descriptor.enumerable, descriptor.configurable, "value" in descriptor ? [ descriptor.value === null ? "null" : typeof descriptor.value, descriptor.writable, ] : [typeof descriptor.get, typeof descriptor.set], ])); if ("value" in descriptor) walk(child, descriptor.value, depth + 1); } } walk("globalThis", globalThis, 0); result.push(`globalEventTarget: ${globalThis instanceof EventTarget}`); let dispatched = false; const listener = () => dispatched = true; addEventListener("snapshot-surface", listener, { once: true }); dispatchEvent(new Event("snapshot-surface")); result.push(`globalDispatch: ${dispatched}`); return result; })();