welcome-ui
Version:
Customizable design system with react, typescript, tailwindcss and ariakit.
103 lines (102 loc) • 3.84 kB
JavaScript
"use client";
var R = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function D(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function S(e) {
return function(...o) {
const c = /* @__PURE__ */ new Set();
function l(...f) {
for (const a of f)
if (a) {
if (typeof a == "string")
c.add((e == null ? void 0 : e[a]) || a);
else if (Array.isArray(a))
l(...a);
else if (typeof a == "object")
for (const t in a)
Object.prototype.hasOwnProperty.call(a, t) && a[t] && c.add((e == null ? void 0 : e[t]) || t);
}
}
return l(...o), Array.from(c).join(" ");
};
}
var y, v;
function h() {
return v || (v = 1, y = function() {
var e = document.getSelection();
if (!e.rangeCount)
return function() {
};
for (var o = document.activeElement, c = [], l = 0; l < e.rangeCount; l++)
c.push(e.getRangeAt(l));
switch (o.tagName.toUpperCase()) {
// .toUpperCase handles XHTML
case "INPUT":
case "TEXTAREA":
o.blur();
break;
default:
o = null;
break;
}
return e.removeAllRanges(), function() {
e.type === "Caret" && e.removeAllRanges(), e.rangeCount || c.forEach(function(f) {
e.addRange(f);
}), o && o.focus();
};
}), y;
}
var g, C;
function T() {
if (C) return g;
C = 1;
var e = h(), o = {
"text/plain": "Text",
"text/html": "Url",
default: "Text"
}, c = "Copy to clipboard: #{key}, Enter";
function l(a) {
var t = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
return a.replace(/#{\s*key\s*}/g, t);
}
function f(a, t) {
var i, b, m, u, s, r, d = !1;
t || (t = {}), i = t.debug || !1;
try {
m = e(), u = document.createRange(), s = document.getSelection(), r = document.createElement("span"), r.textContent = a, r.ariaHidden = "true", r.style.all = "unset", r.style.position = "fixed", r.style.top = 0, r.style.clip = "rect(0, 0, 0, 0)", r.style.whiteSpace = "pre", r.style.webkitUserSelect = "text", r.style.MozUserSelect = "text", r.style.msUserSelect = "text", r.style.userSelect = "text", r.addEventListener("copy", function(n) {
if (n.stopPropagation(), t.format)
if (n.preventDefault(), typeof n.clipboardData > "u") {
i && console.warn("unable to use e.clipboardData"), i && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
var p = o[t.format] || o.default;
window.clipboardData.setData(p, a);
} else
n.clipboardData.clearData(), n.clipboardData.setData(t.format, a);
t.onCopy && (n.preventDefault(), t.onCopy(n.clipboardData));
}), document.body.appendChild(r), u.selectNodeContents(r), s.addRange(u);
var w = document.execCommand("copy");
if (!w)
throw new Error("copy command was unsuccessful");
d = !0;
} catch (n) {
i && console.error("unable to copy using execCommand: ", n), i && console.warn("trying IE specific stuff");
try {
window.clipboardData.setData(t.format || "text", a), t.onCopy && t.onCopy(window.clipboardData), d = !0;
} catch (p) {
i && console.error("unable to copy using clipboardData: ", p), i && console.error("falling back to prompt"), b = l("message" in t ? t.message : c), window.prompt(b, a);
}
} finally {
s && (typeof s.removeRange == "function" ? s.removeRange(u) : s.removeAllRanges()), r && document.body.removeChild(r), m();
}
return d;
}
return g = f, g;
}
var E = T();
const x = /* @__PURE__ */ D(E);
export {
R as a,
x as b,
S as c,
D as g
};