import { __exports as DOMCollection } from "../../../../_virtual/DOMCollection.js";
import "../collections.js";
import { __exports as collections } from "../../../../_virtual/collections.js";
Object.defineProperty(DOMCollection, "__esModule", {
  value: true
});
DOMCollection.test = DOMCollection.serialize = DOMCollection.default = void 0;
var _collections = collections;
const SPACE = " ";
const OBJECT_NAMES = ["DOMStringMap", "NamedNodeMap"];
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
const testName = (name) => OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
const test = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
DOMCollection.test = test;
const isNamedNodeMap = (collection) => collection.constructor.name === "NamedNodeMap";
const serialize = (collection, config, indentation, depth, refs, printer) => {
  const name = collection.constructor.name;
  if (++depth > config.maxDepth) {
    return "[" + name + "]";
  }
  return (config.min ? "" : name + SPACE) + (OBJECT_NAMES.indexOf(name) !== -1 ? "{" + (0, _collections.printObjectProperties)(
    isNamedNodeMap(collection) ? Array.from(collection).reduce((props, attribute) => {
      props[attribute.name] = attribute.value;
      return props;
    }, {}) : { ...collection },
    config,
    indentation,
    depth,
    refs,
    printer
  ) + "}" : "[" + (0, _collections.printListItems)(
    Array.from(collection),
    config,
    indentation,
    depth,
    refs,
    printer
  ) + "]");
};
DOMCollection.serialize = serialize;
const plugin = {
  serialize,
  test
};
var _default = plugin;
DOMCollection.default = _default;
//# sourceMappingURL=DOMCollection.js.map
