dcp-design-react 1.10.18 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/lib/form/src/form.d.ts +2 -1
  2. package/lib/form/src/types.d.ts +5 -1
  3. package/lib/index.d.ts +4 -0
  4. package/lib/index.esm.js +1 -1
  5. package/lib/index.full.js +1 -1
  6. package/lib/index.js +1 -1
  7. package/lib/locale/lang/en.d.ts +4 -0
  8. package/lib/locale/lang/en.js +5 -1
  9. package/lib/locale/lang/zh-cn.d.ts +4 -0
  10. package/lib/locale/lang/zh-cn.js +5 -1
  11. package/lib/pivot-grid/index.d.ts +3 -0
  12. package/lib/pivot-grid/src/config/index.d.ts +9 -0
  13. package/lib/pivot-grid/src/grid-layout/Body.d.ts +3 -0
  14. package/lib/pivot-grid/src/grid-layout/Context.d.ts +20 -0
  15. package/lib/pivot-grid/src/grid-layout/CountPanel.d.ts +7 -0
  16. package/lib/pivot-grid/src/grid-layout/Footer.d.ts +3 -0
  17. package/lib/pivot-grid/src/grid-layout/GroupCard.d.ts +10 -0
  18. package/lib/pivot-grid/src/grid-layout/Header.d.ts +3 -0
  19. package/lib/pivot-grid/src/grid-layout/List.d.ts +7 -0
  20. package/lib/pivot-grid/src/grid-layout/ResizeBar.d.ts +7 -0
  21. package/lib/pivot-grid/src/grid-layout/index.d.ts +3 -0
  22. package/lib/pivot-grid/src/main/Context.d.ts +39 -0
  23. package/lib/pivot-grid/src/main/index.d.ts +3 -0
  24. package/lib/pivot-grid/src/main/types.d.ts +8 -0
  25. package/lib/pivot-grid/src/top-bar/FieldsPanel.d.ts +3 -0
  26. package/lib/pivot-grid/src/top-bar/FilterPanel.d.ts +3 -0
  27. package/lib/pivot-grid/src/top-bar/GroupPanel.d.ts +3 -0
  28. package/lib/pivot-grid/src/top-bar/LineHeightPanel.d.ts +3 -0
  29. package/lib/pivot-grid/src/top-bar/SearchPanel.d.ts +3 -0
  30. package/lib/pivot-grid/src/top-bar/SorterPanel.d.ts +3 -0
  31. package/lib/pivot-grid/src/top-bar/ViewMode.d.ts +3 -0
  32. package/lib/pivot-grid/src/top-bar/index.d.ts +3 -0
  33. package/lib/pivot-grid/src/utils/index.d.ts +2 -0
  34. package/lib/pivot-grid/style/grid-layout.less +234 -0
  35. package/lib/pivot-grid/style/index.less +10 -0
  36. package/lib/pivot-grid/style/main.less +43 -0
  37. package/lib/pivot-grid/style/top-bar.less +105 -0
  38. package/lib/pivot-grid/style/variable.less +9 -0
  39. package/lib/style/index.css +436 -3
  40. package/lib/style/index.less +2 -1
  41. package/lib/style/index.min.css +1 -1
  42. package/lib/table/src/body/DraggableTr.d.ts +26 -0
  43. package/lib/table/src/body/dragUtils.d.ts +43 -0
  44. package/lib/table/src/body/useDragSort.d.ts +24 -0
  45. package/lib/table/src/context/index.d.ts +1 -0
  46. package/lib/table/src/hooks/useTableMemo.d.ts +1 -0
  47. package/lib/table/src/pivot-grid/index.d.ts +7 -0
  48. package/lib/table/src/table/props.d.ts +3 -1
  49. package/lib/table/src/table/types.d.ts +6 -1
  50. package/lib/table/src/toolbox/index.d.ts +1 -0
  51. package/lib/table/style/body.less +103 -77
  52. package/lib/table/style/index.less +31 -30
  53. package/lib/table/style/pivot-grid.less +19 -0
  54. package/package.json +1 -1
package/lib/index.full.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={442:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};n.r(a),n.d(a,{Affix:()=>P.Affix,Alert:()=>P.Alert,Anchor:()=>P.Anchor,AutoComplete:()=>P.AutoComplete,Avatar:()=>P.Avatar,BackTop:()=>P.BackTop,Badge:()=>P.Badge,Breadcrumb:()=>P.Breadcrumb,Button:()=>P.Button,Calendar:()=>L,Card:()=>P.Card,Carousel:()=>P.Carousel,Cascader:()=>P.Cascader,Checkbox:()=>P.Checkbox,Col:()=>P.Col,Collapse:()=>P.Collapse,Comment:()=>P.Comment,ConfigProvider:()=>P.ConfigProvider,DatePicker:()=>H,DcpAnchor:()=>Gt,DcpButton:()=>fe,DcpCollapse:()=>Fe,DcpConfigProvider:()=>U,DcpCopyToClipboard:()=>Nc,DcpCountup:()=>lt,DcpCropper:()=>co,DcpDivider:()=>Ce,DcpDownload:()=>$t,DcpDrawer:()=>rr,DcpEmpty:()=>ct,DcpForm:()=>Ml,DcpGuideTracker:()=>fu,DcpLazyLoad:()=>Eu,DcpModal:()=>cr,DcpPrint:()=>Wd,DcpRangeTableHelper:()=>ad,DcpScrollbar:()=>It,DcpSearchHelper:()=>Bc,DcpSearchTree:()=>No,DcpSignature:()=>_u,DcpSpace:()=>ye,DcpSpin:()=>ut,DcpSplit:()=>tt,DcpTable:()=>Vc,DcpTabs:()=>Jt,DcpTinymce:()=>io,DcpTour:()=>Cd,DcpTransition:()=>Pd,DcpTreeHelper:()=>Jc,DcpTreeTableHelper:()=>Qc,DcpUploadFile:()=>uo,DcpUploadImg:()=>fo,DcpWatermark:()=>gu,Descriptions:()=>P.Descriptions,Divider:()=>P.Divider,Drawer:()=>P.Drawer,Dropdown:()=>P.Dropdown,Empty:()=>P.Empty,Form:()=>P.Form,Grid:()=>P.Grid,Image:()=>P.Image,Input:()=>P.Input,InputNumber:()=>P.InputNumber,Layout:()=>P.Layout,List:()=>P.List,Mentions:()=>P.Mentions,Menu:()=>P.Menu,Modal:()=>P.Modal,PageHeader:()=>P.PageHeader,Pagination:()=>P.Pagination,Popconfirm:()=>P.Popconfirm,Popover:()=>P.Popover,Progress:()=>P.Progress,QmAnchor:()=>Gt,QmButton:()=>fe,QmCollapse:()=>Fe,QmConfigProvider:()=>U,QmCopyToClipboard:()=>Nc,QmCountup:()=>lt,QmCropper:()=>co,QmDivider:()=>Ce,QmDownload:()=>$t,QmDrawer:()=>rr,QmEmpty:()=>ct,QmForm:()=>Ml,QmGuideTracker:()=>fu,QmLazyLoad:()=>Eu,QmModal:()=>cr,QmPrint:()=>Wd,QmRangeTableHelper:()=>ad,QmScrollbar:()=>It,QmSearchHelper:()=>Bc,QmSearchTree:()=>No,QmSignature:()=>_u,QmSpace:()=>ye,QmSpin:()=>ut,QmSplit:()=>tt,QmTable:()=>Vc,QmTabs:()=>Jt,QmTinymce:()=>io,QmTour:()=>Cd,QmTransition:()=>Pd,QmTreeHelper:()=>Jc,QmTreeTableHelper:()=>Qc,QmUploadFile:()=>uo,QmUploadImg:()=>fo,QmWatermark:()=>gu,Radio:()=>P.Radio,Rate:()=>P.Rate,Result:()=>P.Result,Row:()=>P.Row,Segmented:()=>P.Segmented,Select:()=>P.Select,Skeleton:()=>P.Skeleton,Slider:()=>P.Slider,Space:()=>P.Space,Spin:()=>P.Spin,Statistic:()=>P.Statistic,Steps:()=>P.Steps,Switch:()=>P.Switch,Table:()=>P.Table,Tabs:()=>P.Tabs,Tag:()=>P.Tag,TimePicker:()=>q,Timeline:()=>P.Timeline,Tooltip:()=>P.Tooltip,Transfer:()=>P.Transfer,Tree:()=>P.Tree,TreeSelect:()=>P.TreeSelect,Typography:()=>P.Typography,Upload:()=>P.Upload,message:()=>P.message,notification:()=>P.notification,pinyin:()=>Gn,version:()=>Du});var i=n(442),l=n.n(i);const o=(0,i.createContext)({locale:"zh-cn",size:"middle"}),s=require("dayjs");var c=n.n(s);const d={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let u=d;function p(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const m=(...e)=>{const[t,r]=e;let n;const a=t.split(".");let i=u;for(let e=0,t=a.length;e<t;e++){if(n=i[a[e]],e===t-1)return p(n,r);if(!n)return"";i=n}return""},h=(e,t)=>({...e,...Object.keys(t).reduce(((r,n)=>(r[n]=void 0!==t[n]?t[n]:e[n],r)),{})}),f=(e,t)=>{const r=i.useRef(!0);i.useLayoutEffect((()=>e(r.current)),t),i.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function g(e,t){f((t=>{if(!t)return e()}),t)}const b=require("dayjs/plugin/localeData");var y=n.n(b);const x=require("dayjs/plugin/advancedFormat");var v=n.n(x);const E=require("dayjs/plugin/customParseFormat");var S=n.n(E);const w=require("dayjs/plugin/quarterOfYear");var C=n.n(w);const N=require("dayjs/plugin/weekOfYear");var I=n.n(N);const T=require("dayjs/plugin/weekday");var R=n.n(T);c().extend(y()),c().extend(v()),c().extend(S()),c().extend(C()),c().extend(I()),c().extend(R());const P=require("antd"),O=require("rc-picker/es/generate/dayjs");var k=n.n(O);const A=require("antd/es/calendar/generateCalendar"),L=n.n(A)()(k()),F=require("antd/es/date-picker/generatePicker"),H=n.n(F)()(k());function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_.apply(null,arguments)}const D=i.forwardRef(((e,t)=>i.createElement(H,_({},e,{picker:"time",mode:void 0,ref:t}))));D.displayName="TimePicker";const $=i.forwardRef(((e,t)=>i.createElement(H.RangePicker,_({},e,{picker:"time",mode:void 0,ref:t}))));$.displayName="RangePicker",D.RangePicker=$;const q=D,M={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel Merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},K=require("antd/es/locale/zh_CN");var V=n.n(K);const j=require("antd/es/locale/en_GB");var z=n.n(j);const B={[M.name]:{qm:M,antd:z()},[d.name]:{qm:d,antd:V()}},W=e=>{const t=h({locale:"zh-cn",size:"middle"},e),{locale:r,size:n,global:a}=t;l().useMemo((()=>{return e=Object.assign({},B,a?.langPackage)[r].qm,u=e||u,void(u.name&&c().locale(u.name));var e}),[r]);const i=l().useMemo((()=>Object.assign({},B,a?.langPackage)),[a]),[s,d]=l().useState({locale:r,size:n,global:a});return g((()=>{d((e=>Object.assign({},e,{locale:r,size:n})))}),[n,r]),l().createElement(o.Provider,{value:s},l().createElement(P.ConfigProvider,{locale:i[s.locale].antd,componentSize:s.size,autoInsertSpaceInButton:a?.autoInsertSpaceInButton},t.children))};W.displayName="QmConfigProvider";const U=W;function G(){const{locale:e}=i.useContext(o);return{t:m,$locale:e}}function Y(e){const t=i.useRef();return t.current=e,i.useCallback(((...e)=>t.current?.(...e)),[])}function X(e){const{size:t}=i.useContext(o);return{$size:i.useMemo((()=>e.size??t??""),[e.size,t])}}const Q=require("lodash-es"),Z="undefined"==typeof window,J=e=>l().isValidElement(e),ee=e=>J(e)&&e.type===l().Fragment,te=()=>{},re=()=>!0,ne=async e=>new Promise((t=>setTimeout(t,e))),ae=e=>{Promise.resolve().then(e)},ie=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),le=e=>!!(!e&&0!==e||(0,Q.isArray)(e)&&!e.length||(0,Q.isPlainObject)(e)&&!Object.keys(e).length),oe=(e,t)=>{const r={...e};for(const e of t)delete r[e];return r},se=(e,t=new WeakMap)=>{if((0,Q.isPlainObject)(e)||(0,Q.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(r,i){let l=-1;const o=r.length;for(;++l<o;)s=r[l],c=l,a&&(c=s),n[c]=se(e[c],t);var s,c}(a||e),n}return e},ce=e=>(0,Q.isNumber)(e)?`${e}px`:e.toString();class de extends Error{constructor(e){super(e),this.name="QmDesignError"}}function ue(e,t){throw new de(`[${e}] ${t}`)}function pe(e,t){console.warn(new de(`[${e}] ${t}`))}function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},me.apply(null,arguments)}const he=e=>{const{loading:t,shortcutKey:r,authConfig:n,click:a,confirm:i}=e,{t:o}=G(),{$size:s}=X(e);l().useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=l().useState(!1),u=Y((e=>{const t=r.split("+").map((e=>e.trim().toLowerCase())),n=t.includes("alt"),a=t.includes("ctrl"),i=t.includes("shift"),l=t[t.length-1];n&&!e.altKey||a&&!e.ctrlKey||i&&!e.shiftKey||e.key.toLowerCase()!==l||(e.preventDefault(),m.disabled||m.onClick?.(e))})),p=(0,Q.isFunction)(a)?{onClick:async t=>{d(!0);try{await(e.click?.(t))}catch(e){pe("Button","`click`方法执行出错")}d(!1)}}:null,m={...oe(e,["shortcutKey","authConfig","click","confirm"]),size:s,loading:c||t||!1,...p};if(n){const{visible:e=1,disabled:t}=n||{};if(!e)return null;t&&(m.disabled=!0)}const h=l().createElement(P.Button,m,e.children);return i?l().createElement(P.Popconfirm,{title:i.title||o("qm.button.confirmTitle"),disabled:m.disabled,onConfirm:e=>{i.onConfirm?.(),m.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},l().createElement(P.Button,me({},m,{onClick:te}),e.children)):!r||m.disabled?h:l().createElement(P.Tooltip,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},h)};he.displayName="QmButton";const fe=he;var ge=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ge||{});const be=e=>{const{$size:t}=X(e),r=(0,Q.isNumber)(e.size)?e.size:ge[t||"default"],n={...oe(e,["size"]),size:r};return l().createElement(P.Space,n,e.children)};be.displayName="QmSpace";const ye=be,xe=require("classnames");var ve=n.n(xe);const Ee=e=>`qm-${e}`,Se=require("@ant-design/icons"),we=e=>{const{label:t,extra:r,collapse:n,bordered:a=!0,disabled:i,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=X(e),{t:p}=G(),m=Ee("divider"),h={[m]:!0,[`${m}-borderless`]:!a,[`${m}--lg`]:"large"===u,[`${m}--sm`]:"small"===u};return l().createElement("div",{id:o,className:ve()(h,s),style:c},l().createElement("span",{className:`${m}__title`},t),l().createElement("div",{className:`${m}__extra`},r),void 0!==n&&l().createElement(P.Button,{type:"link",className:`${m}__collapse`,disabled:i,onClick:()=>{d?.(!n)}},p(n?"qm.divider.collect":"qm.divider.spread"),n?l().createElement(Se.UpOutlined,null):l().createElement(Se.DownOutlined,null)))};we.displayName="QmDivider";const Ce=we,Ne=()=>({height:0,opacity:0}),Ie=(e,t)=>"height"===t.propertyName,Te={motionName:"rc-collapse-motion",onEnterStart:Ne,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Ne,onEnterEnd:Ie,onLeaveEnd:Ie,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Re=require("rc-motion");var Pe=n.n(Re);const Oe=l().forwardRef(((e,t)=>{const{forceRender:r,className:n,style:a,boxStyle:i,isActive:o}=e,[s,c]=l().useState(o||r);if(l().useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=Ee("collapse");return l().createElement("div",{ref:t,className:ve()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},n),style:a},l().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));Oe.displayName="PanelContent";const ke=Oe;function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ae.apply(null,arguments)}const Le=e=>{const{defaultActive:t,label:r,extra:n,className:a,style:i,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[m,h]=l().useState(!!t),f=Ee("collapse"),g=ve()({[`${f}`]:!0,[`${f}-active`]:m,[`${f}-disabled`]:c},a);return l().createElement("div",{className:g,style:i},l().createElement(Ce,{label:r,extra:n,collapse:m,bordered:s,disabled:c,onCollapseChange:e=>{h(e),p?.(e)}}),l().createElement(Pe(),Ae({visible:m},Te,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),(({className:t,style:r},n)=>l().createElement(ke,{ref:n,prefixCls:f,className:t,style:r,boxStyle:o,isActive:m,forceRender:d},e.children))))};Le.displayName="QmCollapse";const Fe=Le,He=l().createContext(void 0);function _e(e,t){((t,r)=>{const n=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(n.current)),r),i.useEffect((()=>(n.current=!1,()=>{n.current=!0})),[])})(0,t)}const De=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},$e=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},qe=e=>e.preventDefault(),Me=(e,t)=>{if(Z||!e||!t)return null;"float"===(t=ie(t))&&(t="cssFloat");try{const r=e.style[t];if(r)return r;const n=window.getComputedStyle(e);return n?n[t]:""}catch(r){return e.style[t]}},Ke=(e,t,r)=>{!Z&&e&&t&&((0,Q.isPlainObject)(t)?Object.keys(t).forEach((r=>{Ke(e,r,t[r])})):(t=ie(t),e.style[t]=r))},Ve=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},je=(e,t)=>Math.abs(Ve(e)-Ve(t)),ze=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Be=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},We=(e,t)=>{if(Z||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Ue=e=>Math.pow(e,3),Ge=e=>e<.5?Ue(2*e)/2:1-Ue(2*(1-e))/2,Ye=e=>{const{minValues:t,onDragChange:r,onDragging:n}=e,{splitRef:a,direction:i}=l().useContext(He),{t:o}=G(),s=l().useRef(Z?null:document.onselectstart),c=l().useMemo((()=>"horizontal"===i),[i]),d=l().useMemo((()=>c?"X":"Y"),[c]),u=l().useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),p=e=>{u.current=Object.assign({},u.current,e)},m=e=>{if(1!==e.buttons)return h();const r=e[`page${d}`]-u.current[`start${d}`],a=[t[0],u.current[`containerSize${d}`]-t[1]];let i=u.current[`firstElementSize${d}`]+r;i=Math.max(a[0],i),i=Math.min(a[1],i),n(i)},h=()=>{p({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),$e(document,"mousemove",m),$e(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g=Ee("split"),b={[`${g}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return l().createElement("div",{className:ve()(b),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,n=t.children[0];p({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),De(document,"mousemove",m),De(document,"mouseup",h),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Ye.displayName="ResizeBar";const Xe=Ye,Qe=l().forwardRef(((e,t)=>{const{offset:r,className:n,style:a}=e,{direction:i,dragging:o}=l().useContext(He),s="vertical"===i?"height":"width",c=Ee("split-pane"),d={[c]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[n]:!!n},u=void 0!==r?{[s]:ce(r)}:{flex:1,[s]:0};return l().createElement("div",{ref:t,className:ve()(d),style:{...u,...a}},e.children)}));Qe.displayName="SplitPane";const Ze=Qe;function Je(){return Je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Je.apply(null,arguments)}const et=e=>{const{direction:t="horizontal",defaultValue:r="50%",uniqueKey:n,className:a,style:i,onDragStart:s,onDrag:c=te,onDragEnd:d}=e,{global:u}=l().useContext(o),p=l().useRef(null),m=l().useRef(null),h=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=l().useMemo((()=>n?`split_${n}`:""),[n]),[y,x]=l().useState(!1),[v,E]=l().useState(h(r));_e((()=>{y?s?.(f(v)):(d?.(f(v)),localStorage.setItem(b,v),C(b,v))}),[y]),l().useEffect((()=>{S()}),[]);const S=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(h(e)):w(b).then((e=>{localStorage.setItem(b,h(e||r)),S()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},C=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},N=l().useMemo((()=>({splitRef:p,direction:t,dragging:y})),[t,y]),I=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"SplitPane"===e.type?.displayName&&I.push(e)}));const[T,R]=I,P=l().useMemo((()=>[g(T),g(R)]),[T,R]),O=Ee("split"),k={[O]:!0,vertical:"vertical"===t};return l().createElement(He.Provider,{value:N},l().createElement("div",{ref:p,className:ve()(k,a),style:i},l().createElement(Ze,Je({},T.props,{ref:m,offset:v})),l().createElement(Xe,{minValues:P,onDragChange:e=>x(e),onDragging:e=>{E(`${e}px`),c(e)}}),l().createElement(Ze,R.props)))};et.displayName="QmSplit",et.Pane=Ze;const tt=et,rt=require("react-countup");var nt=n.n(rt);function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},at.apply(null,arguments)}const it=e=>{const{className:t,style:r}=e,{$size:n}=X(e),a=Ee("countup"),i={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return l().createElement(nt(),at({},e,{className:ve()(i,t),style:r}),e.children)};it.displayName="QmCountup";const lt=it;function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ot.apply(null,arguments)}const st=e=>{const{className:t}=e,{$size:r}=X(e),n=Ee("empty"),a={...e,image:P.Empty.PRESENTED_IMAGE_SIMPLE},i={[n]:!0,[`${n}--lg`]:"large"===r,[`${n}--sm`]:"small"===r};return l().createElement(P.Empty,ot({},a,{className:ve()(i,t)}))};st.displayName="QmEmpty";const ct=st,dt=e=>{const t=h({tip:"Loading..."},e),{fullHeight:r,className:n,style:a}=t,i=Ee("spin"),o={[i]:!0,[`${i}-fullHeight`]:!!r},s={wrapperClassName:ve()(o,n),...oe(t,["fullHeight"]),style:{...a,maxHeight:"none"}};return l().createElement(P.Spin,s,t.children)};dt.displayName="QmSpin";const ut=dt,pt=l().createContext(void 0),mt=require("resize-observer-polyfill");var ht=n.n(mt);const ft=new Map,gt=new(ht())((function(e){e.forEach((e=>{const{target:t}=e;ft.get(t)?.forEach((e=>e(t)))}))}));function bt(e,t){ft.has(e)||(ft.set(e,new Set),gt.observe(e)),ft.get(e).add(t)}function yt(e,t){ft.has(e)&&(ft.get(e).delete(t),ft.get(e).size||(gt.unobserve(e),ft.delete(e)))}function xt(e){const[t,r]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,n=e=>{r({width:e.offsetWidth,height:e.offsetHeight})};return t&&bt(t,n),()=>{t&&yt(t,n)}}),[e]),t}function vt(e,t){const r=i.useRef(null);return i.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]),i.useCallback(((...n)=>{r.current&&clearTimeout(r.current),r.current=setTimeout((()=>e.apply(this,n)),t)}),[e,t])}const Et=6,St={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},wt=e=>{const{thumb:t,always:r,className:n,barSize:a=Et,direction:i="vertical",onDrag:o=te}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=l().useContext(pt),u=St[i],p=l().useRef(t),m=l().useRef(null),h=l().useRef(null),f=l().useRef({}),g=l().useRef(!1),b=l().useRef(!1),y=l().useRef(Z?null:document.onselectstart),[x,v]=l().useState(!1);l().useLayoutEffect((()=>{p.current=t}),[t]),l().useEffect((()=>{const e=c.current;return De(e,"mousemove",C),De(e,"mouseleave",N),()=>{w(),$e(document,"mouseup",S),$e(e,"mousemove",C),$e(e,"mouseleave",N)}}),[]);const E=e=>{if(!m.current||!h.current)return;if(!g.current)return;const t=f.current[u.axis];if(!t)return;const r=100*(-1*(m.current.getBoundingClientRect()[u.direction]-e[u.client])-(h.current[u.offset]-t))/m.current[u.offset];d.current[u.scroll]=r*d.current[u.scrollSize]/100,o(!0)},S=()=>{g.current=!1,f.current={[u.axis]:0},$e(document,"mousemove",E),$e(document,"mouseup",S),w(),b.current&&v(!1),o(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},C=()=>{b.current=!1,v(!!p.current.size)},N=()=>{b.current=!0,v(g.current)},I=Ee("scrollbar"),T={[`${I}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},R={[u.reverse]:a},P={[u.size]:t.size,transform:`translate${u.axis}(${t.offset}%)`};return l().createElement(Pd,{name:"fade",in:r||s||x,timeout:300},l().createElement("div",{ref:m,className:ve()(T,n),style:R},l().createElement("div",{ref:h,className:`${I}__thumb`,style:P,onMouseDown:e=>{e.stopPropagation(),De(document,"mousemove",E),De(document,"mouseup",S),g.current=!0,y.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(f.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},Ct=20,Nt=l().forwardRef(((e,t)=>{const{wrapClassName:r,wrapStyle:n,barWidth:a,always:i,native:o,showTopScrollbar:s,minSize:c=Ct,onScroll:d}=e,u=l().useRef(null),p=l().useRef(null),m=l().useRef(null),[h,f]=l().useState({size:0,offset:0,ratio:1}),[b,y]=l().useState({size:0,offset:0,ratio:1}),[x,v]=l().useState(!1),E=xt(u),S=xt(m);g((()=>{!o&&w()}),[S.width,S.height,E.width,E.height]);const w=vt((()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,r=e**2/p.current.scrollHeight,n=t**2/p.current.scrollWidth,a=Math.max(r,c),i=Math.max(n,c),l=r/(e-r)/(a/(e-a)),o=n/(t-n)/(i/(t-i)),s=a+4<e?a:0,d=i+4<t?i:0,u=100*p.current.scrollTop/e*l,m=100*p.current.scrollLeft/t*o;f(Object.assign({},h,{size:d,ratio:o,offset:m})),y(Object.assign({},b,{size:s,ratio:l,offset:u}))}),5),C=e=>{v(e)},N=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-r)/500;l<1?(e.scrollTop=n+(t-n)*Ge(l),a(i)):e.scrollTop=t};a(i)})(p.current,e):p.current.scrollTop=e:pe("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},I=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-r)/500;l<1?(e.scrollLeft=n+(t-n)*Ge(l),a(i)):e.scrollLeft=t};a(i)})(p.current,e):p.current.scrollLeft=e:pe("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};l().useImperativeHandle(t,(()=>({container:u.current,scrollTop:p.current?.scrollTop||0,scrollLeft:p.current?.scrollLeft||0,SET_SCROLL_TOP:N,SET_SCROLL_LEFT:I})));const T=l().useMemo((()=>({dragging:x,scrollbarElement:u,wrapElement:p})),[x]),R=Ee("scrollbar"),P={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!o};return l().createElement("div",{ref:u,className:ve()(R,e.className),style:e.style},l().createElement("div",{ref:p,className:ve()(P,r),style:n,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,r=100*p.current.scrollTop/e*b.ratio,n=100*p.current.scrollLeft/t*h.ratio;f(Object.assign({},h,{offset:n})),y(Object.assign({},b,{offset:r}))})(),d?.({scrollTop:t,scrollLeft:r})}},l().createElement("div",{ref:m,className:`${R}__view`},e.children)),!o&&l().createElement(pt.Provider,{value:T},s&&l().createElement(wt,{className:"top",direction:"horizontal",thumb:h,barSize:a,always:i,onDrag:C}),l().createElement(wt,{direction:"horizontal",thumb:h,barSize:a,always:i,onDrag:C}),l().createElement(wt,{direction:"vertical",thumb:b,barSize:a,always:i,onDrag:C})))}));Nt.displayName="QmScrollbar";const It=Nt,Tt=require("sortablejs");var Rt=n.n(Tt);const Pt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ot.apply(null,arguments)}const kt=async(e,{fileName:t,headers:r,params:n})=>{const a=n?new URLSearchParams(n).toString():"",i=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${i+a}`,{method:"GET",headers:r});if(!l.ok)throw new Error(m("qm.download.error"));const o=await l.blob(),s=l.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Pt(o,c)},At=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Lt=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Ft=e=>{const t=h({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:r=[],fileDirection:n="vertical",batchDownload:a,draggable:i,editable:o,disabled:s,readOnly:c,button:d={},className:u,onPreview:p,onSortChange:m,onEditChange:f,onDownload:g,onChange:b}=t,{t:y}=G(),{$size:x}=X(t),v=l().useRef(null),E=l().useRef(null),[S,w]=l().useState({}),C=l().useMemo((()=>s||c),[s,c]);l().useEffect((()=>(T(),()=>E.current?.destroy())),[]);const N=(e,t)=>{w((r=>Object.assign({},r,{[e]:t??!r[e]})))},I=Y((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[a]=e.splice(t,1);e.splice(n,0,a),m?.(e),b?.({file:r[t],fileList:e})}})),T=()=>{i&&(E.current=Rt().create(Be(v.current,Ee("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:I}))},R=async e=>{if(g)return void await g(e);const{downloadWithHeaders:r,headers:n}=t;try{e.url&&await kt(e.url,{fileName:e.name,...r?{headers:n}:null})}catch(e){P.message.error(y("qm.download.error"))}},O=Ee("upload-file"),k={[O]:!0,[`${O}--lg`]:"large"===x,[`${O}--sm`]:"small"===x,[`${O}--horizontal`]:"horizontal"===n};return l().createElement(P.Upload,Ot({className:ve()(k,u)},oe(t,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,r)=>new Promise((async(n,a)=>{const{fileTypes:i=[],fileSize:l,maxCount:o,fileList:s=[],beforeUpload:c}=t,d=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!l||e.size/1024/1024<l,p=!(o>1)||s.length<o,m=d&&u&&p;if(d||P.message.warning(y("qm.upload.tooltip",{type:i.join(",")})),u||P.message.warning(y("qm.upload.sizeLimit",{size:l})),p||P.message.warning(y("qm.upload.countLimit",{count:o})),!m)return P.Upload.LIST_IGNORE;if(c){const t=c(e,r);if(!0===t)return n(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{n(await t)}catch(e){a(e)}}else n(e)})),disabled:C,onChange:b,onPreview:async e=>{if("function"==typeof p)return p(e,(t=>R(t||e)));s||await R(e)},onDownload:async e=>{await R(e)},itemRender:(e,n,a,c)=>((e,n)=>{const{iconRender:a}=t,{uid:c,name:d,url:u,status:p="done"}=e,m="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return l().createElement("div",{className:ve()("ant-upload-list-item",`ant-upload-list-item-${p}`,"ant-upload-list-item-list-type-text",{handle:i})},l().createElement("div",{className:"ant-upload-list-item-info"},l().createElement("span",{className:"ant-upload-span"},l().createElement("div",{className:"ant-upload-text-icon"},a?a(e):l().createElement(Se.LinkOutlined,null)),l().createElement("div",{className:"ant-upload-list-item-name"},S[c]?l().createElement(P.Input,{size:"small",autoFocus:!0,defaultValue:At(d),onBlur:t=>{const{value:n}=t.target;if(n!==At(d)){const t=Object.assign({},e,{name:`${n}.${Lt(d)}`}),a=r.map((e=>e.uid!==c?e:t));f?.(t,a),b?.({file:t,fileList:a})}N(c,!1)}}):l().createElement("a",{rel:"noreferrer",target:"_blank",title:d,href:u,onClick:e=>{e.preventDefault(),o?C||N(c,!0):n.preview()}},d)),l().createElement("span",{className:"ant-upload-list-item-card-actions"},o&&!C&&l().createElement("button",{type:"button",className:m,onClick:()=>N(c)},S[c]?l().createElement(Se.CheckOutlined,null):l().createElement(Se.EditOutlined,null)),o&&l().createElement("button",{type:"button",className:ve()(m,"preview"),onClick:()=>n.preview()},l().createElement(Se.EyeOutlined,null)),l().createElement("button",{type:"button",className:ve()(m,"download"),disabled:s,onClick:()=>n.download()},l().createElement(Se.DownloadOutlined,null)),l().createElement("button",{type:"button",className:ve()(m,"delete"),disabled:C,onClick:()=>n.remove()},l().createElement(Se.DeleteOutlined,null))))))})(n,c)}),l().createElement("span",{className:"inner",ref:v},t.children||c&&r.length?t.children:l().createElement(P.Button,{type:d.type??"default",icon:d.icon??l().createElement(Se.UploadOutlined,null),disabled:C},d.text||y("qm.upload.text")),a&&!!r.length&&l().createElement(P.Button,{disabled:s,style:{marginLeft:8},onClick:async e=>{if(e.stopPropagation(),"function"==typeof a)await a(r);else for(const e of r)await R(e)}},y("qm.upload.batchDownload"))))};Ft.displayName="QmUploadFile";const Ht=Ft;function _t(){return _t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_t.apply(null,arguments)}const Dt=e=>{const t=h({icon:l().createElement(Se.DownloadOutlined,null),withCredentials:!1},e),{$size:r}=X(t),{t:n}=G(),[a,i]=l().useState(!1),o=oe(t,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return l().createElement(P.Button,_t({},o,{size:r,loading:a,onClick:async()=>{i(!0);try{const{action:e,fileName:r,headers:a,params:i,beforeDownload:l=re,onSuccess:o}=t,s=(0,Q.isString)(e)?e:await(async()=>{const e=t.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""})();if(!s)return pe("Download","参数 `action` 有误!");if(!l(s))return;await kt(s,{fileName:r,headers:a,params:i}),await ne(100),o?.(),P.message.success(n("qm.download.success"))}catch(e){t.onError?.(e),P.message.error(n("qm.download.error"))}i(!1)}}),t.children||n("qm.download.text"))};Dt.displayName="QmDownload";const $t=Dt,qt=require("add-dom-event-listener");var Mt=n.n(qt);const Kt=require("scroll-into-view-if-needed");var Vt=n.n(Kt);function jt(e,t){const r=i.useRef(null),n=i.useRef(0);return i.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]),i.useCallback(((...r)=>{const a=Date.now();(!n.current||a-n.current>t)&&(e.apply(this,r),n.current=a)}),[e,t])}const zt=e=>{const{activeKey:t,labels:r,onTabClick:n}=e;return l().createElement(l().Fragment,null,r.map(((e,r)=>{const a={item:!0,actived:r===t};return l().createElement("div",{key:r,className:ve()(a),onClick:e=>n(r,e)},l().createElement("span",null,e))})))},Bt=e=>{const{label:t,showDivider:r,className:n,style:a}=e,i=Ee("anchor-item"),o={[i]:!0};return l().createElement("div",{className:ve()(o,n),style:a},r&&l().createElement(Ce,{label:t,style:{marginBottom:10}}),e.children)};Bt.displayName="AnchorItem";const Wt=Bt,Ut=l().forwardRef(((e,t)=>{const{labelList:r=[],defaultActiveIndex:n,labelWidth:a,tabPosition:i="left",onTabClick:o,className:s,style:c}=e,{$size:d}=X(e),u=l().useRef(null),p=l().useRef(),m=l().useRef("ready"),h=l().useRef(0),[f,g]=l().useState(n||0),b=l().useMemo((()=>!!r?.length),[r]);l().useEffect((()=>{y();const e=Mt()(u.current,"scroll",v);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=je(x(f),u.current))},x=e=>b?document.getElementById(r[e].id):u.current.children[e],v=jt((e=>{if("ready"!==m.current)return;const t=(e=>{const t=Math.abs(e),n=(b?r.map((e=>document.getElementById(e.id))):Array.from(u.current?.children||[])).map((e=>je(e,u.current)));let a=-1;for(let e=0;e<n.length;e++){const r=n[e],i=n[e+1]||1e4;t>=r-1&&t<i&&(a=e)}return a})(e.target.scrollTop);-1!==t&&g(t)}),60),E=e=>{const t=x(e);t&&(g(e),m.current="stop",p.current&&clearTimeout(p.current),Vt()(t,{block:"start",behavior:"smooth",boundary:u.current}),p.current=setTimeout((()=>m.current="ready"),500))};l().useImperativeHandle(t,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>h.current?h.current:e,E(e)}})));const S=Ee("anchor"),w={[S]:!0,[`${S}-left`]:"left"===i,[`${S}-top`]:"top"===i,[`${S}--lg`]:"large"===d,[`${S}--sm`]:"small"===d},C=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"AnchorItem"===e.type?.displayName&&C.push(e)}));const N=b?r.map((e=>e.label)):C.map((e=>e.props.label)),I=b?r.map((e=>e.id)):C.map(((e,t)=>e.props["data-id"]||t.toString()));return h.current=N.length,l().createElement("div",{className:ve()(w,s),style:c},l().createElement("div",{className:ve()("anchor-nav"),style:{width:a?ce(a):""}},l().createElement(zt,{activeKey:f,labels:N,onTabClick:(e,t)=>{E(e),o?.({label:N[e],id:I[e]},t)}})),l().createElement("div",{ref:u,className:ve()("anchor-container")},b?e.children:C))}));Ut.displayName="QmAnchor",Ut.Item=Wt;const Gt=Ut,Yt=e=>l().createElement(P.Tabs.TabPane,e,e.children);Yt.displayName="TabPane";const Xt=Yt;function Qt(){return Qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qt.apply(null,arguments)}const Zt=e=>{const t=h({tabPosition:"top"},e),{items:r,tabPosition:n,tabBarGutter:a,className:i,authConfig:o}=t,{$size:s}=X(t),c=Ee("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u={...oe(t,["items","authConfig"]),size:s,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},p=[];l().Children.map(t.children,(e=>{J(e)&&!ee(e)&&"TabPane"===e.type?.displayName&&p.push(e)}));const m=r?[...r]:p.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<m.length;t++){const r=m[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(m.splice(t,1),t--)}}return l().createElement(P.Tabs,Qt({},u,{items:m,className:ve()(d,i)}))};Zt.displayName="QmTabs",Zt.TabPane=Xt;const Jt=Zt;function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},er.apply(null,arguments)}const tr=l().forwardRef(((e,t)=>{const r=h({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:n,open:a,className:i,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:p,onClose:m,onClosed:f,onFullChange:g}=r,{global:b}=l().useContext(o),{$size:y}=X(r),x=l().useRef(null),v=l().useRef(null),E=l().useRef(!1),[S,w]=l().useState(!1),[C,N]=l().useState(!1),[I,T]=l().useState(!1);_e((()=>{(a??n)&&(!p&&E.current||(0,Q.isUndefined)(s)&&N(!0))}),[a??n]),_e((()=>{v.current&&Ke(v.current,S?{width:"100%"}:{width:ce(r.width||"72%")})}),[S]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=Ee("drawer"),O={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===y,[`${R}--sm`]:"small"===y};return l().createElement(P.Drawer,er({},oe(r,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:u??b?.maskClosable??!1,className:ve()(O,i),title:l().createElement(l().Fragment,null,l().createElement("span",{ref:x,className:"text"},c&&r.title),d&&l().createElement("button",{type:"button",className:"full-screen",onClick:()=>{v.current=Be(x.current,"ant-drawer-content-wrapper"),w(!S),g?.(!S)}},l().createElement(S?Se.FullscreenExitOutlined:Se.FullscreenOutlined))),footer:null,afterOpenChange:e=>{e?(E.current=!0,(0,Q.isUndefined)(s)&&setTimeout((()=>N(!1)),100)):(w(!1),f?.())},onClose:m}),r.children,(s||I||C)&&l().createElement(ut,{spinning:!0,className:ve()("spinning")}))}));tr.displayName="QmDrawer";const rr=tr,nr=require("react-draggable");var ar=n.n(nr);function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ir.apply(null,arguments)}const lr="10vh";var or=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(or||{});const sr=l().forwardRef(((e,t)=>{const r=h({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:lr}},e),{visible:n,open:a,width:i,height:s,className:c,loading:d,draggable:u,showHeader:p,showFullScreen:m,maskClosable:f,destroyOnClose:g,bodyStyle:b,onFullChange:y,onClose:x,onClosed:v}=r,{global:E}=l().useContext(o),{$size:S}=X(r),w=l().createRef(),C=l().useRef(!1),N=l().useMemo((()=>`calc(100vh - ${lr} - ${lr} - ${or[p?S:"none"]}px)`),[S,p]),[I,T]=l().useState(!1),[R,O]=l().useState(!1),[k,A]=l().useState(!1),[L,F]=l().useState(!0),[H,_]=l().useState({left:0,top:0,bottom:0,right:0}),[D,$]=l().useState();_e((()=>{if(a??n){if(!g&&C.current||(0,Q.isUndefined)(d)&&O(!0),!g&&C.current)return;setTimeout((()=>{C.current=!0,(0,Q.isUndefined)(d)&&O(!1)}),400)}}),[a??n]),_e((()=>{$(I?{x:0,y:0}:void 0)}),[I]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>A(!0),STOP_LOADING:()=>A(!1)})));const q=Ee("modal"),M={height:s?ce(s):N,maxHeight:"auto"===s?N:"",overflow:"auto"},K={[q]:!0,"no-header":!p,[`${q}--lg`]:"large"===S,[`${q}--sm`]:"small"===S};return l().createElement(P.Modal,ir({},oe(r,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:a??n,maskClosable:f??E?.maskClosable??!1,className:ve()(K,c),title:l().createElement("div",{onMouseOver:()=>{L&&F(!1)},onMouseOut:()=>{F(!0)}},l().createElement("span",{className:"text"},p&&r.title),m&&l().createElement("button",{type:"button",className:"full-screen",onClick:e=>{const t=Be(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body");I?(Ke(t,{width:ce(i||"60%"),height:"auto",top:lr}),Ke(r,{height:s?ce(s):N,maxHeight:"auto"===s?N:""})):(Ke(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Ke(r,{height:`calc(100vh - ${or[p?S:"none"]}px)`,maxHeight:""})),T(!I),y?.(!I)}},l().createElement(I?Se.FullscreenExitOutlined:Se.FullscreenOutlined))),footer:null,bodyStyle:Object.assign({},M,b),onCancel:x,afterClose:()=>{v?.(),T(!1)},modalRender:e=>l().createElement(ar(),{nodeRef:w,bounds:H,position:D,disabled:!u||L||I,onStart:(e,t)=>((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=w.current.getBoundingClientRect();a&&_({left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1})})(0,t)},l().createElement("div",{ref:w},e))}),r.children,(d||k||R)&&l().createElement(ut,{spinning:!0,className:ve()("spinning")}))}));sr.displayName="QmModal";const cr=sr,dr=require("memoize-one");var ur=n.n(dr);const pr=(0,i.createContext)(void 0),mr=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],hr={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)mr.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e,t=" "){return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},fr=["==","<",">","<=",">=","!=","like","likes","in","nin"],gr=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)fr.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),fr.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},br=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,yr=["string","number","boolean","symbol"],xr=e=>yr.includes(typeof e),vr=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Er=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(br,"\\$1"),"i");window.__query__=(...e)=>((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Er(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Er(t))));break;case"in":xr(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":xr(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(vr(e)?e.slice(0,10):e)!=r;break;case"<":n=(vr(e)?e.slice(0,10):e)<r;break;case"<=":n=(vr(e)?e.slice(0,10):e)<=r;break;case">":n=(vr(e)?e.slice(0,10):e)>r;break;case">=":n=(vr(e)?e.slice(0,10):e)>=r;break;default:n=(vr(e)?e.slice(0,10):e)==r}return n})(e[0],e[1],e[2]);const Sr=hr.stringify,wr=hr.array_format,Cr=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},Nr=(e,t,r)=>{let n=[];t=hr.replace_symbols(t);try{if(r){const r=new Function("record",`return ${gr(t,"record")};`);n=on(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${gr(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){pe("Table","组件 `initialFilter` 参数有误!"),n=e}return n},Ir=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Ir(e.children)):t.push(e)})),t},Tr=e=>e.filter((e=>(e.children&&(e.children=Tr(e.children)),!e.hidden&&!e.noAuth))),Rr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Rr(e.children))})),t},Pr=(e,t)=>e.map((e=>(e.children&&(e.children=Pr(e.children,t)),t?.(e),e))),Or=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Or(r.children,t);if(e)return e}}return null},kr=e=>{const t=e.children;return t?t[0].children?kr(t[0]):t[0]:e},Ar=e=>{const t=e.children;return t?t[t.length-1].children?Ar(t[t.length-1]):t[t.length-1]:e},Lr=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Fr=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Fr(r.children,t);if(e)return e}}return null},Hr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Hr(e.children))})),t},_r=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Rr(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},Dr=(e,t)=>{const r=[];return e.forEach((e=>{r.push(e),t(e)&&r.push(...Dr(e.children,t))})),r},$r=e=>Object.assign(e,{__prevent__:!0}),qr=e=>{delete e.__prevent__},Mr=(e,t,r={left:0,top:0})=>{if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Mr(e.offsetParent,t,r)}return r},Kr=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Vr=(e,t)=>(0,Q.transform)(e,((e,r,n)=>{(0,Q.isEqual)(r,t[n])||(e[n]=(0,Q.isPlainObject)(r)&&(0,Q.isPlainObject)(t[n])?Vr(r,t[n]):r)})),jr=(e,t)=>(0,Q.get)(e,t)??"",zr=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,Q.set)(e,t,r??"")},Br=(e,t)=>{if(!t.includes("|"))return jr(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(jr(e,t))})),r.every((e=>!e))?"":r.join(" | ")},Wr=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Ur=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},Gr=(e,t)=>{const r=e.toString();if(!Wr(r)||0===t)return e;const n=Number.parseFloat(r).toString(),a=n.indexOf(".");if(-1===a)return n+"."+"0".repeat(t);const i=Math.max(0,t-(n.length-a-1));return n+"0".repeat(i)},Yr=(e,t)=>e?c()(e,t):null,Xr=(e,t)=>e?c()(e).format(t):"",Qr=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Zr=e=>{const t=[];if(l().isValidElement(e)){const{children:r}=e.props;l().Children.forEach(r,(e=>{t.push(...Zr(e))}))}else t.push(e);return t},Jr=e=>Zr(e).join(""),en=e=>e.filter((e=>!e._group)),tn=(e,t=!1)=>{let r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const l=Array.isArray(i.condition)?wr(i.condition):Sr(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],l=e[n];for(const e in l)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?wr(l[e]):Sr(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},rn=(e=[],t=[])=>{const r={};return e.forEach((e=>{const n=JSON.stringify((e=>{const r=[];return t.forEach((t=>r.push(jr(e,t)))),r})(e));r[n]=r[n]||[],r[n].push(e)})),Object.keys(r).map((e=>r[e]))},nn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=nn(e[r].children,t);if(n)return[e[r],n].flat()}}},an=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=an(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},ln=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=ln(r.children,t);if(e)return e}if(t(r))return r}return null},on=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&on(e.children,t),t(e)||e.children&&e.children.length))),sn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),cn=require("prop-types");var dn=n.n(cn);const un=e=>["","small","middle","large"].includes(e),pn=80,mn="1",hn="0",fn=400,gn=["RANGE_INPUT","RANGE_INPUT_NUMBER","RANGE_SEARCH_HELPER","MULTIPLE_CHECKBOX","MULTIPLE_SELECT","RANGE_DATE","RANGE_TIME","MULTIPLE_TREE_SELECT","MULTIPLE_SEARCH_HELPER","MULTIPLE_TREE_TABLE_HELPER","MULTIPLE_CASCADER","UPLOAD_IMG","UPLOAD_FILE"],bn={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let yn=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),xn=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),vn=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const En={items:dn().arrayOf(dn().shape({type:dn().string.isRequired,fieldName:dn().string.isRequired})),initialValues:dn().object,initialExtras:dn().object,layout:dn().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!un(e[t]||""))return ue("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:dn().number,customClass:dn().string,compactMode:dn().bool,labelWidth:dn().oneOfType([dn().number,dn().string]),labelAlign:dn().oneOf(["left","right"]),labelWrap:dn().bool,formType:dn().oneOf(["default","search","onlyShow"]),disabled:dn().bool,uniqueKey:dn().string,defaultRows:dn().number,defaultExpand:dn().bool,searchButtonCols:dn().number,scrollToFirstError:dn().bool,authConfig:dn().object,isAutoFocus:dn().bool,isCollapse:dn().bool,isFieldsDefine:dn().bool,isSearchBtn:dn().bool,isSubmitBtn:dn().bool,fieldsChange:dn().func,onValuesChange:dn().func,onFieldsChange:dn().func,onFinish:dn().func,onFinishFailed:dn().func,onReset:dn().func,onCollapse:dn().func},Sn={layout:"horizontal",labelWidth:pn,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:te,onFieldsChange:te,onFinish:te,onFinishFailed:te,onReset:te,onCollapse:te},wn=(e,t)=>{if(!e)return null;if(t===xn.week){const t=e.match(/^(\d{4})-(\d+)/);return t?c()().year(Number(t[1])).week(Number(t[2])):null}if(t===xn.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?c()().year(Number(t[1])).quarter(Number(t[2])):null}return c()(e,t)},Cn=(e,t)=>e?c()(e).format(t):"",Nn=e=>""===e||null==e,In=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},Tn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Rn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Pn=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),(0,Q.isUndefined)(e.isLeaf)||(n.isLeaf=!!e.isLeaf),(0,Q.isUndefined)(e.selectable)||(n.selectable=!!e.selectable),Array.isArray(e.children)&&(n.children=Pn(e.children,t,r)),n})),On=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=On(r.children,t);if(e)return e}}return null},kn=(e,t,r=0)=>{const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...kn(e.children,t,r+1))})),n},An=e=>J(e)||"string"==typeof e,Ln=e=>J(e)?Zr(e).join(""):e??"",Fn=(e,t,r,n)=>{const a={};return a.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Hn={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{曾:"ZENG",沈:"SHEN",嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬤:"MO",嬷:"MO",蹒:"PAN",蹊:"XI",丬:"PAN",霰:"XIAN",莘:"XIN",豉:"CHI",饧:"XING",筠:"JUN",长:"CHANG",帧:"ZHEN",峙:"SHI",郍:"NA",芎:"XIONG",谁:"SHUI"}},_n="阿",Dn="鿿",$n=1,qn=2,Mn=3;let Kn,Vn=null;function jn(e){return e||null===Vn?("object"==typeof Intl&&Intl.Collator?(Kn=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Vn=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Vn=!1,Vn):Vn}function zn(e){const t=Hn.UNIHANS,r=Hn.PINYINS,n=Hn.EXCEPTIONS,a={source:e};if(e in n)return a.type=qn,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=$n,a.target=e,a;if(i=Kn.compare(e,_n),i<0)return a.type=Mn,a.target=e,a;if(0===i)a.type=qn,l=0;else{if(i=Kn.compare(e,Dn),i>0)return a.type=Mn,a.target=e,a;0===i&&(a.type=qn,l=t.length-1)}if(a.type=qn,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=Kn.compare(e,a),0===i)break;i>0?r=l+1:n=l-1}}return i<0&&l--,a.target=r[l],a.target||(a.type=Mn,a.target=a.source),a}function Bn(e){return"string"==typeof e&&jn()?e.split("").map((e=>zn(e))):e}const Wn={isSupported:jn,parse:Bn,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Hn)})))},genToken:zn,convertToPinyin:(e,t,r)=>Bn(e).map((e=>t&&e.type===qn?e.target.toLowerCase():e.target)).join(r||"")},Un={patcher:function(e){e.EXCEPTIONS={嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬷:"MO",蹊:"XI",丬:"PAN",霰:"XIAN",豉:"CHI",饧:"XING",帧:"ZHEN",芎:"XIONG",谁:"SHUI",钶:"KE"},e.UNIHANS[91]="伕",e.UNIHANS[347]="仚",e.UNIHANS[393]="诌",e.UNIHANS[39]="婤",e.UNIHANS[50]="腠",e.UNIHANS[369]="攸",e.UNIHANS[123]="乯",e.UNIHANS[171]="刕",e.UNIHANS[102]="佝",e.UNIHANS[126]="犿",e.UNIHANS[176]="列",e.UNIHANS[178]="刢",e.UNIHANS[252]="娝",e.UNIHANS[330]="偸"},shouldPatch:function(e){return"function"==typeof e&&"FOU"===e("伕").target&&"XIA"===e("仚").target&&"ZHONG"===e("诌").target&&"CHONG"===e("婤").target&&"CONG"===e("腠").target&&"YONG"===e("攸").target&&"HOU"===e("乯").target&&"LENG"===e("刕").target&&"GONG"===e("佝").target&&"HUAI"===e("犿").target&&"LIAO"===e("列").target&&"LIN"===e("刢").target&&"E"===e("钶").target}};Wn.isSupported()&&Un.shouldPatch(Wn.genToken)&&Wn.patchDict(Un);const Gn=Wn,Yn=e=>{const{value:t,bordered:r}=e;return l().createElement(P.Input,{value:t,title:t,bordered:r,readOnly:!0})};Yn.displayName="FormItemView";const Xn=Yn;function Qn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zn.apply(null,arguments)}const{Option:Jn}=P.Select,ea=e=>{const{$$form:t}=l().useContext(pr),{value:r,items:n,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=G(),{fieldName:d,options:u={},style:p={},placeholder:m=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:b,onClear:y}=e.option,{itemList:x=[],filterable:v=!0,listHeight:E=fn,collapseTags:S,maxTagTextLength:w,dropdownStyle:C,openPyt:N=!0}=u,I=le(x)?n:x,T=e=>I.find((t=>t.value===e))?.text||e?.toString()||"",R=e=>a?e?.map((e=>T(e))).join(",")||"":T(e);return t.isOnlyShow?l().createElement(Xn,{value:R(r),bordered:h}):l().createElement(P.Select,Zn({value:r,mode:a?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:C,placeholder:m,style:p,loading:i,bordered:h,allowClear:f,disabled:b,showSearch:v,listHeight:E,maxTagCount:S?"responsive":void 0,maxTagTextLength:w},a?{title:R(r)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,R(e),I)})(e)},onClear:y}),I.map((e=>l().createElement(Jn,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ta extends i.Component{constructor(...e){super(...e),Qn(this,"context",void 0),Qn(this,"state",{itemList:[],loading:!1}),Qn(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:m,validateTrigger:h,rules:f=[],onChange:g=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:ve()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(f)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(ea,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(o,r)}}))),m&&l().createElement(P.Col,null,e.renderFormItemButton(o,m)),p&&l().createElement(P.Col,{flex:ce(p.labelWidth||pn)},e.renderFormItemExtra({fieldName:o,...p}))))}}Qn(ta,"contextType",pr);const ra=ta;function na(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const aa=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=hn,trueValue:m=mn}=o,{t:h}=G();return l().createElement(P.Checkbox,{checked:r===m,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{n?.(e),a(e,h(e===m?"am.form.trueText":"am.form.falseText"))})(t?m:p)}},u?i:null)};class ia extends i.Component{constructor(...e){super(...e),na(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option,{labelToCheckbox:h}=o;return l().createElement(P.Form.Item,{label:h?" ":e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(aa,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}na(ia,"contextType",pr);const la=ia,oa=require("react-sortablejs"),sa=e=>{const{uniqueKey:t,items:r,fieldsChange:n}=e,{global:a}=l().useContext(o),{$$form:i}=l().useContext(pr),{$size:s}=X(e),{t:c}=G(),d=l().useRef(null),[u,p]=l().useState(!1),m=l().useMemo((()=>t?`form_${t}`:""),[t]);l().useLayoutEffect((()=>{f()}),[]);const h=e=>{if(!m)return;const t=e.map((e=>{const t={};return(0,Q.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(m));(0,Q.isEqual)(t,r)||(localStorage.setItem(m,JSON.stringify(t)),(async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(m,t))},f=()=>{const e=(()=>{if(!m)return;const e=JSON.parse(localStorage.getItem(m));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(m).then((e=>{e?(localStorage.setItem(m,JSON.stringify(e)),f()):a?.getComponentConfigApi&&h(r)})).catch((()=>{})),e?(0,Q.xor)(e.map((e=>e.fieldName)),r.map((e=>e.fieldName))).length>0?r.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,Q.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...r.find((t=>t.fieldName===e.fieldName)),...e}))):void 0})();e&&g(e)},g=e=>{n?.([...e])},b=Ee("form-fields-filter"),y={[b]:!0,[`${b}--lg`]:"large"===s,[`${b}--sm`]:"small"===s};return l().createElement(P.Dropdown,{open:u,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:ve()("ant-dropdown-menu","fields-list")},l().createElement("div",{className:"reset"},l().createElement(fe,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||se(e);return Object.assign(t,{hidden:e.hidden})}));g(t),h(t)})(i.getOriginItems())},c("qm.table.columnFilter.reset"))),l().createElement(oa.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));if((0,Q.isEqual)(t,n))return;i.setExpandHandle(!0);const a=sn(e);g(a),h(a)}},r.map((e=>l().createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},l().createElement(P.Checkbox,{disabled:e.rules?.findIndex((e=>e.required))>-1,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,g(r),h(r)}}),l().createElement(Se.HolderOutlined,{className:"handle",title:c("qm.form.draggable")}),l().createElement("span",{className:"title"},i.getFormItemLabel(e.label))))))),overlayClassName:ve()(y),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>d.current,onOpenChange:e=>{p(e)}},l().createElement("a",{ref:d,style:{padding:"5px 0"}},l().createElement(Se.UnorderedListOutlined,null)))};sa.displayName="FieldsFilter";const ca=sa;function da(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ua=l().forwardRef(((e,t)=>{const{$$form:r}=l().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{t:o}=G(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:m,disabled:h,onFocus:f,onBlur:g,onEnter:b,onClear:y}=e.option,{prefix:x,suffix:v,password:E,maxLength:S,pattern:w,toUpper:C,toTrim:N,autoFocus:I,autoComplete:T,secretType:R}=s,O=R&&(m||h),k=l().useRef();l().useEffect((()=>{const e=()=>y?.(),t=k.current?.input.parentNode.querySelector("span[class*='clear-icon']");return p&&t&&t.addEventListener("click",e),()=>{t?.removeEventListener("click",e)}}),[]);const A=e=>{a?.(e),i(e)},L=E?P.Input.Password:P.Input,F=O?((e="",t)=>(e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e))(n,R):n;return r.isOnlyShow?l().createElement(Xn,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(F),bordered:u}):l().createElement(L,{ref:e=>{k.current=e,"function"==typeof t&&t(e)},value:F,autoComplete:E?"new-password":T,autoFocus:I,placeholder:d,style:c,title:E?"":F,prefix:x,suffix:v,maxLength:S,bordered:u,allowClear:p,readOnly:m,disabled:h,onFocus:e=>{f?.(e.target.value,e)},onBlur:t=>{let r=t.target.value??"";if(N){const e=r.trim();r!==e&&(r=e,A(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),g?.(r,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;b?.(t,e),r.isFilterType&&(r.SUBMIT_FORM(),k.current?.blur())}},onChange:e=>{let t=e.target.value;(0,Q.isRegExp)(w)&&(t=w.test(t)?t:n??""),C&&(t=t.toUpperCase()),A(t)}})}));ua.displayName="VInput";class pa extends i.Component{constructor(...e){super(...e),da(this,"context",void 0),da(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(ua,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),u&&l().createElement(P.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}da(pa,"contextType",pr);const ma=pa;function ha(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fa=e=>{const{$$form:t}=l().useContext(pr),{value:r=[],onChange:n,onValuesChange:a}=e,{t:i}=G(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p}=e.option,{prefix:m,suffix:h,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;n?.(t),a(t,b(t))},b=e=>e.join(" - ");return t.isOnlyShow?l().createElement(Xn,{value:b(r),bordered:c}):l().createElement(P.Input.Group,null,l().createElement(P.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:m,suffix:h,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:p,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),l().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:p,readOnly:!0}),l().createElement(P.Input,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:m,suffix:h,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:p,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class ga extends i.Component{constructor(...e){super(...e),ha(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(fa,{option:this.props.option,onValuesChange:(t=[],r)=>{p(t),e.setViewValue(a,r)}}))),c&&l().createElement(P.Col,{flex:ce(c.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...c}))))}}ha(ga,"contextType",pr);const ba=ga,ya=require("big.js");var xa=n.n(ya);function va(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ea=l().forwardRef(((e,t)=>{const{$$form:r}=l().useContext(pr),{value:n,onChange:a,onValuesChange:i}=e,{t:o}=G(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:p,disabled:m,onFocus:h,onBlur:f,onEnter:g}=e.option,{step:b=1,min:y,max:x,precision:v,autoFocus:E,stringMode:S,textAlign:w="left",controls:C=!0,formatter:N,parser:I}=s,T=l().useRef(),R=l().useRef(n),O=e=>{const t=Nn(e)?"":(0,Q.isNumber)(e)?e.toFixed(v):new(xa())(e).toFixed(v);return"function"==typeof N?N(t):t},k={[w]:!0,controls:C};return r.isOnlyShow?l().createElement(Xn,{value:O(n),bordered:u}):l().createElement(P.InputNumber,{ref:e=>{T.current=e,"function"==typeof t&&t(e)},value:n,className:ve()(k),placeholder:d,style:{width:"100%",...c},step:b,min:y,max:x,controls:C,precision:v,autoFocus:E,stringMode:S,formatter:N,parser:I,bordered:u,readOnly:p,disabled:m,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{ae((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(R.current),f?.(R.current,t)}))},onKeyUp:e=>{13===e.keyCode&&(g?.(n,e),r.isFilterType&&(r.SUBMIT_FORM(),T.current?.blur()))},onChange:e=>{const t=e??"";!S&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,a?.(e),i(e,O(e))})(t)}})}));Ea.displayName="VInputNumber";class Sa extends i.Component{constructor(...e){super(...e),va(this,"context",void 0),va(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ea,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),u&&l().createElement(P.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}va(Sa,"contextType",pr);const wa=Sa;function Ca(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Na=e=>{const{$$form:t}=l().useContext(pr),{value:r=[],onChange:n,onValuesChange:a}=e,{t:i}=G(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p}=e.option,{step:m=1,min:h=0,max:f,textAlign:g="left",controls:b=!0,precision:y,formatter:x,parser:v}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];n?.(t),a(t,w(t))},w=e=>Nn(e)?"":e.map((e=>Nn(e)?"":Number(e).toFixed(y))),C={[g]:!0,controls:b};return t.isOnlyShow?l().createElement(Xn,{value:w(r),bordered:c}):l().createElement(P.Input.Group,null,l().createElement(P.InputNumber,{value:r[0],className:ve()("site-input-left",C),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:m,min:h,max:f,controls:b,precision:y,formatter:x,parser:v,bordered:c,readOnly:u,disabled:p,onChange:e=>{S([e,r[1]])},onBlur:()=>{E(r)}}),l().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:p,readOnly:!0}),l().createElement(P.InputNumber,{value:r[1],className:ve()("site-input-right",C),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:m,min:h,max:f,controls:b,precision:y,formatter:x,parser:v,bordered:c,readOnly:u,disabled:p,onChange:e=>{S([r[0],e])},onBlur:()=>{E(r)}}))};class Ia extends i.Component{constructor(...e){super(...e),Ca(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Na,{option:this.props.option,onValuesChange:(t=[],r)=>{p(t),e.setViewValue(a,r)}}))),c&&l().createElement(P.Col,{flex:ce(c.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...c}))))}}Ca(Ia,"contextType",pr);const Ta=Ia;let Ra=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function Pa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Oa}=P.Input;class ka extends i.Component{constructor(e){super(e),Pa(this,"context",void 0),Pa(this,"deriveParams",void 0),Pa(this,"valueKey",void 0),Pa(this,"_is_change",!1),Pa(this,"_record",void 0),Pa(this,"_prevValue",null),Pa(this,"state",{visible:!1,loading:!1}),Pa(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Pa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Pa(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||pe("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||pe("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&pe("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Pa(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Pa(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Pa(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(!e||le(d))return this._prevValue=void 0;this.setState({loading:!0});try{const l=await e(r({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&Tn(t,this.alias,s),c&&Rn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=In(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),Pa(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),Pa(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,Q.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),Pa(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=re,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{ae((()=>this.setState({loading:!1})))}}))})),Pa(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=In(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=In(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),Pa(this,"resetSearchHelperValue",(async(e=[],t)=>{const{fieldName:r}=this.props.option,n=e.filter((e=>In(e,this.alias[r])?.toString().toLowerCase().includes(t.toLowerCase())));if(1===n.length)return this.closeSearchHelper(n[0]);this.openSearchHelper(t)})),Pa(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??re)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),Pa(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:In(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:In(e,this.extras[r])});const n=In(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Pa(this,"closeButNotSelect",(()=>{const{onlySelect:e=!0}=this.searchHelper;this._is_change&&(e?this.clearSearchHelperValue():this.searchHelperChangeHandle(this.props.value)),this._is_change=!1,this.setVisible(!1)})),Pa(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),Pa(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),Pa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),Pa(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Pa(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=m("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,x={visible:t,title:m("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},v={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(Xn,{value:n,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Oa,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:f,onBlur:e=>{const{value:r}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(r),this._is_change&&!t&&(r?n?a?.fetch?.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e,r))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(r):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:r}=e.target;!t&&this.openSearchHelper(r)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):ae((()=>this.clearSearchHelperValue())))}}),l().createElement(cr,x,l().createElement(Bc,v)))}}Pa(ka,"contextType",pr);class Aa extends i.Component{constructor(e,{$$form:t}){super(e),Pa(this,"context",void 0),Pa(this,"promiseRef",void 0),Pa(this,"searchRef",void 0),Pa(this,"state",{searchHelper:{}}),Pa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Pa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return pe("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[]}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(ka,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(i,t)}}))),p&&l().createElement(P.Col,null,e.renderFormItemButton(i,p)),u&&l().createElement(P.Col,{flex:ce(u.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Pa(Aa,"contextType",pr);const La=Aa;function Fa(){return Fa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fa.apply(null,arguments)}function Ha(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _a=e=>{class t extends i.Component{constructor(...e){super(...e),Ha(this,"startClick",void 0),Ha(this,"event1",null),Ha(this,"event2",null),Ha(this,"$el",null),Ha(this,"omitClassNames",[]),Ha(this,"state",{clickOutside:!1}),Ha(this,"mousedownHandler",(e=>{this.startClick=e})),Ha(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Ha(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),l=this.$el===r,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(r)))||o.includes(n);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),Ha(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Ha(this,"setOmitClassNames",((e=[])=>{this.omitClassNames=e}))}componentDidMount(){this.event1=Mt()(document,"mousedown",this.mousedownHandler),this.event2=Mt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:r}=this.state;return l().createElement(e,Fa({ref:t},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Ha(t,"displayName",`OutsideClick(${e.displayName||e.name})`),l().forwardRef(((e,r)=>l().createElement(t,Fa({},e,{forwardedRef:r}))))},Da=require("rc-trigger");var $a,qa,Ma=n.n(Da);function Ka(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Va=_a((qa=class extends i.Component{constructor(e){super(e),Ka(this,"context",void 0),Ka(this,"searchRef",l().createRef()),Ka(this,"_records",[]),Ka(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Ka(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Ka(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||pe("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||pe("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Ka(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Ka(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ka(this,"setItemList",(e=>{this.setState({itemList:e})})),Ka(this,"setRecords",(e=>{this._records=e})),Ka(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Ka(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Ka(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ka(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:r}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[r]))),...e],r));const n=this.recordsToDict();this.setItemList(n),this.triggerChange(n.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Ka(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,Q.isEqual)(r,n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:l,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(le(c))return this.setRecords([]);this.setState({loading:!0});try{const o=await r(a({...n,keys:c}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,Q.get)(o.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),l?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=m("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,x={visible:t,title:m("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},v={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,Q.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),S=l().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},m("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ee("form-multiple-search-helper"),{size:N}=e.context,I={[C]:!0,[`${C}--lg`]:"large"===N,[`${C}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${C}`]);const T=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Xn,{value:T,bordered:p}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ma(),{popupVisible:!g&&r,popup:S,popupClassName:ve()(I),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:bn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(P.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:i,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:T,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(P.Button,{className:"ant-input-search-button",disabled:g,icon:l().createElement(Se.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(cr,x,l().createElement(Bc,v)))}},Ka(qa,"contextType",pr),$a=qa))||$a;class ja extends i.Component{constructor(e,{$$form:t}){super(e),Ka(this,"context",void 0),Ka(this,"promiseRef",void 0),Ka(this,"state",{searchHelper:{}}),Ka(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Ka(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return pe("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Va,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),p&&l().createElement(P.Col,null,e.renderFormItemButton(i,p)),u&&l().createElement(P.Col,{flex:ce(u.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ka(ja,"contextType",pr);const za=ja;function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Wa}=P.Input;class Ua extends i.Component{constructor(e){super(e),Ba(this,"context",void 0),Ba(this,"valueKey",void 0),Ba(this,"_record",void 0),Ba(this,"_prevValue",null),Ba(this,"state",{visible:!1,loading:!1}),Ba(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Ba(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ba(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||pe("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||pe("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&pe("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Ba(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Ba(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Ba(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(!e||le(d))return this._prevValue=void 0;this.setState({loading:!0});try{const l=await e(r({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&Tn(t,this.alias,s),c&&Rn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=In(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),Ba(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=In(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:In(e,this.extras[r])})})),Ba(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ba(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:In(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:In(e,this.extras[r])});const n=In(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Ba(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),Ba(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Ba(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n=""}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=m("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,x={visible:t,title:m("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},v={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,Q.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?l().createElement(Xn,{value:n,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Wa,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:b,maxLength:y,bordered:u,allowClear:p,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),l().createElement(cr,x,l().createElement(Qc,v)))}}Ba(Ua,"contextType",pr);class Ga extends i.Component{constructor(e,{$$form:t}){super(e),Ba(this,"context",void 0),Ba(this,"promiseRef",void 0),Ba(this,"state",{searchHelper:{}}),Ba(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Ba(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return pe("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ua,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(i,t)}}))),p&&l().createElement(P.Col,null,e.renderFormItemButton(i,p)),u&&l().createElement(P.Col,{flex:ce(u.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ba(Ga,"contextType",pr);const Ya=Ga;var Xa,Qa;function Za(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Ja=_a((Qa=class extends i.Component{constructor(e){super(e),Za(this,"context",void 0),Za(this,"searchRef",l().createRef()),Za(this,"_records",[]),Za(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Za(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Za(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||pe("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||pe("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Za(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Za(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Za(this,"setItemList",(e=>{this.setState({itemList:e})})),Za(this,"setRecords",(e=>{this._records=e})),Za(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Za(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Za(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Za(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:r}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[r]))),...e],r));const n=this.recordsToDict();this.setItemList(n),this.triggerChange(n.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Za(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,Q.isEqual)(r,n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=m("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,x={visible:t,title:m("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},v={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,Q.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),S=l().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},m("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,C=Ee("form-multiple-tree-table-helper"),{size:N}=e.context,I={[C]:!0,[`${C}--lg`]:"large"===N,[`${C}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${C}`]);const T=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Xn,{value:T,bordered:p}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ma(),{popupVisible:!g&&r,popup:S,popupClassName:ve()(I),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:bn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(P.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:i,placeholder:u,loading:n,bordered:p,allowClear:h,disabled:g,style:{width:"100%",...d},title:T,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(P.Button,{className:"ant-input-search-button",disabled:g,icon:l().createElement(Se.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(cr,x,l().createElement(Qc,v)))}},Za(Qa,"contextType",pr),Xa=Qa))||Xa;class ei extends i.Component{constructor(e,{$$form:t}){super(e),Za(this,"context",void 0),Za(this,"promiseRef",void 0),Za(this,"state",{searchHelper:{}}),Za(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Za(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return pe("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ja,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),p&&l().createElement(P.Col,null,e.renderFormItemButton(i,p)),u&&l().createElement(P.Col,{flex:ce(u.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Za(ei,"contextType",pr);const ti=ei;function ri(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ni=new Array(2).fill("");class ai extends i.Component{constructor(e){super(e),ri(this,"context",void 0),ri(this,"_is_change",!1),ri(this,"_ceho_data",void 0),ri(this,"_records",[]),ri(this,"_is_clear",!1),ri(this,"state",{visible:!1,loading:!1,itemList:[],textValue:ni}),ri(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),ri(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||pe("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||pe("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),ri(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ri(this,"setItemList",(e=>{this.setState({itemList:e})})),ri(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ri(this,"setTextValue",(e=>{this.setState({textValue:e})})),ri(this,"setRecords",(e=>{this._records=e})),ri(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),ri(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),ri(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(ni),this.triggerChange([])})),ri(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ri(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ri(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,r=le(e)?void 0:e;return{[t]:r}})),ri(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=re,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(ae((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),ri(this,"resetSearchHelperValue",(async(e=[])=>{const{textValue:t}=this.state,{textKey:r}=this.alias,n=e.filter((e=>{const n=e[r]?.toString().toLowerCase();return t.some((e=>n?.includes(e.toLowerCase())))}));if(2===n.length)return this.closeSearchHelper(n);this.openSearchHelper()})),ri(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:r=[]}=this.props;(0,Q.isEqual)(t,r)||(0,Q.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,Q.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=ni.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:t=[]}=this.props,{visible:r,loading:n,textValue:a}=this.state,{fieldName:i,options:o={},searchHelper:s={},placeholder:c=m("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,f=a.every((e=>Nn(e)))?"":a.join(" - "),g={visible:r,title:m("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},b={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,Q.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(Xn,{value:f,bordered:d}):l().createElement(l().Fragment,null,l().createElement(P.Input.Group,null,l().createElement(P.Input,{value:a[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),l().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:p,readOnly:!0}),l().createElement(P.Input.Search,{value:a[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:n,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([a[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),l().createElement(cr,g,l().createElement(ad,b)))}}ri(ai,"contextType",pr);class ii extends i.Component{constructor(e,{$$form:t}){super(e),ri(this,"context",void 0),ri(this,"promiseRef",void 0),ri(this,"state",{searchHelper:{}}),ri(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),ri(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return pe("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:m=[],onChange:h=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(c),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(ai,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(i,r)}}))),u&&l().createElement(P.Col,null,e.renderFormItemButton(i,u)),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...d}))))}}ri(ii,"contextType",pr);const li=ii;function oi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const si=e=>{const{$$form:t}=l().useContext(pr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,m=le(p)?n:p,h=e=>m.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?l().createElement(Xn,{value:h(r),bordered:c}):l().createElement(P.Checkbox.Group,{value:r,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{a?.(e),i(e,h(e))})(e)}},m.map((e=>l().createElement(P.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ci extends i.Component{constructor(...e){super(...e),oi(this,"context",void 0),oi(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:m=[],onChange:h=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(m)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(si,{option:this.props.option,items:t,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),u&&l().createElement(P.Col,{flex:ce(u.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...u}))))}}oi(ci,"contextType",pr);const di=ci;function ui(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pi=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:m}=i;return l().createElement(P.Rate,{value:r,count:p,style:o,allowHalf:u,allowClear:s,tooltips:m,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;n?.(e),a(e,(t=e,m?m[Math.ceil(t)-1]:t.toString()))})(e)}})};class mi extends i.Component{constructor(...e){super(...e),ui(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(pi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}ui(mi,"contextType",pr);const hi=mi;function fi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gi=e=>{const{$$form:t}=l().useContext(pr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:p=[]}=o,m=le(p)?n:p,h=e=>m.find((t=>t.value===e))?.text??"";return t.isOnlyShow?l().createElement(Xn,{value:h(r),bordered:c}):l().createElement(P.Radio.Group,{value:r,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e,h(e))})(t)}},m.map((e=>l().createElement(P.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class bi extends i.Component{constructor(...e){super(...e),fi(this,"context",void 0),fi(this,"state",{itemList:[]}),fi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:m=[],onChange:h=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(m)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(gi,{option:this.props.option,items:t,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),u&&l().createElement(P.Col,{flex:ce(u.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...u}))))}}fi(bi,"contextType",pr);const yi=bi;function xi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vi=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=hn,trueValue:m=mn}=o,{t:h}=G();return l().createElement(l().Fragment,null,l().createElement(P.Switch,{checked:r===m,style:s,disabled:d||t.isOnlyShow,checkedChildren:l().createElement(Se.CheckOutlined,null),unCheckedChildren:l().createElement(Se.CloseOutlined,null),onChange:e=>{(e=>{n?.(e),a(e,h(e===m?"am.form.trueText":"am.form.falseText"))})(e?m:p)}}),u?l().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},i):null)};class Ei extends i.Component{constructor(...e){super(...e),xi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option,{labelToSwitch:h}=o;return l().createElement(P.Form.Item,{label:h?" ":e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(vi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}xi(Ei,"contextType",pr);const Si=Ei;function wi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ci=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{options:o={},style:s={},placeholder:c=i("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:p,disabled:m,onBlur:h,onEnter:f}=e.option,{showCount:g,maxLength:b,autoSize:y}=o,x=Object.assign({},{minRows:1,maxRows:3},y);return l().createElement(P.Input.TextArea,{value:r,placeholder:c,style:s,maxLength:b,showCount:g,autoSize:x,bordered:d,allowClear:u,readOnly:p||t.isOnlyShow,disabled:m,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h?.(r,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f?.(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{n?.(e),a(e)})(t)}})};class Ni extends i.Component{constructor(...e){super(...e),wi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ci,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,t)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}wi(Ni,"contextType",pr);const Ii=Ni;function Ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ri=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.datePlaceholder"),bordered:p=!0,allowClear:m=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:b,disabledDate:y,minDateTime:x,maxDateTime:v,shortCuts:E=!0}=s,S=l().createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),n?.(e),a(e,C(e))},C=e=>Nn(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Cn(c()().subtract(e,"day"),xn[g]);"date"===g&&(t=t.slice(0,10)),w(t),S.current.blur(),S.current.focus()};return t.isOnlyShow?l().createElement(Xn,{value:C(r),bordered:p}):l().createElement(H,{ref:S,style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:yn[g],format:b,bordered:p,showToday:!1,showTime:"datetime"===g&&{defaultValue:c()("00:00:00","HH:mm:ss")},allowClear:m,disabled:f,inputReadOnly:h,disabledDate:y??(e=>((e,[t,r])=>t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day"))(e,[x,v])),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():l().createElement(l().Fragment,null,l().createElement(P.Tag,{color:"processing",onClick:()=>N(0)},i("qm.form.datePickers")[0]),l().createElement(P.Tag,{color:"processing",onClick:()=>N(1)},i("qm.form.datePickers")[1]),l().createElement(P.Tag,{color:"processing",onClick:()=>N(7)},i("qm.form.datePickers")[2]),l().createElement(P.Tag,{color:"processing",onClick:()=>N(30)},i("qm.form.datePickers")[3])):void 0,value:wn(r,xn[g]),onChange:(e,t)=>{w(Cn(e,xn[g]))}})};class Pi extends i.Component{constructor(...e){super(...e),Ti(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ri,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ti(Pi,"contextType",pr);const Oi=Pi;function ki(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ai=e=>[c()().subtract(e,"day"),c()()],Li=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.daterangePlaceholder"),bordered:p=!0,allowClear:m=!0,readOnly:h,disabled:f=t.isFormDisabled}=e.option,{dateType:g="date",format:b,disableds:y=[!1,!1],allowEmpty:x,disabledDate:v,minDateTime:E,maxDateTime:S,shortCuts:w=!0}=s,C={[i("qm.form.dateRangePickers")[0]]:Ai(7),[i("qm.form.dateRangePickers")[1]]:Ai(30),[i("qm.form.dateRangePickers")[2]]:Ai(90),[i("qm.form.dateRangePickers")[3]]:Ai(180)},N=e=>Nn(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?l().createElement(Xn,{value:N(r),bordered:p}):l().createElement(H.RangePicker,{style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:yn[g],format:b,bordered:p,showTime:"datetime"===g&&{defaultValue:[c()("00:00:00","HH:mm:ss"),c()("23:59:59","HH:mm:ss")]},allowClear:m,allowEmpty:x,disabled:f?[!0,!0]:y,inputReadOnly:h,disabledDate:v??(e=>((e,[t,r])=>t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day"))(e,[E,S])),ranges:w&&g.includes("date")?C:void 0,value:le(r)?null:[wn(r?.[0],xn[g]),wn(r?.[1],xn[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),n?.(e),a(e,N(e))})([Cn(e?.[0],xn[g]),Cn(e?.[1],xn[g])])}})};class Fi extends i.Component{constructor(...e){super(...e),ki(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Li,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}ki(Fi,"contextType",pr);const Hi=Fi;function _i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Di=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:m,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:b=1,secondStep:y=1}=s;return t.isOnlyShow?l().createElement(Xn,{value:r,bordered:u}):l().createElement(q,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:b,secondStep:y,allowClear:p,disabled:h,inputReadOnly:m,format:vn[f],value:wn(r,vn[f]),onChange:(e,t)=>{(e=>{const t=Cn(e,vn[f]);n?.(t),a(t)})(e)}})};class $i extends i.Component{constructor(...e){super(...e),_i(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Di,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,t)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}_i($i,"contextType",pr);const qi=$i;function Mi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ki=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:m,disabled:h=t.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:b,hourStep:y=1,minuteStep:x=1,secondStep:v=1}=s,E=e=>Nn(e)?"":e.join(" - ");return t.isOnlyShow?l().createElement(Xn,{value:E(r),bordered:u}):l().createElement(q.RangePicker,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:y,minuteStep:x,secondStep:v,allowClear:p,allowEmpty:b,disabled:h?[!0,!0]:g,inputReadOnly:m,format:vn[f],value:le(r)?null:[wn(r?.[0],vn[f]),wn(r?.[1],vn[f])],onChange:(e,t)=>{(e=>{const t=[Cn(e?.[0],vn[f]),Cn(e?.[1],vn[f])];n?.(t),a(t,E(t))})(e)}})};class Vi extends i.Component{constructor(...e){super(...e),Mi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ki,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Mi(Vi,"contextType",pr);const ji=Vi;function zi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bi extends i.Component{constructor(e){super(e),zi(this,"context",void 0),zi(this,"searchRef",l().createRef()),zi(this,"valueKey",void 0),zi(this,"_clicking",!1),zi(this,"_record",void 0),zi(this,"_prevValue",null),zi(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),zi(this,"getSearchHelper",ur()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),zi(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(n||pe("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||pe("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&pe("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&pe("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),zi(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),zi(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e){if(le(d))return this._prevValue=void 0;try{const l=await e(r({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&Tn(t,this.alias,s),c&&Rn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=In(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}}})),zi(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=In(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:In(e,this.extras[r])})})),zi(this,"fetchHandle",(0,Q.debounce)(this.getItemList,200)),zi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),zi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),zi(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),zi(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:In(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:In(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=In(e,this.alias[n]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,Q.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const l=await r(a({...n,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:r,itemList:n,inputText:a}=this.state,{value:i}=this.props,{fieldName:s,options:c={},style:d={},placeholder:u=m("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{listHeight:b=fn}=c,{hideHeader:y,onlySelect:x=!0}=this.searchHelper||c,v=this.searchHelper.columns||[],E=Ee("form-immediate"),S=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,w=l().createElement(P.Spin,{spinning:r},n.length?l().createElement("table",{cellSpacing:0,cellPadding:0,className:ve()("table")},!y&&l().createElement("thead",null,l().createElement("tr",null,v.filter((e=>!e.hidden)).map((e=>l().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),l().createElement("tbody",null,n.map(((e,t)=>l().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},v.filter((e=>!e.hidden)).map((t=>l().createElement("td",{key:t.dataIndex},(0,Q.get)(e,t.dataIndex))))))))):l().createElement(ct,null));return l().createElement(o.Consumer,null,(r=>{const o={[E]:!0,[`${E}--lg`]:"large"===r?.size,[`${E}--sm`]:"small"===r?.size};return e.isOnlyShow?l().createElement(Xn,{value:i,bordered:p}):l().createElement(Ma(),{action:g?[]:["click"],popupVisible:!g&&t,popup:w,popupClassName:ve()(o,`form-popper__${s}`),popupStyle:{minWidth:S,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:bn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(P.Input,{ref:this.searchRef,placeholder:u,allowClear:h,bordered:p,readOnly:f,disabled:g,style:{width:"100%",...d},value:a??i,title:i,onFocus:()=>{!n.length&&this.fetchHandle(i)},onBlur:e=>{x&&!this._clicking&&a!==i&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(n[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const r=40===e.keyCode?++t%n.length:(--t+n.length)%n.length;this.setState({activeIndex:r})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),x?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}})))}))}}zi(Bi,"contextType",pr);class Wi extends i.Component{constructor(e,{$$form:t}){super(e),zi(this,"context",void 0),zi(this,"promiseRef",void 0),zi(this,"state",{searchHelper:{}}),zi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),zi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return pe("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:ve()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Bi,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="",r)=>{f(t,r),e.setViewValue(i,t)}}))),p&&l().createElement(P.Col,null,e.renderFormItemButton(i,p)),u&&l().createElement(P.Col,{flex:ce(u.labelWidth||pn)},e.renderFormItemExtra({fieldName:i,...u}))))}}zi(Wi,"contextType",pr);const Ui=Wi;function Gi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Yi extends i.Component{constructor(...e){super(...e),Gi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,fieldName:n,className:a,style:i={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=te}=o,p=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===n))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return l().createElement(P.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},l().createElement(Ce,{id:n,label:r,className:a,extra:p.map((e=>e.text)).join(" | "),style:{...i},collapse:s[n],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[n]:t})}))),u(t)}}))}}Gi(Yi,"contextType",pr);const Xi=Yi;function Qi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zi(){return Zi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zi.apply(null,arguments)}const Ji=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Ji(e.children,t,r,n)}:e)),el=e=>{const{$$form:t}=l().useContext(pr),{value:r,items:n,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=G(),{fieldName:d,options:u={},style:p={},placeholder:m=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,asyncLoad:g,readOnly:b,disabled:y}=e.option,{itemList:x,filterable:v=!0,listHeight:E=fn,checkStrictly:S,checkStrategy:w="SHOW_CHILD",collapseTags:C,defaultExpandAll:N=!g,defaultExpandedKeys:I,dropdownStyle:T,openPyt:R=!0}=u,[O,k]=l().useState(le(x)?n:x),A=l().useRef(O);_e((()=>{const e=le(x)?n:x;g?(0,Q.isEqual)(e,A.current)||(k(e),A.current=e):k(e)}),[x,n]);const L=e=>On(O,e)?.text||e?.toString()||"",F=e=>a?e?.map((e=>L(e))).join(",")||"":L(e);return t.isOnlyShow?l().createElement(Xn,{value:F(r),bordered:h}):l().createElement(P.TreeSelect,Zi({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:a,treeCheckable:a,treeCheckStrictly:S,showCheckedStrategy:P.TreeSelect[w],popupClassName:`form-popper__${d}`,dropdownStyle:T,placeholder:m,listHeight:E,style:p,loading:i,bordered:h,allowClear:f,disabled:y,treeDefaultExpandAll:N,treeDefaultExpandedKeys:I,showSearch:v,maxTagCount:C?"responsive":void 0,loadData:g?async({key:e,children:t})=>{if(!g||t)return;const{fetchApi:r,params:n,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=g;if(r)try{const t=await r(s({...n,[l]:e}));if(200===t.code){const r=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[],n=Ji(O,e,l,Pn(r,l,i));k(n),o?.(r)}}catch(e){}}:void 0,treeData:O},a?{title:F(r)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,F(e),O)})(e)}}))};class tl extends i.Component{constructor(...e){super(...e),Qi(this,"context",void 0),Qi(this,"state",{itemList:[],loading:!1}),Qi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=Pn(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:m,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:ve()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(h)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(el,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&l().createElement(P.Col,{flex:ce(p.labelWidth||pn)},e.renderFormItemExtra({fieldName:o,...p}))))}}Qi(tl,"contextType",pr);const rl=tl;function nl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function al(){return al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},al.apply(null,arguments)}const il=e=>{const{$$form:t}=l().useContext(pr),{value:r,multiple:n,items:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,asyncLoad:m,readOnly:h,disabled:f}=e.option,{itemList:g,changeOnSelect:b,checkStrictly:y,checkStrategy:x="SHOW_PARENT",filterable:v=!0,dropdownStyle:E,openPyt:S=!0}=s,[w,C]=l().useState(le(g)?a:g),N=l().useRef(w);_e((()=>{const e=le(g)?a:g;m?(0,Q.isEqual)(e,N.current)||(C(e),N.current=e):C(e)}),[g,a]);const I=e=>kn(w,e??"").map((e=>e.text)).join("/"),T=e=>n?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?l().createElement(Xn,{value:T(r),bordered:u}):l().createElement(P.Cascader,al({value:(e=>le(e)?[]:n?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:w,multiple:n,maxTagCount:"responsive",changeOnSelect:b||y,showCheckedStrategy:P.Cascader[x],popupClassName:`form-popper__${o}`,dropdownStyle:E,placeholder:d,style:c,bordered:u,allowClear:p,disabled:f,showSearch:v&&!m&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(S?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:m?async e=>{const t=e[e.length-1];if(!m||t.children)return;const{fetchApi:r,params:n,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=m;if(r)try{const e=await r(s({...n,[l]:t.value}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[],n=Ji(w,t.value,l,Pn(r,l,i));C(n),o?.(r)}}catch(e){}}:void 0},n?{title:T(r)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,T(t),w)})(((e=[])=>n?e.map((e=>e.join(","))):e.join(","))(t))}}))};class ll extends i.Component{constructor(...e){super(...e),nl(this,"context",void 0),nl(this,"state",{itemList:[],loading:!1}),nl(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=Pn(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:m,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:ve()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(h)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(il,{option:this.props.option,multiple:t,items:r,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&l().createElement(P.Col,{flex:ce(p.labelWidth||pn)},e.renderFormItemExtra({fieldName:o,...p}))))}}nl(ll,"contextType",pr);const ol=ll,sl=require("china-area-data");var cl=n.n(sl);function dl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ul=["110000","120000","310000","500000"],pl=["810000","820000"],ml=[{text:"A",value:"A"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"L",value:"L"},{text:"N",value:"N"},{text:"Q",value:"Q"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],hl=[{text:"A",value:"A"},{text:"B",value:"B"},{text:"C",value:"C"},{text:"D",value:"D"},{text:"E",value:"E"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"K",value:"K"},{text:"L",value:"L"},{text:"M",value:"M"},{text:"N",value:"N"},{text:"P",value:"P"},{text:"Q",value:"Q"},{text:"R",value:"R"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"W",value:"W"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],fl=e=>Gn.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),gl=(e,t,r=1)=>{if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...ul,...pl].includes(e))):Object.keys(e[t])).map((n=>({l:fl(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:gl(e,n,r+1)})))},bl=(e,t)=>t.map((t=>({l:fl(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class yl extends i.Component{constructor(e){super(e),dl(this,"context",void 0),dl(this,"searchRef",l().createRef()),dl(this,"scrollRef",l().createRef()),dl(this,"zxsAndGa",void 0),dl(this,"provinces",void 0),dl(this,"allCities",void 0),dl(this,"letterCities",void 0),dl(this,"state",{visible:!1,select_type:"0",active_key:""}),dl(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),dl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Vt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:bl(cl(),ul)},{l:"Z2",n:"港澳",c:"",p:"",children:bl(cl(),pl)}]}createProvince(){return(gl(cl(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return hl.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...ul,...pl].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return l().createElement(P.Radio.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},l().createElement(P.Radio.Button,{value:"0"},m("qm.form.citySelectType.0")),l().createElement(P.Radio.Button,{value:"1"},m("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?ml:hl).map((t=>l().createElement("li",{key:t.value,className:ve()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return l().createElement(P.Select,{size:"small",placeholder:m("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>l().createElement(P.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,r)=>l().createElement("div",{key:r},l().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),l().createElement("dd",null,t.children?.map((t=>l().createElement("li",{key:t.c,className:ve()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:s=m("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ee("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(r),b=l().createElement("div",{className:"container",style:{...i}},l().createElement("div",{className:"city-drop"},l().createElement("div",{className:"city-drop-toper"},l().createElement("div",{className:"city-drop-toper__type"},this.renderType()),l().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),l().createElement("div",{className:"city-drop-letter"},this.renderLetter()),l().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},l().createElement("dl",null,this.renderCity(r)))));return l().createElement(o.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?l().createElement(Xn,{value:g,bordered:c}):l().createElement(Ma(),{action:p?[]:["click"],popupVisible:!p&&t,popup:b,popupClassName:ve()(a,`form-popper__${n}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:bn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(P.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,readOnly:u,disabled:p,style:{width:"100%",...i},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}dl(yl,"contextType",pr);class xl extends i.Component{constructor(...e){super(...e),dl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(yl,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}dl(xl,"contextType",pr);const vl=xl;function El(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Sl=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:Sl(e,r)})))};class wl extends i.Component{constructor(e){super(e),El(this,"context",void 0),El(this,"searchRef",l().createRef()),El(this,"prevText",void 0),El(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),El(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Sl(cl(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=On(e,t[n]);if(a&&le(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[l],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,t=this.state.tabs.map(((t,r)=>{const n=t.find((t=>t.value===e[r]))?.text||`${m("qm.form.selectPlaceholder").replace("...","")}(${m("qm.form.regionSelectLabel")[r]})`;return l().createElement(Jt.TabPane,{key:r.toString(),tab:n},l().createElement("div",{className:"region-box"},t.map((t=>l().createElement("span",{key:t.value,className:ve()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[r]=t.value.toString(),e=e.slice(0,r+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(r+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(r+1)}))}},t.text)))))}));return t.length?l().createElement(Jt,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):l().createElement(ct,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:s=m("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:p}=this.props.option,h=Ee("form-region-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=l().createElement("div",{className:"container"},this.renderTabs());let b=this.prevText;if(!t){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(b=e,this.prevText=b)}return l().createElement(o.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?l().createElement(Xn,{value:b,bordered:c}):l().createElement(Ma(),{action:p?[]:["click"],popupVisible:!p&&t,popup:g,popupClassName:ve()(a,`form-popper__${n}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:bn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(P.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,style:{width:"100%",...i},readOnly:u,disabled:p,value:b,title:b,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&ae((()=>this.initial()))}})))}))}}El(wl,"contextType",pr);class Cl extends i.Component{constructor(...e){super(...e),El(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(wl,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(a,r)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}El(Cl,"contextType",pr);const Nl=Cl;function Il(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Tl=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:p,fileSize:m,draggable:h,editable:f,batchDownload:g,fileDirection:b,onPreview:y,onDownload:x,onRemove:v,onSortChange:E,onEditChange:S}=i,{action:w,headers:C,params:N,withCredentials:I=!1,dataKey:T="",downloadWithHeaders:R,fieldAliasMap:O,beforeUpload:k,button:A}=o,L="function"==typeof O?O():O||{},{t:F}=G();return l().createElement(uo,{name:"file",action:w,multiple:d,headers:C,data:N,withCredentials:I,downloadWithHeaders:R,beforeUpload:k,maxCount:u,fileTypes:p,fileSize:m,draggable:h,editable:f,batchDownload:g,fileDirection:b,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:l().createElement(Se.DownloadOutlined,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in L)r[n]=e[n]||t.data?.[L[n]]||"";return e.response&&200!==t.code&&P.message.error(t.message||F("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(T?(0,Q.get)(t.data,T):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onPreview:y,onDownload:x,onRemove:v,onSortChange:E,onEditChange:S})};class Rl extends i.Component{constructor(...e){super(...e),Il(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Tl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,"")}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Il(Rl,"contextType",pr);const Pl=Rl;function Ol(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kl=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:p,quality:m,openCropper:h,fileTypes:f,fileSize:g,draggable:b,onRemove:y,onSortChange:x}=i,{action:v,headers:E,params:S,withCredentials:w=!1,dataKey:C="",popupClassName:N,fieldAliasMap:I,beforeUpload:T}=o,R="function"==typeof I?I():I||{},{t:O}=G();return l().createElement(fo,{name:"file",action:v,multiple:d,headers:E,data:S,withCredentials:w,popupClassName:N,beforeUpload:T,maxCount:u,fixedSize:p,quality:m,openCropper:h,fileTypes:f,fileSize:g,draggable:b,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&P.message.error(t.message||O("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(C?(0,Q.get)(t.data,C):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onRemove:y,onSortChange:x})};class Al extends i.Component{constructor(...e){super(...e),Ol(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(kl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,"")}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ol(Al,"contextType",pr);const Ll=Al;function Fl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Hl=e=>{const{$$form:t}=l().useContext(pr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:o,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:m}=i;return l().createElement(io,{value:r,tinymce:u,upload:o,thresholdSize:p,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:m,onChange:e=>{(e=>{n?.(e),a(e)})(e)}})};class _l extends i.Component{constructor(...e){super(...e),Fl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:m=te}=this.props.option;return l().createElement(P.Form.Item,{label:e.renderFormLabel(r),className:ve()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(P.Row,{wrap:!1,gutter:4},l().createElement(P.Col,{flex:"auto"},l().createElement(P.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Hl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,t)}}))),d&&l().createElement(P.Col,{flex:ce(d.labelWidth||pn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Fl(_l,"contextType",pr);const Dl=_l;function $l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ql extends i.Component{constructor(e){super(e),$l(this,"context",void 0),$l(this,"provide",{$$form:this,echo_data:{}}),$l(this,"_initialValues",void 0),$l(this,"_initialOthers",void 0),$l(this,"_initialExtras",void 0),$l(this,"_fieldAuth",{}),$l(this,"wrapperRef",l().createRef()),$l(this,"formRef",l().createRef()),$l(this,"originItems",[]),$l(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),$l(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),$l(this,"resizeListenerHandle",(0,Q.debounce)(this.resizeObserveHandler,10)),$l(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),$l(this,"getFlattenItems",ur()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,Q.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),$l(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),$l(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),$l(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),$l(this,"finishFailedHandle",(({values:e,errorFields:t})=>{this.props.onFinishFailed?.(t)})),$l(this,"openValidateInfo",(e=>{const t=l().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return l().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));P.notification.error({message:m("qm.form.validatePrompt"),description:t,duration:10})})),$l(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Vt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){bt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){yt(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&pe("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(e=[]){return e.some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,Q.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,Q.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,gn.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??hn),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}createOriginItems(){this.originItems=se(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){e!==this.state.collapse&&(this.setState({collapse:e}),this.props.onCollapse?.(e),ae((()=>this.props.onCollapse?.(e))))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if(An(e))return Ln(e);if((0,Q.isPlainObject)(e)){const{fieldName:t,label:r,options:n={}}=e;if(An(r))return Ln(r);const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){if("DIVIDER"===e)return!0;const r=this.getBlockDerivedItems();for(let e=0,n=r.length;e<n;e++){const n=r[e],a=this.dividers.find((e=>e.fieldName===n[0].fieldName)),i=a?.collapse?.showLimit??n.length-1;for(let e=1;e<n.length;e++)if(n[e].fieldName===t&&e>i)return this.state.expand[n[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(Nn(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Nn(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)le(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=oe(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,Q.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:a=1,disabled:i,secretName:l}=n;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},t.options=Object.assign({},t.options,{secretType:l})),this.setFieldAuth(r,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return l().createElement(ma,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return l().createElement(ba,{option:e})}INPUT_NUMBER(e){return l().createElement(wa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return l().createElement(Ta,{option:e})}SEARCH_HELPER(e){return l().createElement(La,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return l().createElement(za,{option:e})}TREE_TABLE_HELPER(e){return l().createElement(Ya,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return l().createElement(ti,{option:e})}RANGE_SEARCH_HELPER(e){return l().createElement(li,{option:e})}CHECKBOX(e){return l().createElement(la,{option:e})}MULTIPLE_CHECKBOX(e){return l().createElement(di,{option:e})}RATE(e){return l().createElement(hi,{option:e})}RADIO(e){return l().createElement(yi,{option:e})}SWITCH(e){return l().createElement(Si,{option:e})}TEXT_AREA(e){return l().createElement(Ii,{option:e})}DATE(e){return l().createElement(Oi,{option:e})}RANGE_DATE(e){return l().createElement(Hi,{option:e})}TIME(e){return l().createElement(qi,{option:e})}RANGE_TIME(e){return l().createElement(ji,{option:e})}SELECT(e){return l().createElement(ra,{option:e})}MULTIPLE_SELECT(e){return l().createElement(ra,{option:e,multiple:!0})}IMMEDIATE(e){return l().createElement(Ui,{option:e})}DIVIDER(e){return l().createElement(Xi,{option:e})}TREE_SELECT(e){return l().createElement(rl,{option:e})}MULTIPLE_TREE_SELECT(e){return l().createElement(rl,{option:e,multiple:!0})}CASCADER(e){return l().createElement(ol,{option:e})}MULTIPLE_CASCADER(e){return l().createElement(ol,{option:e,multiple:!0})}CITY_SELECT(e){return l().createElement(vl,{option:e})}REGION_SELECT(e){return l().createElement(Nl,{option:e})}UPLOAD_FILE(e){return l().createElement(Pl,{option:e})}UPLOAD_IMG(e){return l().createElement(Ll,{option:e})}TINYMCE(e){return l().createElement(Dl,{option:e})}renderFormLabel(e){if(An(e)||!(0,Q.isPlainObject)(e))return e;const{type:t,fieldName:r,label:n,options:a={},onChange:i=te}=e,{itemList:o=[]}=a;return"SELECT"===t?l().createElement(P.Form.Item,{name:r,noStyle:!0},l().createElement(ea,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>i(e,t)})):"CHECKBOX"===t?l().createElement(l().Fragment,null,l().createElement("span",{style:{paddingRight:5}},n),l().createElement(P.Form.Item,{name:r,noStyle:!0},l().createElement(aa,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:r,style:n={},render:a}=e,{extra:i}=this.state;if(r)return l().createElement(P.Tooltip,{className:"extra-tooltip",title:i[t]},l().createElement(Se.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===t));return l().createElement("div",{className:"extra-text",title:a?"":i[t],style:n},l().createElement("span",{className:"extra-overflow-cut"},a?a(o,this):i[t]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:t,fieldName:r,invisible:n,tooltip:a,className:i,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return l().createElement(P.Form.Item,{label:this.renderFormLabel(t),name:r,rules:c,tooltip:a,hidden:n,className:ve()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":ce(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},u?.(e,this))}createFormItem(e){return(0,Q.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(pe("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:r,isFieldsDefine:n}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<r;e++)a.push({})}));const i=24/e,o=[],s=a.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return o.push(n),n}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=a.map(((t,r)=>{let{selfCol:n=1}=t;const{type:a,fieldName:s}=t;n=n>=24||"DIVIDER"===a||"TINYMCE"===a?e:n;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(o[r]),l().createElement(P.Col,{key:s??r,className:s,span:n*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},a?this.createFormItem(se(t)):null)}));return n&&"default"===t&&u.push(l().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:t,collapse:r}=this.state,{searchButtonCols:n,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/t,s=n||1,c=t-e%t-s;return a?l().createElement(P.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},l().createElement(P.Space,{style:{marginBottom:12}},l().createElement(fe,{type:"primary",size:this.$size,icon:l().createElement(Se.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},m("qm.form.search")),l().createElement(fe,{size:this.$size,icon:l().createElement(Se.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},m("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&l().createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?l().createElement(Se.UpOutlined,null):l().createElement(Se.DownOutlined,null)," ",m(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const n=24/e;return r&&"default"===t?l().createElement(P.Row,{gutter:0},l().createElement(P.Col,{key:"-",span:n},l().createElement(P.Form.Item,null,l().createElement(P.Space,{style:{marginBottom:12}},l().createElement(fe,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},m("qm.form.save")),l().createElement(fe,{size:this.$size,onClick:()=>this.RESET_FORM()},m("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:r}=this.props;return l().createElement(ca,{uniqueKey:e,items:t,fieldsChange:r})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[m("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){pe("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return pe("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,Q.isPlainObject)(t))return pe("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return pe("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,Q.set)(i,r,t[r]));r&&(a?a([...n]):pe("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:r,disabled:n,labelWidth:a,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=Ee("form"),d={required:"${label}"+m("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return l().createElement("div",{ref:this.wrapperRef,className:ve()(u,e),style:t},l().createElement(P.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:i,labelWrap:o,colon:!1,disabled:n,labelCol:{flex:this.verticalLayout?"initial":ce(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},l().createElement(pr.Provider,{value:this.provide},l().createElement(P.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}$l(ql,"contextType",o),$l(ql,"propTypes",En),$l(ql,"defaultProps",Sn);const Ml=ql,Kl={onActivate:cn.func,onAddUndo:cn.func,onBeforeAddUndo:cn.func,onBeforeExecCommand:cn.func,onBeforeGetContent:cn.func,onBeforeRenderUI:cn.func,onBeforeSetContent:cn.func,onBeforePaste:cn.func,onBlur:cn.func,onChange:cn.func,onClearUndos:cn.func,onClick:cn.func,onContextMenu:cn.func,onCommentChange:cn.func,onCopy:cn.func,onCut:cn.func,onDblclick:cn.func,onDeactivate:cn.func,onDirty:cn.func,onDrag:cn.func,onDragDrop:cn.func,onDragEnd:cn.func,onDragGesture:cn.func,onDragOver:cn.func,onDrop:cn.func,onExecCommand:cn.func,onFocus:cn.func,onFocusIn:cn.func,onFocusOut:cn.func,onGetContent:cn.func,onHide:cn.func,onInit:cn.func,onKeyDown:cn.func,onKeyPress:cn.func,onKeyUp:cn.func,onLoadContent:cn.func,onMouseDown:cn.func,onMouseEnter:cn.func,onMouseLeave:cn.func,onMouseMove:cn.func,onMouseOut:cn.func,onMouseOver:cn.func,onMouseUp:cn.func,onNodeChange:cn.func,onObjectResizeStart:cn.func,onObjectResized:cn.func,onObjectSelected:cn.func,onPaste:cn.func,onPostProcess:cn.func,onPostRender:cn.func,onPreProcess:cn.func,onProgressState:cn.func,onRedo:cn.func,onRemove:cn.func,onReset:cn.func,onSaveContent:cn.func,onSelectionChange:cn.func,onSetAttrib:cn.func,onSetContent:cn.func,onShow:cn.func,onSubmit:cn.func,onUndo:cn.func,onVisualAid:cn.func,onSkinLoadError:cn.func,onThemeLoadError:cn.func,onModelLoadError:cn.func,onPluginLoadError:cn.func,onIconsLoadError:cn.func,onLanguageLoadError:cn.func},Vl={apiKey:cn.string,id:cn.string,inline:cn.bool,init:cn.object,initialValue:cn.string,onEditorChange:cn.func,value:cn.string,tagName:cn.string,cloudChannel:cn.string,plugins:cn.oneOfType([cn.string,cn.array]),toolbar:cn.oneOfType([cn.string,cn.array]),disabled:cn.bool,textareaName:cn.string,tinymceScriptSrc:cn.string,rollback:cn.oneOfType([cn.number,cn.oneOf([!1])]),scriptLoading:cn.shape({async:cn.bool,defer:cn.bool,delay:cn.number}),...Kl},jl=e=>"function"==typeof e,zl=e=>e in Kl,Bl=e=>e.substr(2),Wl=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(zl),c=Object.keys(l).filter(zl),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=Bl(e),r=o[t];n(t,r),delete o[t]})),u.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=Bl(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Ul=0;const Gl=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Ul++,e+"_"+r+Ul+String(t)},Yl=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Xl=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Ql=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Zl=()=>({listeners:[],scriptId:Gl("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Jl=(()=>{let e=Zl();return{load:(t,r,n,a,i,l)=>{const o=()=>((t,r,n,a,i,l)=>{const o=r.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),r.head&&r.head.appendChild(o)})(e.scriptId,t,r,n,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Zl()}}})(),eo=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function to(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ro extends i.Component{constructor(e){super(e),to(this,"editor",void 0),to(this,"id",void 0),to(this,"elementRef",void 0),to(this,"inline",void 0),to(this,"currentContent",void 0),to(this,"boundHandlers",void 0),to(this,"rollbackTimer",void 0),to(this,"valueCursor",void 0),to(this,"rollbackChange",(()=>{const e=this.editor,t=this.props.value;e&&t&&t!==this.currentContent&&e.undoManager.ignore((()=>{if(e.setContent(t),this.valueCursor&&(!this.inline||e.hasFocus()))try{e.selection.moveToBookmark(this.valueCursor)}catch(e){}})),this.rollbackTimer=void 0})),to(this,"handleBeforeInput",(e=>{if(void 0!==this.props.value&&this.props.value===this.currentContent&&this.editor&&(!this.inline||this.editor.hasFocus()))try{this.valueCursor=this.editor.selection.getBookmark(3)}catch(e){}})),to(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),to(this,"handleEditorChange",(e=>{const t=this.editor;if(t&&t.initialized){const e=t.getContent();void 0!==this.props.value&&this.props.value!==e&&!1!==this.props.rollback&&(this.rollbackTimer||(this.rollbackTimer=window.setTimeout(this.rollbackChange,"number"==typeof this.props.rollback?this.props.rollback:200))),e!==this.currentContent&&(this.currentContent=e,"function"==typeof this.props.onEditorChange&&this.props.onEditorChange(e,t))}})),to(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),to(this,"initialise",((e=0)=>{const t=this.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>this.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>this.initialise(e+1)),100)}return}const r=eo(this.view);if(!r)throw new Error("tinymce should have been loaded into global scope");const n={...this.props.init,selector:void 0,target:t,readonly:this.props.disabled,inline:this.inline,plugins:(a=this.props.init?.plugins,i=this.props.plugins,Xl(a).concat(Xl(i))),toolbar:this.props.toolbar??this.props.init?.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!Yl(t)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&jl(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{const t=this.getInitialValue();this.currentContent=this.currentContent??e.getContent(),this.currentContent!==t&&(this.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const r=this.props.disabled??!1;Ql(this.editor,r?"readonly":"design"),this.props.init&&jl(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}};var a,i;this.inline||(t.style.visibility=""),Yl(t)&&(t.value=this.getInitialValue()),r.init(n)})),this.id=this.props.id||Gl("tiny-react"),this.elementRef=i.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Ql(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==eo(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Jl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=eo(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:e="div"}=this.props;return i.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return i.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Wl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):r&&!n&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}to(ro,"propTypes",Vl),to(ro,"defaultProps",{cloudChannel:"6"});var no=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(no||{});const ao=e=>{const{className:t,style:r,tinymce:n={},upload:a={},thresholdSize:i=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:p}=e,{global:m}=l().useContext(o),{$size:h}=X(e),{$locale:f,t:g}=G(),b={height:n.height||400,plugins:n.plugins||"preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",toolbar:n.toolbar||"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",menubar:n.menubar||"file edit view insert format tools table help",font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:no[f],skin:"tinymce-5",...oe(n,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:l,dataKey:o}=a,s=`data:image/jpeg;base64,${e.base64()}`,c=new FormData;c.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>i)try{const e=await fetch(n,{method:"POST",body:c,headers:l});if(!e.ok)throw new Error(g("qm.upload.uploadError"));const r=await e.json();200===r.code&&t(o?(0,Q.get)(r.data,o):r.data)}catch(e){P.message.error(g("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;u?.({width:r,height:n},t)}))}},y=Ee("tinymce"),x={[y]:!0,[`${y}--lg`]:"large"===h,[`${y}--sm`]:"small"===h},v={init:b,value:d,disabled:c,tinymceScriptSrc:s||m?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{p?.(t.getContent(),t)}};return l().createElement("div",{className:ve()(x,t),style:r},l().createElement(ro,v))};ao.displayName="QmTinymce";const io=ao,lo=require("cropperjs");var oo=n.n(lo);const so=l().forwardRef(((e,t)=>{const r=h({src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0},e),{className:n,style:a,src:i,alt:o,imgStyle:s,...c}=r,d=l().useRef(null),u=l().useRef(null);l().useEffect((()=>{const e={};for(const t in c)void 0!==r[t]&&(e[t]=r[t]);return u.current=new(oo())(d.current,e),()=>{x(),u.current=null}}),[]);const p=()=>u.current?.reset(),m=()=>u.current?.clear(),f=()=>u.current?.crop(),g=(e,t=!1)=>u.current?.replace(e,t),b=()=>u.current?.enable(),y=()=>u.current?.disable(),x=()=>u.current?.destroy(),v=(e,t)=>u.current?.move(e,t),E=(e,t=e)=>u.current?.moveTo(e,t),S=(e,t)=>u.current?.zoom(e),w=(e,t)=>u.current?.zoomTo(e,t),C=e=>u.current?.rotate(e),N=e=>u.current?.rotateTo(e),I=e=>u.current?.scaleX(e),T=e=>u.current?.scaleY(e),R=(e,t=e)=>u.current?.scale(e,t),P=(e=!1)=>u.current?.getData(e),O=e=>u.current?.setData(e),k=()=>u.current?.getContainerData(),A=()=>u.current?.getImageData(),L=()=>u.current?.getCanvasData(),F=e=>u.current?.setCanvasData(e),H=()=>u.current?.getCropBoxData(),_=e=>u.current?.setCropBoxData(e),D=(e={})=>u.current?.getCroppedCanvas(e),$=e=>u.current?.setAspectRatio(e),q=e=>u.current?.setDragMode(e);l().useImperativeHandle(t,(()=>({reset:p,clear:m,initCrop:f,replace:g,enable:b,disable:y,destroy:x,move:v,moveTo:E,relativeZoom:S,zoomTo:w,rotate:C,rotateTo:N,scaleX:I,scaleY:T,scale:R,getData:P,setData:O,getContainerData:k,getImageData:A,getCanvasData:L,setCanvasData:F,getCropBoxData:H,setCropBoxData:_,getCroppedCanvas:D,setAspectRatio:$,setDragMode:q})));const M=Ee("cropper"),K={[M]:!0};return l().createElement("div",{className:ve()(K,n),style:a},l().createElement("img",{ref:d,src:i,alt:o,style:{maxWidth:"100%",...s}}))}));so.displayName="Cropper";const co=so,uo=Ht,po=e=>{const{fileTypes:t=[],fileSize:r,fixedSize:n,quality:a,beforeCrop:i,className:o}=e,{t:s}=G(),c=l().useRef(null),d=l().useRef(),u=l().useRef(),p=l().useRef(),m=l().useRef(),[h,f]=l().useState(""),g=e=>{c.current.relativeZoom(e)},b=e=>{c.current.rotate(e)},y=()=>{f("")},x=Ee("cropper-preview");return l().createElement(l().Fragment,null,(()=>{const t=Array.isArray(e.children)?e.children[0]:e.children;if(!t)return null;const{beforeUpload:r,...n}=t.props;return d.current=r,l().createElement(t.type,{...n,beforeUpload:(e,t)=>new Promise((async(r,n)=>{const a=()=>r(P.Upload.LIST_IGNORE);if(i&&!await i(e,t))return void a();u.current=e,p.current=r,m.current=a;const l=new FileReader;l.onload=()=>{f(l.result),l.onload=null},l.readAsDataURL(e)}))})})(),h&&l().createElement(P.Modal,{open:!0,wrapClassName:ve()(x,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{(async()=>{const{type:e,name:r,uid:n}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async a=>{let i=new File([a],r,{type:e});if(Object.assign(i,{uid:n}),t.length&&!t.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return P.message.warning(s("qm.upload.tooltip",{type:t.join(",")})),m.current("file type is error");if("function"!=typeof d.current)return p.current(i);const l=d.current(i,[i]);if("boolean"==typeof l||l){if(!0===l)return p.current(i);if(!1===l)return m.current("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),p.current(i)}catch(e){m.current(e)}}else pe("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),e,a),await ne(100),y()})()},onCancel:y,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:n?`calc(380px * ${n[1]/n[0]})`:"auto"};return l().createElement("div",{className:"cropper-preview"},l().createElement("div",{className:"cropper-area"},l().createElement("div",{className:"img-cropper"},l().createElement(co,{ref:c,aspectRatio:n?n[0]/n[1]:n,src:h,dragMode:"move",preview:".preview"})),l().createElement("div",{className:"actions"},l().createElement(P.Space,{size:"small"},l().createElement(P.Button,{type:"primary",size:"middle",icon:l().createElement(Se.ZoomInOutlined,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),l().createElement(P.Button,{type:"primary",size:"middle",icon:l().createElement(Se.ZoomOutOutlined,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),l().createElement(P.Button,{type:"primary",size:"middle",icon:l().createElement(Se.RotateRightOutlined,null),onClick:()=>b(90)},s("qm.uploadCropper.rotatePlus")),l().createElement(P.Button,{type:"primary",size:"middle",icon:l().createElement(Se.RotateLeftOutlined,null),onClick:()=>b(-90)},s("qm.uploadCropper.rotateSubtract"))))),l().createElement("div",{className:"preview-area"},l().createElement("div",{className:"preview",style:e})))})()))};function mo(){return mo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mo.apply(null,arguments)}const ho=e=>{const t=h({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:n=!0,fixedSize:a,quality:i=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:p,className:m,popupClassName:f,beforeCrop:g,onSortChange:b,onChange:y}=t,{t:x}=G(),{$size:v}=X(t),E=l().useRef(null),S=l().useRef(null),w=l().useRef(!1),[C,N]=l().useState(!1),[I,T]=l().useState(0),R=l().useMemo((()=>u||p),[u,p]),O=l().useMemo((()=>!c||r.length<c),[r,c]);l().useEffect((()=>(A(),document.addEventListener("paste",F),()=>{S.current?.destroy(),document.removeEventListener("paste",F)})),[]),_e((()=>{O||(w.current=!1)}),[r]);const k=Y((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[a]=e.splice(t,1);e.splice(n,0,a),b?.(e),y?.({file:r[t],fileList:e})}})),A=()=>{d&&(S.current=Rt().create(Be(E.current,Ee("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:k}))},L=(e,r)=>new Promise((async(n,a)=>{const{fileTypes:i=[],fileSize:l,beforeUpload:o}=t,s=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!l||e.size/1024/1024<l,d=s&&c;if(s||P.message.warning(x("qm.upload.tooltip",{type:i.join(",")})),c||P.message.warning(x("qm.upload.sizeLimit",{size:l})),!d)return P.Upload.LIST_IGNORE;if(o){const t=o(e,r);if(!0===t)return n(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{n(await t)}catch(e){a(e)}}else n(e)})),F=Y((async e=>{const{action:n,data:a,headers:i}=t;if(w.current&&O&&n)for(const t of e.clipboardData.items)if("file"===t.kind&&t.type.startsWith("image/")){const e=t.getAsFile(),l=Date.now(),o=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${l}`});try{await L(o,[...r,o]);const e=new FormData;if(e.append("file",o),a)for(const t in a)e.append(t,a[t]);const t="string"==typeof n?n:await n(o),l=await fetch(t,{method:"POST",body:e,headers:i});if(!l.ok)throw new Error(x("qm.upload.uploadError"));const s=await l.json();y?.({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})),H=Ee("upload-img"),_={[H]:!0,[`${H}--lg`]:"large"===v,[`${H}--sm`]:"small"===v},D=l().createElement(P.Upload,mo({className:ve()(_,m)},oe(t,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:L,disabled:R,onPreview:e=>{const t=r.findIndex((t=>t.url===e.url));t<0||(T(t),N(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,r,n)=>l().createElement("div",{className:ve()("upload-item",{handle:d})},e,!R&&l().createElement(Se.CloseOutlined,{title:x("qm.upload.remove"),className:"icon",onClick:()=>n.remove()}))}),l().createElement("span",{className:"inner",ref:E},O&&!(p&&r.length)&&l().createElement(l().Fragment,null,l().createElement("p",{className:"ant-upload-drag-icon"},l().createElement(Se.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},x("qm.uploadCropper.dragableText")),l().createElement("button",{className:ve()("ant-upload-button",{disabled:R}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},x("qm.uploadCropper.pasteText")))));return l().createElement(l().Fragment,null,n?l().createElement(po,{className:f,fixedSize:a,quality:i,fileTypes:o,fileSize:s,beforeCrop:g},D):D,l().createElement("div",{style:{display:"none"}},l().createElement(P.Image.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:C,current:I,rootClassName:f,onVisibleChange:e=>N(e)}},r.map(((e,t)=>l().createElement(P.Image,{key:e.uid||t,src:e.url,alt:""}))))))};ho.displayName="QmUploadImg";const fo=ho,go=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=go(i.children,t,r);e&&(n=e)}}return n},bo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&bo(e.children,t),t(e)||e.children&&e.children.length))),yo=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...yo(e.children,t)),t(e)&&r.push(e)})),r},xo=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=xo(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},vo=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:vo(e.children,t,r,n)}:e)),Eo=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Eo(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},So=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=So(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},wo=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...wo(e,t)))),r},Co=l().forwardRef(((e,t)=>{const{className:r,style:n,filterable:a=!0,multiple:i,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:p,checkStrategy:m="SHOW_CHILD",placeholder:h,fieldsDefine:f,value:b,height:y,defaultSelectedKeys:x=[],defaultExpandedKeys:v=[],defaultExpandAll:E=!0,showSearchBar:S=!0,showCollapse:w=!0,onSelectChange:C,onCheckChange:N,onDragStart:I,onDragChange:T,onExpand:R}=e,{$size:O}=X(e),{t:k}=G(),A=f?.valueKey||"value",L=f?.textKey||"text",F=l().useRef(null),H=l().useRef(null),_=xt(F),[D,$]=l().useState(y),[q,M]=l().useState(!1),K=vt((()=>{$(F.current.offsetHeight-ne.current.offsetHeight-10)}),5);g((()=>{y||K()}),[_.height]);const[V,j]=l().useState([]),[z,B]=l().useState({}),[W,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),[te,re]=l().useState(E),ne=l().useRef(null),ae=l().useRef([]),ie=l().useRef([]);l().useEffect((()=>{Array.isArray(s)&&(oe(s),U(se(s)),B({}))}),[s]),l().useEffect((()=>{ue(),d&&H.current?.focus()}),[]),_e((()=>{ue()}),[c?.params]),_e((()=>{Z(de())}),[z]),l().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=xo(V,(t=>e===t[A]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],oe([...V]))},REMOVE_RECORD:e=>{const t=go(V,e,A);if(void 0===t&&V.find((t=>t[A]===e)))oe(V.filter((t=>t[A]!==e)));else{const r=xo(V,(e=>t===e[A]));if(!r)return;const n=r.children?.findIndex((t=>e===t[A]));n>=0&&(r.children.splice(n,1),oe([...V]))}},UPDATE_RECORD:(e,t)=>{const r=xo(V,(t=>e===t[A]));r&&((0,Q.merge)(r,t),oe([...V]))}})));const oe=e=>{j(e),ae.current=e,ie.current=Eo(e,A)},se=e=>{if(i)return x;const t=yo(e,(e=>x.includes(e[L])));return 1===t.length?[t[0][A]]:[]},ce=e=>So(V,e,A)?.slice(0,-1)||[],de=()=>{if(E)return ie.current;const e=[];return W.forEach((t=>{if(i){if("SHOW_ALL"===m&&!ie.current.includes(t)&&e.push(...ce(t)),"SHOW_CHILD"===m&&e.push(...ce(t)),"SHOW_PARENT"===m){const r=On(V,t);if(r){const n=ce(t),a=wo(r,A);e.push(...n,...[t,...a].filter((e=>ie.current.includes(e))))}}}else e.push(...ce(t))})),[...new Set([...v,...e])]},ue=async()=>{if(!c)return;const{api:e,params:t,dataKey:r,afterFetch:n,callback:a}=c;try{M(!0);const i=await e(t);if(200===i.code){let e=Array.isArray(i.data)?i.data:(0,Q.get)(i.data,r)??[];e="function"==typeof n?await n(e):e,oe(e),U(se(e)),B({}),a?.(e)}}catch(e){}M(!1)},pe=e=>`${e}|${Gn.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,me=Ee("search-tree"),he={[me]:!0,[`${me}--lg`]:"large"===O,[`${me}--sm`]:"small"===O};return l().createElement("div",{ref:F,className:ve()(he,r),style:n},l().createElement("div",{ref:ne,className:"topper"},S&&l().createElement(P.Input,{ref:H,value:J,size:O,placeholder:h||k("qm.form.inputPlaceholder"),suffix:l().createElement(Se.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=bo(ae.current,(t=>{if(!e)return!0;const r=t[L]||"";return-1!==pe(r).indexOf(e)}));ee(e),j(t),Z(E||e?Eo(t,A):de())})(e.target.value)}),w&&l().createElement("a",{className:"trigger",onClick:()=>{re(!te),Z(te?[]:ie.current)}},te?l().createElement(Se.UpOutlined,null):l().createElement(Se.DownOutlined,null)," ",k(te?"qm.form.collect":"qm.form.spread"))),l().createElement(ut,{spinning:q},l().createElement(P.Tree,{fieldNames:{title:L,key:A,children:"children"},multiple:i,draggable:o,blockNode:o,checkable:i,selectable:!i,height:D,disabled:e.disabled,checkStrictly:p,selectedKeys:b??W,checkedKeys:b??W,expandedKeys:Y,treeData:V,loadData:u?async({key:e,children:t})=>{if(!c||t)return;const{api:r,params:n,dataKey:a,formatter:i=(e=>e),afterFetch:l}=c;try{const t=await r(i({...n,[A]:e}));if(200===t.code){let r=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[];r="function"==typeof l?await l(r):r;const n=vo(ae.current,e,A,r);oe(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!J)return!1;const t=e[L]||"";return-1!==pe(t).indexOf(J)},onDragStart:I,onDragEnter:e=>{Z(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][A]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...V];let o;if(i(l,r,((e,t,r)=>{r.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,r=[];i(l,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,o):r.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));oe(l)},onDragEnd:e=>{T?.(e,V)},onExpand:(e,t)=>{le(e)&&re(!1),ie.current.every((t=>e.includes(t)))&&re(!0),Z(e),R?.(e,t)},onSelect:e=>{U(e);const t=yo(ae.current,(t=>e.includes((0,Q.get)(t,A))));C?.(i?t:t[0])},onCheck:e=>{p&&(e=e.checked),U(e),p||("SHOW_CHILD"===m&&(e=e.filter((e=>!ie.current.includes(e)))),"SHOW_PARENT"===m&&(e=e.filter(((e,t,r)=>!r.includes(go(V,e,A))))));const t=yo(ae.current,(t=>e.includes((0,Q.get)(t,A))));N?.(i?t:t[0])}})))}));Co.displayName="QmSearchTree";const No=Co,Io=(0,i.createContext)(void 0),To={dataIndex:dn().string.isRequired,title:dn().string.isRequired,description:dn().string,colSpan:dn().number,width:dn().number,minWidth:dn().number,fixed:dn().oneOf(["left","right"]),align:dn().oneOf(["left","center","right"]),theadAlign:dn().oneOf(["left","center","right"]),printFixed:dn().bool,hidden:dn().bool,noAuth:dn().bool,noFixed:dn().bool,ellipsis:dn().bool,className:dn().string,theadClassName:dn().string,children:dn().array,sorter:dn().oneOfType([dn().bool,dn().func]),filter:dn().shape({type:dn().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:dn().arrayOf(dn().shape({text:dn().string,value:dn().oneOfType([dn().string,dn().number])})),style:dn().object}),precision:dn().number,displayPrecision:dn().number,formatType:dn().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:dn().bool,canCopy:dn().bool,editRender:dn().func,dictItems:dn().arrayOf(dn().shape({text:dn().string,value:dn().oneOfType([dn().string,dn().number])})),summation:dn().shape({sumBySelection:dn().bool,displayWhenNotSelect:dn().bool,dataKey:dn().string,unit:dn().string,render:dn().func}),groupSummary:dn().shape({dataKey:dn().string,unit:dn().string,render:dn().func}),shouldCellUpdate:dn().func,headRender:dn().func,render:dn().func},Ro=(dn().arrayOf(dn().shape(To)).isRequired,dn().func,dn().array,dn().oneOfType([dn().string,dn().func]).isRequired,dn().number,dn().bool,dn().bool,dn().shape({api:dn().func.isRequired,params:dn().object.isRequired,formatter:dn().func,beforeFetch:dn().func,afterFetch:dn().func,stopToFirst:dn().bool,dataKey:dn().string,callback:dn().func}),dn().bool,dn().bool,dn().string,dn().string,dn().bool,dn().bool,dn().bool,dn().bool,dn().oneOfType([dn().object,dn().func]),dn().oneOfType([dn().object,dn().func]),dn().array,dn().func,dn().bool,dn().object,dn().object,dn().shape({type:dn().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:dn().array,selectedRowKeys:dn().array,hideSelectAll:dn().bool,checkStrictly:dn().bool,filterable:dn().bool,selectByClickRow:dn().bool,selectFirstRowOnChange:dn().bool,clearableAfterFetched:dn().bool,selectAllOnCurrentPage:dn().bool,fetchSelectedRows:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),fetchAllRowKeys:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),disabled:dn().func,onChange:dn().func,onSelect:dn().func,onSelectAll:dn().func}),dn().shape({currentRowKey:dn().oneOfType([dn().number,dn().string]),disabled:dn().func,onChange:dn().func}),dn().shape({virtual:dn().bool,doubleXScrollbar:dn().bool}),dn().shape({virtual:dn().bool,expandIconColumn:dn().string}),dn().shape({defaultExpandAllRows:dn().bool,defaultExpandedRowKeys:dn().array,expandedRowKeys:dn().array,hideExpandAll:dn().bool,rowExpandable:dn().func,expandedRowClassName:dn().string,expandedRowRender:dn().func,onExpand:dn().func,onChange:dn().func}),dn().shape({cellMerge:dn().bool,onCellMerge:dn().func,onSelectChange:dn().func}),dn().shape({groupItems:dn().arrayOf(dn().shape({dataIndex:dn().string.isRequired,titleIndex:dn().string,color:dn().string,backgroundColor:dn().string})),fetch:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),onChange:dn().func}),dn().func,dn().bool,dn().bool,dn().bool,dn().bool,dn().shape({current:dn().number,pageSize:dn().number,pageSizeOptions:dn().array,showSizeChanger:dn().bool,showQuickJumper:dn().bool}),dn().shape({fileName:dn().string,fetch:dn().shape({api:dn().func.isRequired,params:dn().object}),beforeExport:dn().func,cellStyle:dn().bool,hideIcon:dn().bool}),dn().shape({showLogo:dn().bool}),dn().shape({fetch:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),fieldList:dn().arrayOf(dn().object)}),dn().shape({position:dn().oneOf(["top","bottom"]),hideAlert:dn().bool,hideClearButton:dn().bool}),dn().oneOf(["left","right"]),dn().func,dn().func,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,{columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0}),Po=10,Oo="1",ko="0",Ao="YYYY-MM-DD",Lo="YYYY-MM-DD HH:mm:ss",Fo="YYYYMMDDHHmmss",Ho={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let _o=function(e){return e.left="flex-start",e.right="flex-end",e}({});const Do={...i}.useId;let $o=0;const qo=Do?function(e){const t=Do();return e||t}:function(e){const[t]=i.useState(`qm_unique_${$o}`);return i.useEffect((()=>{$o+=1}),[]),e||t};let Mo=[];const Ko={_getInstance:function(e){return Mo.find((t=>t.id===e))??null},getFocusInstance:function(){return Mo[0]??null},focus:function(e){const t=this._getInstance(e);t&&0!==Mo.findIndex((e=>e===t))&&(this.deregister(e),Mo=[t,...Mo])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),Mo=[{id:e,vm:t},...Mo])},deregister:function(e){e&&(Mo=Mo.filter((t=>t.id!==e)))}};function Vo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const jo=class{constructor(){Vo(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),Vo(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),Vo(this,"removeFromRequired",(e=>{const t=this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.required.splice(t,1)})),Vo(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),Vo(this,"removeFromValidate",(e=>{const t=this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.validate.splice(t,1)})),Vo(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),Vo(this,"removeFromEdited",(e=>{const t=this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.edited.splice(t,1)})),Vo(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),Vo(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),Vo(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),Vo(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),Vo(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),Vo(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),Vo(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]}))}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}},zo={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollX:50,virtualScrollY:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};function Bo(e){return void 0!==e}function Wo(e,t){const{defaultValue:r,value:n,onChange:a,postState:l}=t||{},[o,s]=i.useState((()=>Bo(n)?n:Bo(r)?"function"==typeof r?r():r:"function"==typeof e?e():e)),c=Bo(n)?n:o,d=l?l(c):c,u=Y(a),[p,m]=i.useState([c]);return g((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),g((()=>{Bo(n)||s(n)}),[n]),[d,Y((e=>{s(e),m([c])}))]}let Uo;const Go=()=>{if(Z)return 0;if(void 0!==Uo)return Uo;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),Uo=t-n,Uo},Yo=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=Yo(t.children)),t})),Xo=(e,t)=>{const{fetch:r,columns:n,height:a,minHeight:i,maxHeight:o,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:p,webPagination:m,scrollPagination:h,showSuperSearch:f,showFastSearch:g,showGroupSummary:b,showTableImport:y,showClipboard:x,showSelectCollection:v,footRender:E}=e,{tableRef:S,getRowKey:w,tableFullData:C,tableData:N,selectionKeys:I,sorter:T,filters:R,superFilters:P,pagination:O,mergedTdCells:k}=t,{selectionRows:A,summaries:L}=S.current,{expandIconColumn:F=""}=p||{},{t:H}=G(),_=l().useMemo((()=>!!r?.api),[r?.api]),D=l().useMemo((()=>!_&&!!m),[_,m]),$=l().useMemo((()=>_&&!!h),[_,h]),q=l().useMemo((()=>(_||D)&&!$),[_,D,$]),M=l().useMemo((()=>!!(a||i||o)),[a,i,o]),K=l().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(Yo(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:zo.selectionColumn,title:"radio"===t?H("qm.table.config.selectionText"):"",width:zo.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:zo.expandableColumn,title:"",width:zo.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Tr(t)})(n)),[n]),V=l().useMemo((()=>Ir(K)),[K]),j=l().useMemo((()=>V.filter((e=>"function"==typeof e.editRender))),[V]),z=l().useMemo((()=>V.filter((e=>!!e.summation))),[V]),B=l().useMemo((()=>V.filter((e=>"left"===e.fixed))),[V]),W=l().useMemo((()=>V.filter((e=>"right"===e.fixed))),[V]),U=l().useMemo((()=>(e=>{const t=[];return e.forEach((e=>{const r=C.find((t=>w(t,t.index)===e.rowKey)),n=V.findIndex((t=>t.dataIndex===e.dataIndex));if(!r||n<0)return;const a={row:r.index,col:n,rowSpan:e.rowSpan,colSpan:e.colSpan};t.push(a);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:a.row+n,col:a.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:a.row+r,col:a.col+n,rowSpan:0,colSpan:0})})),t})(k)),[k,V,C]),Y=l().useMemo((()=>{const e=V.filter((e=>![zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(e.dataIndex)));return F&&e.some((e=>e.dataIndex===F))?F:e[0]?.dataIndex??""}),[V,F]),X=l().useMemo((()=>z.length>0),[z]),Q=l().useMemo((()=>!!E||X),[E,X]),Z=l().useMemo((()=>_r(K).length>1),[K]),J=l().useMemo((()=>s||Z),[s,Z]),ee=l().useMemo((()=>V.some((e=>e.sorter))),[V]),te=l().useMemo((()=>V.some((e=>e.filter))),[V]),re=l().useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),ne=l().useMemo((()=>!_&&!!y),[_,y]),ae=l().useMemo((()=>!!x&&j.length>0),[x,j]),ie=l().useMemo((()=>!!v&&"checkbox"===c?.type),[v,c]),le=l().useMemo((()=>!!f&&te),[f,te]),oe=l().useMemo((()=>!_&&!!g&&te),[_,g,te]),se=l().useMemo((()=>!!b&&V.some((e=>!!e.groupSummary))),[V]),ce=l().useMemo((()=>!!d?.groupItems?.length),[d]),de=l().useMemo((()=>C.some((e=>Array.isArray(e.children)))),[C]),ue=l().useMemo((()=>!N.length),[N]),pe=l().useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=ce?en(S.current.tableFullData):S.current.tableFullData,d=!A.length&&!!o;let u=(!l||d?c:A).reduce(((e,t)=>{if(t?.[zo.summaryIgnore])return e;const n=jr(t,r);return Wr(n)?e.plus(n):e}),new(xa())(0));!Object.keys(L).includes(r)||l&&!d||(u=new(xa())(jr(L,r))),zr(e,r,u.toNumber());let p=n>=0?u.toFixed(n):u.toString();a>=0&&""!==p&&(p=Gr(p,a)),p=Ur(p),zr(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[N,I,L]),me=l().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),he=l().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(T),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=zo.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:zo.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(R,P);return{...e?{[zo.sorterFieldName]:e}:null,...t.length?{[zo.filterFieldName]:t}:null,...me?{[zo.groupSummary.summaryFieldName]:me,usedJH:1}:null,...r?.params??null,[zo.currentPageName]:O.current,[zo.pageSizeName]:O.pageSize}}),[r?.params,O.current,O.pageSize,T,R,P,me]);return{isFetch:_,isWebPagination:D,isScrollPagination:$,showPagination:q,shouldUpdateHeight:M,tableColumns:K,flattenColumns:V,editableColumns:j,summationColumns:z,leftFixedColumns:B,rightFixedColumns:W,derivedMergeCells:U,treeExpandIndex:Y,showSummary:X,showFooter:Q,isHeadGroup:Z,bordered:J,isHeadSorter:ee,isHeadFilter:te,isServiceSummation:re,isSelectCollection:ie,isTableImport:ne,isTableClipboard:ae,isSuperSearch:le,isFastSearch:oe,isGroupSummary:se,isGroupSubtotal:ce,isTreeTable:de,isTableEmpty:ue,summationRows:pe,fetchParams:he}},Qo=require("react-dom");var Zo=n.n(Qo);const Jo=(e,t)=>{const{rowKey:r,height:n,dataSource:a,summation:i,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,treeConfig:m,authConfig:h,ignorePageIndex:f,columnsChange:b,onChange:y,onDataChange:x,onDataLoad:v,onScrollEnd:E,onFetchError:S}=e,{getRowKey:w,tableRef:C,tableElementRef:N,tableBodyRef:I,$size:T,tableColumns:R,flattenColumns:P,editableColumns:O,tableFullData:k,pagination:A,layout:L,filters:F,sorter:H,superFilters:_,fetchParams:D,selectionKeys:$,rowExpandedKeys:q,highlightKey:M,summationColumns:K,shouldUpdateHeight:V,isFetch:j,isTreeTable:z,isWebPagination:B,isScrollPagination:W,isServiceSummation:U,isGroupSubtotal:Y,doLayout:X,setTableData:Z,setTableFlatColumns:J,setTableFullData:ee,setTableOriginData:te,setTableFlatData:ne,setAllTableData:ae,setDeriveRowKeys:ie,setPagination:se,setSpinning:ce,setSorter:de,setFilters:ue,setSuperFilters:me,setSelectionKeys:he,setRowExpandedKeys:fe,setHighlightKey:ge,setSelectionRows:be,setScrollXLoad:ye,setScrollYLoad:xe,setScrollXStore:ve,setScrollYStore:Ee,computeVirtualX:Se,computeVirtualY:we,setFieldAuth:Ce,setResizeState:Ne,setSummaries:Ie,setPermission:Te,setRecordsMap:Re,resetTableScroll:Pe,clearElementStore:Oe,clearRecordsMap:ke}=t,{t:Ae}=G(),{store:Le,scrollBarRef:Fe}=C.current,He=Number.parseInt(l().version)>=18?Zo().flushSync:null,De=l().useRef({...D}),$e=l().useRef(new Map),qe=l().useRef(!1),Me=xt(N);g((()=>{X(),Be(),C.current.scrollXLoad&&Ue(Fe.current.scrollLeft),Ge()}),[R]),g((()=>{Ke()}),[Me.width,T,n,L.tableAutoHeight]),_e((()=>{At(),Lt(),Ft(),j||(B&&St(),ht(a)),s&&de(s),c&&ue(c)}),[a,o?.params]),_e((()=>{const e=dt(D,De.current);e||j&&d?.clearableAfterFetched&&Ht(),!e&&D[zo.currentPageName]>1&&!o?.stopToFirst?St():j&&pt(),De.current=D}),[D]),_e((()=>{B&&Rt(),W||Pe(),ot()}),[A.current,A.pageSize]),_e((()=>{C.current.scrollYLoad&&Qe(Fe.current.scrollTop),j||Ve(k.length),X()}),[k]),_e((()=>{z&&C.current.scrollYLoad&&(wt(),Rt())}),[q]);const Ke=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:r}=C.current,{width:n,height:a}=r,{width:i,height:l}=Me,o=i!==n,s=l!==a;X(),o&&e&&Ge(),s&&V&&t&&Ze(),Ne(Object.assign({},r,{width:i,height:l}))},Ve=e=>{e!==A.total&&se((t=>Object.assign({},t,{total:e})))},je=e=>{qe.current=e},ze=vt((e=>{bt(),E?.(e)})),Be=()=>{ye(P.length>zo.virtualScrollX)},We=(e=[])=>{let t=e.length>zo.virtualScrollY;p?.virtual&&(t=!0),m?.virtual&&(t=!0),xe(t)},Ue=(e=0)=>{const{scrollXStore:t}=C.current,{startIndex:r,endIndex:n,offsetSize:a}=t,{toVisibleIndex:i,visibleSize:l}=Se(e,L.tableWidth),o=Math.max(0,i-1-a),s=i+l+a;(i<=r||i>=n-l-1)&&(r===o&&n===s||(ve(Object.assign({},t,{startIndex:o,endIndex:s})),Ge()))},Ge=()=>{Ye(),Xe()},Ye=()=>{const{scrollXLoad:e,scrollXStore:t}=C.current;if(!e)return;const r=[],n=[],a=[];for(let e=0;e<P.length;e++){const i=P[e];i.fixed?"left"===i.fixed?r.push(i):a.push(i):e>=t.startIndex&&e<t.endIndex&&n.push(i)}He?queueMicrotask((()=>He((()=>J([...r,...n,...a]))))):J([...r,...n,...a])},Xe=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:r}=C.current,{tableBodyWidth:n,gutterWidth:a}=L;let i="",l="";r&&(i=`${P.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,l=`${scrollY?n-a:n}px`),e.$tableBody.style.marginLeft=i,e.$tableXspace.style.width=l},Qe=(e=0)=>{const{scrollYStore:t}=C.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:l}=t,{toVisibleIndex:o}=we(e,l),s=Math.max(0,o-1-a),c=o+i+a;(o<=r||o>=n-i-1)&&(r===s&&n===c||(Ee(Object.assign({},t,{startIndex:s,endIndex:c})),Ze()))},Ze=()=>{const{tableFlatData:e}=C.current;Tt(e),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=C.current,{startIndex:a,rowHeight:i}=r;let l="",o="";n&&(l=`${Math.max(0,a*i)}px`,o=e.length*i+"px"),t.$tableBody.style.marginTop=l,t.$tableYspace.style.height=o})(e)},Je=e=>Y?et(tt(e,0)):e,et=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...et(e.children)),delete e.children,t.push(e)})),t},tt=(e,t)=>{const n=i.groupItems?.[t];return n?rn(e,[n.dataIndex]).map((e=>{const a={children:tt(e,t+1),_group:n.dataIndex};return"function"!=typeof r&&zr(a,r.toString(),Qr()),n.titleIndex&&zr(a,n.titleIndex,jr(e[0],n.titleIndex)),zr(a,n.dataIndex,jr(e[0],n.dataIndex)),K.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[zo.summaryIgnore])return e;const n=Number(jr(r,t));return Number.isNaN(n)?e:e+n}),0);zr(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},rt=e=>{he(e),be((e=>{const{selectionRows:t,recordsMap:r}=C.current,n=new Map;t.forEach((e=>n.set(w(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=n.get(e[t])||r.get(e[t]);i&&a.push(i)}return a})(e))},nt=e=>{const{type:t,checkStrictly:r=!0}=d||{},n=Array.isArray(e)?e:$;let a=[];return C.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{disabled:r}=d||{},{deriveRowKeys:n,recordsMap:a}=C.current,i=Fr(n,e);let l=[];if(!i)return l;let o=it(i?.children||[]);return r&&(o=o.filter((e=>!a.has(e)||!r(a.get(e))))),l=[...new Set([...t,...o])],(an(n,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Fr(n,e),r=t?.children?.every((e=>l.includes(e.rowKey)));l=r?[...l,e]:l.filter((t=>t!==e))})),l})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},at=e=>{const{treeTable:t,allRowKeys:r,flattenRowKeys:n,deriveRowKeys:a,recordsMap:i}=C.current,{defaultExpandAllRows:l,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:q;if(t){s&&pe("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...$];M&&e.unshift(M),e.forEach((e=>{const t=an(a,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)}))}return c=l?r.slice(0):[...new Set(c)],t&&(c=c.filter((e=>!n.includes(e)))),o&&c.filter((e=>{const t=i.get(e);return!!t&&o(t)})),c},it=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...it(e[r].children)),t.push(e[r].rowKey);return t},lt=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...lt(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...lt(e,r[r.length-1])),r},ot=vt((()=>{y?.(A,ct(F),st(H),_,{currentDataSource:It()})})),st=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},ct=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[zo.showFilterType?`${n}|${a}`:n]=e[r]}return t},dt=(e,t)=>{const r=Object.keys(Vr(e,t));return 1===r.length&&(r.includes(zo.currentPageName)||r.includes(zo.pageSizeName))},ut=async()=>{if(!o)return;const{formatter:e=(e=>e),beforeFetch:t=re,afterFetch:r,callback:n}=o;if(!t(D))return;const a=!!i?.fetch?.api;ce(!0);try{const[t,l]=a?await Promise.all([o.api(e(D)),i.fetch.api(e(D))]):[await o.api(e(D))];if(C.current.unMounted)return;if(a?200===t.code&&200===l.code:200===t.code){const e=o.dataKey??zo.dataKey;let a=(0,Q.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,Q.get)(t.data,e.replace(/[^.]+$/,zo.totalKey))||a.length||0,s=Math.max(Math.ceil(i/A.pageSize),1);if(D[zo.currentPageName]>s)return yt({...A,current:s});ht(qe.current?C.current.tableFullData.concat(a):a),Ve(i),ft(l?.data||t.data),n?.(t.data,t)}}catch(e){S?.(e)}var l;l=o,Object.prototype.hasOwnProperty.call(l,"stopToFirst")&&(o.stopToFirst=!1),ce(!1),je(!1)},pt=vt(ut),mt=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=mt(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:r}=A;return!j||W?e:(t-1)*r+e})(t)),e))),ht=e=>{const t=Je(mt(e));Pt(t),Ot(t),rt($r(nt())),fe($r(at())),gt(),v?.(t)},ft=e=>{if(!U)return;const t=i?.fetch?.dataKey??zo.summationKey,r=(t?(0,Q.get)(e,t):e)??{},n={};K.filter((e=>!!e.summation.dataKey)).forEach((e=>{zr(n,e.dataIndex,Number(jr(r,e.summation.dataKey)))})),Ie(n)},gt=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=It();if(e.length){const t=w(e[0],e[0].index);rt([t])}else rt([])}},bt=()=>{if(!W)return;const e=Et();qe.current||A.current>=e||(je(!0),yt({...A,current:A.current+1}))},yt=({current:e,pageSize:t})=>{se((r=>Object.assign({},r,{current:e,pageSize:t})))},Et=()=>{const{pageSize:e,total:t}=A;return Math.ceil(t/e)||1},St=()=>{yt(Object.assign({},A,{current:1}))},wt=()=>{const{scrollYLoad:e,deriveRowKeys:t}=C.current;if(!C.current.treeTable||!e)return;const r=Ct(t,(()=>{const{allTableData:e,allRowKeys:t}=C.current,{rowExpandable:r}=u||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?q.filter((e=>!n.includes(e))):q})());$e.current.clear(),r.forEach(((e,t)=>$e.current.set(e,t)))},Ct=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Ct(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},Nt=()=>{const{current:e,pageSize:t}=A;return C.current.tableFullData.slice((e-1)*t,e*t)},It=()=>B?Nt():C.current.tableFullData,Tt=e=>{const{scrollYLoad:t,scrollYStore:r}=C.current;if(!t)return Z(e);const{startIndex:n,endIndex:a}=r;He?queueMicrotask((()=>He((()=>Z(e.slice(n,a)))))):Z(e.slice(n,a))},Rt=()=>{(()=>{let e=It();C.current.treeTable&&m?.virtual&&(e=(e=>{const{recordsMap:t,allRowKeys:r}=C.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];$e.current.has(a)&&n.push(t.get(a))}return n})()),We(e),ne(e)})(),Ze()},Pt=e=>{ee(e),ae(e),ie(e),kt(),wt(),Rt()},Ot=e=>{te(e)},kt=()=>{ke(),C.current.allTableData.forEach((e=>Re(w(e,e.index),e)))},At=()=>{de({})},Lt=()=>{ue({})},Ft=()=>{me([])},Ht=()=>{rt([])};return{initialTable:()=>{(async()=>{if(!h)return;let t=oe(h,["fetch"]);if(h.fetch){const{api:e,params:r,dataKey:n}=h.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,Q.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;Te((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=C.current,n=Pr(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:l}=a,o=Or(r,n);Ce(n,{visible:t,disabled:i,secretName:l}),t||(e.noAuth=!0,o.noAuth=!0),l&&(e.formatType=`secret-${l}`,o.formatType=`secret-${l}`)}}));b?.(n)}})(),M&&I.current.setClickedValues([M,""]),"radio"===d?.type&&$.length&&I.current.setClickedValues([$[0],""]),Be(),We(),j?ut():ht(a)},checkDataIndex:()=>{const e=P.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&pe("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:Pt,getTableData:ut,handleTableData:Tt,createWebPageData:Nt,createTableData:ht,createGroupData:Je,createSelectionKeys:nt,createRowExpandedKeys:at,setSelectionKeysEffect:rt,findParentRowKeys:lt,getAllChildRowKeys:it,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return pe("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Le.removeFromRequired({x:r,y:n}),Le.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&le(t)&&Le.addToRequired({x:r,y:n,text:e.message||O.find((({dataIndex:e})=>e===n)).title+Ae("qm.form.requiredTips")}),"function"!=typeof e.validator||e.validator?.(t)||Le.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Le.state,i=(0,Q.intersection)(r,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,Q.intersection)(n,r),...(0,Q.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{x?.(C.current.tableFullData)},tableChange:ot,toLastPage:()=>{const e=Et();A.current!==e&&yt(Object.assign({},A,{current:e}))},toFirstPage:St,getPageCount:Et,pagerChangeHandle:yt,triggerScrollXEvent:e=>{Ue(e)},triggerScrollYEvent:e=>{Qe(e)},scrollBottomDebouncer:ze,clearTableSorter:At,clearTableFilter:Lt,clearSuperFilters:Ft,clearRowSelection:Ht,clearRowHighlight:()=>{ge("")},clearTableLog:()=>{Le.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;Oe(),Le.destroy(),e.deregister(t)}}},es=(e,t)=>{const{height:r,minHeight:n,maxHeight:a,ellipsis:i,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:p,$size:m,tableColumns:h,flattenColumns:f,leftFixedColumns:g,derivedMergeCells:b,layout:y,scrollX:x,scrollY:v,showFooter:E,showPagination:S,isFullScreen:w,setLayout:C,setScrollX:N,setScrollY:I,setElementStore:T,setScrollXStore:R,setScrollYStore:P,setShouldToTop:O}=t,k=l().useRef(v),A=l().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=y,i={};return n&&Object.assign(i,{minHeight:`${Kr(n)}px`}),a&&Object.assign(i,{maxHeight:`${Kr(a)}px`}),w?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:r?{...i,height:"auto"!==r?`${Kr(r)}px`:`${t}px`}:i}),[r,a,n,w,y]),L=()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=o?e.$header.offsetHeight:y.headerHeight,i=E?e.$footer.offsetHeight:y.footerHeight,l=n-a-i,s=e.$tableBody.offsetHeight,c=t||s>l;let u=0;if(w){const t=e.$toper?e.$toper.offsetHeight+Po:0,n=e.$pager?e.$pager.offsetHeight+Po:0;u=r.winHeight-t-n-20}(t||l!==y.viewportHeight)&&H(l),k.current=c,I(c),C((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:u})))},F=(e,t)=>{const r=e+t;let n=-1,a=0,i=0;for(let t=0,l=f.length;t<l;t++){const l=f[t];if(a+=l.width||l.renderWidth,-1===n&&e<a&&(n=t),n>=0&&(i++,a>r))break}return{toVisibleIndex:Math.max(0,n),visibleSize:Math.max(8,i)}},H=e=>{const{scrollBarRef:t,scrollYStore:r,isIE:n}=d.current,a=t.current.scrollTop,{rowHeight:i}=r,{toVisibleIndex:l}=_(a,i),o=Math.max(8,Math.ceil(e/i)+2),s=n?5:0,c=Math.max(0,l-1-s),u=Math.max(l+o+s,r.endIndex);P(Object.assign({},r,{visibleSize:o,offsetSize:s,startIndex:c,endIndex:u}))},_=(e,t)=>{const r=Math.floor(e/t);return{toVisibleIndex:Math.max(0,r)}},D=(e,t)=>{const{scrollBarRef:r,elementStore:n,scrollYStore:a,scrollYLoad:i,tableFlatData:l}=d.current;if(void 0!==t&&t>=0)r.current.SET_SCROLL_TOP(t*a.rowHeight);else if(i){const t=l.findIndex((t=>e===c(t,t.index)));t>=0&&r.current.SET_SCROLL_TOP(t*a.rowHeight)}else{const t=n.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);t&&r.current.SET_SCROLL_TOP(t.offsetTop)}};return{createElementStore:()=>{T("$toper",u.current),T("$table",p.current)},tableStyles:A,getSpan:(e,t,r,n,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,Q.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}if(b.length>0){const e=b.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{if(f.findIndex((t=>t.dataIndex===e))<0){const t=Or(h,e);e=t?kr(t).dataIndex:""}let t=0;for(let r=0;r<f.length;r++){const n=f[r];if(n.dataIndex===e)break;t+=n.width||n.renderWidth||0}return t},getStickyRight:(e,t)=>{if(f.findIndex((t=>t.dataIndex===e))<0){const t=Or(h,e);e=t?Ar(t).dataIndex:""}const r="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let r=[];return e.forEach((e=>{e.colSpan>0&&r.length>0&&(t.push(r),r=[]),r.push(e)})),r.length>0&&t.push(r),t.map((e=>{const[t,r]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...r,...t.reverse()]})).flat()})(f):f;let n=0;for(let t=r.length-1;t>=0;t--){const a=r[t];if(a.dataIndex===e)break;n+=a.width||a.renderWidth||0}return n},scrollXToColumn:(e,t)=>{const{scrollBarRef:r}=d.current,n=void 0===t?f.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=g.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=f.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:D,rowInViewport:e=>{const{scrollBarRef:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=y,i=e*r.rowHeight;return!(i<t.current.scrollTop||i+r.rowHeight>t.current.scrollTop+(x?n-a:n))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(S?Ra["small"!==m?"middle":m]+Po:0)-Po;C((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&D("",0),O(!0)},computeVirtualX:F,computeVirtualY:_,doLayout:()=>{i?L():ae((()=>L())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,r=e.$table.clientWidth,n=k.current?y.gutterWidth:0,{defaultColumnWidth:a}=zo,i=[];let l=0;if(f.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,l+=e.width):(e.renderWidth=void 0,i.push(e))})),i.length>0){const e=f.reduce(((e,t)=>e+(t.width||t.minWidth||a)),0);if(e<=r-n){N(!1);const t=r-n-e;if(1===i.length)i[0].renderWidth=(i[0].minWidth||a)+t;else{const e=t/i.reduce(((e,t)=>e+(t.minWidth||a)),0);let r=0;i.forEach(((t,n)=>{if(0===n)return;const i=Math.floor((t.minWidth||a)*e);r+=i,t.renderWidth=(t.minWidth||a)+i})),i[0].renderWidth=(i[0].minWidth||a)+t-r}}else N(!0),i.forEach((e=>{e.renderWidth=e.minWidth||a}));C((t=>({...t,tableBodyWidth:Math.max(e,r)})))}else l=f.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||a)),0),N(l>r),C((e=>({...e,tableBodyWidth:l})));C((e=>({...e,tableWidth:r}))),t&&(e=>{const{scrollXStore:t,isIE:r,scrollBarRef:n}=d.current,a=n.current.scrollLeft,{toVisibleIndex:i,visibleSize:l}=F(a,e),o=r?5:0,s=Math.max(0,i-1-o),c=Math.max(i+l+o,t.endIndex);R(Object.assign({},t,{visibleSize:l,offsetSize:o,startIndex:s,endIndex:c}))})(r)})()}}};function ts({handler:e,delay:t=0}){const r=jt(e,t),n=Y(t>0?r:e);i.useEffect((()=>(window.addEventListener("resize",n),()=>window.removeEventListener("resize",n))),[n])}const rs=e=>{const{total:t}=e,{tableRef:r,selectionKeys:n,isHeadSorter:a,isHeadFilter:i,isTreeTable:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=l().useContext(Io),{infoBarConfig:m,rowSelection:h,rowHighlight:f}=r.current.props,{allTableData:g,invalidRowKeys:b}=r.current,{hideAlert:y,hideClearButton:x}=m||{},{t:v}=G(),E=l().useMemo((()=>!y),[y]),S=l().useMemo((()=>!x&&!!(a||i||h||f)),[x,a,i,h,f]),w=Ee("table"),C={[`${w}__alert`]:!0};return E?l().createElement("div",{className:ve()(C)},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.InfoCircleFilled,null)),l().createElement("span",null,v("qm.table.alert.total",{total:o?g.length:t}),h?`,${v("qm.table.alert.selected",{total:Math.max(n.length-b.length,0)})}`:""),S&&l().createElement("em",{onClick:()=>{c(),d(),u(),p(),ae((()=>s()))}},v("qm.table.alert.clear"))):null},ns=l().forwardRef(((e,t)=>{const{isFullScreen:r,open:n=!0}=e,{setFullScreen:a}=l().useContext(Io),{t:i}=G(),o=()=>{a(!r)};l().useImperativeHandle(t,(()=>({clickHandle:o})));const s=Ee("table");return n?l().createElement("span",{className:`${s}-full-screen`,title:i(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},r?l().createElement(Se.FullscreenExitOutlined,null):l().createElement(Se.FullscreenOutlined,null))):null}));ns.displayName="FullScreen";const as=ns,is=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{getTableData:n}=l().useContext(Io),{t:a}=G(),i=()=>{n()};l().useImperativeHandle(t,(()=>({clickHandle:i})));const o=Ee("table");return r?l().createElement("span",{className:`${o}-reload`,title:a("qm.table.refresh.text"),onClick:()=>i()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.ReloadOutlined,null))):null}));is.displayName="Reload";const ls=is,os=()=>{const e={dateFormat:e=>{const t=e?c()(e).format(Ao):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?c()(e).format(Lo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?c()(e).format(Lo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Wr(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Ur(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},t=(t,r,n)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=r,c=a||s?.(n,r)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==d&&(d=Wr(d)?new(xa())(d).toFixed(i):d),l>=0&&""!==d&&(d=Gr(d,l)),o){const t=e[`${ie(o)}Format`];t?d=t(d):pe("Table","字段的格式化类型 `formatType` 配置不正确")}return d},r=e=>J(e)?Zr(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,a,i)=>{const l=jr(e,n.dataIndex),o=n.render?n.render(l,e,n,a,i):t(l,n,e);return r(o)}}},ss=l().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=l().useContext(o),{tableRef:i,flattenColumns:s,summationRows:c,showSummary:d,getSpan:u}=l().useContext(Io),{tablePrint:p,showHeader:m}=i.current.props,{t:h}=G(),{getTitleFromCellValue:f}=os(),g=a?.print?.leftLogo??"",b=a?.print?.rightLogo??"",y=!(!g&&!b),x=l().useMemo((()=>se(Lr(r,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn]))),[r]),v=l().useMemo((()=>se(Lr(s,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn]))),[s]),E=l().useMemo((()=>se(r.filter((e=>e.printFixed)))),[r]),S=e=>{const t=Object.assign({},nn(x,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},w=(e,t)=>(0,Q.map)((0,Q.groupBy)((0,Q.flatten)(e),t),(0,Q.spread)(((...e)=>(0,Q.mergeWith)(...e,((e,r)=>{if(Array.isArray(e))return w(e.concat(r),t)}))))),C=()=>{const{tableFullData:e}=i.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||zo.defaultColumnWidth,n<=zo.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),E.length&&e.unshift(...E),t.push(r),r=[],n=0,a=0):(i.width=zo.printWidth,r.push(i),t.push(r),a++)}return t})([...v]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(S(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:w(r,"dataIndex")[0]})))(r),t.push(_r(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=N(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},N=(e,t,r)=>{const{showLogo:n=!0}=p;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((({width:e,minWidth:t,renderWidth:r})=>`<col style="width:${e||r||t||zo.defaultColumnWidth}px">`)).join("")}</colgroup>`,m&&(a+=["<thead>",n&&y?`<tr><th colspan="${t.length}" style="border: 0">${['<table class="no-border" width="100%" border="0" cellspacing="0" cellpadding="0">',"<tr>",'<td width="50%" align="left">',g?`<img src="${g}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${Jr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${Hr(r).map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=u(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${n<=0?`<span style="padding-left:${e._level*zo.treeTable.textIndent}px"></span>`:""}${f(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),d&&c.length&&(a+=["<tfoot>",c.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):jr(e,`${a}_text`);return`<td>${0===n&&""===l?h("qm.table.config.summaryText"):J(l)?Zr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},I=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});Pt(e,i)}})(0,C())?.then((({content:e,blob:t})=>{let r=document.createElement("iframe");r.setAttribute("frameborder","0"),r.setAttribute("width","100%"),r.setAttribute("height","0"),r.style.display="none",document.body.appendChild(r),i.current.isIE?(r.contentDocument.write(e),r.contentDocument.execCommand("print"),r.parentNode.removeChild(r),r=null):(r.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{r.parentNode.removeChild(r),r=null}))},r.src=URL.createObjectURL(t))}))};l().useImperativeHandle(t,(()=>({clickHandle:I})));const T=Ee("table");return n?l().createElement("span",{className:`${T}-print`,title:h("qm.table.print.text"),onClick:()=>I()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.PrinterOutlined,null))):null}));ss.displayName="TablePrint";const cs=ss,ds=require("exceljs");var us=n.n(ds);const ps="606060",ms="thin",hs="d4d4d4",fs=(e,t)=>{t&&(e.height=Math.floor(.75*t))},gs=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},bs=()=>({top:{style:ms,color:{argb:hs}},left:{style:ms,color:{argb:hs}},bottom:{style:ms,color:{argb:hs}},right:{style:ms,color:{argb:hs}}}),ys=e=>{const{children:t}=e;return t&&t.length?ys(t[0]):e},xs=e=>{const{precision:t,formatType:r}=e,n=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===r?{numFmt:n?`0${n}%`:"0%"}:"finance"===r?{numFmt:n?`#,##0${n}`:"#,##0"}:n?{numFmt:`0${n}`}:null},vs=()=>{const{tableRef:e,getSpan:t,showSummary:r,isHeadGroup:n}=l().useContext(Io),{spanMethod:a,showHeader:i}=e.current.props,{t:o}=G(),s=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(l,s,c,d)=>{const{columns:u,footSummation:p}=l,{scrollYStore:{rowHeight:m}}=e.current,h=Ir(u),f=_r(u),g=[],b=[],y=[],x=[];let v=0;const E={};h.forEach((e=>{const{dataIndex:t,width:r,minWidth:n,renderWidth:a}=e;E[t]=Jr(e.title),y.push({key:t,width:(r||a||n||zo.defaultColumnWidth)/8})})),i&&(n?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=ys(e),l=h.findIndex((({dataIndex:e})=>e===i.dataIndex));r[i.dataIndex]=Jr(e.title),0!==n&&(n>1||a>1)&&x.push({s:{r:t,c:l},e:{r:t+a-1,c:l+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&x.push({s:{r:v,c:t},e:{r:v+n-1,c:t+r-1}})})),g.push(E)),v+=g.length);const S=Hr(s).map(((e,r)=>{const n={};return h.forEach(((i,l)=>{if("function"==typeof a){const{rowSpan:n,colSpan:a}=t(e,i,r,l,s);(a>1||n>1)&&x.push({s:{r:r+v,c:l},e:{r:r+v+n-1,c:l+a-1}})}const o=["percent","finance"].includes(i.formatType);n[i.dataIndex]=o?jr(e,i.dataIndex):d(e,r,i,l)})),n._level=e._level,n}));v+=S.length,r&&p&&c(h,s).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(s):jr(e,a);r[a]=0===n&&""===l?o("qm.table.config.summaryText"):J(l)?Zr(l).join(""):l})),b.push(r)}));const{sheetName:w,useStyle:C}=l,N=new(us().Workbook),I=N.addWorksheet(w);I.columns=y,i&&I.addRows(g).forEach((e=>{C&&fs(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Or(u,t.key),{align:n,theadAlign:a}=r;gs(e,a||n),C&&Object.assign(e,{font:{bold:!0,color:{argb:ps}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:bs()})}))})),I.addRows(S).forEach(((e,t)=>{const{_level:r}=S[t];C&&fs(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),n=Or(u,t.key),{align:a}=n;gs(e,a),Object.assign(e,xs(n)),C&&Object.assign(e,{font:{color:{argb:ps}},border:bs()}),1===Number(e.col)&&r&&(e.alignment={...e.alignment,indent:r})}))})),r&&p&&I.addRows(b).forEach((e=>{C&&fs(e,m),e.eachCell((e=>{const t=I.getColumn(e.col),r=Or(u,t.key),{align:n}=r;gs(e,n),Object.assign(e,xs(r)),C&&Object.assign(e,{font:{color:{argb:ps}},border:bs()})}))})),x.forEach((({s:e,e:t})=>{I.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const T=await N.xlsx.writeBuffer();return new Blob([T],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],l=l+(n?",":"")+r(i.textContent.trim());l+="\r\n"}return l})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=Ir(r),i=new FileReader;i.onerror=()=>{P.message.error(o("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>Jr(e.title))),n=new(us().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,l);if(c){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;Array.isArray(n?.richText)&&(n=n.richText.map((e=>e.text)).join("")),(0,Q.isPlainObject)(n)&&"text"in n&&(n=n.text),(0,Q.isDate)(n)&&(n=Xr(n,Lo)),n?.formula&&(n=n.result??n.value),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>s(l,e))).filter((e=>""!==e)):t[e]=s(l,t[e])),zr(n,i,t[e])})),n}));t?.(n)}else P.message.error(o("qm.table.import.error"))}else P.message.error(o("qm.table.import.error"))})):P.message.error(o("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},Es=e=>{const{fileType:t,onChange:r}=e,{t:n}=G();let a,i;const o=Ee("table"),s=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return l().createElement(fe,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),i=document.createElement("input"),a.className=`${o}--file-form`,i.name="file",i.type="file",a.appendChild(i),document.body.appendChild(a)),new Promise(((e,r)=>{const l=!t.type;i.multiple=!!t.multiple,i.accept=l?"":`.${t.type}`,i.onchange=o=>{const{files:c}=o.target,d=c[0];let u="";if(!l)for(let e=0;e<c.length;e++){const{type:r}=s(c[e]);if(t.type!==r){u=r;break}}u?(P.message.warning(n("qm.upload.notType",{type:u})),r()):e(d),document.body.removeChild(a),a=null,i=null},a.reset(),i.click()}))})({type:t});r?.(e.name,e)}catch(e){}})()},n("qm.upload.text"))},Ss=e=>{const{columns:t,onClose:r}=e,{tableRef:n,createTableData:a,dataChange:i}=l().useContext(Io),{beforeTableImport:o}=n.current.props,{t:s}=G(),{importXLSX:c}=vs(),d=l().useRef(null),[u,p]=l().useState(!1),[m,h]=l().useState(!0),f=e=>e.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))),g={posIndex:"条"},[b,y]=l().useState([{type:"INPUT",label:s("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:r}=t.GET_FIELDS_VALUE(["fileName"]);return l().createElement(l().Fragment,null,r?l().createElement("span",null,r):l().createElement(Es,{fileType:t.state.formData.fileType,onChange:(e,r)=>{t.SET_FIELDS_VALUE({fileName:e,file:r}),r&&h(!1)}}))}},{type:"SELECT",label:s("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:s("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:s("qm.table.import.fillText"),value:"fill"},{text:s("qm.table.import.addText"),value:"add"},{text:s("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&d.current.SET_FIELDS_EXTRA(g),y([...b])}},{type:"INPUT_NUMBER",label:s("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:n.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]),x=Ee("table");return l().createElement("div",{className:`${x}-import__setting`},l().createElement(Ml,{ref:d,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:g,items:b,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r(),style:{marginRight:8}},s("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:u,disabled:m,onClick:()=>(async()=>{const[e,l]=await d.current.GET_FORM_DATA();e||(p(!0),c({columns:f(t),file:l.file},(async e=>{const{tableFullData:t,store:c}=n.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof o)try{e=await o(e)}catch(e){}if("fill"===l.importType&&a(e),"add"===l.importType&&a([...t,...e]),"insert"===l.importType){const r=l.posIndex,n=t.slice(0,r).concat(e).concat(t.slice(r));a(n)}e.forEach((e=>{c.addToInserted(e)})),i(),P.message.success(s("qm.table.import.success",{total:e.length})),p(!1),r()})))})()},s("qm.table.import.text"))))},ws=l().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{t:a}=G(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c=Ee("table"),d={[`${c}-import`]:!0},u={visible:i,title:a("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:ve()(d),title:a("qm.table.import.textNoSpace"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.ImportOutlined,null))),l().createElement(cr,u,l().createElement(Ss,{columns:r,onClose:()=>o(!1)})))}));ws.displayName="TableImport";const Cs=ws,Ns=e=>{const{columns:t,onChange:r}=e,{$size:n}=l().useContext(Io),{t:a}=G(),i=l().useRef([]),[o,s]=l().useState(!1),[c,d]=l().useState(t);_e((()=>{p()}),[c]),l().useEffect((()=>{u()}),[t]);const u=()=>{const e=[];t.forEach(((r,n)=>{const a=r.colSpan;a>1&&t.slice(n+1,n+a).every((({colSpan:e})=>0===e))&&e.push(t.slice(n,n+a))})),i.current=e},p=()=>{const e=[];c.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=i.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...i.current[a].map((({dataIndex:e},r)=>{const n=c.find((t=>t.dataIndex===e));return r>0&&void 0!==t.hidden&&(n.hidden=t.hidden),n})))})),r?.(e)},m=Ee("table"),h={[`${m}__popper`]:!0,"column-filter__popper":!0,[`${m}--lg`]:"large"===n,[`${m}--sm`]:"small"===n},f=[`${m}-column-filter`,{selected:o}];return l().createElement(Ma(),{action:["click"],popupVisible:o,popup:l().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"main"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:c,setList:e=>{const t=e.map((e=>e.dataIndex)),r=c.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||d(sn(e))}},c.map((e=>((e,t)=>{const{colSpan:r}=e;if(0===r)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(P.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,d([...c])}}),l().createElement("i",{className:ve()(n),title:a("qm.table.columnFilter.draggable")},l().createElement(Se.HolderOutlined,null)),l().createElement("span",{className:"text"},Jr(e.title)))})(e)))))),popupClassName:ve()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{s(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:ve()(f),title:a("qm.table.columnFilter.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.SettingOutlined,null)),l().createElement("span",null,a("qm.table.columnFilter.text"))))},Is=e=>{const{defaultValue:t,onClose:r,onOk:n}=e,{tableRef:a,selectionKeys:i,pagination:o,showSummary:s}=l().useContext(Io),{rowSelection:d}=a.current.props,{t:u}=G(),p=l().useRef(null),[m,h]=l().useState(!1),f=l().useMemo((()=>Object.assign({},{fileName:`${c()().format(Fo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:i.length?"selected":"all","startIndex|endIndex":[1,o.total],footSummation:s?1:0,useStyle:0},t,{columns:se(t.columns||[])})),[]),[g,b]=l().useState([{type:"INPUT",label:u("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:u("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:u("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:u("qm.table.export.all"),value:"all"},{text:u("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==d?.type},{text:u("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:u("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>l().createElement(Ns,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:u("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!s,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:u("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ee("table");return l().createElement("div",{className:`${y}-export__setting`},l().createElement(Ml,{ref:p,initialValues:f,items:g,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:m,onClick:()=>(async()=>{const[e,t]=await p.current.GET_FORM_DATA();if(!e){h(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);n(t),await ne(1e3),h(!1),r()}})()},u("qm.table.export.text"))))},Ts=l().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=l().useContext(o),{tableRef:i,flattenColumns:s,pagination:d,fetchParams:u,isFetch:p,isGroupSubtotal:m,showSummary:h,getSpan:f}=l().useContext(Io),{exportExcel:g,fetch:b,showHeader:y}=i.current.props,{t:x}=G(),{getTitleFromCellValue:v}=os(),[E,S]=l().useState(!1),[w,C]=l().useState(!1),N=l().useMemo((()=>!!g?.fetch?.api),[g]),I=l().useMemo((()=>!d.total||w),[d.total,w]),T=l().useMemo((()=>Lr(r,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn])),[r]),R=l().useMemo((()=>Lr(s,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn])),[s]),O=(e,t="",r=0)=>e.map(((e,n)=>{const a={...e,index:n,pageIndex:n},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=r,Array.isArray(e.children)&&(a.children=O(e.children,i,r+1)),R.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&zr(a,t,jr(a,t))})),a})),k=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(m?en(t):t).reduce(((e,t)=>{if(t?.[zo.summaryIgnore])return e;const r=Number(jr(t,n));return Number.isNaN(r)?e:e+r}),0);zr(r,n,a)})),[r]},A=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let l=v(e,r,t,n);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:L,exportCSV:F}=vs(),H=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=b;let i=[];try{C(!0);const l=await t({...r(u),[zo.currentPageName]:1,[zo.pageSizeName]:e??d.total});if(200===l.code){let e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,a)??[];e="function"==typeof n?await n(e):e,i=O(e)}}catch(e){}return C(!1),i},_=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},D=g?.fileName??`${c()().format(Fo)}.xlsx`,$=D.slice(D.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(I)return P.message.warning(x("qm.table.export.warnText"));N?(async e=>{C(!0);try{const{api:t,params:r}=g.fetch,n=await t({columns:R.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...u,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[zo.currentPageName]:void 0,[zo.pageSizeName]:void 0});n.data&&(Pt(n.data,e),_(e))}catch(e){}C(!1)})(D):S(!0)};l().useImperativeHandle(t,(()=>({clickHandle:q})));const M=Ee("table"),K={[`${M}-export`]:!0},V={visible:E,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},j={fileName:D.slice(0,D.lastIndexOf(".")),fileType:$,columns:T,useStyle:g?.cellStyle?1:0};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:ve()(K),title:x("qm.table.export.textNoSpace"),onClick:()=>q()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.DownloadOutlined,null))),l().createElement(cr,V,l().createElement(Is,{defaultValue:j,onClose:()=>S(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:l}=e,{tableFullData:o,selectionRows:s}=i.current;let c=[];if(p?("all"===n&&(c=await H()),"custom"===n&&(c=await H(l),c=c.slice(a-1))):("all"===n&&(c=o.slice(0)),"custom"===n&&(c=o.slice(a-1,l||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof g?.beforeExport)try{c=g?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await L(e,c,k,A);Pt(r,`${t}.xlsx`),_(`${t}.xlsx`)}if("csv"===r){const r=F(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=_r(r),i=Ir(r);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((({width:e,minWidth:t,renderWidth:r})=>`<col style="width:${e||r||t||zo.defaultColumnWidth}px">`)).join("")}</colgroup>`,y&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${Jr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${Hr(t).map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=f(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${A(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),h&&n&&(l+=["<tfoot>",k(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,l=i?.render?i.render(t):jr(e,a);return`<td>${0===n&&""===l?x("qm.table.config.summaryText"):J(l)?Zr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));Pt(r,`${t}.csv`),_(`${t}.csv`)}})(Object.assign({},e,{columns:Tr(e.columns)}))}})))}));Ts.displayName="TableExport";const Rs=Ts,Ps=e=>{const{columns:t,onClose:r}=e,{tableRef:n,tableBodyRef:a,dataChange:i}=l().useContext(Io),{beforeClipboard:o}=n.current.props,{t:s}=G(),c=l().useRef(null),[d,u]=l().useState([{type:"INPUT_NUMBER",label:s("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:s("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:Jr(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:s("qm.table.clipboard.content"),fieldName:"content",placeholder:s("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[p,m]=l().useState(!1),h=Ee("table");return l().createElement("div",{className:`${h}-clipboard__setting`},l().createElement("h3",{className:"info"},s("qm.table.clipboard.supportText")),l().createElement(Ml,{ref:c,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:d,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r(),style:{marginRight:8}},s("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,l]=await c.current.GET_FORM_DATA();if(e)return;const{tableFullData:d,store:u}=n.current;m(!0);const p=l.content.trim().replace(/(\r|\n)$/,"");let h=p.replace(/"[^"]+"/g,"^");(p.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{h=h.replace(/\^/,e)}));let f=h.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof o)try{f=await o(f,f[0].map(((e,r)=>t[l.colIndex+r].dataIndex)))}catch(e){}f.forEach(((e,r)=>{e.forEach(((e,a)=>{const i=d[l.rowIndex-1+r],o=t[l.colIndex+a];if(i&&o){let t=!1;if(o.editRender){const e=o.editRender(i,o);t=!(e.disabled||e.extra?.disabled||n.current.fieldAuth[o.dataIndex]?.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&(zr(i,o.dataIndex,e),u.addToUpdated(i))}}))})),a.current.forceUpdate(),i(),P.message.success(s("qm.table.clipboard.success",{total:f.length})),m(!1),r()})()},s("qm.table.clipboard.text"))))},Os=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{flattenColumns:n}=l().useContext(Io),{t:a}=G(),[i,o]=l().useState(!1),s=l().useMemo((()=>(e=>e.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))))(n)),[n]),c=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:c})));const d=Ee("table"),u={[`${d}-clipboard`]:!0},p={visible:i,title:a("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:ve()(u),title:a("qm.table.clipboard.textNoSpace"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.CopyOutlined,null))),l().createElement(cr,p,l().createElement(Ps,{columns:s,onClose:()=>o(!1)})))}));Os.displayName="TableClipboard";const ks=Os,As=e=>{const{columns:t,onClose:r}=e,{tableRef:n,$size:a,selectionKeys:i,setSelectionKeysEffect:o}=l().useContext(Io),{rowKey:s,rowSelection:c}=n.current.props,{t:d}=G(),u=l().useRef(null),p=xt(u),m=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=m(e.children)),t})),[h,f]=l().useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...m(t.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))))]),[b]=l().useState((()=>{const{disabled:e}=c||{},t=n.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[y,x]=l().useState(300),v=vt((()=>{const e=u.current;x(e.offsetHeight-2*Ra[a]-30)}),5);return g((()=>{v()}),[p.width]),l().createElement("div",{ref:u,style:{height:"100%"}},l().createElement(Kc,{size:a,columns:h,dataSource:b,rowKey:s,height:y,rowSelection:{type:"checkbox",selectedRowKeys:i,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),l().createElement("div",{style:{height:10}}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},Ls=l().forwardRef(((e,t)=>{const{columns:r,open:n=!0}=e,{tableRef:a,getRowKey:i,selectionKeys:o,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:d,setSelectionRows:u}=l().useContext(Io),{rowSelection:p}=a.current.props,{t:m}=G(),[h,f]=l().useState(!1),g=l().useRef(!1);_e((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:o},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,Q.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),d(n.map(((e,t)=>i(e,t)))),u(n),g.current=!0}}catch(e){}},y=()=>{f(!0)};l().useImperativeHandle(t,(()=>({clickHandle:y})));const x=Ee("table"),v={visible:h,title:m("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>f(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${x}-select-collection`,title:m("qm.table.selectCollection.text"),onClick:()=>y()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.CheckSquareOutlined,null))),l().createElement(cr,v,l().createElement(As,{columns:r,onClose:()=>f(!1)})))}));Ls.displayName="SelectCollection";const Fs=Ls,Hs=require("localforage");var _s=n.n(Hs);const Ds=e=>{const{onClose:t}=e,{global:r}=l().useContext(o),{tableRef:n,getRowKey:a,$size:i,flattenColumns:s,pagination:c,createWebPageData:d,setPagination:u,scrollYToRecord:p,setHighlightKey:m,setShouldToTop:h,isTreeTable:f,isWebPagination:g}=l().useContext(Io),{uniqueKey:b}=n.current.props,{t:y}=G(),x=l().useRef(null),v=l().useRef(null),E=l().useRef([]),S=l().useRef(""),w=l().useRef(-1),C=l().useRef("stop");_e((()=>{const e=Hr(d()).findIndex((e=>a(e,e.index)===S.current));p("",e)}),[c.current]);const N=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},I=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:N(e.filter.type),fieldName:e.dataIndex,label:Jr(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[r,n]=await v.current.GET_FORM_DATA(),a=(0,Q.omitBy)(Object.assign({},t,n),le);k(a)}}))),T={case:0,fullchar:0},R=l().useMemo((()=>s.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[s]),[O,k]=l().useState({}),[A,L]=l().useState(T),[F]=l().useState(I([R[0]])),[H]=l().useState(I(R.slice(1))),[_,D]=l().useState(0),$=l().useMemo((()=>!Object.keys(O).length),[O]);_e((()=>{C.current="ready"}),[O,A]);const q=e=>{L(Object.assign({},A,e))},M=(e,t,r)=>new Promise(((n,a)=>{P.Modal.confirm({title:y("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),K=async e=>{if(!Object.keys(O).length)return P.Modal.warning({title:y("qm.button.confirmPrompt"),content:y("qm.table.fastSearch.queryCondition")});if("ready"===C.current&&(C.current="stop",E.current=(e=>{const{allTableData:t}=n.current,r=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];let l=!0;for(const t in e){const{type:r}=R.find((e=>e.dataIndex===t)).filter;let n=jr(i,t),o=!0;if("text"===r||"textarea"===r?o=new RegExp(A.fullchar?`^${e[t]}$`:e[t],A.case?"":"i").test(n):(n="string"==typeof(a=n)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(a)?n.slice(0,10):n,o=n==e[t]),!o){l=!1;break}}l&&r.push(i)}var a;return r})(O),D(E.current.length)),!E.current.length)return m(""),P.Modal.warning({title:y("qm.button.confirmPrompt"),content:y("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>E.current.length-1&&await M(y("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=E.current.length-1))),"prev"===e&&(w.current=w.current<0?E.current.length-1:w.current-1,w.current<0&&await M(y("qm.table.fastSearch.toStart"),(()=>w.current=E.current.length-1),(()=>w.current=0)));const t=E.current[w.current],r=a(t,t.index);let i=t.index;if(f&&g){const e=an(n.current.deriveRowKeys,r)[0];i=n.current.tableFullData.findIndex((t=>a(t,t.index)===e))}((e,t)=>{if(S.current=e,g){const{pageSize:e}=c,r=Math.ceil((t+1)/e);h(!1),u(Object.assign({},c,{current:r}))}else p(e)})(r,i),m(r)},V=()=>{x.current.RESET_FORM(),v.current.RESET_FORM()},j=l().useMemo((()=>b?`fastSearch_${b}`:""),[b]),[z,B]=l().useState([]),[W,U]=l().useState(""),[Y,X]=l().useState("");_e((()=>{if(Y){const{filters:e,config:t}=z.find((e=>e.value===Y)).list;x.current.SET_FIELDS_VALUE(oe(e,H.map((e=>e.fieldName)))),v.current.SET_FIELDS_VALUE(oe(e,F.map((e=>e.fieldName)))),k(e),L(t)}else V(),k({}),L(T)}),[Y]),l().useEffect((()=>{Z()}),[]);const Z=async()=>{if(!j)return;let e=await _s().getItem(j);e||(e=await J(j),Array.isArray(e)&&await _s().setItem(j,e)),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))},J=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},ee=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},te=Ee("table");return l().createElement("div",{className:`${te}-fast-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"top"},l().createElement("div",{className:"container"},l().createElement(Jt,{defaultActiveKey:"1",size:"small",tabBarExtraContent:l().createElement("span",null,y("qm.table.alert.total",{total:_}))},l().createElement(Jt.TabPane,{tab:y("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},l().createElement(Ml,{ref:x,items:F,cols:1,labelWidth:110})),l().createElement(Jt.TabPane,{tab:y("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},l().createElement(Ml,{ref:v,items:H,cols:1,labelWidth:110})))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(P.Input,{size:i,value:W,placeholder:y("qm.table.highSearch.configText"),disabled:$,onChange:e=>{const{value:t}=e.target;U(t)}}),l().createElement(fe,{type:"primary",disabled:!W||$,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!j)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Qr(),t=[...z,{text:W,value:e,list:{filters:O,config:A}}];B(t),X(e),U(""),await _s().setItem(j,t),await ee(j,t)})()},y("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${zo.rowHeightMaps[i]}px`}},l().createElement("span",null,y("qm.table.fastSearch.savedSetting"))),l().createElement("ul",null,z.map((e=>l().createElement("li",{key:e.value,className:ve()({selected:e.value===Y}),title:e.text,onClick:()=>{return t=e.value,void X(t!==Y?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:y("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=z.filter((t=>t.value!==e));B(t),e===Y&&X(""),await _s().setItem(j,t),await ee(j,t)})(e.value)}},l().createElement(Se.CloseCircleOutlined,null))))),!z.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ct,null)))))),l().createElement("div",{className:"bottom"},l().createElement("div",null,l().createElement(P.Checkbox,{checked:!!A.case,onChange:e=>q({case:e.target.checked})},y("qm.table.fastSearch.matchCase")),l().createElement(P.Checkbox,{checked:!!A.fullchar,onChange:e=>q({fullchar:e.target.checked})},y("qm.table.fastSearch.matchFullchar"))),l().createElement("div",null,l().createElement(fe,{onClick:()=>V()},y("qm.table.fastSearch.clear"))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Ra[i]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},y("qm.table.fastSearch.closeButton")),l().createElement(fe,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},y("qm.table.fastSearch.queryPrev")),l().createElement(fe,{type:"primary",onClick:()=>K("next")},y("qm.table.fastSearch.queryNext"))))},$s=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{$size:n}=l().useContext(Io),{t:a}=G(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c=Ee("table"),d={visible:i,title:a("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Ra[n]+20}px`},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${c}-super-search`,title:a("qm.table.fastSearch.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.MonitorOutlined,null))),l().createElement(cr,d,l().createElement(Ds,{onClose:()=>o(!1)})))}));$s.displayName="FastSearch";const qs=$s,Ms=e=>{const{columns:t,group:r,summary:n}=e,{tableRef:a,$size:i,pagination:o,fetchParams:s,isFetch:d}=l().useContext(Io),{fetch:u}=a.current.props,{t:p}=G(),m=e=>{const r=t.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:r.dictItems??[]}},h=r.map((e=>({dataIndex:e.group,...m(e.group)}))),f=n.map((e=>e.summary===zo.groupSummary.total.value?{dataIndex:e.summary,title:zo.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...m(e.summary),formula:e.formula})),g=l().useMemo((()=>Object.assign({},s,{[zo.sorterFieldName]:void 0,[zo.groupSummary.summaryFieldName]:n.map((e=>`${e.formula}|${e.summary}`)).join(","),[zo.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[zo.currentPageName]:1})),[s,r,n]),[b,y]=l().useState(((e,r)=>[{title:p("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...r.map((e=>{const r=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=r?{summation:r}:null;return e.dataIndex===zo.groupSummary.total.value&&(n={dataIndex:zo.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,f)),[x]=l().useState(d?[]:(e=>{const t=rn(e,r.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};b.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&zr(t,n,jr(e[0],n))})),n.forEach((r=>{const n=r.summary!==zo.groupSummary.total.value?r.summary:zo.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&zr(t,n,e.length),"sum"===a&&zr(t,n,(0,Q.sumBy)(e,n)),"max"===a&&zr(t,n,(0,Q.maxBy)(e,n)[n]),"min"===a&&zr(t,n,(0,Q.minBy)(e,n)[n]),"avg"===a&&zr(t,n,((0,Q.sumBy)(e,n)/e.length).toFixed(2))})),a.push(t)})),a})(a.current.tableFullData)),v={size:i,height:400,...d?{fetch:{api:u.api,params:g,dataKey:u?.dataKey}}:{dataSource:x},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${c()().format(Fo)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)};return l().createElement(Kc,v)},Ks=e=>{const{onClose:t}=e,{global:r}=l().useContext(o),{tableRef:n,$size:a,flattenColumns:i}=l().useContext(Io),{uniqueKey:s}=n.current.props,{t:c}=G(),d=l().useRef(null),u=l().useRef(null),[p,m]=l().useState(!1),[h,f]=l().useState([]),[g,b]=l().useState(""),[y,x]=l().useState("");_e((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;I(e),k(t)}else{const e=H();I(e?.group||[]),k(e?.summary||[])}}),[y]),l().useEffect((()=>{_()}),[]);const v=l().useMemo((()=>s?`summary_${s}`:""),[s]),E=l().useMemo((()=>i.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex)))),[i]),S=E.filter((e=>!e.groupSummary)).map((e=>({text:Jr(e.title),value:e.dataIndex}))),w=[zo.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:Jr(e.title),value:e.dataIndex})))],C=[{text:c("qm.table.groupSummary.sumText"),value:"sum"},{text:c("qm.table.groupSummary.maxText"),value:"max"},{text:c("qm.table.groupSummary.minText"),value:"min"},{text:c("qm.table.groupSummary.avgText"),value:"avg"},{text:c("qm.table.groupSummary.countText"),value:"count"}],[N,I]=l().useState([]),[T,R]=l().useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(t)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:c("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:S.map((e=>({...e,disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[O,k]=l().useState([]),[A,L]=l().useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:c("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:w.map((e=>({...e,disabled:O.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:c("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===zo.groupSummary.total.value?C.slice(C.length-1):C})}]),F=l().useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=O.length&&O.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,O]),H=()=>{if(!v)return;const e=sessionStorage.getItem(v);return e?JSON.parse(e):null},_=async()=>{if(!v)return;const e=H();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await _s().getItem(v);t||(t=await D(v),Array.isArray(t)&&await _s().setItem(v,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},D=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},$=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},q=Ee("table"),M={visible:p,title:c("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>m(!1)};return l().createElement("div",{className:`${q}-group-summary__setting`},l().createElement("div",{className:"main"},l().createElement("div",{style:{width:"30%"}},l().createElement(Kc,{ref:d,size:a,columns:T,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>R(e),onDataChange:e=>{I(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(Se.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"container line"},l().createElement(Kc,{ref:u,size:a,columns:A,dataSource:O,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>L(e),onDataChange:e=>{k(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(Se.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(P.Input,{size:a,value:g,placeholder:c("qm.table.groupSummary.configText"),disabled:F,onChange:e=>{const{value:t}=e.target;b(t)}}),l().createElement(fe,{type:"primary",disabled:!g||F,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!v)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Qr(),t=[...h,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}}];f(t),x(e),b(""),await _s().setItem(v,t),await $(v,t)})()},c("qm.table.groupSummary.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${zo.rowHeightMaps[a]}px`}},l().createElement("span",null,c("qm.table.groupSummary.savedSetting"))),l().createElement("ul",null,h.map((e=>l().createElement("li",{key:e.value,className:ve()({selected:e.value===y}),title:e.text,onClick:()=>{return t=e.value,void x(t!==y?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:c("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));f(t),e===y&&x(""),await _s().setItem(v,t),await $(v,t)})(e.value)}},l().createElement(Se.CloseCircleOutlined,null))))),!h.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ct,null)))))),l().createElement(cr,M,l().createElement(Ms,{columns:E,group:N,summary:O})),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),l().createElement(fe,{type:"primary",disabled:F,onClick:()=>(v&&sessionStorage.setItem(v,JSON.stringify({group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))})),void m(!0))},c("qm.table.groupSummary.confirmButton"))))},Vs=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{t:n}=G(),[a,i]=l().useState(!1),o=()=>{i(!0)};l().useImperativeHandle(t,(()=>({clickHandle:o})));const s=Ee("table"),c={visible:a,title:n("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${s}-group-summary`,title:n("qm.table.groupSummary.text"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.PieChartOutlined,null))),l().createElement(cr,c,l().createElement(Ks,{onClose:()=>i(!1)})))}));Vs.displayName="GroupSummary";const js=Vs,zs=e=>{const{onClose:t}=e,{global:r}=l().useContext(o),{tableRef:n,$size:a,flattenColumns:i,setSuperFilters:s,clearTableFilter:c}=l().useContext(Io),{uniqueKey:d}=n.current.props,{t:u}=G(),p=l().useRef(null),[m,h]=l().useState([]),[f,g]=l().useState([]),[b,y]=l().useState(""),[x,v]=l().useState("");_e((()=>{h(x?f.find((e=>e.value===x)).list:H()||[])}),[x]),l().useEffect((()=>{_()}),[]);const E=l().useMemo((()=>d?`superSearch_${d}`:""),[d]),S=l().useMemo((()=>i.filter((e=>!!e.filter))),[i]),w=tn(m),C=l().useMemo((()=>!(w&&Cr(w))),[w]),N=l().useMemo((()=>!!m.length&&C),[m,C]),I=[{value:"and",text:u("qm.table.highSearch.andText")},{value:"or",text:u("qm.table.highSearch.orText")}],T=i.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Jr(e.title)}))),R=e=>["in","nin"].includes(e),O=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:u("qm.table.highSearch.gtText")},{value:"<",text:u("qm.table.highSearch.ltText")},{value:">=",text:u("qm.table.highSearch.gteText")},{value:"<=",text:u("qm.table.highSearch.lteText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:u("qm.table.highSearch.inText")},{value:"nin",text:u("qm.table.highSearch.ninText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:u("qm.table.highSearch.likeText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}]}return t},[A,L]=l().useState([{title:u("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{p.current.REMOVE_RECORDS(t)}},u("qm.table.highSearch.removeText")))},{title:u("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:u("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:T,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:u("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=S.find((e=>e.dataIndex===r))?.filter.type,a=k(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=R(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:u("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:u("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=S.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=R(e.expression)?[]:""}}}},{title:u("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=S.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:O(r,R(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:u("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:u("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),F=()=>{E&&sessionStorage.setItem(E,JSON.stringify(m.filter((e=>!!e.fieldName))))},H=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},_=async()=>{if(!E)return;const e=H();e&&h(e);let t=await _s().getItem(E);t||(t=await D(E),Array.isArray(t)&&await _s().setItem(E,t)),Array.isArray(t)&&t.length&&(g(t),!e&&v(t[0].value))},D=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},$=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},q=Ee("table");return l().createElement("div",{className:`${q}-super-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"container"},l().createElement(Kc,{ref:p,size:a,columns:A,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>L(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...m]))},onDataChange:e=>{h(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(Se.PlusOutlined,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),zo.highSearch.showSQL&&w&&l().createElement("code",{className:"lang-js"},w)),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(P.Input,{size:a,value:b,placeholder:u("qm.table.highSearch.configText"),disabled:C,onChange:e=>{const{value:t}=e.target;y(t)}}),l().createElement(fe,{type:"primary",disabled:!b||C,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Qr(),t=[...f,{text:b,value:e,list:m.filter((e=>!!e.fieldName))}];g(t),v(e),y(""),await _s().setItem(E,t),await $(E,t)})()},u("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${zo.rowHeightMaps[a]}px`}},l().createElement("span",null,u("qm.table.highSearch.savedSetting"))),l().createElement("ul",null,f.map((e=>l().createElement("li",{key:e.value,className:ve()({selected:e.value===x}),title:e.text,onClick:()=>{return t=e.value,void v(t!==x?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:u("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));g(t),e===x&&v(""),await _s().setItem(E,t),await $(E,t)})(e.value)}},l().createElement(Se.CloseCircleOutlined,null))))),!f.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ct,null)))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},u("qm.table.highSearch.closeButton")),l().createElement(fe,{type:"primary",disabled:N,onClick:()=>(c(),s(m.map((e=>oe(e,["index","pageIndex"])))),F(),void t())},u("qm.table.highSearch.searchButton"))))},Bs=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{t:n}=G(),[a,i]=l().useState(!1),o=()=>{i(!0)};l().useImperativeHandle(t,(()=>({clickHandle:o})));const s=Ee("table"),c={visible:a,title:n("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${s}-super-search`,title:n("qm.table.highSearch.text"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.FunnelPlotOutlined,null))),l().createElement(cr,c,l().createElement(zs,{onClose:()=>i(!1)})))}));Bs.displayName="SuperSearch";const Ws=Bs,Us=l().forwardRef(((e,t)=>{const{tableColumns:r,showFullScreen:n,showReload:a,showPrint:i,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:p,showSuperSearch:m,showGroupSummary:h,showToolBox:f}=e,{global:g}=l().useContext(o),{tableRef:b,isFullScreen:y,$size:x}=l().useContext(Io),{uniqueKey:v,exportExcel:E}=b.current.props,{t:S}=G(),w=l().useRef(null),C=l().useRef(null),N=l().useRef(null),I=l().useRef(null),T=l().useRef(null),R=l().useRef(null),O=l().useRef(null),k=l().useRef(null),A=l().useRef(null),L=l().useRef(null),F=l().useRef(!1),H=l().useMemo((()=>v?`toolBox_${v}`:""),[v]),[_,D]=l().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),$={fullScreen:n,reload:a,print:i,import:s,export:c&&!E?.hideIcon,clipboard:d,collection:u,fastSearch:p,superSearch:m,groupSummary:h},[q,M]=l().useState(!1);_e((()=>{F.current&&(V(),F.current=!1)}),[_]),l().useEffect((()=>{K()}),[]),l().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!T.current)return pe("Table","执行导出需要配置 `exportExcel` 参数");T.current.clickHandle()}})));const K=()=>{if(!H||!f)return;const e=JSON.parse(localStorage.getItem(H));e||j(H).then((e=>{e&&(D(Object.assign({},_,e)),localStorage.setItem(H,JSON.stringify(e)))})).catch((()=>{})),e&&D(Object.assign({},_,e))},V=()=>{if(!H||!f)return;const e={};for(const t in _)_[t]&&(e[t]=_[t]);localStorage.setItem(H,JSON.stringify(e)),z(H,e)},j=async e=>{const t=g?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},z=async(e,t)=>{const r=g?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},B=async e=>{M(!1),await ne(100),e.current.clickHandle()},W=(e,t)=>{F.current=!0,D(Object.assign({},_,{[t]:e}))},U=Ee("table"),Y={"top-toolbox__popper":!0,[`${U}--lg`]:"large"===x,[`${U}--sm`]:"small"===x};return l().createElement(l().Fragment,null,n&&l().createElement(as,{ref:w,isFullScreen:y,open:!f||_.fullScreen}),a&&l().createElement(ls,{ref:C,open:!f||_.reload}),i&&l().createElement(cs,{ref:N,tableColumns:r,open:!f||_.print}),s&&l().createElement(Cs,{ref:I,tableColumns:r,open:!f||_.import}),c&&l().createElement(Rs,{ref:T,tableColumns:r,open:(!f||_.export)&&!E?.hideIcon}),d&&l().createElement(ks,{ref:R,open:!f||_.clipboard}),u&&l().createElement(Fs,{ref:O,columns:r,open:!f||_.collection}),p&&l().createElement(qs,{ref:k,open:!f||_.fastSearch}),h&&l().createElement(js,{ref:A,open:!f||_.groupSummary}),m&&l().createElement(Ws,{ref:L,open:!f||_.superSearch}),f&&l().createElement(P.Dropdown,{open:q,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.fullScreen,style:{marginRight:6},onChange:e=>W(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.screen.full"))),onClick:()=>B(w)},{key:"reload",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.reload,style:{marginRight:6},onChange:e=>W(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.refresh.text"))),onClick:()=>B(C)},{key:"print",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.print,style:{marginRight:6},onChange:e=>W(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.print.text"))),onClick:()=>B(N)},{key:"import",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.import,style:{marginRight:6},onChange:e=>W(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.import.textNoSpace"))),onClick:()=>B(I)},{key:"export",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.export,style:{marginRight:6},onChange:e=>W(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.export.textNoSpace"))),onClick:()=>B(T)},{key:"clipboard",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.clipboard,style:{marginRight:6},onChange:e=>W(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.clipboard.textNoSpace"))),onClick:()=>B(R)},{key:"collection",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.collection,style:{marginRight:6},onChange:e=>W(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.selectCollection.text"))),onClick:()=>B(O)},{key:"fastSearch",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.fastSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.fastSearch.text"))),onClick:()=>B(k)},{key:"groupSummary",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.groupSummary,style:{marginRight:6},onChange:e=>W(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.groupSummary.text"))),onClick:()=>B(A)},{key:"superSearch",label:l().createElement(l().Fragment,null,l().createElement(P.Checkbox,{checked:_.superSearch,style:{marginRight:6},onChange:e=>W(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.highSearch.text"))),onClick:()=>B(L)}];return l().createElement(P.Menu,{items:e.filter((e=>$[e.key]))})})(),overlayClassName:ve()(Y),overlayStyle:{minWidth:120},onOpenChange:e=>{M(e)}},l().createElement("span",{className:`${U}-toolbox`,title:S("qm.table.toolbox.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.AppstoreAddOutlined,null)))))}));Us.displayName="ToolBox";const Gs=Us,Ys=(e,t)=>e.map((e=>(e.children&&(e.children=Ys(e.children,t)),t(e)))),Xs=l().forwardRef(((e,t)=>{const{columns:r}=e,{global:n}=l().useContext(o),{tableRef:a,$size:i}=l().useContext(Io),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=a.current.props,{t:p}=G(),m=l().useRef([]),[h,f]=l().useState(!1),g=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),b=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),x=l().useMemo((()=>c?`table_${c}`:""),[c]);_e((()=>{E(r)}),[r]),l().useLayoutEffect((()=>{S()}),[]),l().useImperativeHandle(t,(()=>({initialHandler:S})));const v=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=v(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),E=e=>{if(!x)return;const t=v(e),r=JSON.parse(localStorage.getItem(x));a.current.columnsDefined&&!(0,Q.isEqual)(t,r)&&(localStorage.setItem(x,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(x,t))},S=()=>{const e=(()=>{if(!x)return;const e=JSON.parse(localStorage.getItem(x));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(x).then((e=>{e?(localStorage.setItem(x,JSON.stringify(e)),S()):n?.getComponentConfigApi&&E(r)})).catch((()=>{})),e?(0,Q.xor)(Rr(e).map((e=>e.dataIndex)),Rr(r).map((e=>e.dataIndex))).length>0?Ys(r,(t=>{const r=Or(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):Ys(e,(e=>{const t=Or(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=w(e),m.current=t,u?.(e))},w=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((({colSpan:e})=>0===e))&&t.push(e.slice(n,n+a))})),t},C=e=>{const t=[];e.forEach((r=>{const{colSpan:n,dataIndex:a}=r;if(0===n)return;if(1===n)return t.push(r);const i=m.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(r);t.push(...m.current[i].map((({dataIndex:t},n)=>{const a=e.find((e=>e.dataIndex===t));return n>0&&(void 0!==r.hidden&&(a.hidden=r.hidden),void 0!==r.fixed?a.fixed=r.fixed:a.fixed&&delete a.fixed),a})))})),r.forEach(((e,r)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(r,0,e)})),u?.(t)},N=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,C(r))},I=(e,t)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=Jr(e.title),o=["svgicon","handle",`${t}-handle`],s=l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(P.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,C(r)}}),l().createElement("i",{className:ve()(o),title:p("qm.table.columnFilter.draggable")},l().createElement(Se.HolderOutlined,null)),l().createElement("span",{className:"text",title:i},i),"main"===t?l().createElement("span",{className:ve()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>N(e,"left")},l().createElement(Se.StepBackwardOutlined,null)),l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>N(e,"right")},l().createElement(Se.StepForwardOutlined,null))):"sub"!==t?l().createElement("span",{className:ve()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>N(e)},l().createElement(Se.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?l().createElement(P.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:T(e.children,e.dataIndex)},s):s},T=(e,t)=>l().createElement("div",{className:"column-filter--wrap"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:n=>{const a=n.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,Q.isEqual)(a,i)||((e,t)=>{Or(r,t).children=e,u?.([...r])})(sn(n),t)}},e.map((e=>I(e,"sub"))))),R=Ee("table"),O={[`${R}__popper`]:!0,"column-filter__popper":!0,[`${R}--lg`]:"large"===i,[`${R}--sm`]:"small"===i},k=[`${R}-column-filter`,{selected:h}];return s?l().createElement(Ma(),{action:["click"],popupVisible:h,popup:l().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"reset"},l().createElement(fe,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const n=Or(r,t.dataIndex)||se(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));u?.(e(a.current.originColumns))}},p("qm.table.columnFilter.reset"))),l().createElement("div",{className:"left"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),r=g.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||C([...sn(e),...y,...b])}},g.map((e=>I(e,"left"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"main"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||C([...g,...sn(e),...b])}},y.map((e=>I(e,"main"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"right"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),r=b.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||C([...g,...y,...sn(e)])}},b.map((e=>I(e,"right")))))),popupClassName:ve()(O),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:ve()(k),title:d?p("qm.table.columnFilter.text"):void 0},l().createElement("i",{className:"svgicon icon"},l().createElement(Se.SettingOutlined,null)),!d&&l().createElement("span",null,p("qm.table.columnFilter.text")))):null}));Xs.displayName="ColumnFilter";const Qs=Xs,Zs=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function Js(){return Js=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Js.apply(null,arguments)}const ec=e=>{const{column:t,filters:r}=e,{$size:n,setFilters:a,clearSuperFilters:i}=l().useContext(Io),{t:o}=G(),s=l().useRef(null),c=l().useRef(null),d=l().useRef(null),[u,p]=l().useState(!1),[m,h]=l().useState(!1),[f,g]=l().useState({}),b=l().useMemo((()=>{const{dataIndex:e,filter:r}=t;return`${e}|${r.type}`}),[t]),y=l().useMemo((()=>{let e=!1;for(const t in r[b])if(!le(r[b][t])||m){e=!0;break}return e}),[b,r,m]);l().useLayoutEffect((()=>{u&&setTimeout((()=>x()),20)}),[u]),l().useEffect((()=>{(0,Q.isEqual)(f[b],r[b])||g({[b]:r[b]||{}}),h(""===r[b]?.["=="])}),[r]);const x=()=>{switch(t.filter.type){case"text":s.current.focus();break;case"number":c.current.focus();break;case"textarea":d.current.focus()}},v=e=>{e&&g(e),i(),a((e=>{for(const t in e){for(const r in e[t])if(le(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...r,...f,...e})),p(!1)},E={text:e=>l().createElement(l().Fragment,null,l().createElement(P.Input,{ref:s,size:n,placeholder:o("qm.table.filter.searchText",{text:Jr(e.title)}),style:{width:"180px"},value:f[b]?.like??"",disabled:m,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&v()}}),l().createElement("div",{style:{marginTop:8}},l().createElement(P.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},o("qm.table.filter.nullValue")))),textarea:e=>l().createElement(l().Fragment,null,l().createElement(P.Input.TextArea,{ref:d,size:n,placeholder:o("qm.table.filter.searchAreaText",{text:Jr(e.title)}),style:{width:"220px"},value:f[b]?.likes??"",disabled:m,onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),v())}}),l().createElement("div",{style:{marginTop:8}},l().createElement(P.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;g((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),h(t)}},o("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:f[b]?.[e]??"",size:n,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&v()}});return l().createElement("ul",null,l().createElement("li",null,l().createElement("span",null,"> "),l().createElement(P.InputNumber,Js({ref:c},t(">"),{placeholder:o("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(P.InputNumber,Js({},t("<"),{placeholder:o("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(P.InputNumber,Js({},t("=="),{placeholder:o("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(P.InputNumber,Js({},t("!="),{placeholder:o("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:Yr(f[b]?.[e],Ao),format:Ao,size:n,onChange:t=>{g((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:Xr(t,Ao)})})))},onKeyDown:e=>{13===e.keyCode&&v()}});return l().createElement("ul",null,l().createElement("li",null,l().createElement("span",null,"> "),l().createElement(H,Js({},t(">"),{placeholder:o("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(H,Js({},t("<"),{placeholder:o("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(H,Js({},t("=="),{placeholder:o("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(H,Js({},t("!="),{placeholder:o("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return l().createElement("ul",null,l().createElement(P.Radio.Group,{style:{width:"100%"},value:f[b]?.["=="],onChange:e=>{const{value:t}=e.target;g((e=>Object.assign({},e,{[b]:{"==":t}})))}},n.map((e=>l().createElement("li",{key:e.value},l().createElement(P.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return l().createElement("ul",null,l().createElement(P.Checkbox.Group,{style:{width:"100%"},value:f[b]?.in,onChange:e=>{g((t=>Object.assign({},t,{[b]:{in:e}})))}},n.map((e=>l().createElement("li",{key:e.value},l().createElement(P.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return l().createElement("div",{style:{height:200,...t.style}},l().createElement(No,{multiple:!0,value:f[b]?.in||[],dataSource:n,onCheckChange:e=>{const t=e.map((e=>e.value));g((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},S=Ee("table"),w={"head-filter__popper":!0,[`${S}--lg`]:"large"===n,[`${S}--sm`]:"small"===n},C=["cell--filter",{selected:u,actived:y}];return l().createElement(Ma(),{action:["click"],popupVisible:u,popup:(()=>{const e=t.filter.type,r=E[e];return r?l().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},l().createElement("div",null,r(t)),l().createElement(P.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},l().createElement(fe,{size:n,onClick:()=>(v({[b]:{}}),void h(!1))},o("qm.table.filter.reset")),l().createElement(fe,{type:"primary",size:n,onClick:()=>v()},o("qm.table.filter.search")))):(pe("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:ve()(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{p(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("div",{className:ve()(C),title:o("qm.table.filter.text"),onClick:e=>e.stopPropagation()},l().createElement("span",{className:"svgicon icon"},l().createElement(Zs,null))))},tc=e=>{const{column:t}=e,{tableRef:r,bordered:n}=l().useContext(Io),{columns:a,resizable:i,columnsChange:o=te}=r.current.props,s=l().useMemo((()=>Ar(t)),[t]),c={resizable:!0,"is--line":i&&!n};return l().createElement("div",{className:ve()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,i=n.$resizableBar,l=t.offsetWidth/2,c=e.clientX,d=Mr(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+l;n.$table.classList.add("c--resize"),i.style.left=`${d}px`,i.style.display="block";const u=s.width||s.renderWidth;let p=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,r=u+t;r<(s.minWidth||zo.defaultColumnWidth)||(p=Math.floor(r),i.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(Or(a,s.dataIndex).width=p,o([...a]))},!1}})},rc=e=>{const{selectionKeys:t}=e,{tableRef:r,getRowKey:n,fetchParams:a,createWebPageData:i,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=l().useContext(Io),{rowSelection:p}=r.current.props,{fetchAllRowKeys:m,selectAllOnCurrentPage:h,filterable:f,onSelectAll:g}=p,{t:b}=G(),y=l().useRef([]),x=l().useMemo((()=>d&&!!m),[d,m]),v=l().useMemo((()=>!x&&!!h),[x,h]),E=l().useMemo((()=>(f??!0)&&!v),[f,v]),S=()=>u?i():r.current.tableFullData,w=()=>{const{selectionRows:e}=r.current,{disabled:t}=p;return(t?e.filter((e=>!t(e))):e).map((e=>n(e,e.index)))},C=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:a}=p;if(x)return y.current.length?y.current:(0,Q.union)(t,w());if(!v)return a?t.filter((t=>!a(e.get(t)))):t;const i=a?S().filter((e=>!a(e))).map((e=>n(e,e.index))):S().map((e=>n(e,e.index)));return(0,Q.union)(i,w())})(),N=t.filter((e=>!C.includes(e))),I=t.length-N.length,T=I>0&&I<C.length,R=!!I&&I===C.length;s(N);const O=async()=>{const e=m;let t=[];c(!0);try{const r=await e.api(a);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,Q.get)(r.data,e.dataKey)??[];const{disabled:a}=p;a&&(t=(0,Q.xor)(t,S().filter((e=>a(e))).map((e=>n(e,e.index))))),y.current=t}}catch(e){}return c(!1),t},k=async e=>{let t=[];t=x?e?await O():[]:e?C.slice(0):[],t=[...new Set([...t,...N])],o(t),g?.(e,t)};return l().createElement("div",{className:"cell--selection"},l().createElement(P.Checkbox,{checked:R,indeterminate:T,disabled:!C.length,onChange:e=>k(e.target.checked)}),E&&l().createElement(P.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:b("qm.table.selection.all"),onClick:()=>{k(!0)}},{key:2,label:b("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=x?(0,Q.xor)(t,await O()):(0,Q.xor)(t,C),e=[...new Set([...e,...N])],o(e)})()},{key:3,label:b("qm.table.selection.clear"),onClick:()=>{k(!1)}}];return l().createElement(P.Menu,{items:e})})()},l().createElement(Se.DownOutlined,{className:"svgicon icon"})),v&&l().createElement(P.Tooltip,{placement:"top",title:b("qm.table.selection.currentPage")},l().createElement(Se.InfoCircleOutlined,{className:"info"})))},nc=e=>{const{style:t}=e,{tableRef:r,isTreeTable:n,setRowExpandedKeys:a}=l().useContext(Io),{expandable:i}=r.current.props,[o,s]=l().useState(i?.defaultExpandAllRows||!1);_e((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;a(o?e.filter((e=>!(n&&t.includes(e)))):[])}),[o]);const c=Ee("expand"),d={[`${c}--icon`]:!0,expanded:o,collapsed:!o};return l().createElement("span",{className:ve()(d),title:"",onClick:e=>{e.stopPropagation(),s(!o)},style:t})},ac=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),ic=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),lc=e=>{const{tableColumns:t,sorter:r,filters:n}=e,{tableRef:a,layout:i,scrollY:o,flattenColumns:s,superFilters:c,selectionKeys:d,rightFixedColumns:u,treeExpandIndex:p,isFetch:m,isTreeTable:h,isGroupSubtotal:f,tableChange:g,setSorter:b,setElementStore:y,resetTableScroll:x,getStickyLeft:v,getStickyRight:E,createGroupData:S,createTableFullData:w}=l().useContext(Io),{ellipsis:C,resizable:N,multipleSort:I,rowSelection:T,expandable:R}=a.current.props,[O,k]=zo.sortDirections,{tableOriginData:A}=a.current,{t:L}=G(),F=l().useRef(null),H=l().useMemo((()=>A.some((e=>Array.isArray(e.children)))),[A]),_=l().useMemo((()=>!m),[m]),D=l().useMemo((()=>!m),[m]),$=l().useMemo((()=>!R?.hideExpandAll),[R]),q=l().useMemo((()=>!(!T||(m?!T.selectAllOnCurrentPage&&!T.fetchAllRowKeys:T.hideSelectAll))),[m,T]);_e((()=>{B(),g(),x()}),[r]),_e((()=>{Y(),g(),x()}),[n]),_e((()=>{Y(),g(),x()}),[c]),l().useEffect((()=>{!le(r)&&ae((()=>B())),!le(n)&&ae((()=>Y()))}),[]),l().useLayoutEffect((()=>{M()}),[]);const M=()=>{y("$header",F.current)},K=e=>{const{dataIndex:t,type:n,sorter:a,title:i,description:o}=e;if(t===zo.selectionColumn&&"checkbox"===n){if("checkbox"===n)return l().createElement("div",{className:"cell"},q?l().createElement(rc,{selectionKeys:d}):L("qm.table.config.selectionText"));if("radio"===n)return l().createElement("div",{className:"cell"},i)}const s=[];return s.push(l().createElement("div",{key:0,className:"cell",title:Jr(i)},h&&t===p&&$?l().createElement(nc,null):null,t===zo.expandableColumn&&$?l().createElement(nc,null):i)),o&&s.push(l().createElement(P.Tooltip,{key:1,placement:"top",title:o},l().createElement(Se.InfoCircleOutlined,{className:"tip"}))),a&&s.push(V(r[t])),s},V=e=>{const t=["svgicon cell--sorter__asc",{actived:e===O}],r=["svgicon cell--sorter__desc",{actived:e===k}];return l().createElement("div",{key:2,className:"cell--sorter",title:L("qm.table.sorter.text")},l().createElement("span",{className:ve()(t)},l().createElement(ac,null)),l().createElement("span",{className:ve()(r)},l().createElement(ic,null)))},j=e=>l().createElement(ec,{column:e,filters:n}),z=(e,t)=>{const{sorter:n,dataIndex:a}=t;if(n){const e=r[a],t=e?e===k?null:k:O;I?(delete r[a],b(Object.assign({},r,{[a]:t}))):b(Object.assign({},{[a]:t}))}},B=()=>{_&&W()},W=e=>{const t=(0,Q.pickBy)(r,(e=>null!==e));for(const e in t){const r=s.find((t=>t.dataIndex===e));r?U(r,t[e]):delete t[e]}e||Object.keys(t).length||U({dataIndex:"index"},O)},U=(e,t)=>{const{tableFullData:r}=a.current,{dataIndex:n,sorter:i}=e,l=(e,r)=>{const a=jr(e,n),i=jr(r,n);return Number.isNaN(a-i)?t===O?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===O?a-i:i-a},o=f?S(en(r).sort("function"==typeof i?i:l)):r.sort("function"==typeof i?i:l).slice(0);w(o)},Y=()=>{D&&X()},X=()=>{const e=c.length?tn(c):tn(n),t=""!==e?f?S(Nr(en(A),e,H)):Nr(A,e,H):A;w(t),W(!0)},Z=_r(t),J=Ee("table"),{tableBodyWidth:ee}=i;return l().createElement("div",{ref:F,className:`${J}--header-wrapper`},l().createElement("table",{className:`${J}--header`,cellSpacing:"0",cellPadding:"0",style:{width:ee?`${ee}px`:""}},(()=>{const{gutterWidth:e}=i;return l().createElement("colgroup",null,s.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return l().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),o&&l().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),l().createElement("thead",null,(e=>{const{isIE:t}=a.current,n=["gutter",{"cell-fix-right":!!u.length}],s=t?null:{right:u.length?0:""};return e.map(((e,t)=>l().createElement("tr",{key:t,className:"header--row"},e.map(((t,n)=>((e,t,n)=>{const{isIE:s}=a.current,{gutterWidth:c}=i,{dataIndex:d,colSpan:u,rowSpan:p,fixed:m,align:h,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:x,headRender:S}=e;if(0===u)return null;const w=f||h,I=["header--column",{"col--ellipsis":e.ellipsis??C,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!x,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!r[d],"cell-fix-left":!s&&"left"===m,"cell-fix-right":!s&&"right"===m,"cell-fix-left-last":!s&&"left"===m&&!n[t+(u??1)]?.fixed,"cell-fix-right-first":!s&&"right"===m&&!n[t-1]?.fixed,[g]:!!g}],T=s?null:{left:"left"===m?`${v(d)}px`:"",right:"right"===m?`${E(d,"thead")+(o?c:0)}px`:""},R=N&&![zo.expandableColumn,zo.selectionColumn].includes(d);return l().createElement("th",{key:d,className:ve()(I),colSpan:u,rowSpan:p,style:{...T},onClick:t=>z(t,e)},l().createElement("div",{className:"cell--wrapper"},S?l().createElement("div",{className:"cell--text cell"},S(e,a.current.tableFullData)):l().createElement(l().Fragment,null,l().createElement("div",{className:"cell--text"},K(e)),y?j(e):null)),R&&l().createElement(tc,{column:e}))})(t,n,e))),o&&l().createElement("th",{className:ve()(n),style:{...s}}))))})(Z))))},oc=l().createContext([]),sc=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,cc=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),dc=(e,t)=>{const r=e.target;return!("button"in e&&e.button>0||r&&!sc(r).contains(r)||t.current?.contains(r))};function uc({ref:e,handler:t,enabled:r=!0,omitClassNames:n=[]}){const a=Y(t),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!r)return;const i=t=>{dc(t,e)&&(l.current.isPointerDown=!0)},o=r=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:t&&l.current.isPointerDown&&dc(r,e)&&cc(r,n)&&(l.current.isPointerDown=!1,a(r))},s=r=>{l.current.ignoreEmulatedMouseEvents=!0,t&&l.current.isPointerDown&&dc(r,e)&&cc(r,n)&&(l.current.isPointerDown=!1,a(r))},c=sc(e.current);return c.addEventListener("mousedown",i,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",i,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",i,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",i,!0),c.removeEventListener("touchend",s,!0)}}),[t,e,a,l,r])}function pc(){const[,e]=i.useReducer((e=>e+1),0);return e}const mc=e=>{const{selectionKeys:t,column:r,record:n,rowKey:a}=e,{tableRef:i,isTreeTable:o,getAllChildRowKeys:s}=l().useContext(Io),{rowSelection:c}=i.current.props,d=l().useMemo((()=>r.type||""),[r.type]),u=e=>{const r=c.checkStrictly??!0;if(!o||r)return!1;const n=Fr(i.current.deriveRowKeys,e);return((e,t)=>{const r=new Set(t);let n=!1,a=!1;for(const t of e)if(r.has(t)?n=!0:a=!0,n&&a)break;return n&&a})(s(n?.children??[]),t)};return"radio"===d?(()=>{const e=c.disabled,r=e?.(n),i=!r&&t[0]===a;return l().createElement(P.Radio,{checked:i,disabled:r})})():(()=>{const e=c.disabled,r=e?.(n),i=!!t.includes(a);return l().createElement(P.Checkbox,{checked:i,indeterminate:u(a),disabled:r})})()},hc=e=>{const{record:t,rowKey:r,style:n}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:o}=l().useContext(Io),{expandable:s={}}=a.current.props,[c]=l().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=l().useMemo((()=>i.includes(r)),[i,r]);_e((()=>{s.onExpand?.(d,t)}),[d]);const u=Ee("expand"),p={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return l().createElement("span",{className:ve()(p),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==r)):[...i,r];o(t)},style:n})},fc=l().forwardRef(((e,t)=>{const{size:r,defaultValue:n,value:a,min:i,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:m,allowClear:h,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:x}=e,v=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<i&&(t=i.toString()),p>=0&&""!==t&&(t=new(xa())(t).toFixed(p)),t},E=void 0!==a,[S,w]=l().useState(n??""),C=b(E?a:S),N=y(C);return _e((()=>{e.onChange?.(N)}),[S]),l().createElement(P.Input,{ref:t,size:r,value:C,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value.replace(/\s+/g,""));let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),i>=0&&r.startsWith("-")&&(n=!1),n){if(!m&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):w(t)})(r)}},onFocus:x,onBlur:()=>{const t=v(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(v(N),N)}})}));fc.displayName="InputNumber";const gc=fc;function bc(){return bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bc.apply(null,arguments)}const{Search:yc}=P.Input,xc=l().forwardRef(((e,t)=>{const{column:r,record:n,rowKey:a,columnKey:i}=e,{tableRef:o,tableBodyRef:s,$size:c,flattenColumns:d,updateTableData:u,doFieldValidate:p,dataChange:m}=l().useContext(Io),h=l().useContext(oc),f="table-editable__popper",{t:g}=G(),b=pc(),{store:y,fieldAuth:x}=o.current,v=r.editRender?.(n,r)||{},E=l().useRef(null),S=l().useRef(null),w=l().useRef(null),C=l().useRef(null),N=l().useRef(null),I=l().useRef(!1),T=l().useRef({}),R=l().useRef({}),O=l().useRef([]),[k,A]=l().useState(!1),[L,F]=l().useState(!1),[_,D]=l().useState(v.items||[]),[$,M]=l().useState(),K=(v.editable||(0,Q.isEqual)(h,[a,i]))&&!v.disabled&&!x[i]?.disabled,V=`${a}|${i}`,j=2===h.length?`${h[0]}|${h[1]}`:"",z=![...y.state.required,...y.state.validate].some((({x:e,y:t})=>e===a&&t===i)),B=y.state.required.find((({x:e,y:t})=>e===a&&t===i))?.text||"",W=y.state.validate.find((({x:e,y:t})=>e===a&&t===i))?.text||"",U=y.state.edited.some((({x:e,y:t})=>e===a&&t===i)),Y=K||!z||k||L,X=!!v.helper?.combinedDataIndex&&("search-helper"===v.type||"tree-helper"===v.type),Z=v.type?.endsWith("multiple");l().useLayoutEffect((()=>{Y&&j===V&&te()}),[h]),l().useLayoutEffect((()=>{const{items:e}=v;Z&&e&&ee(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const J=()=>{u(),m()},ee=e=>{O.current=e},te=()=>{const{type:e}=v;switch(e){case"text":S.current?.focus();break;case"number":w.current?.select();break;case"search-helper":C.current?.focus();break;case"tree-helper":N.current?.focus()}},ne=()=>{const{type:e}=v;switch(e){case"text":S.current?.blur();break;case"number":w.current?.blur();break;case"search-helper":C.current?.blur();break;case"tree-helper":N.current?.blur()}};l().useImperativeHandle(t,(()=>({focus:te,blur:ne,isEditable:()=>!v.disabled,isOpening:()=>k})));const ie=(e,t,r)=>{const{cornerSign:n=!0}=v.extra||{};y.addToUpdated(e),n&&y.addToEdited({x:t,y:r})},le=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",oe={text:(e,t,r)=>{const{dataIndex:n}=t,{type:o,extra:s={},rules:d=[],onInput:u,onChange:m,onEnter:h,onBlur:f}=v,y=jr(e,n),x=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=r?{rows:x.minRows,autoSize:x}:null,w=s.password?P.Input.Password:r?P.Input.TextArea:P.Input;return l().createElement(w,bc({ref:S,size:c,value:y,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||g("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";zr(e,n,r),p(d,r,a,i),b(),u?.({[V]:r}),I.current=!0},onBlur:t=>{const r=t.target.value??"";I.current&&(I.current=!1,ie(e,a,i),m?.({[V]:r},e),f?.({[V]:r},e),J())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";h?.({[V]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&h&&e.preventDefault()}}))},textarea:(e,t)=>oe.text(e,t,!0),number:(e,t)=>{const{dataIndex:r,precision:n,formatType:o}=t,{type:s,extra:d={},rules:u=[],onInput:m,onChange:h,onEnter:f,onBlur:y}=v,x=jr(e,r);let E,S;return"finance"===o&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(xa())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(xa())(e).times(.01).toString()),l().createElement(gc,{ref:w,size:c,value:x,min:d.min,max:d.max,precision:n,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===o?"%":void 0),placeholder:d.placeholder||g("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:S,onChange:t=>{zr(e,r,t),p(u,t,a,i),b(),m?.({[V]:t}),I.current=!0},onBlur:(t,n)=>{if(!I.current)return;I.current=!1;let l=d.stringMode?t:le(t);"percent"===o&&"."===n.charAt(n.length-1)&&(l=Number(t)/100),zr(e,r,l),ie(e,a,i),h?.({[V]:l},e),y?.({[V]:l},e),J()},onEnter:(t,r)=>{let n=d.stringMode?t:le(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),f?.({[V]:n},e)}})},select:(e,t,r)=>{const{dataIndex:n,dictItems:o=[]}=t,{type:s,extra:d={},rules:u=[],items:m,onChange:h,onEnter:b}=v,y=m||o,x=jr(e,n);let E=x;return l().createElement(P.Select,{mode:r?"multiple":void 0,size:c,popupClassName:f,value:x||void 0,placeholder:d.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>A(e),onChange:t=>{zr(e,n,t),p(u,t,a,i),ie(e,a,i),h?.({[V]:t},e),J()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&ae((()=>b?.({[V]:E},e)))}},y.map((e=>l().createElement(P.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>oe.select(e,t,!0),date:(e,t,r)=>{const{dataIndex:n}=t,{type:o,extra:s={},rules:d=[],onChange:u}=v,m=r||"exactdate",h=jr(e,n);return l().createElement(H,{size:c,popupClassName:f,value:Yr(h,xn[m])??void 0,picker:yn[m],format:s.format,showTime:"datetime"===m,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=Xr(t,xn[m]);zr(e,n,r),p(d,r,a,i),ie(e,a,i),u?.({[V]:r},e),J()}})},datetime:(e,t)=>oe.date(e,t,"datetime"),month:(e,t)=>oe.date(e,t,"month"),year:(e,t)=>oe.date(e,t,"year"),time:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],onChange:d}=v,u="HH:mm:ss",m=jr(e,r);return l().createElement(q,{size:c,popupClassName:f,value:Yr(m,u)??void 0,format:o.format||u,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const n=Xr(t,u);zr(e,r,n),p(s,n,a,i),ie(e,a,i),d?.({[V]:n},e),J()}})},checkbox:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],onChange:c}=v,{trueValue:d=Oo,falseValue:u=ko,disabled:m}=o,h=jr(e,r);return l().createElement(P.Checkbox,{checked:h===d,disabled:m,onChange:t=>{const n=t.target.checked?d:u;zr(e,r,n),p(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},switch:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],onChange:c}=v,{trueValue:d=Oo,falseValue:u=ko,disabled:m}=o,h=jr(e,r);return l().createElement(P.Switch,{checked:h===d,disabled:m,onChange:t=>{const n=t?d:u;zr(e,r,n),p(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},"search-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:o,extra:s={},rules:u=[],helper:m={},onInput:h,onChange:b,onEnter:y}=v,x=Br(e,X?m.combinedDataIndex:r),E=m.fieldAliasMap;E||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof E?E():E||{};Object.keys(S).includes(r)||pe("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),X&&(m.combinedDataIndex.split("|").every((e=>Object.keys(S).includes(e)))||pe("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),S[r].includes("|")&&pe("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=e=>{const{filterAliasMap:t}=m,n=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[r]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,Q.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i},N=e=>{const{autoQueryAssign:t=!0}=m;t&&(T.current=w(e)),A(!0)},R=(r,n)=>{const{beforeOpen:a}=m,i=(a??re)({[V]:x},e,t);i?.then?i.then((()=>{N(r),n?.()})).catch((()=>{})):!1!==i&&(N(r),n?.())},P=e=>{const t={};for(const n in S){const a=S[n];n!==r&&(t[n]=Br(e,a))}const n=S[r]?Br(e,S[r]):"";L(n,t);const{closed:a}=m;A(!1),a?.(e)},O=()=>{const{onlySelect:e=!0}=m;I.current&&L(e?"":x),A(!1)},L=(t="",l)=>{if((0,Q.isPlainObject)(l)&&Object.keys(l).length)for(const t in l){const r=l[t],n=d.find((e=>e.dataIndex===t));if(n){zr(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&p(i.rules,r,a,t)}else zr(e,t,r)}X&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return zr(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&zr(e,t,a[r]?.trim())}))})(e,m.combinedDataIndex),zr(e,r,t,n),p(u,t,a,i),ie(e,a,i),b?.({[V]:t},e),J(),T.current={},I.current=!1,M(void 0)},H={visible:k,title:g("qm.searchHelper.text"),width:m.width??"60%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{O()}},_={...m,size:c,initialValue:Object.assign({},T.current,m.initialValue),onClose:e=>{e?P(e):O()}};return l().createElement(l().Fragment,null,l().createElement(yc,{ref:C,value:$??x,placeholder:s.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=m;if(I.current&&!k)return t&&n&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=m,{beforeFetch:n=re}=t.fetch;return new Promise((async(a,i)=>{const l=(0,Q.merge)({},t.fetch.params,{...r,...w(e)},{currentPage:1,pageSize:500});if(!n(l))return i();F(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{ae((()=>F(!1)))}}))})(t).then((e=>((e=[],t)=>{const n=e.filter((e=>Br(e,S[r]).toString().includes(t)));if(1===n.length)return P(n[0]);R(t)})(e,t))).catch((()=>L(""))):void L(t)},onChange:e=>{const{value:t}=e.target;h?.({[V]:t}),I.current=!0,M(t)},onKeyDown:e=>{if(13===e.keyCode){const t=e.target.value??"";!k&&R(t)}},onDoubleClick:e=>{const{value:t}=e.target;R(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&R(e)}}),l().createElement(cr,H,l().createElement(Bc,_)))},"search-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,items:o=[],extra:s={},rules:d=[],helper:u={},onInput:m,onChange:h,onEnter:b}=v,y=jr(e,r),x=u.fieldAliasMap;x||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||pe("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=E;const S=r=>{const{beforeOpen:n}=u,a=(n??re)({[V]:y},e,t);a?.then?a.then((()=>{A(!0),r?.()})).catch((()=>{})):!1!==a&&(A(!0),r?.())},w=()=>{A(!1)},C=t=>{zr(e,r,t),p(d,t,a,i),ie(e,a,i),h?.({[V]:t},e,O.current),J()},N={visible:k,title:g("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{w()}},I={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=E;ee((0,Q.uniqBy)([...O.current.filter((e=>t.includes(e[n]))),...e],n));const a=O.current.map((e=>({text:e[r],value:e[n]}))),i=(0,Q.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));D(i),C(i.map((e=>e.value)));const{closed:l}=u;A(!1),l?.(O.current)})(e,t):w()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(P.Select,{mode:"multiple",open:!1,value:y,placeholder:s.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!k&&S()},onDoubleClick:()=>{s.disabled||S()},onChange:e=>{const{valueKey:t}=E;ee(O.current.filter((r=>e.includes(r[t])))),C(e)}},_.map((e=>l().createElement(P.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(P.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:l().createElement(Se.SearchOutlined,null),onClick:()=>{S()}})))),l().createElement(cr,N,l().createElement(Bc,I)))},"tree-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:o,extra:s={},rules:u=[],helper:m={},onChange:h,onEnter:b}=v,y=Br(e,X?m.combinedDataIndex:r),x=m.fieldAliasMap;x||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes(r)||pe("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),X&&(m.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||pe("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[r].includes("|")&&pe("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const S=r=>{const{beforeOpen:n}=m,a=(n??re)({[V]:y},e,t);a?.then?a.then((()=>{A(!0),r?.()})).catch((()=>{})):!1!==a&&(A(!0),r?.())},w=()=>{A(!1)},C=(t="",l)=>{if((0,Q.isPlainObject)(l)&&Object.keys(l).length)for(const t in l){const r=l[t],n=d.find((e=>e.dataIndex===t));if(n){zr(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&p(i.rules,r,a,t)}else zr(e,t,r)}zr(e,r,t,n),p(u,t,a,i),ie(e,a,i),h?.({[V]:t},e),J()},I={visible:k,title:g("qm.searchHelper.text"),width:m.width??"40%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{w()}},T={...m,defaultSelectedKeys:[y],size:c,onClose:e=>{e?(e=>{const t={};for(const n in E){const a=E[n];n!==r&&(t[n]=Br(e,a))}const n=E[r]?Br(e,E[r]):"";C(n,t);const{closed:a}=m;A(!1),a?.(e)})(e):w()}};return l().createElement(l().Fragment,null,l().createElement(yc,{ref:N,value:y,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||g("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!k&&S())},onDoubleClick:()=>{S()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?S():C(""))}}),l().createElement(cr,I,l().createElement(Jc,T)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},items:s=[],rules:d=[],helper:u={},onInput:m,onChange:h,onEnter:b}=v,y=jr(e,r),x=u.fieldAliasMap;x||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||pe("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=E;const S=r=>{const{beforeOpen:n}=u,a=(n??re)({[V]:y},e,t);a?.then?a.then((()=>{A(!0),r?.()})).catch((()=>{})):!1!==a&&(A(!0),r?.())},w=()=>{A(!1)},C=t=>{zr(e,r,t),p(d,t,a,i),ie(e,a,i),h?.({[V]:t},e,O.current),J()},N={visible:k,title:g("qm.searchHelper.text"),width:u.width??"40%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{w()}},I={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=E;ee(e);const n=O.current.map((e=>({text:e[t],value:e[r]})));D(n),C(n.map((e=>e.value)));const{closed:a}=u;A(!1),a?.(O.current)})(e):w()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(P.Select,{mode:"multiple",open:!1,value:y,placeholder:o.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!k&&S()},onDoubleClick:()=>{o.disabled||S()},onChange:e=>{const{valueKey:t}=E;ee(O.current.filter((r=>e.includes(r[t])))),C(e)}},_.map((e=>l().createElement(P.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(P.Button,{className:"ant-input-search-button",disabled:o.disabled,icon:l().createElement(Se.SearchOutlined,null),onClick:()=>{S()}})))),l().createElement(cr,N,l().createElement(Jc,I)))},custom:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],render:c,onChange:d}=v;if(!c)return pe("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const u=jr(e,r),m=t=>{zr(e,r,t),p(s,t,a,i),ie(e,a,i),d?.({[V]:t},e),J()},h=c(e,t,m);return l().isValidElement(h)?l().cloneElement(h,{value:u,disabled:o.disabled,readOnly:o.readOnly,popupClassName:f,onChange:m}):null}};return l().createElement(l().Fragment,null,Y?(()=>{const{type:e}=v,t=oe[e];if(!t)return pe("Table","单元格编辑的类型 `type` 配置不正确"),null;const a=["cell--edit",{"is-error":!z}];return l().createElement("div",{ref:E,className:ve()(a)},t(n,r),!z&&l().createElement("div",{className:"cell-error"},B||W))})():(()=>{const{disabled:t,extra:r={}}=v,{disabledColor:n,disabledBgColor:a}=r,i=["cell--show",{"is-cell-bg":t&&a}];return l().createElement(l().Fragment,null,l().createElement("span",{className:ve()(i),style:{color:t?n:""}},e.children),t&&a&&l().createElement("i",{className:"cell--bg",style:{background:a}}))})(),U&&l().createElement("i",{className:"cell--sign"}))}));xc.displayName="CellEdit";const vc=xc,Ec=require("copy-to-clipboard");var Sc=n.n(Ec);const wc=(e,...t)=>l().isValidElement(e)?l().cloneElement(e,...t):null,Cc=e=>{const{text:t,options:r,showMessage:n=!0,onCopy:a}=e,{t:i}=G();return wc(e.children,{onClick:o=>{const s=l().Children.only(e.children),c=Sc()(t,r);a?.(t,c),c&&n&&P.message.success(i("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Cc.displayName="QmCopyToClipboard";const Nc=Cc,Ic=l().forwardRef(((e,t)=>{const{column:r,row:n,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c}=e,{selectionKeys:d,treeExpandIndex:u,updateMark:p,isTreeTable:m}=l().useContext(Io),{dataIndex:h,canCopy:f,render:g,editRender:b,shouldCellUpdate:y}=r,{t:x}=G(),{renderText:v,getTitleFromCellNode:E}=os(),S=l().useRef(null),w=jr(n,h),[C,N]=function(e,c,d){const u=i.useRef({});return"value"in u.current&&!((e,t)=>{if(y){const[,r]=e,[,a]=t;return y(a,r,n)}return!((e,t,r=!1)=>{const n=new Set;return function e(t,a,i=1){if(n.has(t))return!1;if(t===a)return!0;if(r&&i>1)return!1;n.add(t);const l=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],a[r],l))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const r=Object.keys(t);return r.length===Object.keys(a).length&&r.every((r=>e(t[r],a[r],l)))}return!1}(e,t)})(e,t,!0)})(u.current.condition,c)||(u.current.value=(()=>{const e=g?g(w,n,r,a,o):v(w,r,n);return[e,b?l().createElement(vc,{ref:t,column:r,record:n,rowKey:s,columnKey:h},e):null]})(),u.current.condition=c),u.current.value}(0,[p,n,w,g,b]);l().useEffect((()=>{if([zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(h))return;const e=S.current.parentNode;c?e.title=E(C):e.removeAttribute("title")}),[c,C]);const I=e=>Array.isArray(e.children);return l().createElement("div",{ref:S,className:"cell"},(()=>{if(h===zo.expandableColumn)return l().createElement(hc,{record:n,rowKey:s});if(h===zo.selectionColumn)return l().createElement(mc,{selectionKeys:d,column:r,record:n,rowKey:s});if(N)return N;if(m&&h===u)return l().createElement(l().Fragment,null,(e=n._level)?l().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*zo.treeTable.textIndent+"px"}}):null,l().createElement(hc,{key:"expand",record:n,rowKey:s,style:I(n)?{}:{visibility:"hidden"}}),C);var e;if(f){const e=E(C);return l().createElement("div",{className:"cell--copy"},l().createElement("span",{className:"text"},C),e&&l().createElement(Nc,{text:e},l().createElement(Se.CopyOutlined,{className:"icon",title:x("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return C})())}));Ic.displayName="Cell";const Tc=Ic,Rc={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},Pc={open:!1,offsetX:0,offsetY:0},Oc=l().forwardRef(((e,t)=>{const{tableRef:r,getRowKey:n,flattenColumns:a,mergedTdCells:i,setMergedCells:o}=l().useContext(Io),{areaSelection:s={}}=r.current.props,{elementStore:c,tableFlatData:d}=r.current,{t:u}=G(),p=l().useRef(document.onselectstart),m=l().useRef(null),h=l().useRef(null),[f,g]=l().useState(null),[b,y]=l().useState(null),[x,v]=l().useState(null);uc({ref:m,handler:()=>D()});const E=l().useRef(Rc),S=e=>{E.current=Object.assign({},E.current,e)};l().useEffect((()=>{const e=Mt()(c.$tableBody,"mousedown",k),t=Mt()(c.$tableBody,"contextmenu",P),r=Mt()(document,"keydown",O);return()=>{e.remove(),t.remove(),r.remove()}}),[]);const w=()=>{g(null),y(null),v(null)};l().useImperativeHandle(t,(()=>({blur:w})));const C=()=>c.$tableBody.parentNode,N=e=>{const{offsetLeft:t,offsetTop:r,offsetWidth:n,offsetHeight:a}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:r,w:n,h:a}},I=vt(((e,t)=>{let r=null;const n=c.$tableBody.querySelectorAll("tbody > tr");for(let a=0;a<n.length;a++){if(n[a].offsetTop>t||n[a].offsetTop+n[a].offsetHeight<t)continue;const i=n[a].querySelectorAll("td");for(let t=0;t<i.length;t++)if(!(i[t].offsetLeft>e||i[t].offsetLeft+i[t].offsetWidth<e)){r=i[t];break}break}r&&y(N(r))}),5),T=Y((()=>{const e=[];if(!f||!b)return e;const[t,r]=[f.colIndex,b.colIndex],[i,l]=[f.rowKey,b.rowKey];let[o,s]=[0,0];for(let e=0;e<d.length;e++){const t=n(d[e],d[e].index);if(t==i&&(o=e),t==l){s=e;break}}const c=a.slice(Math.min(t,r),Math.max(t,r)+1);return d.slice(o,s+1).forEach((t=>{for(let r=0;r<c.length;r++){const{dataIndex:a}=c[r];e.push({rowKey:n(t,t.index),dataIndex:a,cellValue:jr(t,a)})}})),e})),R=e=>{o(e),s.onCellMerge?.(e),ae((()=>w()))},P=Y((e=>{s.cellMerge&&f&&H(e.clientX,e.clientY)?(e.preventDefault(),_(e)):x?.open&&D()})),O=e=>{27===e.keyCode&&w()},k=Y((e=>{e.stopPropagation();const t=(e=>{let t=e;for(;t;){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null})(e.target);if(1!==e.buttons||!t)return;D(),setTimeout((()=>{g(N(t)),y(N(t))}));const[r,n]=[c.$tableBody.getBoundingClientRect().top,C().getBoundingClientRect().left],{offsetWidth:a,offsetHeight:i}=C();S({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-n,startOffsetY:e.clientY-r,containerSizeX:a,containerSizeY:i}),document.addEventListener("mousemove",A),document.addEventListener("mouseup",L),p.current=document.onselectstart,document.onselectstart=()=>!1})),A=e=>{const t=e.clientX-E.current.startX,r=e.clientY-E.current.startY,n=E.current.startOffsetX+t,a=E.current.startOffsetY+r;I(Math.min(n,E.current.containerSizeX),Math.min(a,E.current.containerSizeY))},L=()=>{S(Rc),s.onSelectChange?.(T()),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",L),F()},F=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)},H=(e,t)=>{const{top:r,left:n}=C().getBoundingClientRect(),[a,i]=[e-n,t-r],{el:l,et:o,ew:s,eh:c}=M();return!(a<l||a>l+s||i<o||i>o+c)},_=e=>{const{top:t,left:r,height:n}=h.current.getBoundingClientRect();v({open:!0,offsetX:e.clientX-r,offsetY:-1*(n-(e.clientY-t))})},D=()=>{v((e=>({...e,open:!1})))},$=()=>{if(!f||!b||(t=b,(e=f).rowKey===t.rowKey&&e.colIndex===t.colIndex))return w();var e,t;const[r,l]=f.t<=b.t?[f.rowKey,b.rowKey]:[b.rowKey,f.rowKey],[o,s]=f.l<=b.l?[f.colIndex,b.colIndex]:[b.colIndex,f.colIndex];let[c,u]=[0,0],p=r;for(let e=0;e<d.length;e++){const t=d[e],a=n(t,t.index);if(a==r&&(p=a,c=e),a==l){u=e;break}}const m={rowKey:p,dataIndex:a[Math.min(o,s)].dataIndex,rowSpan:u-c+1,colSpan:Math.abs(s-o+1)};R([...i.filter((e=>!(e.rowKey===m.rowKey&&e.dataIndex===m.dataIndex))),m])},q=()=>{let e=f.rowKey;const t=f.colIndex;for(let t=0;t<d.length;t++){const r=d[t],a=n(r,r.index);if(a==e){e=a;break}}const r=e,l=a[t].dataIndex;R(i.filter((e=>!(e.rowKey===r&&e.dataIndex===l))))},M=()=>{const{w:e,h:t,l:r,t:n}=f;let{w:a,h:i,l,t:o}=b;return a=l-r>0?l-r+a:Math.abs(l-r)+e,i=o-n>0?o-n+i:Math.abs(o-n)+t,l=l>r?r:l,o=o>n?n:o,{sl:r,st:n,sw:e,sh:t,el:l,et:o,ew:a,eh:i}},K=Ee("table");return l().createElement("div",{className:`${K}--area-select`},(()=>{if(!f||!b)return null;const{sl:e,st:t,sw:r,sh:n,el:a,et:i,ew:o,eh:s}=M(),{open:c,offsetX:d,offsetY:p}=x||Pc,g=l().createElement("ul",{ref:m,className:"ant-dropdown-menu"},l().createElement("li",{className:"ant-dropdown-menu-item",onClick:$},u("qm.table.areaSelect.mergeCell")),l().createElement("li",{className:"ant-dropdown-menu-item",onClick:q},u("qm.table.areaSelect.cancelMerge")));return l().createElement(l().Fragment,null,l().createElement("div",{className:"active-area",style:{left:e,top:t,width:r,height:n}}),l().createElement(Ma(),{popupVisible:c,popup:g,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:"table-editable__popper",builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,p+4],overflow:{adjustX:1,adjustY:1}}}},l().createElement("div",{ref:h,className:"checked-area",style:{left:a,top:i,width:o,height:s}})))})())}));Oc.displayName="AreaSelect";const kc=Oc,Ac=l().forwardRef(((e,t)=>{const{tableFlatColumns:r,tableData:n}=e,{getRowKey:a,tableRef:i,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:p,layout:m,showFooter:h,scrollX:f,scrollY:g,selectionKeys:b,rowExpandedKeys:y,highlightKey:x,isPingLeft:v,isPingRight:E,isTableEmpty:S,isTreeTable:w,isGroupSubtotal:C,isWebPagination:N,setElementStore:I,createTableFullData:T,setSelectionKeysEffect:R,setHighlightKey:P,getStickyLeft:O,getStickyRight:k,scrollXToColumn:A,scrollYToRecord:L,rowInViewport:F,dataChange:H,setPingLeft:_,setPingRight:D,setFullScreen:$,findParentRowKeys:q,getAllChildRowKeys:M,triggerScrollXEvent:K,triggerScrollYEvent:V,scrollBottomDebouncer:j}=l().useContext(Io),{height:z,minHeight:B,maxHeight:W,rowHeight:U,rowSelection:G,rowHighlight:X,expandable:Z,stripe:J,summation:ee,rowStyle:ne,cellStyle:ae,spanMethod:ie,tableConfig:le,areaSelection:oe,nativeScrollBar:se,ellipsis:ce,showHeader:de,rowDraggable:ue,onRowClick:pe,onRowDblclick:me,onRowContextmenu:he,onRowEnter:fe}=i.current.props,ge=l().useRef(null),be=l().useRef({}),ye=l().useRef(null),xe=l().useRef(null),Se=l().useRef(null),we=l().useRef({prevST:0,prevSL:0}),Ce=i.current.scrollXLoad?r:o,Ne=l().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=m,i={};return S&&Object.assign(i,{minHeight:"100px"}),B&&Object.assign(i,{minHeight:Kr(B)-e-r+"px"}),W&&Object.assign(i,{maxHeight:Kr(W)-e-r+"px"}),z||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[z,W,B,S,m]),Ie=l().useMemo((()=>{const{scrollYStore:e}=i.current,{viewportHeight:t,gutterWidth:r}=m;return Math.floor((f?t-r:t)/e.rowHeight)}),[m,f]),[Te,Re]=l().useState([]),Pe=pc();uc({ref:ge,omitClassNames:[".table-editable__popper"],handler:()=>{De([]),Se.current?.blur()}}),l().useImperativeHandle(t,(()=>({setClickedValues:De,createFocus:Ae,forceUpdate:Pe}))),_e((()=>{Te.length&&i.current.tableManager.focus(i.current.uid)}),[Te]),l().useLayoutEffect((()=>{ke();const e=Mt()(document,"keydown",Oe);return()=>e.remove()}),[]);const Oe=Y((e=>{const{keyCode:t}=e;if(i.current.uid===i.current.tableManager.getFocusInstance()?.id&&(27===t&&(De([]),P(""),$(!1)),Te.length&&(We(document.activeElement,ge.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===G?.type||X)){const t=b[0]??x??null,r=n.find((e=>a(e,e.index)===t))??null;r&&fe?.(r,e)}if(!He(Te[0],Te[1])){if(38===t||40===t){qe(e);let r=N?n:i.current.tableFullData;w&&(r=Dr(r,(e=>Array.isArray(e.children)&&y.includes(a(e,e.index)))));const l=r.length;let o=r.findIndex((e=>a(e,e.index)===Te[0]));const s=38===t?(--o+l)%l:++o%l,c=r[s],d=a(c,c.index),u=Fe(d,Te[1]);"radio"!==G?.type||G.disabled?.(c)||u||R([d]),!X||X.disabled?.(c)||u||P(d),F(s)||(38===t&&L(d,s),40===t&&L(d,Ie>s+1?0:s+1-Ie)),Le(...Te),De([d,Te[1]])}if(9===t||e.shiftKey&&9===t){if(qe(e),!s.length)return De([]);const r=s.length;let n=s.findIndex((e=>e.dataIndex===Te[1]));const a=e.shiftKey&&9===t?(--n+r)%r:++n%r,i=s[a].dataIndex;Le(...Te),A(i),De([Te[0],i])}}}})),ke=()=>{I("$tableBody",ge.current),I("$tableXspace",ye.current),I("$tableYspace",xe.current)},Ae=(e,t)=>{be.current[`${e}-${t}`]?.focus()},Le=(e,t)=>{be.current[`${e}-${t}`]?.blur()},Fe=(e,t)=>be.current[`${e}-${t}`]?.isEditable()??!1,He=(e,t)=>be.current[`${e}-${t}`]?.isOpening()??!1,De=e=>{(0,Q.isEqual)(e,Te)||Re(e)},$e=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),Me=(e,t,r)=>{const{disabled:n}=G||{},{deriveRowKeys:a,recordsMap:l}=i.current,o=Fr(a,e);let s=[],c=M(o?.children||[]);return n&&(c=c.filter((e=>!l.has(e)||!n(l.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(an(a,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Fr(a,e),r=t?.children?.every((e=>s.includes(e.rowKey)));s=r?[...s,e]:s.filter((t=>t!==e))})),s},Ke=(e,t=0)=>{const r=[];return e.forEach((e=>{const n=e.index,o=a(e,e.index);if(r.push(Ve(e,n,o,t)),Z?.expandedRowRender){const{expandedRowClassName:t,rowExpandable:a=re}=Z;y.includes(o)&&a(e)&&r.push(l().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},l().createElement("td",{colSpan:Ce.length,className:"body--column",style:{paddingLeft:G?2*zo.selectionColumnWidth:zo.selectionColumnWidth}},l().createElement("div",{className:ve()("cell",t)},Z.expandedRowRender(e,n)))))}if(!i.current.scrollYLoad&&(e=>Array.isArray(e.children))(e)){const n="function"!=typeof Z?.rowExpandable||Z.rowExpandable(e);y.includes(o)&&n&&r.push(...Ke(e.children,t+1))}})),r},Ve=(e,t,r,n=0)=>{const{disabled:a}=G||{},i=["body--row",{"body--row-striped":J&&t%2!=0,"body--row-selected":b.includes(r)&&!a?.(e),"body--row-current":x===r,...C?Ue(e._group):null}];return l().createElement("tr",{key:r,"data-row-key":r,className:ve()(i)},Ce.map(((a,i)=>je(a,i,e,t,r,n))))},je=(e,t,r,n,s,u)=>{const{isIE:m}=i.current,{dataIndex:h,fixed:f,align:g,className:y=""}=e;i.current.scrollXLoad&&(t=o.findIndex((e=>e.dataIndex===h)));const{rowSpan:x,colSpan:v}=ze(r,e,n,t);if(!x||!v)return null;const E=e.ellipsis??ce,S=!m&&"left"===f,N=!m&&"right"===f,I=["body--column",{"col--ellipsis":E,"col--center":"center"===g,"col--right":"right"===g,"column--sort":!!p[h],"cell-fix-left":S,"cell-fix-right":N,"cell-fix-left-last":S&&c[c.length-v]?.dataIndex===h,"cell-fix-right-first":N&&d[0]?.dataIndex===h,[y]:!!y}],T=N&&v>1?o.slice(t+1,t+v).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,A=m?null:{left:S?`${O(h)}px`:"",right:N?k(h)-T+"px":""},L=ne?"function"==typeof ne?ne(r,n):ne:null,F=ae?"function"==typeof ae?ae(r,e,n,t):ae:null,H=C?Be(r._group):null,_=Object.assign({},A,U?{height:U}:null,H,L,F);return l().createElement("td",{key:h,"data-col-index":t,rowSpan:x>1?x:void 0,colSpan:v>1?v:void 0,className:ve()(I),style:_,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([zo.expandableColumn,zo.operationColumn].includes(n))return;const i=a(t,t.index);De([i,n]);const l=Fe(i,n),{type:o,selectByClickRow:s=!0,disabled:c=te}=G||{};!o||c(t)||l||(s||n===zo.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=G||{};if("radio"===r&&R([e]),"checkbox"===r){const r=!b.includes(e),i=w&&!n?Me(e,b,r):$e(e,b,r);R(i),a?.(r,t,i)}})(i,t),[zo.selectionColumn].includes(n)||(!X||X.disabled?.(t)||l||P(i),pe?.(t,r,e))})(t,r,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(n)||me?.(t,r,e)})(t,r,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(n)||he?.(t,r,e)})(t,r,e)},l().createElement(Tc,{ref:e=>be.current[`${s}-${h}`]=e,row:r,column:e,rowIndex:n,columnIndex:t,rowKey:s,depth:u,showTitle:E}))},ze=(e,t,r,a)=>{let i=1,l=1;if("function"==typeof ie){const o=ie({row:e,column:t,rowIndex:r,columnIndex:a,tableData:n});if(Array.isArray(o)?(i=o[0],l=o[1]):(0,Q.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan),e===n[0]&&0===i){i=1;for(let e=1;e<n.length;e++){const{rowSpan:r}=ze(n[e],t,n[e].index,a);if(r>0)break;i++}}}if(u.length>0){const e=u.find((e=>e.row===r&&e.col===a));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},Be=e=>{const{backgroundColor:t,color:r}=ee.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},Ue=e=>{const t=ee.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ge=Ee("table");return l().createElement(l().Fragment,null,l().createElement(It,{ref:i.current.scrollBarRef,wrapClassName:`${Ge}--body-wrapper`,wrapStyle:Ne,native:se,showTopScrollbar:le?.doubleXScrollbar,onScroll:e=>{const{elementStore:t,scrollXLoad:r,scrollYLoad:n}=i.current,{prevST:a,prevSL:l}=we.current,o=g?m.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==l){de&&(t.$header.scrollLeft=c),h&&(t.$footer.scrollLeft=c);const e=c>0,r=Math.ceil(c)+m.tableWidth<m.tableBodyWidth+o;v!==e&&_(e),E!==r&&D(r)}if(n&&s!==a&&V(s),r&&c!==l&&K(c),g&&s!==a){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+m.viewportHeight-o>=r&&j({type:"scroll",target:e,preventDefault:te,stopPropagation:te})}we.current.prevST=s,we.current.prevSL=c}},l().createElement("div",{ref:xe,className:"body--y-space"}),l().createElement("div",{ref:ye,className:"body--x-space",style:{width:g?m.tableBodyWidth-m.gutterWidth:m.tableBodyWidth}}),l().createElement(oc.Provider,{value:Te},l().createElement("table",{ref:ge,className:`${Ge}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0",style:{width:0}},l().createElement("colgroup",null,Ce.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return l().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})}))),ue?l().createElement(oa.ReactSortable,{itemKey:e=>a(e,e.index),tag:"tbody",filter:".cell--edit input",preventOnFilter:!1,animation:200,list:n,setList:e=>{const t=e.map((e=>a(e,e.index))),r=n.map((e=>a(e,e.index)));if((0,Q.isEqual)(t,r))return;const l=sn(e),o=[];i.current.tableFullData.forEach((e=>{n.includes(e)?o.push(l.shift()):o.push(e)})),T(o),H()}},n.map((e=>Ve(e,e.index,a(e,e.index))))):l().createElement("tbody",null,Ke(n)))),!!oe&&l().createElement(kc,{ref:Se})))}));Ac.displayName="TableBody";const Lc=Ac,Fc=e=>{const{summationRows:t}=e,{tableRef:r,sorter:n,layout:a,scrollY:i,flattenColumns:o,leftFixedColumns:s,rightFixedColumns:c,setElementStore:d,getStickyLeft:u,getStickyRight:p}=l().useContext(Io),{footRender:m}=r.current.props,{t:h}=G(),f=l().useRef(null);l().useLayoutEffect((()=>{g()}),[]);const g=()=>{d("$footer",f.current)},b=Ee("table"),{tableBodyWidth:y}=a;return l().createElement("div",{ref:f,className:`${b}--footer-wrapper`},m?m(o,r.current.tableFullData):l().createElement("table",{className:`${b}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=a;return l().createElement("colgroup",null,o.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return l().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),i&&l().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),l().createElement("tfoot",null,(()=>{const{isIE:e}=r.current,d=["gutter",{"cell-fix-right":!!c.length}],m=e?null:{right:c.length?0:""};return t.map(((e,t)=>l().createElement("tr",{key:t,className:"footer--row"},o.map(((t,o)=>((e,t,o)=>{const{isIE:d}=r.current,{gutterWidth:m}=a,{dataIndex:f,fixed:g,align:b,summation:y}=e,x=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!n[f],"cell-fix-left":!d&&"left"===g,"cell-fix-right":!d&&"right"===g,"cell-fix-left-last":!d&&"left"===g&&s[s.length-1]?.dataIndex===f,"cell-fix-right-first":!d&&"right"===g&&c[0]?.dataIndex===f}],v=d?null:{left:"left"===g?`${u(f)}px`:"",right:"right"===g?`${p(f)+(i?m:0)}px`:""},E=y?.render?y.render(r.current.tableFullData):jr(t,`${f}_text`),S=0===o&&""===E?h("qm.table.config.summaryText"):E;return l().createElement("td",{key:f,title:S,className:ve()(x),style:{...v}},l().createElement("div",{className:"cell"},S))})(t,e,o))),i&&l().createElement("td",{className:ve()(d),style:{...m}}))))})())))};var Hc=function(e){return e.small="small",e.middle="default",e.large="default",e}(Hc||{});const _c=e=>{const{current:t,pageSize:r,total:n,onChange:a}=e,{global:i}=l().useContext(o),{tableRef:s,$size:c,setElementStore:d}=l().useContext(Io),{uniqueKey:u,paginationConfig:p,infoBarConfig:m}=s.current.props,h=l().useRef(null),f=l().useMemo((()=>u?`tablePager_${u}`:""),[u]);l().useLayoutEffect((()=>{g(),v()}),[]);const g=()=>{d("$pager",h.current)},b=p?.showSizeChanger??zo.pagination.showSizeChanger,y=p?.showQuickJumper??zo.pagination.showQuickJumper,x=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||zo.pagination.pageSizeOptions,v=async()=>{if(!f)return;const e=await E(f);e&&e!==r&&(a(t,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S=Ee("table"),w={[`${S}-pager`]:!0};return l().createElement("div",{ref:h,className:ve()(w)},l().createElement("div",{className:"pager-alert"},"bottom"===m?.position&&l().createElement(rs,{total:n})),l().createElement(P.Pagination,{size:Hc[c],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:x,current:t,pageSize:r,total:n,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=i?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},Dc=()=>{const{layout:e}=l().useContext(Io),t=l().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),r=Ee("table");return l().createElement("div",{className:`${r}--empty`,style:t},l().createElement(ct,null))},$c=()=>{const{setElementStore:e}=l().useContext(Io),t=l().useRef(null);l().useLayoutEffect((()=>{r()}),[]);const r=()=>{e("$resizableBar",t.current)},n=Ee("table");return l().createElement("div",{ref:t,className:`${n}--resizable-bar`})};function qc(){return qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qc.apply(null,arguments)}const Mc=l().forwardRef(((e,t)=>{const r=h(Ro,e),{rowKey:n,columns:a,loading:i,resizable:s,customClass:c,areaSelection:d,tablePrint:u,exportExcel:p,infoBarConfig:m,topSpaceAlign:f,showTableInfo:g,showFullScreen:b,showRefresh:y,showToolBox:x,showHeader:v}=r,{$size:E}=X(r),S=l().useRef(null),w=l().useRef(null),C=l().useRef(null),N=l().useRef(null),I=l().useRef(null),T=Y(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(pe("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),{tableRef:R,tableFullData:P,setElementStore:O,setOriginColumns:k,setTableFullData:A,setTableOriginData:L,setTableFlatData:F,setAllTableData:H,setDeriveRowKeys:_,setInvalidRowKeys:D,setFieldAuth:$,setColumnsDefined:q,setScrollXStore:M,setScrollYStore:K,setScrollXLoad:V,setScrollYLoad:j,setResizeState:z,setHandleState:B,setSummaries:W,setSelectionRows:U,setShouldToTop:G,setRecordsMap:J,setUnMounted:ee,clearElementStore:te,clearRecordsMap:re}=((e,{getRowKey:t,$size:r})=>{const{rowHeight:n,dynamicThead:a}=e,i=l().useRef({props:e,uid:qo(),tableManager:Ko,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],tableFlatData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!a,scrollBarRef:l().createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:n||zo.rowHeightMaps[r]},store:new jo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollXLoad:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!Z&&/MSIE|Trident/.test(navigator.userAgent)});var o;o=e,i.current.props=o;const s=(e,r,n="",a="",i=0)=>e.map((e=>{const l=t(e,e.index),o=n?`${n}#${l}`:`${l}`,c=a?`${a}.${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:l,rowKeyPath:o,indexPath:c};return e.indexPath=c,e._level=i,Array.isArray(e.children)&&(d.children=s(e.children,l,o,c,i+1)),r?Object.assign({},d,{parentRowKey:r}):d})),c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:i,...i.current,setElementStore:(e,t)=>{i.current.elementStore[e]=t},setOriginColumns:e=>{i.current.originColumns=e},setTableFullData:e=>{i.current.tableFullData=e},setTableFlatData:e=>{i.current.tableFlatData=e},setTableOriginData:e=>{i.current.tableOriginData=e},setAllTableData:e=>{const r=Hr(e);i.current.allTableData=r,i.current.allRowKeys=r.map((e=>t(e,e.index)))},setDeriveRowKeys:e=>{const t=i.current.tableFullData.some((e=>Array.isArray(e.children)));i.current.treeTable=t,i.current.deriveRowKeys=t?s(e,""):[],i.current.flattenRowKeys=t?c(i.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{i.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{i.current.fieldAuth[e]=t},setColumnsDefined:e=>{i.current.columnsDefined=e},setScrollXStore:e=>{i.current.scrollXStore=e},setScrollYStore:e=>{i.current.scrollYStore=e},setResizeState:e=>{i.current.resizeState=e},setHandleState:e=>{i.current.handleState=e},setSummaries:e=>{i.current.summaries=e},setScrollXLoad:e=>{i.current.scrollXLoad=e},setScrollYLoad:e=>{i.current.scrollYLoad=e},setShouldToTop:e=>{i.current.shouldToTop=e},setSelectionRows:e=>{i.current.selectionRows=e},setRecordsMap:(e,t)=>{i.current.recordsMap.set(e,t)},setUnMounted:e=>{i.current.unMounted=e},clearElementStore:()=>{for(const e in i.current.elementStore)i.current.elementStore[e]=null},clearRecordsMap:()=>{i.current.recordsMap.clear()}}})(r,{getRowKey:T,$size:E}),{tableData:ne,setTableData:ie,tableFlatColumns:le,setTableFlatColumns:oe,filters:ce,setFilters:de,sorter:ue,setSorter:me,superFilters:he,setSuperFilters:fe,pagination:ge,setPagination:be,selectionKeys:ye,setSelectionKeys:xe,rowExpandedKeys:Se,setRowExpandedKeys:we,highlightKey:Ce,setHighlightKey:Ne,updateMark:Ie,forceUpdate:Te,mergedTdCells:Re,setMergedCells:Pe,layout:Oe,setLayout:ke,permission:Ae,setPermission:Le,spinning:Fe,setSpinning:He,scrollX:De,setScrollX:$e,scrollY:qe,setScrollY:Me,isPingLeft:Ke,setPingLeft:Ve,isPingRight:je,setPingRight:ze,isFullScreen:Be,setFullScreen:We,updateTableData:Ue}=(e=>{const{uniqueKey:t,nativeScrollBar:r,initialSorter:n={},initialFilter:a={},paginationConfig:i,rowSelection:s,expandable:c,rowHighlight:d,mergedCells:u}=e,{global:p}=l().useContext(o),m={current:i?.current??zo.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??i?.pageSize??p?.table?.pagination?.pageSize??zo.pagination.pageSize,total:0},h=s?.selectedRowKeys??s?.defaultSelectedRowKeys??[],f=c?.expandedRowKeys??c?.defaultExpandedRowKeys??[],[g,b]=l().useState([]),[y,x]=l().useState([]),[v,E]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),a),[S,w]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),n),[C,N]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),[]),[I,T]=l().useState(m),[R,P]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),h),[O,k]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),f),[A,L]=l().useState(d?.currentRowKey??""),[F,H]=l().useReducer((e=>e+1),0),[_,D]=Wo([],{value:u}),[$,q]=l().useState({gutterWidth:r?Go():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[M,K]=l().useState({export:!0,import:!0,print:!0}),[V,j]=l().useState(!1),[z,B]=l().useState(!1),[W,U]=l().useState(!1),[G,Y]=l().useState(!1),[X,Z]=l().useState(!1),[J,ee]=l().useState(!1);return{tableData:g,setTableData:b,tableFlatColumns:y,setTableFlatColumns:x,filters:v,setFilters:E,sorter:S,setSorter:w,superFilters:C,setSuperFilters:N,pagination:I,setPagination:T,selectionKeys:R,setSelectionKeys:P,rowExpandedKeys:O,setRowExpandedKeys:k,highlightKey:A,setHighlightKey:L,updateMark:F,forceUpdate:H,mergedTdCells:_,setMergedCells:D,layout:$,permission:M,setPermission:K,setLayout:q,spinning:V,setSpinning:j,scrollX:z,setScrollX:B,scrollY:W,setScrollY:U,isPingLeft:G,setPingLeft:Y,isPingRight:X,setPingRight:Z,isFullScreen:J,setFullScreen:ee,updateTableData:()=>b([...g])}})(r),{isFetch:Ge,isWebPagination:Ye,isScrollPagination:Xe,showPagination:Qe,shouldUpdateHeight:Ze,tableColumns:Je,flattenColumns:et,editableColumns:tt,summationColumns:rt,leftFixedColumns:nt,rightFixedColumns:at,derivedMergeCells:it,treeExpandIndex:lt,showSummary:ot,showFooter:st,isHeadGroup:ct,bordered:dt,isHeadSorter:pt,isHeadFilter:mt,isServiceSummation:ht,isSelectCollection:ft,isTableImport:gt,isTableClipboard:bt,isSuperSearch:yt,isFastSearch:xt,isGroupSummary:vt,isGroupSubtotal:Et,isTreeTable:St,isTableEmpty:wt,summationRows:Ct,fetchParams:Nt}=Xo(r,{getRowKey:T,tableRef:R,tableFullData:P,tableData:ne,sorter:ue,filters:ce,superFilters:he,selectionKeys:ye,pagination:ge,mergedTdCells:Re}),{createElementStore:It,tableStyles:Tt,getSpan:Rt,getStickyLeft:Pt,getStickyRight:Ot,scrollXToColumn:kt,scrollYToRecord:At,rowInViewport:Lt,calcTableHeight:Ft,resetTableScroll:Ht,computeVirtualX:_t,computeVirtualY:Dt,doLayout:$t}=es(r,{getRowKey:T,tableRef:R,topElementRef:S,tableElementRef:w,$size:E,tableColumns:Je,flattenColumns:et,leftFixedColumns:nt,derivedMergeCells:it,layout:Oe,scrollX:De,scrollY:qe,showFooter:st,showPagination:Qe,isFullScreen:Be,setLayout:ke,setScrollX:$e,setScrollY:Me,setElementStore:O,setScrollXStore:M,setScrollYStore:K,setShouldToTop:G}),{initialTable:qt,checkDataIndex:Mt,createTableFullData:Kt,getTableData:Vt,handleTableData:jt,createWebPageData:zt,createTableData:Bt,createGroupData:Wt,createSelectionKeys:Ut,createRowExpandedKeys:Gt,setSelectionKeysEffect:Yt,findParentRowKeys:Xt,getAllChildRowKeys:Qt,doFieldValidate:Zt,getTableLog:Jt,dataChange:er,tableChange:tr,toLastPage:rr,toFirstPage:nr,getPageCount:ar,pagerChangeHandle:ir,triggerScrollXEvent:lr,triggerScrollYEvent:or,scrollBottomDebouncer:sr,clearTableSorter:cr,clearTableFilter:dr,clearSuperFilters:ur,clearRowSelection:pr,clearRowHighlight:mr,clearTableLog:hr,destroy:fr}=Jo(r,{getRowKey:T,tableRef:R,tableElementRef:w,tableBodyRef:C,$size:E,tableColumns:Je,flattenColumns:et,editableColumns:tt,tableFullData:P,pagination:ge,layout:Oe,filters:ce,sorter:ue,superFilters:he,fetchParams:Nt,selectionKeys:ye,rowExpandedKeys:Se,highlightKey:Ce,summationColumns:rt,shouldUpdateHeight:Ze,isFetch:Ge,isTreeTable:St,isWebPagination:Ye,isScrollPagination:Xe,isServiceSummation:ht,isGroupSubtotal:Et,doLayout:$t,setTableData:ie,setTableFlatColumns:oe,setTableFullData:A,setTableOriginData:L,setTableFlatData:F,setAllTableData:H,setDeriveRowKeys:_,setPagination:be,setSpinning:He,setSorter:me,setFilters:de,setSuperFilters:fe,setSelectionKeys:xe,setRowExpandedKeys:we,setHighlightKey:Ne,setSelectionRows:U,setScrollXLoad:V,setScrollYLoad:j,setScrollXStore:M,setScrollYStore:K,computeVirtualX:_t,computeVirtualY:Dt,setFieldAuth:$,setResizeState:z,setSummaries:W,setPermission:Le,setRecordsMap:J,resetTableScroll:Ht,clearElementStore:te,clearRecordsMap:re});((e,t)=>{const{columns:r,summation:n,rowSelection:a,expandable:i,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,scrollX:u,pagination:p,selectionKeys:m,rowExpandedKeys:h,highlightKey:f,summationRows:g,showSummary:b,isWebPagination:y,isScrollPagination:x,checkDataIndex:v,toLastPage:E,toFirstPage:S,getPageCount:w,setHandleState:C,scrollYToRecord:N,setSelectionKeysEffect:I,setOriginColumns:T,setRowExpandedKeys:R,setHighlightKey:P,setResizeState:O,setPingRight:k,setUnMounted:A,calcTableHeight:L,createSelectionKeys:F,createRowExpandedKeys:H,initialTable:_,destroy:D}=t,$=l().useRef(g);_e((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),m.__prevent__||e?.(m,s.current.selectionRows),qr(m)}),[m]),_e((()=>{if(!i)return;const{onChange:e}=i;h.__prevent__||e?.(h,h.map((e=>s.current.recordsMap.get(e)))),qr(h)}),[h]),_e((()=>{o&&(c.current.setClickedValues(f?[f,""]:[]),o.onChange?.(f,s.current.recordsMap.get(f)??null))}),[f]),_e((()=>{(0,Q.isEqual)(g,$.current)||($.current=g,b&&n&&n.onChange?.(g))}),[g]),_e((()=>{const e=F(a.selectedRowKeys);(0,Q.isEqual)(e,m)||I($r(e))}),[a?.selectedRowKeys]),_e((()=>{const e=H(i.expandedRowKeys);(0,Q.isEqual)(e,h)||R($r(e))}),[i?.expandedRowKeys]),_e((()=>{const{currentRowKey:e}=o;e!==f&&P(e??"")}),[o?.currentRowKey]),_e((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?E():S()),N("","after"===e?1e5:0)),t&&p.current>w()&&E(),(e||t)&&C({insert:null,remove:!1})}),[p.total]),_e((()=>{k(u)}),[u]),_e((()=>{L()}),[d]),_e((()=>{s.current.scrollYLoad&&(e.height||e.maxHeight||pe("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||pe("Table","必须设置组件参数 `ellipsis`")),x&&(e.height||e.maxHeight||pe("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,x]),ts({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(O(Object.assign({},e,{winHeight:r})),L())},delay:16}),l().useEffect((()=>(T(se(r)),_(),v(),ae((()=>L())),()=>{D(),A(!0)})),[])})(r,{tableRef:R,tableBodyRef:C,$size:E,scrollX:De,pagination:ge,selectionKeys:ye,rowExpandedKeys:Se,highlightKey:Ce,showSummary:ot,summationRows:Ct,isWebPagination:Ye,isScrollPagination:Xe,checkDataIndex:Mt,toLastPage:rr,toFirstPage:nr,getPageCount:ar,setHandleState:B,scrollYToRecord:At,setOriginColumns:k,setSelectionKeysEffect:Yt,setRowExpandedKeys:we,setHighlightKey:Ne,setResizeState:z,setPingRight:ze,setUnMounted:ee,calcTableHeight:Ft,createSelectionKeys:Ut,createRowExpandedKeys:Gt,initialTable:qt,destroy:fr});const gr=l().useMemo((()=>({getRowKey:T,tableRef:R,tableBodyRef:C,$size:E,flattenColumns:et,editableColumns:tt,leftFixedColumns:nt,rightFixedColumns:at,treeExpandIndex:lt,sorter:ue,filters:ce,superFilters:he,layout:Oe,bordered:dt,showFooter:st,showSummary:ot,summationRows:Ct,scrollX:De,scrollY:qe,pagination:ge,fetchParams:Nt,selectionKeys:ye,rowExpandedKeys:Se,highlightKey:Ce,mergedTdCells:Re,derivedMergeCells:it,updateMark:Ie,isFetch:Ge,isPingLeft:Ke,isPingRight:je,isHeadSorter:pt,isHeadFilter:mt,isFullScreen:Be,isTableEmpty:wt,isHeadGroup:ct,isTreeTable:St,isGroupSubtotal:Et,isWebPagination:Ye,dataChange:er,tableChange:tr,getTableData:Vt,setElementStore:O,createWebPageData:zt,createTableFullData:Kt,updateTableData:Ue,setSorter:me,setFilters:de,setSuperFilters:fe,setHighlightKey:Ne,setRowExpandedKeys:we,setSelectionRows:U,setSelectionKeysEffect:Yt,setInvalidRowKeys:D,setMergedCells:Pe,getSpan:Rt,getStickyLeft:Pt,getStickyRight:Ot,scrollXToColumn:kt,scrollYToRecord:At,rowInViewport:Lt,setPagination:be,setPingLeft:Ve,setPingRight:ze,setSpinning:He,setFullScreen:We,setShouldToTop:G,doFieldValidate:Zt,createTableData:Bt,createGroupData:Wt,findParentRowKeys:Xt,getAllChildRowKeys:Qt,triggerScrollXEvent:lr,triggerScrollYEvent:or,scrollBottomDebouncer:sr,resetTableScroll:Ht,clearTableSorter:cr,clearTableFilter:dr,clearSuperFilters:ur,clearRowSelection:pr,clearRowHighlight:mr})),[E,et,tt,nt,at,lt,ue,ce,he,Oe,dt,st,ot,Ct,De,qe,ge,Nt,ye,Se,Ce,it,Ie,Ge,Ke,je,pt,mt,Be,wt,ct,St,Et,Ye]);((e,t)=>{const{getRowKey:r,tableRef:n,toolBoxRef:a,tableBodyRef:i,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:m,highlightKey:h,isFetch:f,dataChange:g,getTableData:b,handleTableData:y,createTableData:x,createTableFullData:v,calcTableHeight:E,scrollXToColumn:S,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:N,setHandleState:I,setColumnsDefined:T,setSelectionKeysEffect:R,setRowExpandedKeys:P,setHighlightKey:O,setSelectionRows:k,setOriginColumns:A,forceUpdate:L,getTableLog:F,clearRowSelection:H,clearRowHighlight:_,clearTableSorter:D,clearTableFilter:$,clearSuperFilters:q,clearTableLog:M}=t,{columns:K,columnsChange:V}=n.current.props,j=(e,t,n)=>e.filter((e=>{const a=r(e,e.index);e.children&&(e.children=j(e.children,t,n));const i=t.includes(a);return i&&n?.(e,a),!i}));l().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:async e=>{f&&(await b(),e?.())},GET_LOG:()=>F(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(H(),_(),D(),$(),q(),M(),x([]))},CLEAR_LOG:()=>{M()},CREATE_FOCUS:(e,t)=>{i.current.createFocus(e,t)},FORCE_UPDATE:()=>{L()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{S(e)},SET_SELECTION:(e,t)=>{R(t?$r([...e]):e)},SET_EXPANDABLE:(e,t)=>{P(t?$r([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{y(e)},DEFINE_INITIAL_COLUMNS:e=>{A(e),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=Or(K,e);if(!n)return pe("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,Q.isPlainObject)(t))return pe("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return pe("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,Q.set)(n,e,t[e]);r&&(V?V([...K]):pe("Table","需要设置 `columnsChange` 参数"),L())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i}=n.current,l=(Array.isArray(e)?e:[e]).filter((e=>(0,Q.isPlainObject)(e)));if(!l.length)return;l.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(r)||zr(e,r,jr(e,r))})),a.addToInserted(e)}));const o="before"===t?.mode,c=void 0===t?.parentRowKey,d=i;if(c)o?d.unshift(...l):d.push(...l);else{const e=ln(i,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}c&&I(Object.assign({},n.current.handleState,{insert:o?"before":"after"})),x(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a}=n.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,Q.isPlainObject)(e)?r(e,e.index):e));if(!i.length)return;let l=!1;const o=j(a,i,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),l=!0}));l&&(I(Object.assign({},n.current.handleState,{remove:!0})),v(o),R(p.filter((e=>!i.includes(e)))),i.includes(h)&&_(),P(m.filter((e=>!i.includes(e)))),g(),ae((()=>{N(j(n.current.tableOriginData,i))})))},VALIDATE_FIELDS:(e,t)=>{n.current.allTableData.forEach((n=>{c.forEach((a=>{const{dataIndex:i,editRender:l}=a,o=l?.(n,a);if(!o)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:d}=o;d||C(c,jr(n,i),s,i)}))}));const{required:a,validate:i}=F(),l=[...a,...i];return l.length&&w(l[0].rowKey),L(),{required:a,validate:i}}})))})(t,{getRowKey:T,tableRef:R,toolBoxRef:N,tableBodyRef:C,columnFilterRef:I,flattenColumns:et,editableColumns:tt,pagination:ge,fetchParams:Nt,selectionKeys:ye,rowExpandedKeys:Se,highlightKey:Ce,isFetch:Ge,dataChange:er,getTableData:Vt,handleTableData:jt,createTableData:Bt,createTableFullData:Kt,calcTableHeight:Ft,scrollXToColumn:kt,scrollYToRecord:At,doFieldValidate:Zt,setTableOriginData:L,setHandleState:B,setColumnsDefined:q,setSelectionKeysEffect:Yt,setRowExpandedKeys:we,setHighlightKey:Ne,setSelectionRows:U,setOriginColumns:k,forceUpdate:Te,getTableLog:Jt,clearRowSelection:pr,clearRowHighlight:mr,clearTableSorter:cr,clearTableFilter:dr,clearSuperFilters:ur,clearTableLog:hr}),l().useLayoutEffect((()=>{It(),R.current.tableManager.register(R.current.uid,t??{current:null})}),[]);const br=Ee("table"),yr={[`${br}--wrapper`]:!0,[`${br}--lg`]:"large"===E,[`${br}--sm`]:"small"===E,[`${br}--maximize`]:Be,[c]:!!c},xr={[br]:!0,"is--border":dt,"is--fixed":nt.length||at.length,"is--sortable":pt,"is--filterable":mt,"is--head-group":ct,"is--area-select":!!d,"is--ping-left":Ke,"is--ping-right":je};return l().createElement(Io.Provider,{value:gr},l().createElement("div",{className:ve()(yr)},g&&l().createElement("div",{ref:S,className:`${br}-top`},l().createElement("div",{className:`${br}-top__space`},"bottom"!==m?.position&&l().createElement(rs,{total:ge.total}),l().createElement("div",{className:`${br}-top__space-slot`,style:{justifyContent:_o[f]}},r.children)),l().createElement("div",{className:`${br}-top__actions`},l().createElement(Gs,{ref:N,showFullScreen:b,showReload:y&&Ge,showPrint:Ae.print&&!!u,showImport:Ae.import&&gt,showExport:Ae.export&&!!p,showClipboard:bt,showCollection:ft,showFastSearch:xt,showSuperSearch:yt,showGroupSummary:vt,showToolBox:x,tableColumns:Je}),l().createElement(Qs,{ref:I,columns:a}))),l().createElement(ut,{spinning:i??Fe},l().createElement("div",{ref:w,className:ve()(xr),style:Tt},l().createElement("div",{className:`${br}--main-wrapper`},v&&l().createElement(lc,{tableColumns:Je,sorter:ue,filters:ce}),l().createElement(Lc,{ref:C,tableFlatColumns:le,tableData:ne}),st&&l().createElement(Fc,{summationRows:Ct})),dt&&l().createElement("div",{className:`${br}--border-line`}),wt&&l().createElement(Dc,null),s&&l().createElement($c,null))),Qe&&l().createElement(_c,qc({},ge,{onChange:(e,t)=>ir({current:e,pageSize:t})}))))}));Mc.displayName="QmTable";const Kc=Mc,Vc=Kc;function jc(){return jc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jc.apply(null,arguments)}const zc=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},className:c,style:d,onClose:u}=e,{$size:p}=X(e),{t:m}=G(),h=l().useRef(null),f=l().useRef(null),b=l().useRef(null),y=xt(h),[x,v]=l().useState(s),[E,S]=l().useState(),[w,C]=l().useState(i),[N,I]=l().useState(!1),[T,R]=l().useState(300),[P,O]=l().useState(o),[k,A]=l().useState([{title:m("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[L,F]=l().useState((0,Q.merge)({},s.fetch?.params,n)),[H,_]=l().useState([]),D=()=>{const e=h.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Ra[p]-30)},$=vt(D,5);g((()=>{$()}),[y.width]),_e((()=>{(0,Q.isEqual)(o,P)||O(o)}),[o]),l().useEffect((()=>{q()}),[L]),l().useEffect((()=>{a&&b.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{n&&f.current?.SET_FIELDS_VALUE(n)}),[]);const q=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=re}=t;if(i(L)){I(!0);try{const e=await n(L);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];r||(C([]),await ne(0)),_(t)}}catch(e){}I(!1)}},M=e=>{r||(S(e),u(e))},K=e=>{F(Object.assign({},L,e))},V=Ee("search-helper"),j={[`${V}--wrapper`]:!0},z=x.webPagination?{dataSource:H,loading:N,webPagination:!0}:{fetch:{...x.fetch,params:L}};return l().createElement("div",{ref:h,className:ve()(j,c),style:d},l().createElement("div",{className:"form-wrap"},P.length?l().createElement(Ml,{ref:f,items:P,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>O(e),onCollapse:()=>D(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await f.current.GET_FORM_DATA();e||K(t)}}):null),l().createElement("div",null,l().createElement(Vc,jc({ref:b,uniqueKey:t,height:T,columns:k,rowKey:x.rowKey||"pageIndex"},z,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{C(e),S(r?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>A(e),onRowDblclick:M,onRowEnter:M}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>u(null),style:{marginRight:8}},m("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!E,onClick:()=>u(E,r?w:void 0)},m("qm.dialog.confirm"))))};zc.displayName="QmSearchHelper";const Bc=zc;function Wc(){return Wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wc.apply(null,arguments)}const Uc=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Uc(e.children)),e.children&&t.push(e.value)})),t},Gc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=Gc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Yc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Yc(e.children,t),t(e)||e.children&&e.children.length))),Xc=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},tree:c={},className:d,style:u,onClose:p}=e,{$size:m}=X(e),{t:h}=G(),f=l().useRef(null),b=l().useRef(null),y=l().useRef(null),x=xt(f),[v,E]=l().useState(s),[S,w]=l().useState(),[C,N]=l().useState(i),[I,T]=l().useState(!1),[R,O]=l().useState(300),[k,A]=l().useState(300),[L,F]=l().useState(o),[H,_]=l().useState([{title:h("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[D,$]=l().useState((0,Q.merge)({},s.fetch?.params,n)),[q,M]=l().useState([]),K=()=>{const e=f.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");O(e.offsetHeight-r.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Ra[m]-30)},V=vt(K,5);g((()=>{V()}),[x.width]),_e((()=>{(0,Q.isEqual)(o,L)||F(o)}),[o]),l().useEffect((()=>{j()}),[D]),l().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{n&&b.current?.SET_FIELDS_VALUE(n),ie()}),[]);const j=async()=>{const{webPagination:e,fetch:t}=v;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=re}=t;if(i(D)){T(!0);try{const e=await n(D);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];r||(N([]),await ne(0)),M(t)}}catch(e){}T(!1)}},z=e=>{r||(w(e),p(e))},B=e=>{$(Object.assign({},D,e))},[W,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),te=l().useRef(W),ae=l().useRef([]);_e((()=>{Z(Uc(W))}),[W]);const ie=async()=>{if(!c.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=c.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,Q.get)(i.data,r)??[],t=Pn(e,n,a);U(t),te.current=t,ae.current=e}}catch(e){}},le=e=>`${e}|${Gn.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe=Ee("tree-table-helper"),se={[`${oe}--wrapper`]:!0},ce=v.webPagination?{dataSource:q,loading:I,webPagination:!0}:{fetch:{...v.fetch,params:D}};return l().createElement("div",{ref:f,className:ve()(se,d),style:u},l().createElement(tt,{defaultValue:200,style:{height:"100%"}},l().createElement(tt.Pane,{min:100,style:{overflowY:"auto"}},l().createElement(P.Input,{className:"input-wrap",value:J,style:{marginBottom:8},placeholder:h("qm.form.inputPlaceholder"),suffix:l().createElement(Se.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{const t=Yc(te.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==le(r).indexOf(e)}));ee(e),U(t)})(e.target.value)}),l().createElement(P.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:Y,treeData:W,filterTreeNode:e=>{if(!J)return!1;const t=e.text||"";return-1!==le(t).indexOf(J)},onExpand:e=>{Z(e)},onSelect:e=>{const{valueKey:t="value"}=c.fetch;(e=>{if(!c.tableParamsMap)return pe("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof c.tableParamsMap?c.tableParamsMap():c.tableParamsMap,r={};for(const n in t)r[n]=(0,Q.get)(e,t[n]);B(r)})(Gc(ae.current,(r=>(0,Q.get)(r,t)===e[0]))||{})}})),l().createElement(tt.Pane,{className:"split-pane"},l().createElement("div",{className:"form-wrap"},L.length?l().createElement(Ml,{ref:b,items:L,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>F(e),onCollapse:()=>K(),onFinish:e=>B(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||B(t)}}):null),l().createElement("div",null,l().createElement(Vc,Wc({ref:y,uniqueKey:t,height:k,columns:H,rowKey:v.rowKey||"pageIndex"},ce,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{N(e),w(r?t:t[0])}},paginationConfig:v.paginationConfig,columnsChange:e=>_(e),onRowDblclick:z,onRowEnter:z}))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>p(null),style:{marginRight:8}},h("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!S,onClick:()=>p(S,r?C:void 0)},h("qm.dialog.confirm"))))};Xc.displayName="TreeTableHelper";const Qc=Xc,Zc=e=>{const{multiple:t,tree:r={},defaultSelectedKeys:n,className:a,style:i,onClose:o}=e,{$size:s}=X(e),{t:c}=G(),[d,u]=l().useState(),[p]=l().useState(r.fetch?.params),m=Ee("tree-helper"),h={[`${m}--wrapper`]:!0},f=r.fetch?{...oe(r.fetch,["params","valueKey","textKey"]),params:p}:void 0;return l().createElement("div",{className:ve()(h,a),style:i},l().createElement(No,{multiple:t,fetch:f,fieldsDefine:{valueKey:r.fetch?.valueKey,textKey:r.fetch?.textKey},autoFocus:!0,asyncLoad:r.asyncLoad,checkStrictly:r.checkStrictly,checkStrategy:r.checkStrategy,defaultSelectedKeys:n,defaultExpandAll:r.defaultExpandAll,onSelectChange:e=>u(e),onCheckChange:e=>u(e)}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!d,onClick:()=>o(d)},c("qm.dialog.confirm"))))};Zc.displayName="TreeHelper";const Jc=Zc;function ed(){return ed=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ed.apply(null,arguments)}const td="_startSign",rd="_endSign",nd=e=>{const{uniqueKey:t,initialValue:r,filters:n=[],table:a={},onClose:i}=e,{$size:o}=X(e),{t:s}=G(),c=l().useRef(null),d=l().useRef(null),u=l().useRef(null),p=xt(c),[m,h]=l().useState(a),[f,b]=l().useState(!1),[y,x]=l().useState([]),[v,E]=l().useState(300),[S,w]=l().useState(n),[C,N]=l().useState([{title:s("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},{title:s("qm.form.rangeSearchHelper")[0],dataIndex:td,width:80,align:"right",render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:s("qm.form.rangeSearchHelper")[1],dataIndex:rd,fixed:"right",width:80,render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)}]),[I,T]=l().useState((0,Q.merge)({},a.fetch?.params,r)),[R,O]=l().useState([]),k=l().useMemo((()=>y.map((e=>e?.pageIndex))),[y]),A=l().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),L=()=>{const e=c.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Ra[o]-30)},F=vt(L,5);g((()=>{F()}),[p.width]),_e((()=>{(0,Q.isEqual)(n,S)||w(n)}),[n]),l().useEffect((()=>{H()}),[I]);const H=async()=>{const{webPagination:e,fetch:t}=m;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=re}=t;if(a(I)){b(!0);try{const e=await r(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[];O(t)}}catch(e){}b(!1)}},_=(e,t)=>{delete e[t]},D=()=>{y.forEach((e=>{e&&(_(e,td),_(e,rd))})),x([])},$=e=>{D(),T(Object.assign({},I,e))},q=Ee("range-helper"),M=m.webPagination?{dataSource:R,loading:f,webPagination:!0}:{fetch:{...m.fetch,params:I}};return l().createElement("div",{ref:c,className:`${q}--wrapper`},l().createElement("div",{className:"form-wrap"},S.length?l().createElement(Ml,{ref:d,items:S,initialValues:r,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>L(),onFinish:e=>$(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||$(t)}}):null),l().createElement("div",null,l().createElement(Vc,ed({ref:u,height:v,columns:C,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[td,rd].includes(r)&&(r===td&&(e[r]?(_(e,r),x([void 0,y[1]])):e.pageIndex>k[1]?P.message.warning(s("qm.searchHelper.rangeStartTip")):(y[0]&&_(y[0],r),e[r]="[",x([e,y[1]]))),r===rd&&(e[r]?(_(e,r),x([y[0],void 0])):e.pageIndex<k[0]?P.message.warning(s("qm.searchHelper.rangeEndTip")):(y[1]&&_(y[1],r),e[r]="]",x([y[0],e]))),u.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[td]="["),e.pageIndex===k[1]&&(e[rd]="]")}))}}),l().createElement(fe,{type:"primary",icon:l().createElement(Se.ClearOutlined,null),title:s("qm.table.alert.clear"),onClick:()=>D()}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[o]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>i(null),style:{marginRight:8}},s("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!A,onClick:()=>i(y.map((e=>(e=>{const t={};for(const r in e)[td,rd].includes(r)||(t[r]=e[r]);return t})(e))))},s("qm.dialog.confirm"))))};nd.displayName="RangeTableHelper";const ad=nd,id=e=>null!=e;function ld(e,t,r,n){const[a,i]=l().useState(void 0);l().useLayoutEffect((()=>{const t="function"==typeof e?e():e;i(t||null)}));const[o,s]=l().useState(null),c=()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:l}=e.getBoundingClientRect();return n>=0&&l>=0&&a<=t&&i<=r})(a)&&t&&a.scrollIntoView(n);const{left:e,top:r,width:i,height:l}=a.getBoundingClientRect(),o={left:e,top:r,width:i,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};return l().useLayoutEffect((()=>{c()}),[a,t]),ts({handler:c}),[l().useMemo((()=>{if(!o)return o;const e=r?.offset||6,t=r?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,r]),a]}const od={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},sd={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},cd=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function dd(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(od).forEach((e=>{const c={...n&&sd[e]||od[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,cd.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":c.offset[1]=-d.arrowOffsetHorizontal-o;break;case"leftBottom":case"rightBottom":c.offset[1]=d.arrowOffsetHorizontal+o}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+r,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+r,i.shiftX=!0,i.adjustX=!0}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,d,t,r),l&&(c.htmlRegion="visibleFirst")})),s}const ud=require("@rc-component/portal");var pd=n.n(ud);const md=require("@rc-component/trigger");var hd=n.n(md);function fd(){return fd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fd.apply(null,arguments)}const gd={fill:"transparent",pointerEvents:"auto"},bd=e=>{const{prefixCls:t,rootClassName:r,pos:n,showMask:a,style:i={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${qo()}`,p="object"==typeof c?c?.placeholder:c;return l().createElement(pd(),{open:s,autoLock:!0},l().createElement("div",{className:ve()(`${t}-mask`,r),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...i}},a?l().createElement("svg",{style:{width:"100%",height:"100%"}},l().createElement("defs",null,l().createElement("mask",{id:u},l().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),n&&l().createElement("rect",{x:n.left,y:n.top,rx:n.radius,width:n.width,height:n.height,fill:"black",className:p?`${t}-placeholder-animated`:""}))),l().createElement("rect",fd({},n?null:gd,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),n&&l().createElement(l().Fragment,null,l().createElement("rect",fd({},gd,{x:"0",y:"0",width:"100%",height:`${n.top}px`})),l().createElement("rect",fd({},gd,{x:"0",y:"0",width:n.left,height:"100%"})),l().createElement("rect",fd({},gd,{x:"0",y:n.top+n.height,width:"100%",height:`calc(100vh - ${n.top+n.height}px)`})),l().createElement("rect",fd({},gd,{x:n.left+n.width,y:"0",width:`calc(100vw - ${n.left+n.width}px)`,height:"100%"})))):null))},yd=e=>{const{prefixCls:t,zIndex:r,open:n,onPause:a,onPlay:i}=e,[o,s]=Wo(void 0,{value:n,postState:e=>e??!0}),c=l().useRef(null),d=l().useRef(!1),u=Y((e=>{p(e),e.shiftKey&&32===e.keyCode&&m()}));l().useEffect((()=>{const e=Mt()(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},m=()=>{d.current?d.current=!1:(s(!o),o?a?.():i?.())};return l().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-ze(t).x,o=e.clientY-ze(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-r-1&&(s=a-r-1),c<0&&(c=0),c>i-n-1&&(c=i-n-1),Ke(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>m()},o?l().createElement(Se.PauseOutlined,null):l().createElement(Se.CaretRightOutlined,null))},xd=e=>{const{prefixCls:t,current:r,total:n=0,cover:a,title:i,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:m,onFinish:h,className:f,indicatorsRender:g}=e,{t:b}=G(),y="primary"!==c?"primary":"default",x=Y((e=>{w(e),40===e.keyCode&&(r<n-1?m?.():h?.()),38===e.keyCode&&r>0&&p?.()}));l().useEffect((()=>{const e=Mt()(document,"keyup",x);return()=>e.remove()}),[]);const v=id(a)?l().createElement("div",{className:`${t}-cover`},a):null,E=id(o)?l().createElement("div",{className:`${t}-description`},o):null;let S;S=g?g(r,n):[...Array.from({length:n}).keys()].map(((e,n)=>l().createElement("span",{key:e,className:ve()(n===r&&`${t}-indicator-active`,`${t}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return l().createElement("div",{className:ve()(`${t}-content`,f)},l().createElement("div",{className:`${t}-inner`},l().createElement(Se.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&l().createElement(P.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},l().createElement(Se.QuestionCircleOutlined,{className:ve()(`${t}-close`,"help-icon")})),v,l().createElement("div",{className:`${t}-header`},l().createElement("div",{className:`${t}-title`},i)),E,l().createElement("div",{className:`${t}-footer`},n>1&&l().createElement("div",{className:`${t}-indicators`},S),l().createElement(ye,{className:`${t}-buttons`},0!==r?l().createElement(fe,{className:`${t}-prev-btn`,size:"small",onMouseDown:w,onClick:p},b("qm.tour.prevStep")):null,r===n-1?l().createElement(fe,{className:`${t}-finish-btn`,type:y,size:"small",onClick:h},b("qm.tour.finish")):l().createElement(fe,{className:`${t}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:m},b("qm.tour.nextStep"))))))},vd=e=>{const{current:t,renderPanel:r}=e;return l().createElement(l().Fragment,null,"function"==typeof r?r(e,t):l().createElement(xd,e))};function Ed(){return Ed=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ed.apply(null,arguments)}const Sd={left:"50%",top:"50%",width:1,height:1},wd=l().forwardRef(((e,t)=>{const{steps:r=[],defaultCurrent:n,current:a,onChange:i,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:m=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:b,zIndex:y,renderPanel:x,indicatorsRender:v,gap:E,animated:S=!0,scrollIntoViewOptions:w=!0,...C}=e,N=l().useRef(),[I,T]=Wo(0,{value:a,defaultValue:n}),[R,P]=Wo(void 0,{value:c,postState:e=>!(I<0||I>=r.length)&&(e??!1)}),[O,k]=Wo(1051,{value:y,defaultValue:y}),[A,L]=l().useState(),F=l().useRef(R);l().useLayoutEffect((()=>{R&&!F.current&&T(0),F.current=R,L(R)}),[R]),l().useImperativeHandle(t,(()=>({OPEN:()=>P(!0),CLOSE:()=>P(!1),SET_ZINDEX:e=>k(e)})));const{target:H,type:_,placement:D,trigger:$,delay:q,style:M,arrow:K,className:V,mask:j,scrollIntoViewOptions:z,zIndex:B,action:W}=r[I]||{},U=B||O,G=_||d,Y=R&&(j??u),X=z??w,[Q,Z]=ld(H,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,D),ee=!!Z&&(void 0===K?p:K),te="object"==typeof ee&&ee.pointAtCenter;l().useLayoutEffect((()=>{N.current?.forceAlign()}),[te,I]),_e((()=>{R&&(ie(),W?.(Z,I))}),[R,Z]);const re=e=>{T(e),i?.(e)},ae=()=>{P(!1),o?.(I)},ie=()=>{if(!Z)return;const e=[];!function t(r){if(1===r.nodeType){var n;"INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName||"none"===Me(n=r,"display")||"hidden"===Me(n,"visibility")||"0"===Me(n,"opacity")||e.push(r);for(const e of Array.from(r.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const le=async()=>{if(!$||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[a,i]=[e+r/2,t+n/2],l=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await ne(q??320))},oe="boolean"==typeof Y?Y:!!Y,se="boolean"==typeof Y?void 0:Y,ce=Object.assign({},f,M),de=Ee("tour"),ue=[{[`${de}-primary`]:"primary"===G},h,V],pe=dd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(bd,{zIndex:U,prefixCls:de,pos:Q,showMask:oe,style:se?.style,fill:se?.color,open:A,animated:S,rootClassName:h}),l().createElement(pd(),{open:A,autoLock:!0},l().createElement(hd(),Ed({ref:N},C,{zIndex:U,builtinPlacements:pe,popupStyle:ce,popupPlacement:J,popupVisible:A,popupClassName:ve()(ue),prefixCls:de,popup:()=>l().createElement(vd,Ed({key:"content",arrow:ee,prefixCls:de,total:r.length,helper:b,renderPanel:x,indicatorsRender:v,onPrev:async()=>{await le(),re(I-1)},onNext:async()=>{await le(),re(I+1)},onClose:ae,current:I,onFinish:()=>{ae(),s?.()}},Object.assign({},r[I],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),l().createElement("div",{className:ve()(h,`${de}-target-placeholder`),style:{...Q||Sd,position:"fixed",pointerEvents:"none"}}))),m&&l().createElement(pd(),{open:R},l().createElement(yd,{zIndex:U,prefixCls:de,onPause:()=>L(!1),onPlay:()=>L(!0)})))}));wd.displayName="QmTour";const Cd=wd,Nd=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Id=e=>({_s:e,status:Nd[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Td=e=>e?6:5,Rd=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Id(e);t(i),r.current=i,a?.({current:i})},Pd=e=>{const{name:t,in:r,timeout:n,preEnter:a=!0,preExit:o}=e,[s,c]=((e={})=>{const{enter:t=!0,exit:r=!0,preEnter:n,preExit:a,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,p]=(0,i.useState)((()=>Id(o?2:Td(s)))),m=(0,i.useRef)(u),h=(0,i.useRef)(),[f,g]=(e=>(0,Q.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),b=(0,i.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return Td(t)}})(m.current._s,c);e&&Rd(e,p,m,h,d)}),[d,c]),y=(0,i.useCallback)((e=>{const i=e=>{switch(Rd(e,p,m,h,d),e){case 1:f>=0&&(h.current=setTimeout(b,f));break;case 4:g>=0&&(h.current=setTimeout(b,g));break;case 0:case 3:h.current=setTimeout((()=>i(e+1)),0)}},l=m.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&i(t?n?0:1:2):l&&i(r?a?3:4:Td(c))}),[b,d,t,r,n,a,f,g,c]);return(0,i.useEffect)((()=>()=>clearTimeout(h.current)),[]),[u,y,b]})({timeout:n,preEnter:a,preExit:o,initialEntered:r});return g((()=>{c()}),[r]),l().createElement(l().Fragment,null,l().Children.map(e.children,(e=>l().isValidElement(e)?wc(e,{className:ve()(e.props.className,t,s.status)}):e)))},Od={previewWidth:1100,defaultDistance:.45,logoHeight:60},kd=(0,i.createContext)(void 0);var Ad=null;function Ld(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function Fd(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(Ld()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void P.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:Ad?r=Ad:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),Ad=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&Ld(),r}catch(e){P.message.error("getLodop 出错:"+e)}}Ld();const Hd=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},_d=l().forwardRef(((e,t)=>{const{templateRender:r,directPrint:n}=e,{global:a}=l().useContext(o),{$$preview:i}=l().useContext(kd),{state:s,isWindowsPrinter:c,pageSize:d}=i,u=l().useRef(null),p=l().useRef({}),m=l().useRef([]),h=l().useRef([]),f=l().useRef([]),[g,b]=l().useState(!0);l().useImperativeHandle(t,(()=>({createPreviewDom:O,createExportHtml:A,createPrintHtml:k,SHOW_PREVIEW:L,DIRECT_PRINT:F}))),_e((()=>{P()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),l().useEffect((()=>{p.current.templateEl=u.current.querySelector(".origin-template").children[0],p.current.previewEl=u.current.querySelector(".workspace")}),[]);const y=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Od.defaultDistance+10*Od.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),x=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Od.defaultDistance+10*Od.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),v=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Hd(y-10*(e.left-Od.defaultDistance)-10*(e.right-Od.defaultDistance))}),[s,y]),E=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Hd(x-10*(e.top-Od.defaultDistance)-10*(e.bottom-Od.defaultDistance))}),[s,x]),S=s.form.scale,w=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:Hd(10*e.left),right:Hd(10*e.right),top:Hd(10*e.top),bottom:Hd(10*e.bottom)}}),[s]),C=l().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:r,top:n,bottom:a}=w,i=v+t+r,l=Od.previewWidth-i<=0?0:(Od.previewWidth-i)/2,o=Math.abs((1-S)*i/2);let c=0;return S>1&&(c=o>l?-1*l:-1*o),S<1&&(c=i-2*o>Od.previewWidth?0:l>0?o:(Od.previewWidth-(i-2*o))/2),{width:`${v}px`,height:"stylus"===e?"auto":E+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${S})`,opacity:g?0:1}}),[s,g,w,S,E,v]),N=(m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=a?.print?.leftLogo??"",t=a?.print?.rightLogo??"";return[`<tr style="height: ${Od.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},T=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},R=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}h.current=r,m.current=t},P=()=>{if(!m.current.length)return;const{form:{setting:e,printerType:t}}=s;if(n)return f.current.push([I(),N(),...m.current]);const r=e.fixedLogo?E-Od.logoHeight:E;let a=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[N()]:[],...m.current]);else{let t=0;for(let n=0,i=h.current.length;n<i;n++){const l=m.current[n],o=h.current[n];e.fixedLogo||0!==n||(t+=Od.logoHeight),t+=o,t<=r?a.push(l):(f.current.push([I(),...e.fixedLogo?[N()]:[],...a]),a=[],t=0,n-=1),n===i-1&&a.length&&f.current.push([I(),...e.fixedLogo?[N()]:[],...a])}}e.fixedLogo||f.current[0]?.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');i.setState({currentPage:1,totalPage:f.current.length}),O()},O=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},A=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+I()+e.join("")+"</table>"},L=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return H();p.current.previewEl.innerHTML||(T(),await ne(0),R(),P(),b(!1))},F=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return H();T(),await ne(0),R(),P(),b(!1),i.doPrint(k()),await ne(0),i.doClose()},H=()=>{pe("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_=Ee("print-container"),D={[_]:!0,"no-visible":n};return l().createElement("div",{ref:u,className:ve()(D)},l().createElement(ut,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},l().createElement("div",{className:"preview"},l().createElement("div",{className:"origin-template",style:{width:`${v}px`,marginLeft:`-${Math.floor(v/2)}px`}},r?.()),l().createElement("div",{className:"workspace",style:C}))))}));_d.displayName="Container";const Dd=_d;function $d(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class qd extends i.Component{constructor(...e){super(...e),$d(this,"context",void 0),$d(this,"formRef",l().createRef()),$d(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:m("qm.print.setPanel.printParameter")},{type:"SELECT",label:m("qm.print.setPanel.pagerType"),fieldName:"pageSize",options:{itemList:[{text:"A2",value:"420*594"},{text:"A3",value:"420*297"},{text:"A4",value:"210*297"},{text:"A5",value:"210*148"},{text:m("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:m("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:m("qm.print.setPanel.vertical"),value:"vertical"},{text:m("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:m("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:m("qm.print.setPanel.manualDoublePrint"),value:"manual"}]},disabled:!this.props.setting.doubleSide},options:{trueValue:1,falseValue:0},onChange:e=>{const{formList:t}=this.state;t.find((e=>"doubleSide"===e.fieldName)).label.disabled=!e,this.setState({formList:t})}},{type:"CHECKBOX",label:m("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:m("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:m("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Od.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:m("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:m("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Od.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:m("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:m("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Od.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:m("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:m("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Od.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:m("qm.print.setPanel.noEmpty")}]}])),$d(this,"getInitialvalue",(()=>{const{setting:e}=this.props,{distance:t}=e;return Object.assign({},{disleft:t.left,disright:t.right,distop:t.top,disbottom:t.bottom,pageSize:e.pageSize,direction:e.direction,doubleSide:e.doubleSide,doubleSideType:e.doubleSideType,fixedLogo:e.fixedLogo})})),$d(this,"getInitialExtra",(()=>({disleft:m("qm.print.setPanel.sizeUnit"),disright:m("qm.print.setPanel.sizeUnit"),distop:m("qm.print.setPanel.sizeUnit"),disbottom:m("qm.print.setPanel.sizeUnit")}))),$d(this,"state",{formList:this.createFormList()}),$d(this,"confirmHandle",(async()=>{const[e,t]=await this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),$d(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return l().createElement(l().Fragment,null,l().createElement(Ml,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},m("qm.dialog.close")),l().createElement(fe,{type:"primary",onClick:()=>this.confirmHandle()},m("qm.dialog.confirm"))))}}$d(qd,"contextType",o);const Md=qd;function Kd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Vd extends i.Component{constructor(...e){super(...e),Kd(this,"context",void 0),Kd(this,"provide",{$$preview:this}),Kd(this,"containRef",l().createRef()),Kd(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Od.defaultDistance,right:Od.defaultDistance,top:Od.defaultDistance,bottom:Od.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Kd(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Kd(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Kd(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await _s().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Kd(this,"doClose",(()=>{this.props.onClose?.()})),Kd(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Kd(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Kd(this,"createStyle",(()=>'\n <style type="text/css">\n table {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n table-layout: fixed;\n }\n table tr td {\n padding: 2px;\n line-height: 1.2;\n word-wrap: break-word;\n }\n .fs12 {\n font-size: 12px;\n }\n .fs13 {\n font-size: 13px;\n }\n .fs14 {\n font-size: 14px;\n }\n .fw500 {\n font-weight: 500;\n }\n .fw700 {\n font-weight: 700;\n }\n .fl {\n float: left;\n }\n .fr {\n float: right;\n }\n .tc {\n text-align: center;\n }\n .tr {\n text-align: right;\n }\n .bor {\n border: 1px solid #000;\n }\n .bor-t {\n border-top: 1px solid #000;\n }\n .bor-b {\n border-bottom: 1px solid #000;\n }\n .bor-l {\n border-left: 1px solid #000;\n }\n .bor-r {\n border-right: 1px solid #000;\n }\n .no-bor {\n border: none !important;\n }\n </style>\n ')),Kd(this,"doPrint",(e=>{const t=Fd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Od,{left:d,right:u,top:p,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():P.message.error(m("qm.print.printError"))},t.PRINT()})),Kd(this,"doExport",(e=>{const t=Fd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():P.message.error(m("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===a.direction?1:2),t.SAVE_TO_FILE(`${c()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:m("qm.print.laserPrinter"),value:"laser"},{text:m("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Fd(),t=[{text:m("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){pe("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await _s().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,Q.isPlainObject)(e)&&await _s().setItem(this.printerKey,e)),(0,Q.isPlainObject)(e)&&Object.keys(e).length&&(0,Q.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:r,form:n,currentPage:a,totalPage:i,printPage:o}=this.state,s=Ee("print-preview"),c={visible:r,title:m("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?l().createElement(l().Fragment,null,l().createElement("div",{className:ve()(d)},l().createElement("div",{className:"outer"},l().createElement("div",{className:"header"},l().createElement("span",null,m("qm.print.printer"),":",l().createElement(P.Select,{value:n.printerName,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>l().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,m("qm.print.type"),":",l().createElement(P.Select,{value:n.printerType,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>l().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,m("qm.print.copies"),":",l().createElement(P.InputNumber,{value:n.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),l().createElement("span",null,m("qm.print.printPage.0"),l().createElement(P.InputNumber,{value:o,min:1,max:i,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),m("qm.print.printPage.1")),l().createElement("span",null,l().createElement(P.Pagination,{size:"small",current:a,pageSize:1,total:i,onChange:this.pageChangeHandle})),l().createElement("span",null,l().createElement(fe,{type:"text",icon:l().createElement(Se.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},m("qm.print.setting"))),l().createElement("span",null,l().createElement(fe,{type:"text",icon:l().createElement(Se.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},m("qm.print.export"))),l().createElement("span",null,l().createElement(fe,{icon:l().createElement(Se.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},m("qm.print.print")))),l().createElement("div",{className:"main"},l().createElement(kd.Provider,{value:this.provide},l().createElement(Dd,{ref:this.containRef,templateRender:t,directPrint:!1}))),l().createElement("div",{className:"footer"},l().createElement("span",null,m("qm.print.scale"),":",l().createElement(P.Slider,{value:n.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{scale:e}})))}}),l().createElement("em",{className:"scale-text"},`${Math.floor(100*n.scale)}%`)),l().createElement("span",null,m("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),l().createElement("span",null,m("qm.print.pageNumber"),":",m("qm.print.pagination",{currentPage:a,totalPage:i}))))),l().createElement(cr,c,l().createElement(Md,{setting:n.setting,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):l().createElement(kd.Provider,{value:this.provide},l().createElement(Dd,{ref:this.containRef,templateRender:t,directPrint:!0}))}}Kd(Vd,"contextType",o);const jd=Vd;function zd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bd extends i.Component{constructor(...e){super(...e),zd(this,"context",void 0),zd(this,"previewRef",l().createRef()),zd(this,"state",{visible:!1,loading:!1}),zd(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),zd(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i}=this.props,o={visible:e,title:m("qm.print.preview"),width:`${Od.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?l().createElement(cr,o,l().createElement(jd,s)):e?l().createElement(jd,s):null})),zd(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ne(0),this.setState({visible:!0}),await ne(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:r,type:n,disabled:a,shape:i}=this.props,o={size:t||this.context.size||"",type:n,shape:i,icon:r,loading:e,disabled:a,click:this.clickHandle};return l().createElement(l().Fragment,null,this.props.children&&l().createElement(fe,o,this.props.children),this.createRender())}}zd(Bd,"propTypes",{size:(e,t,r)=>{if(!un(e[t]||""))return ue("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:dn().elementType}),zd(Bd,"defaultProps",{preview:!0,type:"primary",icon:l().createElement(Se.PrinterOutlined,null)}),zd(Bd,"contextType",o);const Wd=Bd;function Ud(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Gd(e){const t=Ud(e);return t?t.frameElement:null}function Yd(e){const t=Zd(e);return Xd([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Xd(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function Qd(e,t){const r=Gd(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=Yd(a);if(n.push(e),a=Gd(a),i)break;a&&Ud(a)===t&&(i=!0)}return Xd(n)}return e.getBoundingClientRect()}function Zd(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function Jd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const eu=Object.assign;class tu{constructor(e,t){Jd(this,"node",void 0),Jd(this,"border",void 0),Jd(this,"padding",void 0),Jd(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=iu.border,this.padding.style.borderColor=iu.padding,this.content.style.backgroundColor=iu.background,eu(this.node.style,{borderColor:iu.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){au(t,"margin",this.node),au(t,"border",this.border),au(t,"padding",this.padding),eu(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),eu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class ru{constructor(e,t){Jd(this,"tip",void 0),Jd(this,"nameSpan",void 0),Jd(this,"dimSpan",void 0),this.tip=e.createElement("div"),eu(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),eu(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),eu(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:r.width,height:r.height});eu(this.tip.style,n.style)}}class nu{constructor(){Jd(this,"window",void 0),Jd(this,"tipBoundsWindow",void 0),Jd(this,"container",void 0),Jd(this,"tip",void 0),Jd(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new ru(r,this.container),this.rects=[],r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new tu(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=Qd(e,this.window),a=Zd(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=Qd(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function au(e,t,r){eu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const iu={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let lu=null,ou=null;function su(){null!=window.document&&(lu=null,null!==ou&&(ou.remove(),ou=null))}function cu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class du{constructor(e){cu(this,"_isRunning",void 0),cu(this,"_selectIgnore",void 0),cu(this,"_lastHoveredNode",null),cu(this,"excludeSelectors",void 0),cu(this,"onSelect",void 0),cu(this,"iframesListeningTo",new Set),cu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),cu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),cu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),cu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>We(t,window.document.querySelector(e)))))return this._selectIgnore=!0,su();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var r;r=[t],null,!1,null!=window.document?(null!==lu&&clearTimeout(lu),null!=r&&(null===ou&&(ou=new nu),ou.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),cu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),cu(this,"selectFiberForNode",(0,Q.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else r.getAttribute("name")?e+=`[name=${r.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.join(" > ")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){su(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function uu(e){return document.querySelector(e)}const pu=e=>{const{action:t,onConfirm:r,onCancel:n,onFinish:a}=e,{t:i}=G();return l().createElement(l().Fragment,null,l().createElement("div",{style:{height:100}},i("qm.table.config.emptyText")),l().createElement(ye,{style:{width:"100%",justifyContent:"flex-end"}},l().createElement(fe,{size:"small",onClick:()=>n?.()},i("qm.guideTracker.closeButton")),l().createElement(fe,{size:"small",onClick:()=>r?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),l().createElement(fe,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},mu={left:"50%",top:"50%",width:1,height:1},hu=l().forwardRef(((e,t)=>{const{open:r,current:n,defaultCurrent:a,steps:i=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:m,helper:h={},selectFilter:f=(e=>e),onSelect:g,onChange:b,onClose:y,onFinish:x}=e,{t:v}=G(),E=l().useRef(),S=l().useRef(i.length),[w,C]=Wo(0,{value:n,defaultValue:a}),[N,I]=Wo(void 0,{value:r,postState:e=>e??!1}),[T,R]=Wo(1051,{value:m,defaultValue:m}),[O,k]=l().useState({}),[A,L]=l().useState(!1),[F,H]=l().useState(N),[_,D]=l().useState(!1),[$,q]=ld(O.node,!!r),[M,K]=l().useState(22),V=l().useRef(!1),j=l().useMemo((()=>w>=i.length?"add":"edit"),[w,i]),z=l().useMemo((()=>`${w+1} / ${i.length}`),[w,i]);l().useLayoutEffect((()=>{E.current=new du({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),k({id:Qr(),node:e,path:t}),C(S.current),L(!0),W(),g?.(t,e)}})}),[]),l().useEffect((()=>(N?B():W(),N?setTimeout((()=>H(!0)),16):H(!1),()=>{W()})),[N]),l().useEffect((()=>{S.current=i.length}),[i]);const B=()=>{E.current.startHandle()},W=()=>{E.current.stopHandle()},U=e=>{e.stopPropagation(),e.preventDefault()};l().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:w,selector:O.path})})));const Y=Ee("guide-tracker"),X=[{[`${Y}-primary`]:!0}],Z=dd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(pd(),{open:N&&A,autoLock:!0},l().createElement(hd(),{zIndex:T,builtinPlacements:Z,popupPlacement:o,popupVisible:N&&A,popupClassName:ve()(X,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{L(!1),B()};return l().createElement("div",{className:`${Y}-content`},l().createElement("div",{className:`${Y}-inner`},l().createElement(Se.CloseOutlined,{className:`${Y}-close`,onClick:()=>{y?.(w),e()}}),l().createElement(P.Dropdown,{open:_,trigger:["click"],dropdownRender:()=>i.length?l().createElement("div",{className:"ant-dropdown-menu step-list"},l().createElement(oa.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),r=i.map((e=>e.id));if((0,Q.isEqual)(t,r))return;const n=t.findIndex((e=>e===O.id)),a=-1!==n?n:w;C(a),b?.(sn(e),a)}},i.map(((e,t)=>l().createElement("li",{key:t,className:ve()("item",{actived:e.id===O.id})},l().createElement(Se.HolderOutlined,{className:"handle",title:v("qm.form.draggable")}),l().createElement("span",{className:"box"},l().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==w&&(k({id:e.id,node:uu(e.selector),path:e.selector}),C(t),K(22===M?M+1:M-1),b?.(i,t))}},e.title),l().createElement(P.Popconfirm,{title:v("qm.button.confirmTitle"),zIndex:T+1,onConfirm:()=>{const r=i.filter((t=>t.id!==e.id)),n=t===w;let a=t<=w?w-1:w;if(a=a<0?0:a,a=a>r.length?r.length:a,n&&r[a]){const{id:e,selector:t}=r[a];k({id:e,node:uu(t),path:t})}C(a),b?.(r,a)}},l().createElement(Se.CloseOutlined,{className:"close-icon"})))))))):l().createElement(l().Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:T},onOpenChange:e=>D(e)},l().createElement(Se.MenuOutlined,{className:ve()(`${Y}-close`,"menu-icon"),style:{width:M}})),h.content&&l().createElement(P.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:T},content:h.content,title:h.title},l().createElement(Se.QuestionCircleOutlined,{className:ve()(`${Y}-close`,"help-icon")})),l().createElement("div",{className:"panel-label"},l().createElement("span",{className:"title"},v("qm.guideTracker.label")),l().createElement("span",{className:"step"},v("qm.guideTracker.currentStep"),z)),p?p({id:O.id,selector:O.path,actionStatus:j,DO_CLOSE:e},w):l().createElement(pu,{action:j,onConfirm:()=>{b?.("add"===j?[...i,{id:O.id,selector:O.path,title:"Guide Title"}]:[...i],w),e()},onCancel:()=>{y?.(w),e()},onFinish:()=>{e(),y?.(w),x?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},l().createElement("div",{className:ve()(`${Y}-target-placeholder`),style:{...$||mu,position:"fixed",zIndex:T-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:U,onClick:U}))),s&&l().createElement(pd(),{open:F},l().createElement(yd,{zIndex:T,prefixCls:Y,onPause:()=>{V.current=A,L(!1),W()},onPlay:()=>{V.current?L(!0):B()}})))}));hu.displayName="QmGuideTracker";const fu=hu,gu=e=>{const{content:t,image:r,width:n,height:a,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:p=1,antiTamper:m=!0,grayscale:h,className:f,style:g}=e,b=l().useRef(null),y=l().useRef(new Map),x=o.fontSize??16,v=o.fontWeight??"normal",E=o.fontStyle??"normal",S=o.fontFamily??"sans-serif",w=o.color??"rgba(0, 0, 0, 0.15)",C=o.textAlign??"center",N=Array.isArray(t)?t:[t],I=s[0],T=s[1],R=I/2,P=T/2,O=c[0]??R,k=c[1]??P,A=l().useMemo((()=>{const e=O-R,t=k-P;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,P,O,k,u]),L=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const i=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[l,o]=(e=>{let t=120,i=64;if(!r&&e.measureText){e.font=`${x}px ${S}`;const r=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),i=x*N.length+3*(N.length-1)}return[n??t,a??i]})(t),s=l*i,c=o*i,u=(I+l)*i,m=(T+o)*i,f=I/2*i,g=T/2*i,R=u/2,P=m/2,O=2*(I+l);e.width=2*u,e.height=2*m,t.globalAlpha=p,t.save(),t.translate(R,P),t.rotate(Math.PI/180*d),t.translate(-R,-P);const k=()=>{t.restore(),t.drawImage(e,0,0,u,m,u,m,u,m),h&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${r=e,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var r})).join(";"))({...A,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),O)},L=()=>{const e=Number(x)*i;t.font=`${E} normal ${v} ${e}px/${o}px ${S}`,t.fillStyle=w,t.textAlign=C,t.textBaseline="top",t.translate(s/2,0),N.forEach(((r,n)=>{t.fillText(r??"",f,g+n*(e+3*i))})),k()};if(r){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),k()},e.onerror=()=>{L()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=r}else L()},F=e=>Array.from(y.current.values()).includes(e);l().useEffect((()=>{L()}),[t,r,n,a,o,s,c,d,u,p,m,h]),function(e,t,r={}){const n=window&&"MutationObserver"in window,a=i.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(l(),n&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,r)),()=>l())),[e])}(b,(e=>{if(m)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),r="attributes"===t.type&&F(t.target);if(e||r){L();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const H=Ee("watermark");return l().createElement("div",{ref:b,className:ve()(H,f),style:{position:"relative",...g}},e.children)},bu=new Map,yu=new WeakMap;let xu=0;function vu(e,t,r={},n=undefined){if(void 0===window.IntersectionObserver&&void 0!==n){const a=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:l}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(yu.has(r)||(xu+=1,yu.set(r,xu.toString())),yu.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=bu.get(t);if(!r){const n=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},bu.set(t,r)}return r}(r),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),i.unobserve(e)),0===l.size&&(i.disconnect(),bu.delete(a))}}const Eu=e=>{const{forceRender:t,height:r,placeholder:n=null,unmountIfInvisible:a,className:i,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:t,threshold:r,triggerOnce:n,fallbackInView:a,trackVisibility:i,skip:o,delay:s,onChange:c}={})=>{const[d,u]=l().useState(null),[p,m]=l().useState({inView:!1,entry:void 0}),h=l().useRef(c);l().useEffect((()=>{if(o||!d)return;let l;return l=vu(d,((e,t)=>{m({inView:e,entry:t}),h.current?.(e,t),t.isIntersecting&&n&&l&&(l(),l=void 0)}),{root:e,rootMargin:t,threshold:r,trackVisibility:i,delay:s},a),()=>{l&&l()}}),[Array.isArray(r)?r.toString():r,d,e,t,n,o,i,a,s]);const f=p.entry?.target,g=l().useRef();d||!f||n||o||g.current===f||(g.current=f,m({inView:!1,entry:void 0}));const b=[u,p.inView,p.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b})(Object.assign({},e,{triggerOnce:!a}));l().useEffect((()=>{r||pe("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=Ee("lazy-load"),p={[u]:!0};return l().createElement("div",{ref:s,className:ve()(p,i),style:o},t||c?e.children:l().createElement("div",{className:"placeholder",style:{height:r}},n))},Su=require("html2canvas");var wu=n.n(Su);function Cu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nu{constructor(e,t,r,n){if(Cu(this,"x",void 0),Cu(this,"y",void 0),Cu(this,"pressure",void 0),Cu(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=r||0,this.time=n||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class Iu{static fromPoints(e,t){const r=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Iu(e[1],r,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,r){const n=e.x-t.x,a=e.y-t.y,i=t.x-r.x,l=t.y-r.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+r.x)/2,d=(t.y+r.y)/2,u=Math.sqrt(n*n+a*a),p=Math.sqrt(i*i+l*l),m=p/(u+p),h=c+(o-c)*m,f=d+(s-d)*m,g=t.x-h,b=t.y-f;return{c1:new Nu(o+g,s+b),c2:new Nu(c+g,d+b)}}constructor(e,t,r,n,a,i){this.startPoint=e,this.control2=t,this.control1=r,this.endPoint=n,this.startWidth=a,this.endWidth=i}length(){let e,t,r=0;for(let n=0;n<=10;n+=1){const a=n/10,i=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(n>0){const n=i-e,a=l-t;r+=Math.sqrt(n*n+a*a)}e=i,t=l}return r}point(e,t,r,n,a){return t*(1-e)*(1-e)*(1-e)+3*r*(1-e)*(1-e)*e+3*n*(1-e)*e*e+a*e*e*e}}function Tu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ru{constructor(e,t){Tu(this,"canvas",void 0),Tu(this,"ctx",void 0),Tu(this,"textInput",void 0),Tu(this,"width",320),Tu(this,"height",200),Tu(this,"ratio",Math.max(window.devicePixelRatio||1,1)),Tu(this,"penColor","rgba(0,0,0,1)"),Tu(this,"backgroundColor","rgba(0,0,0,0)"),Tu(this,"canAddHistory",!1),Tu(this,"mode",void 0),Tu(this,"openSmooth",!0),Tu(this,"dotSize",0),Tu(this,"throttle",16),Tu(this,"minDistance",5),Tu(this,"velocityFilterWeight",.7),Tu(this,"compositeOperation","source-over"),Tu(this,"minWidth",.5),Tu(this,"maxWidth",2.5),Tu(this,"fontSize",16),Tu(this,"eraserSize",20),Tu(this,"lineHeight",1.25),Tu(this,"degreeOfBlur",5),Tu(this,"textInputPos",{x:0,y:0}),Tu(this,"onStart",(()=>{})),Tu(this,"onEnd",(()=>{})),Tu(this,"_drawingStroke",!1),Tu(this,"_lastPoints",[]),Tu(this,"_data",[]),Tu(this,"_historyList",[]),Tu(this,"_lastVelocity",0),Tu(this,"_lastWidth",0),Tu(this,"_strokeMoveUpdate",void 0),Tu(this,"setCanvasSize",(()=>{this.canvas.style.height=`${this.height}px`,this.canvas.style.width=`${this.width}px`,this.canvas.height=this.height*this.ratio,this.canvas.width=this.width*this.ratio,1!==this.ratio&&this.ctx.scale(this.ratio,this.ratio)})),Tu(this,"setTextInput",(()=>{this.openSmooth||(this.textInput.setAttribute("class","signature__text-input"),this.textInput.setAttribute("contentEditable","true"),this.textInput.setAttribute("spellCheck","false"),this.canvas.parentNode.appendChild(this.textInput))})),Tu(this,"isTouchEvent",(e=>"touches"in e)),Tu(this,"addListener",(()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",("ontouchstart"in window||navigator.maxTouchPoints)&&(this.canvas.addEventListener("touchstart",this.onDrawStart,{passive:!1}),this.canvas.addEventListener("touchmove",this.onDrawMove,{passive:!1}),document.addEventListener("touchcancel",this.onDrawEnd,{passive:!1}),document.addEventListener("touchend",this.onDrawEnd,{passive:!1})),this.canvas.addEventListener("mousedown",this.onDrawStart),this.canvas.addEventListener("mousemove",this.onDrawMove),document.addEventListener("mouseup",this.onDrawEnd),this.textInput.addEventListener("blur",this.onInputBlur)})),Tu(this,"removeListener",(()=>{this.canvas.style.touchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("touchstart",this.onDrawStart),this.canvas.removeEventListener("touchmove",this.onDrawMove),document.removeEventListener("touchend",this.onDrawEnd),document.removeEventListener("touchcancel",this.onDrawEnd),this.canvas.removeEventListener("mousedown",this.onDrawStart),this.canvas.removeEventListener("mousemove",this.onDrawMove),document.removeEventListener("mouseup",this.onDrawEnd),this.textInput.removeEventListener("blur",this.onInputBlur)})),Tu(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),Tu(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:this.isTouchEvent(e)?e.touches[0]?.clientX:e.clientX,y:this.isTouchEvent(e)?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),Tu(this,"_getPointGroupOptions",(e=>({penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}))),Tu(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),r={...t,points:[]};this._data.push(r),this._reset(t),this._strokeUpdate(e,!1)})),Tu(this,"_strokeUpdate",((e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const r=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],a=n.points,i=a.length>0&&a[a.length-1],l=!!i&&r.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(n);if(!i||!i||!l){const e=this._addPoint(r,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(r,o)),a.push({time:r.time,x:r.x,y:r.y,pressure:r.pressure})}})),Tu(this,"_strokeEnd",((e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)})),Tu(this,"_reset",(e=>{this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this.ctx.fillStyle=e.penColor,this.ctx.globalCompositeOperation=e.compositeOperation})),Tu(this,"_drawDot",((e,t)=>{const r=this.ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;r.beginPath(),this._drawCurveSegment(e.x,e.y,n),r.closePath(),r.fillStyle=t.penColor,r.fill()})),Tu(this,"_drawCurve",((e,t)=>{const r=this.ctx,n=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());r.beginPath(),r.fillStyle=t.penColor;for(let r=0;r<a;r+=1){const i=r/a,l=i*i,o=l*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*l*e.control2.x,u+=o*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*i*e.control1.y,p+=3*s*l*e.control2.y,p+=o*e.endPoint.y;const m=Math.min(e.startWidth+o*n,t.maxWidth);this._drawCurveSegment(u,p,m)}r.closePath(),r.fill()})),Tu(this,"_drawCurveSegment",((e,t,r)=>{const n=this.ctx;n.moveTo(e,t),n.arc(e,t,r,0,2*Math.PI,!1)})),Tu(this,"_createPoint",((e,t,r)=>{const n=this.canvas.getBoundingClientRect();return new Nu(e-n.left,t-n.top,r,(new Date).getTime())})),Tu(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),Tu(this,"_addPoint",((e,t)=>{const{_lastPoints:r}=this;if(r.push(e),r.length>2){3===r.length&&r.unshift(r[0]);const e=this._calculateCurveWidths(r[1],r[2],t),n=Iu.fromPoints(r,e);return r.shift(),n}return null})),Tu(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),Tu(this,"_calculateCurveWidths",((e,t,r)=>{const n=r.velocityFilterWeight*t.velocityFrom(e)+(1-r.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(n,r),i={end:a,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=a,i})),Tu(this,"onDrawStart",(e=>{e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),this.onStart?.(e))})),Tu(this,"onDrawMove",(e=>{e.preventDefault(),"text"!==this.mode&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?window.requestAnimationFrame?window.requestAnimationFrame((()=>this.drawHandler(e))):this.drawHandler(e):this._strokeEnd(this._pointerEventToSignatureEvent(e)))})),Tu(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),Tu(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),Tu(this,"drawHandler",(e=>{switch(this.mode){case"line":this.drawLine(e);break;case"square":this.drawSquare(e);break;case"round":this.drawRound(e);break;case"arrow":this.drawArrow(e);break;case"mosaic":this.drawMosaic(e);break;case"text":this.drawText(e);break;case"eraser":this.drawEraser(e)}this.canAddHistory=!0})),Tu(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,r,n-t,a-r),this.ctx.stroke(),this.ctx.restore()})),Tu(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(n,t),l=Math.min(a,r),o=.5*(Math.max(n,t)-i),s=.5*(Math.max(a,r)-l),c=i+o,d=l+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),Tu(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(r-a,t-n)/Math.PI,l=(i+25)*Math.PI/180,o=(i-25)*Math.PI/180,s=15*Math.cos(l),c=15*Math.sin(l),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,r),this.ctx.lineTo(n,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n,a);const p=n+s,m=a+c;this.ctx.lineTo(p,m);const h=n+d,f=a+u;this.ctx.lineTo(h,f),this.ctx.lineTo(n,a),this.ctx.fill(),this.ctx.restore()})),Tu(this,"getAxisColor",((e,t,r)=>{const n=e.width,a=e.data,i=[];return i[0]=a[4*(r*n+t)],i[1]=a[4*(r*n+t)+1],i[2]=a[4*(r*n+t)+2],i[3]=a[4*(r*n+t)+3],i})),Tu(this,"setAxisColor",((e,t,r,n)=>{const a=e.width,i=e.data;i[4*(r*a+t)]=n[0],i[4*(r*a+t)+1]=n[1],i[4*(r*a+t)+2]=n[2],i[4*(r*a+t)+3]=n[3]})),Tu(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),n=this.ctx.getImageData(t*this.ratio,r*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=n.width,i=n.height,l=a/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const r=this.getAxisColor(n,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let a=0;a<this.degreeOfBlur;a++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(n,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,r)}this.ctx.putImageData(n,t*this.ratio,r*this.ratio)})),Tu(this,"drawText",(e=>{const{x:t,y:r}=this.textInputPos;if(0===t&&0===r)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const n=this.fontSize*this.lineHeight,a=this.width-t,i=e.target.innerText,l=[];let o="";for(let e=0;e<i.length;e++){const t=o+i[e];this.ctx.measureText(t).width>a&&o.length>0?(l.push(o),o=i[e]):o=t}l.push(o),l.forEach(((e,a)=>{this.ctx.fillText(e,t+1,r+a*n+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),Tu(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),Tu(this,"drawPencil",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.restore()})),Tu(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),Tu(this,"drawEraser",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),Tu(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),Tu(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=r?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),Tu(this,"setInputStyle",(()=>{if(!this._lastPoints.length)return;const{x:e,y:t}=this._lastPoints[0];this.textInput.style.left=e+"px",this.textInput.style.lineHeight=this.lineHeight.toString(),this.textInput.style.fontSize=this.fontSize+"px",this.textInput.style.color=this.penColor,this.textInput.style.top=t-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:e,y:t}})),Tu(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),Tu(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),Tu(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),Tu(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),Tu(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),Tu(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),Tu(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),Tu(this,"setDrawMode",(e=>{this.mode=e})),Tu(this,"setLineWidth",(e=>{this.maxWidth=e})),Tu(this,"setPenColor",(e=>{this.penColor=e})),Tu(this,"setFontSize",(e=>{this.fontSize=e})),Tu(this,"isEmpty",(()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,this.backgroundColor?(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)):1!==this.ratio&&t.scale(this.ratio,this.ratio),e.toDataURL()===this.canvas.toDataURL()})),Tu(this,"toDataURL",((e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const r=document.createElement("canvas");return r.width=this.width,r.height=this.height,r.getContext("2d").drawImage(this.canvas,0,0,r.width,r.height),r.toDataURL(e,t)})),Tu(this,"getPNG",(()=>this.toDataURL())),Tu(this,"getJPG",((e=.8)=>this.toDataURL("image/jpeg",e))),this.initial(e,t)}initial(e,t={}){e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.backgroundColor=t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this._strokeMoveUpdate=this.throttle?function(e,t=250){let r,n,a,i=0,l=null;const o=()=>{i=Date.now(),l=null,r=e.apply(n,a),l||(n=null,a=[])};return function(...s){const c=Date.now(),d=t-(c-i);return n=this,a=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),i=c,r=e.apply(n,a),l||(n=null,a=[])):l||(l=window.setTimeout(o,d)),r}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}Tu(Ru,"dataURLToBlob",(e=>{const t=e.split(";base64,"),r=t[0].split(":")[1],n=window.atob(t[1]),a=n.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=n.charCodeAt(e);return new Blob([i],{type:r})})),Tu(Ru,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),Tu(Ru,"canvasToBlob",(e=>new Promise(((t,r)=>{e.toBlob((e=>e?t(e):r(null)),"image/png",1)}))));const Pu=Ru,Ou=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})),ku=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M839.111111 269.198222V122.908444A9.159111 9.159111 0 0 0 829.980444 113.777778H208.213333A9.159111 9.159111 0 0 0 199.111111 122.908444v146.289778c0 5.034667 4.124444 9.159111 9.130667 9.159111h64a9.159111 9.159111 0 0 0 9.159111-9.159111V196.067556h192v640h-105.159111a9.159111 9.159111 0 0 0-9.130667 9.130666v64c0 5.034667 4.124444 9.159111 9.130667 9.159111h301.738666a9.159111 9.159111 0 0 0 9.130667-9.159111v-64a9.159111 9.159111 0 0 0-9.130667-9.130666h-105.159111v-640h192v73.130666c0 5.034667 4.124444 9.159111 9.159111 9.159111h64a9.159111 9.159111 0 0 0 9.130667-9.159111z"})),Au=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M887.65217391 606.59279489a31.26857185 31.26857185 0 0 1-31.26857185-31.26857087v-363.48819946L158.38608696 909.83354065a31.26857185 31.26857185 0 1 1-44.21962762-44.21962761l697.99751609-698.06906805h-363.48819945a31.26857185 31.26857185 0 0 1 0-62.46559075h439.04795087c17.17267109 0 31.26857185 13.95279489 31.26857086 31.19701891v439.04795087a31.26857185 31.26857185 0 0 1-31.3401238 31.26857087z"})),Lu=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M606.4 103.424a64 64 0 0 1 0.704 0.64l320.256 280.32a64 64 0 0 1 7.104 89.024l-330.432 398.72 320.448 0.128a32 32 0 0 1 0 64.064H397.632a32.128 32.128 0 0 1-6.208-0.64h-20.736a64 64 0 0 1-42.304-16.064l-238.08-210.112A64 64 0 0 1 83.84 620.16l432.32-509.312a64 64 0 0 1 90.24-7.36zM242.048 537.536l-87.04 101.76a32 32 0 0 0 3.584 45.248l213.12 180.672a32 32 0 0 0 20.736 7.616l-0.64-0.064a32.192 32.192 0 0 1 5.76-0.512h102.016a32 32 0 0 0 18.176-10.496l40.96-47.232-316.672-276.992zM592.96 177.28a32 32 0 0 0-45.12 3.456L283.712 488.96l316.928 277.248 264.512-304.96a32 32 0 0 0 1.024-40.704l-3.904-4.16-268.928-238.72a32 32 0 0 0-0.384-0.32z"})),Fu=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M607.75537778 291.05948444H223.6416l115.34336-115.41617778a36.37248 36.37248 0 1 0-51.48216889-51.44576L132.61937778 279.04455111c-13.54410667 13.50769778-21.04433778 31.67573333-21.11715556 50.97244444a71.72551111 71.72551111 0 0 0 21.11715556 51.51857778l154.88341333 154.91982222a36.29966222 36.29966222 0 0 0 51.48216889 0 36.37248 36.37248 0 0 0 0-51.48216889l-121.46005333-121.16878222H607.75537778c130.70791111 0 237.02186667 106.16832 237.02186667 236.65777777s-106.31395555 236.65777778-237.02186667 236.65777778h-254.13404445a36.40888889 36.40888889 0 0 0 0 72.81777779h254.13404445c170.83050667 0 309.83964445-138.82709333 309.83964444-309.47555557 0-170.64846222-139.00913778-309.47555555-309.83964444-309.47555555"})),Hu=l().forwardRef(((e,t)=>{const{open:r,width:n,height:a,imageName:i,penColor:o,penMode:s,minWidth:d,maxWidth:u,backgroundColor:p,className:m,style:h,onOk:f,onCancel:g}=e,{t:b}=G(),y=l().useRef(),x=l().useRef(null),v=l().useRef(null),E=l().useRef(null),S=[2,4,6],w=[14,16,18,20,24,28],C=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,I]=Wo(void 0,{value:r,postState:e=>e??!1}),T=l().useMemo((()=>!!e.children),[e.children]),[R,O]=l().useState(s||(T?"square":"line")),[k,A]=l().useState(S[0]),[L,F]=l().useState(T?C[0]:C[4]),[H,_]=l().useState(w[1]),[D,$]=l().useState("bottomLeft"),[q,M]=l().useState(!1),[K,V]=l().useState(!1);l().useEffect((()=>{const e={width:n??v.current?.offsetWidth,height:a??v.current?.offsetHeight,maxWidth:k,mode:R,penColor:L,fontSize:H,backgroundColor:p,openSmooth:!T};return e.openSmooth&&Object.assign(e,{penColor:o,minWidth:d,maxWidth:u}),y.current=new Pu(x.current,e),()=>y.current.destroy()}),[]);const j=e=>{const[t,r]=[n??v.current?.offsetWidth,a??v.current?.offsetHeight],{width:i,height:l}=y.current;let o=!1;t&&t!==i&&(y.current.width=t,o=!0),r&&r!==l&&(y.current.height=r,o=!0),(o||e)&&y.current.update()};_e((()=>{T&&N&&j()}),[N,T]),_e((()=>{y.current.setDrawMode(R)}),[R]),_e((()=>{y.current.setLineWidth(k)}),[k]),_e((()=>{y.current.setPenColor(L)}),[L]),_e((()=>{y.current.setFontSize(H)}),[H]);const z=async()=>{const e=T?v.current.parentNode:x.current;if(e)try{const t=await wu()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Pu.canvasToDataURL(t)}catch(e){pe("Signature","生成合成图片失败!")}},B=()=>{y.current.clear(),g?.()};l().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),CLEAR:()=>y.current.clear(),UNDO:()=>y.current.undo(),IS_EMPTY:()=>y.current.isEmpty(),UPDATE:j,GET_DATE_URL:z})));const W=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},U=e=>l().createElement("div",{className:ve()("ant-dropdown-menu","content")},"text"!==e?l().createElement("div",{className:"lineWidth"},S.map((e=>l().createElement("span",{key:e,className:ve()("dot",`s${e}`,{active:e===k}),onClick:()=>A(e)})))):l().createElement("div",{className:"fontSize"},l().createElement(P.Select,{size:"small",value:H,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(e)})),l().createElement("span",{className:"divider"}),l().createElement("div",{className:"penColor"},C.map((e=>l().createElement("span",{key:e,className:ve()("dot",{active:e===L}),style:{backgroundColor:e},onClick:()=>F(e)},l().createElement(Se.CheckOutlined,{className:"icon"})))))),Y=Ee("signature"),X={[Y]:!0,"is-annotation":T},Q=n?{...h,width:n}:h;return l().createElement("div",{className:ve()(X,m),style:Q},T&&l().createElement(l().Fragment,null,l().createElement("div",{ref:v,className:"content"},e.children),K&&l().createElement(ut,{spinning:!0,className:"spinning"})),l().createElement("div",{className:ve()("signature",{show:N})},l().createElement("canvas",{ref:x,className:R}),T&&l().createElement("div",{ref:E,className:"signature__tool-bar"},l().createElement("div",{className:"wrapper"},l().createElement("div",{className:ve()("actions",{hidden:q})},l().createElement(P.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>O("square")},l().createElement(Se.BorderOutlined,null))),l().createElement(P.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>O("round")},l().createElement(Ou,null))),l().createElement(P.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>O("arrow")},l().createElement(Au,null))),l().createElement(P.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>O("line")},l().createElement(Se.EditOutlined,null))),l().createElement(P.Dropdown,{dropdownRender:()=>U("text"),overlayClassName:`${Y}__popper`,placement:D,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>O("text")},l().createElement(ku,null))),l().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{V(!0);const e=await z();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):c()().format(Fo);Pt(Pu.dataURLToBlob(e),`${t}.png`)}V(!1)})(),B()}},l().createElement(Se.DownloadOutlined,null)),l().createElement("button",{className:"btn",onClick:()=>O("eraser")},l().createElement(Lu,null)),l().createElement("button",{className:"btn",onClick:()=>y.current.undo()},l().createElement(Fu,null)),l().createElement("button",{className:"btn",onClick:()=>y.current.clear()},l().createElement(Se.ClearOutlined,null)),l().createElement("span",{className:"divider"}),l().createElement("button",{className:"btn",onClick:()=>g?.()},l().createElement(Se.CloseOutlined,null)),l().createElement("button",{className:"btn",onClick:async()=>{V(!0),await ne(10);const e=await z();V(!1),B(),f?.(e)}},l().createElement(Se.CheckOutlined,null))),l().createElement("button",{className:"btn btn-fold",title:b(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!q)},q?l().createElement(Se.LeftOutlined,null):l().createElement(Se.RightOutlined,null))))))}));Hu.displayName="QmSignature";const _u=Hu,Du="1.10.18";return a})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={442:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};n.r(a),n.d(a,{Affix:()=>O.Affix,Alert:()=>O.Alert,Anchor:()=>O.Anchor,AutoComplete:()=>O.AutoComplete,Avatar:()=>O.Avatar,BackTop:()=>O.BackTop,Badge:()=>O.Badge,Breadcrumb:()=>O.Breadcrumb,Button:()=>O.Button,Calendar:()=>L,Card:()=>O.Card,Carousel:()=>O.Carousel,Cascader:()=>O.Cascader,Checkbox:()=>O.Checkbox,Col:()=>O.Col,Collapse:()=>O.Collapse,Comment:()=>O.Comment,ConfigProvider:()=>O.ConfigProvider,DatePicker:()=>_,DcpAnchor:()=>Gt,DcpButton:()=>fe,DcpCollapse:()=>Fe,DcpConfigProvider:()=>U,DcpCopyToClipboard:()=>Dc,DcpCountup:()=>lt,DcpCropper:()=>co,DcpDivider:()=>Se,DcpDownload:()=>$t,DcpDrawer:()=>rr,DcpEmpty:()=>ct,DcpForm:()=>Ml,DcpGuideTracker:()=>Tu,DcpLazyLoad:()=>Au,DcpModal:()=>cr,DcpPivotGrid:()=>vm,DcpPrint:()=>nu,DcpRangeTableHelper:()=>fd,DcpScrollbar:()=>Tt,DcpSearchHelper:()=>rd,DcpSearchTree:()=>No,DcpSignature:()=>Uu,DcpSpace:()=>be,DcpSpin:()=>ut,DcpSplit:()=>tt,DcpTable:()=>Jc,DcpTabs:()=>Jt,DcpTinymce:()=>io,DcpTour:()=>_d,DcpTransition:()=>Md,DcpTreeHelper:()=>dd,DcpTreeTableHelper:()=>sd,DcpUploadFile:()=>uo,DcpUploadImg:()=>fo,DcpWatermark:()=>Iu,Descriptions:()=>O.Descriptions,Divider:()=>O.Divider,Drawer:()=>O.Drawer,Dropdown:()=>O.Dropdown,Empty:()=>O.Empty,Form:()=>O.Form,Grid:()=>O.Grid,Image:()=>O.Image,Input:()=>O.Input,InputNumber:()=>O.InputNumber,Layout:()=>O.Layout,List:()=>O.List,Mentions:()=>O.Mentions,Menu:()=>O.Menu,Modal:()=>O.Modal,PageHeader:()=>O.PageHeader,Pagination:()=>O.Pagination,Popconfirm:()=>O.Popconfirm,Popover:()=>O.Popover,Progress:()=>O.Progress,QmAnchor:()=>Gt,QmButton:()=>fe,QmCollapse:()=>Fe,QmConfigProvider:()=>U,QmCopyToClipboard:()=>Dc,QmCountup:()=>lt,QmCropper:()=>co,QmDivider:()=>Se,QmDownload:()=>$t,QmDrawer:()=>rr,QmEmpty:()=>ct,QmForm:()=>Ml,QmGuideTracker:()=>Tu,QmLazyLoad:()=>Au,QmModal:()=>cr,QmPivotGrid:()=>vm,QmPrint:()=>nu,QmRangeTableHelper:()=>fd,QmScrollbar:()=>Tt,QmSearchHelper:()=>rd,QmSearchTree:()=>No,QmSignature:()=>Uu,QmSpace:()=>be,QmSpin:()=>ut,QmSplit:()=>tt,QmTable:()=>Jc,QmTabs:()=>Jt,QmTinymce:()=>io,QmTour:()=>_d,QmTransition:()=>Md,QmTreeHelper:()=>dd,QmTreeTableHelper:()=>sd,QmUploadFile:()=>uo,QmUploadImg:()=>fo,QmWatermark:()=>Iu,Radio:()=>O.Radio,Rate:()=>O.Rate,Result:()=>O.Result,Row:()=>O.Row,Segmented:()=>O.Segmented,Select:()=>O.Select,Skeleton:()=>O.Skeleton,Slider:()=>O.Slider,Space:()=>O.Space,Spin:()=>O.Spin,Statistic:()=>O.Statistic,Steps:()=>O.Steps,Switch:()=>O.Switch,Table:()=>O.Table,Tabs:()=>O.Tabs,Tag:()=>O.Tag,TimePicker:()=>q,Timeline:()=>O.Timeline,Tooltip:()=>O.Tooltip,Transfer:()=>O.Transfer,Tree:()=>O.Tree,TreeSelect:()=>O.TreeSelect,Typography:()=>O.Typography,Upload:()=>O.Upload,message:()=>O.message,notification:()=>O.notification,pinyin:()=>Gn,version:()=>xm});var i=n(442),l=n.n(i);const o=(0,i.createContext)({locale:"zh-cn",size:"middle"}),s=require("dayjs");var c=n.n(s);const d={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}},pivotGrid:{text:"透视表",settingTitle:"透视表看板"}}};require("dayjs/locale/zh-cn");let u=d;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const p=(...e)=>{const[t,r]=e;let n;const a=t.split(".");let i=u;for(let e=0,t=a.length;e<t;e++){if(n=i[a[e]],e===t-1)return m(n,r);if(!n)return"";i=n}return""},h=(e,t)=>({...e,...Object.keys(t).reduce(((r,n)=>(r[n]=void 0!==t[n]?t[n]:e[n],r)),{})}),f=(e,t)=>{const r=i.useRef(!0);i.useLayoutEffect((()=>e(r.current)),t),i.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function g(e,t){f((t=>{if(!t)return e()}),t)}const y=require("dayjs/plugin/localeData");var b=n.n(y);const v=require("dayjs/plugin/advancedFormat");var x=n.n(v);const E=require("dayjs/plugin/customParseFormat");var C=n.n(E);const w=require("dayjs/plugin/quarterOfYear");var S=n.n(w);const N=require("dayjs/plugin/weekOfYear");var T=n.n(N);const I=require("dayjs/plugin/weekday");var R=n.n(I);c().extend(b()),c().extend(x()),c().extend(C()),c().extend(S()),c().extend(T()),c().extend(R());const O=require("antd"),P=require("rc-picker/es/generate/dayjs");var k=n.n(P);const A=require("antd/es/calendar/generateCalendar"),L=n.n(A)()(k()),F=require("antd/es/date-picker/generatePicker"),_=n.n(F)()(k());function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},D.apply(null,arguments)}const H=i.forwardRef(((e,t)=>i.createElement(_,D({},e,{picker:"time",mode:void 0,ref:t}))));H.displayName="TimePicker";const $=i.forwardRef(((e,t)=>i.createElement(_.RangePicker,D({},e,{picker:"time",mode:void 0,ref:t}))));$.displayName="RangePicker",H.RangePicker=$;const q=H,M={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel Merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}}},K=require("antd/es/locale/zh_CN");var V=n.n(K);const j=require("antd/es/locale/en_GB");var z=n.n(j);const B={[M.name]:{qm:M,antd:z()},[d.name]:{qm:d,antd:V()}},W=e=>{const t=h({locale:"zh-cn",size:"middle"},e),{locale:r,size:n,global:a}=t;l().useMemo((()=>{return e=Object.assign({},B,a?.langPackage)[r].qm,u=e||u,void(u.name&&c().locale(u.name));var e}),[r]);const i=l().useMemo((()=>Object.assign({},B,a?.langPackage)),[a]),[s,d]=l().useState({locale:r,size:n,global:a});return g((()=>{d((e=>Object.assign({},e,{locale:r,size:n})))}),[n,r]),l().createElement(o.Provider,{value:s},l().createElement(O.ConfigProvider,{locale:i[s.locale].antd,componentSize:s.size,autoInsertSpaceInButton:a?.autoInsertSpaceInButton},t.children))};W.displayName="QmConfigProvider";const U=W;function G(){const{locale:e}=i.useContext(o);return{t:p,$locale:e}}function Y(e){const t=i.useRef();return t.current=e,i.useCallback(((...e)=>t.current?.(...e)),[])}function X(e){const{size:t}=i.useContext(o);return{$size:i.useMemo((()=>e.size??t??""),[e.size,t])}}const Q=require("lodash-es"),Z="undefined"==typeof window,J=e=>l().isValidElement(e),ee=e=>J(e)&&e.type===l().Fragment,te=()=>{},re=()=>!0,ne=async e=>new Promise((t=>setTimeout(t,e))),ae=e=>{Promise.resolve().then(e)},ie=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),le=e=>!!(!e&&0!==e||(0,Q.isArray)(e)&&!e.length||(0,Q.isPlainObject)(e)&&!Object.keys(e).length),oe=(e,t)=>{const r={...e};for(const e of t)delete r[e];return r},se=(e,t=new WeakMap)=>{if((0,Q.isPlainObject)(e)||(0,Q.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(r,i){let l=-1;const o=r.length;for(;++l<o;)s=r[l],c=l,a&&(c=s),n[c]=se(e[c],t);var s,c}(a||e),n}return e},ce=e=>(0,Q.isNumber)(e)?`${e}px`:e.toString();class de extends Error{constructor(e){super(e),this.name="QmDesignError"}}function ue(e,t){throw new de(`[${e}] ${t}`)}function me(e,t){console.warn(new de(`[${e}] ${t}`))}function pe(){return pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pe.apply(null,arguments)}const he=e=>{const{loading:t,shortcutKey:r,authConfig:n,click:a,confirm:i}=e,{t:o}=G(),{$size:s}=X(e);l().useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=l().useState(!1),u=Y((e=>{const t=r.split("+").map((e=>e.trim().toLowerCase())),n=t.includes("alt"),a=t.includes("ctrl"),i=t.includes("shift"),l=t[t.length-1];n&&!e.altKey||a&&!e.ctrlKey||i&&!e.shiftKey||e.key.toLowerCase()!==l||(e.preventDefault(),p.disabled||p.onClick?.(e))})),m=(0,Q.isFunction)(a)?{onClick:async t=>{d(!0);try{await(e.click?.(t))}catch(e){me("Button","`click`方法执行出错")}d(!1)}}:null,p={...oe(e,["shortcutKey","authConfig","click","confirm"]),size:s,loading:c||t||!1,...m};if(n){const{visible:e=1,disabled:t}=n||{};if(!e)return null;t&&(p.disabled=!0)}const h=l().createElement(O.Button,p,e.children);return i?l().createElement(O.Popconfirm,{title:i.title||o("qm.button.confirmTitle"),disabled:p.disabled,onConfirm:e=>{i.onConfirm?.(),p.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},l().createElement(O.Button,pe({},p,{onClick:te}),e.children)):!r||p.disabled?h:l().createElement(O.Tooltip,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},h)};he.displayName="QmButton";const fe=he;var ge=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ge||{});const ye=e=>{const{$size:t}=X(e),r=(0,Q.isNumber)(e.size)?e.size:ge[t||"default"],n={...oe(e,["size"]),size:r};return l().createElement(O.Space,n,e.children)};ye.displayName="QmSpace";const be=ye,ve=require("classnames");var xe=n.n(ve);const Ee=e=>`qm-${e}`,Ce=require("@ant-design/icons"),we=e=>{const{label:t,extra:r,collapse:n,bordered:a=!0,disabled:i,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=X(e),{t:m}=G(),p=Ee("divider"),h={[p]:!0,[`${p}-borderless`]:!a,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return l().createElement("div",{id:o,className:xe()(h,s),style:c},l().createElement("span",{className:`${p}__title`},t),l().createElement("div",{className:`${p}__extra`},r),void 0!==n&&l().createElement(O.Button,{type:"link",className:`${p}__collapse`,disabled:i,onClick:()=>{d?.(!n)}},m(n?"qm.divider.collect":"qm.divider.spread"),n?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)))};we.displayName="QmDivider";const Se=we,Ne=()=>({height:0,opacity:0}),Te=(e,t)=>"height"===t.propertyName,Ie={motionName:"rc-collapse-motion",onEnterStart:Ne,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:Ne,onEnterEnd:Te,onLeaveEnd:Te,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"},Re=require("rc-motion");var Oe=n.n(Re);const Pe=l().forwardRef(((e,t)=>{const{forceRender:r,className:n,style:a,boxStyle:i,isActive:o}=e,[s,c]=l().useState(o||r);if(l().useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=Ee("collapse");return l().createElement("div",{ref:t,className:xe()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},n),style:a},l().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));Pe.displayName="PanelContent";const ke=Pe;function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ae.apply(null,arguments)}const Le=e=>{const{defaultActive:t,label:r,extra:n,className:a,style:i,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=l().useState(!!t),f=Ee("collapse"),g=xe()({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},a);return l().createElement("div",{className:g,style:i},l().createElement(Se,{label:r,extra:n,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),m?.(e)}}),l().createElement(Oe(),Ae({visible:p},Ie,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),(({className:t,style:r},n)=>l().createElement(ke,{ref:n,prefixCls:f,className:t,style:r,boxStyle:o,isActive:p,forceRender:d},e.children))))};Le.displayName="QmCollapse";const Fe=Le,_e=l().createContext(void 0);function De(e,t){((t,r)=>{const n=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(n.current)),r),i.useEffect((()=>(n.current=!1,()=>{n.current=!0})),[])})(0,t)}const He=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},$e=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},qe=e=>e.preventDefault(),Me=(e,t)=>{if(Z||!e||!t)return null;"float"===(t=ie(t))&&(t="cssFloat");try{const r=e.style[t];if(r)return r;const n=window.getComputedStyle(e);return n?n[t]:""}catch(r){return e.style[t]}},Ke=(e,t,r)=>{!Z&&e&&t&&((0,Q.isPlainObject)(t)?Object.keys(t).forEach((r=>{Ke(e,r,t[r])})):(t=ie(t),e.style[t]=r))},Ve=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},je=(e,t)=>Math.abs(Ve(e)-Ve(t)),ze=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Be=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},We=(e,t)=>{if(Z||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Ue=e=>Math.pow(e,3),Ge=e=>e<.5?Ue(2*e)/2:1-Ue(2*(1-e))/2,Ye=e=>{const{minValues:t,onDragChange:r,onDragging:n}=e,{splitRef:a,direction:i}=l().useContext(_e),{t:o}=G(),s=l().useRef(Z?null:document.onselectstart),c=l().useMemo((()=>"horizontal"===i),[i]),d=l().useMemo((()=>c?"X":"Y"),[c]),u=l().useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const r=e[`page${d}`]-u.current[`start${d}`],a=[t[0],u.current[`containerSize${d}`]-t[1]];let i=u.current[`firstElementSize${d}`]+r;i=Math.max(a[0],i),i=Math.min(a[1],i),n(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),$e(document,"mousemove",p),$e(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g=Ee("split"),y={[`${g}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return l().createElement("div",{className:xe()(y),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,n=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),He(document,"mousemove",p),He(document,"mouseup",h),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Ye.displayName="ResizeBar";const Xe=Ye,Qe=l().forwardRef(((e,t)=>{const{offset:r,className:n,style:a}=e,{direction:i,dragging:o}=l().useContext(_e),s="vertical"===i?"height":"width",c=Ee("split-pane"),d={[c]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[n]:!!n},u=void 0!==r?{[s]:ce(r)}:{flex:1,[s]:0};return l().createElement("div",{ref:t,className:xe()(d),style:{...u,...a}},e.children)}));Qe.displayName="SplitPane";const Ze=Qe;function Je(){return Je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Je.apply(null,arguments)}const et=e=>{const{direction:t="horizontal",defaultValue:r="50%",uniqueKey:n,className:a,style:i,onDragStart:s,onDrag:c=te,onDragEnd:d}=e,{global:u}=l().useContext(o),m=l().useRef(null),p=l().useRef(null),h=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},y=l().useMemo((()=>n?`split_${n}`:""),[n]),[b,v]=l().useState(!1),[x,E]=l().useState(h(r));De((()=>{b?s?.(f(x)):(d?.(f(x)),localStorage.setItem(y,x),S(y,x))}),[b]),l().useEffect((()=>{C()}),[]);const C=()=>{if(!y)return;const e=localStorage.getItem(y);e?E(h(e)):w(y).then((e=>{localStorage.setItem(y,h(e||r)),C()})).catch((()=>{}))},w=async e=>{const t=u?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S=async(e,t)=>{const r=u?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},N=l().useMemo((()=>({splitRef:m,direction:t,dragging:b})),[t,b]),T=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"SplitPane"===e.type?.displayName&&T.push(e)}));const[I,R]=T,O=l().useMemo((()=>[g(I),g(R)]),[I,R]),P=Ee("split"),k={[P]:!0,vertical:"vertical"===t};return l().createElement(_e.Provider,{value:N},l().createElement("div",{ref:m,className:xe()(k,a),style:i},l().createElement(Ze,Je({},I.props,{ref:p,offset:x})),l().createElement(Xe,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),c(e)}}),l().createElement(Ze,R.props)))};et.displayName="QmSplit",et.Pane=Ze;const tt=et,rt=require("react-countup");var nt=n.n(rt);function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},at.apply(null,arguments)}const it=e=>{const{className:t,style:r}=e,{$size:n}=X(e),a=Ee("countup"),i={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return l().createElement(nt(),at({},e,{className:xe()(i,t),style:r}),e.children)};it.displayName="QmCountup";const lt=it;function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ot.apply(null,arguments)}const st=e=>{const{className:t}=e,{$size:r}=X(e),n=Ee("empty"),a={...e,image:O.Empty.PRESENTED_IMAGE_SIMPLE},i={[n]:!0,[`${n}--lg`]:"large"===r,[`${n}--sm`]:"small"===r};return l().createElement(O.Empty,ot({},a,{className:xe()(i,t)}))};st.displayName="QmEmpty";const ct=st,dt=e=>{const t=h({tip:"Loading..."},e),{fullHeight:r,className:n,style:a}=t,i=Ee("spin"),o={[i]:!0,[`${i}-fullHeight`]:!!r},s={wrapperClassName:xe()(o,n),...oe(t,["fullHeight"]),style:{...a,maxHeight:"none"}};return l().createElement(O.Spin,s,t.children)};dt.displayName="QmSpin";const ut=dt,mt=l().createContext(void 0),pt=require("resize-observer-polyfill");var ht=n.n(pt);const ft=new Map,gt=new(ht())((function(e){e.forEach((e=>{const{target:t}=e;ft.get(t)?.forEach((e=>e(t)))}))}));function yt(e,t){ft.has(e)||(ft.set(e,new Set),gt.observe(e)),ft.get(e).add(t)}function bt(e,t){ft.has(e)&&(ft.get(e).delete(t),ft.get(e).size||(gt.unobserve(e),ft.delete(e)))}function vt(e){const[t,r]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,n=e=>{r({width:e.offsetWidth,height:e.offsetHeight})};return t&&yt(t,n),()=>{t&&bt(t,n)}}),[e]),t}function xt(e,t){const r=i.useRef(null);return i.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]),i.useCallback(((...n)=>{r.current&&clearTimeout(r.current),r.current=setTimeout((()=>e.apply(this,n)),t)}),[e,t])}const Et=6,Ct={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},wt=e=>{const{thumb:t,always:r,className:n,barSize:a=Et,direction:i="vertical",onDrag:o=te}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=l().useContext(mt),u=Ct[i],m=l().useRef(t),p=l().useRef(null),h=l().useRef(null),f=l().useRef({}),g=l().useRef(!1),y=l().useRef(!1),b=l().useRef(Z?null:document.onselectstart),[v,x]=l().useState(!1);l().useLayoutEffect((()=>{m.current=t}),[t]),l().useEffect((()=>{const e=c.current;return He(e,"mousemove",S),He(e,"mouseleave",N),()=>{w(),$e(document,"mouseup",C),$e(e,"mousemove",S),$e(e,"mouseleave",N)}}),[]);const E=e=>{if(!p.current||!h.current)return;if(!g.current)return;const t=f.current[u.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[u.direction]-e[u.client])-(h.current[u.offset]-t))/p.current[u.offset];d.current[u.scroll]=r*d.current[u.scrollSize]/100,o(!0)},C=()=>{g.current=!1,f.current={[u.axis]:0},$e(document,"mousemove",E),$e(document,"mouseup",C),w(),y.current&&x(!1),o(!1)},w=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},S=()=>{y.current=!1,x(!!m.current.size)},N=()=>{y.current=!0,x(g.current)},T=Ee("scrollbar"),I={[`${T}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},R={[u.reverse]:a},O={[u.size]:t.size,transform:`translate${u.axis}(${t.offset}%)`};return l().createElement(Md,{name:"fade",in:r||s||v,timeout:300},l().createElement("div",{ref:p,className:xe()(I,n),style:R},l().createElement("div",{ref:h,className:`${T}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),He(document,"mousemove",E),He(document,"mouseup",C),g.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(f.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},St=20,Nt=l().forwardRef(((e,t)=>{const{wrapClassName:r,wrapStyle:n,barWidth:a,always:i,native:o,showTopScrollbar:s,minSize:c=St,onScroll:d}=e,u=l().useRef(null),m=l().useRef(null),p=l().useRef(null),[h,f]=l().useState({size:0,offset:0,ratio:1}),[y,b]=l().useState({size:0,offset:0,ratio:1}),[v,x]=l().useState(!1),E=vt(u),C=vt(p);g((()=>{!o&&w()}),[C.width,C.height,E.width,E.height]);const w=xt((()=>{if(!m.current)return;const e=m.current.offsetHeight-4,t=m.current.offsetWidth-4,r=e**2/m.current.scrollHeight,n=t**2/m.current.scrollWidth,a=Math.max(r,c),i=Math.max(n,c),l=r/(e-r)/(a/(e-a)),o=n/(t-n)/(i/(t-i)),s=a+4<e?a:0,d=i+4<t?i:0,u=100*m.current.scrollTop/e*l,p=100*m.current.scrollLeft/t*o;f(Object.assign({},h,{size:d,ratio:o,offset:p})),b(Object.assign({},y,{size:s,ratio:l,offset:u}))}),5),S=e=>{x(e)},N=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-r)/500;l<1?(e.scrollTop=n+(t-n)*Ge(l),a(i)):e.scrollTop=t};a(i)})(m.current,e):m.current.scrollTop=e:me("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const r=Date.now(),n=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-r)/500;l<1?(e.scrollLeft=n+(t-n)*Ge(l),a(i)):e.scrollLeft=t};a(i)})(m.current,e):m.current.scrollLeft=e:me("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};l().useImperativeHandle(t,(()=>({container:u.current,scrollTop:m.current?.scrollTop||0,scrollLeft:m.current?.scrollLeft||0,SET_SCROLL_TOP:N,SET_SCROLL_LEFT:T})));const I=l().useMemo((()=>({dragging:v,scrollbarElement:u,wrapElement:m})),[v]),R=Ee("scrollbar"),O={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!o};return l().createElement("div",{ref:u,className:xe()(R,e.className),style:e.style},l().createElement("div",{ref:m,className:xe()(O,r),style:n,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!m.current)return;const e=m.current.offsetHeight-4,t=m.current.offsetWidth-4,r=100*m.current.scrollTop/e*y.ratio,n=100*m.current.scrollLeft/t*h.ratio;f(Object.assign({},h,{offset:n})),b(Object.assign({},y,{offset:r}))})(),d?.({scrollTop:t,scrollLeft:r})}},l().createElement("div",{ref:p,className:`${R}__view`},e.children)),!o&&l().createElement(mt.Provider,{value:I},s&&l().createElement(wt,{className:"top",direction:"horizontal",thumb:h,barSize:a,always:i,onDrag:S}),l().createElement(wt,{direction:"horizontal",thumb:h,barSize:a,always:i,onDrag:S}),l().createElement(wt,{direction:"vertical",thumb:y,barSize:a,always:i,onDrag:S})))}));Nt.displayName="QmScrollbar";const Tt=Nt,It=require("sortablejs");var Rt=n.n(It);const Ot=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Pt(){return Pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Pt.apply(null,arguments)}const kt=async(e,{fileName:t,headers:r,params:n})=>{const a=n?new URLSearchParams(n).toString():"",i=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${i+a}`,{method:"GET",headers:r});if(!l.ok)throw new Error(p("qm.download.error"));const o=await l.blob(),s=l.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Ot(o,c)},At=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Lt=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Ft=e=>{const t=h({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:r=[],fileDirection:n="vertical",batchDownload:a,draggable:i,editable:o,disabled:s,readOnly:c,button:d={},className:u,onPreview:m,onSortChange:p,onEditChange:f,onDownload:g,onChange:y}=t,{t:b}=G(),{$size:v}=X(t),x=l().useRef(null),E=l().useRef(null),[C,w]=l().useState({}),S=l().useMemo((()=>s||c),[s,c]);l().useEffect((()=>(I(),()=>E.current?.destroy())),[]);const N=(e,t)=>{w((r=>Object.assign({},r,{[e]:t??!r[e]})))},T=Y((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[a]=e.splice(t,1);e.splice(n,0,a),p?.(e),y?.({file:r[t],fileList:e})}})),I=()=>{i&&(E.current=Rt().create(Be(x.current,Ee("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:T}))},R=async e=>{if(g)return void await g(e);const{downloadWithHeaders:r,headers:n}=t;try{e.url&&await kt(e.url,{fileName:e.name,...r?{headers:n}:null})}catch(e){O.message.error(b("qm.download.error"))}},P=Ee("upload-file"),k={[P]:!0,[`${P}--lg`]:"large"===v,[`${P}--sm`]:"small"===v,[`${P}--horizontal`]:"horizontal"===n};return l().createElement(O.Upload,Pt({className:xe()(k,u)},oe(t,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,r)=>new Promise((async(n,a)=>{const{fileTypes:i=[],fileSize:l,maxCount:o,fileList:s=[],beforeUpload:c}=t,d=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!l||e.size/1024/1024<l,m=!(o>1)||s.length<o,p=d&&u&&m;if(d||O.message.warning(b("qm.upload.tooltip",{type:i.join(",")})),u||O.message.warning(b("qm.upload.sizeLimit",{size:l})),m||O.message.warning(b("qm.upload.countLimit",{count:o})),!p)return O.Upload.LIST_IGNORE;if(c){const t=c(e,r);if(!0===t)return n(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{n(await t)}catch(e){a(e)}}else n(e)})),disabled:S,onChange:y,onPreview:async e=>{if("function"==typeof m)return m(e,(t=>R(t||e)));s||await R(e)},onDownload:async e=>{await R(e)},itemRender:(e,n,a,c)=>((e,n)=>{const{iconRender:a}=t,{uid:c,name:d,url:u,status:m="done"}=e,p="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return l().createElement("div",{className:xe()("ant-upload-list-item",`ant-upload-list-item-${m}`,"ant-upload-list-item-list-type-text",{handle:i})},l().createElement("div",{className:"ant-upload-list-item-info"},l().createElement("span",{className:"ant-upload-span"},l().createElement("div",{className:"ant-upload-text-icon"},a?a(e):l().createElement(Ce.LinkOutlined,null)),l().createElement("div",{className:"ant-upload-list-item-name"},C[c]?l().createElement(O.Input,{size:"small",autoFocus:!0,defaultValue:At(d),onBlur:t=>{const{value:n}=t.target;if(n!==At(d)){const t=Object.assign({},e,{name:`${n}.${Lt(d)}`}),a=r.map((e=>e.uid!==c?e:t));f?.(t,a),y?.({file:t,fileList:a})}N(c,!1)}}):l().createElement("a",{rel:"noreferrer",target:"_blank",title:d,href:u,onClick:e=>{e.preventDefault(),o?S||N(c,!0):n.preview()}},d)),l().createElement("span",{className:"ant-upload-list-item-card-actions"},o&&!S&&l().createElement("button",{type:"button",className:p,onClick:()=>N(c)},C[c]?l().createElement(Ce.CheckOutlined,null):l().createElement(Ce.EditOutlined,null)),o&&l().createElement("button",{type:"button",className:xe()(p,"preview"),onClick:()=>n.preview()},l().createElement(Ce.EyeOutlined,null)),l().createElement("button",{type:"button",className:xe()(p,"download"),disabled:s,onClick:()=>n.download()},l().createElement(Ce.DownloadOutlined,null)),l().createElement("button",{type:"button",className:xe()(p,"delete"),disabled:S,onClick:()=>n.remove()},l().createElement(Ce.DeleteOutlined,null))))))})(n,c)}),l().createElement("span",{className:"inner",ref:x},t.children||c&&r.length?t.children:l().createElement(O.Button,{type:d.type??"default",icon:d.icon??l().createElement(Ce.UploadOutlined,null),disabled:S},d.text||b("qm.upload.text")),a&&!!r.length&&l().createElement(O.Button,{disabled:s,style:{marginLeft:8},onClick:async e=>{if(e.stopPropagation(),"function"==typeof a)await a(r);else for(const e of r)await R(e)}},b("qm.upload.batchDownload"))))};Ft.displayName="QmUploadFile";const _t=Ft;function Dt(){return Dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Dt.apply(null,arguments)}const Ht=e=>{const t=h({icon:l().createElement(Ce.DownloadOutlined,null),withCredentials:!1},e),{$size:r}=X(t),{t:n}=G(),[a,i]=l().useState(!1),o=oe(t,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return l().createElement(O.Button,Dt({},o,{size:r,loading:a,onClick:async()=>{i(!0);try{const{action:e,fileName:r,headers:a,params:i,beforeDownload:l=re,onSuccess:o}=t,s=(0,Q.isString)(e)?e:await(async()=>{const e=t.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""})();if(!s)return me("Download","参数 `action` 有误!");if(!l(s))return;await kt(s,{fileName:r,headers:a,params:i}),await ne(100),o?.(),O.message.success(n("qm.download.success"))}catch(e){t.onError?.(e),O.message.error(n("qm.download.error"))}i(!1)}}),t.children||n("qm.download.text"))};Ht.displayName="QmDownload";const $t=Ht,qt=require("add-dom-event-listener");var Mt=n.n(qt);const Kt=require("scroll-into-view-if-needed");var Vt=n.n(Kt);function jt(e,t){const r=i.useRef(null),n=i.useRef(0);return i.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]),i.useCallback(((...r)=>{const a=Date.now();(!n.current||a-n.current>t)&&(e.apply(this,r),n.current=a)}),[e,t])}const zt=e=>{const{activeKey:t,labels:r,onTabClick:n}=e;return l().createElement(l().Fragment,null,r.map(((e,r)=>{const a={item:!0,actived:r===t};return l().createElement("div",{key:r,className:xe()(a),onClick:e=>n(r,e)},l().createElement("span",null,e))})))},Bt=e=>{const{label:t,showDivider:r,className:n,style:a}=e,i=Ee("anchor-item"),o={[i]:!0};return l().createElement("div",{className:xe()(o,n),style:a},r&&l().createElement(Se,{label:t,style:{marginBottom:10}}),e.children)};Bt.displayName="AnchorItem";const Wt=Bt,Ut=l().forwardRef(((e,t)=>{const{labelList:r=[],defaultActiveIndex:n,labelWidth:a,tabPosition:i="left",onTabClick:o,className:s,style:c}=e,{$size:d}=X(e),u=l().useRef(null),m=l().useRef(),p=l().useRef("ready"),h=l().useRef(0),[f,g]=l().useState(n||0),y=l().useMemo((()=>!!r?.length),[r]);l().useEffect((()=>{b();const e=Mt()(u.current,"scroll",x);return()=>{e.remove()}}),[]);const b=()=>{f>0&&(u.current.scrollTop=je(v(f),u.current))},v=e=>y?document.getElementById(r[e].id):u.current.children[e],x=jt((e=>{if("ready"!==p.current)return;const t=(e=>{const t=Math.abs(e),n=(y?r.map((e=>document.getElementById(e.id))):Array.from(u.current?.children||[])).map((e=>je(e,u.current)));let a=-1;for(let e=0;e<n.length;e++){const r=n[e],i=n[e+1]||1e4;t>=r-1&&t<i&&(a=e)}return a})(e.target.scrollTop);-1!==t&&g(t)}),60),E=e=>{const t=v(e);t&&(g(e),p.current="stop",m.current&&clearTimeout(m.current),Vt()(t,{block:"start",behavior:"smooth",boundary:u.current}),m.current=setTimeout((()=>p.current="ready"),500))};l().useImperativeHandle(t,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>h.current?h.current:e,E(e)}})));const C=Ee("anchor"),w={[C]:!0,[`${C}-left`]:"left"===i,[`${C}-top`]:"top"===i,[`${C}--lg`]:"large"===d,[`${C}--sm`]:"small"===d},S=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"AnchorItem"===e.type?.displayName&&S.push(e)}));const N=y?r.map((e=>e.label)):S.map((e=>e.props.label)),T=y?r.map((e=>e.id)):S.map(((e,t)=>e.props["data-id"]||t.toString()));return h.current=N.length,l().createElement("div",{className:xe()(w,s),style:c},l().createElement("div",{className:xe()("anchor-nav"),style:{width:a?ce(a):""}},l().createElement(zt,{activeKey:f,labels:N,onTabClick:(e,t)=>{E(e),o?.({label:N[e],id:T[e]},t)}})),l().createElement("div",{ref:u,className:xe()("anchor-container")},y?e.children:S))}));Ut.displayName="QmAnchor",Ut.Item=Wt;const Gt=Ut,Yt=e=>l().createElement(O.Tabs.TabPane,e,e.children);Yt.displayName="TabPane";const Xt=Yt;function Qt(){return Qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qt.apply(null,arguments)}const Zt=e=>{const t=h({tabPosition:"top"},e),{items:r,tabPosition:n,tabBarGutter:a,className:i,authConfig:o}=t,{$size:s}=X(t),c=Ee("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u={...oe(t,["items","authConfig"]),size:s,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},m=[];l().Children.map(t.children,(e=>{J(e)&&!ee(e)&&"TabPane"===e.type?.displayName&&m.push(e)}));const p=r?[...r]:m.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(p.splice(t,1),t--)}}return l().createElement(O.Tabs,Qt({},u,{items:p,className:xe()(d,i)}))};Zt.displayName="QmTabs",Zt.TabPane=Xt;const Jt=Zt;function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},er.apply(null,arguments)}const tr=l().forwardRef(((e,t)=>{const r=h({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:n,open:a,className:i,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:f,onFullChange:g}=r,{global:y}=l().useContext(o),{$size:b}=X(r),v=l().useRef(null),x=l().useRef(null),E=l().useRef(!1),[C,w]=l().useState(!1),[S,N]=l().useState(!1),[T,I]=l().useState(!1);De((()=>{(a??n)&&(!m&&E.current||(0,Q.isUndefined)(s)&&N(!0))}),[a??n]),De((()=>{x.current&&Ke(x.current,C?{width:"100%"}:{width:ce(r.width||"72%")})}),[C]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>I(!0),STOP_LOADING:()=>I(!1)})));const R=Ee("drawer"),P={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===b,[`${R}--sm`]:"small"===b};return l().createElement(O.Drawer,er({},oe(r,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:u??y?.maskClosable??!1,className:xe()(P,i),title:l().createElement(l().Fragment,null,l().createElement("span",{ref:v,className:"text"},c&&r.title),d&&l().createElement("button",{type:"button",className:"full-screen",onClick:()=>{x.current=Be(v.current,"ant-drawer-content-wrapper"),w(!C),g?.(!C)}},l().createElement(C?Ce.FullscreenExitOutlined:Ce.FullscreenOutlined))),footer:null,afterOpenChange:e=>{e?(E.current=!0,(0,Q.isUndefined)(s)&&setTimeout((()=>N(!1)),100)):(w(!1),f?.())},onClose:p}),r.children,(s||T||S)&&l().createElement(ut,{spinning:!0,className:xe()("spinning")}))}));tr.displayName="QmDrawer";const rr=tr,nr=require("react-draggable");var ar=n.n(nr);function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ir.apply(null,arguments)}const lr="10vh";var or=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(or||{});const sr=l().forwardRef(((e,t)=>{const r=h({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:lr}},e),{visible:n,open:a,width:i,height:s,className:c,loading:d,draggable:u,showHeader:m,showFullScreen:p,maskClosable:f,destroyOnClose:g,bodyStyle:y,onFullChange:b,onClose:v,onClosed:x}=r,{global:E}=l().useContext(o),{$size:C}=X(r),w=l().createRef(),S=l().useRef(!1),N=l().useMemo((()=>`calc(100vh - ${lr} - ${lr} - ${or[m?C:"none"]}px)`),[C,m]),[T,I]=l().useState(!1),[R,P]=l().useState(!1),[k,A]=l().useState(!1),[L,F]=l().useState(!0),[_,D]=l().useState({left:0,top:0,bottom:0,right:0}),[H,$]=l().useState();De((()=>{if(a??n){if(!g&&S.current||(0,Q.isUndefined)(d)&&P(!0),!g&&S.current)return;setTimeout((()=>{S.current=!0,(0,Q.isUndefined)(d)&&P(!1)}),400)}}),[a??n]),De((()=>{$(T?{x:0,y:0}:void 0)}),[T]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>A(!0),STOP_LOADING:()=>A(!1)})));const q=Ee("modal"),M={height:s?ce(s):N,maxHeight:"auto"===s?N:"",overflow:"auto"},K={[q]:!0,"no-header":!m,[`${q}--lg`]:"large"===C,[`${q}--sm`]:"small"===C};return l().createElement(O.Modal,ir({},oe(r,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:a??n,maskClosable:f??E?.maskClosable??!1,className:xe()(K,c),title:l().createElement("div",{onMouseOver:()=>{L&&F(!1)},onMouseOut:()=>{F(!0)}},l().createElement("span",{className:"text"},m&&r.title),p&&l().createElement("button",{type:"button",className:"full-screen",onClick:e=>{const t=Be(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body");T?(Ke(t,{width:ce(i||"60%"),height:"auto",top:lr}),Ke(r,{height:s?ce(s):N,maxHeight:"auto"===s?N:""})):(Ke(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Ke(r,{height:`calc(100vh - ${or[m?C:"none"]}px)`,maxHeight:""})),I(!T),b?.(!T)}},l().createElement(T?Ce.FullscreenExitOutlined:Ce.FullscreenOutlined))),footer:null,bodyStyle:Object.assign({},M,y),onCancel:v,afterClose:()=>{x?.(),I(!1)},modalRender:e=>l().createElement(ar(),{nodeRef:w,bounds:_,position:H,disabled:!u||L||T,onStart:(e,t)=>((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=w.current.getBoundingClientRect();a&&D({left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1})})(0,t)},l().createElement("div",{ref:w},e))}),r.children,(d||k||R)&&l().createElement(ut,{spinning:!0,className:xe()("spinning")}))}));sr.displayName="QmModal";const cr=sr,dr=require("memoize-one");var ur=n.n(dr);const mr=(0,i.createContext)(void 0),pr=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],hr={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)pr.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e,t=" "){return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},fr=["==","<",">","<=",">=","!=","like","likes","in","nin"],gr=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)fr.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),fr.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},yr=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,br=["string","number","boolean","symbol"],vr=e=>br.includes(typeof e),xr=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Er=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(yr,"\\$1"),"i");window.__query__=(...e)=>((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(Er(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(Er(t))));break;case"in":vr(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":vr(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(xr(e)?e.slice(0,10):e)!=r;break;case"<":n=(xr(e)?e.slice(0,10):e)<r;break;case"<=":n=(xr(e)?e.slice(0,10):e)<=r;break;case">":n=(xr(e)?e.slice(0,10):e)>r;break;case">=":n=(xr(e)?e.slice(0,10):e)>=r;break;default:n=(xr(e)?e.slice(0,10):e)==r}return n})(e[0],e[1],e[2]);const Cr=hr.stringify,wr=hr.array_format,Sr=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},Nr=(e,t,r)=>{let n=[];t=hr.replace_symbols(t);try{if(r){const r=new Function("record",`return ${gr(t,"record")};`);n=on(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${gr(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){me("Table","组件 `initialFilter` 参数有误!"),n=e}return n},Tr=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Tr(e.children)):t.push(e)})),t},Ir=e=>e.filter((e=>(e.children&&(e.children=Ir(e.children)),!e.hidden&&!e.noAuth))),Rr=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Rr(e.children))})),t},Or=(e,t)=>e.map((e=>(e.children&&(e.children=Or(e.children,t)),t?.(e),e))),Pr=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=Pr(r.children,t);if(e)return e}}return null},kr=e=>{const t=e.children;return t?t[0].children?kr(t[0]):t[0]:e},Ar=e=>{const t=e.children;return t?t[t.length-1].children?Ar(t[t.length-1]):t[t.length-1]:e},Lr=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Fr=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Fr(r.children,t);if(e)return e}}return null},_r=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(..._r(e.children))})),t},Dr=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Rr(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},Hr=(e,t)=>{const r=[];return e.forEach((e=>{r.push(e),t(e)&&r.push(...Hr(e.children,t))})),r},$r=e=>Object.assign(e,{__prevent__:!0}),qr=e=>{delete e.__prevent__},Mr=(e,t,r={left:0,top:0})=>{if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return Mr(e.offsetParent,t,r)}return r},Kr=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Vr=(e,t)=>(0,Q.transform)(e,((e,r,n)=>{(0,Q.isEqual)(r,t[n])||(e[n]=(0,Q.isPlainObject)(r)&&(0,Q.isPlainObject)(t[n])?Vr(r,t[n]):r)})),jr=(e,t)=>(0,Q.get)(e,t)??"",zr=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,Q.set)(e,t,r??"")},Br=(e,t)=>{if(!t.includes("|"))return jr(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(jr(e,t))})),r.every((e=>!e))?"":r.join(" | ")},Wr=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Ur=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},Gr=(e,t)=>{const r=e.toString();if(!Wr(r)||0===t)return e;const n=Number.parseFloat(r).toString(),a=n.indexOf(".");if(-1===a)return n+"."+"0".repeat(t);const i=Math.max(0,t-(n.length-a-1));return n+"0".repeat(i)},Yr=(e,t)=>e?c()(e,t):null,Xr=(e,t)=>e?c()(e).format(t):"",Qr=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Zr=e=>{const t=[];if(l().isValidElement(e)){const{children:r}=e.props;l().Children.forEach(r,(e=>{t.push(...Zr(e))}))}else t.push(e);return t},Jr=e=>Zr(e).join(""),en=e=>e.filter((e=>!e._group)),tn=(e,t=!1)=>{let r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const l=Array.isArray(i.condition)?wr(i.condition):Cr(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],l=e[n];for(const e in l)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?wr(l[e]):Cr(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},rn=(e=[],t=[])=>{const r={};return e.forEach((e=>{const n=JSON.stringify((e=>{const r=[];return t.forEach((t=>r.push(jr(e,t)))),r})(e));r[n]=r[n]||[],r[n].push(e)})),Object.keys(r).map((e=>r[e]))},nn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=nn(e[r].children,t);if(n)return[e[r],n].flat()}}},an=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=an(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},ln=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=ln(r.children,t);if(e)return e}if(t(r))return r}return null},on=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&on(e.children,t),t(e)||e.children&&e.children.length))),sn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),cn=require("prop-types");var dn=n.n(cn);const un=e=>["","small","middle","large"].includes(e),mn=80,pn="1",hn="0",fn=400,gn=["RANGE_INPUT","RANGE_INPUT_NUMBER","RANGE_SEARCH_HELPER","MULTIPLE_CHECKBOX","MULTIPLE_SELECT","RANGE_DATE","RANGE_TIME","MULTIPLE_TREE_SELECT","MULTIPLE_SEARCH_HELPER","MULTIPLE_TREE_TABLE_HELPER","MULTIPLE_CASCADER","UPLOAD_IMG","UPLOAD_FILE"],yn={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let bn=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),vn=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),xn=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const En={items:dn().arrayOf(dn().shape({type:dn().string.isRequired,fieldName:dn().string.isRequired})),initialValues:dn().object,initialExtras:dn().object,layout:dn().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!un(e[t]||""))return ue("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:dn().number,className:dn().string,style:dn().object,compactMode:dn().bool,labelWidth:dn().oneOfType([dn().number,dn().string]),labelAlign:dn().oneOf(["left","right"]),labelWrap:dn().bool,formType:dn().oneOf(["default","search","onlyShow"]),disabled:dn().bool,uniqueKey:dn().string,defaultRows:dn().number,defaultExpand:dn().bool,searchButtonCols:dn().number,scrollToFirstError:dn().bool,authConfig:dn().object,isAutoFocus:dn().bool,isCollapse:dn().bool,isFieldsDefine:dn().bool,isSearchBtn:dn().bool,isSubmitBtn:dn().bool,fieldsChange:dn().func,onValuesChange:dn().func,onFieldsChange:dn().func,onFinish:dn().func,onFinishFailed:dn().func,onReset:dn().func,onCollapse:dn().func},Cn={layout:"horizontal",labelWidth:mn,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:te,onFieldsChange:te,onFinish:te,onFinishFailed:te,onReset:te,onCollapse:te},wn=(e,t)=>{if(!e)return null;if(t===vn.week){const t=e.match(/^(\d{4})-(\d+)/);return t?c()().year(Number(t[1])).week(Number(t[2])):null}if(t===vn.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?c()().year(Number(t[1])).quarter(Number(t[2])):null}return c()(e,t)},Sn=(e,t)=>e?c()(e).format(t):"",Nn=e=>""===e||null==e,Tn=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},In=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Rn=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},On=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),(0,Q.isUndefined)(e.isLeaf)||(n.isLeaf=!!e.isLeaf),(0,Q.isUndefined)(e.selectable)||(n.selectable=!!e.selectable),Array.isArray(e.children)&&(n.children=On(e.children,t,r)),n})),Pn=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=Pn(r.children,t);if(e)return e}}return null},kn=(e,t,r=0)=>{const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...kn(e.children,t,r+1))})),n},An=e=>J(e)||"string"==typeof e,Ln=e=>J(e)?Zr(e).join(""):e??"",Fn=(e,t,r,n)=>{const a={};return a.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},_n={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{曾:"ZENG",沈:"SHEN",嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬤:"MO",嬷:"MO",蹒:"PAN",蹊:"XI",丬:"PAN",霰:"XIAN",莘:"XIN",豉:"CHI",饧:"XING",筠:"JUN",长:"CHANG",帧:"ZHEN",峙:"SHI",郍:"NA",芎:"XIONG",谁:"SHUI"}},Dn="阿",Hn="鿿",$n=1,qn=2,Mn=3;let Kn,Vn=null;function jn(e){return e||null===Vn?("object"==typeof Intl&&Intl.Collator?(Kn=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Vn=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Vn=!1,Vn):Vn}function zn(e){const t=_n.UNIHANS,r=_n.PINYINS,n=_n.EXCEPTIONS,a={source:e};if(e in n)return a.type=qn,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=$n,a.target=e,a;if(i=Kn.compare(e,Dn),i<0)return a.type=Mn,a.target=e,a;if(0===i)a.type=qn,l=0;else{if(i=Kn.compare(e,Hn),i>0)return a.type=Mn,a.target=e,a;0===i&&(a.type=qn,l=t.length-1)}if(a.type=qn,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=Kn.compare(e,a),0===i)break;i>0?r=l+1:n=l-1}}return i<0&&l--,a.target=r[l],a.target||(a.type=Mn,a.target=a.source),a}function Bn(e){return"string"==typeof e&&jn()?e.split("").map((e=>zn(e))):e}const Wn={isSupported:jn,parse:Bn,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(_n)})))},genToken:zn,convertToPinyin:(e,t,r)=>Bn(e).map((e=>t&&e.type===qn?e.target.toLowerCase():e.target)).join(r||"")},Un={patcher:function(e){e.EXCEPTIONS={嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬷:"MO",蹊:"XI",丬:"PAN",霰:"XIAN",豉:"CHI",饧:"XING",帧:"ZHEN",芎:"XIONG",谁:"SHUI",钶:"KE"},e.UNIHANS[91]="伕",e.UNIHANS[347]="仚",e.UNIHANS[393]="诌",e.UNIHANS[39]="婤",e.UNIHANS[50]="腠",e.UNIHANS[369]="攸",e.UNIHANS[123]="乯",e.UNIHANS[171]="刕",e.UNIHANS[102]="佝",e.UNIHANS[126]="犿",e.UNIHANS[176]="列",e.UNIHANS[178]="刢",e.UNIHANS[252]="娝",e.UNIHANS[330]="偸"},shouldPatch:function(e){return"function"==typeof e&&"FOU"===e("伕").target&&"XIA"===e("仚").target&&"ZHONG"===e("诌").target&&"CHONG"===e("婤").target&&"CONG"===e("腠").target&&"YONG"===e("攸").target&&"HOU"===e("乯").target&&"LENG"===e("刕").target&&"GONG"===e("佝").target&&"HUAI"===e("犿").target&&"LIAO"===e("列").target&&"LIN"===e("刢").target&&"E"===e("钶").target}};Wn.isSupported()&&Un.shouldPatch(Wn.genToken)&&Wn.patchDict(Un);const Gn=Wn,Yn=e=>{const{value:t,bordered:r}=e;return l().createElement(O.Input,{value:t,title:t,bordered:r,readOnly:!0})};Yn.displayName="FormItemView";const Xn=Yn;function Qn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zn.apply(null,arguments)}const{Option:Jn}=O.Select,ea=e=>{const{$$form:t}=l().useContext(mr),{value:r,items:n,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=G(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:y,onClear:b}=e.option,{itemList:v=[],filterable:x=!0,listHeight:E=fn,collapseTags:C,maxTagTextLength:w,dropdownStyle:S,openPyt:N=!0}=u,T=le(v)?n:v,I=e=>T.find((t=>t.value===e))?.text||e?.toString()||"",R=e=>a?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?l().createElement(Xn,{value:R(r),bordered:h}):l().createElement(O.Select,Zn({value:r,mode:a?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:p,style:m,loading:i,bordered:h,allowClear:f,disabled:y,showSearch:x,listHeight:E,maxTagCount:C?"responsive":void 0,maxTagTextLength:w},a?{title:R(r)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,R(e),T)})(e)},onClear:b}),T.map((e=>l().createElement(Jn,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ta extends i.Component{constructor(...e){super(...e),Qn(this,"context",void 0),Qn(this,"state",{itemList:[],loading:!1}),Qn(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,buttonAfter:p,validateTrigger:h,rules:f=[],onChange:g=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:xe()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(f)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(ea,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(o,r)}}))),p&&l().createElement(O.Col,null,e.renderFormItemButton(o,p)),m&&l().createElement(O.Col,{flex:ce(m.labelWidth||mn)},e.renderFormItemExtra({fieldName:o,...m}))))}}Qn(ta,"contextType",mr);const ra=ta;function na(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const aa=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=hn,trueValue:p=pn}=o,{t:h}=G();return l().createElement(O.Checkbox,{checked:r===p,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{n?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(t?p:m)}},u?i:null)};class ia extends i.Component{constructor(...e){super(...e),na(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option,{labelToCheckbox:h}=o;return l().createElement(O.Form.Item,{label:h?" ":e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(aa,{option:this.props.option,onValuesChange:(t,r)=>{p(t),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}na(ia,"contextType",mr);const la=ia,oa=require("react-sortablejs"),sa=e=>{const{uniqueKey:t,items:r,fieldsChange:n}=e,{global:a}=l().useContext(o),{$$form:i}=l().useContext(mr),{$size:s}=X(e),{t:c}=G(),d=l().useRef(null),[u,m]=l().useState(!1),p=l().useMemo((()=>t?`form_${t}`:""),[t]);l().useLayoutEffect((()=>{f()}),[]);const h=e=>{if(!p)return;const t=e.map((e=>{const t={};return(0,Q.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(p));(0,Q.isEqual)(t,r)||(localStorage.setItem(p,JSON.stringify(t)),(async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(p,t))},f=()=>{const e=(()=>{if(!p)return;const e=JSON.parse(localStorage.getItem(p));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(p).then((e=>{e?(localStorage.setItem(p,JSON.stringify(e)),f()):a?.getComponentConfigApi&&h(r)})).catch((()=>{})),e?(0,Q.xor)(e.map((e=>e.fieldName)),r.map((e=>e.fieldName))).length>0?r.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,Q.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...r.find((t=>t.fieldName===e.fieldName)),...e}))):void 0})();e&&g(e)},g=e=>{n?.([...e])},y=Ee("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===s,[`${y}--sm`]:"small"===s};return l().createElement(O.Dropdown,{open:u,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","fields-list")},l().createElement("div",{className:"reset"},l().createElement(fe,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||se(e);return Object.assign(t,{hidden:e.hidden})}));g(t),h(t)})(i.getOriginItems())},c("qm.table.columnFilter.reset"))),l().createElement(oa.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));if((0,Q.isEqual)(t,n))return;i.setExpandHandle(!0);const a=sn(e);g(a),h(a)}},r.map((e=>l().createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},l().createElement(O.Checkbox,{disabled:e.rules?.findIndex((e=>e.required))>-1,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,g(r),h(r)}}),l().createElement(Ce.HolderOutlined,{className:"handle",title:c("qm.form.draggable")}),l().createElement("span",{className:"title"},i.getFormItemLabel(e.label))))))),overlayClassName:xe()(b),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>d.current,onOpenChange:e=>{m(e)}},l().createElement("a",{ref:d,style:{padding:"5px 0"}},l().createElement(Ce.UnorderedListOutlined,null)))};sa.displayName="FieldsFilter";const ca=sa;function da(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ua=l().forwardRef(((e,t)=>{const{$$form:r}=l().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{t:o}=G(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h,onFocus:f,onBlur:g,onEnter:y,onClear:b}=e.option,{prefix:v,suffix:x,password:E,maxLength:C,pattern:w,toUpper:S,toTrim:N,autoFocus:T,autoComplete:I,secretType:R}=s,P=R&&(p||h),k=l().useRef();l().useEffect((()=>{const e=()=>b?.(),t=k.current?.input.parentNode.querySelector("span[class*='clear-icon']");return m&&t&&t.addEventListener("click",e),()=>{t?.removeEventListener("click",e)}}),[]);const A=e=>{a?.(e),i(e)},L=E?O.Input.Password:O.Input,F=P?((e="",t)=>(e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e))(n,R):n;return r.isOnlyShow?l().createElement(Xn,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(F),bordered:u}):l().createElement(L,{ref:e=>{k.current=e,"function"==typeof t&&t(e)},value:F,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":F,prefix:v,suffix:x,maxLength:C,bordered:u,allowClear:m,readOnly:p,disabled:h,onFocus:e=>{f?.(e.target.value,e)},onBlur:t=>{let r=t.target.value??"";if(N){const e=r.trim();r!==e&&(r=e,A(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),g?.(r,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;y?.(t,e),r.isFilterType&&(r.SUBMIT_FORM(),k.current?.blur())}},onChange:e=>{let t=e.target.value;(0,Q.isRegExp)(w)&&(t=w.test(t)?t:n??""),S&&(t=t.toUpperCase()),A(t)}})}));ua.displayName="VInput";class ma extends i.Component{constructor(...e){super(...e),da(this,"context",void 0),da(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(ua,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),u&&l().createElement(O.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}da(ma,"contextType",mr);const pa=ma;function ha(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fa=e=>{const{$$form:t}=l().useContext(mr),{value:r=[],onChange:n,onValuesChange:a}=e,{t:i}=G(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{prefix:p,suffix:h,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;n?.(t),a(t,y(t))},y=e=>e.join(" - ");return t.isOnlyShow?l().createElement(Xn,{value:y(r),bordered:c}):l().createElement(O.Input.Group,null,l().createElement(O.Input,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:p,suffix:h,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),l().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),l().createElement(O.Input,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:p,suffix:h,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class ga extends i.Component{constructor(...e){super(...e),ha(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(fa,{option:this.props.option,onValuesChange:(t=[],r)=>{m(t),e.setViewValue(a,r)}}))),c&&l().createElement(O.Col,{flex:ce(c.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...c}))))}}ha(ga,"contextType",mr);const ya=ga,ba=require("big.js");var va=n.n(ba);function xa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ea=l().forwardRef(((e,t)=>{const{$$form:r}=l().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{t:o}=G(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:g}=e.option,{step:y=1,min:b,max:v,precision:x,autoFocus:E,stringMode:C,textAlign:w="left",controls:S=!0,formatter:N,parser:T}=s,I=l().useRef(),R=l().useRef(n),P=e=>{const t=Nn(e)?"":(0,Q.isNumber)(e)?e.toFixed(x):new(va())(e).toFixed(x);return"function"==typeof N?N(t):t},k={[w]:!0,controls:S};return r.isOnlyShow?l().createElement(Xn,{value:P(n),bordered:u}):l().createElement(O.InputNumber,{ref:e=>{I.current=e,"function"==typeof t&&t(e)},value:n,className:xe()(k),placeholder:d,style:{width:"100%",...c},step:y,min:b,max:v,controls:S,precision:x,autoFocus:E,stringMode:C,formatter:N,parser:T,bordered:u,readOnly:m,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{ae((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(R.current),f?.(R.current,t)}))},onKeyUp:e=>{13===e.keyCode&&(g?.(n,e),r.isFilterType&&(r.SUBMIT_FORM(),I.current?.blur()))},onChange:e=>{const t=e??"";!C&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,a?.(e),i(e,P(e))})(t)}})}));Ea.displayName="VInputNumber";class Ca extends i.Component{constructor(...e){super(...e),xa(this,"context",void 0),xa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ea,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(a,r)}}))),u&&l().createElement(O.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}xa(Ca,"contextType",mr);const wa=Ca;function Sa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Na=e=>{const{$$form:t}=l().useContext(mr),{value:r=[],onChange:n,onValuesChange:a}=e,{t:i}=G(),{options:o={},placeholder:s=i("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{step:p=1,min:h=0,max:f,textAlign:g="left",controls:y=!0,precision:b,formatter:v,parser:x}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),C(e)},C=e=>{const t=e.every((e=>null===e))?[]:[...e];n?.(t),a(t,w(t))},w=e=>Nn(e)?"":e.map((e=>Nn(e)?"":Number(e).toFixed(b))),S={[g]:!0,controls:y};return t.isOnlyShow?l().createElement(Xn,{value:w(r),bordered:c}):l().createElement(O.Input.Group,null,l().createElement(O.InputNumber,{value:r[0],className:xe()("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:p,min:h,max:f,controls:y,precision:b,formatter:v,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{C([e,r[1]])},onBlur:()=>{E(r)}}),l().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),l().createElement(O.InputNumber,{value:r[1],className:xe()("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:p,min:h,max:f,controls:y,precision:b,formatter:v,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{C([r[0],e])},onBlur:()=>{E(r)}}))};class Ta extends i.Component{constructor(...e){super(...e),Sa(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(s),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(o)},required:e.getFormItemRequired(u)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Na,{option:this.props.option,onValuesChange:(t=[],r)=>{m(t),e.setViewValue(a,r)}}))),c&&l().createElement(O.Col,{flex:ce(c.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...c}))))}}Sa(Ta,"contextType",mr);const Ia=Ta;let Ra=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function Oa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Pa}=O.Input;class ka extends i.Component{constructor(e){super(e),Oa(this,"context",void 0),Oa(this,"deriveParams",void 0),Oa(this,"valueKey",void 0),Oa(this,"_is_change",!1),Oa(this,"_record",void 0),Oa(this,"_prevValue",null),Oa(this,"state",{visible:!1,loading:!1}),Oa(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Oa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Oa(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||me("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||me("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&me("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Oa(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Oa(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Oa(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(!e||le(d))return this._prevValue=void 0;this.setState({loading:!0});try{const l=await e(r({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&In(t,this.alias,s),c&&Rn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Tn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),Oa(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),Oa(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,Q.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),Oa(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=re,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{ae((()=>this.setState({loading:!1})))}}))})),Oa(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Tn(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=Tn(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),Oa(this,"resetSearchHelperValue",(async(e=[],t)=>{const{fieldName:r}=this.props.option,n=e.filter((e=>Tn(e,this.alias[r])?.toString().toLowerCase().includes(t.toLowerCase())));if(1===n.length)return this.closeSearchHelper(n[0]);this.openSearchHelper(t)})),Oa(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??re)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),Oa(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Tn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Tn(e,this.extras[r])});const n=Tn(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Oa(this,"closeButNotSelect",(()=>{const{onlySelect:e=!0}=this.searchHelper;this._is_change&&(e?this.clearSearchHelperValue():this.searchHelperChangeHandle(this.props.value)),this._is_change=!1,this.setVisible(!1)})),Oa(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),Oa(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),Oa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),Oa(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Oa(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:y,maxLength:b}=o,v={visible:t,title:p("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(Xn,{value:n,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Pa,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:y,maxLength:b,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:r}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(r),this._is_change&&!t&&(r?n?a?.fetch?.api&&this.getSearchHelperTableData(r).then((e=>this.resetSearchHelperValue(e,r))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(r):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:r}=e.target;!t&&this.openSearchHelper(r)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):ae((()=>this.clearSearchHelperValue())))}}),l().createElement(cr,v,l().createElement(rd,x)))}}Oa(ka,"contextType",mr);class Aa extends i.Component{constructor(e,{$$form:t}){super(e),Oa(this,"context",void 0),Oa(this,"promiseRef",void 0),Oa(this,"searchRef",void 0),Oa(this,"state",{searchHelper:{}}),Oa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Oa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[]}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(ka,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(i,t)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:ce(u.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Oa(Aa,"contextType",mr);const La=Aa;function Fa(){return Fa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fa.apply(null,arguments)}function _a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Da=e=>{class t extends i.Component{constructor(...e){super(...e),_a(this,"startClick",void 0),_a(this,"event1",null),_a(this,"event2",null),_a(this,"$el",null),_a(this,"omitClassNames",[]),_a(this,"state",{clickOutside:!1}),_a(this,"mousedownHandler",(e=>{this.startClick=e})),_a(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),_a(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),l=this.$el===r,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(r)))||o.includes(n);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),_a(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),_a(this,"setOmitClassNames",((e=[])=>{this.omitClassNames=e}))}componentDidMount(){this.event1=Mt()(document,"mousedown",this.mousedownHandler),this.event2=Mt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:r}=this.state;return l().createElement(e,Fa({ref:t},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return _a(t,"displayName",`OutsideClick(${e.displayName||e.name})`),l().forwardRef(((e,r)=>l().createElement(t,Fa({},e,{forwardedRef:r}))))},Ha=require("rc-trigger");var $a,qa,Ma=n.n(Ha);function Ka(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Va=Da((qa=class extends i.Component{constructor(e){super(e),Ka(this,"context",void 0),Ka(this,"searchRef",l().createRef()),Ka(this,"_records",[]),Ka(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Ka(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Ka(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||me("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||me("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Ka(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Ka(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ka(this,"setItemList",(e=>{this.setState({itemList:e})})),Ka(this,"setRecords",(e=>{this._records=e})),Ka(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Ka(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Ka(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ka(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:r}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[r]))),...e],r));const n=this.recordsToDict();this.setItemList(n),this.triggerChange(n.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Ka(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,Q.isEqual)(r,n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:l,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(le(c))return this.setRecords([]);this.setState({loading:!0});try{const o=await r(a({...n,keys:c}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,Q.get)(o.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),l?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:y,maxTagTextLength:b}=s,v={visible:t,title:p("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,Q.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),C=l().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=Ee("form-multiple-search-helper"),{size:N}=e.context,T={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const I=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Xn,{value:I,bordered:m}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ma(),{popupVisible:!g&&r,popup:C,popupClassName:xe()(T),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:yn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(O.Select,{mode:"multiple",maxTagCount:y?"responsive":void 0,maxTagTextLength:b,open:!1,value:i,placeholder:u,loading:n,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(O.Button,{className:"ant-input-search-button",disabled:g,icon:l().createElement(Ce.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(cr,v,l().createElement(rd,x)))}},Ka(qa,"contextType",mr),$a=qa))||$a;class ja extends i.Component{constructor(e,{$$form:t}){super(e),Ka(this,"context",void 0),Ka(this,"promiseRef",void 0),Ka(this,"state",{searchHelper:{}}),Ka(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Ka(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Va,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:ce(u.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ka(ja,"contextType",mr);const za=ja;function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:Wa}=O.Input;class Ua extends i.Component{constructor(e){super(e),Ba(this,"context",void 0),Ba(this,"valueKey",void 0),Ba(this,"_record",void 0),Ba(this,"_prevValue",null),Ba(this,"state",{visible:!1,loading:!1}),Ba(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Ba(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ba(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||me("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||me("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&me("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Ba(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Ba(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Ba(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(!e||le(d))return this._prevValue=void 0;this.setState({loading:!0});try{const l=await e(r({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&In(t,this.alias,s),c&&Rn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Tn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),Ba(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Tn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Tn(e,this.extras[r])})})),Ba(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ba(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Tn(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Tn(e,this.extras[r])});const n=Tn(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Ba(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),Ba(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Ba(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:t,loading:r}=this.state,{value:n=""}=this.props,{type:a,fieldName:i,options:o={},searchHelper:s={},style:c={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:y,maxLength:b}=o,v={visible:t,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,Q.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?l().createElement(Xn,{value:n,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Wa,{ref:e=>this[`${a}_Ref`]=e,value:n,title:n,loading:r,placeholder:d,style:c,prefix:g,suffix:y,maxLength:b,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),l().createElement(cr,v,l().createElement(sd,x)))}}Ba(Ua,"contextType",mr);class Ga extends i.Component{constructor(e,{$$form:t}){super(e),Ba(this,"context",void 0),Ba(this,"promiseRef",void 0),Ba(this,"state",{searchHelper:{}}),Ba(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Ba(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ua,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(i,t)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:ce(u.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ba(Ga,"contextType",mr);const Ya=Ga;var Xa,Qa;function Za(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Ja=Da((Qa=class extends i.Component{constructor(e){super(e),Za(this,"context",void 0),Za(this,"searchRef",l().createRef()),Za(this,"_records",[]),Za(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Za(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),Za(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||me("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||me("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Za(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Za(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Za(this,"setItemList",(e=>{this.setState({itemList:e})})),Za(this,"setRecords",(e=>{this._records=e})),Za(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Za(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Za(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Za(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:r}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[r]))),...e],r));const n=this.recordsToDict();this.setItemList(n),this.triggerChange(n.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Za(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,Q.isEqual)(r,n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:t,visible2:r,loading:n,itemList:a}=this.state,{value:i}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:y,maxTagTextLength:b}=s,v={visible:t,title:p("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,Q.merge)({},c.initialValue),defaultSelectedKeys:i,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=a.filter((e=>i?.includes(e.value))),C=l().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>l().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):l().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),w=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=Ee("form-multiple-tree-table-helper"),{size:N}=e.context,T={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const I=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Xn,{value:I,bordered:m}):l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},l().createElement(Ma(),{popupVisible:!g&&r,popup:C,popupClassName:xe()(T),popupStyle:{minWidth:w},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:yn,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement(O.Select,{mode:"multiple",maxTagCount:y?"responsive":void 0,maxTagTextLength:b,open:!1,value:i,placeholder:u,loading:n,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...d},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},a.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(O.Button,{className:"ant-input-search-button",disabled:g,icon:l().createElement(Ce.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),l().createElement(cr,v,l().createElement(sd,x)))}},Za(Qa,"contextType",mr),Xa=Qa))||Xa;class ei extends i.Component{constructor(e,{$$form:t}){super(e),Za(this,"context",void 0),Za(this,"promiseRef",void 0),Za(this,"state",{searchHelper:{}}),Za(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),Za(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Ja,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(i,r)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:ce(u.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...u}))))}}Za(ei,"contextType",mr);const ti=ei;function ri(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ni=new Array(2).fill("");class ai extends i.Component{constructor(e){super(e),ri(this,"context",void 0),ri(this,"_is_change",!1),ri(this,"_ceho_data",void 0),ri(this,"_records",[]),ri(this,"_is_clear",!1),ri(this,"state",{visible:!1,loading:!1,itemList:[],textValue:ni}),ri(this,"getSearchHelper",ur()((e=>Object.assign({},this.props.helperConfig,e)))),ri(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||me("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||me("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),ri(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ri(this,"setItemList",(e=>{this.setState({itemList:e})})),ri(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ri(this,"setTextValue",(e=>{this.setState({textValue:e})})),ri(this,"setRecords",(e=>{this._records=e})),ri(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),ri(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),ri(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(ni),this.triggerChange([])})),ri(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ri(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??re)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),ri(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,r=le(e)?void 0:e;return{[t]:r}})),ri(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=re,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(ae((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),ri(this,"resetSearchHelperValue",(async(e=[])=>{const{textValue:t}=this.state,{textKey:r}=this.alias,n=e.filter((e=>{const n=e[r]?.toString().toLowerCase();return t.some((e=>n?.includes(e.toLowerCase())))}));if(2===n.length)return this.closeSearchHelper(n);this.openSearchHelper()})),ri(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:r=[]}=this.props;(0,Q.isEqual)(t,r)||(0,Q.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,Q.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=ni.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:t=[]}=this.props,{visible:r,loading:n,textValue:a}=this.state,{fieldName:i,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,f=a.every((e=>Nn(e)))?"":a.join(" - "),g={visible:r,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${Ra[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},y={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${i}`:"",initialValue:(0,Q.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?l().createElement(Xn,{value:f,bordered:d}):l().createElement(l().Fragment,null,l().createElement(O.Input.Group,null,l().createElement(O.Input,{value:a[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),l().createElement(O.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),l().createElement(O.Input.Search,{value:a[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:n,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!r&&(t?a.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([a[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),l().createElement(cr,g,l().createElement(fd,y)))}}ri(ai,"contextType",mr);class ii extends i.Component{constructor(e,{$$form:t}){super(e),ri(this,"context",void 0),ri(this,"promiseRef",void 0),ri(this,"state",{searchHelper:{}}),ri(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),ri(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(c),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(p)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(ai,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(i,r)}}))),u&&l().createElement(O.Col,null,e.renderFormItemButton(i,u)),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...d}))))}}ri(ii,"contextType",mr);const li=ii;function oi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const si=e=>{const{$$form:t}=l().useContext(mr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=le(m)?n:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?l().createElement(Xn,{value:h(r),bordered:c}):l().createElement(O.Checkbox.Group,{value:r,style:{width:"100%",...s},disabled:u,onChange:e=>{(e=>{a?.(e),i(e,h(e))})(e)}},p.map((e=>l().createElement(O.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ci extends i.Component{constructor(...e){super(...e),oi(this,"context",void 0),oi(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(p)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(si,{option:this.props.option,items:t,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),u&&l().createElement(O.Col,{flex:ce(u.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...u}))))}}oi(ci,"contextType",mr);const di=ci;function ui(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const mi=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=t.isFormDisabled}=e.option,{allowHalf:u,count:m=5,tooltips:p}=i;return l().createElement(O.Rate,{value:r,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;n?.(e),a(e,(t=e,p?p[Math.ceil(t)-1]:t.toString()))})(e)}})};class pi extends i.Component{constructor(...e){super(...e),ui(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(mi,{option:this.props.option,onValuesChange:(t,r)=>{p(t),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}ui(pi,"contextType",mr);const hi=pi;function fi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gi=e=>{const{$$form:t}=l().useContext(mr),{value:r,items:n,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=t.isFormDisabled}=e.option,{itemList:m=[]}=o,p=le(m)?n:m,h=e=>p.find((t=>t.value===e))?.text??"";return t.isOnlyShow?l().createElement(Xn,{value:h(r),bordered:c}):l().createElement(O.Radio.Group,{value:r,style:{width:"100%",...s},disabled:u||t.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e,h(e))})(t)}},p.map((e=>l().createElement(O.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class yi extends i.Component{constructor(...e){super(...e),fi(this,"context",void 0),fi(this,"state",{itemList:[]}),fi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(p)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(gi,{option:this.props.option,items:t,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),u&&l().createElement(O.Col,{flex:ce(u.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...u}))))}}fi(yi,"contextType",mr);const bi=yi;function vi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const xi=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=hn,trueValue:p=pn}=o,{t:h}=G();return l().createElement(l().Fragment,null,l().createElement(O.Switch,{checked:r===p,style:s,disabled:d||t.isOnlyShow,checkedChildren:l().createElement(Ce.CheckOutlined,null),unCheckedChildren:l().createElement(Ce.CloseOutlined,null),onChange:e=>{(e=>{n?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(e?p:m)}}),u?l().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},i):null)};class Ei extends i.Component{constructor(...e){super(...e),vi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option,{labelToSwitch:h}=o;return l().createElement(O.Form.Item,{label:h?" ":e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(xi,{option:this.props.option,onValuesChange:(t,r)=>{p(t),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}vi(Ei,"contextType",mr);const Ci=Ei;function wi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Si=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{options:o={},style:s={},placeholder:c=i("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:m,disabled:p,onBlur:h,onEnter:f}=e.option,{showCount:g,maxLength:y,autoSize:b}=o,v=Object.assign({},{minRows:1,maxRows:3},b);return l().createElement(O.Input.TextArea,{value:r,placeholder:c,style:s,maxLength:y,showCount:g,autoSize:v,bordered:d,allowClear:u,readOnly:m||t.isOnlyShow,disabled:p,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h?.(r,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f?.(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{n?.(e),a(e)})(t)}})};class Ni extends i.Component{constructor(...e){super(...e),wi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Si,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}wi(Ni,"contextType",mr);const Ti=Ni;function Ii(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ri=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.datePlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:y,disabledDate:b,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=s,C=l().createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),n?.(e),a(e,S(e))},S=e=>Nn(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Sn(c()().subtract(e,"day"),vn[g]);"date"===g&&(t=t.slice(0,10)),w(t),C.current.blur(),C.current.focus()};return t.isOnlyShow?l().createElement(Xn,{value:S(r),bordered:m}):l().createElement(_,{ref:C,style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:bn[g],format:y,bordered:m,showToday:!1,showTime:"datetime"===g&&{defaultValue:c()("00:00:00","HH:mm:ss")},allowClear:p,disabled:f,inputReadOnly:h,disabledDate:b??(e=>((e,[t,r])=>t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day"))(e,[v,x])),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():l().createElement(l().Fragment,null,l().createElement(O.Tag,{color:"processing",onClick:()=>N(0)},i("qm.form.datePickers")[0]),l().createElement(O.Tag,{color:"processing",onClick:()=>N(1)},i("qm.form.datePickers")[1]),l().createElement(O.Tag,{color:"processing",onClick:()=>N(7)},i("qm.form.datePickers")[2]),l().createElement(O.Tag,{color:"processing",onClick:()=>N(30)},i("qm.form.datePickers")[3])):void 0,value:wn(r,vn[g]),onChange:(e,t)=>{w(Sn(e,vn[g]))}})};class Oi extends i.Component{constructor(...e){super(...e),Ii(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ri,{option:this.props.option,onValuesChange:(t,r)=>{p(t),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ii(Oi,"contextType",mr);const Pi=Oi;function ki(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ai=e=>[c()().subtract(e,"day"),c()()],Li=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:d={},placeholder:u=i("qm.form.daterangePlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f=t.isFormDisabled}=e.option,{dateType:g="date",format:y,disableds:b=[!1,!1],allowEmpty:v,disabledDate:x,minDateTime:E,maxDateTime:C,shortCuts:w=!0}=s,S={[i("qm.form.dateRangePickers")[0]]:Ai(7),[i("qm.form.dateRangePickers")[1]]:Ai(30),[i("qm.form.dateRangePickers")[2]]:Ai(90),[i("qm.form.dateRangePickers")[3]]:Ai(180)},N=e=>Nn(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?l().createElement(Xn,{value:N(r),bordered:m}):l().createElement(_.RangePicker,{style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:bn[g],format:y,bordered:m,showTime:"datetime"===g&&{defaultValue:[c()("00:00:00","HH:mm:ss"),c()("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:v,disabled:f?[!0,!0]:b,inputReadOnly:h,disabledDate:x??(e=>((e,[t,r])=>t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day"))(e,[E,C])),ranges:w&&g.includes("date")?S:void 0,value:le(r)?null:[wn(r?.[0],vn[g]),wn(r?.[1],vn[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),n?.(e),a(e,N(e))})([Sn(e?.[0],vn[g]),Sn(e?.[1],vn[g])])}})};class Fi extends i.Component{constructor(...e){super(...e),ki(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Li,{option:this.props.option,onValuesChange:(t,r)=>{p(t),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}ki(Fi,"contextType",mr);const _i=Fi;function Di(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Hi=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:y=1,secondStep:b=1}=s;return t.isOnlyShow?l().createElement(Xn,{value:r,bordered:u}):l().createElement(q,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:y,secondStep:b,allowClear:m,disabled:h,inputReadOnly:p,format:xn[f],value:wn(r,xn[f]),onChange:(e,t)=>{(e=>{const t=Sn(e,xn[f]);n?.(t),a(t)})(e)}})};class $i extends i.Component{constructor(...e){super(...e),Di(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Hi,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Di($i,"contextType",mr);const qi=$i;function Mi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ki=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h=t.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:y,hourStep:b=1,minuteStep:v=1,secondStep:x=1}=s,E=e=>Nn(e)?"":e.join(" - ");return t.isOnlyShow?l().createElement(Xn,{value:E(r),bordered:u}):l().createElement(q.RangePicker,{style:{width:"100%",...c},popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:b,minuteStep:v,secondStep:x,allowClear:m,allowEmpty:y,disabled:h?[!0,!0]:g,inputReadOnly:p,format:xn[f],value:le(r)?null:[wn(r?.[0],xn[f]),wn(r?.[1],xn[f])],onChange:(e,t)=>{(e=>{const t=[Sn(e?.[0],xn[f]),Sn(e?.[1],xn[f])];n?.(t),a(t,E(t))})(e)}})};class Vi extends i.Component{constructor(...e){super(...e),Mi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Ki,{option:this.props.option,onValuesChange:(t,r)=>{p(t),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Mi(Vi,"contextType",mr);const ji=Vi;function zi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bi extends i.Component{constructor(e){super(e),zi(this,"context",void 0),zi(this,"searchRef",l().createRef()),zi(this,"valueKey",void 0),zi(this,"_clicking",!1),zi(this,"_record",void 0),zi(this,"_prevValue",null),zi(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),zi(this,"getSearchHelper",ur()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),zi(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(n||me("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||me("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&me("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&me("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),zi(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),zi(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},d=this.getItemValue();if(e){if(le(d))return this._prevValue=void 0;try{const l=await e(r({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&In(t,this.alias,s),c&&Rn(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=d,i){const e=Tn(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}}})),zi(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=Tn(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Tn(e,this.extras[r])})})),zi(this,"fetchHandle",(0,Q.debounce)(this.getItemList,200)),zi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),zi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),zi(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),zi(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Tn(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Tn(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Tn(e,this.alias[n]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,Q.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const l=await r(a({...n,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:t,loading:r,itemList:n,inputText:a}=this.state,{value:i}=this.props,{fieldName:s,options:c={},style:d={},placeholder:u=p("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{listHeight:y=fn}=c,{hideHeader:b,onlySelect:v=!0}=this.searchHelper||c,x=this.searchHelper.columns||[],E=Ee("form-immediate"),C=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,w=l().createElement(O.Spin,{spinning:r},n.length?l().createElement("table",{cellSpacing:0,cellPadding:0,className:xe()("table")},!b&&l().createElement("thead",null,l().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>l().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),l().createElement("tbody",null,n.map(((e,t)=>l().createElement("tr",{key:t,className:this.state.activeIndex===t?"active":"",onMouseEnter:()=>{this.setState({activeIndex:t})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((t=>l().createElement("td",{key:t.dataIndex},(0,Q.get)(e,t.dataIndex))))))))):l().createElement(ct,null));return l().createElement(o.Consumer,null,(r=>{const o={[E]:!0,[`${E}--lg`]:"large"===r?.size,[`${E}--sm`]:"small"===r?.size};return e.isOnlyShow?l().createElement(Xn,{value:i,bordered:m}):l().createElement(Ma(),{action:g?[]:["click"],popupVisible:!g&&t,popup:w,popupClassName:xe()(o,`form-popper__${s}`),popupStyle:{minWidth:C,maxHeight:y},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(O.Input,{ref:this.searchRef,placeholder:u,allowClear:h,bordered:m,readOnly:f,disabled:g,style:{width:"100%",...d},value:a??i,title:i,onFocus:()=>{!n.length&&this.fetchHandle(i)},onBlur:e=>{v&&!this._clicking&&a!==i&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(n[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const r=40===e.keyCode?++t%n.length:(--t+n.length)%n.length;this.setState({activeIndex:r})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),v?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}})))}))}}zi(Bi,"contextType",mr);class Wi extends i.Component{constructor(e,{$$form:t}){super(e),zi(this,"context",void 0),zi(this,"promiseRef",void 0),zi(this,"state",{searchHelper:{}}),zi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){ue("Form","搜索帮助获取定义信息的接口出错")}})),zi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return me("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Fn(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:r,label:n,tooltip:a,fieldName:i,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(n),className:xe()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ce(c)},required:e.getFormItemRequired(h)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:i,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},l().createElement(Bi,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="",r)=>{f(t,r),e.setViewValue(i,t)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:ce(u.labelWidth||mn)},e.renderFormItemExtra({fieldName:i,...u}))))}}zi(Wi,"contextType",mr);const Ui=Wi;function Gi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Yi extends i.Component{constructor(...e){super(...e),Gi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,fieldName:n,className:a,style:i={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:d=[],onCollapse:u=te}=o,m=[];if(d.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===n))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=d.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&m.push({...t,text:`${n}${a}`})}))}return l().createElement(O.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},l().createElement(Se,{id:n,label:r,className:a,extra:m.map((e=>e.text)).join(" | "),style:{...i},collapse:s[n],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[n]:t})}))),u(t)}}))}}Gi(Yi,"contextType",mr);const Xi=Yi;function Qi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zi(){return Zi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zi.apply(null,arguments)}const Ji=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Ji(e.children,t,r,n)}:e)),el=e=>{const{$$form:t}=l().useContext(mr),{value:r,items:n,multiple:a,loading:i,onChange:o,onValuesChange:s}=e,{t:c}=G(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,asyncLoad:g,readOnly:y,disabled:b}=e.option,{itemList:v,filterable:x=!0,listHeight:E=fn,checkStrictly:C,checkStrategy:w="SHOW_CHILD",collapseTags:S,defaultExpandAll:N=!g,defaultExpandedKeys:T,dropdownStyle:I,openPyt:R=!0}=u,[P,k]=l().useState(le(v)?n:v),A=l().useRef(P);De((()=>{const e=le(v)?n:v;g?(0,Q.isEqual)(e,A.current)||(k(e),A.current=e):k(e)}),[v,n]);const L=e=>Pn(P,e)?.text||e?.toString()||"",F=e=>a?e?.map((e=>L(e))).join(",")||"":L(e);return t.isOnlyShow?l().createElement(Xn,{value:F(r),bordered:h}):l().createElement(O.TreeSelect,Zi({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:a,treeCheckable:a,treeCheckStrictly:C,showCheckedStrategy:O.TreeSelect[w],popupClassName:`form-popper__${d}`,dropdownStyle:I,placeholder:p,listHeight:E,style:m,loading:i,bordered:h,allowClear:f,disabled:b,treeDefaultExpandAll:N,treeDefaultExpandedKeys:T,showSearch:x,maxTagCount:S?"responsive":void 0,loadData:g?async({key:e,children:t})=>{if(!g||t)return;const{fetchApi:r,params:n,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=g;if(r)try{const t=await r(s({...n,[l]:e}));if(200===t.code){const r=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[],n=Ji(P,e,l,On(r,l,i));k(n),o?.(r)}}catch(e){}}:void 0,treeData:P},a?{title:F(r)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,F(e),P)})(e)}}))};class tl extends i.Component{constructor(...e){super(...e),Qi(this,"context",void 0),Qi(this,"state",{itemList:[],loading:!1}),Qi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=On(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:r}=this.state,{type:n,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:xe()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(h)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(el,{option:this.props.option,items:t,loading:r,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),m&&l().createElement(O.Col,{flex:ce(m.labelWidth||mn)},e.renderFormItemExtra({fieldName:o,...m}))))}}Qi(tl,"contextType",mr);const rl=tl;function nl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function al(){return al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},al.apply(null,arguments)}const il=e=>{const{$$form:t}=l().useContext(mr),{value:r,multiple:n,items:a}=e,{t:i}=G(),{fieldName:o,options:s={},style:c={},placeholder:d=i("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,asyncLoad:p,readOnly:h,disabled:f}=e.option,{itemList:g,changeOnSelect:y,checkStrictly:b,checkStrategy:v="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:C=!0}=s,[w,S]=l().useState(le(g)?a:g),N=l().useRef(w);De((()=>{const e=le(g)?a:g;p?(0,Q.isEqual)(e,N.current)||(S(e),N.current=e):S(e)}),[g,a]);const T=e=>kn(w,e??"").map((e=>e.text)).join("/"),I=e=>n?e?.map((e=>T(e))).join(",")||"":T(e);return t.isOnlyShow?l().createElement(Xn,{value:I(r),bordered:u}):l().createElement(O.Cascader,al({value:(e=>le(e)?[]:n?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:w,multiple:n,maxTagCount:"responsive",changeOnSelect:y||b,showCheckedStrategy:O.Cascader[v],popupClassName:`form-popper__${o}`,dropdownStyle:E,placeholder:d,style:c,bordered:u,allowClear:m,disabled:f,showSearch:x&&!p&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?async e=>{const t=e[e.length-1];if(!p||t.children)return;const{fetchApi:r,params:n,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=p;if(r)try{const e=await r(s({...n,[l]:t.value}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[],n=Ji(w,t.value,l,On(r,l,i));S(n),o?.(r)}}catch(e){}}:void 0},n?{title:I(r)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,I(t),w)})(((e=[])=>n?e.map((e=>e.join(","))):e.join(","))(t))}}))};class ll extends i.Component{constructor(...e){super(...e),nl(this,"context",void 0),nl(this,"state",{itemList:[],loading:!1}),nl(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[],r=On(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,Q.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(a),className:xe()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ce(d)},required:e.getFormItemRequired(h)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},l().createElement(il,{option:this.props.option,multiple:t,items:r,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),m&&l().createElement(O.Col,{flex:ce(m.labelWidth||mn)},e.renderFormItemExtra({fieldName:o,...m}))))}}nl(ll,"contextType",mr);const ol=ll,sl=require("china-area-data");var cl=n.n(sl);function dl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ul=["110000","120000","310000","500000"],ml=["810000","820000"],pl=[{text:"A",value:"A"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"L",value:"L"},{text:"N",value:"N"},{text:"Q",value:"Q"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],hl=[{text:"A",value:"A"},{text:"B",value:"B"},{text:"C",value:"C"},{text:"D",value:"D"},{text:"E",value:"E"},{text:"F",value:"F"},{text:"G",value:"G"},{text:"H",value:"H"},{text:"J",value:"J"},{text:"K",value:"K"},{text:"L",value:"L"},{text:"M",value:"M"},{text:"N",value:"N"},{text:"P",value:"P"},{text:"Q",value:"Q"},{text:"R",value:"R"},{text:"S",value:"S"},{text:"T",value:"T"},{text:"W",value:"W"},{text:"X",value:"X"},{text:"Y",value:"Y"},{text:"Z",value:"Z"},{text:"直辖市",value:"Z1"},{text:"港澳",value:"Z2"}],fl=e=>Gn.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),gl=(e,t,r=1)=>{if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...ul,...ml].includes(e))):Object.keys(e[t])).map((n=>({l:fl(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:gl(e,n,r+1)})))},yl=(e,t)=>t.map((t=>({l:fl(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class bl extends i.Component{constructor(e){super(e),dl(this,"context",void 0),dl(this,"searchRef",l().createRef()),dl(this,"scrollRef",l().createRef()),dl(this,"zxsAndGa",void 0),dl(this,"provinces",void 0),dl(this,"allCities",void 0),dl(this,"letterCities",void 0),dl(this,"state",{visible:!1,select_type:"0",active_key:""}),dl(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),dl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Vt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:yl(cl(),ul)},{l:"Z2",n:"港澳",c:"",p:"",children:yl(cl(),ml)}]}createProvince(){return(gl(cl(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return hl.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...ul,...ml].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return l().createElement(O.Radio.Group,{size:"small",buttonStyle:"solid",value:e,onChange:e=>{const{value:t}=e.target;this.setState({select_type:t,active_key:""},(()=>{this.scrollRef.current.scrollTop=0}))}},l().createElement(O.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),l().createElement(O.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:t}=this.state;return("0"===t?pl:hl).map((t=>l().createElement("li",{key:t.value,className:xe()({tag:!0,actived:t.value===e}),onClick:()=>this.scrollHandle(t.value.toString())},t.text)))}renderSelect(){const{value:e}=this.props;return l().createElement(O.Select,{size:"small",placeholder:p("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>l().createElement(O.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:t}=this.state;return("0"===t?this.provinces:this.letterCities).map(((t,r)=>l().createElement("div",{key:r},l().createElement("dt",{ref:e=>this[`${t.l}Ref`]=e},t.n,":"),l().createElement("dd",null,t.children?.map((t=>l().createElement("li",{key:t.c,className:xe()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=Ee("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(r),y=l().createElement("div",{className:"container",style:{...i}},l().createElement("div",{className:"city-drop"},l().createElement("div",{className:"city-drop-toper"},l().createElement("div",{className:"city-drop-toper__type"},this.renderType()),l().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),l().createElement("div",{className:"city-drop-letter"},this.renderLetter()),l().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},l().createElement("dl",null,this.renderCity(r)))));return l().createElement(o.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?l().createElement(Xn,{value:g,bordered:c}):l().createElement(Ma(),{action:m?[]:["click"],popupVisible:!m&&t,popup:y,popupClassName:xe()(a,`form-popper__${n}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(O.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,readOnly:u,disabled:m,style:{width:"100%",...i},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}dl(bl,"contextType",mr);class vl extends i.Component{constructor(...e){super(...e),dl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(bl,{option:this.props.option,onValuesChange:(t,r)=>{p(t,r),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}dl(vl,"contextType",mr);const xl=vl;function El(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Cl=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:Cl(e,r)})))};class wl extends i.Component{constructor(e){super(e),El(this,"context",void 0),El(this,"searchRef",l().createRef()),El(this,"prevText",void 0),El(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),El(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Cl(cl(),"86")||[];this.state={results:t,visible:!1,values:[],tabs:[t.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=Pn(e,t[n]);if(a&&le(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[l],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,t=this.state.tabs.map(((t,r)=>{const n=t.find((t=>t.value===e[r]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[r]})`;return l().createElement(Jt.TabPane,{key:r.toString(),tab:n},l().createElement("div",{className:"region-box"},t.map((t=>l().createElement("span",{key:t.value,className:xe()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[r]=t.value.toString(),e=e.slice(0,r+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(r+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(r+1)}))}},t.text)))))}));return t.length?l().createElement(Jt,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):l().createElement(ct,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:r}=this.props,{fieldName:n,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=Ee("form-region-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=l().createElement("div",{className:"container"},this.renderTabs());let y=this.prevText;if(!t){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(y=e,this.prevText=y)}return l().createElement(o.Consumer,null,(r=>{const a={[h]:!0,[`${h}--lg`]:"large"===r?.size,[`${h}--sm`]:"small"===r?.size};return e.isOnlyShow?l().createElement(Xn,{value:y,bordered:c}):l().createElement(Ma(),{action:m?[]:["click"],popupVisible:!m&&t,popup:g,popupClassName:xe()(a,`form-popper__${n}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:yn,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("div",null,l().createElement(O.Input,{ref:this.searchRef,placeholder:s,allowClear:d,bordered:c,style:{width:"100%",...i},readOnly:u,disabled:m,value:y,title:y,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&ae((()=>this.initial()))}})))}))}}El(wl,"contextType",mr);class Sl extends i.Component{constructor(...e){super(...e),El(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(wl,{option:this.props.option,onValuesChange:(t,r)=>{p(t,r),e.setViewValue(a,r)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}El(Sl,"contextType",mr);const Nl=Sl;function Tl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Il=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:y,onPreview:b,onDownload:v,onRemove:x,onSortChange:E,onEditChange:C}=i,{action:w,headers:S,params:N,withCredentials:T=!1,dataKey:I="",downloadWithHeaders:R,fieldAliasMap:P,beforeUpload:k,button:A}=o,L="function"==typeof P?P():P||{},{t:F}=G();return l().createElement(uo,{name:"file",action:w,multiple:d,headers:S,data:N,withCredentials:T,downloadWithHeaders:R,beforeUpload:k,maxCount:u,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:l().createElement(Ce.DownloadOutlined,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in L)r[n]=e[n]||t.data?.[L[n]]||"";return e.response&&200!==t.code&&O.message.error(t.message||F("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(I?(0,Q.get)(t.data,I):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onPreview:b,onDownload:v,onRemove:x,onSortChange:E,onEditChange:C})};class Rl extends i.Component{constructor(...e){super(...e),Tl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(Il,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Tl(Rl,"contextType",mr);const Ol=Rl;function Pl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kl=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:y,onRemove:b,onSortChange:v}=i,{action:x,headers:E,params:C,withCredentials:w=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,R="function"==typeof T?T():T||{},{t:P}=G();return l().createElement(fo,{name:"file",action:x,multiple:d,headers:E,data:C,withCredentials:w,popupClassName:N,beforeUpload:I,maxCount:u,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&O.message.error(t.message||P("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(S?(0,Q.get)(t.data,S):t.data)||"",status:e.status}}));n?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onRemove:b,onSortChange:v})};class Al extends i.Component{constructor(...e){super(...e),Pl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(kl,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Pl(Al,"contextType",mr);const Ll=Al;function Fl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _l=e=>{const{$$form:t}=l().useContext(mr),{value:r,onChange:n,onValuesChange:a}=e,{options:i={},upload:o,style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{tinymce:u,thresholdSize:m,onResizeEditor:p}=i;return l().createElement(io,{value:r,tinymce:u,upload:o,thresholdSize:m,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{n?.(e),a(e)})(e)}})};class Dl extends i.Component{constructor(...e){super(...e),Fl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:r,tooltip:n,fieldName:a,invisible:i,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=te}=this.props.option;return l().createElement(O.Form.Item,{label:e.renderFormLabel(r),className:xe()(c),tooltip:n,hidden:i,labelCol:{flex:e.verticalLayout?"initial":ce(s)},required:e.getFormItemRequired(m)},l().createElement(O.Row,{wrap:!1,gutter:4},l().createElement(O.Col,{flex:"auto"},l().createElement(O.Form.Item,{name:a,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},l().createElement(_l,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:ce(d.labelWidth||mn)},e.renderFormItemExtra({fieldName:a,...d}))))}}Fl(Dl,"contextType",mr);const Hl=Dl;function $l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ql extends i.Component{constructor(e){super(e),$l(this,"context",void 0),$l(this,"provide",{$$form:this,echo_data:{}}),$l(this,"_initialValues",void 0),$l(this,"_initialOthers",void 0),$l(this,"_initialExtras",void 0),$l(this,"_fieldAuth",{}),$l(this,"wrapperRef",l().createRef()),$l(this,"formRef",l().createRef()),$l(this,"originItems",[]),$l(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),$l(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),$l(this,"resizeListenerHandle",(0,Q.debounce)(this.resizeObserveHandler,10)),$l(this,"getFormItems",ur()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),$l(this,"getFlattenItems",ur()((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{(0,Q.isPlainObject)(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t}))),$l(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),$l(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),$l(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),$l(this,"finishFailedHandle",(({values:e,errorFields:t})=>{this.props.onFinishFailed?.(t)})),$l(this,"openValidateInfo",(e=>{const t=l().createElement("ul",null,e.map((e=>{const{label:t}=this.formItems.find((t=>t.fieldName===e.name[0]));return l().createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof t?`${t}: `:"")+e.errors.join(","),"]")})));O.notification.error({message:p("qm.form.validatePrompt"),description:t,duration:10})})),$l(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Vt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){yt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){bt(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&me("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(e=[]){return e.some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,Q.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,Q.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,gn.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??hn),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}createOriginItems(){this.originItems=se(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){e!==this.state.collapse&&(this.setState({collapse:e}),this.props.onCollapse?.(e),ae((()=>this.props.onCollapse?.(e))))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if(An(e))return Ln(e);if((0,Q.isPlainObject)(e)){const{fieldName:t,label:r,options:n={}}=e;if(An(r))return Ln(r);const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){if("DIVIDER"===e)return!0;const r=this.getBlockDerivedItems();for(let e=0,n=r.length;e<n;e++){const n=r[e],a=this.dividers.find((e=>e.fieldName===n[0].fieldName)),i=a?.collapse?.showLimit??n.length-1;for(let e=1;e<n.length;e++)if(n[e].fieldName===t&&e>i)return this.state.expand[n[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(Nn(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Nn(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)le(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=oe(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,Q.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:a=1,disabled:i,secretName:l}=n;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},t.options=Object.assign({},t.options,{secretType:l})),this.setFieldAuth(r,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return l().createElement(pa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return l().createElement(ya,{option:e})}INPUT_NUMBER(e){return l().createElement(wa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return l().createElement(Ia,{option:e})}SEARCH_HELPER(e){return l().createElement(La,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return l().createElement(za,{option:e})}TREE_TABLE_HELPER(e){return l().createElement(Ya,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return l().createElement(ti,{option:e})}RANGE_SEARCH_HELPER(e){return l().createElement(li,{option:e})}CHECKBOX(e){return l().createElement(la,{option:e})}MULTIPLE_CHECKBOX(e){return l().createElement(di,{option:e})}RATE(e){return l().createElement(hi,{option:e})}RADIO(e){return l().createElement(bi,{option:e})}SWITCH(e){return l().createElement(Ci,{option:e})}TEXT_AREA(e){return l().createElement(Ti,{option:e})}DATE(e){return l().createElement(Pi,{option:e})}RANGE_DATE(e){return l().createElement(_i,{option:e})}TIME(e){return l().createElement(qi,{option:e})}RANGE_TIME(e){return l().createElement(ji,{option:e})}SELECT(e){return l().createElement(ra,{option:e})}MULTIPLE_SELECT(e){return l().createElement(ra,{option:e,multiple:!0})}IMMEDIATE(e){return l().createElement(Ui,{option:e})}DIVIDER(e){return l().createElement(Xi,{option:e})}TREE_SELECT(e){return l().createElement(rl,{option:e})}MULTIPLE_TREE_SELECT(e){return l().createElement(rl,{option:e,multiple:!0})}CASCADER(e){return l().createElement(ol,{option:e})}MULTIPLE_CASCADER(e){return l().createElement(ol,{option:e,multiple:!0})}CITY_SELECT(e){return l().createElement(xl,{option:e})}REGION_SELECT(e){return l().createElement(Nl,{option:e})}UPLOAD_FILE(e){return l().createElement(Ol,{option:e})}UPLOAD_IMG(e){return l().createElement(Ll,{option:e})}TINYMCE(e){return l().createElement(Hl,{option:e})}renderFormLabel(e){if(An(e)||!(0,Q.isPlainObject)(e))return e;const{type:t,fieldName:r,label:n,options:a={},onChange:i=te}=e,{itemList:o=[]}=a;return"SELECT"===t?l().createElement(O.Form.Item,{name:r,noStyle:!0},l().createElement(ea,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>i(e,t)})):"CHECKBOX"===t?l().createElement(l().Fragment,null,l().createElement("span",{style:{paddingRight:5}},n),l().createElement(O.Form.Item,{name:r,noStyle:!0},l().createElement(aa,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:r,style:n={},render:a}=e,{extra:i}=this.state;if(r)return l().createElement(O.Tooltip,{className:"extra-tooltip",title:i[t]},l().createElement(Ce.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===t));return l().createElement("div",{className:"extra-text",title:a?"":i[t],style:n},l().createElement("span",{className:"extra-overflow-cut"},a?a(o,this):i[t]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:t,fieldName:r,invisible:n,tooltip:a,className:i,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return l().createElement(O.Form.Item,{label:this.renderFormLabel(t),name:r,rules:c,tooltip:a,hidden:n,className:xe()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":ce(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},u?.(e,this))}createFormItem(e){return(0,Q.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(me("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:t,defaultRows:r,isFieldsDefine:n}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<r;e++)a.push({})}));const i=24/e,o=[],s=a.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return o.push(n),n}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=a.map(((t,r)=>{let{selfCol:n=1}=t;const{type:a,fieldName:s}=t;n=n>=24||"DIVIDER"===a||"TINYMCE"===a?e:n;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(o[r]),l().createElement(O.Col,{key:s??r,className:s,span:n*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},a?this.createFormItem(se(t)):null)}));return n&&"default"===t&&u.push(l().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:t,collapse:r}=this.state,{searchButtonCols:n,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/t,s=n||1,c=t-e%t-s;return a?l().createElement(O.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},l().createElement(O.Space,{style:{marginBottom:12}},l().createElement(fe,{type:"primary",size:this.$size,icon:l().createElement(Ce.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),l().createElement(fe,{size:this.$size,icon:l().createElement(Ce.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),i?this.createFieldsDefine():null,this.showFilterCollapse&&l().createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)," ",p(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const n=24/e;return r&&"default"===t?l().createElement(O.Row,{gutter:0},l().createElement(O.Col,{key:"-",span:n},l().createElement(O.Form.Item,null,l().createElement(O.Space,{style:{marginBottom:12}},l().createElement(fe,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),l().createElement(fe,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:r}=this.props;return l().createElement(ca,{uniqueKey:e,items:t,fieldsChange:r})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[p("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){me("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return me("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,Q.isPlainObject)(t))return me("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return me("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,Q.set)(i,r,t[r]));r&&(a?a([...n]):me("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:r,disabled:n,labelWidth:a,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=Ee("form"),d={required:"${label}"+p("qm.form.requiredTips")},u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return l().createElement("div",{ref:this.wrapperRef,className:xe()(u,e),style:t},l().createElement(O.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:i,labelWrap:o,colon:!1,disabled:n,labelCol:{flex:this.verticalLayout?"initial":ce(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},l().createElement(mr.Provider,{value:this.provide},l().createElement(O.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}$l(ql,"contextType",o),$l(ql,"propTypes",En),$l(ql,"defaultProps",Cn);const Ml=ql,Kl={onActivate:cn.func,onAddUndo:cn.func,onBeforeAddUndo:cn.func,onBeforeExecCommand:cn.func,onBeforeGetContent:cn.func,onBeforeRenderUI:cn.func,onBeforeSetContent:cn.func,onBeforePaste:cn.func,onBlur:cn.func,onChange:cn.func,onClearUndos:cn.func,onClick:cn.func,onContextMenu:cn.func,onCommentChange:cn.func,onCopy:cn.func,onCut:cn.func,onDblclick:cn.func,onDeactivate:cn.func,onDirty:cn.func,onDrag:cn.func,onDragDrop:cn.func,onDragEnd:cn.func,onDragGesture:cn.func,onDragOver:cn.func,onDrop:cn.func,onExecCommand:cn.func,onFocus:cn.func,onFocusIn:cn.func,onFocusOut:cn.func,onGetContent:cn.func,onHide:cn.func,onInit:cn.func,onKeyDown:cn.func,onKeyPress:cn.func,onKeyUp:cn.func,onLoadContent:cn.func,onMouseDown:cn.func,onMouseEnter:cn.func,onMouseLeave:cn.func,onMouseMove:cn.func,onMouseOut:cn.func,onMouseOver:cn.func,onMouseUp:cn.func,onNodeChange:cn.func,onObjectResizeStart:cn.func,onObjectResized:cn.func,onObjectSelected:cn.func,onPaste:cn.func,onPostProcess:cn.func,onPostRender:cn.func,onPreProcess:cn.func,onProgressState:cn.func,onRedo:cn.func,onRemove:cn.func,onReset:cn.func,onSaveContent:cn.func,onSelectionChange:cn.func,onSetAttrib:cn.func,onSetContent:cn.func,onShow:cn.func,onSubmit:cn.func,onUndo:cn.func,onVisualAid:cn.func,onSkinLoadError:cn.func,onThemeLoadError:cn.func,onModelLoadError:cn.func,onPluginLoadError:cn.func,onIconsLoadError:cn.func,onLanguageLoadError:cn.func},Vl={apiKey:cn.string,id:cn.string,inline:cn.bool,init:cn.object,initialValue:cn.string,onEditorChange:cn.func,value:cn.string,tagName:cn.string,cloudChannel:cn.string,plugins:cn.oneOfType([cn.string,cn.array]),toolbar:cn.oneOfType([cn.string,cn.array]),disabled:cn.bool,textareaName:cn.string,tinymceScriptSrc:cn.string,rollback:cn.oneOfType([cn.number,cn.oneOf([!1])]),scriptLoading:cn.shape({async:cn.bool,defer:cn.bool,delay:cn.number}),...Kl},jl=e=>"function"==typeof e,zl=e=>e in Kl,Bl=e=>e.substr(2),Wl=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(zl),c=Object.keys(l).filter(zl),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=Bl(e),r=o[t];n(t,r),delete o[t]})),u.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=Bl(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Ul=0;const Gl=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Ul++,e+"_"+r+Ul+String(t)},Yl=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Xl=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Ql=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Zl=()=>({listeners:[],scriptId:Gl("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Jl=(()=>{let e=Zl();return{load:(t,r,n,a,i,l)=>{const o=()=>((t,r,n,a,i,l)=>{const o=r.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),r.head&&r.head.appendChild(o)})(e.scriptId,t,r,n,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Zl()}}})(),eo=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function to(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ro extends i.Component{constructor(e){super(e),to(this,"editor",void 0),to(this,"id",void 0),to(this,"elementRef",void 0),to(this,"inline",void 0),to(this,"currentContent",void 0),to(this,"boundHandlers",void 0),to(this,"rollbackTimer",void 0),to(this,"valueCursor",void 0),to(this,"rollbackChange",(()=>{const e=this.editor,t=this.props.value;e&&t&&t!==this.currentContent&&e.undoManager.ignore((()=>{if(e.setContent(t),this.valueCursor&&(!this.inline||e.hasFocus()))try{e.selection.moveToBookmark(this.valueCursor)}catch(e){}})),this.rollbackTimer=void 0})),to(this,"handleBeforeInput",(e=>{if(void 0!==this.props.value&&this.props.value===this.currentContent&&this.editor&&(!this.inline||this.editor.hasFocus()))try{this.valueCursor=this.editor.selection.getBookmark(3)}catch(e){}})),to(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),to(this,"handleEditorChange",(e=>{const t=this.editor;if(t&&t.initialized){const e=t.getContent();void 0!==this.props.value&&this.props.value!==e&&!1!==this.props.rollback&&(this.rollbackTimer||(this.rollbackTimer=window.setTimeout(this.rollbackChange,"number"==typeof this.props.rollback?this.props.rollback:200))),e!==this.currentContent&&(this.currentContent=e,"function"==typeof this.props.onEditorChange&&this.props.onEditorChange(e,t))}})),to(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),to(this,"initialise",((e=0)=>{const t=this.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>this.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>this.initialise(e+1)),100)}return}const r=eo(this.view);if(!r)throw new Error("tinymce should have been loaded into global scope");const n={...this.props.init,selector:void 0,target:t,readonly:this.props.disabled,inline:this.inline,plugins:(a=this.props.init?.plugins,i=this.props.plugins,Xl(a).concat(Xl(i))),toolbar:this.props.toolbar??this.props.init?.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!Yl(t)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&jl(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{const t=this.getInitialValue();this.currentContent=this.currentContent??e.getContent(),this.currentContent!==t&&(this.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const r=this.props.disabled??!1;Ql(this.editor,r?"readonly":"design"),this.props.init&&jl(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}};var a,i;this.inline||(t.style.visibility=""),Yl(t)&&(t.value=this.getInitialValue()),r.init(n)})),this.id=this.props.id||Gl("tiny-react"),this.elementRef=i.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Ql(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==eo(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Jl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=eo(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:e="div"}=this.props;return i.createElement(e,{ref:this.elementRef,id:this.id})}renderIframe(){return i.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Wl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):r&&!n&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}to(ro,"propTypes",Vl),to(ro,"defaultProps",{cloudChannel:"6"});var no=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(no||{});const ao=e=>{const{className:t,style:r,tinymce:n={},upload:a={},thresholdSize:i=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:m}=e,{global:p}=l().useContext(o),{$size:h}=X(e),{$locale:f,t:g}=G(),y={height:n.height||400,plugins:n.plugins||"preview importcss searchreplace autolink save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons",toolbar:n.toolbar||"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",menubar:n.menubar||"file edit view insert format tools table help",font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:no[f],skin:"tinymce-5",...oe(n,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:l,dataKey:o}=a,s=`data:image/jpeg;base64,${e.base64()}`,c=new FormData;c.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>i)try{const e=await fetch(n,{method:"POST",body:c,headers:l});if(!e.ok)throw new Error(g("qm.upload.uploadError"));const r=await e.json();200===r.code&&t(o?(0,Q.get)(r.data,o):r.data)}catch(e){O.message.error(g("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;u?.({width:r,height:n},t)}))}},b=Ee("tinymce"),v={[b]:!0,[`${b}--lg`]:"large"===h,[`${b}--sm`]:"small"===h},x={init:y,value:d,disabled:c,tinymceScriptSrc:s||p?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{m?.(t.getContent(),t)}};return l().createElement("div",{className:xe()(v,t),style:r},l().createElement(ro,x))};ao.displayName="QmTinymce";const io=ao,lo=require("cropperjs");var oo=n.n(lo);const so=l().forwardRef(((e,t)=>{const r=h({src:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0},e),{className:n,style:a,src:i,alt:o,imgStyle:s,...c}=r,d=l().useRef(null),u=l().useRef(null);l().useEffect((()=>{const e={};for(const t in c)void 0!==r[t]&&(e[t]=r[t]);return u.current=new(oo())(d.current,e),()=>{v(),u.current=null}}),[]);const m=()=>u.current?.reset(),p=()=>u.current?.clear(),f=()=>u.current?.crop(),g=(e,t=!1)=>u.current?.replace(e,t),y=()=>u.current?.enable(),b=()=>u.current?.disable(),v=()=>u.current?.destroy(),x=(e,t)=>u.current?.move(e,t),E=(e,t=e)=>u.current?.moveTo(e,t),C=(e,t)=>u.current?.zoom(e),w=(e,t)=>u.current?.zoomTo(e,t),S=e=>u.current?.rotate(e),N=e=>u.current?.rotateTo(e),T=e=>u.current?.scaleX(e),I=e=>u.current?.scaleY(e),R=(e,t=e)=>u.current?.scale(e,t),O=(e=!1)=>u.current?.getData(e),P=e=>u.current?.setData(e),k=()=>u.current?.getContainerData(),A=()=>u.current?.getImageData(),L=()=>u.current?.getCanvasData(),F=e=>u.current?.setCanvasData(e),_=()=>u.current?.getCropBoxData(),D=e=>u.current?.setCropBoxData(e),H=(e={})=>u.current?.getCroppedCanvas(e),$=e=>u.current?.setAspectRatio(e),q=e=>u.current?.setDragMode(e);l().useImperativeHandle(t,(()=>({reset:m,clear:p,initCrop:f,replace:g,enable:y,disable:b,destroy:v,move:x,moveTo:E,relativeZoom:C,zoomTo:w,rotate:S,rotateTo:N,scaleX:T,scaleY:I,scale:R,getData:O,setData:P,getContainerData:k,getImageData:A,getCanvasData:L,setCanvasData:F,getCropBoxData:_,setCropBoxData:D,getCroppedCanvas:H,setAspectRatio:$,setDragMode:q})));const M=Ee("cropper"),K={[M]:!0};return l().createElement("div",{className:xe()(K,n),style:a},l().createElement("img",{ref:d,src:i,alt:o,style:{maxWidth:"100%",...s}}))}));so.displayName="Cropper";const co=so,uo=_t,mo=e=>{const{fileTypes:t=[],fileSize:r,fixedSize:n,quality:a,beforeCrop:i,className:o}=e,{t:s}=G(),c=l().useRef(null),d=l().useRef(),u=l().useRef(),m=l().useRef(),p=l().useRef(),[h,f]=l().useState(""),g=e=>{c.current.relativeZoom(e)},y=e=>{c.current.rotate(e)},b=()=>{f("")},v=Ee("cropper-preview");return l().createElement(l().Fragment,null,(()=>{const t=Array.isArray(e.children)?e.children[0]:e.children;if(!t)return null;const{beforeUpload:r,...n}=t.props;return d.current=r,l().createElement(t.type,{...n,beforeUpload:(e,t)=>new Promise((async(r,n)=>{const a=()=>r(O.Upload.LIST_IGNORE);if(i&&!await i(e,t))return void a();u.current=e,m.current=r,p.current=a;const l=new FileReader;l.onload=()=>{f(l.result),l.onload=null},l.readAsDataURL(e)}))})})(),h&&l().createElement(O.Modal,{open:!0,wrapClassName:xe()(v,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{(async()=>{const{type:e,name:r,uid:n}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async a=>{let i=new File([a],r,{type:e});if(Object.assign(i,{uid:n}),t.length&&!t.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return O.message.warning(s("qm.upload.tooltip",{type:t.join(",")})),p.current("file type is error");if("function"!=typeof d.current)return m.current(i);const l=d.current(i,[i]);if("boolean"==typeof l||l){if(!0===l)return m.current(i);if(!1===l)return p.current("not upload");if(l&&"function"==typeof l.then)try{const e=await l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),m.current(i)}catch(e){p.current(e)}}else me("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),e,a),await ne(100),b()})()},onCancel:b,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:n?`calc(380px * ${n[1]/n[0]})`:"auto"};return l().createElement("div",{className:"cropper-preview"},l().createElement("div",{className:"cropper-area"},l().createElement("div",{className:"img-cropper"},l().createElement(co,{ref:c,aspectRatio:n?n[0]/n[1]:n,src:h,dragMode:"move",preview:".preview"})),l().createElement("div",{className:"actions"},l().createElement(O.Space,{size:"small"},l().createElement(O.Button,{type:"primary",size:"middle",icon:l().createElement(Ce.ZoomInOutlined,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),l().createElement(O.Button,{type:"primary",size:"middle",icon:l().createElement(Ce.ZoomOutOutlined,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),l().createElement(O.Button,{type:"primary",size:"middle",icon:l().createElement(Ce.RotateRightOutlined,null),onClick:()=>y(90)},s("qm.uploadCropper.rotatePlus")),l().createElement(O.Button,{type:"primary",size:"middle",icon:l().createElement(Ce.RotateLeftOutlined,null),onClick:()=>y(-90)},s("qm.uploadCropper.rotateSubtract"))))),l().createElement("div",{className:"preview-area"},l().createElement("div",{className:"preview",style:e})))})()))};function po(){return po=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},po.apply(null,arguments)}const ho=e=>{const t=h({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:n=!0,fixedSize:a,quality:i=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:m,className:p,popupClassName:f,beforeCrop:g,onSortChange:y,onChange:b}=t,{t:v}=G(),{$size:x}=X(t),E=l().useRef(null),C=l().useRef(null),w=l().useRef(!1),[S,N]=l().useState(!1),[T,I]=l().useState(0),R=l().useMemo((()=>u||m),[u,m]),P=l().useMemo((()=>!c||r.length<c),[r,c]);l().useEffect((()=>(A(),document.addEventListener("paste",F),()=>{C.current?.destroy(),document.removeEventListener("paste",F)})),[]),De((()=>{P||(w.current=!1)}),[r]);const k=Y((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[a]=e.splice(t,1);e.splice(n,0,a),y?.(e),b?.({file:r[t],fileList:e})}})),A=()=>{d&&(C.current=Rt().create(Be(E.current,Ee("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:k}))},L=(e,r)=>new Promise((async(n,a)=>{const{fileTypes:i=[],fileSize:l,beforeUpload:o}=t,s=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!l||e.size/1024/1024<l,d=s&&c;if(s||O.message.warning(v("qm.upload.tooltip",{type:i.join(",")})),c||O.message.warning(v("qm.upload.sizeLimit",{size:l})),!d)return O.Upload.LIST_IGNORE;if(o){const t=o(e,r);if(!0===t)return n(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{n(await t)}catch(e){a(e)}}else n(e)})),F=Y((async e=>{const{action:n,data:a,headers:i}=t;if(w.current&&P&&n)for(const t of e.clipboardData.items)if("file"===t.kind&&t.type.startsWith("image/")){const e=t.getAsFile(),l=Date.now(),o=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${l}`});try{await L(o,[...r,o]);const e=new FormData;if(e.append("file",o),a)for(const t in a)e.append(t,a[t]);const t="string"==typeof n?n:await n(o),l=await fetch(t,{method:"POST",body:e,headers:i});if(!l.ok)throw new Error(v("qm.upload.uploadError"));const s=await l.json();b?.({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})),_=Ee("upload-img"),D={[_]:!0,[`${_}--lg`]:"large"===x,[`${_}--sm`]:"small"===x},H=l().createElement(O.Upload,po({className:xe()(D,p)},oe(t,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:L,disabled:R,onPreview:e=>{const t=r.findIndex((t=>t.url===e.url));t<0||(I(t),N(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,r,n)=>l().createElement("div",{className:xe()("upload-item",{handle:d})},e,!R&&l().createElement(Ce.CloseOutlined,{title:v("qm.upload.remove"),className:"icon",onClick:()=>n.remove()}))}),l().createElement("span",{className:"inner",ref:E},P&&!(m&&r.length)&&l().createElement(l().Fragment,null,l().createElement("p",{className:"ant-upload-drag-icon"},l().createElement(Ce.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},v("qm.uploadCropper.dragableText")),l().createElement("button",{className:xe()("ant-upload-button",{disabled:R}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},v("qm.uploadCropper.pasteText")))));return l().createElement(l().Fragment,null,n?l().createElement(mo,{className:f,fixedSize:a,quality:i,fileTypes:o,fileSize:s,beforeCrop:g},H):H,l().createElement("div",{style:{display:"none"}},l().createElement(O.Image.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:S,current:T,rootClassName:f,onVisibleChange:e=>N(e)}},r.map(((e,t)=>l().createElement(O.Image,{key:e.uid||t,src:e.url,alt:""}))))))};ho.displayName="QmUploadImg";const fo=ho,go=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=go(i.children,t,r);e&&(n=e)}}return n},yo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&yo(e.children,t),t(e)||e.children&&e.children.length))),bo=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...bo(e.children,t)),t(e)&&r.push(e)})),r},vo=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=vo(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},xo=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:xo(e.children,t,r,n)}:e)),Eo=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Eo(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},Co=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=Co(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},wo=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...wo(e,t)))),r},So=l().forwardRef(((e,t)=>{const{className:r,style:n,filterable:a=!0,multiple:i,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:m,checkStrategy:p="SHOW_CHILD",placeholder:h,fieldsDefine:f,value:y,height:b,defaultSelectedKeys:v=[],defaultExpandedKeys:x=[],defaultExpandAll:E=!0,showSearchBar:C=!0,showCollapse:w=!0,onSelectChange:S,onCheckChange:N,onDragStart:T,onDragChange:I,onExpand:R}=e,{$size:P}=X(e),{t:k}=G(),A=f?.valueKey||"value",L=f?.textKey||"text",F=l().useRef(null),_=l().useRef(null),D=vt(F),[H,$]=l().useState(b),[q,M]=l().useState(!1),K=xt((()=>{$(F.current.offsetHeight-ne.current.offsetHeight-10)}),5);g((()=>{b||K()}),[D.height]);const[V,j]=l().useState([]),[z,B]=l().useState({}),[W,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),[te,re]=l().useState(E),ne=l().useRef(null),ae=l().useRef([]),ie=l().useRef([]);l().useEffect((()=>{Array.isArray(s)&&(oe(s),U(se(s)),B({}))}),[s]),l().useEffect((()=>{ue(),d&&_.current?.focus()}),[]),De((()=>{ue()}),[c?.params]),De((()=>{Z(de())}),[z]),l().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=vo(V,(t=>e===t[A]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],oe([...V]))},REMOVE_RECORD:e=>{const t=go(V,e,A);if(void 0===t&&V.find((t=>t[A]===e)))oe(V.filter((t=>t[A]!==e)));else{const r=vo(V,(e=>t===e[A]));if(!r)return;const n=r.children?.findIndex((t=>e===t[A]));n>=0&&(r.children.splice(n,1),oe([...V]))}},UPDATE_RECORD:(e,t)=>{const r=vo(V,(t=>e===t[A]));r&&((0,Q.merge)(r,t),oe([...V]))}})));const oe=e=>{j(e),ae.current=e,ie.current=Eo(e,A)},se=e=>{if(i)return v;const t=bo(e,(e=>v.includes(e[L])));return 1===t.length?[t[0][A]]:[]},ce=e=>Co(V,e,A)?.slice(0,-1)||[],de=()=>{if(E)return ie.current;const e=[];return W.forEach((t=>{if(i){if("SHOW_ALL"===p&&!ie.current.includes(t)&&e.push(...ce(t)),"SHOW_CHILD"===p&&e.push(...ce(t)),"SHOW_PARENT"===p){const r=Pn(V,t);if(r){const n=ce(t),a=wo(r,A);e.push(...n,...[t,...a].filter((e=>ie.current.includes(e))))}}}else e.push(...ce(t))})),[...new Set([...x,...e])]},ue=async()=>{if(!c)return;const{api:e,params:t,dataKey:r,afterFetch:n,callback:a}=c;try{M(!0);const i=await e(t);if(200===i.code){let e=Array.isArray(i.data)?i.data:(0,Q.get)(i.data,r)??[];e="function"==typeof n?await n(e):e,oe(e),U(se(e)),B({}),a?.(e)}}catch(e){}M(!1)},me=e=>`${e}|${Gn.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,pe=Ee("search-tree"),he={[pe]:!0,[`${pe}--lg`]:"large"===P,[`${pe}--sm`]:"small"===P};return l().createElement("div",{ref:F,className:xe()(he,r),style:n},l().createElement("div",{ref:ne,className:"topper"},C&&l().createElement(O.Input,{ref:_,value:J,size:P,placeholder:h||k("qm.form.inputPlaceholder"),suffix:l().createElement(Ce.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=yo(ae.current,(t=>{if(!e)return!0;const r=t[L]||"";return-1!==me(r).indexOf(e)}));ee(e),j(t),Z(E||e?Eo(t,A):de())})(e.target.value)}),w&&l().createElement("a",{className:"trigger",onClick:()=>{re(!te),Z(te?[]:ie.current)}},te?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)," ",k(te?"qm.form.collect":"qm.form.spread"))),l().createElement(ut,{spinning:q},l().createElement(O.Tree,{fieldNames:{title:L,key:A,children:"children"},multiple:i,draggable:o,blockNode:o,checkable:i,selectable:!i,height:H,disabled:e.disabled,checkStrictly:m,selectedKeys:y??W,checkedKeys:y??W,expandedKeys:Y,treeData:V,loadData:u?async({key:e,children:t})=>{if(!c||t)return;const{api:r,params:n,dataKey:a,formatter:i=(e=>e),afterFetch:l}=c;try{const t=await r(i({...n,[A]:e}));if(200===t.code){let r=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[];r="function"==typeof l?await l(r):r;const n=xo(ae.current,e,A,r);oe(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!J)return!1;const t=e[L]||"";return-1!==me(t).indexOf(J)},onDragStart:T,onDragEnter:e=>{Z(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][A]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...V];let o;if(i(l,r,((e,t,r)=>{r.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,r=[];i(l,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,o):r.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));oe(l)},onDragEnd:e=>{I?.(e,V)},onExpand:(e,t)=>{le(e)&&re(!1),ie.current.every((t=>e.includes(t)))&&re(!0),Z(e),R?.(e,t)},onSelect:e=>{U(e);const t=bo(ae.current,(t=>e.includes((0,Q.get)(t,A))));S?.(i?t:t[0])},onCheck:e=>{m&&(e=e.checked),U(e),m||("SHOW_CHILD"===p&&(e=e.filter((e=>!ie.current.includes(e)))),"SHOW_PARENT"===p&&(e=e.filter(((e,t,r)=>!r.includes(go(V,e,A))))));const t=bo(ae.current,(t=>e.includes((0,Q.get)(t,A))));N?.(i?t:t[0])}})))}));So.displayName="QmSearchTree";const No=So,To=(0,i.createContext)(void 0),Io={dataIndex:dn().string.isRequired,title:dn().string.isRequired,description:dn().string,colSpan:dn().number,width:dn().number,minWidth:dn().number,fixed:dn().oneOf(["left","right"]),align:dn().oneOf(["left","center","right"]),theadAlign:dn().oneOf(["left","center","right"]),printFixed:dn().bool,hidden:dn().bool,noAuth:dn().bool,noFixed:dn().bool,ellipsis:dn().bool,className:dn().string,theadClassName:dn().string,children:dn().array,sorter:dn().oneOfType([dn().bool,dn().func]),filter:dn().shape({type:dn().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:dn().arrayOf(dn().shape({text:dn().string,value:dn().oneOfType([dn().string,dn().number])})),style:dn().object}),precision:dn().number,displayPrecision:dn().number,formatType:dn().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:dn().bool,canCopy:dn().bool,editRender:dn().func,dictItems:dn().arrayOf(dn().shape({text:dn().string,value:dn().oneOfType([dn().string,dn().number])})),summation:dn().shape({sumBySelection:dn().bool,displayWhenNotSelect:dn().bool,dataKey:dn().string,unit:dn().string,render:dn().func}),groupSummary:dn().shape({dataKey:dn().string,unit:dn().string,render:dn().func}),shouldCellUpdate:dn().func,headRender:dn().func,render:dn().func},Ro=(dn().arrayOf(dn().shape(Io)).isRequired,dn().func,dn().array,dn().oneOfType([dn().string,dn().func]).isRequired,dn().number,dn().bool,dn().bool,dn().shape({api:dn().func.isRequired,params:dn().object.isRequired,formatter:dn().func,beforeFetch:dn().func,afterFetch:dn().func,stopToFirst:dn().bool,dataKey:dn().string,callback:dn().func}),dn().bool,dn().bool,dn().string,dn().string,dn().object,dn().bool,dn().bool,dn().bool,dn().bool,dn().oneOfType([dn().object,dn().func]),dn().oneOfType([dn().object,dn().func]),dn().array,dn().func,dn().bool,dn().object,dn().object,dn().shape({type:dn().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:dn().array,selectedRowKeys:dn().array,hideSelectAll:dn().bool,checkStrictly:dn().bool,filterable:dn().bool,selectByClickRow:dn().bool,selectFirstRowOnChange:dn().bool,clearableAfterFetched:dn().bool,selectAllOnCurrentPage:dn().bool,fetchSelectedRows:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),fetchAllRowKeys:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),disabled:dn().func,onChange:dn().func,onSelect:dn().func,onSelectAll:dn().func}),dn().shape({currentRowKey:dn().oneOfType([dn().number,dn().string]),disabled:dn().func,onChange:dn().func}),dn().shape({virtual:dn().bool,doubleXScrollbar:dn().bool}),dn().shape({virtual:dn().bool,expandIconColumn:dn().string}),dn().shape({defaultExpandAllRows:dn().bool,defaultExpandedRowKeys:dn().array,expandedRowKeys:dn().array,hideExpandAll:dn().bool,rowExpandable:dn().func,expandedRowClassName:dn().string,expandedRowRender:dn().func,onExpand:dn().func,onChange:dn().func}),dn().shape({cellMerge:dn().bool,onCellMerge:dn().func,onSelectChange:dn().func}),dn().shape({groupItems:dn().arrayOf(dn().shape({dataIndex:dn().string.isRequired,titleIndex:dn().string,color:dn().string,backgroundColor:dn().string})),fetch:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),onChange:dn().func}),dn().func,dn().bool,dn().bool,dn().bool,dn().bool,dn().shape({current:dn().number,pageSize:dn().number,pageSizeOptions:dn().array,showSizeChanger:dn().bool,showQuickJumper:dn().bool}),dn().shape({fileName:dn().string,fetch:dn().shape({api:dn().func.isRequired,params:dn().object}),beforeExport:dn().func,cellStyle:dn().bool,hideIcon:dn().bool}),dn().shape({showLogo:dn().bool}),dn().shape({fetch:dn().shape({api:dn().func.isRequired,params:dn().object,dataKey:dn().string}),fieldList:dn().arrayOf(dn().object)}),dn().shape({position:dn().oneOf(["top","bottom"]),hideAlert:dn().bool,hideClearButton:dn().bool}),dn().oneOf(["left","right"]),dn().func,dn().func,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().bool,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,dn().func,{columns:[],dataSource:[],rowKey:"id",border:!0,resizable:!0,showHeader:!0,ellipsis:!0,multipleSort:!0,topSpaceAlign:"right",showFullScreen:!0,showRefresh:!0,showClipboard:!0,showSelectCollection:!0,showSuperSearch:!0,showFastSearch:!0,showGroupSummary:!0,showColumnDefine:!0,showTableInfo:!0}),Oo=10,Po="1",ko="0",Ao="YYYY-MM-DD",Lo="YYYY-MM-DD HH:mm:ss",Fo="YYYYMMDDHHmmss",_o={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};let Do=function(e){return e.left="flex-start",e.right="flex-end",e}({});const Ho={...i}.useId;let $o=0;const qo=Ho?function(e){const t=Ho();return e||t}:function(e){const[t]=i.useState(`qm_unique_${$o}`);return i.useEffect((()=>{$o+=1}),[]),e||t};let Mo=[];const Ko={_getInstance:function(e){return Mo.find((t=>t.id===e))??null},getFocusInstance:function(){return Mo[0]??null},focus:function(e){const t=this._getInstance(e);t&&0!==Mo.findIndex((e=>e===t))&&(this.deregister(e),Mo=[t,...Mo])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),Mo=[{id:e,vm:t},...Mo])},deregister:function(e){e&&(Mo=Mo.filter((t=>t.id!==e)))}};function Vo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const jo=class{constructor(){Vo(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),Vo(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),Vo(this,"removeFromRequired",(e=>{const t=this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.required.splice(t,1)})),Vo(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),Vo(this,"removeFromValidate",(e=>{const t=this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.validate.splice(t,1)})),Vo(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),Vo(this,"removeFromEdited",(e=>{const t=this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y));t<0||this.state.edited.splice(t,1)})),Vo(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),Vo(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),Vo(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),Vo(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),Vo(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),Vo(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),Vo(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]}))}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}},zo={defaultColumnWidth:80,selectionColumnWidth:50,rowHeightMaps:{large:42,middle:34,small:26},sortDirections:["ascend","descend"],pagination:{current:1,pageSize:20,pageSizeOptions:[10,20,30,40,50],showSizeChanger:!0,showQuickJumper:!0},groupSummary:{total:{text:"记录数",value:"*"},recordTotalIndex:"nRecordsCount",summaryFieldName:"tsummary",groupbyFieldName:"tgroupby"},highSearch:{showSQL:!1},treeTable:{textIndent:17},dataKey:"records",summationKey:"summation",totalKey:"total",virtualScrollX:50,virtualScrollY:150,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored"};function Bo(e){return void 0!==e}function Wo(e,t){const{defaultValue:r,value:n,onChange:a,postState:l}=t||{},[o,s]=i.useState((()=>Bo(n)?n:Bo(r)?"function"==typeof r?r():r:"function"==typeof e?e():e)),c=Bo(n)?n:o,d=l?l(c):c,u=Y(a),[m,p]=i.useState([c]);return g((()=>{const e=m[0];o!==e&&u(o,e)}),[m]),g((()=>{Bo(n)||s(n)}),[n]),[d,Y((e=>{s(e),p([c])}))]}let Uo;const Go=()=>{if(Z)return 0;if(void 0!==Uo)return Uo;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),Uo=t-n,Uo},Yo=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=Yo(t.children)),t})),Xo=(e,t)=>{const{fetch:r,columns:n,height:a,minHeight:i,maxHeight:o,border:s=!0,rowSelection:c,summation:d,expandable:u,treeConfig:m,webPagination:p,scrollPagination:h,showSuperSearch:f,showFastSearch:g,showGroupSummary:y,showTableImport:b,showClipboard:v,showSelectCollection:x,showPivotGrid:E,footRender:C}=e,{tableRef:w,getRowKey:S,tableFullData:N,tableData:T,selectionKeys:I,sorter:R,filters:O,superFilters:P,pagination:k,mergedTdCells:A}=t,{selectionRows:L,summaries:F}=w.current,{expandIconColumn:_=""}=m||{},{t:D}=G(),H=l().useMemo((()=>!!r?.api),[r?.api]),$=l().useMemo((()=>!H&&!!p),[H,p]),q=l().useMemo((()=>H&&!!h),[H,h]),M=l().useMemo((()=>(H||$)&&!q),[H,$,q]),K=l().useMemo((()=>!!(a||i||o)),[a,i,o]),V=l().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(Yo(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:zo.selectionColumn,title:"radio"===t?D("qm.table.config.selectionText"):"",width:zo.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=u,a?.expandedRowRender?{dataIndex:zo.expandableColumn,title:"",width:zo.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),Ir(t)})(n)),[n]),j=l().useMemo((()=>Tr(V)),[V]),z=l().useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),B=l().useMemo((()=>j.filter((e=>!!e.summation))),[j]),W=l().useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),U=l().useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),Y=l().useMemo((()=>(e=>{const t=[];return e.forEach((e=>{const r=N.find((t=>S(t,t.index)===e.rowKey)),n=j.findIndex((t=>t.dataIndex===e.dataIndex));if(!r||n<0)return;const a={row:r.index,col:n,rowSpan:e.rowSpan,colSpan:e.colSpan};t.push(a);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:a.row+n,col:a.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:a.row+r,col:a.col+n,rowSpan:0,colSpan:0})})),t})(A)),[A,j,N]),X=l().useMemo((()=>{const e=j.filter((e=>![zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(e.dataIndex)));return _&&e.some((e=>e.dataIndex===_))?_:e[0]?.dataIndex??""}),[j,_]),Q=l().useMemo((()=>B.length>0),[B]),Z=l().useMemo((()=>!!C||Q),[C,Q]),J=l().useMemo((()=>Dr(V).length>1),[V]),ee=l().useMemo((()=>s||J),[s,J]),te=l().useMemo((()=>j.some((e=>e.sorter))),[j]),re=l().useMemo((()=>j.some((e=>e.filter))),[j]),ne=l().useMemo((()=>B.some((e=>!!e.summation.dataKey))),[B]),ae=l().useMemo((()=>!H&&!!b),[H,b]),ie=l().useMemo((()=>!!v&&z.length>0),[v,z]),le=l().useMemo((()=>!!x&&"checkbox"===c?.type),[x,c]),oe=l().useMemo((()=>!!f&&re),[f,re]),se=l().useMemo((()=>!H&&!!g&&re),[H,g,re]),ce=l().useMemo((()=>!H&&!!E),[H,E]),de=l().useMemo((()=>!!y&&j.some((e=>!!e.groupSummary))),[j]),ue=l().useMemo((()=>!!d?.groupItems?.length),[d]),me=l().useMemo((()=>N.some((e=>Array.isArray(e.children)))),[N]),pe=l().useMemo((()=>!T.length),[T]),he=l().useMemo((()=>(()=>{const e={};return B.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=ue?en(w.current.tableFullData):w.current.tableFullData,d=!L.length&&!!o;let u=(!l||d?c:L).reduce(((e,t)=>{if(t?.[zo.summaryIgnore])return e;const n=jr(t,r);return Wr(n)?e.plus(n):e}),new(va())(0));!Object.keys(F).includes(r)||l&&!d||(u=new(va())(jr(F,r))),zr(e,r,u.toNumber());let m=n>=0?u.toFixed(n):u.toString();a>=0&&""!==m&&(m=Gr(m,a)),m=Ur(m),zr(e,`${r}_text`,s?`${m} ${s}`:m)})),[e]})()),[T,I,F]),fe=l().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(B)),[B]),ge=l().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=zo.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:zo.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(O,P);return{...e?{[zo.sorterFieldName]:e}:null,...t.length?{[zo.filterFieldName]:t}:null,...fe?{[zo.groupSummary.summaryFieldName]:fe,usedJH:1}:null,...r?.params??null,[zo.currentPageName]:k.current,[zo.pageSizeName]:k.pageSize}}),[r?.params,k.current,k.pageSize,R,O,P,fe]);return{isFetch:H,isWebPagination:$,isScrollPagination:q,showPagination:M,shouldUpdateHeight:K,tableColumns:V,flattenColumns:j,editableColumns:z,summationColumns:B,leftFixedColumns:W,rightFixedColumns:U,derivedMergeCells:Y,treeExpandIndex:X,showSummary:Q,showFooter:Z,isHeadGroup:J,bordered:ee,isHeadSorter:te,isHeadFilter:re,isServiceSummation:ne,isSelectCollection:le,isTableImport:ae,isTableClipboard:ie,isSuperSearch:oe,isFastSearch:se,isPivotGrid:ce,isGroupSummary:de,isGroupSubtotal:ue,isTreeTable:me,isTableEmpty:pe,summationRows:he,fetchParams:ge}},Qo=require("react-dom");var Zo=n.n(Qo);const Jo=(e,t)=>{const{rowKey:r,height:n,dataSource:a,summation:i,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,treeConfig:p,authConfig:h,ignorePageIndex:f,columnsChange:y,onChange:b,onDataChange:v,onDataLoad:x,onScrollEnd:E,onFetchError:C}=e,{getRowKey:w,tableRef:S,tableElementRef:N,tableBodyRef:T,$size:I,tableColumns:R,flattenColumns:O,editableColumns:P,tableFullData:k,pagination:A,layout:L,filters:F,sorter:_,superFilters:D,fetchParams:H,selectionKeys:$,rowExpandedKeys:q,highlightKey:M,summationColumns:K,shouldUpdateHeight:V,isFetch:j,isTreeTable:z,isWebPagination:B,isScrollPagination:W,isServiceSummation:U,isGroupSubtotal:Y,doLayout:X,setTableData:Z,setTableFlatColumns:J,setTableFullData:ee,setTableOriginData:te,setTableFlatData:ne,setAllTableData:ae,setDeriveRowKeys:ie,setPagination:se,setSpinning:ce,setSorter:de,setFilters:ue,setSuperFilters:pe,setSelectionKeys:he,setRowExpandedKeys:fe,setHighlightKey:ge,setSelectionRows:ye,setScrollXLoad:be,setScrollYLoad:ve,setScrollXStore:xe,setScrollYStore:Ee,computeVirtualX:Ce,computeVirtualY:we,setFieldAuth:Se,setResizeState:Ne,setSummaries:Te,setPermission:Ie,setRecordsMap:Re,resetTableScroll:Oe,clearElementStore:Pe,clearRecordsMap:ke}=t,{t:Ae}=G(),{store:Le,scrollBarRef:Fe}=S.current,_e=Number.parseInt(l().version)>=18?Zo().flushSync:null,He=l().useRef({...H}),$e=l().useRef(new Map),qe=l().useRef(!1),Me=vt(N);g((()=>{X(),Be(),S.current.scrollXLoad&&Ue(Fe.current.scrollLeft),Ge()}),[R]),g((()=>{Ke()}),[Me.width,I,n,L.tableAutoHeight]),De((()=>{At(),Lt(),Ft(),j||(B&&Ct(),ht(a)),s&&de(s),c&&ue(c)}),[a,o?.params]),De((()=>{const e=dt(H,He.current);e||j&&d?.clearableAfterFetched&&_t(),!e&&H[zo.currentPageName]>1&&!o?.stopToFirst?Ct():j&&mt(),He.current=H}),[H]),De((()=>{B&&Rt(),W||Oe(),ot()}),[A.current,A.pageSize]),De((()=>{S.current.scrollYLoad&&Qe(Fe.current.scrollTop),j||Ve(k.length),X()}),[k]),De((()=>{z&&S.current.scrollYLoad&&(wt(),Rt())}),[q]);const Ke=()=>{const{scrollXLoad:e,scrollYLoad:t,resizeState:r}=S.current,{width:n,height:a}=r,{width:i,height:l}=Me,o=i!==n,s=l!==a;X(),o&&e&&Ge(),s&&V&&t&&Ze(),Ne(Object.assign({},r,{width:i,height:l}))},Ve=e=>{e!==A.total&&se((t=>Object.assign({},t,{total:e})))},je=e=>{qe.current=e},ze=xt((e=>{yt(),E?.(e)})),Be=()=>{be(O.length>zo.virtualScrollX)},We=(e=[])=>{let t=e.length>zo.virtualScrollY;m?.virtual&&(t=!0),p?.virtual&&(t=!0),ve(t)},Ue=(e=0)=>{const{scrollXStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:a}=t,{toVisibleIndex:i,visibleSize:l}=Ce(e,L.tableWidth),o=Math.max(0,i-1-a),s=i+l+a;(i<=r||i>=n-l-1)&&(r===o&&n===s||(xe(Object.assign({},t,{startIndex:o,endIndex:s})),Ge()))},Ge=()=>{Ye(),Xe()},Ye=()=>{const{scrollXLoad:e,scrollXStore:t}=S.current;if(!e)return;const r=[],n=[],a=[];for(let e=0;e<O.length;e++){const i=O[e];i.fixed?"left"===i.fixed?r.push(i):a.push(i):e>=t.startIndex&&e<t.endIndex&&n.push(i)}_e?queueMicrotask((()=>_e((()=>J([...r,...n,...a]))))):J([...r,...n,...a])},Xe=()=>{const{elementStore:e,scrollXStore:t,scrollXLoad:r}=S.current,{tableBodyWidth:n,gutterWidth:a}=L;let i="",l="";r&&(i=`${O.slice(0,t.startIndex).filter((e=>!e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)}px`,l=`${scrollY?n-a:n}px`),e.$tableBody.style.marginLeft=i,e.$tableXspace.style.width=l},Qe=(e=0)=>{const{scrollYStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:l}=t,{toVisibleIndex:o}=we(e,l),s=Math.max(0,o-1-a),c=o+i+a;(o<=r||o>=n-i-1)&&(r===s&&n===c||(Ee(Object.assign({},t,{startIndex:s,endIndex:c})),Ze()))},Ze=()=>{const{tableFlatData:e}=S.current;It(e),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=S.current,{startIndex:a,rowHeight:i}=r;let l="",o="";n&&(l=`${Math.max(0,a*i)}px`,o=e.length*i+"px"),t.$tableBody.style.marginTop=l,t.$tableYspace.style.height=o})(e)},Je=e=>Y?et(tt(e,0)):e,et=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...et(e.children)),delete e.children,t.push(e)})),t},tt=(e,t)=>{const n=i.groupItems?.[t];return n?rn(e,[n.dataIndex]).map((e=>{const a={children:tt(e,t+1),_group:n.dataIndex};return"function"!=typeof r&&zr(a,r.toString(),Qr()),n.titleIndex&&zr(a,n.titleIndex,jr(e[0],n.titleIndex)),zr(a,n.dataIndex,jr(e[0],n.dataIndex)),K.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[zo.summaryIgnore])return e;const n=Number(jr(r,t));return Number.isNaN(n)?e:e+n}),0);zr(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},rt=e=>{he(e),ye((e=>{const{selectionRows:t,recordsMap:r}=S.current,n=new Map;t.forEach((e=>n.set(w(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=n.get(e[t])||r.get(e[t]);i&&a.push(i)}return a})(e))},nt=e=>{const{type:t,checkStrictly:r=!0}=d||{},n=Array.isArray(e)?e:$;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{disabled:r}=d||{},{deriveRowKeys:n,recordsMap:a}=S.current,i=Fr(n,e);let l=[];if(!i)return l;let o=it(i?.children||[]);return r&&(o=o.filter((e=>!a.has(e)||!r(a.get(e))))),l=[...new Set([...t,...o])],(an(n,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Fr(n,e),r=t?.children?.every((e=>l.includes(e.rowKey)));l=r?[...l,e]:l.filter((t=>t!==e))})),l})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},at=e=>{const{treeTable:t,allRowKeys:r,flattenRowKeys:n,deriveRowKeys:a,recordsMap:i}=S.current,{defaultExpandAllRows:l,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:q;if(t){s&&me("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...$];M&&e.unshift(M),e.forEach((e=>{const t=an(a,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)}))}return c=l?r.slice(0):[...new Set(c)],t&&(c=c.filter((e=>!n.includes(e)))),o&&c.filter((e=>{const t=i.get(e);return!!t&&o(t)})),c},it=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...it(e[r].children)),t.push(e[r].rowKey);return t},lt=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...lt(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(...lt(e,r[r.length-1])),r},ot=xt((()=>{b?.(A,ct(F),st(_),D,{currentDataSource:Tt()})})),st=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},ct=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[zo.showFilterType?`${n}|${a}`:n]=e[r]}return t},dt=(e,t)=>{const r=Object.keys(Vr(e,t));return 1===r.length&&(r.includes(zo.currentPageName)||r.includes(zo.pageSizeName))},ut=async()=>{if(!o)return;const{formatter:e=(e=>e),beforeFetch:t=re,afterFetch:r,callback:n}=o;if(!t(H))return;const a=!!i?.fetch?.api;ce(!0);try{const[t,l]=a?await Promise.all([o.api(e(H)),i.fetch.api(e(H))]):[await o.api(e(H))];if(S.current.unMounted)return;if(a?200===t.code&&200===l.code:200===t.code){const e=o.dataKey??zo.dataKey;let a=(0,Q.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,Q.get)(t.data,e.replace(/[^.]+$/,zo.totalKey))||a.length||0,s=Math.max(Math.ceil(i/A.pageSize),1);if(H[zo.currentPageName]>s)return bt({...A,current:s});ht(qe.current?S.current.tableFullData.concat(a):a),Ve(i),ft(l?.data||t.data),n?.(t.data,t)}}catch(e){C?.(e)}var l;l=o,Object.prototype.hasOwnProperty.call(l,"stopToFirst")&&(o.stopToFirst=!1),ce(!1),je(!1)},mt=xt(ut),pt=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=pt(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:r}=A;return!j||W?e:(t-1)*r+e})(t)),e))),ht=e=>{const t=Je(pt(e));Ot(t),Pt(t),rt(nt()),fe(at()),gt(),x?.(t)},ft=e=>{if(!U)return;const t=i?.fetch?.dataKey??zo.summationKey,r=(t?(0,Q.get)(e,t):e)??{},n={};K.filter((e=>!!e.summation.dataKey)).forEach((e=>{zr(n,e.dataIndex,Number(jr(r,e.summation.dataKey)))})),Te(n)},gt=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=Tt();if(e.length){const t=w(e[0],e[0].index);rt([t])}else rt([])}},yt=()=>{if(!W)return;const e=Et();qe.current||A.current>=e||(je(!0),bt({...A,current:A.current+1}))},bt=({current:e,pageSize:t})=>{se((r=>Object.assign({},r,{current:e,pageSize:t})))},Et=()=>{const{pageSize:e,total:t}=A;return Math.ceil(t/e)||1},Ct=()=>{bt(Object.assign({},A,{current:1}))},wt=()=>{const{scrollYLoad:e,deriveRowKeys:t}=S.current;if(!S.current.treeTable||!e)return;const r=St(t,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=u||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?q.filter((e=>!n.includes(e))):q})());$e.current.clear(),r.forEach(((e,t)=>$e.current.set(e,t)))},St=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...St(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},Nt=()=>{const{current:e,pageSize:t}=A;return S.current.tableFullData.slice((e-1)*t,e*t)},Tt=()=>B?Nt():S.current.tableFullData,It=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;if(!t)return Z(e);const{startIndex:n,endIndex:a}=r;_e?queueMicrotask((()=>_e((()=>Z(e.slice(n,a)))))):Z(e.slice(n,a))},Rt=()=>{(()=>{let e=Tt();S.current.treeTable&&p?.virtual&&(e=(e=>{const{recordsMap:t,allRowKeys:r}=S.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];$e.current.has(a)&&n.push(t.get(a))}return n})()),We(e),ne(e)})(),Ze()},Ot=e=>{ee(e),ae(e),ie(e),kt(),wt(),Rt()},Pt=e=>{te(e)},kt=()=>{ke(),S.current.allTableData.forEach((e=>Re(w(e,e.index),e)))},At=()=>{de({})},Lt=()=>{ue({})},Ft=()=>{pe([])},_t=()=>{rt([])};return{initialTable:()=>{(async()=>{if(!h)return;let t=oe(h,["fetch"]);if(h.fetch){const{api:e,params:r,dataKey:n}=h.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,Q.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;Ie((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=Or(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:l}=a,o=Pr(r,n);Se(n,{visible:t,disabled:i,secretName:l}),t||(e.noAuth=!0,o.noAuth=!0),l&&(e.formatType=`secret-${l}`,o.formatType=`secret-${l}`)}}));y?.(n)}})(),M&&T.current.setClickedValues([M,""]),"radio"===d?.type&&$.length&&T.current.setClickedValues([$[0],""]),Be(),We(),j?ut():ht(a)},checkDataIndex:()=>{const e=O.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&me("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:Ot,getTableData:ut,handleTableData:It,createWebPageData:Nt,createTableData:ht,createGroupData:Je,createSelectionKeys:nt,createRowExpandedKeys:at,setSelectionKeysEffect:rt,findParentRowKeys:lt,getAllChildRowKeys:it,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return me("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Le.removeFromRequired({x:r,y:n}),Le.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&le(t)&&Le.addToRequired({x:r,y:n,text:e.message||P.find((({dataIndex:e})=>e===n)).title+Ae("qm.form.requiredTips")}),"function"!=typeof e.validator||e.validator?.(t)||Le.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Le.state,i=(0,Q.intersection)(r,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,Q.intersection)(n,r),...(0,Q.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{v?.(S.current.tableFullData)},tableChange:ot,toLastPage:()=>{const e=Et();A.current!==e&&bt(Object.assign({},A,{current:e}))},toFirstPage:Ct,getPageCount:Et,pagerChangeHandle:bt,triggerScrollXEvent:e=>{Ue(e)},triggerScrollYEvent:e=>{Qe(e)},scrollBottomDebouncer:ze,clearTableSorter:At,clearTableFilter:Lt,clearSuperFilters:Ft,clearRowSelection:_t,clearRowHighlight:()=>{ge("")},clearTableLog:()=>{Le.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=S.current;Pe(),Le.destroy(),e.deregister(t)}}},es=(e,t)=>{const{height:r,minHeight:n,maxHeight:a,ellipsis:i,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:m,$size:p,tableColumns:h,flattenColumns:f,leftFixedColumns:g,derivedMergeCells:y,layout:b,scrollX:v,scrollY:x,showFooter:E,showPagination:C,isFullScreen:w,setLayout:S,setScrollX:N,setScrollY:T,setElementStore:I,setScrollXStore:R,setScrollYStore:O,setShouldToTop:P}=t,k=l().useRef(x),A=l().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=b,i={};return n&&Object.assign(i,{minHeight:`${Kr(n)}px`}),a&&Object.assign(i,{maxHeight:`${Kr(a)}px`}),w?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:r?{...i,height:"auto"!==r?`${Kr(r)}px`:`${t}px`}:i}),[r,a,n,w,b]),L=()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=o?e.$header.offsetHeight:b.headerHeight,i=E?e.$footer.offsetHeight:b.footerHeight,l=n-a-i,s=e.$tableBody.offsetHeight,c=t||s>l;let u=0;if(w){const t=e.$toper?e.$toper.offsetHeight+Oo:0,n=e.$pager?e.$pager.offsetHeight+Oo:0;u=r.winHeight-t-n-20}(t||l!==b.viewportHeight)&&_(l),k.current=c,T(c),S((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:u})))},F=(e,t)=>{const r=e+t;let n=-1,a=0,i=0;for(let t=0,l=f.length;t<l;t++){const l=f[t];if(a+=l.width||l.renderWidth,-1===n&&e<a&&(n=t),n>=0&&(i++,a>r))break}return{toVisibleIndex:Math.max(0,n),visibleSize:Math.max(8,i)}},_=e=>{const{scrollBarRef:t,scrollYStore:r,isIE:n}=d.current,a=t.current.scrollTop,{rowHeight:i}=r,{toVisibleIndex:l}=D(a,i),o=Math.max(8,Math.ceil(e/i)+2),s=n?5:0,c=Math.max(0,l-1-s),u=Math.max(l+o+s,r.endIndex);O(Object.assign({},r,{visibleSize:o,offsetSize:s,startIndex:c,endIndex:u}))},D=(e,t)=>{const r=Math.floor(e/t);return{toVisibleIndex:Math.max(0,r)}},H=(e,t)=>{const{scrollBarRef:r,elementStore:n,scrollYStore:a,scrollYLoad:i,tableFlatData:l}=d.current;if(void 0!==t&&t>=0)r.current.SET_SCROLL_TOP(t*a.rowHeight);else if(i){const t=l.findIndex((t=>e===c(t,t.index)));t>=0&&r.current.SET_SCROLL_TOP(t*a.rowHeight)}else{const t=n.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);t&&r.current.SET_SCROLL_TOP(t.offsetTop)}};return{createElementStore:()=>{I("$toper",u.current),I("$table",m.current)},tableStyles:A,getSpan:(e,t,r,n,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,Q.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}if(y.length>0){const e=y.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{if(f.findIndex((t=>t.dataIndex===e))<0){const t=Pr(h,e);e=t?kr(t).dataIndex:""}let t=0;for(let r=0;r<f.length;r++){const n=f[r];if(n.dataIndex===e)break;t+=n.width||n.renderWidth||0}return t},getStickyRight:(e,t)=>{if(f.findIndex((t=>t.dataIndex===e))<0){const t=Pr(h,e);e=t?Ar(t).dataIndex:""}const r="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let r=[];return e.forEach((e=>{e.colSpan>0&&r.length>0&&(t.push(r),r=[]),r.push(e)})),r.length>0&&t.push(r),t.map((e=>{const[t,r]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...r,...t.reverse()]})).flat()})(f):f;let n=0;for(let t=r.length-1;t>=0;t--){const a=r[t];if(a.dataIndex===e)break;n+=a.width||a.renderWidth||0}return n},scrollXToColumn:(e,t)=>{const{scrollBarRef:r}=d.current,n=void 0===t?f.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=g.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=f.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:H,rowInViewport:e=>{const{scrollBarRef:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=b,i=e*r.rowHeight;return!(i<t.current.scrollTop||i+r.rowHeight>t.current.scrollTop+(v?n-a:n))},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current,n=t.winHeight-e.$table.getBoundingClientRect().top-(C?Ra["small"!==p?"middle":p]+Oo:0)-Oo;S((e=>Object.assign({},e,{tableAutoHeight:n})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&H("",0),P(!0)},computeVirtualX:F,computeVirtualY:D,doLayout:()=>{i?L():ae((()=>L())),(()=>{const{elementStore:e,scrollXLoad:t}=d.current,r=e.$table.clientWidth,n=k.current?b.gutterWidth:0,{defaultColumnWidth:a}=zo,i=[];let l=0;if(f.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,l+=e.width):(e.renderWidth=void 0,i.push(e))})),i.length>0){const e=f.reduce(((e,t)=>e+(t.width||t.minWidth||a)),0);if(e<=r-n){N(!1);const t=r-n-e;if(1===i.length)i[0].renderWidth=(i[0].minWidth||a)+t;else{const e=t/i.reduce(((e,t)=>e+(t.minWidth||a)),0);let r=0;i.forEach(((t,n)=>{if(0===n)return;const i=Math.floor((t.minWidth||a)*e);r+=i,t.renderWidth=(t.minWidth||a)+i})),i[0].renderWidth=(i[0].minWidth||a)+t-r}}else N(!0),i.forEach((e=>{e.renderWidth=e.minWidth||a}));S((t=>({...t,tableBodyWidth:Math.max(e,r)})))}else l=f.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||a)),0),N(l>r),S((e=>({...e,tableBodyWidth:l})));S((e=>({...e,tableWidth:r}))),t&&(e=>{const{scrollXStore:t,isIE:r,scrollBarRef:n}=d.current,a=n.current.scrollLeft,{toVisibleIndex:i,visibleSize:l}=F(a,e),o=r?5:0,s=Math.max(0,i-1-o),c=Math.max(i+l+o,t.endIndex);R(Object.assign({},t,{visibleSize:l,offsetSize:o,startIndex:s,endIndex:c}))})(r)})()}}};function ts({handler:e,delay:t=0}){const r=jt(e,t),n=Y(t>0?r:e);i.useEffect((()=>(window.addEventListener("resize",n),()=>window.removeEventListener("resize",n))),[n])}const rs=e=>{const{total:t}=e,{tableRef:r,prefixCls:n,selectionKeys:a,isHeadSorter:i,isHeadFilter:o,isTreeTable:s,clearTableSorter:c,clearTableFilter:d,clearSuperFilters:u,clearRowSelection:m,clearRowHighlight:p}=l().useContext(To),{infoBarConfig:h,rowSelection:f,rowHighlight:g}=r.current.props,{allTableData:y,invalidRowKeys:b}=r.current,{hideAlert:v,hideClearButton:x}=h||{},{t:E}=G(),C=l().useMemo((()=>!v),[v]),w=l().useMemo((()=>!x&&!!(i||o||f||g)),[x,i,o,f,g]),S={[`${n}__alert`]:!0};return C?l().createElement("div",{className:xe()(S)},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.InfoCircleFilled,null)),l().createElement("span",null,E("qm.table.alert.total",{total:s?y.length:t}),f?`,${E("qm.table.alert.selected",{total:Math.max(a.length-b.length,0)})}`:""),w&&l().createElement("em",{onClick:()=>{d(),u(),m(),p(),ae((()=>c()))}},E("qm.table.alert.clear"))):null},ns=l().forwardRef(((e,t)=>{const{isFullScreen:r,open:n=!0}=e,{prefixCls:a,setFullScreen:i}=l().useContext(To),{t:o}=G(),s=()=>{i(!r)};return l().useImperativeHandle(t,(()=>({clickHandle:s}))),n?l().createElement("span",{className:`${a}-full-screen`,title:o(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},r?l().createElement(Ce.FullscreenExitOutlined,null):l().createElement(Ce.FullscreenOutlined,null))):null}));ns.displayName="FullScreen";const as=ns,is=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{prefixCls:n,getTableData:a}=l().useContext(To),{t:i}=G(),o=()=>{a()};return l().useImperativeHandle(t,(()=>({clickHandle:o}))),r?l().createElement("span",{className:`${n}-reload`,title:i("qm.table.refresh.text"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.ReloadOutlined,null))):null}));is.displayName="Reload";const ls=is,os=()=>{const e={dateFormat:e=>{const t=e?c()(e).format(Ao):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?c()(e).format(Lo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?c()(e).format(Lo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Wr(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Ur(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},t=(t,r,n)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=r,c=a||s?.(n,r)?.items||[];let d=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(d=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==d&&(d=Wr(d)?new(va())(d).toFixed(i):d),l>=0&&""!==d&&(d=Gr(d,l)),o){const t=e[`${ie(o)}Format`];t?d=t(d):me("Table","字段的格式化类型 `formatType` 配置不正确")}return d},r=e=>J(e)?Zr(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,a,i)=>{const l=jr(e,n.dataIndex),o=n.render?n.render(l,e,n,a,i):t(l,n,e);return r(o)}}},ss=l().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:c,summationRows:d,showSummary:u,getSpan:m}=l().useContext(To),{tablePrint:p,showHeader:h}=i.current.props,{t:f}=G(),{getTitleFromCellValue:g}=os(),y=a?.print?.leftLogo??"",b=a?.print?.rightLogo??"",v=!(!y&&!b),x=l().useMemo((()=>se(Lr(r,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn]))),[r]),E=l().useMemo((()=>se(Lr(c,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn]))),[c]),C=l().useMemo((()=>se(r.filter((e=>e.printFixed)))),[r]),w=e=>{const t=Object.assign({},nn(x,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?w(t):t},S=(e,t)=>(0,Q.map)((0,Q.groupBy)((0,Q.flatten)(e),t),(0,Q.spread)(((...e)=>(0,Q.mergeWith)(...e,((e,r)=>{if(Array.isArray(e))return S(e.concat(r),t)}))))),N=()=>{const{tableFullData:e}=i.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||zo.defaultColumnWidth,n<=zo.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),C.length&&e.unshift(...C),t.push(r),r=[],n=0,a=0):(i.width=zo.printWidth,r.push(i),t.push(r),a++)}return t})([...E]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(w(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:S(r,"dataIndex")[0]})))(r),t.push(Dr(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=T(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},T=(e,t,r)=>{const{showLogo:n=!0}=p;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((({width:e,minWidth:t,renderWidth:r})=>`<col style="width:${e||r||t||zo.defaultColumnWidth}px">`)).join("")}</colgroup>`,h&&(a+=["<thead>",n&&v?`<tr><th colspan="${t.length}" style="border: 0">${['<table class="no-border" width="100%" border="0" cellspacing="0" cellpadding="0">',"<tr>",'<td width="50%" align="left">',y?`<img src="${y}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${Jr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${_r(r).map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=m(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${n<=0?`<span style="padding-left:${e._level*zo.treeTable.textIndent}px"></span>`:""}${g(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),u&&d.length&&(a+=["<tfoot>",d.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):jr(e,`${a}_text`);return`<td>${0===n&&""===l?f("qm.table.config.summaryText"):J(l)?Zr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},I=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});Ot(e,i)}})(0,N())?.then((({content:e,blob:t})=>{let r=document.createElement("iframe");r.setAttribute("frameborder","0"),r.setAttribute("width","100%"),r.setAttribute("height","0"),r.style.display="none",document.body.appendChild(r),i.current.isIE?(r.contentDocument.write(e),r.contentDocument.execCommand("print"),r.parentNode.removeChild(r),r=null):(r.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{r.parentNode.removeChild(r),r=null}))},r.src=URL.createObjectURL(t))}))};return l().useImperativeHandle(t,(()=>({clickHandle:I}))),n?l().createElement("span",{className:`${s}-print`,title:f("qm.table.print.text"),onClick:()=>I()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.PrinterOutlined,null))):null}));ss.displayName="TablePrint";const cs=ss,ds=require("exceljs");var us=n.n(ds);const ms="606060",ps="thin",hs="d4d4d4",fs=(e,t)=>{t&&(e.height=Math.floor(.75*t))},gs=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},ys=()=>({top:{style:ps,color:{argb:hs}},left:{style:ps,color:{argb:hs}},bottom:{style:ps,color:{argb:hs}},right:{style:ps,color:{argb:hs}}}),bs=e=>{const{children:t}=e;return t&&t.length?bs(t[0]):e},vs=e=>{const{precision:t,formatType:r}=e,n=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===r?{numFmt:n?`0${n}%`:"0%"}:"finance"===r?{numFmt:n?`#,##0${n}`:"#,##0"}:n?{numFmt:`0${n}`}:null},xs=()=>{const{tableRef:e,getSpan:t,showSummary:r,isHeadGroup:n}=l().useContext(To),{spanMethod:a,showHeader:i}=e.current.props,{t:o}=G(),s=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(l,s,c,d)=>{const{columns:u,footSummation:m}=l,{scrollYStore:{rowHeight:p}}=e.current,h=Tr(u),f=Dr(u),g=[],y=[],b=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:r,minWidth:n,renderWidth:a}=e;E[t]=Jr(e.title),b.push({key:t,width:(r||a||n||zo.defaultColumnWidth)/8})})),i&&(n?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=bs(e),l=h.findIndex((({dataIndex:e})=>e===i.dataIndex));r[i.dataIndex]=Jr(e.title),0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const C=_r(s).map(((e,r)=>{const n={};return h.forEach(((i,l)=>{if("function"==typeof a){const{rowSpan:n,colSpan:a}=t(e,i,r,l,s);(a>1||n>1)&&v.push({s:{r:r+x,c:l},e:{r:r+x+n-1,c:l+a-1}})}const o=["percent","finance"].includes(i.formatType);n[i.dataIndex]=o?jr(e,i.dataIndex):d(e,r,i,l)})),n._level=e._level,n}));x+=C.length,r&&m&&c(h,s).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(s):jr(e,a);r[a]=0===n&&""===l?o("qm.table.config.summaryText"):J(l)?Zr(l).join(""):l})),y.push(r)}));const{sheetName:w,useStyle:S}=l,N=new(us().Workbook),T=N.addWorksheet(w);T.columns=b,i&&T.addRows(g).forEach((e=>{S&&fs(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),r=Pr(u,t.key),{align:n,theadAlign:a}=r;gs(e,a||n),S&&Object.assign(e,{font:{bold:!0,color:{argb:ms}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:ys()})}))})),T.addRows(C).forEach(((e,t)=>{const{_level:r}=C[t];S&&fs(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),n=Pr(u,t.key),{align:a}=n;gs(e,a),Object.assign(e,vs(n)),S&&Object.assign(e,{font:{color:{argb:ms}},border:ys()}),1===Number(e.col)&&r&&(e.alignment={...e.alignment,indent:r})}))})),r&&m&&T.addRows(y).forEach((e=>{S&&fs(e,p),e.eachCell((e=>{const t=T.getColumn(e.col),r=Pr(u,t.key),{align:n}=r;gs(e,n),Object.assign(e,vs(r)),S&&Object.assign(e,{font:{color:{argb:ms}},border:ys()})}))})),v.forEach((({s:e,e:t})=>{T.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const I=await N.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],l=l+(n?",":"")+r(i.textContent.trim());l+="\r\n"}return l})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=Tr(r),i=new FileReader;i.onerror=()=>{O.message.error(o("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>Jr(e.title))),n=new(us().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,l);if(c){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;Array.isArray(n?.richText)&&(n=n.richText.map((e=>e.text)).join("")),(0,Q.isPlainObject)(n)&&"text"in n&&(n=n.text),(0,Q.isDate)(n)&&(n=Xr(n,Lo)),n?.formula&&(n=n.result??n.value),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>s(l,e))).filter((e=>""!==e)):t[e]=s(l,t[e])),zr(n,i,t[e])})),n}));t?.(n)}else O.message.error(o("qm.table.import.error"))}else O.message.error(o("qm.table.import.error"))})):O.message.error(o("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},Es=e=>{const{fileType:t,onChange:r}=e,{prefixCls:n}=l().useContext(To),{t:a}=G();let i,o;const s=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return l().createElement(fe,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return i||(i=document.createElement("form"),o=document.createElement("input"),i.className=`${n}--file-form`,o.name="file",o.type="file",i.appendChild(o),document.body.appendChild(i)),new Promise(((e,r)=>{const n=!t.type;o.multiple=!!t.multiple,o.accept=n?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!n)for(let e=0;e<c.length;e++){const{type:r}=s(c[e]);if(t.type!==r){u=r;break}}u?(O.message.warning(a("qm.upload.notType",{type:u})),r()):e(d),document.body.removeChild(i),i=null,o=null},i.reset(),o.click()}))})({type:t});r?.(e.name,e)}catch(e){}})()},a("qm.upload.text"))},Cs=e=>{const{columns:t,onClose:r}=e,{tableRef:n,prefixCls:a,createTableData:i,dataChange:o}=l().useContext(To),{beforeTableImport:s}=n.current.props,{t:c}=G(),{importXLSX:d}=xs(),u=l().useRef(null),[m,p]=l().useState(!1),[h,f]=l().useState(!0),g=e=>e.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))),y={posIndex:"条"},[b,v]=l().useState([{type:"INPUT",label:c("qm.table.export.fileName"),fieldName:"fileName",render:(e,t)=>{const{fileName:r}=t.GET_FIELDS_VALUE(["fileName"]);return l().createElement(l().Fragment,null,r?l().createElement("span",null,r):l().createElement(Es,{fileType:t.state.formData.fileType,onChange:(e,r)=>{t.SET_FIELDS_VALUE({fileName:e,file:r}),r&&f(!1)}}))}},{type:"SELECT",label:c("qm.table.export.fileType"),fieldName:"fileType",allowClear:!1,options:{itemList:[{text:"xlsx",value:"xlsx"}]}},{type:"SELECT",label:c("qm.table.import.importType"),fieldName:"importType",allowClear:!1,options:{itemList:[{text:c("qm.table.import.fillText"),value:"fill"},{text:c("qm.table.import.addText"),value:"add"},{text:c("qm.table.import.insertText"),value:"insert"}]},onChange:e=>{b.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&u.current.SET_FIELDS_EXTRA(y),v([...b])}},{type:"INPUT_NUMBER",label:c("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:n.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]);return l().createElement("div",{className:`${a}-import__setting`},l().createElement(Ml,{ref:u,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:y,items:b,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:m,disabled:h,onClick:()=>(async()=>{const[e,a]=await u.current.GET_FORM_DATA();e||(p(!0),d({columns:g(t),file:a.file},(async e=>{const{tableFullData:t,store:l}=n.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=await s(e)}catch(e){}if("fill"===a.importType&&i(e),"add"===a.importType&&i([...t,...e]),"insert"===a.importType){const r=a.posIndex,n=t.slice(0,r).concat(e).concat(t.slice(r));i(n)}e.forEach((e=>{l.addToInserted(e)})),o(),O.message.success(c("qm.table.import.success",{total:e.length})),p(!1),r()})))})()},c("qm.table.import.text"))))},ws=l().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{prefixCls:a}=l().useContext(To),{t:i}=G(),[o,s]=l().useState(!1),c=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:c})));const d={[`${a}-import`]:!0},u={visible:o,title:i("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:xe()(d),title:i("qm.table.import.textNoSpace"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.ImportOutlined,null))),l().createElement(cr,u,l().createElement(Cs,{columns:r,onClose:()=>s(!1)})))}));ws.displayName="TableImport";const Ss=ws,Ns=e=>{const{columns:t,onChange:r}=e,{prefixCls:n,$size:a}=l().useContext(To),{t:i}=G(),o=l().useRef([]),[s,c]=l().useState(!1),[d,u]=l().useState(t);De((()=>{p()}),[d]),l().useEffect((()=>{m()}),[t]);const m=()=>{const e=[];t.forEach(((r,n)=>{const a=r.colSpan;a>1&&t.slice(n+1,n+a).every((({colSpan:e})=>0===e))&&e.push(t.slice(n,n+a))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...o.current[a].map((({dataIndex:e},r)=>{const n=d.find((t=>t.dataIndex===e));return r>0&&void 0!==t.hidden&&(n.hidden=t.hidden),n})))})),r?.(e)},h={[`${n}__popper`]:!0,"column-filter__popper":!0,[`${n}--lg`]:"large"===a,[`${n}--sm`]:"small"===a},f=[`${n}-column-filter`,{selected:s}];return l().createElement(Ma(),{action:["click"],popupVisible:s,popup:l().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"main"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:d,setList:e=>{const t=e.map((e=>e.dataIndex)),r=d.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||u(sn(e))}},d.map((e=>((e,t)=>{const{colSpan:r}=e;if(0===r)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const n=["svgicon","handle","main-handle"];return l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,u([...d])}}),l().createElement("i",{className:xe()(n),title:i("qm.table.columnFilter.draggable")},l().createElement(Ce.HolderOutlined,null)),l().createElement("span",{className:"text"},Jr(e.title)))})(e)))))),popupClassName:xe()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:_o,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:xe()(f),title:i("qm.table.columnFilter.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.SettingOutlined,null)),l().createElement("span",null,i("qm.table.columnFilter.text"))))},Ts=e=>{const{defaultValue:t,onClose:r,onOk:n}=e,{tableRef:a,prefixCls:i,selectionKeys:o,pagination:s,showSummary:d}=l().useContext(To),{rowSelection:u}=a.current.props,{t:m}=G(),p=l().useRef(null),[h,f]=l().useState(!1),g=l().useMemo((()=>Object.assign({},{fileName:`${c()().format(Fo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:d?1:0,useStyle:0},t,{columns:se(t.columns||[])})),[]),[y,b]=l().useState([{type:"INPUT",label:m("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:m("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:m("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:m("qm.table.export.all"),value:"all"},{text:m("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==u?.type},{text:m("qm.table.export.custom"),value:"custom"}]},onChange:e=>{y.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...y])}},options:{min:1},disabled:!0},{type:"INPUT",label:m("qm.table.columnFilter.text"),fieldName:"columns",render:(e,t)=>l().createElement(Ns,{columns:t.state.formData.columns,onChange:e=>{t.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:m("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!d,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:m("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return l().createElement("div",{className:`${i}-export__setting`},l().createElement(Ml,{ref:p,initialValues:g,items:y,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r(),style:{marginRight:8}},m("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:h,onClick:()=>(async()=>{const[e,t]=await p.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);n(t),await ne(1e3),f(!1),r()}})()},m("qm.table.export.text"))))},Is=l().forwardRef(((e,t)=>{const{tableColumns:r,open:n=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:d,pagination:u,fetchParams:m,isFetch:p,isGroupSubtotal:h,showSummary:f,getSpan:g}=l().useContext(To),{exportExcel:y,fetch:b,showHeader:v}=i.current.props,{t:x}=G(),{getTitleFromCellValue:E}=os(),[C,w]=l().useState(!1),[S,N]=l().useState(!1),T=l().useMemo((()=>!!y?.fetch?.api),[y]),I=l().useMemo((()=>!u.total||S),[u.total,S]),R=l().useMemo((()=>Lr(r,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn])),[r]),P=l().useMemo((()=>Lr(d,[zo.expandableColumn,zo.selectionColumn,zo.operationColumn])),[d]),k=(e,t="",r=0)=>e.map(((e,n)=>{const a={...e,index:n,pageIndex:n},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=r,Array.isArray(e.children)&&(a.children=k(e.children,i,r+1)),P.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&zr(a,t,jr(a,t))})),a})),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(h?en(t):t).reduce(((e,t)=>{if(t?.[zo.summaryIgnore])return e;const r=Number(jr(t,n));return Number.isNaN(r)?e:e+r}),0);zr(r,n,a)})),[r]},L=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let l=E(e,r,t,n);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:F,exportCSV:_}=xs(),D=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=b;let i=[];try{N(!0);const l=await t({...r(m),[zo.currentPageName]:1,[zo.pageSizeName]:e??u.total});if(200===l.code){let e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,a)??[];e="function"==typeof n?await n(e):e,i=k(e)}}catch(e){}return N(!1),i},H=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},$=y?.fileName??`${c()().format(Fo)}.xlsx`,q=$.slice($.lastIndexOf(".")+1).toLowerCase(),M=()=>{if(I)return O.message.warning(x("qm.table.export.warnText"));T?(async e=>{N(!0);try{const{api:t,params:r}=y.fetch,n=await t({columns:P.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...m,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[zo.currentPageName]:void 0,[zo.pageSizeName]:void 0});n.data&&(Ot(n.data,e),H(e))}catch(e){}N(!1)})($):w(!0)};l().useImperativeHandle(t,(()=>({clickHandle:M})));const K={[`${s}-export`]:!0},V={visible:C,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>w(!1)},j={fileName:$.slice(0,$.lastIndexOf(".")),fileType:q,columns:R,useStyle:y?.cellStyle?1:0};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:xe()(K),title:x("qm.table.export.textNoSpace"),onClick:()=>M()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.DownloadOutlined,null))),l().createElement(cr,V,l().createElement(Ts,{defaultValue:j,onClose:()=>w(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:l}=e,{tableFullData:o,selectionRows:s}=i.current;let c=[];if(p?("all"===n&&(c=await D()),"custom"===n&&(c=await D(l),c=c.slice(a-1))):("all"===n&&(c=o.slice(0)),"custom"===n&&(c=o.slice(a-1,l||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof y?.beforeExport)try{c=y?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await F(e,c,A,L);Ot(r,`${t}.xlsx`),H(`${t}.xlsx`)}if("csv"===r){const r=_(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=Dr(r),i=Tr(r);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((({width:e,minWidth:t,renderWidth:r})=>`<col style="width:${e||r||t||zo.defaultColumnWidth}px">`)).join("")}</colgroup>`,v&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${Jr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${_r(t).map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=g(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${L(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&n&&(l+=["<tfoot>",A(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,l=i?.render?i.render(t):jr(e,a);return`<td>${0===n&&""===l?x("qm.table.config.summaryText"):J(l)?Zr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));Ot(r,`${t}.csv`),H(`${t}.csv`)}})(Object.assign({},e,{columns:Ir(e.columns)}))}})))}));Is.displayName="TableExport";const Rs=Is,Os=e=>{const{columns:t,onClose:r}=e,{tableRef:n,tableBodyRef:a,prefixCls:i,dataChange:o}=l().useContext(To),{beforeClipboard:s}=n.current.props,{t:c}=G(),d=l().useRef(null),[u,m]=l().useState([{type:"INPUT_NUMBER",label:c("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:c("qm.table.clipboard.colIndex"),fieldName:"colIndex",options:{itemList:t.map(((e,t)=>({value:t,text:Jr(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:c("qm.table.clipboard.content"),fieldName:"content",placeholder:c("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[p,h]=l().useState(!1);return l().createElement("div",{className:`${i}-clipboard__setting`},l().createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),l().createElement(Ml,{ref:d,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:u,cols:1,labelWidth:100}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(fe,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,i]=await d.current.GET_FORM_DATA();if(e)return;const{tableFullData:l,store:u}=n.current;h(!0);const m=i.content.trim().replace(/(\r|\n)$/,"");let p=m.replace(/"[^"]+"/g,"^");(m.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{p=p.replace(/\^/,e)}));let f=p.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{f=await s(f,f[0].map(((e,r)=>t[i.colIndex+r].dataIndex)))}catch(e){}f.forEach(((e,r)=>{e.forEach(((e,a)=>{const o=l[i.rowIndex-1+r],s=t[i.colIndex+a];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||e.extra?.disabled||n.current.fieldAuth[s.dataIndex]?.disabled)}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(zr(o,s.dataIndex,e),u.addToUpdated(o))}}))})),a.current.forceUpdate(),o(),O.message.success(c("qm.table.clipboard.success",{total:f.length})),h(!1),r()})()},c("qm.table.clipboard.text"))))},Ps=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{prefixCls:n,flattenColumns:a}=l().useContext(To),{t:i}=G(),[o,s]=l().useState(!1),c=l().useMemo((()=>(e=>e.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))))(a)),[a]),d=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:d})));const u={[`${n}-clipboard`]:!0},m={visible:o,title:i("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:xe()(u),title:i("qm.table.clipboard.textNoSpace"),onClick:()=>d()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.CopyOutlined,null))),l().createElement(cr,m,l().createElement(Os,{columns:c,onClose:()=>s(!1)})))}));Ps.displayName="TableClipboard";const ks=Ps,As=e=>{const{columns:t,onClose:r}=e,{tableRef:n,$size:a,selectionKeys:i,setSelectionKeysEffect:o}=l().useContext(To),{rowKey:s,rowSelection:c}=n.current.props,{t:d}=G(),u=l().useRef(null),m=vt(u),p=e=>e.map((e=>{const t={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:e.dictItems??[],render:e.render};return Array.isArray(e.children)&&(t.children=p(e.children)),t})),[h,f]=l().useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(t.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))))]),[y]=l().useState((()=>{const{disabled:e}=c||{},t=n.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[b,v]=l().useState(300),x=xt((()=>{const e=u.current;v(e.offsetHeight-2*Ra[a]-30)}),5);return g((()=>{x()}),[m.width]),l().createElement("div",{ref:u,style:{height:"100%"}},l().createElement(Zc,{size:a,columns:h,dataSource:y,rowKey:s,height:b,rowSelection:{type:"checkbox",selectedRowKeys:i,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),l().createElement("div",{style:{height:10}}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},Ls=l().forwardRef(((e,t)=>{const{columns:r,open:n=!0}=e,{tableRef:a,getRowKey:i,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=l().useContext(To),{rowSelection:p}=a.current.props,{t:h}=G(),[f,g]=l().useState(!1),y=l().useRef(!1);De((()=>{!y.current&&b()}),[d]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(c&&e)try{const r=await e.api(Object.assign({},{selectedKeys:s},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,Q.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),u(n.map(((e,t)=>i(e,t)))),m(n),y.current=!0}}catch(e){}},v=()=>{g(!0)};l().useImperativeHandle(t,(()=>({clickHandle:v})));const x={visible:f,title:h("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${o}-select-collection`,title:h("qm.table.selectCollection.text"),onClick:()=>v()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.CheckSquareOutlined,null))),l().createElement(cr,x,l().createElement(As,{columns:r,onClose:()=>g(!1)})))}));Ls.displayName="SelectCollection";const Fs=Ls,_s=require("localforage");var Ds=n.n(_s);const Hs=e=>{const{onClose:t}=e,{global:r}=l().useContext(o),{tableRef:n,getRowKey:a,prefixCls:i,$size:s,flattenColumns:c,pagination:d,createWebPageData:u,setPagination:m,scrollYToRecord:p,setHighlightKey:h,setShouldToTop:f,isTreeTable:g,isWebPagination:y}=l().useContext(To),{uniqueKey:b}=n.current.props,{t:v}=G(),x=l().useRef(null),E=l().useRef(null),C=l().useRef([]),w=l().useRef(""),S=l().useRef(-1),N=l().useRef("stop");De((()=>{const e=_r(u()).findIndex((e=>a(e,e.index)===w.current));p("",e)}),[d.current]);const T=e=>{let t;switch(e){case"text":case"textarea":default:t="INPUT";break;case"number":t="INPUT_NUMBER";break;case"date":t="DATE";break;case"checkbox":case"radio":t="SELECT"}return t},I=e=>e.filter((e=>e?.dataIndex)).map((e=>({type:T(e.filter.type),fieldName:e.dataIndex,label:Jr(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await x.current.GET_FORM_DATA(),[r,n]=await E.current.GET_FORM_DATA(),a=(0,Q.omitBy)(Object.assign({},t,n),le);A(a)}}))),R={case:0,fullchar:0},P=l().useMemo((()=>c.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[k,A]=l().useState({}),[L,F]=l().useState(R),[_]=l().useState(I([P[0]])),[D]=l().useState(I(P.slice(1))),[H,$]=l().useState(0),q=l().useMemo((()=>!Object.keys(k).length),[k]);De((()=>{N.current="ready"}),[k,L]);const M=e=>{F(Object.assign({},L,e))},K=(e,t,r)=>new Promise(((n,a)=>{O.Modal.confirm({title:v("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),V=async e=>{if(!Object.keys(k).length)return O.Modal.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.queryCondition")});if("ready"===N.current&&(N.current="stop",C.current=(e=>{const{allTableData:t}=n.current,r=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];let l=!0;for(const t in e){const{type:r}=P.find((e=>e.dataIndex===t)).filter;let n=jr(i,t),o=!0;if("text"===r||"textarea"===r?o=new RegExp(L.fullchar?`^${e[t]}$`:e[t],L.case?"":"i").test(n):(n="string"==typeof(a=n)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(a)?n.slice(0,10):n,o=n==e[t]),!o){l=!1;break}}l&&r.push(i)}var a;return r})(k),$(C.current.length)),!C.current.length)return h(""),O.Modal.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.notMatch")});"next"===e&&(S.current=S.current<0?0:S.current+1,S.current>C.current.length-1&&await K(v("qm.table.fastSearch.toTheEnd"),(()=>S.current=0),(()=>S.current=C.current.length-1))),"prev"===e&&(S.current=S.current<0?C.current.length-1:S.current-1,S.current<0&&await K(v("qm.table.fastSearch.toStart"),(()=>S.current=C.current.length-1),(()=>S.current=0)));const t=C.current[S.current],r=a(t,t.index);let i=t.index;if(g&&y){const e=an(n.current.deriveRowKeys,r)[0];i=n.current.tableFullData.findIndex((t=>a(t,t.index)===e))}((e,t)=>{if(w.current=e,y){const{pageSize:e}=d,r=Math.ceil((t+1)/e);f(!1),m(Object.assign({},d,{current:r}))}else p(e)})(r,i),h(r)},j=()=>{x.current.RESET_FORM(),E.current.RESET_FORM()},z=l().useMemo((()=>b?`fastSearch_${b}`:""),[b]),[B,W]=l().useState([]),[U,Y]=l().useState(""),[X,Z]=l().useState("");De((()=>{if(X){const{filters:e,config:t}=B.find((e=>e.value===X)).list;x.current.SET_FIELDS_VALUE(oe(e,D.map((e=>e.fieldName)))),E.current.SET_FIELDS_VALUE(oe(e,_.map((e=>e.fieldName)))),A(e),F(t)}else j(),A({}),F(R)}),[X]),l().useEffect((()=>{J()}),[]);const J=async()=>{if(!z)return;let e=await Ds().getItem(z);e||(e=await ee(z),Array.isArray(e)&&await Ds().setItem(z,e)),Array.isArray(e)&&e.length&&(W(e),Z(e[0].value))},ee=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},te=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}};return l().createElement("div",{className:`${i}-fast-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"top"},l().createElement("div",{className:"container"},l().createElement(Jt,{defaultActiveKey:"1",size:"small",tabBarExtraContent:l().createElement("span",null,v("qm.table.alert.total",{total:H}))},l().createElement(Jt.TabPane,{tab:v("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},l().createElement(Ml,{ref:x,items:_,cols:1,labelWidth:110})),l().createElement(Jt.TabPane,{tab:v("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},l().createElement(Ml,{ref:E,items:D,cols:1,labelWidth:110})))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(O.Input,{size:s,value:U,placeholder:v("qm.table.highSearch.configText"),disabled:q,onChange:e=>{const{value:t}=e.target;Y(t)}}),l().createElement(fe,{type:"primary",disabled:!U||q,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!z)return me("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Qr(),t=[...B,{text:U,value:e,list:{filters:k,config:L}}];W(t),Z(e),Y(""),await Ds().setItem(z,t),await te(z,t)})()},v("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${zo.rowHeightMaps[s]}px`}},l().createElement("span",null,v("qm.table.fastSearch.savedSetting"))),l().createElement("ul",null,B.map((e=>l().createElement("li",{key:e.value,className:xe()({selected:e.value===X}),title:e.text,onClick:()=>{return t=e.value,void Z(t!==X?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:v("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=B.filter((t=>t.value!==e));W(t),e===X&&Z(""),await Ds().setItem(z,t),await te(z,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!B.length&&l().createElement("div",{style:{padding:Oo}},l().createElement(ct,null)))))),l().createElement("div",{className:"bottom"},l().createElement("div",null,l().createElement(O.Checkbox,{checked:!!L.case,onChange:e=>M({case:e.target.checked})},v("qm.table.fastSearch.matchCase")),l().createElement(O.Checkbox,{checked:!!L.fullchar,onChange:e=>M({fullchar:e.target.checked})},v("qm.table.fastSearch.matchFullchar"))),l().createElement("div",null,l().createElement(fe,{onClick:()=>j()},v("qm.table.fastSearch.clear"))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Ra[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},v("qm.table.fastSearch.closeButton")),l().createElement(fe,{type:"primary",style:{marginRight:8},onClick:()=>V("prev")},v("qm.table.fastSearch.queryPrev")),l().createElement(fe,{type:"primary",onClick:()=>V("next")},v("qm.table.fastSearch.queryNext"))))},$s=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{prefixCls:n,$size:a}=l().useContext(To),{t:i}=G(),[o,s]=l().useState(!1),c=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:c})));const d={visible:o,title:i("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Ra[a]+20}px`},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${n}-super-search`,title:i("qm.table.fastSearch.text"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.MonitorOutlined,null))),l().createElement(cr,d,l().createElement(Hs,{onClose:()=>s(!1)})))}));$s.displayName="FastSearch";const qs=$s,Ms=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{prefixCls:n}=l().useContext(To),{t:a}=G(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c={visible:i,title:a("qm.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${n}-pivot-grid`,title:a("qm.pivotGrid.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.LineChartOutlined,null))),l().createElement(cr,c,l().createElement(vm,null)))}));Ms.displayName="PivotGrid";const Ks=Ms,Vs=e=>{const{columns:t,group:r,summary:n}=e,{tableRef:a,$size:i,pagination:o,fetchParams:s,isFetch:d}=l().useContext(To),{fetch:u}=a.current.props,{t:m}=G(),p=e=>{const r=t.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:r.dictItems??[]}},h=r.map((e=>({dataIndex:e.group,...p(e.group)}))),f=n.map((e=>e.summary===zo.groupSummary.total.value?{dataIndex:e.summary,title:zo.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=l().useMemo((()=>Object.assign({},s,{[zo.sorterFieldName]:void 0,[zo.groupSummary.summaryFieldName]:n.map((e=>`${e.formula}|${e.summary}`)).join(","),[zo.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[zo.currentPageName]:1})),[s,r,n]),[y,b]=l().useState(((e,r)=>[{title:m("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...r.map((e=>{const r=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=r?{summation:r}:null;return e.dataIndex===zo.groupSummary.total.value&&(n={dataIndex:zo.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,f)),[v]=l().useState(d?[]:(e=>{const t=rn(e,r.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};y.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&zr(t,n,jr(e[0],n))})),n.forEach((r=>{const n=r.summary!==zo.groupSummary.total.value?r.summary:zo.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&zr(t,n,e.length),"sum"===a&&zr(t,n,(0,Q.sumBy)(e,n)),"max"===a&&zr(t,n,(0,Q.maxBy)(e,n)[n]),"min"===a&&zr(t,n,(0,Q.minBy)(e,n)[n]),"avg"===a&&zr(t,n,((0,Q.sumBy)(e,n)/e.length).toFixed(2))})),a.push(t)})),a})(a.current.tableFullData)),x={size:i,height:400,...d?{fetch:{api:u.api,params:g,dataKey:u?.dataKey}}:{dataSource:v},columns:y,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${c()().format(Fo)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>b(e)};return l().createElement(Zc,x)},js=e=>{const{onClose:t}=e,{global:r}=l().useContext(o),{tableRef:n,prefixCls:a,$size:i,flattenColumns:s}=l().useContext(To),{uniqueKey:c}=n.current.props,{t:d}=G(),u=l().useRef(null),m=l().useRef(null),[p,h]=l().useState(!1),[f,g]=l().useState([]),[y,b]=l().useState(""),[v,x]=l().useState("");De((()=>{if(v){const{group:e,summary:t}=f.find((e=>e.value===v)).list;I(e),A(t)}else{const e=D();I(e?.group||[]),A(e?.summary||[])}}),[v]),l().useEffect((()=>{H()}),[]);const E=l().useMemo((()=>c?`summary_${c}`:""),[c]),C=l().useMemo((()=>s.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex)))),[s]),w=C.filter((e=>!e.groupSummary)).map((e=>({text:Jr(e.title),value:e.dataIndex}))),S=[zo.groupSummary.total,...C.filter((e=>!!e.groupSummary)).map((e=>({text:Jr(e.title),value:e.dataIndex})))],N=[{text:d("qm.table.groupSummary.sumText"),value:"sum"},{text:d("qm.table.groupSummary.maxText"),value:"max"},{text:d("qm.table.groupSummary.minText"),value:"min"},{text:d("qm.table.groupSummary.avgText"),value:"avg"},{text:d("qm.table.groupSummary.countText"),value:"count"}],[T,I]=l().useState([]),[R,P]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(t)}},d("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:d("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>({...e,disabled:T.findIndex((t=>t.group===e.value))>-1})))})}]),[k,A]=l().useState([]),[L,F]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{m.current.REMOVE_RECORDS(t)}},d("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:d("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:S.map((e=>({...e,disabled:k.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:d("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===zo.groupSummary.total.value?N.slice(N.length-1):N})}]),_=l().useMemo((()=>{const e=T.length&&T.every((e=>Object.values(e).every((e=>""!==e)))),t=k.length&&k.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[T,k]),D=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},H=async()=>{if(!E)return;const e=D();if(e){const{group:t,summary:r}=e;I(t),A(r)}let t=await Ds().getItem(E);t||(t=await $(E),Array.isArray(t)&&await Ds().setItem(E,t)),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},M={visible:p,title:d("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return l().createElement("div",{className:`${a}-group-summary__setting`},l().createElement("div",{className:"main"},l().createElement("div",{style:{width:"30%"}},l().createElement(Zc,{ref:u,size:i,columns:R,dataSource:T,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{I(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(Ce.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"container line"},l().createElement(Zc,{ref:m,size:i,columns:L,dataSource:k,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onDataChange:e=>{A(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(Ce.PlusOutlined,null),onClick:()=>{m.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(O.Input,{size:i,value:y,placeholder:d("qm.table.groupSummary.configText"),disabled:_,onChange:e=>{const{value:t}=e.target;b(t)}}),l().createElement(fe,{type:"primary",disabled:!y||_,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return me("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Qr(),t=[...f,{text:y,value:e,list:{group:T.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}}];g(t),x(e),b(""),await Ds().setItem(E,t),await q(E,t)})()},d("qm.table.groupSummary.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${zo.rowHeightMaps[i]}px`}},l().createElement("span",null,d("qm.table.groupSummary.savedSetting"))),l().createElement("ul",null,f.map((e=>l().createElement("li",{key:e.value,className:xe()({selected:e.value===v}),title:e.text,onClick:()=>{return t=e.value,void x(t!==v?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:d("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));g(t),e===v&&x(""),await Ds().setItem(E,t),await q(E,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!f.length&&l().createElement("div",{style:{padding:Oo}},l().createElement(ct,null)))))),l().createElement(cr,M,l().createElement(Vs,{columns:C,group:T,summary:k})),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},d("qm.table.groupSummary.closeButton")),l().createElement(fe,{type:"primary",disabled:_,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:T.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))})),void h(!0))},d("qm.table.groupSummary.confirmButton"))))},zs=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{prefixCls:n}=l().useContext(To),{t:a}=G(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c={visible:i,title:a("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${n}-group-summary`,title:a("qm.table.groupSummary.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.PieChartOutlined,null))),l().createElement(cr,c,l().createElement(js,{onClose:()=>o(!1)})))}));zs.displayName="GroupSummary";const Bs=zs,Ws=e=>{const{onClose:t}=e,{global:r}=l().useContext(o),{tableRef:n,$size:a,prefixCls:i,flattenColumns:s,setSuperFilters:c,clearTableFilter:d}=l().useContext(To),{uniqueKey:u}=n.current.props,{t:m}=G(),p=l().useRef(null),[h,f]=l().useState([]),[g,y]=l().useState([]),[b,v]=l().useState(""),[x,E]=l().useState("");De((()=>{f(x?g.find((e=>e.value===x)).list:D()||[])}),[x]),l().useEffect((()=>{H()}),[]);const C=l().useMemo((()=>u?`superSearch_${u}`:""),[u]),w=l().useMemo((()=>s.filter((e=>!!e.filter))),[s]),S=tn(h),N=l().useMemo((()=>!(S&&Sr(S))),[S]),T=l().useMemo((()=>!!h.length&&N),[h,N]),I=[{value:"and",text:m("qm.table.highSearch.andText")},{value:"or",text:m("qm.table.highSearch.orText")}],R=s.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Jr(e.title)}))),P=e=>["in","nin"].includes(e),k=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},A=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:m("qm.table.highSearch.gtText")},{value:"<",text:m("qm.table.highSearch.ltText")},{value:">=",text:m("qm.table.highSearch.gteText")},{value:"<=",text:m("qm.table.highSearch.lteText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",text:m("qm.table.highSearch.inText")},{value:"nin",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:m("qm.table.highSearch.likeText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")}]}return t},[L,F]=l().useState([{title:m("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(fe,{type:"text",onClick:()=>{p.current.REMOVE_RECORDS(t)}},m("qm.table.highSearch.removeText")))},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:R,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:m("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=w.find((e=>e.dataIndex===r))?.filter.type,a=A(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=P(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:m("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:m("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:A(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=P(e.expression)?[]:""}}}},{title:m("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=w.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:k(r,P(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,t)=>l().createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{C&&sessionStorage.setItem(C,JSON.stringify(h.filter((e=>!!e.fieldName))))},D=()=>{if(!C)return;const e=sessionStorage.getItem(C);return e?JSON.parse(e):null},H=async()=>{if(!C)return;const e=D();e&&f(e);let t=await Ds().getItem(C);t||(t=await $(C),Array.isArray(t)&&await Ds().setItem(C,t)),Array.isArray(t)&&t.length&&(y(t),!e&&E(t[0].value))},$=async e=>{const t=r?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}};return l().createElement("div",{className:`${i}-super-search__setting`},l().createElement("div",{className:"main"},l().createElement("div",{className:"container"},l().createElement(Zc,{ref:p,size:a,columns:L,dataSource:h,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),f([...h]))},onDataChange:e=>{f(e)}},l().createElement(fe,{type:"primary",icon:l().createElement(Ce.PlusOutlined,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),zo.highSearch.showSQL&&S&&l().createElement("code",{className:"lang-js"},S)),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(O.Input,{size:a,value:b,placeholder:m("qm.table.highSearch.configText"),disabled:N,onChange:e=>{const{value:t}=e.target;v(t)}}),l().createElement(fe,{type:"primary",disabled:!b||N,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!C)return me("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Qr(),t=[...g,{text:b,value:e,list:h.filter((e=>!!e.fieldName))}];y(t),E(e),v(""),await Ds().setItem(C,t),await q(C,t)})()},m("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${zo.rowHeightMaps[a]}px`}},l().createElement("span",null,m("qm.table.highSearch.savedSetting"))),l().createElement("ul",null,g.map((e=>l().createElement("li",{key:e.value,className:xe()({selected:e.value===x}),title:e.text,onClick:()=>{return t=e.value,void E(t!==x?t:"");var t}},l().createElement("span",{className:"title"},e.text),l().createElement("i",{className:"svgicon close",title:m("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=g.filter((t=>t.value!==e));y(t),e===x&&E(""),await Ds().setItem(C,t),await q(C,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!g.length&&l().createElement("div",{style:{padding:Oo}},l().createElement(ct,null)))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>t(),style:{marginRight:8}},m("qm.table.highSearch.closeButton")),l().createElement(fe,{type:"primary",disabled:T,onClick:()=>(d(),c(h.map((e=>oe(e,["index","pageIndex"])))),_(),void t())},m("qm.table.highSearch.searchButton"))))},Us=l().forwardRef(((e,t)=>{const{open:r=!0}=e,{prefixCls:n}=l().useContext(To),{t:a}=G(),[i,o]=l().useState(!1),s=()=>{o(!0)};l().useImperativeHandle(t,(()=>({clickHandle:s})));const c={visible:i,title:a("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:`${n}-super-search`,title:a("qm.table.highSearch.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.FunnelPlotOutlined,null))),l().createElement(cr,c,l().createElement(Ws,{onClose:()=>o(!1)})))}));Us.displayName="SuperSearch";const Gs=Us,Ys=l().forwardRef(((e,t)=>{const{tableColumns:r,showFullScreen:n,showReload:a,showPrint:i,showImport:s,showExport:c,showClipboard:d,showCollection:u,showFastSearch:m,showSuperSearch:p,showPivotGrid:h,showGroupSummary:f,showToolBox:g}=e,{global:y}=l().useContext(o),{tableRef:b,$size:v,prefixCls:x,isFullScreen:E}=l().useContext(To),{uniqueKey:C,exportExcel:w}=b.current.props,{t:S}=G(),N=l().useRef(null),T=l().useRef(null),I=l().useRef(null),R=l().useRef(null),P=l().useRef(null),k=l().useRef(null),A=l().useRef(null),L=l().useRef(null),F=l().useRef(null),_=l().useRef(null),D=l().useRef(null),H=l().useRef(!1),$=l().useMemo((()=>C?`toolBox_${C}`:""),[C]),[q,M]=l().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),K={fullScreen:n,reload:a,print:i,import:s,export:c&&!w?.hideIcon,clipboard:d,collection:u,fastSearch:m,superSearch:p,pivotGrid:h,groupSummary:f},[V,j]=l().useState(!1);De((()=>{H.current&&(B(),H.current=!1)}),[q]),l().useEffect((()=>{z()}),[]),l().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!P.current)return me("Table","执行导出需要配置 `exportExcel` 参数");P.current.clickHandle()}})));const z=()=>{if(!$||!g)return;const e=JSON.parse(localStorage.getItem($));e||W($).then((e=>{e&&(M(Object.assign({},q,e)),localStorage.setItem($,JSON.stringify(e)))})).catch((()=>{})),e&&M(Object.assign({},q,e))},B=()=>{if(!$||!g)return;const e={};for(const t in q)q[t]&&(e[t]=q[t]);localStorage.setItem($,JSON.stringify(e)),U($,e)},W=async e=>{const t=y?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},U=async(e,t)=>{const r=y?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},Y=async e=>{j(!1),await ne(100),e.current.clickHandle()},X=(e,t)=>{H.current=!0,M(Object.assign({},q,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${x}--lg`]:"large"===v,[`${x}--sm`]:"small"===v};return l().createElement(l().Fragment,null,n&&l().createElement(as,{ref:N,isFullScreen:E,open:!g||q.fullScreen}),a&&l().createElement(ls,{ref:T,open:!g||q.reload}),i&&l().createElement(cs,{ref:I,tableColumns:r,open:!g||q.print}),s&&l().createElement(Ss,{ref:R,tableColumns:r,open:!g||q.import}),c&&l().createElement(Rs,{ref:P,tableColumns:r,open:(!g||q.export)&&!w?.hideIcon}),d&&l().createElement(ks,{ref:k,open:!g||q.clipboard}),u&&l().createElement(Fs,{ref:A,columns:r,open:!g||q.collection}),m&&l().createElement(qs,{ref:L,open:!g||q.fastSearch}),h&&l().createElement(Ks,{ref:F,open:!g||q.pivotGrid}),f&&l().createElement(Bs,{ref:_,open:!g||q.groupSummary}),p&&l().createElement(Gs,{ref:D,open:!g||q.superSearch}),g&&l().createElement(O.Dropdown,{open:V,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.screen.full"))),onClick:()=>Y(N)},{key:"reload",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.refresh.text"))),onClick:()=>Y(T)},{key:"print",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.print.text"))),onClick:()=>Y(I)},{key:"import",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.import.textNoSpace"))),onClick:()=>Y(R)},{key:"export",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.export.textNoSpace"))),onClick:()=>Y(P)},{key:"clipboard",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.clipboard.textNoSpace"))),onClick:()=>Y(k)},{key:"collection",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.selectCollection.text"))),onClick:()=>Y(A)},{key:"fastSearch",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.fastSearch.text"))),onClick:()=>Y(L)},{key:"pivotGrid",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.pivotGrid.text"))),onClick:()=>Y(F)},{key:"groupSummary",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.groupSummary.text"))),onClick:()=>Y(_)},{key:"superSearch",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:q.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.highSearch.text"))),onClick:()=>Y(D)}];return l().createElement(O.Menu,{items:e.filter((e=>K[e.key]))})})(),overlayClassName:xe()(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{j(e)}},l().createElement("span",{className:`${x}-toolbox`,title:S("qm.table.toolbox.text")},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.AppstoreAddOutlined,null)))))}));Ys.displayName="ToolBox";const Xs=Ys,Qs=(e,t)=>e.map((e=>(e.children&&(e.children=Qs(e.children,t)),t(e)))),Zs=l().forwardRef(((e,t)=>{const{columns:r}=e,{global:n}=l().useContext(o),{tableRef:a,prefixCls:i,$size:s}=l().useContext(To),{showColumnDefine:c,uniqueKey:d,onlyShowIcon:u,columnsChange:m}=a.current.props,{t:p}=G(),h=l().useRef([]),[f,g]=l().useState(!1),y=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),b=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),v=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),x=l().useMemo((()=>d?`table_${d}`:""),[d]);De((()=>{C(r)}),[r]),l().useLayoutEffect((()=>{w()}),[]),l().useImperativeHandle(t,(()=>({initialHandler:w})));const E=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=E(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),C=e=>{if(!x)return;const t=E(e),r=JSON.parse(localStorage.getItem(x));a.current.columnsDefined&&!(0,Q.isEqual)(t,r)&&(localStorage.setItem(x,JSON.stringify(t)),(async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(x,t))},w=()=>{const e=(()=>{if(!x)return;const e=JSON.parse(localStorage.getItem(x));return e||(async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(x).then((e=>{e?(localStorage.setItem(x,JSON.stringify(e)),w()):n?.getComponentConfigApi&&C(r)})).catch((()=>{})),e?(0,Q.xor)(Rr(e).map((e=>e.dataIndex)),Rr(r).map((e=>e.dataIndex))).length>0?Qs(r,(t=>{const r=Pr(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):Qs(e,(e=>{const t=Pr(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();var t;e&&(t=S(e),h.current=t,m?.(e))},S=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((({colSpan:e})=>0===e))&&t.push(e.slice(n,n+a))})),t},N=e=>{const t=[];e.forEach((r=>{const{colSpan:n,dataIndex:a}=r;if(0===n)return;if(1===n)return t.push(r);const i=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(r);t.push(...h.current[i].map((({dataIndex:t},n)=>{const a=e.find((e=>e.dataIndex===t));return n>0&&(void 0!==r.hidden&&(a.hidden=r.hidden),void 0!==r.fixed?a.fixed=r.fixed:a.fixed&&delete a.fixed),a})))})),r.forEach(((e,r)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(r,0,e)})),m?.(t)},T=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,N(r))},I=(e,t)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=Jr(e.title),o=["svgicon","handle",`${t}-handle`],s=l().createElement("li",{key:e.dataIndex,className:"item"},l().createElement(O.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,N(r)}}),l().createElement("i",{className:xe()(o),title:p("qm.table.columnFilter.draggable")},l().createElement(Ce.HolderOutlined,null)),l().createElement("span",{className:"text",title:i},i),"main"===t?l().createElement("span",{className:xe()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>T(e,"left")},l().createElement(Ce.StepBackwardOutlined,null)),l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>T(e,"right")},l().createElement(Ce.StepForwardOutlined,null))):"sub"!==t?l().createElement("span",{className:xe()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>T(e)},l().createElement(Ce.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?l().createElement(O.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:R(e.children,e.dataIndex)},s):s},R=(e,t)=>l().createElement("div",{className:"column-filter--wrap"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:n=>{const a=n.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,Q.isEqual)(a,i)||((e,t)=>{Pr(r,t).children=e,m?.([...r])})(sn(n),t)}},e.map((e=>I(e,"sub"))))),P={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===s,[`${i}--sm`]:"small"===s},k=[`${i}-column-filter`,{selected:f}];return c?l().createElement(Ma(),{action:["click"],popupVisible:f,popup:l().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"reset"},l().createElement(fe,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const n=Pr(r,t.dataIndex)||se(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));m?.(e(a.current.originColumns))}},p("qm.table.columnFilter.reset"))),l().createElement("div",{className:"left"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),r=y.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||N([...sn(e),...v,...b])}},y.map((e=>I(e,"left"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"main"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),r=v.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||N([...y,...sn(e),...b])}},v.map((e=>I(e,"main"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"right"},l().createElement(oa.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),r=b.map((e=>e.dataIndex));(0,Q.isEqual)(t,r)||N([...y,...v,...sn(e)])}},b.map((e=>I(e,"right")))))),popupClassName:xe()(P),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{g(e)},builtinPlacements:_o,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:xe()(k),title:u?p("qm.table.columnFilter.text"):void 0},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.SettingOutlined,null)),!u&&l().createElement("span",null,p("qm.table.columnFilter.text")))):null}));Zs.displayName="ColumnFilter";const Js=Zs,ec=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}));function tc(){return tc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tc.apply(null,arguments)}const rc=e=>{const{column:t,filters:r}=e,{$size:n,prefixCls:a,setFilters:i,clearSuperFilters:o}=l().useContext(To),{t:s}=G(),c=l().useRef(null),d=l().useRef(null),u=l().useRef(null),[m,p]=l().useState(!1),[h,f]=l().useState(!1),[g,y]=l().useState({}),b=l().useMemo((()=>{const{dataIndex:e,filter:r}=t;return`${e}|${r.type}`}),[t]),v=l().useMemo((()=>{let e=!1;for(const t in r[b])if(!le(r[b][t])||h){e=!0;break}return e}),[b,r,h]);l().useLayoutEffect((()=>{m&&setTimeout((()=>x()),20)}),[m]),l().useEffect((()=>{(0,Q.isEqual)(g[b],r[b])||y({[b]:r[b]||{}}),f(""===r[b]?.["=="])}),[r]);const x=()=>{switch(t.filter.type){case"text":c.current.focus();break;case"number":d.current.focus();break;case"textarea":u.current.focus()}},E=e=>{e&&y(e),o(),i((e=>{for(const t in e){for(const r in e[t])if(le(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...r,...g,...e})),p(!1)},C={text:e=>l().createElement(l().Fragment,null,l().createElement(O.Input,{ref:c,size:n,placeholder:s("qm.table.filter.searchText",{text:Jr(e.title)}),style:{width:"180px"},value:g[b]?.like??"",disabled:h,onChange:e=>{const{value:t}=e.target;y((e=>Object.assign({},e,{[b]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),l().createElement("div",{style:{marginTop:8}},l().createElement(O.Checkbox,{checked:h,onChange:e=>{const{checked:t}=e.target,r=t?"":null;y((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),f(t)}},s("qm.table.filter.nullValue")))),textarea:e=>l().createElement(l().Fragment,null,l().createElement(O.Input.TextArea,{ref:u,size:n,placeholder:s("qm.table.filter.searchAreaText",{text:Jr(e.title)}),style:{width:"220px"},value:g[b]?.likes??"",disabled:h,onChange:e=>{const{value:t}=e.target;y((e=>Object.assign({},e,{[b]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),E())}}),l().createElement("div",{style:{marginTop:8}},l().createElement(O.Checkbox,{checked:h,onChange:e=>{const{checked:t}=e.target,r=t?"":null;y((e=>Object.assign({},e,{[b]:{"==":r,like:null}}))),f(t)}},s("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:g[b]?.[e]??"",size:n,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||y((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return l().createElement("ul",null,l().createElement("li",null,l().createElement("span",null,"> "),l().createElement(O.InputNumber,tc({ref:d},t(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(O.InputNumber,tc({},t("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(O.InputNumber,tc({},t("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(O.InputNumber,tc({},t("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:Yr(g[b]?.[e],Ao),format:Ao,size:n,onChange:t=>{y((r=>Object.assign({},r,{[b]:Object.assign({},r[b],{[e]:Xr(t,Ao)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return l().createElement("ul",null,l().createElement("li",null,l().createElement("span",null,"> "),l().createElement(_,tc({},t(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(_,tc({},t("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(_,tc({},t("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(_,tc({},t("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return l().createElement("ul",null,l().createElement(O.Radio.Group,{style:{width:"100%"},value:g[b]?.["=="],onChange:e=>{const{value:t}=e.target;y((e=>Object.assign({},e,{[b]:{"==":t}})))}},n.map((e=>l().createElement("li",{key:e.value},l().createElement(O.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return l().createElement("ul",null,l().createElement(O.Checkbox.Group,{style:{width:"100%"},value:g[b]?.in,onChange:e=>{y((t=>Object.assign({},t,{[b]:{in:e}})))}},n.map((e=>l().createElement("li",{key:e.value},l().createElement(O.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:t,dictItems:r=[]}=e,n=t.items||r;return l().createElement("div",{style:{height:200,...t.style}},l().createElement(No,{multiple:!0,value:g[b]?.in||[],dataSource:n,onCheckChange:e=>{const t=e.map((e=>e.value));y((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},w={"head-filter__popper":!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n},S=["cell--filter",{selected:m,actived:v}];return l().createElement(Ma(),{action:["click"],popupVisible:m,popup:(()=>{const e=t.filter.type,r=C[e];return r?l().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},l().createElement("div",null,r(t)),l().createElement(O.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},l().createElement(fe,{size:n,onClick:()=>(E({[b]:{}}),void f(!1))},s("qm.table.filter.reset")),l().createElement(fe,{type:"primary",size:n,onClick:()=>E()},s("qm.table.filter.search")))):(me("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:xe()(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{p(e)},builtinPlacements:_o,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("div",{className:xe()(S),title:s("qm.table.filter.text"),onClick:e=>e.stopPropagation()},l().createElement("span",{className:"svgicon icon"},l().createElement(ec,null))))},nc=e=>{const{column:t}=e,{tableRef:r,bordered:n}=l().useContext(To),{columns:a,resizable:i,columnsChange:o=te}=r.current.props,s=l().useMemo((()=>Ar(t)),[t]),c={resizable:!0,"is--line":i&&!n};return l().createElement("div",{className:xe()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n}=r.current,i=n.$resizableBar,l=t.offsetWidth/2,c=e.clientX,d=Mr(t,n.$table).left-n.$tableBody.parentNode.parentNode.scrollLeft+l;n.$table.classList.add("c--resize"),i.style.left=`${d}px`,i.style.display="block";const u=s.width||s.renderWidth;let m=u;return document.onmousemove=function(e){if("number"!=typeof u)return;const t=e.clientX-c,r=u+t;r<(s.minWidth||zo.defaultColumnWidth)||(m=Math.floor(r),i.style.left=`${t+d}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),i.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof m&&(Pr(a,s.dataIndex).width=m,o([...a]))},!1}})},ac=e=>{const{selectionKeys:t}=e,{tableRef:r,getRowKey:n,fetchParams:a,createWebPageData:i,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=l().useContext(To),{rowSelection:m}=r.current.props,{fetchAllRowKeys:p,selectAllOnCurrentPage:h,filterable:f,onSelectAll:g}=m,{t:y}=G(),b=l().useRef([]),v=l().useMemo((()=>d&&!!p),[d,p]),x=l().useMemo((()=>!v&&!!h),[v,h]),E=l().useMemo((()=>(f??!0)&&!x),[f,x]),C=()=>u?i():r.current.tableFullData,w=()=>{const{selectionRows:e}=r.current,{disabled:t}=m;return(t?e.filter((e=>!t(e))):e).map((e=>n(e,e.index)))},S=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:a}=m;if(v)return b.current.length?b.current:(0,Q.union)(t,w());if(!x)return a?t.filter((t=>!a(e.get(t)))):t;const i=a?C().filter((e=>!a(e))).map((e=>n(e,e.index))):C().map((e=>n(e,e.index)));return(0,Q.union)(i,w())})(),N=t.filter((e=>!S.includes(e))),T=t.length-N.length,I=T>0&&T<S.length,R=!!T&&T===S.length;s(N);const P=async()=>{const e=p;let t=[];c(!0);try{const r=await e.api(a);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,Q.get)(r.data,e.dataKey)??[];const{disabled:a}=m;a&&(t=(0,Q.xor)(t,C().filter((e=>a(e))).map((e=>n(e,e.index))))),b.current=t}}catch(e){}return c(!1),t},k=async e=>{let t=[];t=v?e?await P():[]:e?S.slice(0):[],t=[...new Set([...t,...N])],o(t),g?.(e,t)};return l().createElement("div",{className:"cell--selection"},l().createElement(O.Checkbox,{checked:R,indeterminate:I,disabled:!S.length,onChange:e=>k(e.target.checked)}),E&&l().createElement(O.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:y("qm.table.selection.all"),onClick:()=>{k(!0)}},{key:2,label:y("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=v?(0,Q.xor)(t,await P()):(0,Q.xor)(t,S),e=[...new Set([...e,...N])],o(e)})()},{key:3,label:y("qm.table.selection.clear"),onClick:()=>{k(!1)}}];return l().createElement(O.Menu,{items:e})})()},l().createElement(Ce.DownOutlined,{className:"svgicon icon"})),x&&l().createElement(O.Tooltip,{placement:"top",title:y("qm.table.selection.currentPage")},l().createElement(Ce.InfoCircleOutlined,{className:"info"})))},ic=e=>{const{style:t}=e,{tableRef:r,isTreeTable:n,setRowExpandedKeys:a}=l().useContext(To),{expandable:i}=r.current.props,[o,s]=l().useState(i?.defaultExpandAllRows||!1);De((()=>{const{allRowKeys:e,flattenRowKeys:t}=r.current;a(o?e.filter((e=>!(n&&t.includes(e)))):[])}),[o]);const c=Ee("expand"),d={[`${c}--icon`]:!0,expanded:o,collapsed:!o};return l().createElement("span",{className:xe()(d),title:"",onClick:e=>{e.stopPropagation(),s(!o)},style:t})},lc=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"})),oc=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})),sc=e=>{const{tableColumns:t,sorter:r,filters:n}=e,{tableRef:a,prefixCls:i,layout:o,scrollY:s,flattenColumns:c,superFilters:d,selectionKeys:u,rightFixedColumns:m,treeExpandIndex:p,isFetch:h,isTreeTable:f,isGroupSubtotal:g,tableChange:y,setSorter:b,setElementStore:v,resetTableScroll:x,getStickyLeft:E,getStickyRight:C,createGroupData:w,createTableFullData:S}=l().useContext(To),{ellipsis:N,resizable:T,multipleSort:I,rowSelection:R,expandable:P}=a.current.props,[k,A]=zo.sortDirections,{tableOriginData:L}=a.current,{t:F}=G(),_=l().useRef(null),D=l().useMemo((()=>L.some((e=>Array.isArray(e.children)))),[L]),H=l().useMemo((()=>!h),[h]),$=l().useMemo((()=>!h),[h]),q=l().useMemo((()=>!P?.hideExpandAll),[P]),M=l().useMemo((()=>!(!R||(h?!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys:R.hideSelectAll))),[h,R]);De((()=>{W(),y(),x()}),[r]),De((()=>{X(),y(),x()}),[n]),De((()=>{X(),y(),x()}),[d]),l().useEffect((()=>{!le(r)&&ae((()=>W())),!le(n)&&ae((()=>X()))}),[]),l().useLayoutEffect((()=>{K()}),[]);const K=()=>{v("$header",_.current)},V=e=>{const{dataIndex:t,type:n,sorter:a,title:i,description:o}=e;if(t===zo.selectionColumn&&"checkbox"===n){if("checkbox"===n)return l().createElement("div",{className:"cell"},M?l().createElement(ac,{selectionKeys:u}):F("qm.table.config.selectionText"));if("radio"===n)return l().createElement("div",{className:"cell"},i)}const s=[];return s.push(l().createElement("div",{key:0,className:"cell",title:Jr(i)},f&&t===p&&q?l().createElement(ic,null):null,t===zo.expandableColumn&&q?l().createElement(ic,null):i)),o&&s.push(l().createElement(O.Tooltip,{key:1,placement:"top",title:o},l().createElement(Ce.InfoCircleOutlined,{className:"tip"}))),a&&s.push(j(r[t])),s},j=e=>{const t=["svgicon cell--sorter__asc",{actived:e===k}],r=["svgicon cell--sorter__desc",{actived:e===A}];return l().createElement("div",{key:2,className:"cell--sorter",title:F("qm.table.sorter.text")},l().createElement("span",{className:xe()(t)},l().createElement(lc,null)),l().createElement("span",{className:xe()(r)},l().createElement(oc,null)))},z=e=>l().createElement(rc,{column:e,filters:n}),B=(e,t)=>{const{sorter:n,dataIndex:a}=t;if(n){const e=r[a],t=e?e===A?null:A:k;I?(delete r[a],b(Object.assign({},r,{[a]:t}))):b(Object.assign({},{[a]:t}))}},W=()=>{H&&U()},U=e=>{const t=(0,Q.pickBy)(r,(e=>null!==e));for(const e in t){const r=c.find((t=>t.dataIndex===e));r?Y(r,t[e]):delete t[e]}e||Object.keys(t).length||Y({dataIndex:"index"},k)},Y=(e,t)=>{const{tableFullData:r}=a.current,{dataIndex:n,sorter:i}=e,l=(e,r)=>{const a=jr(e,n),i=jr(r,n);return Number.isNaN(a-i)?t===k?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===k?a-i:i-a},o=g?w(en(r).sort("function"==typeof i?i:l)):r.sort("function"==typeof i?i:l).slice(0);S(o)},X=()=>{$&&Z()},Z=()=>{const e=d.length?tn(d):tn(n),t=""!==e?g?w(Nr(en(L),e,D)):Nr(L,e,D):L;S(t),U(!0)},J=Dr(t),{tableBodyWidth:ee}=o;return l().createElement("div",{ref:_,className:`${i}--header-wrapper`},l().createElement("table",{className:`${i}--header`,cellSpacing:"0",cellPadding:"0",style:{width:ee?`${ee}px`:""}},(()=>{const{gutterWidth:e}=o;return l().createElement("colgroup",null,c.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return l().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),s&&l().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),l().createElement("thead",null,(e=>{const{isIE:t}=a.current,n=["gutter",{"cell-fix-right":!!m.length}],i=t?null:{right:m.length?0:""};return e.map(((e,t)=>l().createElement("tr",{key:t,className:"header--row"},e.map(((t,n)=>((e,t,n)=>{const{isIE:i}=a.current,{gutterWidth:c}=o,{dataIndex:d,colSpan:u,rowSpan:m,fixed:p,align:h,theadAlign:f,theadClassName:g="",sorter:y,filter:b,required:v,headRender:x}=e;if(0===u)return null;const w=f||h,S=["header--column",{"col--ellipsis":e.ellipsis??N,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!v,"column-has-sorter":y,"column-has-filter":b,"column--sort":!!r[d],"cell-fix-left":!i&&"left"===p,"cell-fix-right":!i&&"right"===p,"cell-fix-left-last":!i&&"left"===p&&!n[t+(u??1)]?.fixed,"cell-fix-right-first":!i&&"right"===p&&!n[t-1]?.fixed,[g]:!!g}],I=i?null:{left:"left"===p?`${E(d)}px`:"",right:"right"===p?`${C(d,"thead")+(s?c:0)}px`:""},R=T&&![zo.expandableColumn,zo.selectionColumn].includes(d);return l().createElement("th",{key:d,className:xe()(S),colSpan:u,rowSpan:m,style:{...I},onClick:t=>B(t,e)},l().createElement("div",{className:"cell--wrapper"},x?l().createElement("div",{className:"cell--text cell"},x(e,a.current.tableFullData)):l().createElement(l().Fragment,null,l().createElement("div",{className:"cell--text"},V(e)),b?z(e):null)),R&&l().createElement(nc,{column:e}))})(t,n,e))),s&&l().createElement("th",{className:xe()(n),style:{...i}}))))})(J))))},cc=l().createContext([]),dc=(e,t,r,n,a,i,l,o,s,c)=>{const{clientX:d,clientY:u}=e,{top:m,height:p}=e.target.getBoundingClientRect(),h=((a?.x||0)-d-12)/n,f=s.filter((e=>o[e]?.children?.length));let g=uc(o,r.eventKey);if(u<m+p/2){const e=l.findIndex((e=>e===g.key)),t=l[e<=0?0:e-1];g=uc(o,t)}const y=g.key,b=g,v=g.key;let x=0,E=0;if(!f.includes(y))for(let e=0;e<h&&pc(g);e+=1)g=g.parent,E+=1;const C=t.data,w=g.node;let S=!0;return hc(g)&&0===g.level&&u<m+p/2&&i({dragNode:C,dropNode:w,dropPosition:-1})&&g.key===r.eventKey?x=-1:(b.children||[]).length&&f.includes(v)?i({dragNode:C,dropNode:w,dropPosition:0})?x=0:S=!1:0===E?h>-1.5?i({dragNode:C,dropNode:w,dropPosition:1})?x=1:S=!1:i({dragNode:C,dropNode:w,dropPosition:0})?x=c?1:0:i({dragNode:C,dropNode:w,dropPosition:1})?x=1:S=!1:i({dragNode:C,dropNode:w,dropPosition:1})?x=1:S=!1,{dropPosition:x,dropLevelOffset:E,dropTargetKey:g.key,dropTargetPos:g.pos,dragOverNodeKey:v,dropContainerKey:0===x?null:g.parent?.key||null,dropAllowed:S}},uc=(e,t)=>e[t],mc=e=>e.split("-"),pc=e=>{if(e.parent){const t=mc(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},hc=e=>{const t=mc(e.pos);return 0===Number(t[t.length-1])},fc=(e,{dragOverNodeKey:t,dropPosition:r,keyEntities:n})=>{const a=uc(n,e);return{eventKey:e,pos:a?a.pos:"",dragOver:t===e&&0===r,dragOverGapTop:t===e&&-1===r,dragOverGapBottom:t===e&&1===r}},gc=()=>{const{tableRef:e,getRowKey:t,isTreeTable:r,rowExpandedKeys:n,setRowExpandedKeys:a,createTableFullData:i,dataChange:o}=l().useContext(To),{tableFullData:s,allRowKeys:c}=e.current,d=re,u=l().useRef(null),m=l().useRef(null),p=l().useRef(null),h=l().useRef(),[f,g]=l().useState({}),[y,b]=l().useState(null),[v,x]=l().useState([]),[E,C]=l().useState(0),[w,S]=l().useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),N=e=>{S((t=>Object.assign({},t,e)))};l().useLayoutEffect((()=>{g((e=>{const r={},n=(e,a=null,i=0)=>{const l=[];return e.forEach(((e,o)=>{const s=t(e,e.index),c={index:o,key:s,level:i,node:e,parent:a,pos:(d=a?.pos||"0",u=o,`${d}-${u}`),nodes:[...a?.nodes||[],e]};var d,u;Array.isArray(e.children)&&(c.children=n(e.children,c,i+1)),r[s]=c,l.push(c)})),l};return n(e),r})(s))}),[s]),l().useEffect((()=>()=>{window.removeEventListener("dragend",R)}),[]);const T=()=>{N({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},I=()=>{null!==y&&(b(null),N({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),m.current=null,p.current=null},R=e=>{O(e,null,!0),window.removeEventListener("dragend",R)},O=(e,t,r)=>{N({dragOverNodeKey:null}),I(),u.current=null,window.removeEventListener("dragend",R)};return{onNodeDragStart:(e,t)=>{const{eventKey:r}=t;u.current=t,m.current={x:e.clientX,y:e.clientY};const i=((e,t)=>{if(!e)return[];const r=e.slice(),n=r.indexOf(t);return n>=0&&r.splice(n,1),r})(n,r);b(r),x(((e,t)=>{const r=[];return function e(t=[]){t.forEach((({key:t,children:n})=>{r.push(t),e(n)}))}(uc(t,e).children),r})(r,f)),C(2*zo.treeTable.textIndent),a(i),window.addEventListener("dragend",R)},onNodeDragEnter:(e,t)=>{const{eventKey:i}=t;if(p.current!==i&&(p.current=i),!u.current)return void T();const{dropPosition:l,dropLevelOffset:o,dropTargetKey:s,dropContainerKey:g,dropTargetPos:b,dropAllowed:x,dragOverNodeKey:C}=dc(e,u.current,t,E,m.current,d,c,f,n,!r);-1===v.indexOf(s)&&x?(h.current||(h.current={}),Object.keys(h.current).forEach((e=>{clearTimeout(h.current[e])})),u.current.eventKey!==i&&(e.persist(),h.current[i]=window.setTimeout((()=>{if(null===y)return;let e=[...n];const t=uc(f,i);t&&t.children?.length&&(e=((e,t)=>{const r=(e||[]).slice();return-1===r.indexOf(t)&&r.push(t),r})(n,i)),a(e)}),800)),u.current.eventKey!==s||0!==o?N({dragOverNodeKey:C,dropPosition:l,dropLevelOffset:o,dropTargetKey:s,dropContainerKey:g,dropTargetPos:b,dropAllowed:x}):T()):T()},onNodeDragOver:(e,t)=>{if(!u.current)return;const{dropPosition:a,dropLevelOffset:i,dropTargetKey:l,dropContainerKey:o,dropAllowed:s,dropTargetPos:p,dragOverNodeKey:h}=dc(e,u.current,t,E,m.current,d,c,f,n,!r);-1===v.indexOf(l)&&s&&(u.current.eventKey===l&&0===i?null===w.dropPosition&&null===w.dropLevelOffset&&null===w.dropTargetKey&&null===w.dropContainerKey&&null===w.dropTargetPos&&!1===w.dropAllowed&&null===w.dragOverNodeKey||T():a===w.dropPosition&&i===w.dropLevelOffset&&l===w.dropTargetKey&&o===w.dropContainerKey&&p===w.dropTargetPos&&s===w.dropAllowed&&h===w.dragOverNodeKey||N({dropPosition:a,dropLevelOffset:i,dropTargetKey:l,dropContainerKey:o,dropTargetPos:p,dropAllowed:s,dragOverNodeKey:h}))},onNodeDragLeave:(e,t)=>{p.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(T(),p.current=null)},onNodeDragEnd:O,onNodeDrop:(e,r,n=!1)=>{const{dropPosition:a,dropTargetKey:l,dropTargetPos:c,dropAllowed:d,dragOverNodeKey:m}=w;if(!d)return;if(N({dragOverNodeKey:null}),I(),null===l)return;const p={...fc(l,{dropPosition:a,dragOverNodeKey:m,keyEntities:f}),data:uc(f,l).node};-1!==v.indexOf(l)&&me("Table Draggable","无法拖放到 `dragNode` 的子节点");const h=mc(c),g={event:e,node:p,dragNode:u.current,dragNodesKeys:[u.current.eventKey].concat(v),dropToGap:0!==a,dropPosition:a+Number(h[h.length-1])};n||(e=>{const r=e.node.eventKey,n=e.dragNode.eventKey,a=e.node.pos.split("-"),l=e.dropPosition-Number(a[a.length-1]),c=(e,r,n)=>{for(let a=0;a<e.length;a++){if(t(e[a],e[a].index)===r)return n(e[a],a,e);e[a].children&&c(e[a].children,r,n)}},d=[...s];let u;if(c(d,n,((e,t,r)=>{r.splice(t,1),u=e})),e.dropToGap){let e,t=[];c(d,r,((r,n,a)=>{t=a,e=n})),-1===l?t.splice(e,0,u):t.splice(e+1,0,u)}else c(d,r,(e=>{e.children=e.children||[],e.children.unshift(u)}));i(d),o()})(g),u.current=null},indent:E,dropOptions:w}},yc=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,bc=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),vc=(e,t)=>{const r=e.target;return!("button"in e&&e.button>0||r&&!yc(r).contains(r)||t.current?.contains(r))};function xc({ref:e,handler:t,enabled:r=!0,omitClassNames:n=[]}){const a=Y(t),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!r)return;const i=t=>{vc(t,e)&&(l.current.isPointerDown=!0)},o=r=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:t&&l.current.isPointerDown&&vc(r,e)&&bc(r,n)&&(l.current.isPointerDown=!1,a(r))},s=r=>{l.current.ignoreEmulatedMouseEvents=!0,t&&l.current.isPointerDown&&vc(r,e)&&bc(r,n)&&(l.current.isPointerDown=!1,a(r))},c=yc(e.current);return c.addEventListener("mousedown",i,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",i,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",i,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",i,!0),c.removeEventListener("touchend",s,!0)}}),[t,e,a,l,r])}function Ec(){const[,e]=i.useReducer((e=>e+1),0);return e}const Cc=e=>{const{rowKey:t,row:r,className:n,style:a,indent:i,filter:o,dropOption:s,onNodeDragStart:c,onNodeDragEnter:d,onNodeDragOver:u,onNodeDragLeave:m,onNodeDragEnd:p,onNodeDrop:h}=e,f=l().useRef({eventKey:t,data:r,props:e}),g=l().useRef(!1),[y,b]=l().useState(!1),{dropPosition:v,dropLevelOffset:x,dragOverNodeKey:E,dropTargetKey:C,dropContainerKey:w}=s,S=E===t&&0===v,N=E===t&&-1===v,T=E===t&&1===v,I=r._level||0,R={};switch(v){case-1:Object.assign(R,{top:0,left:-x*i+I*i});break;case 1:Object.assign(R,{bottom:0,left:-x*i+I*i});break;case 0:Object.assign(R,{bottom:0,left:i+I*i})}const O={"body--row-draggable":!0,"body--row-dragging":y,"drop-target":C===t,"drop-container":w===t,"drag-over":S,"drag-over-gap-top":N,"drag-over-gap-bottom":T};return l().createElement("tr",{"data-row-key":t,className:xe()(n,O),style:a,draggable:!0,onMouseDown:e=>{var t;o&&(t=e.target.matches(o),g.current=t)},onDragStart:e=>{if(e.stopPropagation(),g.current)return e.preventDefault();b(!0),c(e,f.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),d(e,f.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),u(e,f.current)},onDragLeave:e=>{e.stopPropagation(),m(e,f.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),b(!1),h(e,f.current)},onDragEnd:e=>{e.stopPropagation(),b(!1),p(e,f.current)}},e.children,E===t&&null!==v&&null!==x&&l().createElement("td",{className:"drop-indicator",style:R}))};Cc.displayName="DraggableTr";const wc=Cc,Sc=e=>{const{selectionKeys:t,column:r,record:n,rowKey:a}=e,{tableRef:i,isTreeTable:o,getAllChildRowKeys:s}=l().useContext(To),{rowSelection:c}=i.current.props,d=l().useMemo((()=>r.type||""),[r.type]),u=e=>{const r=c.checkStrictly??!0;if(!o||r)return!1;const n=Fr(i.current.deriveRowKeys,e);return((e,t)=>{const r=new Set(t);let n=!1,a=!1;for(const t of e)if(r.has(t)?n=!0:a=!0,n&&a)break;return n&&a})(s(n?.children??[]),t)};return"radio"===d?(()=>{const e=c.disabled,r=e?.(n),i=!r&&t[0]===a;return l().createElement(O.Radio,{checked:i,disabled:r})})():(()=>{const e=c.disabled,r=e?.(n),i=!!t.includes(a);return l().createElement(O.Checkbox,{checked:i,indeterminate:u(a),disabled:r})})()},Nc=e=>{const{record:t,rowKey:r,style:n}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:o}=l().useContext(To),{expandable:s={}}=a.current.props,[c]=l().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=l().useMemo((()=>i.includes(r)),[i,r]);De((()=>{s.onExpand?.(d,t)}),[d]);const u=Ee("expand"),m={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return l().createElement("span",{className:xe()(m),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==r)):[...i,r];o(t)},style:n})},Tc=l().forwardRef(((e,t)=>{const{size:r,defaultValue:n,value:a,min:i,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:m,stringMode:p,allowClear:h,readOnly:f,disabled:g,formatter:y=(e=>e.toString()),parser:b=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<i&&(t=i.toString()),m>=0&&""!==t&&(t=new(va())(t).toFixed(m)),t},E=void 0!==a,[C,w]=l().useState(n??""),S=y(E?a:C),N=b(S);return De((()=>{e.onChange?.(N)}),[C]),l().createElement(O.Input,{ref:t,size:r,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const r=b(t.target.value.replace(/\s+/g,""));let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===m&&r.includes(".")&&(n=!1),i>=0&&r.startsWith("-")&&(n=!1),n){if(!p&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):w(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(N),N)}})}));Tc.displayName="InputNumber";const Ic=Tc;function Rc(){return Rc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rc.apply(null,arguments)}const{Search:Oc}=O.Input,Pc=l().forwardRef(((e,t)=>{const{column:r,record:n,rowKey:a,columnKey:i}=e,{tableRef:o,tableBodyRef:s,$size:c,flattenColumns:d,updateTableData:u,doFieldValidate:m,dataChange:p}=l().useContext(To),h=l().useContext(cc),f="table-editable__popper",{t:g}=G(),y=Ec(),{store:b,fieldAuth:v}=o.current,x=r.editRender?.(n,r)||{},E=l().useRef(null),C=l().useRef(null),w=l().useRef(null),S=l().useRef(null),N=l().useRef(null),T=l().useRef(!1),I=l().useRef({}),R=l().useRef({}),P=l().useRef([]),[k,A]=l().useState(!1),[L,F]=l().useState(!1),[D,H]=l().useState(x.items||[]),[$,M]=l().useState(),K=(x.editable||(0,Q.isEqual)(h,[a,i]))&&!x.disabled&&!v[i]?.disabled,V=`${a}|${i}`,j=2===h.length?`${h[0]}|${h[1]}`:"",z=![...b.state.required,...b.state.validate].some((({x:e,y:t})=>e===a&&t===i)),B=b.state.required.find((({x:e,y:t})=>e===a&&t===i))?.text||"",W=b.state.validate.find((({x:e,y:t})=>e===a&&t===i))?.text||"",U=b.state.edited.some((({x:e,y:t})=>e===a&&t===i)),Y=K||!z||k||L,X=!!x.helper?.combinedDataIndex&&("search-helper"===x.type||"tree-helper"===x.type),Z=x.type?.endsWith("multiple");l().useLayoutEffect((()=>{Y&&j===V&&te()}),[h]),l().useLayoutEffect((()=>{const{items:e}=x;Z&&e&&ee(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const J=()=>{u(),p()},ee=e=>{P.current=e},te=()=>{const{type:e}=x;switch(e){case"text":C.current?.focus();break;case"number":w.current?.select();break;case"search-helper":S.current?.focus();break;case"tree-helper":N.current?.focus()}},ne=()=>{const{type:e}=x;switch(e){case"text":C.current?.blur();break;case"number":w.current?.blur();break;case"search-helper":S.current?.blur();break;case"tree-helper":N.current?.blur()}};l().useImperativeHandle(t,(()=>({focus:te,blur:ne,isEditable:()=>!x.disabled,isOpening:()=>k})));const ie=(e,t,r)=>{const{cornerSign:n=!0}=x.extra||{};b.addToUpdated(e),n&&b.addToEdited({x:t,y:r})},le=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",oe={text:(e,t,r)=>{const{dataIndex:n}=t,{type:o,extra:s={},rules:d=[],onInput:u,onChange:p,onEnter:h,onBlur:f}=x,b=jr(e,n),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=r?{rows:v.minRows,autoSize:v}:null,w=s.password?O.Input.Password:r?O.Input.TextArea:O.Input;return l().createElement(w,Rc({ref:C,size:c,value:b,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||g("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";zr(e,n,r),m(d,r,a,i),y(),u?.({[V]:r}),T.current=!0},onBlur:t=>{const r=t.target.value??"";T.current&&(T.current=!1,ie(e,a,i),p?.({[V]:r},e),f?.({[V]:r},e),J())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";h?.({[V]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&h&&e.preventDefault()}}))},textarea:(e,t)=>oe.text(e,t,!0),number:(e,t)=>{const{dataIndex:r,precision:n,formatType:o}=t,{type:s,extra:d={},rules:u=[],onInput:p,onChange:h,onEnter:f,onBlur:b}=x,v=jr(e,r);let E,C;return"finance"===o&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},C=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(va())(e).times(100).toNumber()}`,C=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(va())(e).times(.01).toString()),l().createElement(Ic,{ref:w,size:c,value:v,min:d.min,max:d.max,precision:n,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===o?"%":void 0),placeholder:d.placeholder||g("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:C,onChange:t=>{zr(e,r,t),m(u,t,a,i),y(),p?.({[V]:t}),T.current=!0},onBlur:(t,n)=>{if(!T.current)return;T.current=!1;let l=d.stringMode?t:le(t);"percent"===o&&"."===n.charAt(n.length-1)&&(l=Number(t)/100),zr(e,r,l),ie(e,a,i),h?.({[V]:l},e),b?.({[V]:l},e),J()},onEnter:(t,r)=>{let n=d.stringMode?t:le(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),f?.({[V]:n},e)}})},select:(e,t,r)=>{const{dataIndex:n,dictItems:o=[]}=t,{type:s,extra:d={},rules:u=[],items:p,onChange:h,onEnter:y}=x,b=p||o,v=jr(e,n);let E=v;return l().createElement(O.Select,{mode:r?"multiple":void 0,size:c,popupClassName:f,value:v||void 0,placeholder:d.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Gn.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>A(e),onChange:t=>{zr(e,n,t),m(u,t,a,i),ie(e,a,i),h?.({[V]:t},e),J()},onSelect:e=>{E=e},onInputKeyDown:t=>{13===t.keyCode&&ae((()=>y?.({[V]:E},e)))}},b.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>oe.select(e,t,!0),date:(e,t,r)=>{const{dataIndex:n}=t,{type:o,extra:s={},rules:d=[],onChange:u}=x,p=r||"exactdate",h=jr(e,n);return l().createElement(_,{size:c,popupClassName:f,value:Yr(h,vn[p])??void 0,picker:bn[p],format:s.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=Xr(t,vn[p]);zr(e,n,r),m(d,r,a,i),ie(e,a,i),u?.({[V]:r},e),J()}})},datetime:(e,t)=>oe.date(e,t,"datetime"),month:(e,t)=>oe.date(e,t,"month"),year:(e,t)=>oe.date(e,t,"year"),time:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],onChange:d}=x,u="HH:mm:ss",p=jr(e,r);return l().createElement(q,{size:c,popupClassName:f,value:Yr(p,u)??void 0,format:o.format||u,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const n=Xr(t,u);zr(e,r,n),m(s,n,a,i),ie(e,a,i),d?.({[V]:n},e),J()}})},checkbox:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],onChange:c}=x,{trueValue:d=Po,falseValue:u=ko,disabled:p}=o,h=jr(e,r);return l().createElement(O.Checkbox,{checked:h===d,disabled:p,onChange:t=>{const n=t.target.checked?d:u;zr(e,r,n),m(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},switch:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],onChange:c}=x,{trueValue:d=Po,falseValue:u=ko,disabled:p}=o,h=jr(e,r);return l().createElement(O.Switch,{checked:h===d,disabled:p,onChange:t=>{const n=t?d:u;zr(e,r,n),m(s,n,a,i),ie(e,a,i),c?.({[V]:n},e),J()}})},"search-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:o,extra:s={},rules:u=[],helper:p={},onInput:h,onChange:y,onEnter:b}=x,v=Br(e,X?p.combinedDataIndex:r),E=p.fieldAliasMap;E||me("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof E?E():E||{};Object.keys(C).includes(r)||me("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),X&&(p.combinedDataIndex.split("|").every((e=>Object.keys(C).includes(e)))||me("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),C[r].includes("|")&&me("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=e=>{const{filterAliasMap:t}=p,n=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[r]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,Q.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i},N=e=>{const{autoQueryAssign:t=!0}=p;t&&(I.current=w(e)),A(!0)},R=(r,n)=>{const{beforeOpen:a}=p,i=(a??re)({[V]:v},e,t);i?.then?i.then((()=>{N(r),n?.()})).catch((()=>{})):!1!==i&&(N(r),n?.())},O=e=>{const t={};for(const n in C){const a=C[n];n!==r&&(t[n]=Br(e,a))}const n=C[r]?Br(e,C[r]):"";L(n,t);const{closed:a}=p;A(!1),a?.(e)},P=()=>{const{onlySelect:e=!0}=p;T.current&&L(e?"":v),A(!1)},L=(t="",l)=>{if((0,Q.isPlainObject)(l)&&Object.keys(l).length)for(const t in l){const r=l[t],n=d.find((e=>e.dataIndex===t));if(n){zr(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&m(i.rules,r,a,t)}else zr(e,t,r)}X&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return zr(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&zr(e,t,a[r]?.trim())}))})(e,p.combinedDataIndex),zr(e,r,t,n),m(u,t,a,i),ie(e,a,i),y?.({[V]:t},e),J(),I.current={},T.current=!1,M(void 0)},_={visible:k,title:g("qm.searchHelper.text"),width:p.width??"60%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{P()}},D={...p,size:c,initialValue:Object.assign({},I.current,p.initialValue),onClose:e=>{e?O(e):P()}};return l().createElement(l().Fragment,null,l().createElement(Oc,{ref:S,value:$??v,placeholder:s.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=p;if(T.current&&!k)return t&&n&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=p,{beforeFetch:n=re}=t.fetch;return new Promise((async(a,i)=>{const l=(0,Q.merge)({},t.fetch.params,{...r,...w(e)},{currentPage:1,pageSize:500});if(!n(l))return i();F(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,Q.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{ae((()=>F(!1)))}}))})(t).then((e=>((e=[],t)=>{const n=e.filter((e=>Br(e,C[r]).toString().includes(t)));if(1===n.length)return O(n[0]);R(t)})(e,t))).catch((()=>L(""))):void L(t)},onChange:e=>{const{value:t}=e.target;h?.({[V]:t}),T.current=!0,M(t)},onKeyDown:e=>{if(13===e.keyCode){const t=e.target.value??"";!k&&R(t)}},onDoubleClick:e=>{const{value:t}=e.target;R(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&R(e)}}),l().createElement(cr,_,l().createElement(rd,D)))},"search-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,items:o=[],extra:s={},rules:d=[],helper:u={},onInput:p,onChange:h,onEnter:y}=x,b=jr(e,r),v=u.fieldAliasMap;v||me("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof v?v():v||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||me("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=E;const C=r=>{const{beforeOpen:n}=u,a=(n??re)({[V]:b},e,t);a?.then?a.then((()=>{A(!0),r?.()})).catch((()=>{})):!1!==a&&(A(!0),r?.())},w=()=>{A(!1)},S=t=>{zr(e,r,t),m(d,t,a,i),ie(e,a,i),h?.({[V]:t},e,P.current),J()},N={visible:k,title:g("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{w()}},T={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=E;ee((0,Q.uniqBy)([...P.current.filter((e=>t.includes(e[n]))),...e],n));const a=P.current.map((e=>({text:e[r],value:e[n]}))),i=(0,Q.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));H(i),S(i.map((e=>e.value)));const{closed:l}=u;A(!1),l?.(P.current)})(e,t):w()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(O.Select,{mode:"multiple",open:!1,value:b,placeholder:s.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!k&&C()},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=E;ee(P.current.filter((r=>e.includes(r[t])))),S(e)}},D.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(O.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:l().createElement(Ce.SearchOutlined,null),onClick:()=>{C()}})))),l().createElement(cr,N,l().createElement(rd,T)))},"tree-helper":(e,t)=>{const{dataIndex:r,precision:n}=t,{type:o,extra:s={},rules:u=[],helper:p={},onChange:h,onEnter:y}=x,b=Br(e,X?p.combinedDataIndex:r),v=p.fieldAliasMap;v||me("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof v?v():v||{};Object.keys(E).includes(r)||me("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),X&&(p.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||me("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[r].includes("|")&&me("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const C=r=>{const{beforeOpen:n}=p,a=(n??re)({[V]:b},e,t);a?.then?a.then((()=>{A(!0),r?.()})).catch((()=>{})):!1!==a&&(A(!0),r?.())},w=()=>{A(!1)},S=(t="",l)=>{if((0,Q.isPlainObject)(l)&&Object.keys(l).length)for(const t in l){const r=l[t],n=d.find((e=>e.dataIndex===t));if(n){zr(e,t,r,n.precision);const i=n.editRender?.(e,n);i&&Array.isArray(i.rules)&&m(i.rules,r,a,t)}else zr(e,t,r)}zr(e,r,t,n),m(u,t,a,i),ie(e,a,i),h?.({[V]:t},e),J()},T={visible:k,title:g("qm.searchHelper.text"),width:p.width??"40%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{w()}},I={...p,defaultSelectedKeys:[b],size:c,onClose:e=>{e?(e=>{const t={};for(const n in E){const a=E[n];n!==r&&(t[n]=Br(e,a))}const n=E[r]?Br(e,E[r]):"";S(n,t);const{closed:a}=p;A(!1),a?.(e)})(e):w()}};return l().createElement(l().Fragment,null,l().createElement(Oc,{ref:N,value:b,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||g("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!k&&C())},onDoubleClick:()=>{C()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?C():S(""))}}),l().createElement(cr,T,l().createElement(dd,I)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},items:s=[],rules:d=[],helper:u={},onInput:p,onChange:h,onEnter:y}=x,b=jr(e,r),v=u.fieldAliasMap;v||me("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof v?v():v||{};Object.keys(E).includes("valueKey")&&Object.keys(E).includes("textKey")||me("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=E;const C=r=>{const{beforeOpen:n}=u,a=(n??re)({[V]:b},e,t);a?.then?a.then((()=>{A(!0),r?.()})).catch((()=>{})):!1!==a&&(A(!0),r?.())},w=()=>{A(!1)},S=t=>{zr(e,r,t),m(d,t,a,i),ie(e,a,i),h?.({[V]:t},e,P.current),J()},N={visible:k,title:g("qm.searchHelper.text"),width:u.width??"40%",loading:!1,wrapClassName:f,bodyStyle:{paddingBottom:`${Ra[c]+20}px`},onClose:()=>{w()}},T={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:b,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=E;ee(e);const n=P.current.map((e=>({text:e[t],value:e[r]})));H(n),S(n.map((e=>e.value)));const{closed:a}=u;A(!1),a?.(P.current)})(e):w()}};return l().createElement(l().Fragment,null,l().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},l().createElement("span",{className:"ant-input-wrapper ant-input-group"},l().createElement(O.Select,{mode:"multiple",open:!1,value:b,placeholder:o.placeholder||g("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!k&&C()},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=E;ee(P.current.filter((r=>e.includes(r[t])))),S(e)}},D.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value},e.text)))),l().createElement("span",{className:"ant-input-group-addon"},l().createElement(O.Button,{className:"ant-input-search-button",disabled:o.disabled,icon:l().createElement(Ce.SearchOutlined,null),onClick:()=>{C()}})))),l().createElement(cr,N,l().createElement(dd,T)))},custom:(e,t)=>{const{dataIndex:r}=t,{type:n,extra:o={},rules:s=[],render:c,onChange:d}=x;if(!c)return me("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const u=jr(e,r),p=t=>{zr(e,r,t),m(s,t,a,i),ie(e,a,i),d?.({[V]:t},e),J()},h=c(e,t,p);return l().isValidElement(h)?l().cloneElement(h,{value:u,disabled:o.disabled,readOnly:o.readOnly,popupClassName:f,onChange:p}):null}};return l().createElement(l().Fragment,null,Y?(()=>{const{type:e}=x,t=oe[e];if(!t)return me("Table","单元格编辑的类型 `type` 配置不正确"),null;const a=["cell--edit",{"is-error":!z}];return l().createElement("div",{ref:E,className:xe()(a)},t(n,r),!z&&l().createElement("div",{className:"cell-error"},B||W))})():(()=>{const{disabled:t,extra:r={}}=x,{disabledColor:n,disabledBgColor:a}=r,i=["cell--show",{"is-cell-bg":t&&a}];return l().createElement(l().Fragment,null,l().createElement("span",{className:xe()(i),style:{color:t?n:""}},e.children),t&&a&&l().createElement("i",{className:"cell--bg",style:{background:a}}))})(),U&&l().createElement("i",{className:"cell--sign"}))}));Pc.displayName="CellEdit";const kc=Pc,Ac=require("copy-to-clipboard");var Lc=n.n(Ac);const Fc=(e,...t)=>l().isValidElement(e)?l().cloneElement(e,...t):null,_c=e=>{const{text:t,options:r,showMessage:n=!0,onCopy:a}=e,{t:i}=G();return Fc(e.children,{onClick:o=>{const s=l().Children.only(e.children),c=Lc()(t,r);a?.(t,c),c&&n&&O.message.success(i("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};_c.displayName="QmCopyToClipboard";const Dc=_c,Hc=l().forwardRef(((e,t)=>{const{column:r,row:n,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c}=e,{selectionKeys:d,treeExpandIndex:u,updateMark:m,isTreeTable:p}=l().useContext(To),{dataIndex:h,canCopy:f,render:g,editRender:y,shouldCellUpdate:b}=r,{t:v}=G(),{renderText:x,getTitleFromCellNode:E}=os(),C=l().useRef(null),w=jr(n,h),[S,N]=function(e,c,d){const u=i.useRef({});return"value"in u.current&&!((e,t)=>{if(b){const[,r]=e,[,a]=t;return b(a,r,n)}return!((e,t,r=!1)=>{const n=new Set;return function e(t,a,i=1){if(n.has(t))return!1;if(t===a)return!0;if(r&&i>1)return!1;n.add(t);const l=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],a[r],l))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const r=Object.keys(t);return r.length===Object.keys(a).length&&r.every((r=>e(t[r],a[r],l)))}return!1}(e,t)})(e,t,!0)})(u.current.condition,c)||(u.current.value=(()=>{const e=g?g(w,n,r,a,o):x(w,r,n);return[e,y?l().createElement(kc,{ref:t,column:r,record:n,rowKey:s,columnKey:h},e):null]})(),u.current.condition=c),u.current.value}(0,[m,n,w,g,y]);l().useEffect((()=>{if([zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(h))return;const e=C.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const T=e=>Array.isArray(e.children);return l().createElement("div",{ref:C,className:"cell"},(()=>{if(h===zo.expandableColumn)return l().createElement(Nc,{record:n,rowKey:s});if(h===zo.selectionColumn)return l().createElement(Sc,{selectionKeys:d,column:r,record:n,rowKey:s});if(N)return N;if(p&&h===u)return l().createElement(l().Fragment,null,(e=n._level)?l().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*zo.treeTable.textIndent+"px"}}):null,l().createElement(Nc,{key:"expand",record:n,rowKey:s,style:T(n)?{}:{visibility:"hidden"}}),S);var e;if(f){const e=E(S);return l().createElement("div",{className:"cell--copy"},l().createElement("span",{className:"text"},S),e&&l().createElement(Dc,{text:e},l().createElement(Ce.CopyOutlined,{className:"icon",title:v("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Hc.displayName="Cell";const $c=Hc,qc={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},Mc={open:!1,offsetX:0,offsetY:0},Kc=l().forwardRef(((e,t)=>{const{tableRef:r,getRowKey:n,prefixCls:a,flattenColumns:i,mergedTdCells:o,setMergedCells:s}=l().useContext(To),{areaSelection:c={}}=r.current.props,{elementStore:d,tableFlatData:u}=r.current,{t:m}=G(),p=l().useRef(document.onselectstart),h=l().useRef(null),f=l().useRef(null),[g,y]=l().useState(null),[b,v]=l().useState(null),[x,E]=l().useState(null);xc({ref:h,handler:()=>$()});const C=l().useRef(qc),w=e=>{C.current=Object.assign({},C.current,e)};l().useEffect((()=>{const e=Mt()(d.$tableBody,"mousedown",A),t=Mt()(d.$tableBody,"contextmenu",P),r=Mt()(document,"keydown",k);return()=>{e.remove(),t.remove(),r.remove()}}),[]);const S=()=>{y(null),v(null),E(null)};l().useImperativeHandle(t,(()=>({blur:S})));const N=()=>d.$tableBody.parentNode,T=e=>{const{offsetLeft:t,offsetTop:r,offsetWidth:n,offsetHeight:a}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:r,w:n,h:a}},I=xt(((e,t)=>{let r=null;const n=d.$tableBody.querySelectorAll("tbody > tr");for(let a=0;a<n.length;a++){if(n[a].offsetTop>t||n[a].offsetTop+n[a].offsetHeight<t)continue;const i=n[a].querySelectorAll("td");for(let t=0;t<i.length;t++)if(!(i[t].offsetLeft>e||i[t].offsetLeft+i[t].offsetWidth<e)){r=i[t];break}break}r&&v(T(r))}),5),R=Y((()=>{const e=[];if(!g||!b)return e;const[t,r]=[g.colIndex,b.colIndex],[a,l]=[g.rowKey,b.rowKey];let[o,s]=[0,0];for(let e=0;e<u.length;e++){const t=n(u[e],u[e].index);if(t==a&&(o=e),t==l){s=e;break}}const c=i.slice(Math.min(t,r),Math.max(t,r)+1);return u.slice(o,s+1).forEach((t=>{for(let r=0;r<c.length;r++){const{dataIndex:a}=c[r];e.push({rowKey:n(t,t.index),dataIndex:a,cellValue:jr(t,a)})}})),e})),O=e=>{s(e),c.onCellMerge?.(e),ae((()=>S()))},P=Y((e=>{c.cellMerge&&g&&D(e.clientX,e.clientY)?(e.preventDefault(),H(e)):x?.open&&$()})),k=e=>{27===e.keyCode&&S()},A=Y((e=>{e.stopPropagation();const t=(e=>{let t=e;for(;t;){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null})(e.target);if(1!==e.buttons||!t)return;$(),setTimeout((()=>{y(T(t)),v(T(t))}));const[r,n]=[d.$tableBody.getBoundingClientRect().top,N().getBoundingClientRect().left],{offsetWidth:a,offsetHeight:i}=N();w({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-n,startOffsetY:e.clientY-r,containerSizeX:a,containerSizeY:i}),document.addEventListener("mousemove",L),document.addEventListener("mouseup",F),p.current=document.onselectstart,document.onselectstart=()=>!1})),L=e=>{const t=e.clientX-C.current.startX,r=e.clientY-C.current.startY,n=C.current.startOffsetX+t,a=C.current.startOffsetY+r;I(Math.min(n,C.current.containerSizeX),Math.min(a,C.current.containerSizeY))},F=()=>{w(qc),c.onSelectChange?.(R()),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",F),_()},_=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)},D=(e,t)=>{const{top:r,left:n}=N().getBoundingClientRect(),[a,i]=[e-n,t-r],{el:l,et:o,ew:s,eh:c}=K();return!(a<l||a>l+s||i<o||i>o+c)},H=e=>{const{top:t,left:r,height:n}=f.current.getBoundingClientRect();E({open:!0,offsetX:e.clientX-r,offsetY:-1*(n-(e.clientY-t))})},$=()=>{E((e=>({...e,open:!1})))},q=()=>{if(!g||!b||(t=b,(e=g).rowKey===t.rowKey&&e.colIndex===t.colIndex))return S();var e,t;const[r,a]=g.t<=b.t?[g.rowKey,b.rowKey]:[b.rowKey,g.rowKey],[l,s]=g.l<=b.l?[g.colIndex,b.colIndex]:[b.colIndex,g.colIndex];let[c,d]=[0,0],m=r;for(let e=0;e<u.length;e++){const t=u[e],i=n(t,t.index);if(i==r&&(m=i,c=e),i==a){d=e;break}}const p={rowKey:m,dataIndex:i[Math.min(l,s)].dataIndex,rowSpan:d-c+1,colSpan:Math.abs(s-l+1)};O([...o.filter((e=>!(e.rowKey===p.rowKey&&e.dataIndex===p.dataIndex))),p])},M=()=>{let e=g.rowKey;const t=g.colIndex;for(let t=0;t<u.length;t++){const r=u[t],a=n(r,r.index);if(a==e){e=a;break}}const r=e,a=i[t].dataIndex;O(o.filter((e=>!(e.rowKey===r&&e.dataIndex===a))))},K=()=>{const{w:e,h:t,l:r,t:n}=g;let{w:a,h:i,l,t:o}=b;return a=l-r>0?l-r+a:Math.abs(l-r)+e,i=o-n>0?o-n+i:Math.abs(o-n)+t,l=l>r?r:l,o=o>n?n:o,{sl:r,st:n,sw:e,sh:t,el:l,et:o,ew:a,eh:i}};return l().createElement("div",{className:`${a}--area-select`},(()=>{if(!g||!b)return null;const{sl:e,st:t,sw:r,sh:n,el:a,et:i,ew:o,eh:s}=K(),{open:c,offsetX:d,offsetY:u}=x||Mc,p=l().createElement("ul",{ref:h,className:"ant-dropdown-menu"},l().createElement("li",{className:"ant-dropdown-menu-item",onClick:q},m("qm.table.areaSelect.mergeCell")),l().createElement("li",{className:"ant-dropdown-menu-item",onClick:M},m("qm.table.areaSelect.cancelMerge")));return l().createElement(l().Fragment,null,l().createElement("div",{className:"active-area",style:{left:e,top:t,width:r,height:n}}),l().createElement(Ma(),{popupVisible:c,popup:p,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:"table-editable__popper",builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},l().createElement("div",{ref:f,className:"checked-area",style:{left:a,top:i,width:o,height:s}})))})())}));Kc.displayName="AreaSelect";const Vc=Kc,jc=l().forwardRef(((e,t)=>{const{tableFlatColumns:r,tableData:n}=e,{tableRef:a,getRowKey:i,prefixCls:o,flattenColumns:s,editableColumns:c,leftFixedColumns:d,rightFixedColumns:u,derivedMergeCells:m,sorter:p,layout:h,showFooter:f,scrollX:g,scrollY:y,selectionKeys:b,rowExpandedKeys:v,highlightKey:x,isPingLeft:E,isPingRight:C,isTableEmpty:w,isTreeTable:S,isGroupSubtotal:N,isWebPagination:T,setElementStore:I,setSelectionKeysEffect:R,setHighlightKey:O,getStickyLeft:P,getStickyRight:k,scrollXToColumn:A,scrollYToRecord:L,rowInViewport:F,setPingLeft:_,setPingRight:D,setFullScreen:H,findParentRowKeys:$,getAllChildRowKeys:q,triggerScrollXEvent:M,triggerScrollYEvent:K,scrollBottomDebouncer:V}=l().useContext(To),{height:j,minHeight:z,maxHeight:B,rowHeight:W,rowSelection:U,rowHighlight:G,expandable:X,stripe:Z,summation:J,rowStyle:ee,cellStyle:ne,spanMethod:ae,tableConfig:ie,areaSelection:le,nativeScrollBar:oe,ellipsis:se,showHeader:ce,rowDraggable:de,onRowClick:ue,onRowDblclick:me,onRowContextmenu:pe,onRowEnter:he}=a.current.props,fe=l().useRef(null),ge=l().useRef({}),ye=l().useRef(null),be=l().useRef(null),ve=l().useRef(null),Ee=l().useRef({prevST:0,prevSL:0}),Ce=a.current.scrollXLoad?r:s,{onNodeDragStart:we,onNodeDragEnter:Se,onNodeDragOver:Ne,onNodeDragLeave:Te,onNodeDragEnd:Ie,onNodeDrop:Re,indent:Oe,dropOptions:Pe}=gc(),ke=l().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=h,i={};return w&&Object.assign(i,{minHeight:"100px"}),z&&Object.assign(i,{minHeight:Kr(z)-e-r+"px"}),B&&Object.assign(i,{maxHeight:Kr(B)-e-r+"px"}),j||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[j,B,z,w,h]),Ae=l().useMemo((()=>{const{scrollYStore:e}=a.current,{viewportHeight:t,gutterWidth:r}=h;return Math.floor((g?t-r:t)/e.rowHeight)}),[h,g]),[Le,Fe]=l().useState([]),_e=Ec();xc({ref:fe,omitClassNames:[".table-editable__popper"],handler:()=>{ze([]),ve.current?.blur()}}),l().useImperativeHandle(t,(()=>({setClickedValues:ze,createFocus:Me,forceUpdate:_e}))),De((()=>{Le.length&&a.current.tableManager.focus(a.current.uid)}),[Le]),l().useLayoutEffect((()=>{$e();const e=Mt()(document,"keydown",He);return()=>e.remove()}),[]);const He=Y((e=>{const{keyCode:t}=e;if(a.current.uid===a.current.tableManager.getFocusInstance()?.id&&(27===t&&(ze([]),O(""),H(!1)),Le.length&&(We(document.activeElement,fe.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===U?.type||G)){const t=b[0]??x??null,r=n.find((e=>i(e,e.index)===t))??null;r&&he?.(r,e)}if(!je(Le[0],Le[1])){if(38===t||40===t){qe(e);let r=T?n:a.current.tableFullData;S&&(r=Hr(r,(e=>Array.isArray(e.children)&&v.includes(i(e,e.index)))));const l=r.length;let o=r.findIndex((e=>i(e,e.index)===Le[0]));const s=38===t?(--o+l)%l:++o%l,c=r[s],d=i(c,c.index),u=Ve(d,Le[1]);"radio"!==U?.type||U.disabled?.(c)||u||R([d]),!G||G.disabled?.(c)||u||O(d),F(s)||(38===t&&L(d,s),40===t&&L(d,Ae>s+1?0:s+1-Ae)),Ke(...Le),ze([d,Le[1]])}if(9===t||e.shiftKey&&9===t){if(qe(e),!c.length)return ze([]);const r=c.length;let n=c.findIndex((e=>e.dataIndex===Le[1]));const a=e.shiftKey&&9===t?(--n+r)%r:++n%r,i=c[a].dataIndex;Ke(...Le),A(i),ze([Le[0],i])}}}})),$e=()=>{I("$tableBody",fe.current),I("$tableXspace",ye.current),I("$tableYspace",be.current)},Me=(e,t)=>{ge.current[`${e}-${t}`]?.focus()},Ke=(e,t)=>{ge.current[`${e}-${t}`]?.blur()},Ve=(e,t)=>ge.current[`${e}-${t}`]?.isEditable()??!1,je=(e,t)=>ge.current[`${e}-${t}`]?.isOpening()??!1,ze=e=>{(0,Q.isEqual)(e,Le)||Fe(e)},Be=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),Ue=(e,t,r)=>{const{disabled:n}=U||{},{deriveRowKeys:i,recordsMap:l}=a.current,o=Fr(i,e);let s=[],c=q(o?.children||[]);return n&&(c=c.filter((e=>!l.has(e)||!n(l.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(an(i,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Fr(i,e),r=t?.children?.every((e=>s.includes(e.rowKey)));s=r?[...s,e]:s.filter((t=>t!==e))})),s},Ge=(e,t=0)=>{const r=[];return e.forEach((e=>{const n=e.index,o=i(e,e.index);if(r.push(Ye(e,n,o,t)),X?.expandedRowRender){const{expandedRowClassName:t,rowExpandable:a=re}=X;v.includes(o)&&a(e)&&r.push(l().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},l().createElement("td",{colSpan:Ce.length,className:"body--column",style:{paddingLeft:U?2*zo.selectionColumnWidth:zo.selectionColumnWidth}},l().createElement("div",{className:xe()("cell",t)},X.expandedRowRender(e,n)))))}if(!a.current.scrollYLoad&&(e=>Array.isArray(e.children))(e)){const n="function"!=typeof X?.rowExpandable||X.rowExpandable(e);v.includes(o)&&n&&r.push(...Ge(e.children,t+1))}})),r},Ye=(e,t,r,n=0)=>{const{disabled:a}=U||{},i=["body--row",{"body--row-striped":Z&&t%2!=0,"body--row-selected":b.includes(r)&&!a?.(e),"body--row-current":x===r,...N?Je(e._group):null}];return de?l().createElement(wc,{key:r,className:xe()(i),row:e,rowKey:r,indent:Oe,filter:".cell--edit input",dropOption:Pe,onNodeDragStart:we,onNodeDragEnter:Se,onNodeDragOver:Ne,onNodeDragLeave:Te,onNodeDragEnd:Ie,onNodeDrop:Re},Ce.map(((a,i)=>Xe(a,i,e,t,r,n)))):l().createElement("tr",{key:r,"data-row-key":r,className:xe()(i)},Ce.map(((a,i)=>Xe(a,i,e,t,r,n))))},Xe=(e,t,r,n,o,c)=>{const{isIE:m}=a.current,{dataIndex:h,fixed:f,align:g,className:y=""}=e;a.current.scrollXLoad&&(t=s.findIndex((e=>e.dataIndex===h)));const{rowSpan:v,colSpan:x}=Qe(r,e,n,t);if(!v||!x)return null;const E=e.ellipsis??se,C=!m&&"left"===f,w=!m&&"right"===f,T=["body--column",{"col--ellipsis":E,"col--center":"center"===g,"col--right":"right"===g,"column--sort":!!p[h],"cell-fix-left":C,"cell-fix-right":w,"cell-fix-left-last":C&&d[d.length-x]?.dataIndex===h,"cell-fix-right-first":w&&u[0]?.dataIndex===h,[y]:!!y}],I=w&&x>1?s.slice(t+1,t+x).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0):0,A=m?null:{left:C?`${P(h)}px`:"",right:w?k(h)-I+"px":""},L=ee?"function"==typeof ee?ee(r,n):ee:null,F=ne?"function"==typeof ne?ne(r,e,n,t):ne:null,_=N?Ze(r._group):null,D=Object.assign({},A,W?{height:W}:null,_,L,F);return l().createElement("td",{key:h,"data-col-index":t,rowSpan:v>1?v:void 0,colSpan:x>1?x:void 0,className:xe()(T),style:D,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([zo.expandableColumn,zo.operationColumn].includes(n))return;const a=i(t,t.index);ze([a,n]);const l=Ve(a,n),{type:o,selectByClickRow:s=!0,disabled:c=te}=U||{};!o||c(t)||l||(s||n===zo.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=U||{};if("radio"===r&&R([e]),"checkbox"===r){const r=!b.includes(e),i=S&&!n?Ue(e,b,r):Be(e,b,r);R(i),a?.(r,t,i)}})(a,t),[zo.selectionColumn].includes(n)||(!G||G.disabled?.(t)||l||O(a),ue?.(t,r,e))})(t,r,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(n)||me?.(t,r,e)})(t,r,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(n)||pe?.(t,r,e)})(t,r,e)},l().createElement($c,{ref:e=>ge.current[`${o}-${h}`]=e,row:r,column:e,rowIndex:n,columnIndex:t,rowKey:o,depth:c,showTitle:E}))},Qe=(e,t,r,a)=>{let i=1,l=1;if("function"==typeof ae){const o=ae({row:e,column:t,rowIndex:r,columnIndex:a,tableData:n});if(Array.isArray(o)?(i=o[0],l=o[1]):(0,Q.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan),e===n[0]&&0===i){i=1;for(let e=1;e<n.length;e++){const{rowSpan:r}=Qe(n[e],t,n[e].index,a);if(r>0)break;i++}}}if(m.length>0){const e=m.find((e=>e.row===r&&e.col===a));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},Ze=e=>{const{backgroundColor:t,color:r}=J.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},Je=e=>{const t=J.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}};return l().createElement(l().Fragment,null,l().createElement(Tt,{ref:a.current.scrollBarRef,wrapClassName:`${o}--body-wrapper`,wrapStyle:ke,native:oe,showTopScrollbar:ie?.doubleXScrollbar,onScroll:e=>{const{elementStore:t,scrollXLoad:r,scrollYLoad:n}=a.current,{prevST:i,prevSL:l}=Ee.current,o=y?h.gutterWidth:0,{scrollTop:s,scrollLeft:c}=e;if(c!==l){ce&&(t.$header.scrollLeft=c),f&&(t.$footer.scrollLeft=c);const e=c>0,r=Math.ceil(c)+h.tableWidth<h.tableBodyWidth+o;E!==e&&_(e),C!==r&&D(r)}if(n&&s!==i&&K(s),r&&c!==l&&M(c),y&&s!==i){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(s)+h.viewportHeight-o>=r&&V({type:"scroll",target:e,preventDefault:te,stopPropagation:te})}Ee.current.prevST=s,Ee.current.prevSL=c}},l().createElement("div",{ref:be,className:"body--y-space"}),l().createElement("div",{ref:ye,className:"body--x-space",style:{width:y?h.tableBodyWidth-h.gutterWidth:h.tableBodyWidth}}),l().createElement(cc.Provider,{value:Le},l().createElement("table",{ref:fe,className:`${o}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0",style:{width:0}},l().createElement("colgroup",null,Ce.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return l().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})}))),l().createElement("tbody",null,Ge(n)))),!!le&&l().createElement(Vc,{ref:ve})))}));jc.displayName="TableBody";const zc=jc,Bc=e=>{const{summationRows:t}=e,{tableRef:r,prefixCls:n,sorter:a,layout:i,scrollY:o,flattenColumns:s,leftFixedColumns:c,rightFixedColumns:d,setElementStore:u,getStickyLeft:m,getStickyRight:p}=l().useContext(To),{footRender:h}=r.current.props,{t:f}=G(),g=l().useRef(null);l().useLayoutEffect((()=>{y()}),[]);const y=()=>{u("$footer",g.current)},{tableBodyWidth:b}=i;return l().createElement("div",{ref:g,className:`${n}--footer-wrapper`},h?h(s,r.current.tableFullData):l().createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:b?`${b}px`:""}},(()=>{const{gutterWidth:e}=i;return l().createElement("colgroup",null,s.map((e=>{const{dataIndex:t,width:r,renderWidth:n}=e;return l().createElement("col",{key:t,style:{width:`${r||n}px`,minWidth:`${r||n}px`}})})),o&&l().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),l().createElement("tfoot",null,(()=>{const{isIE:e}=r.current,n=["gutter",{"cell-fix-right":!!d.length}],u=e?null:{right:d.length?0:""};return t.map(((e,t)=>l().createElement("tr",{key:t,className:"footer--row"},s.map(((t,n)=>((e,t,n)=>{const{isIE:s}=r.current,{gutterWidth:u}=i,{dataIndex:h,fixed:g,align:y,summation:b}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===y,"col--right":"right"===y,"column--sort":!!a[h],"cell-fix-left":!s&&"left"===g,"cell-fix-right":!s&&"right"===g,"cell-fix-left-last":!s&&"left"===g&&c[c.length-1]?.dataIndex===h,"cell-fix-right-first":!s&&"right"===g&&d[0]?.dataIndex===h}],x=s?null:{left:"left"===g?`${m(h)}px`:"",right:"right"===g?`${p(h)+(o?u:0)}px`:""},E=b?.render?b.render(r.current.tableFullData):jr(t,`${h}_text`),C=0===n&&""===E?f("qm.table.config.summaryText"):E;return l().createElement("td",{key:h,title:C,className:xe()(v),style:{...x}},l().createElement("div",{className:"cell"},C))})(t,e,n))),o&&l().createElement("td",{className:xe()(n),style:{...u}}))))})())))};var Wc=function(e){return e.small="small",e.middle="default",e.large="default",e}(Wc||{});const Uc=e=>{const{current:t,pageSize:r,total:n,onChange:a}=e,{global:i}=l().useContext(o),{tableRef:s,prefixCls:c,$size:d,setElementStore:u}=l().useContext(To),{uniqueKey:m,paginationConfig:p,infoBarConfig:h}=s.current.props,f=l().useRef(null),g=l().useMemo((()=>m?`tablePager_${m}`:""),[m]);l().useLayoutEffect((()=>{y(),E()}),[]);const y=()=>{u("$pager",f.current)},b=p?.showSizeChanger??zo.pagination.showSizeChanger,v=p?.showQuickJumper??zo.pagination.showQuickJumper,x=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||zo.pagination.pageSizeOptions,E=async()=>{if(!g)return;const e=await C(g);e&&e!==r&&(a(t,e),localStorage.setItem(g,e.toString()))},C=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(g))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},w={[`${c}-pager`]:!0};return l().createElement("div",{ref:f,className:xe()(w)},l().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&l().createElement(rs,{total:n})),l().createElement(O.Pagination,{size:Wc[d],showSizeChanger:b,showQuickJumper:v,pageSizeOptions:x,current:t,pageSize:r,total:n,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{g&&((async(e,t)=>{const r=i?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(g,t),localStorage.setItem(g,`${t}`))}}))},Gc=()=>{const{prefixCls:e,layout:t}=l().useContext(To),r=l().useMemo((()=>{const{headerHeight:e,viewportHeight:r}=t;return{top:`${e}px`,height:`${r}px`}}),[t]);return l().createElement("div",{className:`${e}--empty`,style:r},l().createElement(ct,null))},Yc=()=>{const{prefixCls:e,setElementStore:t}=l().useContext(To),r=l().useRef(null);l().useLayoutEffect((()=>{n()}),[]);const n=()=>{t("$resizableBar",r.current)};return l().createElement("div",{ref:r,className:`${e}--resizable-bar`})};function Xc(){return Xc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xc.apply(null,arguments)}const Qc=l().forwardRef(((e,t)=>{const r=h(Ro,e),{rowKey:n,columns:a,loading:i,resizable:s,customClass:c,areaSelection:d,tablePrint:u,exportExcel:m,infoBarConfig:p,topSpaceAlign:f,showTableInfo:g,showFullScreen:y,showRefresh:b,showToolBox:v,showHeader:x,className:E,style:C}=r,{$size:w}=X(r),S=l().useRef(null),N=l().useRef(null),T=l().useRef(null),I=l().useRef(null),R=l().useRef(null),O=Ee("table"),P=Y(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(me("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),{tableRef:k,tableFullData:A,setElementStore:L,setOriginColumns:F,setTableFullData:_,setTableOriginData:D,setTableFlatData:H,setAllTableData:$,setDeriveRowKeys:q,setInvalidRowKeys:M,setFieldAuth:K,setColumnsDefined:V,setScrollXStore:j,setScrollYStore:z,setScrollXLoad:B,setScrollYLoad:W,setResizeState:U,setHandleState:G,setSummaries:J,setSelectionRows:ee,setShouldToTop:te,setRecordsMap:re,setUnMounted:ne,clearElementStore:ie,clearRecordsMap:le}=((e,{getRowKey:t,$size:r})=>{const{rowHeight:n,dynamicThead:a}=e,i=l().useRef({props:e,uid:qo(),tableManager:Ko,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],tableFlatData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!a,scrollBarRef:l().createRef(),scrollXStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0},scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:n||zo.rowHeightMaps[r]},store:new jo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollXLoad:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!Z&&/MSIE|Trident/.test(navigator.userAgent)});var o;o=e,i.current.props=o;const s=(e,r,n="",a="",i=0)=>e.map((e=>{const l=t(e,e.index),o=n?`${n}#${l}`:`${l}`,c=a?`${a}.${e.index+1}`:`${e.index+1}`,d={level:i,rowKey:l,rowKeyPath:o,indexPath:c};return e.indexPath=c,e._level=i,Array.isArray(e.children)&&(d.children=s(e.children,l,o,c,i+1)),r?Object.assign({},d,{parentRowKey:r}):d})),c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:i,...i.current,setElementStore:(e,t)=>{i.current.elementStore[e]=t},setOriginColumns:e=>{i.current.originColumns=e},setTableFullData:e=>{i.current.tableFullData=e},setTableFlatData:e=>{i.current.tableFlatData=e},setTableOriginData:e=>{i.current.tableOriginData=e},setAllTableData:e=>{const r=_r(e);i.current.allTableData=r,i.current.allRowKeys=r.map((e=>t(e,e.index)))},setDeriveRowKeys:e=>{const t=i.current.tableFullData.some((e=>Array.isArray(e.children)));i.current.treeTable=t,i.current.deriveRowKeys=t?s(e,""):[],i.current.flattenRowKeys=t?c(i.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{i.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{i.current.fieldAuth[e]=t},setColumnsDefined:e=>{i.current.columnsDefined=e},setScrollXStore:e=>{i.current.scrollXStore=e},setScrollYStore:e=>{i.current.scrollYStore=e},setResizeState:e=>{i.current.resizeState=e},setHandleState:e=>{i.current.handleState=e},setSummaries:e=>{i.current.summaries=e},setScrollXLoad:e=>{i.current.scrollXLoad=e},setScrollYLoad:e=>{i.current.scrollYLoad=e},setShouldToTop:e=>{i.current.shouldToTop=e},setSelectionRows:e=>{i.current.selectionRows=e},setRecordsMap:(e,t)=>{i.current.recordsMap.set(e,t)},setUnMounted:e=>{i.current.unMounted=e},clearElementStore:()=>{for(const e in i.current.elementStore)i.current.elementStore[e]=null},clearRecordsMap:()=>{i.current.recordsMap.clear()}}})(r,{getRowKey:P,$size:w}),{tableData:oe,setTableData:ce,tableFlatColumns:de,setTableFlatColumns:ue,filters:pe,setFilters:he,sorter:fe,setSorter:ge,superFilters:ye,setSuperFilters:be,pagination:ve,setPagination:Ce,selectionKeys:we,setSelectionKeys:Se,rowExpandedKeys:Ne,setRowExpandedKeys:Te,highlightKey:Ie,setHighlightKey:Re,updateMark:Oe,forceUpdate:Pe,mergedTdCells:ke,setMergedCells:Ae,layout:Le,setLayout:Fe,permission:_e,setPermission:He,spinning:$e,setSpinning:qe,scrollX:Me,setScrollX:Ke,scrollY:Ve,setScrollY:je,isPingLeft:ze,setPingLeft:Be,isPingRight:We,setPingRight:Ue,isFullScreen:Ge,setFullScreen:Ye,updateTableData:Xe}=(e=>{const{uniqueKey:t,nativeScrollBar:r,initialSorter:n={},initialFilter:a={},paginationConfig:i,rowSelection:s,expandable:c,rowHighlight:d,mergedCells:u}=e,{global:m}=l().useContext(o),p={current:i?.current??zo.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??i?.pageSize??m?.table?.pagination?.pageSize??zo.pagination.pageSize,total:0},h=s?.selectedRowKeys??s?.defaultSelectedRowKeys??[],f=c?.expandedRowKeys??c?.defaultExpandedRowKeys??[],[g,y]=l().useState([]),[b,v]=l().useState([]),[x,E]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),a),[C,w]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),n),[S,N]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),[]),[T,I]=l().useState(p),[R,O]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),h),[P,k]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),f),[A,L]=l().useState(d?.currentRowKey??""),[F,_]=l().useReducer((e=>e+1),0),[D,H]=Wo([],{value:u}),[$,q]=l().useState({gutterWidth:r?Go():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[M,K]=l().useState({export:!0,import:!0,print:!0}),[V,j]=l().useState(!1),[z,B]=l().useState(!1),[W,U]=l().useState(!1),[G,Y]=l().useState(!1),[X,Z]=l().useState(!1),[J,ee]=l().useState(!1);return{tableData:g,setTableData:y,tableFlatColumns:b,setTableFlatColumns:v,filters:x,setFilters:E,sorter:C,setSorter:w,superFilters:S,setSuperFilters:N,pagination:T,setPagination:I,selectionKeys:R,setSelectionKeys:O,rowExpandedKeys:P,setRowExpandedKeys:k,highlightKey:A,setHighlightKey:L,updateMark:F,forceUpdate:_,mergedTdCells:D,setMergedCells:H,layout:$,permission:M,setPermission:K,setLayout:q,spinning:V,setSpinning:j,scrollX:z,setScrollX:B,scrollY:W,setScrollY:U,isPingLeft:G,setPingLeft:Y,isPingRight:X,setPingRight:Z,isFullScreen:J,setFullScreen:ee,updateTableData:()=>y([...g])}})(r),{isFetch:Qe,isWebPagination:Ze,isScrollPagination:Je,showPagination:et,shouldUpdateHeight:tt,tableColumns:rt,flattenColumns:nt,editableColumns:at,summationColumns:it,leftFixedColumns:lt,rightFixedColumns:ot,derivedMergeCells:st,treeExpandIndex:ct,showSummary:dt,showFooter:mt,isHeadGroup:pt,bordered:ht,isHeadSorter:ft,isHeadFilter:gt,isServiceSummation:yt,isSelectCollection:bt,isTableImport:vt,isTableClipboard:xt,isSuperSearch:Et,isFastSearch:Ct,isPivotGrid:wt,isGroupSummary:St,isGroupSubtotal:Nt,isTreeTable:Tt,isTableEmpty:It,summationRows:Rt,fetchParams:Ot}=Xo(r,{getRowKey:P,tableRef:k,tableFullData:A,tableData:oe,sorter:fe,filters:pe,superFilters:ye,selectionKeys:we,pagination:ve,mergedTdCells:ke}),{createElementStore:Pt,tableStyles:kt,getSpan:At,getStickyLeft:Lt,getStickyRight:Ft,scrollXToColumn:_t,scrollYToRecord:Dt,rowInViewport:Ht,calcTableHeight:$t,resetTableScroll:qt,computeVirtualX:Mt,computeVirtualY:Kt,doLayout:Vt}=es(r,{getRowKey:P,tableRef:k,topElementRef:S,tableElementRef:N,$size:w,tableColumns:rt,flattenColumns:nt,leftFixedColumns:lt,derivedMergeCells:st,layout:Le,scrollX:Me,scrollY:Ve,showFooter:mt,showPagination:et,isFullScreen:Ge,setLayout:Fe,setScrollX:Ke,setScrollY:je,setElementStore:L,setScrollXStore:j,setScrollYStore:z,setShouldToTop:te}),{initialTable:jt,checkDataIndex:zt,createTableFullData:Bt,getTableData:Wt,handleTableData:Ut,createWebPageData:Gt,createTableData:Yt,createGroupData:Xt,createSelectionKeys:Qt,createRowExpandedKeys:Zt,setSelectionKeysEffect:Jt,findParentRowKeys:er,getAllChildRowKeys:tr,doFieldValidate:rr,getTableLog:nr,dataChange:ar,tableChange:ir,toLastPage:lr,toFirstPage:or,getPageCount:sr,pagerChangeHandle:cr,triggerScrollXEvent:dr,triggerScrollYEvent:ur,scrollBottomDebouncer:mr,clearTableSorter:pr,clearTableFilter:hr,clearSuperFilters:fr,clearRowSelection:gr,clearRowHighlight:yr,clearTableLog:br,destroy:vr}=Jo(r,{getRowKey:P,tableRef:k,tableElementRef:N,tableBodyRef:T,$size:w,tableColumns:rt,flattenColumns:nt,editableColumns:at,tableFullData:A,pagination:ve,layout:Le,filters:pe,sorter:fe,superFilters:ye,fetchParams:Ot,selectionKeys:we,rowExpandedKeys:Ne,highlightKey:Ie,summationColumns:it,shouldUpdateHeight:tt,isFetch:Qe,isTreeTable:Tt,isWebPagination:Ze,isScrollPagination:Je,isServiceSummation:yt,isGroupSubtotal:Nt,doLayout:Vt,setTableData:ce,setTableFlatColumns:ue,setTableFullData:_,setTableOriginData:D,setTableFlatData:H,setAllTableData:$,setDeriveRowKeys:q,setPagination:Ce,setSpinning:qe,setSorter:ge,setFilters:he,setSuperFilters:be,setSelectionKeys:Se,setRowExpandedKeys:Te,setHighlightKey:Re,setSelectionRows:ee,setScrollXLoad:B,setScrollYLoad:W,setScrollXStore:j,setScrollYStore:z,computeVirtualX:Mt,computeVirtualY:Kt,setFieldAuth:K,setResizeState:U,setSummaries:J,setPermission:He,setRecordsMap:re,resetTableScroll:qt,clearElementStore:ie,clearRecordsMap:le});((e,t)=>{const{columns:r,summation:n,rowSelection:a,expandable:i,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,scrollX:u,pagination:m,selectionKeys:p,rowExpandedKeys:h,highlightKey:f,summationRows:g,showSummary:y,isWebPagination:b,isScrollPagination:v,checkDataIndex:x,toLastPage:E,toFirstPage:C,getPageCount:w,setHandleState:S,scrollYToRecord:N,setSelectionKeysEffect:T,setOriginColumns:I,setRowExpandedKeys:R,setHighlightKey:O,setResizeState:P,setPingRight:k,setUnMounted:A,calcTableHeight:L,createSelectionKeys:F,createRowExpandedKeys:_,initialTable:D,destroy:H}=t,$=l().useRef(g);De((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(p.length?[p[0],""]:[]),p.__prevent__||e?.(p,s.current.selectionRows),qr(p)}),[p]),De((()=>{if(!i)return;const{onChange:e}=i;h.__prevent__||e?.(h,h.map((e=>s.current.recordsMap.get(e)))),qr(h)}),[h]),De((()=>{o&&(c.current.setClickedValues(f?[f,""]:[]),o.onChange?.(f,s.current.recordsMap.get(f)??null))}),[f]),De((()=>{(0,Q.isEqual)(g,$.current)||($.current=g,y&&n&&n.onChange?.(g))}),[g]),De((()=>{const e=F(a.selectedRowKeys);(0,Q.isEqual)(e,p)||T($r(e))}),[a?.selectedRowKeys]),De((()=>{const e=_(i.expandedRowKeys);(0,Q.isEqual)(e,h)||R($r(e))}),[i?.expandedRowKeys]),De((()=>{const{currentRowKey:e}=o;e!==f&&O(e??"")}),[o?.currentRowKey]),De((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(b&&("after"===e?E():C()),N("","after"===e?1e5:0)),t&&m.current>w()&&E(),(e||t)&&S({insert:null,remove:!1})}),[m.total]),De((()=>{k(u)}),[u]),De((()=>{L()}),[d]),De((()=>{s.current.scrollYLoad&&(e.height||e.maxHeight||me("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||me("Table","必须设置组件参数 `ellipsis`")),v&&(e.height||e.maxHeight||me("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,v]),ts({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(P(Object.assign({},e,{winHeight:r})),L())},delay:16}),l().useEffect((()=>(I(se(r)),D(),x(),ae((()=>L())),()=>{H(),A(!0)})),[])})(r,{tableRef:k,tableBodyRef:T,$size:w,scrollX:Me,pagination:ve,selectionKeys:we,rowExpandedKeys:Ne,highlightKey:Ie,showSummary:dt,summationRows:Rt,isWebPagination:Ze,isScrollPagination:Je,checkDataIndex:zt,toLastPage:lr,toFirstPage:or,getPageCount:sr,setHandleState:G,scrollYToRecord:Dt,setOriginColumns:F,setSelectionKeysEffect:Jt,setRowExpandedKeys:Te,setHighlightKey:Re,setResizeState:U,setPingRight:Ue,setUnMounted:ne,calcTableHeight:$t,createSelectionKeys:Qt,createRowExpandedKeys:Zt,initialTable:jt,destroy:vr});const xr=l().useMemo((()=>({getRowKey:P,tableRef:k,tableBodyRef:T,prefixCls:O,$size:w,flattenColumns:nt,editableColumns:at,leftFixedColumns:lt,rightFixedColumns:ot,treeExpandIndex:ct,sorter:fe,filters:pe,superFilters:ye,layout:Le,bordered:ht,showFooter:mt,showSummary:dt,summationRows:Rt,scrollX:Me,scrollY:Ve,pagination:ve,fetchParams:Ot,selectionKeys:we,rowExpandedKeys:Ne,highlightKey:Ie,mergedTdCells:ke,derivedMergeCells:st,updateMark:Oe,isFetch:Qe,isPingLeft:ze,isPingRight:We,isHeadSorter:ft,isHeadFilter:gt,isFullScreen:Ge,isTableEmpty:It,isHeadGroup:pt,isTreeTable:Tt,isGroupSubtotal:Nt,isWebPagination:Ze,dataChange:ar,tableChange:ir,getTableData:Wt,setElementStore:L,createWebPageData:Gt,createTableFullData:Bt,updateTableData:Xe,setSorter:ge,setFilters:he,setSuperFilters:be,setHighlightKey:Re,setRowExpandedKeys:Te,setSelectionRows:ee,setSelectionKeysEffect:Jt,setInvalidRowKeys:M,setMergedCells:Ae,getSpan:At,getStickyLeft:Lt,getStickyRight:Ft,scrollXToColumn:_t,scrollYToRecord:Dt,rowInViewport:Ht,setPagination:Ce,setPingLeft:Be,setPingRight:Ue,setSpinning:qe,setFullScreen:Ye,setShouldToTop:te,doFieldValidate:rr,createTableData:Yt,createGroupData:Xt,findParentRowKeys:er,getAllChildRowKeys:tr,triggerScrollXEvent:dr,triggerScrollYEvent:ur,scrollBottomDebouncer:mr,resetTableScroll:qt,clearTableSorter:pr,clearTableFilter:hr,clearSuperFilters:fr,clearRowSelection:gr,clearRowHighlight:yr})),[w,nt,at,lt,ot,ct,fe,pe,ye,Le,ht,mt,dt,Rt,Me,Ve,ve,Ot,we,Ne,Ie,st,Oe,Qe,ze,We,ft,gt,Ge,It,pt,Tt,Nt,Ze]);((e,t)=>{const{getRowKey:r,tableRef:n,toolBoxRef:a,tableBodyRef:i,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,isFetch:f,dataChange:g,getTableData:y,handleTableData:b,createTableData:v,createTableFullData:x,calcTableHeight:E,scrollXToColumn:C,scrollYToRecord:w,doFieldValidate:S,setTableOriginData:N,setHandleState:T,setColumnsDefined:I,setSelectionKeysEffect:R,setRowExpandedKeys:O,setHighlightKey:P,setSelectionRows:k,setOriginColumns:A,forceUpdate:L,getTableLog:F,clearRowSelection:_,clearRowHighlight:D,clearTableSorter:H,clearTableFilter:$,clearSuperFilters:q,clearTableLog:M}=t,{columns:K,columnsChange:V}=n.current.props,j=(e,t,n)=>e.filter((e=>{const a=r(e,e.index);e.children&&(e.children=j(e.children,t,n));const i=t.includes(a);return i&&n?.(e,a),!i}));l().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:async e=>{f&&(await y(),e?.())},GET_LOG:()=>F(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(_(),D(),H(),$(),q(),M(),v([]))},CLEAR_LOG:()=>{M()},CREATE_FOCUS:(e,t)=>{i.current.createFocus(e,t)},FORCE_UPDATE:()=>{L()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{C(e)},SET_SELECTION:(e,t)=>{R(t?$r([...e]):e)},SET_EXPANDABLE:(e,t)=>{O(t?$r([...e]):e)},SET_HIGHLIGHT:e=>{P(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{A(e),I(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=Pr(K,e);if(!n)return me("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,Q.isPlainObject)(t))return me("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return me("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,Q.set)(n,e,t[e]);r&&(V?V([...K]):me("Table","需要设置 `columnsChange` 参数"),L())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i}=n.current,l=(Array.isArray(e)?e:[e]).filter((e=>(0,Q.isPlainObject)(e)));if(!l.length)return;l.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[zo.expandableColumn,zo.selectionColumn,zo.operationColumn].includes(r)||zr(e,r,jr(e,r))})),a.addToInserted(e)}));const o="before"===t?.mode,c=void 0===t?.parentRowKey,d=i;if(c)o?d.unshift(...l):d.push(...l);else{const e=ln(i,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}c&&T(Object.assign({},n.current.handleState,{insert:o?"before":"after"})),v(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a}=n.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,Q.isPlainObject)(e)?r(e,e.index):e));if(!i.length)return;let l=!1;const o=j(a,i,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),l=!0}));l&&(T(Object.assign({},n.current.handleState,{remove:!0})),x(o),R(m.filter((e=>!i.includes(e)))),i.includes(h)&&D(),O(p.filter((e=>!i.includes(e)))),g(),ae((()=>{N(j(n.current.tableOriginData,i))})))},VALIDATE_FIELDS:(e,t)=>{n.current.allTableData.forEach((n=>{c.forEach((a=>{const{dataIndex:i,editRender:l}=a,o=l?.(n,a);if(!o)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:d}=o;d||S(c,jr(n,i),s,i)}))}));const{required:a,validate:i}=F(),l=[...a,...i];return l.length&&w(l[0].rowKey),L(),{required:a,validate:i}}})))})(t,{getRowKey:P,tableRef:k,toolBoxRef:I,tableBodyRef:T,columnFilterRef:R,flattenColumns:nt,editableColumns:at,pagination:ve,fetchParams:Ot,selectionKeys:we,rowExpandedKeys:Ne,highlightKey:Ie,isFetch:Qe,dataChange:ar,getTableData:Wt,handleTableData:Ut,createTableData:Yt,createTableFullData:Bt,calcTableHeight:$t,scrollXToColumn:_t,scrollYToRecord:Dt,doFieldValidate:rr,setTableOriginData:D,setHandleState:G,setColumnsDefined:V,setSelectionKeysEffect:Jt,setRowExpandedKeys:Te,setHighlightKey:Re,setSelectionRows:ee,setOriginColumns:F,forceUpdate:Pe,getTableLog:nr,clearRowSelection:gr,clearRowHighlight:yr,clearTableSorter:pr,clearTableFilter:hr,clearSuperFilters:fr,clearTableLog:br}),l().useLayoutEffect((()=>{Pt(),k.current.tableManager.register(k.current.uid,t??{current:null})}),[]);const Er={[`${O}--wrapper`]:!0,[`${O}--lg`]:"large"===w,[`${O}--sm`]:"small"===w,[`${O}--maximize`]:Ge,[c]:!!c},Cr={[O]:!0,"is--border":ht,"is--fixed":lt.length||ot.length,"is--sortable":ft,"is--filterable":gt,"is--head-group":pt,"is--area-select":!!d,"is--ping-left":ze,"is--ping-right":We};return l().createElement(To.Provider,{value:xr},l().createElement("div",{className:xe()(Er,E),style:C},g&&l().createElement("div",{ref:S,className:`${O}-top`},l().createElement("div",{className:`${O}-top__space`},"bottom"!==p?.position&&l().createElement(rs,{total:ve.total}),l().createElement("div",{className:`${O}-top__space-slot`,style:{justifyContent:Do[f]}},r.children)),l().createElement("div",{className:`${O}-top__actions`},l().createElement(Xs,{ref:I,showFullScreen:y,showReload:b&&Qe,showPrint:_e.print&&!!u,showImport:_e.import&&vt,showExport:_e.export&&!!m,showClipboard:xt,showCollection:bt,showFastSearch:Ct,showSuperSearch:Et,showPivotGrid:wt,showGroupSummary:St,showToolBox:v,tableColumns:rt}),l().createElement(Js,{ref:R,columns:a}))),l().createElement(ut,{spinning:i??$e},l().createElement("div",{ref:N,className:xe()(Cr),style:kt},l().createElement("div",{className:`${O}--main-wrapper`},x&&l().createElement(sc,{tableColumns:rt,sorter:fe,filters:pe}),l().createElement(zc,{ref:T,tableFlatColumns:de,tableData:oe}),mt&&l().createElement(Bc,{summationRows:Rt})),ht&&l().createElement("div",{className:`${O}--border-line`}),It&&l().createElement(Gc,null),s&&l().createElement(Yc,null))),et&&l().createElement(Uc,Xc({},ve,{onChange:(e,t)=>cr({current:e,pageSize:t})}))))}));Qc.displayName="QmTable";const Zc=Qc,Jc=Zc;function ed(){return ed=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ed.apply(null,arguments)}const td=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},className:c,style:d,onClose:u}=e,{$size:m}=X(e),{t:p}=G(),h=l().useRef(null),f=l().useRef(null),y=l().useRef(null),b=vt(h),[v,x]=l().useState(s),[E,C]=l().useState(),[w,S]=l().useState(i),[N,T]=l().useState(!1),[I,R]=l().useState(300),[O,P]=l().useState(o),[k,A]=l().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[L,F]=l().useState((0,Q.merge)({},s.fetch?.params,n)),[_,D]=l().useState([]),H=()=>{const e=h.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Ra[m]-30)},$=xt(H,5);g((()=>{$()}),[b.width]),De((()=>{(0,Q.isEqual)(o,O)||P(o)}),[o]),l().useEffect((()=>{q()}),[L]),l().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{n&&f.current?.SET_FIELDS_VALUE(n)}),[]);const q=async()=>{const{webPagination:e,fetch:t}=v;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=re}=t;if(i(L)){T(!0);try{const e=await n(L);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];r||(S([]),await ne(0)),D(t)}}catch(e){}T(!1)}},M=e=>{r||(C(e),u(e))},K=e=>{F(Object.assign({},L,e))},V=Ee("search-helper"),j={[`${V}--wrapper`]:!0},z=v.webPagination?{dataSource:_,loading:N,webPagination:!0}:{fetch:{...v.fetch,params:L}};return l().createElement("div",{ref:h,className:xe()(j,c),style:d},l().createElement("div",{className:"form-wrap"},O.length?l().createElement(Ml,{ref:f,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>P(e),onCollapse:()=>H(),onFinish:e=>K(e),onReset:async()=>{const[e,t]=await f.current.GET_FORM_DATA();e||K(t)}}):null),l().createElement("div",null,l().createElement(Jc,ed({ref:y,uniqueKey:t,height:I,columns:k,rowKey:v.rowKey||"pageIndex"},z,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{S(e),C(r?t:t[0])}},paginationConfig:v.paginationConfig,columnsChange:e=>A(e),onRowDblclick:M,onRowEnter:M}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!E,onClick:()=>u(E,r?w:void 0)},p("qm.dialog.confirm"))))};td.displayName="QmSearchHelper";const rd=td;function nd(){return nd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nd.apply(null,arguments)}const ad=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...ad(e.children)),e.children&&t.push(e.value)})),t},id=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=id(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},ld=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&ld(e.children,t),t(e)||e.children&&e.children.length))),od=e=>{const{uniqueKey:t,multiple:r,initialValue:n,selectionRows:a,defaultSelectedKeys:i=[],filters:o=[],table:s={},tree:c={},className:d,style:u,onClose:m}=e,{$size:p}=X(e),{t:h}=G(),f=l().useRef(null),y=l().useRef(null),b=l().useRef(null),v=vt(f),[x,E]=l().useState(s),[C,w]=l().useState(),[S,N]=l().useState(i),[T,I]=l().useState(!1),[R,P]=l().useState(300),[k,A]=l().useState(300),[L,F]=l().useState(o),[_,D]=l().useState([{title:h("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[H,$]=l().useState((0,Q.merge)({},s.fetch?.params,n)),[q,M]=l().useState([]),K=()=>{const e=f.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");P(e.offsetHeight-r.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Ra[p]-30)},V=xt(K,5);g((()=>{V()}),[v.width]),De((()=>{(0,Q.isEqual)(o,L)||F(o)}),[o]),l().useEffect((()=>{j()}),[H]),l().useEffect((()=>{a&&b.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{n&&y.current?.SET_FIELDS_VALUE(n),ie()}),[]);const j=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:n,dataKey:a,beforeFetch:i=re}=t;if(i(H)){I(!0);try{const e=await n(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];r||(N([]),await ne(0)),M(t)}}catch(e){}I(!1)}},z=e=>{r||(w(e),m(e))},B=e=>{$(Object.assign({},H,e))},[W,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),te=l().useRef(W),ae=l().useRef([]);De((()=>{Z(ad(W))}),[W]);const ie=async()=>{if(!c.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=c.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,Q.get)(i.data,r)??[],t=On(e,n,a);U(t),te.current=t,ae.current=e}}catch(e){}},le=e=>`${e}|${Gn.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe=Ee("tree-table-helper"),se={[`${oe}--wrapper`]:!0},ce=x.webPagination?{dataSource:q,loading:T,webPagination:!0}:{fetch:{...x.fetch,params:H}};return l().createElement("div",{ref:f,className:xe()(se,d),style:u},l().createElement(tt,{defaultValue:200,style:{height:"100%"}},l().createElement(tt.Pane,{min:100,style:{overflowY:"auto"}},l().createElement(O.Input,{className:"input-wrap",value:J,style:{marginBottom:8},placeholder:h("qm.form.inputPlaceholder"),suffix:l().createElement(Ce.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{const t=ld(te.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==le(r).indexOf(e)}));ee(e),U(t)})(e.target.value)}),l().createElement(O.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:Y,treeData:W,filterTreeNode:e=>{if(!J)return!1;const t=e.text||"";return-1!==le(t).indexOf(J)},onExpand:e=>{Z(e)},onSelect:e=>{const{valueKey:t="value"}=c.fetch;(e=>{if(!c.tableParamsMap)return me("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof c.tableParamsMap?c.tableParamsMap():c.tableParamsMap,r={};for(const n in t)r[n]=(0,Q.get)(e,t[n]);B(r)})(id(ae.current,(r=>(0,Q.get)(r,t)===e[0]))||{})}})),l().createElement(tt.Pane,{className:"split-pane"},l().createElement("div",{className:"form-wrap"},L.length?l().createElement(Ml,{ref:y,items:L,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>F(e),onCollapse:()=>K(),onFinish:e=>B(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||B(t)}}):null),l().createElement("div",null,l().createElement(Jc,nd({ref:b,uniqueKey:t,height:k,columns:_,rowKey:x.rowKey||"pageIndex"},ce,{rowSelection:{type:r?"checkbox":"radio",clearableAfterFetched:!r,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),w(r?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>D(e),onRowDblclick:z,onRowEnter:z}))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>m(null),style:{marginRight:8}},h("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!C,onClick:()=>m(C,r?S:void 0)},h("qm.dialog.confirm"))))};od.displayName="TreeTableHelper";const sd=od,cd=e=>{const{multiple:t,tree:r={},defaultSelectedKeys:n,className:a,style:i,onClose:o}=e,{$size:s}=X(e),{t:c}=G(),[d,u]=l().useState(),[m]=l().useState(r.fetch?.params),p=Ee("tree-helper"),h={[`${p}--wrapper`]:!0},f=r.fetch?{...oe(r.fetch,["params","valueKey","textKey"]),params:m}:void 0;return l().createElement("div",{className:xe()(h,a),style:i},l().createElement(No,{multiple:t,fetch:f,fieldsDefine:{valueKey:r.fetch?.valueKey,textKey:r.fetch?.textKey},autoFocus:!0,asyncLoad:r.asyncLoad,checkStrictly:r.checkStrictly,checkStrategy:r.checkStrategy,defaultSelectedKeys:n,defaultExpandAll:r.defaultExpandAll,onSelectChange:e=>u(e),onCheckChange:e=>u(e)}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!d,onClick:()=>o(d)},c("qm.dialog.confirm"))))};cd.displayName="TreeHelper";const dd=cd;function ud(){return ud=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ud.apply(null,arguments)}const md="_startSign",pd="_endSign",hd=e=>{const{uniqueKey:t,initialValue:r,filters:n=[],table:a={},onClose:i}=e,{$size:o}=X(e),{t:s}=G(),c=l().useRef(null),d=l().useRef(null),u=l().useRef(null),m=vt(c),[p,h]=l().useState(a),[f,y]=l().useState(!1),[b,v]=l().useState([]),[x,E]=l().useState(300),[C,w]=l().useState(n),[S,N]=l().useState([{title:s("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},{title:s("qm.form.rangeSearchHelper")[0],dataIndex:md,width:80,align:"right",render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:s("qm.form.rangeSearchHelper")[1],dataIndex:pd,fixed:"right",width:80,render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)}]),[T,I]=l().useState((0,Q.merge)({},a.fetch?.params,r)),[R,P]=l().useState([]),k=l().useMemo((()=>b.map((e=>e?.pageIndex))),[b]),A=l().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),L=()=>{const e=c.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Ra[o]-30)},F=xt(L,5);g((()=>{F()}),[m.width]),De((()=>{(0,Q.isEqual)(n,C)||w(n)}),[n]),l().useEffect((()=>{_()}),[T]);const _=async()=>{const{webPagination:e,fetch:t}=p;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=re}=t;if(a(T)){y(!0);try{const e=await r(T);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,n)??[];P(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},H=()=>{b.forEach((e=>{e&&(D(e,md),D(e,pd))})),v([])},$=e=>{H(),I(Object.assign({},T,e))},q=Ee("range-helper"),M=p.webPagination?{dataSource:R,loading:f,webPagination:!0}:{fetch:{...p.fetch,params:T}};return l().createElement("div",{ref:c,className:`${q}--wrapper`},l().createElement("div",{className:"form-wrap"},C.length?l().createElement(Ml,{ref:d,items:C,initialValues:r,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>L(),onFinish:e=>$(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||$(t)}}):null),l().createElement("div",null,l().createElement(Jc,ud({ref:u,height:x,columns:S,rowKey:p.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[md,pd].includes(r)&&(r===md&&(e[r]?(D(e,r),v([void 0,b[1]])):e.pageIndex>k[1]?O.message.warning(s("qm.searchHelper.rangeStartTip")):(b[0]&&D(b[0],r),e[r]="[",v([e,b[1]]))),r===pd&&(e[r]?(D(e,r),v([b[0],void 0])):e.pageIndex<k[0]?O.message.warning(s("qm.searchHelper.rangeEndTip")):(b[1]&&D(b[1],r),e[r]="]",v([b[0],e]))),u.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[md]="["),e.pageIndex===k[1]&&(e[pd]="]")}))}}),l().createElement(fe,{type:"primary",icon:l().createElement(Ce.ClearOutlined,null),title:s("qm.table.alert.clear"),onClick:()=>H()}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ra[o]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(fe,{onClick:()=>i(null),style:{marginRight:8}},s("qm.dialog.cancel")),l().createElement(fe,{type:"primary",disabled:!A,onClick:()=>i(b.map((e=>(e=>{const t={};for(const r in e)[md,pd].includes(r)||(t[r]=e[r]);return t})(e))))},s("qm.dialog.confirm"))))};hd.displayName="RangeTableHelper";const fd=hd,gd=e=>null!=e;function yd(e,t,r,n){const[a,i]=l().useState(void 0);l().useLayoutEffect((()=>{const t="function"==typeof e?e():e;i(t||null)}));const[o,s]=l().useState(null),c=()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:l}=e.getBoundingClientRect();return n>=0&&l>=0&&a<=t&&i<=r})(a)&&t&&a.scrollIntoView(n);const{left:e,top:r,width:i,height:l}=a.getBoundingClientRect(),o={left:e,top:r,width:i,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};return l().useLayoutEffect((()=>{c()}),[a,t]),ts({handler:c}),[l().useMemo((()=>{if(!o)return o;const e=r?.offset||6,t=r?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,r]),a]}const bd={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},vd={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},xd=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Ed(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(bd).forEach((e=>{const c={...n&&vd[e]||bd[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,xd.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const d=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-d.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":c.offset[0]=d.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":c.offset[1]=-d.arrowOffsetHorizontal-o;break;case"leftBottom":case"rightBottom":c.offset[1]=d.arrowOffsetHorizontal+o}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+r,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+r,i.shiftX=!0,i.adjustX=!0}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,d,t,r),l&&(c.htmlRegion="visibleFirst")})),s}const Cd=require("@rc-component/portal");var wd=n.n(Cd);const Sd=require("@rc-component/trigger");var Nd=n.n(Sd);function Td(){return Td=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Td.apply(null,arguments)}const Id={fill:"transparent",pointerEvents:"auto"},Rd=e=>{const{prefixCls:t,rootClassName:r,pos:n,showMask:a,style:i={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${qo()}`,m="object"==typeof c?c?.placeholder:c;return l().createElement(wd(),{open:s,autoLock:!0},l().createElement("div",{className:xe()(`${t}-mask`,r),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none",...i}},a?l().createElement("svg",{style:{width:"100%",height:"100%"}},l().createElement("defs",null,l().createElement("mask",{id:u},l().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),n&&l().createElement("rect",{x:n.left,y:n.top,rx:n.radius,width:n.width,height:n.height,fill:"black",className:m?`${t}-placeholder-animated`:""}))),l().createElement("rect",Td({},n?null:Id,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),n&&l().createElement(l().Fragment,null,l().createElement("rect",Td({},Id,{x:"0",y:"0",width:"100%",height:`${n.top}px`})),l().createElement("rect",Td({},Id,{x:"0",y:"0",width:n.left,height:"100%"})),l().createElement("rect",Td({},Id,{x:"0",y:n.top+n.height,width:"100%",height:`calc(100vh - ${n.top+n.height}px)`})),l().createElement("rect",Td({},Id,{x:n.left+n.width,y:"0",width:`calc(100vw - ${n.left+n.width}px)`,height:"100%"})))):null))},Od=e=>{const{prefixCls:t,zIndex:r,open:n,onPause:a,onPlay:i}=e,[o,s]=Wo(void 0,{value:n,postState:e=>e??!0}),c=l().useRef(null),d=l().useRef(!1),u=Y((e=>{m(e),e.shiftKey&&32===e.keyCode&&p()}));l().useEffect((()=>{const e=Mt()(document,"keyup",u);return()=>e.remove()}),[]);const m=e=>{e.stopPropagation(),e.preventDefault()},p=()=>{d.current?d.current=!1:(s(!o),o?a?.():i?.())};return l().createElement("div",{ref:c,className:`${t}-control`,style:{zIndex:r+1},onMouseDown:e=>{m(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-ze(t).x,o=e.clientY-ze(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-r-1&&(s=a-r-1),c<0&&(c=0),c>i-n-1&&(c=i-n-1),Ke(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>p()},o?l().createElement(Ce.PauseOutlined,null):l().createElement(Ce.CaretRightOutlined,null))},Pd=e=>{const{prefixCls:t,current:r,total:n=0,cover:a,title:i,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:m,onNext:p,onFinish:h,className:f,indicatorsRender:g}=e,{t:y}=G(),b="primary"!==c?"primary":"default",v=Y((e=>{w(e),40===e.keyCode&&(r<n-1?p?.():h?.()),38===e.keyCode&&r>0&&m?.()}));l().useEffect((()=>{const e=Mt()(document,"keyup",v);return()=>e.remove()}),[]);const x=gd(a)?l().createElement("div",{className:`${t}-cover`},a):null,E=gd(o)?l().createElement("div",{className:`${t}-description`},o):null;let C;C=g?g(r,n):[...Array.from({length:n}).keys()].map(((e,n)=>l().createElement("span",{key:e,className:xe()(n===r&&`${t}-indicator-active`,`${t}-indicator`)})));const w=e=>{e.stopPropagation(),e.preventDefault()};return l().createElement("div",{className:xe()(`${t}-content`,f)},l().createElement("div",{className:`${t}-inner`},l().createElement(Ce.CloseOutlined,{className:`${t}-close`,onClick:u}),s.content&&l().createElement(O.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},l().createElement(Ce.QuestionCircleOutlined,{className:xe()(`${t}-close`,"help-icon")})),x,l().createElement("div",{className:`${t}-header`},l().createElement("div",{className:`${t}-title`},i)),E,l().createElement("div",{className:`${t}-footer`},n>1&&l().createElement("div",{className:`${t}-indicators`},C),l().createElement(be,{className:`${t}-buttons`},0!==r?l().createElement(fe,{className:`${t}-prev-btn`,size:"small",onMouseDown:w,onClick:m},y("qm.tour.prevStep")):null,r===n-1?l().createElement(fe,{className:`${t}-finish-btn`,type:b,size:"small",onClick:h},y("qm.tour.finish")):l().createElement(fe,{className:`${t}-next-btn`,type:b,size:"small",onMouseDown:w,onClick:p},y("qm.tour.nextStep"))))))},kd=e=>{const{current:t,renderPanel:r}=e;return l().createElement(l().Fragment,null,"function"==typeof r?r(e,t):l().createElement(Pd,e))};function Ad(){return Ad=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ad.apply(null,arguments)}const Ld={left:"50%",top:"50%",width:1,height:1},Fd=l().forwardRef(((e,t)=>{const{steps:r=[],defaultCurrent:n,current:a,onChange:i,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:m=!0,control:p=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:y,zIndex:b,renderPanel:v,indicatorsRender:x,gap:E,animated:C=!0,scrollIntoViewOptions:w=!0,...S}=e,N=l().useRef(),[T,I]=Wo(0,{value:a,defaultValue:n}),[R,O]=Wo(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(e??!1)}),[P,k]=Wo(1051,{value:b,defaultValue:b}),[A,L]=l().useState(),F=l().useRef(R);l().useLayoutEffect((()=>{R&&!F.current&&I(0),F.current=R,L(R)}),[R]),l().useImperativeHandle(t,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>k(e)})));const{target:_,type:D,placement:H,trigger:$,delay:q,style:M,arrow:K,className:V,mask:j,scrollIntoViewOptions:z,zIndex:B,action:W}=r[T]||{},U=B||P,G=D||d,Y=R&&(j??u),X=z??w,[Q,Z]=yd(_,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,H),ee=!!Z&&(void 0===K?m:K),te="object"==typeof ee&&ee.pointAtCenter;l().useLayoutEffect((()=>{N.current?.forceAlign()}),[te,T]),De((()=>{R&&(ie(),W?.(Z,T))}),[R,Z]);const re=e=>{I(e),i?.(e)},ae=()=>{O(!1),o?.(T)},ie=()=>{if(!Z)return;const e=[];!function t(r){if(1===r.nodeType){var n;"INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName||"none"===Me(n=r,"display")||"hidden"===Me(n,"visibility")||"0"===Me(n,"opacity")||e.push(r);for(const e of Array.from(r.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const le=async()=>{if(!$||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[a,i]=[e+r/2,t+n/2],l=new MouseEvent($,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await ne(q??320))},oe="boolean"==typeof Y?Y:!!Y,se="boolean"==typeof Y?void 0:Y,ce=Object.assign({},f,M),de=Ee("tour"),ue=[{[`${de}-primary`]:"primary"===G},h,V],me=Ed({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(Rd,{zIndex:U,prefixCls:de,pos:Q,showMask:oe,style:se?.style,fill:se?.color,open:A,animated:C,rootClassName:h}),l().createElement(wd(),{open:A,autoLock:!0},l().createElement(Nd(),Ad({ref:N},S,{zIndex:U,builtinPlacements:me,popupStyle:ce,popupPlacement:J,popupVisible:A,popupClassName:xe()(ue),prefixCls:de,popup:()=>l().createElement(kd,Ad({key:"content",arrow:ee,prefixCls:de,total:r.length,helper:y,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await le(),re(T-1)},onNext:async()=>{await le(),re(T+1)},onClose:ae,current:T,onFinish:()=>{ae(),s?.()}},Object.assign({},r[T],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),l().createElement("div",{className:xe()(h,`${de}-target-placeholder`),style:{...Q||Ld,position:"fixed",pointerEvents:"none"}}))),p&&l().createElement(wd(),{open:R},l().createElement(Od,{zIndex:U,prefixCls:de,onPause:()=>L(!1),onPlay:()=>L(!0)})))}));Fd.displayName="QmTour";const _d=Fd,Dd=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Hd=e=>({_s:e,status:Dd[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),$d=e=>e?6:5,qd=(e,t,r,n,a)=>{clearTimeout(n.current);const i=Hd(e);t(i),r.current=i,a?.({current:i})},Md=e=>{const{name:t,in:r,timeout:n,preEnter:a=!0,preExit:o}=e,[s,c]=((e={})=>{const{enter:t=!0,exit:r=!0,preEnter:n,preExit:a,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,m]=(0,i.useState)((()=>Hd(o?2:$d(s)))),p=(0,i.useRef)(u),h=(0,i.useRef)(),[f,g]=(e=>(0,Q.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),y=(0,i.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return $d(t)}})(p.current._s,c);e&&qd(e,m,p,h,d)}),[d,c]),b=(0,i.useCallback)((e=>{const i=e=>{switch(qd(e,m,p,h,d),e){case 1:f>=0&&(h.current=setTimeout(y,f));break;case 4:g>=0&&(h.current=setTimeout(y,g));break;case 0:case 3:h.current=setTimeout((()=>i(e+1)),0)}},l=p.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&i(t?n?0:1:2):l&&i(r?a?3:4:$d(c))}),[y,d,t,r,n,a,f,g,c]);return(0,i.useEffect)((()=>()=>clearTimeout(h.current)),[]),[u,b,y]})({timeout:n,preEnter:a,preExit:o,initialEntered:r});return g((()=>{c()}),[r]),l().createElement(l().Fragment,null,l().Children.map(e.children,(e=>l().isValidElement(e)?Fc(e,{className:xe()(e.props.className,t,s.status)}):e)))},Kd={previewWidth:1100,defaultDistance:.45,logoHeight:60},Vd=(0,i.createContext)(void 0);var jd=null;function zd(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function Bd(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(zd()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void O.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:jd?r=jd:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),jd=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&zd(),r}catch(e){O.message.error("getLodop 出错:"+e)}}zd();const Wd=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},Ud=l().forwardRef(((e,t)=>{const{templateRender:r,directPrint:n}=e,{global:a}=l().useContext(o),{$$preview:i}=l().useContext(Vd),{state:s,isWindowsPrinter:c,pageSize:d}=i,u=l().useRef(null),m=l().useRef({}),p=l().useRef([]),h=l().useRef([]),f=l().useRef([]),[g,y]=l().useState(!0);l().useImperativeHandle(t,(()=>({createPreviewDom:P,createExportHtml:A,createPrintHtml:k,SHOW_PREVIEW:L,DIRECT_PRINT:F}))),De((()=>{O()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),l().useEffect((()=>{m.current.templateEl=u.current.querySelector(".origin-template").children[0],m.current.previewEl=u.current.querySelector(".workspace")}),[]);const b=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Kd.defaultDistance+10*Kd.defaultDistance:0;return("vertical"===e?d[0]:d[1])-t}),[s,c,d]),v=l().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*Kd.defaultDistance+10*Kd.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),x=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Wd(b-10*(e.left-Kd.defaultDistance)-10*(e.right-Kd.defaultDistance))}),[s,b]),E=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return Wd(v-10*(e.top-Kd.defaultDistance)-10*(e.bottom-Kd.defaultDistance))}),[s,v]),C=s.form.scale,w=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:Wd(10*e.left),right:Wd(10*e.right),top:Wd(10*e.top),bottom:Wd(10*e.bottom)}}),[s]),S=l().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:r,top:n,bottom:a}=w,i=x+t+r,l=Kd.previewWidth-i<=0?0:(Kd.previewWidth-i)/2,o=Math.abs((1-C)*i/2);let c=0;return C>1&&(c=o>l?-1*l:-1*o),C<1&&(c=i-2*o>Kd.previewWidth?0:l>0?o:(Kd.previewWidth-(i-2*o))/2),{width:`${x}px`,height:"stylus"===e?"auto":E+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${C})`,opacity:g?0:1}}),[s,g,w,C,E,x]),N=(p.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=a?.print?.leftLogo??"",t=a?.print?.rightLogo??"";return[`<tr style="height: ${Kd.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),T=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},I=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=T().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=m.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},R=()=>{const e=m.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}h.current=r,p.current=t},O=()=>{if(!p.current.length)return;const{form:{setting:e,printerType:t}}=s;if(n)return f.current.push([T(),N(),...p.current]);const r=e.fixedLogo?E-Kd.logoHeight:E;let a=[];if(f.current=[],"stylus"===t)f.current.push([T(),...e.fixedLogo?[N()]:[],...p.current]);else{let t=0;for(let n=0,i=h.current.length;n<i;n++){const l=p.current[n],o=h.current[n];e.fixedLogo||0!==n||(t+=Kd.logoHeight),t+=o,t<=r?a.push(l):(f.current.push([T(),...e.fixedLogo?[N()]:[],...a]),a=[],t=0,n-=1),n===i-1&&a.length&&f.current.push([T(),...e.fixedLogo?[N()]:[],...a])}}e.fixedLogo||f.current[0]?.splice(1,0,N());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');i.setState({currentPage:1,totalPage:f.current.length}),P()},P=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${m.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",m.current.previewEl.innerHTML=t,m.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${m.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},A=()=>{const e=[];for(let t=0;t<p.current.length;t++)e[t]=p.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+N()+T()+e.join("")+"</table>"},L=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();m.current.previewEl.innerHTML||(I(),await ne(0),R(),O(),y(!1))},F=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();I(),await ne(0),R(),O(),y(!1),i.doPrint(k()),await ne(0),i.doClose()},_=()=>{me("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=Ee("print-container"),H={[D]:!0,"no-visible":n};return l().createElement("div",{ref:u,className:xe()(H)},l().createElement(ut,{wrapperClassName:"spin",spinning:g,tip:"Loading..."},l().createElement("div",{className:"preview"},l().createElement("div",{className:"origin-template",style:{width:`${x}px`,marginLeft:`-${Math.floor(x/2)}px`}},r?.()),l().createElement("div",{className:"workspace",style:S}))))}));Ud.displayName="Container";const Gd=Ud;function Yd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Xd extends i.Component{constructor(...e){super(...e),Yd(this,"context",void 0),Yd(this,"formRef",l().createRef()),Yd(this,"createFormList",(()=>[{type:"DIVIDER",fieldName:"_1",label:p("qm.print.setPanel.printParameter")},{type:"SELECT",label:p("qm.print.setPanel.pagerType"),fieldName:"pageSize",options:{itemList:[{text:"A2",value:"420*594"},{text:"A3",value:"420*297"},{text:"A4",value:"210*297"},{text:"A5",value:"210*148"},{text:p("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:p("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:p("qm.print.setPanel.vertical"),value:"vertical"},{text:p("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:p("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:p("qm.print.setPanel.manualDoublePrint"),value:"manual"}]},disabled:!this.props.setting.doubleSide},options:{trueValue:1,falseValue:0},onChange:e=>{const{formList:t}=this.state;t.find((e=>"doubleSide"===e.fieldName)).label.disabled=!e,this.setState({formList:t})}},{type:"CHECKBOX",label:p("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:p("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Kd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Kd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Kd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:p("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Kd.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),Yd(this,"getInitialvalue",(()=>{const{setting:e}=this.props,{distance:t}=e;return Object.assign({},{disleft:t.left,disright:t.right,distop:t.top,disbottom:t.bottom,pageSize:e.pageSize,direction:e.direction,doubleSide:e.doubleSide,doubleSideType:e.doubleSideType,fixedLogo:e.fixedLogo})})),Yd(this,"getInitialExtra",(()=>({disleft:p("qm.print.setPanel.sizeUnit"),disright:p("qm.print.setPanel.sizeUnit"),distop:p("qm.print.setPanel.sizeUnit"),disbottom:p("qm.print.setPanel.sizeUnit")}))),Yd(this,"state",{formList:this.createFormList()}),Yd(this,"confirmHandle",(async()=>{const[e,t]=await this.formRef.current.GET_FORM_DATA();e||(this.props.onChange({distance:{left:t.disleft,right:t.disright,top:t.distop,bottom:t.disbottom},pageSize:t.pageSize,direction:t.direction,doubleSide:t.doubleSide,doubleSideType:t.doubleSideType,fixedLogo:t.fixedLogo}),this.cancelHandle())})),Yd(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return l().createElement(l().Fragment,null,l().createElement(Ml,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},l().createElement(fe,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),l().createElement(fe,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}Yd(Xd,"contextType",o);const Qd=Xd;function Zd(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Jd extends i.Component{constructor(...e){super(...e),Zd(this,"context",void 0),Zd(this,"provide",{$$preview:this}),Zd(this,"containRef",l().createRef()),Zd(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:Kd.defaultDistance,right:Kd.defaultDistance,top:Kd.defaultDistance,bottom:Kd.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Zd(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Zd(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Zd(this,"printClickHandle",(async()=>{if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e={...this.state.form,printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text};await Ds().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Zd(this,"doClose",(()=>{this.props.onClose?.()})),Zd(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Zd(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Zd(this,"createStyle",(()=>'\n <style type="text/css">\n table {\n width: 100%;\n border-spacing: 0;\n border-collapse: collapse;\n table-layout: fixed;\n }\n table tr td {\n padding: 2px;\n line-height: 1.2;\n word-wrap: break-word;\n }\n .fs12 {\n font-size: 12px;\n }\n .fs13 {\n font-size: 13px;\n }\n .fs14 {\n font-size: 14px;\n }\n .fw500 {\n font-weight: 500;\n }\n .fw700 {\n font-weight: 700;\n }\n .fl {\n float: left;\n }\n .fr {\n float: right;\n }\n .tc {\n text-align: center;\n }\n .tr {\n text-align: right;\n }\n .bor {\n border: 1px solid #000;\n }\n .bor-t {\n border-top: 1px solid #000;\n }\n .bor-b {\n border-bottom: 1px solid #000;\n }\n .bor-l {\n border-left: 1px solid #000;\n }\n .bor-r {\n border-right: 1px solid #000;\n }\n .no-bor {\n border: none !important;\n }\n </style>\n ')),Zd(this,"doPrint",(e=>{const t=Bd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Kd,{left:d,right:u,top:m,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():O.message.error(p("qm.print.printError"))},t.PRINT()})),Zd(this,"doExport",(e=>{const t=Bd();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():O.message.error(p("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===a.direction?1:2),t.SAVE_TO_FILE(`${c()().format("YYYYMMDDHHmmss")}.xlsx`)}))}get printerTypeItems(){return[{text:p("qm.print.laserPrinter"),value:"laser"},{text:p("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Bd(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){me("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await Ds().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,Q.isPlainObject)(e)&&await Ds().setItem(this.printerKey,e)),(0,Q.isPlainObject)(e)&&Object.keys(e).length&&(0,Q.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:t}=this.props,{visible:r,form:n,currentPage:a,totalPage:i,printPage:o}=this.state,s=Ee("print-preview"),c={visible:r,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?l().createElement(l().Fragment,null,l().createElement("div",{className:xe()(d)},l().createElement("div",{className:"outer"},l().createElement("div",{className:"header"},l().createElement("span",null,p("qm.print.printer"),":",l().createElement(O.Select,{value:n.printerName,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,p("qm.print.type"),":",l().createElement(O.Select,{value:n.printerType,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value},e.text))))),l().createElement("span",null,p("qm.print.copies"),":",l().createElement(O.InputNumber,{value:n.copies,min:1,precision:0,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{copies:e??1}})))},style:{width:"50px"}})),l().createElement("span",null,p("qm.print.printPage.0"),l().createElement(O.InputNumber,{value:o,min:1,max:i,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),p("qm.print.printPage.1")),l().createElement("span",null,l().createElement(O.Pagination,{size:"small",current:a,pageSize:1,total:i,onChange:this.pageChangeHandle})),l().createElement("span",null,l().createElement(fe,{type:"text",icon:l().createElement(Ce.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),l().createElement("span",null,l().createElement(fe,{type:"text",icon:l().createElement(Ce.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),l().createElement("span",null,l().createElement(fe,{icon:l().createElement(Ce.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),l().createElement("div",{className:"main"},l().createElement(Vd.Provider,{value:this.provide},l().createElement(Gd,{ref:this.containRef,templateRender:t,directPrint:!1}))),l().createElement("div",{className:"footer"},l().createElement("span",null,p("qm.print.scale"),":",l().createElement(O.Slider,{value:n.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{scale:e}})))}}),l().createElement("em",{className:"scale-text"},`${Math.floor(100*n.scale)}%`)),l().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),l().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:a,totalPage:i}))))),l().createElement(cr,c,l().createElement(Qd,{setting:n.setting,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):l().createElement(Vd.Provider,{value:this.provide},l().createElement(Gd,{ref:this.containRef,templateRender:t,directPrint:!0}))}}Zd(Jd,"contextType",o);const eu=Jd;function tu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ru extends i.Component{constructor(...e){super(...e),tu(this,"context",void 0),tu(this,"previewRef",l().createRef()),tu(this,"state",{visible:!1,loading:!1}),tu(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),tu(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${Kd.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:r,defaultConfig:n,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?l().createElement(cr,o,l().createElement(eu,s)):e?l().createElement(eu,s):null})),tu(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ne(0),this.setState({visible:!0}),await ne(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:t,icon:r,type:n,disabled:a,shape:i}=this.props,o={size:t||this.context.size||"",type:n,shape:i,icon:r,loading:e,disabled:a,click:this.clickHandle};return l().createElement(l().Fragment,null,this.props.children&&l().createElement(fe,o,this.props.children),this.createRender())}}tu(ru,"propTypes",{size:(e,t,r)=>{if(!un(e[t]||""))return ue("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:dn().elementType}),tu(ru,"defaultProps",{preview:!0,type:"primary",icon:l().createElement(Ce.PrinterOutlined,null)}),tu(ru,"contextType",o);const nu=ru;function au(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function iu(e){const t=au(e);return t?t.frameElement:null}function lu(e){const t=cu(e);return ou([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function ou(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function su(e,t){const r=iu(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=lu(a);if(n.push(e),a=iu(a),i)break;a&&au(a)===t&&(i=!0)}return ou(n)}return e.getBoundingClientRect()}function cu(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function du(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const uu=Object.assign;class mu{constructor(e,t){du(this,"node",void 0),du(this,"border",void 0),du(this,"padding",void 0),du(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=gu.border,this.padding.style.borderColor=gu.padding,this.content.style.backgroundColor=gu.background,uu(this.node.style,{borderColor:gu.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){fu(t,"margin",this.node),fu(t,"border",this.border),fu(t,"padding",this.padding),uu(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),uu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class pu{constructor(e,t){du(this,"tip",void 0),du(this,"nameSpan",void 0),du(this,"dimSpan",void 0),this.tip=e.createElement("div"),uu(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),uu(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),uu(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:r.width,height:r.height});uu(this.tip.style,n.style)}}class hu{constructor(){du(this,"window",void 0),du(this,"tipBoundsWindow",void 0),du(this,"container",void 0),du(this,"tip",void 0),du(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new pu(r,this.container),this.rects=[],r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new mu(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=su(e,this.window),a=cu(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=su(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function fu(e,t,r){uu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const gu={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let yu=null,bu=null;function vu(){null!=window.document&&(yu=null,null!==bu&&(bu.remove(),bu=null))}function xu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Eu{constructor(e){xu(this,"_isRunning",void 0),xu(this,"_selectIgnore",void 0),xu(this,"_lastHoveredNode",null),xu(this,"excludeSelectors",void 0),xu(this,"onSelect",void 0),xu(this,"iframesListeningTo",new Set),xu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),xu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),xu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),xu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>We(t,window.document.querySelector(e)))))return this._selectIgnore=!0,vu();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var r;r=[t],null,!1,null!=window.document?(null!==yu&&clearTimeout(yu),null!=r&&(null===bu&&(bu=new hu),bu.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),xu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),xu(this,"selectFiberForNode",(0,Q.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else r.getAttribute("name")?e+=`[name=${r.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.join(" > ")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){vu(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function Cu(e){return document.querySelector(e)}const wu=e=>{const{action:t,onConfirm:r,onCancel:n,onFinish:a}=e,{t:i}=G();return l().createElement(l().Fragment,null,l().createElement("div",{style:{height:100}},i("qm.table.config.emptyText")),l().createElement(be,{style:{width:"100%",justifyContent:"flex-end"}},l().createElement(fe,{size:"small",onClick:()=>n?.()},i("qm.guideTracker.closeButton")),l().createElement(fe,{size:"small",onClick:()=>r?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),l().createElement(fe,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},Su={left:"50%",top:"50%",width:1,height:1},Nu=l().forwardRef(((e,t)=>{const{open:r,current:n,defaultCurrent:a,steps:i=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:m,zIndex:p,helper:h={},selectFilter:f=(e=>e),onSelect:g,onChange:y,onClose:b,onFinish:v}=e,{t:x}=G(),E=l().useRef(),C=l().useRef(i.length),[w,S]=Wo(0,{value:n,defaultValue:a}),[N,T]=Wo(void 0,{value:r,postState:e=>e??!1}),[I,R]=Wo(1051,{value:p,defaultValue:p}),[P,k]=l().useState({}),[A,L]=l().useState(!1),[F,_]=l().useState(N),[D,H]=l().useState(!1),[$,q]=yd(P.node,!!r),[M,K]=l().useState(22),V=l().useRef(!1),j=l().useMemo((()=>w>=i.length?"add":"edit"),[w,i]),z=l().useMemo((()=>`${w+1} / ${i.length}`),[w,i]);l().useLayoutEffect((()=>{E.current=new Eu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),k({id:Qr(),node:e,path:t}),S(C.current),L(!0),W(),g?.(t,e)}})}),[]),l().useEffect((()=>(N?B():W(),N?setTimeout((()=>_(!0)),16):_(!1),()=>{W()})),[N]),l().useEffect((()=>{C.current=i.length}),[i]);const B=()=>{E.current.startHandle()},W=()=>{E.current.stopHandle()},U=e=>{e.stopPropagation(),e.preventDefault()};l().useImperativeHandle(t,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),GET_CURRENT_STEP:()=>({current:w,selector:P.path})})));const Y=Ee("guide-tracker"),X=[{[`${Y}-primary`]:!0}],Z=Ed({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(wd(),{open:N&&A,autoLock:!0},l().createElement(Nd(),{zIndex:I,builtinPlacements:Z,popupPlacement:o,popupVisible:N&&A,popupClassName:xe()(X,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{L(!1),B()};return l().createElement("div",{className:`${Y}-content`},l().createElement("div",{className:`${Y}-inner`},l().createElement(Ce.CloseOutlined,{className:`${Y}-close`,onClick:()=>{b?.(w),e()}}),l().createElement(O.Dropdown,{open:D,trigger:["click"],dropdownRender:()=>i.length?l().createElement("div",{className:"ant-dropdown-menu step-list"},l().createElement(oa.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),r=i.map((e=>e.id));if((0,Q.isEqual)(t,r))return;const n=t.findIndex((e=>e===P.id)),a=-1!==n?n:w;S(a),y?.(sn(e),a)}},i.map(((e,t)=>l().createElement("li",{key:t,className:xe()("item",{actived:e.id===P.id})},l().createElement(Ce.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),l().createElement("span",{className:"box"},l().createElement("span",{className:"title",title:e.title,onClick:()=>{t!==w&&(k({id:e.id,node:Cu(e.selector),path:e.selector}),S(t),K(22===M?M+1:M-1),y?.(i,t))}},e.title),l().createElement(O.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:I+1,onConfirm:()=>{const r=i.filter((t=>t.id!==e.id)),n=t===w;let a=t<=w?w-1:w;if(a=a<0?0:a,a=a>r.length?r.length:a,n&&r[a]){const{id:e,selector:t}=r[a];k({id:e,node:Cu(t),path:t})}S(a),y?.(r,a)}},l().createElement(Ce.CloseOutlined,{className:"close-icon"})))))))):l().createElement(l().Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:I},onOpenChange:e=>H(e)},l().createElement(Ce.MenuOutlined,{className:xe()(`${Y}-close`,"menu-icon"),style:{width:M}})),h.content&&l().createElement(O.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:I},content:h.content,title:h.title},l().createElement(Ce.QuestionCircleOutlined,{className:xe()(`${Y}-close`,"help-icon")})),l().createElement("div",{className:"panel-label"},l().createElement("span",{className:"title"},x("qm.guideTracker.label")),l().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),z)),m?m({id:P.id,selector:P.path,actionStatus:j,DO_CLOSE:e},w):l().createElement(wu,{action:j,onConfirm:()=>{y?.("add"===j?[...i,{id:P.id,selector:P.path,title:"Guide Title"}]:[...i],w),e()},onCancel:()=>{b?.(w),e()},onFinish:()=>{e(),b?.(w),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},l().createElement("div",{className:xe()(`${Y}-target-placeholder`),style:{...$||Su,position:"fixed",zIndex:I-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:U,onClick:U}))),s&&l().createElement(wd(),{open:F},l().createElement(Od,{zIndex:I,prefixCls:Y,onPause:()=>{V.current=A,L(!1),W()},onPlay:()=>{V.current?L(!0):B()}})))}));Nu.displayName="QmGuideTracker";const Tu=Nu,Iu=e=>{const{content:t,image:r,width:n,height:a,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:d=-22,zIndex:u=9,alpha:m=1,antiTamper:p=!0,grayscale:h,className:f,style:g}=e,y=l().useRef(null),b=l().useRef(new Map),v=o.fontSize??16,x=o.fontWeight??"normal",E=o.fontStyle??"normal",C=o.fontFamily??"sans-serif",w=o.color??"rgba(0, 0, 0, 0.15)",S=o.textAlign??"center",N=Array.isArray(t)?t:[t],T=s[0],I=s[1],R=T/2,O=I/2,P=c[0]??R,k=c[1]??O,A=l().useMemo((()=>{const e=P-R,t=k-O;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:u}}),[R,O,P,k,u]),L=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const i=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[l,o]=(e=>{let t=120,i=64;if(!r&&e.measureText){e.font=`${v}px ${C}`;const r=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),i=v*N.length+3*(N.length-1)}return[n??t,a??i]})(t),s=l*i,c=o*i,u=(T+l)*i,p=(I+o)*i,f=T/2*i,g=I/2*i,R=u/2,O=p/2,P=2*(T+l);e.width=2*u,e.height=2*p,t.globalAlpha=m,t.save(),t.translate(R,O),t.rotate(Math.PI/180*d),t.translate(-R,-O);const k=()=>{t.restore(),t.drawImage(e,0,0,u,p,u,p,u,p),h&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(y.current){const r=b.current.get(y.current);r&&(y.current.contains(r)&&y.current.removeChild(r),b.current.delete(y.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${r=e,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var r})).join(";"))({...A,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),y.current?.append(n),b.current.set(y.current,n)}})(e.toDataURL(),P)},L=()=>{const e=Number(v)*i;t.font=`${E} normal ${x} ${e}px/${o}px ${C}`,t.fillStyle=w,t.textAlign=S,t.textBaseline="top",t.translate(s/2,0),N.forEach(((r,n)=>{t.fillText(r??"",f,g+n*(e+3*i))})),k()};if(r){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),k()},e.onerror=()=>{L()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=r}else L()},F=e=>Array.from(b.current.values()).includes(e);l().useEffect((()=>{L()}),[t,r,n,a,o,s,c,d,u,m,p,h]),function(e,t,r={}){const n=window&&"MutationObserver"in window,a=i.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(l(),n&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,r)),()=>l())),[e])}(y,(e=>{if(p)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),r="attributes"===t.type&&F(t.target);if(e||r){L();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const _=Ee("watermark");return l().createElement("div",{ref:y,className:xe()(_,f),style:{position:"relative",...g}},e.children)},Ru=new Map,Ou=new WeakMap;let Pu=0;function ku(e,t,r={},n=undefined){if(void 0===window.IntersectionObserver&&void 0!==n){const a=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:l}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(Ou.has(r)||(Pu+=1,Ou.set(r,Pu.toString())),Ou.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=Ru.get(t);if(!r){const n=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},Ru.set(t,r)}return r}(r),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),i.unobserve(e)),0===l.size&&(i.disconnect(),Ru.delete(a))}}const Au=e=>{const{forceRender:t,height:r,placeholder:n=null,unmountIfInvisible:a,className:i,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:t,threshold:r,triggerOnce:n,fallbackInView:a,trackVisibility:i,skip:o,delay:s,onChange:c}={})=>{const[d,u]=l().useState(null),[m,p]=l().useState({inView:!1,entry:void 0}),h=l().useRef(c);l().useEffect((()=>{if(o||!d)return;let l;return l=ku(d,((e,t)=>{p({inView:e,entry:t}),h.current?.(e,t),t.isIntersecting&&n&&l&&(l(),l=void 0)}),{root:e,rootMargin:t,threshold:r,trackVisibility:i,delay:s},a),()=>{l&&l()}}),[Array.isArray(r)?r.toString():r,d,e,t,n,o,i,a,s]);const f=m.entry?.target,g=l().useRef();d||!f||n||o||g.current===f||(g.current=f,p({inView:!1,entry:void 0}));const y=[u,m.inView,m.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!a}));l().useEffect((()=>{r||me("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=Ee("lazy-load"),m={[u]:!0};return l().createElement("div",{ref:s,className:xe()(m,i),style:o},t||c?e.children:l().createElement("div",{className:"placeholder",style:{height:r}},n))},Lu=require("html2canvas");var Fu=n.n(Lu);function _u(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Du{constructor(e,t,r,n){if(_u(this,"x",void 0),_u(this,"y",void 0),_u(this,"pressure",void 0),_u(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=r||0,this.time=n||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class Hu{static fromPoints(e,t){const r=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Hu(e[1],r,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,r){const n=e.x-t.x,a=e.y-t.y,i=t.x-r.x,l=t.y-r.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+r.x)/2,d=(t.y+r.y)/2,u=Math.sqrt(n*n+a*a),m=Math.sqrt(i*i+l*l),p=m/(u+m),h=c+(o-c)*p,f=d+(s-d)*p,g=t.x-h,y=t.y-f;return{c1:new Du(o+g,s+y),c2:new Du(c+g,d+y)}}constructor(e,t,r,n,a,i){this.startPoint=e,this.control2=t,this.control1=r,this.endPoint=n,this.startWidth=a,this.endWidth=i}length(){let e,t,r=0;for(let n=0;n<=10;n+=1){const a=n/10,i=this.point(a,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(a,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(n>0){const n=i-e,a=l-t;r+=Math.sqrt(n*n+a*a)}e=i,t=l}return r}point(e,t,r,n,a){return t*(1-e)*(1-e)*(1-e)+3*r*(1-e)*(1-e)*e+3*n*(1-e)*e*e+a*e*e*e}}function $u(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class qu{constructor(e,t){$u(this,"canvas",void 0),$u(this,"ctx",void 0),$u(this,"textInput",void 0),$u(this,"width",320),$u(this,"height",200),$u(this,"ratio",Math.max(window.devicePixelRatio||1,1)),$u(this,"penColor","rgba(0,0,0,1)"),$u(this,"backgroundColor","rgba(0,0,0,0)"),$u(this,"canAddHistory",!1),$u(this,"mode",void 0),$u(this,"openSmooth",!0),$u(this,"dotSize",0),$u(this,"throttle",16),$u(this,"minDistance",5),$u(this,"velocityFilterWeight",.7),$u(this,"compositeOperation","source-over"),$u(this,"minWidth",.5),$u(this,"maxWidth",2.5),$u(this,"fontSize",16),$u(this,"eraserSize",20),$u(this,"lineHeight",1.25),$u(this,"degreeOfBlur",5),$u(this,"textInputPos",{x:0,y:0}),$u(this,"onStart",(()=>{})),$u(this,"onEnd",(()=>{})),$u(this,"_drawingStroke",!1),$u(this,"_lastPoints",[]),$u(this,"_data",[]),$u(this,"_historyList",[]),$u(this,"_lastVelocity",0),$u(this,"_lastWidth",0),$u(this,"_strokeMoveUpdate",void 0),$u(this,"setCanvasSize",(()=>{this.canvas.style.height=`${this.height}px`,this.canvas.style.width=`${this.width}px`,this.canvas.height=this.height*this.ratio,this.canvas.width=this.width*this.ratio,1!==this.ratio&&this.ctx.scale(this.ratio,this.ratio)})),$u(this,"setTextInput",(()=>{this.openSmooth||(this.textInput.setAttribute("class","signature__text-input"),this.textInput.setAttribute("contentEditable","true"),this.textInput.setAttribute("spellCheck","false"),this.canvas.parentNode.appendChild(this.textInput))})),$u(this,"isTouchEvent",(e=>"touches"in e)),$u(this,"addListener",(()=>{this.removeListener(),this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",("ontouchstart"in window||navigator.maxTouchPoints)&&(this.canvas.addEventListener("touchstart",this.onDrawStart,{passive:!1}),this.canvas.addEventListener("touchmove",this.onDrawMove,{passive:!1}),document.addEventListener("touchcancel",this.onDrawEnd,{passive:!1}),document.addEventListener("touchend",this.onDrawEnd,{passive:!1})),this.canvas.addEventListener("mousedown",this.onDrawStart),this.canvas.addEventListener("mousemove",this.onDrawMove),document.addEventListener("mouseup",this.onDrawEnd),this.textInput.addEventListener("blur",this.onInputBlur)})),$u(this,"removeListener",(()=>{this.canvas.style.touchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("touchstart",this.onDrawStart),this.canvas.removeEventListener("touchmove",this.onDrawMove),document.removeEventListener("touchend",this.onDrawEnd),document.removeEventListener("touchcancel",this.onDrawEnd),this.canvas.removeEventListener("mousedown",this.onDrawStart),this.canvas.removeEventListener("mousemove",this.onDrawMove),document.removeEventListener("mouseup",this.onDrawEnd),this.textInput.removeEventListener("blur",this.onInputBlur)})),$u(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),$u(this,"_pointerEventToSignatureEvent",(e=>({event:e,type:e.type,x:this.isTouchEvent(e)?e.touches[0]?.clientX:e.clientX,y:this.isTouchEvent(e)?e.touches[0]?.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}))),$u(this,"_getPointGroupOptions",(e=>({penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}))),$u(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),r={...t,points:[]};this._data.push(r),this._reset(t),this._strokeUpdate(e,!1)})),$u(this,"_strokeUpdate",((e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const r=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],a=n.points,i=a.length>0&&a[a.length-1],l=!!i&&r.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(n);if(!i||!i||!l){const e=this._addPoint(r,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(r,o)),a.push({time:r.time,x:r.x,y:r.y,pressure:r.pressure})}})),$u(this,"_strokeEnd",((e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)})),$u(this,"_reset",(e=>{this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this.ctx.fillStyle=e.penColor,this.ctx.globalCompositeOperation=e.compositeOperation})),$u(this,"_drawDot",((e,t)=>{const r=this.ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;r.beginPath(),this._drawCurveSegment(e.x,e.y,n),r.closePath(),r.fillStyle=t.penColor,r.fill()})),$u(this,"_drawCurve",((e,t)=>{const r=this.ctx,n=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());r.beginPath(),r.fillStyle=t.penColor;for(let r=0;r<a;r+=1){const i=r/a,l=i*i,o=l*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*l*e.control2.x,u+=o*e.endPoint.x;let m=d*e.startPoint.y;m+=3*c*i*e.control1.y,m+=3*s*l*e.control2.y,m+=o*e.endPoint.y;const p=Math.min(e.startWidth+o*n,t.maxWidth);this._drawCurveSegment(u,m,p)}r.closePath(),r.fill()})),$u(this,"_drawCurveSegment",((e,t,r)=>{const n=this.ctx;n.moveTo(e,t),n.arc(e,t,r,0,2*Math.PI,!1)})),$u(this,"_createPoint",((e,t,r)=>{const n=this.canvas.getBoundingClientRect();return new Du(e-n.left,t-n.top,r,(new Date).getTime())})),$u(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),$u(this,"_addPoint",((e,t)=>{const{_lastPoints:r}=this;if(r.push(e),r.length>2){3===r.length&&r.unshift(r[0]);const e=this._calculateCurveWidths(r[1],r[2],t),n=Hu.fromPoints(r,e);return r.shift(),n}return null})),$u(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),$u(this,"_calculateCurveWidths",((e,t,r)=>{const n=r.velocityFilterWeight*t.velocityFrom(e)+(1-r.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(n,r),i={end:a,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=a,i})),$u(this,"onDrawStart",(e=>{e.preventDefault(),this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&(this._strokeBegin(this._pointerEventToSignatureEvent(e)),this.ctx.strokeStyle=this.penColor,this.ctx.lineWidth=this.maxWidth,"line"===this.mode&&this.createPencil(e),"eraser"===this.mode&&this.createEraser(e),"text"===this.mode&&this.createTextInput(e),this.onStart?.(e))})),$u(this,"onDrawMove",(e=>{e.preventDefault(),"text"!==this.mode&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?window.requestAnimationFrame?window.requestAnimationFrame((()=>this.drawHandler(e))):this.drawHandler(e):this._strokeEnd(this._pointerEventToSignatureEvent(e)))})),$u(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),$u(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),$u(this,"drawHandler",(e=>{switch(this.mode){case"line":this.drawLine(e);break;case"square":this.drawSquare(e);break;case"round":this.drawRound(e);break;case"arrow":this.drawArrow(e);break;case"mosaic":this.drawMosaic(e);break;case"text":this.drawText(e);break;case"eraser":this.drawEraser(e)}this.canAddHistory=!0})),$u(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,r,n-t,a-r),this.ctx.stroke(),this.ctx.restore()})),$u(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(n,t),l=Math.min(a,r),o=.5*(Math.max(n,t)-i),s=.5*(Math.max(a,r)-l),c=i+o,d=l+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()})),$u(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0],{x:n,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(r-a,t-n)/Math.PI,l=(i+25)*Math.PI/180,o=(i-25)*Math.PI/180,s=15*Math.cos(l),c=15*Math.sin(l),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,r),this.ctx.lineTo(n,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(n,a);const m=n+s,p=a+c;this.ctx.lineTo(m,p);const h=n+d,f=a+u;this.ctx.lineTo(h,f),this.ctx.lineTo(n,a),this.ctx.fill(),this.ctx.restore()})),$u(this,"getAxisColor",((e,t,r)=>{const n=e.width,a=e.data,i=[];return i[0]=a[4*(r*n+t)],i[1]=a[4*(r*n+t)+1],i[2]=a[4*(r*n+t)+2],i[3]=a[4*(r*n+t)+3],i})),$u(this,"setAxisColor",((e,t,r,n)=>{const a=e.width,i=e.data;i[4*(r*a+t)]=n[0],i[4*(r*a+t)+1]=n[1],i[4*(r*a+t)+2]=n[2],i[4*(r*a+t)+3]=n[3]})),$u(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),n=this.ctx.getImageData(t*this.ratio,r*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=n.width,i=n.height,l=a/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const r=this.getAxisColor(n,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let a=0;a<this.degreeOfBlur;a++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(n,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,r)}this.ctx.putImageData(n,t*this.ratio,r*this.ratio)})),$u(this,"drawText",(e=>{const{x:t,y:r}=this.textInputPos;if(0===t&&0===r)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const n=this.fontSize*this.lineHeight,a=this.width-t,i=e.target.innerText,l=[];let o="";for(let e=0;e<i.length;e++){const t=o+i[e];this.ctx.measureText(t).width>a&&o.length>0?(l.push(o),o=i[e]):o=t}l.push(o),l.forEach(((e,a)=>{this.ctx.fillText(e,t+1,r+a*n+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),$u(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),$u(this,"drawPencil",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.restore()})),$u(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,r)})),$u(this,"drawEraser",(e=>{const{x:t,y:r}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,r),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),$u(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),$u(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:r}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=r?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),$u(this,"setInputStyle",(()=>{if(!this._lastPoints.length)return;const{x:e,y:t}=this._lastPoints[0];this.textInput.style.left=e+"px",this.textInput.style.lineHeight=this.lineHeight.toString(),this.textInput.style.fontSize=this.fontSize+"px",this.textInput.style.color=this.penColor,this.textInput.style.top=t-Math.floor((this.textInput.offsetHeight-2)/2)+"px",this.textInputPos={x:e,y:t}})),$u(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),$u(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),$u(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),$u(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),$u(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),$u(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),$u(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),$u(this,"setDrawMode",(e=>{this.mode=e})),$u(this,"setLineWidth",(e=>{this.maxWidth=e})),$u(this,"setPenColor",(e=>{this.penColor=e})),$u(this,"setFontSize",(e=>{this.fontSize=e})),$u(this,"isEmpty",(()=>{const e=document.createElement("canvas"),t=e.getContext("2d");return e.width=this.canvas.width,e.height=this.canvas.height,this.backgroundColor?(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)):1!==this.ratio&&t.scale(this.ratio,this.ratio),e.toDataURL()===this.canvas.toDataURL()})),$u(this,"toDataURL",((e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const r=document.createElement("canvas");return r.width=this.width,r.height=this.height,r.getContext("2d").drawImage(this.canvas,0,0,r.width,r.height),r.toDataURL(e,t)})),$u(this,"getPNG",(()=>this.toDataURL())),$u(this,"getJPG",((e=.8)=>this.toDataURL("image/jpeg",e))),this.initial(e,t)}initial(e,t={}){e&&(this.canvas=e,this.ctx=e.getContext("2d"),this.textInput=document.createElement("div"),this.width=t.width||e.clientWidth||this.width,this.height=t.height||e.clientHeight||this.height,this.penColor=t.penColor||this.penColor,this.fontSize=t.fontSize||this.fontSize,this.backgroundColor=t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this._strokeMoveUpdate=this.throttle?function(e,t=250){let r,n,a,i=0,l=null;const o=()=>{i=Date.now(),l=null,r=e.apply(n,a),l||(n=null,a=[])};return function(...s){const c=Date.now(),d=t-(c-i);return n=this,a=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),i=c,r=e.apply(n,a),l||(n=null,a=[])):l||(l=window.setTimeout(o,d)),r}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}$u(qu,"dataURLToBlob",(e=>{const t=e.split(";base64,"),r=t[0].split(":")[1],n=window.atob(t[1]),a=n.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=n.charCodeAt(e);return new Blob([i],{type:r})})),$u(qu,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),$u(qu,"canvasToBlob",(e=>new Promise(((t,r)=>{e.toBlob((e=>e?t(e):r(null)),"image/png",1)}))));const Mu=qu,Ku=()=>l().createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})),Vu=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M839.111111 269.198222V122.908444A9.159111 9.159111 0 0 0 829.980444 113.777778H208.213333A9.159111 9.159111 0 0 0 199.111111 122.908444v146.289778c0 5.034667 4.124444 9.159111 9.130667 9.159111h64a9.159111 9.159111 0 0 0 9.159111-9.159111V196.067556h192v640h-105.159111a9.159111 9.159111 0 0 0-9.130667 9.130666v64c0 5.034667 4.124444 9.159111 9.130667 9.159111h301.738666a9.159111 9.159111 0 0 0 9.130667-9.159111v-64a9.159111 9.159111 0 0 0-9.130667-9.130666h-105.159111v-640h192v73.130666c0 5.034667 4.124444 9.159111 9.159111 9.159111h64a9.159111 9.159111 0 0 0 9.130667-9.159111z"})),ju=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M887.65217391 606.59279489a31.26857185 31.26857185 0 0 1-31.26857185-31.26857087v-363.48819946L158.38608696 909.83354065a31.26857185 31.26857185 0 1 1-44.21962762-44.21962761l697.99751609-698.06906805h-363.48819945a31.26857185 31.26857185 0 0 1 0-62.46559075h439.04795087c17.17267109 0 31.26857185 13.95279489 31.26857086 31.19701891v439.04795087a31.26857185 31.26857185 0 0 1-31.3401238 31.26857087z"})),zu=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M606.4 103.424a64 64 0 0 1 0.704 0.64l320.256 280.32a64 64 0 0 1 7.104 89.024l-330.432 398.72 320.448 0.128a32 32 0 0 1 0 64.064H397.632a32.128 32.128 0 0 1-6.208-0.64h-20.736a64 64 0 0 1-42.304-16.064l-238.08-210.112A64 64 0 0 1 83.84 620.16l432.32-509.312a64 64 0 0 1 90.24-7.36zM242.048 537.536l-87.04 101.76a32 32 0 0 0 3.584 45.248l213.12 180.672a32 32 0 0 0 20.736 7.616l-0.64-0.064a32.192 32.192 0 0 1 5.76-0.512h102.016a32 32 0 0 0 18.176-10.496l40.96-47.232-316.672-276.992zM592.96 177.28a32 32 0 0 0-45.12 3.456L283.712 488.96l316.928 277.248 264.512-304.96a32 32 0 0 0 1.024-40.704l-3.904-4.16-268.928-238.72a32 32 0 0 0-0.384-0.32z"})),Bu=()=>l().createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},l().createElement("path",{d:"M607.75537778 291.05948444H223.6416l115.34336-115.41617778a36.37248 36.37248 0 1 0-51.48216889-51.44576L132.61937778 279.04455111c-13.54410667 13.50769778-21.04433778 31.67573333-21.11715556 50.97244444a71.72551111 71.72551111 0 0 0 21.11715556 51.51857778l154.88341333 154.91982222a36.29966222 36.29966222 0 0 0 51.48216889 0 36.37248 36.37248 0 0 0 0-51.48216889l-121.46005333-121.16878222H607.75537778c130.70791111 0 237.02186667 106.16832 237.02186667 236.65777777s-106.31395555 236.65777778-237.02186667 236.65777778h-254.13404445a36.40888889 36.40888889 0 0 0 0 72.81777779h254.13404445c170.83050667 0 309.83964445-138.82709333 309.83964444-309.47555557 0-170.64846222-139.00913778-309.47555555-309.83964444-309.47555555"})),Wu=l().forwardRef(((e,t)=>{const{open:r,width:n,height:a,imageName:i,penColor:o,penMode:s,minWidth:d,maxWidth:u,backgroundColor:m,className:p,style:h,onOk:f,onCancel:g}=e,{t:y}=G(),b=l().useRef(),v=l().useRef(null),x=l().useRef(null),E=l().useRef(null),C=[2,4,6],w=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=Wo(void 0,{value:r,postState:e=>e??!1}),I=l().useMemo((()=>!!e.children),[e.children]),[R,P]=l().useState(s||(I?"square":"line")),[k,A]=l().useState(C[0]),[L,F]=l().useState(I?S[0]:S[4]),[_,D]=l().useState(w[1]),[H,$]=l().useState("bottomLeft"),[q,M]=l().useState(!1),[K,V]=l().useState(!1);l().useEffect((()=>{const e={width:n??x.current?.offsetWidth,height:a??x.current?.offsetHeight,maxWidth:k,mode:R,penColor:L,fontSize:_,backgroundColor:m,openSmooth:!I};return e.openSmooth&&Object.assign(e,{penColor:o,minWidth:d,maxWidth:u}),b.current=new Mu(v.current,e),()=>b.current.destroy()}),[]);const j=e=>{const[t,r]=[n??x.current?.offsetWidth,a??x.current?.offsetHeight],{width:i,height:l}=b.current;let o=!1;t&&t!==i&&(b.current.width=t,o=!0),r&&r!==l&&(b.current.height=r,o=!0),(o||e)&&b.current.update()};De((()=>{I&&N&&j()}),[N,I]),De((()=>{b.current.setDrawMode(R)}),[R]),De((()=>{b.current.setLineWidth(k)}),[k]),De((()=>{b.current.setPenColor(L)}),[L]),De((()=>{b.current.setFontSize(_)}),[_]);const z=async()=>{const e=I?x.current.parentNode:v.current;if(e)try{const t=await Fu()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Mu.canvasToDataURL(t)}catch(e){me("Signature","生成合成图片失败!")}},B=()=>{b.current.clear(),g?.()};l().useImperativeHandle(t,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>b.current.clear(),UNDO:()=>b.current.undo(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:j,GET_DATE_URL:z})));const W=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},U=e=>l().createElement("div",{className:xe()("ant-dropdown-menu","content")},"text"!==e?l().createElement("div",{className:"lineWidth"},C.map((e=>l().createElement("span",{key:e,className:xe()("dot",`s${e}`,{active:e===k}),onClick:()=>A(e)})))):l().createElement("div",{className:"fontSize"},l().createElement(O.Select,{size:"small",value:_,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>D(e)})),l().createElement("span",{className:"divider"}),l().createElement("div",{className:"penColor"},S.map((e=>l().createElement("span",{key:e,className:xe()("dot",{active:e===L}),style:{backgroundColor:e},onClick:()=>F(e)},l().createElement(Ce.CheckOutlined,{className:"icon"})))))),Y=Ee("signature"),X={[Y]:!0,"is-annotation":I},Q=n?{...h,width:n}:h;return l().createElement("div",{className:xe()(X,p),style:Q},I&&l().createElement(l().Fragment,null,l().createElement("div",{ref:x,className:"content"},e.children),K&&l().createElement(ut,{spinning:!0,className:"spinning"})),l().createElement("div",{className:xe()("signature",{show:N})},l().createElement("canvas",{ref:v,className:R}),I&&l().createElement("div",{ref:E,className:"signature__tool-bar"},l().createElement("div",{className:"wrapper"},l().createElement("div",{className:xe()("actions",{hidden:q})},l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>P("square")},l().createElement(Ce.BorderOutlined,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>P("round")},l().createElement(Ku,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>P("arrow")},l().createElement(ju,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>P("line")},l().createElement(Ce.EditOutlined,null))),l().createElement(O.Dropdown,{dropdownRender:()=>U("text"),overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>P("text")},l().createElement(Vu,null))),l().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{V(!0);const e=await z();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):c()().format(Fo);Ot(Mu.dataURLToBlob(e),`${t}.png`)}V(!1)})(),B()}},l().createElement(Ce.DownloadOutlined,null)),l().createElement("button",{className:"btn",onClick:()=>P("eraser")},l().createElement(zu,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.undo()},l().createElement(Bu,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.clear()},l().createElement(Ce.ClearOutlined,null)),l().createElement("span",{className:"divider"}),l().createElement("button",{className:"btn",onClick:()=>g?.()},l().createElement(Ce.CloseOutlined,null)),l().createElement("button",{className:"btn",onClick:async()=>{V(!0),await ne(10);const e=await z();V(!1),B(),f?.(e)}},l().createElement(Ce.CheckOutlined,null))),l().createElement("button",{className:"btn btn-fold",title:y(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!q)},q?l().createElement(Ce.LeftOutlined,null):l().createElement(Ce.RightOutlined,null))))))}));Wu.displayName="QmSignature";const Uu=Wu,Gu=l().createContext(void 0),Yu=e=>{const{prefixCls:t,flatColumns:r}=e,{tableRef:n}=l().useContext(To),{tableFullData:a}=n.current,[i,o]=l().useState({prefixCls:t,viewMode:"table",size:"middle",columns:r,tableData:a,groupList:[],filterList:[],sorterList:[],expandedKeys:[]}),s=e=>{o((t=>{const r={...t};let n=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(r[i]=e[i],n=!0)})),n?r:t}))},c=e=>{s({columns:e})},d=e=>{s({tableData:e})},u=e=>{s({groupList:e})},m=e=>{s({filterList:e})},p=e=>{s({sorterList:e})},h=e=>{s({expandedKeys:e})},f=l().useMemo((()=>({...i,setContext:s,setColumns:c,setTableData:d,setGroupList:u,setFilterList:m,setSorterList:p,setExpandedKeys:h})),[i]);return l().createElement(Gu.Provider,{value:f},e.children)},Xu=()=>l().useContext(Gu),Qu=()=>{const{prefixCls:e,viewMode:t,setContext:r}=Xu(),{t:n}=G();return l().createElement("div",{className:`${e}-view-mode`},l().createElement(O.Segmented,{value:t,options:[{label:"表格视图",value:"table"},{label:"甘特视图",value:"gantt"},{label:"看板视图",value:"card"},{label:"图表视图",value:"chart"}],onChange:e=>{r({viewMode:e})}}))},Zu=()=>{const{tableRef:e}=l().useContext(To),{prefixCls:t,groupList:r,columns:n,tableData:a,setGroupList:i,setExpandedKeys:o,setContext:s}=Xu(),{tableFullData:c}=e.current,d=l().useRef([]),u=l().useMemo((()=>r.filter((e=>e.fieldName))),[r]),m=l().useMemo((()=>r.filter((e=>e.fieldName&&e.order)).map((e=>({[e.fieldName]:e.order})))),[r]),p=l().useMemo((()=>n.map((e=>({label:e.title,value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,n]),[h,f]=l().useState(!0);De((()=>{o(h?g(a):[])}),[h]);const g=e=>"object"!=typeof e||null===e?[]:Object.keys(e).reduce(((t,r)=>{if(t.push(r),Array.isArray(e[r]))return t;const n=g(e[r]);return t.concat(n)}),[]),y=[{label:"选项顺序",value:"ascend"},{label:"选项倒叙",value:"descend"}];De((()=>{if(!(0,Q.isEqual)(m,d.current)){d.current=m;const e=((e,t=[],r)=>{if(!Array.isArray(e)||0===t.length)return e;const n=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:a}]=t,i=Object.keys(t[0])[0],l=t.slice(1),o=Object.groupBy(e,(e=>r(e,i))),s=Object.keys(o).sort(((e,t)=>"ascend"===a?e.localeCompare(t):t.localeCompare(e))),c={};return s.forEach((e=>{c[`#${e}`]=n(o[e],l)})),c};return n(e,t)})(c,m,((e,t)=>{const{dictItems:r,precision:a}=n.find((e=>e.dataIndex===t))||{},i=jr(e,t);let l=r?.find((e=>e.value==i))?.text??i??"";return Array.isArray(i)&&(l=i.map((e=>r?.find((t=>t.value==e))?.text??e)).join(",")),a>=0&&""!==l&&(l=Wr(l)?new(va())(l).toFixed(a):l),l||"(内容为空)"}));s({tableData:e,expandedKeys:h?g(e):[]})}}),[m]);const b=()=>{i([...r,{fieldName:"",order:"ascend"}])},v=(e,t,n)=>{Object.assign(t,{[e]:n}),i([...r])};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,"设置分组条件"),l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>f(!h)},h?"折叠所有":"展开所有")),l().createElement("div",{className:"list"},l().createElement(oa.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));(0,Q.isEqual)(t,n)||i(e)}},r.map((e=>{return l().createElement("li",{key:e.fieldName,className:"item"},(t=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(O.Select,{value:t.fieldName||void 0,placeholder:"请选择...",options:p,style:{width:160,margin:"0 10px"},onChange:e=>v("fieldName",t,e)}),l().createElement(O.Select,{value:t.order,options:y,style:{width:100},onChange:e=>v("order",t,e)}),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(r.filter((t=>t!==e)))})(t)}))));var t})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:b},l().createElement(Ce.PlusOutlined,{className:"icon"}),"添加条件"))),className:xe()("action-btn",{active:!!u.length}),overlayClassName:`${t}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.CreditCardOutlined,{className:"icon"}),"分组",u.length?`(${u.length})`:null))},Ju=()=>{const{prefixCls:e,filterList:t,columns:r,setFilterList:n}=Xu(),{t:a}=G(),i=l().useMemo((()=>t.filter((e=>e.fieldName))),[t]),o=l().useMemo((()=>r.filter((e=>!!e.filter)).map((e=>({label:e.title,value:e.dataIndex})))),[r]),[s,c]=l().useState("and");De((()=>{n(t.map((e=>({...e,logic:s}))))}),[s]);const d=[{label:"满足所有条件",value:"and"},{label:"满足任一条件",value:"or"}],u=e=>{let t=[];if(!e)return[];switch(e){case"date":case"number":t=[{value:">",label:a("qm.table.highSearch.gtText")},{value:"<",label:a("qm.table.highSearch.ltText")},{value:">=",label:a("qm.table.highSearch.gteText")},{value:"<=",label:a("qm.table.highSearch.lteText")},{value:"==",label:a("qm.table.highSearch.eqText")},{value:"!=",label:a("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:a("qm.table.highSearch.inText")},{value:"nin",label:a("qm.table.highSearch.ninText")},{value:"==",label:a("qm.table.highSearch.eqText")},{value:"!=",label:a("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:a("qm.table.highSearch.likeText")},{value:"==",label:a("qm.table.highSearch.eqText")},{value:"!=",label:a("qm.table.highSearch.neqText")}]}return t},m=()=>{n([...t,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:s}])},p=(e,a,i)=>{Object.assign(a,{[e]:i}),"fieldName"===e&&Object.assign(a,{type:r.find((e=>e.dataIndex===i)).filter.type,expression:"",value:""}),n([...t])},h=e=>{switch(e.type){case"number":return l().createElement(O.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{p("condition",e,t)}});case"date":return l().createElement(_,{popupClassName:"table-editable__popper",defaultValue:Yr(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{p("condition",e,Xr(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":return l().createElement(O.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value,style:{width:150},onChange:t=>{p("condition",e,t)}});default:return l().createElement(O.Input,{defaultValue:e.value,style:{width:150},onChange:t=>{p("condition",e,t)}})}};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,"设置筛选条件"),!!i.length&&l().createElement(O.Select,{value:s,options:d,style:{width:150},onChange:e=>c(e)})),l().createElement("div",{className:"list"},t.map((e=>{return l().createElement("li",{key:e.fieldName,className:"item"},(r=e,l().createElement(l().Fragment,null,l().createElement(O.Select,{value:r.fieldName,options:o,style:{width:160},onChange:e=>p("fieldName",r,e)}),l().createElement(O.Select,{value:r.expression,options:u(r.type),style:{width:100,margin:"0 10px"},onChange:e=>p("expression",r,e)}),h(r),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{n(t.filter((t=>t!==e)))})(r)}))));var r}))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:m},l().createElement(Ce.PlusOutlined,{className:"icon"}),"添加条件"))),className:xe()("action-btn",{active:!!i.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.FilterOutlined,{className:"icon"}),"筛选",i.length?`(${i.length})`:null))},em=()=>{const{prefixCls:e,sorterList:t,columns:r,setSorterList:n}=Xu(),a=l().useMemo((()=>t.filter((e=>e.fieldName))),[t]),i=l().useMemo((()=>r.map((e=>({label:e.title,value:e.dataIndex,disabled:t.some((t=>t.fieldName===e.dataIndex))})))),[t,r]),o=[{label:"字段升序",value:"ascend"},{label:"字段降叙",value:"descend"}],s=()=>{n([...t,{fieldName:"",order:"ascend"}])},c=(e,r,a)=>{Object.assign(r,{[e]:a}),n([...t])};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,"设置排序条件")),l().createElement("div",{className:"list"},l().createElement(oa.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:t,setList:e=>{const r=e.map((e=>e.fieldName)),a=t.map((e=>e.fieldName));(0,Q.isEqual)(r,a)||n(e)}},t.map((e=>{return l().createElement("li",{key:e.fieldName,className:"item"},(r=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(O.Select,{value:r.fieldName||void 0,placeholder:"请选择...",options:i,style:{width:160,margin:"0 10px"},onChange:e=>c("fieldName",r,e)}),l().createElement(O.Select,{value:r.order,options:o,style:{width:100},onChange:e=>c("order",r,e)}),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{n(t.filter((t=>t!==e)))})(r)}))));var r})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:s},l().createElement(Ce.PlusOutlined,{className:"icon"}),"添加条件"))),className:xe()("action-btn",{active:!!a.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.SortAscendingOutlined,{className:"icon"}),"排序",a.length?`(${a.length})`:null))},tm=()=>{const{prefixCls:e}=Xu(),[t,r]=l().useState(!1),n=e=>{};return l().createElement(O.Dropdown,{open:t,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,"设置查找条件"),l().createElement("button",{className:"button-icon",onClick:()=>r(!1)},l().createElement(Ce.CloseOutlined,null))),l().createElement("div",{className:"list search",style:{margin:"10px 0"}},l().createElement(O.Input,{autoFocus:!0,style:{width:280},suffix:l().createElement("div",{className:"search-switch"},l().createElement("button",{className:"button-icon"},l().createElement(Ce.LeftOutlined,null)),l().createElement("span",{className:"num"},"1 / 8"),l().createElement("button",{className:"button-icon"},l().createElement(Ce.RightOutlined,null))),onChange:n}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},l().createElement("span",{onClick:()=>r(!t)},l().createElement(Ce.MonitorOutlined,{className:"icon"}),"查找"))},rm=()=>{const{prefixCls:e}=Xu();return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,"字段自定义设置")),l().createElement("div",{className:"list"})),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.SettingOutlined,{className:"icon"}),"字段管理"))},nm=()=>{const{prefixCls:e,size:t,setContext:r}=Xu(),n=[{label:"常规",value:"small"},{label:"中等",value:"middle"},{label:"高",value:"large"}];return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},n.map((e=>l().createElement("li",{key:e.value,className:xe()("ant-dropdown-menu-item check-item",{active:t===e.value}),onClick:()=>r({size:e.value})},l().createElement("span",{className:"label"},e.label),l().createElement("i",{className:"icon"},l().createElement(Ce.CheckOutlined,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},l().createElement("span",null,l().createElement(Ce.ColumnHeightOutlined,{className:"icon"}),"行高"))},am=()=>l().createElement("div",{className:"top-bar"},l().createElement(be,{size:4},l().createElement(Qu,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(rm,null),l().createElement(Zu,null),l().createElement(Ju,null),l().createElement(em,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(nm,null),l().createElement(tm,null))),im=l().createContext(void 0),lm=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(lm)):0,om=e=>{const{scrollbar:t}=e,{tableData:r}=Xu(),[n,a]=l().useState({scrollbarRef:t,selectionKeys:[],countMethod:{}}),i=l().useMemo((()=>{const e=lm(r);return Math.max(0,e-1)}),[r]),o=e=>{a((t=>{const r={...t};let n=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(r[i]=e[i],n=!0)})),n?r:t}))},s=e=>{o({selectionKeys:e})},c=e=>{o({countMethod:Object.assign({},e)})},d=l().useMemo((()=>({...n,indentDepth:i,setContext:o,setSelectionKeys:s,setCountMethod:c})),[n,i]);return l().createElement(im.Provider,{value:d},e.children)},sm=()=>l().useContext(im),cm={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80},indentWidth:12},dm=e=>{const{column:t}=e,{columns:r,setColumns:n}=Xu(),{scrollbarRef:a}=sm(),i=l().useRef(null),[o,s]=l().useState(!1),c=l().useRef(document.onselectstart),d=l().useRef({startX:0,originSizeX:0,columnWidth:0}),u=e=>{d.current=Object.assign({},d.current,e)},m=e=>{if(1!==e.buttons)return p();const r=e.clientX-d.current.startX,n=(t.width||t.renderWidth)+r;n<(t.minWidth||zo.defaultColumnWidth)||(u({columnWidth:n}),i.current.style.left=`${d.current.originSizeX+r}px`)},p=()=>{t.width=d.current.columnWidth,n([...r]),document.body.style.cursor="",ae((()=>s(!1))),$e(document,"mousemove",m),$e(document,"mouseup",p),u({startX:0,originSizeX:0,columnWidth:0}),h()},h=()=>{document.onselectstart!==c.current&&(document.onselectstart=c.current)};return l().createElement(l().Fragment,null,l().createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault();const r=Mr(e.target,a.current.container).left-a.current.scrollLeft+3;u({startX:e.clientX,originSizeX:r,columnWidth:t.width||t.renderWidth||0}),He(document,"mousemove",m),He(document,"mouseup",p),s(!0),document.body.style.cursor="col-resize",ae((()=>i.current.style.left=`${r}px`)),c.current=document.onselectstart,document.onselectstart=()=>!1}}),l().createElement(wd(),{open:o,getContainer:a.current?.container},l().createElement("div",{ref:i,className:"resize-line"})))},um=()=>{const{tableRef:e}=l().useContext(To),{columns:t}=Xu(),{indentDepth:r,selectionKeys:n,setSelectionKeys:a}=sm(),{allRowKeys:i}=e.current,{selectionColumn:o}=zo,s=l().useMemo((()=>[cm.selectionColumnDefine,...t]),[t]),c=l().useMemo((()=>n.length===i.length),[n]),d=l().useMemo((()=>n.length>0&&n.length<i.length),[n]);return l().createElement("div",{className:"header"},l().createElement("table",{className:"table",cellSpacing:"0",cellPadding:"0"},l().createElement("colgroup",null,s.map(((e,t)=>{const{dataIndex:n,width:a,renderWidth:i,align:o}=e,c=(a||i)+(1===t||t===s.length-1?r*(cm.indentWidth+1):0);return l().createElement("col",{key:n,style:{width:`${c}px`,minWidth:`${c}px`}})}))),l().createElement("thead",null,l().createElement("tr",null,s.map((e=>{const{dataIndex:t,title:r,align:n}=e,s={"selection-column":t===o,"col--center":"center"===n,"col--right":"right"===n};return l().createElement("th",{key:t,className:xe()("table-cell",s)},t!==o?l().createElement("span",{className:"cell"},r):l().createElement(O.Checkbox,{checked:c,indeterminate:d,onChange:e=>{return t=e.target.checked,void a(t?i:[]);var t}}),t!==o&&l().createElement(dm,{column:e}))}))))))},mm=e=>{const{records:t}=e,{getRowKey:r}=l().useContext(To),{columns:n}=Xu(),{selectionKeys:a,setSelectionKeys:i}=sm(),{renderText:o,getTitleFromCellNode:s}=os(),{selectionColumn:c}=zo,d=l().useMemo((()=>[cm.selectionColumnDefine,...n]),[n]);return l().createElement("div",{className:"grid-list"},t.map(((e,t)=>{const n=r(e,e.index),u={"row--selection":a.includes(n)};return l().createElement("li",{key:n,"data-row-key":n,className:xe()("table-row",u)},d.map(((r,d)=>((e,t,r,n,d)=>{const{dataIndex:u,width:m,renderWidth:p,align:h,render:f}=e,g=jr(r,u),y=f?f(g,r,e,n,t):o(g,e,r),b=s(y),v=a.includes(d),x={"selection-column":u===c,"col--center":"center"===h,"col--right":"right"===h};return l().createElement("div",{key:u,"data-col-index":t,title:b,className:xe()("table-cell",x),style:{width:`${m||p}px`,minWidth:`${m||p}px`}},u!==c?l().createElement("span",{className:"cell"},y):l().createElement(l().Fragment,null,l().createElement("span",{className:"order"},n+1),l().createElement(O.Checkbox,{className:"checkbox",checked:v,onChange:e=>{return t=e.target.checked,r=d,void i(t?[...a,r]:a.filter((e=>e!==r)));var t,r}})))})(r,d,e,t,n))))})))},pm=e=>{const{labelKey:t,depth:r,className:n,style:a}=e,{columns:i,expandedKeys:o,setExpandedKeys:s}=Xu(),{indentDepth:c}=sm(),{selectionColumn:d}=zo,u=l().useMemo((()=>[cm.selectionColumnDefine,...i]),[i]),m=l().useMemo((()=>o.includes(t)),[o,t]),p={inner:r>0};return l().createElement("div",{className:xe()("group-card",p,n),style:a},l().createElement("li",{className:"label-row"},u.map(((e,n)=>((e,n)=>{const{dataIndex:a,width:i,renderWidth:u,render:p}=e,h=(i||u)+(1===n?(c-r)*(cm.indentWidth+1):0),f={"expandable-column":a===d};return l().createElement("div",{key:a,className:xe()("label-cell",f),style:{width:`${h}px`,minWidth:`${h}px`}},a!==d?1===n?t.slice(1):null:l().createElement("button",{className:xe()("button-icon",{expand:m}),onClick:()=>{return e=t,void s(m?o.filter((t=>t!==e)):[...o,e]);var e}},l().createElement(Ce.RightOutlined,null)))})(e,n)))),l().createElement("div",{style:{display:m?"block":"none"}},e.children))},hm=()=>{const{tableData:e}=Xu(),t=(e,r=0)=>{const n=(0,Q.isPlainObject)(e)&&!Array.isArray(e);return l().createElement(l().Fragment,null,n?Object.keys(e).map((n=>l().createElement(pm,{key:n,labelKey:n,depth:r},Array.isArray(e[n])?l().createElement(mm,{records:e[n]}):t(e[n],r+1)))):l().createElement(mm,{records:e}))};return l().createElement("div",{className:"body"},t(e))},fm=e=>{const{column:t}=e,{prefixCls:r}=Xu(),{countMethod:n,setCountMethod:a}=sm(),{dataIndex:i}=t,o=l().useMemo((()=>[{text:"记录数",value:"total"},{text:"平均值",value:"avg"}]),[]);return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:xe()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},o.map((e=>{const t=e.value===n[i];return l().createElement("li",{key:e.value,className:xe()("ant-dropdown-menu-item check-item",{active:t}),onClick:()=>{a({[i]:t?void 0:e.value})}},l().createElement("span",{className:"label"},e.text),l().createElement("i",{className:"icon"},l().createElement(Ce.CheckOutlined,null)))})))),className:xe()("count-select",{show:!!n[i]}),overlayClassName:`${r}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140}},l().createElement("span",null,"行高 ",l().createElement(Ce.DownOutlined,{className:"icon"})))},gm=()=>{const{columns:e}=Xu(),{indentDepth:t}=sm(),{selectionColumn:r}=zo,n=l().useMemo((()=>[cm.selectionColumnDefine,...e]),[e]);return l().createElement("div",{className:"footer"},l().createElement("table",{className:"table",cellSpacing:"0",cellPadding:"0"},l().createElement("colgroup",null,n.map(((e,r)=>{const{dataIndex:a,width:i,renderWidth:o}=e,s=(i||o)+(1===r||r===n.length-1?t*(cm.indentWidth+1):0);return l().createElement("col",{key:a,style:{width:`${s}px`,minWidth:`${s}px`}})}))),l().createElement("tfoot",null,l().createElement("tr",null,n.map((e=>{const{dataIndex:t}=e,n={"selection-column":t===r,"col--right":!0};return l().createElement("td",{key:t,className:xe()("table-cell",n)},t!==r?l().createElement(fm,{column:e}):null)}))))))},ym=()=>{const{prefixCls:e,size:t}=Xu(),r=l().useRef(null);return l().createElement(om,{scrollbar:r},l().createElement(Tt,{ref:r,className:xe()(`${e}__layout`,t)},l().createElement(um,null),l().createElement(hm,null),l().createElement(gm,null)))},bm=()=>{const{flattenColumns:e}=l().useContext(To),t=l().useMemo((()=>se(e.filter((e=>![zo.expandableColumn,zo.selectionColumn,"index","pageIndex",zo.operationColumn].includes(e.dataIndex))))),[]),r=Ee("pivot-grid");return l().createElement("div",{className:`${r}__main`},l().createElement(Yu,{prefixCls:r,flatColumns:t},l().createElement(am,null),l().createElement("div",{className:"wrapper"},l().createElement(ym,null))))};bm.displayName="PivotGrid";const vm=bm,xm="1.11.0";return a})()));