{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport classNames from 'classnames';\nimport CSSMotion, { CSSMotionList } from 'rc-motion';\nimport * as React from 'react';\nimport { useMemo } from 'react';\nimport initCollapseMotion from '../_util/motion';\nimport { FormItemPrefixContext } from './context';\nimport useDebounce from './hooks/useDebounce';\nimport useStyle from './style';\nconst EMPTY_LIST = [];\nfunction toErrorEntity(error, prefix, errorStatus) {\n  let index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n  return {\n    key: typeof error === 'string' ? error : `${prefix}-${index}`,\n    error,\n    errorStatus\n  };\n}\nconst ErrorList = _ref => {\n  let {\n    help,\n    helpStatus,\n    errors = EMPTY_LIST,\n    warnings = EMPTY_LIST,\n    className: rootClassName,\n    fieldId,\n    onVisibleChanged\n  } = _ref;\n  const {\n    prefixCls\n  } = React.useContext(FormItemPrefixContext);\n  const baseClassName = `${prefixCls}-item-explain`;\n  const [, hashId] = useStyle(prefixCls);\n  const collapseMotion = useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);\n  // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n  // ref: https://github.com/ant-design/ant-design/issues/36336\n  const debounceErrors = useDebounce(errors);\n  const debounceWarnings = useDebounce(warnings);\n  const fullKeyList = React.useMemo(() => {\n    if (help !== undefined && help !== null) {\n      return [toErrorEntity(help, 'help', helpStatus)];\n    }\n    return [].concat(_toConsumableArray(debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index))), _toConsumableArray(debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))));\n  }, [help, helpStatus, debounceErrors, debounceWarnings]);\n  const helpProps = {};\n  if (fieldId) {\n    helpProps.id = `${fieldId}_help`;\n  }\n  return /*#__PURE__*/React.createElement(CSSMotion, {\n    motionDeadline: collapseMotion.motionDeadline,\n    motionName: `${prefixCls}-show-help`,\n    visible: !!fullKeyList.length,\n    onVisibleChanged: onVisibleChanged\n  }, holderProps => {\n    const {\n      className: holderClassName,\n      style: holderStyle\n    } = holderProps;\n    return /*#__PURE__*/React.createElement(\"div\", Object.assign({}, helpProps, {\n      className: classNames(baseClassName, holderClassName, rootClassName, hashId),\n      style: holderStyle,\n      role: \"alert\"\n    }), /*#__PURE__*/React.createElement(CSSMotionList, Object.assign({\n      keys: fullKeyList\n    }, initCollapseMotion(prefixCls), {\n      motionName: `${prefixCls}-show-help-item`,\n      component: false\n    }), itemProps => {\n      const {\n        key,\n        error,\n        errorStatus,\n        className: itemClassName,\n        style: itemStyle\n      } = itemProps;\n      return /*#__PURE__*/React.createElement(\"div\", {\n        key: key,\n        className: classNames(itemClassName, {\n          [`${baseClassName}-${errorStatus}`]: errorStatus\n        }),\n        style: itemStyle\n      }, error);\n    }));\n  });\n};\nexport default ErrorList;","map":{"version":3,"names":["_toConsumableArray","classNames","CSSMotion","CSSMotionList","React","useMemo","initCollapseMotion","FormItemPrefixContext","useDebounce","useStyle","EMPTY_LIST","toErrorEntity","error","prefix","errorStatus","index","arguments","length","undefined","key","ErrorList","_ref","help","helpStatus","errors","warnings","className","rootClassName","fieldId","onVisibleChanged","prefixCls","useContext","baseClassName","hashId","collapseMotion","debounceErrors","debounceWarnings","fullKeyList","concat","map","warning","helpProps","id","createElement","motionDeadline","motionName","visible","holderProps","holderClassName","style","holderStyle","Object","assign","role","keys","component","itemProps","itemClassName","itemStyle"],"sources":["/Users/chrishaack/UC_Trains_Voice/react-demo/node_modules/antd/es/form/ErrorList.js"],"sourcesContent":["\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport classNames from 'classnames';\nimport CSSMotion, { CSSMotionList } from 'rc-motion';\nimport * as React from 'react';\nimport { useMemo } from 'react';\nimport initCollapseMotion from '../_util/motion';\nimport { FormItemPrefixContext } from './context';\nimport useDebounce from './hooks/useDebounce';\nimport useStyle from './style';\nconst EMPTY_LIST = [];\nfunction toErrorEntity(error, prefix, errorStatus) {\n  let index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n  return {\n    key: typeof error === 'string' ? error : `${prefix}-${index}`,\n    error,\n    errorStatus\n  };\n}\nconst ErrorList = _ref => {\n  let {\n    help,\n    helpStatus,\n    errors = EMPTY_LIST,\n    warnings = EMPTY_LIST,\n    className: rootClassName,\n    fieldId,\n    onVisibleChanged\n  } = _ref;\n  const {\n    prefixCls\n  } = React.useContext(FormItemPrefixContext);\n  const baseClassName = `${prefixCls}-item-explain`;\n  const [, hashId] = useStyle(prefixCls);\n  const collapseMotion = useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);\n  // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n  // ref: https://github.com/ant-design/ant-design/issues/36336\n  const debounceErrors = useDebounce(errors);\n  const debounceWarnings = useDebounce(warnings);\n  const fullKeyList = React.useMemo(() => {\n    if (help !== undefined && help !== null) {\n      return [toErrorEntity(help, 'help', helpStatus)];\n    }\n    return [].concat(_toConsumableArray(debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index))), _toConsumableArray(debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))));\n  }, [help, helpStatus, debounceErrors, debounceWarnings]);\n  const helpProps = {};\n  if (fieldId) {\n    helpProps.id = `${fieldId}_help`;\n  }\n  return /*#__PURE__*/React.createElement(CSSMotion, {\n    motionDeadline: collapseMotion.motionDeadline,\n    motionName: `${prefixCls}-show-help`,\n    visible: !!fullKeyList.length,\n    onVisibleChanged: onVisibleChanged\n  }, holderProps => {\n    const {\n      className: holderClassName,\n      style: holderStyle\n    } = holderProps;\n    return /*#__PURE__*/React.createElement(\"div\", Object.assign({}, helpProps, {\n      className: classNames(baseClassName, holderClassName, rootClassName, hashId),\n      style: holderStyle,\n      role: \"alert\"\n    }), /*#__PURE__*/React.createElement(CSSMotionList, Object.assign({\n      keys: fullKeyList\n    }, initCollapseMotion(prefixCls), {\n      motionName: `${prefixCls}-show-help-item`,\n      component: false\n    }), itemProps => {\n      const {\n        key,\n        error,\n        errorStatus,\n        className: itemClassName,\n        style: itemStyle\n      } = itemProps;\n      return /*#__PURE__*/React.createElement(\"div\", {\n        key: key,\n        className: classNames(itemClassName, {\n          [`${baseClassName}-${errorStatus}`]: errorStatus\n        }),\n        style: itemStyle\n      }, error);\n    }));\n  });\n};\nexport default ErrorList;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,IAAIC,aAAa,QAAQ,WAAW;AACpD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,OAAO,QAAQ,OAAO;AAC/B,OAAOC,kBAAkB,MAAM,iBAAiB;AAChD,SAASC,qBAAqB,QAAQ,WAAW;AACjD,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,OAAOC,QAAQ,MAAM,SAAS;AAC9B,MAAMC,UAAU,GAAG,EAAE;AACrB,SAASC,aAAaA,CAACC,KAAK,EAAEC,MAAM,EAAEC,WAAW,EAAE;EACjD,IAAIC,KAAK,GAAGC,SAAS,CAACC,MAAM,GAAG,CAAC,IAAID,SAAS,CAAC,CAAC,CAAC,KAAKE,SAAS,GAAGF,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;EACjF,OAAO;IACLG,GAAG,EAAE,OAAOP,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAI,GAAEC,MAAO,IAAGE,KAAM,EAAC;IAC7DH,KAAK;IACLE;EACF,CAAC;AACH;AACA,MAAMM,SAAS,GAAGC,IAAI,IAAI;EACxB,IAAI;IACFC,IAAI;IACJC,UAAU;IACVC,MAAM,GAAGd,UAAU;IACnBe,QAAQ,GAAGf,UAAU;IACrBgB,SAAS,EAAEC,aAAa;IACxBC,OAAO;IACPC;EACF,CAAC,GAAGR,IAAI;EACR,MAAM;IACJS;EACF,CAAC,GAAG1B,KAAK,CAAC2B,UAAU,CAACxB,qBAAqB,CAAC;EAC3C,MA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