var l = (n, o, a) => new Promise((r, e) => {
  var s = (t) => {
    try {
      c(a.next(t));
    } catch (i) {
      e(i);
    }
  }, f = (t) => {
    try {
      c(a.throw(t));
    } catch (i) {
      e(i);
    }
  }, c = (t) => t.done ? r(t.value) : Promise.resolve(t.value).then(s, f);
  c((a = a.apply(n, o)).next());
});
const d = (a) => l(void 0, [a], function* ({
  target: n,
  value: o
}) {
  try {
    let r = "";
    if (!navigator.clipboard)
      return console.warn("Browser don't have support for native clipboard."), !1;
    if (n) {
      const e = document.querySelector(n);
      if (!e || !e.textContent)
        return console.warn("Element not found"), !1;
      o = e.textContent;
    }
    return o && (r = o), yield navigator.clipboard.writeText(r), !0;
  } catch (r) {
    return !1;
  }
});
export {
  d as copyToClipboard
};
