import c from "./index-loadjs.umd.js";
import { useRef as s } from "react";
function i() {
  return i = Object.assign || function(t) {
    for (var r = 1; r < arguments.length; r++) {
      var e = arguments[r];
      for (var o in e)
        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
    return t;
  }, i.apply(this, arguments);
}
var l = "https://platform.twitter.com/widgets.js", f = "twttr", a = f, m = !!(typeof window < "u" && window.document && window.document.createElement);
function h() {
  c(l, a);
}
function g() {
  return new Promise(function(t, r) {
    var e = function() {
      return r(new Error("Could not load remote twitter widgets js"));
    };
    c.ready(a, {
      success: function() {
        var n = window[f];
        (!n || !n.widgets) && e(), t(n.widgets);
      },
      error: e
    });
  });
}
function v(t, r) {
  t && t.querySelectorAll("*").forEach(function(e) {
    e.hasAttribute(r) && e.remove();
  });
}
function u(t, r) {
  return t === r ? t !== 0 || r !== 0 || 1 / t === 1 / r : t !== t && r !== r;
}
function w(t, r) {
  if (u(t, r))
    return !0;
  if (typeof t != "object" || t === null || typeof r != "object" || r === null)
    return !1;
  var e = Object.keys(t), o = Object.keys(r);
  if (e.length !== o.length)
    return !1;
  for (var n = 0; n < e.length; n++)
    if (!Object.prototype.hasOwnProperty.call(r, e[n]) || !u(t[e[n]], r[e[n]]))
      return !1;
  return !0;
}
function y(t) {
  var r = s();
  return w(t, r.current) || (r.current = t), r.current;
}
function O(t) {
  return typeof t == "object" ? i({}, t) : t;
}
export {
  m as canUseDOM,
  O as cloneShallow,
  v as removeChildrenWithAttribute,
  h as twLoad,
  g as twWidgetFactory,
  y as useShallowCompareMemoize
};
