Implement a deep-clone function for nested objects in JavaScript (or a language of your choice) without using JSON serialization or third-party libraries. Requirements:
-
Correctly copy primitives, plain objects, arrays, Maps, Sets, Dates, and RegExps.
-
Preserve object prototypes and property descriptors (writable, enumerable, configurable) when possible.
-
Handle circular references and shared substructures so identical references remain shared after cloning.
-
Support symbol keys and non-enumerable properties.
-
Do not clone functions; keep function references as-is.
-
Discuss time and space complexity, recursion vs. iteration, and stack-safety for very deep graphs.
-
Provide tests for edge cases such as self-referential objects, sparse arrays, NaN/Infinity/-0, typed arrays, and large object graphs.