import { v4 as createId } from 'uuid';
/**
Accepts an array of HTML attribute names to be removed from the host element and applied to a child element (typically a native element).
*/
export function getHostAttrs(hostEl, whitelist = []) {
  const hostAttrs = hostEl.attributes;
  const passAttrs = {};
  whitelist.forEach(attrName => {
    const attr = hostAttrs.getNamedItem(attrName);
    if (attr) {
      passAttrs[attrName] = attr.value;
      hostAttrs.removeNamedItem(attrName);
    }
  });
  return passAttrs;
}
/**
Accepts an array of HTML attribute names to be removed from the host element and applied to a child element.
The 'id' attribute is always included.  If an 'id' is not passed to the host element, one will be generated.
*/
export function getHostAttrsWithId(hostEl, whitelist = []) {
  const attrs = getHostAttrs(hostEl, ['id', ...whitelist]);
  attrs.id = attrs.id || createId();
  return attrs;
}
export function genId() {
  return createId();
}
//# sourceMappingURL=index.js.map
