"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useMutationObserver = void 0;
var _react = require("react");
const DEFAULT = {
  attributes: true,
  childList: true,
  subtree: true
};
const useMutationObserver = function (element, callback) {
  let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT;
  (0, _react.useEffect)(() => {
    if (!element) return;
    const observer = new MutationObserver(callback);
    observer.observe(element, options);
    return () => observer.disconnect();
  }, [callback, element, options]);
};
exports.useMutationObserver = useMutationObserver;
//# sourceMappingURL=useMutationObserver.js.map