PromoCursed/node_modules/.cache/babel-loader/4849dc305f5492575e2332ab14ca42e0c573cd239f63c4d484a5a84fa3adac30.json

1 line
8.0 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport * as React from 'react';\nimport copy from 'copy-to-clipboard';\nimport { useEvent } from 'rc-util';\nconst useCopyClick = _ref => {\n let {\n copyConfig,\n children\n } = _ref;\n const [copied, setCopied] = React.useState(false);\n const [copyLoading, setCopyLoading] = React.useState(false);\n const copyIdRef = React.useRef(null);\n const cleanCopyId = () => {\n if (copyIdRef.current) {\n clearTimeout(copyIdRef.current);\n }\n };\n const copyOptions = {};\n if (copyConfig.format) {\n copyOptions.format = copyConfig.format;\n }\n React.useEffect(() => cleanCopyId, []);\n // Keep copy action up to date\n const onClick = useEvent(e => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n e === null || e === void 0 ? void 0 : e.preventDefault();\n e === null || e === void 0 ? void 0 : e.stopPropagation();\n setCopyLoading(true);\n try {\n const text = typeof copyConfig.text === 'function' ? yield copyConfig.text() : copyConfig.text;\n copy(text || String(children) || '', copyOptions);\n setCopyLoading(false);\n setCopied(true);\n // Trigger tips update\n cleanCopyId();\n copyIdRef.current = setTimeout(() => {\n setCopied(false);\n }, 3000);\n (_a = copyConfig.onCopy) === null || _a === void 0 ? void 0 : _a.call(copyConfig, e);\n } catch (error) {\n setCopyLoading(false);\n throw error;\n }\n }));\n return {\n copied,\n copyLoading,\n onClick\n };\n};\nexport default useCopyClick;","map":{"version":3,"names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","React","copy","useEvent","useCopyClick","_ref","copyConfig","children","copied","setCopied","useState","copyLoading","setCopyLoading","copyIdRef","useRef","cleanCopyId","current","clearTimeout","copyOptions","format","useEffect","onClick","_a","preventDefault","stopPropagation","text","String","setTimeout","onCopy","call","error"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/typography/hooks/useCopyClick.js"],"sourcesContent":["var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport * as React from 'react';\nimport copy from 'copy-to-clipboard';\nimport { useEvent } from 'rc-util';\nconst useCopyClick = _ref => {\n let {\n copyConfig,\n children\n } = _ref;\n const [copied, setCopied] = React.useState(false);\n const [copyLoading, setCopyLoading] = R