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  CSSProperties,\n  memo,\n  ReactElement,\n  ReactNode,\n  SyntheticEvent,\n  useEffect,\n  useRef,\n  useState\n} from 'react';\nimport cc from 'classcat';\nimport { ZINDEX_HIGH_1 } from 'utils/constants/app/ui';\nimport SpringConfigs from 'utils/constants/swarm/spring-configs';\nimport { isMobile } from 'utils/is-mobile';\nimport { rand } from 'utils/swarm/rid-generator';\nimport { Portal } from 'components/Shared/Portal';\nimport './index.less';\n\ntype TModalProps = {\n  visible: boolean;\n  title?: ReactElement | string;\n  onCancel?: (e?: SyntheticEvent) => void;\n  width?: string | number;\n  wrapClassName: string;\n  className?: string;\n  centered?: boolean;\n  zIndex?: number;\n  style?: CSSProperties;\n  bodyStyle?: CSSProperties;\n  maskStyle?: CSSProperties;\n  maskClosable?: boolean;\n  mask?: boolean;\n  footer?: ReactElement | null;\n  closeIcon?: ReactNode;\n  renderCloseIconInMask?: boolean;\n  destroyOnClose?: boolean;\n  closable?: boolean;\n  afterClose?: () => void;\n  children: ReactNode;\n  contentPadding?: number | string;\n  maxWidth?: string | number;\n  hideBorder?: boolean;\n  getContainer?: string | false;\n  wrapperPadding?: string;\n  fullPage?: boolean;\n  placement?: 'top' | 'bottom' | 'left' | 'right' | undefined;\n  borderRadius?: string;\n  closeIconStyle?: CSSProperties;\n};\n\nif (SpringConfigs.IS_RTL) {\n  import('./rtl.less');\n}\n\nconst AFTER_CLOSE_DELAY = 300;\nconst MODAL_WRAPPER_PADDING = 24;\nconst MODAL_WRAPPER_MOBILE_PADDING = 12;\nconst randomNumberForAddBlocker = rand();\n\nexport const CustomModal = memo(\n  ({\n    visible,\n    title,\n    onCancel,\n    width,\n    wrapClassName,\n    zIndex,\n    style,\n    bodyStyle,\n    maskStyle,\n    maskClosable = true,\n    mask = true,\n    footer,\n    closeIcon,\n    destroyOnClose,\n    closable = true,\n    afterClose,\n    className,\n    contentPadding,\n    maxWidth,\n    hideBorder = true,\n    getContainer = false,\n    centered = true,\n    wrapperPadding,\n    fullPage,\n    placement,\n    borderRadius,\n    closeIconStyle,\n    renderCloseIconInMask = false,\n    children,\n    ...rest\n  }: TModalProps) => {\n    const [modalVisible, setModalVisible] = useState(visible);\n    const modalContainerRef = useRef<string | false>(getContainer);\n\n    useEffect(() => {\n      setModalVisible(visible);\n      modalContainerRef.current = getContainer || false;\n    }, [visible, getContainer]);\n\n    const handleClose = () => {\n      if (onCancel) {\n        onCancel();\n      } else {\n        closeModal();\n      }\n    };\n\n    const closeModal = () => {\n      if (destroyOnClose) {\n        setModalVisible(false);\n      }\n\n      if (afterClose && typeof afterClose === 'function') {\n        const timeout = setTimeout(() => {\n          afterClose();\n          clearTimeout(timeout);\n        }, AFTER_CLOSE_DELAY);\n      }\n    };\n\n    const handleMaskClick = () => {\n      if (maskClosable) {\n        handleClose();\n      }\n    };\n\n    const modalContent = (\n      <>\n        <div\n          {...rest}\n          className={cc([\n            'customModal',\n            {\n              visible: modalVisible,\n              customModal__notCentered: !centered,\n              customModal__left: placement === 'left',\n              customModal__right: placement === 'right',\n              customModal__top: placement === 'top',\n              customModal__bottom: placement === 'bottom'\n            },\n            `${randomNumberForAddBlocker}`\n          ])}\n          style={{ zIndex: zIndex ? zIndex : ZINDEX_HIGH_1, ...style }}\n        >\n          <div\n            className={cc([\n              'custom__modalContent',\n              {\n                [`${wrapClassName}`]: wrapClassName,\n                'custom__modalContent--mobile': isMobile()\n              }\n            ])}\n            style={{\n              width,\n              ...bodyStyle,\n              padding: `${contentPadding}px`,\n              maxWidth: `${maxWidth}${typeof maxWidth === 'string' ? '' : 'px'}`\n            }}\n          >\n            <div\n              className={className}\n              style={{\n                padding: wrapperPadding\n                  ? wrapperPadding\n                  : !isMobile()\n                  ? MODAL_WRAPPER_PADDING\n                  : MODAL_WRAPPER_MOBILE_PADDING,\n                border: `${\n                  hideBorder ? 'none' : '1px solid var(--v3-black-6)'\n                }`,\n                height: `${fullPage ? '100%' : 'unset'}`,\n                borderRadius: borderRadius\n                  ? borderRadius\n                  : 'var(--v3-border-radius-s)'\n              }}\n            >\n              {!renderCloseIconInMask && closable && (\n                <span\n                  style={closeIconStyle}\n                  className=\"custom__modalClose\"\n                  onClick={handleClose}\n                >\n                  {closeIcon}\n                </span>\n              )}\n              {!!title && (\n                <div className=\"custom__modalHeader\">\n                  <span>{title}</span>\n                </div>\n              )}\n              <div className=\"custom__modalBody\">{children}</div>\n              {footer}\n            </div>\n          </div>\n\n          {renderCloseIconInMask && closable && (\n            <span\n              style={closeIconStyle}\n              className=\"custom__modalClose\"\n              onClick={handleClose}\n            >\n              {closeIcon}\n            </span>\n          )}\n        </div>\n\n        {mask && (\n          <div\n            className={cc([\n              'custom__modalMask',\n              `${randomNumberForAddBlocker}`\n            ])}\n            style={maskStyle}\n            onClick={handleMaskClick}\n          />\n        )}\n      </>\n    );\n\n    return modalVisible ? (\n      <Portal rootId={modalContainerRef.current || ''}>{modalContent}</Portal>\n    ) : null;\n  }\n);\n"],"names":["SpringConfigs","IS_RTL","randomNumberForAddBlocker","rand","CustomModal","memo","_ref","visible","title","onCancel","width","wrapClassName","zIndex","style","bodyStyle","maskStyle","maskClosable","mask","footer","closeIcon","destroyOnClose","closable","afterClose","className","contentPadding","maxWidth","hideBorder","getContainer","centered","wrapperPadding","fullPage","placement","borderRadius","closeIconStyle","renderCloseIconInMask","children","rest","modalVisible","setModalVisible","useState","modalContainerRef","useRef","useEffect","current","handleClose","closeModal","timeout","setTimeout","clearTimeout","modalContent","_jsxs","_Fragment","cc","customModal__notCentered","customModal__left","customModal__right","customModal__top","customModal__bottom","ZINDEX_HIGH_1","_jsx","isMobile","padding","border","height","onClick","handleMaskClick","Portal","rootId"],"sourceRoot":""}