PromoCursed/node_modules/.cache/babel-loader/ac0cf1b62ffb72e11835e3b59c36d617a0057c503e2cbb2e6d5fd42e615aac1c.json
2024-08-20 23:25:37 +04:00

1 line
8.8 KiB
JSON

{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport { isValidElement, version } from 'react';\nimport { ForwardRef, isFragment, isMemo } from 'react-is';\nimport useMemo from \"./hooks/useMemo\";\nexport var fillRef = function fillRef(ref, node) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (_typeof(ref) === 'object' && ref && 'current' in ref) {\n ref.current = node;\n }\n};\n\n/**\n * Merge refs into one ref function to support ref passing.\n */\nexport var composeRef = function composeRef() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n var refList = refs.filter(Boolean);\n if (refList.length <= 1) {\n return refList[0];\n }\n return function (node) {\n refs.forEach(function (ref) {\n fillRef(ref, node);\n });\n };\n};\nexport var useComposeRef = function useComposeRef() {\n for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n refs[_key2] = arguments[_key2];\n }\n return useMemo(function () {\n return composeRef.apply(void 0, refs);\n }, refs, function (prev, next) {\n return prev.length !== next.length || prev.every(function (ref, i) {\n return ref !== next[i];\n });\n });\n};\nexport var supportRef = function supportRef(nodeOrComponent) {\n var _type$prototype, _nodeOrComponent$prot;\n var type = isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;\n\n // Function component node\n if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== ForwardRef) {\n return false;\n }\n\n // Class component\n if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== ForwardRef) {\n return false;\n }\n return true;\n};\nfunction isReactElement(node) {\n return /*#__PURE__*/isValidElement(node) && !isFragment(node);\n}\nexport var supportNodeRef = function supportNodeRef(node) {\n return isReactElement(node) && supportRef(node);\n};\n\n/**\n * In React 19. `ref` is not a property from node.\n * But a property from `props.ref`.\n * To check if `props.ref` exist or fallback to `ref`.\n */\nexport var getNodeRef = Number(version.split('.')[0]) >= 19 ?\n// >= React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.props.ref;\n }\n return null;\n} :\n// < React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.ref;\n }\n return null;\n};","map":{"version":3,"names":["_typeof","isValidElement","version","ForwardRef","isFragment","isMemo","useMemo","fillRef","ref","node","current","composeRef","_len","arguments","length","refs","Array","_key","refList","filter","Boolean","forEach","useComposeRef","_len2","_key2","apply","prev","next","every","i","supportRef","nodeOrComponent","_type$prototype","_nodeOrComponent$prot","type","prototype","render","$$typeof","isReactElement","supportNodeRef","getNodeRef","Number","split","props"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-util/es/ref.js"],"sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport { isValidElement, version } from 'react';\nimport { ForwardRef, isFragment, isMemo } from 'react-is';\nimport useMemo from \"./hooks/useMemo\";\nexport var fillRef = function fillRef(ref, node) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (_typeof(ref) === 'object' && ref && 'current' in ref) {\n ref.current = node;\n }\n};\n\n/**\n * Merge refs into one ref function to support ref passing.\n */\nexport var composeRef = function composeRef() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n var refList = refs.filter(Boolean);\n if (refList.length <= 1) {\n return refList[0];\n }\n return function (node) {\n refs.forEach(function (ref) {\n fillRef(ref, node);\n });\n };\n};\nexport var useComposeRef = function useComposeRef() {\n for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n refs[_key2] = arguments[_key2];\n }\n return useMemo(function () {\n return composeRef.apply(void 0, refs);\n }, refs, function (prev, next) {\n return prev.length !== next.length || prev.every(function (ref, i) {\n return ref !== next[i];\n });\n });\n};\nexport var supportRef = function supportRef(nodeOrComponent) {\n var _type$prototype, _nodeOrComponent$prot;\n var type = isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;\n\n // Function component node\n if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== ForwardRef) {\n return false;\n }\n\n // Class component\n if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== ForwardRef) {\n return false;\n }\n return true;\n};\nfunction isReactElement(node) {\n return /*#__PURE__*/isValidElement(node) && !isFragment(node);\n}\nexport var supportNodeRef = function supportNodeRef(node) {\n return isReactElement(node) && supportRef(node);\n};\n\n/**\n * In React 19. `ref` is not a property from node.\n * But a property from `props.ref`.\n * To check if `props.ref` exist or fallback to `ref`.\n */\nexport var getNodeRef = Number(version.split('.')[0]) >= 19 ?\n// >= React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.props.ref;\n }\n return null;\n} :\n// < React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.ref;\n }\n return null;\n};"],"mappings":"AAAA,OAAOA,OAAO,MAAM,mCAAmC;AACvD,SAASC,cAAc,EAAEC,OAAO,QAAQ,OAAO;AAC/C,SAASC,UAAU,EAAEC,UAAU,EAAEC,MAAM,QAAQ,UAAU;AACzD,OAAOC,OAAO,MAAM,iBAAiB;AACrC,OAAO,IAAIC,OAAO,GAAG,SAASA,OAAOA,CAACC,GAAG,EAAEC,IAAI,EAAE;EAC/C,IAAI,OAAOD,GAAG,KAAK,UAAU,EAAE;IAC7BA,GAAG,CAACC,IAAI,CAAC;EACX,CAAC,MAAM,IAAIT,OAAO,CAACQ,GAAG,CAAC,KAAK,QAAQ,IAAIA,GAAG,IAAI,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