"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6939],{96939:function(o,t,n){n.r(t);var e={contexts:["*"],prefix:"sn-clipboard-copy",label:"Copy text to clipboard (function)",description:"A reusable function that copies a given string to the clipboard.",locales:{"zh-CN":{label:"\u590D\u5236\u6587\u672C\u5230\u526A\u8D34\u677F\uFF08\u51FD\u6570\uFF09",description:"\u901A\u7528\u51FD\u6570\uFF1A\u63A5\u53D7\u4E00\u4E2A\u5B57\u7B26\u4E32\u53C2\u6570\u5E76\u590D\u5236\u5230\u526A\u8D34\u677F\u3002"}},content:`
// A general utility function that copies text to clipboard.
// Usage:
//   const ok = await copyTextToClipboard('Hello');
//   if (ok) { /* success */ } else { /* handle failure */ }
async function copyTextToClipboard(text) {
  const s = String(text ?? '');
  try {
    if (navigator?.clipboard?.writeText) {
      await navigator.clipboard.writeText(s);
      return true;
    }
  } catch (_) {
    // Fallback below
  }
}
`};t.default=e}}]);
