1 line
11 KiB
JSON
1 line
11 KiB
JSON
{"ast":null,"code":"\"use strict\";\n\nvar deselectCurrent = require(\"toggle-selection\");\nvar clipboardToIE11Formatting = {\n \"text/plain\": \"Text\",\n \"text/html\": \"Url\",\n \"default\": \"Text\"\n};\nvar defaultMessage = \"Copy to clipboard: #{key}, Enter\";\nfunction format(message) {\n var copyKey = (/mac os x/i.test(navigator.userAgent) ? \"⌘\" : \"Ctrl\") + \"+C\";\n return message.replace(/#{\\s*key\\s*}/g, copyKey);\n}\nfunction copy(text, options) {\n var debug,\n message,\n reselectPrevious,\n range,\n selection,\n mark,\n success = false;\n if (!options) {\n options = {};\n }\n debug = options.debug || false;\n try {\n reselectPrevious = deselectCurrent();\n range = document.createRange();\n selection = document.getSelection();\n mark = document.createElement(\"span\");\n mark.textContent = text;\n // avoid screen readers from reading out loud the text\n mark.ariaHidden = \"true\";\n // reset user styles for span element\n mark.style.all = \"unset\";\n // prevents scrolling to the end of the page\n mark.style.position = \"fixed\";\n mark.style.top = 0;\n mark.style.clip = \"rect(0, 0, 0, 0)\";\n // used to preserve spaces and line breaks\n mark.style.whiteSpace = \"pre\";\n // do not inherit user-select (it may be `none`)\n mark.style.webkitUserSelect = \"text\";\n mark.style.MozUserSelect = \"text\";\n mark.style.msUserSelect = \"text\";\n mark.style.userSelect = \"text\";\n mark.addEventListener(\"copy\", function (e) {\n e.stopPropagation();\n if (options.format) {\n e.preventDefault();\n if (typeof e.clipboardData === \"undefined\") {\n // IE 11\n debug && console.warn(\"unable to use e.clipboardData\");\n debug && console.warn(\"trying IE specific stuff\");\n window.clipboardData.clearData();\n var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting[\"default\"];\n window.clipboardData.setData(format, text);\n } else {\n // all other browsers\n e.clipboardData.clearData();\n e.clipboardData.setData(options.format, text);\n }\n }\n if (options.onCopy) {\n e.preventDefault();\n options.onCopy(e.clipboardData);\n }\n });\n document.body.appendChild(mark);\n range.selectNodeContents(mark);\n selection.addRange(range);\n var successful = document.execCommand(\"copy\");\n if (!successful) {\n throw new Error(\"copy command was unsuccessful\");\n }\n success = true;\n } catch (err) {\n debug && console.error(\"unable to copy using execCommand: \", err);\n debug && console.warn(\"trying IE specific stuff\");\n try {\n window.clipboardData.setData(options.format || \"text\", text);\n options.onCopy && options.onCopy(window.clipboardData);\n success = true;\n } catch (err) {\n debug && console.error(\"unable to copy using clipboardData: \", err);\n debug && console.error(\"falling back to prompt\");\n message = format(\"message\" in options ? options.message : defaultMessage);\n window.prompt(message, text);\n }\n } finally {\n if (selection) {\n if (typeof selection.removeRange == \"function\") {\n selection.removeRange(range);\n } else {\n selection.removeAllRanges();\n }\n }\n if (mark) {\n document.body.removeChild(mark);\n }\n reselectPrevious();\n }\n return success;\n}\nmodule.exports = copy;","map":{"version":3,"names":["deselectCurrent","require","clipboardToIE11Formatting","defaultMessage","format","message","copyKey","test","navigator","userAgent","replace","copy","text","options","debug","reselectPrevious","range","selection","mark","success","document","createRange","getSelection","createElement","textContent","ariaHidden","style","all","position","top","clip","whiteSpace","webkitUserSelect","MozUserSelect","msUserSelect","userSelect","addEventListener","e","stopPropagation","preventDefault","clipboardData","console","warn","window","clearData","setData","onCopy","body","appendChild","selectNodeContents","addRange","successful","execCommand","Error","err","error","prompt","removeRange","removeAllRanges","removeChild","module","exports"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/copy-to-clipboard/index.js"],"sourcesContent":["\"use strict\";\n\nvar deselectCurrent = require(\"toggle-selection\");\n\nvar clipboardToIE11Formatting = {\n \"text/plain\": \"Text\",\n \"text/html\": \"Url\",\n \"default\": \"Text\"\n}\n\nvar defaultMessage = \"Copy to clipboard: #{key}, Enter\";\n\nfunction format(message) {\n var copyKey = (/mac os x/i.test(navigator.userAgent) ? \"⌘\" : \"Ctrl\") + \"+C\";\n return message.replace(/#{\\s*key\\s*}/g, copyKey);\n}\n\nfunction copy(text, options) {\n var debug,\n message,\n reselectPrevious,\n range,\n selection,\n mark,\n success = false;\n if (!options) {\n options = {};\n }\n debug = options.debug || false;\n try {\n reselectPrevious = deselectCurrent();\n\n range = document.createRange();\n selection = document.getSelection();\n\n mark = document.createElement(\"span\");\n mark.textContent = text;\n // avoid screen readers from reading out loud the text\n mark.ariaHidden = \"true\"\n // reset user styles for span element\n mark.style.all = \"unset\";\n // prevents scrolling to the end of the page\n mark.style.position = \"fixed\";\n mark.style.top = 0;\n mark.style.clip = \"rect(0, 0, 0, 0)\";\n // used to preserve spaces and line breaks\n mark.style.whiteSpace = \"pre\";\n // do not inherit user-select (it may be `none`)\n mark.style.webkitUserSelect = \"text\";\n mark.style.MozUserSelect = \"text\";\n mark.style.msUserSelect = \"text\";\n mark.style.userSelect = \"text\";\n mark.addEventListener(\"copy\", function(e) {\n e.stopPropagation();\n if (options.format) {\n e.preventDefault();\n if (typeof e.clipboardData === \"undefined\") { // IE 11\n debug && console.warn(\"unable to use e.clipboardData\");\n debug && console.warn(\"trying IE specific stuff\");\n window.clipboardData.clearData();\n var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting[\"default\"]\n window.clipboardData.setData(format, text);\n } else { // all other browsers\n e.clipboardData.clearData();\n e.clipboardData.setData(options.format, text);\n }\n }\n if (options.onCopy) {\n e.preventDefault();\n options.onCopy(e.clipboardData);\n }\n });\n\n document.body.appendChild(mark);\n\n range.selectNodeContents(mark);\n selection.addRange(range);\n\n var successful = document.execCommand(\"copy\");\n if (!successful) {\n throw new Error(\"copy command was unsuccessful\");\n }\n success = true;\n } catch (err) {\n debug && console.error(\"unable to copy using execCommand: \", err);\n debug && console.warn(\"trying IE specific stuff\");\n try {\n window.clipboardData.setData(options.format || \"text\", text);\n options.onCopy && options.onCopy(window.clipboardData);\n success = true;\n } catch (err) {\n debug && console.error(\"unable to copy using clipboardData: \", err);\n debug && console.error(\"falling back to prompt\");\n message = format(\"message\" in options ? options.message : defaultMessage);\n window.prompt(message, text);\n }\n } finally {\n if (selection) {\n if (typeof selection.removeRange == \"function\") {\n selection.removeRange(range);\n } else {\n selection.removeAllRanges();\n }\n }\n\n if (mark) {\n document.body.removeChild(mark);\n }\n reselectPrevious();\n }\n\n return success;\n}\n\nmodule.exports = copy;\n"],"mappings":"AAAA,YAAY;;AAEZ,IAAIA,eAAe,GAAGC,OAAO,CAAC,kBAAkB,CAAC;AAEjD,IAAIC,yBAAyB,GAAG;EAC9B,YAAY,EAAE,MAAM;EACpB,WAAW,EAAE,KAAK;EAClB,SAAS,EAAE;AACb,CAAC;AAED,IAAIC,cAAc,GAAG,kCAAkC;AAEvD,SAASC,MAAMA,CAACC,OAAO,EAAE;EACvB,IAAIC,OAAO,GAAG,CAAC,WAAW,CAACC,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC,GAAG,GAAG,GAAG,MAAM,IAAI,IAAI;EAC3E,OAAOJ,OAAO,CAACK,OAAO,CAAC,eAAe,EAAEJ,OAAO,CAAC;AAClD;AAEA,SAASK,IAAIA,CAACC,IAAI,EAAEC,OAAO,EAAE;EAC3B,IAAIC,KAAK;IACPT,OAAO;IACPU,gBAAgB;IAChBC,KAAK;IACLC,SAAS;IACTC,IAAI;IACJC,OAAO,GAAG,KAAK;EACjB,IAAI,CAACN,OAAO,EAAE;IACZA,OAAO,GAAG,CAAC,CAAC;EACd;EACAC,KAAK,GAAGD,OAAO,CAACC,KAAK,IAAI,KAAK;EAC9B,IAAI;IACFC,gBAAgB,GAAGf,eAAe,CAAC,CAAC;IAEpCgB,KAAK,GAAGI,QAAQ,CAACC,WAAW,CAAC,CAAC;IAC9BJ,SAAS,GAAGG,QAAQ,CAACE,YAAY,CAAC,CAAC;IAEnCJ,IAAI,GAAGE,QAAQ,CAACG,aAAa,CAAC,MAAM,CAAC;IACrCL,IAAI,CAACM,WAAW,GAAGZ,IAAI;IACvB;IACAM,IAAI,CAACO,UAAU,GAAG,MAAM;IACxB;IACAP,IAAI,CAACQ,KAAK,CAACC,GAAG,GAAG,OAAO;IACxB;IACAT,IAAI,CAACQ,KAAK,CAACE,QAAQ,GA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