{"ast":null,"code":"\"use client\";\n\nimport React from 'react';\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nexport function pickClosable(context) {\n if (!context) {\n return undefined;\n }\n return {\n closable: context.closable,\n closeIcon: context.closeIcon\n };\n}\n/** Convert `closable` and `closeIcon` to config object */\nfunction useClosableConfig(closableCollection) {\n const {\n closable,\n closeIcon\n } = closableCollection || {};\n return React.useMemo(() => {\n if (\n // If `closable`, whatever rest be should be true\n !closable && (closable === false || closeIcon === false || closeIcon === null)) {\n return false;\n }\n if (closable === undefined && closeIcon === undefined) {\n return null;\n }\n let closableConfig = {\n closeIcon: typeof closeIcon !== 'boolean' && closeIcon !== null ? closeIcon : undefined\n };\n if (closable && typeof closable === 'object') {\n closableConfig = Object.assign(Object.assign({}, closableConfig), closable);\n }\n return closableConfig;\n }, [closable, closeIcon]);\n}\n/**\n * Assign object without `undefined` field. Will skip if is `false`.\n * This helps to handle both closableConfig or false\n */\nfunction assignWithoutUndefined() {\n const target = {};\n for (var _len = arguments.length, objList = new Array(_len), _key = 0; _key < _len; _key++) {\n objList[_key] = arguments[_key];\n }\n objList.forEach(obj => {\n if (obj) {\n Object.keys(obj).forEach(key => {\n if (obj[key] !== undefined) {\n target[key] = obj[key];\n }\n });\n }\n });\n return target;\n}\n/** Use same object to support `useMemo` optimization */\nconst EmptyFallbackCloseCollection = {};\nexport default function useClosable(propCloseCollection, contextCloseCollection) {\n let fallbackCloseCollection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EmptyFallbackCloseCollection;\n // Align the `props`, `context` `fallback` to config object first\n const propCloseConfig = useClosableConfig(propCloseCollection);\n const contextCloseConfig = useClosableConfig(contextCloseCollection);\n const mergedFallbackCloseCollection = React.useMemo(() => Object.assign({\n closeIcon: /*#__PURE__*/React.createElement(CloseOutlined, null)\n }, fallbackCloseCollection), [fallbackCloseCollection]);\n // Use fallback logic to fill the config\n const mergedClosableConfig = React.useMemo(() => {\n // ================ Props First ================\n // Skip if prop is disabled\n if (propCloseConfig === false) {\n return false;\n }\n if (propCloseConfig) {\n return assignWithoutUndefined(mergedFallbackCloseCollection, contextCloseConfig, propCloseConfig);\n }\n // =============== Context Second ==============\n // Skip if context is disabled\n if (contextCloseConfig === false) {\n return false;\n }\n if (contextCloseConfig) {\n return assignWithoutUndefined(mergedFallbackCloseCollection, contextCloseConfig);\n }\n // ============= Fallback Default ==============\n return !mergedFallbackCloseCollection.closable ? false : mergedFallbackCloseCollection;\n }, [propCloseConfig, contextCloseConfig, mergedFallbackCloseCollection]);\n // Calculate the final closeIcon\n return React.useMemo(() => {\n if (mergedClosableConfig === false) {\n return [false, null];\n }\n const {\n closeIconRender\n } = mergedFallbackCloseCollection;\n const {\n closeIcon\n } = mergedClosableConfig;\n let mergedCloseIcon = closeIcon;\n if (mergedCloseIcon !== null && mergedCloseIcon !== undefined) {\n // Wrap the closeIcon if needed\n if (closeIconRender) {\n mergedCloseIcon = closeIconRender(closeIcon);\n }\n // Wrap the closeIcon with aria props\n const ariaProps = pickAttrs(mergedClosableConfig, true);\n if (Object.keys(ariaProps).length) {\n mergedCloseIcon = /*#__PURE__*/React.isValidElement(mergedCloseIcon) ? ( /*#__PURE__*/React.cloneElement(mergedCloseIcon, ariaProps)) : ( /*#__PURE__*/React.createElement(\"span\", Object.assign({}, ariaProps), mergedCloseIcon));\n }\n }\n return [true, mergedCloseIcon];\n }, [mergedClosableConfig, mergedFallbackCloseCollection]);\n}","map":{"version":3,"names":["React","CloseOutlined","pickAttrs","pickClosable","context","undefined","closable","closeIcon","useClosableConfig","closableCollection","useMemo","closableConfig","Object","assign","assignWithoutUndefined","target","_len","arguments","length","objList","Array","_key","forEach","obj","keys","key","EmptyFallbackCloseCollection","useClosable","propCloseCollection","contextCloseCollection","fallbackCloseCollection","propCloseConfig","contextCloseConfig","mergedFallbackCloseCollection","createElement","mergedClosableConfig","closeIconRender","mergedCloseIcon","ariaProps","isValidElement","cloneElement"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/_util/hooks/useClosable.js"],"sourcesContent":["\"use client\";\n\nimport React from 'react';\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nexport function pickClosable(context) {\n if (!context) {\n return undefined;\n }\n return {\n closable: context.closable,\n closeIcon: context.closeIcon\n };\n}\n/** Convert `closable` and `closeIcon` to config object */\nfunction useClosableConfig(closableCollection) {\n const {\n closable,\n closeIcon\n } = closableCollection || {};\n return React.useMemo(() => {\n if (\n // If `closable`, whatever rest be should be true\n !closable && (closable === false || closeIcon === false || closeIcon === null)) {\n return false;\n }\n if (closable === undefined && closeIcon === undefined) {\n return null;\n }\n let closableConfig = {\n closeIcon: typeof closeIcon !== 'boolean' && closeIcon !== null ? closeIcon : undefined\n };\n if (closable && typeof closable === 'object') {\n closableConfig = Object.assign(Object.assign({}, closableConfig), closable);\n }\n return closableConfig;\n }, [closable, closeIcon]);\n}\n/**\n * Assign object without `undefined` field. Will skip if is `false`.\n * This helps to handle both closableConfig or false\n */\nfunction assignWithoutUndefined() {\n const target = {};\n for (var _len = arguments.length, objList = new Array(_len), _key = 0; _key < _len; _key++) {\n objList[_key] = arguments[_key];\n }\n objList.forEach(obj => {\n if (obj) {\n Object.keys(obj).forEach(key => {\n if (obj[key] !== undefined) {\n target[key] = obj[key];\n }\n });\n }\n });\n return target;\n}\n/** Use same object to support `useMemo` optimization */\nconst EmptyFallbackCloseCollection = {};\nexport default function useClosable(propCloseCollection, contextCloseCollection) {\n let fallbackCloseCollection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EmptyFallbackCloseCollection;\n // Align the `props`, `context` `fallback` to config object first\n const propCloseConfig = useClosableConfig(propCloseCollection);\n const contextCloseConfig = useClosableConfig(contextCloseCollection);\n const mergedFallbackCloseCollection = React.useMemo(() => Object.assign({\n closeIcon: /*#__PURE__*/React.createElement(CloseOutlined, null)\n }, fallbackCloseCollection), [fallbackCloseCollection]);\n // Use fallback logic to fill the config\n const mergedClosableConfig = React.useMemo(() => {\n // ================ Props First ================\n // Skip if prop is disabled\n if (propCloseConfig === false) {\n return false;\n }\n if (propCloseConfig) {\n return assignWithoutUndefined(mergedFallbackCloseCollection, contextCloseConfig, propCloseConfig);\n }\n // =============== Context Second ==============\n // Skip if context is disabled\n if (contextCloseConfig === false) {\n return false;\n }\n if (contextCloseConfig) {\n return assignWithoutUndefined(mergedFallbackCloseCollection, contextCloseConfig);\n }\n // ============= Fallback Default ==============\n return !mergedFallbackCloseCollection.closable ? false : mergedFallbackCloseCollection;\n }, [propCloseConfig, contextCloseConfig, mergedFallbackCloseCollection]);\n // Calculate the final closeIcon\n return React.useMemo(() => {\n if (mergedClosableConfig === false) {\n return [false, null];\n }\n const {\n closeIconRender\n } = mergedFallbackCloseCollection;\n const {\n closeIcon\n } = mergedClosableConfig;\n let mergedCloseIcon = closeIcon;\n if (mergedCloseIcon !== null && mergedCloseIcon !== undefined) {\n // Wrap the closeIcon if needed\n if (closeIconRender) {\n mergedCloseIcon = closeIconRender(closeIcon);\n }\n // Wrap the closeIcon with aria props\n const ariaProps = pickAttrs(mergedClosableConfig, true);\n if (Object.keys(ariaProps).length) {\n mergedCloseIcon = /*#__PURE__*/React.isValidElement(mergedCloseIcon) ? ( /*#__PURE__*/React.cloneElement(mergedCloseIcon, ariaProps)) : ( /*#__PURE__*/React.createElement(\"span\", Object.assign({}, ariaProps), mergedCloseIcon));\n }\n }\n return [true, mergedCloseIcon];\n }, [mergedClosableConfig, mergedFallbackCloseCollection]);\n}"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAOC,SAAS,MAAM,sBAAsB;AAC5C,OAAO,SAASC,YAAYA,CAACC,OAAO,EAAE;EACpC,IAAI,CAACA,OAAO,EAAE;IACZ,OAAOC,SAAS;EAClB;EACA,OAAO;IACLC,QAAQ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