{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport React from 'react';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport findDOMNode from \"rc-util/es/Dom/findDOMNode\";\nimport useEvent from \"rc-util/es/hooks/useEvent\";\nimport DomWrapper from \"./wrapper\";\nimport useMutateObserver from \"./useMutateObserver\";\nvar MutateObserver = function MutateObserver(props) {\n var children = props.children,\n options = props.options,\n _props$onMutate = props.onMutate,\n onMutate = _props$onMutate === void 0 ? function () {} : _props$onMutate;\n var callback = useEvent(onMutate);\n var wrapperRef = React.useRef(null);\n var elementRef = React.useRef(null);\n var canRef = /*#__PURE__*/React.isValidElement(children) && supportRef(children);\n var mergedRef = useComposeRef(elementRef, canRef ? children.ref : null);\n var _React$useState = React.useState(null),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n target = _React$useState2[0],\n setTarget = _React$useState2[1];\n useMutateObserver(target, callback, options);\n\n // =========================== Effect ===========================\n // Bind target\n useLayoutEffect(function () {\n setTarget(findDOMNode(elementRef.current) || findDOMNode(wrapperRef.current));\n });\n\n // =========================== Render ===========================\n if (!children) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('MutationObserver need children props');\n }\n return null;\n }\n return /*#__PURE__*/React.createElement(DomWrapper, {\n ref: wrapperRef\n }, canRef ? /*#__PURE__*/React.cloneElement(children, {\n ref: mergedRef\n }) : children);\n};\nexport default MutateObserver;","map":{"version":3,"names":["_slicedToArray","React","useLayoutEffect","supportRef","useComposeRef","findDOMNode","useEvent","DomWrapper","useMutateObserver","MutateObserver","props","children","options","_props$onMutate","onMutate","callback","wrapperRef","useRef","elementRef","canRef","isValidElement","mergedRef","ref","_React$useState","useState","_React$useState2","target","setTarget","current","process","env","NODE_ENV","console","error","createElement","cloneElement"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@rc-component/mutate-observer/es/MutateObserver.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport React from 'react';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport findDOMNode from \"rc-util/es/Dom/findDOMNode\";\nimport useEvent from \"rc-util/es/hooks/useEvent\";\nimport DomWrapper from \"./wrapper\";\nimport useMutateObserver from \"./useMutateObserver\";\nvar MutateObserver = function MutateObserver(props) {\n var children = props.children,\n options = props.options,\n _props$onMutate = props.onMutate,\n onMutate = _props$onMutate === void 0 ? function () {} : _props$onMutate;\n var callback = useEvent(onMutate);\n var wrapperRef = React.useRef(null);\n var elementRef = React.useRef(null);\n var canRef = /*#__PURE__*/React.isValidElement(children) && supportRef(children);\n var mergedRef = useComposeRef(elementRef, canRef ? children.ref : null);\n var _React$useState = React.useState(null),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n target = _React$useState2[0],\n setTarget = _React$useState2[1];\n useMutateObserver(target, callback, options);\n\n // =========================== Effect ===========================\n // Bind target\n useLayoutEffect(function () {\n setTarget(findDOMNode(elementRef.current) || findDOMNode(wrapperRef.current));\n });\n\n // =========================== Render ===========================\n if (!children) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('MutationObserver need children props');\n }\n return null;\n }\n return /*#__PURE__*/React.createElement(DomWrapper, {\n ref: wrapperRef\n }, canRef ? /*#__PURE__*/React.cloneElement(children, {\n ref: mergedRef\n }) : children);\n};\nexport default MutateObserver;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,SAASC,UAAU,EAAEC,aAAa,QAAQ,gBAAgB;AAC1D,OAAOC,WAAW,MAAM,4BAA4B;AACpD,OAAOC,QAAQ,MAAM,2BAA2B;AAChD,OAAOC,UAAU,MAAM,WAAW;AAClC,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,IAAIC,cAAc,GA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