Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

87 lines
2.9 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 9791d1c834ee18fb.a3b8628b5c.js
* Module id: 26012
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e, t, n) => {
"use strict";
var r = e.r(121583),
o = { "text/plain": "Text", "text/html": "Url", default: "Text" };
t.exports = function (e, t) {
var n,
a,
i,
l,
s,
c,
d,
u,
f = !1;
t || (t = {}), (i = t.debug || !1);
try {
if (
((s = r()),
(c = document.createRange()),
(d = document.getSelection()),
((u = document.createElement("span")).textContent = e),
(u.ariaHidden = "true"),
(u.style.all = "unset"),
(u.style.position = "fixed"),
(u.style.top = 0),
(u.style.clip = "rect(0, 0, 0, 0)"),
(u.style.whiteSpace = "pre"),
(u.style.webkitUserSelect = "text"),
(u.style.MozUserSelect = "text"),
(u.style.msUserSelect = "text"),
(u.style.userSelect = "text"),
u.addEventListener("copy", function (n) {
if ((n.stopPropagation(), t.format))
if ((n.preventDefault(), void 0 === n.clipboardData)) {
i && console.warn("unable to use e.clipboardData"),
i && console.warn("trying IE specific stuff"),
window.clipboardData.clearData();
var r = o[t.format] || o.default;
window.clipboardData.setData(r, e);
} else
n.clipboardData.clearData(),
n.clipboardData.setData(t.format, e);
t.onCopy && (n.preventDefault(), t.onCopy(n.clipboardData));
}),
document.body.appendChild(u),
c.selectNodeContents(u),
d.addRange(c),
!document.execCommand("copy"))
)
throw Error("copy command was unsuccessful");
f = !0;
} catch (r) {
i && console.error("unable to copy using execCommand: ", r),
i && console.warn("trying IE specific stuff");
try {
window.clipboardData.setData(t.format || "text", e),
t.onCopy && t.onCopy(window.clipboardData),
(f = !0);
} catch (r) {
i && console.error("unable to copy using clipboardData: ", r),
i && console.error("falling back to prompt"),
(n =
"message" in t ? t.message : "Copy to clipboard: #{key}, Enter"),
(a = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C"),
(l = n.replace(/#{\s*key\s*}/g, a)),
window.prompt(l, e);
}
} finally {
d &&
("function" == typeof d.removeRange
? d.removeRange(c)
: d.removeAllRanges()),
u && document.body.removeChild(u),
s();
}
return f;
};
};
export default moduleFactory;