Recursively Flatten a Deeply Nested Object into a Single-Level Key-Value Map
Write a function that takes an arbitrarily nested JavaScript object and flattens it into a single-level object where nested key paths are represented as dot-notation strings. For example, {a: {b: {c: 1}}} becomes {'a.b.c': 1}. Handle arrays embedded within objects (use bracket notation like 'a[0].b'), null values, and circular reference detection. This is used in form serialization, analytics event flattening, and config normalization.