{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport React, { useContext } from 'react';\nimport warning from '../_util/warning';\nimport ConfigProvider, { ConfigContext, globalConfig, warnContext } from '../config-provider';\nimport { unstableSetRender } from '../config-provider/UnstableContext';\nimport ConfirmDialog from './ConfirmDialog';\nimport destroyFns from './destroyFns';\nimport { getConfirmLocale } from './locale';\nlet defaultRootPrefixCls = '';\nfunction getRootPrefixCls() {\n return defaultRootPrefixCls;\n}\nconst ConfirmDialogWrapper = props => {\n var _a, _b;\n const {\n prefixCls: customizePrefixCls,\n getContainer,\n direction\n } = props;\n const runtimeLocale = getConfirmLocale();\n const config = useContext(ConfigContext);\n const rootPrefixCls = getRootPrefixCls() || config.getPrefixCls();\n // because Modal.config set rootPrefixCls, which is different from other components\n const prefixCls = customizePrefixCls || `${rootPrefixCls}-modal`;\n let mergedGetContainer = getContainer;\n if (mergedGetContainer === false) {\n mergedGetContainer = undefined;\n if (process.env.NODE_ENV !== 'production') {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'Modal', 'Static method not support `getContainer` to be `false` since it do not have context env.') : void 0;\n }\n }\n return /*#__PURE__*/React.createElement(ConfirmDialog, Object.assign({}, props, {\n rootPrefixCls: rootPrefixCls,\n prefixCls: prefixCls,\n iconPrefixCls: config.iconPrefixCls,\n theme: config.theme,\n direction: direction !== null && direction !== void 0 ? direction : config.direction,\n locale: (_b = (_a = config.locale) === null || _a === void 0 ? void 0 : _a.Modal) !== null && _b !== void 0 ? _b : runtimeLocale,\n getContainer: mergedGetContainer\n }));\n};\nexport default function confirm(config) {\n const global = globalConfig();\n if (process.env.NODE_ENV !== 'production' && !global.holderRender) {\n warnContext('Modal');\n }\n const container = document.createDocumentFragment();\n let currentConfig = Object.assign(Object.assign({}, config), {\n close,\n open: true\n });\n let timeoutId;\n let reactUnmount;\n function destroy(...args) {\n var _a;\n const triggerCancel = args.some(param => param === null || param === void 0 ? void 0 : param.triggerCancel);\n if (triggerCancel) {\n var _a2;\n (_a = config.onCancel) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [config, () => {}].concat(_toConsumableArray(args.slice(1))));\n }\n for (let i = 0; i < destroyFns.length; i++) {\n const fn = destroyFns[i];\n if (fn === close) {\n destroyFns.splice(i, 1);\n break;\n }\n }\n reactUnmount();\n }\n function render(props) {\n clearTimeout(timeoutId);\n /**\n * https://github.com/ant-design/ant-design/issues/23623\n *\n * Sync render blocks React event. Let's make this async.\n */\n timeoutId = setTimeout(() => {\n const rootPrefixCls = global.getPrefixCls(undefined, getRootPrefixCls());\n const iconPrefixCls = global.getIconPrefixCls();\n const theme = global.getTheme();\n const dom = /*#__PURE__*/React.createElement(ConfirmDialogWrapper, Object.assign({}, props));\n const reactRender = unstableSetRender();\n reactUnmount = reactRender(/*#__PURE__*/React.createElement(ConfigProvider, {\n prefixCls: rootPrefixCls,\n iconPrefixCls: iconPrefixCls,\n theme: theme\n }, global.holderRender ? global.holderRender(dom) : dom), container);\n });\n }\n function close(...args) {\n currentConfig = Object.assign(Object.assign({}, currentConfig), {\n open: false,\n afterClose: () => {\n if (typeof config.afterClose === 'function') {\n config.afterClose();\n }\n // @ts-ignore\n destroy.apply(this, args);\n }\n });\n // Legacy support\n if (currentConfig.visible) {\n delete currentConfig.visible;\n }\n render(currentConfig);\n }\n function update(configUpdate) {\n if (typeof configUpdate === 'function') {\n currentConfig = configUpdate(currentConfig);\n } else {\n currentConfig = Object.assign(Object.assign({}, currentConfig), configUpdate);\n }\n render(currentConfig);\n }\n render(currentConfig);\n destroyFns.push(close);\n return {\n destroy: close,\n update\n };\n}\nexport function withWarn(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'warning'\n });\n}\nexport function withInfo(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'info'\n });\n}\nexport function withSuccess(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'success'\n });\n}\nexport function withError(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'error'\n });\n}\nexport function withConfirm(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'confirm'\n });\n}\nexport function modalGlobalConfig({\n rootPrefixCls\n}) {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'Modal', 'Modal.config is deprecated. Please use ConfigProvider.config instead.') : void 0;\n defaultRootPrefixCls = rootPrefixCls;\n}","map":{"version":3,"names":["_toConsumableArray","React","useContext","warning","ConfigProvider","ConfigContext","globalConfig","warnContext","unstableSetRender","ConfirmDialog","destroyFns","getConfirmLocale","defaultRootPrefixCls","getRootPrefixCls","ConfirmDialogWrapper","props","_a","_b","prefixCls","customizePrefixCls","getContainer","direction","runtimeLocale","config","rootPrefixCls","getPrefixCls","mergedGetContainer","undefined","process","env","NODE_ENV","createElement","Object","assign","iconPrefixCls","theme","locale","Modal","confirm","global","holderRender","container","document","createDocumentFragment","currentConfig","close","open","timeoutId","reactUnmount","destroy","args","triggerCancel","some","param","_a2","onCancel","call","apply","concat","slice","i","length","fn","splice","render","clearTimeout","setTimeout","getIconPrefixCls","getTheme","dom","reactRender","afterClose","visible","update","configUpdate","push","withWarn","type","withInfo","withSuccess","withError","withConfirm","modalGlobalConfig"],"sources":["/Users/max_liu/max_liu/company/tools_auto_pt/node_modules/antd/es/modal/confirm.js"],"sourcesContent":["\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport React, { useContext } from 'react';\nimport warning from '../_util/warning';\nimport ConfigProvider, { ConfigContext, globalConfig, warnContext } from '../config-provider';\nimport { unstableSetRender } from '../config-provider/UnstableContext';\nimport ConfirmDialog from './ConfirmDialog';\nimport destroyFns from './destroyFns';\nimport { getConfirmLocale } from './locale';\nlet defaultRootPrefixCls = '';\nfunction getRootPrefixCls() {\n return defaultRootPrefixCls;\n}\nconst ConfirmDialogWrapper = props => {\n var _a, _b;\n const {\n prefixCls: customizePrefixCls,\n getContainer,\n direction\n } = props;\n const runtimeLocale = getConfirmLocale();\n const config = useContext(ConfigContext);\n const rootPrefixCls = getRootPrefixCls() || config.getPrefixCls();\n // because Modal.config set rootPrefixCls, which is different from other components\n const prefixCls = customizePrefixCls || `${rootPrefixCls}-modal`;\n let mergedGetContainer = getContainer;\n if (mergedGetContainer === false) {\n mergedGetContainer = undefined;\n if (process.env.NODE_ENV !== 'production') {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'Modal', 'Static method not support `getContainer` to be `false` since it do not have context env.') : void 0;\n }\n }\n return /*#__PURE__*/React.createElement(ConfirmDialog, Object.assign({}, props, {\n rootPrefixCls: rootPrefixCls,\n prefixCls: prefixCls,\n iconPrefixCls: config.iconPrefixCls,\n theme: config.theme,\n direction: direction !== null && direction !== void 0 ? direction : config.direction,\n locale: (_b = (_a = config.locale) === null || _a === void 0 ? void 0 : _a.Modal) !== null && _b !== void 0 ? _b : runtimeLocale,\n getContainer: mergedGetContainer\n }));\n};\nexport default function confirm(config) {\n const global = globalConfig();\n if (process.env.NODE_ENV !== 'production' && !global.holderRender) {\n warnContext('Modal');\n }\n const container = document.createDocumentFragment();\n let currentConfig = Object.assign(Object.assign({}, config), {\n close,\n open: true\n });\n let timeoutId;\n let reactUnmount;\n function destroy(...args) {\n var _a;\n const triggerCancel = args.some(param => param === null || param === void 0 ? void 0 : param.triggerCancel);\n if (triggerCancel) {\n var _a2;\n (_a = config.onCancel) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [config, () => {}].concat(_toConsumableArray(args.slice(1))));\n }\n for (let i = 0; i < destroyFns.length; i++) {\n const fn = destroyFns[i];\n if (fn === close) {\n destroyFns.splice(i, 1);\n break;\n }\n }\n reactUnmount();\n }\n function render(props) {\n clearTimeout(timeoutId);\n /**\n * https://github.com/ant-design/ant-design/issues/23623\n *\n * Sync render blocks React event. Let's make this async.\n */\n timeoutId = setTimeout(() => {\n const rootPrefixCls = global.getPrefixCls(undefined, getRootPrefixCls());\n const iconPrefixCls = global.getIconPrefixCls();\n const theme = global.getTheme();\n const dom = /*#__PURE__*/React.createElement(ConfirmDialogWrapper, Object.assign({}, props));\n const reactRender = unstableSetRender();\n reactUnmount = reactRender(/*#__PURE__*/React.createElement(ConfigProvider, {\n prefixCls: rootPrefixCls,\n iconPrefixCls: iconPrefixCls,\n theme: theme\n }, global.holderRender ? global.holderRender(dom) : dom), container);\n });\n }\n function close(...args) {\n currentConfig = Object.assign(Object.assign({}, currentConfig), {\n open: false,\n afterClose: () => {\n if (typeof config.afterClose === 'function') {\n config.afterClose();\n }\n // @ts-ignore\n destroy.apply(this, args);\n }\n });\n // Legacy support\n if (currentConfig.visible) {\n delete currentConfig.visible;\n }\n render(currentConfig);\n }\n function update(configUpdate) {\n if (typeof configUpdate === 'function') {\n currentConfig = configUpdate(currentConfig);\n } else {\n currentConfig = Object.assign(Object.assign({}, currentConfig), configUpdate);\n }\n render(currentConfig);\n }\n render(currentConfig);\n destroyFns.push(close);\n return {\n destroy: close,\n update\n };\n}\nexport function withWarn(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'warning'\n });\n}\nexport function withInfo(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'info'\n });\n}\nexport function withSuccess(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'success'\n });\n}\nexport function withError(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'error'\n });\n}\nexport function withConfirm(props) {\n return Object.assign(Object.assign({}, props), {\n type: 'confirm'\n });\n}\nexport function modalGlobalConfig({\n rootPrefixCls\n}) {\n process.env.NODE_ENV !== \"production\" ? warning(false, 'Modal', 'Modal.config is deprecated. Please use ConfigProvider.config instead.') : void 0;\n defaultRootPrefixCls = rootPrefixCls;\n}"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,cAAc,IAAIC,aAAa,EAAEC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC7F,SAAS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