dcp-design-react 1.11.12 → 1.11.14

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.
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}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};r.r(a),r.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:()=>A,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:()=>Xt,DcpButton:()=>ge,DcpCollapse:()=>De,DcpColorPicker:()=>op,DcpConfigProvider:()=>U,DcpCopyToClipboard:()=>Xc,DcpCountup:()=>st,DcpCropper:()=>mo,DcpDivider:()=>Ne,DcpDownload:()=>Mt,DcpDrawer:()=>an,DcpEmpty:()=>ut,DcpForm:()=>zl,DcpGuideTracker:()=>$u,DcpLazyLoad:()=>Bu,DcpModal:()=>mn,DcpPivotGrid:()=>Jm,DcpPrint:()=>gu,DcpRangeTableHelper:()=>Rd,DcpScrollbar:()=>Rt,DcpSearchHelper:()=>fd,DcpSearchTree:()=>To,DcpSignature:()=>lm,DcpSpace:()=>ve,DcpSpin:()=>pt,DcpSplit:()=>rt,DcpTable:()=>md,DcpTabs:()=>tn,DcpTinymce:()=>oo,DcpTour:()=>Gd,DcpTransition:()=>Jd,DcpTreeHelper:()=>Cd,DcpTreeTableHelper:()=>Ed,DcpUploadFile:()=>po,DcpUploadImg:()=>yo,DcpVirtualList:()=>rp,DcpWatermark:()=>Mu,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:()=>Xt,QmButton:()=>ge,QmCollapse:()=>De,QmColorPicker:()=>op,QmConfigProvider:()=>U,QmCopyToClipboard:()=>Xc,QmCountup:()=>st,QmCropper:()=>mo,QmDivider:()=>Ne,QmDownload:()=>Mt,QmDrawer:()=>an,QmEmpty:()=>ut,QmForm:()=>zl,QmGuideTracker:()=>$u,QmLazyLoad:()=>Bu,QmModal:()=>mn,QmPivotGrid:()=>Jm,QmPrint:()=>gu,QmRangeTableHelper:()=>Rd,QmScrollbar:()=>Rt,QmSearchHelper:()=>fd,QmSearchTree:()=>To,QmSignature:()=>lm,QmSpace:()=>ve,QmSpin:()=>pt,QmSplit:()=>rt,QmTable:()=>md,QmTabs:()=>tn,QmTinymce:()=>oo,QmTour:()=>Gd,QmTransition:()=>Jd,QmTreeHelper:()=>Cd,QmTreeTableHelper:()=>Ed,QmUploadFile:()=>po,QmUploadImg:()=>yo,QmVirtualList:()=>rp,QmWatermark:()=>Mu,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:()=>$,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:()=>Xr,version:()=>sp});var i=r(442),l=r.n(i);const o=(0,i.createContext)({locale:"zh-cn",size:"middle"}),s=require("dayjs");var c=r.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:"模糊匹配",nullText:"空值",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:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}}}};require("dayjs/locale/zh-cn");let u=d;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const p=(...e)=>{const[t,n]=e;let r;const a=t.split(".");let i=u;for(let e=0,t=a.length;e<t;e++){if(r=i[a[e]],e===t-1)return m(r,n);if(!r)return"";i=r}return""},h=(e,t)=>({...e,...Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})}),f=(e,t)=>{const n=i.useRef(!0);i.useLayoutEffect((()=>e(n.current)),t),i.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function g(e,t){f((t=>{if(!t)return e()}),t)}const y=require("dayjs/plugin/localeData");var b=r.n(y);const v=require("dayjs/plugin/advancedFormat");var x=r.n(v);const E=require("dayjs/plugin/customParseFormat");var w=r.n(E);const C=require("dayjs/plugin/quarterOfYear");var S=r.n(C);const N=require("dayjs/plugin/weekOfYear");var I=r.n(N);const T=require("dayjs/plugin/weekday");var R=r.n(T);c().extend(b()),c().extend(x()),c().extend(w()),c().extend(S()),c().extend(I()),c().extend(R());const O=require("antd"),k=require("rc-picker/es/generate/dayjs");var P=r.n(k);const L=require("antd/es/calendar/generateCalendar"),A=r.n(L)()(P()),F=require("antd/es/date-picker/generatePicker"),_=r.n(F)()(P());function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}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 q=i.forwardRef(((e,t)=>i.createElement(_.RangePicker,D({},e,{picker:"time",mode:void 0,ref:t}))));q.displayName="RangePicker",H.RangePicker=q;const $=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",nullText:"null value",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"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}}}},K=require("antd/es/locale/zh_CN");var z=r.n(K);const j=require("antd/es/locale/en_GB");var V=r.n(j);const B={[M.name]:{qm:M,antd:V()},[d.name]:{qm:d,antd:z()}},W=e=>{const t=h({locale:"zh-cn",size:"middle"},e),{locale:n,size:r,global:a}=t;l().useMemo((()=>{return e=Object.assign({},B,a?.langPackage)[n].qm,u=e||u,void(u.name&&c().locale(u.name));var e}),[n]);const i=l().useMemo((()=>Object.assign({},B,a?.langPackage)),[a]),[s,d]=l().useState({locale:n,size:r,global:a});return g((()=>{d((e=>Object.assign({},e,{locale:n,size:r})))}),[r,n]),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=()=>{},ne=()=>!0,re=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)=>t.split(".").reduce(((e,t)=>e?.[t]),e),se=(e,t)=>{const n={...e};for(const e of t)delete n[e];return n},ce=(e,t=new WeakMap)=>{if((0,Q.isPlainObject)(e)||(0,Q.isArray)(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const a=n?void 0:Object.keys(e);return function(n,i){let l=-1;const o=n.length;for(;++l<o;)s=n[l],c=l,a&&(c=s),r[c]=ce(e[c],t);var s,c}(a||e),r}return e},de=e=>(0,Q.isNumber)(e)?`${e}px`:e.toString();class ue extends Error{constructor(e){super(e),this.name="QmDesignError"}}function me(e,t){throw new ue(`[${e}] ${t}`)}function pe(e,t){console.warn(new ue(`[${e}] ${t}`))}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(null,arguments)}const fe=e=>{const{loading:t,shortcutKey:n,authConfig:r,click:a,confirm:i}=e,{t:o}=G(),{$size:s}=X(e);l().useEffect((()=>(n&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=l().useState(!1),u=Y((e=>{const t=n.split("+").map((e=>e.trim().toLowerCase())),r=t.includes("alt"),a=t.includes("ctrl"),i=t.includes("shift"),l=t[t.length-1];r&&!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){pe("Button","`click`方法执行出错")}d(!1)}}:null,p={...se(e,["shortcutKey","authConfig","click","confirm"]),size:s,loading:c||t||!1,...m};if(r){const{visible:e=1,disabled:t}=r||{};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,he({},p,{onClick:te}),e.children)):!n||p.disabled?h:l().createElement(O.Tooltip,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${n}`},h)};fe.displayName="QmButton";const ge=fe;var ye=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ye||{});const be=e=>{const{$size:t}=X(e),n=(0,Q.isNumber)(e.size)?e.size:ye[t||"default"],r={...se(e,["size"]),size:n};return l().createElement(O.Space,r,e.children)};be.displayName="QmSpace";const ve=be,xe=require("classnames");var Ee=r.n(xe);const we=e=>`qm-${e}`,Ce=require("@ant-design/icons"),Se=e=>{const{label:t,extra:n,collapse:r,bordered:a=!0,disabled:i,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=X(e),{t:m}=G(),p=we("divider"),h={[p]:!0,[`${p}-borderless`]:!a,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return l().createElement("div",{id:o,className:Ee()(h,s),style:c},l().createElement("span",{className:`${p}__title`},t),l().createElement("div",{className:`${p}__extra`},n),void 0!==r&&l().createElement(O.Button,{type:"link",className:`${p}__collapse`,disabled:i,onClick:()=>{d?.(!r)}},m(r?"qm.divider.collect":"qm.divider.spread"),r?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)))};Se.displayName="QmDivider";const Ne=Se,Ie=()=>({height:0,opacity:0}),Te=e=>({height:e.scrollHeight,opacity:1}),Re=e=>({height:e?e.offsetHeight:0}),Oe=(e,t)=>!0===t?.deadline||"height"===t.propertyName,ke=require("rc-motion");var Pe=r.n(ke);const Le=l().forwardRef(((e,t)=>{const{forceRender:n,className:r,style:a,boxStyle:i,isActive:o}=e,[s,c]=l().useState(o||n);if(l().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const d=we("collapse");return l().createElement("div",{ref:t,className:Ee()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},r),style:a},l().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));Le.displayName="PanelContent";const Ae=Le;function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fe.apply(null,arguments)}const _e=e=>{const{defaultActive:t,label:n,extra:r,className:a,style:i,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=l().useState(!!t),f=we("collapse"),g=Ee()({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},a);return l().createElement("div",{className:g,style:i},l().createElement(Ne,{label:n,extra:r,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),m?.(e)}}),l().createElement(Pe(),Fe({visible:p},((e=we("motion-collapse"))=>({motionName:e,onAppearStart:Ie,onEnterStart:Ie,onAppearActive:Te,onEnterActive:Te,onLeaveStart:Re,onLeaveActive:Ie,onAppearEnd:Oe,onEnterEnd:Oe,onLeaveEnd:Oe,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:t,style:n},r)=>l().createElement(Ae,{ref:r,prefixCls:f,className:t,style:n,boxStyle:o,isActive:p,forceRender:d},e.children))))};_e.displayName="QmCollapse";const De=_e,He=l().createContext(void 0);function qe(e,t){((t,n)=>{const r=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(r.current)),n),i.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})(0,t)}const $e=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},Me=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Ke=e=>e.preventDefault(),ze=(e,t)=>{if(Z||!e||!t)return null;"float"===(t=ie(t))&&(t="cssFloat");try{const n=e.style[t];if(n)return n;const r=window.getComputedStyle(e);return r?r[t]:""}catch(n){return e.style[t]}},je=(e,t,n)=>{!Z&&e&&t&&((0,Q.isPlainObject)(t)?Object.keys(t).forEach((n=>{je(e,n,t[n])})):(t=ie(t),e.style[t]=n))},Ve=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Be=(e,t)=>Math.abs(Ve(e)-Ve(t)),We=e=>{let t=0,n=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:n}},Ue=(e,t)=>{let n=e;for(;n;){if(n.classList?.contains(t))return n;n=n.parentNode}return null},Ge=(e,t)=>{if(Z||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ye=e=>Math.pow(e,3),Xe=e=>e<.5?Ye(2*e)/2:1-Ye(2*(1-e))/2,Qe=e=>{const{minValues:t,onDragChange:n,onDragging:r}=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}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const n=e[`page${d}`]-u.current[`start${d}`],a=[t[0],u.current[`containerSize${d}`]-t[1]];let i=u.current[`firstElementSize${d}`]+n;i=Math.max(a[0],i),i=Math.min(a[1],i),r(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),n(!1),Me(document,"mousemove",p),Me(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g=we("split"),y={[`${g}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return l().createElement("div",{className:Ee()(y),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,r=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:r.offsetWidth,firstElementSizeY:r.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),$e(document,"mousemove",p),$e(document,"mouseup",h),n(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Qe.displayName="ResizeBar";const Ze=Qe,Je=l().forwardRef(((e,t)=>{const{offset:n,className:r,style:a}=e,{direction:i,dragging:o}=l().useContext(He),s="vertical"===i?"height":"width",c=we("split-pane"),d={[c]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[r]:!!r},u=void 0!==n?{[s]:de(n)}:{flex:1,[s]:0};return l().createElement("div",{ref:t,className:Ee()(d),style:{...u,...a}},e.children)}));Je.displayName="SplitPane";const et=Je;function tt(){return tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tt.apply(null,arguments)}const nt=e=>{const{direction:t="horizontal",defaultValue:n="50%",uniqueKey:r,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((()=>r?`split_${r}`:""),[r]),[b,v]=l().useState(!1),[x,E]=l().useState(h(n));qe((()=>{b?s?.(f(x)):(d?.(f(x)),localStorage.setItem(y,x),S(y,x))}),[b]),l().useEffect((()=>{w()}),[]);const w=()=>{if(!y)return;const e=localStorage.getItem(y);e?E(h(e)):C(y).then((e=>{localStorage.setItem(y,h(e||n)),w()})).catch((()=>{}))},C=async e=>{const t=u?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},S=async(e,t)=>{const n=u?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},N=l().useMemo((()=>({splitRef:m,direction:t,dragging:b})),[t,b]),I=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"SplitPane"===e.type?.displayName&&I.push(e)}));const[T,R]=I,O=l().useMemo((()=>[g(T),g(R)]),[T,R]),k=we("split"),P={[k]:!0,vertical:"vertical"===t};return l().createElement(He.Provider,{value:N},l().createElement("div",{ref:m,className:Ee()(P,a),style:i},l().createElement(et,tt({},T.props,{ref:p,offset:x})),l().createElement(Ze,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),c(e)}}),l().createElement(et,R.props)))};nt.displayName="QmSplit",nt.Pane=et;const rt=nt,at=require("react-countup");var it=r.n(at);function lt(){return lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lt.apply(null,arguments)}const ot=e=>{const{className:t,style:n}=e,{$size:r}=X(e),a=we("countup"),i={[a]:!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r};return l().createElement(it(),lt({},e,{className:Ee()(i,t),style:n}),e.children)};ot.displayName="QmCountup";const st=ot;function ct(){return ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ct.apply(null,arguments)}const dt=e=>{const{className:t}=e,{$size:n}=X(e),r=we("empty"),a={...e,image:O.Empty.PRESENTED_IMAGE_SIMPLE},i={[r]:!0,[`${r}--lg`]:"large"===n,[`${r}--sm`]:"small"===n};return l().createElement(O.Empty,ct({},a,{className:Ee()(i,t)}))};dt.displayName="QmEmpty";const ut=dt,mt=e=>{const t=h({tip:"Loading..."},e),{fullHeight:n,className:r,style:a}=t,i=we("spin"),o={[i]:!0,[`${i}-fullHeight`]:!!n},s={wrapperClassName:Ee()(o,r),...se(t,["fullHeight"]),style:{...a,maxHeight:"none"}};return l().createElement(O.Spin,s,t.children)};mt.displayName="QmSpin";const pt=mt,ht=l().createContext(void 0),ft=require("resize-observer-polyfill");var gt=r.n(ft);const yt=new Map,bt=new(gt())((function(e){e.forEach((e=>{const{target:t}=e;yt.get(t)?.forEach((e=>e(t)))}))}));function vt(e,t){yt.has(e)||(yt.set(e,new Set),bt.observe(e)),yt.get(e).add(t)}function xt(e,t){yt.has(e)&&(yt.get(e).delete(t),yt.get(e).size||(bt.unobserve(e),yt.delete(e)))}function Et(e){const[t,n]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,r=e=>{n({width:e.offsetWidth,height:e.offsetHeight})};return t&&vt(t,r),()=>{t&&xt(t,r)}}),[e]),t}function wt(e,t){const n=i.useRef(null);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...r)=>{n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(this,r)),t)}),[e,t])}const Ct=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"}},Nt=e=>{const{thumb:t,always:n,className:r,barSize:a=Ct,direction:i="vertical",onDrag:o=te}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=l().useContext(ht),u=St[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 $e(e,"mousemove",S),$e(e,"mouseleave",N),()=>{C(),Me(document,"mouseup",w),Me(e,"mousemove",S),Me(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 n=100*(-1*(p.current.getBoundingClientRect()[u.direction]-e[u.client])-(h.current[u.offset]-t))/p.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},w=()=>{g.current=!1,f.current={[u.axis]:0},Me(document,"mousemove",E),Me(document,"mouseup",w),C(),y.current&&x(!1),o(!1)},C=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},S=()=>{y.current=!1,x(!!m.current.size)},N=()=>{y.current=!0,x(g.current)},I=we("scrollbar"),T={[`${I}__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(Jd,{name:"fade",in:n||s||v,timeout:300},l().createElement("div",{ref:p,className:Ee()(T,r),style:R},l().createElement("div",{ref:h,className:`${I}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),$e(document,"mousemove",E),$e(document,"mouseup",w),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])})}})))},It=20,Tt=l().forwardRef(((e,t)=>{const{wrapClassName:n,wrapStyle:r,innerStyle:a,barWidth:i,always:o,native:s,showTopScrollbar:c,minSize:d=It,onScroll:u}=e,m=l().useRef(null),p=l().useRef(null),h=l().useRef(null),[f,y]=l().useState({size:0,offset:0,ratio:1}),[b,v]=l().useState({size:0,offset:0,ratio:1}),[x,E]=l().useState(!1),w=Et(m),C=Et(h);g((()=>{!s&&S()}),[C.width,C.height,w.width,w.height]);const S=wt((()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=e**2/p.current.scrollHeight,r=t**2/p.current.scrollWidth,a=Math.max(n,d),i=Math.max(r,d),l=n/(e-n)/(a/(e-a)),o=r/(t-r)/(i/(t-i)),s=a+4<e?a:0,c=i+4<t?i:0,u=100*p.current.scrollTop/e*l,m=100*p.current.scrollLeft/t*o;y(Object.assign({},f,{size:c,ratio:o,offset:m})),v(Object.assign({},b,{size:s,ratio:l,offset:u}))}),5),N=e=>{E(e)},I=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollTop=r+(t-r)*Xe(l),a(i)):e.scrollTop=t};a(i)})(p.current,e):p.current.scrollTop=e:pe("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollLeft=r+(t-r)*Xe(l),a(i)):e.scrollLeft=t};a(i)})(p.current,e):p.current.scrollLeft=e:pe("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};l().useImperativeHandle(t,(()=>({container:m.current,scrollTop:p.current?.scrollTop||0,scrollLeft:p.current?.scrollLeft||0,SET_SCROLL_TOP:I,SET_SCROLL_LEFT:T})));const R=l().useMemo((()=>({dragging:x,scrollbarElement:m,wrapElement:p})),[x]),O=we("scrollbar"),k={[`${O}__wrap`]:!0,[`${O}__wrap--hidden`]:!s};return l().createElement("div",{ref:m,className:Ee()(O,e.className),style:e.style},l().createElement("div",{ref:p,className:Ee()(k,n),style:r,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=100*p.current.scrollTop/e*b.ratio,r=100*p.current.scrollLeft/t*f.ratio;y(Object.assign({},f,{offset:r})),v(Object.assign({},b,{offset:n}))})(),u?.({scrollTop:t,scrollLeft:n})}},l().createElement("div",{ref:h,className:`${O}__view`,style:a},e.children)),!s&&l().createElement(ht.Provider,{value:R},c&&l().createElement(Nt,{className:"top",direction:"horizontal",thumb:f,barSize:i,always:o,onDrag:N}),l().createElement(Nt,{direction:"horizontal",thumb:f,barSize:i,always:o,onDrag:N}),l().createElement(Nt,{direction:"vertical",thumb:b,barSize:i,always:o,onDrag:N})))}));Tt.displayName="QmScrollbar";const Rt=Tt,Ot=require("sortablejs");var kt=r.n(Ot);const Pt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const n=window.URL.createObjectURL(e);let r=document.createElement("a");r.href=n,r.download=decodeURI(t),r.click(),r=null}};function Lt(){return Lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Lt.apply(null,arguments)}const At=async(e,{fileName:t,headers:n,params:r})=>{const a=r?new URLSearchParams(r).toString():"",i=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${i+a}`,{method:"GET",headers:n});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));Pt(o,c)},Ft=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},_t=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Dt=e=>{const t=h({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:n=[],fileDirection:r="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),[w,C]=l().useState({}),S=l().useMemo((()=>s||c),[s,c]);l().useEffect((()=>(T(),()=>E.current?.destroy())),[]);const N=(e,t)=>{C((n=>Object.assign({},n,{[e]:t??!n[e]})))},I=Y((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),p?.(e),y?.({file:n[t],fileList:e})}})),T=()=>{i&&(E.current=kt().create(Ue(x.current,we("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:n,headers:r}=t;try{e.url&&await At(e.url,{fileName:e.name,...n?{headers:r}:null})}catch(e){O.message.error(b("qm.download.error"))}},k=we("upload-file"),P={[k]:!0,[`${k}--lg`]:"large"===v,[`${k}--sm`]:"small"===v,[`${k}--horizontal`]:"horizontal"===r};return l().createElement(O.Upload,Lt({className:Ee()(P,u)},se(t,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,n)=>new Promise((async(r,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,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(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,r,a,c)=>((e,r)=>{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:Ee()("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"},w[c]?l().createElement(O.Input,{size:"small",autoFocus:!0,defaultValue:Ft(d),onBlur:t=>{const{value:r}=t.target;if(r!==Ft(d)){const t=Object.assign({},e,{name:`${r}.${_t(d)}`}),a=n.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):r.preview()}},d)),l().createElement("span",{className:"ant-upload-list-item-card-actions"},o&&!S&&l().createElement("button",{type:"button",className:p,onClick:()=>N(c)},w[c]?l().createElement(Ce.CheckOutlined,null):l().createElement(Ce.EditOutlined,null)),o&&l().createElement("button",{type:"button",className:Ee()(p,"preview"),onClick:()=>r.preview()},l().createElement(Ce.EyeOutlined,null)),l().createElement("button",{type:"button",className:Ee()(p,"download"),disabled:s,onClick:()=>r.download()},l().createElement(Ce.DownloadOutlined,null)),l().createElement("button",{type:"button",className:Ee()(p,"delete"),disabled:S,onClick:()=>r.remove()},l().createElement(Ce.DeleteOutlined,null))))))})(r,c)}),l().createElement("span",{className:"inner",ref:x},t.children||c&&n.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&&!!n.length&&l().createElement(O.Button,{disabled:s,style:{marginLeft:8},onClick:async e=>{if(e.stopPropagation(),"function"==typeof a)await a(n);else for(const e of n)await R(e)}},b("qm.upload.batchDownload"))))};Dt.displayName="QmUploadFile";const Ht=Dt;function qt(){return qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qt.apply(null,arguments)}const $t=e=>{const t=h({icon:l().createElement(Ce.DownloadOutlined,null),withCredentials:!1},e),{$size:n}=X(t),{t:r}=G(),[a,i]=l().useState(!1),o=se(t,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return l().createElement(O.Button,qt({},o,{size:n,loading:a,onClick:async()=>{i(!0);try{const{action:e,fileName:n,headers:a,params:i,beforeDownload:l=ne,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 At(s,{fileName:n,headers:a,params:i}),await re(100),o?.(),O.message.success(r("qm.download.success"))}catch(e){t.onError?.(e),O.message.error(r("qm.download.error"))}i(!1)}}),t.children||r("qm.download.text"))};$t.displayName="QmDownload";const Mt=$t,Kt=require("add-dom-event-listener");var zt=r.n(Kt);const jt=require("scroll-into-view-if-needed");var Vt=r.n(jt);function Bt(e,t){const n=i.useRef(null),r=i.useRef(0);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...n)=>{const a=Date.now();(!r.current||a-r.current>t)&&(e.apply(this,n),r.current=a)}),[e,t])}const Wt=e=>{const{activeKey:t,labels:n,onTabClick:r}=e;return l().createElement(l().Fragment,null,n.map(((e,n)=>{const a={item:!0,actived:n===t};return l().createElement("div",{key:n,className:Ee()(a),onClick:e=>r(n,e)},l().createElement("span",null,e))})))},Ut=e=>{const{label:t,showDivider:n,className:r,style:a}=e,i=we("anchor-item"),o={[i]:!0};return l().createElement("div",{className:Ee()(o,r),style:a},n&&l().createElement(Ne,{label:t,style:{marginBottom:10}}),e.children)};Ut.displayName="AnchorItem";const Gt=Ut,Yt=l().forwardRef(((e,t)=>{const{labelList:n=[],defaultActiveIndex:r,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(r||0),y=l().useMemo((()=>!!n?.length),[n]);l().useEffect((()=>{b();const e=zt()(u.current,"scroll",x);return()=>{e.remove()}}),[]);const b=()=>{f>0&&(u.current.scrollTop=Be(v(f),u.current))},v=e=>y?document.getElementById(n[e].id):u.current.children[e],x=Bt((e=>{if("ready"!==p.current)return;const t=(e=>{const t=Math.abs(e),r=(y?n.map((e=>document.getElementById(e.id))):Array.from(u.current?.children||[])).map((e=>Be(e,u.current)));let a=-1;for(let e=0;e<r.length;e++){const n=r[e],i=r[e+1]||1e4;t>=n-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 w=we("anchor"),C={[w]:!0,[`${w}-left`]:"left"===i,[`${w}-top`]:"top"===i,[`${w}--lg`]:"large"===d,[`${w}--sm`]:"small"===d},S=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"AnchorItem"===e.type?.displayName&&S.push(e)}));const N=y?n.map((e=>e.label)):S.map((e=>e.props.label)),I=y?n.map((e=>e.id)):S.map(((e,t)=>e.props["data-id"]||t.toString()));return h.current=N.length,l().createElement("div",{className:Ee()(C,s),style:c},l().createElement("div",{className:Ee()("anchor-nav"),style:{width:a?de(a):""}},l().createElement(Wt,{activeKey:f,labels:N,onTabClick:(e,t)=>{E(e),o?.({label:N[e],id:I[e]},t)}})),l().createElement("div",{ref:u,className:Ee()("anchor-container")},y?e.children:S))}));Yt.displayName="QmAnchor",Yt.Item=Gt;const Xt=Yt,Qt=e=>l().createElement(O.Tabs.TabPane,e,e.children);Qt.displayName="TabPane";const Zt=Qt;function Jt(){return Jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jt.apply(null,arguments)}const en=e=>{const t=h({tabPosition:"top"},e),{items:n,tabPosition:r,tabBarGutter:a,className:i,authConfig:o}=t,{$size:s}=X(t),c=we("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u={...se(t,["items","authConfig"]),size:s,tabBarGutter:a??(["top","bottom"].includes(r)?30:0)},m=[];l().Children.map(t.children,(e=>{J(e)&&!ee(e)&&"TabPane"===e.type?.displayName&&m.push(e)}));const p=n?[...n]: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 n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:a=1,disabled:i}=r||{};a?i&&(n.disabled=!0):(p.splice(t,1),t--)}}return l().createElement(O.Tabs,Jt({},u,{items:p,className:Ee()(d,i)}))};en.displayName="QmTabs",en.TabPane=Zt;const tn=en;function nn(){return nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nn.apply(null,arguments)}const rn=l().forwardRef(((e,t)=>{const n=h({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:r,open:a,className:i,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:f,onFullChange:g}=n,{global:y}=l().useContext(o),{$size:b}=X(n),v=l().useRef(null),x=l().useRef(null),E=l().useRef(!1),[w,C]=l().useState(!1),[S,N]=l().useState(!1),[I,T]=l().useState(!1);qe((()=>{(a??r)&&(!m&&E.current||(0,Q.isUndefined)(s)&&N(!0))}),[a??r]),qe((()=>{x.current&&je(x.current,w?{width:"100%"}:{width:de(n.width||"72%")})}),[w]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=we("drawer"),k={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===b,[`${R}--sm`]:"small"===b};return l().createElement(O.Drawer,nn({},se(n,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??r,maskClosable:u??y?.maskClosable??!1,className:Ee()(k,i),title:l().createElement(l().Fragment,null,l().createElement("span",{ref:v,className:"text"},c&&n.title),d&&l().createElement("button",{type:"button",className:"full-screen",onClick:()=>{x.current=Ue(v.current,"ant-drawer-content-wrapper"),C(!w),g?.(!w)}},l().createElement(w?Ce.FullscreenExitOutlined:Ce.FullscreenOutlined))),footer:null,afterOpenChange:e=>{e?(E.current=!0,(0,Q.isUndefined)(s)&&setTimeout((()=>N(!1)),100)):(C(!1),f?.())},onClose:p}),n.children,(s||I||S)&&l().createElement(pt,{spinning:!0,className:Ee()("spinning")}))}));rn.displayName="QmDrawer";const an=rn,ln=require("react-draggable");var on=r.n(ln);function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sn.apply(null,arguments)}const cn="10vh";var dn=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(dn||{});const un=l().forwardRef(((e,t)=>{const n=h({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:cn}},e),{visible:r,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}=n,{global:E}=l().useContext(o),{$size:w}=X(n),C=l().createRef(),S=l().useRef(!1),N=l().useMemo((()=>`calc(100vh - ${cn} - ${cn} - ${dn[m?w:"none"]}px)`),[w,m]),[I,T]=l().useState(!1),[R,k]=l().useState(!1),[P,L]=l().useState(!1),[A,F]=l().useState(!0),[_,D]=l().useState({left:0,top:0,bottom:0,right:0}),[H,q]=l().useState();qe((()=>{if(a??r){if(!g&&S.current||(0,Q.isUndefined)(d)&&k(!0),!g&&S.current)return;setTimeout((()=>{S.current=!0,(0,Q.isUndefined)(d)&&k(!1)}),400)}}),[a??r]),qe((()=>{q(I?{x:0,y:0}:void 0)}),[I]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>L(!0),STOP_LOADING:()=>L(!1)})));const $=we("modal"),M={height:s?de(s):N,maxHeight:"auto"===s?N:"",overflow:"auto"},K={[$]:!0,"no-header":!m,[`${$}--lg`]:"large"===w,[`${$}--sm`]:"small"===w};return l().createElement(O.Modal,sn({},se(n,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:a??r,maskClosable:f??E?.maskClosable??!1,className:Ee()(K,c),title:l().createElement("div",{onMouseOver:()=>{A&&F(!1)},onMouseOut:()=>{F(!0)}},l().createElement("span",{className:"text"},m&&n.title),p&&l().createElement("button",{type:"button",className:"full-screen",onClick:e=>{const t=Ue(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");I?(je(t,{width:de(i||"60%"),height:"auto",top:cn}),je(n,{height:s?de(s):N,maxHeight:"auto"===s?N:""})):(je(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),je(n,{height:`calc(100vh - ${dn[m?w:"none"]}px)`,maxHeight:""})),T(!I),b?.(!I)}},l().createElement(I?Ce.FullscreenExitOutlined:Ce.FullscreenOutlined))),footer:null,bodyStyle:Object.assign({},M,y),onCancel:v,afterClose:()=>{x?.(),T(!1)},modalRender:e=>l().createElement(on(),{nodeRef:C,bounds:_,position:H,disabled:!u||A||I,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,a=C.current.getBoundingClientRect();a&&D({left:-a.left+t.x,right:n-(a.right-t.x)-1,top:-a.top+t.y,bottom:r-(a.bottom-t.y)-1})})(0,t)},l().createElement("div",{ref:C},e))}),n.children,(d||P||R)&&l().createElement(pt,{spinning:!0,className:Ee()("spinning")}))}));un.displayName="QmModal";const mn=un,pn=require("memoize-one");var hn=r.n(pn);const fn=(0,i.createContext)(void 0),gn=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],yn={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)gn.includes(t[e])?(n[r]=n[r].join(" "),r++,n[r]=[]):n[r].push(t[e]);return n[r]=n[r].join(" "),n},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 n=0,r=(e=Array.isArray(e)?e:[e]).length;n<r;n++)t+="number"==typeof e[n]?e[n]:"'"+e[n]+"'",n<r-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,n){return e.split(t).join(n)},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 ")}},bn=["==","<",">","<=",">=","!=","like","likes","in","nin"],vn=function(e,t){let n="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?n+=" "+e[t]+" ":n+=e[t];const r=n.split(" ").filter((e=>""!==e));for(let e=0;e<r.length;e++)bn.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),bn.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return r.join(" ")},xn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,En=["string","number","boolean","symbol"],wn=e=>En.includes(typeof e),Cn=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Sn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(xn,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=e??"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Sn(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Sn(t))));break;case"in":wn(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":wn(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(Cn(e)?e.slice(0,10):e)!=n;break;case"<":r=(Cn(e)?e.slice(0,10):e)<n;break;case"<=":r=(Cn(e)?e.slice(0,10):e)<=n;break;case">":r=(Cn(e)?e.slice(0,10):e)>n;break;case">=":r=(Cn(e)?e.slice(0,10):e)>=n;break;default:r=(Cn(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const Nn=yn.stringify,In=yn.array_format,Tn=function(e){let t=0;const n=e.length;for(let r=0;r<n;r++){const n=e.charAt(r);"("===n&&t++,")"===n&&t--}return 0===t},Rn=(e,t,n)=>{let r=[];t=yn.replace_symbols(t);try{if(n){const n=new Function("record",`return ${vn(t,"record")};`);r=cr(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${vn(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)n(e,t)&&r.push(e[t])}}catch(t){pe("Table","组件 `initialFilter` 参数有误!"),r=e}return r},On=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...On(e.children)):t.push(e)})),t},kn=e=>e.filter((e=>(e.children&&(e.children=kn(e.children)),!e.hidden&&!e.noAuth))),Pn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Pn(e.children))})),t},Ln=(e,t)=>e.map((e=>(e.children&&(e.children=Ln(e.children,t)),t?.(e),e))),An=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=An(n.children,t);if(e)return e}}return null},Fn=e=>{const t=e.children;return t?t[0].children?Fn(t[0]):t[0]:e},_n=e=>{const t=e.children;return t?t[t.length-1].children?_n(t[t.length-1]):t[t.length-1]:e},Dn=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Hn=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Hn(n.children,t);if(e)return e}}return null},qn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...qn(e.children))})),t},$n=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...$n(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},Mn=e=>{let t=1;const n=(e,r)=>{if(r&&(e.level=r.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((r=>{e.fixed?r.fixed=e.fixed:delete r.fixed,n(r,e),t+=r.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return Pn(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Kn=e=>Object.assign(e,{__prevent__:!0}),zn=e=>{delete e.__prevent__},jn=(e,t,n={left:0,top:0})=>{if(e){const r=e.parentNode;if(n.top+=e.offsetTop,n.left+=e.offsetLeft,r&&r!==document.documentElement&&r!==document.body&&(n.top-=r.scrollTop,n.left-=r.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return jn(e.offsetParent,t,n)}return n},Vn=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Bn=(e,t)=>(0,Q.transform)(e,((e,n,r)=>{(0,Q.isEqual)(n,t[r])||(e[r]=(0,Q.isPlainObject)(n)&&(0,Q.isPlainObject)(t[r])?Bn(n,t[r]):n)})),Wn=(e,t)=>(0,Q.get)(e,t)??"",Un=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),(0,Q.set)(e,t,n??"")},Gn=(e,t)=>{if(!t.includes("|"))return Wn(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(Wn(e,t))})),n.every((e=>!e))?"":n.join(" | ")},Yn=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Xn=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],a="";for(;r.length>3;)a=`,${r.slice(-3)}${a}`,r=r.slice(0,r.length-3);return r&&(a=r+a),`${n}${a}${t[1]?`.${t[1]}`:""}`},Qn=(e,t)=>{const n=e.toString();if(!Yn(n)||0===t)return e;const r=Number.parseFloat(n).toString(),a=r.indexOf(".");if(-1===a)return r+"."+"0".repeat(t);const i=Math.max(0,t-(r.length-a-1));return r+"0".repeat(i)},Zn=(e,t)=>e?c()(e,t):null,Jn=(e,t)=>e?c()(e).format(t):"",er=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},tr=e=>{const t=[];if(l().isValidElement(e)){const{children:n}=e.props;l().Children.forEach(n,(e=>{t.push(...tr(e))}))}else t.push(e);return t},nr=e=>tr(e).join(""),rr=e=>e.filter((e=>!e._group)),ar=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=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)?In(i.condition):Nn(i.condition,"^");n+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,r=i.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[a,i]=r.includes("|")?r.split("|"):[r,""],l=e[r];for(const e in l)n+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?In(l[e]):Nn(l[e],"^")} and `}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},ir=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(Wn(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},lr=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].dataIndex===t)return[e[n]];if(Array.isArray(e[n].children)){const r=lr(e[n].children,t);if(r)return[e[n],r].flat()}}},or=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].rowKey===t)return[t];if(Array.isArray(e[n].children)){const r=or(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},sr=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=sr(n.children,t);if(e)return e}if(t(n))return n}return null},cr=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&cr(e.children,t),t(e)||e.children&&e.children.length))),dr=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),ur=require("prop-types");var mr=r.n(ur);const pr=e=>["","small","middle","large"].includes(e),hr=80,fr="1",gr="0",yr=400,br=["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"],vr={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 xr=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}({}),Er=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}({}),wr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Cr={items:mr().arrayOf(mr().shape({type:mr().string.isRequired,fieldName:mr().string.isRequired})),initialValues:mr().object,initialExtras:mr().object,layout:mr().oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!pr(e[t]||""))return me("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:mr().number,className:mr().string,style:mr().object,compactMode:mr().bool,labelWidth:mr().oneOfType([mr().number,mr().string]),labelAlign:mr().oneOf(["left","right"]),labelWrap:mr().bool,formType:mr().oneOf(["default","search","onlyShow"]),disabled:mr().bool,uniqueKey:mr().string,defaultRows:mr().number,defaultExpand:mr().bool,searchButtonCols:mr().number,scrollToFirstError:mr().bool,authConfig:mr().object,isAutoFocus:mr().bool,isCollapse:mr().bool,isFieldsDefine:mr().bool,isSearchBtn:mr().bool,isSubmitBtn:mr().bool,fieldsChange:mr().func,onValuesChange:mr().func,onFieldsChange:mr().func,onFinish:mr().func,onFinishFailed:mr().func,onReset:mr().func,onCollapse:mr().func},Sr={layout:"horizontal",labelWidth:hr,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},Nr=(e,t)=>{if(!e)return null;if(t===Er.week){const t=e.match(/^(\d{4})-(\d+)/);return t?c()().year(Number(t[1])).week(Number(t[2])):null}if(t===Er.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)},Ir=(e,t)=>e?c()(e).format(t):"",Tr=e=>""===e||null==e,Rr=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const n=t.split("|");let r="";for(let t=0,a=n.length;t<a;t++)r+=(e[n[t].trim()]??"")+(t===a-1?"":" | ");return r},Or=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},kr=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},Pr=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),(0,Q.isUndefined)(e.isLeaf)||(r.isLeaf=!!e.isLeaf),(0,Q.isUndefined)(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=Pr(e.children,t,n)),r})),Lr=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=Lr(n.children,t);if(e)return e}}return null},Ar=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...Ar(e.children,t,n+1))})),r},Fr=e=>J(e)||"string"==typeof e,_r=e=>J(e)?tr(e).join(""):e??"",Dr=(e,t,n,r)=>{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={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:n(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={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:n(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:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Hr={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"}},qr="阿",$r="鿿",Mr=1,Kr=2,zr=3;let jr,Vr=null;function Br(e){return e||null===Vr?("object"==typeof Intl&&Intl.Collator?(jr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Vr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Vr=!1,Vr):Vr}function Wr(e){const t=Hr.UNIHANS,n=Hr.PINYINS,r=Hr.EXCEPTIONS,a={source:e};if(e in r)return a.type=Kr,a.target=r[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=Mr,a.target=e,a;if(i=jr.compare(e,qr),i<0)return a.type=zr,a.target=e,a;if(0===i)a.type=Kr,l=0;else{if(i=jr.compare(e,$r),i>0)return a.type=zr,a.target=e,a;0===i&&(a.type=Kr,l=t.length-1)}if(a.type=Kr,l<0){let n=0,r=t.length-1;for(;n<=r;){l=~~((n+r)/2);const a=t[l];if(i=jr.compare(e,a),0===i)break;i>0?n=l+1:r=l-1}}return i<0&&l--,a.target=n[l],a.target||(a.type=zr,a.target=a.source),a}function Ur(e){return"string"==typeof e&&Br()?e.split("").map((e=>Wr(e))):e}const Gr={isSupported:Br,parse:Ur,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Hr)})))},genToken:Wr,convertToPinyin:(e,t,n)=>Ur(e).map((e=>t&&e.type===Kr?e.target.toLowerCase():e.target)).join(n||"")},Yr={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}};Gr.isSupported()&&Yr.shouldPatch(Gr.genToken)&&Gr.patchDict(Yr);const Xr=Gr,Qr=e=>{const{value:t,bordered:n}=e;return l().createElement(O.Input,{value:t,title:t,bordered:n,readOnly:!0})};Qr.displayName="FormItemView";const Zr=Qr;function Jr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ea(){return ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ea.apply(null,arguments)}const{Option:ta}=O.Select,na=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,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=yr,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,I=le(v)?r:v,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(Zr,{value:R(n),bordered:h}):l().createElement(O.Select,ea({value:n,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:w?"responsive":void 0,maxTagTextLength:C},a?{title:R(n)}:null,{filterOption:(e,t)=>{const n=t?.children?.toString()||"",r=Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,R(e),I)})(e)},onClear:b}),I.map((e=>l().createElement(ta,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ra extends i.Component{constructor(...e){super(...e),Jr(this,"context",void 0),Jr(this,"state",{itemList:[],loading:!1}),Jr(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,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:Ee()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(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(na,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),p&&l().createElement(O.Col,null,e.renderFormItemButton(o,p)),m&&l().createElement(O.Col,{flex:de(m.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...m}))))}}Jr(ra,"contextType",fn);const aa=ra;function ia(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const la=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=gr,trueValue:p=fr}=o,{t:h}=G();return l().createElement(O.Checkbox,{checked:n===p,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{r?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(t?p:m)}},u?i:null)};class oa extends i.Component{constructor(...e){super(...e),ia(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(la,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ia(oa,"contextType",fn);const sa=oa,ca=require("react-sortablejs"),da=e=>{const{uniqueKey:t,items:n,fieldsChange:r}=e,{global:a}=l().useContext(o),{$$form:i}=l().useContext(fn),{$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}})),n=JSON.parse(localStorage.getItem(p));(0,Q.isEqual)(t,n)||(localStorage.setItem(p,JSON.stringify(t)),(async(e,t)=>{const n=a?.saveComponentConfigApi;if(n)try{await n({[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 n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(p).then((e=>{e?(localStorage.setItem(p,JSON.stringify(e)),f()):a?.getComponentConfigApi&&h(n)})).catch((()=>{})),e?(0,Q.xor)(e.map((e=>e.fieldName)),n.map((e=>e.fieldName))).length>0?n.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?((0,Q.isUndefined)(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>({...n.find((t=>t.fieldName===e.fieldName)),...e}))):void 0})();e&&g(e)},g=e=>{r?.([...e])},y=we("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:Ee()("ant-dropdown-menu","fields-list")},l().createElement("div",{className:"reset"},l().createElement(ge,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=n.find((t=>t.fieldName===e.fieldName))||ce(e);return Object.assign(t,{hidden:e.hidden})}));g(t),h(t)})(i.getOriginItems())},c("qm.table.columnFilter.reset"))),l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));if((0,Q.isEqual)(t,r))return;i.setExpandHandle(!0);const a=dr(e);g(a),h(a)}},n.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:r}=t.target;e.hidden=!r,g(n),h(n)}}),l().createElement(Ce.HolderOutlined,{className:"handle",title:c("qm.form.draggable")}),l().createElement("span",{className:"title"},i.getFormItemLabel(e.label))))))),overlayClassName:Ee()(b),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>d.current,onOpenChange:e=>{m(e)}},l().createElement("a",{ref:d,style:{padding:"5px 0"}},l().createElement(Ce.UnorderedListOutlined,null)))};da.displayName="FieldsFilter";const ua=da;function ma(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(fn),{value:r,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:w,pattern:C,toUpper:S,toTrim:N,autoFocus:I,autoComplete:T,secretType:R}=s,k=R&&(p||h),P=l().useRef();l().useEffect((()=>{const e=()=>b?.(),t=P.current?.input.parentNode.querySelector("span[class*='clear-icon']");return m&&t&&t.addEventListener("click",e),()=>{t?.removeEventListener("click",e)}}),[]);const L=e=>{a?.(e),i(e)},A=E?O.Input.Password:O.Input,F=k?((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))(r,R):r;return n.isOnlyShow?l().createElement(Zr,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(F),bordered:u}):l().createElement(A,{ref:e=>{P.current=e,"function"==typeof t&&t(e)},value:F,autoComplete:E?"new-password":T,autoFocus:I,placeholder:d,style:c,title:E?"":F,prefix:v,suffix:x,maxLength:w,bordered:u,allowClear:m,readOnly:p,disabled:h,onFocus:e=>{f?.(e.target.value,e)},onBlur:t=>{let n=t.target.value??"";if(N){const e=n.trim();n!==e&&(n=e,L(n))}(t=>{const{onBlur:n}=e;n?.(t)})(n),g?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;y?.(t,e),n.isFilterType&&(n.SUBMIT_FORM(),P.current?.blur())}},onChange:e=>{let t=e.target.value;(0,Q.isRegExp)(C)&&(t=C.test(t)?t:r??""),S&&(t=t.toUpperCase()),L(t)}})}));pa.displayName="VInput";class ha extends i.Component{constructor(...e){super(...e),ma(this,"context",void 0),ma(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(pa,{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:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ma(ha,"contextType",fn);const fa=ha;function ga(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ya=e=>{const{$$form:t}=l().useContext(fn),{value:n=[],onChange:r,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;r?.(t),a(t,y(t))},y=e=>e.join(" - ");return t.isOnlyShow?l().createElement(Zr,{value:y(n),bordered:c}):l().createElement(O.Input.Group,null,l().createElement(O.Input,{value:n[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,n[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:n[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([n[0],t])}}))};class ba extends i.Component{constructor(...e){super(...e),ga(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(ya,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(O.Col,{flex:de(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...c}))))}}ga(ba,"contextType",fn);const va=ba,xa=require("big.js");var Ea=r.n(xa);function wa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ca=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(fn),{value:r,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:w,textAlign:C="left",controls:S=!0,formatter:N,parser:I}=s,T=l().useRef(),R=l().useRef(r),k=e=>{const t=Tr(e)?"":(0,Q.isNumber)(e)?e.toFixed(x):new(Ea())(e).toFixed(x);return"function"==typeof N?N(t):t},P={[C]:!0,controls:S};return n.isOnlyShow?l().createElement(Zr,{value:k(r),bordered:u}):l().createElement(O.InputNumber,{ref:e=>{T.current=e,"function"==typeof t&&t(e)},value:r,className:Ee()(P),placeholder:d,style:{width:"100%",...c},step:y,min:b,max:v,controls:S,precision:x,autoFocus:E,stringMode:w,formatter:N,parser:I,bordered:u,readOnly:m,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{ae((()=>{(t=>{const{onBlur:n}=e;n?.(t)})(R.current),f?.(R.current,t)}))},onKeyUp:e=>{13===e.keyCode&&(g?.(r,e),n.isFilterType&&(n.SUBMIT_FORM(),T.current?.blur()))},onChange:e=>{const t=e??"";!w&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,a?.(e),i(e,k(e))})(t)}})}));Ca.displayName="VInputNumber";class Sa extends i.Component{constructor(...e){super(...e),wa(this,"context",void 0),wa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ca,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&l().createElement(O.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}wa(Sa,"contextType",fn);const Na=Sa;function Ia(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ta=e=>{const{$$form:t}=l().useContext(fn),{value:n=[],onChange:r,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]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];r?.(t),a(t,C(t))},C=e=>Tr(e)?"":e.map((e=>Tr(e)?"":Number(e).toFixed(b))),S={[g]:!0,controls:y};return t.isOnlyShow?l().createElement(Zr,{value:C(n),bordered:c}):l().createElement(O.Input.Group,null,l().createElement(O.InputNumber,{value:n[0],className:Ee()("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=>{w([e,n[1]])},onBlur:()=>{E(n)}}),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:n[1],className:Ee()("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=>{w([n[0],e])},onBlur:()=>{E(n)}}))};class Ra extends i.Component{constructor(...e){super(...e),Ia(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ta,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(O.Col,{flex:de(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...c}))))}}Ia(Ra,"contextType",fn);const Oa=Ra;let ka=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function Pa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:La}=O.Input;class Aa 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",hn()((e=>Object.assign({},this.props.helperConfig,e)))),Pa(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=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:n,echoRequest:r}=this.searchHelper;if(t||pe("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||pe("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&pe("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Pa(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Pa(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Pa(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=(e=>e),dataKey:r,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)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&kr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Rr(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:n}=this.searchHelper,r=""!==e?e:void 0,a=("function"==typeof n?n():n)||[],i={[t]:r};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](r):r;else i[e]=r})),i})),Pa(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=ne,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!r(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:n}=this.props.option;for(const r in this.alias){const a=Rr(e,this.alias[r]);void 0!==a&&(t.SET_FIELDS_VALUE({[r]:a}),r===n&&t.setViewValue(n,a))}for(const n in this.extras){const r=Rr(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}})),Pa(this,"resetSearchHelperValue",(async(e=[],t)=>{const{fieldName:n}=this.props.option,r=e.filter((e=>Rr(e,this.alias[n])?.toString().toLowerCase().includes(t.toLowerCase())));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),Pa(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,a=(r??ne)(n.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:n}=this.props.option;this._record=e;for(const r in this.alias)r!==n&&t.SET_FIELDS_VALUE({[r]:Rr(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])});const r=Rr(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);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 n in this.alias)n!==t&&e.SET_FIELDS_VALUE({[n]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this._prevValue=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:n}=this.props;t?.(e),n(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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r}=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:`${ka[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(Zr,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(La,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,placeholder:d,style:c,prefix:g,suffix:y,maxLength:b,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:n}=e.target,{onlySelect:r=!0,table:a}=this.searchHelper;this.triggerBlur(n),this._is_change&&!t&&(n?r?a?.fetch?.api&&this.getSearchHelperTableData(n).then((e=>this.resetSearchHelperValue(e,n))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(n):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:n}=e.target;!t&&this.openSearchHelper(n)}},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):this.clearSearchHelperValue())}}),l().createElement(mn,v,l().createElement(fd,x)))}}Pa(Aa,"contextType",fn);class Fa 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){me("Form","搜索帮助获取定义信息的接口出错")}})),Pa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Aa,{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:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Pa(Fa,"contextType",fn);const _a=Fa;function Da(){return Da=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Da.apply(null,arguments)}function Ha(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const qa=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 n=e.target,r=t?.target,a=!n||!r,i=this.$el?.contains(n)||this.$el?.contains(r),l=this.$el===n,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(n)))||o.includes(r);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=zt()(document,"mousedown",this.mousedownHandler),this.event2=zt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:n}=this.state;return l().createElement(e,Da({ref:t},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Ha(t,"displayName",`OutsideClick(${e.displayName||e.name})`),l().forwardRef(((e,n)=>l().createElement(t,Da({},e,{forwardedRef:n}))))},$a=require("rc-trigger");var Ma,Ka,za=r.n($a);function ja(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Va=qa((Ka=class extends i.Component{constructor(e){super(e),ja(this,"context",void 0),ja(this,"searchRef",l().createRef()),ja(this,"_records",[]),ja(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),ja(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),ja(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`")})),ja(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ja(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ja(this,"setItemList",(e=>{this.setState({itemList:e})})),ja(this,"setRecords",(e=>{this._records=e})),ja(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),ja(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),ja(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ja(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ja(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(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:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,Q.isEqual)(n,r)||(0,Q.isEqual)(r,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:n,params:r={},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(n){if(le(c))return this.setRecords([]);this.setState({loading:!0});try{const o=await n(a({...r,keys:c}));if(200===o.code){let n=Array.isArray(o.data)?o.data:(0,Q.get)(o.data,i)??[];n.forEach((n=>{s?.valueKey&&s.valueKey!==t&&(n[t]=n[s.valueKey]),s?.textKey&&s.textKey!==e&&(n[e]=n[s.textKey])})),n=n.filter((e=>c.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setViewValue(c),l?.(n)}}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:n,loading:r,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:`${ka[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))),w=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"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=we("form-multiple-search-helper"),{size:N}=e.context,I={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const T=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Zr,{value:T,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(za(),{popupVisible:!g&&n,popup:w,popupClassName:Ee()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,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:r,bordered:m,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(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(mn,v,l().createElement(fd,x)))}},ja(Ka,"contextType",fn),Ma=Ka))||Ma;class Ba extends i.Component{constructor(e,{$$form:t}){super(e),ja(this,"context",void 0),ja(this,"promiseRef",void 0),ja(this,"state",{searchHelper:{}}),ja(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),ja(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Va,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ja(Ba,"contextType",fn);const Wa=Ba;function Ua(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:Ga}=O.Input;class Ya extends i.Component{constructor(e){super(e),Ua(this,"context",void 0),Ua(this,"valueKey",void 0),Ua(this,"_record",void 0),Ua(this,"_prevValue",null),Ua(this,"state",{visible:!1,loading:!1}),Ua(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),Ua(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Ua(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ua(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||pe("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||pe("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&pe("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Ua(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Ua(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Ua(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=(e=>e),dataKey:r,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)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&kr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})}})),Ua(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const a=Rr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])})})),Ua(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),Ua(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias)r!==n&&t.SET_FIELDS_VALUE({[r]:Rr(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])});const r=Rr(e,this.alias[n]);this.triggerChange(r);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Ua(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const n in this.alias)n!==t&&e.SET_FIELDS_VALUE({[n]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this._prevValue=null,this.triggerChange("")})),Ua(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),Ua(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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r=""}=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:`${ka[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(Zr,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Ga,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,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(mn,v,l().createElement(Ed,x)))}}Ua(Ya,"contextType",fn);class Xa extends i.Component{constructor(e,{$$form:t}){super(e),Ua(this,"context",void 0),Ua(this,"promiseRef",void 0),Ua(this,"state",{searchHelper:{}}),Ua(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),Ua(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Ya,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ua(Xa,"contextType",fn);const Qa=Xa;var Za,Ja;function ei(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ti=qa((Ja=class extends i.Component{constructor(e){super(e),ei(this,"context",void 0),ei(this,"searchRef",l().createRef()),ei(this,"_records",[]),ei(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),ei(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),ei(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`")})),ei(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ei(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ei(this,"setItemList",(e=>{this.setState({itemList:e})})),ei(this,"setRecords",(e=>{this._records=e})),ei(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),ei(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),ei(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ei(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ei(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(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:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,Q.isEqual)(n,r)||(0,Q.isEqual)(r,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:n,params:r={},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(n){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),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:n,loading:r,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:`${ka[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))),w=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"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=we("form-multiple-tree-table-helper"),{size:N}=e.context,I={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const T=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Zr,{value:T,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(za(),{popupVisible:!g&&n,popup:w,popupClassName:Ee()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,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:r,bordered:m,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(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(mn,v,l().createElement(Ed,x)))}},ei(Ja,"contextType",fn),Za=Ja))||Za;class ni extends i.Component{constructor(e,{$$form:t}){super(e),ei(this,"context",void 0),ei(this,"promiseRef",void 0),ei(this,"state",{searchHelper:{}}),ei(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),ei(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(ti,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ei(ni,"contextType",fn);const ri=ni;function ai(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ii=new Array(2).fill("");class li extends i.Component{constructor(e){super(e),ai(this,"context",void 0),ai(this,"_is_change",!1),ai(this,"_ceho_data",void 0),ai(this,"_records",[]),ai(this,"_is_clear",!1),ai(this,"state",{visible:!1,loading:!1,itemList:[],textValue:ii}),ai(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),ai(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`")})),ai(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ai(this,"setItemList",(e=>{this.setState({itemList:e})})),ai(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ai(this,"setTextValue",(e=>{this.setState({textValue:e})})),ai(this,"setRecords",(e=>{this._records=e})),ai(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),ai(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,t?.(e),n(e,this.createViewText(),this._records)})),ai(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(ii),this.triggerChange([])})),ai(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:n}=this.alias,r=e.map((e=>({value:e[t],text:e[n]})));this.setRecords(e),this.setItemList(r),this.setTextValue(r.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ai(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ai(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,n=le(e)?void 0:e;return{[t]:n}})),ai(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=ne,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!r(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()}))})),ai(this,"resetSearchHelperValue",(async(e=[])=>{const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{const r=e[n]?.toString().toLowerCase();return t.some((e=>r?.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),ai(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:n=[]}=this.props;(0,Q.isEqual)(t,n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:a}=this.props.option;if(!(0,Q.isEqual)(r[a],this._ceho_data)&&(this._ceho_data=r[a],this.setItemList(r[a]),n.length)){const e=ii.map(((e,t)=>r[a].find((e=>e.value===n[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:n,params:r={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(n){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t]))).slice(0,2);const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setTextValue(r.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:n,loading:r,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=>Tr(e)))?"":a.join(" - "),g={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${ka[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(Zr,{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&&!n&&(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:r,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(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(mn,g,l().createElement(Rd,y)))}}ai(li,"contextType",fn);class oi extends i.Component{constructor(e,{$$form:t}){super(e),ai(this,"context",void 0),ai(this,"promiseRef",void 0),ai(this,"state",{searchHelper:{}}),ai(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),ai(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(c),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(li,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{h(t,r),e.setViewValue(i,n)}}))),u&&l().createElement(O.Col,null,e.renderFormItemButton(i,u)),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...d}))))}}ai(oi,"contextType",fn);const si=oi;function ci(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const di=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=le(m)?r:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?l().createElement(Zr,{value:h(n),bordered:c}):l().createElement(O.Checkbox.Group,{value:n,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 ui extends i.Component{constructor(...e){super(...e),ci(this,"context",void 0),ci(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(di,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ci(ui,"contextType",fn);const mi=ui;function pi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const hi=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:n,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;r?.(e),a(e,(t=e,p?p[Math.ceil(t)-1]:t.toString()))})(e)}})};class fi extends i.Component{constructor(...e){super(...e),pi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(hi,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}pi(fi,"contextType",fn);const gi=fi;function yi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const bi=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,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)?r:m,h=e=>p.find((t=>t.value===e))?.text??"";return t.isOnlyShow?l().createElement(Zr,{value:h(n),bordered:c}):l().createElement(O.Radio.Group,{value:n,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 vi extends i.Component{constructor(...e){super(...e),yi(this,"context",void 0),yi(this,"state",{itemList:[]}),yi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(bi,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}yi(vi,"contextType",fn);const xi=vi;function Ei(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wi=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=gr,trueValue:p=fr}=o,{t:h}=G();return l().createElement(l().Fragment,null,l().createElement(O.Switch,{checked:n===p,style:s,disabled:d||t.isOnlyShow,checkedChildren:l().createElement(Ce.CheckOutlined,null),unCheckedChildren:l().createElement(Ce.CloseOutlined,null),onChange:e=>{(e=>{r?.(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 Ci extends i.Component{constructor(...e){super(...e),Ei(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(wi,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ei(Ci,"contextType",fn);const Si=Ci;function Ni(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ii=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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,onFocus:h,onBlur:f,onEnter:g}=e.option,{showCount:y,maxLength:b,autoSize:v}=o,x=Object.assign({},{minRows:1,maxRows:3},v);return l().createElement(O.Input.TextArea,{value:n,placeholder:c,style:s,maxLength:b,showCount:y,autoSize:x,bordered:d,allowClear:u,readOnly:m||t.isOnlyShow,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;n?.(t)})(n),f?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g?.(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{r?.(e),a(e)})(t)}})};class Ti extends i.Component{constructor(...e){super(...e),Ni(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ii,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ni(Ti,"contextType",fn);const Ri=Ti;function Oi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ki=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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,w=l().createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),r?.(e),a(e,S(e))},S=e=>Tr(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Ir(c()().subtract(e,"day"),Er[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return t.isOnlyShow?l().createElement(Zr,{value:S(n),bordered:m}):l().createElement(_,{ref:w,style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:xr[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,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"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:Nr(n,Er[g]),onChange:(e,t)=>{C(Ir(e,Er[g]))}})};class Pi extends i.Component{constructor(...e){super(...e),Oi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(ki,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Oi(Pi,"contextType",fn);const Li=Pi;function Ai(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fi=e=>[c()().subtract(e,"day"),c()()],_i=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:w,shortCuts:C=!0}=s,S={[i("qm.form.dateRangePickers")[0]]:Fi(7),[i("qm.form.dateRangePickers")[1]]:Fi(30),[i("qm.form.dateRangePickers")[2]]:Fi(90),[i("qm.form.dateRangePickers")[3]]:Fi(180)},N=e=>Tr(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?l().createElement(Zr,{value:N(n),bordered:m}):l().createElement(_.RangePicker,{style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:xr[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,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w])),ranges:C&&g.includes("date")?S:void 0,value:le(n)?null:[Nr(n?.[0],Er[g]),Nr(n?.[1],Er[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=[]),r?.(e),a(e,N(e))})([Ir(e?.[0],Er[g]),Ir(e?.[1],Er[g])])}})};class Di extends i.Component{constructor(...e){super(...e),Ai(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(_i,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ai(Di,"contextType",fn);const Hi=Di;function qi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $i=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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(Zr,{value:n,bordered:u}):l().createElement($,{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:wr[f],value:Nr(n,wr[f]),onChange:(e,t)=>{(e=>{const t=Ir(e,wr[f]);r?.(t),a(t)})(e)}})};class Mi extends i.Component{constructor(...e){super(...e),qi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement($i,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}qi(Mi,"contextType",fn);const Ki=Mi;function zi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ji=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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=>Tr(e)?"":e.join(" - ");return t.isOnlyShow?l().createElement(Zr,{value:E(n),bordered:u}):l().createElement($.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:wr[f],value:le(n)?null:[Nr(n?.[0],wr[f]),Nr(n?.[1],wr[f])],onChange:(e,t)=>{(e=>{const t=[Ir(e?.[0],wr[f]),Ir(e?.[1],wr[f])];r?.(t),a(t,E(t))})(e)}})};class Vi extends i.Component{constructor(...e){super(...e),zi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(ji,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}zi(Vi,"contextType",fn);const Bi=Vi;function Wi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ui extends i.Component{constructor(e){super(e),Wi(this,"context",void 0),Wi(this,"searchRef",l().createRef()),Wi(this,"valueKey",void 0),Wi(this,"_clicking",!1),Wi(this,"_record",void 0),Wi(this,"_prevValue",null),Wi(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Wi(this,"getSearchHelper",hn()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),Wi(this,"paramsChangeHandler",(async(e,t)=>{await this.props.waiting(),(0,Q.isEqual)(e,t)||this.getItemList()})),Wi(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Wi(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(r||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&&!n&&pe("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),Wi(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Wi(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=(e=>e),dataKey:r,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))try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&kr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}})),Wi(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const a=Rr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])})})),Wi(this,"fetchHandle",(0,Q.debounce)(this.getItemList,200)),Wi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Wi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),Wi(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Wi(this,"clickHandle",((e,t)=>{const{$$form:n}=this.context,{fieldName:r}=this.props.option;for(const t in this.alias)t!==r&&n.SET_FIELDS_VALUE({[t]:Rr(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:Rr(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Rr(e,this.alias[r]);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||{}}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,n=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;this.paramsChangeHandler(n,t),this.echoSearchHelper()}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:n,params:r={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(n){this.setState({loading:!0});try{const l=await n(a({...r,[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:n,itemList:r,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=yr}=c,{hideHeader:b,onlySelect:v=!0}=this.searchHelper||c,x=this.searchHelper.columns||[],E=we("form-immediate"),w=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=l().createElement(O.Spin,{spinning:n},r.length?l().createElement("table",{cellSpacing:0,cellPadding:0,className:Ee()("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,r.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(ut,null));return l().createElement(o.Consumer,null,(n=>{const o={[E]:!0,[`${E}--lg`]:"large"===n?.size,[`${E}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(Zr,{value:i,bordered:m}):l().createElement(za(),{action:g?[]:["click"],popupVisible:!g&&t,popup:C,popupClassName:Ee()(o,`form-popper__${s}`),popupStyle:{minWidth:w,maxHeight:y},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,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:()=>{!r.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(r[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 n=40===e.keyCode?++t%r.length:(--t+r.length)%r.length;this.setState({activeIndex:n})}},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)}})))}))}}Wi(Ui,"contextType",fn);class Gi extends i.Component{constructor(e,{$$form:t}){super(e),Wi(this,"context",void 0),Wi(this,"promiseRef",void 0),Wi(this,"state",{searchHelper:{}}),Wi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),Wi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Ui,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Wi(Gi,"contextType",fn);const Yi=Gi;function Xi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Qi extends i.Component{constructor(...e){super(...e),Xi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,fieldName:r,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===r))??[],n=c??t.length-1;t.slice(n+1).forEach((t=>{const n=d.find((e=>e.fieldName===t.fieldName));if(!n)return;const r=n.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&m.push({...t,text:`${r}${a}`})}))}return l().createElement(O.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},l().createElement(Ne,{id:r,label:n,className:a,extra:m.map((e=>e.text)).join(" | "),style:{...i},collapse:s[r],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[r]:t})}))),u(t)}}))}}Xi(Qi,"contextType",fn);const Zi=Qi;function Ji(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},el.apply(null,arguments)}const tl=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:tl(e.children,t,n,r)}:e)),nl=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,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=yr,checkStrictly:w,checkStrategy:C="SHOW_CHILD",collapseTags:S,defaultExpandAll:N=!g,defaultExpandedKeys:I,dropdownStyle:T,openPyt:R=!0}=u,[k,P]=l().useState(le(v)?r:v),L=l().useRef(k);qe((()=>{const e=le(v)?r:v;g?(0,Q.isEqual)(e,L.current)||(P(e),L.current=e):P(e)}),[v,r]);const A=e=>Lr(k,e)?.text||e?.toString()||"",F=e=>a?e?.map((e=>A(e))).join(",")||"":A(e);return t.isOnlyShow?l().createElement(Zr,{value:F(n),bordered:h}):l().createElement(O.TreeSelect,el({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:a,treeCheckable:a,treeCheckStrictly:w,showCheckedStrategy:O.TreeSelect[C],popupClassName:`form-popper__${d}`,dropdownStyle:T,placeholder:p,listHeight:E,style:m,loading:i,bordered:h,allowClear:f,disabled:b,treeDefaultExpandAll:N,treeDefaultExpandedKeys:I,showSearch:x,maxTagCount:S?"responsive":void 0,loadData:g?async({key:e,children:t})=>{if(!g||t)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=g;if(n)try{const t=await n(s({...r,[l]:e}));if(200===t.code){const n=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[],r=tl(k,e,l,Pr(n,l,i));P(r),o?.(n)}}catch(e){}}:void 0,treeData:k},a?{title:F(n)}:null,{filterTreeNode:(e,t)=>{const n=t?.text?.toString()||"",r=Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,F(e),k)})(e)}}))};class rl extends i.Component{constructor(...e){super(...e),Ji(this,"context",void 0),Ji(this,"state",{itemList:[],loading:!1}),Ji(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=Pr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,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:Ee()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(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(nl,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(O.Col,{flex:de(m.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...m}))))}}Ji(rl,"contextType",fn);const al=rl;function il(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ll(){return ll=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ll.apply(null,arguments)}const ol=e=>{const{$$form:t}=l().useContext(fn),{value:n,multiple:r,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:w=!0}=s,[C,S]=l().useState(le(g)?a:g),N=l().useRef(C);qe((()=>{const e=le(g)?a:g;p?(0,Q.isEqual)(e,N.current)||(S(e),N.current=e):S(e)}),[g,a]);const I=e=>Ar(C,e??"").map((e=>e.text)).join("/"),T=e=>r?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?l().createElement(Zr,{value:T(n),bordered:u}):l().createElement(O.Cascader,ll({value:(e=>le(e)?[]:r?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:C,multiple:r,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 n=t?.text?.toString()||"",r=Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?async e=>{const t=e[e.length-1];if(!p||t.children)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=p;if(n)try{const e=await n(s({...r,[l]:t.value}));if(200===e.code){const n=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[],r=tl(C,t.value,l,Pr(n,l,i));S(r),o?.(n)}}catch(e){}}:void 0},r?{title:T(n)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;n?.(t),r(t,T(t),C)})(((e=[])=>r?e.map((e=>e.join(","))):e.join(","))(t))}}))};class sl extends i.Component{constructor(...e){super(...e),il(this,"context",void 0),il(this,"state",{itemList:[],loading:!1}),il(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=Pr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:n}=this.state,{type:r,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:Ee()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(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(ol,{option:this.props.option,multiple:t,items:n,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(O.Col,{flex:de(m.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...m}))))}}il(sl,"contextType",fn);const cl=sl,dl=require("china-area-data");var ul=r.n(dl);function ml(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pl=["110000","120000","310000","500000"],hl=["810000","820000"],fl=[{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"}],gl=[{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"}],yl=e=>Xr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),bl=(e,t,n=1)=>{if(!(n>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...pl,...hl].includes(e))):Object.keys(e[t])).map((r=>({l:yl(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:bl(e,r,n+1)})))},vl=(e,t)=>t.map((t=>({l:yl(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class xl extends i.Component{constructor(e){super(e),ml(this,"context",void 0),ml(this,"searchRef",l().createRef()),ml(this,"scrollRef",l().createRef()),ml(this,"zxsAndGa",void 0),ml(this,"provinces",void 0),ml(this,"allCities",void 0),ml(this,"letterCities",void 0),ml(this,"state",{visible:!1,select_type:"0",active_key:""}),ml(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ml(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(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:vl(ul(),pl)},{l:"Z2",n:"港澳",c:"",p:"",children:vl(ul(),hl)}]}createProvince(){return(bl(ul(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return gl.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...pl,...hl].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?fl:gl).map((t=>l().createElement("li",{key:t.value,className:Ee()({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,n)=>l().createElement("div",{key:n},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:Ee()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=we("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(n),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(n)))));return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(Zr,{value:g,bordered:c}):l().createElement(za(),{action:m?[]:["click"],popupVisible:!m&&t,popup:y,popupClassName:Ee()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,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)}})))}))}}ml(xl,"contextType",fn);class El extends i.Component{constructor(...e){super(...e),ml(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(xl,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ml(El,"contextType",fn);const wl=El;function Cl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sl=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Sl(e,n)})))};class Nl extends i.Component{constructor(e){super(e),Cl(this,"context",void 0),Cl(this,"searchRef",l().createRef()),Cl(this,"prevText",void 0),Cl(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Cl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Sl(ul(),"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:n}=this.props;t!==n&&this.state.values.join(",")!==(n??"")&&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 n=this.state.tabs.slice(0,1);for(let r=0;r<t.length;r++){const a=Lr(e,t[r]);if(a&&le(a.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(a?.children)&&(n[r+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:n,formatter:r=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(n)try{const t=await n(r({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,n)=>{const r=t.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return l().createElement(tn.TabPane,{key:n.toString(),tab:r},l().createElement("div",{className:"region-box"},t.map((t=>l().createElement("span",{key:t.value,className:Ee()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[n]=t.value.toString(),e=e.slice(0,n+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(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},t.text)))))}));return t.length?l().createElement(tn,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):l().createElement(ut,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=we("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(n);(""===e||e.split("/").every((e=>""!==e)))&&(y=e,this.prevText=y)}return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(Zr,{value:y,bordered:c}):l().createElement(za(),{action:m?[]:["click"],popupVisible:!m&&t,popup:g,popupClassName:Ee()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,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()))}})))}))}}Cl(Nl,"contextType",fn);class Il extends i.Component{constructor(...e){super(...e),Cl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Nl,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Cl(Il,"contextType",fn);const Tl=Il;function Rl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ol=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:w}=i,{action:C,headers:S,params:N,withCredentials:I=!1,dataKey:T="",downloadWithHeaders:R,fieldAliasMap:k,beforeUpload:P,button:L}=o,A="function"==typeof k?k():k||{},{t:F}=G();return l().createElement(po,{name:"file",action:C,multiple:d,headers:S,data:N,withCredentials:I,downloadWithHeaders:R,beforeUpload:P,maxCount:u,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,button:L,showUploadList:{showDownloadIcon:!0,downloadIcon:l().createElement(Ce.DownloadOutlined,null)},fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in A)n[r]=e[r]||t.data?.[A[r]]||"";return e.response&&200!==t.code&&O.message.error(t.message||F("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(T?(0,Q.get)(t.data,T):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onPreview:b,onDownload:v,onRemove:x,onSortChange:E,onEditChange:w})};class kl extends i.Component{constructor(...e){super(...e),Rl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ol,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Rl(kl,"contextType",fn);const Pl=kl;function Ll(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Al=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:w,withCredentials:C=!1,dataKey:S="",popupClassName:N,fieldAliasMap:I,beforeUpload:T}=o,R="function"==typeof I?I():I||{},{t:k}=G();return l().createElement(yo,{name:"file",action:x,multiple:d,headers:E,data:w,withCredentials:C,popupClassName:N,beforeUpload:T,maxCount:u,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in R)n[r]=e[r]||t.data?.[R[r]]||"";return e.response&&200!==t.code&&O.message.error(t.message||k("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(S?(0,Q.get)(t.data,S):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onRemove:b,onSortChange:v})};class Fl extends i.Component{constructor(...e){super(...e),Ll(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Al,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ll(Fl,"contextType",fn);const _l=Fl;function Dl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hl=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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(oo,{value:n,tinymce:u,upload:o,thresholdSize:m,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{r?.(e),a(e)})(e)}})};class ql extends i.Component{constructor(...e){super(...e),Dl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Hl,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Dl(ql,"contextType",fn);const $l=ql;function Ml(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Kl extends i.Component{constructor(e){super(e),Ml(this,"context",void 0),Ml(this,"provide",{$$form:this,echo_data:{}}),Ml(this,"_initialValues",void 0),Ml(this,"_initialOthers",void 0),Ml(this,"_initialExtras",void 0),Ml(this,"_fieldAuth",{}),Ml(this,"wrapperRef",l().createRef()),Ml(this,"formRef",l().createRef()),Ml(this,"originItems",[]),Ml(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Ml(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})})),Ml(this,"resizeListenerHandle",(0,Q.debounce)(this.resizeObserveHandler,10)),Ml(this,"getFormItems",hn()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Ml(this,"getFlattenItems",hn()((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}))),Ml(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Ml(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Ml(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Ml(this,"finishFailedHandle",(({values:e,errorFields:t})=>{this.props.onFinishFailed?.(t)})),Ml(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})})),Ml(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(){vt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){xt(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)),n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return Object.assign({},n)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,Q.isPlainObject)(e.extra))).forEach((n=>{t[n.fieldName]=e[n.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:n,options:r}=e;return t=t??void 0,br.includes(n)&&(t=t??[]),"CHECKBOX"!==n&&"SWITCH"!==n||(t=t??r?.falseValue??gr),t}createFormValue(e){const t={};return this.flattenItems.forEach((n=>{t[n.fieldName]=this.getInitialValue(n,e[n.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=ce(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((n=>({viewData:Object.assign({},n.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:n}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!n||setTimeout((()=>this.CREATE_FOCUS(n)))}getFormItemLabel(e){if(Fr(e))return _r(e);if((0,Q.isPlainObject)(e)){const{fieldName:t,label:n,options:r={}}=e;if(Fr(n))return _r(n);const{itemList:a=[]}=r,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,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){if("DIVIDER"===e)return!0;const n=this.getBlockDerivedItems();for(let e=0,r=n.length;e<r;e++){const r=n[e],a=this.dividers.find((e=>e.fieldName===r[0].fieldName)),i=a?.collapse?.showLimit??r.length-1;for(let e=1;e<r.length;e++)if(r[e].fieldName===t&&e>i)return this.state.expand[r[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const n=e[t];if(Tr(n)&&(e[t]=""),Array.isArray(n)&&n.forEach(((n,r)=>{Tr(n)&&(e[t][r]="")})),t.includes("|")&&Array.isArray(n)){const[r,a]=t.split("|");e[r]=n[0]??"",e[a]=n[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=se(e,["fetch"]);if(e.fetch){const{api:n,params:r,dataKey:a}=e.fetch;try{const e=await n(r);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:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const t=this.originItems.find((e=>e.fieldName===n)),{visible:a=1,disabled:i,secretName:l}=r;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(n,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return l().createElement(fa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return l().createElement(va,{option:e})}INPUT_NUMBER(e){return l().createElement(Na,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return l().createElement(Oa,{option:e})}SEARCH_HELPER(e){return l().createElement(_a,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return l().createElement(Wa,{option:e})}TREE_TABLE_HELPER(e){return l().createElement(Qa,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return l().createElement(ri,{option:e})}RANGE_SEARCH_HELPER(e){return l().createElement(si,{option:e})}CHECKBOX(e){return l().createElement(sa,{option:e})}MULTIPLE_CHECKBOX(e){return l().createElement(mi,{option:e})}RATE(e){return l().createElement(gi,{option:e})}RADIO(e){return l().createElement(xi,{option:e})}SWITCH(e){return l().createElement(Si,{option:e})}TEXT_AREA(e){return l().createElement(Ri,{option:e})}DATE(e){return l().createElement(Li,{option:e})}RANGE_DATE(e){return l().createElement(Hi,{option:e})}TIME(e){return l().createElement(Ki,{option:e})}RANGE_TIME(e){return l().createElement(Bi,{option:e})}SELECT(e){return l().createElement(aa,{option:e})}MULTIPLE_SELECT(e){return l().createElement(aa,{option:e,multiple:!0})}IMMEDIATE(e){return l().createElement(Yi,{option:e})}DIVIDER(e){return l().createElement(Zi,{option:e})}TREE_SELECT(e){return l().createElement(al,{option:e})}MULTIPLE_TREE_SELECT(e){return l().createElement(al,{option:e,multiple:!0})}CASCADER(e){return l().createElement(cl,{option:e})}MULTIPLE_CASCADER(e){return l().createElement(cl,{option:e,multiple:!0})}CITY_SELECT(e){return l().createElement(wl,{option:e})}REGION_SELECT(e){return l().createElement(Tl,{option:e})}UPLOAD_FILE(e){return l().createElement(Pl,{option:e})}UPLOAD_IMG(e){return l().createElement(_l,{option:e})}TINYMCE(e){return l().createElement($l,{option:e})}renderFormLabel(e){if(Fr(e)||!(0,Q.isPlainObject)(e))return e;const{type:t,fieldName:n,label:r,options:a={},onChange:i=te}=e,{itemList:o=[]}=a;return"SELECT"===t?l().createElement(O.Form.Item,{name:n,noStyle:!0},l().createElement(na,{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}},r),l().createElement(O.Form.Item,{name:n,noStyle:!0},l().createElement(la,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:n,style:r={},render:a}=e,{extra:i}=this.state;if(n)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:r},l().createElement("span",{className:"extra-overflow-cut"},a?a(o,this):i[t]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),r="function"==typeof t?t(n):t;return this.isOnlyShow?null:r}renderFormItem(e){const{label:t,fieldName:n,invisible:r,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:n,rules:c,tooltip:a,hidden:r,className:Ee()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":de(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},this.formRef.current?u(e,this):null)}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:n,isFieldsDefine:r}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<n;e++)a.push({})}));const i=24/e,o=[],s=a.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,d=[],u=a.map(((t,n)=>{let{selfCol:r=1}=t;const{type:a,fieldName:s}=t;r=r>=24||"DIVIDER"===a||"TINYMCE"===a?e:r;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(o[n]),l().createElement(O.Col,{key:s??n,className:s,span:r*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},a?this.createFormItem(ce(t)):null)}));return r&&"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:n}=this.state,{searchButtonCols:r,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/t,s=r||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(ge,{type:"primary",size:this.$size,icon:l().createElement(Ce.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),l().createElement(ge,{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(!n)},n?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const r=24/e;return n&&"default"===t?l().createElement(O.Row,{gutter:0},l().createElement(O.Col,{key:"-",span:r},l().createElement(O.Form.Item,null,l().createElement(O.Space,{style:{marginBottom:12}},l().createElement(ge,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),l().createElement(ge,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:n}=this.props;return l().createElement(ua,{uniqueKey:e,items:t,fieldsChange:n})}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[n,r]=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:[]})));n||a.length?t((n||[]).concat(a)):e(r)}))}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),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),a={};return r.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,n){const{items:r,fieldsChange:a}=this.props,i=r.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 n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||(0,Q.set)(i,n,t[n]));n&&(a?a([...r]):pe("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:n,disabled:r,labelWidth:a,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=we("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:Ee()(u,e),style:t},l().createElement(O.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:i,labelWrap:o,colon:!1,disabled:r,labelCol:{flex:this.verticalLayout?"initial":de(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},l().createElement(fn.Provider,{value:this.provide},l().createElement(O.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Ml(Kl,"contextType",o),Ml(Kl,"propTypes",Cr),Ml(Kl,"defaultProps",Sr);const zl=Kl,jl={onActivate:ur.func,onAddUndo:ur.func,onBeforeAddUndo:ur.func,onBeforeExecCommand:ur.func,onBeforeGetContent:ur.func,onBeforeRenderUI:ur.func,onBeforeSetContent:ur.func,onBeforePaste:ur.func,onBlur:ur.func,onChange:ur.func,onClearUndos:ur.func,onClick:ur.func,onContextMenu:ur.func,onCommentChange:ur.func,onCopy:ur.func,onCut:ur.func,onDblclick:ur.func,onDeactivate:ur.func,onDirty:ur.func,onDrag:ur.func,onDragDrop:ur.func,onDragEnd:ur.func,onDragGesture:ur.func,onDragOver:ur.func,onDrop:ur.func,onExecCommand:ur.func,onFocus:ur.func,onFocusIn:ur.func,onFocusOut:ur.func,onGetContent:ur.func,onHide:ur.func,onInit:ur.func,onKeyDown:ur.func,onKeyPress:ur.func,onKeyUp:ur.func,onLoadContent:ur.func,onMouseDown:ur.func,onMouseEnter:ur.func,onMouseLeave:ur.func,onMouseMove:ur.func,onMouseOut:ur.func,onMouseOver:ur.func,onMouseUp:ur.func,onNodeChange:ur.func,onObjectResizeStart:ur.func,onObjectResized:ur.func,onObjectSelected:ur.func,onPaste:ur.func,onPostProcess:ur.func,onPostRender:ur.func,onPreProcess:ur.func,onProgressState:ur.func,onRedo:ur.func,onRemove:ur.func,onReset:ur.func,onSaveContent:ur.func,onSelectionChange:ur.func,onSetAttrib:ur.func,onSetContent:ur.func,onShow:ur.func,onSubmit:ur.func,onUndo:ur.func,onVisualAid:ur.func,onSkinLoadError:ur.func,onThemeLoadError:ur.func,onModelLoadError:ur.func,onPluginLoadError:ur.func,onIconsLoadError:ur.func,onLanguageLoadError:ur.func},Vl={apiKey:ur.string,id:ur.string,inline:ur.bool,init:ur.object,initialValue:ur.string,onEditorChange:ur.func,value:ur.string,tagName:ur.string,cloudChannel:ur.string,plugins:ur.oneOfType([ur.string,ur.array]),toolbar:ur.oneOfType([ur.string,ur.array]),disabled:ur.bool,textareaName:ur.string,tinymceScriptSrc:ur.string,rollback:ur.oneOfType([ur.number,ur.oneOf([!1])]),scriptLoading:ur.shape({async:ur.bool,defer:ur.bool,delay:ur.number}),...jl},Bl=e=>"function"==typeof e,Wl=e=>e in jl,Ul=e=>e.substr(2),Gl=(e,t,n,r,a)=>((t,n,r,a,i,l,o)=>{const s=Object.keys(i).filter(Wl),c=Object.keys(l).filter(Wl),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=Ul(e),n=o[t];r(t,n),delete o[t]})),u.forEach((r=>{const a=((t,n)=>r=>t(n)?.(r,e))(t,r),i=Ul(r);o[i]=a,n(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,n,r);let Yl=0;const Xl=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return Yl++,e+"_"+n+Yl+String(t)},Ql=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Zl=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Jl=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},eo=()=>({listeners:[],scriptId:Xl("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),to=(()=>{let e=eo();return{load:(t,n,r,a,i,l)=>{const o=()=>((t,n,r,a,i,l)=>{const o=n.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=r,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),n.head&&n.head.appendChild(o)})(e.scriptId,t,n,r,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=eo()}}})(),no=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function ro(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ao extends i.Component{constructor(e){super(e),ro(this,"editor",void 0),ro(this,"id",void 0),ro(this,"elementRef",void 0),ro(this,"inline",void 0),ro(this,"currentContent",void 0),ro(this,"boundHandlers",void 0),ro(this,"rollbackTimer",void 0),ro(this,"valueCursor",void 0),ro(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})),ro(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){}})),ro(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),ro(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))}})),ro(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),ro(this,"initialise",((e=0)=>{const t=this.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,n=e.parentNode;for(;null!=n;)t=n,n=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 n=no(this.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const r={...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,Zl(a).concat(Zl(i))),toolbar:this.props.toolbar??this.props.init?.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!Ql(t)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&Bl(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 n=this.props.disabled??!1;Jl(this.editor,n?"readonly":"design"),this.props.init&&Bl(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}};var a,i;this.inline||(t.style.visibility=""),Ql(t)&&(t.value=this.getInitialValue()),n.init(r)})),this.id=this.props.id||Xl("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 n=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const r of[t,n])if(r)try{e.selection.moveToBookmark(r),this.valueCursor=r;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Jl(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==no(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&to.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=no(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){Gl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,n=t(e),r=t(this.props);!n&&r?(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)):n&&!r&&(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))}}}ro(ao,"propTypes",Vl),ro(ao,"defaultProps",{cloudChannel:"6"});var io=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(io||{});const lo=e=>{const{className:t,style:n,tinymce:r={},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:r.height||400,plugins:r.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:r.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:r.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:io[f],skin:"tinymce-5",...se(r,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,n)=>{const{action:r,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(r&&d/1024/1024>i)try{const e=await fetch(r,{method:"POST",body:c,headers:l});if(!e.ok)throw new Error(g("qm.upload.uploadError"));const n=await e.json();200===n.code&&t(o?(0,Q.get)(n.data,o):n.data)}catch(e){O.message.error(g("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;u?.({width:n,height:r},t)}))}},b=we("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:Ee()(v,t),style:n},l().createElement(ao,x))};lo.displayName="QmTinymce";const oo=lo,so=require("cropperjs");var co=r.n(so);const uo=l().forwardRef(((e,t)=>{const n=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:r,style:a,src:i,alt:o,imgStyle:s,...c}=n,d=l().useRef(null),u=l().useRef(null);l().useEffect((()=>{const e={};for(const t in c)void 0!==n[t]&&(e[t]=n[t]);return u.current=new(co())(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),w=(e,t)=>u.current?.zoom(e),C=(e,t)=>u.current?.zoomTo(e,t),S=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),O=(e=!1)=>u.current?.getData(e),k=e=>u.current?.setData(e),P=()=>u.current?.getContainerData(),L=()=>u.current?.getImageData(),A=()=>u.current?.getCanvasData(),F=e=>u.current?.setCanvasData(e),_=()=>u.current?.getCropBoxData(),D=e=>u.current?.setCropBoxData(e),H=(e={})=>u.current?.getCroppedCanvas(e),q=e=>u.current?.setAspectRatio(e),$=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:w,zoomTo:C,rotate:S,rotateTo:N,scaleX:I,scaleY:T,scale:R,getData:O,setData:k,getContainerData:P,getImageData:L,getCanvasData:A,setCanvasData:F,getCropBoxData:_,setCropBoxData:D,getCroppedCanvas:H,setAspectRatio:q,setDragMode:$})));const M=we("cropper"),K={[M]:!0};return l().createElement("div",{className:Ee()(K,r),style:a},l().createElement("img",{ref:d,src:i,alt:o,style:{maxWidth:"100%",...s}}))}));uo.displayName="Cropper";const mo=uo,po=Ht,ho=e=>{const{fileTypes:t=[],fileSize:n,fixedSize:r,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=we("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:n,...r}=t.props;return d.current=n,l().createElement(t.type,{...r,beforeUpload:(e,t)=>new Promise((async(n,r)=>{const a=()=>n(O.Upload.LIST_IGNORE);if(i&&!await i(e,t))return void a();u.current=e,m.current=n,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:Ee()(v,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{(async()=>{const{type:e,name:n,uid:r}=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],n,{type:e});if(Object.assign(i,{uid:r}),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 pe("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),e,a),await re(100),b()})()},onCancel:b,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:r?`calc(380px * ${r[1]/r[0]})`:"auto"};return l().createElement("div",{className:"cropper-preview"},l().createElement("div",{className:"cropper-area"},l().createElement("div",{className:"img-cropper"},l().createElement(mo,{ref:c,aspectRatio:r?r[0]/r[1]:r,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 fo(){return fo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fo.apply(null,arguments)}const go=e=>{const t=h({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:n=[],openCropper:r=!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),w=l().useRef(null),C=l().useRef(!1),[S,N]=l().useState(!1),[I,T]=l().useState(0),R=l().useMemo((()=>u||m),[u,m]),k=l().useMemo((()=>!c||n.length<c),[n,c]);l().useEffect((()=>(L(),document.addEventListener("paste",F),()=>{w.current?.destroy(),document.removeEventListener("paste",F)})),[]),qe((()=>{k||(C.current=!1)}),[n]);const P=Y((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),y?.(e),b?.({file:n[t],fileList:e})}})),L=()=>{d&&(w.current=kt().create(Ue(E.current,we("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:P}))},A=(e,n)=>new Promise((async(r,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,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(e)})),F=Y((async e=>{const{action:r,data:a,headers:i}=t;if(C.current&&k&&r)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 A(o,[...n,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 r?r:await r(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:[...n,{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){}}})),_=we("upload-img"),D={[_]:!0,[`${_}--lg`]:"large"===x,[`${_}--sm`]:"small"===x},H=l().createElement(O.Upload,fo({className:Ee()(D,p)},se(t,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:A,disabled:R,onPreview:e=>{const t=n.findIndex((t=>t.url===e.url));t<0||(T(t),N(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,n,r)=>l().createElement("div",{className:Ee()("upload-item",{handle:d})},e,!R&&l().createElement(Ce.CloseOutlined,{title:v("qm.upload.remove"),className:"icon",onClick:()=>r.remove()}))}),l().createElement("span",{className:"inner",ref:E},k&&!(m&&n.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:Ee()("ant-upload-button",{disabled:R}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{C.current=!0},onBlur:()=>{C.current=!1}},v("qm.uploadCropper.pasteText")))));return l().createElement(l().Fragment,null,r?l().createElement(ho,{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:n.map((e=>e.uid||"")).join(","),preview:{visible:S,current:I,rootClassName:f,onVisibleChange:e=>N(e)}},n.map(((e,t)=>l().createElement(O.Image,{key:e.uid||t,src:e.url,alt:""}))))))};go.displayName="QmUploadImg";const yo=go,bo=(e,t,n)=>{let r;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[n]===t)))r=i[n];else{const e=bo(i.children,t,n);e&&(r=e)}}return r},vo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vo(e.children,t),t(e)||e.children&&e.children.length))),xo=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...xo(e.children,t)),t(e)&&n.push(e)})),n},Eo=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Eo(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},wo=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:wo(e.children,t,n,r)}:e)),Co=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Co(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},So=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][n]===t)return[t];if(Array.isArray(e[r].children)){const a=So(e[r].children,t,n);if(a)return[e[r][n],a].flat()}}},No=(e,t)=>{const n=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>n.push(...No(e,t)))),n},Io=l().forwardRef(((e,t)=>{const{className:n,style:r,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:w=!0,showCollapse:C=!0,onSelectChange:S,onCheckChange:N,onDragStart:I,onDragChange:T,onExpand:R}=e,{$size:k}=X(e),{t:P}=G(),L=f?.valueKey||"value",A=f?.textKey||"text",F=l().useRef(null),_=l().useRef(null),D=Et(F),[H,q]=l().useState(b),[$,M]=l().useState(!1),K=wt((()=>{q(F.current.offsetHeight-re.current.offsetHeight-10)}),5);g((()=>{b||K()}),[D.height]);const[z,j]=l().useState([]),[V,B]=l().useState({}),[W,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),[te,ne]=l().useState(E),re=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()}),[]),qe((()=>{ue()}),[c?.params]),qe((()=>{Z(de())}),[V]),l().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=Eo(z,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],oe([...z]))},REMOVE_RECORD:e=>{const t=bo(z,e,L);if(void 0===t&&z.find((t=>t[L]===e)))oe(z.filter((t=>t[L]!==e)));else{const n=Eo(z,(e=>t===e[L]));if(!n)return;const r=n.children?.findIndex((t=>e===t[L]));r>=0&&(n.children.splice(r,1),oe([...z]))}},UPDATE_RECORD:(e,t)=>{const n=Eo(z,(t=>e===t[L]));n&&((0,Q.merge)(n,t),oe([...z]))}})));const oe=e=>{j(e),ae.current=e,ie.current=Co(e,L)},se=e=>{if(i)return v;const t=xo(e,(e=>v.includes(e[A])));return 1===t.length?[t[0][L]]:[]},ce=e=>So(z,e,L)?.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 n=Lr(z,t);if(n){const r=ce(t),a=No(n,L);e.push(...r,...[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:n,afterFetch:r,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,n)??[];e="function"==typeof r?await r(e):e,oe(e),U(se(e)),B({}),a?.(e)}}catch(e){}M(!1)},me=e=>`${e}|${Xr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,pe=we("search-tree"),he={[pe]:!0,[`${pe}--lg`]:"large"===k,[`${pe}--sm`]:"small"===k};return l().createElement("div",{ref:F,className:Ee()(he,n),style:r},l().createElement("div",{ref:re,className:"topper"},w&&l().createElement(O.Input,{ref:_,value:J,size:k,placeholder:h||P("qm.form.inputPlaceholder"),suffix:l().createElement(Ce.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=vo(ae.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==me(n).indexOf(e)}));ee(e),j(t),Z(E||e?Co(t,L):de())})(e.target.value)}),C&&l().createElement("a",{className:"trigger",onClick:()=>{ne(!te),Z(te?[]:ie.current)}},te?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)," ",P(te?"qm.form.collect":"qm.form.spread"))),l().createElement(pt,{spinning:$},l().createElement(O.Tree,{fieldNames:{title:A,key:L,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:z,loadData:u?async({key:e,children:t})=>{if(!c||t)return;const{api:n,params:r,dataKey:a,formatter:i=(e=>e),afterFetch:l}=c;try{const t=await n(i({...r,[L]:e}));if(200===t.code){let n=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[];n="function"==typeof l?await l(n):n;const r=wo(ae.current,e,L,n);oe(r)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!J)return!1;const t=e[A]||"";return-1!==me(t).indexOf(J)},onDragStart:I,onDragEnter:e=>{Z(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),a=e.dropPosition-Number(r[r.length-1]),i=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][L]===t)return n(e[r],r,e);e[r].children&&i(e[r].children,t,n)}},l=[...z];let o;if(i(l,n,((e,t,n)=>{n.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,n=[];i(l,t,((t,r,a)=>{n=a,e=r})),-1===a?n.splice(e,0,o):n.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));oe(l)},onDragEnd:e=>{T?.(e,z)},onExpand:(e,t)=>{le(e)&&ne(!1),ie.current.every((t=>e.includes(t)))&&ne(!0),Z(e),R?.(e,t)},onSelect:e=>{U(e);const t=xo(ae.current,(t=>e.includes((0,Q.get)(t,L))));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,n)=>!n.includes(bo(z,e,L))))));const t=xo(ae.current,(t=>e.includes((0,Q.get)(t,L))));N?.(i?t:t[0])}})))}));Io.displayName="QmSearchTree";const To=Io,Ro=(0,i.createContext)(void 0),Oo={dataIndex:mr().string.isRequired,title:mr().string.isRequired,description:mr().string,colSpan:mr().number,width:mr().number,minWidth:mr().number,fixed:mr().oneOf(["left","right"]),align:mr().oneOf(["left","center","right"]),theadAlign:mr().oneOf(["left","center","right"]),printFixed:mr().bool,hidden:mr().bool,noAuth:mr().bool,noFixed:mr().bool,ellipsis:mr().bool,className:mr().string,theadClassName:mr().string,children:mr().array,sorter:mr().oneOfType([mr().bool,mr().func]),filter:mr().shape({type:mr().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:mr().arrayOf(mr().shape({text:mr().string,value:mr().oneOfType([mr().string,mr().number])})),style:mr().object}),precision:mr().number,displayPrecision:mr().number,formatType:mr().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:mr().bool,canCopy:mr().bool,editRender:mr().func,dictItems:mr().arrayOf(mr().shape({text:mr().string,value:mr().oneOfType([mr().string,mr().number])})),summation:mr().shape({sumBySelection:mr().bool,displayWhenNotSelect:mr().bool,dataKey:mr().string,unit:mr().string,render:mr().func}),groupSummary:mr().shape({dataKey:mr().string,unit:mr().string,render:mr().func}),shouldCellUpdate:mr().func,headRender:mr().func,render:mr().func},ko=(mr().arrayOf(mr().shape(Oo)).isRequired,mr().func,mr().array,mr().oneOfType([mr().string,mr().func]).isRequired,mr().number,mr().bool,mr().bool,mr().shape({api:mr().func.isRequired,params:mr().object.isRequired,formatter:mr().func,beforeFetch:mr().func,afterFetch:mr().func,stopToFirst:mr().bool,dataKey:mr().string,callback:mr().func}),mr().bool,mr().bool,mr().string,mr().string,mr().object,mr().bool,mr().bool,mr().bool,mr().oneOfType([mr().object,mr().func]),mr().oneOfType([mr().object,mr().func]),mr().array,mr().func,mr().bool,mr().object,mr().object,mr().shape({type:mr().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:mr().array,selectedRowKeys:mr().array,hideSelectAll:mr().bool,checkStrictly:mr().bool,filterable:mr().bool,selectByClickRow:mr().bool,selectFirstRowOnChange:mr().bool,clearableAfterFetched:mr().bool,selectAllOnCurrentPage:mr().bool,fetchSelectedRows:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),fetchAllRowKeys:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),disabled:mr().func,onChange:mr().func,onSelect:mr().func,onSelectAll:mr().func}),mr().shape({currentRowKey:mr().oneOfType([mr().number,mr().string]),disabled:mr().func,onChange:mr().func}),mr().shape({virtual:mr().bool,overscan:mr().number,doubleXScrollbar:mr().bool}),mr().shape({expandIconColumn:mr().string}),mr().shape({defaultExpandAllRows:mr().bool,defaultExpandedRowKeys:mr().array,expandedRowKeys:mr().array,hideExpandAll:mr().bool,rowExpandable:mr().func,expandedRowClassName:mr().string,expandedRowRender:mr().func,onExpand:mr().func,onChange:mr().func}),mr().shape({cellMerge:mr().bool,onCellMerge:mr().func,onSelectChange:mr().func}),mr().shape({groupItems:mr().arrayOf(mr().shape({dataIndex:mr().string.isRequired,titleIndex:mr().string,color:mr().string,backgroundColor:mr().string})),fetch:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),onChange:mr().func}),mr().func,mr().bool,mr().bool,mr().bool,mr().bool,mr().shape({current:mr().number,pageSize:mr().number,pageSizeOptions:mr().array,showSizeChanger:mr().bool,showQuickJumper:mr().bool}),mr().shape({fileName:mr().string,fetch:mr().shape({api:mr().func.isRequired,params:mr().object}),beforeExport:mr().func,cellStyle:mr().bool,hideIcon:mr().bool}),mr().shape({showLogo:mr().bool}),mr().shape({fetch:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),fieldList:mr().arrayOf(mr().object)}),mr().shape({position:mr().oneOf(["top","bottom"]),hideAlert:mr().bool,hideClearButton:mr().bool}),mr().oneOf(["left","right"]),mr().func,mr().func,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().func,mr().func,mr().func,mr().func,mr().func,mr().func,mr().func,mr().func,mr().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,Lo="1",Ao="0",Fo="YYYY-MM-DD",_o="YYYY-MM-DD HH:mm:ss",Do="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 qo=function(e){return e.left="flex-start",e.right="flex-end",e}({});const $o={...i}.useId;let Mo=0;const Ko=$o?function(e){const t=$o();return e||t}:function(e){const[t]=i.useState(`qm_unique_${Mo}`);return i.useEffect((()=>{Mo+=1}),[]),e||t};let zo=[];const jo={_getInstance:function(e){return zo.find((t=>t.id===e))??null},getFocusInstance:function(){return zo[0]??null},focus:function(e){const t=this._getInstance(e);t&&0!==zo.findIndex((e=>e===t))&&(this.deregister(e),zo=[t,...zo])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),zo=[{id:e,vm:t},...zo])},deregister:function(e){e&&(zo=zo.filter((t=>t.id!==e)))}};function Vo(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Bo=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)}},Wo={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:100,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored",popupClassName:"table-editable__popper"};function Uo(e){return void 0!==e}function Go(e,t){const{defaultValue:n,value:r,onChange:a,postState:l}=t||{},[o,s]=i.useState((()=>Uo(r)?r:Uo(n)?"function"==typeof n?n():n:"function"==typeof e?e():e)),c=Uo(r)?r: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((()=>{Uo(r)||s(r)}),[r]),[d,Y((e=>{s(e),p([c])}))]}const 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:n,columns:r,border:a,rowSelection:i,summation:o,expandable:s,treeConfig:c,webPagination:d,scrollPagination:u,showSuperSearch:m,showFastSearch:p,showGroupSummary:h,showTableImport:f,showClipboard:g,showSelectCollection:y,showPivotGrid:b,footRender:v}=e,{tableRef:x,getRowKey:E,tableFullData:w,tableFlatData:C,selectionKeys:S,sorter:N,filters:I,superFilters:T,pagination:R,mergedTdCells:O}=t,{selectionRows:k,summaries:P}=x.current,{expandIconColumn:L=""}=c||{},{t:A}=G(),F=(e,t,n,r,a)=>{const i=`${t},${n}`;e.has(i)||e.set(i,{row:t,col:n,rowSpan:r,colSpan:a})},_=l().useMemo((()=>!!n?.api),[n?.api]),D=l().useMemo((()=>!_&&!!d),[_,d]),H=l().useMemo((()=>_&&!!u),[_,u]),q=l().useMemo((()=>(_||D)&&!H),[_,D,H]),$=l().useMemo((()=>(e=>{const t=(e=>{const t=[],n=[],r=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?n.push(i):r.push(i)}return[...t,...r,...n]})(Yo(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Wo.selectionColumn,title:"radio"===t?A("qm.table.config.selectionText"):"",width:Wo.selectionColumnWidth,fixed:"left",type:t}})(i),r=(a=s,a?.expandedRowRender?{dataIndex:Wo.expandableColumn,title:"",width:Wo.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return n&&t.unshift(n),r&&t.unshift(r),kn(t)})(r)),[r]),M=l().useMemo((()=>On($)),[$]),K=l().useMemo((()=>M.filter((e=>"function"==typeof e.editRender))),[M]),z=l().useMemo((()=>M.filter((e=>!!e.summation))),[M]),j=l().useMemo((()=>M.filter((e=>"left"===e.fixed))),[M]),V=l().useMemo((()=>M.filter((e=>"right"===e.fixed))),[M]),B=l().useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=C.findIndex((t=>E(t,t.index)===e.rowKey)),r=M.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){F(t,n,r,e.rowSpan,e.colSpan);for(let a=0;a<e.rowSpan;a++)for(let i=0;i<e.colSpan;i++)0===a&&0===i||F(t,n+a,r+i,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(O)),[O,M,w]),W=l().useMemo((()=>{const e=M.filter((e=>![Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn].includes(e.dataIndex)));return L&&e.some((e=>e.dataIndex===L))?L:e[0]?.dataIndex??""}),[M,L]),U=l().useMemo((()=>z.length>0),[z]),Y=l().useMemo((()=>!!v||U),[v,U]),X=l().useMemo((()=>Mn($).length>1),[$]),Q=l().useMemo((()=>a||X),[a,X]),Z=l().useMemo((()=>M.some((e=>e.sorter))),[M]),J=l().useMemo((()=>M.some((e=>e.filter))),[M]),ee=l().useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),te=l().useMemo((()=>!_&&!!f),[_,f]),ne=l().useMemo((()=>!!g&&K.length>0),[g,K]),re=l().useMemo((()=>!!y&&"checkbox"===i?.type),[y,i]),ae=l().useMemo((()=>!!m&&J),[m,J]),ie=l().useMemo((()=>!_&&!!p&&J),[_,p,J]),le=l().useMemo((()=>!_&&!!b),[_,b]),oe=l().useMemo((()=>!!h&&M.some((e=>!!e.groupSummary))),[M]),se=l().useMemo((()=>!!o?.groupItems?.length),[o]),ce=l().useMemo((()=>!C.length),[C]),de=l().useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=se?rr(x.current.tableFullData):x.current.tableFullData,d=!k.length&&!!o;let u=(!l||d?c:k).reduce(((e,t)=>{if(t?.[Wo.summaryIgnore])return e;const r=Wn(t,n);return Yn(r)?e.plus(r):e}),new(Ea())(0));!Object.keys(P).includes(n)||l&&!d||(u=new(Ea())(Wn(P,n))),Un(e,n,u.toNumber());let m=r>=0?u.toFixed(r):u.toString();a>=0&&""!==m&&(m=Qn(m,a)),m=Xn(m),Un(e,`${n}_text`,s?`${m} ${s}`:m)})),[e]})()),[C,S,P]),ue=l().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),me=l().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(N),t=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,a]=Wo.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{n.push({type:a,bracketLeft:"",fieldName:r,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{n.push({type:Wo.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(I,T);return{...e?{[Wo.sorterFieldName]:e}:null,...t.length?{[Wo.filterFieldName]:t}:null,...ue?{[Wo.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[Wo.currentPageName]:R.current,[Wo.pageSizeName]:R.pageSize}}),[n?.params,R.current,R.pageSize,N,I,T,ue]);return{isFetch:_,isWebPagination:D,isScrollPagination:H,showPagination:q,tableColumns:$,flattenColumns:M,editableColumns:K,summationColumns:z,leftFixedColumns:j,rightFixedColumns:V,derivedMergeCells:B,treeExpandIndex:W,showSummary:U,showFooter:Y,isHeadGroup:X,bordered:Q,isHeadSorter:Z,isHeadFilter:J,isServiceSummation:ee,isSelectCollection:re,isTableImport:te,isTableClipboard:ne,isSuperSearch:ae,isFastSearch:ie,isPivotGrid:le,isGroupSummary:oe,isGroupSubtotal:se,isTableEmpty:ce,summationRows:de,fetchParams:me}},Qo=(e,t)=>{const{rowKey:n,height:r,dataSource:a,summation:i,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,authConfig:p,ignorePageIndex:h,columnsChange:f,onChange:y,onDataChange:b,onDataLoad:v,onScrollEnd:x,onFetchError:E}=e,{getRowKey:w,tableRef:C,tableElementRef:S,tableBodyRef:N,$size:I,tableColumns:T,flattenColumns:R,tableFullData:O,pagination:k,layout:P,filters:L,sorter:A,superFilters:F,fetchParams:_,selectionKeys:D,rowExpandedKeys:H,highlightKey:q,summationColumns:$,isFetch:M,isWebPagination:K,isScrollPagination:z,isServiceSummation:j,isGroupSubtotal:V,doLayout:B,setTableFullData:W,setTableOriginData:U,setTableFlatData:Y,setAllTableData:X,setDeriveRowKeys:Z,setPagination:J,setPingRight:ee,setPingLeft:te,setSpinning:re,setSorter:ae,setFilters:ie,setSuperFilters:oe,setSelectionKeys:ce,setRowExpandedKeys:de,setHighlightKey:ue,setSelectionRows:me,setScrollXLoad:he,setScrollYLoad:fe,setFieldAuth:ge,setResizeState:ye,setSummaries:be,setPermission:ve,setRecordsMap:xe,resetTableScroll:Ee,clearElementStore:we,clearRecordsMap:Ce}=t,{t:Se}=G(),{store:Ne}=C.current,Ie=l().useRef({..._}),Te=l().useRef(!1),Re=Et(S);g((()=>{Ae(),B()}),[T]),g((()=>{Oe()}),[Re,I,r,P.tableAutoHeight]),qe((()=>{dt(),ut(),mt(),M||(K&&rt(),Qe(a)),s&&ae(s),c&&ie(c)}),[a,o?.params]),qe((()=>{const e=Ue(_,Ie.current);e||M&&d?.clearableAfterFetched&&pt(),!e&&_[Wo.currentPageName]>1&&!o?.stopToFirst?rt():M&&Ye(),Ie.current=_}),[_]),qe((()=>{K&&lt(),z||Ee(),Ve()}),[k.current,k.pageSize]),qe((()=>{M||ke(O.length),B()}),[O]),qe((()=>{C.current.isTreeTable&&lt()}),[H]);const Oe=()=>{const{scrollBarRef:e,resizeState:t}=C.current,{width:n,height:r}=Re;B(),P.tableBodyWidth>n&&ee(!0),e.current.scrollLeft>0&&te(!0),ye(Object.assign({},t,{width:n,height:r}))},ke=e=>{e!==k.total&&J((t=>Object.assign({},t,{total:e})))},Pe=e=>{Te.current=e},Le=wt((e=>{et(),x?.(e)})),Ae=()=>{he(R.length>Wo.virtualScrollX)},Fe=(e=[])=>{let t=e.length>Wo.virtualScrollY;C.current.isTreeTable&&(t=!0),m?.virtual&&(t=!0),fe(t)},_e=e=>V?De(He(e,0)):e,De=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...De(e.children)),delete e.children,t.push(e)})),t},He=(e,t)=>{const r=i.groupItems?.[t];return r?ir(e,[r.dataIndex]).map((e=>{const a={children:He(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&Un(a,n.toString(),er()),r.titleIndex&&Un(a,r.titleIndex,Wn(e[0],r.titleIndex)),Un(a,r.dataIndex,Wn(e[0],r.dataIndex)),$.forEach((e=>{const{dataIndex:t}=e,n=a.children?.reduce(((e,n)=>{if(n[Wo.summaryIgnore])return e;const r=Number(Wn(n,t));return Number.isNaN(r)?e:e+r}),0);Un(a,t,n)})),a})):(e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e)},$e=e=>{ce(e),me((e=>{const{selectionRows:t,recordsMap:n}=C.current,r=new Map;t.forEach((e=>r.set(w(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=r.get(e[t])||n.get(e[t]);i&&a.push(i)}return a})(e))},Me=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:D;let a=[];return C.current.isTreeTable&&!n&&r.forEach((e=>{a.push(...((e,t)=>{const{disabled:n}=d||{},{deriveRowKeys:r,recordsMap:a}=C.current,i=Hn(r,e);let l=[];if(!i)return l;let o=ze(i?.children||[]);return n&&(o=o.filter((e=>!a.has(e)||!n(a.get(e))))),l=[...new Set([...t,...o])],(or(r,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Hn(r,e),n=t?.children?.every((e=>l.includes(e.rowKey)));l=n?[...l,e]:l.filter((t=>t!==e))})),l})(e,r))})),a="radio"===t?r.slice(0,1):[...new Set([...r,...a])],a},Ke=e=>{const{isTreeTable:t,allRowKeys:n,allParentRowKeys:r,deriveRowKeys:a,recordsMap:i}=C.current,{defaultExpandAllRows:l,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:H;if(l)c=(t?r:n).slice(0);else if(t){s&&pe("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];q&&e.unshift(q),e.forEach((e=>{const t=or(a,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)})),c=[...new Set(c)]}return o&&c.filter((e=>{const t=i.get(e);return!!t&&o(t)})),c},ze=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...ze(e[n].children)),t.push(e[n].rowKey);return t},je=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...je(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...je(e,n[n.length-1])),n},Ve=wt((()=>{y?.(k,We(L),Be(A),F,{currentDataSource:it()})})),Be=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},We=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,a]=n.split("|");t[Wo.showFilterType?`${r}|${a}`:r]=e[n]}return t},Ue=(e,t)=>{const n=Object.keys(Bn(e,t));return 1===n.length&&(n.includes(Wo.currentPageName)||n.includes(Wo.pageSizeName))},Ge=async()=>{if(!o)return;const{formatter:e=(e=>e),beforeFetch:t=ne,afterFetch:n,callback:r}=o;if(!t(_))return;const a=!!i?.fetch?.api;re(!0);try{const[t,l]=a?await Promise.all([o.api(e(_)),i.fetch.api(e(_))]):[await o.api(e(_))];if(C.current.unMounted)return;if(a?200===t.code&&200===l.code:200===t.code){const e=o.dataKey??Wo.dataKey;let a=(0,Q.get)(t.data,e)??[];a="function"==typeof n?await n(a):a;const i=(0,Q.get)(t.data,e.replace(/[^.]+$/,Wo.totalKey))||a.length||0,s=Math.max(Math.ceil(i/k.pageSize),1);if(_[Wo.currentPageName]>s)return tt({...k,current:s});Qe(Te.current?C.current.tableFullData.concat(a):a),ke(i),Ze(l?.data||t.data),r?.(t.data,t)}}catch(e){E?.(e)}var l;l=o,Object.prototype.hasOwnProperty.call(l,"stopToFirst")&&(o.stopToFirst=!1),re(!1),Pe(!1)},Ye=wt(Ge),Xe=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Xe(e.children)),e.index=t,h||(e.pageIndex=(e=>{const{current:t,pageSize:n}=k;return!M||z?e:(t-1)*n+e})(t)),e))),Qe=e=>{const t=_e(Xe(e));ot(t),st(t),$e(Me()),de(Ke()),Je(),v?.(t)},Ze=e=>{if(!j)return;const t=i?.fetch?.dataKey??Wo.summationKey,n=(t?(0,Q.get)(e,t):e)??{},r={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{Un(r,e.dataIndex,Number(Wn(n,e.summation.dataKey)))})),be(r)},Je=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=it();if(e.length){const t=w(e[0],e[0].index);$e([t])}else $e([])}},et=()=>{if(!z)return;const e=nt();Te.current||k.current>=e||(Pe(!0),tt({...k,current:k.current+1}))},tt=({current:e,pageSize:t})=>{J((n=>Object.assign({},n,{current:e,pageSize:t})))},nt=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},rt=()=>{tt(Object.assign({},k,{current:1}))},at=()=>{const{current:e,pageSize:t}=k;return C.current.tableFullData.slice((e-1)*t,e*t)},it=()=>K?at():C.current.tableFullData,lt=()=>{const{allTableData:e,isTreeTable:t}=C.current,n=K?qn(at()):e,r=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=w(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);H.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(n):n;Fe(r),Y(r)},ot=e=>{W(e),X(e),Z(e),ct(),lt()},st=e=>{U(e)},ct=()=>{Ce(),C.current.allTableData.forEach((e=>xe(w(e,e.index),e)))},dt=()=>{ae({})},ut=()=>{ie({})},mt=()=>{oe([])},pt=()=>{$e([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=se(p,["fetch"]);if(p.fetch){const{api:e,params:n,dataKey:r}=p.fetch;try{const a=await e(n);200===a.code&&(t=(r?(0,Q.get)(a.data,r):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:n=1,isPrint:r=1}=t;ve((t=>Object.assign({},t,{export:!!e,import:!!n,print:!!r})))}if(Array.isArray(t.fieldList)){const n=Ln(e.columns,(e=>{const{dataIndex:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const{visible:t=1,disabled:a,secretName:i}=r,l=An(C.current.originColumns,n);ge(n,{visible:t,disabled:a,secretName:i}),t||(e.noAuth=!0,l.noAuth=!0),i&&(e.formatType=`secret-${i}`,l.formatType=`secret-${i}`)}}));f?.(n)}})(),q&&N.current.setClickedValues([q,""]),"radio"===d?.type&&D.length&&N.current.setClickedValues([D[0],""]),Ae(),Fe(),M?Ge():Qe(a)},checkDataIndex:()=>{const e=R.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&pe("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:ot,getTableData:Ge,createTableList:it,createTableData:Qe,createGroupData:_e,createSelectionKeys:Me,createRowExpandedKeys:Ke,setSelectionKeysEffect:$e,findParentRowKeys:je,getAllChildRowKeys:ze,doFieldValidate:(e,t,n,r,a)=>{if(!Array.isArray(e))return pe("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ne.removeFromRequired({x:n,y:r}),Ne.removeFromValidate({x:n,y:r}),e.forEach((e=>{e.required&&le(t)&&Ne.addToRequired({x:n,y:r,text:e.message||a+Se("qm.form.requiredTips")}),"function"!=typeof e.validator||e.validator?.(t)||Ne.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:a}=Ne.state,i=(0,Q.intersection)(n,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:n.filter((e=>!i.includes(e))),updated:r.filter((e=>![...(0,Q.intersection)(r,n),...(0,Q.intersection)(r,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(C.current.tableFullData)},tableChange:Ve,toLastPage:()=>{const e=nt();k.current!==e&&tt(Object.assign({},k,{current:e}))},toFirstPage:rt,getPageCount:nt,pagerChangeHandle:tt,scrollBottomDebouncer:Le,clearTableSorter:dt,clearTableFilter:ut,clearSuperFilters:mt,clearRowSelection:pt,clearRowHighlight:()=>{ue("")},clearTableLog:()=>{Ne.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;we(),Ne.destroy(),e.deregister(t)}}};function Zo({handler:e,delay:t=0}){const n=Bt(e,t),r=Y(t>0?n:e);i.useEffect((()=>(window.addEventListener("resize",r),()=>window.removeEventListener("resize",r))),[r])}const Jo=e=>{const{total:t}=e,{tableRef:n,prefixCls:r,selectionKeys:a,isHeadSorter:i,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:m}=l().useContext(Ro),{infoBarConfig:p,rowSelection:h,rowHighlight:f}=n.current.props,{allTableData:g,invalidRowKeys:y}=n.current,{hideAlert:b,hideClearButton:v}=p||{},{t:x}=G(),E=l().useMemo((()=>!b),[b]),w=l().useMemo((()=>!v&&!!(i||o||h||f)),[v,i,o,h,f]),C={[`${r}__alert`]:!0};return E?l().createElement("div",{className:Ee()(C)},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.InfoCircleFilled,null)),l().createElement("span",null,x("qm.table.alert.total",{total:n.current.isTreeTable?g.length:t}),h?`,${x("qm.table.alert.selected",{total:Math.max(a.length-y.length,0)})}`:""),w&&l().createElement("em",{onClick:()=>{c(),d(),u(),m(),ae((()=>s()))}},x("qm.table.alert.clear"))):null},es=l().forwardRef(((e,t)=>{const{isFullScreen:n,open:r=!0}=e,{prefixCls:a,setFullScreen:i}=l().useContext(Ro),{t:o}=G(),s=()=>{i(!n)};return l().useImperativeHandle(t,(()=>({clickHandle:s}))),r?l().createElement("span",{className:`${a}-full-screen`,title:o(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},n?l().createElement(Ce.FullscreenExitOutlined,null):l().createElement(Ce.FullscreenOutlined,null))):null}));es.displayName="FullScreen";const ts=es,ns=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,getTableData:a}=l().useContext(Ro),{t:i}=G(),o=()=>{a()};return l().useImperativeHandle(t,(()=>({clickHandle:o}))),n?l().createElement("span",{className:`${r}-reload`,title:i("qm.table.refresh.text"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.ReloadOutlined,null))):null}));ns.displayName="Reload";const rs=ns,as=()=>{const e={dateFormat:e=>{const t=e?c()(e).format(Fo):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?c()(e).format(_o):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?c()(e).format(_o.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Yn(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Xn(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,n,r)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=n,c=a||s?.(r,n)?.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=Yn(d)?new(Ea())(d).toFixed(i):d),l>=0&&""!==d&&(d=Qn(d,l)),o){const t=e[`${ie(o)}Format`];t?d=t(d):pe("Table","字段的格式化类型 `formatType` 配置不正确")}return d},n=e=>J(e)?tr(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,a,i)=>{const l=Wn(e,r.dataIndex),o=r.render?r.render(l,e,r,a,i):t(l,r,e);return n(o)}}},is=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:c,summationRows:d,showSummary:u,getSpan:m}=l().useContext(Ro),{tablePrint:p,showHeader:h}=i.current.props,{t:f}=G(),{getTitleFromCellValue:g}=as(),y=a?.print?.leftLogo??"",b=a?.print?.rightLogo??"",v=!(!y&&!b),x=l().useMemo((()=>ce(Dn(n,[Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn]))),[n]),E=l().useMemo((()=>ce(Dn(c,[Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn]))),[c]),w=l().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=e=>{const t=Object.assign({},lr(x,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?C(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,n)=>{if(Array.isArray(e))return S(e.concat(n),t)}))))),N=()=>{const e=(e=>{const t=[];let n=[],r=0,a=0;for(;a<e.length;){const i=e[a];r+=i.width||i.renderWidth,r<=Wo.printWidth?(n.push(i),a===e.length-1&&t.push(n),a++):a>0?(e.splice(0,a),w.length&&e.unshift(...w),t.push(n),n=[],r=0,a=0):(i.width=Wo.printWidth,n.push(i),t.push(n),a++)}return t})([...E]),t=(e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(C(e))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const n=e.filter((e=>e.dataIndex===t));return n.length<=1?n[0]:S(n,"dataIndex")[0]})))(n),t.push(Mn(n))})),t})(e);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 r=0;r<e.length;r++)n+=I(t[r],e[r],i.current.tableFullData),n+='<div class="page-break"></div>';return n+"</body></html>"},I=(e,t,n)=>{const{showLogo:r=!0}=p;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,h&&(a+=["<thead>",r&&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:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${nr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(a+=`<tbody>${qn(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:a,colSpan:i}=m(e,t,e.index,r,n);return a&&i?`<td rowspan="${a}" colspan="${i}">${0===r&&e._level?`<span style="padding-left:${e._level*Wo.treeTable.textIndent}px"></span>`:""}${g(e,t,e.index,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),u&&d.length&&(a+=["<tfoot>",d.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(n):Wn(e,`${a}_text`);return`<td>${0===r&&""===l?f("qm.table.config.summaryText"):J(l)?tr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},T=()=>{((e,t)=>{const{filename:n,type:r,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!a)return Promise.resolve({type:r,content:t,blob:e});Pt(e,i)}})(0,N())?.then((({content:e,blob:t})=>{let n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),i.current.isIE?(n.contentDocument.write(e),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(t))}))};return l().useImperativeHandle(t,(()=>({clickHandle:T}))),r?l().createElement("span",{className:`${s}-print`,title:f("qm.table.print.text"),onClick:()=>T()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.PrinterOutlined,null))):null}));is.displayName="TablePrint";const ls=is,os=require("exceljs");var ss=r.n(os);const cs="606060",ds="thin",us="d4d4d4",ms=(e,t)=>{t&&(e.height=Math.floor(.75*t))},ps=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},hs=()=>({top:{style:ds,color:{argb:us}},left:{style:ds,color:{argb:us}},bottom:{style:ds,color:{argb:us}},right:{style:ds,color:{argb:us}}}),fs=e=>{const{children:t}=e;return t&&t.length?fs(t[0]):e},gs=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},ys=()=>{const{tableRef:e,getSpan:t,showSummary:n,isHeadGroup:r}=l().useContext(Ro),{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,{rowHeight:p}=e.current,h=On(u),f=Mn(u),g=[],y=[],b=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;E[t]=nr(e.title),b.push({key:t,width:(n||r||Wo.defaultColumnWidth)/8})})),i&&(r?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:a}=e,i=fs(e),l=h.findIndex((({dataIndex:e})=>e===i.dataIndex));n[i.dataIndex]=nr(e.title),0!==r&&(r>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+r-1}})})),g.push(n)})):(h.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&v.push({s:{r:x,c:t},e:{r:x+r-1,c:t+n-1}})})),g.push(E)),x+=g.length);const w=qn(s).map(((e,n)=>{const r={};return h.forEach(((i,l)=>{if("function"==typeof a){const{rowSpan:r,colSpan:a}=t(e,i,n,l,s);(a>1||r>1)&&v.push({s:{r:n+x,c:l},e:{r:n+x+r-1,c:l+a-1}})}const o=["percent","finance"].includes(i.formatType);r[i.dataIndex]=o?Wn(e,i.dataIndex):d(e,n,i,l)})),r._level=e._level,r}));x+=w.length,n&&m&&c(h,s).forEach(((e,t)=>{const n={};h.forEach(((t,r)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(s):Wn(e,a);n[a]=0===r&&""===l?o("qm.table.config.summaryText"):J(l)?tr(l).join(""):l})),y.push(n)}));const{sheetName:C,useStyle:S}=l,N=new(ss().Workbook),I=N.addWorksheet(C);I.columns=b,i&&I.addRows(g).forEach((e=>{S&&ms(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),n=An(u,t.key),{align:r,theadAlign:a}=n;ps(e,a||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:cs}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:hs()})}))})),I.addRows(w).forEach(((e,t)=>{const{_level:n}=w[t];S&&ms(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),r=An(u,t.key),{align:a}=r;ps(e,a),Object.assign(e,gs(r)),S&&Object.assign(e,{font:{color:{argb:cs}},border:hs()}),1===Number(e.col)&&n&&(e.alignment={...e.alignment,indent:n})}))})),n&&m&&I.addRows(y).forEach((e=>{S&&ms(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),n=An(u,t.key),{align:r}=n;ps(e,r),Object.assign(e,gs(n)),S&&Object.assign(e,{font:{color:{argb:cs}},border:hs()})}))})),v.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 n=e=>{let t=e;const n=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),r=-1!==e.indexOf('"');return r&&(t=t.replace(/"/g,'""')),(n||r)&&(t='"'+t+'"'),t},r="\ufeff"+(e=>{let t,r,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],r=0;r<a.cells.length;r+=1)i=a.cells[r],l=l+(r?",":"")+n(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,n)=>{t=t||"",n=n||512;const r=window.atob(e),a=[];let i;for(i=0;i<r.length;i+=n){const e=r.slice(i,i+n),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=r,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:n,file:r}=e,a=On(n),i=new FileReader;i.onerror=()=>{O.message.error(o("qm.table.import.error"))},i.onload=e=>{const n=a.map((e=>nr(e.title))),r=new(ss().Workbook),i=e.target;i?r.xlsx.load(i.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,l);if(c){const r=e.slice(i+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,Q.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,Q.isDate)(r)&&(r=Jn(r,_o)),r?.formula&&(r=r.result??r.value),t[l[n]]=r}));const r={};return n.forEach(((e,n)=>{const{dataIndex:i,dictItems:l}=a[n];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])),Un(r,i,t[e])})),r}));t?.(r)}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(r)}}},bs=e=>{const{fileType:t,onChange:n}=e,{prefixCls:r}=l().useContext(Ro),{t:a}=G();let i,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}};return l().createElement(ge,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return i||(i=document.createElement("form"),o=document.createElement("input"),i.className=`${r}--file-form`,o.name="file",o.type="file",i.appendChild(o),document.body.appendChild(i)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(O.message.warning(a("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(i),i=null,o=null},i.reset(),o.click()}))})({type:t});n?.(e.name,e)}catch(e){}})()},a("qm.upload.text"))},vs=e=>{const{columns:t,onClose:n}=e,{tableRef:r,prefixCls:a,createTableData:i,dataChange:o}=l().useContext(Ro),{beforeTableImport:s}=r.current.props,{t:c}=G(),{importXLSX:d}=ys(),u=l().useRef(null),[m,p]=l().useState(!1),[h,f]=l().useState(!0),g=e=>e.filter((e=>![Wo.expandableColumn,Wo.selectionColumn,"index","pageIndex",Wo.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:n}=t.GET_FIELDS_VALUE(["fileName"]);return l().createElement(l().Fragment,null,n?l().createElement("span",null,n):l().createElement(bs,{fileType:t.state.formData.fileType,onChange:(e,n)=>{t.SET_FIELDS_VALUE({fileName:e,file:n}),n&&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:r.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(zl,{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(ge,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(ge,{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}=r.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 n=a.posIndex,r=t.slice(0,n).concat(e).concat(t.slice(n));i(r)}e.forEach((e=>{l.addToInserted(e)})),o(),O.message.success(c("qm.table.import.success",{total:e.length})),p(!1),n()})))})()},c("qm.table.import.text"))))},xs=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{prefixCls:a}=l().useContext(Ro),{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,r&&l().createElement("span",{className:Ee()(d),title:i("qm.table.import.textNoSpace"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.ImportOutlined,null))),l().createElement(mn,u,l().createElement(vs,{columns:n,onClose:()=>s(!1)})))}));xs.displayName="TableImport";const Es=xs,ws=e=>{const{columns:t,onChange:n}=e,{prefixCls:r,$size:a}=l().useContext(Ro),{t:i}=G(),o=l().useRef([]),[s,c]=l().useState(!1),[d,u]=l().useState(t);qe((()=>{p()}),[d]),l().useEffect((()=>{m()}),[t]);const m=()=>{const e=[];t.forEach(((n,r)=>{const a=n.colSpan;a>1&&t.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&e.push(t.slice(r,r+a))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const a=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===a)return e.push(t);e.push(...o.current[a].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),n?.(e)},h={[`${r}__popper`]:!0,"column-filter__popper":!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a},f=[`${r}-column-filter`,{selected:s}];return l().createElement(za(),{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(ca.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:d,setList:e=>{const t=e.map((e=>e.dataIndex)),n=d.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||u(dr(e))}},d.map((e=>((e,t)=>{const{colSpan:n}=e;if(0===n)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const r=["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:n}=t.target;e.hidden=!n,u([...d])}}),l().createElement("i",{className:Ee()(r),title:i("qm.table.columnFilter.draggable")},l().createElement(Ce.HolderOutlined,null)),l().createElement("span",{className:"text"},nr(e.title)))})(e)))))),popupClassName:Ee()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:Ee()(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"))))},Cs=e=>{const{defaultValue:t,onClose:n,onOk:r}=e,{tableRef:a,prefixCls:i,selectionKeys:o,pagination:s,showSummary:d}=l().useContext(Ro),{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(Do)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:d?1:0,useStyle:0},t,{columns:ce(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(ws,{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(zl,{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(ge,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.export.closeButton")),l().createElement(ge,{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]);r(t),await re(1e3),f(!1),n()}})()},m("qm.table.export.text"))))},Ss=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!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(Ro),{exportExcel:y,fetch:b,showHeader:v}=i.current.props,{t:x}=G(),{getTitleFromCellValue:E}=as(),[w,C]=l().useState(!1),[S,N]=l().useState(!1),I=l().useMemo((()=>!!y?.fetch?.api),[y]),T=l().useMemo((()=>!u.total||S),[u.total,S]),R=l().useMemo((()=>Dn(n,[Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn])),[n]),k=l().useMemo((()=>Dn(d,[Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn])),[d]),P=(e,t="",n=0)=>e.map(((e,r)=>{const a={...e,index:r,pageIndex:r},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=n,Array.isArray(e.children)&&(a.children=P(e.children,i,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&Un(a,t,Wn(a,t))})),a})),L=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,a=(h?rr(t):t).reduce(((e,t)=>{if(t?.[Wo.summaryIgnore])return e;const n=Number(Wn(t,r));return Number.isNaN(n)?e:e+n}),0);Un(n,r,a)})),[n]},A=(e,t,n,r)=>{const{precision:a,formatType:i}=n;let l=E(e,n,t,r);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:F,exportCSV:_}=ys(),D=async e=>{const{api:t,formatter:n=(e=>e),afterFetch:r,dataKey:a}=b;let i=[];try{N(!0);const l=await t({...n(m),[Wo.currentPageName]:1,[Wo.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 r?await r(e):e,i=P(e)}}catch(e){}return N(!1),i},H=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},q=y?.fileName??`${c()().format(Do)}.xlsx`,$=q.slice(q.lastIndexOf(".")+1).toLowerCase(),M=()=>{if(T)return O.message.warning(x("qm.table.export.warnText"));I?(async e=>{N(!0);try{const{api:t,params:n}=y.fetch,r=await t({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:a}=e.filter||{};return{title:t,dataIndex:n,type:a,hidden:r}})),...m,...n,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[Wo.currentPageName]:void 0,[Wo.pageSizeName]:void 0});r.data&&(Pt(r.data,e),H(e))}catch(e){}N(!1)})(q):C(!0)};l().useImperativeHandle(t,(()=>({clickHandle:M})));const K={[`${s}-export`]:!0},z={visible:w,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},j={fileName:q.slice(0,q.lastIndexOf(".")),fileType:$,columns:R,useStyle:y?.cellStyle?1:0};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:Ee()(K),title:x("qm.table.export.textNoSpace"),onClick:()=>M()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.DownloadOutlined,null))),l().createElement(mn,z,l().createElement(Cs,{defaultValue:j,onClose:()=>C(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:n,exportType:r,startIndex:a=1,endIndex:l}=e,{tableFullData:o,selectionRows:s}=i.current;let c=[];if(p?("all"===r&&(c=await D()),"custom"===r&&(c=await D(l),c=c.slice(a-1))):("all"===r&&(c=o.slice(0)),"custom"===r&&(c=o.slice(a-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof y?.beforeExport)try{c=y?.beforeExport(c)}catch(e){}if("xlsx"===n){const n=await F(e,c,L,A);Pt(n,`${t}.xlsx`),H(`${t}.xlsx`)}if("csv"===n){const n=_(e,((e,t)=>{const{columns:n,footSummation:r}=e,a=Mn(n),i=On(n);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,v&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${nr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${qn(t).map((e=>`<tr>${i.map(((n,r)=>{const{rowSpan:a,colSpan:i}=g(e,n,e.index,r,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${A(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(l+=["<tfoot>",L(i,t).map((e=>`<tr>${i.map(((n,r)=>{const{dataIndex:a,summation:i}=n,l=i?.render?i.render(t):Wn(e,a);return`<td>${0===r&&""===l?x("qm.table.config.summaryText"):J(l)?tr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));Pt(n,`${t}.csv`),H(`${t}.csv`)}})(Object.assign({},e,{columns:kn(e.columns)}))}})))}));Ss.displayName="TableExport";const Ns=Ss,Is=e=>{const{columns:t,onClose:n}=e,{tableRef:r,tableBodyRef:a,prefixCls:i,dataChange:o}=l().useContext(Ro),{beforeClipboard:s}=r.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:nr(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(zl,{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(ge,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(ge,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,i]=await d.current.GET_FORM_DATA();if(e)return;const{tableFullData:l,store:u,fieldAuth:m}=r.current;h(!0);const p=i.content.trim().replace(/(\r|\n)$/,"");let f=p.replace(/"[^"]+"/g,"^");(p.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{f=f.replace(/\^/,e)}));let g=f.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{g=await s(g,g[0].map(((e,n)=>t[i.colIndex+n].dataIndex)))}catch(e){}g.forEach(((e,n)=>{e.forEach(((e,r)=>{const a=l[i.rowIndex-1+n],o=t[i.colIndex+r];if(a&&o){let t=!1;if(o.editRender){const e=o.editRender(a,o);t=!(e.disabled||e.extra?.disabled||m[o.dataIndex]?.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&(Un(a,o.dataIndex,e),u.addToUpdated(a))}}))})),a.current.forceUpdate(),o(),O.message.success(c("qm.table.clipboard.success",{total:g.length})),h(!1),n()})()},c("qm.table.clipboard.text"))))},Ts=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,flattenColumns:a}=l().useContext(Ro),{t:i}=G(),[o,s]=l().useState(!1),c=l().useMemo((()=>(e=>e.filter((e=>![Wo.expandableColumn,Wo.selectionColumn,"index","pageIndex",Wo.operationColumn].includes(e.dataIndex))))(a)),[a]),d=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:d})));const u={[`${r}-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,n&&l().createElement("span",{className:Ee()(u),title:i("qm.table.clipboard.textNoSpace"),onClick:()=>d()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.CopyOutlined,null))),l().createElement(mn,m,l().createElement(Is,{columns:c,onClose:()=>s(!1)})))}));Ts.displayName="TableClipboard";const Rs=Ts,Os=e=>{const{columns:t,onClose:n}=e,{tableRef:r,$size:a,selectionKeys:i,setSelectionKeysEffect:o}=l().useContext(Ro),{rowKey:s,rowSelection:c}=r.current.props,{t:d}=G(),u=l().useRef(null),m=Et(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=>![Wo.expandableColumn,Wo.selectionColumn,"index","pageIndex",Wo.operationColumn].includes(e.dataIndex))))]),[y]=l().useState((()=>{const{disabled:e}=c||{},t=r.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[b,v]=l().useState(300),x=wt((()=>{const e=u.current;v(e.offsetHeight-2*ka[a]-30)}),5);return g((()=>{x()}),[m.width]),l().createElement("div",{ref:u,style:{height:"100%"}},l().createElement(ud,{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(ge,{onClick:()=>n()},d("qm.table.selectCollection.closeButton"))))},ks=l().forwardRef(((e,t)=>{const{columns:n,open:r=!0}=e,{tableRef:a,getRowKey:i,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=l().useContext(Ro),{rowSelection:p}=a.current.props,{t:h}=G(),[f,g]=l().useState(!1),y=l().useRef(!1);qe((()=>{!y.current&&b()}),[d]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(c&&e)try{const n=await e.api(Object.assign({},{selectedKeys:s},e.params));if(200===n.code){let r=Array.isArray(n.data)?n.data:(0,Q.get)(n.data,e.dataKey)??[];r=r.filter((e=>!t(e))),u(r.map(((e,t)=>i(e,t)))),m(r),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,r&&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(mn,x,l().createElement(Os,{columns:n,onClose:()=>g(!1)})))}));ks.displayName="SelectCollection";const Ps=ks,Ls=require("localforage");var As=r.n(Ls);const Fs=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,getRowKey:a,prefixCls:i,$size:s,tableFlatData:c,flattenColumns:d,pagination:u,setPagination:m,scrollYToRecord:p,setHighlightKey:h,setShouldToTop:f,isWebPagination:g}=l().useContext(Ro),{uniqueKey:y}=r.current.props,{t:b}=G(),v=l().useRef(null),x=l().useRef(null),E=l().useRef([]),w=l().useRef(""),C=l().useRef(-1),S=l().useRef("stop");qe((()=>{const e=c.findIndex((e=>a(e,e.index)===w.current));p("",e)}),[u.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:nr(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await v.current.GET_FORM_DATA(),[n,r]=await x.current.GET_FORM_DATA(),a=(0,Q.omitBy)(Object.assign({},t,r),le);P(a)}}))),T={case:0,fullchar:0},R=l().useMemo((()=>d.filter((e=>![Wo.expandableColumn,Wo.selectionColumn,"index","pageIndex",Wo.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[d]),[k,P]=l().useState({}),[L,A]=l().useState(T),[F]=l().useState(I([R[0]])),[_]=l().useState(I(R.slice(1))),[D,H]=l().useState(0),q=l().useMemo((()=>!Object.keys(k).length),[k]);qe((()=>{S.current="ready"}),[k,L]);const $=e=>{A(Object.assign({},L,e))},M=(e,t,n)=>new Promise(((r,a)=>{O.Modal.confirm({title:b("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),K=async e=>{if(!Object.keys(k).length)return O.Modal.warning({title:b("qm.button.confirmPrompt"),content:b("qm.table.fastSearch.queryCondition")});if("ready"===S.current&&(S.current="stop",E.current=(e=>{const{allTableData:t}=r.current,n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];let l=!0;for(const t in e){const{type:n}=R.find((e=>e.dataIndex===t)).filter;let r=Wn(i,t),o=!0;if("text"===n||"textarea"===n?o=new RegExp(L.fullchar?`^${e[t]}$`:e[t],L.case?"":"i").test(r):(r="string"==typeof(a=r)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(a)?r.slice(0,10):r,o=r==e[t]),!o){l=!1;break}}l&&n.push(i)}var a;return n})(k),H(E.current.length)),!E.current.length)return h(""),O.Modal.warning({title:b("qm.button.confirmPrompt"),content:b("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>E.current.length-1&&await M(b("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=E.current.length-1))),"prev"===e&&(C.current=C.current<0?E.current.length-1:C.current-1,C.current<0&&await M(b("qm.table.fastSearch.toStart"),(()=>C.current=E.current.length-1),(()=>C.current=0)));const{isTreeTable:t,tableFullData:n,deriveRowKeys:i}=r.current,l=E.current[C.current],o=a(l,l.index);let s=l.index;if(t&&g){const e=or(i,o)[0];s=n.findIndex((t=>a(t,t.index)===e))}((e,t)=>{if(w.current=e,g){const{pageSize:e}=u,n=Math.ceil((t+1)/e);f(!1),m(Object.assign({},u,{current:n}))}else p(e)})(o,s),h(o)},z=()=>{v.current.RESET_FORM(),x.current.RESET_FORM()},j=l().useMemo((()=>y?`fastSearch_${y}`:""),[y]),[V,B]=l().useState([]),[W,U]=l().useState(""),[Y,X]=l().useState("");qe((()=>{if(Y){const{filters:e,config:t}=V.find((e=>e.value===Y)).list;v.current.SET_FIELDS_VALUE(se(e,_.map((e=>e.fieldName)))),x.current.SET_FIELDS_VALUE(se(e,F.map((e=>e.fieldName)))),P(e),A(t)}else z(),P({}),A(T)}),[Y]),l().useEffect((()=>{Z()}),[]);const Z=async()=>{if(!j)return;let e=await As().getItem(j);e||(e=await J(j),Array.isArray(e)&&await As().setItem(j,e)),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))},J=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},ee=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[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(tn,{defaultActiveKey:"1",size:"small",tabBarExtraContent:l().createElement("span",null,b("qm.table.alert.total",{total:D}))},l().createElement(tn.TabPane,{tab:b("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},l().createElement(zl,{ref:v,items:F,cols:1,labelWidth:110})),l().createElement(tn.TabPane,{tab:b("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},l().createElement(zl,{ref:x,items:_,cols:1,labelWidth:110})))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(O.Input,{size:s,value:W,placeholder:b("qm.table.highSearch.configText"),disabled:q,onChange:e=>{const{value:t}=e.target;U(t)}}),l().createElement(ge,{type:"primary",disabled:!W||q,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!j)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=er(),t=[...V,{text:W,value:e,list:{filters:k,config:L}}];B(t),X(e),U(""),await As().setItem(j,t),await ee(j,t)})()},b("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${Wo.rowHeightMaps[s]}px`}},l().createElement("span",null,b("qm.table.fastSearch.savedSetting"))),l().createElement("ul",null,V.map((e=>l().createElement("li",{key:e.value,className:Ee()({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:b("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=V.filter((t=>t.value!==e));B(t),e===Y&&X(""),await As().setItem(j,t),await ee(j,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!V.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ut,null)))))),l().createElement("div",{className:"bottom"},l().createElement("div",null,l().createElement(O.Checkbox,{checked:!!L.case,onChange:e=>$({case:e.target.checked})},b("qm.table.fastSearch.matchCase")),l().createElement(O.Checkbox,{checked:!!L.fullchar,onChange:e=>$({fullchar:e.target.checked})},b("qm.table.fastSearch.matchFullchar"))),l().createElement("div",null,l().createElement(ge,{onClick:()=>z()},b("qm.table.fastSearch.clear"))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${ka[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>t(),style:{marginRight:8}},b("qm.table.fastSearch.closeButton")),l().createElement(ge,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},b("qm.table.fastSearch.queryPrev")),l().createElement(ge,{type:"primary",onClick:()=>K("next")},b("qm.table.fastSearch.queryNext"))))},_s=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,$size:a}=l().useContext(Ro),{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:`${ka[a]+20}px`},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-super-search`,title:i("qm.table.fastSearch.text"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.MonitorOutlined,null))),l().createElement(mn,d,l().createElement(Fs,{onClose:()=>s(!1)})))}));_s.displayName="FastSearch";const Ds=_s,Hs=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{tableRef:r,prefixCls:a,flattenColumns:i}=l().useContext(Ro),{rowKey:o,uniqueKey:s}=r.current.props,{t:c}=G(),{tableFullData:d}=r.current,[u,m]=l().useState(!1),p=()=>{m(!0)};l().useImperativeHandle(t,(()=>({clickHandle:p})));const h={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${a}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>p()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.LineChartOutlined,null))),l().createElement(mn,h,l().createElement(Jm,{fromTable:!0,rowKey:o,uniqueKey:s,columns:i,dataSource:d})))}));Hs.displayName="PivotGrid";const qs=Hs,$s=e=>{const{columns:t,group:n,summary:r}=e,{tableRef:a,$size:i,pagination:o,fetchParams:s,isFetch:d}=l().useContext(Ro),{fetch:u}=a.current.props,{t:m}=G(),p=e=>{const n=t.find((t=>t.dataIndex===e));return{title:n.title,precision:n.precision,dictItems:n.dictItems??[]}},h=n.map((e=>({dataIndex:e.group,...p(e.group)}))),f=r.map((e=>e.summary===Wo.groupSummary.total.value?{dataIndex:e.summary,title:Wo.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=l().useMemo((()=>Object.assign({},s,{[Wo.sorterFieldName]:void 0,[Wo.groupSummary.summaryFieldName]:r.map((e=>`${e.formula}|${e.summary}`)).join(","),[Wo.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[Wo.currentPageName]:1})),[s,n,r]),[y,b]=l().useState(((e,n)=>[{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}))),...n.map((e=>{const n=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let r=n?{summation:n}:null;return e.dataIndex===Wo.groupSummary.total.value&&(r={dataIndex:Wo.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?r:null}}))])(h,f)),[v]=l().useState(d?[]:(e=>{const t=ir(e,n.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};y.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&Un(t,r,Wn(e[0],r))})),r.forEach((n=>{const r=n.summary!==Wo.groupSummary.total.value?n.summary:Wo.groupSummary.recordTotalIndex,a=n.formula;"count"===a&&Un(t,r,e.length),"sum"===a&&Un(t,r,(0,Q.sumBy)(e,r)),"max"===a&&Un(t,r,(0,Q.maxBy)(e,r)[r]),"min"===a&&Un(t,r,(0,Q.minBy)(e,r)[r]),"avg"===a&&Un(t,r,((0,Q.sumBy)(e,r)/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(Do)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>b(e)};return l().createElement(ud,x)},Ms=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,prefixCls:a,$size:i,flattenColumns:s}=l().useContext(Ro),{uniqueKey:c}=r.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("");qe((()=>{if(v){const{group:e,summary:t}=f.find((e=>e.value===v)).list;T(e),L(t)}else{const e=D();T(e?.group||[]),L(e?.summary||[])}}),[v]),l().useEffect((()=>{H()}),[]);const E=l().useMemo((()=>c?`summary_${c}`:""),[c]),w=l().useMemo((()=>s.filter((e=>![Wo.expandableColumn,Wo.selectionColumn,"index","pageIndex",Wo.operationColumn].includes(e.dataIndex)))),[s]),C=w.filter((e=>!e.groupSummary)).map((e=>({text:nr(e.title),value:e.dataIndex}))),S=[Wo.groupSummary.total,...w.filter((e=>!!e.groupSummary)).map((e=>({text:nr(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"}],[I,T]=l().useState([]),[R,k]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(ge,{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:C.map((e=>({...e,disabled:I.findIndex((t=>t.group===e.value))>-1})))})}]),[P,L]=l().useState([]),[A,F]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(ge,{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:P.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===Wo.groupSummary.total.value?N.slice(N.length-1):N})}]),_=l().useMemo((()=>{const e=I.length&&I.every((e=>Object.values(e).every((e=>""!==e)))),t=P.length&&P.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[I,P]),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:n}=e;T(t),L(n)}let t=await As().getItem(E);t||(t=await q(E),Array.isArray(t)&&await As().setItem(E,t)),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},$=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[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(ud,{ref:u,size:i,columns:R,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{T(e)}},l().createElement(ge,{type:"primary",icon:l().createElement(Ce.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"container line"},l().createElement(ud,{ref:m,size:i,columns:A,dataSource:P,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onDataChange:e=>{L(e)}},l().createElement(ge,{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(ge,{type:"primary",disabled:!y||_,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=er(),t=[...f,{text:y,value:e,list:{group:I.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))}}];g(t),x(e),b(""),await As().setItem(E,t),await $(E,t)})()},d("qm.table.groupSummary.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${Wo.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:Ee()({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 As().setItem(E,t),await $(E,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!f.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ut,null)))))),l().createElement(mn,M,l().createElement($s,{columns:w,group:I,summary:P})),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(ge,{onClick:()=>t(),style:{marginRight:8}},d("qm.table.groupSummary.closeButton")),l().createElement(ge,{type:"primary",disabled:_,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:I.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))})),void h(!0))},d("qm.table.groupSummary.confirmButton"))))},Ks=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ro),{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,n&&l().createElement("span",{className:`${r}-group-summary`,title:a("qm.table.groupSummary.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.PieChartOutlined,null))),l().createElement(mn,c,l().createElement(Ms,{onClose:()=>o(!1)})))}));Ks.displayName="GroupSummary";const zs=Ks,js=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,$size:a,prefixCls:i,flattenColumns:s,setSuperFilters:c,clearTableFilter:d}=l().useContext(Ro),{uniqueKey:u}=r.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("");qe((()=>{f(x?g.find((e=>e.value===x)).list:D()||[])}),[x]),l().useEffect((()=>{H()}),[]);const w=l().useMemo((()=>u?`superSearch_${u}`:""),[u]),C=l().useMemo((()=>s.filter((e=>!!e.filter))),[s]),S=ar(h),N=l().useMemo((()=>!(S&&Tn(S))),[S]),I=l().useMemo((()=>!!h.length&&N),[h,N]),T=[{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:nr(e.title)}))),k=e=>["in","nin"].includes(e),P=(e,t)=>{let n;switch(e){case"number":n="number";break;case"date":n="date";break;case"checkbox":case"radio":n=t?"select-multiple":"select";break;default:n="text"}return n},L=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},[A,F]=l().useState([{title:m("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(ge,{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 n=Object.values(t)[0],r=C.find((e=>e.dataIndex===n))?.filter.type,a=L(r);e.fieldType=r,e.expression=n?a[0]?.value:"",e.condition=k(e.expression)?[]:"",n||(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=C.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:L(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=k(e.expression)?[]:""}}}},{title:m("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName)),n=t?.filter.type,r=t?.filter?.items??t?.dictItems??[];return{type:P(n,k(e.expression)),editable:!0,items:r,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:T,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{w&&sessionStorage.setItem(w,JSON.stringify(h.filter((e=>!!e.fieldName))))},D=()=>{if(!w)return;const e=sessionStorage.getItem(w);return e?JSON.parse(e):null},H=async()=>{if(!w)return;const e=D();e&&f(e);let t=await As().getItem(w);t||(t=await q(w),Array.isArray(t)&&await As().setItem(w,t)),Array.isArray(t)&&t.length&&(y(t),!e&&E(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},$=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[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(ud,{ref:p,size:a,columns:A,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:n}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(n)&&("bracketLeft"===n&&(e[n]=e[n]?"":"("),"bracketRight"===n&&(e[n]=e[n]?"":")"),f([...h]))},onDataChange:e=>{f(e)}},l().createElement(ge,{type:"primary",icon:l().createElement(Ce.PlusOutlined,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),Wo.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(ge,{type:"primary",disabled:!b||N,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!w)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=er(),t=[...g,{text:b,value:e,list:h.filter((e=>!!e.fieldName))}];y(t),E(e),v(""),await As().setItem(w,t),await $(w,t)})()},m("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${Wo.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:Ee()({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 As().setItem(w,t),await $(w,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!g.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ut,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(ge,{onClick:()=>t(),style:{marginRight:8}},m("qm.table.highSearch.closeButton")),l().createElement(ge,{type:"primary",disabled:I,onClick:()=>(d(),c(h.map((e=>se(e,["index","pageIndex"])))),_(),void t())},m("qm.table.highSearch.searchButton"))))},Vs=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ro),{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,n&&l().createElement("span",{className:`${r}-super-search`,title:a("qm.table.highSearch.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.FunnelPlotOutlined,null))),l().createElement(mn,c,l().createElement(js,{onClose:()=>o(!1)})))}));Vs.displayName="SuperSearch";const Bs=Vs,Ws=l().forwardRef(((e,t)=>{const{tableColumns:n,showFullScreen:r,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(Ro),{uniqueKey:w,exportExcel:C}=b.current.props,{t:S}=G(),N=l().useRef(null),I=l().useRef(null),T=l().useRef(null),R=l().useRef(null),k=l().useRef(null),P=l().useRef(null),L=l().useRef(null),A=l().useRef(null),F=l().useRef(null),_=l().useRef(null),D=l().useRef(null),H=l().useRef(!1),q=l().useMemo((()=>w?`toolBox_${w}`:""),[w]),[$,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:r,reload:a,print:i,import:s,export:c&&!C?.hideIcon,clipboard:d,collection:u,fastSearch:m,superSearch:p,pivotGrid:h,groupSummary:f},[z,j]=l().useState(!1);qe((()=>{H.current&&(B(),H.current=!1)}),[$]),l().useEffect((()=>{V()}),[]),l().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!k.current)return pe("Table","执行导出需要配置 `exportExcel` 参数");k.current.clickHandle()}})));const V=()=>{if(!q||!g)return;const e=JSON.parse(localStorage.getItem(q));e||W(q).then((e=>{e&&(M(Object.assign({},$,e)),localStorage.setItem(q,JSON.stringify(e)))})).catch((()=>{})),e&&M(Object.assign({},$,e))},B=()=>{if(!q||!g)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(q,JSON.stringify(e)),U(q,e)},W=async e=>{const t=y?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},U=async(e,t)=>{const n=y?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},Y=async e=>{j(!1),await re(100),e.current.clickHandle()},X=(e,t)=>{H.current=!0,M(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${x}--lg`]:"large"===v,[`${x}--sm`]:"small"===v};return l().createElement(l().Fragment,null,r&&l().createElement(ts,{ref:N,isFullScreen:E,open:!g||$.fullScreen}),a&&l().createElement(rs,{ref:I,open:!g||$.reload}),i&&l().createElement(ls,{ref:T,tableColumns:n,open:!g||$.print}),s&&l().createElement(Es,{ref:R,tableColumns:n,open:!g||$.import}),c&&l().createElement(Ns,{ref:k,tableColumns:n,open:(!g||$.export)&&!C?.hideIcon}),d&&l().createElement(Rs,{ref:P,open:!g||$.clipboard}),u&&l().createElement(Ps,{ref:L,columns:n,open:!g||$.collection}),m&&l().createElement(Ds,{ref:A,open:!g||$.fastSearch}),h&&l().createElement(qs,{ref:F,open:!g||$.pivotGrid}),f&&l().createElement(zs,{ref:_,open:!g||$.groupSummary}),p&&l().createElement(Bs,{ref:D,open:!g||$.superSearch}),g&&l().createElement(O.Dropdown,{open:z,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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:$.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(I)},{key:"print",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(T)},{key:"import",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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:$.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(k)},{key:"clipboard",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(P)},{key:"collection",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(L)},{key:"fastSearch",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(A)},{key:"pivotGrid",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.pivotGrid.text"))),onClick:()=>Y(F)},{key:"groupSummary",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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:$.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:Ee()(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)))))}));Ws.displayName="ToolBox";const Us=Ws,Gs=(e,t)=>e.map((e=>(e.children&&(e.children=Gs(e.children,t)),t(e)))),Ys=l().forwardRef(((e,t)=>{const{columns:n}=e,{global:r}=l().useContext(o),{tableRef:a,prefixCls:i,$size:s}=l().useContext(Ro),{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)))(n)),[n]),b=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(n)),[n]),v=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(n)),[n]),x=l().useMemo((()=>d?`table_${d}`:""),[d]);qe((()=>{w(n)}),[n]),l().useLayoutEffect((()=>{C()}),[]),l().useImperativeHandle(t,(()=>({initialHandler:C})));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}})),w=e=>{if(!x)return;const t=E(e),n=JSON.parse(localStorage.getItem(x));a.current.columnsDefined&&!(0,Q.isEqual)(t,n)&&(localStorage.setItem(x,JSON.stringify(t)),(async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(x,t))},C=()=>{const e=(()=>{if(!x)return;const e=JSON.parse(localStorage.getItem(x));return e||(async e=>{const t=r?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(x).then((e=>{e?(localStorage.setItem(x,JSON.stringify(e)),C()):r?.getComponentConfigApi&&w(n)})).catch((()=>{})),e?(0,Q.xor)(Pn(e).map((e=>e.dataIndex)),Pn(n).map((e=>e.dataIndex))).length>0?Gs(n,(t=>{const n=An(e,t.dataIndex);return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Gs(e,(e=>{const t=An(n,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(((n,r)=>{const a=n.colSpan;a>1&&e.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+a))})),t},N=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:a}=n;if(0===r)return;if(1===r)return t.push(n);const i=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(n);t.push(...h.current[i].map((({dataIndex:t},r)=>{const a=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(a.hidden=n.hidden),void 0!==n.fixed?a.fixed=n.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),m?.(t)},I=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,N(n))},T=(e,t)=>{const{colSpan:r,noFixed:a}=e;if(0===r)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=nr(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:r}=t.target;e.hidden=!r,N(n)}}),l().createElement("i",{className:Ee()(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:Ee()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>I(e,"left")},l().createElement(Ce.StepBackwardOutlined,null)),l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},l().createElement(Ce.StepForwardOutlined,null))):"sub"!==t?l().createElement("span",{className:Ee()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>I(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(ca.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:r=>{const a=r.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,Q.isEqual)(a,i)||((e,t)=>{An(n,t).children=e,m?.([...n])})(dr(r),t)}},e.map((e=>T(e,"sub"))))),k={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===s,[`${i}--sm`]:"small"===s},P=[`${i}-column-filter`,{selected:f}];return c?l().createElement(za(),{action:["click"],popupVisible:f,popup:l().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"reset"},l().createElement(ge,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const r=An(n,t.dataIndex)||ce(t);return t.children&&(r.children=e(t.children)),Object.assign(r,{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(ca.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),n=y.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||N([...dr(e),...v,...b])}},y.map((e=>T(e,"left"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"main"},l().createElement(ca.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||N([...y,...dr(e),...b])}},v.map((e=>T(e,"main"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"right"},l().createElement(ca.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),n=b.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||N([...y,...v,...dr(e)])}},b.map((e=>T(e,"right")))))),popupClassName:Ee()(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{g(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:Ee()(P),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}));Ys.displayName="ColumnFilter";const Xs=Ys,Qs=()=>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 Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zs.apply(null,arguments)}const Js=e=>{const{column:t,filters:n}=e,{$size:r,prefixCls:a,setFilters:i,clearSuperFilters:o}=l().useContext(Ro),{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:n}=t;return`${e}|${n.type}`}),[t]),v=l().useMemo((()=>{let e=!1;for(const t in n[b])if(!le(n[b][t])||h){e=!0;break}return e}),[b,n,h]);l().useLayoutEffect((()=>{m&&setTimeout((()=>x()),20)}),[m]),l().useEffect((()=>{(0,Q.isEqual)(g[b],n[b])||y({[b]:n[b]||{}}),f(""===n[b]?.["=="])}),[n]);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 n in e[t])if(le(e[t][n])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][n])continue;delete e[t][n]}Object.keys(e[t]).length||delete e[t]}return e})({...n,...g,...e})),p(!1)},w={text:e=>l().createElement(l().Fragment,null,l().createElement(O.Input,{ref:c,size:r,placeholder:s("qm.table.filter.searchText",{text:nr(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,n=t?"":null;y((e=>Object.assign({},e,{[b]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue")))),textarea:e=>l().createElement(l().Fragment,null,l().createElement(O.Input.TextArea,{ref:u,size:r,placeholder:s("qm.table.filter.searchAreaText",{text:nr(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,n=t?"":null;y((e=>Object.assign({},e,{[b]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:g[b]?.[e]??"",size:r,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||y((n=>Object.assign({},n,{[b]:Object.assign({},n[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,Zs({ref:d},t(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(O.InputNumber,Zs({},t("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(O.InputNumber,Zs({},t("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(O.InputNumber,Zs({},t("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:Zn(g[b]?.[e],Fo),format:Fo,size:r,onChange:t=>{y((n=>Object.assign({},n,{[b]:Object.assign({},n[b],{[e]:Jn(t,Fo)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return l().createElement("ul",null,l().createElement("li",null,l().createElement("span",null,"> "),l().createElement(_,Zs({},t(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(_,Zs({},t("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(_,Zs({},t("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(_,Zs({},t("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:n=[]}=e,r=t.items||n;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}})))}},r.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:n=[]}=e,r=t.items||n;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}})))}},r.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:n=[]}=e,r=t.items||n;return l().createElement("div",{style:{height:200,...t.style}},l().createElement(To,{multiple:!0,value:g[b]?.in||[],dataSource:r,onCheckChange:e=>{const t=e.map((e=>e.value));y((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},C={"head-filter__popper":!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r},S=["cell--filter",{selected:m,actived:v}];return l().createElement(za(),{action:["click"],popupVisible:m,popup:(()=>{const e=t.filter.type,n=w[e];return n?l().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},l().createElement("div",null,n(t)),l().createElement(O.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},l().createElement(ge,{size:r,onClick:()=>(E({[b]:{}}),void f(!1))},s("qm.table.filter.reset")),l().createElement(ge,{type:"primary",size:r,onClick:()=>E()},s("qm.table.filter.search")))):(pe("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Ee()(C),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{p(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("div",{className:Ee()(S),title:s("qm.table.filter.text"),onClick:e=>e.stopPropagation()},l().createElement("span",{className:"svgicon icon"},l().createElement(Qs,null))))},ec=e=>{const{column:t}=e,{tableRef:n,bordered:r}=l().useContext(Ro),{columns:a,resizable:i,columnsChange:o=te}=n.current.props,s=l().useMemo((()=>_n(t)),[t]),c={resizable:!0,"is--line":i&&!r};return l().createElement("div",{className:Ee()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r,scrollBarRef:i}=n.current,l=r.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=jn(t,r.$table).left-i.current.scrollLeft+c;r.$table.classList.add("c--resize"),l.style.left=`${u}px`,l.style.display="block";const m=s.width||s.renderWidth;let p=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||Wo.defaultColumnWidth)||(p=Math.floor(n),l.style.left=`${t+u}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),l.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(An(a,s.dataIndex).width=p,o([...a]))},!1}})},tc=e=>{const{selectionKeys:t}=e,{tableRef:n,getRowKey:r,fetchParams:a,createTableList:i,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=l().useContext(Ro),{rowSelection:m}=n.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]),w=()=>{const{selectionRows:e}=n.current,{disabled:t}=m;return(t?e.filter((e=>!t(e))):e).map((e=>r(e,e.index)))},C=(()=>{const{recordsMap:e,allRowKeys:t}=n.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 l=a?i().filter((e=>!a(e))).map((e=>r(e,e.index))):i().map((e=>r(e,e.index)));return(0,Q.union)(l,w())})(),S=t.filter((e=>!C.includes(e))),N=t.length-S.length,I=N>0&&N<C.length,T=!!N&&N===C.length;s(S);const R=async()=>{const e=p;let t=[];c(!0);try{const n=await e.api(a);if(200===n.code){t=Array.isArray(n.data)?n.data:(0,Q.get)(n.data,e.dataKey)??[];const{disabled:a}=m;a&&(t=(0,Q.xor)(t,i().filter((e=>a(e))).map((e=>r(e,e.index))))),b.current=t}}catch(e){}return c(!1),t},k=async e=>{let t=[];t=v?e?await R():[]:e?C.slice(0):[],t=[...new Set([...t,...S])],o(t),g?.(e,t)};return l().createElement("div",{className:"cell--selection"},l().createElement(O.Checkbox,{checked:T,indeterminate:I,disabled:!C.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 R()):(0,Q.xor)(t,C),e=[...new Set([...e,...S])],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"})))},nc=e=>{const{style:t}=e,{tableRef:n,setRowExpandedKeys:r}=l().useContext(Ro),{expandable:a}=n.current.props,[i,o]=l().useState(a?.defaultExpandAllRows||!1);qe((()=>{r(i?[...n.current.allParentRowKeys]:[])}),[i]);const s=we("expand"),c={[`${s}--icon`]:!0,expanded:i,collapsed:!i};return l().createElement("span",{className:Ee()(c),title:"",onClick:e=>{e.stopPropagation(),o(!i)},style:t})},rc=()=>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"})),ac=()=>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"})),ic=e=>{const{tableColumns:t}=e,{tableRef:n,prefixCls:r,layout:a,flattenColumns:i,sorter:o,filters:s,superFilters:c,selectionKeys:d,isFetch:u,isGroupSubtotal:m,treeExpandIndex:p,tableChange:h,setSorter:f,setElementStore:g,resetTableScroll:y,getStickyLeft:b,getStickyRight:v,createGroupData:x,createTableFullData:E}=l().useContext(Ro),{ellipsis:w,resizable:C,multipleSort:S,rowSelection:N,expandable:I}=n.current.props,[T,R]=Wo.sortDirections,{tableOriginData:k}=n.current,{t:P}=G(),L=l().useRef(null),A=l().useMemo((()=>k.some((e=>Array.isArray(e.children)))),[k]),F=l().useMemo((()=>!u),[u]),_=l().useMemo((()=>!u),[u]),D=l().useMemo((()=>!I?.hideExpandAll),[I]),H=l().useMemo((()=>!(!N||(u?!N.selectAllOnCurrentPage&&!N.fetchAllRowKeys:N.hideSelectAll))),[u,N]);qe((()=>{j(),h(),y()}),[o]),qe((()=>{U(),h(),y()}),[s]),qe((()=>{U(),h(),y()}),[c]),l().useEffect((()=>{!le(o)&&ae((()=>j())),!le(s)&&ae((()=>U()))}),[]),l().useLayoutEffect((()=>{q()}),[]);const q=()=>{g("$header",L.current)},$=e=>{const{dataIndex:t,type:r,sorter:a,title:i,description:s}=e;if(t===Wo.selectionColumn&&"checkbox"===r){if("checkbox"===r)return l().createElement("div",{className:"cell"},H?l().createElement(tc,{selectionKeys:d}):P("qm.table.config.selectionText"));if("radio"===r)return l().createElement("div",{className:"cell"},i)}const c=[];return c.push(l().createElement("div",{key:0,className:"cell",title:nr(i)},n.current.isTreeTable&&t===p&&D?l().createElement(nc,null):null,t===Wo.expandableColumn&&D?l().createElement(nc,null):i)),s&&c.push(l().createElement(O.Tooltip,{key:1,placement:"top",title:s},l().createElement(Ce.InfoCircleOutlined,{className:"tip"}))),a&&c.push(M(o[t])),c},M=e=>{const t=["svgicon cell--sorter__asc",{actived:e===T}],n=["svgicon cell--sorter__desc",{actived:e===R}];return l().createElement("div",{key:2,className:"cell--sorter",title:P("qm.table.sorter.text")},l().createElement("span",{className:Ee()(t)},l().createElement(rc,null)),l().createElement("span",{className:Ee()(n)},l().createElement(ac,null)))},K=e=>l().createElement(Js,{column:e,filters:s}),z=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===R?null:R:T;S?(delete o[r],f(Object.assign({},o,{[r]:t}))):f(Object.assign({},{[r]:t}))}},j=()=>{F&&V()},V=e=>{const t=(0,Q.pickBy)(o,(e=>null!==e));W(t),e||Object.keys(t).length||W({index:T})},B=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,W=e=>{const{tableFullData:t}=n.current,r=((e,t)=>e.sort(((e,n)=>{for(const r in t){const a=i.find((e=>e.dataIndex===r)),l=t[r],o=Wn(e,r),s=Wn(n,r),c="function"!=typeof a?.sorter?B(o,s):a.sorter(e,n);if(0!==c)return"ascend"===l?c:-c}return 0})).slice(0))(m?x(rr(t)):t,e);E(r)},U=()=>{_&&Y()},Y=()=>{const e=c.length?ar(c):ar(s),t=""!==e?m?x(Rn(rr(k),e,A)):Rn(k,e,A):k;E(t),V(!0)},X=Mn(t),{tableBodyWidth:Z}=a;return l().createElement("div",{ref:L,className:`${r}--header-wrapper`},l().createElement("table",{className:`${r}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},l().createElement("colgroup",null,i.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("thead",null,(e=>e.map(((e,t)=>l().createElement("tr",{key:t,className:"header--row"},e.map(((t,r)=>((e,t,r)=>{const{dataIndex:a,colSpan:i,rowSpan:s,fixed:c,align:d,theadAlign:u,theadClassName:m="",sorter:p,filter:h,required:f,headRender:g}=e;if(0===i)return null;const y=u||d,x=["header--column",{"col--ellipsis":e.ellipsis??w,"col--center":"center"===y,"col--right":"right"===y,"column--required":!!f,"column-has-sorter":p,"column-has-filter":h,"column--sort":!!o[a],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&!r[t+(i??1)]?.fixed,"cell-fix-right-first":"right"===c&&!r[t-1]?.fixed,[m]:!!m}],E={left:"left"===c?`${b(a)}px`:"",right:"right"===c?`${v(a,"thead")}px`:""},S=C&&![Wo.expandableColumn,Wo.selectionColumn].includes(a);return l().createElement("th",{key:a,className:Ee()(x),colSpan:i,rowSpan:s,style:{...E},onClick:t=>z(t,e)},l().createElement("div",{className:"cell--wrapper"},g?l().createElement("div",{className:"cell--text cell"},g(e,n.current.tableFullData)):l().createElement(l().Fragment,null,l().createElement("div",{className:"cell--text"},$(e)),h?K(e):null)),S&&l().createElement(ec,{column:e}))})(t,r,e)))))))(X))))},lc=l().createContext([]),oc=require("react-dom");function sc(e,t,n){let r,a=n.initialDeps??[];return()=>{let i;n.key&&n.debug?.()&&(i=Date.now());const l=e(),o=l.length!==a.length||l.some(((e,t)=>a[t]!==e));if(!n.noCache?.()&&!o)return r;let s;if(a=l,n.key&&n.debug?.()&&(s=Date.now()),r=t(...l),n.key&&n.debug?.()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-s))/100,r=t/16,a=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${a(t,5)} / ${a(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange?.(r),r}}function cc(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const dc=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,a)),n)}};function uc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const mc=e=>e,pc=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},hc=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(a(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver((e=>{const t=e[0];if(t?.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void a({width:e.inlineSize,height:e.blockSize})}a(n.getBoundingClientRect())}));return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},fc={passive:!0},gc="undefined"==typeof window||"onscrollend"in window,yc=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&gc?()=>{}:dc(r,(()=>{t(a,!1)}),e.options.isScrollingResetDelay),l=r=>()=>{const{horizontal:l,isRtl:o}=e.options;a=l?n.scrollLeft*(o?-1:1):n.scrollTop,i(),t(a,r)},o=l(!0),s=l(!1);return s(),n.addEventListener("scroll",o,fc),n.addEventListener("scrollend",s,fc),()=>{n.removeEventListener("scroll",o),n.removeEventListener("scrollend",s)}},bc=(e,t,n)=>{if(t?.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},vc=(e,{adjustments:t=0,behavior:n},r)=>{const a=e+t;r.scrollElement?.scrollTo?.({[r.options.horizontal?"left":"top"]:a,behavior:n})};class xc{constructor(e){uc(this,"unsubs",[]),uc(this,"options",void 0),uc(this,"scrollElement",null),uc(this,"targetWindow",null),uc(this,"isScrolling",!1),uc(this,"scrollToIndexTimeoutId",null),uc(this,"measurementsCache",[]),uc(this,"itemSizeCache",new Map),uc(this,"pendingMeasuredCacheIndexes",[]),uc(this,"scrollRect",null),uc(this,"scrollOffset",null),uc(this,"scrollDirection",null),uc(this,"scrollAdjustments",0),uc(this,"shouldAdjustScrollPositionOnItemSizeChange",void 0),uc(this,"elementsCache",new Map),uc(this,"observer",(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver((e=>{e.forEach((e=>{this._measureElement(e.target,e)}))})):null);return{disconnect:()=>{t()?.disconnect(),e=null},observe:e=>t()?.observe(e,{box:"border-box"}),unobserve:e=>t()?.unobserve(e)}})()),uc(this,"range",null),uc(this,"setOptions",(e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options={debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mc,rangeExtractor:pc,onChange:()=>{},measureElement:bc,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0,...e}})),uc(this,"notify",(e=>{this.options.onChange?.(this,e)})),uc(this,"maybeNotify",sc((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:!1,noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]})),uc(this,"cleanup",(()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null})),uc(this,"_didMount",(()=>()=>{this.cleanup()})),uc(this,"_willUpdate",(()=>{const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e)return void this.maybeNotify();this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}})),uc(this,"getSize",(()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0))),uc(this,"getScrollOffset",(()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0))),uc(this,"getFurthestMeasurement",((e,t)=>{const n=new Map,r=new Map;for(let a=t-1;a>=0;a--){const t=e[a];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0})),uc(this,"getMeasurementOptions",sc((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,a)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a})),{key:!1})),uc(this,"getMeasurements",sc((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,l);for(let a=l;a<e;a++){const e=r(a),l=1===this.options.lanes?o[a-1]:this.getFurthestMeasurement(o,a),s=l?l.end+this.options.gap:t+n,c=i.get(e),d="number"==typeof c?c:this.options.estimateSize(a),u=s+d,m=l?l.lane:a%this.options.lanes;o[a]={index:a,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:!1,debug:()=>this.options.debug})),uc(this,"calculateRange",sc((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()]),((e,t,n)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,a=Ec(0,r,(t=>e[t].start),n);let i=a;for(;i<r&&e[i].end<n+t;)i++;return{startIndex:a,endIndex:i}}({measurements:e,outerSize:t,scrollOffset:n}):null),{key:!1,debug:()=>this.options.debug})),uc(this,"getIndexes",sc((()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count]),((e,t,n,r)=>null===t?[]:e({startIndex:t.startIndex,endIndex:t.endIndex,overscan:n,count:r})),{key:!1,debug:()=>this.options.debug})),uc(this,"indexFromElement",(e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)})),uc(this,"_measureElement",((e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const a=r.key,i=this.elementsCache.get(a);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(a,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))})),uc(this,"resizeItem",((e,t)=>{const n=this.measurementsCache[e];if(!n)return;const r=t-(this.itemSizeCache.get(n.key)??n.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))})),uc(this,"measureElement",(e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))})),uc(this,"getVirtualItems",sc((()=>[this.getIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,a=e.length;r<a;r++){const a=t[e[r]];n.push(a)}return n}),{key:!1,debug:()=>this.options.debug})),uc(this,"getVirtualItemForOffset",(e=>{const t=this.getMeasurements();if(0!==t.length)return cc(t[Ec(0,t.length-1,(e=>cc(t[e]).start),e)])})),uc(this,"getOffsetForAlignment",((e,t)=>{const n=this.getSize(),r=this.getScrollOffset();"auto"===t&&e>=r+n&&(t="end"),"end"===t&&(e-=n);const a=this.options.horizontal?"scrollWidth":"scrollHeight",i=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-n;return Math.max(Math.min(i,e),0)})),uc(this,"getOffsetForIndex",((e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),a=this.getScrollOffset();if("auto"===t)if(n.end>=a+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=a+this.options.scrollPaddingStart))return[a,t];t="start"}const i=n.start-this.options.scrollPaddingStart+(n.size-r)/2;switch(t){case"center":return[this.getOffsetForAlignment(i,t),t];case"end":return[this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,t),t];default:return[this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,t),t]}})),uc(this,"isDynamicMode",(()=>this.elementsCache.size>0)),uc(this,"cancelScrollToIndex",(()=>{null!==this.scrollToIndexTimeoutId&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)})),uc(this,"scrollToOffset",((e,{align:t="start",behavior:n}={})=>{this.cancelScrollToIndex(),"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})})),uc(this,"scrollToIndex",((e,{align:t="auto",behavior:n}={})=>{e=Math.max(0,Math.min(e,this.options.count-1)),this.cancelScrollToIndex(),"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const r=this.getOffsetForIndex(e,t);if(!r)return;const[a,i]=r;this._scrollToOffset(a,{adjustments:void 0,behavior:n}),"smooth"!==n&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout((()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(e))){const[a]=cc(this.getOffsetForIndex(e,i));t=a,r=this.getScrollOffset(),Math.abs(t-r)<1||this.scrollToIndex(e,{align:i,behavior:n})}else this.scrollToIndex(e,{align:i,behavior:n});var t,r})))})),uc(this,"scrollBy",((e,{behavior:t}={})=>{this.cancelScrollToIndex(),"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})})),uc(this,"getTotalSize",(()=>{const e=this.getMeasurements();let t;return t=0===e.length?this.options.paddingStart:1===this.options.lanes?e[e.length-1]?.end??0:Math.max(...e.slice(-this.options.lanes).map((e=>e.end))),Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)})),uc(this,"_scrollToOffset",((e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)})),uc(this,"measure",(()=>{this.itemSizeCache=new Map,this.notify(!1)})),this.setOptions(e)}}const Ec=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else{if(!(i>r))return a;t=a-1}}return e>0?e-1:0},wc="undefined"!=typeof document?l().useLayoutEffect:l().useEffect,Cc=e=>(e=>{const t=l().useReducer((()=>({})),{})[1],n={...e,onChange:(n,r)=>{r?(0,oc.flushSync)(t):t(),e.onChange?.(n,r)}},[r]=l().useState((()=>new xc(n)));return r.setOptions(n),wc((()=>r._didMount()),[]),wc((()=>r._willUpdate())),r})({observeElementRect:hc,observeElementOffset:yc,scrollToFn:vc,...e}),Sc=(e,t,n,r,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)/r,f=s.filter((e=>o[e]?.children?.length));let g=Nc(o,n.eventKey);if(u<m+p/2){const e=l.findIndex((e=>e===g.key)),t=l[e<=0?0:e-1];g=Nc(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&&Tc(g);e+=1)g=g.parent,E+=1;const w=t.data,C=g.node;let S=!0;return Rc(g)&&0===g.level&&u<m+p/2&&i({dragNode:w,dropNode:C,dropPosition:-1})&&g.key===n.eventKey?x=-1:(b.children||[]).length&&f.includes(v)?i({dragNode:w,dropNode:C,dropPosition:0})?x=0:S=!1:0===E?h>-1.5?i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,dropPosition:0})?x=c?1:0:i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,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}},Nc=(e,t)=>e[t],Ic=e=>e.split("-"),Tc=e=>{if(e.parent){const t=Ic(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Rc=e=>{const t=Ic(e.pos);return 0===Number(t[t.length-1])},Oc=(e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const a=Nc(r,e);return{eventKey:e,pos:a?a.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}},kc=({openDragSort:e})=>{const{tableRef:t,getRowKey:n,rowExpandedKeys:r,setRowExpandedKeys:a,createTableFullData:i,dataChange:o}=l().useContext(Ro),{tableFullData:s,allRowKeys:c,isTreeTable:d}=t.current,u=ne,m=l().useRef(null),p=l().useRef(null),h=l().useRef(null),f=l().useRef(),[g,y]=l().useState({}),[b,v]=l().useState(null),[x,E]=l().useState([]),[w,C]=l().useState(0),[S,N]=l().useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),I=e=>{N((t=>Object.assign({},t,e)))};l().useLayoutEffect((()=>{e&&y((e=>{const t={},r=(e,a=null,i=0)=>{const l=[];return e.forEach(((e,o)=>{const s=n(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=r(e.children,c,i+1)),t[s]=c,l.push(c)})),l};return r(e),t})(s))}),[s]),l().useEffect((()=>()=>{window.removeEventListener("dragend",O)}),[]);const T=()=>{I({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},R=()=>{null!==b&&(v(null),I({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),p.current=null,h.current=null},O=e=>{k(e,null,!0),window.removeEventListener("dragend",O)},k=(e,t,n)=>{I({dragOverNodeKey:null}),R(),m.current=null,window.removeEventListener("dragend",O)};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;m.current=t,p.current={x:e.clientX,y:e.clientY};const i=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(r,n);v(n),E(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Nc(t,e).children),n})(n,g)),C(2*Wo.treeTable.textIndent),a(i),window.addEventListener("dragend",O)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(h.current!==n&&(h.current=n),!m.current)return void T();const{dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v,dragOverNodeKey:E}=Sc(e,m.current,t,w,p.current,u,c,g,r,!d);-1===x.indexOf(o)&&v?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),m.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{if(null===b)return;let e=[...r];const t=Nc(g,n);t&&t.children?.length&&(e=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(r,n)),a(e)}),800)),m.current.eventKey!==o||0!==l?I({dragOverNodeKey:E,dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v}):T()):T()},onNodeDragOver:(e,t)=>{if(!m.current)return;const{dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:h}=Sc(e,m.current,t,w,p.current,u,c,g,r,!d);-1===x.indexOf(i)&&o&&(m.current.eventKey===i&&0===a?null===S.dropPosition&&null===S.dropLevelOffset&&null===S.dropTargetKey&&null===S.dropContainerKey&&null===S.dropTargetPos&&!1===S.dropAllowed&&null===S.dragOverNodeKey||T():n===S.dropPosition&&a===S.dropLevelOffset&&i===S.dropTargetKey&&l===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&h===S.dragOverNodeKey||I({dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:h}))},onNodeDragLeave:(e,t)=>{h.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(T(),h.current=null)},onNodeDragEnd:k,onNodeDrop:(e,t,r=!1)=>{const{dropPosition:a,dropTargetKey:l,dropTargetPos:c,dropAllowed:d,dragOverNodeKey:u}=S;if(!d)return;if(I({dragOverNodeKey:null}),R(),null===l)return;const p={...Oc(l,{dropPosition:a,dragOverNodeKey:u,keyEntities:g}),data:Nc(g,l).node};-1!==x.indexOf(l)&&pe("Table Draggable","无法拖放到 `dragNode` 的子节点");const h=Ic(c),f={event:e,node:p,dragNode:m.current,dragNodesKeys:[m.current.eventKey].concat(x),dropToGap:0!==a,dropPosition:a+Number(h[h.length-1])};r||(e=>{const t=e.node.eventKey,r=e.dragNode.eventKey,a=e.node.pos.split("-"),l=e.dropPosition-Number(a[a.length-1]),c=(e,t,r)=>{for(let a=0;a<e.length;a++){if(n(e[a],e[a].index)===t)return r(e[a],a,e);e[a].children&&c(e[a].children,t,r)}},d=[...s];let u;if(c(d,r,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,a)=>{n=a,e=r})),-1===l?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));i(d),o()})(f),m.current=null},indent:w,dropOptions:S}},Pc=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Lc=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),Ac=(e,t)=>{const n=e.target;return!("button"in e&&e.button>0||n&&!Pc(n).contains(n)||t.current?.contains(n))};function Fc({ref:e,handler:t,enabled:n=!0,omitClassNames:r=[]}){const a=Y(t),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!n)return;const i=t=>{Ac(t,e)&&(l.current.isPointerDown=!0)},o=n=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:t&&l.current.isPointerDown&&Ac(n,e)&&Lc(n,r)&&(l.current.isPointerDown=!1,a(n))},s=n=>{l.current.ignoreEmulatedMouseEvents=!0,t&&l.current.isPointerDown&&Ac(n,e)&&Lc(n,r)&&(l.current.isPointerDown=!1,a(n))},c=Pc(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,n])}function _c(){const[,e]=i.useReducer((e=>e+1),0);return e}const Dc=l().forwardRef(((e,t)=>{const{rowKey:n,rowIndex:r,row:a,className:i,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:p,onNodeDragLeave:h,onNodeDragEnd:f,onNodeDrop:g}=e,y=l().useRef({eventKey:n,data:a,props:e}),b=l().useRef(!1),[v,x]=l().useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,I=C===n&&0===E,T=C===n&&-1===E,R=C===n&&1===E,O=a._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const P={"body--row-draggable":!0,"body--row-dragging":v,"drop-target":S===n,"drop-container":N===n,"drag-over":I,"drag-over-gap-top":T,"drag-over-gap-bottom":R};return l().createElement("tr",{ref:t,"data-row-key":n,"data-row-index":r,className:Ee()(i,P),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),b.current=t)},onDragStart:e=>{if(e.stopPropagation(),b.current)return e.preventDefault();x(!0),u(e,y.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,y.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),p(e,y.current)},onDragLeave:e=>{e.stopPropagation(),h(e,y.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,y.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,y.current)}},e.children,C===n&&null!==E&&null!==w&&l().createElement("td",{className:"drop-indicator",style:k}))}));Dc.displayName="DraggableTr";const Hc=Dc,qc=e=>{const{selectionKeys:t,column:n,record:r,rowKey:a}=e,{tableRef:i,getAllChildRowKeys:o}=l().useContext(Ro),{rowSelection:s}=i.current.props,c=l().useMemo((()=>n.type||""),[n.type]),d=e=>{const n=s.checkStrictly??!0;if(!i.current.isTreeTable||n)return!1;const r=Hn(i.current.deriveRowKeys,e);return((e,t)=>{const n=new Set(t);let r=!1,a=!1;for(const t of e)if(n.has(t)?r=!0:a=!0,r&&a)break;return r&&a})(o(r?.children??[]),t)};return"radio"===c?(()=>{const e=s.disabled,n=e?.(r),i=!n&&t[0]===a;return l().createElement(O.Radio,{checked:i,disabled:n})})():(()=>{const e=s.disabled,n=e?.(r),i=!!t.includes(a);return l().createElement(O.Checkbox,{checked:i,indeterminate:d(a),disabled:n})})()},$c=e=>{const{record:t,rowKey:n,style:r}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:o}=l().useContext(Ro),{expandable:s={}}=a.current.props,[c]=l().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=l().useMemo((()=>i.includes(n)),[i,n]);qe((()=>{s.onExpand?.(d,t)}),[d]);const u=we("expand"),m={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return l().createElement("span",{className:Ee()(m),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==n)):[...i,n];o(t)},style:r})},Mc=l().forwardRef(((e,t)=>{const{size:n,defaultValue:r,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(Ea())(t).toFixed(m)),t},E=void 0!==a,[w,C]=l().useState(r??""),S=y(E?a:w),N=b(S);return qe((()=>{e.onChange?.(N)}),[w]),l().createElement(O.Input,{ref:t,size:n,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const n=b(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===m&&n.includes(".")&&(r=!1),i>=0&&n.startsWith("-")&&(r=!1),r){if(!p&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):C(t)})(n)}},onFocus:v,onBlur:()=>{const t=x(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(N),N)}})}));Mc.displayName="InputNumber";const Kc=Mc;function zc(){return zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zc.apply(null,arguments)}const{Search:jc}=O.Input,Vc=l().forwardRef(((e,t)=>{const{column:n,record:r,rowKey:a,columnKey:i}=e,{tableRef:o,tableBodyRef:s,$size:c,flattenColumns:d,updateTableFlatData:u,doFieldValidate:m,dataChange:p}=l().useContext(Ro),h=l().useContext(lc),{t:f}=G(),g=_c(),{store:y,fieldAuth:b}=o.current,v=n.editRender?.(r,n)||{},x=l().useRef(null),E=l().useRef(null),w=l().useRef(null),C=l().useRef(null),S=l().useRef(null),N=l().useRef(!1),I=l().useRef({}),T=l().useRef({}),R=l().useRef([]),[k,P]=l().useState(!1),[L,A]=l().useState(!1),[F,D]=l().useState(v.items||[]),[H,q]=l().useState(),M=(v.editable||(0,Q.isEqual)(h,[a,i]))&&!v.disabled&&!b[i]?.disabled,K=`${a}|${i}`,z=2===h.length?`${h[0]}|${h[1]}`:"",j=![...y.state.required,...y.state.validate].some((({x:e,y:t})=>e===a&&t===i)),V=y.state.required.find((({x:e,y:t})=>e===a&&t===i))?.text||"",B=y.state.validate.find((({x:e,y:t})=>e===a&&t===i))?.text||"",W=y.state.edited.some((({x:e,y:t})=>e===a&&t===i)),U=M||!j||k||L,Y=!!v.helper?.combinedDataIndex&&("search-helper"===v.type||"tree-helper"===v.type),X=v.type?.endsWith("multiple");l().useLayoutEffect((()=>{U&&z===K&&ee()}),[h]),l().useLayoutEffect((()=>{const{items:e}=v;X&&e&&J(e.map((e=>({[T.current.valueKey]:e.value,[T.current.textKey]:e.text}))))}),[]);const Z=()=>{u(),p()},J=e=>{R.current=e},ee=()=>{const{type:e}=v;switch(e){case"text":E.current?.focus();break;case"number":w.current?.select();break;case"search-helper":C.current?.focus();break;case"tree-helper":S.current?.focus()}},te=()=>{const{type:e}=v;switch(e){case"text":E.current?.blur();break;case"number":w.current?.blur();break;case"search-helper":C.current?.blur();break;case"tree-helper":S.current?.blur()}};l().useImperativeHandle(t,(()=>({focus:ee,blur:te,isEditable:()=>!v.disabled,isOpening:()=>k})));const re=(e,t,n)=>{const{cornerSign:r=!0}=v.extra||{};y.addToUpdated(e),r&&y.addToEdited({x:t,y:n})},ie=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",le={text:(e,t,n)=>{const{dataIndex:r}=t,{type:o,extra:s={},rules:d=[],onInput:u,onChange:p,onEnter:h,onBlur:y}=v,b=Wn(e,r),x=Object.assign({},{minRows:1,maxRows:4},s.autoSize),w=n?{rows:x.minRows,autoSize:x}:null,C=s.password?O.Input.Password:n?O.Input.TextArea:O.Input;return l().createElement(C,zc({ref:E,size:c,value:b,maxLength:s.maxLength,showCount:s.showCount},w,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||f("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:n=>{const l=n.target.value??"";Un(e,r,l),m(d,l,a,i,nr(t.title)),g(),u?.({[K]:l}),N.current=!0},onBlur:t=>{const n=t.target.value??"";N.current&&(N.current=!1,re(e,a,i),p?.({[K]:n},e),y?.({[K]:n},e),Z())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const n=t.target.value??"";h?.({[K]:n},e)}},onKeyDown:e=>{n&&13===e.keyCode&&!e.shiftKey&&h&&e.preventDefault()}}))},textarea:(e,t)=>le.text(e,t,!0),number:(e,t)=>{const{dataIndex:n,precision:r,formatType:o}=t,{type:s,extra:d={},rules:u=[],onInput:p,onChange:h,onEnter:y,onBlur:b}=v,x=Wn(e,n);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(Ea())(e).times(100).toNumber()}`,C=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Ea())(e).times(.01).toString()),l().createElement(Kc,{ref:w,size:c,value:x,min:d.min,max:d.max,precision:r,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===o?"%":void 0),placeholder:d.placeholder||f("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:C,onChange:r=>{Un(e,n,r),m(u,r,a,i,nr(t.title)),g(),p?.({[K]:r}),N.current=!0},onBlur:(t,r)=>{if(!N.current)return;N.current=!1;let l=d.stringMode?t:ie(t);"percent"===o&&"."===r.charAt(r.length-1)&&(l=Number(t)/100),Un(e,n,l),re(e,a,i),h?.({[K]:l},e),b?.({[K]:l},e),Z()},onEnter:(t,n)=>{let r=d.stringMode?t:ie(t);"percent"===o&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),y?.({[K]:r},e)}})},select:(e,t,n)=>{const{dataIndex:r,dictItems:o=[]}=t,{type:s,extra:d={},rules:u=[],items:p,onChange:h,onEnter:g}=v,y=p||o,b=Wn(e,r);let x=b;return l().createElement(O.Select,{mode:n?"multiple":void 0,size:c,popupClassName:Wo.popupClassName,value:b||void 0,placeholder:d.placeholder||f("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 n=t?.children?.toString()||"";return`${n}|${Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>P(e),onChange:n=>{Un(e,r,n),m(u,n,a,i,nr(t.title)),re(e,a,i),h?.({[K]:n},e),Z()},onSelect:e=>{x=e},onInputKeyDown:t=>{13===t.keyCode&&ae((()=>g?.({[K]:x},e)))}},y.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>le.select(e,t,!0),date:(e,t,n)=>{const{dataIndex:r}=t,{type:o,extra:s={},rules:d=[],onChange:u}=v,p=n||"exactdate",h=Wn(e,r);return l().createElement(_,{size:c,popupClassName:Wo.popupClassName,value:Zn(h,Er[p])??void 0,picker:xr[p],format:s.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=s;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:n=>{const l=Jn(n,Er[p]);Un(e,r,l),m(d,l,a,i,nr(t.title)),re(e,a,i),u?.({[K]:l},e),Z()}})},datetime:(e,t)=>le.date(e,t,"datetime"),month:(e,t)=>le.date(e,t,"month"),year:(e,t)=>le.date(e,t,"year"),time:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],onChange:d}=v,u="HH:mm:ss",p=Wn(e,n);return l().createElement($,{size:c,popupClassName:Wo.popupClassName,value:Zn(p,u)??void 0,format:o.format||u,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:r=>{const l=Jn(r,u);Un(e,n,l),m(s,l,a,i,nr(t.title)),re(e,a,i),d?.({[K]:l},e),Z()}})},checkbox:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],onChange:c}=v,{trueValue:d=Lo,falseValue:u=Ao,disabled:p}=o,h=Wn(e,n);return l().createElement(O.Checkbox,{checked:h===d,disabled:p,onChange:r=>{const l=r.target.checked?d:u;Un(e,n,l),m(s,l,a,i,nr(t.title)),re(e,a,i),c?.({[K]:l},e),Z()}})},switch:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],onChange:c}=v,{trueValue:d=Lo,falseValue:u=Ao,disabled:p}=o,h=Wn(e,n);return l().createElement(O.Switch,{checked:h===d,disabled:p,onChange:r=>{const l=r?d:u;Un(e,n,l),m(s,l,a,i,nr(t.title)),re(e,a,i),c?.({[K]:l},e),Z()}})},"search-helper":(e,t)=>{const{dataIndex:n,precision:r}=t,{type:o,extra:s={},rules:u=[],helper:p={},onInput:h,onChange:g,onEnter:y}=v,b=Gn(e,Y?p.combinedDataIndex:n),x=p.fieldAliasMap;x||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes(n)||pe("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(p.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||pe("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[n].includes("|")&&pe("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=e=>{const{filterAliasMap:t}=p,r=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[n]:r};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](r):r;else i[e]=r})),i},S=e=>{const{autoQueryAssign:t=!0}=p;t&&(I.current=w(e)),P(!0)},T=(n,r)=>{const{beforeOpen:a}=p,i=(a??ne)({[K]:b},e,t);i?.then?i.then((()=>{S(n),r?.()})).catch((()=>{})):!1!==i&&(S(n),r?.())},R=e=>{const t={};for(const r in E){const a=E[r];r!==n&&(t[r]=Gn(e,a))}const r=E[n]?Gn(e,E[n]):"";L(r,t);const{closed:a}=p;P(!1),a?.(e)},O=()=>{const{onlySelect:e=!0}=p;N.current&&L(e?"":b),P(!1)},L=(l="",o)=>{if((0,Q.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const n=o[t],r=d.find((e=>e.dataIndex===t));if(r){Un(e,t,n,r.precision);const i=r.editRender?.(e,r);i&&Array.isArray(i.rules)&&m(i.rules,n,a,t,nr(r.title))}else Un(e,t,n)}Y&&!l&&((e,t,n,r)=>{if(!t.includes("|"))return Un(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,n)=>{t&&Un(e,t,a[n]?.trim())}))})(e,p.combinedDataIndex),Un(e,n,l,r),m(u,l,a,i,nr(t.title)),re(e,a,i),g?.({[K]:l},e),Z(),I.current={},N.current=!1,q(void 0)},F={visible:k,title:f("qm.searchHelper.text"),width:p.width??"60%",loading:!1,wrapClassName:Wo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{O()}},_={...p,size:c,initialValue:Object.assign({},I.current,p.initialValue),onClose:e=>{e?R(e):O()}};return l().createElement(l().Fragment,null,l().createElement(jc,{ref:C,value:H??b,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:r=!0,table:a}=p;if(N.current&&!k)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:n={}}=p,{beforeFetch:r=ne}=t.fetch;return new Promise((async(a,i)=>{const l=(0,Q.merge)({},t.fetch.params,{...n,...w(e)},{currentPage:1,pageSize:500});if(!r(l))return i();A(!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((()=>A(!1)))}}))})(t).then((e=>((e=[],t)=>{const r=e.filter((e=>Gn(e,E[n]).toString().includes(t)));if(1===r.length)return R(r[0]);T(t)})(e,t))).catch((()=>L(""))):void L(t)},onChange:e=>{const{value:t}=e.target;h?.({[K]:t}),N.current=!0,q(t)},onKeyDown:e=>{if(13===e.keyCode){const t=e.target.value??"";!k&&T(t)}},onDoubleClick:e=>{const{value:t}=e.target;T(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&T(e)}}),l().createElement(mn,F,l().createElement(fd,_)))},"search-helper-multiple":(e,t)=>{const{dataIndex:n}=t,{type:r,items:o=[],extra:s={},rules:d=[],helper:u={},onInput:p,onChange:h,onEnter:g}=v,y=Wn(e,n),b=u.fieldAliasMap;b||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||pe("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),T.current=x;const E=n=>{const{beforeOpen:r}=u,a=(r??ne)({[K]:y},e,t);a?.then?a.then((()=>{P(!0),n?.()})).catch((()=>{})):!1!==a&&(P(!0),n?.())},w=()=>{P(!1)},C=r=>{Un(e,n,r),m(d,r,a,i,nr(t.title)),re(e,a,i),h?.({[K]:r},e,R.current),Z()},S={visible:k,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:Wo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{w()}},N={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=x;J((0,Q.uniqBy)([...R.current.filter((e=>t.includes(e[r]))),...e],r));const a=R.current.map((e=>({text:e[n],value:e[r]}))),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;P(!1),l?.(R.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:y,placeholder:s.placeholder||f("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&&E()},onDoubleClick:()=>{s.disabled||E()},onChange:e=>{const{valueKey:t}=x;J(R.current.filter((n=>e.includes(n[t])))),C(e)}},F.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:()=>{E()}})))),l().createElement(mn,S,l().createElement(fd,N)))},"tree-helper":(e,t)=>{const{dataIndex:n,precision:r}=t,{type:o,extra:s={},rules:u=[],helper:p={},onChange:h,onEnter:g}=v,y=Gn(e,Y?p.combinedDataIndex:n),b=p.fieldAliasMap;b||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(n)||pe("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(p.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||pe("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[n].includes("|")&&pe("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=n=>{const{beforeOpen:r}=p,a=(r??ne)({[K]:y},e,t);a?.then?a.then((()=>{P(!0),n?.()})).catch((()=>{})):!1!==a&&(P(!0),n?.())},w=()=>{P(!1)},C=(l="",o)=>{if((0,Q.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const n=o[t],r=d.find((e=>e.dataIndex===t));if(r){Un(e,t,n,r.precision);const i=r.editRender?.(e,r);i&&Array.isArray(i.rules)&&m(i.rules,n,a,t,nr(r.title))}else Un(e,t,n)}Un(e,n,l,r),m(u,l,a,i,nr(t.title)),re(e,a,i),h?.({[K]:l},e),Z()},N={visible:k,title:f("qm.searchHelper.text"),width:p.width??"40%",loading:!1,wrapClassName:Wo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{w()}},I={...p,defaultSelectedKeys:[y],size:c,onClose:e=>{e?(e=>{const t={};for(const r in x){const a=x[r];r!==n&&(t[r]=Gn(e,a))}const r=x[n]?Gn(e,x[n]):"";C(r,t);const{closed:a}=p;P(!1),a?.(e)})(e):w()}};return l().createElement(l().Fragment,null,l().createElement(jc,{ref:S,value:y,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!k&&E())},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?E():C(""))}}),l().createElement(mn,N,l().createElement(Cd,I)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},items:s=[],rules:d=[],helper:u={},onInput:p,onChange:h,onEnter:g}=v,y=Wn(e,n),b=u.fieldAliasMap;b||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||pe("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),T.current=x;const E=n=>{const{beforeOpen:r}=u,a=(r??ne)({[K]:y},e,t);a?.then?a.then((()=>{P(!0),n?.()})).catch((()=>{})):!1!==a&&(P(!0),n?.())},w=()=>{P(!1)},C=r=>{Un(e,n,r),m(d,r,a,i,nr(t.title)),re(e,a,i),h?.({[K]:r},e,R.current),Z()},S={visible:k,title:f("qm.searchHelper.text"),width:u.width??"40%",loading:!1,wrapClassName:Wo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{w()}},N={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=x;J(e);const r=R.current.map((e=>({text:e[t],value:e[n]})));D(r),C(r.map((e=>e.value)));const{closed:a}=u;P(!1),a?.(R.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:y,placeholder:o.placeholder||f("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&&E()},onDoubleClick:()=>{o.disabled||E()},onChange:e=>{const{valueKey:t}=x;J(R.current.filter((n=>e.includes(n[t])))),C(e)}},F.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:()=>{E()}})))),l().createElement(mn,S,l().createElement(Cd,N)))},custom:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],render:c,onChange:d}=v;if(!c)return pe("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const u=Wn(e,n),p=r=>{Un(e,n,r),m(s,r,a,i,nr(t.title)),re(e,a,i),d?.({[K]:r},e),Z()},h=c(e,t,p);return l().isValidElement(h)?l().cloneElement(h,{value:u,disabled:o.disabled,readOnly:o.readOnly,popupClassName:Wo.popupClassName,onChange:p}):null}};return l().createElement(l().Fragment,null,U?(()=>{const{type:e}=v,t=le[e];if(!t)return pe("Table","单元格编辑的类型 `type` 配置不正确"),null;const a=["cell--edit",{"is-error":!j}];return l().createElement("div",{ref:x,className:Ee()(a)},t(r,n),!j&&l().createElement("div",{className:"cell-error"},V||B))})():(()=>{const{disabled:t,extra:n={}}=v,{disabledColor:r,disabledBgColor:a}=n,i=["cell--show",{"is-cell-bg":t&&a}];return l().createElement(l().Fragment,null,l().createElement("span",{className:Ee()(i),style:{color:t?r:""}},e.children),t&&a&&l().createElement("i",{className:"cell--bg",style:{background:a}}))})(),W&&l().createElement("i",{className:"cell--sign"}))}));Vc.displayName="CellEdit";const Bc=Vc,Wc=require("copy-to-clipboard");var Uc=r.n(Wc);const Gc=(e,...t)=>l().isValidElement(e)?l().cloneElement(e,...t):null,Yc=e=>{const{text:t,options:n,showMessage:r=!0,onCopy:a}=e,{t:i}=G();return Gc(e.children,{onClick:o=>{const s=l().Children.only(e.children),c=Uc()(t,n);a?.(t,c),c&&r&&O.message.success(i("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Yc.displayName="QmCopyToClipboard";const Xc=Yc,Qc=l().forwardRef(((e,t)=>{const{column:n,row:r,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c}=e,{tableRef:d,selectionKeys:u,treeExpandIndex:m,updateMark:p}=l().useContext(Ro),{dataIndex:h,canCopy:f,render:g,editRender:y,shouldCellUpdate:b}=n,{t:v}=G(),{renderText:x,getTitleFromCellNode:E}=as(),w=l().useRef(null),C=Wn(r,h),[S,N]=function(e,c,d){const u=i.useRef({});return"value"in u.current&&!((e,t)=>{if(b){const[,n]=e,[,a]=t;return b(a,n,r)}return!((e,t,n=!1)=>{const r=new Set;return function e(t,a,i=1){if(r.has(t))return!1;if(t===a)return!0;if(n&&i>1)return!1;r.add(t);const l=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],a[n],l))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const n=Object.keys(t);return n.length===Object.keys(a).length&&n.every((n=>e(t[n],a[n],l)))}return!1}(e,t)})(e,t,!0)})(u.current.condition,c)||(u.current.value=(()=>{const e=g?g(C,r,n,a,o):x(C,n,r);return[e,y?l().createElement(Bc,{ref:t,column:n,record:r,rowKey:s,columnKey:h},e):null]})(),u.current.condition=c),u.current.value}(0,[p,r,C,g,y]);l().useEffect((()=>{if([Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn].includes(h))return;const e=w.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const I=e=>Array.isArray(e.children);return l().createElement("div",{ref:w,className:"cell"},(()=>{if(h===Wo.expandableColumn)return l().createElement($c,{record:r,rowKey:s});if(h===Wo.selectionColumn)return l().createElement(qc,{selectionKeys:u,column:n,record:r,rowKey:s});if(N)return N;if(d.current.isTreeTable&&h===m)return l().createElement(l().Fragment,null,(e=r._level)?l().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*Wo.treeTable.textIndent+"px"}}):null,l().createElement($c,{key:"expand",record:r,rowKey:s,style:I(r)?{}:{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(Xc,{text:e},l().createElement(Ce.CopyOutlined,{className:"icon",title:v("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Qc.displayName="Cell";const Zc=Qc,Jc={open:!1,offsetX:0,offsetY:0},ed=l().forwardRef(((e,t)=>{const{tableRef:n,getRowKey:r,prefixCls:a,tableFlatData:i,flattenColumns:o,mergedTdCells:s,setMergedCells:c}=l().useContext(Ro),{areaSelection:d={}}=n.current.props,{elementStore:u}=n.current,{t:m}=G(),p=l().useRef(document.onselectstart),h=l().useRef(null),f=l().useRef(null),g=l().useRef(null),y=e=>{g.current=e},[b,v]=l().useState(null),[x,E]=l().useState(null),[w,C]=l().useState(null),S=e=>{if(!e)return C(null);let t=!1;for(const n in e)if(w?.[n]!==e[n]){t=!0;break}t&&C(Object.assign({},w,e))};Fc({ref:h,handler:()=>M()}),l().useEffect((()=>{const e=zt()(u.$tableBody,"mousedown",F),t=zt()(u.$tableBody,"contextmenu",L),n=zt()(document,"keydown",A);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const N=()=>{v(null),S(null),y(null),E(null)};l().useImperativeHandle(t,(()=>({blur:N})));const I=e=>{let t=e;for(;t;){if(!u.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},T=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),R=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),O=e=>{let[t,n,r,a]=[1/0,-1/0,1/0,-1/0];for(const i of e)t=Math.min(t,i.rowStart),n=Math.max(n,i.rowEnd),r=Math.min(r,i.colStart),a=Math.max(a,i.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:a}},k=wt((e=>{let t=O([R(e),g.current]);s.forEach((e=>{const n=i.findIndex((t=>r(t,t.index)===e.rowKey)),a=o.findIndex((t=>t.dataIndex===e.dataIndex)),l={rowStart:n,rowEnd:n+e.rowSpan,colStart:a,colEnd:a+e.colSpan};var s,c;c=l,(s=t).rowEnd<=c.rowStart||s.rowStart>=c.rowEnd||s.colEnd<=c.colStart||s.colStart>=c.colEnd||(t=O([t,l]))})),S(t)}),5),P=e=>{c(e),d.onCellMerge?.(e),ae((()=>N()))},L=Y((e=>{d.cellMerge&&b&&q(e.clientX,e.clientY)?(e.preventDefault(),$(e)):x?.open&&M()})),A=Y((e=>{27===e.keyCode&&N()})),F=Y((e=>{e.stopPropagation();const t=I(e.target);if(1!==e.buttons||!t)return;M();const n=T(t);v(n);const r=R(n);y(r),S(r),document.addEventListener("mousemove",_),document.addEventListener("mouseup",D),p.current=document.onselectstart,document.onselectstart=()=>!1})),_=Y((e=>{const t=I(e.target);t&&k(T(t))})),D=Y((()=>{d.onSelectChange?.((()=>{const e=[];if(!b||!w)return e;for(let t=w.rowStart;t<w.rowEnd;t++)for(let n=w.colStart;n<w.colEnd;n++)e.push({rowKey:r(i[t],i[t].index),dataIndex:o[n].dataIndex,cellValue:Wn(i[t],o[n].dataIndex)});return e})()),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",D),H()})),H=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)},q=(e,t)=>{const{top:n,left:r}=u.$tableBody.parentNode.getBoundingClientRect(),[a,i]=[e-r,t-n],{el:l,et:o,ew:s,eh:c}=V();return!(a<l||a>l+s||i<o||i>o+c)},$=e=>{const{top:t,left:n,height:r}=f.current.getBoundingClientRect();E({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},M=()=>{E((e=>({...e,open:!1})))},K=e=>({rowIndex:i.findIndex((t=>r(t,t.index)===e.rowKey)),colIndex:o.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),z=()=>{if(!b||!w||(t=w,(e=b).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return N();var e,t;const n={rowKey:r(i[w.rowStart],i[w.rowStart].index),dataIndex:o[w.colStart].dataIndex,rowSpan:w.rowEnd-w.rowStart,colSpan:w.colEnd-w.colStart};P([...s.filter((e=>!((e,t)=>{const n=K(e),r=K(t),[a,i,l,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return a<=s&&i<=c&&l>=d&&o>=u||s<=a&&c<=i&&d>=l&&u>=o})(e,n))),n])},j=()=>{const e=r(i[w.rowStart],i[w.rowStart].index),t=o[w.colStart].dataIndex;P(s.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},V=()=>{const{w:e,h:t,l:r,t:a}=b,i=o.slice(0,w.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),l=n.current.rowHeight*w.rowStart;return{sl:r,st:a,sw:e,sh:t,el:i,et:l,ew:o.slice(0,w.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-i,eh:n.current.rowHeight*w.rowEnd-l}};return l().createElement("div",{className:`${a}--area-select`},(()=>{if(!b||!w)return null;const{sl:e,st:t,sw:n,sh:r,el:a,et:i,ew:o,eh:s}=V(),{open:c,offsetX:d,offsetY:u}=x||Jc,p=l().createElement("ul",{ref:h,className:"ant-dropdown-menu"},l().createElement("li",{className:"ant-dropdown-menu-item",onClick:z},m("qm.table.areaSelect.mergeCell")),l().createElement("li",{className:"ant-dropdown-menu-item",onClick:j},m("qm.table.areaSelect.cancelMerge")));return l().createElement(l().Fragment,null,l().createElement("div",{className:"active-area",style:{left:e,top:t,width:n,height:r}}),l().createElement(za(),{popupVisible:c,popup:p,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:Wo.popupClassName,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}})))})())}));ed.displayName="AreaSelect";const td=ed,nd=l().forwardRef(((e,t)=>{const{tableRef:n,getRowKey:r,prefixCls:a,tableFlatData:i,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:m,layout:p,showFooter:h,selectionKeys:f,rowExpandedKeys:g,highlightKey:y,isPingLeft:b,isPingRight:v,isTableEmpty:x,isGroupSubtotal:E,setElementStore:w,setSelectionKeysEffect:C,setHighlightKey:S,getStickyLeft:N,getStickyRight:I,setPingLeft:T,setPingRight:R,setFullScreen:O,findParentRowKeys:k,getAllChildRowKeys:P,scrollBottomDebouncer:L}=l().useContext(Ro),{height:A,minHeight:F,maxHeight:_,rowHeight:D,rowSelection:H,rowHighlight:q,expandable:$,stripe:M,summation:K,rowStyle:z,cellStyle:j,spanMethod:V,tableConfig:B,areaSelection:W,ellipsis:U,showHeader:G,rowDraggable:X,onRowClick:Z,onRowDblclick:J,onRowContextmenu:ee,onRowEnter:re}=n.current.props,ae=l().useRef(null),ie=l().useRef({}),le=l().useRef(null),oe=l().useRef({prevST:0,prevSL:0}),{onNodeDragStart:se,onNodeDragEnter:ce,onNodeDragOver:de,onNodeDragLeave:ue,onNodeDragEnd:me,onNodeDrop:pe,indent:he,dropOptions:fe}=kc({openDragSort:X}),{rowVirtualizer:ge,columnVirtualizer:ye,virtualRows:be,virtualColumns:ve,resetItemXSize:xe,getYIndexes:we,virtualTranslateY:Ce,virtualTranslateX:Se,calcVirtualYSize:Ne,calcVirtualXSize:Ie,scrollToYIndex:Te}=((e,t)=>{const{tableRef:n}=l().useContext(Ro),{props:r,scrollBarRef:a,rowHeight:i}=n.current,o=r.tableConfig?.overscan||1,s=l().useMemo((()=>a.current?.container.children[0]??null),[a.current]),c=l().useMemo((()=>{const e=[],n=[];return t.forEach(((t,r)=>{"left"===t.fixed&&e.push(r),"right"===t.fixed&&n.push(r)})),[e,n]}),[t]),d=Cc({count:e.length,getScrollElement:()=>s,estimateSize:()=>i,indexAttribute:"data-row-index",overscan:o,enabled:n.current.scrollYLoad}),u=d.getVirtualItems(),m=Cc({horizontal:!0,count:t.length,getScrollElement:()=>s,estimateSize:e=>t[e].width||t[e].renderWidth||0,indexAttribute:"data-col-index",overscan:o,enabled:n.current.scrollXLoad,rangeExtractor:e=>[...new Set([...c[0],...pc(e),...c[1]])]}),p=m.getVirtualItems();return{rowVirtualizer:d,columnVirtualizer:m,virtualRows:u,virtualColumns:p,resetItemXSize:e=>{e.forEach(((e,t)=>{m.resizeItem(t,e.width||e.renderWidth||Wo.defaultColumnWidth)}))},getYIndexes:()=>d.getIndexes()||[],getXIndexes:()=>m.getIndexes()||[],virtualTranslateY:()=>u[0]?.start??0,virtualTranslateX:()=>{const e=c[0].length;return e?p[e]?.index===e?p[0]?.start??0:(p[e]?.start??0)-p.slice(0,e).reduce(((e,t)=>e+t.size),0):p[0]?.start??0},calcVirtualYSize:()=>d.getTotalSize()||void 0,calcVirtualXSize:()=>m.getTotalSize()||void 0,scrollToYIndex:e=>{d.scrollToIndex(e)},scrollToXIndex:e=>{m.scrollToIndex(e)}}})(i,o),Re=we(),Oe=e=>{if(e&&!U)return ge.measureElement(e)},ke=l().useMemo((()=>u.length&&n.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:a,colSpan:i})=>{const l=e+a-1,o=[];for(let t=e;t<=l;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:i});for(let a=t;a<t+i;a++)0===r&&a===t||n.push({row:e,col:a,rowSpan:0,colSpan:0})}))})),n})(u,Re):u),[u,Re.join(",")]),[Pe,Le]=l().useState([]),Ae=_c();Fc({ref:ae,omitClassNames:[`.${Wo.popupClassName}`],handler:()=>{Ue([]),le.current?.blur()}}),l().useImperativeHandle(t,(()=>({setClickedValues:Ue,createFocus:ze,forceUpdate:Ae,resetItemXSize:xe,scrollToYIndex:Te}))),qe((()=>{Pe.length&&n.current.tableManager.focus(n.current.uid)}),[Pe]),l().useLayoutEffect((()=>{Me();const e=zt()(document,"keydown",De);return()=>e.remove()}),[]);const Fe=l().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:a}=p,i={};return x&&Object.assign(i,{minHeight:"100px"}),F&&Object.assign(i,{minHeight:Vn(F)-e-n+"px"}),_&&Object.assign(i,{maxHeight:Vn(_)-e-n+"px"}),A||r||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[A,_,F,x,p]),_e=Y((e=>{const{elementStore:t}=n.current,{prevST:r,prevSL:a}=oe.current,{scrollTop:i,scrollLeft:l}=e;if(l!==a){G&&(t.$header.scrollLeft=l),h&&(t.$footer.scrollLeft=l);const e=l>0,n=Math.ceil(l)+p.tableWidth<p.tableBodyWidth;b!==e&&T(e),v!==n&&R(n)}i!==r&&Math.ceil(i)+p.viewportHeight>=ae.current.parentNode.offsetHeight&&L({type:"scroll",target:e,preventDefault:te,stopPropagation:te}),oe.current={prevST:i,prevSL:l}})),De=Y((e=>{const{keyCode:t}=e;if(n.current.uid===n.current.tableManager.getFocusInstance()?.id&&(27===t&&(Ue([]),S(""),O(!1)),Pe.length&&(Ge(document.activeElement,ae.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===H?.type||q)){const t=f[0]??y??null,n=i.find((e=>r(e,e.index)===t))??null;n&&re?.(n,e)}if(!Be(Pe[0],Pe[1])){if(38===t||40===t){Ke(e);const n=i.length;let a=i.findIndex((e=>r(e,e.index)===Pe[0]));const l=38===t?(--a+n)%n:++a%n,o=i[l],s=r(o,o.index),c=Ve(s,Pe[1]);"radio"!==H?.type||H.disabled?.(o)||c||C([s]),!q||q.disabled?.(o)||c||S(s),He(38===t?"top":"bottom",l),je(...Pe),Ue([s,Pe[1]])}if(9===t||e.shiftKey&&9===t){if(Ke(e),!s.length)return Ue([]);const n=s.length;let r=s.findIndex((e=>e.dataIndex===Pe[1]));const a=e.shiftKey&&9===t?(--r+n)%n:++r%n;je(...Pe),$e(e.shiftKey&&9===t?"left":"right",a),Ue([Pe[0],s[a].dataIndex])}}}})),He=(e,t)=>{const{scrollBarRef:r,scrollYLoad:a}=n.current;if(a)return ge.scrollToIndex(t);const l=i.length,o=t,s=ae.current.querySelectorAll("tbody > tr"),c=i.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<r.current.scrollTop?r.current.SET_SCROLL_TOP(c):t===l-1&&r.current.SET_SCROLL_TOP(c-(p.viewportHeight-d)):c+d>r.current.scrollTop+p.viewportHeight?r.current.SET_SCROLL_TOP(c-(p.viewportHeight-d)):0===t&&r.current.SET_SCROLL_TOP(c)},$e=(e,t)=>{const{scrollBarRef:r}=n.current,a=s.length,i=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),l=o.slice(0,i).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[i].width||o[i].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),h=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?l<r.current.scrollLeft+m?r.current.SET_SCROLL_LEFT(l-m):t===a-1&&r.current.SET_SCROLL_LEFT(l-(p.tableWidth-u)+h):l+u>r.current.scrollLeft+(p.tableWidth-h)?r.current.SET_SCROLL_LEFT(l-(p.tableWidth-u)+h):0===t&&r.current.SET_SCROLL_LEFT(l-m)},Me=()=>{w("$tableBody",ae.current)},ze=(e,t)=>{ie.current[`${e}-${t}`]?.focus()},je=(e,t)=>{ie.current[`${e}-${t}`]?.blur()},Ve=(e,t)=>ie.current[`${e}-${t}`]?.isEditable()??!1,Be=(e,t)=>ie.current[`${e}-${t}`]?.isOpening()??!1,We=e=>{const t=K.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ue=e=>{(0,Q.isEqual)(e,Pe)||Le(e)},Ye=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Xe=(e,t,r)=>{const{disabled:a}=H||{},{deriveRowKeys:i,recordsMap:l}=n.current,o=Hn(i,e);let s=[],c=P(o?.children||[]);return a&&(c=c.filter((e=>!l.has(e)||!a(l.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(or(i,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Hn(i,e),n=t?.children?.every((e=>s.includes(e.rowKey)));s=n?[...s,e]:s.filter((t=>t!==e))})),s},Qe=(e,t,a,i,o,s)=>{const{dataIndex:u,fixed:p,align:h,className:g=""}=e,{rowSpan:y,colSpan:b}=Ze(a,e,i,t);if(!y||!b)return null;const v=e.ellipsis??U,x=["body--column",{"col--ellipsis":v,"col--center":"center"===h,"col--right":"right"===h,"column--sort":!!m[u],"cell-fix-left":"left"===p,"cell-fix-right":"right"===p,"cell-fix-left-last":"left"===p&&c[c.length-b]?.dataIndex===u,"cell-fix-right-first":"right"===p&&d[0]?.dataIndex===u,[g]:!!g}],w={left:"left"===p?`${N(u)}px`:"",right:"right"===p?`${I(u)}px`:""},T=z?"function"==typeof z?z(a,i):z:null,R=j?"function"==typeof j?j(a,e,i,t):j:null,O=E?(e=>{const{backgroundColor:t,color:n}=K.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:n}})(a._group):null,k=Object.assign({},w,{height:D},O,T,R);return l().createElement("td",{key:u,"data-col-index":t,rowSpan:y>1?y:void 0,colSpan:b>1?b:void 0,className:Ee()(x),style:k,onClick:t=>((e,t,a)=>{const{dataIndex:i}=a;if([Wo.expandableColumn,Wo.operationColumn].includes(i))return;const l=r(t,t.index);Ue([l,i]);const o=Ve(l,i),{type:s,selectByClickRow:c=!0,disabled:d=te}=H||{};!s||d(t)||o||(c||i===Wo.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:a=!0,onSelect:i}=H||{};if("radio"===r&&C([e]),"checkbox"===r){const r=!f.includes(e),l=n.current.isTreeTable&&!a?Xe(e,f,r):Ye(e,f,r);C(l),i?.(r,t,l)}})(l,t),[Wo.selectionColumn].includes(i)||(!q||q.disabled?.(t)||o||S(l),Z?.(t,a,e))})(t,a,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn].includes(r)||J?.(t,n,e)})(t,a,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn].includes(r)||ee?.(t,n,e)})(t,a,e)},l().createElement(Zc,{ref:e=>ie.current[`${o}-${u}`]=e,row:a,column:e,rowIndex:i,columnIndex:t,rowKey:o,depth:s,showTitle:v}))},Ze=(e,t,n,r)=>{let a=1,l=1;const o=V;if("function"==typeof o){const s=o({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(s)?(a=s[0],l=s[1]):(0,Q.isPlainObject)(s)&&(a=s.rowSpan,l=s.colSpan);const c=Re[0]??0;if(e===i[c]&&0===a)for(let e=c;e<i.length;e++){const n=o({row:i[e],column:t,rowIndex:e,columnIndex:r,tableData:i});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;a++}}if(ke.length>0){const e=ke.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,l=e.colSpan)}return{rowSpan:a,colSpan:l}};return l().createElement(l().Fragment,null,l().createElement(Rt,{ref:n.current.scrollBarRef,wrapClassName:`${a}--body-wrapper`,wrapStyle:Fe,innerStyle:{height:Ne(),width:Ie()},showTopScrollbar:B?.doubleXScrollbar,onScroll:_e},l().createElement(lc.Provider,{value:Pe},l().createElement("table",{ref:ae,style:{width:0,marginTop:Ce(),marginLeft:Se()},className:`${a}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=n.current;return l().createElement("colgroup",null,(e?ve:o).map((t=>{const{dataIndex:n,width:r,renderWidth:a}=e?o[t.index]:t;return l().createElement("col",{key:n,style:{width:`${r||a}px`,minWidth:`${r||a}px`}})})))})(),l().createElement("tbody",null,((e,t=0)=>{const{scrollYLoad:a}=n.current,s=[],c=a?e:i;return c.forEach(((e,d)=>{const u=a?i[e.index]:e,m=a?e.index:d,p=r(u,u.index);if(s.push(((e,t,r,a=0)=>{const{scrollXLoad:i}=n.current,{disabled:s}=H||{},c=["body--row",{"body--row-striped":M&&t%2!=0,"body--row-selected":f.includes(r)&&!s?.(e),"body--row-current":y===r,...E?We(e._group):null}],d=(i?ve:o).map(((n,l)=>Qe(i?o[n.index]:n,i?n.index:l,e,t,r,a)));return X?l().createElement(Hc,{key:r,ref:Oe,className:Ee()(c),rowKey:r,rowIndex:t,row:e,indent:he,filter:".cell--edit input",dropOption:fe,onNodeDragStart:se,onNodeDragEnter:ce,onNodeDragOver:de,onNodeDragLeave:ue,onNodeDragEnd:me,onNodeDrop:pe},d):l().createElement("tr",{key:r,ref:Oe,"data-row-key":r,"data-row-index":t,className:Ee()(c)},d)})(u,m,p,t)),$?.expandedRowRender){const{expandedRowClassName:e,rowExpandable:t=ne}=$;g.includes(p)&&t(u)&&s.push(l().createElement("tr",{key:`expand_${p}`,className:"body--row-expanded"},l().createElement("td",{colSpan:c.length,className:"body--column",style:{paddingLeft:H?2*Wo.selectionColumnWidth:Wo.selectionColumnWidth}},l().createElement("div",{className:Ee()("cell",e)},$.expandedRowRender(u,m)))))}})),s})(be)))),!!W&&l().createElement(td,{ref:le})))}));nd.displayName="TableBody";const rd=nd,ad=()=>{const{tableRef:e,prefixCls:t,sorter:n,layout:r,flattenColumns:a,leftFixedColumns:i,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=l().useContext(Ro),{footRender:m}=e.current.props,{t:p}=G(),h=l().useRef(null);l().useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",h.current)},{tableBodyWidth:g}=r;return l().createElement("div",{ref:h,className:`${t}--footer-wrapper`},m?m(a,e.current.tableFullData):l().createElement("table",{className:`${t}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:g?`${g}px`:""}},l().createElement("colgroup",null,a.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("tfoot",null,s.map(((t,r)=>l().createElement("tr",{key:r,className:"footer--row"},a.map(((r,a)=>((t,r,a)=>{const{dataIndex:s,fixed:c,align:m,summation:h}=t,f=["footer--column","col--ellipsis",{"col--center":"center"===m,"col--right":"right"===m,"column--sort":!!n[s],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&i[i.length-1]?.dataIndex===s,"cell-fix-right-first":"right"===c&&o[0]?.dataIndex===s}],g={left:"left"===c?`${d(s)}px`:"",right:"right"===c?`${u(s)}px`:""},y=h?.render?h.render(e.current.tableFullData):Wn(r,`${s}_text`),b=0===a&&""===y?p("qm.table.config.summaryText"):y;return l().createElement("td",{key:s,title:b,className:Ee()(f),style:{...g}},l().createElement("div",{className:"cell"},b))})(r,t,a)))))))))};var id=function(e){return e.small="small",e.middle="default",e.large="default",e}(id||{});const ld=e=>{const{current:t,pageSize:n,total:r,onChange:a}=e,{global:i}=l().useContext(o),{tableRef:s,prefixCls:c,$size:d,setElementStore:u}=l().useContext(Ro),{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??Wo.pagination.showSizeChanger,v=p?.showQuickJumper??Wo.pagination.showQuickJumper,x=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||Wo.pagination.pageSizeOptions,E=async()=>{if(!g)return;const e=await w(g);e&&e!==n&&(a(t,e),localStorage.setItem(g,e.toString()))},w=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(g))try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},C={[`${c}-pager`]:!0};return l().createElement("div",{ref:f,className:Ee()(C)},l().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&l().createElement(Jo,{total:r})),l().createElement(O.Pagination,{size:id[d],showSizeChanger:b,showQuickJumper:v,pageSizeOptions:x,current:t,pageSize:n,total:r,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{g&&((async(e,t)=>{const n=i?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(g,t),localStorage.setItem(g,`${t}`))}}))},od=()=>{const{prefixCls:e,layout:t}=l().useContext(Ro),n=l().useMemo((()=>{const{headerHeight:e,viewportHeight:n}=t;return{top:`${e}px`,height:`${n}px`}}),[t]);return l().createElement("div",{className:`${e}--empty`,style:n},l().createElement(ut,null))},sd=()=>{const{prefixCls:e,setElementStore:t}=l().useContext(Ro),n=l().useRef(null);l().useLayoutEffect((()=>{r()}),[]);const r=()=>{t("$resizableBar",n.current)};return l().createElement("div",{ref:n,className:`${e}--resizable-bar`})};function cd(){return cd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cd.apply(null,arguments)}const dd=l().forwardRef(((e,t)=>{const n=h(ko,e),{rowKey:r,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:w}=n,{$size:C}=X(n),S=l().useRef(null),N=l().useRef(null),I=l().useRef(null),T=l().useRef(null),R=l().useRef(null),O=we("table"),k=Y(((e,t)=>{const n="function"==typeof r?r(e,t):e?.[r];return void 0===n?(pe("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:P,tableFullData:L,setElementStore:A,setOriginColumns:F,setTableFullData:_,setTableOriginData:D,setAllTableData:H,setDeriveRowKeys:q,setInvalidRowKeys:$,setFieldAuth:M,setColumnsDefined:K,setScrollXLoad:z,setScrollYLoad:j,setResizeState:V,setHandleState:B,setSummaries:W,setSelectionRows:U,setShouldToTop:G,setRecordsMap:J,setUnMounted:ee,clearElementStore:te,clearRecordsMap:ne}=((e,{getRowKey:t,$size:n})=>{const{rowHeight:r,dynamicThead:a}=e,i=l().useRef({props:e,uid:Ko(),tableManager:jo,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],allParentRowKeys:[],deriveRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!a,scrollBarRef:l().createRef(),rowHeight:r||Wo.rowHeightMaps[n],store:new Bo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!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,n,r="",a=0)=>e.map((e=>{const i=t(e,e.index),l=r?`${r}.${e.index+1}`:`${e.index+1}`,o={level:a,rowKey:i,indexPath:l};return e.indexPath=l,e._level=a,e._parentRowKey=a?n:null,Array.isArray(e.children)&&(o.children=s(e.children,i,l,a+1)),n?Object.assign(o,{parentRowKey:n}):o}));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},setTableOriginData:e=>{i.current.tableOriginData=e},setAllTableData:e=>{const n=qn(e);i.current.allTableData=n,i.current.allRowKeys=n.map((e=>t(e,e.index)))},setDeriveRowKeys:e=>{const n=e.some((e=>Array.isArray(e.children)));i.current.isTreeTable=n,i.current.deriveRowKeys=n?s(e,""):[],i.current.allParentRowKeys=n?$n(e,(e=>t(e,e.index))):[]},setInvalidRowKeys:e=>{i.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{i.current.fieldAuth[e]=t},setColumnsDefined:e=>{i.current.columnsDefined=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()}}})(n,{getRowKey:k,$size:C}),{tableFlatData:re,setTableFlatData:ie,filters:le,setFilters:oe,sorter:se,setSorter:de,superFilters:ue,setSuperFilters:me,pagination:he,setPagination:fe,selectionKeys:ge,setSelectionKeys:ye,rowExpandedKeys:be,setRowExpandedKeys:ve,highlightKey:xe,setHighlightKey:Ce,updateMark:Se,forceUpdate:Ne,mergedTdCells:Ie,setMergedCells:Te,layout:Re,setLayout:Oe,permission:ke,setPermission:Pe,spinning:Le,setSpinning:Ae,isPingLeft:Fe,setPingLeft:_e,isPingRight:De,setPingRight:He,isFullScreen:$e,setFullScreen:Me,updateTableFlatData:Ke}=(e=>{const{uniqueKey:t,initialSorter:n={},initialFilter:r={},paginationConfig:a,rowSelection:i,expandable:s,rowHighlight:c,mergedCells:d}=e,{global:u}=l().useContext(o),m={current:a?.current??Wo.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??a?.pageSize??u?.table?.pagination?.pageSize??Wo.pagination.pageSize,total:0},p=i?.selectedRowKeys??i?.defaultSelectedRowKeys??[],h=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[f,g]=l().useState([]),[y,b]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),r),[v,x]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),n),[E,w]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),[]),[C,S]=l().useState(m),[N,I]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),p),[T,R]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),h),[O,k]=l().useState(c?.currentRowKey??""),[P,L]=l().useReducer((e=>e+1),0),[A,F]=Go([],{value:d}),[_,D]=l().useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[H,q]=l().useState({export:!0,import:!0,print:!0}),[$,M]=l().useState(!1),[K,z]=l().useState(!1),[j,V]=l().useState(!1),[B,W]=l().useState(!1);return{tableFlatData:f,setTableFlatData:g,filters:y,setFilters:b,sorter:v,setSorter:x,superFilters:E,setSuperFilters:w,pagination:C,setPagination:S,selectionKeys:N,setSelectionKeys:I,rowExpandedKeys:T,setRowExpandedKeys:R,highlightKey:O,setHighlightKey:k,updateMark:P,forceUpdate:L,mergedTdCells:A,setMergedCells:F,layout:_,permission:H,setPermission:q,setLayout:D,spinning:$,setSpinning:M,isPingLeft:K,setPingLeft:z,isPingRight:j,setPingRight:V,isFullScreen:B,setFullScreen:W,updateTableFlatData:()=>g([...f])}})(n),{isFetch:ze,isWebPagination:je,isScrollPagination:Ve,showPagination:Be,tableColumns:We,flattenColumns:Ue,editableColumns:Ge,summationColumns:Ye,leftFixedColumns:Xe,rightFixedColumns:Qe,derivedMergeCells:Ze,treeExpandIndex:Je,showSummary:et,showFooter:tt,isHeadGroup:nt,bordered:rt,isHeadSorter:at,isHeadFilter:it,isServiceSummation:lt,isSelectCollection:ot,isTableImport:st,isTableClipboard:ct,isSuperSearch:dt,isFastSearch:ut,isPivotGrid:mt,isGroupSummary:ht,isGroupSubtotal:ft,isTableEmpty:gt,summationRows:yt,fetchParams:bt}=Xo(n,{getRowKey:k,tableRef:P,tableFullData:L,tableFlatData:re,sorter:se,filters:le,superFilters:ue,selectionKeys:ge,pagination:he,mergedTdCells:Ie}),{createElementStore:vt,tableStyles:xt,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:St,scrollYToRecord:Nt,calcTableHeight:It,resetTableScroll:Tt,doLayout:Rt}=((e,t)=>{const{height:n,minHeight:r,maxHeight:a,ellipsis:i,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:m,tableBodyRef:p,$size:h,tableColumns:f,flattenColumns:g,leftFixedColumns:y,derivedMergeCells:b,tableFlatData:v,layout:x,showFooter:E,showPagination:w,isFullScreen:C,setLayout:S,setElementStore:N,setShouldToTop:I}=t,T=l().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,i={};return r&&Object.assign(i,{minHeight:`${Vn(r)}px`}),a&&Object.assign(i,{maxHeight:`${Vn(a)}px`}),C?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...i,height:"auto"!==n?`${Vn(n)}px`:`${t}px`}:i}),[n,a,r,C,x]),R=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r,rowHeight:a}=d.current;if(void 0!==t&&t>=0)if(t<v.length)if(r)p.current.scrollToYIndex(t);else{const e=O(c(v[t],v[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*a);else if(r){const t=v.findIndex((t=>e===c(t,t.index)));t>=0&&p.current.scrollToYIndex(t)}else{const t=O(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},O=e=>d.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{N("$toper",u.current),N("$table",m.current)},tableStyles:T,getSpan:(e,t,n,r,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,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===n&&e.col===r));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=An(f,e);e=t?Fn(t).dataIndex:""}let t=0;for(let n=0;n<g.length;n++){const r=g[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=An(f,e);e=t?_n(t).dataIndex:""}const n="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let n=[];return e.forEach((e=>{e.colSpan>0&&n.length>0&&(t.push(n),n=[]),n.push(e)})),n.length>0&&t.push(n),t.map((e=>{const[t,n]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...n,...t.reverse()]})).flat()})(g):g;let r=0;for(let t=n.length-1;t>=0;t--){const a=n[t];if(a.dataIndex===e)break;r+=a.width||a.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?g.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=d.current,a=y.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:R,calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=d.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(w?ka["small"!==h?"middle":h]+Po:0)-Po;S((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{d.current.shouldToTop&&R("",0),I(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=Wo,a=[];let i=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,a.push(e))})),a.length>0){const e=g.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===a.length)a[0].renderWidth=(a[0].minWidth||r)+t;else{const e=t/a.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;a.forEach(((t,a)=>{if(0===a)return;const i=Math.floor((t.minWidth||r)*e);n+=i,t.renderWidth=(t.minWidth||r)+i})),a[0].renderWidth=(a[0].minWidth||r)+t-n}}else a.forEach((e=>{e.renderWidth=e.minWidth||r}));S((t=>({...t,tableBodyWidth:Math.max(e,n)})))}else i=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>({...e,tableBodyWidth:i})));S((e=>({...e,tableWidth:n}))),t&&p.current.resetItemXSize(g)})(),ae((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,a=o?e.$header.offsetHeight:x.headerHeight,i=E?e.$footer.offsetHeight:x.footerHeight,l=r-a-i,s=e.$tableBody.offsetHeight;let c=0;if(C){const t=e.$toper?e.$toper.offsetHeight+Po:0,r=e.$pager?e.$pager.offsetHeight+Po:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:c})))})()))}}})(n,{getRowKey:k,tableRef:P,topElementRef:S,tableElementRef:N,tableBodyRef:I,$size:C,tableColumns:We,flattenColumns:Ue,leftFixedColumns:Xe,derivedMergeCells:Ze,tableFlatData:re,layout:Re,showFooter:tt,showPagination:Be,isFullScreen:$e,setLayout:Oe,setElementStore:A,setShouldToTop:G}),{initialTable:Ot,checkDataIndex:kt,createTableFullData:Pt,getTableData:Lt,createTableList:At,createTableData:Ft,createGroupData:_t,createSelectionKeys:Dt,createRowExpandedKeys:Ht,setSelectionKeysEffect:qt,findParentRowKeys:$t,getAllChildRowKeys:Mt,doFieldValidate:Kt,getTableLog:zt,dataChange:jt,tableChange:Vt,toLastPage:Bt,toFirstPage:Wt,getPageCount:Ut,pagerChangeHandle:Gt,scrollBottomDebouncer:Yt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:en,clearTableLog:tn,destroy:nn}=Qo(n,{getRowKey:k,tableRef:P,tableElementRef:N,tableBodyRef:I,$size:C,tableColumns:We,flattenColumns:Ue,tableFullData:L,pagination:he,layout:Re,filters:le,sorter:se,superFilters:ue,fetchParams:bt,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,summationColumns:Ye,isFetch:ze,isWebPagination:je,isScrollPagination:Ve,isServiceSummation:lt,isGroupSubtotal:ft,doLayout:Rt,setTableFlatData:ie,setTableFullData:_,setTableOriginData:D,setAllTableData:H,setDeriveRowKeys:q,setPagination:fe,setPingRight:He,setPingLeft:_e,setSpinning:Ae,setSorter:de,setFilters:oe,setSuperFilters:me,setSelectionKeys:ye,setRowExpandedKeys:ve,setHighlightKey:Ce,setSelectionRows:U,setScrollXLoad:z,setScrollYLoad:j,setFieldAuth:M,setResizeState:V,setSummaries:W,setPermission:Pe,setRecordsMap:J,resetTableScroll:Tt,clearElementStore:te,clearRecordsMap:ne});((e,t)=>{const{columns:n,summation:r,rowSelection:a,expandable:i,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,summationRows:f,showSummary:g,isWebPagination:y,isScrollPagination:b,checkDataIndex:v,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:C,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:I,setRowExpandedKeys:T,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:P,createSelectionKeys:L,createRowExpandedKeys:A,initialTable:F,destroy:_}=t,D=l().useRef(f);qe((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),m.__prevent__||e?.(m,s.current.selectionRows),zn(m)}),[m]),qe((()=>{if(!i)return;const{onChange:e}=i;p.__prevent__||e?.(p,p.map((e=>s.current.recordsMap.get(e)))),zn(p)}),[p]),qe((()=>{o&&(c.current.setClickedValues(h?[h,""]:[]),o.onChange?.(h,s.current.recordsMap.get(h)??null))}),[h]),qe((()=>{(0,Q.isEqual)(f,D.current)||(D.current=f,g&&r&&r.onChange?.(f))}),[f]),qe((()=>{const e=L(a.selectedRowKeys);(0,Q.isEqual)(e,m)||N(Kn(e))}),[a?.selectedRowKeys]),qe((()=>{const e=A(i.expandedRowKeys);(0,Q.isEqual)(e,p)||T(Kn(e))}),[i?.expandedRowKeys]),qe((()=>{const{currentRowKey:e}=o;e!==h&&R(e??"")}),[o?.currentRowKey]),qe((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&C({insert:null,remove:!1})}),[u.total]),qe((()=>{P()}),[d]),qe((()=>{(s.current.scrollYLoad||b)&&(e.height||e.maxHeight||pe("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,b]),Zo({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(O(Object.assign({},e,{winHeight:n})),P())},delay:16}),l().useEffect((()=>(I(ce(n)),F(),v(),ae((()=>P())),()=>{_(),k(!0)})),[])})(n,{tableRef:P,tableBodyRef:I,$size:C,pagination:he,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,showSummary:et,summationRows:yt,isWebPagination:je,isScrollPagination:Ve,checkDataIndex:kt,toLastPage:Bt,toFirstPage:Wt,getPageCount:Ut,setHandleState:B,scrollYToRecord:Nt,setOriginColumns:F,setSelectionKeysEffect:qt,setRowExpandedKeys:ve,setHighlightKey:Ce,setResizeState:V,setUnMounted:ee,calcTableHeight:It,createSelectionKeys:Dt,createRowExpandedKeys:Ht,initialTable:Ot,destroy:nn});const rn=l().useMemo((()=>({getRowKey:k,tableRef:P,tableBodyRef:I,prefixCls:O,$size:C,tableFlatData:re,flattenColumns:Ue,editableColumns:Ge,leftFixedColumns:Xe,rightFixedColumns:Qe,treeExpandIndex:Je,sorter:se,filters:le,superFilters:ue,layout:Re,bordered:rt,showFooter:tt,showSummary:et,summationRows:yt,pagination:he,fetchParams:bt,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,mergedTdCells:Ie,derivedMergeCells:Ze,updateMark:Se,isFetch:ze,isPingLeft:Fe,isPingRight:De,isHeadSorter:at,isHeadFilter:it,isFullScreen:$e,isTableEmpty:gt,isHeadGroup:nt,isGroupSubtotal:ft,isWebPagination:je,dataChange:jt,tableChange:Vt,getTableData:Lt,setElementStore:A,createTableList:At,createTableFullData:Pt,updateTableFlatData:Ke,setSorter:de,setFilters:oe,setSuperFilters:me,setHighlightKey:Ce,setRowExpandedKeys:ve,setSelectionRows:U,setSelectionKeysEffect:qt,setInvalidRowKeys:$,setMergedCells:Te,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:St,scrollYToRecord:Nt,setPagination:fe,setPingLeft:_e,setPingRight:He,setSpinning:Ae,setFullScreen:Me,setShouldToTop:G,doFieldValidate:Kt,createTableData:Ft,createGroupData:_t,findParentRowKeys:$t,getAllChildRowKeys:Mt,scrollBottomDebouncer:Yt,resetTableScroll:Tt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:en})),[C,re,Ue,se,le,ue,Re,rt,tt,et,yt,he,bt,ge,be,xe,Ze,Se,ze,Fe,De,at,it,$e,gt,nt,ft,je]);((e,t)=>{const{getRowKey:n,tableRef:r,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,createTableData:b,createTableFullData:v,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:S,setHandleState:N,setColumnsDefined:I,setSelectionKeysEffect:T,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:P,forceUpdate:L,getTableLog:A,clearRowSelection:F,clearRowHighlight:_,clearTableSorter:D,clearTableFilter:H,clearSuperFilters:q,clearTableLog:$}=t,{columns:M,columnsChange:K}=r.current.props,z=(e,t,r)=>e.filter((e=>{const a=n(e,e.index);e.children&&(e.children=z(e.children,t,r));const i=t.includes(a);return i&&r?.(e,a),!i}));l().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:async e=>{f&&(await y(),e?.())},GET_LOG:()=>A(),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||(F(),_(),D(),H(),q(),$(),b([]))},CLEAR_LOG:()=>{$()},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=>{E(e)},SET_SELECTION:(e,t)=>{T(t?Kn([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?Kn([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{v(e)},DEFINE_INITIAL_COLUMNS:e=>{P(e),I(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=An(M,e);if(!r)return pe("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,Q.isPlainObject)(t))return pe("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return pe("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,Q.set)(r,e,t[e]);n&&(K?K([...M]):pe("Table","需要设置 `columnsChange` 参数"),L())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i}=r.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:n}=t;[Wo.expandableColumn,Wo.selectionColumn,Wo.operationColumn].includes(n)||Un(e,n,Wn(e,n))})),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=sr(i,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}c&&N(Object.assign({},r.current.handleState,{insert:o?"before":"after"})),b(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a}=r.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,Q.isPlainObject)(e)?n(e,e.index):e));if(!i.length)return;let l=!1;const o=z(a,i,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:a,editRender:i}=r,l=i?.(e,r);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:n,y:a}),t.removeFromValidate({x:n,y:a}),t.removeFromEdited({x:n,y:a}))})),l=!0}));l&&(N(Object.assign({},r.current.handleState,{remove:!0})),v(o),T(m.filter((e=>!i.includes(e)))),i.includes(h)&&_(),R(p.filter((e=>!i.includes(e)))),g(),ae((()=>{S(z(r.current.tableOriginData,i))})))},VALIDATE_FIELDS:(e,t)=>{r.current.allTableData.forEach((r=>{c.forEach((a=>{const{dataIndex:i,title:l,editRender:o}=a,s=o?.(r,a);if(!s)return;const c=n(r,r.index);if(e&&!e.includes(c))return;if(t&&!t.includes(i))return;const{rules:d=[],disabled:u}=s;u||C(d,Wn(r,i),c,i,nr(l))}))}));const{required:a,validate:i}=A(),l=[...a,...i];return l.length&&w(l[0].rowKey),L(),{required:a,validate:i}}})))})(t,{getRowKey:k,tableRef:P,toolBoxRef:T,tableBodyRef:I,columnFilterRef:R,flattenColumns:Ue,editableColumns:Ge,pagination:he,fetchParams:bt,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,isFetch:ze,dataChange:jt,getTableData:Lt,createTableData:Ft,createTableFullData:Pt,calcTableHeight:It,scrollXToColumn:St,scrollYToRecord:Nt,doFieldValidate:Kt,setTableOriginData:D,setHandleState:B,setColumnsDefined:K,setSelectionKeysEffect:qt,setRowExpandedKeys:ve,setHighlightKey:Ce,setSelectionRows:U,setOriginColumns:F,forceUpdate:Ne,getTableLog:zt,clearRowSelection:Jt,clearRowHighlight:en,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearTableLog:tn}),l().useLayoutEffect((()=>{vt(),P.current.tableManager.register(P.current.uid,t??{current:null})}),[]);const an={[`${O}--wrapper`]:!0,[`${O}--lg`]:"large"===C,[`${O}--sm`]:"small"===C,[`${O}--maximize`]:$e,[c]:!!c},ln={[O]:!0,"is--border":rt,"is--fixed":Xe.length||Qe.length,"is--sortable":at,"is--filterable":it,"is--head-group":nt,"is--area-select":!!d,"is--ping-left":Fe,"is--ping-right":De};return l().createElement(Ro.Provider,{value:rn},l().createElement("div",{className:Ee()(an,E),style:w},g&&l().createElement("div",{ref:S,className:`${O}-top`},l().createElement("div",{className:`${O}-top__space`},"bottom"!==p?.position&&l().createElement(Jo,{total:he.total}),l().createElement("div",{className:`${O}-top__space-slot`,style:{justifyContent:qo[f]}},n.children)),l().createElement("div",{className:`${O}-top__actions`},l().createElement(Us,{ref:T,showFullScreen:y,showReload:b&&ze,showPrint:ke.print&&!!u,showImport:ke.import&&st,showExport:ke.export&&!!m,showClipboard:ct,showCollection:ot,showFastSearch:ut,showSuperSearch:dt,showPivotGrid:mt,showGroupSummary:ht,showToolBox:v,tableColumns:We}),l().createElement(Xs,{ref:R,columns:a}))),l().createElement(pt,{spinning:i??Le},l().createElement("div",{ref:N,className:Ee()(ln),style:xt},l().createElement("div",{className:`${O}--main-wrapper`},x&&l().createElement(ic,{tableColumns:We}),l().createElement(rd,{ref:I}),tt&&l().createElement(ad,null)),rt&&l().createElement("div",{className:`${O}--border-line`}),gt&&l().createElement(od,null),s&&l().createElement(sd,null))),Be&&l().createElement(ld,cd({},he,{onChange:(e,t)=>Gt({current:e,pageSize:t})}))))}));dd.displayName="QmTable";const ud=dd,md=ud;function pd(){return pd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pd.apply(null,arguments)}const hd=e=>{const{uniqueKey:t,multiple:n,initialValue:r,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=Et(h),[v,x]=l().useState(s),[E,w]=l().useState(),[C,S]=l().useState(i),[N,I]=l().useState(!1),[T,R]=l().useState(300),[O,k]=l().useState(o),[P,L]=l().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[A,F]=l().useState((0,Q.merge)({},s.fetch?.params,r)),[_,D]=l().useState([]),H=()=>{const e=h.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*ka[m]-30)},q=wt(H,5);g((()=>{q()}),[b.width]),qe((()=>{(0,Q.isEqual)(o,O)||k(o)}),[o]),l().useEffect((()=>{$()}),[A]),l().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&f.current?.SET_FIELDS_VALUE(r)}),[]);const $=async()=>{const{webPagination:e,fetch:t}=v;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ne}=t;if(i(A)){I(!0);try{const e=await r(A);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];n||(S([]),await re(0)),D(t)}}catch(e){}I(!1)}},M=e=>{n||(w(e),u(e))},K=e=>{F(Object.assign({},A,e))},z=we("search-helper"),j={[`${z}--wrapper`]:!0},V=v.webPagination?{dataSource:_,loading:N,webPagination:!0}:{fetch:{...v.fetch,params:A}};return l().createElement("div",{ref:h,className:Ee()(j,c),style:d},l().createElement("div",{className:"form-wrap"},O.length?l().createElement(zl,{ref:f,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(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(md,pd({ref:y,uniqueKey:t,height:T,columns:P,rowKey:v.rowKey||"pageIndex"},V,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{S(e),w(n?t:t[0])}},paginationConfig:v.paginationConfig,columnsChange:e=>L(e),onRowDblclick:M,onRowEnter:M}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ka[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!E,onClick:()=>u(E,n?C:void 0)},p("qm.dialog.confirm"))))};hd.displayName="QmSearchHelper";const fd=hd;function gd(){return gd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gd.apply(null,arguments)}const yd=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...yd(e.children)),e.children&&t.push(e.value)})),t},bd=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=bd(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},vd=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vd(e.children,t),t(e)||e.children&&e.children.length))),xd=e=>{const{uniqueKey:t,multiple:n,initialValue:r,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=Et(f),[x,E]=l().useState(s),[w,C]=l().useState(),[S,N]=l().useState(i),[I,T]=l().useState(!1),[R,k]=l().useState(300),[P,L]=l().useState(300),[A,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,q]=l().useState((0,Q.merge)({},s.fetch?.params,r)),[$,M]=l().useState([]),K=()=>{const e=f.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");k(e.offsetHeight-n.offsetHeight-10),L(e.offsetHeight-t.offsetHeight-2*ka[p]-30)},z=wt(K,5);g((()=>{z()}),[v.width]),qe((()=>{(0,Q.isEqual)(o,A)||F(o)}),[o]),l().useEffect((()=>{j()}),[H]),l().useEffect((()=>{a&&b.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&y.current?.SET_FIELDS_VALUE(r),ie()}),[]);const j=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ne}=t;if(i(H)){T(!0);try{const e=await r(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];n||(N([]),await re(0)),M(t)}}catch(e){}T(!1)}},V=e=>{n||(C(e),m(e))},B=e=>{q(Object.assign({},H,e))},[W,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),te=l().useRef(W),ae=l().useRef([]);qe((()=>{Z(yd(W))}),[W]);const ie=async()=>{if(!c.fetch)return;const{api:e,params:t,dataKey:n,valueKey:r="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,n)??[],t=Pr(e,r,a);U(t),te.current=t,ae.current=e}}catch(e){}},le=e=>`${e}|${Xr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe=we("tree-table-helper"),se={[`${oe}--wrapper`]:!0},ce=x.webPagination?{dataSource:$,loading:I,webPagination:!0}:{fetch:{...x.fetch,params:H}};return l().createElement("div",{ref:f,className:Ee()(se,d),style:u},l().createElement(rt,{defaultValue:200,style:{height:"100%"}},l().createElement(rt.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=vd(te.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==le(n).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 pe("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof c.tableParamsMap?c.tableParamsMap():c.tableParamsMap,n={};for(const r in t)n[r]=(0,Q.get)(e,t[r]);B(n)})(bd(ae.current,(n=>(0,Q.get)(n,t)===e[0]))||{})}})),l().createElement(rt.Pane,{className:"split-pane"},l().createElement("div",{className:"form-wrap"},A.length?l().createElement(zl,{ref:y,items:A,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(md,gd({ref:b,uniqueKey:t,height:P,columns:_,rowKey:x.rowKey||"pageIndex"},ce,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),C(n?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>D(e),onRowDblclick:V,onRowEnter:V}))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ka[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>m(null),style:{marginRight:8}},h("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!w,onClick:()=>m(w,n?S:void 0)},h("qm.dialog.confirm"))))};xd.displayName="TreeTableHelper";const Ed=xd,wd=e=>{const{multiple:t,tree:n={},defaultSelectedKeys:r,className:a,style:i,onClose:o}=e,{$size:s}=X(e),{t:c}=G(),[d,u]=l().useState(),[m]=l().useState(n.fetch?.params),p=we("tree-helper"),h={[`${p}--wrapper`]:!0},f=n.fetch?{...se(n.fetch,["params","valueKey","textKey"]),params:m}:void 0;return l().createElement("div",{className:Ee()(h,a),style:i},l().createElement(To,{multiple:t,fetch:f,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},autoFocus:!0,asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:r,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>u(e),onCheckChange:e=>u(e)}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ka[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!d,onClick:()=>o(d)},c("qm.dialog.confirm"))))};wd.displayName="TreeHelper";const Cd=wd;function Sd(){return Sd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sd.apply(null,arguments)}const Nd="_startSign",Id="_endSign",Td=e=>{const{uniqueKey:t,initialValue:n,filters:r=[],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=Et(c),[p,h]=l().useState(a),[f,y]=l().useState(!1),[b,v]=l().useState([]),[x,E]=l().useState(300),[w,C]=l().useState(r),[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:Nd,width:80,align:"right",render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:s("qm.form.rangeSearchHelper")[1],dataIndex:Id,fixed:"right",width:80,render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)}]),[I,T]=l().useState((0,Q.merge)({},a.fetch?.params,n)),[R,k]=l().useState([]),P=l().useMemo((()=>b.map((e=>e?.pageIndex))),[b]),L=l().useMemo((()=>2===P.length&&P.every((e=>void 0!==e))),[P]),A=()=>{const e=c.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*ka[o]-30)},F=wt(A,5);g((()=>{F()}),[m.width]),qe((()=>{(0,Q.isEqual)(r,w)||C(r)}),[r]),l().useEffect((()=>{_()}),[I]);const _=async()=>{const{webPagination:e,fetch:t}=p;if(!e||!t?.api)return;const{api:n,dataKey:r,beforeFetch:a=ne}=t;if(a(I)){y(!0);try{const e=await n(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[];k(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},H=()=>{b.forEach((e=>{e&&(D(e,Nd),D(e,Id))})),v([])},q=e=>{H(),T(Object.assign({},I,e))},$=we("range-helper"),M=p.webPagination?{dataSource:R,loading:f,webPagination:!0}:{fetch:{...p.fetch,params:I}};return l().createElement("div",{ref:c,className:`${$}--wrapper`},l().createElement("div",{className:"form-wrap"},w.length?l().createElement(zl,{ref:d,items:w,initialValues:n,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>A(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||q(t)}}):null),l().createElement("div",null,l().createElement(md,Sd({ref:u,height:x,columns:S,rowKey:p.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=P[0]&&e.pageIndex<=P[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[Nd,Id].includes(n)&&(n===Nd&&(e[n]?(D(e,n),v([void 0,b[1]])):e.pageIndex>P[1]?O.message.warning(s("qm.searchHelper.rangeStartTip")):(b[0]&&D(b[0],n),e[n]="[",v([e,b[1]]))),n===Id&&(e[n]?(D(e,n),v([b[0],void 0])):e.pageIndex<P[0]?O.message.warning(s("qm.searchHelper.rangeEndTip")):(b[1]&&D(b[1],n),e[n]="]",v([b[0],e]))),u.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===P[0]&&(e[Nd]="["),e.pageIndex===P[1]&&(e[Id]="]")}))}}),l().createElement(ge,{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:`${ka[o]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>i(null),style:{marginRight:8}},s("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!L,onClick:()=>i(b.map((e=>(e=>{const t={};for(const n in e)[Nd,Id].includes(n)||(t[n]=e[n]);return t})(e))))},s("qm.dialog.confirm"))))};Td.displayName="RangeTableHelper";const Rd=Td,Od=e=>null!=e;function kd(e,t,n,r){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,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:a,bottom:i,left:l}=e.getBoundingClientRect();return r>=0&&l>=0&&a<=t&&i<=n})(a)&&t&&a.scrollIntoView(r);const{left:e,top:n,width:i,height:l}=a.getBoundingClientRect(),o={left:e,top:n,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]),Zo({handler:c}),[l().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),a]}const Pd={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"]}},Ld={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"]}},Ad=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Fd(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Pd).forEach((e=>{const c={...r&&Ld[e]||Pd[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Ad.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:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?8:r}}({contentRadius:i,limitVerticalRadius:!0});if(r)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]=2*-d.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":c.offset[1]=2*d.arrowOffsetHorizontal-o}c.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const a=r&&"object"==typeof r?r:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+n,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,n),l&&(c.htmlRegion="visibleFirst")})),s}const _d=require("@rc-component/portal");var Dd=r.n(_d);const Hd=require("@rc-component/trigger");var qd=r.n(Hd);function $d(){return $d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$d.apply(null,arguments)}const Md={fill:"transparent",pointerEvents:"auto"},Kd=e=>{const{prefixCls:t,rootClassName:n,pos:r,showMask:a,style:i={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${Ko()}`,m="object"==typeof c?c?.placeholder:c;return l().createElement(Dd(),{open:s,autoLock:!0},l().createElement("div",{className:Ee()(`${t}-mask`,n),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"}),r&&l().createElement("rect",{x:r.left,y:r.top,rx:r.radius,width:r.width,height:r.height,fill:"black",className:m?`${t}-placeholder-animated`:""}))),l().createElement("rect",$d({},r?null:Md,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),r&&l().createElement(l().Fragment,null,l().createElement("rect",$d({},Md,{x:"0",y:"0",width:"100%",height:`${r.top}px`})),l().createElement("rect",$d({},Md,{x:"0",y:"0",width:r.left,height:"100%"})),l().createElement("rect",$d({},Md,{x:"0",y:r.top+r.height,width:"100%",height:`calc(100vh - ${r.top+r.height}px)`})),l().createElement("rect",$d({},Md,{x:r.left+r.width,y:"0",width:`calc(100vw - ${r.left+r.width}px)`,height:"100%"})))):null))},zd=e=>{const{prefixCls:t,zIndex:n,open:r,onPause:a,onPlay:i}=e,[o,s]=Go(void 0,{value:r,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=zt()(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:n+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-We(t).x,o=e.clientY-We(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-n-1&&(s=a-n-1),c<0&&(c=0),c>i-r-1&&(c=i-r-1),je(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))},jd=e=>{const{prefixCls:t,current:n,total:r=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=>{C(e),40===e.keyCode&&(n<r-1?p?.():h?.()),38===e.keyCode&&n>0&&m?.()}));l().useEffect((()=>{const e=zt()(document,"keyup",v);return()=>e.remove()}),[]);const x=Od(a)?l().createElement("div",{className:`${t}-cover`},a):null,E=Od(o)?l().createElement("div",{className:`${t}-description`},o):null;let w;w=g?g(n,r):[...Array.from({length:r}).keys()].map(((e,r)=>l().createElement("span",{key:e,className:Ee()(r===n&&`${t}-indicator-active`,`${t}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return l().createElement("div",{className:Ee()(`${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:Ee()(`${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`},r>1&&l().createElement("div",{className:`${t}-indicators`},w),l().createElement(ve,{className:`${t}-buttons`},0!==n?l().createElement(ge,{className:`${t}-prev-btn`,size:"small",onMouseDown:C,onClick:m},y("qm.tour.prevStep")):null,n===r-1?l().createElement(ge,{className:`${t}-finish-btn`,type:b,size:"small",onClick:h},y("qm.tour.finish")):l().createElement(ge,{className:`${t}-next-btn`,type:b,size:"small",onMouseDown:C,onClick:p},y("qm.tour.nextStep"))))))},Vd=e=>{const{current:t,renderPanel:n}=e;return l().createElement(l().Fragment,null,"function"==typeof n?n(e,t):l().createElement(jd,e))};function Bd(){return Bd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bd.apply(null,arguments)}const Wd={left:"50%",top:"50%",width:1,height:1},Ud=l().forwardRef(((e,t)=>{const{steps:n=[],defaultCurrent:r,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:w=!0,scrollIntoViewOptions:C=!0,...S}=e,N=l().useRef(),[I,T]=Go(0,{value:a,defaultValue:r}),[R,O]=Go(void 0,{value:c,postState:e=>!(I<0||I>=n.length)&&(e??!1)}),[k,P]=Go(1051,{value:b,defaultValue:b}),[L,A]=l().useState(),F=l().useRef(R);l().useLayoutEffect((()=>{R&&!F.current&&T(0),F.current=R,A(R)}),[R]),l().useImperativeHandle(t,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>P(e)})));const{target:_,type:D,placement:H,trigger:q,delay:$,style:M,arrow:K,className:z,mask:j,scrollIntoViewOptions:V,zIndex:B,action:W}=n[I]||{},U=B||k,G=D||d,Y=R&&(j??u),X=V??C,[Q,Z]=kd(_,!!c,E,X),J=((e,t,n)=>n??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,I]),qe((()=>{R&&(ie(),W?.(Z,I))}),[R,Z]);const ne=e=>{T(e),i?.(e)},ae=()=>{O(!1),o?.(I)},ie=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||"none"===ze(r=n,"display")||"hidden"===ze(r,"visibility")||"0"===ze(r,"opacity")||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const le=async()=>{if(!q||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[a,i]=[e+n/2,t+r/2],l=new MouseEvent(q,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await re($??320))},oe="boolean"==typeof Y?Y:!!Y,se="boolean"==typeof Y?void 0:Y,ce=Object.assign({},f,M),de=we("tour"),ue=[{[`${de}-primary`]:"primary"===G},h,z],me=Fd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(Kd,{zIndex:U,prefixCls:de,pos:Q,showMask:oe,style:se?.style,fill:se?.color,open:L,animated:w,rootClassName:h}),l().createElement(Dd(),{open:L,autoLock:!0},l().createElement(qd(),Bd({ref:N},S,{zIndex:U,builtinPlacements:me,popupStyle:ce,popupPlacement:J,popupVisible:L,popupClassName:Ee()(ue),prefixCls:de,popup:()=>l().createElement(Vd,Bd({key:"content",arrow:ee,prefixCls:de,total:n.length,helper:y,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await le(),ne(I-1)},onNext:async()=>{await le(),ne(I+1)},onClose:ae,current:I,onFinish:()=>{ae(),s?.()}},Object.assign({},n[I],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),l().createElement("div",{className:Ee()(h,`${de}-target-placeholder`),style:{...Q||Wd,position:"fixed",pointerEvents:"none"}}))),p&&l().createElement(Dd(),{open:R},l().createElement(zd,{zIndex:U,prefixCls:de,onPause:()=>A(!1),onPlay:()=>A(!0)})))}));Ud.displayName="QmTour";const Gd=Ud,Yd=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Xd=e=>({_s:e,status:Yd[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Qd=e=>e?6:5,Zd=(e,t,n,r,a)=>{clearTimeout(r.current);const i=Xd(e);t(i),n.current=i,a?.({current:i})},Jd=e=>{const{name:t,in:n,timeout:r,preEnter:a=!0,preExit:o}=e,[s,c]=((e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:a,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,m]=(0,i.useState)((()=>Xd(o?2:Qd(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 Qd(t)}})(p.current._s,c);e&&Zd(e,m,p,h,d)}),[d,c]),b=(0,i.useCallback)((e=>{const i=e=>{switch(Zd(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?r?0:1:2):l&&i(n?a?3:4:Qd(c))}),[y,d,t,n,r,a,f,g,c]);return(0,i.useEffect)((()=>()=>clearTimeout(h.current)),[]),[u,b,y]})({timeout:r,preEnter:a,preExit:o,initialEntered:n});return g((()=>{c()}),[n]),l().createElement(l().Fragment,null,l().Children.map(e.children,(e=>l().isValidElement(e)?Gc(e,{className:Ee()(e.props.className,t,s.status)}):e)))},eu={previewWidth:1100,defaultDistance:.45,logoHeight:60},tu=(0,i.createContext)(void 0);var nu=null;function ru(){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),n=e.match(/MSIE\D?\d+/i),r=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!n&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){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 au(e,t){var n;try{var r=navigator.userAgent,a=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(ru()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void O.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&r.match(/x64/i),e||t?n=a?e:t:nu?n=nu:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),nu=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n;return n.VERSION<"6.2.2.6"&&ru(),n}catch(e){O.message.error("getLodop 出错:"+e)}}ru();const iu=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:n}=window.screen;if(t&&n)e[0]=t,e[1]=n;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)},lu=l().forwardRef(((e,t)=>{const{templateRender:n,directPrint:r}=e,{global:a}=l().useContext(o),{$$preview:i}=l().useContext(tu),{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:k,createExportHtml:L,createPrintHtml:P,SHOW_PREVIEW:A,DIRECT_PRINT:F}))),qe((()=>{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*eu.defaultDistance+10*eu.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*eu.defaultDistance+10*eu.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),x=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return iu(b-10*(e.left-eu.defaultDistance)-10*(e.right-eu.defaultDistance))}),[s,b]),E=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return iu(v-10*(e.top-eu.defaultDistance)-10*(e.bottom-eu.defaultDistance))}),[s,v]),w=s.form.scale,C=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:iu(10*e.left),right:iu(10*e.right),top:iu(10*e.top),bottom:iu(10*e.bottom)}}),[s]),S=l().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:n,top:r,bottom:a}=C,i=x+t+n,l=eu.previewWidth-i<=0?0:(eu.previewWidth-i)/2,o=Math.abs((1-w)*i/2);let c=0;return w>1&&(c=o>l?-1*l:-1*o),w<1&&(c=i-2*o>eu.previewWidth?0:l>0?o:(eu.previewWidth-(i-2*o))/2),{width:`${x}px`,height:"stylus"===e?"auto":E+"px",paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${w})`,opacity:g?0:1}}),[s,g,C,w,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: ${eu.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,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=m.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},R=()=>{const e=m.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const a=e[r].clientHeight;e[r].style.height=a+"px",n.push(a),t.push(e[r].outerHTML)}h.current=n,p.current=t},O=()=>{if(!p.current.length)return;const{form:{setting:e,printerType:t}}=s;if(r)return f.current.push([I(),N(),...p.current]);const n=e.fixedLogo?E-eu.logoHeight:E;let a=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[N()]:[],...p.current]);else{let t=0;for(let r=0,i=h.current.length;r<i;r++){const l=p.current[r],o=h.current[r];e.fixedLogo||0!==r||(t+=eu.logoHeight),t+=o,t<=n?a.push(l):(f.current.push([I(),...e.fixedLogo?[N()]:[],...a]),a=[],t=0,r-=1),r===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}),k()},k=()=>{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},P=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},L=()=>{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()+I()+e.join("")+"</table>"},A=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();m.current.previewEl.innerHTML||(T(),await re(0),R(),O(),y(!1))},F=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();T(),await re(0),R(),O(),y(!1),i.doPrint(P()),await re(0),i.doClose()},_=()=>{pe("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=we("print-container"),H={[D]:!0,"no-visible":r};return l().createElement("div",{ref:u,className:Ee()(H)},l().createElement(pt,{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`}},n?.()),l().createElement("div",{className:"workspace",style:S}))))}));lu.displayName="Container";const ou=lu;function su(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class cu extends i.Component{constructor(...e){super(...e),su(this,"context",void 0),su(this,"formRef",l().createRef()),su(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:eu.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:eu.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:eu.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:eu.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),su(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})})),su(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")}))),su(this,"state",{formList:this.createFormList()}),su(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())})),su(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return l().createElement(l().Fragment,null,l().createElement(zl,{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(ge,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),l().createElement(ge,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}su(cu,"contextType",o);const du=cu;function uu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class mu extends i.Component{constructor(...e){super(...e),uu(this,"context",void 0),uu(this,"provide",{$$preview:this}),uu(this,"containRef",l().createRef()),uu(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:eu.defaultDistance,right:eu.defaultDistance,top:eu.defaultDistance,bottom:eu.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),uu(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),uu(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),uu(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 As().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),uu(this,"doClose",(()=>{this.props.onClose?.()})),uu(this,"getPrintConfig",(async e=>{const t=this.context.global,n=t?.getComponentConfigApi;if(n)try{const t=await n({key:e});if(200===t.code)return t.data}catch(e){}})),uu(this,"savePrintConfig",(async(e,t)=>{const n=this.context.global,r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})),uu(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 ')),uu(this,"doPrint",(e=>{const t=au();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=eu,{left:d,right:u,top:m,bottom:h}=a.distance;t.PRINT_INIT(n??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?r&&this.doClose():O.message.error(p("qm.print.printError"))},t.PRINT()})),uu(this,"doExport",(e=>{const t=au();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&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=au(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const n=e.GET_PRINTER_COUNT();for(let r=0;r<n;r++)t.push({text:e.GET_PRINTER_NAME(r),value:r})}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 As().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,Q.isPlainObject)(e)&&await As().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:n,form:r,currentPage:a,totalPage:i,printPage:o}=this.state,s=we("print-preview"),c={visible:n,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:Ee()(d)},l().createElement("div",{className:"outer"},l().createElement("div",{className:"header"},l().createElement("span",null,p("qm.print.printer"),":",l().createElement(O.Select,{value:r.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:r.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:r.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(ge,{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(ge,{type:"text",icon:l().createElement(Ce.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),l().createElement("span",null,l().createElement(ge,{icon:l().createElement(Ce.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),l().createElement("div",{className:"main"},l().createElement(tu.Provider,{value:this.provide},l().createElement(ou,{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:r.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*r.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(mn,c,l().createElement(du,{setting:r.setting,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):l().createElement(tu.Provider,{value:this.provide},l().createElement(ou,{ref:this.containRef,templateRender:t,directPrint:!0}))}}uu(mu,"contextType",o);const pu=mu;function hu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class fu extends i.Component{constructor(...e){super(...e),hu(this,"context",void 0),hu(this,"previewRef",l().createRef()),hu(this,"state",{visible:!1,loading:!1}),hu(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})})),hu(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${eu.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?l().createElement(mn,o,l().createElement(pu,s)):e?l().createElement(pu,s):null})),hu(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await re(0),this.setState({visible:!0}),await re(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:n,type:r,disabled:a,shape:i}=this.props,o={size:t||this.context.size||"",type:r,shape:i,icon:n,loading:e,disabled:a,click:this.clickHandle};return l().createElement(l().Fragment,null,this.props.children&&l().createElement(ge,o,this.props.children),this.createRender())}}hu(fu,"propTypes",{size:(e,t,n)=>{if(!pr(e[t]||""))return me("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:mr().elementType}),hu(fu,"defaultProps",{preview:!0,type:"primary",icon:l().createElement(Ce.PrinterOutlined,null)}),hu(fu,"contextType",o);const gu=fu;function yu(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function bu(e){const t=yu(e);return t?t.frameElement:null}function vu(e){const t=wu(e);return xu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function xu(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 Eu(e,t){const n=bu(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let a=n,i=!1;for(;a;){const e=vu(a);if(r.push(e),a=bu(a),i)break;a&&yu(a)===t&&(i=!0)}return xu(r)}return e.getBoundingClientRect()}function wu(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 Cu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Su=Object.assign;class Nu{constructor(e,t){Cu(this,"node",void 0),Cu(this,"border",void 0),Cu(this,"padding",void 0),Cu(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=Ou.border,this.padding.style.borderColor=Ou.padding,this.content.style.backgroundColor=Ou.background,Su(this.node.style,{borderColor:Ou.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){Ru(t,"margin",this.node),Ru(t,"border",this.border),Ru(t,"padding",this.padding),Su(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"}),Su(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Iu{constructor(e,t){Cu(this,"tip",void 0),Cu(this,"nameSpan",void 0),Cu(this,"dimSpan",void 0),this.tip=e.createElement("div"),Su(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),Su(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),Su(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,n){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(n)+"px"}updatePosition(e,t){const n=this.tip.getBoundingClientRect(),r=function(e,t,n){const r=Math.max(n.height,20),a=Math.max(n.width,60);let i;i=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-r<=t.top+t.height?e.top-r-5<t.top+5?t.top+5:e.top-r-5:t.top+t.height-r-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:n.width,height:n.height});Su(this.tip.style,r.style)}}class Tu{constructor(){Cu(this,"window",void 0),Cu(this,"tipBoundsWindow",void 0),Cu(this,"container",void 0),Cu(this,"tip",void 0),Cu(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const n=e.document;this.container=n.createElement("div"),this.container.style.zIndex="10000000",this.tip=new Iu(n,this.container),this.rects=[],n.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 n=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>n.length;){const e=this.rects.pop();e?.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new Nu(this.window.document,this.container));const r={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};n.forEach(((e,t)=>{const n=Eu(e,this.window),a=wu(e);r.top=Math.min(r.top,n.top-a.marginTop),r.right=Math.max(r.right,n.left+n.width+a.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+a.marginBottom),r.left=Math.min(r.left,n.left-a.marginLeft),this.rects[t].update(n,a)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const a=Eu(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:r.top,left:r.left,height:r.bottom-r.top,width:r.right-r.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Ru(e,t,n){Su(n.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const Ou={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 ku=null,Pu=null;function Lu(){null!=window.document&&(ku=null,null!==Pu&&(Pu.remove(),Pu=null))}function Au(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Fu{constructor(e){Au(this,"_isRunning",void 0),Au(this,"_selectIgnore",void 0),Au(this,"_lastHoveredNode",null),Au(this,"excludeSelectors",void 0),Au(this,"onSelect",void 0),Au(this,"iframesListeningTo",new Set),Au(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Au(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Au(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),Au(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Ge(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Lu();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 n;n=[t],null,!1,null!=window.document?(null!==ku&&clearTimeout(ku),null!=n&&(null===Pu&&(Pu=new Tu),Pu.inspect(n,null))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}})),Au(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Au(this,"selectFiberForNode",(0,Q.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let n=e;const r=[];for(;n!==t&&null!==n;){let e=n.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,r=Array.from(n.classList).reverse();e<r.length;e++)t.test(r[e])&&n.classList.remove(r[e]);if(n.id&&/^rc-\w+/.test(n.id)&&n.removeAttribute("id"),n.id)e+=`#${n.id}`;else{const t=Array.from(n.parentElement.children).filter((e=>e.tagName===n.tagName)),r=n.className.trim();if(t.filter((e=>e.className.includes(r))).length<=1){if(r){const t=r.split(/\s+/);let n="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(n+=`.${t[e]}`);e+=n}}else n.getAttribute("name")?e+=`[name=${n.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(n)+1})`}n.nodeType!==Node.TEXT_NODE&&r.unshift(e),n=n.parentElement}return r.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(){Lu(),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 _u(e){return document.querySelector(e)}const Du=e=>{const{action:t,onConfirm:n,onCancel:r,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(ve,{style:{width:"100%",justifyContent:"flex-end"}},l().createElement(ge,{size:"small",onClick:()=>r?.()},i("qm.guideTracker.closeButton")),l().createElement(ge,{size:"small",onClick:()=>n?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),l().createElement(ge,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},Hu={left:"50%",top:"50%",width:1,height:1},qu=l().forwardRef(((e,t)=>{const{open:n,current:r,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(),w=l().useRef(i.length),[C,S]=Go(0,{value:r,defaultValue:a}),[N,I]=Go(void 0,{value:n,postState:e=>e??!1}),[T,R]=Go(1051,{value:p,defaultValue:p}),[k,P]=l().useState({}),[L,A]=l().useState(!1),[F,_]=l().useState(N),[D,H]=l().useState(!1),[q,$]=kd(k.node,!!n),[M,K]=l().useState(22),z=l().useRef(!1),j=l().useMemo((()=>C>=i.length?"add":"edit"),[C,i]),V=l().useMemo((()=>`${C+1} / ${i.length}`),[C,i]);l().useLayoutEffect((()=>{E.current=new Fu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),P({id:er(),node:e,path:t}),S(w.current),A(!0),W(),g?.(t,e)}})}),[]),l().useEffect((()=>(N?B():W(),N?setTimeout((()=>_(!0)),16):_(!1),()=>{W()})),[N]),l().useEffect((()=>{w.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:C,selector:k.path})})));const Y=we("guide-tracker"),X=[{[`${Y}-primary`]:!0}],Z=Fd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(Dd(),{open:N&&L,autoLock:!0},l().createElement(qd(),{zIndex:T,builtinPlacements:Z,popupPlacement:o,popupVisible:N&&L,popupClassName:Ee()(X,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{A(!1),B()};return l().createElement("div",{className:`${Y}-content`},l().createElement("div",{className:`${Y}-inner`},l().createElement(Ce.CloseOutlined,{className:`${Y}-close`,onClick:()=>{b?.(C),e()}}),l().createElement(O.Dropdown,{open:D,trigger:["click"],dropdownRender:()=>i.length?l().createElement("div",{className:"ant-dropdown-menu step-list"},l().createElement(ca.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),n=i.map((e=>e.id));if((0,Q.isEqual)(t,n))return;const r=t.findIndex((e=>e===k.id)),a=-1!==r?r:C;S(a),y?.(dr(e),a)}},i.map(((e,t)=>l().createElement("li",{key:t,className:Ee()("item",{actived:e.id===k.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!==C&&(P({id:e.id,node:_u(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:T+1,onConfirm:()=>{const n=i.filter((t=>t.id!==e.id)),r=t===C;let a=t<=C?C-1:C;if(a=a<0?0:a,a=a>n.length?n.length:a,r&&n[a]){const{id:e,selector:t}=n[a];P({id:e,node:_u(t),path:t})}S(a),y?.(n,a)}},l().createElement(Ce.CloseOutlined,{className:"close-icon"})))))))):l().createElement(l().Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:T},onOpenChange:e=>H(e)},l().createElement(Ce.MenuOutlined,{className:Ee()(`${Y}-close`,"menu-icon"),style:{width:M}})),h.content&&l().createElement(O.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:T},content:h.content,title:h.title},l().createElement(Ce.QuestionCircleOutlined,{className:Ee()(`${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"),V)),m?m({id:k.id,selector:k.path,actionStatus:j,DO_CLOSE:e},C):l().createElement(Du,{action:j,onConfirm:()=>{y?.("add"===j?[...i,{id:k.id,selector:k.path,title:"Guide Title"}]:[...i],C),e()},onCancel:()=>{b?.(C),e()},onFinish:()=>{e(),b?.(C),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},l().createElement("div",{className:Ee()(`${Y}-target-placeholder`),style:{...q||Hu,position:"fixed",zIndex:T-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:U,onClick:U}))),s&&l().createElement(Dd(),{open:F},l().createElement(zd,{zIndex:T,prefixCls:Y,onPause:()=>{z.current=L,A(!1),W()},onPlay:()=>{z.current?A(!0):B()}})))}));qu.displayName="QmGuideTracker";const $u=qu,Mu=e=>{const{content:t,image:n,width:r,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",w=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",S=o.textAlign??"center",N=Array.isArray(t)?t:[t],I=s[0],T=s[1],R=I/2,O=T/2,k=c[0]??R,P=c[1]??O,L=l().useMemo((()=>{const e=k-R,t=P-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,k,P,u]),A=()=>{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(!n&&e.measureText){e.font=`${v}px ${w}`;const n=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),i=v*N.length+3*(N.length-1)}return[r??t,a??i]})(t),s=l*i,c=o*i,u=(I+l)*i,p=(T+o)*i,f=I/2*i,g=T/2*i,R=u/2,O=p/2,k=2*(I+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 P=()=>{t.restore(),t.drawImage(e,0,0,u,p,u,p,u,p),h&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),((e,t)=>{if(y.current){const n=b.current.get(y.current);n&&(y.current.contains(n)&&y.current.removeChild(n),b.current.delete(y.current));const r=document.createElement("div");r.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))({...L,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),y.current?.append(r),b.current.set(y.current,r)}})(e.toDataURL(),k)},A=()=>{const e=Number(v)*i;t.font=`${E} normal ${x} ${e}px/${o}px ${w}`,t.fillStyle=C,t.textAlign=S,t.textBaseline="top",t.translate(s/2,0),N.forEach(((n,r)=>{t.fillText(n??"",f,g+r*(e+3*i))})),P()};if(n){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),P()},e.onerror=()=>{A()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=n}else A()},F=e=>Array.from(b.current.values()).includes(e);l().useEffect((()=>{A()}),[t,n,r,a,o,s,c,d,u,m,p,h]),function(e,t,n={}){const r=window&&"MutationObserver"in window,a=i.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(l(),r&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,n)),()=>l())),[e])}(y,(e=>{if(p)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),n="attributes"===t.type&&F(t.target);if(e||n){A();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const _=we("watermark");return l().createElement("div",{ref:y,className:Ee()(_,f),style:{position:"relative",...g}},e.children)},Ku=new Map,zu=new WeakMap;let ju=0;function Vu(e,t,n={},r=undefined){if(void 0===window.IntersectionObserver&&void 0!==r){const a=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.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?(n=e.root,n?(zu.has(n)||(ju+=1,zu.set(n,ju.toString())),zu.get(n)):"0"):e[t]}`;var n})).toString()}(e);let n=Ku.get(t);if(!n){const r=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const n=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=n),r.get(t.target)?.forEach((e=>{e(n,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:r},Ku.set(t,n)}return n}(n),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(),Ku.delete(a))}}const Bu=e=>{const{forceRender:t,height:n,placeholder:r=null,unmountIfInvisible:a,className:i,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:t,threshold:n,triggerOnce:r,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=Vu(d,((e,t)=>{p({inView:e,entry:t}),h.current?.(e,t),t.isIntersecting&&r&&l&&(l(),l=void 0)}),{root:e,rootMargin:t,threshold:n,trackVisibility:i,delay:s},a),()=>{l&&l()}}),[Array.isArray(n)?n.toString():n,d,e,t,r,o,i,a,s]);const f=m.entry?.target,g=l().useRef();d||!f||r||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((()=>{n||pe("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=we("lazy-load"),m={[u]:!0};return l().createElement("div",{ref:s,className:Ee()(m,i),style:o},t||c?e.children:l().createElement("div",{className:"placeholder",style:{height:n}},r))},Wu=require("html2canvas");var Uu=r.n(Wu);function Gu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Yu{constructor(e,t,n,r){if(Gu(this,"x",void 0),Gu(this,"y",void 0),Gu(this,"pressure",void 0),Gu(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||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 Xu{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Xu(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,a=e.y-t.y,i=t.x-n.x,l=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+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 Yu(o+g,s+y),c2:new Yu(c+g,d+y)}}constructor(e,t,n,r,a,i){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=a,this.endWidth=i}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const a=r/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(r>0){const r=i-e,a=l-t;n+=Math.sqrt(r*r+a*a)}e=i,t=l}return n}point(e,t,n,r,a){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+a*e*e*e}}function Qu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Zu{constructor(e,t){Qu(this,"canvas",void 0),Qu(this,"ctx",void 0),Qu(this,"textInput",void 0),Qu(this,"width",320),Qu(this,"height",200),Qu(this,"ratio",Math.max(window.devicePixelRatio||1,1)),Qu(this,"penColor","rgba(0,0,0,1)"),Qu(this,"backgroundColor","rgba(0,0,0,0)"),Qu(this,"canAddHistory",!1),Qu(this,"mode",void 0),Qu(this,"openSmooth",!0),Qu(this,"dotSize",0),Qu(this,"throttle",16),Qu(this,"minDistance",5),Qu(this,"velocityFilterWeight",.7),Qu(this,"compositeOperation","source-over"),Qu(this,"minWidth",.5),Qu(this,"maxWidth",2.5),Qu(this,"fontSize",16),Qu(this,"eraserSize",20),Qu(this,"lineHeight",1.25),Qu(this,"degreeOfBlur",5),Qu(this,"textInputPos",{x:0,y:0}),Qu(this,"onStart",(()=>{})),Qu(this,"onEnd",(()=>{})),Qu(this,"_drawingStroke",!1),Qu(this,"_lastPoints",[]),Qu(this,"_data",[]),Qu(this,"_historyList",[]),Qu(this,"_lastVelocity",0),Qu(this,"_lastWidth",0),Qu(this,"_strokeMoveUpdate",void 0),Qu(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)})),Qu(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))})),Qu(this,"isTouchEvent",(e=>"touches"in e)),Qu(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)})),Qu(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)})),Qu(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),Qu(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}))),Qu(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}))),Qu(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n={...t,points:[]};this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)})),Qu(this,"_strokeUpdate",((e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const n=this._createPoint(e.x,e.y,e.pressure),r=this._data[this._data.length-1],a=r.points,i=a.length>0&&a[a.length-1],l=!!i&&n.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(r);if(!i||!i||!l){const e=this._addPoint(n,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(n,o)),a.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),Qu(this,"_strokeEnd",((e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)})),Qu(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})),Qu(this,"_drawDot",((e,t)=>{const n=this.ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()})),Qu(this,"_drawCurve",((e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<a;n+=1){const i=n/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*r,t.maxWidth);this._drawCurveSegment(u,m,p)}n.closePath(),n.fill()})),Qu(this,"_drawCurveSegment",((e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)})),Qu(this,"_createPoint",((e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new Yu(e-r.left,t-r.top,n,(new Date).getTime())})),Qu(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),Qu(this,"_addPoint",((e,t)=>{const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=Xu.fromPoints(n,e);return n.shift(),r}return null})),Qu(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),Qu(this,"_calculateCurveWidths",((e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(r,n),i={end:a,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=a,i})),Qu(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))})),Qu(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)))})),Qu(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),Qu(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),Qu(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})),Qu(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,a-n),this.ctx.stroke(),this.ctx.restore()})),Qu(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(r,t),l=Math.min(a,n),o=.5*(Math.max(r,t)-i),s=.5*(Math.max(a,n)-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()})),Qu(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(n-a,t-r)/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,n),this.ctx.lineTo(r,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,a);const m=r+s,p=a+c;this.ctx.lineTo(m,p);const h=r+d,f=a+u;this.ctx.lineTo(h,f),this.ctx.lineTo(r,a),this.ctx.fill(),this.ctx.restore()})),Qu(this,"getAxisColor",((e,t,n)=>{const r=e.width,a=e.data,i=[];return i[0]=a[4*(n*r+t)],i[1]=a[4*(n*r+t)+1],i[2]=a[4*(n*r+t)+2],i[3]=a[4*(n*r+t)+3],i})),Qu(this,"setAxisColor",((e,t,n,r)=>{const a=e.width,i=e.data;i[4*(n*a+t)]=r[0],i[4*(n*a+t)+1]=r[1],i[4*(n*a+t)+2]=r[2],i[4*(n*a+t)+3]=r[3]})),Qu(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),r=this.ctx.getImageData(t*this.ratio,n*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=r.width,i=r.height,l=a/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const n=this.getAxisColor(r,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(r,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)})),Qu(this,"drawText",(e=>{const{x:t,y:n}=this.textInputPos;if(0===t&&0===n)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const r=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,n+a*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),Qu(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),Qu(this,"drawPencil",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()})),Qu(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),Qu(this,"drawEraser",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),Qu(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),Qu(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=n?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),Qu(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}})),Qu(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),Qu(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),Qu(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),Qu(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),Qu(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),Qu(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),Qu(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),Qu(this,"setDrawMode",(e=>{this.mode=e})),Qu(this,"setLineWidth",(e=>{this.maxWidth=e})),Qu(this,"setPenColor",(e=>{this.penColor=e})),Qu(this,"setFontSize",(e=>{this.fontSize=e})),Qu(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()})),Qu(this,"toDataURL",((e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),Qu(this,"getPNG",(()=>this.toDataURL())),Qu(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 n,r,a,i=0,l=null;const o=()=>{i=Date.now(),l=null,n=e.apply(r,a),l||(r=null,a=[])};return function(...s){const c=Date.now(),d=t-(c-i);return r=this,a=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),i=c,n=e.apply(r,a),l||(r=null,a=[])):l||(l=window.setTimeout(o,d)),n}}(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)}}Qu(Zu,"dataURLToBlob",(e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),a=r.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})})),Qu(Zu,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),Qu(Zu,"canvasToBlob",(e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}))));const Ju=Zu,em=()=>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"})),tm=()=>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"})),nm=()=>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"})),rm=()=>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"})),am=()=>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"})),im=l().forwardRef(((e,t)=>{const{open:n,width:r,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),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,I]=Go(void 0,{value:n,postState:e=>e??!1}),T=l().useMemo((()=>!!e.children),[e.children]),[R,k]=l().useState(s||(T?"square":"line")),[P,L]=l().useState(w[0]),[A,F]=l().useState(T?S[0]:S[4]),[_,D]=l().useState(C[1]),[H,q]=l().useState("bottomLeft"),[$,M]=l().useState(!1),[K,z]=l().useState(!1);l().useEffect((()=>{const e={width:r??x.current?.offsetWidth,height:a??x.current?.offsetHeight,maxWidth:P,mode:R,penColor:A,fontSize:_,backgroundColor:m,openSmooth:!T};return e.openSmooth&&Object.assign(e,{penColor:o,minWidth:d,maxWidth:u}),b.current=new Ju(v.current,e),()=>b.current.destroy()}),[]);const j=e=>{const[t,n]=[r??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),n&&n!==l&&(b.current.height=n,o=!0),(o||e)&&b.current.update()};qe((()=>{T&&N&&j()}),[N,T]),qe((()=>{b.current.setDrawMode(R)}),[R]),qe((()=>{b.current.setLineWidth(P)}),[P]),qe((()=>{b.current.setPenColor(A)}),[A]),qe((()=>{b.current.setFontSize(_)}),[_]);const V=async()=>{const e=T?x.current.parentNode:v.current;if(e)try{const t=await Uu()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Ju.canvasToDataURL(t)}catch(e){pe("Signature","生成合成图片失败!")}},B=()=>{b.current.clear(),g?.()};l().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),CLEAR:()=>b.current.clear(),UNDO:()=>b.current.undo(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:j,GET_DATE_URL:V})));const W=e=>{e&&q((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},U=e=>l().createElement("div",{className:Ee()("ant-dropdown-menu","content")},"text"!==e?l().createElement("div",{className:"lineWidth"},w.map((e=>l().createElement("span",{key:e,className:Ee()("dot",`s${e}`,{active:e===P}),onClick:()=>L(e)})))):l().createElement("div",{className:"fontSize"},l().createElement(O.Select,{size:"small",value:_,options:C.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:Ee()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>F(e)},l().createElement(Ce.CheckOutlined,{className:"icon"})))))),Y=we("signature"),X={[Y]:!0,"is-annotation":T},Q=r?{...h,width:r}:h;return l().createElement("div",{className:Ee()(X,p),style:Q},T&&l().createElement(l().Fragment,null,l().createElement("div",{ref:x,className:"content"},e.children),K&&l().createElement(pt,{spinning:!0,className:"spinning"})),l().createElement("div",{className:Ee()("signature",{show:N})},l().createElement("canvas",{ref:v,className:R}),T&&l().createElement("div",{ref:E,className:"signature__tool-bar"},l().createElement("div",{className:"wrapper"},l().createElement("div",{className:Ee()("actions",{hidden:$})},l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>k("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:()=>k("round")},l().createElement(em,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>k("arrow")},l().createElement(nm,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:W},l().createElement("button",{className:"btn",onClick:()=>k("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:()=>k("text")},l().createElement(tm,null))),l().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{z(!0);const e=await V();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):c()().format(Do);Pt(Ju.dataURLToBlob(e),`${t}.png`)}z(!1)})(),B()}},l().createElement(Ce.DownloadOutlined,null)),l().createElement("button",{className:"btn",onClick:()=>k("eraser")},l().createElement(rm,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.undo()},l().createElement(am,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()=>{z(!0),await re(10);const e=await V();z(!1),B(),f?.(e)}},l().createElement(Ce.CheckOutlined,null))),l().createElement("button",{className:"btn btn-fold",title:y($?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!$)},$?l().createElement(Ce.LeftOutlined,null):l().createElement(Ce.RightOutlined,null))))))}));im.displayName="QmSignature";const lm=im,om={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"},sm=e=>[om.selectionColumnDefine,...e].filter((e=>!e.hidden)),cm=e=>e.some((e=>Array.isArray(e.children))),dm=e=>void 0!==e._groupLevel,um=(e,t)=>t.split(om.separator).reduce(((e,t)=>e?.[t]),e),mm=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(mm)):0,pm=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const a=t?`${t}${om.separator}${r}`:r;if(n.push(a),Array.isArray(e[r]))return n;const i=pm(e[r],a);return n.concat(i)}),[]),hm={sum:e=>Xn(e.reduce(((e,t)=>e+t),0)),avg:e=>e.length>0?(e.reduce(((e,t)=>e+t),0)/e.length).toFixed(2):0,max:e=>e.length>0?Math.max(...e):void 0,min:e=>e.length>0?Math.min(...e):void 0,count:e=>Xn(e.length),unique:e=>new Set(e).size,empty:e=>e.filter((e=>le(e))).length,notEmpty:e=>e.filter((e=>!le(e))).length},fm=l().createContext(void 0),gm=e=>{const{prefixCls:t,pivotProps:n,size:r,getRowKey:a,flatColumns:i,tableData:o}=e,{initialGroup:s}=n,c=e=>{const t=new Map;return qn(e).forEach((e=>t.set(a(e,e.index),e))),t},d=l().useRef({props:n,originGridData:o,flatGroupData:[],isTree:cm(o),keyRecordMap:c(o),gridLayoutContext:{}}),[u,m]=l().useState({pivotRef:d,prefixCls:t,size:r,viewMode:"table",columns:i,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=i.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:[],sorterList:[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map}),p=e=>{m((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};g((()=>{y(o),h("originGridData",o),h("isTree",cm(o)),h("keyRecordMap",c(o))}),[o]),g((()=>{f(i)}),[i]),g((()=>{p({size:r})}),[r]);const h=(e,t)=>{u.pivotRef.current[e]=t};h("props",n);const f=e=>{p({columns:e})},y=e=>{p({gridData:e})},b=e=>{p({groupGridData:e})},v=e=>{p({groupList:e})},x=e=>{p({filterList:e})},E=e=>{p({sorterList:e})},w=e=>{p({colorList:e})},C=e=>{p({expandedKeys:e})},S=e=>{p({searchResults:e})},N=e=>{p({switchIndex:e})},I=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),p({fillColorCells:t})},T=l().useMemo((()=>({...u,setContext:p,getRowKey:a,setPivotGridRef:h,setColumns:f,setGridData:y,setGroupGridData:b,setGroupList:v,setFilterList:x,setSorterList:E,setColorList:w,setExpandedKeys:C,setSearchResults:S,setSwitchIndex:N,setFillColor:I})),[u]);return l().createElement(fm.Provider,{value:T},e.children)},ym=()=>l().useContext(fm),bm=()=>{const{prefixCls:e,pivotRef:t,viewMode:n,setContext:r}=ym(),{fromTable:a}=t.current.props,{t:i}=G(),o=[{label:i("qm.pivotGrid.viewMode.table"),value:"table"},{label:i("qm.pivotGrid.viewMode.gantt"),value:"gantt"},{label:i("qm.pivotGrid.viewMode.card"),value:"card"}];return a?null:l().createElement("div",{className:`${e}-view-mode`},l().createElement(O.Segmented,{value:n,options:o,onChange:e=>{r({viewMode:e})}}))},vm=()=>{const{prefixCls:e,pivotRef:t,groupList:n,columns:r,gridData:a,setGroupList:i,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=ym(),{onGroupChange:d,onDataChange:u}=t.current.props,{t:m}=G(),p=l().useRef([]),h=l().useRef([]),f=l().useMemo((()=>n.filter((e=>e.fieldName&&e.order))),[n]),g=l().useMemo((()=>r.map((e=>({label:nr(e.title),value:e.dataIndex,disabled:n.some((t=>t.fieldName===e.dataIndex))})))),[n,r]),y=l().useMemo((()=>{const e=f.map((e=>({[e.fieldName]:e.order})));return(0,Q.isEqual)(e,p.current)?p.current:(p.current=e,e)}),[f]),b=[{label:m("qm.pivotGrid.group.ascend"),value:"ascend"},{label:m("qm.pivotGrid.group.descend"),value:"descend"}];l().useEffect((()=>{o(h.current)}),[y]),l().useLayoutEffect((()=>{const e=((e,t=[],n)=>{const r=(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=>n(e,i))),s=Object.keys(o).sort(((e,t)=>"ascend"===a?e.localeCompare(t):t.localeCompare(e))),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],l)})),c};return r(e,t)})(a,y,((e,t)=>{const{dictItems:n,precision:a}=r.find((e=>e.dataIndex===t))||{},i=Wn(e,t);let l=n?.find((e=>e.value==i))?.text??i??"";return Array.isArray(i)&&(l=i.map((e=>n?.find((t=>t.value==e))?.text??e)).join(",")),a>=0&&""!==l&&(l=Yn(l)?new(Ea())(l).toFixed(a):l),l||m("qm.pivotGrid.group.empty")}));var t;s(e),t=pm(e),h.current=t,c("flatGroupData",(e=>{const t=[];return function e(n,r,a=""){if(Array.isArray(n))n.forEach(((e,t)=>{e._varIndex=t,a?e._parentRowKey=a:delete e._parentRowKey})),t.push(...qn(n));else for(const i in n){const l=a?`${a}${om.separator}${i}`:i;t.push({id:l,_groupLabel:i,_groupLevel:r}),e(n[i],r+1,l)}}(e,0),t})(e))}),[y,a]),qe((()=>{d?.(f)}),[y]),qe((()=>{u?.(a)}),[a]);const v=()=>{i([...n,{fieldName:"",order:"ascend"}])},x=(e,t,r)=>{Object.assign(t,{[e]:r}),i([...n])};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,m("qm.pivotGrid.group.title")),!!f.length&&l().createElement("div",null,l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},m("qm.pivotGrid.group.foldAll")),l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(h.current)},m("qm.pivotGrid.group.unfoldAll")))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));(0,Q.isEqual)(t,r)||i(e)}},n.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(r=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(O.Select,{value:r.fieldName||null,placeholder:m("qm.table.editable.selectPlaceholder"),options:g,style:{width:160,margin:"0 10px"},onChange:e=>x("fieldName",r,e)}),l().createElement(O.Select,{value:r.order,options:b,placeholder:m("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>x("order",r,e)}),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(n.filter((t=>t!==e)))})(r)}))));var r})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:v},l().createElement(Ce.PlusOutlined,{className:"icon"}),m("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!f.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.FolderOpenOutlined,{className:"icon"}),m("qm.pivotGrid.group.text"),f.length?`(${f.length})`:null))},xm=()=>{const{prefixCls:e,pivotRef:t,columns:n,filterList:r,setFilterList:a,setGridData:i}=ym(),{originGridData:o,isTree:s}=t.current,{onFilterChange:c}=t.current.props,{t:d}=G(),u=l().useRef([]),m=l().useMemo((()=>r.filter((e=>e.fieldName&&("nil"===e.expression||e.value)))),[r]),p=l().useMemo((()=>n.map((e=>({label:nr(e.title),value:e.dataIndex})))),[n]),[h,f]=l().useState("and"),g=l().useMemo((()=>{const e=m.map((e=>`${e.fieldName},${e.expression},${e.value??""}`));return(0,Q.isEqual)(e,u.current)?u.current:(u.current=e,e)}),[m]);qe((()=>{a(r.map((e=>({...e,logic:h}))))}),[h]),qe((()=>{y(),c?.(m)}),[g]);const y=wt((()=>{const e=ar(m.map((e=>({...se(e,["value"]),expression:"nil"!==e.expression?e.expression:"==",condition:e.value}))));i(e?Rn(o,e,s):o)}),200),b=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],v=()=>{a([...r,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:h}])},x=(e,t,i)=>{if(Object.assign(t,{[e]:i}),"fieldName"===e){const e=n.find((e=>e.dataIndex===i)).filter?.type||"text";Object.assign(t,{type:e,expression:E(e)[0].value,value:""})}"expression"===e&&"nil"===i&&Object.assign(t,{value:""}),a([...r])},E=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.likeText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")}]}return t},w=e=>{switch(e.type){case"number":return l().createElement(O.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{x("value",e,le(t)?"":t)}});case"date":return l().createElement(_,{popupClassName:Wo.popupClassName,defaultValue:Zn(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{x("value",e,Jn(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=n.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(O.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||null,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{x("value",e,t)}},t.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(O.Input,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{x("value",e,t.target.value)}})}};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&l().createElement(O.Select,{value:h,options:b,style:{width:130},onChange:e=>f(e)})),l().createElement("div",{className:"list"},r.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(O.Select,{value:n.fieldName||null,options:p,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>x("fieldName",n,e)}),l().createElement(O.Select,{value:n.expression,placeholder:d("qm.table.editable.selectPlaceholder"),options:E(n.type),style:{width:100,margin:"0 10px"},onChange:e=>x("expression",n,e)}),w(n),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(n)}))));var n}))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:v},l().createElement(Ce.PlusOutlined,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.FilterOutlined,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},Em=()=>{const{prefixCls:e,pivotRef:t,columns:n,gridData:r,sorterList:a,setSorterList:i,setGridData:o}=ym(),{onSorterChange:s}=t.current.props,{t:c}=G(),d=l().useMemo((()=>a.filter((e=>e.fieldName&&e.order))),[a]),u=l().useMemo((()=>n.map((e=>({label:nr(e.title),value:e.dataIndex,disabled:a.some((t=>t.fieldName===e.dataIndex))})))),[a,n]);qe((()=>{h(),s?.(d)}),[l().useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],p=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,h=()=>{var e;o((e=d,r.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:a}=r,i=Wn(t,e),l=Wn(n,e),o=p(i,l);if(0!==o)return"ascend"===a?o:-o}return 0})).slice(0)))},f=()=>{i([...a,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),i([...a])};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.sorter.title"))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,Q.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(O.Select,{value:n.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:e=>g("fieldName",n,e)}),l().createElement(O.Select,{value:n.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>g("order",n,e)}),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:f},l().createElement(Ce.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.SortAscendingOutlined,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},wm=()=>{const{prefixCls:e,getRowKey:t,gridData:n,columns:r,searchResults:a,switchIndex:i,setSearchResults:o,setSwitchIndex:s}=ym(),{t:c}=G(),[d,u]=l().useState(!1),m=l().useMemo((()=>a.length),[a]);qe((()=>{d||setTimeout((()=>{s(0),o([])}),200)}),[d]);const p=(e,n)=>{const a=[];return e.forEach((e=>{r.forEach((r=>{const{dataIndex:i,dictItems:l,precision:o}=r,s=Wn(e,i);let c=l?.find((e=>e.value==s))?.text??s??"";Array.isArray(s)&&(c=s.map((e=>l?.find((t=>t.value==e))?.text??e)).join(",")),o>=0&&""!==c&&(c=Yn(c)?new(Ea())(c).toFixed(o):c),c+="",c.includes(n)&&a.push({value:c,rowKey:t(e,e.index),dataIndex:i})})),Array.isArray(e.children)&&a.push(...p(e.children,n))})),a},h=wt((e=>{const t=e.target.value.trim();s(0),o(t?p(n,t):[])}),200),f=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&g()},g=()=>{m&&s((i+1)%m)};return l().createElement(O.Dropdown,{open:d,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.search.title")),l().createElement("button",{className:"button-icon",onClick:()=>u(!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",onClick:()=>{m&&s((i-1+m)%m)}},l().createElement(Ce.LeftOutlined,null)),l().createElement("span",{className:"num"},m>0?i+1:i,"/",m),l().createElement("button",{className:"button-icon",onClick:()=>g()},l().createElement(Ce.RightOutlined,null))),onChange:h,onKeyUp:f}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},l().createElement("span",{onClick:()=>u(!d)},l().createElement(Ce.MonitorOutlined,{className:"icon"}),c("qm.pivotGrid.search.text")))},Cm=()=>{const{prefixCls:e,pivotRef:t,columns:n,setColumns:r}=ym(),{onColumnsChange:a}=t.current.props,{t:i}=G(),o=l().useMemo((()=>{let e=0;for(let t=0;t<n.length-1&&("left"!==n[t].fixed||n[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let r=0;r<n.length;r++)r===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(n[r]);return t}),[n]);return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,i("qm.pivotGrid.field.title"))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:o,setList:e=>{const t=e.map((e=>e.dataIndex)),n=o.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const a=e[r];r<t?a.fixed="left":delete a.fixed,r!==t&&n.push(a)}r(n),a?.(n)})(dr(e))}},o.map((e=>"__divider__"!==e.dataIndex?l().createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},l().createElement(Ce.HolderOutlined,{className:"handle"}),l().createElement("span",{className:"label"},l().createElement("span",{className:"title"},nr(e.title)),l().createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...n];r(t),a?.(t)})(e)},e.hidden?l().createElement(Ce.EyeInvisibleOutlined,null):l().createElement(Ce.EyeOutlined,null)))):l().createElement("li",{key:e.dataIndex,className:"divider"})))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},l().createElement("span",null,l().createElement(Ce.SettingOutlined,{className:"icon"}),i("qm.pivotGrid.field.text")))},Sm=()=>{const{prefixCls:e,size:t,setContext:n}=ym(),{t:r}=G(),a=[{label:r("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:r("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:r("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},a.map((e=>l().createElement("li",{key:e.value,className:Ee()("ant-dropdown-menu-item check-item",{active:t===e.value}),onClick:()=>n({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"}),r("qm.pivotGrid.lineHeight.text")))},Nm="606060",Im="thin",Tm="d4d4d4",Rm=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Om=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},km=()=>({top:{style:Im,color:{argb:Tm}},left:{style:Im,color:{argb:Tm}},bottom:{style:Im,color:{argb:Tm}},right:{style:Im,color:{argb:Tm}}}),Pm=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Lm=()=>{const{prefixCls:e,pivotRef:t,columns:n}=ym(),{t:r}=G(),{exportXLSX:a}=(()=>{const{size:e}=ym(),{t}=G(),{rowHeightMaps:n}=Wo,r=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(r,a,i,l)=>{const{columns:o,footSummation:s}=r,c=n[e],d=On(o),u=[],m=[],p=[];let h=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=nr(e.title),p.push({key:t,width:(n||r)/8})})),u.push(f),h+=u.length;const g=a.map(((e,t)=>{const n={};return d.forEach(((r,a)=>{const i=["percent","finance"].includes(r.formatType);n[r.dataIndex]=i?Wn(e,r.dataIndex):l(e,t,r,a)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));h+=g.length,s&&i(d,a).forEach(((e,n)=>{const r={};d.forEach(((n,i)=>{const{dataIndex:l,summation:o}=n,s=o?.render?o.render(a):Wn(e,l);r[l]=0===i&&""===s?t("qm.table.config.summaryText"):J(s)?tr(s).join(""):s})),m.push(r)}));const{sheetName:y,useStyle:b}=r,v=new(ss().Workbook),x=v.addWorksheet(y);x.columns=p,x.addRows(u).forEach((e=>{b&&Rm(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=An(o,t.key),{align:r,theadAlign:a}=n;Om(e,a||r),b&&Object.assign(e,{font:{bold:!0,color:{argb:Nm}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:km()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];b&&Rm(e,c),e.eachCell(((e,t)=>{const a=x.getColumn(e.col),i=An(o,a.key),{align:l}=i;Om(e,1===t||void 0===r?l:"right"),Object.assign(e,Pm(i)),b&&Object.assign(e,{font:{color:{argb:Nm}},border:km()}),1===Number(e.col)&&n&&(e.alignment={...e.alignment,indent:n})}))})),s&&x.addRows(m).forEach((e=>{b&&Rm(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=An(o,n.key),{align:a}=r;Om(e,1===t?a:"right"),Object.assign(e,Pm(r)),b&&Object.assign(e,{font:{color:{argb:Nm}},border:km()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=await v.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})},importXLSX:(e,n)=>{const{columns:a,file:i}=e,l=On(a),o=new FileReader;o.onerror=()=>{O.message.error(t("qm.table.import.error"))},o.onload=e=>{const a=l.map((e=>nr(e.title))),i=new(ss().Workbook),o=e.target;o?i.xlsx.load(o.result).then((e=>{const i=e.worksheets[0];if(i){const e=i.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(a,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,Q.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,Q.isDate)(r)&&(r=Jn(r,_o)),r?.formula&&(r=r.result??r.value),t[s[n]]=r}));const n={};return a.forEach(((e,a)=>{const{dataIndex:i,dictItems:o}=l[a];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>r(o,e))).filter((e=>""!==e)):t[e]=r(o,t[e])),Un(n,i,t[e])})),n}));n?.(t)}else O.message.error(t("qm.table.import.error"))}else O.message.error(t("qm.table.import.error"))})):O.message.error(t("qm.table.import.error"))},o.readAsArrayBuffer(i)}}})(),{getTitleFromCellValue:i}=as(),o=[{text:r("qm.pivotGrid.count.records"),value:"count"},{text:r("qm.pivotGrid.count.unique"),value:"unique"},{text:r("qm.pivotGrid.count.empty"),value:"empty"},{text:r("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:r("qm.pivotGrid.count.sum"),value:"sum"},{text:r("qm.pivotGrid.count.max"),value:"max"},{text:r("qm.pivotGrid.count.min"),value:"min"},{text:r("qm.pivotGrid.count.avg"),value:"avg"}],s={columns:kn(n),fileName:c()().format(Do),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},d=(e,t,n,r)=>{const{dataIndex:a,precision:l,formatType:o}=n;if(dm(e))return Wn(e,a);let s=i(e,n,t,r);return l>=0&&!o&&""!==s&&(s=Number(s)),s},u=()=>{const{gridLayoutContext:e}=t.current,{countMethod:n,summationData:r}=e;if(!n||!Object.keys(n).length)return[];const a={};return s.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(t>0){let t="";n?.[e]&&(t=o.find((t=>t.value===n[e])).text+" "+r.total[e]),Un(a,e,t)}})),[a]},m=async e=>{const{countMethod:n={}}=t.current.gridLayoutContext,r=await a({...s,footSummation:!!Object.keys(n).length},e,u,d);Pt(r,`${c()().format(Do)}.xlsx`)},p=[{key:"1",label:l().createElement(l().Fragment,null,l().createElement(Ce.FolderOutlined,{style:{marginRight:4}})," ",r("qm.pivotGrid.export.group")),onClick:()=>{m((()=>{const{flatGroupData:e,gridLayoutContext:n}=t.current,{countMethod:r,summationData:a}=n,i=[];let l=0;return e.forEach((e=>{const t={...e};dm(e)?(t._level=e._groupLevel,s.columns.map((e=>e.dataIndex)).forEach(((n,i)=>{if(0===i)Un(t,n,e._groupLabel);else{let i="";r?.[n]&&(i=o.find((e=>e.value===r[n])).text+" "+um(a,e.id).subtotal[n]),Un(t,n,i)}})),l=e._groupLevel):l>0&&(t._level=e._level+l+1),i.push(t)})),i})())}},{key:"2",label:l().createElement(l().Fragment,null,l().createElement(Ce.BarsOutlined,{style:{marginRight:4}})," ",r("qm.pivotGrid.export.list")),onClick:()=>{m(Array.from(t.current.keyRecordMap.values()))}}];return l().createElement(O.Dropdown,{trigger:["click"],menu:{items:p},className:Ee()("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},l().createElement("span",null,l().createElement(Ce.DownloadOutlined,{className:"icon"}),r("qm.pivotGrid.export.text")))},Am=()=>{const{prefixCls:e,pivotRef:t,groupList:n,filterList:r,sorterList:a,setContext:i}=ym(),{uniqueKey:o}=t.current.props,{t:s}=G(),d=l().useMemo((()=>o?`grid_conf_${o}`:""),[o]),u=l().useRef({}),[m,p]=l().useState([]),[h,f]=l().useState({}),[g,y]=l().useState(""),b=(e,t)=>{f((n=>Object.assign({},n,{[e]:t??!n[e]})))};l().useLayoutEffect((()=>{v()}),[]),qe((()=>{x()}),[m]);const v=async()=>{try{if(!d)return;const e=await As().getItem(d);Array.isArray(e)&&(p(e),f(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}},x=async()=>{try{if(!d)return;await As().setItem(d,m)}catch(e){}},E=()=>{const e=er();p([{id:e,label:c()().format(Do),value:{groupList:n,filterList:r,sorterList:a}},...m]),ae((()=>b(e,!0)))};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,s("qm.pivotGrid.saved.title"))),l().createElement("div",{className:"list"},l().createElement("ul",null,m.map((e=>l().createElement("li",{key:e.id,className:Ee()("ant-dropdown-menu-item sort-item",{active:e.id===g}),onClick:()=>(e=>{if(h[e.id])return;const t=g!==e.id,n=t?e.value:u.current;i({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList}),y(t?e.id:"")})(e)},l().createElement("div",{className:"label",style:{width:200}},h[e.id]?l().createElement(O.Input,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,p([...m])),b(e.id,!1)}}):l().createElement("span",null,e.label)),l().createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),b(e.id)}},h[e.id]?l().createElement(Ce.CheckOutlined,null):l().createElement(Ce.EditOutlined,null)),l().createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,p(m.filter((e=>e.id!==n)))}},l().createElement(Ce.CloseOutlined,null))))))),l().createElement("div",{className:"add-record",style:{padding:10}},l().createElement("span",{className:"insert",onClick:E},l().createElement(Ce.PlusOutlined,{className:"icon"}),s("qm.pivotGrid.saved.add")))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:n,filterList:r,sorterList:a}:{},u.current=t}},l().createElement("span",null,l().createElement(Ce.SaveOutlined,{className:"icon"}),s("qm.pivotGrid.saved.text")))},Fm=()=>{const{gridData:e}=ym(),{t}=G();return l().createElement("div",{className:"alert-info"},l().createElement(Ce.InfoCircleOutlined,{className:"icon"}),t("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},_m=()=>{const{prefixCls:e,pivotRef:t,getRowKey:n,columns:r,colorList:a,setColorList:i,setFillColor:o}=ym(),{flatGroupData:s}=t.current,{t:c}=G(),d=l().useRef([]),u=l().useMemo((()=>a.filter((e=>e.fieldName&&e.color&&("nil"===e.expression||e.value)))),[a]),m=l().useMemo((()=>r.map((e=>({label:nr(e.title),value:e.dataIndex})))),[r]),p=l().useMemo((()=>sm(r)),[r]),h=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"}];qe((()=>{f()}),[l().useMemo((()=>{const e=u.map((e=>({[e.color]:`${e.mode},${e.fieldName},${e.expression},${e.value??""}`})));return(0,Q.isEqual)(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=wt((()=>{const e=[];u.forEach((t=>{const r=ar([{...se(t,["value"]),expression:"nil"!==t.expression?t.expression:"==",condition:t.value}]),a=Rn(s,r);if("cell"===t.mode)for(let r=0;r<a.length;r++)e.push({color:t.color,rowKey:n(a[r],a[r].index),dataIndex:t.fieldName});if("row"===t.mode)for(let r=0;r<a.length;r++){const i=n(a[r],a[r].index);for(let n=0;n<p.length;n++)e.push({color:t.color,rowKey:i,dataIndex:p[n].dataIndex})}})),o(e)}),200),g=()=>{i([...a,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},y=(e,t,n)=>{if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=r.find((e=>e.dataIndex===n)).filter?.type||"text";Object.assign(t,{type:e,expression:b(e)[0].value,value:""})}"expression"===e&&"nil"===n&&Object.assign(t,{value:""}),i([...a])},b=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.likeText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")}]}return t};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.fillColor.title"))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,Q.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(op,{defaultValue:n.color,style:{marginLeft:5},onChangeComplete:e=>y("color",n,e.hex)}),l().createElement(O.Select,{value:n.mode,options:h,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:e=>y("mode",n,e)}),l().createElement(O.Select,{value:n.fieldName||null,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>y("fieldName",n,e)}),l().createElement(O.Select,{value:n.expression,placeholder:c("qm.table.editable.selectPlaceholder"),options:b(n.type),style:{width:100,margin:"0 10px"},onChange:e=>y("expression",n,e)}),(e=>{switch(e.type){case"number":return l().createElement(O.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{y("value",e,le(t)?"":t)}});case"date":return l().createElement(_,{popupClassName:Wo.popupClassName,defaultValue:Zn(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{y("value",e,Jn(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=r.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(O.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||null,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{y("value",e,t)}},t.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(O.Input,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{y("value",e,t.target.value)}})}})(n),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:g},l().createElement(Ce.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.BgColorsOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Dm=()=>l().createElement("div",{className:"top-bar"},l().createElement(ve,{size:4},l().createElement(Fm,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(Cm,null),l().createElement(vm,null),l().createElement(xm,null),l().createElement(Em,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(Sm,null),l().createElement(_m,null),l().createElement(wm,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(Lm,null),l().createElement(Am,null)),l().createElement(ve,{size:4},l().createElement(bm,null))),Hm=l().createContext(void 0),qm=e=>{const{scrollbar:t}=e,{pivotRef:n,getRowKey:r,columns:a,groupGridData:i,setPivotGridRef:o}=ym(),{rowSelection:s,treeExpandable:c}=n.current.props,d=c?.defaultExpandAllRows??!0,[u,m]=l().useState({scrollbarRef:t,selectionKeys:s?.defaultSelectedRowKeys??[],treeExpandKeys:d?$n(n.current.originGridData,(e=>r(e,e.index))):[],countMethod:{},summationData:{},checkedColumnKey:"",hoverRowKey:"",updateLayout:0}),p=l().useMemo((()=>Math.max(0,mm(i)-1)),[i]),h=e=>{m((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};l().useLayoutEffect((()=>{o("gridLayoutContext",((e,t)=>{const n={};for(const t of["countMethod","summationData"])t in e&&(n[t]=e[t]);return n})(u))}),[u]),l().useLayoutEffect((()=>{w(),E()}),[a]),l().useLayoutEffect((()=>{s?.selectedRowKeys&&f(s.selectedRowKeys)}),[s?.selectedRowKeys]);const f=e=>{h({selectionKeys:e})},g=e=>{h({treeExpandKeys:e})},y=e=>{var t;h({countMethod:(t=Object.assign({},u.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},b=e=>{h({summationData:e})},v=e=>{h({checkedColumnKey:e})},x=e=>{h({hoverRowKey:e})},E=()=>{h({updateLayout:u.updateLayout+1})},w=()=>{const e=t.current.container.clientWidth,{defaultColumnWidth:n}=Wo,r=[];let i=0;if(a.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,r.push(e))})),r.length>0){const t=a.reduce(((e,t)=>e+(t.width||t.minWidth||n)),0);if(t<=e){const a=e-t;if(1===r.length)r[0].renderWidth=(r[0].minWidth||n)+a;else{const e=a/r.reduce(((e,t)=>e+(t.minWidth||n)),0);let t=0;r.forEach(((r,a)=>{if(0===a)return;const i=Math.floor((r.minWidth||n)*e);t+=i,r.renderWidth=(r.minWidth||n)+i})),r[0].renderWidth=(r[0].minWidth||n)+a-t}}else r.forEach((e=>{e.renderWidth=e.minWidth||n}))}else i=a.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||n)),0)},C=l().useMemo((()=>({...u,indentDepth:p,setContext:h,setSelectionKeys:f,setTreeExpandKeys:g,setCountMethod:y,setSummationData:b,setCheckColumnKey:v,setHoverRowKey:x,forceUpdateLayout:E,updateColumnsWidth:w})),[u,p]);return l().createElement(Hm.Provider,{value:C},e.children)},$m=()=>l().useContext(Hm),Mm=e=>{const{column:t}=e,{columns:n,setColumns:r}=ym(),{scrollbarRef:a}=$m(),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 n=e.clientX-d.current.startX,r=(t.width||t.renderWidth)+n;r<(t.minWidth||Wo.defaultColumnWidth)||(u({columnWidth:r}),i.current.style.left=`${d.current.originSizeX+n}px`)},p=()=>{a.current.container.style.cursor="",t.width=d.current.columnWidth,r([...n]),ae((()=>s(!1))),Me(document,"mousemove",m),Me(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(),a.current.container.style.cursor="col-resize";const n=jn(e.target,a.current.container).left-a.current.scrollLeft+3;u({startX:e.clientX,originSizeX:n,columnWidth:t.width||t.renderWidth||0}),$e(document,"mousemove",m),$e(document,"mouseup",p),s(!0),ae((()=>i.current.style.left=`${n}px`)),c.current=document.onselectstart,document.onselectstart=()=>!1}}),l().createElement(Dd(),{open:o,getContainer:a.current?.container},l().createElement("div",{ref:i,className:"resize-line"})))},Km=e=>{const{left:t}=e,{scrollbarRef:n}=$m();return l().createElement(Dd(),{open:!0,getContainer:n.current?.container},l().createElement("div",{className:"fixed-line",style:{left:t}}))},zm=()=>{const{pivotRef:e,columns:t}=ym(),{indentDepth:n,updateLayout:r,checkedColumnKey:a,selectionKeys:i,setSelectionKeys:o,setCheckColumnKey:s}=$m(),{rowSelection:c}=e.current.props,{selectionColumn:d}=Wo,{indentWidth:u,selectionColumnDefine:m}=om,p=l().useMemo((()=>sm(t)),[t]),h=l().useMemo((()=>p.filter((e=>"left"===e.fixed))),[p]),f=l().useMemo((()=>p.filter((e=>"left"!==e.fixed))),[p]),g=l().useMemo((()=>h.reduce(((e,t,r)=>e+(t.width||t.renderWidth||0)+(1===r?n*u:0)),0)),[n,r,h]),y=l().useMemo((()=>i.length===e.current.keyRecordMap.size),[i]),b=l().useMemo((()=>i.length>0&&i.length<e.current.keyRecordMap.size),[i]),v=(t,r)=>l().createElement("div",{className:Ee()(r?"fixed-left":"no-fixed"),style:{width:r?g:""}},t.map(((i,p)=>{const{dataIndex:h,title:f,align:g,width:v,renderWidth:x}=i,E={"selection-column":h===d,"col--center":"center"===g,"col--right":"right"===g,"col--checked":a===h},w=r&&1===p||!r&&p===t.length-1?n*u:0,C={width:`${(v||x||0)+w}px`,minWidth:`${(v||x||0)+w}px`};return l().createElement("div",{key:h,className:Ee()("table-cell",E),style:C,onClick:()=>{return e=h,void([m.dataIndex].includes(e)||s(a!==e?e:""));var e}},h!==d?l().createElement("span",{className:"cell"},f):l().createElement(O.Checkbox,{checked:y,indeterminate:b,onChange:t=>(t=>{const n=t?Array.from(e.current.keyRecordMap.keys()):[];o(n),c?.onChange?.(n,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}),h!==d&&l().createElement(Mm,{column:i}))})));return l().createElement("div",{className:"header"},v(h,!0),(e=>v(e))(f),l().createElement(Km,{left:g}))},jm=e=>{const{column:t,keyPath:n,type:r}=e,{prefixCls:a}=ym(),{summationData:i,countMethod:o,setCountMethod:s}=$m(),{t:c}=G(),{dataIndex:d,filter:u}=t,[m,p]=l().useState(!1),h=l().useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:hm.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:hm.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:hm.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:hm.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:hm.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:hm.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:hm.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:hm.avg}];return"number"===u?.type?e:e.slice(0,-4)}),[]),f=l().useMemo((()=>{const e=o[d];return e?`${h.find((t=>t.value===e)).text} ${(t=i,a=n,a?um(t,a):t)?.[r]?.[d]??""}`:c("qm.pivotGrid.count.statistic");var t,a}),[i,o]);return l().createElement(O.Dropdown,{open:m,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},h.map((e=>{const t=e.value===o[d];return l().createElement("li",{key:e.value,className:Ee()("ant-dropdown-menu-item check-item",{active:t}),onClick:()=>{s({[d]:t?void 0:e.value}),p(!1)}},l().createElement("span",{className:"label"},e.text),l().createElement("i",{className:"icon"},l().createElement(Ce.CheckOutlined,null)))})))),className:Ee()("count-select",{show:!!o[d]}),overlayClassName:`${a}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},l().createElement("span",null,f," ",l().createElement(Ce.DownOutlined,{className:"icon"})))},Vm=e=>{const{pivotRef:t,expandedKeys:n,groupGridData:r,searchResults:a,switchIndex:i,fillColorCells:o,setExpandedKeys:s}=ym(),{indentDepth:c,hoverRowKey:d,checkedColumnKey:u,selectionKeys:m,treeExpandKeys:p,setSelectionKeys:h,setTreeExpandKeys:f,setHoverRowKey:g}=$m(),{keyRecordMap:y,isTree:b}=t.current,{rowSelection:v,treeExpandable:x,onRowClick:E}=t.current.props,{renderText:w,getTitleFromCellNode:C}=as(),{selectionColumn:S,treeTable:N}=Wo,{indentWidth:I}=om,T=l().useMemo((()=>Array.isArray(r)),[r]),R=(e,t)=>a[i]?.rowKey===e&&a[i]?.dataIndex===t,k=(t,r,a,i)=>{const{dataIndex:o,width:d,renderWidth:u}=t,m={"expandable-column":o===S},p=e&&1===r?(c-a._groupLevel)*I:0,h={width:`${(d||u||0)+p}px`,minWidth:`${(d||u||0)+p}px`};return l().createElement("div",{key:o,className:Ee()("label-cell",m),style:h},o!==S?l().createElement(l().Fragment,null,e&&1===r&&l().createElement("span",{className:"title"},a._groupLabel.slice(1)),l().createElement(jm,{column:t,keyPath:a.id,type:"subtotal"})):(e=>l().createElement("button",{className:Ee()("button-icon",{expand:n.includes(e.id)}),onClick:()=>{return t=e.id,void s(n.includes(t)?n.filter((e=>e!==t)):[...n,t]);var t}},l().createElement(Ce.RightOutlined,null)))(a))},P=(t,n,r,a,i)=>{const{dataIndex:s,width:c,renderWidth:d,align:g,render:I}=t,k=Wn(r,s),P=I?I(k,r,t,r.index,n):w(k,t,r),L=C(P),A=m.includes(i),F={"selection-column":s===S,"col--center":"center"===g,"col--right":"right"===g,"col--checked":u===s,active:R(i,s)},_={width:`${c||d||0}px`,minWidth:`${c||d||0}px`,backgroundColor:o.get(`${i}|${s}`)};return l().createElement("div",{key:s,"data-col-index":n,title:L,className:Ee()("table-cell",F),style:_,onClick:e=>{s!==S&&E?.(r,t,e)}},s!==S?l().createElement(l().Fragment,null,e&&b&&1===n&&l().createElement(l().Fragment,null,(D=r._level)?l().createElement("span",{key:D,className:`cell--indent indent-level-${D}`,style:{paddingLeft:D*N.textIndent+"px"}}):null,((e,t)=>l().createElement(Ce.DownOutlined,{className:Ee()("cell--expand",{fold:!p.includes(t)}),style:{visibility:e.children?.length>0?"visible":"hidden"},onClick:()=>(e=>{const t=p.includes(e),n=t?p.filter((t=>t!==e)):[...p,e];f(n),x?.onExpand?.(!t,y.get(e)),x?.onChange?.(n)})(t)}))(r,i)),l().createElement("span",{className:Ee()("cell",{indent:!T})},P)):l().createElement(l().Fragment,null,l().createElement("span",{className:"order"},((e,t)=>b?0===e._level?e._varIndex+1:null:t+1)(r,a)),l().createElement(O.Checkbox,{className:"checkbox",checked:A,onChange:e=>((e,t)=>{const n=e?[...m,t]:m.filter((e=>e!==t));h(n),v?.onSelect?.(e,y.get(t)),v?.onChange?.(n,(e=>{const t=[];return e.forEach((e=>t.push(y.get(e)))),t})(n))})(e.target.checked,i)})));var D};return{renderGroupRow:(e,t,n)=>l().createElement("div",{className:"label-row"},e.map(((e,n)=>k(e,n,t)))),renderRow:(e,t,n,r)=>{const a={"row--selection":m.includes(r),"row--hover":d===r};return l().createElement("li",{key:r,"data-row-key":r,className:Ee()("table-row",a),onMouseEnter:()=>g(r),onMouseLeave:()=>g("")},e.map(((e,a)=>P(e,a,t,n,r))))}}},Bm=e=>{const{tbodyColumns:t,layout:n,displayList:r,virtualRows:a}=e,{indentDepth:i,updateLayout:o}=$m(),{indentWidth:s}=om,{renderGroupRow:c,renderRow:d}=Vm(!0),u=l().useMemo((()=>t.filter((e=>"left"===e.fixed))),[t]),m=l().useMemo((()=>u.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?i*s:0)),0)),[i,o,u]);return l().createElement("div",{className:"left-panel",style:{width:m}},l().createElement("div",{className:"container"},a.map((e=>{const t=e.index,a=n[t],i=r[t];if(dm(i))return l().createElement("div",{key:i.id,className:"group-label",style:{top:a.top,left:a.left,right:0,height:a.height}},c(u,i,a.key));const o=t===n.length-1||dm(r[t+1]);return l().createElement("div",{key:a.key,className:Ee()("row-item",{last:o}),style:{top:a.top,left:a.left,right:0,height:a.height}},d(u,i,i._varIndex,a.key))}))))},Wm=e=>{const{tbodyColumns:t,layout:n,displayList:r,virtualRows:a}=e,{pivotRef:i}=ym(),{renderGroupRow:o,renderRow:s}=Vm(),c=l().useMemo((()=>t.filter((e=>"left"!==e.fixed))),[t]);return l().createElement("div",{className:"main-panel"},l().createElement("div",{className:"container"},a.map((e=>{const t=e.index,a=n[t],i=r[t];if(dm(i))return l().createElement("div",{key:i.id,className:"group-label",style:{top:a.top,left:0,right:a.right,height:a.height}},o(c,i,a.key));const d=t===n.length-1||dm(r[t+1]);return l().createElement("div",{key:a.key,className:Ee()("row-item",{last:d}),style:{top:a.top,left:0,right:a.right,height:a.height}},s(c,i,i._varIndex,a.key))}))))},Um=()=>{const{pivotRef:e,getRowKey:t,size:n,columns:r,groupGridData:a,expandedKeys:i,searchResults:o,switchIndex:s}=ym(),{scrollbarRef:c,treeExpandKeys:d}=$m(),{flatGroupData:u}=e.current,{groupMargin:m}=om,{rowHeightMaps:p}=Wo,h=l().useRef(null),{contextMenu:f}=(({ref:e,popup:t,prevent:n,enabled:r=!0})=>{const a=l().useRef(null),i=l().useRef(null),o=e=>{i.current=e},[s,c]=l().useState(!1),[d,u]=l().useState(null),m={width:150,height:200,zIndex:9999};Fc({ref:a,handler:()=>p()});const p=()=>{c(!1),u(null),o(null)},h=Y((e=>{if(e.preventDefault(),n?.(e.target))return p();o(e),c(!0),ae((()=>{const{width:t,height:n}=a.current?.getBoundingClientRect()||m,r=t,i=n,l=window.innerWidth,o=window.innerHeight;let s=e.clientX,c=e.clientY;s+r>l&&(s-=r),c+i>o&&(c-=i),u({x:s,y:c})}))}));l().useEffect((()=>{const t=e.current;return r&&t&&t.addEventListener("contextmenu",h),()=>{t&&t.removeEventListener("contextmenu",h)}}),[e]);const f=we("context-menu"),g={position:"fixed",top:`${d?.y||0}px`,left:`${d?.x||0}px`,zIndex:m.zIndex};return{contextMenu:l().createElement(Dd(),{open:s},l().createElement("div",{ref:a,className:Ee()(f,"ant-dropdown-menu"),style:g},i.current?t(i.current):null)),closeMenu:p}})({ref:h,prevent:e=>e.offsetParent.classList.contains("group-label"),enabled:!1,popup:e=>{const n=Ue(e.target,"table-row"),r=n?.getAttribute("data-row-key")||"";return u.find((e=>t(e,e.index)==r)),l().createElement("div",{style:{height:200,width:150}},"右键菜单。。。")}}),g=l().useMemo((()=>sm(r)),[r]),y=l().useMemo((()=>Array.isArray(a)),[a]),b=l().useMemo((()=>{const e=new Map,n=[];return u.forEach((r=>{if(dm(r)){if(0===r._groupLevel)return e.set(r.id,i.includes(r.id)),void n.push(r);const t=r.id.slice(0,r.id.lastIndexOf(om.separator));return void(i.includes(t)&&e.get(t)&&(e.set(r.id,i.includes(r.id)),n.push(r)))}const a=t(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(a,d.includes(a)),n.push(r))})),e.clear(),n}),[a,i,d]),v=l().useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],a=[],i=n,l=om.indentWidth,o=om.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;a.length>0&&a[a.length-1]._level>=e._groupLevel;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}a[a.length-1];const t={key:e.id,top:s,left:l*e._groupLevel,right:l*e._groupLevel,height:i,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),a.push(t),s+=i}else{const n=a[a.length-1]||{left:0,right:0},l={key:t(e,e.index),top:s,left:n.left,right:n.right,height:i};r.push(l),s+=i,a.length>0&&(n._childHeight+=i)}}));a.length>0;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(b,{getRowKey:t,rowHeight:p[n]})),[b,n]),x=l().useMemo((()=>{if(y)return v.reduce(((e,t)=>e+t.height),0)+2*m;const e=v.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*m+2*m}),[y,v]),{virtualRows:E}=(e=>{const{layout:t,isGroup:n}=e,{size:r}=ym(),{scrollbarRef:a}=$m(),{rowHeightMaps:i}=Wo,o=l().useMemo((()=>a.current?.container.children[0]??null),[a.current]),s=Cc({count:t.length,getScrollElement:()=>o,estimateSize:e=>t[e].height,overscan:1,noCache:n,rangeExtractor:e=>{if(!n)return pc(e);const l=a.current.scrollTop,c=s.scrollElement?.offsetHeight||o.offsetHeight,d=[];for(let e=0;e<t.length;e++){const n=t[e];l>n.top+n.height+i[r]||l+c+i[r]<n.top||d.push(e)}return d}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:v,isGroup:!y});qe((()=>{const e=u.findIndex((e=>t(e,e.index)===o[s]?.rowKey));e>=0&&c.current.SET_SCROLL_TOP(e*p[n]);const r=g.findIndex((e=>e.dataIndex===o[s]?.dataIndex));if(r>=0){const e=g.slice(0,r).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]);const w={tbodyColumns:g,layout:v,displayList:b,virtualRows:E};return l().createElement("div",{ref:h,className:"body",style:{height:x}},l().createElement(Bm,w),l().createElement(Wm,w),f)},Gm=()=>{const{columns:e,groupGridData:t}=ym(),{indentDepth:n,updateLayout:r,countMethod:a,setSummationData:i}=$m(),{selectionColumn:o}=Wo,{indentWidth:s}=om,c=l().useMemo((()=>sm(e)),[e]),d=l().useMemo((()=>c.filter((e=>"left"===e.fixed))),[c]),u=l().useMemo((()=>c.filter((e=>"left"!==e.fixed))),[c]),m=l().useMemo((()=>d.reduce(((e,t,r)=>e+(t.width||t.renderWidth||0)+(1===r?n*s:0)),0)),[n,r,d]);qe((()=>{i(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const a=e.map((e=>oe(e,r)||0));n[r]=t[r](a)}return n},a=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const i={},l={};Object.keys(t).forEach((e=>{l[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>oe(e,n)||0));e[n]=t[n](r),l[n].push(...r)}i[r]={subtotal:e}}else{const e=a(o);i[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&l[n].push(t)}}}if(0===n.length)return i;const o={};for(const e in t)o[e]=t[e](l[e]);return i.subtotal=o,i},i=Array.isArray(e)?{total:r(e)}:a(e);return n.length>0&&(i.total=r(n)),delete i.subtotal,i})(t,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:hm[e[n]]});return t})(a)))}),[a,t]);const p=(e,t)=>l().createElement("div",{className:Ee()(t?"fixed-left":"no-fixed"),style:{width:t?m:""}},e.map(((r,a)=>{const{dataIndex:i,width:c,renderWidth:d}=r,u={"selection-column":i===o,"col--right":!0},m=t&&1===a||!t&&a===e.length-1?n*s:0,p={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return l().createElement("div",{key:i,className:Ee()("table-cell",u),style:p},i!==o?l().createElement(jm,{column:r,keyPath:"",type:"total"}):null)})));return l().createElement("div",{className:"footer"},p(d,!0),(e=>p(e))(u))},Ym=()=>{const{prefixCls:e,size:t}=ym(),n=l().useRef(null);return l().createElement(qm,{scrollbar:n},l().createElement(Rt,{ref:n,className:Ee()(`${e}__layout`,t)},l().createElement(zm,null),l().createElement(Um,null),l().createElement(Gm,null)))},Xm=()=>l().createElement("div",{className:"wrapper"},l().createElement(Ym,null)),Qm={rowKey:"id",columns:[],dataSource:[]},Zm=e=>{const t=h(Qm,e),{rowKey:n,fromTable:r,columns:a,dataSource:i,height:o,maxHeight:s,className:c,style:d}=t,{$size:u}=X(t),m=Y(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(pe("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),p=(e,t="",n=0)=>e.map(((e,r)=>{const a=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=p(e.children,a,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),f=l().useMemo((()=>(e=>{let t=!1;const n=(e=>e.filter((e=>![Wo.expandableColumn,Wo.selectionColumn,"index","pageIndex",Wo.operationColumn].includes(e.dataIndex))))(e).map((e=>{"left"===e.fixed&&(t=!0);const n={...e,fixed:"left"===e.fixed?"left":void 0,editRender:void 0};return r&&(void 0===n.fixed&&delete n.fixed,delete n.editRender),n}));return!t&&n.length&&(n[0].fixed="left"),n})(a)),[a]),g=l().useMemo((()=>p(i)),[i]),y=we("pivot-grid"),b={[y]:!0,"is-from-table":r},v={height:o,maxHeight:o||s?s:500},x={prefixCls:y,size:u,getRowKey:m,flatColumns:f,tableData:g,pivotProps:se(t,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return l().createElement("div",{className:Ee()(b,c),style:{...d,...v}},l().createElement(gm,x,l().createElement(Dm,null),l().createElement(Xm,null)))};Zm.displayName="PivotGrid";const Jm=Zm,ep=l().forwardRef(((e,t)=>{const{dataIndex:n,className:r,style:a}=e;return l().createElement("li",{ref:t,"data-index":n,className:Ee()("list-item",r),style:a},e.children)}));ep.displayName="ListItem";const tp=ep,np=l().forwardRef(((e,t)=>{const{dataSource:n=[],height:r,maxHeight:a,itemHeight:i,renderItem:o,onScroll:s,className:c}=e,d=l().useRef(null),u=Cc({count:n.length,getScrollElement:()=>d.current?.container.children[0]??null,estimateSize:()=>i||40,overscan:3,onChange:(e,t)=>s?.(e,t)}),m=u.getVirtualItems();l().useImperativeHandle(t,(()=>({SCROLL_TO_INDEX:e=>u.scrollToIndex(e),SCROLL_TO_OFFSET:e=>u.scrollToOffset(e)})));const p=we("virtual-list");return l().createElement(Rt,{ref:d,className:Ee()(p,c),style:{...e.style,height:r,maxHeight:a}},l().createElement("div",{className:"container",style:{height:u.getTotalSize()}},l().createElement("ul",{style:{transform:`translateY(${m[0]?.start??0}px)`}},m.map((e=>l().createElement(tp,{ref:u.measureElement,key:e.index,dataIndex:e.index,style:{height:i}},o?.(n[e.index],e.index)))))))}));np.displayName="VirtualList";const rp=np,ap=require("@rc-component/color-picker");var ip=r.n(ap);const lp=e=>{const{value:t,defaultValue:n,disabled:r,disabledAlpha:a,className:i,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=Go("",{value:t,defaultValue:n}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),p=Fd({offset:0,arrowWidth:16,borderRadius:6}),h=we("color-picker");return l().createElement(qd(),{action:["click"],prefixCls:h,popupPlacement:"bottomLeft",builtinPlacements:p,popup:()=>l().createElement(ip(),{prefixCls:h,value:d,disabled:r,disabledAlpha:a,onChange:(e,t)=>{u(e.toRgbString()),s?.(m(e),t)},onChangeComplete:(e,t)=>{c?.(m(e),t)}})},l().createElement("div",{className:Ee()(`${h}-btn`,i),style:o},l().createElement(ap.ColorBlock,{color:d,prefixCls:h})))};lp.displayName="ColorPicker";const op=lp,sp="1.11.12";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}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};r.r(a),r.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:()=>A,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:()=>Xt,DcpButton:()=>ge,DcpCollapse:()=>De,DcpColorPicker:()=>sp,DcpConfigProvider:()=>U,DcpCopyToClipboard:()=>Xc,DcpCountup:()=>st,DcpCropper:()=>mo,DcpDivider:()=>Ne,DcpDownload:()=>Mt,DcpDrawer:()=>an,DcpEmpty:()=>ut,DcpForm:()=>zl,DcpGuideTracker:()=>$u,DcpLazyLoad:()=>Wu,DcpModal:()=>mn,DcpPivotGrid:()=>ep,DcpPrint:()=>gu,DcpRangeTableHelper:()=>Rd,DcpScrollbar:()=>Rt,DcpSearchHelper:()=>fd,DcpSearchTree:()=>To,DcpSignature:()=>lm,DcpSpace:()=>ve,DcpSpin:()=>pt,DcpSplit:()=>rt,DcpTable:()=>md,DcpTabs:()=>tn,DcpTinymce:()=>oo,DcpTour:()=>Gd,DcpTransition:()=>Jd,DcpTreeHelper:()=>Cd,DcpTreeTableHelper:()=>Ed,DcpUploadFile:()=>po,DcpUploadImg:()=>yo,DcpVirtualList:()=>ap,DcpWatermark:()=>Mu,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:()=>Xt,QmButton:()=>ge,QmCollapse:()=>De,QmColorPicker:()=>sp,QmConfigProvider:()=>U,QmCopyToClipboard:()=>Xc,QmCountup:()=>st,QmCropper:()=>mo,QmDivider:()=>Ne,QmDownload:()=>Mt,QmDrawer:()=>an,QmEmpty:()=>ut,QmForm:()=>zl,QmGuideTracker:()=>$u,QmLazyLoad:()=>Wu,QmModal:()=>mn,QmPivotGrid:()=>ep,QmPrint:()=>gu,QmRangeTableHelper:()=>Rd,QmScrollbar:()=>Rt,QmSearchHelper:()=>fd,QmSearchTree:()=>To,QmSignature:()=>lm,QmSpace:()=>ve,QmSpin:()=>pt,QmSplit:()=>rt,QmTable:()=>md,QmTabs:()=>tn,QmTinymce:()=>oo,QmTour:()=>Gd,QmTransition:()=>Jd,QmTreeHelper:()=>Cd,QmTreeTableHelper:()=>Ed,QmUploadFile:()=>po,QmUploadImg:()=>yo,QmVirtualList:()=>ap,QmWatermark:()=>Mu,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:()=>$,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:()=>Xr,version:()=>cp});var i=r(442),l=r.n(i);const o=(0,i.createContext)({locale:"zh-cn",size:"middle"}),s=require("dayjs");var c=r.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:"模糊匹配",nullText:"空值",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:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}}}};require("dayjs/locale/zh-cn");let u=d;function m(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const p=(...e)=>{const[t,n]=e;let r;const a=t.split(".");let i=u;for(let e=0,t=a.length;e<t;e++){if(r=i[a[e]],e===t-1)return m(r,n);if(!r)return"";i=r}return""},h=(e,t)=>({...e,...Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})}),f=(e,t)=>{const n=i.useRef(!0);i.useLayoutEffect((()=>e(n.current)),t),i.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function g(e,t){f((t=>{if(!t)return e()}),t)}const y=require("dayjs/plugin/localeData");var b=r.n(y);const v=require("dayjs/plugin/advancedFormat");var x=r.n(v);const E=require("dayjs/plugin/customParseFormat");var w=r.n(E);const C=require("dayjs/plugin/quarterOfYear");var S=r.n(C);const N=require("dayjs/plugin/weekOfYear");var I=r.n(N);const T=require("dayjs/plugin/weekday");var R=r.n(T);c().extend(b()),c().extend(x()),c().extend(w()),c().extend(S()),c().extend(I()),c().extend(R());const O=require("antd"),k=require("rc-picker/es/generate/dayjs");var P=r.n(k);const L=require("antd/es/calendar/generateCalendar"),A=r.n(L)()(P()),F=require("antd/es/date-picker/generatePicker"),_=r.n(F)()(P());function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}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 q=i.forwardRef(((e,t)=>i.createElement(_.RangePicker,D({},e,{picker:"time",mode:void 0,ref:t}))));q.displayName="RangePicker",H.RangePicker=q;const $=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",nullText:"null value",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"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}}}},K=require("antd/es/locale/zh_CN");var z=r.n(K);const j=require("antd/es/locale/en_GB");var V=r.n(j);const W={[M.name]:{qm:M,antd:V()},[d.name]:{qm:d,antd:z()}},B=e=>{const t=h({locale:"zh-cn",size:"middle"},e),{locale:n,size:r,global:a}=t;l().useMemo((()=>{return e=Object.assign({},W,a?.langPackage)[n].qm,u=e||u,void(u.name&&c().locale(u.name));var e}),[n]);const i=l().useMemo((()=>Object.assign({},W,a?.langPackage)),[a]),[s,d]=l().useState({locale:n,size:r,global:a});return g((()=>{d((e=>Object.assign({},e,{locale:n,size:r})))}),[r,n]),l().createElement(o.Provider,{value:s},l().createElement(O.ConfigProvider,{locale:i[s.locale].antd,componentSize:s.size,autoInsertSpaceInButton:a?.autoInsertSpaceInButton},t.children))};B.displayName="QmConfigProvider";const U=B;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=()=>{},ne=()=>!0,re=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)=>t.split(".").reduce(((e,t)=>e?.[t]),e),se=(e,t)=>{const n={...e};for(const e of t)delete n[e];return n},ce=(e,t=new WeakMap)=>{if((0,Q.isPlainObject)(e)||(0,Q.isArray)(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const a=n?void 0:Object.keys(e);return function(n,i){let l=-1;const o=n.length;for(;++l<o;)s=n[l],c=l,a&&(c=s),r[c]=ce(e[c],t);var s,c}(a||e),r}return e},de=e=>(0,Q.isNumber)(e)?`${e}px`:e.toString();class ue extends Error{constructor(e){super(e),this.name="QmDesignError"}}function me(e,t){throw new ue(`[${e}] ${t}`)}function pe(e,t){console.warn(new ue(`[${e}] ${t}`))}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(null,arguments)}const fe=e=>{const{loading:t,shortcutKey:n,authConfig:r,click:a,confirm:i}=e,{t:o}=G(),{$size:s}=X(e);l().useEffect((()=>(n&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=l().useState(!1),u=Y((e=>{const t=n.split("+").map((e=>e.trim().toLowerCase())),r=t.includes("alt"),a=t.includes("ctrl"),i=t.includes("shift"),l=t[t.length-1];r&&!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){pe("Button","`click`方法执行出错")}d(!1)}}:null,p={...se(e,["shortcutKey","authConfig","click","confirm"]),size:s,loading:c||t||!1,...m};if(r){const{visible:e=1,disabled:t}=r||{};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,he({},p,{onClick:te}),e.children)):!n||p.disabled?h:l().createElement(O.Tooltip,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${n}`},h)};fe.displayName="QmButton";const ge=fe;var ye=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ye||{});const be=e=>{const{$size:t}=X(e),n=(0,Q.isNumber)(e.size)?e.size:ye[t||"default"],r={...se(e,["size"]),size:n};return l().createElement(O.Space,r,e.children)};be.displayName="QmSpace";const ve=be,xe=require("classnames");var Ee=r.n(xe);const we=e=>`qm-${e}`,Ce=require("@ant-design/icons"),Se=e=>{const{label:t,extra:n,collapse:r,bordered:a=!0,disabled:i,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=X(e),{t:m}=G(),p=we("divider"),h={[p]:!0,[`${p}-borderless`]:!a,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return l().createElement("div",{id:o,className:Ee()(h,s),style:c},l().createElement("span",{className:`${p}__title`},t),l().createElement("div",{className:`${p}__extra`},n),void 0!==r&&l().createElement(O.Button,{type:"link",className:`${p}__collapse`,disabled:i,onClick:()=>{d?.(!r)}},m(r?"qm.divider.collect":"qm.divider.spread"),r?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)))};Se.displayName="QmDivider";const Ne=Se,Ie=()=>({height:0,opacity:0}),Te=e=>({height:e.scrollHeight,opacity:1}),Re=e=>({height:e?e.offsetHeight:0}),Oe=(e,t)=>!0===t?.deadline||"height"===t.propertyName,ke=require("rc-motion");var Pe=r.n(ke);const Le=l().forwardRef(((e,t)=>{const{forceRender:n,className:r,style:a,boxStyle:i,isActive:o}=e,[s,c]=l().useState(o||n);if(l().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const d=we("collapse");return l().createElement("div",{ref:t,className:Ee()(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},r),style:a},l().createElement("div",{className:`${d}-content-box`,style:i},e.children))}));Le.displayName="PanelContent";const Ae=Le;function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fe.apply(null,arguments)}const _e=e=>{const{defaultActive:t,label:n,extra:r,className:a,style:i,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=l().useState(!!t),f=we("collapse"),g=Ee()({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},a);return l().createElement("div",{className:g,style:i},l().createElement(Ne,{label:n,extra:r,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),m?.(e)}}),l().createElement(Pe(),Fe({visible:p},((e=we("motion-collapse"))=>({motionName:e,onAppearStart:Ie,onEnterStart:Ie,onAppearActive:Te,onEnterActive:Te,onLeaveStart:Re,onLeaveActive:Ie,onAppearEnd:Oe,onEnterEnd:Oe,onLeaveEnd:Oe,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:t,style:n},r)=>l().createElement(Ae,{ref:r,prefixCls:f,className:t,style:n,boxStyle:o,isActive:p,forceRender:d},e.children))))};_e.displayName="QmCollapse";const De=_e,He=l().createContext(void 0);function qe(e,t){((t,n)=>{const r=i.useRef(!0);i.useEffect((()=>(t=>{if(!t)return e()})(r.current)),n),i.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})(0,t)}const $e=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},Me=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Ke=e=>e.preventDefault(),ze=(e,t)=>{if(Z||!e||!t)return null;"float"===(t=ie(t))&&(t="cssFloat");try{const n=e.style[t];if(n)return n;const r=window.getComputedStyle(e);return r?r[t]:""}catch(n){return e.style[t]}},je=(e,t,n)=>{!Z&&e&&t&&((0,Q.isPlainObject)(t)?Object.keys(t).forEach((n=>{je(e,n,t[n])})):(t=ie(t),e.style[t]=n))},Ve=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},We=(e,t)=>Math.abs(Ve(e)-Ve(t)),Be=e=>{let t=0,n=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:n}},Ue=(e,t)=>{let n=e;for(;n;){if(n.classList?.contains(t))return n;n=n.parentNode}return null},Ge=(e,t)=>{if(Z||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ye=e=>Math.pow(e,3),Xe=e=>e<.5?Ye(2*e)/2:1-Ye(2*(1-e))/2,Qe=e=>{const{minValues:t,onDragChange:n,onDragging:r}=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}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const n=e[`page${d}`]-u.current[`start${d}`],a=[t[0],u.current[`containerSize${d}`]-t[1]];let i=u.current[`firstElementSize${d}`]+n;i=Math.max(a[0],i),i=Math.min(a[1],i),r(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),n(!1),Me(document,"mousemove",p),Me(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g=we("split"),y={[`${g}__resize-bar`]:!0,vertical:"vertical"===i,horizontal:"horizontal"===i};return l().createElement("div",{className:Ee()(y),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,r=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:r.offsetWidth,firstElementSizeY:r.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),$e(document,"mousemove",p),$e(document,"mouseup",h),n(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Qe.displayName="ResizeBar";const Ze=Qe,Je=l().forwardRef(((e,t)=>{const{offset:n,className:r,style:a}=e,{direction:i,dragging:o}=l().useContext(He),s="vertical"===i?"height":"width",c=we("split-pane"),d={[c]:!0,isLocked:o,horizontal:"horizontal"===i,vertical:"vertical"===i,[r]:!!r},u=void 0!==n?{[s]:de(n)}:{flex:1,[s]:0};return l().createElement("div",{ref:t,className:Ee()(d),style:{...u,...a}},e.children)}));Je.displayName="SplitPane";const et=Je;function tt(){return tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tt.apply(null,arguments)}const nt=e=>{const{direction:t="horizontal",defaultValue:n="50%",uniqueKey:r,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((()=>r?`split_${r}`:""),[r]),[b,v]=l().useState(!1),[x,E]=l().useState(h(n));qe((()=>{b?s?.(f(x)):(d?.(f(x)),localStorage.setItem(y,x),S(y,x))}),[b]),l().useEffect((()=>{w()}),[]);const w=()=>{if(!y)return;const e=localStorage.getItem(y);e?E(h(e)):C(y).then((e=>{localStorage.setItem(y,h(e||n)),w()})).catch((()=>{}))},C=async e=>{const t=u?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},S=async(e,t)=>{const n=u?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},N=l().useMemo((()=>({splitRef:m,direction:t,dragging:b})),[t,b]),I=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"SplitPane"===e.type?.displayName&&I.push(e)}));const[T,R]=I,O=l().useMemo((()=>[g(T),g(R)]),[T,R]),k=we("split"),P={[k]:!0,vertical:"vertical"===t};return l().createElement(He.Provider,{value:N},l().createElement("div",{ref:m,className:Ee()(P,a),style:i},l().createElement(et,tt({},T.props,{ref:p,offset:x})),l().createElement(Ze,{minValues:O,onDragChange:e=>v(e),onDragging:e=>{E(`${e}px`),c(e)}}),l().createElement(et,R.props)))};nt.displayName="QmSplit",nt.Pane=et;const rt=nt,at=require("react-countup");var it=r.n(at);function lt(){return lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lt.apply(null,arguments)}const ot=e=>{const{className:t,style:n}=e,{$size:r}=X(e),a=we("countup"),i={[a]:!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r};return l().createElement(it(),lt({},e,{className:Ee()(i,t),style:n}),e.children)};ot.displayName="QmCountup";const st=ot;function ct(){return ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ct.apply(null,arguments)}const dt=e=>{const{className:t}=e,{$size:n}=X(e),r=we("empty"),a={...e,image:O.Empty.PRESENTED_IMAGE_SIMPLE},i={[r]:!0,[`${r}--lg`]:"large"===n,[`${r}--sm`]:"small"===n};return l().createElement(O.Empty,ct({},a,{className:Ee()(i,t)}))};dt.displayName="QmEmpty";const ut=dt,mt=e=>{const t=h({tip:"Loading..."},e),{fullHeight:n,className:r,style:a}=t,i=we("spin"),o={[i]:!0,[`${i}-fullHeight`]:!!n},s={wrapperClassName:Ee()(o,r),...se(t,["fullHeight"]),style:{...a,maxHeight:"none"}};return l().createElement(O.Spin,s,t.children)};mt.displayName="QmSpin";const pt=mt,ht=l().createContext(void 0),ft=require("resize-observer-polyfill");var gt=r.n(ft);const yt=new Map,bt=new(gt())((function(e){e.forEach((e=>{const{target:t}=e;yt.get(t)?.forEach((e=>e(t)))}))}));function vt(e,t){yt.has(e)||(yt.set(e,new Set),bt.observe(e)),yt.get(e).add(t)}function xt(e,t){yt.has(e)&&(yt.get(e).delete(t),yt.get(e).size||(bt.unobserve(e),yt.delete(e)))}function Et(e){const[t,n]=i.useState({width:0,height:0});return i.useLayoutEffect((()=>{const t=e.current,r=e=>{n({width:e.offsetWidth,height:e.offsetHeight})};return t&&vt(t,r),()=>{t&&xt(t,r)}}),[e]),t}function wt(e,t){const n=i.useRef(null);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...r)=>{n.current&&clearTimeout(n.current),n.current=setTimeout((()=>e.apply(this,r)),t)}),[e,t])}const Ct=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"}},Nt=e=>{const{thumb:t,always:n,className:r,barSize:a=Ct,direction:i="vertical",onDrag:o=te}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=l().useContext(ht),u=St[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 $e(e,"mousemove",S),$e(e,"mouseleave",N),()=>{C(),Me(document,"mouseup",w),Me(e,"mousemove",S),Me(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 n=100*(-1*(p.current.getBoundingClientRect()[u.direction]-e[u.client])-(h.current[u.offset]-t))/p.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},w=()=>{g.current=!1,f.current={[u.axis]:0},Me(document,"mousemove",E),Me(document,"mouseup",w),C(),y.current&&x(!1),o(!1)},C=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},S=()=>{y.current=!1,x(!!m.current.size)},N=()=>{y.current=!0,x(g.current)},I=we("scrollbar"),T={[`${I}__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(Jd,{name:"fade",in:n||s||v,timeout:300},l().createElement("div",{ref:p,className:Ee()(T,r),style:R},l().createElement("div",{ref:h,className:`${I}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),$e(document,"mousemove",E),$e(document,"mouseup",w),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])})}})))},It=20,Tt=l().forwardRef(((e,t)=>{const{wrapClassName:n,wrapStyle:r,innerStyle:a,barWidth:i,always:o,native:s,showTopScrollbar:c,minSize:d=It,onScroll:u}=e,m=l().useRef(null),p=l().useRef(null),h=l().useRef(null),[f,y]=l().useState({size:0,offset:0,ratio:1}),[b,v]=l().useState({size:0,offset:0,ratio:1}),[x,E]=l().useState(!1),w=Et(m),C=Et(h);g((()=>{!s&&S()}),[C.width,C.height,w.width,w.height]);const S=wt((()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=e**2/p.current.scrollHeight,r=t**2/p.current.scrollWidth,a=Math.max(n,d),i=Math.max(r,d),l=n/(e-n)/(a/(e-a)),o=r/(t-r)/(i/(t-i)),s=a+4<e?a:0,c=i+4<t?i:0,u=100*p.current.scrollTop/e*l,m=100*p.current.scrollLeft/t*o;y(Object.assign({},f,{size:c,ratio:o,offset:m})),v(Object.assign({},b,{size:s,ratio:l,offset:u}))}),5),N=e=>{E(e)},I=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollTop=r+(t-r)*Xe(l),a(i)):e.scrollTop=t};a(i)})(p.current,e):p.current.scrollTop=e:pe("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{(0,Q.isNumber)(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,a=window.requestAnimationFrame,i=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollLeft=r+(t-r)*Xe(l),a(i)):e.scrollLeft=t};a(i)})(p.current,e):p.current.scrollLeft=e:pe("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};l().useImperativeHandle(t,(()=>({container:m.current,scrollTop:p.current?.scrollTop||0,scrollLeft:p.current?.scrollLeft||0,SET_SCROLL_TOP:I,SET_SCROLL_LEFT:T})));const R=l().useMemo((()=>({dragging:x,scrollbarElement:m,wrapElement:p})),[x]),O=we("scrollbar"),k={[`${O}__wrap`]:!0,[`${O}__wrap--hidden`]:!s};return l().createElement("div",{ref:m,className:Ee()(O,e.className),style:e.style},l().createElement("div",{ref:p,className:Ee()(k,n),style:r,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(()=>{if(!p.current)return;const e=p.current.offsetHeight-4,t=p.current.offsetWidth-4,n=100*p.current.scrollTop/e*b.ratio,r=100*p.current.scrollLeft/t*f.ratio;y(Object.assign({},f,{offset:r})),v(Object.assign({},b,{offset:n}))})(),u?.({scrollTop:t,scrollLeft:n})}},l().createElement("div",{ref:h,className:`${O}__view`,style:a},e.children)),!s&&l().createElement(ht.Provider,{value:R},c&&l().createElement(Nt,{className:"top",direction:"horizontal",thumb:f,barSize:i,always:o,onDrag:N}),l().createElement(Nt,{direction:"horizontal",thumb:f,barSize:i,always:o,onDrag:N}),l().createElement(Nt,{direction:"vertical",thumb:b,barSize:i,always:o,onDrag:N})))}));Tt.displayName="QmScrollbar";const Rt=Tt,Ot=require("sortablejs");var kt=r.n(Ot);const Pt=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const n=window.URL.createObjectURL(e);let r=document.createElement("a");r.href=n,r.download=decodeURI(t),r.click(),r=null}};function Lt(){return Lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Lt.apply(null,arguments)}const At=async(e,{fileName:t,headers:n,params:r})=>{const a=r?new URLSearchParams(r).toString():"",i=a?e.includes("?")?"&":"?":"",l=await fetch(e+`${i+a}`,{method:"GET",headers:n});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));Pt(o,c)},Ft=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},_t=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Dt=e=>{const t=h({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:n=[],fileDirection:r="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),[w,C]=l().useState({}),S=l().useMemo((()=>s||c),[s,c]);l().useEffect((()=>(T(),()=>E.current?.destroy())),[]);const N=(e,t)=>{C((n=>Object.assign({},n,{[e]:t??!n[e]})))},I=Y((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),p?.(e),y?.({file:n[t],fileList:e})}})),T=()=>{i&&(E.current=kt().create(Ue(x.current,we("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:n,headers:r}=t;try{e.url&&await At(e.url,{fileName:e.name,...n?{headers:r}:null})}catch(e){O.message.error(b("qm.download.error"))}},k=we("upload-file"),P={[k]:!0,[`${k}--lg`]:"large"===v,[`${k}--sm`]:"small"===v,[`${k}--horizontal`]:"horizontal"===r};return l().createElement(O.Upload,Lt({className:Ee()(P,u)},se(t,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,n)=>new Promise((async(r,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,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(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,r,a,c)=>((e,r)=>{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:Ee()("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"},w[c]?l().createElement(O.Input,{size:"small",autoFocus:!0,defaultValue:Ft(d),onBlur:t=>{const{value:r}=t.target;if(r!==Ft(d)){const t=Object.assign({},e,{name:`${r}.${_t(d)}`}),a=n.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):r.preview()}},d)),l().createElement("span",{className:"ant-upload-list-item-card-actions"},o&&!S&&l().createElement("button",{type:"button",className:p,onClick:()=>N(c)},w[c]?l().createElement(Ce.CheckOutlined,null):l().createElement(Ce.EditOutlined,null)),o&&l().createElement("button",{type:"button",className:Ee()(p,"preview"),onClick:()=>r.preview()},l().createElement(Ce.EyeOutlined,null)),l().createElement("button",{type:"button",className:Ee()(p,"download"),disabled:s,onClick:()=>r.download()},l().createElement(Ce.DownloadOutlined,null)),l().createElement("button",{type:"button",className:Ee()(p,"delete"),disabled:S,onClick:()=>r.remove()},l().createElement(Ce.DeleteOutlined,null))))))})(r,c)}),l().createElement("span",{className:"inner",ref:x},t.children||c&&n.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&&!!n.length&&l().createElement(O.Button,{disabled:s,style:{marginLeft:8},onClick:async e=>{if(e.stopPropagation(),"function"==typeof a)await a(n);else for(const e of n)await R(e)}},b("qm.upload.batchDownload"))))};Dt.displayName="QmUploadFile";const Ht=Dt;function qt(){return qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qt.apply(null,arguments)}const $t=e=>{const t=h({icon:l().createElement(Ce.DownloadOutlined,null),withCredentials:!1},e),{$size:n}=X(t),{t:r}=G(),[a,i]=l().useState(!1),o=se(t,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return l().createElement(O.Button,qt({},o,{size:n,loading:a,onClick:async()=>{i(!0);try{const{action:e,fileName:n,headers:a,params:i,beforeDownload:l=ne,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 At(s,{fileName:n,headers:a,params:i}),await re(100),o?.(),O.message.success(r("qm.download.success"))}catch(e){t.onError?.(e),O.message.error(r("qm.download.error"))}i(!1)}}),t.children||r("qm.download.text"))};$t.displayName="QmDownload";const Mt=$t,Kt=require("add-dom-event-listener");var zt=r.n(Kt);const jt=require("scroll-into-view-if-needed");var Vt=r.n(jt);function Wt(e,t){const n=i.useRef(null),r=i.useRef(0);return i.useEffect((()=>()=>{clearTimeout(n.current),n.current=null}),[]),i.useCallback(((...n)=>{const a=Date.now();(!r.current||a-r.current>t)&&(e.apply(this,n),r.current=a)}),[e,t])}const Bt=e=>{const{activeKey:t,labels:n,onTabClick:r}=e;return l().createElement(l().Fragment,null,n.map(((e,n)=>{const a={item:!0,actived:n===t};return l().createElement("div",{key:n,className:Ee()(a),onClick:e=>r(n,e)},l().createElement("span",null,e))})))},Ut=e=>{const{label:t,showDivider:n,className:r,style:a}=e,i=we("anchor-item"),o={[i]:!0};return l().createElement("div",{className:Ee()(o,r),style:a},n&&l().createElement(Ne,{label:t,style:{marginBottom:10}}),e.children)};Ut.displayName="AnchorItem";const Gt=Ut,Yt=l().forwardRef(((e,t)=>{const{labelList:n=[],defaultActiveIndex:r,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(r||0),y=l().useMemo((()=>!!n?.length),[n]);l().useEffect((()=>{b();const e=zt()(u.current,"scroll",x);return()=>{e.remove()}}),[]);const b=()=>{f>0&&(u.current.scrollTop=We(v(f),u.current))},v=e=>y?document.getElementById(n[e].id):u.current.children[e],x=Wt((e=>{if("ready"!==p.current)return;const t=(e=>{const t=Math.abs(e),r=(y?n.map((e=>document.getElementById(e.id))):Array.from(u.current?.children||[])).map((e=>We(e,u.current)));let a=-1;for(let e=0;e<r.length;e++){const n=r[e],i=r[e+1]||1e4;t>=n-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 w=we("anchor"),C={[w]:!0,[`${w}-left`]:"left"===i,[`${w}-top`]:"top"===i,[`${w}--lg`]:"large"===d,[`${w}--sm`]:"small"===d},S=[];l().Children.map(e.children,(e=>{J(e)&&!ee(e)&&"AnchorItem"===e.type?.displayName&&S.push(e)}));const N=y?n.map((e=>e.label)):S.map((e=>e.props.label)),I=y?n.map((e=>e.id)):S.map(((e,t)=>e.props["data-id"]||t.toString()));return h.current=N.length,l().createElement("div",{className:Ee()(C,s),style:c},l().createElement("div",{className:Ee()("anchor-nav"),style:{width:a?de(a):""}},l().createElement(Bt,{activeKey:f,labels:N,onTabClick:(e,t)=>{E(e),o?.({label:N[e],id:I[e]},t)}})),l().createElement("div",{ref:u,className:Ee()("anchor-container")},y?e.children:S))}));Yt.displayName="QmAnchor",Yt.Item=Gt;const Xt=Yt,Qt=e=>l().createElement(O.Tabs.TabPane,e,e.children);Qt.displayName="TabPane";const Zt=Qt;function Jt(){return Jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jt.apply(null,arguments)}const en=e=>{const t=h({tabPosition:"top"},e),{items:n,tabPosition:r,tabBarGutter:a,className:i,authConfig:o}=t,{$size:s}=X(t),c=we("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u={...se(t,["items","authConfig"]),size:s,tabBarGutter:a??(["top","bottom"].includes(r)?30:0)},m=[];l().Children.map(t.children,(e=>{J(e)&&!ee(e)&&"TabPane"===e.type?.displayName&&m.push(e)}));const p=n?[...n]: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 n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:a=1,disabled:i}=r||{};a?i&&(n.disabled=!0):(p.splice(t,1),t--)}}return l().createElement(O.Tabs,Jt({},u,{items:p,className:Ee()(d,i)}))};en.displayName="QmTabs",en.TabPane=Zt;const tn=en;function nn(){return nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nn.apply(null,arguments)}const rn=l().forwardRef(((e,t)=>{const n=h({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:r,open:a,className:i,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:f,onFullChange:g}=n,{global:y}=l().useContext(o),{$size:b}=X(n),v=l().useRef(null),x=l().useRef(null),E=l().useRef(!1),[w,C]=l().useState(!1),[S,N]=l().useState(!1),[I,T]=l().useState(!1);qe((()=>{(a??r)&&(!m&&E.current||(0,Q.isUndefined)(s)&&N(!0))}),[a??r]),qe((()=>{x.current&&je(x.current,w?{width:"100%"}:{width:de(n.width||"72%")})}),[w]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=we("drawer"),k={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===b,[`${R}--sm`]:"small"===b};return l().createElement(O.Drawer,nn({},se(n,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??r,maskClosable:u??y?.maskClosable??!1,className:Ee()(k,i),title:l().createElement(l().Fragment,null,l().createElement("span",{ref:v,className:"text"},c&&n.title),d&&l().createElement("button",{type:"button",className:"full-screen",onClick:()=>{x.current=Ue(v.current,"ant-drawer-content-wrapper"),C(!w),g?.(!w)}},l().createElement(w?Ce.FullscreenExitOutlined:Ce.FullscreenOutlined))),footer:null,afterOpenChange:e=>{e?(E.current=!0,(0,Q.isUndefined)(s)&&setTimeout((()=>N(!1)),100)):(C(!1),f?.())},onClose:p}),n.children,(s||I||S)&&l().createElement(pt,{spinning:!0,className:Ee()("spinning")}))}));rn.displayName="QmDrawer";const an=rn,ln=require("react-draggable");var on=r.n(ln);function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sn.apply(null,arguments)}const cn="10vh";var dn=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(dn||{});const un=l().forwardRef(((e,t)=>{const n=h({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:cn}},e),{visible:r,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}=n,{global:E}=l().useContext(o),{$size:w}=X(n),C=l().createRef(),S=l().useRef(!1),N=l().useMemo((()=>`calc(100vh - ${cn} - ${cn} - ${dn[m?w:"none"]}px)`),[w,m]),[I,T]=l().useState(!1),[R,k]=l().useState(!1),[P,L]=l().useState(!1),[A,F]=l().useState(!0),[_,D]=l().useState({left:0,top:0,bottom:0,right:0}),[H,q]=l().useState();qe((()=>{if(a??r){if(!g&&S.current||(0,Q.isUndefined)(d)&&k(!0),!g&&S.current)return;setTimeout((()=>{S.current=!0,(0,Q.isUndefined)(d)&&k(!1)}),400)}}),[a??r]),qe((()=>{q(I?{x:0,y:0}:void 0)}),[I]);l().useImperativeHandle(t,(()=>({START_LOADING:()=>L(!0),STOP_LOADING:()=>L(!1)})));const $=we("modal"),M={height:s?de(s):N,maxHeight:"auto"===s?N:"",overflow:"auto"},K={[$]:!0,"no-header":!m,[`${$}--lg`]:"large"===w,[`${$}--sm`]:"small"===w};return l().createElement(O.Modal,sn({},se(n,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:a??r,maskClosable:f??E?.maskClosable??!1,className:Ee()(K,c),title:l().createElement("div",{onMouseOver:()=>{A&&F(!1)},onMouseOut:()=>{F(!0)}},l().createElement("span",{className:"text"},m&&n.title),p&&l().createElement("button",{type:"button",className:"full-screen",onClick:e=>{const t=Ue(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");I?(je(t,{width:de(i||"60%"),height:"auto",top:cn}),je(n,{height:s?de(s):N,maxHeight:"auto"===s?N:""})):(je(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),je(n,{height:`calc(100vh - ${dn[m?w:"none"]}px)`,maxHeight:""})),T(!I),b?.(!I)}},l().createElement(I?Ce.FullscreenExitOutlined:Ce.FullscreenOutlined))),footer:null,bodyStyle:Object.assign({},M,y),onCancel:v,afterClose:()=>{x?.(),T(!1)},modalRender:e=>l().createElement(on(),{nodeRef:C,bounds:_,position:H,disabled:!u||A||I,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,a=C.current.getBoundingClientRect();a&&D({left:-a.left+t.x,right:n-(a.right-t.x)-1,top:-a.top+t.y,bottom:r-(a.bottom-t.y)-1})})(0,t)},l().createElement("div",{ref:C},e))}),n.children,(d||P||R)&&l().createElement(pt,{spinning:!0,className:Ee()("spinning")}))}));un.displayName="QmModal";const mn=un,pn=require("memoize-one");var hn=r.n(pn);const fn=(0,i.createContext)(void 0),gn=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],yn={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)gn.includes(t[e])?(n[r]=n[r].join(" "),r++,n[r]=[]):n[r].push(t[e]);return n[r]=n[r].join(" "),n},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 n=0,r=(e=Array.isArray(e)?e:[e]).length;n<r;n++)t+="number"==typeof e[n]?e[n]:"'"+e[n]+"'",n<r-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,n){return e.split(t).join(n)},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 ")}},bn=["==","<",">","<=",">=","!=","like","likes","in","nin"],vn=function(e,t){let n="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?n+=" "+e[t]+" ":n+=e[t];const r=n.split(" ").filter((e=>""!==e));for(let e=0;e<r.length;e++)bn.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),bn.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return r.join(" ")},xn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,En=["string","number","boolean","symbol"],wn=e=>En.includes(typeof e),Cn=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Sn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(xn,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=e??"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Sn(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Sn(t))));break;case"in":wn(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":wn(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(Cn(e)?e.slice(0,10):e)!=n;break;case"<":r=(Cn(e)?e.slice(0,10):e)<n;break;case"<=":r=(Cn(e)?e.slice(0,10):e)<=n;break;case">":r=(Cn(e)?e.slice(0,10):e)>n;break;case">=":r=(Cn(e)?e.slice(0,10):e)>=n;break;default:r=(Cn(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const Nn=yn.stringify,In=yn.array_format,Tn=function(e){let t=0;const n=e.length;for(let r=0;r<n;r++){const n=e.charAt(r);"("===n&&t++,")"===n&&t--}return 0===t},Rn=(e,t,n)=>{let r=[];t=yn.replace_symbols(t);try{if(n){const n=new Function("record",`return ${vn(t,"record")};`);r=cr(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${vn(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)n(e,t)&&r.push(e[t])}}catch(t){pe("Table","组件 `initialFilter` 参数有误!"),r=e}return r},On=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...On(e.children)):t.push(e)})),t},kn=e=>e.filter((e=>(e.children&&(e.children=kn(e.children)),!e.hidden&&!e.noAuth))),Pn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Pn(e.children))})),t},Ln=(e,t)=>e.map((e=>(e.children&&(e.children=Ln(e.children,t)),t?.(e),e))),An=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=An(n.children,t);if(e)return e}}return null},Fn=e=>{const t=e.children;return t?t[0].children?Fn(t[0]):t[0]:e},_n=e=>{const t=e.children;return t?t[t.length-1].children?_n(t[t.length-1]):t[t.length-1]:e},Dn=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Hn=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Hn(n.children,t);if(e)return e}}return null},qn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...qn(e.children))})),t},$n=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...$n(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},Mn=e=>{let t=1;const n=(e,r)=>{if(r&&(e.level=r.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((r=>{e.fixed?r.fixed=e.fixed:delete r.fixed,n(r,e),t+=r.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return Pn(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Kn=e=>Object.assign(e,{__prevent__:!0}),zn=e=>{delete e.__prevent__},jn=(e,t,n={left:0,top:0})=>{if(e){const r=e.parentNode;if(n.top+=e.offsetTop,n.left+=e.offsetLeft,r&&r!==document.documentElement&&r!==document.body&&(n.top-=r.scrollTop,n.left-=r.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return jn(e.offsetParent,t,n)}return n},Vn=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Wn=(e,t)=>(0,Q.transform)(e,((e,n,r)=>{(0,Q.isEqual)(n,t[r])||(e[r]=(0,Q.isPlainObject)(n)&&(0,Q.isPlainObject)(t[r])?Wn(n,t[r]):n)})),Bn=(e,t)=>(0,Q.get)(e,t)??"",Un=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),(0,Q.set)(e,t,n??"")},Gn=(e,t)=>{if(!t.includes("|"))return Bn(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(Bn(e,t))})),n.every((e=>!e))?"":n.join(" | ")},Yn=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Xn=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],a="";for(;r.length>3;)a=`,${r.slice(-3)}${a}`,r=r.slice(0,r.length-3);return r&&(a=r+a),`${n}${a}${t[1]?`.${t[1]}`:""}`},Qn=(e,t)=>{const n=e.toString();if(!Yn(n)||0===t)return e;const r=Number.parseFloat(n).toString(),a=r.indexOf(".");if(-1===a)return r+"."+"0".repeat(t);const i=Math.max(0,t-(r.length-a-1));return r+"0".repeat(i)},Zn=(e,t)=>e?c()(e,t):null,Jn=(e,t)=>e?c()(e).format(t):"",er=(e="")=>{let t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},tr=e=>{const t=[];if(l().isValidElement(e)){const{children:n}=e.props;l().Children.forEach(n,(e=>{t.push(...tr(e))}))}else t.push(e);return t},nr=e=>tr(e).join(""),rr=e=>e.filter((e=>!e._group)),ar=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=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)?In(i.condition):Nn(i.condition,"^");n+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,r=i.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[a,i]=r.includes("|")?r.split("|"):[r,""],l=e[r];for(const e in l)n+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?In(l[e]):Nn(l[e],"^")} and `}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},ir=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(Bn(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},lr=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].dataIndex===t)return[e[n]];if(Array.isArray(e[n].children)){const r=lr(e[n].children,t);if(r)return[e[n],r].flat()}}},or=(e,t)=>{for(let n=0;n<e.length;n++){if(e[n].rowKey===t)return[t];if(Array.isArray(e[n].children)){const r=or(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},sr=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=sr(n.children,t);if(e)return e}if(t(n))return n}return null},cr=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&cr(e.children,t),t(e)||e.children&&e.children.length))),dr=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),ur=require("prop-types");var mr=r.n(ur);const pr=e=>["","small","middle","large"].includes(e),hr=80,fr="1",gr="0",yr=400,br=["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"],vr={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 xr=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}({}),Er=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}({}),wr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Cr={items:mr().arrayOf(mr().shape({type:mr().string.isRequired,fieldName:mr().string.isRequired})),initialValues:mr().object,initialExtras:mr().object,layout:mr().oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!pr(e[t]||""))return me("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:mr().number,className:mr().string,style:mr().object,compactMode:mr().bool,labelWidth:mr().oneOfType([mr().number,mr().string]),labelAlign:mr().oneOf(["left","right"]),labelWrap:mr().bool,formType:mr().oneOf(["default","search","onlyShow"]),disabled:mr().bool,uniqueKey:mr().string,defaultRows:mr().number,defaultExpand:mr().bool,searchButtonCols:mr().number,scrollToFirstError:mr().bool,authConfig:mr().object,isAutoFocus:mr().bool,isCollapse:mr().bool,isFieldsDefine:mr().bool,isSearchBtn:mr().bool,isSubmitBtn:mr().bool,fieldsChange:mr().func,onValuesChange:mr().func,onFieldsChange:mr().func,onFinish:mr().func,onFinishFailed:mr().func,onReset:mr().func,onCollapse:mr().func},Sr={layout:"horizontal",labelWidth:hr,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},Nr=(e,t)=>{if(!e)return null;if(t===Er.week){const t=e.match(/^(\d{4})-(\d+)/);return t?c()().year(Number(t[1])).week(Number(t[2])):null}if(t===Er.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)},Ir=(e,t)=>e?c()(e).format(t):"",Tr=e=>""===e||null==e,Rr=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const n=t.split("|");let r="";for(let t=0,a=n.length;t<a;t++)r+=(e[n[t].trim()]??"")+(t===a-1?"":" | ");return r},Or=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},kr=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const a=t[r].split("|"),i=n[r].split("|");a.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},Pr=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),(0,Q.isUndefined)(e.isLeaf)||(r.isLeaf=!!e.isLeaf),(0,Q.isUndefined)(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=Pr(e.children,t,n)),r})),Lr=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=Lr(n.children,t);if(e)return e}}return null},Ar=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...Ar(e.children,t,n+1))})),r},Fr=e=>J(e)||"string"==typeof e,_r=e=>J(e)?tr(e).join(""):e??"",Dr=(e,t,n,r)=>{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={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:n(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={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:n(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:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Hr={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"}},qr="阿",$r="鿿",Mr=1,Kr=2,zr=3;let jr,Vr=null;function Wr(e){return e||null===Vr?("object"==typeof Intl&&Intl.Collator?(jr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Vr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Vr=!1,Vr):Vr}function Br(e){const t=Hr.UNIHANS,n=Hr.PINYINS,r=Hr.EXCEPTIONS,a={source:e};if(e in r)return a.type=Kr,a.target=r[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=Mr,a.target=e,a;if(i=jr.compare(e,qr),i<0)return a.type=zr,a.target=e,a;if(0===i)a.type=Kr,l=0;else{if(i=jr.compare(e,$r),i>0)return a.type=zr,a.target=e,a;0===i&&(a.type=Kr,l=t.length-1)}if(a.type=Kr,l<0){let n=0,r=t.length-1;for(;n<=r;){l=~~((n+r)/2);const a=t[l];if(i=jr.compare(e,a),0===i)break;i>0?n=l+1:r=l-1}}return i<0&&l--,a.target=n[l],a.target||(a.type=zr,a.target=a.source),a}function Ur(e){return"string"==typeof e&&Wr()?e.split("").map((e=>Br(e))):e}const Gr={isSupported:Wr,parse:Ur,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Hr)})))},genToken:Br,convertToPinyin:(e,t,n)=>Ur(e).map((e=>t&&e.type===Kr?e.target.toLowerCase():e.target)).join(n||"")},Yr={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}};Gr.isSupported()&&Yr.shouldPatch(Gr.genToken)&&Gr.patchDict(Yr);const Xr=Gr,Qr=e=>{const{value:t,bordered:n}=e;return l().createElement(O.Input,{value:t,title:t,bordered:n,readOnly:!0})};Qr.displayName="FormItemView";const Zr=Qr;function Jr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ea(){return ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ea.apply(null,arguments)}const{Option:ta}=O.Select,na=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,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=yr,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,I=le(v)?r:v,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(Zr,{value:R(n),bordered:h}):l().createElement(O.Select,ea({value:n,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:w?"responsive":void 0,maxTagTextLength:C},a?{title:R(n)}:null,{filterOption:(e,t)=>{const n=t?.children?.toString()||"",r=Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,R(e),I)})(e)},onClear:b}),I.map((e=>l().createElement(ta,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ra extends i.Component{constructor(...e){super(...e),Jr(this,"context",void 0),Jr(this,"state",{itemList:[],loading:!1}),Jr(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,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:Ee()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(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(na,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),p&&l().createElement(O.Col,null,e.renderFormItemButton(o,p)),m&&l().createElement(O.Col,{flex:de(m.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...m}))))}}Jr(ra,"contextType",fn);const aa=ra;function ia(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const la=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=gr,trueValue:p=fr}=o,{t:h}=G();return l().createElement(O.Checkbox,{checked:n===p,style:s,disabled:d||t.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{r?.(e),a(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(t?p:m)}},u?i:null)};class oa extends i.Component{constructor(...e){super(...e),ia(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(la,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ia(oa,"contextType",fn);const sa=oa,ca=require("react-sortablejs"),da=e=>{const{uniqueKey:t,items:n,fieldsChange:r}=e,{global:a}=l().useContext(o),{$$form:i}=l().useContext(fn),{$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}})),n=JSON.parse(localStorage.getItem(p));(0,Q.isEqual)(t,n)||(localStorage.setItem(p,JSON.stringify(t)),(async(e,t)=>{const n=a?.saveComponentConfigApi;if(n)try{await n({[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 n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(p).then((e=>{e?(localStorage.setItem(p,JSON.stringify(e)),f()):a?.getComponentConfigApi&&h(n)})).catch((()=>{})),e?(0,Q.xor)(e.map((e=>e.fieldName)),n.map((e=>e.fieldName))).length>0?n.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?((0,Q.isUndefined)(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>({...n.find((t=>t.fieldName===e.fieldName)),...e}))):void 0})();e&&g(e)},g=e=>{r?.([...e])},y=we("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:Ee()("ant-dropdown-menu","fields-list")},l().createElement("div",{className:"reset"},l().createElement(ge,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=n.find((t=>t.fieldName===e.fieldName))||ce(e);return Object.assign(t,{hidden:e.hidden})}));g(t),h(t)})(i.getOriginItems())},c("qm.table.columnFilter.reset"))),l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));if((0,Q.isEqual)(t,r))return;i.setExpandHandle(!0);const a=dr(e);g(a),h(a)}},n.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:r}=t.target;e.hidden=!r,g(n),h(n)}}),l().createElement(Ce.HolderOutlined,{className:"handle",title:c("qm.form.draggable")}),l().createElement("span",{className:"title"},i.getFormItemLabel(e.label))))))),overlayClassName:Ee()(b),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>d.current,onOpenChange:e=>{m(e)}},l().createElement("a",{ref:d,style:{padding:"5px 0"}},l().createElement(Ce.UnorderedListOutlined,null)))};da.displayName="FieldsFilter";const ua=da;function ma(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(fn),{value:r,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:w,pattern:C,toUpper:S,toTrim:N,autoFocus:I,autoComplete:T,secretType:R}=s,k=R&&(p||h),P=l().useRef();l().useEffect((()=>{const e=()=>b?.(),t=P.current?.input.parentNode.querySelector("span[class*='clear-icon']");return m&&t&&t.addEventListener("click",e),()=>{t?.removeEventListener("click",e)}}),[]);const L=e=>{a?.(e),i(e)},A=E?O.Input.Password:O.Input,F=k?((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))(r,R):r;return n.isOnlyShow?l().createElement(Zr,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(F),bordered:u}):l().createElement(A,{ref:e=>{P.current=e,"function"==typeof t&&t(e)},value:F,autoComplete:E?"new-password":T,autoFocus:I,placeholder:d,style:c,title:E?"":F,prefix:v,suffix:x,maxLength:w,bordered:u,allowClear:m,readOnly:p,disabled:h,onFocus:e=>{f?.(e.target.value,e)},onBlur:t=>{let n=t.target.value??"";if(N){const e=n.trim();n!==e&&(n=e,L(n))}(t=>{const{onBlur:n}=e;n?.(t)})(n),g?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;y?.(t,e),n.isFilterType&&(n.SUBMIT_FORM(),P.current?.blur())}},onChange:e=>{let t=e.target.value;(0,Q.isRegExp)(C)&&(t=C.test(t)?t:r??""),S&&(t=t.toUpperCase()),L(t)}})}));pa.displayName="VInput";class ha extends i.Component{constructor(...e){super(...e),ma(this,"context",void 0),ma(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(pa,{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:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ma(ha,"contextType",fn);const fa=ha;function ga(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ya=e=>{const{$$form:t}=l().useContext(fn),{value:n=[],onChange:r,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;r?.(t),a(t,y(t))},y=e=>e.join(" - ");return t.isOnlyShow?l().createElement(Zr,{value:y(n),bordered:c}):l().createElement(O.Input.Group,null,l().createElement(O.Input,{value:n[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,n[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:n[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([n[0],t])}}))};class ba extends i.Component{constructor(...e){super(...e),ga(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(ya,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(O.Col,{flex:de(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...c}))))}}ga(ba,"contextType",fn);const va=ba,xa=require("big.js");var Ea=r.n(xa);function wa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ca=l().forwardRef(((e,t)=>{const{$$form:n}=l().useContext(fn),{value:r,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:w,textAlign:C="left",controls:S=!0,formatter:N,parser:I}=s,T=l().useRef(),R=l().useRef(r),k=e=>{const t=Tr(e)?"":(0,Q.isNumber)(e)?e.toFixed(x):new(Ea())(e).toFixed(x);return"function"==typeof N?N(t):t},P={[C]:!0,controls:S};return n.isOnlyShow?l().createElement(Zr,{value:k(r),bordered:u}):l().createElement(O.InputNumber,{ref:e=>{T.current=e,"function"==typeof t&&t(e)},value:r,className:Ee()(P),placeholder:d,style:{width:"100%",...c},step:y,min:b,max:v,controls:S,precision:x,autoFocus:E,stringMode:w,formatter:N,parser:I,bordered:u,readOnly:m,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{ae((()=>{(t=>{const{onBlur:n}=e;n?.(t)})(R.current),f?.(R.current,t)}))},onKeyUp:e=>{13===e.keyCode&&(g?.(r,e),n.isFilterType&&(n.SUBMIT_FORM(),T.current?.blur()))},onChange:e=>{const t=e??"";!w&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,a?.(e),i(e,k(e))})(t)}})}));Ca.displayName="VInputNumber";class Sa extends i.Component{constructor(...e){super(...e),wa(this,"context",void 0),wa(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ca,{ref:e=>this[t]=e,option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&l().createElement(O.Col,null,e.renderFormItemButton(a,u)),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}wa(Sa,"contextType",fn);const Na=Sa;function Ia(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ta=e=>{const{$$form:t}=l().useContext(fn),{value:n=[],onChange:r,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]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];r?.(t),a(t,C(t))},C=e=>Tr(e)?"":e.map((e=>Tr(e)?"":Number(e).toFixed(b))),S={[g]:!0,controls:y};return t.isOnlyShow?l().createElement(Zr,{value:C(n),bordered:c}):l().createElement(O.Input.Group,null,l().createElement(O.InputNumber,{value:n[0],className:Ee()("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=>{w([e,n[1]])},onBlur:()=>{E(n)}}),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:n[1],className:Ee()("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=>{w([n[0],e])},onBlur:()=>{E(n)}}))};class Ra extends i.Component{constructor(...e){super(...e),Ia(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(s),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ta,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(a,n)}}))),c&&l().createElement(O.Col,{flex:de(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...c}))))}}Ia(Ra,"contextType",fn);const Oa=Ra;let ka=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function Pa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:La}=O.Input;class Aa 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",hn()((e=>Object.assign({},this.props.helperConfig,e)))),Pa(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=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:n,echoRequest:r}=this.searchHelper;if(t||pe("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||pe("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&pe("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Pa(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Pa(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Pa(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=(e=>e),dataKey:r,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)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&kr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Rr(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:n}=this.searchHelper,r=""!==e?e:void 0,a=("function"==typeof n?n():n)||[],i={[t]:r};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](r):r;else i[e]=r})),i})),Pa(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=ne,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!r(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:n}=this.props.option;for(const r in this.alias){const a=Rr(e,this.alias[r]);void 0!==a&&(t.SET_FIELDS_VALUE({[r]:a}),r===n&&t.setViewValue(n,a))}for(const n in this.extras){const r=Rr(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}})),Pa(this,"resetSearchHelperValue",(async(e=[],t)=>{const{fieldName:n}=this.props.option,r=e.filter((e=>Rr(e,this.alias[n])?.toString().toLowerCase().includes(t.toLowerCase())));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),Pa(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,a=(r??ne)(n.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:n}=this.props.option;this._record=e;for(const r in this.alias)r!==n&&t.SET_FIELDS_VALUE({[r]:Rr(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])});const r=Rr(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);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 n in this.alias)n!==t&&e.SET_FIELDS_VALUE({[n]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this._prevValue=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:n}=this.props;t?.(e),n(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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r}=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:`${ka[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(Zr,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(La,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,placeholder:d,style:c,prefix:g,suffix:y,maxLength:b,bordered:u,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:n}=e.target,{onlySelect:r=!0,table:a}=this.searchHelper;this.triggerBlur(n),this._is_change&&!t&&(n?r?a?.fetch?.api&&this.getSearchHelperTableData(n).then((e=>this.resetSearchHelperValue(e,n))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(n):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:n}=e.target;!t&&this.openSearchHelper(n)}},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(mn,v,l().createElement(fd,x)))}}Pa(Aa,"contextType",fn);class Fa 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){me("Form","搜索帮助获取定义信息的接口出错")}})),Pa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Aa,{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:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Pa(Fa,"contextType",fn);const _a=Fa;function Da(){return Da=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Da.apply(null,arguments)}function Ha(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const qa=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 n=e.target,r=t?.target,a=!n||!r,i=this.$el?.contains(n)||this.$el?.contains(r),l=this.$el===n,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(n)))||o.includes(r);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=zt()(document,"mousedown",this.mousedownHandler),this.event2=zt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:t}=this.props,{clickOutside:n}=this.state;return l().createElement(e,Da({ref:t},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Ha(t,"displayName",`OutsideClick(${e.displayName||e.name})`),l().forwardRef(((e,n)=>l().createElement(t,Da({},e,{forwardedRef:n}))))},$a=require("rc-trigger");var Ma,Ka,za=r.n($a);function ja(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Va=qa((Ka=class extends i.Component{constructor(e){super(e),ja(this,"context",void 0),ja(this,"searchRef",l().createRef()),ja(this,"_records",[]),ja(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),ja(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),ja(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`")})),ja(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ja(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ja(this,"setItemList",(e=>{this.setState({itemList:e})})),ja(this,"setRecords",(e=>{this._records=e})),ja(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),ja(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),ja(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ja(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ja(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(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:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,Q.isEqual)(n,r)||(0,Q.isEqual)(r,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:n,params:r={},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(n){if(le(c))return this.setRecords([]);this.setState({loading:!0});try{const o=await n(a({...r,keys:c}));if(200===o.code){let n=Array.isArray(o.data)?o.data:(0,Q.get)(o.data,i)??[];n.forEach((n=>{s?.valueKey&&s.valueKey!==t&&(n[t]=n[s.valueKey]),s?.textKey&&s.textKey!==e&&(n[e]=n[s.textKey])})),n=n.filter((e=>c.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setViewValue(c),l?.(n)}}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:n,loading:r,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:`${ka[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))),w=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"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=we("form-multiple-search-helper"),{size:N}=e.context,I={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const T=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Zr,{value:T,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(za(),{popupVisible:!g&&n,popup:w,popupClassName:Ee()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,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:r,bordered:m,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(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(mn,v,l().createElement(fd,x)))}},ja(Ka,"contextType",fn),Ma=Ka))||Ma;class Wa extends i.Component{constructor(e,{$$form:t}){super(e),ja(this,"context",void 0),ja(this,"promiseRef",void 0),ja(this,"state",{searchHelper:{}}),ja(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),ja(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Va,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ja(Wa,"contextType",fn);const Ba=Wa;function Ua(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Search:Ga}=O.Input;class Ya extends i.Component{constructor(e){super(e),Ua(this,"context",void 0),Ua(this,"valueKey",void 0),Ua(this,"_record",void 0),Ua(this,"_prevValue",null),Ua(this,"state",{visible:!1,loading:!1}),Ua(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),Ua(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Ua(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ua(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||pe("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),n){const e=["valueKey","displayKey","extraKey"];for(const t in n)e.includes(t)&&(this[t]=n[t])}Object.keys(this.alias).includes(e)||pe("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&pe("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),Ua(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Ua(this,"getDerivedSearchHelper",(()=>this.searchHelper)),Ua(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=(e=>e),dataKey:r,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)){this.setState({loading:!0});try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&kr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})}})),Ua(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const a=Rr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])})})),Ua(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),Ua(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias)r!==n&&t.SET_FIELDS_VALUE({[r]:Rr(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])});const r=Rr(e,this.alias[n]);this.triggerChange(r);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),Ua(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const n in this.alias)n!==t&&e.SET_FIELDS_VALUE({[n]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this._prevValue=null,this.triggerChange("")})),Ua(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),Ua(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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){const{$$form:e}=this.context,{visible:t,loading:n}=this.state,{value:r=""}=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:`${ka[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(Zr,{value:r,bordered:u}):l().createElement(l().Fragment,null,l().createElement(Ga,{ref:e=>this[`${a}_Ref`]=e,value:r,title:r,loading:n,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(mn,v,l().createElement(Ed,x)))}}Ua(Ya,"contextType",fn);class Xa extends i.Component{constructor(e,{$$form:t}){super(e),Ua(this,"context",void 0),Ua(this,"promiseRef",void 0),Ua(this,"state",{searchHelper:{}}),Ua(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),Ua(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Ya,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Ua(Xa,"contextType",fn);const Qa=Xa;var Za,Ja;function ei(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ti=qa((Ja=class extends i.Component{constructor(e){super(e),ei(this,"context",void 0),ei(this,"searchRef",l().createRef()),ei(this,"_records",[]),ei(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),ei(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),ei(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`")})),ei(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ei(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ei(this,"setItemList",(e=>{this.setState({itemList:e})})),ei(this,"setRecords",(e=>{this._records=e})),ei(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),ei(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))})),ei(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ei(this,"closeSearchHelper",((e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords((0,Q.uniqBy)([...this._records.filter((e=>t.includes(e[n]))),...e],n));const r=this.recordsToDict();this.setItemList(r),this.triggerChange(r.map((e=>e.value)));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ei(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),t?.(e),n(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:n=[]}=e,{value:r=[],clickOutside:a}=this.props;(0,Q.isEqual)(n,r)||(0,Q.isEqual)(r,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:n,params:r={},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(n){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t])));const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),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:n,loading:r,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:`${ka[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))),w=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"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,S=we("form-multiple-tree-table-helper"),{size:N}=e.context,I={[S]:!0,[`${S}--lg`]:"large"===N,[`${S}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${S}`]);const T=a.filter((e=>i?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?l().createElement(Zr,{value:T,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(za(),{popupVisible:!g&&n,popup:w,popupClassName:Ee()(I),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,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:r,bordered:m,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(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(mn,v,l().createElement(Ed,x)))}},ei(Ja,"contextType",fn),Za=Ja))||Za;class ni extends i.Component{constructor(e,{$$form:t}){super(e),ei(this,"context",void 0),ei(this,"promiseRef",void 0),ei(this,"state",{searchHelper:{}}),ei(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),ei(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(ti,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(i,n)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ei(ni,"contextType",fn);const ri=ni;function ai(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ii=new Array(2).fill("");class li extends i.Component{constructor(e){super(e),ai(this,"context",void 0),ai(this,"_is_change",!1),ai(this,"_ceho_data",void 0),ai(this,"_records",[]),ai(this,"_is_clear",!1),ai(this,"state",{visible:!1,loading:!1,itemList:[],textValue:ii}),ai(this,"getSearchHelper",hn()((e=>Object.assign({},this.props.helperConfig,e)))),ai(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`")})),ai(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),ai(this,"setItemList",(e=>{this.setState({itemList:e})})),ai(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),ai(this,"setTextValue",(e=>{this.setState({textValue:e})})),ai(this,"setRecords",(e=>{this._records=e})),ai(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),ai(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,t?.(e),n(e,this.createViewText(),this._records)})),ai(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(ii),this.triggerChange([])})),ai(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:n}=this.alias,r=e.map((e=>({value:e[t],text:e[n]})));this.setRecords(e),this.setItemList(r),this.setTextValue(r.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),ai(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(n??ne)(t.state.formData);r?.then?r.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),e?.())})),ai(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,n=le(e)?void 0:e;return{[t]:n}})),ai(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=ne,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,Q.merge)({},this.searchHelper.table.fetch.params,{...n,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!r(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()}))})),ai(this,"resetSearchHelperValue",(async(e=[])=>{const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{const r=e[n]?.toString().toLowerCase();return t.some((e=>r?.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),ai(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:n=[]}=this.props;(0,Q.isEqual)(t,n)||(0,Q.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:a}=this.props.option;if(!(0,Q.isEqual)(r[a],this._ceho_data)&&(this._ceho_data=r[a],this.setItemList(r[a]),n.length)){const e=ii.map(((e,t)=>r[a].find((e=>e.value===n[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:n,params:r={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(n){if(le(s))return this.setRecords([]);this.setState({loading:!0});try{const l=await n(a({...r,keys:s}));if(200===l.code){let n=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,i)??[];n.forEach((n=>{o?.valueKey&&o.valueKey!==t&&(n[t]=n[o.valueKey]),o?.textKey&&o.textKey!==e&&(n[e]=n[o.textKey])})),n=n.filter((e=>s.includes(e[t]))).slice(0,2);const r=n.map((n=>({value:n[t],text:n[e]})));this.setRecords(n),this.setItemList(r),this.setTextValue(r.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:n,loading:r,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=>Tr(e)))?"":a.join(" - "),g={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${i}`,loading:!1,bodyStyle:{paddingBottom:`${ka[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(Zr,{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&&!n&&(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:r,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(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(mn,g,l().createElement(Rd,y)))}}ai(li,"contextType",fn);class oi extends i.Component{constructor(e,{$$form:t}){super(e),ai(this,"context",void 0),ai(this,"promiseRef",void 0),ai(this,"state",{searchHelper:{}}),ai(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),ai(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(c),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(li,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t,n,r)=>{h(t,r),e.setViewValue(i,n)}}))),u&&l().createElement(O.Col,null,e.renderFormItemButton(i,u)),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...d}))))}}ai(oi,"contextType",fn);const si=oi;function ci(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const di=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,onChange:a,onValuesChange:i}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=le(m)?r:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return t.isOnlyShow?l().createElement(Zr,{value:h(n),bordered:c}):l().createElement(O.Checkbox.Group,{value:n,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 ui extends i.Component{constructor(...e){super(...e),ci(this,"context",void 0),ci(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(di,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ci(ui,"contextType",fn);const mi=ui;function pi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const hi=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:n,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||t.isOnlyShow,onChange:e=>{(e=>{var t;r?.(e),a(e,(t=e,p?p[Math.ceil(t)-1]:t.toString()))})(e)}})};class fi extends i.Component{constructor(...e){super(...e),pi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(hi,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}pi(fi,"contextType",fn);const gi=fi;function yi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const bi=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,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)?r:m,h=e=>p.find((t=>t.value===e))?.text??"";return t.isOnlyShow?l().createElement(Zr,{value:h(n),bordered:c}):l().createElement(O.Radio.Group,{value:n,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 vi extends i.Component{constructor(...e){super(...e),yi(this,"context",void 0),yi(this,"state",{itemList:[]}),yi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(bi,{option:this.props.option,items:t,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}yi(vi,"contextType",fn);const xi=vi;function Ei(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wi=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,onValuesChange:a}=e,{label:i,options:o={},style:s={},readOnly:c,disabled:d=t.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=gr,trueValue:p=fr}=o,{t:h}=G();return l().createElement(l().Fragment,null,l().createElement(O.Switch,{checked:n===p,style:s,disabled:d||t.isOnlyShow,checkedChildren:l().createElement(Ce.CheckOutlined,null),unCheckedChildren:l().createElement(Ce.CloseOutlined,null),onChange:e=>{(e=>{r?.(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 Ci extends i.Component{constructor(...e){super(...e),Ei(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(wi,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ei(Ci,"contextType",fn);const Si=Ci;function Ni(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ii=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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,onFocus:h,onBlur:f,onEnter:g}=e.option,{showCount:y,maxLength:b,autoSize:v}=o,x=Object.assign({},{minRows:1,maxRows:3},v);return l().createElement(O.Input.TextArea,{value:n,placeholder:c,style:s,maxLength:b,showCount:y,autoSize:x,bordered:d,allowClear:u,readOnly:m||t.isOnlyShow,disabled:p,onFocus:e=>{h?.(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;n?.(t)})(n),f?.(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g?.(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{r?.(e),a(e)})(t)}})};class Ti extends i.Component{constructor(...e){super(...e),Ni(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ii,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ni(Ti,"contextType",fn);const Ri=Ti;function Oi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ki=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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,w=l().createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),r?.(e),a(e,S(e))},S=e=>Tr(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Ir(c()().subtract(e,"day"),Er[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return t.isOnlyShow?l().createElement(Zr,{value:S(n),bordered:m}):l().createElement(_,{ref:w,style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:xr[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,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"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:Nr(n,Er[g]),onChange:(e,t)=>{C(Ir(e,Er[g]))}})};class Pi extends i.Component{constructor(...e){super(...e),Oi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(ki,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Oi(Pi,"contextType",fn);const Li=Pi;function Ai(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fi=e=>[c()().subtract(e,"day"),c()()],_i=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:w,shortCuts:C=!0}=s,S={[i("qm.form.dateRangePickers")[0]]:Fi(7),[i("qm.form.dateRangePickers")[1]]:Fi(30),[i("qm.form.dateRangePickers")[2]]:Fi(90),[i("qm.form.dateRangePickers")[3]]:Fi(180)},N=e=>Tr(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return t.isOnlyShow?l().createElement(Zr,{value:N(n),bordered:m}):l().createElement(_.RangePicker,{style:{width:"100%",...d},popupClassName:`form-popper__${o}`,picker:xr[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,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w])),ranges:C&&g.includes("date")?S:void 0,value:le(n)?null:[Nr(n?.[0],Er[g]),Nr(n?.[1],Er[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=[]),r?.(e),a(e,N(e))})([Ir(e?.[0],Er[g]),Ir(e?.[1],Er[g])])}})};class Di extends i.Component{constructor(...e){super(...e),Ai(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(_i,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ai(Di,"contextType",fn);const Hi=Di;function qi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $i=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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(Zr,{value:n,bordered:u}):l().createElement($,{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:wr[f],value:Nr(n,wr[f]),onChange:(e,t)=>{(e=>{const t=Ir(e,wr[f]);r?.(t),a(t)})(e)}})};class Mi extends i.Component{constructor(...e){super(...e),qi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement($i,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}qi(Mi,"contextType",fn);const Ki=Mi;function zi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ji=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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=>Tr(e)?"":e.join(" - ");return t.isOnlyShow?l().createElement(Zr,{value:E(n),bordered:u}):l().createElement($.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:wr[f],value:le(n)?null:[Nr(n?.[0],wr[f]),Nr(n?.[1],wr[f])],onChange:(e,t)=>{(e=>{const t=[Ir(e?.[0],wr[f]),Ir(e?.[1],wr[f])];r?.(t),a(t,E(t))})(e)}})};class Vi extends i.Component{constructor(...e){super(...e),zi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(ji,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}zi(Vi,"contextType",fn);const Wi=Vi;function Bi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ui extends i.Component{constructor(e){super(e),Bi(this,"context",void 0),Bi(this,"searchRef",l().createRef()),Bi(this,"valueKey",void 0),Bi(this,"_clicking",!1),Bi(this,"_record",void 0),Bi(this,"_prevValue",null),Bi(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Bi(this,"getSearchHelper",hn()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),Bi(this,"paramsChangeHandler",(async(e,t)=>{await this.props.waiting(),(0,Q.isEqual)(e,t)||this.getItemList()})),Bi(this,"echoSearchHelper",(async()=>{await this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),Bi(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(r||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&&!n&&pe("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),Bi(this,"getItemValue",(()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey])),Bi(this,"getItemText",(async()=>{const{fetchApi:e,params:t={},formatter:n=(e=>e),dataKey:r,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))try{const l=await e(n({...t,key:d}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,Q.get)(l.data,r)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&kr(t,this.extras,c),this._record=t,this.setFieldsValue(t),i){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}a?.([t])}}}catch(e){}})),Bi(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const a=Rr(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:a}),r===n&&t.setViewValue(n,a)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Rr(e,this.extras[n])})})),Bi(this,"fetchHandle",(0,Q.debounce)(this.getItemList,200)),Bi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Bi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this._record)})),Bi(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Bi(this,"clickHandle",((e,t)=>{const{$$form:n}=this.context,{fieldName:r}=this.props.option;for(const t in this.alias)t!==r&&n.SET_FIELDS_VALUE({[t]:Rr(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:Rr(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Rr(e,this.alias[r]);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||{}}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,n=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;this.paramsChangeHandler(n,t),this.echoSearchHelper()}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:n,params:r={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(n){this.setState({loading:!0});try{const l=await n(a({...r,[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:n,itemList:r,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=yr}=c,{hideHeader:b,onlySelect:v=!0}=this.searchHelper||c,x=this.searchHelper.columns||[],E=we("form-immediate"),w=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=l().createElement(O.Spin,{spinning:n},r.length?l().createElement("table",{cellSpacing:0,cellPadding:0,className:Ee()("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,r.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(ut,null));return l().createElement(o.Consumer,null,(n=>{const o={[E]:!0,[`${E}--lg`]:"large"===n?.size,[`${E}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(Zr,{value:i,bordered:m}):l().createElement(za(),{action:g?[]:["click"],popupVisible:!g&&t,popup:C,popupClassName:Ee()(o,`form-popper__${s}`),popupStyle:{minWidth:w,maxHeight:y},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,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:()=>{!r.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(r[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 n=40===e.keyCode?++t%r.length:(--t+r.length)%r.length;this.setState({activeIndex:n})}},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)}})))}))}}Bi(Ui,"contextType",fn);class Gi extends i.Component{constructor(e,{$$form:t}){super(e),Bi(this,"context",void 0),Bi(this,"promiseRef",void 0),Bi(this,"state",{searchHelper:{}}),Bi(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){me("Form","搜索帮助获取定义信息的接口出错")}})),Bi(this,"getHelperConfig",(e=>{const{global:t}=e,{name:n,fieldsDefine:r}=this.props.option.searchHelper||{};if(!n)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:n});if(200===l.code){const n=Dr(Object.assign({},l.data,r),a,t.searchHelper.createFetchApi);this.setState({searchHelper:n},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:t}=this.state,{type:n,label:r,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(r),className:Ee()(d),tooltip:a,hidden:o,labelCol:{flex:e.verticalLayout?"initial":de(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(r)}},l().createElement(Ui,{option:this.props.option,helperConfig:t,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(i,t)}}))),m&&l().createElement(O.Col,null,e.renderFormItemButton(i,m)),u&&l().createElement(O.Col,{flex:de(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Bi(Gi,"contextType",fn);const Yi=Gi;function Xi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Qi extends i.Component{constructor(...e){super(...e),Xi(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,fieldName:r,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===r))??[],n=c??t.length-1;t.slice(n+1).forEach((t=>{const n=d.find((e=>e.fieldName===t.fieldName));if(!n)return;const r=n.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&m.push({...t,text:`${r}${a}`})}))}return l().createElement(O.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},l().createElement(Ne,{id:r,label:n,className:a,extra:m.map((e=>e.text)).join(" | "),style:{...i},collapse:s[r],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[r]:t})}))),u(t)}}))}}Xi(Qi,"contextType",fn);const Zi=Qi;function Ji(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},el.apply(null,arguments)}const tl=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:tl(e.children,t,n,r)}:e)),nl=e=>{const{$$form:t}=l().useContext(fn),{value:n,items:r,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=yr,checkStrictly:w,checkStrategy:C="SHOW_CHILD",collapseTags:S,defaultExpandAll:N=!g,defaultExpandedKeys:I,dropdownStyle:T,openPyt:R=!0}=u,[k,P]=l().useState(le(v)?r:v),L=l().useRef(k);qe((()=>{const e=le(v)?r:v;g?(0,Q.isEqual)(e,L.current)||(P(e),L.current=e):P(e)}),[v,r]);const A=e=>Lr(k,e)?.text||e?.toString()||"",F=e=>a?e?.map((e=>A(e))).join(",")||"":A(e);return t.isOnlyShow?l().createElement(Zr,{value:F(n),bordered:h}):l().createElement(O.TreeSelect,el({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:a,treeCheckable:a,treeCheckStrictly:w,showCheckedStrategy:O.TreeSelect[C],popupClassName:`form-popper__${d}`,dropdownStyle:T,placeholder:p,listHeight:E,style:m,loading:i,bordered:h,allowClear:f,disabled:b,treeDefaultExpandAll:N,treeDefaultExpandedKeys:I,showSearch:x,maxTagCount:S?"responsive":void 0,loadData:g?async({key:e,children:t})=>{if(!g||t)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=g;if(n)try{const t=await n(s({...r,[l]:e}));if(200===t.code){const n=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[],r=tl(k,e,l,Pr(n,l,i));P(r),o?.(n)}}catch(e){}}:void 0,treeData:k},a?{title:F(n)}:null,{filterTreeNode:(e,t)=>{const n=t?.text?.toString()||"",r=Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,F(e),k)})(e)}}))};class rl extends i.Component{constructor(...e){super(...e),Ji(this,"context",void 0),Ji(this,"state",{itemList:[],loading:!1}),Ji(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=Pr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:t,loading:n}=this.state,{type:r,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:Ee()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(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(nl,{option:this.props.option,items:t,loading:n,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(O.Col,{flex:de(m.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...m}))))}}Ji(rl,"contextType",fn);const al=rl;function il(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ll(){return ll=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ll.apply(null,arguments)}const ol=e=>{const{$$form:t}=l().useContext(fn),{value:n,multiple:r,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:w=!0}=s,[C,S]=l().useState(le(g)?a:g),N=l().useRef(C);qe((()=>{const e=le(g)?a:g;p?(0,Q.isEqual)(e,N.current)||(S(e),N.current=e):S(e)}),[g,a]);const I=e=>Ar(C,e??"").map((e=>e.text)).join("/"),T=e=>r?e?.map((e=>I(e))).join(",")||"":I(e);return t.isOnlyShow?l().createElement(Zr,{value:T(n),bordered:u}):l().createElement(O.Cascader,ll({value:(e=>le(e)?[]:r?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:C,multiple:r,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 n=t?.text?.toString()||"",r=Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${n}|${r}`:n).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?async e=>{const t=e[e.length-1];if(!p||t.children)return;const{fetchApi:n,params:r,dataKey:a,textKey:i="text",valueKey:l="value",callback:o,formatter:s=(e=>e)}=p;if(n)try{const e=await n(s({...r,[l]:t.value}));if(200===e.code){const n=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[],r=tl(C,t.value,l,Pr(n,l,i));S(r),o?.(n)}}catch(e){}}:void 0},r?{title:T(n)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;n?.(t),r(t,T(t),C)})(((e=[])=>r?e.map((e=>e.join(","))):e.join(","))(t))}}))};class sl extends i.Component{constructor(...e){super(...e),il(this,"context",void 0),il(this,"state",{itemList:[],loading:!1}),il(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:n={},dataKey:r,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(n);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[],n=Pr(t,a,i);this.setState({itemList:n},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,n=this.props.option.request?.params;(0,Q.isEqual)(t,n)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:t}=this.props,{itemList:n}=this.state,{type:r,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:Ee()(u),tooltip:i,hidden:s,labelCol:{flex:e.verticalLayout?"initial":de(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(ol,{option:this.props.option,multiple:t,items:n,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&l().createElement(O.Col,{flex:de(m.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...m}))))}}il(sl,"contextType",fn);const cl=sl,dl=require("china-area-data");var ul=r.n(dl);function ml(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pl=["110000","120000","310000","500000"],hl=["810000","820000"],fl=[{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"}],gl=[{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"}],yl=e=>Xr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),bl=(e,t,n=1)=>{if(!(n>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...pl,...hl].includes(e))):Object.keys(e[t])).map((r=>({l:yl(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:bl(e,r,n+1)})))},vl=(e,t)=>t.map((t=>({l:yl(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class xl extends i.Component{constructor(e){super(e),ml(this,"context",void 0),ml(this,"searchRef",l().createRef()),ml(this,"scrollRef",l().createRef()),ml(this,"zxsAndGa",void 0),ml(this,"provinces",void 0),ml(this,"allCities",void 0),ml(this,"letterCities",void 0),ml(this,"state",{visible:!1,select_type:"0",active_key:""}),ml(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),ml(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(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:vl(ul(),pl)},{l:"Z2",n:"港澳",c:"",p:"",children:vl(ul(),hl)}]}createProvince(){return(bl(ul(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return gl.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...pl,...hl].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?fl:gl).map((t=>l().createElement("li",{key:t.value,className:Ee()({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,n)=>l().createElement("div",{key:n},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:Ee()({actived:t.c===e}),onClick:()=>this.clickHadnle(t.c)},t.n)))))))}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=we("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(n),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(n)))));return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(Zr,{value:g,bordered:c}):l().createElement(za(),{action:m?[]:["click"],popupVisible:!m&&t,popup:y,popupClassName:Ee()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,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)}})))}))}}ml(xl,"contextType",fn);class El extends i.Component{constructor(...e){super(...e),ml(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(xl,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}ml(El,"contextType",fn);const wl=El;function Cl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sl=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Sl(e,n)})))};class Nl extends i.Component{constructor(e){super(e),Cl(this,"context",void 0),Cl(this,"searchRef",l().createRef()),Cl(this,"prevText",void 0),Cl(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Cl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:n}=this.props;t?.(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const t=Sl(ul(),"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:n}=this.props;t!==n&&this.state.values.join(",")!==(n??"")&&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 n=this.state.tabs.slice(0,1);for(let r=0;r<t.length;r++){const a=Lr(e,t[r]);if(a&&le(a.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(a?.children)&&(n[r+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:n,formatter:r=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(n)try{const t=await n(r({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,n)=>{const r=t.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return l().createElement(tn.TabPane,{key:n.toString(),tab:r},l().createElement("div",{className:"region-box"},t.map((t=>l().createElement("span",{key:t.value,className:Ee()({"region-box__item":!0,actived:e.includes(t.value.toString())}),title:t.text,onClick:()=>{let{values:e}=this.state;e[n]=t.value.toString(),e=e.slice(0,n+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(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},t.text)))))}));return t.length?l().createElement(tn,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},t):l().createElement(ut,null)}render(){const{$$form:e}=this.context,{visible:t}=this.state,{value:n}=this.props,{fieldName:r,options:a={},style:i={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:d=!0,readOnly:u,disabled:m}=this.props.option,h=we("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(n);(""===e||e.split("/").every((e=>""!==e)))&&(y=e,this.prevText=y)}return l().createElement(o.Consumer,null,(n=>{const a={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?l().createElement(Zr,{value:y,bordered:c}):l().createElement(za(),{action:m?[]:["click"],popupVisible:!m&&t,popup:g,popupClassName:Ee()(a,`form-popper__${r}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,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()))}})))}))}}Cl(Nl,"contextType",fn);class Il extends i.Component{constructor(...e){super(...e),Cl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Nl,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(a,n)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Cl(Il,"contextType",fn);const Tl=Il;function Rl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ol=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:w}=i,{action:C,headers:S,params:N,withCredentials:I=!1,dataKey:T="",downloadWithHeaders:R,fieldAliasMap:k,beforeUpload:P,button:L}=o,A="function"==typeof k?k():k||{},{t:F}=G();return l().createElement(po,{name:"file",action:C,multiple:d,headers:S,data:N,withCredentials:I,downloadWithHeaders:R,beforeUpload:P,maxCount:u,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,button:L,showUploadList:{showDownloadIcon:!0,downloadIcon:l().createElement(Ce.DownloadOutlined,null)},fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in A)n[r]=e[r]||t.data?.[A[r]]||"";return e.response&&200!==t.code&&O.message.error(t.message||F("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(T?(0,Q.get)(t.data,T):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onPreview:b,onDownload:v,onRemove:x,onSortChange:E,onEditChange:w})};class kl extends i.Component{constructor(...e){super(...e),Rl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Ol,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Rl(kl,"contextType",fn);const Pl=kl;function Ll(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Al=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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:w,withCredentials:C=!1,dataKey:S="",popupClassName:N,fieldAliasMap:I,beforeUpload:T}=o,R="function"==typeof I?I():I||{},{t:k}=G();return l().createElement(yo,{name:"file",action:x,multiple:d,headers:E,data:w,withCredentials:C,popupClassName:N,beforeUpload:T,maxCount:u,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:y,disabled:s||t.props.disabled,readOnly:t.isOnlyShow||c,fileList:n,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{const t=e.response||{},n={};for(const r in R)n[r]=e[r]||t.data?.[R[r]]||"";return e.response&&200!==t.code&&O.message.error(t.message||k("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...n,url:e.url||(S?(0,Q.get)(t.data,S):t.data)||"",status:e.status}}));r?.(t),t.every((e=>"done"===e.status&&e.url))&&a(t)})(e)},onRemove:b,onSortChange:v})};class Fl extends i.Component{constructor(...e){super(...e),Ll(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Al,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,"")}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Ll(Fl,"contextType",fn);const _l=Fl;function Dl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hl=e=>{const{$$form:t}=l().useContext(fn),{value:n,onChange:r,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(oo,{value:n,tinymce:u,upload:o,thresholdSize:m,style:{width:"100%",...s},disabled:d||c||t.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{r?.(e),a(e)})(e)}})};class ql extends i.Component{constructor(...e){super(...e),Dl(this,"context",void 0)}render(){const{$$form:e}=this.context,{type:t,label:n,tooltip:r,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(n),className:Ee()(c),tooltip:r,hidden:i,labelCol:{flex:e.verticalLayout?"initial":de(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(n)}},l().createElement(Hl,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(a,t)}}))),d&&l().createElement(O.Col,{flex:de(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:a,...d}))))}}Dl(ql,"contextType",fn);const $l=ql;function Ml(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Kl extends i.Component{constructor(e){super(e),Ml(this,"context",void 0),Ml(this,"provide",{$$form:this,echo_data:{}}),Ml(this,"_initialValues",void 0),Ml(this,"_initialOthers",void 0),Ml(this,"_initialExtras",void 0),Ml(this,"_fieldAuth",{}),Ml(this,"wrapperRef",l().createRef()),Ml(this,"formRef",l().createRef()),Ml(this,"originItems",[]),Ml(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),Ml(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})})),Ml(this,"resizeListenerHandle",(0,Q.debounce)(this.resizeObserveHandler,10)),Ml(this,"getFormItems",hn()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),Ml(this,"getFlattenItems",hn()((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}))),Ml(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),Ml(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),Ml(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),Ml(this,"finishFailedHandle",(({values:e,errorFields:t})=>{this.props.onFinishFailed?.(t)})),Ml(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})})),Ml(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(){vt(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){xt(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)),n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return Object.assign({},n)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,Q.isPlainObject)(e.extra))).forEach((n=>{t[n.fieldName]=e[n.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:n,options:r}=e;return t=t??void 0,br.includes(n)&&(t=t??[]),"CHECKBOX"!==n&&"SWITCH"!==n||(t=t??r?.falseValue??gr),t}createFormValue(e){const t={};return this.flattenItems.forEach((n=>{t[n.fieldName]=this.getInitialValue(n,e[n.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=ce(this.props.items)}getOriginItems(){return this.originItems}setViewValue(e,t=""){t!==this.getViewValue(e)&&this.setState((n=>({viewData:Object.assign({},n.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:n}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!n||setTimeout((()=>this.CREATE_FOCUS(n)))}getFormItemLabel(e){if(Fr(e))return _r(e);if((0,Q.isPlainObject)(e)){const{fieldName:t,label:n,options:r={}}=e;if(Fr(n))return _r(n);const{itemList:a=[]}=r,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,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){if("DIVIDER"===e)return!0;const n=this.getBlockDerivedItems();for(let e=0,r=n.length;e<r;e++){const r=n[e],a=this.dividers.find((e=>e.fieldName===r[0].fieldName)),i=a?.collapse?.showLimit??r.length-1;for(let e=1;e<r.length;e++)if(r[e].fieldName===t&&e>i)return this.state.expand[r[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const n=e[t];if(Tr(n)&&(e[t]=""),Array.isArray(n)&&n.forEach(((n,r)=>{Tr(n)&&(e[t][r]="")})),t.includes("|")&&Array.isArray(n)){const[r,a]=t.split("|");e[r]=n[0]??"",e[a]=n[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=se(e,["fetch"]);if(e.fetch){const{api:n,params:r,dataKey:a}=e.fetch;try{const e=await n(r);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:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const t=this.originItems.find((e=>e.fieldName===n)),{visible:a=1,disabled:i,secretName:l}=r;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(n,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return l().createElement(fa,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return l().createElement(va,{option:e})}INPUT_NUMBER(e){return l().createElement(Na,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return l().createElement(Oa,{option:e})}SEARCH_HELPER(e){return l().createElement(_a,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return l().createElement(Ba,{option:e})}TREE_TABLE_HELPER(e){return l().createElement(Qa,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return l().createElement(ri,{option:e})}RANGE_SEARCH_HELPER(e){return l().createElement(si,{option:e})}CHECKBOX(e){return l().createElement(sa,{option:e})}MULTIPLE_CHECKBOX(e){return l().createElement(mi,{option:e})}RATE(e){return l().createElement(gi,{option:e})}RADIO(e){return l().createElement(xi,{option:e})}SWITCH(e){return l().createElement(Si,{option:e})}TEXT_AREA(e){return l().createElement(Ri,{option:e})}DATE(e){return l().createElement(Li,{option:e})}RANGE_DATE(e){return l().createElement(Hi,{option:e})}TIME(e){return l().createElement(Ki,{option:e})}RANGE_TIME(e){return l().createElement(Wi,{option:e})}SELECT(e){return l().createElement(aa,{option:e})}MULTIPLE_SELECT(e){return l().createElement(aa,{option:e,multiple:!0})}IMMEDIATE(e){return l().createElement(Yi,{option:e})}DIVIDER(e){return l().createElement(Zi,{option:e})}TREE_SELECT(e){return l().createElement(al,{option:e})}MULTIPLE_TREE_SELECT(e){return l().createElement(al,{option:e,multiple:!0})}CASCADER(e){return l().createElement(cl,{option:e})}MULTIPLE_CASCADER(e){return l().createElement(cl,{option:e,multiple:!0})}CITY_SELECT(e){return l().createElement(wl,{option:e})}REGION_SELECT(e){return l().createElement(Tl,{option:e})}UPLOAD_FILE(e){return l().createElement(Pl,{option:e})}UPLOAD_IMG(e){return l().createElement(_l,{option:e})}TINYMCE(e){return l().createElement($l,{option:e})}renderFormLabel(e){if(Fr(e)||!(0,Q.isPlainObject)(e))return e;const{type:t,fieldName:n,label:r,options:a={},onChange:i=te}=e,{itemList:o=[]}=a;return"SELECT"===t?l().createElement(O.Form.Item,{name:n,noStyle:!0},l().createElement(na,{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}},r),l().createElement(O.Form.Item,{name:n,noStyle:!0},l().createElement(la,{option:e,onValuesChange:e=>i(e)}))):null}renderFormItemExtra(e){const{fieldName:t,isTooltip:n,style:r={},render:a}=e,{extra:i}=this.state;if(n)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:r},l().createElement("span",{className:"extra-overflow-cut"},a?a(o,this):i[t]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),r="function"==typeof t?t(n):t;return this.isOnlyShow?null:r}renderFormItem(e){const{label:t,fieldName:n,invisible:r,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:n,rules:c,tooltip:a,hidden:r,className:Ee()(i),style:{width:"100%",...d},labelCol:{flex:this.verticalLayout?"initial":de(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(t)}},this.formRef.current?u(e,this):l().createElement(l().Fragment,null))}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:n,isFieldsDefine:r}=this.props,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<n;e++)a.push({})}));const i=24/e,o=[],s=a.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,d=[],u=a.map(((t,n)=>{let{selfCol:r=1}=t;const{type:a,fieldName:s}=t;r=r>=24||"DIVIDER"===a||"TINYMCE"===a?e:r;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(t);return u&&d.push(o[n]),l().createElement(O.Col,{key:s??n,className:s,span:r*i,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},a?this.createFormItem(ce(t)):null)}));return r&&"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:n}=this.state,{searchButtonCols:r,isSearchBtn:a,isFieldsDefine:i=!0}=this.props;if(!this.isFilterType)return null;const o=24/t,s=r||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(ge,{type:"primary",size:this.$size,icon:l().createElement(Ce.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),l().createElement(ge,{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(!n)},n?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:t,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const r=24/e;return n&&"default"===t?l().createElement(O.Row,{gutter:0},l().createElement(O.Col,{key:"-",span:r},l().createElement(O.Form.Item,null,l().createElement(O.Space,{style:{marginBottom:12}},l().createElement(ge,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),l().createElement(ge,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:t,fieldsChange:n}=this.props;return l().createElement(ua,{uniqueKey:e,items:t,fieldsChange:n})}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[n,r]=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:[]})));n||a.length?t((n||[]).concat(a)):e(r)}))}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),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),a={};return r.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,n){const{items:r,fieldsChange:a}=this.props,i=r.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 n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||(0,Q.set)(i,n,t[n]));n&&(a?a([...r]):pe("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:t,layout:n,disabled:r,labelWidth:a,labelAlign:i,labelWrap:o,customClass:s}=this.props,c=we("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:Ee()(u,e),style:t},l().createElement(O.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:i,labelWrap:o,colon:!1,disabled:r,labelCol:{flex:this.verticalLayout?"initial":de(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},l().createElement(fn.Provider,{value:this.provide},l().createElement(O.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Ml(Kl,"contextType",o),Ml(Kl,"propTypes",Cr),Ml(Kl,"defaultProps",Sr);const zl=Kl,jl={onActivate:ur.func,onAddUndo:ur.func,onBeforeAddUndo:ur.func,onBeforeExecCommand:ur.func,onBeforeGetContent:ur.func,onBeforeRenderUI:ur.func,onBeforeSetContent:ur.func,onBeforePaste:ur.func,onBlur:ur.func,onChange:ur.func,onClearUndos:ur.func,onClick:ur.func,onContextMenu:ur.func,onCommentChange:ur.func,onCopy:ur.func,onCut:ur.func,onDblclick:ur.func,onDeactivate:ur.func,onDirty:ur.func,onDrag:ur.func,onDragDrop:ur.func,onDragEnd:ur.func,onDragGesture:ur.func,onDragOver:ur.func,onDrop:ur.func,onExecCommand:ur.func,onFocus:ur.func,onFocusIn:ur.func,onFocusOut:ur.func,onGetContent:ur.func,onHide:ur.func,onInit:ur.func,onKeyDown:ur.func,onKeyPress:ur.func,onKeyUp:ur.func,onLoadContent:ur.func,onMouseDown:ur.func,onMouseEnter:ur.func,onMouseLeave:ur.func,onMouseMove:ur.func,onMouseOut:ur.func,onMouseOver:ur.func,onMouseUp:ur.func,onNodeChange:ur.func,onObjectResizeStart:ur.func,onObjectResized:ur.func,onObjectSelected:ur.func,onPaste:ur.func,onPostProcess:ur.func,onPostRender:ur.func,onPreProcess:ur.func,onProgressState:ur.func,onRedo:ur.func,onRemove:ur.func,onReset:ur.func,onSaveContent:ur.func,onSelectionChange:ur.func,onSetAttrib:ur.func,onSetContent:ur.func,onShow:ur.func,onSubmit:ur.func,onUndo:ur.func,onVisualAid:ur.func,onSkinLoadError:ur.func,onThemeLoadError:ur.func,onModelLoadError:ur.func,onPluginLoadError:ur.func,onIconsLoadError:ur.func,onLanguageLoadError:ur.func},Vl={apiKey:ur.string,id:ur.string,inline:ur.bool,init:ur.object,initialValue:ur.string,onEditorChange:ur.func,value:ur.string,tagName:ur.string,cloudChannel:ur.string,plugins:ur.oneOfType([ur.string,ur.array]),toolbar:ur.oneOfType([ur.string,ur.array]),disabled:ur.bool,textareaName:ur.string,tinymceScriptSrc:ur.string,rollback:ur.oneOfType([ur.number,ur.oneOf([!1])]),scriptLoading:ur.shape({async:ur.bool,defer:ur.bool,delay:ur.number}),...jl},Wl=e=>"function"==typeof e,Bl=e=>e in jl,Ul=e=>e.substr(2),Gl=(e,t,n,r,a)=>((t,n,r,a,i,l,o)=>{const s=Object.keys(i).filter(Bl),c=Object.keys(l).filter(Bl),d=s.filter((e=>void 0===l[e])),u=c.filter((e=>void 0===i[e]));d.forEach((e=>{const t=Ul(e),n=o[t];r(t,n),delete o[t]})),u.forEach((r=>{const a=((t,n)=>r=>t(n)?.(r,e))(t,r),i=Ul(r);o[i]=a,n(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,n,r);let Yl=0;const Xl=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return Yl++,e+"_"+n+Yl+String(t)},Ql=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Zl=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Jl=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},eo=()=>({listeners:[],scriptId:Xl("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),to=(()=>{let e=eo();return{load:(t,n,r,a,i,l)=>{const o=()=>((t,n,r,a,i,l)=>{const o=n.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=r,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),n.head&&n.head.appendChild(o)})(e.scriptId,t,n,r,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=eo()}}})(),no=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function ro(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ao extends i.Component{constructor(e){super(e),ro(this,"editor",void 0),ro(this,"id",void 0),ro(this,"elementRef",void 0),ro(this,"inline",void 0),ro(this,"currentContent",void 0),ro(this,"boundHandlers",void 0),ro(this,"rollbackTimer",void 0),ro(this,"valueCursor",void 0),ro(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})),ro(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){}})),ro(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),ro(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))}})),ro(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),ro(this,"initialise",((e=0)=>{const t=this.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,n=e.parentNode;for(;null!=n;)t=n,n=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 n=no(this.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const r={...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,Zl(a).concat(Zl(i))),toolbar:this.props.toolbar??this.props.init?.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!Ql(t)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&Wl(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 n=this.props.disabled??!1;Jl(this.editor,n?"readonly":"design"),this.props.init&&Wl(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}};var a,i;this.inline||(t.style.visibility=""),Ql(t)&&(t.value=this.getInitialValue()),n.init(r)})),this.id=this.props.id||Xl("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 n=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const r of[t,n])if(r)try{e.selection.moveToBookmark(r),this.valueCursor=r;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Jl(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==no(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&to.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=no(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){Gl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,n=t(e),r=t(this.props);!n&&r?(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)):n&&!r&&(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))}}}ro(ao,"propTypes",Vl),ro(ao,"defaultProps",{cloudChannel:"6"});var io=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(io||{});const lo=e=>{const{className:t,style:n,tinymce:r={},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:r.height||400,plugins:r.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:r.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:r.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:io[f],skin:"tinymce-5",...se(r,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,n)=>{const{action:r,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(r&&d/1024/1024>i)try{const e=await fetch(r,{method:"POST",body:c,headers:l});if(!e.ok)throw new Error(g("qm.upload.uploadError"));const n=await e.json();200===n.code&&t(o?(0,Q.get)(n.data,o):n.data)}catch(e){O.message.error(g("qm.uploadCropper.uploadError"))}else t(s)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;u?.({width:n,height:r},t)}))}},b=we("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:Ee()(v,t),style:n},l().createElement(ao,x))};lo.displayName="QmTinymce";const oo=lo,so=require("cropperjs");var co=r.n(so);const uo=l().forwardRef(((e,t)=>{const n=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:r,style:a,src:i,alt:o,imgStyle:s,...c}=n,d=l().useRef(null),u=l().useRef(null);l().useEffect((()=>{const e={};for(const t in c)void 0!==n[t]&&(e[t]=n[t]);return u.current=new(co())(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),w=(e,t)=>u.current?.zoom(e),C=(e,t)=>u.current?.zoomTo(e,t),S=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),O=(e=!1)=>u.current?.getData(e),k=e=>u.current?.setData(e),P=()=>u.current?.getContainerData(),L=()=>u.current?.getImageData(),A=()=>u.current?.getCanvasData(),F=e=>u.current?.setCanvasData(e),_=()=>u.current?.getCropBoxData(),D=e=>u.current?.setCropBoxData(e),H=(e={})=>u.current?.getCroppedCanvas(e),q=e=>u.current?.setAspectRatio(e),$=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:w,zoomTo:C,rotate:S,rotateTo:N,scaleX:I,scaleY:T,scale:R,getData:O,setData:k,getContainerData:P,getImageData:L,getCanvasData:A,setCanvasData:F,getCropBoxData:_,setCropBoxData:D,getCroppedCanvas:H,setAspectRatio:q,setDragMode:$})));const M=we("cropper"),K={[M]:!0};return l().createElement("div",{className:Ee()(K,r),style:a},l().createElement("img",{ref:d,src:i,alt:o,style:{maxWidth:"100%",...s}}))}));uo.displayName="Cropper";const mo=uo,po=Ht,ho=e=>{const{fileTypes:t=[],fileSize:n,fixedSize:r,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=we("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:n,...r}=t.props;return d.current=n,l().createElement(t.type,{...r,beforeUpload:(e,t)=>new Promise((async(n,r)=>{const a=()=>n(O.Upload.LIST_IGNORE);if(i&&!await i(e,t))return void a();u.current=e,m.current=n,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:Ee()(v,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{(async()=>{const{type:e,name:n,uid:r}=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],n,{type:e});if(Object.assign(i,{uid:r}),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 pe("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),e,a),await re(100),b()})()},onCancel:b,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:r?`calc(380px * ${r[1]/r[0]})`:"auto"};return l().createElement("div",{className:"cropper-preview"},l().createElement("div",{className:"cropper-area"},l().createElement("div",{className:"img-cropper"},l().createElement(mo,{ref:c,aspectRatio:r?r[0]/r[1]:r,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 fo(){return fo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fo.apply(null,arguments)}const go=e=>{const t=h({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:n=[],openCropper:r=!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),w=l().useRef(null),C=l().useRef(!1),[S,N]=l().useState(!1),[I,T]=l().useState(0),R=l().useMemo((()=>u||m),[u,m]),k=l().useMemo((()=>!c||n.length<c),[n,c]);l().useEffect((()=>(L(),document.addEventListener("paste",F),()=>{w.current?.destroy(),document.removeEventListener("paste",F)})),[]),qe((()=>{k||(C.current=!1)}),[n]);const P=Y((e=>{const{oldIndex:t,newIndex:r}=e;if(t!==r){const e=[...n],[a]=e.splice(t,1);e.splice(r,0,a),y?.(e),b?.({file:n[t],fileList:e})}})),L=()=>{d&&(w.current=kt().create(Ue(E.current,we("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:P}))},A=(e,n)=>new Promise((async(r,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,n);if(!0===t)return r(e);if(!1===t)return a("not upload");if(t&&"function"==typeof t.then)try{r(await t)}catch(e){a(e)}}else r(e)})),F=Y((async e=>{const{action:r,data:a,headers:i}=t;if(C.current&&k&&r)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 A(o,[...n,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 r?r:await r(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:[...n,{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){}}})),_=we("upload-img"),D={[_]:!0,[`${_}--lg`]:"large"===x,[`${_}--sm`]:"small"===x},H=l().createElement(O.Upload,fo({className:Ee()(D,p)},se(t,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:A,disabled:R,onPreview:e=>{const t=n.findIndex((t=>t.url===e.url));t<0||(T(t),N(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,t,n,r)=>l().createElement("div",{className:Ee()("upload-item",{handle:d})},e,!R&&l().createElement(Ce.CloseOutlined,{title:v("qm.upload.remove"),className:"icon",onClick:()=>r.remove()}))}),l().createElement("span",{className:"inner",ref:E},k&&!(m&&n.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:Ee()("ant-upload-button",{disabled:R}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{C.current=!0},onBlur:()=>{C.current=!1}},v("qm.uploadCropper.pasteText")))));return l().createElement(l().Fragment,null,r?l().createElement(ho,{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:n.map((e=>e.uid||"")).join(","),preview:{visible:S,current:I,rootClassName:f,onVisibleChange:e=>N(e)}},n.map(((e,t)=>l().createElement(O.Image,{key:e.uid||t,src:e.url,alt:""}))))))};go.displayName="QmUploadImg";const yo=go,bo=(e,t,n)=>{let r;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[n]===t)))r=i[n];else{const e=bo(i.children,t,n);e&&(r=e)}}return r},vo=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vo(e.children,t),t(e)||e.children&&e.children.length))),xo=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...xo(e.children,t)),t(e)&&n.push(e)})),n},Eo=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Eo(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},wo=(e,t,n,r)=>e.map((e=>e[n]===t?{...e,children:r}:e.children?{...e,children:wo(e.children,t,n,r)}:e)),Co=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Co(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},So=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][n]===t)return[t];if(Array.isArray(e[r].children)){const a=So(e[r].children,t,n);if(a)return[e[r][n],a].flat()}}},No=(e,t)=>{const n=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>n.push(...No(e,t)))),n},Io=l().forwardRef(((e,t)=>{const{className:n,style:r,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:w=!0,showCollapse:C=!0,onSelectChange:S,onCheckChange:N,onDragStart:I,onDragChange:T,onExpand:R}=e,{$size:k}=X(e),{t:P}=G(),L=f?.valueKey||"value",A=f?.textKey||"text",F=l().useRef(null),_=l().useRef(null),D=Et(F),[H,q]=l().useState(b),[$,M]=l().useState(!1),K=wt((()=>{q(F.current.offsetHeight-re.current.offsetHeight-10)}),5);g((()=>{b||K()}),[D.height]);const[z,j]=l().useState([]),[V,W]=l().useState({}),[B,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),[te,ne]=l().useState(E),re=l().useRef(null),ae=l().useRef([]),ie=l().useRef([]);l().useEffect((()=>{Array.isArray(s)&&(oe(s),U(se(s)),W({}))}),[s]),l().useEffect((()=>{ue(),d&&_.current?.focus()}),[]),qe((()=>{ue()}),[c?.params]),qe((()=>{Z(de())}),[V]),l().useImperativeHandle(t,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=Eo(z,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],oe([...z]))},REMOVE_RECORD:e=>{const t=bo(z,e,L);if(void 0===t&&z.find((t=>t[L]===e)))oe(z.filter((t=>t[L]!==e)));else{const n=Eo(z,(e=>t===e[L]));if(!n)return;const r=n.children?.findIndex((t=>e===t[L]));r>=0&&(n.children.splice(r,1),oe([...z]))}},UPDATE_RECORD:(e,t)=>{const n=Eo(z,(t=>e===t[L]));n&&((0,Q.merge)(n,t),oe([...z]))}})));const oe=e=>{j(e),ae.current=e,ie.current=Co(e,L)},se=e=>{if(i)return v;const t=xo(e,(e=>v.includes(e[A])));return 1===t.length?[t[0][L]]:[]},ce=e=>So(z,e,L)?.slice(0,-1)||[],de=()=>{if(E)return ie.current;const e=[];return B.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 n=Lr(z,t);if(n){const r=ce(t),a=No(n,L);e.push(...r,...[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:n,afterFetch:r,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,n)??[];e="function"==typeof r?await r(e):e,oe(e),U(se(e)),W({}),a?.(e)}}catch(e){}M(!1)},me=e=>`${e}|${Xr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,pe=we("search-tree"),he={[pe]:!0,[`${pe}--lg`]:"large"===k,[`${pe}--sm`]:"small"===k};return l().createElement("div",{ref:F,className:Ee()(he,n),style:r},l().createElement("div",{ref:re,className:"topper"},w&&l().createElement(O.Input,{ref:_,value:J,size:k,placeholder:h||P("qm.form.inputPlaceholder"),suffix:l().createElement(Ce.SearchOutlined,null),allowClear:!0,onChange:e=>(e=>{if(!a)return;const t=vo(ae.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==me(n).indexOf(e)}));ee(e),j(t),Z(E||e?Co(t,L):de())})(e.target.value)}),C&&l().createElement("a",{className:"trigger",onClick:()=>{ne(!te),Z(te?[]:ie.current)}},te?l().createElement(Ce.UpOutlined,null):l().createElement(Ce.DownOutlined,null)," ",P(te?"qm.form.collect":"qm.form.spread"))),l().createElement(pt,{spinning:$},l().createElement(O.Tree,{fieldNames:{title:A,key:L,children:"children"},multiple:i,draggable:o,blockNode:o,checkable:i,selectable:!i,height:H,disabled:e.disabled,checkStrictly:m,selectedKeys:y??B,checkedKeys:y??B,expandedKeys:Y,treeData:z,loadData:u?async({key:e,children:t})=>{if(!c||t)return;const{api:n,params:r,dataKey:a,formatter:i=(e=>e),afterFetch:l}=c;try{const t=await n(i({...r,[L]:e}));if(200===t.code){let n=Array.isArray(t.data)?t.data:(0,Q.get)(t.data,a)??[];n="function"==typeof l?await l(n):n;const r=wo(ae.current,e,L,n);oe(r)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!J)return!1;const t=e[A]||"";return-1!==me(t).indexOf(J)},onDragStart:I,onDragEnter:e=>{Z(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),a=e.dropPosition-Number(r[r.length-1]),i=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][L]===t)return n(e[r],r,e);e[r].children&&i(e[r].children,t,n)}},l=[...z];let o;if(i(l,n,((e,t,n)=>{n.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,n=[];i(l,t,((t,r,a)=>{n=a,e=r})),-1===a?n.splice(e,0,o):n.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));oe(l)},onDragEnd:e=>{T?.(e,z)},onExpand:(e,t)=>{le(e)&&ne(!1),ie.current.every((t=>e.includes(t)))&&ne(!0),Z(e),R?.(e,t)},onSelect:e=>{U(e);const t=xo(ae.current,(t=>e.includes((0,Q.get)(t,L))));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,n)=>!n.includes(bo(z,e,L))))));const t=xo(ae.current,(t=>e.includes((0,Q.get)(t,L))));N?.(i?t:t[0])}})))}));Io.displayName="QmSearchTree";const To=Io,Ro=(0,i.createContext)(void 0),Oo={dataIndex:mr().string.isRequired,title:mr().string.isRequired,description:mr().string,colSpan:mr().number,width:mr().number,minWidth:mr().number,fixed:mr().oneOf(["left","right"]),align:mr().oneOf(["left","center","right"]),theadAlign:mr().oneOf(["left","center","right"]),printFixed:mr().bool,hidden:mr().bool,noAuth:mr().bool,noFixed:mr().bool,ellipsis:mr().bool,className:mr().string,theadClassName:mr().string,children:mr().array,sorter:mr().oneOfType([mr().bool,mr().func]),filter:mr().shape({type:mr().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:mr().arrayOf(mr().shape({text:mr().string,value:mr().oneOfType([mr().string,mr().number])})),style:mr().object}),precision:mr().number,displayPrecision:mr().number,formatType:mr().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:mr().bool,canCopy:mr().bool,editRender:mr().func,dictItems:mr().arrayOf(mr().shape({text:mr().string,value:mr().oneOfType([mr().string,mr().number])})),summation:mr().shape({sumBySelection:mr().bool,displayWhenNotSelect:mr().bool,dataKey:mr().string,unit:mr().string,render:mr().func}),groupSummary:mr().shape({dataKey:mr().string,unit:mr().string,render:mr().func}),shouldCellUpdate:mr().func,headRender:mr().func,render:mr().func},ko=(mr().arrayOf(mr().shape(Oo)).isRequired,mr().func,mr().array,mr().oneOfType([mr().string,mr().func]).isRequired,mr().number,mr().bool,mr().bool,mr().shape({api:mr().func.isRequired,params:mr().object.isRequired,formatter:mr().func,beforeFetch:mr().func,afterFetch:mr().func,stopToFirst:mr().bool,dataKey:mr().string,callback:mr().func}),mr().bool,mr().bool,mr().string,mr().string,mr().object,mr().bool,mr().bool,mr().bool,mr().oneOfType([mr().object,mr().func]),mr().oneOfType([mr().object,mr().func]),mr().array,mr().func,mr().bool,mr().object,mr().object,mr().shape({type:mr().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:mr().array,selectedRowKeys:mr().array,hideSelectAll:mr().bool,checkStrictly:mr().bool,filterable:mr().bool,selectByClickRow:mr().bool,selectFirstRowOnChange:mr().bool,clearableAfterFetched:mr().bool,selectAllOnCurrentPage:mr().bool,fetchSelectedRows:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),fetchAllRowKeys:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),disabled:mr().func,onChange:mr().func,onSelect:mr().func,onSelectAll:mr().func}),mr().shape({currentRowKey:mr().oneOfType([mr().number,mr().string]),disabled:mr().func,onChange:mr().func}),mr().shape({virtual:mr().bool,overscan:mr().number,doubleXScrollbar:mr().bool}),mr().shape({expandIconColumn:mr().string}),mr().shape({defaultExpandAllRows:mr().bool,defaultExpandedRowKeys:mr().array,expandedRowKeys:mr().array,hideExpandAll:mr().bool,rowExpandable:mr().func,expandedRowClassName:mr().string,expandedRowRender:mr().func,onExpand:mr().func,onChange:mr().func}),mr().shape({cellMerge:mr().bool,onCellMerge:mr().func,onSelectChange:mr().func}),mr().shape({groupItems:mr().arrayOf(mr().shape({dataIndex:mr().string.isRequired,titleIndex:mr().string,color:mr().string,backgroundColor:mr().string})),fetch:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),onChange:mr().func}),mr().func,mr().bool,mr().bool,mr().bool,mr().bool,mr().shape({current:mr().number,pageSize:mr().number,pageSizeOptions:mr().array,showSizeChanger:mr().bool,showQuickJumper:mr().bool}),mr().shape({fileName:mr().string,fetch:mr().shape({api:mr().func.isRequired,params:mr().object}),beforeExport:mr().func,cellStyle:mr().bool,hideIcon:mr().bool}),mr().shape({showLogo:mr().bool}),mr().shape({fetch:mr().shape({api:mr().func.isRequired,params:mr().object,dataKey:mr().string}),fieldList:mr().arrayOf(mr().object)}),mr().shape({position:mr().oneOf(["top","bottom"]),hideAlert:mr().bool,hideClearButton:mr().bool}),mr().oneOf(["left","right"]),mr().func,mr().func,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().bool,mr().func,mr().func,mr().func,mr().func,mr().func,mr().func,mr().func,mr().func,mr().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,Lo="1",Ao="0",Fo="YYYY-MM-DD",_o="YYYY-MM-DD HH:mm:ss",Do="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 qo=function(e){return e.left="flex-start",e.right="flex-end",e}({});const $o={...i}.useId;let Mo=0;const Ko=$o?function(e){const t=$o();return e||t}:function(e){const[t]=i.useState(`qm_unique_${Mo}`);return i.useEffect((()=>{Mo+=1}),[]),e||t};let zo=[];const jo={_getInstance:function(e){return zo.find((t=>t.id===e))??null},getFocusInstance:function(){return zo[0]??null},focus:function(e){const t=this._getInstance(e);t&&0!==zo.findIndex((e=>e===t))&&(this.deregister(e),zo=[t,...zo])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),zo=[{id:e,vm:t},...zo])},deregister:function(e){e&&(zo=zo.filter((t=>t.id!==e)))}};function Vo(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Wo=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)}},Bo={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:100,sorterFieldName:"tsortby",filterFieldName:"twhere",currentPageName:"currentPage",pageSizeName:"pageSize",showFilterType:!0,printWidth:1040,operationColumn:"__action__",selectionColumn:"__selection__",expandableColumn:"__expandable__",summaryIgnore:"sumIgnored",popupClassName:"table-editable__popper"};function Uo(e){return void 0!==e}function Go(e,t){const{defaultValue:n,value:r,onChange:a,postState:l}=t||{},[o,s]=i.useState((()=>Uo(r)?r:Uo(n)?"function"==typeof n?n():n:"function"==typeof e?e():e)),c=Uo(r)?r: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((()=>{Uo(r)||s(r)}),[r]),[d,Y((e=>{s(e),p([c])}))]}const 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:n,columns:r,border:a,rowSelection:i,summation:o,expandable:s,treeConfig:c,webPagination:d,scrollPagination:u,showSuperSearch:m,showFastSearch:p,showGroupSummary:h,showTableImport:f,showClipboard:g,showSelectCollection:y,showPivotGrid:b,footRender:v}=e,{tableRef:x,getRowKey:E,tableFullData:w,tableFlatData:C,selectionKeys:S,sorter:N,filters:I,superFilters:T,pagination:R,mergedTdCells:O}=t,{selectionRows:k,summaries:P}=x.current,{expandIconColumn:L=""}=c||{},{t:A}=G(),F=(e,t,n,r,a)=>{const i=`${t},${n}`;e.has(i)||e.set(i,{row:t,col:n,rowSpan:r,colSpan:a})},_=l().useMemo((()=>!!n?.api),[n?.api]),D=l().useMemo((()=>!_&&!!d),[_,d]),H=l().useMemo((()=>_&&!!u),[_,u]),q=l().useMemo((()=>(_||D)&&!H),[_,D,H]),$=l().useMemo((()=>(e=>{const t=(e=>{const t=[],n=[],r=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?n.push(i):r.push(i)}return[...t,...r,...n]})(Yo(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Bo.selectionColumn,title:"radio"===t?A("qm.table.config.selectionText"):"",width:Bo.selectionColumnWidth,fixed:"left",type:t}})(i),r=(a=s,a?.expandedRowRender?{dataIndex:Bo.expandableColumn,title:"",width:Bo.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return n&&t.unshift(n),r&&t.unshift(r),kn(t)})(r)),[r]),M=l().useMemo((()=>On($)),[$]),K=l().useMemo((()=>M.filter((e=>"function"==typeof e.editRender))),[M]),z=l().useMemo((()=>M.filter((e=>!!e.summation))),[M]),j=l().useMemo((()=>M.filter((e=>"left"===e.fixed))),[M]),V=l().useMemo((()=>M.filter((e=>"right"===e.fixed))),[M]),W=l().useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=C.findIndex((t=>E(t,t.index)===e.rowKey)),r=M.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){F(t,n,r,e.rowSpan,e.colSpan);for(let a=0;a<e.rowSpan;a++)for(let i=0;i<e.colSpan;i++)0===a&&0===i||F(t,n+a,r+i,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(O)),[O,M,w]),B=l().useMemo((()=>{const e=M.filter((e=>![Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn].includes(e.dataIndex)));return L&&e.some((e=>e.dataIndex===L))?L:e[0]?.dataIndex??""}),[M,L]),U=l().useMemo((()=>z.length>0),[z]),Y=l().useMemo((()=>!!v||U),[v,U]),X=l().useMemo((()=>Mn($).length>1),[$]),Q=l().useMemo((()=>a||X),[a,X]),Z=l().useMemo((()=>M.some((e=>e.sorter))),[M]),J=l().useMemo((()=>M.some((e=>e.filter))),[M]),ee=l().useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),te=l().useMemo((()=>!_&&!!f),[_,f]),ne=l().useMemo((()=>!!g&&K.length>0),[g,K]),re=l().useMemo((()=>!!y&&"checkbox"===i?.type),[y,i]),ae=l().useMemo((()=>!!m&&J),[m,J]),ie=l().useMemo((()=>!_&&!!p&&J),[_,p,J]),le=l().useMemo((()=>!_&&!!b),[_,b]),oe=l().useMemo((()=>!!h&&M.some((e=>!!e.groupSummary))),[M]),se=l().useMemo((()=>!!o?.groupItems?.length),[o]),ce=l().useMemo((()=>!C.length),[C]),de=l().useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=se?rr(x.current.tableFullData):x.current.tableFullData,d=!k.length&&!!o;let u=(!l||d?c:k).reduce(((e,t)=>{if(t?.[Bo.summaryIgnore])return e;const r=Bn(t,n);return Yn(r)?e.plus(r):e}),new(Ea())(0));!Object.keys(P).includes(n)||l&&!d||(u=new(Ea())(Bn(P,n))),Un(e,n,u.toNumber());let m=r>=0?u.toFixed(r):u.toString();a>=0&&""!==m&&(m=Qn(m,a)),m=Xn(m),Un(e,`${n}_text`,s?`${m} ${s}`:m)})),[e]})()),[C,S,P]),ue=l().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),me=l().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(N),t=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,a]=Bo.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{n.push({type:a,bracketLeft:"",fieldName:r,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{n.push({type:Bo.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(I,T);return{...e?{[Bo.sorterFieldName]:e}:null,...t.length?{[Bo.filterFieldName]:t}:null,...ue?{[Bo.groupSummary.summaryFieldName]:ue,usedJH:1}:null,...n?.params??null,[Bo.currentPageName]:R.current,[Bo.pageSizeName]:R.pageSize}}),[n?.params,R.current,R.pageSize,N,I,T,ue]);return{isFetch:_,isWebPagination:D,isScrollPagination:H,showPagination:q,tableColumns:$,flattenColumns:M,editableColumns:K,summationColumns:z,leftFixedColumns:j,rightFixedColumns:V,derivedMergeCells:W,treeExpandIndex:B,showSummary:U,showFooter:Y,isHeadGroup:X,bordered:Q,isHeadSorter:Z,isHeadFilter:J,isServiceSummation:ee,isSelectCollection:re,isTableImport:te,isTableClipboard:ne,isSuperSearch:ae,isFastSearch:ie,isPivotGrid:le,isGroupSummary:oe,isGroupSubtotal:se,isTableEmpty:ce,summationRows:de,fetchParams:me}},Qo=(e,t)=>{const{rowKey:n,height:r,dataSource:a,summation:i,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,authConfig:p,ignorePageIndex:h,columnsChange:f,onChange:y,onDataChange:b,onDataLoad:v,onScrollEnd:x,onFetchError:E}=e,{getRowKey:w,tableRef:C,tableElementRef:S,tableBodyRef:N,$size:I,tableColumns:T,flattenColumns:R,tableFullData:O,pagination:k,layout:P,filters:L,sorter:A,superFilters:F,fetchParams:_,selectionKeys:D,rowExpandedKeys:H,highlightKey:q,summationColumns:$,isFetch:M,isWebPagination:K,isScrollPagination:z,isServiceSummation:j,isGroupSubtotal:V,doLayout:W,setTableFullData:B,setTableOriginData:U,setTableFlatData:Y,setAllTableData:X,setDeriveRowKeys:Z,setPagination:J,setPingRight:ee,setPingLeft:te,setSpinning:re,setSorter:ae,setFilters:ie,setSuperFilters:oe,setSelectionKeys:ce,setRowExpandedKeys:de,setHighlightKey:ue,setSelectionRows:me,setScrollXLoad:he,setScrollYLoad:fe,setFieldAuth:ge,setResizeState:ye,setSummaries:be,setPermission:ve,setRecordsMap:xe,resetTableScroll:Ee,clearElementStore:we,clearRecordsMap:Ce}=t,{t:Se}=G(),{store:Ne}=C.current,Ie=l().useRef({..._}),Te=l().useRef(!1),Re=Et(S);g((()=>{Ae(),W()}),[T]),g((()=>{Oe()}),[Re,I,r,P.tableAutoHeight]),qe((()=>{dt(),ut(),mt(),M||(K&&rt(),Qe(a)),s&&ae(s),c&&ie(c)}),[a,o?.params]),qe((()=>{const e=Ue(_,Ie.current);e||M&&d?.clearableAfterFetched&&pt(),!e&&_[Bo.currentPageName]>1&&!o?.stopToFirst?rt():M&&Ye(),Ie.current=_}),[_]),qe((()=>{K&&lt(),z||Ee(),Ve()}),[k.current,k.pageSize]),qe((()=>{M||ke(O.length),W()}),[O]),qe((()=>{C.current.isTreeTable&&lt()}),[H]);const Oe=()=>{const{scrollBarRef:e,resizeState:t}=C.current,{width:n,height:r}=Re;W(),P.tableBodyWidth>n&&ee(!0),e.current.scrollLeft>0&&te(!0),ye(Object.assign({},t,{width:n,height:r}))},ke=e=>{e!==k.total&&J((t=>Object.assign({},t,{total:e})))},Pe=e=>{Te.current=e},Le=wt((e=>{et(),x?.(e)})),Ae=()=>{he(R.length>Bo.virtualScrollX)},Fe=(e=[])=>{let t=e.length>Bo.virtualScrollY;C.current.isTreeTable&&(t=!0),m?.virtual&&(t=!0),fe(t)},_e=e=>V?De(He(e,0)):e,De=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...De(e.children)),delete e.children,t.push(e)})),t},He=(e,t)=>{const r=i.groupItems?.[t];return r?ir(e,[r.dataIndex]).map((e=>{const a={children:He(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&Un(a,n.toString(),er()),r.titleIndex&&Un(a,r.titleIndex,Bn(e[0],r.titleIndex)),Un(a,r.dataIndex,Bn(e[0],r.dataIndex)),$.forEach((e=>{const{dataIndex:t}=e,n=a.children?.reduce(((e,n)=>{if(n[Bo.summaryIgnore])return e;const r=Number(Bn(n,t));return Number.isNaN(r)?e:e+r}),0);Un(a,t,n)})),a})):(e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e)},$e=e=>{ce(e),me((e=>{const{selectionRows:t,recordsMap:n}=C.current,r=new Map;t.forEach((e=>r.set(w(e,e.index),e)));const a=[];for(let t=0,i=e.length;t<i;t++){const i=r.get(e[t])||n.get(e[t]);i&&a.push(i)}return a})(e))},Me=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:D;let a=[];return C.current.isTreeTable&&!n&&r.forEach((e=>{a.push(...((e,t)=>{const{disabled:n}=d||{},{deriveRowKeys:r,recordsMap:a}=C.current,i=Hn(r,e);let l=[];if(!i)return l;let o=ze(i?.children||[]);return n&&(o=o.filter((e=>!a.has(e)||!n(a.get(e))))),l=[...new Set([...t,...o])],(or(r,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Hn(r,e),n=t?.children?.every((e=>l.includes(e.rowKey)));l=n?[...l,e]:l.filter((t=>t!==e))})),l})(e,r))})),a="radio"===t?r.slice(0,1):[...new Set([...r,...a])],a},Ke=e=>{const{isTreeTable:t,allRowKeys:n,allParentRowKeys:r,deriveRowKeys:a,recordsMap:i}=C.current,{defaultExpandAllRows:l,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:H;if(l)c=(t?r:n).slice(0);else if(t){s&&pe("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];q&&e.unshift(q),e.forEach((e=>{const t=or(a,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)})),c=[...new Set(c)]}return o&&c.filter((e=>{const t=i.get(e);return!!t&&o(t)})),c},ze=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...ze(e[n].children)),t.push(e[n].rowKey);return t},je=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...je(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...je(e,n[n.length-1])),n},Ve=wt((()=>{y?.(k,Be(L),We(A),F,{currentDataSource:it()})})),We=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Be=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,a]=n.split("|");t[Bo.showFilterType?`${r}|${a}`:r]=e[n]}return t},Ue=(e,t)=>{const n=Object.keys(Wn(e,t));return 1===n.length&&(n.includes(Bo.currentPageName)||n.includes(Bo.pageSizeName))},Ge=async()=>{if(!o)return;const{formatter:e=(e=>e),beforeFetch:t=ne,afterFetch:n,callback:r}=o;if(!t(_))return;const a=!!i?.fetch?.api;re(!0);try{const[t,l]=a?await Promise.all([o.api(e(_)),i.fetch.api(e(_))]):[await o.api(e(_))];if(C.current.unMounted)return;if(a?200===t.code&&200===l.code:200===t.code){const e=o.dataKey??Bo.dataKey;let a=(0,Q.get)(t.data,e)??[];a="function"==typeof n?await n(a):a;const i=(0,Q.get)(t.data,e.replace(/[^.]+$/,Bo.totalKey))||a.length||0,s=Math.max(Math.ceil(i/k.pageSize),1);if(_[Bo.currentPageName]>s)return tt({...k,current:s});Qe(Te.current?C.current.tableFullData.concat(a):a),ke(i),Ze(l?.data||t.data),r?.(t.data,t)}}catch(e){E?.(e)}var l;l=o,Object.prototype.hasOwnProperty.call(l,"stopToFirst")&&(o.stopToFirst=!1),re(!1),Pe(!1)},Ye=wt(Ge),Xe=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Xe(e.children)),e.index=t,h||(e.pageIndex=(e=>{const{current:t,pageSize:n}=k;return!M||z?e:(t-1)*n+e})(t)),e))),Qe=e=>{const t=_e(Xe(e));ot(t),st(t),$e(Me()),de(Ke()),Je(),v?.(t)},Ze=e=>{if(!j)return;const t=i?.fetch?.dataKey??Bo.summationKey,n=(t?(0,Q.get)(e,t):e)??{},r={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{Un(r,e.dataIndex,Number(Bn(n,e.summation.dataKey)))})),be(r)},Je=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=it();if(e.length){const t=w(e[0],e[0].index);$e([t])}else $e([])}},et=()=>{if(!z)return;const e=nt();Te.current||k.current>=e||(Pe(!0),tt({...k,current:k.current+1}))},tt=({current:e,pageSize:t})=>{J((n=>Object.assign({},n,{current:e,pageSize:t})))},nt=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},rt=()=>{tt(Object.assign({},k,{current:1}))},at=()=>{const{current:e,pageSize:t}=k;return C.current.tableFullData.slice((e-1)*t,e*t)},it=()=>K?at():C.current.tableFullData,lt=()=>{const{allTableData:e,isTreeTable:t}=C.current,n=K?qn(at()):e,r=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=w(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);H.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(n):n;Fe(r),Y(r)},ot=e=>{B(e),X(e),Z(e),ct(),lt()},st=e=>{U(e)},ct=()=>{Ce(),C.current.allTableData.forEach((e=>xe(w(e,e.index),e)))},dt=()=>{ae({})},ut=()=>{ie({})},mt=()=>{oe([])},pt=()=>{$e([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=se(p,["fetch"]);if(p.fetch){const{api:e,params:n,dataKey:r}=p.fetch;try{const a=await e(n);200===a.code&&(t=(r?(0,Q.get)(a.data,r):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:n=1,isPrint:r=1}=t;ve((t=>Object.assign({},t,{export:!!e,import:!!n,print:!!r})))}if(Array.isArray(t.fieldList)){const n=Ln(e.columns,(e=>{const{dataIndex:n}=e,r=t.fieldList.find((e=>e.dataIndex===n));if(r){const{visible:t=1,disabled:a,secretName:i}=r,l=An(C.current.originColumns,n);ge(n,{visible:t,disabled:a,secretName:i}),t||(e.noAuth=!0,l.noAuth=!0),i&&(e.formatType=`secret-${i}`,l.formatType=`secret-${i}`)}}));f?.(n)}})(),q&&N.current.setClickedValues([q,""]),"radio"===d?.type&&D.length&&N.current.setClickedValues([D[0],""]),Ae(),Fe(),M?Ge():Qe(a)},checkDataIndex:()=>{const e=R.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&pe("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:ot,getTableData:Ge,createTableList:it,createTableData:Qe,createGroupData:_e,createSelectionKeys:Me,createRowExpandedKeys:Ke,setSelectionKeysEffect:$e,findParentRowKeys:je,getAllChildRowKeys:ze,doFieldValidate:(e,t,n,r,a)=>{if(!Array.isArray(e))return pe("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ne.removeFromRequired({x:n,y:r}),Ne.removeFromValidate({x:n,y:r}),e.forEach((e=>{e.required&&le(t)&&Ne.addToRequired({x:n,y:r,text:e.message||a+Se("qm.form.requiredTips")}),"function"!=typeof e.validator||e.validator?.(t)||Ne.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:a}=Ne.state,i=(0,Q.intersection)(n,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:n.filter((e=>!i.includes(e))),updated:r.filter((e=>![...(0,Q.intersection)(r,n),...(0,Q.intersection)(r,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(C.current.tableFullData)},tableChange:Ve,toLastPage:()=>{const e=nt();k.current!==e&&tt(Object.assign({},k,{current:e}))},toFirstPage:rt,getPageCount:nt,pagerChangeHandle:tt,scrollBottomDebouncer:Le,clearTableSorter:dt,clearTableFilter:ut,clearSuperFilters:mt,clearRowSelection:pt,clearRowHighlight:()=>{ue("")},clearTableLog:()=>{Ne.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;we(),Ne.destroy(),e.deregister(t)}}};function Zo({handler:e,delay:t=0}){const n=Wt(e,t),r=Y(t>0?n:e);i.useEffect((()=>(window.addEventListener("resize",r),()=>window.removeEventListener("resize",r))),[r])}const Jo=e=>{const{total:t}=e,{tableRef:n,prefixCls:r,selectionKeys:a,isHeadSorter:i,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:m}=l().useContext(Ro),{infoBarConfig:p,rowSelection:h,rowHighlight:f}=n.current.props,{allTableData:g,invalidRowKeys:y}=n.current,{hideAlert:b,hideClearButton:v}=p||{},{t:x}=G(),E=l().useMemo((()=>!b),[b]),w=l().useMemo((()=>!v&&!!(i||o||h||f)),[v,i,o,h,f]),C={[`${r}__alert`]:!0};return E?l().createElement("div",{className:Ee()(C)},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.InfoCircleFilled,null)),l().createElement("span",null,x("qm.table.alert.total",{total:n.current.isTreeTable?g.length:t}),h?`,${x("qm.table.alert.selected",{total:Math.max(a.length-y.length,0)})}`:""),w&&l().createElement("em",{onClick:()=>{c(),d(),u(),m(),ae((()=>s()))}},x("qm.table.alert.clear"))):null},es=l().forwardRef(((e,t)=>{const{isFullScreen:n,open:r=!0}=e,{prefixCls:a,setFullScreen:i}=l().useContext(Ro),{t:o}=G(),s=()=>{i(!n)};return l().useImperativeHandle(t,(()=>({clickHandle:s}))),r?l().createElement("span",{className:`${a}-full-screen`,title:o(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},n?l().createElement(Ce.FullscreenExitOutlined,null):l().createElement(Ce.FullscreenOutlined,null))):null}));es.displayName="FullScreen";const ts=es,ns=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,getTableData:a}=l().useContext(Ro),{t:i}=G(),o=()=>{a()};return l().useImperativeHandle(t,(()=>({clickHandle:o}))),n?l().createElement("span",{className:`${r}-reload`,title:i("qm.table.refresh.text"),onClick:()=>o()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.ReloadOutlined,null))):null}));ns.displayName="Reload";const rs=ns,as=()=>{const e={dateFormat:e=>{const t=e?c()(e).format(Fo):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?c()(e).format(_o):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?c()(e).format(_o.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Yn(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Xn(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,n,r)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=n,c=a||s?.(r,n)?.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=Yn(d)?new(Ea())(d).toFixed(i):d),l>=0&&""!==d&&(d=Qn(d,l)),o){const t=e[`${ie(o)}Format`];t?d=t(d):pe("Table","字段的格式化类型 `formatType` 配置不正确")}return d},n=e=>J(e)?tr(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,a,i)=>{const l=Bn(e,r.dataIndex),o=r.render?r.render(l,e,r,a,i):t(l,r,e);return n(o)}}},is=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{global:a}=l().useContext(o),{tableRef:i,prefixCls:s,flattenColumns:c,summationRows:d,showSummary:u,getSpan:m}=l().useContext(Ro),{tablePrint:p,showHeader:h}=i.current.props,{t:f}=G(),{getTitleFromCellValue:g}=as(),y=a?.print?.leftLogo??"",b=a?.print?.rightLogo??"",v=!(!y&&!b),x=l().useMemo((()=>ce(Dn(n,[Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn]))),[n]),E=l().useMemo((()=>ce(Dn(c,[Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn]))),[c]),w=l().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),C=e=>{const t=Object.assign({},lr(x,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?C(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,n)=>{if(Array.isArray(e))return S(e.concat(n),t)}))))),N=()=>{const e=(e=>{const t=[];let n=[],r=0,a=0;for(;a<e.length;){const i=e[a];r+=i.width||i.renderWidth,r<=Bo.printWidth?(n.push(i),a===e.length-1&&t.push(n),a++):a>0?(e.splice(0,a),w.length&&e.unshift(...w),t.push(n),n=[],r=0,a=0):(i.width=Bo.printWidth,n.push(i),t.push(n),a++)}return t})([...E]),t=(e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(C(e))})),n=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const n=e.filter((e=>e.dataIndex===t));return n.length<=1?n[0]:S(n,"dataIndex")[0]})))(n),t.push(Mn(n))})),t})(e);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 r=0;r<e.length;r++)n+=I(t[r],e[r],i.current.tableFullData),n+='<div class="page-break"></div>';return n+"</body></html>"},I=(e,t,n)=>{const{showLogo:r=!0}=p;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,h&&(a+=["<thead>",r&&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:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${nr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(a+=`<tbody>${qn(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:a,colSpan:i}=m(e,t,e.index,r,n);return a&&i?`<td rowspan="${a}" colspan="${i}">${0===r&&e._level?`<span style="padding-left:${e._level*Bo.treeTable.textIndent}px"></span>`:""}${g(e,t,e.index,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),u&&d.length&&(a+=["<tfoot>",d.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(n):Bn(e,`${a}_text`);return`<td>${0===r&&""===l?f("qm.table.config.summaryText"):J(l)?tr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},T=()=>{((e,t)=>{const{filename:n,type:r,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!a)return Promise.resolve({type:r,content:t,blob:e});Pt(e,i)}})(0,N())?.then((({content:e,blob:t})=>{let n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),i.current.isIE?(n.contentDocument.write(e),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(t))}))};return l().useImperativeHandle(t,(()=>({clickHandle:T}))),r?l().createElement("span",{className:`${s}-print`,title:f("qm.table.print.text"),onClick:()=>T()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.PrinterOutlined,null))):null}));is.displayName="TablePrint";const ls=is,os=require("exceljs");var ss=r.n(os);const cs="606060",ds="thin",us="d4d4d4",ms=(e,t)=>{t&&(e.height=Math.floor(.75*t))},ps=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},hs=()=>({top:{style:ds,color:{argb:us}},left:{style:ds,color:{argb:us}},bottom:{style:ds,color:{argb:us}},right:{style:ds,color:{argb:us}}}),fs=e=>{const{children:t}=e;return t&&t.length?fs(t[0]):e},gs=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},ys=()=>{const{tableRef:e,getSpan:t,showSummary:n,isHeadGroup:r}=l().useContext(Ro),{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,{rowHeight:p}=e.current,h=On(u),f=Mn(u),g=[],y=[],b=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;E[t]=nr(e.title),b.push({key:t,width:(n||r||Bo.defaultColumnWidth)/8})})),i&&(r?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:a}=e,i=fs(e),l=h.findIndex((({dataIndex:e})=>e===i.dataIndex));n[i.dataIndex]=nr(e.title),0!==r&&(r>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+r-1}})})),g.push(n)})):(h.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&v.push({s:{r:x,c:t},e:{r:x+r-1,c:t+n-1}})})),g.push(E)),x+=g.length);const w=qn(s).map(((e,n)=>{const r={};return h.forEach(((i,l)=>{if("function"==typeof a){const{rowSpan:r,colSpan:a}=t(e,i,n,l,s);(a>1||r>1)&&v.push({s:{r:n+x,c:l},e:{r:n+x+r-1,c:l+a-1}})}const o=["percent","finance"].includes(i.formatType);r[i.dataIndex]=o?Bn(e,i.dataIndex):d(e,n,i,l)})),r._level=e._level,r}));x+=w.length,n&&m&&c(h,s).forEach(((e,t)=>{const n={};h.forEach(((t,r)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(s):Bn(e,a);n[a]=0===r&&""===l?o("qm.table.config.summaryText"):J(l)?tr(l).join(""):l})),y.push(n)}));const{sheetName:C,useStyle:S}=l,N=new(ss().Workbook),I=N.addWorksheet(C);I.columns=b,i&&I.addRows(g).forEach((e=>{S&&ms(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),n=An(u,t.key),{align:r,theadAlign:a}=n;ps(e,a||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:cs}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:hs()})}))})),I.addRows(w).forEach(((e,t)=>{const{_level:n}=w[t];S&&ms(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),r=An(u,t.key),{align:a}=r;ps(e,a),Object.assign(e,gs(r)),S&&Object.assign(e,{font:{color:{argb:cs}},border:hs()}),1===Number(e.col)&&n&&(e.alignment={...e.alignment,indent:n})}))})),n&&m&&I.addRows(y).forEach((e=>{S&&ms(e,p),e.eachCell((e=>{const t=I.getColumn(e.col),n=An(u,t.key),{align:r}=n;ps(e,r),Object.assign(e,gs(n)),S&&Object.assign(e,{font:{color:{argb:cs}},border:hs()})}))})),v.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 n=e=>{let t=e;const n=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),r=-1!==e.indexOf('"');return r&&(t=t.replace(/"/g,'""')),(n||r)&&(t='"'+t+'"'),t},r="\ufeff"+(e=>{let t,r,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],r=0;r<a.cells.length;r+=1)i=a.cells[r],l=l+(r?",":"")+n(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,n)=>{t=t||"",n=n||512;const r=window.atob(e),a=[];let i;for(i=0;i<r.length;i+=n){const e=r.slice(i,i+n),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=r,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:n,file:r}=e,a=On(n),i=new FileReader;i.onerror=()=>{O.message.error(o("qm.table.import.error"))},i.onload=e=>{const n=a.map((e=>nr(e.title))),r=new(ss().Workbook),i=e.target;i?r.xlsx.load(i.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,l);if(c){const r=e.slice(i+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,Q.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,Q.isDate)(r)&&(r=Jn(r,_o)),r?.formula&&(r=r.result??r.value),t[l[n]]=r}));const r={};return n.forEach(((e,n)=>{const{dataIndex:i,dictItems:l}=a[n];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])),Un(r,i,t[e])})),r}));t?.(r)}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(r)}}},bs=e=>{const{fileType:t,onChange:n}=e,{prefixCls:r}=l().useContext(Ro),{t:a}=G();let i,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}};return l().createElement(ge,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return i||(i=document.createElement("form"),o=document.createElement("input"),i.className=`${r}--file-form`,o.name="file",o.type="file",i.appendChild(o),document.body.appendChild(i)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(O.message.warning(a("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(i),i=null,o=null},i.reset(),o.click()}))})({type:t});n?.(e.name,e)}catch(e){}})()},a("qm.upload.text"))},vs=e=>{const{columns:t,onClose:n}=e,{tableRef:r,prefixCls:a,createTableData:i,dataChange:o}=l().useContext(Ro),{beforeTableImport:s}=r.current.props,{t:c}=G(),{importXLSX:d}=ys(),u=l().useRef(null),[m,p]=l().useState(!1),[h,f]=l().useState(!0),g=e=>e.filter((e=>![Bo.expandableColumn,Bo.selectionColumn,"index","pageIndex",Bo.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:n}=t.GET_FIELDS_VALUE(["fileName"]);return l().createElement(l().Fragment,null,n?l().createElement("span",null,n):l().createElement(bs,{fileType:t.state.formData.fileType,onChange:(e,n)=>{t.SET_FIELDS_VALUE({fileName:e,file:n}),n&&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:r.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(zl,{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(ge,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(ge,{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}=r.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 n=a.posIndex,r=t.slice(0,n).concat(e).concat(t.slice(n));i(r)}e.forEach((e=>{l.addToInserted(e)})),o(),O.message.success(c("qm.table.import.success",{total:e.length})),p(!1),n()})))})()},c("qm.table.import.text"))))},xs=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!0}=e,{prefixCls:a}=l().useContext(Ro),{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,r&&l().createElement("span",{className:Ee()(d),title:i("qm.table.import.textNoSpace"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.ImportOutlined,null))),l().createElement(mn,u,l().createElement(vs,{columns:n,onClose:()=>s(!1)})))}));xs.displayName="TableImport";const Es=xs,ws=e=>{const{columns:t,onChange:n}=e,{prefixCls:r,$size:a}=l().useContext(Ro),{t:i}=G(),o=l().useRef([]),[s,c]=l().useState(!1),[d,u]=l().useState(t);qe((()=>{p()}),[d]),l().useEffect((()=>{m()}),[t]);const m=()=>{const e=[];t.forEach(((n,r)=>{const a=n.colSpan;a>1&&t.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&e.push(t.slice(r,r+a))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const a=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===a)return e.push(t);e.push(...o.current[a].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),n?.(e)},h={[`${r}__popper`]:!0,"column-filter__popper":!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a},f=[`${r}-column-filter`,{selected:s}];return l().createElement(za(),{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(ca.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:d,setList:e=>{const t=e.map((e=>e.dataIndex)),n=d.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||u(dr(e))}},d.map((e=>((e,t)=>{const{colSpan:n}=e;if(0===n)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const r=["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:n}=t.target;e.hidden=!n,u([...d])}}),l().createElement("i",{className:Ee()(r),title:i("qm.table.columnFilter.draggable")},l().createElement(Ce.HolderOutlined,null)),l().createElement("span",{className:"text"},nr(e.title)))})(e)))))),popupClassName:Ee()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:Ee()(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"))))},Cs=e=>{const{defaultValue:t,onClose:n,onOk:r}=e,{tableRef:a,prefixCls:i,selectionKeys:o,pagination:s,showSummary:d}=l().useContext(Ro),{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(Do)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:d?1:0,useStyle:0},t,{columns:ce(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(ws,{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(zl,{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(ge,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.export.closeButton")),l().createElement(ge,{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]);r(t),await re(1e3),f(!1),n()}})()},m("qm.table.export.text"))))},Ss=l().forwardRef(((e,t)=>{const{tableColumns:n,open:r=!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(Ro),{exportExcel:y,fetch:b,showHeader:v}=i.current.props,{t:x}=G(),{getTitleFromCellValue:E}=as(),[w,C]=l().useState(!1),[S,N]=l().useState(!1),I=l().useMemo((()=>!!y?.fetch?.api),[y]),T=l().useMemo((()=>!u.total||S),[u.total,S]),R=l().useMemo((()=>Dn(n,[Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn])),[n]),k=l().useMemo((()=>Dn(d,[Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn])),[d]),P=(e,t="",n=0)=>e.map(((e,r)=>{const a={...e,index:r,pageIndex:r},i=t?`${t}.${a.index+1}`:`${a.index+1}`;return a.indexPath=i,a._level=n,Array.isArray(e.children)&&(a.children=P(e.children,i,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&Un(a,t,Bn(a,t))})),a})),L=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,a=(h?rr(t):t).reduce(((e,t)=>{if(t?.[Bo.summaryIgnore])return e;const n=Number(Bn(t,r));return Number.isNaN(n)?e:e+n}),0);Un(n,r,a)})),[n]},A=(e,t,n,r)=>{const{precision:a,formatType:i}=n;let l=E(e,n,t,r);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:F,exportCSV:_}=ys(),D=async e=>{const{api:t,formatter:n=(e=>e),afterFetch:r,dataKey:a}=b;let i=[];try{N(!0);const l=await t({...n(m),[Bo.currentPageName]:1,[Bo.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 r?await r(e):e,i=P(e)}}catch(e){}return N(!1),i},H=e=>{const t=a?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},q=y?.fileName??`${c()().format(Do)}.xlsx`,$=q.slice(q.lastIndexOf(".")+1).toLowerCase(),M=()=>{if(T)return O.message.warning(x("qm.table.export.warnText"));I?(async e=>{N(!0);try{const{api:t,params:n}=y.fetch,r=await t({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:a}=e.filter||{};return{title:t,dataIndex:n,type:a,hidden:r}})),...m,...n,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[Bo.currentPageName]:void 0,[Bo.pageSizeName]:void 0});r.data&&(Pt(r.data,e),H(e))}catch(e){}N(!1)})(q):C(!0)};l().useImperativeHandle(t,(()=>({clickHandle:M})));const K={[`${s}-export`]:!0},z={visible:w,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},j={fileName:q.slice(0,q.lastIndexOf(".")),fileType:$,columns:R,useStyle:y?.cellStyle?1:0};return l().createElement(l().Fragment,null,r&&l().createElement("span",{className:Ee()(K),title:x("qm.table.export.textNoSpace"),onClick:()=>M()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.DownloadOutlined,null))),l().createElement(mn,z,l().createElement(Cs,{defaultValue:j,onClose:()=>C(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:n,exportType:r,startIndex:a=1,endIndex:l}=e,{tableFullData:o,selectionRows:s}=i.current;let c=[];if(p?("all"===r&&(c=await D()),"custom"===r&&(c=await D(l),c=c.slice(a-1))):("all"===r&&(c=o.slice(0)),"custom"===r&&(c=o.slice(a-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof y?.beforeExport)try{c=y?.beforeExport(c)}catch(e){}if("xlsx"===n){const n=await F(e,c,L,A);Pt(n,`${t}.xlsx`),H(`${t}.xlsx`)}if("csv"===n){const n=_(e,((e,t)=>{const{columns:n,footSummation:r}=e,a=Mn(n),i=On(n);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,v&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${nr(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${qn(t).map((e=>`<tr>${i.map(((n,r)=>{const{rowSpan:a,colSpan:i}=g(e,n,e.index,r,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${A(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(l+=["<tfoot>",L(i,t).map((e=>`<tr>${i.map(((n,r)=>{const{dataIndex:a,summation:i}=n,l=i?.render?i.render(t):Bn(e,a);return`<td>${0===r&&""===l?x("qm.table.config.summaryText"):J(l)?tr(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));Pt(n,`${t}.csv`),H(`${t}.csv`)}})(Object.assign({},e,{columns:kn(e.columns)}))}})))}));Ss.displayName="TableExport";const Ns=Ss,Is=e=>{const{columns:t,onClose:n}=e,{tableRef:r,tableBodyRef:a,prefixCls:i,dataChange:o}=l().useContext(Ro),{beforeClipboard:s}=r.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:nr(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(zl,{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(ge,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.export.closeButton")),l().createElement(ge,{type:"primary",loading:p,onClick:()=>(async()=>{const[e,i]=await d.current.GET_FORM_DATA();if(e)return;const{tableFullData:l,store:u,fieldAuth:m}=r.current;h(!0);const p=i.content.trim().replace(/(\r|\n)$/,"");let f=p.replace(/"[^"]+"/g,"^");(p.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{f=f.replace(/\^/,e)}));let g=f.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{g=await s(g,g[0].map(((e,n)=>t[i.colIndex+n].dataIndex)))}catch(e){}g.forEach(((e,n)=>{e.forEach(((e,r)=>{const a=l[i.rowIndex-1+n],o=t[i.colIndex+r];if(a&&o){let t=!1;if(o.editRender){const e=o.editRender(a,o);t=!(e.disabled||e.extra?.disabled||m[o.dataIndex]?.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&(Un(a,o.dataIndex,e),u.addToUpdated(a))}}))})),a.current.forceUpdate(),o(),O.message.success(c("qm.table.clipboard.success",{total:g.length})),h(!1),n()})()},c("qm.table.clipboard.text"))))},Ts=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,flattenColumns:a}=l().useContext(Ro),{t:i}=G(),[o,s]=l().useState(!1),c=l().useMemo((()=>(e=>e.filter((e=>![Bo.expandableColumn,Bo.selectionColumn,"index","pageIndex",Bo.operationColumn].includes(e.dataIndex))))(a)),[a]),d=()=>{s(!0)};l().useImperativeHandle(t,(()=>({clickHandle:d})));const u={[`${r}-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,n&&l().createElement("span",{className:Ee()(u),title:i("qm.table.clipboard.textNoSpace"),onClick:()=>d()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.CopyOutlined,null))),l().createElement(mn,m,l().createElement(Is,{columns:c,onClose:()=>s(!1)})))}));Ts.displayName="TableClipboard";const Rs=Ts,Os=e=>{const{columns:t,onClose:n}=e,{tableRef:r,$size:a,selectionKeys:i,setSelectionKeysEffect:o}=l().useContext(Ro),{rowKey:s,rowSelection:c}=r.current.props,{t:d}=G(),u=l().useRef(null),m=Et(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=>![Bo.expandableColumn,Bo.selectionColumn,"index","pageIndex",Bo.operationColumn].includes(e.dataIndex))))]),[y]=l().useState((()=>{const{disabled:e}=c||{},t=r.current.selectionRows.map((e=>({...e,children:void 0})));return e?t.filter((t=>!e(t))):t})()),[b,v]=l().useState(300),x=wt((()=>{const e=u.current;v(e.offsetHeight-2*ka[a]-30)}),5);return g((()=>{x()}),[m.width]),l().createElement("div",{ref:u,style:{height:"100%"}},l().createElement(ud,{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(ge,{onClick:()=>n()},d("qm.table.selectCollection.closeButton"))))},ks=l().forwardRef(((e,t)=>{const{columns:n,open:r=!0}=e,{tableRef:a,getRowKey:i,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=l().useContext(Ro),{rowSelection:p}=a.current.props,{t:h}=G(),[f,g]=l().useState(!1),y=l().useRef(!1);qe((()=>{!y.current&&b()}),[d]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=p;if(c&&e)try{const n=await e.api(Object.assign({},{selectedKeys:s},e.params));if(200===n.code){let r=Array.isArray(n.data)?n.data:(0,Q.get)(n.data,e.dataKey)??[];r=r.filter((e=>!t(e))),u(r.map(((e,t)=>i(e,t)))),m(r),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,r&&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(mn,x,l().createElement(Os,{columns:n,onClose:()=>g(!1)})))}));ks.displayName="SelectCollection";const Ps=ks,Ls=require("localforage");var As=r.n(Ls);const Fs=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,getRowKey:a,prefixCls:i,$size:s,tableFlatData:c,flattenColumns:d,pagination:u,setPagination:m,scrollYToRecord:p,setHighlightKey:h,setShouldToTop:f,isWebPagination:g}=l().useContext(Ro),{uniqueKey:y}=r.current.props,{t:b}=G(),v=l().useRef(null),x=l().useRef(null),E=l().useRef([]),w=l().useRef(""),C=l().useRef(-1),S=l().useRef("stop");qe((()=>{const e=c.findIndex((e=>a(e,e.index)===w.current));p("",e)}),[u.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:nr(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:e.dictItems??[]},onChange:async()=>{const[e,t]=await v.current.GET_FORM_DATA(),[n,r]=await x.current.GET_FORM_DATA(),a=(0,Q.omitBy)(Object.assign({},t,r),le);P(a)}}))),T={case:0,fullchar:0},R=l().useMemo((()=>d.filter((e=>![Bo.expandableColumn,Bo.selectionColumn,"index","pageIndex",Bo.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[d]),[k,P]=l().useState({}),[L,A]=l().useState(T),[F]=l().useState(I([R[0]])),[_]=l().useState(I(R.slice(1))),[D,H]=l().useState(0),q=l().useMemo((()=>!Object.keys(k).length),[k]);qe((()=>{S.current="ready"}),[k,L]);const $=e=>{A(Object.assign({},L,e))},M=(e,t,n)=>new Promise(((r,a)=>{O.Modal.confirm({title:b("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),K=async e=>{if(!Object.keys(k).length)return O.Modal.warning({title:b("qm.button.confirmPrompt"),content:b("qm.table.fastSearch.queryCondition")});if("ready"===S.current&&(S.current="stop",E.current=(e=>{const{allTableData:t}=r.current,n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];let l=!0;for(const t in e){const{type:n}=R.find((e=>e.dataIndex===t)).filter;let r=Bn(i,t),o=!0;if("text"===n||"textarea"===n?o=new RegExp(L.fullchar?`^${e[t]}$`:e[t],L.case?"":"i").test(r):(r="string"==typeof(a=r)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(a)?r.slice(0,10):r,o=r==e[t]),!o){l=!1;break}}l&&n.push(i)}var a;return n})(k),H(E.current.length)),!E.current.length)return h(""),O.Modal.warning({title:b("qm.button.confirmPrompt"),content:b("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>E.current.length-1&&await M(b("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=E.current.length-1))),"prev"===e&&(C.current=C.current<0?E.current.length-1:C.current-1,C.current<0&&await M(b("qm.table.fastSearch.toStart"),(()=>C.current=E.current.length-1),(()=>C.current=0)));const{isTreeTable:t,tableFullData:n,deriveRowKeys:i}=r.current,l=E.current[C.current],o=a(l,l.index);let s=l.index;if(t&&g){const e=or(i,o)[0];s=n.findIndex((t=>a(t,t.index)===e))}((e,t)=>{if(w.current=e,g){const{pageSize:e}=u,n=Math.ceil((t+1)/e);f(!1),m(Object.assign({},u,{current:n}))}else p(e)})(o,s),h(o)},z=()=>{v.current.RESET_FORM(),x.current.RESET_FORM()},j=l().useMemo((()=>y?`fastSearch_${y}`:""),[y]),[V,W]=l().useState([]),[B,U]=l().useState(""),[Y,X]=l().useState("");qe((()=>{if(Y){const{filters:e,config:t}=V.find((e=>e.value===Y)).list;v.current.SET_FIELDS_VALUE(se(e,_.map((e=>e.fieldName)))),x.current.SET_FIELDS_VALUE(se(e,F.map((e=>e.fieldName)))),P(e),A(t)}else z(),P({}),A(T)}),[Y]),l().useEffect((()=>{Z()}),[]);const Z=async()=>{if(!j)return;let e=await As().getItem(j);e||(e=await J(j),Array.isArray(e)&&await As().setItem(j,e)),Array.isArray(e)&&e.length&&(W(e),X(e[0].value))},J=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},ee=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[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(tn,{defaultActiveKey:"1",size:"small",tabBarExtraContent:l().createElement("span",null,b("qm.table.alert.total",{total:D}))},l().createElement(tn.TabPane,{tab:b("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},l().createElement(zl,{ref:v,items:F,cols:1,labelWidth:110})),l().createElement(tn.TabPane,{tab:b("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},l().createElement(zl,{ref:x,items:_,cols:1,labelWidth:110})))),l().createElement("div",{className:"saved line"},l().createElement("div",{className:"form-wrap"},l().createElement(O.Input,{size:s,value:B,placeholder:b("qm.table.highSearch.configText"),disabled:q,onChange:e=>{const{value:t}=e.target;U(t)}}),l().createElement(ge,{type:"primary",disabled:!B||q,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!j)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=er(),t=[...V,{text:B,value:e,list:{filters:k,config:L}}];W(t),X(e),U(""),await As().setItem(j,t),await ee(j,t)})()},b("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${Bo.rowHeightMaps[s]}px`}},l().createElement("span",null,b("qm.table.fastSearch.savedSetting"))),l().createElement("ul",null,V.map((e=>l().createElement("li",{key:e.value,className:Ee()({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:b("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=V.filter((t=>t.value!==e));W(t),e===Y&&X(""),await As().setItem(j,t),await ee(j,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!V.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ut,null)))))),l().createElement("div",{className:"bottom"},l().createElement("div",null,l().createElement(O.Checkbox,{checked:!!L.case,onChange:e=>$({case:e.target.checked})},b("qm.table.fastSearch.matchCase")),l().createElement(O.Checkbox,{checked:!!L.fullchar,onChange:e=>$({fullchar:e.target.checked})},b("qm.table.fastSearch.matchFullchar"))),l().createElement("div",null,l().createElement(ge,{onClick:()=>z()},b("qm.table.fastSearch.clear"))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${ka[s]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>t(),style:{marginRight:8}},b("qm.table.fastSearch.closeButton")),l().createElement(ge,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},b("qm.table.fastSearch.queryPrev")),l().createElement(ge,{type:"primary",onClick:()=>K("next")},b("qm.table.fastSearch.queryNext"))))},_s=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r,$size:a}=l().useContext(Ro),{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:`${ka[a]+20}px`},onClose:()=>s(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${r}-super-search`,title:i("qm.table.fastSearch.text"),onClick:()=>c()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.MonitorOutlined,null))),l().createElement(mn,d,l().createElement(Fs,{onClose:()=>s(!1)})))}));_s.displayName="FastSearch";const Ds=_s,Hs=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{tableRef:r,prefixCls:a,flattenColumns:i}=l().useContext(Ro),{rowKey:o,uniqueKey:s}=r.current.props,{t:c}=G(),{tableFullData:d}=r.current,[u,m]=l().useState(!1),p=()=>{m(!0)};l().useImperativeHandle(t,(()=>({clickHandle:p})));const h={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return l().createElement(l().Fragment,null,n&&l().createElement("span",{className:`${a}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>p()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.LineChartOutlined,null))),l().createElement(mn,h,l().createElement(ep,{fromTable:!0,rowKey:o,uniqueKey:s,columns:i,dataSource:d})))}));Hs.displayName="PivotGrid";const qs=Hs,$s=e=>{const{columns:t,group:n,summary:r}=e,{tableRef:a,$size:i,pagination:o,fetchParams:s,isFetch:d}=l().useContext(Ro),{fetch:u}=a.current.props,{t:m}=G(),p=e=>{const n=t.find((t=>t.dataIndex===e));return{title:n.title,precision:n.precision,dictItems:n.dictItems??[]}},h=n.map((e=>({dataIndex:e.group,...p(e.group)}))),f=r.map((e=>e.summary===Bo.groupSummary.total.value?{dataIndex:e.summary,title:Bo.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...p(e.summary),formula:e.formula})),g=l().useMemo((()=>Object.assign({},s,{[Bo.sorterFieldName]:void 0,[Bo.groupSummary.summaryFieldName]:r.map((e=>`${e.formula}|${e.summary}`)).join(","),[Bo.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[Bo.currentPageName]:1})),[s,n,r]),[y,b]=l().useState(((e,n)=>[{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}))),...n.map((e=>{const n=t.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let r=n?{summation:n}:null;return e.dataIndex===Bo.groupSummary.total.value&&(r={dataIndex:Bo.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?r:null}}))])(h,f)),[v]=l().useState(d?[]:(e=>{const t=ir(e,n.map((e=>e.group))),a=[];return t.forEach((e=>{const t={};y.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&Un(t,r,Bn(e[0],r))})),r.forEach((n=>{const r=n.summary!==Bo.groupSummary.total.value?n.summary:Bo.groupSummary.recordTotalIndex,a=n.formula;"count"===a&&Un(t,r,e.length),"sum"===a&&Un(t,r,(0,Q.sumBy)(e,r)),"max"===a&&Un(t,r,(0,Q.maxBy)(e,r)[r]),"min"===a&&Un(t,r,(0,Q.minBy)(e,r)[r]),"avg"===a&&Un(t,r,((0,Q.sumBy)(e,r)/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(Do)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>b(e)};return l().createElement(ud,x)},Ms=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,prefixCls:a,$size:i,flattenColumns:s}=l().useContext(Ro),{uniqueKey:c}=r.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("");qe((()=>{if(v){const{group:e,summary:t}=f.find((e=>e.value===v)).list;T(e),L(t)}else{const e=D();T(e?.group||[]),L(e?.summary||[])}}),[v]),l().useEffect((()=>{H()}),[]);const E=l().useMemo((()=>c?`summary_${c}`:""),[c]),w=l().useMemo((()=>s.filter((e=>![Bo.expandableColumn,Bo.selectionColumn,"index","pageIndex",Bo.operationColumn].includes(e.dataIndex)))),[s]),C=w.filter((e=>!e.groupSummary)).map((e=>({text:nr(e.title),value:e.dataIndex}))),S=[Bo.groupSummary.total,...w.filter((e=>!!e.groupSummary)).map((e=>({text:nr(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"}],[I,T]=l().useState([]),[R,k]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(ge,{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:C.map((e=>({...e,disabled:I.findIndex((t=>t.group===e.value))>-1})))})}]),[P,L]=l().useState([]),[A,F]=l().useState([{title:d("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(ge,{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:P.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===Bo.groupSummary.total.value?N.slice(N.length-1):N})}]),_=l().useMemo((()=>{const e=I.length&&I.every((e=>Object.values(e).every((e=>""!==e)))),t=P.length&&P.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[I,P]),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:n}=e;T(t),L(n)}let t=await As().getItem(E);t||(t=await q(E),Array.isArray(t)&&await As().setItem(E,t)),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},$=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[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(ud,{ref:u,size:i,columns:R,dataSource:I,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>k(e),onDataChange:e=>{T(e)}},l().createElement(ge,{type:"primary",icon:l().createElement(Ce.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),l().createElement("div",{className:"container line"},l().createElement(ud,{ref:m,size:i,columns:A,dataSource:P,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>F(e),onDataChange:e=>{L(e)}},l().createElement(ge,{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(ge,{type:"primary",disabled:!y||_,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=er(),t=[...f,{text:y,value:e,list:{group:I.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))}}];g(t),x(e),b(""),await As().setItem(E,t),await $(E,t)})()},d("qm.table.groupSummary.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${Bo.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:Ee()({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 As().setItem(E,t),await $(E,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!f.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ut,null)))))),l().createElement(mn,M,l().createElement($s,{columns:w,group:I,summary:P})),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(ge,{onClick:()=>t(),style:{marginRight:8}},d("qm.table.groupSummary.closeButton")),l().createElement(ge,{type:"primary",disabled:_,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:I.filter((e=>!!e.group)),summary:P.filter((e=>!!e.summary))})),void h(!0))},d("qm.table.groupSummary.confirmButton"))))},Ks=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ro),{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,n&&l().createElement("span",{className:`${r}-group-summary`,title:a("qm.table.groupSummary.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.PieChartOutlined,null))),l().createElement(mn,c,l().createElement(Ms,{onClose:()=>o(!1)})))}));Ks.displayName="GroupSummary";const zs=Ks,js=e=>{const{onClose:t}=e,{global:n}=l().useContext(o),{tableRef:r,$size:a,prefixCls:i,flattenColumns:s,setSuperFilters:c,clearTableFilter:d}=l().useContext(Ro),{uniqueKey:u}=r.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("");qe((()=>{f(x?g.find((e=>e.value===x)).list:D()||[])}),[x]),l().useEffect((()=>{H()}),[]);const w=l().useMemo((()=>u?`superSearch_${u}`:""),[u]),C=l().useMemo((()=>s.filter((e=>!!e.filter))),[s]),S=ar(h),N=l().useMemo((()=>!(S&&Tn(S))),[S]),I=l().useMemo((()=>!!h.length&&N),[h,N]),T=[{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:nr(e.title)}))),k=e=>["in","nin"].includes(e),P=(e,t)=>{let n;switch(e){case"number":n="number";break;case"date":n="date";break;case"checkbox":case"radio":n=t?"select-multiple":"select";break;default:n="text"}return n},L=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},[A,F]=l().useState([{title:m("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,t)=>l().createElement("div",null,l().createElement(ge,{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 n=Object.values(t)[0],r=C.find((e=>e.dataIndex===n))?.filter.type,a=L(r);e.fieldType=r,e.expression=n?a[0]?.value:"",e.condition=k(e.expression)?[]:"",n||(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=C.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:L(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=k(e.expression)?[]:""}}}},{title:m("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName)),n=t?.filter.type,r=t?.filter?.items??t?.dictItems??[];return{type:P(n,k(e.expression)),editable:!0,items:r,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:T,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{w&&sessionStorage.setItem(w,JSON.stringify(h.filter((e=>!!e.fieldName))))},D=()=>{if(!w)return;const e=sessionStorage.getItem(w);return e?JSON.parse(e):null},H=async()=>{if(!w)return;const e=D();e&&f(e);let t=await As().getItem(w);t||(t=await q(w),Array.isArray(t)&&await As().setItem(w,t)),Array.isArray(t)&&t.length&&(y(t),!e&&E(t[0].value))},q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},$=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[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(ud,{ref:p,size:a,columns:A,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:n}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(n)&&("bracketLeft"===n&&(e[n]=e[n]?"":"("),"bracketRight"===n&&(e[n]=e[n]?"":")"),f([...h]))},onDataChange:e=>{f(e)}},l().createElement(ge,{type:"primary",icon:l().createElement(Ce.PlusOutlined,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),Bo.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(ge,{type:"primary",disabled:!b||N,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!w)return pe("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=er(),t=[...g,{text:b,value:e,list:h.filter((e=>!!e.fieldName))}];y(t),E(e),v(""),await As().setItem(w,t),await $(w,t)})()},m("qm.table.highSearch.saveButton"))),l().createElement("div",{className:"card-wrap"},l().createElement("h5",{style:{height:`${Bo.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:Ee()({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 As().setItem(w,t),await $(w,t)})(e.value)}},l().createElement(Ce.CloseCircleOutlined,null))))),!g.length&&l().createElement("div",{style:{padding:Po}},l().createElement(ut,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(ge,{onClick:()=>t(),style:{marginRight:8}},m("qm.table.highSearch.closeButton")),l().createElement(ge,{type:"primary",disabled:I,onClick:()=>(d(),c(h.map((e=>se(e,["index","pageIndex"])))),_(),void t())},m("qm.table.highSearch.searchButton"))))},Vs=l().forwardRef(((e,t)=>{const{open:n=!0}=e,{prefixCls:r}=l().useContext(Ro),{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,n&&l().createElement("span",{className:`${r}-super-search`,title:a("qm.table.highSearch.text"),onClick:()=>s()},l().createElement("i",{className:"svgicon icon"},l().createElement(Ce.FunnelPlotOutlined,null))),l().createElement(mn,c,l().createElement(js,{onClose:()=>o(!1)})))}));Vs.displayName="SuperSearch";const Ws=Vs,Bs=l().forwardRef(((e,t)=>{const{tableColumns:n,showFullScreen:r,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(Ro),{uniqueKey:w,exportExcel:C}=b.current.props,{t:S}=G(),N=l().useRef(null),I=l().useRef(null),T=l().useRef(null),R=l().useRef(null),k=l().useRef(null),P=l().useRef(null),L=l().useRef(null),A=l().useRef(null),F=l().useRef(null),_=l().useRef(null),D=l().useRef(null),H=l().useRef(!1),q=l().useMemo((()=>w?`toolBox_${w}`:""),[w]),[$,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:r,reload:a,print:i,import:s,export:c&&!C?.hideIcon,clipboard:d,collection:u,fastSearch:m,superSearch:p,pivotGrid:h,groupSummary:f},[z,j]=l().useState(!1);qe((()=>{H.current&&(W(),H.current=!1)}),[$]),l().useEffect((()=>{V()}),[]),l().useImperativeHandle(t,(()=>({exportHandle:()=>{if(!k.current)return pe("Table","执行导出需要配置 `exportExcel` 参数");k.current.clickHandle()}})));const V=()=>{if(!q||!g)return;const e=JSON.parse(localStorage.getItem(q));e||B(q).then((e=>{e&&(M(Object.assign({},$,e)),localStorage.setItem(q,JSON.stringify(e)))})).catch((()=>{})),e&&M(Object.assign({},$,e))},W=()=>{if(!q||!g)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(q,JSON.stringify(e)),U(q,e)},B=async e=>{const t=y?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},U=async(e,t)=>{const n=y?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}},Y=async e=>{j(!1),await re(100),e.current.clickHandle()},X=(e,t)=>{H.current=!0,M(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${x}--lg`]:"large"===v,[`${x}--sm`]:"small"===v};return l().createElement(l().Fragment,null,r&&l().createElement(ts,{ref:N,isFullScreen:E,open:!g||$.fullScreen}),a&&l().createElement(rs,{ref:I,open:!g||$.reload}),i&&l().createElement(ls,{ref:T,tableColumns:n,open:!g||$.print}),s&&l().createElement(Es,{ref:R,tableColumns:n,open:!g||$.import}),c&&l().createElement(Ns,{ref:k,tableColumns:n,open:(!g||$.export)&&!C?.hideIcon}),d&&l().createElement(Rs,{ref:P,open:!g||$.clipboard}),u&&l().createElement(Ps,{ref:L,columns:n,open:!g||$.collection}),m&&l().createElement(Ds,{ref:A,open:!g||$.fastSearch}),h&&l().createElement(qs,{ref:F,open:!g||$.pivotGrid}),f&&l().createElement(zs,{ref:_,open:!g||$.groupSummary}),p&&l().createElement(Ws,{ref:D,open:!g||$.superSearch}),g&&l().createElement(O.Dropdown,{open:z,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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:$.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(I)},{key:"print",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(T)},{key:"import",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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:$.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(k)},{key:"clipboard",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(P)},{key:"collection",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(L)},{key:"fastSearch",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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(A)},{key:"pivotGrid",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),l().createElement("span",null,S("qm.table.pivotGrid.text"))),onClick:()=>Y(F)},{key:"groupSummary",label:l().createElement(l().Fragment,null,l().createElement(O.Checkbox,{checked:$.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:$.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:Ee()(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)))))}));Bs.displayName="ToolBox";const Us=Bs,Gs=(e,t)=>e.map((e=>(e.children&&(e.children=Gs(e.children,t)),t(e)))),Ys=l().forwardRef(((e,t)=>{const{columns:n}=e,{global:r}=l().useContext(o),{tableRef:a,prefixCls:i,$size:s}=l().useContext(Ro),{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)))(n)),[n]),b=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(n)),[n]),v=l().useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(n)),[n]),x=l().useMemo((()=>d?`table_${d}`:""),[d]);qe((()=>{w(n)}),[n]),l().useLayoutEffect((()=>{C()}),[]),l().useImperativeHandle(t,(()=>({initialHandler:C})));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}})),w=e=>{if(!x)return;const t=E(e),n=JSON.parse(localStorage.getItem(x));a.current.columnsDefined&&!(0,Q.isEqual)(t,n)&&(localStorage.setItem(x,JSON.stringify(t)),(async(e,t)=>{const n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(x,t))},C=()=>{const e=(()=>{if(!x)return;const e=JSON.parse(localStorage.getItem(x));return e||(async e=>{const t=r?.getComponentConfigApi;if(t)try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}})(x).then((e=>{e?(localStorage.setItem(x,JSON.stringify(e)),C()):r?.getComponentConfigApi&&w(n)})).catch((()=>{})),e?(0,Q.xor)(Pn(e).map((e=>e.dataIndex)),Pn(n).map((e=>e.dataIndex))).length>0?Gs(n,(t=>{const n=An(e,t.dataIndex);return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Gs(e,(e=>{const t=An(n,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(((n,r)=>{const a=n.colSpan;a>1&&e.slice(r+1,r+a).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+a))})),t},N=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:a}=n;if(0===r)return;if(1===r)return t.push(n);const i=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(a)));if(-1===i)return t.push(n);t.push(...h.current[i].map((({dataIndex:t},r)=>{const a=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(a.hidden=n.hidden),void 0!==n.fixed?a.fixed=n.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),m?.(t)},I=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,N(n))},T=(e,t)=>{const{colSpan:r,noFixed:a}=e;if(0===r)return l().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=nr(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:r}=t.target;e.hidden=!r,N(n)}}),l().createElement("i",{className:Ee()(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:Ee()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>I(e,"left")},l().createElement(Ce.StepBackwardOutlined,null)),l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},l().createElement(Ce.StepForwardOutlined,null))):"sub"!==t?l().createElement("span",{className:Ee()("fixed",a?"disabled":"")},l().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>I(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(ca.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:r=>{const a=r.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,Q.isEqual)(a,i)||((e,t)=>{An(n,t).children=e,m?.([...n])})(dr(r),t)}},e.map((e=>T(e,"sub"))))),k={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===s,[`${i}--sm`]:"small"===s},P=[`${i}-column-filter`,{selected:f}];return c?l().createElement(za(),{action:["click"],popupVisible:f,popup:l().createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},l().createElement("div",{className:"reset"},l().createElement(ge,{type:"text",size:"small",onClick:()=>{const e=t=>t.map((t=>{const r=An(n,t.dataIndex)||ce(t);return t.children&&(r.children=e(t.children)),Object.assign(r,{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(ca.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),n=y.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||N([...dr(e),...v,...b])}},y.map((e=>T(e,"left"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"main"},l().createElement(ca.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||N([...y,...dr(e),...b])}},v.map((e=>T(e,"main"))))),l().createElement("div",{className:"divider"}),l().createElement("div",{className:"right"},l().createElement(ca.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:b,setList:e=>{const t=e.map((e=>e.dataIndex)),n=b.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||N([...y,...v,...dr(e)])}},b.map((e=>T(e,"right")))))),popupClassName:Ee()(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{g(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("span",{className:Ee()(P),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}));Ys.displayName="ColumnFilter";const Xs=Ys,Qs=()=>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 Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zs.apply(null,arguments)}const Js=e=>{const{column:t,filters:n}=e,{$size:r,prefixCls:a,setFilters:i,clearSuperFilters:o}=l().useContext(Ro),{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:n}=t;return`${e}|${n.type}`}),[t]),v=l().useMemo((()=>{let e=!1;for(const t in n[b])if(!le(n[b][t])||h){e=!0;break}return e}),[b,n,h]);l().useLayoutEffect((()=>{m&&setTimeout((()=>x()),20)}),[m]),l().useEffect((()=>{(0,Q.isEqual)(g[b],n[b])||y({[b]:n[b]||{}}),f(""===n[b]?.["=="])}),[n]);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 n in e[t])if(le(e[t][n])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][n])continue;delete e[t][n]}Object.keys(e[t]).length||delete e[t]}return e})({...n,...g,...e})),p(!1)},w={text:e=>l().createElement(l().Fragment,null,l().createElement(O.Input,{ref:c,size:r,placeholder:s("qm.table.filter.searchText",{text:nr(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,n=t?"":null;y((e=>Object.assign({},e,{[b]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue")))),textarea:e=>l().createElement(l().Fragment,null,l().createElement(O.Input.TextArea,{ref:u,size:r,placeholder:s("qm.table.filter.searchAreaText",{text:nr(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,n=t?"":null;y((e=>Object.assign({},e,{[b]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue")))),number:e=>{const t=e=>({value:g[b]?.[e]??"",size:r,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||y((n=>Object.assign({},n,{[b]:Object.assign({},n[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,Zs({ref:d},t(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(O.InputNumber,Zs({},t("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(O.InputNumber,Zs({},t("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(O.InputNumber,Zs({},t("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const t=e=>({value:Zn(g[b]?.[e],Fo),format:Fo,size:r,onChange:t=>{y((n=>Object.assign({},n,{[b]:Object.assign({},n[b],{[e]:Jn(t,Fo)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return l().createElement("ul",null,l().createElement("li",null,l().createElement("span",null,"> "),l().createElement(_,Zs({},t(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"< "),l().createElement(_,Zs({},t("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"= "),l().createElement(_,Zs({},t("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),l().createElement("li",null,l().createElement("span",null,"!="),l().createElement(_,Zs({},t("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:t,dictItems:n=[]}=e,r=t.items||n;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}})))}},r.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:n=[]}=e,r=t.items||n;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}})))}},r.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:n=[]}=e,r=t.items||n;return l().createElement("div",{style:{height:200,...t.style}},l().createElement(To,{multiple:!0,value:g[b]?.in||[],dataSource:r,onCheckChange:e=>{const t=e.map((e=>e.value));y((e=>Object.assign({},e,{[b]:{in:t}})))}}))}},C={"head-filter__popper":!0,[`${a}--lg`]:"large"===r,[`${a}--sm`]:"small"===r},S=["cell--filter",{selected:m,actived:v}];return l().createElement(za(),{action:["click"],popupVisible:m,popup:(()=>{const e=t.filter.type,n=w[e];return n?l().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},l().createElement("div",null,n(t)),l().createElement(O.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},l().createElement(ge,{size:r,onClick:()=>(E({[b]:{}}),void f(!1))},s("qm.table.filter.reset")),l().createElement(ge,{type:"primary",size:r,onClick:()=>E()},s("qm.table.filter.search")))):(pe("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Ee()(C),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{p(e)},builtinPlacements:Ho,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},l().createElement("div",{className:Ee()(S),title:s("qm.table.filter.text"),onClick:e=>e.stopPropagation()},l().createElement("span",{className:"svgicon icon"},l().createElement(Qs,null))))},ec=e=>{const{column:t}=e,{tableRef:n,bordered:r}=l().useContext(Ro),{columns:a,resizable:i,columnsChange:o=te}=n.current.props,s=l().useMemo((()=>_n(t)),[t]),c={resizable:!0,"is--line":i&&!r};return l().createElement("div",{className:Ee()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r,scrollBarRef:i}=n.current,l=r.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=jn(t,r.$table).left-i.current.scrollLeft+c;r.$table.classList.add("c--resize"),l.style.left=`${u}px`,l.style.display="block";const m=s.width||s.renderWidth;let p=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||Bo.defaultColumnWidth)||(p=Math.floor(n),l.style.left=`${t+u}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),l.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(An(a,s.dataIndex).width=p,o([...a]))},!1}})},tc=e=>{const{selectionKeys:t}=e,{tableRef:n,getRowKey:r,fetchParams:a,createTableList:i,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=l().useContext(Ro),{rowSelection:m}=n.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]),w=()=>{const{selectionRows:e}=n.current,{disabled:t}=m;return(t?e.filter((e=>!t(e))):e).map((e=>r(e,e.index)))},C=(()=>{const{recordsMap:e,allRowKeys:t}=n.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 l=a?i().filter((e=>!a(e))).map((e=>r(e,e.index))):i().map((e=>r(e,e.index)));return(0,Q.union)(l,w())})(),S=t.filter((e=>!C.includes(e))),N=t.length-S.length,I=N>0&&N<C.length,T=!!N&&N===C.length;s(S);const R=async()=>{const e=p;let t=[];c(!0);try{const n=await e.api(a);if(200===n.code){t=Array.isArray(n.data)?n.data:(0,Q.get)(n.data,e.dataKey)??[];const{disabled:a}=m;a&&(t=(0,Q.xor)(t,i().filter((e=>a(e))).map((e=>r(e,e.index))))),b.current=t}}catch(e){}return c(!1),t},k=async e=>{let t=[];t=v?e?await R():[]:e?C.slice(0):[],t=[...new Set([...t,...S])],o(t),g?.(e,t)};return l().createElement("div",{className:"cell--selection"},l().createElement(O.Checkbox,{checked:T,indeterminate:I,disabled:!C.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 R()):(0,Q.xor)(t,C),e=[...new Set([...e,...S])],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"})))},nc=e=>{const{style:t}=e,{tableRef:n,setRowExpandedKeys:r}=l().useContext(Ro),{expandable:a}=n.current.props,[i,o]=l().useState(a?.defaultExpandAllRows||!1);qe((()=>{r(i?[...n.current.allParentRowKeys]:[])}),[i]);const s=we("expand"),c={[`${s}--icon`]:!0,expanded:i,collapsed:!i};return l().createElement("span",{className:Ee()(c),title:"",onClick:e=>{e.stopPropagation(),o(!i)},style:t})},rc=()=>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"})),ac=()=>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"})),ic=e=>{const{tableColumns:t}=e,{tableRef:n,prefixCls:r,layout:a,flattenColumns:i,sorter:o,filters:s,superFilters:c,selectionKeys:d,isFetch:u,isGroupSubtotal:m,treeExpandIndex:p,tableChange:h,setSorter:f,setElementStore:g,resetTableScroll:y,getStickyLeft:b,getStickyRight:v,createGroupData:x,createTableFullData:E}=l().useContext(Ro),{ellipsis:w,resizable:C,multipleSort:S,rowSelection:N,expandable:I}=n.current.props,[T,R]=Bo.sortDirections,{tableOriginData:k}=n.current,{t:P}=G(),L=l().useRef(null),A=l().useMemo((()=>k.some((e=>Array.isArray(e.children)))),[k]),F=l().useMemo((()=>!u),[u]),_=l().useMemo((()=>!u),[u]),D=l().useMemo((()=>!I?.hideExpandAll),[I]),H=l().useMemo((()=>!(!N||(u?!N.selectAllOnCurrentPage&&!N.fetchAllRowKeys:N.hideSelectAll))),[u,N]);qe((()=>{j(),h(),y()}),[o]),qe((()=>{U(),h(),y()}),[s]),qe((()=>{U(),h(),y()}),[c]),l().useEffect((()=>{!le(o)&&ae((()=>j())),!le(s)&&ae((()=>U()))}),[]),l().useLayoutEffect((()=>{q()}),[]);const q=()=>{g("$header",L.current)},$=e=>{const{dataIndex:t,type:r,sorter:a,title:i,description:s}=e;if(t===Bo.selectionColumn&&"checkbox"===r){if("checkbox"===r)return l().createElement("div",{className:"cell"},H?l().createElement(tc,{selectionKeys:d}):P("qm.table.config.selectionText"));if("radio"===r)return l().createElement("div",{className:"cell"},i)}const c=[];return c.push(l().createElement("div",{key:0,className:"cell",title:nr(i)},n.current.isTreeTable&&t===p&&D?l().createElement(nc,null):null,t===Bo.expandableColumn&&D?l().createElement(nc,null):i)),s&&c.push(l().createElement(O.Tooltip,{key:1,placement:"top",title:s},l().createElement(Ce.InfoCircleOutlined,{className:"tip"}))),a&&c.push(M(o[t])),c},M=e=>{const t=["svgicon cell--sorter__asc",{actived:e===T}],n=["svgicon cell--sorter__desc",{actived:e===R}];return l().createElement("div",{key:2,className:"cell--sorter",title:P("qm.table.sorter.text")},l().createElement("span",{className:Ee()(t)},l().createElement(rc,null)),l().createElement("span",{className:Ee()(n)},l().createElement(ac,null)))},K=e=>l().createElement(Js,{column:e,filters:s}),z=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===R?null:R:T;S?(delete o[r],f(Object.assign({},o,{[r]:t}))):f(Object.assign({},{[r]:t}))}},j=()=>{F&&V()},V=e=>{const t=(0,Q.pickBy)(o,(e=>null!==e));B(t),e||Object.keys(t).length||B({index:T})},W=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,B=e=>{const{tableFullData:t}=n.current,r=((e,t)=>e.sort(((e,n)=>{for(const r in t){const a=i.find((e=>e.dataIndex===r)),l=t[r],o=Bn(e,r),s=Bn(n,r),c="function"!=typeof a?.sorter?W(o,s):a.sorter(e,n);if(0!==c)return"ascend"===l?c:-c}return 0})).slice(0))(m?x(rr(t)):t,e);E(r)},U=()=>{_&&Y()},Y=()=>{const e=c.length?ar(c):ar(s),t=""!==e?m?x(Rn(rr(k),e,A)):Rn(k,e,A):k;E(t),V(!0)},X=Mn(t),{tableBodyWidth:Z}=a;return l().createElement("div",{ref:L,className:`${r}--header-wrapper`},l().createElement("table",{className:`${r}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Z?`${Z}px`:""}},l().createElement("colgroup",null,i.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("thead",null,(e=>e.map(((e,t)=>l().createElement("tr",{key:t,className:"header--row"},e.map(((t,r)=>((e,t,r)=>{const{dataIndex:a,colSpan:i,rowSpan:s,fixed:c,align:d,theadAlign:u,theadClassName:m="",sorter:p,filter:h,required:f,headRender:g}=e;if(0===i)return null;const y=u||d,x=["header--column",{"col--ellipsis":e.ellipsis??w,"col--center":"center"===y,"col--right":"right"===y,"column--required":!!f,"column-has-sorter":p,"column-has-filter":h,"column--sort":!!o[a],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&!r[t+(i??1)]?.fixed,"cell-fix-right-first":"right"===c&&!r[t-1]?.fixed,[m]:!!m}],E={left:"left"===c?`${b(a)}px`:"",right:"right"===c?`${v(a,"thead")}px`:""},S=C&&![Bo.expandableColumn,Bo.selectionColumn].includes(a);return l().createElement("th",{key:a,className:Ee()(x),colSpan:i,rowSpan:s,style:{...E},onClick:t=>z(t,e)},l().createElement("div",{className:"cell--wrapper"},g?l().createElement("div",{className:"cell--text cell"},g(e,n.current.tableFullData)):l().createElement(l().Fragment,null,l().createElement("div",{className:"cell--text"},$(e)),h?K(e):null)),S&&l().createElement(ec,{column:e}))})(t,r,e)))))))(X))))},lc=l().createContext([]),oc=require("react-dom");function sc(e,t,n){let r,a=n.initialDeps??[];return()=>{let i;n.key&&n.debug?.()&&(i=Date.now());const l=e(),o=l.length!==a.length||l.some(((e,t)=>a[t]!==e));if(!n.noCache?.()&&!o)return r;let s;if(a=l,n.key&&n.debug?.()&&(s=Date.now()),r=t(...l),n.key&&n.debug?.()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-s))/100,r=t/16,a=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${a(t,5)} / ${a(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange?.(r),r}}function cc(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const dc=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,a)),n)}};function uc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const mc=e=>e,pc=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},hc=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(a(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver((e=>{const t=e[0];if(t?.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void a({width:e.inlineSize,height:e.blockSize})}a(n.getBoundingClientRect())}));return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},fc={passive:!0},gc="undefined"==typeof window||"onscrollend"in window,yc=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&gc?()=>{}:dc(r,(()=>{t(a,!1)}),e.options.isScrollingResetDelay),l=r=>()=>{const{horizontal:l,isRtl:o}=e.options;a=l?n.scrollLeft*(o?-1:1):n.scrollTop,i(),t(a,r)},o=l(!0),s=l(!1);return s(),n.addEventListener("scroll",o,fc),n.addEventListener("scrollend",s,fc),()=>{n.removeEventListener("scroll",o),n.removeEventListener("scrollend",s)}},bc=(e,t,n)=>{if(t?.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},vc=(e,{adjustments:t=0,behavior:n},r)=>{const a=e+t;r.scrollElement?.scrollTo?.({[r.options.horizontal?"left":"top"]:a,behavior:n})};class xc{constructor(e){uc(this,"unsubs",[]),uc(this,"options",void 0),uc(this,"scrollElement",null),uc(this,"targetWindow",null),uc(this,"isScrolling",!1),uc(this,"scrollToIndexTimeoutId",null),uc(this,"measurementsCache",[]),uc(this,"itemSizeCache",new Map),uc(this,"pendingMeasuredCacheIndexes",[]),uc(this,"scrollRect",null),uc(this,"scrollOffset",null),uc(this,"scrollDirection",null),uc(this,"scrollAdjustments",0),uc(this,"shouldAdjustScrollPositionOnItemSizeChange",void 0),uc(this,"elementsCache",new Map),uc(this,"observer",(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver((e=>{e.forEach((e=>{this._measureElement(e.target,e)}))})):null);return{disconnect:()=>{t()?.disconnect(),e=null},observe:e=>t()?.observe(e,{box:"border-box"}),unobserve:e=>t()?.unobserve(e)}})()),uc(this,"range",null),uc(this,"setOptions",(e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options={debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mc,rangeExtractor:pc,onChange:()=>{},measureElement:bc,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0,...e}})),uc(this,"notify",(e=>{this.options.onChange?.(this,e)})),uc(this,"maybeNotify",sc((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:!1,noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]})),uc(this,"cleanup",(()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null})),uc(this,"_didMount",(()=>()=>{this.cleanup()})),uc(this,"_willUpdate",(()=>{const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e)return void this.maybeNotify();this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}})),uc(this,"getSize",(()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0))),uc(this,"getScrollOffset",(()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0))),uc(this,"getFurthestMeasurement",((e,t)=>{const n=new Map,r=new Map;for(let a=t-1;a>=0;a--){const t=e[a];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0})),uc(this,"getMeasurementOptions",sc((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,a)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a})),{key:!1})),uc(this,"getMeasurements",sc((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,l);for(let a=l;a<e;a++){const e=r(a),l=1===this.options.lanes?o[a-1]:this.getFurthestMeasurement(o,a),s=l?l.end+this.options.gap:t+n,c=i.get(e),d="number"==typeof c?c:this.options.estimateSize(a),u=s+d,m=l?l.lane:a%this.options.lanes;o[a]={index:a,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:!1,debug:()=>this.options.debug})),uc(this,"calculateRange",sc((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()]),((e,t,n)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,a=Ec(0,r,(t=>e[t].start),n);let i=a;for(;i<r&&e[i].end<n+t;)i++;return{startIndex:a,endIndex:i}}({measurements:e,outerSize:t,scrollOffset:n}):null),{key:!1,debug:()=>this.options.debug})),uc(this,"getIndexes",sc((()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count]),((e,t,n,r)=>null===t?[]:e({startIndex:t.startIndex,endIndex:t.endIndex,overscan:n,count:r})),{key:!1,debug:()=>this.options.debug})),uc(this,"indexFromElement",(e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)})),uc(this,"_measureElement",((e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const a=r.key,i=this.elementsCache.get(a);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(a,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))})),uc(this,"resizeItem",((e,t)=>{const n=this.measurementsCache[e];if(!n)return;const r=t-(this.itemSizeCache.get(n.key)??n.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))})),uc(this,"measureElement",(e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))})),uc(this,"getVirtualItems",sc((()=>[this.getIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,a=e.length;r<a;r++){const a=t[e[r]];n.push(a)}return n}),{key:!1,debug:()=>this.options.debug})),uc(this,"getVirtualItemForOffset",(e=>{const t=this.getMeasurements();if(0!==t.length)return cc(t[Ec(0,t.length-1,(e=>cc(t[e]).start),e)])})),uc(this,"getOffsetForAlignment",((e,t)=>{const n=this.getSize(),r=this.getScrollOffset();"auto"===t&&e>=r+n&&(t="end"),"end"===t&&(e-=n);const a=this.options.horizontal?"scrollWidth":"scrollHeight",i=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-n;return Math.max(Math.min(i,e),0)})),uc(this,"getOffsetForIndex",((e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),a=this.getScrollOffset();if("auto"===t)if(n.end>=a+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=a+this.options.scrollPaddingStart))return[a,t];t="start"}const i=n.start-this.options.scrollPaddingStart+(n.size-r)/2;switch(t){case"center":return[this.getOffsetForAlignment(i,t),t];case"end":return[this.getOffsetForAlignment(n.end+this.options.scrollPaddingEnd,t),t];default:return[this.getOffsetForAlignment(n.start-this.options.scrollPaddingStart,t),t]}})),uc(this,"isDynamicMode",(()=>this.elementsCache.size>0)),uc(this,"cancelScrollToIndex",(()=>{null!==this.scrollToIndexTimeoutId&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)})),uc(this,"scrollToOffset",((e,{align:t="start",behavior:n}={})=>{this.cancelScrollToIndex(),"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})})),uc(this,"scrollToIndex",((e,{align:t="auto",behavior:n}={})=>{e=Math.max(0,Math.min(e,this.options.count-1)),this.cancelScrollToIndex(),"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const r=this.getOffsetForIndex(e,t);if(!r)return;const[a,i]=r;this._scrollToOffset(a,{adjustments:void 0,behavior:n}),"smooth"!==n&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout((()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(e))){const[a]=cc(this.getOffsetForIndex(e,i));t=a,r=this.getScrollOffset(),Math.abs(t-r)<1||this.scrollToIndex(e,{align:i,behavior:n})}else this.scrollToIndex(e,{align:i,behavior:n});var t,r})))})),uc(this,"scrollBy",((e,{behavior:t}={})=>{this.cancelScrollToIndex(),"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})})),uc(this,"getTotalSize",(()=>{const e=this.getMeasurements();let t;return t=0===e.length?this.options.paddingStart:1===this.options.lanes?e[e.length-1]?.end??0:Math.max(...e.slice(-this.options.lanes).map((e=>e.end))),Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)})),uc(this,"_scrollToOffset",((e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)})),uc(this,"measure",(()=>{this.itemSizeCache=new Map,this.notify(!1)})),this.setOptions(e)}}const Ec=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else{if(!(i>r))return a;t=a-1}}return e>0?e-1:0},wc="undefined"!=typeof document?l().useLayoutEffect:l().useEffect,Cc=e=>(e=>{const t=l().useReducer((()=>({})),{})[1],n={...e,onChange:(n,r)=>{r?(0,oc.flushSync)(t):t(),e.onChange?.(n,r)}},[r]=l().useState((()=>new xc(n)));return r.setOptions(n),wc((()=>r._didMount()),[]),wc((()=>r._willUpdate())),r})({observeElementRect:hc,observeElementOffset:yc,scrollToFn:vc,...e}),Sc=(e,t,n,r,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)/r,f=s.filter((e=>o[e]?.children?.length));let g=Nc(o,n.eventKey);if(u<m+p/2){const e=l.findIndex((e=>e===g.key)),t=l[e<=0?0:e-1];g=Nc(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&&Tc(g);e+=1)g=g.parent,E+=1;const w=t.data,C=g.node;let S=!0;return Rc(g)&&0===g.level&&u<m+p/2&&i({dragNode:w,dropNode:C,dropPosition:-1})&&g.key===n.eventKey?x=-1:(b.children||[]).length&&f.includes(v)?i({dragNode:w,dropNode:C,dropPosition:0})?x=0:S=!1:0===E?h>-1.5?i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,dropPosition:0})?x=c?1:0:i({dragNode:w,dropNode:C,dropPosition:1})?x=1:S=!1:i({dragNode:w,dropNode:C,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}},Nc=(e,t)=>e[t],Ic=e=>e.split("-"),Tc=e=>{if(e.parent){const t=Ic(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Rc=e=>{const t=Ic(e.pos);return 0===Number(t[t.length-1])},Oc=(e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const a=Nc(r,e);return{eventKey:e,pos:a?a.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}},kc=({openDragSort:e})=>{const{tableRef:t,getRowKey:n,rowExpandedKeys:r,setRowExpandedKeys:a,createTableFullData:i,dataChange:o}=l().useContext(Ro),{tableFullData:s,allRowKeys:c,isTreeTable:d}=t.current,u=ne,m=l().useRef(null),p=l().useRef(null),h=l().useRef(null),f=l().useRef(),[g,y]=l().useState({}),[b,v]=l().useState(null),[x,E]=l().useState([]),[w,C]=l().useState(0),[S,N]=l().useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),I=e=>{N((t=>Object.assign({},t,e)))};l().useLayoutEffect((()=>{e&&y((e=>{const t={},r=(e,a=null,i=0)=>{const l=[];return e.forEach(((e,o)=>{const s=n(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=r(e.children,c,i+1)),t[s]=c,l.push(c)})),l};return r(e),t})(s))}),[s]),l().useEffect((()=>()=>{window.removeEventListener("dragend",O)}),[]);const T=()=>{I({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},R=()=>{null!==b&&(v(null),I({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),p.current=null,h.current=null},O=e=>{k(e,null,!0),window.removeEventListener("dragend",O)},k=(e,t,n)=>{I({dragOverNodeKey:null}),R(),m.current=null,window.removeEventListener("dragend",O)};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;m.current=t,p.current={x:e.clientX,y:e.clientY};const i=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(r,n);v(n),E(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Nc(t,e).children),n})(n,g)),C(2*Bo.treeTable.textIndent),a(i),window.addEventListener("dragend",O)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(h.current!==n&&(h.current=n),!m.current)return void T();const{dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v,dragOverNodeKey:E}=Sc(e,m.current,t,w,p.current,u,c,g,r,!d);-1===x.indexOf(o)&&v?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),m.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{if(null===b)return;let e=[...r];const t=Nc(g,n);t&&t.children?.length&&(e=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(r,n)),a(e)}),800)),m.current.eventKey!==o||0!==l?I({dragOverNodeKey:E,dropPosition:i,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:y,dropAllowed:v}):T()):T()},onNodeDragOver:(e,t)=>{if(!m.current)return;const{dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:h}=Sc(e,m.current,t,w,p.current,u,c,g,r,!d);-1===x.indexOf(i)&&o&&(m.current.eventKey===i&&0===a?null===S.dropPosition&&null===S.dropLevelOffset&&null===S.dropTargetKey&&null===S.dropContainerKey&&null===S.dropTargetPos&&!1===S.dropAllowed&&null===S.dragOverNodeKey||T():n===S.dropPosition&&a===S.dropLevelOffset&&i===S.dropTargetKey&&l===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&h===S.dragOverNodeKey||I({dropPosition:n,dropLevelOffset:a,dropTargetKey:i,dropContainerKey:l,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:h}))},onNodeDragLeave:(e,t)=>{h.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(T(),h.current=null)},onNodeDragEnd:k,onNodeDrop:(e,t,r=!1)=>{const{dropPosition:a,dropTargetKey:l,dropTargetPos:c,dropAllowed:d,dragOverNodeKey:u}=S;if(!d)return;if(I({dragOverNodeKey:null}),R(),null===l)return;const p={...Oc(l,{dropPosition:a,dragOverNodeKey:u,keyEntities:g}),data:Nc(g,l).node};-1!==x.indexOf(l)&&pe("Table Draggable","无法拖放到 `dragNode` 的子节点");const h=Ic(c),f={event:e,node:p,dragNode:m.current,dragNodesKeys:[m.current.eventKey].concat(x),dropToGap:0!==a,dropPosition:a+Number(h[h.length-1])};r||(e=>{const t=e.node.eventKey,r=e.dragNode.eventKey,a=e.node.pos.split("-"),l=e.dropPosition-Number(a[a.length-1]),c=(e,t,r)=>{for(let a=0;a<e.length;a++){if(n(e[a],e[a].index)===t)return r(e[a],a,e);e[a].children&&c(e[a].children,t,r)}},d=[...s];let u;if(c(d,r,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,a)=>{n=a,e=r})),-1===l?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));i(d),o()})(f),m.current=null},indent:w,dropOptions:S}},Pc=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Lc=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>t?.contains(e.target))),Ac=(e,t)=>{const n=e.target;return!("button"in e&&e.button>0||n&&!Pc(n).contains(n)||t.current?.contains(n))};function Fc({ref:e,handler:t,enabled:n=!0,omitClassNames:r=[]}){const a=Y(t),l=i.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});i.useEffect((()=>{if(!n)return;const i=t=>{Ac(t,e)&&(l.current.isPointerDown=!0)},o=n=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:t&&l.current.isPointerDown&&Ac(n,e)&&Lc(n,r)&&(l.current.isPointerDown=!1,a(n))},s=n=>{l.current.ignoreEmulatedMouseEvents=!0,t&&l.current.isPointerDown&&Ac(n,e)&&Lc(n,r)&&(l.current.isPointerDown=!1,a(n))},c=Pc(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,n])}function _c(){const[,e]=i.useReducer((e=>e+1),0);return e}const Dc=l().forwardRef(((e,t)=>{const{rowKey:n,rowIndex:r,row:a,className:i,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:p,onNodeDragLeave:h,onNodeDragEnd:f,onNodeDrop:g}=e,y=l().useRef({eventKey:n,data:a,props:e}),b=l().useRef(!1),[v,x]=l().useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,I=C===n&&0===E,T=C===n&&-1===E,R=C===n&&1===E,O=a._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const P={"body--row-draggable":!0,"body--row-dragging":v,"drop-target":S===n,"drop-container":N===n,"drag-over":I,"drag-over-gap-top":T,"drag-over-gap-bottom":R};return l().createElement("tr",{ref:t,"data-row-key":n,"data-row-index":r,className:Ee()(i,P),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),b.current=t)},onDragStart:e=>{if(e.stopPropagation(),b.current)return e.preventDefault();x(!0),u(e,y.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,y.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),p(e,y.current)},onDragLeave:e=>{e.stopPropagation(),h(e,y.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,y.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,y.current)}},e.children,C===n&&null!==E&&null!==w&&l().createElement("td",{className:"drop-indicator",style:k}))}));Dc.displayName="DraggableTr";const Hc=Dc,qc=e=>{const{selectionKeys:t,column:n,record:r,rowKey:a}=e,{tableRef:i,getAllChildRowKeys:o}=l().useContext(Ro),{rowSelection:s}=i.current.props,c=l().useMemo((()=>n.type||""),[n.type]),d=e=>{const n=s.checkStrictly??!0;if(!i.current.isTreeTable||n)return!1;const r=Hn(i.current.deriveRowKeys,e);return((e,t)=>{const n=new Set(t);let r=!1,a=!1;for(const t of e)if(n.has(t)?r=!0:a=!0,r&&a)break;return r&&a})(o(r?.children??[]),t)};return"radio"===c?(()=>{const e=s.disabled,n=e?.(r),i=!n&&t[0]===a;return l().createElement(O.Radio,{checked:i,disabled:n})})():(()=>{const e=s.disabled,n=e?.(r),i=!!t.includes(a);return l().createElement(O.Checkbox,{checked:i,indeterminate:d(a),disabled:n})})()},$c=e=>{const{record:t,rowKey:n,style:r}=e,{tableRef:a,rowExpandedKeys:i,setRowExpandedKeys:o}=l().useContext(Ro),{expandable:s={}}=a.current.props,[c]=l().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(t)),d=l().useMemo((()=>i.includes(n)),[i,n]);qe((()=>{s.onExpand?.(d,t)}),[d]);const u=we("expand"),m={[`${u}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return l().createElement("span",{className:Ee()(m),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?i.filter((e=>e!==n)):[...i,n];o(t)},style:r})},Mc=l().forwardRef(((e,t)=>{const{size:n,defaultValue:r,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(Ea())(t).toFixed(m)),t},E=void 0!==a,[w,C]=l().useState(r??""),S=y(E?a:w),N=b(S);return qe((()=>{e.onChange?.(N)}),[w]),l().createElement(O.Input,{ref:t,size:n,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const n=b(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===m&&n.includes(".")&&(r=!1),i>=0&&n.startsWith("-")&&(r=!1),r){if(!p&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):C(t)})(n)}},onFocus:v,onBlur:()=>{const t=x(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(N),N)}})}));Mc.displayName="InputNumber";const Kc=Mc;function zc(){return zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zc.apply(null,arguments)}const{Search:jc}=O.Input,Vc=l().forwardRef(((e,t)=>{const{column:n,record:r,rowKey:a,columnKey:i}=e,{tableRef:o,tableBodyRef:s,$size:c,flattenColumns:d,updateTableFlatData:u,doFieldValidate:m,dataChange:p}=l().useContext(Ro),h=l().useContext(lc),{t:f}=G(),g=_c(),{store:y,fieldAuth:b}=o.current,v=n.editRender?.(r,n)||{},x=l().useRef(null),E=l().useRef(null),w=l().useRef(null),C=l().useRef(null),S=l().useRef(null),N=l().useRef(!1),I=l().useRef({}),T=l().useRef({}),R=l().useRef([]),[k,P]=l().useState(!1),[L,A]=l().useState(!1),[F,D]=l().useState(v.items||[]),[H,q]=l().useState(),M=(v.editable||(0,Q.isEqual)(h,[a,i]))&&!v.disabled&&!b[i]?.disabled,K=`${a}|${i}`,z=2===h.length?`${h[0]}|${h[1]}`:"",j=![...y.state.required,...y.state.validate].some((({x:e,y:t})=>e===a&&t===i)),V=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||"",B=y.state.edited.some((({x:e,y:t})=>e===a&&t===i)),U=M||!j||k||L,Y=!!v.helper?.combinedDataIndex&&("search-helper"===v.type||"tree-helper"===v.type),X=v.type?.endsWith("multiple");l().useLayoutEffect((()=>{U&&z===K&&ee()}),[h]),l().useLayoutEffect((()=>{const{items:e}=v;X&&e&&J(e.map((e=>({[T.current.valueKey]:e.value,[T.current.textKey]:e.text}))))}),[]);const Z=()=>{u(),p()},J=e=>{R.current=e},ee=()=>{const{type:e}=v;switch(e){case"text":E.current?.focus();break;case"number":w.current?.select();break;case"search-helper":C.current?.focus();break;case"tree-helper":S.current?.focus()}},te=()=>{const{type:e}=v;switch(e){case"text":E.current?.blur();break;case"number":w.current?.blur();break;case"search-helper":C.current?.blur();break;case"tree-helper":S.current?.blur()}};l().useImperativeHandle(t,(()=>({focus:ee,blur:te,isEditable:()=>!v.disabled,isOpening:()=>k})));const re=(e,t,n)=>{const{cornerSign:r=!0}=v.extra||{};y.addToUpdated(e),r&&y.addToEdited({x:t,y:n})},ie=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",le={text:(e,t,n)=>{const{dataIndex:r}=t,{type:o,extra:s={},rules:d=[],onInput:u,onChange:p,onEnter:h,onBlur:y}=v,b=Bn(e,r),x=Object.assign({},{minRows:1,maxRows:4},s.autoSize),w=n?{rows:x.minRows,autoSize:x}:null,C=s.password?O.Input.Password:n?O.Input.TextArea:O.Input;return l().createElement(C,zc({ref:E,size:c,value:b,maxLength:s.maxLength,showCount:s.showCount},w,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||f("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:n=>{const l=n.target.value??"";Un(e,r,l),m(d,l,a,i,nr(t.title)),g(),u?.({[K]:l}),N.current=!0},onBlur:t=>{const n=t.target.value??"";N.current&&(N.current=!1,re(e,a,i),p?.({[K]:n},e),y?.({[K]:n},e),Z())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const n=t.target.value??"";h?.({[K]:n},e)}},onKeyDown:e=>{n&&13===e.keyCode&&!e.shiftKey&&h&&e.preventDefault()}}))},textarea:(e,t)=>le.text(e,t,!0),number:(e,t)=>{const{dataIndex:n,precision:r,formatType:o}=t,{type:s,extra:d={},rules:u=[],onInput:p,onChange:h,onEnter:y,onBlur:b}=v,x=Bn(e,n);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(Ea())(e).times(100).toNumber()}`,C=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(Ea())(e).times(.01).toString()),l().createElement(Kc,{ref:w,size:c,value:x,min:d.min,max:d.max,precision:r,stringMode:d.stringMode,prefix:d.prefix,suffix:d.suffix??("percent"===o?"%":void 0),placeholder:d.placeholder||f("qm.table.editable.inputPlaceholder"),maxLength:d.maxLength,allowClear:d.allowClear,readOnly:d.readOnly,disabled:d.disabled,formatter:E,parser:C,onChange:r=>{Un(e,n,r),m(u,r,a,i,nr(t.title)),g(),p?.({[K]:r}),N.current=!0},onBlur:(t,r)=>{if(!N.current)return;N.current=!1;let l=d.stringMode?t:ie(t);"percent"===o&&"."===r.charAt(r.length-1)&&(l=Number(t)/100),Un(e,n,l),re(e,a,i),h?.({[K]:l},e),b?.({[K]:l},e),Z()},onEnter:(t,n)=>{let r=d.stringMode?t:ie(t);"percent"===o&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),y?.({[K]:r},e)}})},select:(e,t,n)=>{const{dataIndex:r,dictItems:o=[]}=t,{type:s,extra:d={},rules:u=[],items:p,onChange:h,onEnter:g}=v,y=p||o,b=Bn(e,r);let x=b;return l().createElement(O.Select,{mode:n?"multiple":void 0,size:c,popupClassName:Bo.popupClassName,value:b||void 0,placeholder:d.placeholder||f("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 n=t?.children?.toString()||"";return`${n}|${Xr.parse(n).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>P(e),onChange:n=>{Un(e,r,n),m(u,n,a,i,nr(t.title)),re(e,a,i),h?.({[K]:n},e),Z()},onSelect:e=>{x=e},onInputKeyDown:t=>{13===t.keyCode&&ae((()=>g?.({[K]:x},e)))}},y.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>le.select(e,t,!0),date:(e,t,n)=>{const{dataIndex:r}=t,{type:o,extra:s={},rules:d=[],onChange:u}=v,p=n||"exactdate",h=Bn(e,r);return l().createElement(_,{size:c,popupClassName:Bo.popupClassName,value:Zn(h,Er[p])??void 0,picker:xr[p],format:s.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=s;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:n=>{const l=Jn(n,Er[p]);Un(e,r,l),m(d,l,a,i,nr(t.title)),re(e,a,i),u?.({[K]:l},e),Z()}})},datetime:(e,t)=>le.date(e,t,"datetime"),month:(e,t)=>le.date(e,t,"month"),year:(e,t)=>le.date(e,t,"year"),time:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],onChange:d}=v,u="HH:mm:ss",p=Bn(e,n);return l().createElement($,{size:c,popupClassName:Bo.popupClassName,value:Zn(p,u)??void 0,format:o.format||u,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:r=>{const l=Jn(r,u);Un(e,n,l),m(s,l,a,i,nr(t.title)),re(e,a,i),d?.({[K]:l},e),Z()}})},checkbox:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],onChange:c}=v,{trueValue:d=Lo,falseValue:u=Ao,disabled:p}=o,h=Bn(e,n);return l().createElement(O.Checkbox,{checked:h===d,disabled:p,onChange:r=>{const l=r.target.checked?d:u;Un(e,n,l),m(s,l,a,i,nr(t.title)),re(e,a,i),c?.({[K]:l},e),Z()}})},switch:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],onChange:c}=v,{trueValue:d=Lo,falseValue:u=Ao,disabled:p}=o,h=Bn(e,n);return l().createElement(O.Switch,{checked:h===d,disabled:p,onChange:r=>{const l=r?d:u;Un(e,n,l),m(s,l,a,i,nr(t.title)),re(e,a,i),c?.({[K]:l},e),Z()}})},"search-helper":(e,t)=>{const{dataIndex:n,precision:r}=t,{type:o,extra:s={},rules:u=[],helper:p={},onInput:h,onChange:g,onEnter:y}=v,b=Gn(e,Y?p.combinedDataIndex:n),x=p.fieldAliasMap;x||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const E="function"==typeof x?x():x||{};Object.keys(E).includes(n)||pe("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(p.combinedDataIndex.split("|").every((e=>Object.keys(E).includes(e)))||pe("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),E[n].includes("|")&&pe("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const w=e=>{const{filterAliasMap:t}=p,r=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[n]:r};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](r):r;else i[e]=r})),i},S=e=>{const{autoQueryAssign:t=!0}=p;t&&(I.current=w(e)),P(!0)},T=(n,r)=>{const{beforeOpen:a}=p,i=(a??ne)({[K]:b},e,t);i?.then?i.then((()=>{S(n),r?.()})).catch((()=>{})):!1!==i&&(S(n),r?.())},R=e=>{const t={};for(const r in E){const a=E[r];r!==n&&(t[r]=Gn(e,a))}const r=E[n]?Gn(e,E[n]):"";L(r,t);const{closed:a}=p;P(!1),a?.(e)},O=()=>{const{onlySelect:e=!0}=p;N.current&&L(e?"":b),P(!1)},L=(l="",o)=>{if((0,Q.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const n=o[t],r=d.find((e=>e.dataIndex===t));if(r){Un(e,t,n,r.precision);const i=r.editRender?.(e,r);i&&Array.isArray(i.rules)&&m(i.rules,n,a,t,nr(r.title))}else Un(e,t,n)}Y&&!l&&((e,t,n,r)=>{if(!t.includes("|"))return Un(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,n)=>{t&&Un(e,t,a[n]?.trim())}))})(e,p.combinedDataIndex),Un(e,n,l,r),m(u,l,a,i,nr(t.title)),re(e,a,i),g?.({[K]:l},e),Z(),I.current={},N.current=!1,q(void 0)},F={visible:k,title:f("qm.searchHelper.text"),width:p.width??"60%",loading:!1,wrapClassName:Bo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{O()}},_={...p,size:c,initialValue:Object.assign({},I.current,p.initialValue),onClose:e=>{e?R(e):O()}};return l().createElement(l().Fragment,null,l().createElement(jc,{ref:C,value:H??b,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:r=!0,table:a}=p;if(N.current&&!k)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:n={}}=p,{beforeFetch:r=ne}=t.fetch;return new Promise((async(a,i)=>{const l=(0,Q.merge)({},t.fetch.params,{...n,...w(e)},{currentPage:1,pageSize:500});if(!r(l))return i();A(!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((()=>A(!1)))}}))})(t).then((e=>((e=[],t)=>{const r=e.filter((e=>Gn(e,E[n]).toString().includes(t)));if(1===r.length)return R(r[0]);T(t)})(e,t))).catch((()=>L(""))):void L(t)},onChange:e=>{const{value:t}=e.target;h?.({[K]:t}),N.current=!0,q(t)},onKeyDown:e=>{if(13===e.keyCode){const t=e.target.value??"";!k&&T(t)}},onDoubleClick:e=>{const{value:t}=e.target;T(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&T(e)}}),l().createElement(mn,F,l().createElement(fd,_)))},"search-helper-multiple":(e,t)=>{const{dataIndex:n}=t,{type:r,items:o=[],extra:s={},rules:d=[],helper:u={},onInput:p,onChange:h,onEnter:g}=v,y=Bn(e,n),b=u.fieldAliasMap;b||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||pe("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),T.current=x;const E=n=>{const{beforeOpen:r}=u,a=(r??ne)({[K]:y},e,t);a?.then?a.then((()=>{P(!0),n?.()})).catch((()=>{})):!1!==a&&(P(!0),n?.())},w=()=>{P(!1)},C=r=>{Un(e,n,r),m(d,r,a,i,nr(t.title)),re(e,a,i),h?.({[K]:r},e,R.current),Z()},S={visible:k,title:f("qm.searchHelper.text"),width:u.width??"60%",loading:!1,wrapClassName:Bo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{w()}},N={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=x;J((0,Q.uniqBy)([...R.current.filter((e=>t.includes(e[r]))),...e],r));const a=R.current.map((e=>({text:e[n],value:e[r]}))),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;P(!1),l?.(R.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:y,placeholder:s.placeholder||f("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&&E()},onDoubleClick:()=>{s.disabled||E()},onChange:e=>{const{valueKey:t}=x;J(R.current.filter((n=>e.includes(n[t])))),C(e)}},F.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:()=>{E()}})))),l().createElement(mn,S,l().createElement(fd,N)))},"tree-helper":(e,t)=>{const{dataIndex:n,precision:r}=t,{type:o,extra:s={},rules:u=[],helper:p={},onChange:h,onEnter:g}=v,y=Gn(e,Y?p.combinedDataIndex:n),b=p.fieldAliasMap;b||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(n)||pe("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Y&&(p.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||pe("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[n].includes("|")&&pe("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=n=>{const{beforeOpen:r}=p,a=(r??ne)({[K]:y},e,t);a?.then?a.then((()=>{P(!0),n?.()})).catch((()=>{})):!1!==a&&(P(!0),n?.())},w=()=>{P(!1)},C=(l="",o)=>{if((0,Q.isPlainObject)(o)&&Object.keys(o).length)for(const t in o){const n=o[t],r=d.find((e=>e.dataIndex===t));if(r){Un(e,t,n,r.precision);const i=r.editRender?.(e,r);i&&Array.isArray(i.rules)&&m(i.rules,n,a,t,nr(r.title))}else Un(e,t,n)}Un(e,n,l,r),m(u,l,a,i,nr(t.title)),re(e,a,i),h?.({[K]:l},e),Z()},N={visible:k,title:f("qm.searchHelper.text"),width:p.width??"40%",loading:!1,wrapClassName:Bo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{w()}},I={...p,defaultSelectedKeys:[y],size:c,onClose:e=>{e?(e=>{const t={};for(const r in x){const a=x[r];r!==n&&(t[r]=Gn(e,a))}const r=x[n]?Gn(e,x[n]):"";C(r,t);const{closed:a}=p;P(!1),a?.(e)})(e):w()}};return l().createElement(l().Fragment,null,l().createElement(jc,{ref:S,value:y,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||f("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!k&&E())},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?E():C(""))}}),l().createElement(mn,N,l().createElement(Cd,I)))},"tree-helper-multiple":(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},items:s=[],rules:d=[],helper:u={},onInput:p,onChange:h,onEnter:g}=v,y=Bn(e,n),b=u.fieldAliasMap;b||pe("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes("valueKey")&&Object.keys(x).includes("textKey")||pe("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),T.current=x;const E=n=>{const{beforeOpen:r}=u,a=(r??ne)({[K]:y},e,t);a?.then?a.then((()=>{P(!0),n?.()})).catch((()=>{})):!1!==a&&(P(!0),n?.())},w=()=>{P(!1)},C=r=>{Un(e,n,r),m(d,r,a,i,nr(t.title)),re(e,a,i),h?.({[K]:r},e,R.current),Z()},S={visible:k,title:f("qm.searchHelper.text"),width:u.width??"40%",loading:!1,wrapClassName:Bo.popupClassName,bodyStyle:{paddingBottom:`${ka[c]+20}px`},onClose:()=>{w()}},N={...u,size:c,multiple:!0,initialValue:(0,Q.merge)({},u.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=x;J(e);const r=R.current.map((e=>({text:e[t],value:e[n]})));D(r),C(r.map((e=>e.value)));const{closed:a}=u;P(!1),a?.(R.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:y,placeholder:o.placeholder||f("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&&E()},onDoubleClick:()=>{o.disabled||E()},onChange:e=>{const{valueKey:t}=x;J(R.current.filter((n=>e.includes(n[t])))),C(e)}},F.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:()=>{E()}})))),l().createElement(mn,S,l().createElement(Cd,N)))},custom:(e,t)=>{const{dataIndex:n}=t,{type:r,extra:o={},rules:s=[],render:c,onChange:d}=v;if(!c)return pe("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const u=Bn(e,n),p=r=>{Un(e,n,r),m(s,r,a,i,nr(t.title)),re(e,a,i),d?.({[K]:r},e),Z()},h=c(e,t,p);return l().isValidElement(h)?l().cloneElement(h,{value:u,disabled:o.disabled,readOnly:o.readOnly,popupClassName:Bo.popupClassName,onChange:p}):null}};return l().createElement(l().Fragment,null,U?(()=>{const{type:e}=v,t=le[e];if(!t)return pe("Table","单元格编辑的类型 `type` 配置不正确"),null;const a=["cell--edit",{"is-error":!j}];return l().createElement("div",{ref:x,className:Ee()(a)},t(r,n),!j&&l().createElement("div",{className:"cell-error"},V||W))})():(()=>{const{disabled:t,extra:n={}}=v,{disabledColor:r,disabledBgColor:a}=n,i=["cell--show",{"is-cell-bg":t&&a}];return l().createElement(l().Fragment,null,l().createElement("span",{className:Ee()(i),style:{color:t?r:""}},e.children),t&&a&&l().createElement("i",{className:"cell--bg",style:{background:a}}))})(),B&&l().createElement("i",{className:"cell--sign"}))}));Vc.displayName="CellEdit";const Wc=Vc,Bc=require("copy-to-clipboard");var Uc=r.n(Bc);const Gc=(e,...t)=>l().isValidElement(e)?l().cloneElement(e,...t):null,Yc=e=>{const{text:t,options:n,showMessage:r=!0,onCopy:a}=e,{t:i}=G();return Gc(e.children,{onClick:o=>{const s=l().Children.only(e.children),c=Uc()(t,n);a?.(t,c),c&&r&&O.message.success(i("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Yc.displayName="QmCopyToClipboard";const Xc=Yc,Qc=l().forwardRef(((e,t)=>{const{column:n,row:r,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c}=e,{tableRef:d,selectionKeys:u,treeExpandIndex:m,updateMark:p}=l().useContext(Ro),{dataIndex:h,canCopy:f,render:g,editRender:y,shouldCellUpdate:b}=n,{t:v}=G(),{renderText:x,getTitleFromCellNode:E}=as(),w=l().useRef(null),C=Bn(r,h),[S,N]=function(e,c,d){const u=i.useRef({});return"value"in u.current&&!((e,t)=>{if(b){const[,n]=e,[,a]=t;return b(a,n,r)}return!((e,t,n=!1)=>{const r=new Set;return function e(t,a,i=1){if(r.has(t))return!1;if(t===a)return!0;if(n&&i>1)return!1;r.add(t);const l=i+1;if(Array.isArray(t)){if(!Array.isArray(a)||t.length!==a.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],a[n],l))return!1;return!0}if(t&&a&&"object"==typeof t&&"object"==typeof a){const n=Object.keys(t);return n.length===Object.keys(a).length&&n.every((n=>e(t[n],a[n],l)))}return!1}(e,t)})(e,t,!0)})(u.current.condition,c)||(u.current.value=(()=>{const e=g?g(C,r,n,a,o):x(C,n,r);return[e,y?l().createElement(Wc,{ref:t,column:n,record:r,rowKey:s,columnKey:h},e):null]})(),u.current.condition=c),u.current.value}(0,[p,r,C,g,y]);l().useEffect((()=>{if([Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn].includes(h))return;const e=w.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const I=e=>Array.isArray(e.children);return l().createElement("div",{ref:w,className:"cell"},(()=>{if(h===Bo.expandableColumn)return l().createElement($c,{record:r,rowKey:s});if(h===Bo.selectionColumn)return l().createElement(qc,{selectionKeys:u,column:n,record:r,rowKey:s});if(N)return N;if(d.current.isTreeTable&&h===m)return l().createElement(l().Fragment,null,(e=r._level)?l().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*Bo.treeTable.textIndent+"px"}}):null,l().createElement($c,{key:"expand",record:r,rowKey:s,style:I(r)?{}:{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(Xc,{text:e},l().createElement(Ce.CopyOutlined,{className:"icon",title:v("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Qc.displayName="Cell";const Zc=Qc,Jc={open:!1,offsetX:0,offsetY:0},ed=l().forwardRef(((e,t)=>{const{tableRef:n,getRowKey:r,prefixCls:a,tableFlatData:i,flattenColumns:o,mergedTdCells:s,setMergedCells:c}=l().useContext(Ro),{areaSelection:d={}}=n.current.props,{elementStore:u}=n.current,{t:m}=G(),p=l().useRef(document.onselectstart),h=l().useRef(null),f=l().useRef(null),g=l().useRef(null),y=e=>{g.current=e},[b,v]=l().useState(null),[x,E]=l().useState(null),[w,C]=l().useState(null),S=e=>{if(!e)return C(null);let t=!1;for(const n in e)if(w?.[n]!==e[n]){t=!0;break}t&&C(Object.assign({},w,e))};Fc({ref:h,handler:()=>M()}),l().useEffect((()=>{const e=zt()(u.$tableBody,"mousedown",F),t=zt()(u.$tableBody,"contextmenu",L),n=zt()(document,"keydown",A);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const N=()=>{v(null),S(null),y(null),E(null)};l().useImperativeHandle(t,(()=>({blur:N})));const I=e=>{let t=e;for(;t;){if(!u.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},T=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),R=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),O=e=>{let[t,n,r,a]=[1/0,-1/0,1/0,-1/0];for(const i of e)t=Math.min(t,i.rowStart),n=Math.max(n,i.rowEnd),r=Math.min(r,i.colStart),a=Math.max(a,i.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:a}},k=wt((e=>{let t=O([R(e),g.current]);s.forEach((e=>{const n=i.findIndex((t=>r(t,t.index)===e.rowKey)),a=o.findIndex((t=>t.dataIndex===e.dataIndex)),l={rowStart:n,rowEnd:n+e.rowSpan,colStart:a,colEnd:a+e.colSpan};var s,c;c=l,(s=t).rowEnd<=c.rowStart||s.rowStart>=c.rowEnd||s.colEnd<=c.colStart||s.colStart>=c.colEnd||(t=O([t,l]))})),S(t)}),5),P=e=>{c(e),d.onCellMerge?.(e),ae((()=>N()))},L=Y((e=>{d.cellMerge&&b&&q(e.clientX,e.clientY)?(e.preventDefault(),$(e)):x?.open&&M()})),A=Y((e=>{27===e.keyCode&&N()})),F=Y((e=>{e.stopPropagation();const t=I(e.target);if(1!==e.buttons||!t)return;M();const n=T(t);v(n);const r=R(n);y(r),S(r),document.addEventListener("mousemove",_),document.addEventListener("mouseup",D),p.current=document.onselectstart,document.onselectstart=()=>!1})),_=Y((e=>{const t=I(e.target);t&&k(T(t))})),D=Y((()=>{d.onSelectChange?.((()=>{const e=[];if(!b||!w)return e;for(let t=w.rowStart;t<w.rowEnd;t++)for(let n=w.colStart;n<w.colEnd;n++)e.push({rowKey:r(i[t],i[t].index),dataIndex:o[n].dataIndex,cellValue:Bn(i[t],o[n].dataIndex)});return e})()),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",D),H()})),H=()=>{document.onselectstart!==p.current&&(document.onselectstart=p.current)},q=(e,t)=>{const{top:n,left:r}=u.$tableBody.parentNode.getBoundingClientRect(),[a,i]=[e-r,t-n],{el:l,et:o,ew:s,eh:c}=V();return!(a<l||a>l+s||i<o||i>o+c)},$=e=>{const{top:t,left:n,height:r}=f.current.getBoundingClientRect();E({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},M=()=>{E((e=>({...e,open:!1})))},K=e=>({rowIndex:i.findIndex((t=>r(t,t.index)===e.rowKey)),colIndex:o.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),z=()=>{if(!b||!w||(t=w,(e=b).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return N();var e,t;const n={rowKey:r(i[w.rowStart],i[w.rowStart].index),dataIndex:o[w.colStart].dataIndex,rowSpan:w.rowEnd-w.rowStart,colSpan:w.colEnd-w.colStart};P([...s.filter((e=>!((e,t)=>{const n=K(e),r=K(t),[a,i,l,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return a<=s&&i<=c&&l>=d&&o>=u||s<=a&&c<=i&&d>=l&&u>=o})(e,n))),n])},j=()=>{const e=r(i[w.rowStart],i[w.rowStart].index),t=o[w.colStart].dataIndex;P(s.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},V=()=>{const{w:e,h:t,l:r,t:a}=b,i=o.slice(0,w.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),l=n.current.rowHeight*w.rowStart;return{sl:r,st:a,sw:e,sh:t,el:i,et:l,ew:o.slice(0,w.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-i,eh:n.current.rowHeight*w.rowEnd-l}};return l().createElement("div",{className:`${a}--area-select`},(()=>{if(!b||!w)return null;const{sl:e,st:t,sw:n,sh:r,el:a,et:i,ew:o,eh:s}=V(),{open:c,offsetX:d,offsetY:u}=x||Jc,p=l().createElement("ul",{ref:h,className:"ant-dropdown-menu"},l().createElement("li",{className:"ant-dropdown-menu-item",onClick:z},m("qm.table.areaSelect.mergeCell")),l().createElement("li",{className:"ant-dropdown-menu-item",onClick:j},m("qm.table.areaSelect.cancelMerge")));return l().createElement(l().Fragment,null,l().createElement("div",{className:"active-area",style:{left:e,top:t,width:n,height:r}}),l().createElement(za(),{popupVisible:c,popup:p,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:Bo.popupClassName,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}})))})())}));ed.displayName="AreaSelect";const td=ed,nd=l().forwardRef(((e,t)=>{const{tableRef:n,getRowKey:r,prefixCls:a,tableFlatData:i,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:m,layout:p,showFooter:h,selectionKeys:f,rowExpandedKeys:g,highlightKey:y,isPingLeft:b,isPingRight:v,isTableEmpty:x,isGroupSubtotal:E,setElementStore:w,setSelectionKeysEffect:C,setHighlightKey:S,getStickyLeft:N,getStickyRight:I,setPingLeft:T,setPingRight:R,setFullScreen:O,findParentRowKeys:k,getAllChildRowKeys:P,scrollBottomDebouncer:L}=l().useContext(Ro),{height:A,minHeight:F,maxHeight:_,rowHeight:D,rowSelection:H,rowHighlight:q,expandable:$,stripe:M,summation:K,rowStyle:z,cellStyle:j,spanMethod:V,tableConfig:W,areaSelection:B,ellipsis:U,showHeader:G,rowDraggable:X,onRowClick:Z,onRowDblclick:J,onRowContextmenu:ee,onRowEnter:re}=n.current.props,ae=l().useRef(null),ie=l().useRef({}),le=l().useRef(null),oe=l().useRef({prevST:0,prevSL:0}),{onNodeDragStart:se,onNodeDragEnter:ce,onNodeDragOver:de,onNodeDragLeave:ue,onNodeDragEnd:me,onNodeDrop:pe,indent:he,dropOptions:fe}=kc({openDragSort:X}),{rowVirtualizer:ge,columnVirtualizer:ye,virtualRows:be,virtualColumns:ve,resetItemXSize:xe,getYIndexes:we,virtualTranslateY:Ce,virtualTranslateX:Se,calcVirtualYSize:Ne,calcVirtualXSize:Ie,scrollToYIndex:Te}=((e,t)=>{const{tableRef:n}=l().useContext(Ro),{props:r,scrollBarRef:a,rowHeight:i}=n.current,o=r.tableConfig?.overscan||1,s=l().useMemo((()=>a.current?.container.children[0]??null),[a.current]),c=l().useMemo((()=>{const e=[],n=[];return t.forEach(((t,r)=>{"left"===t.fixed&&e.push(r),"right"===t.fixed&&n.push(r)})),[e,n]}),[t]),d=Cc({count:e.length,getScrollElement:()=>s,estimateSize:()=>i,indexAttribute:"data-row-index",overscan:o,enabled:n.current.scrollYLoad}),u=d.getVirtualItems(),m=Cc({horizontal:!0,count:t.length,getScrollElement:()=>s,estimateSize:e=>t[e].width||t[e].renderWidth||0,indexAttribute:"data-col-index",overscan:o,enabled:n.current.scrollXLoad,rangeExtractor:e=>[...new Set([...c[0],...pc(e),...c[1]])]}),p=m.getVirtualItems();return{rowVirtualizer:d,columnVirtualizer:m,virtualRows:u,virtualColumns:p,resetItemXSize:e=>{e.forEach(((e,t)=>{m.resizeItem(t,e.width||e.renderWidth||Bo.defaultColumnWidth)}))},getYIndexes:()=>d.getIndexes()||[],getXIndexes:()=>m.getIndexes()||[],virtualTranslateY:()=>u[0]?.start??0,virtualTranslateX:()=>{const e=c[0].length;return e?p[e]?.index===e?p[0]?.start??0:(p[e]?.start??0)-p.slice(0,e).reduce(((e,t)=>e+t.size),0):p[0]?.start??0},calcVirtualYSize:()=>d.getTotalSize()||void 0,calcVirtualXSize:()=>m.getTotalSize()||void 0,scrollToYIndex:e=>{d.scrollToIndex(e)},scrollToXIndex:e=>{m.scrollToIndex(e)}}})(i,o),Re=we(),Oe=e=>{if(e&&!U)return ge.measureElement(e)},ke=l().useMemo((()=>u.length&&n.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:a,colSpan:i})=>{const l=e+a-1,o=[];for(let t=e;t<=l;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:i});for(let a=t;a<t+i;a++)0===r&&a===t||n.push({row:e,col:a,rowSpan:0,colSpan:0})}))})),n})(u,Re):u),[u,Re.join(",")]),[Pe,Le]=l().useState([]),Ae=_c();Fc({ref:ae,omitClassNames:[`.${Bo.popupClassName}`],handler:()=>{Ue([]),le.current?.blur()}}),l().useImperativeHandle(t,(()=>({setClickedValues:Ue,createFocus:ze,forceUpdate:Ae,resetItemXSize:xe,scrollToYIndex:Te}))),qe((()=>{Pe.length&&n.current.tableManager.focus(n.current.uid)}),[Pe]),l().useLayoutEffect((()=>{Me();const e=zt()(document,"keydown",De);return()=>e.remove()}),[]);const Fe=l().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:a}=p,i={};return x&&Object.assign(i,{minHeight:"100px"}),F&&Object.assign(i,{minHeight:Vn(F)-e-n+"px"}),_&&Object.assign(i,{maxHeight:Vn(_)-e-n+"px"}),A||r||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[A,_,F,x,p]),_e=Y((e=>{const{elementStore:t}=n.current,{prevST:r,prevSL:a}=oe.current,{scrollTop:i,scrollLeft:l}=e;if(l!==a){G&&(t.$header.scrollLeft=l),h&&(t.$footer.scrollLeft=l);const e=l>0,n=Math.ceil(l)+p.tableWidth<p.tableBodyWidth;b!==e&&T(e),v!==n&&R(n)}i!==r&&Math.ceil(i)+p.viewportHeight>=ae.current.parentNode.offsetHeight&&L({type:"scroll",target:e,preventDefault:te,stopPropagation:te}),oe.current={prevST:i,prevSL:l}})),De=Y((e=>{const{keyCode:t}=e;if(n.current.uid===n.current.tableManager.getFocusInstance()?.id&&(27===t&&(Ue([]),S(""),O(!1)),Pe.length&&(Ge(document.activeElement,ae.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===H?.type||q)){const t=f[0]??y??null,n=i.find((e=>r(e,e.index)===t))??null;n&&re?.(n,e)}if(!We(Pe[0],Pe[1])){if(38===t||40===t){Ke(e);const n=i.length;let a=i.findIndex((e=>r(e,e.index)===Pe[0]));const l=38===t?(--a+n)%n:++a%n,o=i[l],s=r(o,o.index),c=Ve(s,Pe[1]);"radio"!==H?.type||H.disabled?.(o)||c||C([s]),!q||q.disabled?.(o)||c||S(s),He(38===t?"top":"bottom",l),je(...Pe),Ue([s,Pe[1]])}if(9===t||e.shiftKey&&9===t){if(Ke(e),!s.length)return Ue([]);const n=s.length;let r=s.findIndex((e=>e.dataIndex===Pe[1]));const a=e.shiftKey&&9===t?(--r+n)%n:++r%n;je(...Pe),$e(e.shiftKey&&9===t?"left":"right",a),Ue([Pe[0],s[a].dataIndex])}}}})),He=(e,t)=>{const{scrollBarRef:r,scrollYLoad:a}=n.current;if(a)return ge.scrollToIndex(t);const l=i.length,o=t,s=ae.current.querySelectorAll("tbody > tr"),c=i.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<r.current.scrollTop?r.current.SET_SCROLL_TOP(c):t===l-1&&r.current.SET_SCROLL_TOP(c-(p.viewportHeight-d)):c+d>r.current.scrollTop+p.viewportHeight?r.current.SET_SCROLL_TOP(c-(p.viewportHeight-d)):0===t&&r.current.SET_SCROLL_TOP(c)},$e=(e,t)=>{const{scrollBarRef:r}=n.current,a=s.length,i=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),l=o.slice(0,i).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[i].width||o[i].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),h=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?l<r.current.scrollLeft+m?r.current.SET_SCROLL_LEFT(l-m):t===a-1&&r.current.SET_SCROLL_LEFT(l-(p.tableWidth-u)+h):l+u>r.current.scrollLeft+(p.tableWidth-h)?r.current.SET_SCROLL_LEFT(l-(p.tableWidth-u)+h):0===t&&r.current.SET_SCROLL_LEFT(l-m)},Me=()=>{w("$tableBody",ae.current)},ze=(e,t)=>{ie.current[`${e}-${t}`]?.focus()},je=(e,t)=>{ie.current[`${e}-${t}`]?.blur()},Ve=(e,t)=>ie.current[`${e}-${t}`]?.isEditable()??!1,We=(e,t)=>ie.current[`${e}-${t}`]?.isOpening()??!1,Be=e=>{const t=K.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ue=e=>{(0,Q.isEqual)(e,Pe)||Le(e)},Ye=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Xe=(e,t,r)=>{const{disabled:a}=H||{},{deriveRowKeys:i,recordsMap:l}=n.current,o=Hn(i,e);let s=[],c=P(o?.children||[]);return a&&(c=c.filter((e=>!l.has(e)||!a(l.get(e))))),s=r?[...new Set([...t,e,...c])]:t.filter((t=>![e,...c].includes(t))),(or(i,e)?.slice(0,-1).reverse()||[]).forEach((e=>{const t=Hn(i,e),n=t?.children?.every((e=>s.includes(e.rowKey)));s=n?[...s,e]:s.filter((t=>t!==e))})),s},Qe=(e,t,a,i,o)=>{const{dataIndex:s,fixed:u,align:p,className:h=""}=e,{rowSpan:g,colSpan:y}=Ze(a,e,i,t);if(!g||!y)return null;const b=e.ellipsis??U,v=["body--column",{"col--ellipsis":b,"col--center":"center"===p,"col--right":"right"===p,"column--sort":!!m[s],"cell-fix-left":"left"===u,"cell-fix-right":"right"===u,"cell-fix-left-last":"left"===u&&c[c.length-y]?.dataIndex===s,"cell-fix-right-first":"right"===u&&d[0]?.dataIndex===s,[h]:!!h}],x={left:"left"===u?`${N(s)}px`:"",right:"right"===u?`${I(s)}px`:""},w=z?"function"==typeof z?z(a,i):z:null,T=j?"function"==typeof j?j(a,e,i,t):j:null,R=E?(e=>{const{backgroundColor:t,color:n}=K.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:n}})(a._group):null,O=Object.assign({},x,{height:D},R,w,T);return l().createElement("td",{key:s,"data-col-index":t,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:Ee()(v),style:O,onClick:t=>((e,t,a)=>{const{dataIndex:i}=a;if([Bo.expandableColumn,Bo.operationColumn].includes(i))return;const l=r(t,t.index);Ue([l,i]);const o=Ve(l,i),{type:s,selectByClickRow:c=!0,disabled:d=te}=H||{};!s||d(t)||o||(c||i===Bo.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:a=!0,onSelect:i}=H||{};if("radio"===r&&C([e]),"checkbox"===r){const r=!f.includes(e),l=n.current.isTreeTable&&!a?Xe(e,f,r):Ye(e,f,r);C(l),i?.(r,t,l)}})(l,t),[Bo.selectionColumn].includes(i)||(!q||q.disabled?.(t)||o||S(l),Z?.(t,a,e))})(t,a,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn].includes(r)||J?.(t,n,e)})(t,a,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn].includes(r)||ee?.(t,n,e)})(t,a,e)},l().createElement(Zc,{ref:e=>ie.current[`${o}-${s}`]=e,row:a,column:e,rowIndex:i,columnIndex:t,rowKey:o,showTitle:b}))},Ze=(e,t,n,r)=>{let a=1,l=1;const o=V;if("function"==typeof o){const s=o({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(s)?(a=s[0],l=s[1]):(0,Q.isPlainObject)(s)&&(a=s.rowSpan,l=s.colSpan);const c=Re[0]??0;if(e===i[c]&&0===a)for(let e=c;e<i.length;e++){const n=o({row:i[e],column:t,rowIndex:e,columnIndex:r,tableData:i});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;a++}}if(ke.length>0){const e=ke.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,l=e.colSpan)}return{rowSpan:a,colSpan:l}};return l().createElement(l().Fragment,null,l().createElement(Rt,{ref:n.current.scrollBarRef,wrapClassName:`${a}--body-wrapper`,wrapStyle:Fe,innerStyle:{height:Ne(),width:Ie()},showTopScrollbar:W?.doubleXScrollbar,onScroll:_e},l().createElement(lc.Provider,{value:Pe},l().createElement("table",{ref:ae,style:{width:0,marginTop:Ce(),marginLeft:Se()},className:`${a}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=n.current;return l().createElement("colgroup",null,(e?ve:o).map((t=>{const{dataIndex:n,width:r,renderWidth:a}=e?o[t.index]:t;return l().createElement("col",{key:n,style:{width:`${r||a}px`,minWidth:`${r||a}px`}})})))})(),l().createElement("tbody",null,(e=>{const{scrollYLoad:t,scrollXLoad:a}=n.current,s=[];return(t?e:i).forEach(((e,c)=>{const d=t?i[e.index]:e,u=t?e.index:c,m=r(d,d.index);if(s.push(((e,t,r)=>{const{scrollXLoad:a}=n.current,{disabled:i}=H||{},s=["body--row",{"body--row-striped":M&&t%2!=0,"body--row-selected":f.includes(r)&&!i?.(e),"body--row-current":y===r,...E?Be(e._group):null}],c=(a?ve:o).map(((n,i)=>Qe(a?o[n.index]:n,a?n.index:i,e,t,r)));return X?l().createElement(Hc,{key:r,ref:Oe,className:Ee()(s),rowKey:r,rowIndex:t,row:e,indent:he,filter:".cell--edit input",dropOption:fe,onNodeDragStart:se,onNodeDragEnter:ce,onNodeDragOver:de,onNodeDragLeave:ue,onNodeDragEnd:me,onNodeDrop:pe},c):l().createElement("tr",{key:r,ref:Oe,"data-row-key":r,"data-row-index":t,className:Ee()(s)},c)})(d,u,m)),$?.expandedRowRender){const{expandedRowClassName:e,rowExpandable:t=ne}=$;g.includes(m)&&t(d)&&s.push(l().createElement("tr",{key:`expand_${m}`,className:"body--row-expanded"},l().createElement("td",{colSpan:(a?ve:o).length,className:"body--column",style:{paddingLeft:H?2*Bo.selectionColumnWidth:Bo.selectionColumnWidth}},l().createElement("div",{className:Ee()("cell",e)},$.expandedRowRender(d,u)))))}})),s})(be)))),!!B&&l().createElement(td,{ref:le})))}));nd.displayName="TableBody";const rd=nd,ad=()=>{const{tableRef:e,prefixCls:t,sorter:n,layout:r,flattenColumns:a,leftFixedColumns:i,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=l().useContext(Ro),{footRender:m}=e.current.props,{t:p}=G(),h=l().useRef(null);l().useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",h.current)},{tableBodyWidth:g}=r;return l().createElement("div",{ref:h,className:`${t}--footer-wrapper`},m?m(a,e.current.tableFullData):l().createElement("table",{className:`${t}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:g?`${g}px`:""}},l().createElement("colgroup",null,a.map((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;return l().createElement("col",{key:t,style:{width:`${n||r}px`,minWidth:`${n||r}px`}})}))),l().createElement("tfoot",null,s.map(((t,r)=>l().createElement("tr",{key:r,className:"footer--row"},a.map(((r,a)=>((t,r,a)=>{const{dataIndex:s,fixed:c,align:m,summation:h}=t,f=["footer--column","col--ellipsis",{"col--center":"center"===m,"col--right":"right"===m,"column--sort":!!n[s],"cell-fix-left":"left"===c,"cell-fix-right":"right"===c,"cell-fix-left-last":"left"===c&&i[i.length-1]?.dataIndex===s,"cell-fix-right-first":"right"===c&&o[0]?.dataIndex===s}],g={left:"left"===c?`${d(s)}px`:"",right:"right"===c?`${u(s)}px`:""},y=h?.render?h.render(e.current.tableFullData):Bn(r,`${s}_text`),b=0===a&&""===y?p("qm.table.config.summaryText"):y;return l().createElement("td",{key:s,title:b,className:Ee()(f),style:{...g}},l().createElement("div",{className:"cell"},b))})(r,t,a)))))))))};var id=function(e){return e.small="small",e.middle="default",e.large="default",e}(id||{});const ld=e=>{const{current:t,pageSize:n,total:r,onChange:a}=e,{global:i}=l().useContext(o),{tableRef:s,prefixCls:c,$size:d,setElementStore:u}=l().useContext(Ro),{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??Bo.pagination.showSizeChanger,v=p?.showQuickJumper??Bo.pagination.showQuickJumper,x=p?.pageSizeOptions||i?.table?.pagination?.pageSizeOptions||Bo.pagination.pageSizeOptions,E=async()=>{if(!g)return;const e=await w(g);e&&e!==n&&(a(t,e),localStorage.setItem(g,e.toString()))},w=async e=>{const t=i?.getComponentConfigApi;if(t&&!localStorage.getItem(g))try{const n=await t({key:e});if(200===n.code)return n.data}catch(e){}},C={[`${c}-pager`]:!0};return l().createElement("div",{ref:f,className:Ee()(C)},l().createElement("div",{className:"pager-alert"},"bottom"===h?.position&&l().createElement(Jo,{total:r})),l().createElement(O.Pagination,{size:id[d],showSizeChanger:b,showQuickJumper:v,pageSizeOptions:x,current:t,pageSize:n,total:r,onChange:(e,t)=>{a(e,t)},onShowSizeChange:(e,t)=>{g&&((async(e,t)=>{const n=i?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})(g,t),localStorage.setItem(g,`${t}`))}}))},od=()=>{const{prefixCls:e,layout:t}=l().useContext(Ro),n=l().useMemo((()=>{const{headerHeight:e,viewportHeight:n}=t;return{top:`${e}px`,height:`${n}px`}}),[t]);return l().createElement("div",{className:`${e}--empty`,style:n},l().createElement(ut,null))},sd=()=>{const{prefixCls:e,setElementStore:t}=l().useContext(Ro),n=l().useRef(null);l().useLayoutEffect((()=>{r()}),[]);const r=()=>{t("$resizableBar",n.current)};return l().createElement("div",{ref:n,className:`${e}--resizable-bar`})};function cd(){return cd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cd.apply(null,arguments)}const dd=l().forwardRef(((e,t)=>{const n=h(ko,e),{rowKey:r,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:w}=n,{$size:C}=X(n),S=l().useRef(null),N=l().useRef(null),I=l().useRef(null),T=l().useRef(null),R=l().useRef(null),O=we("table"),k=Y(((e,t)=>{const n="function"==typeof r?r(e,t):e?.[r];return void 0===n?(pe("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:P,tableFullData:L,setElementStore:A,setOriginColumns:F,setTableFullData:_,setTableOriginData:D,setAllTableData:H,setDeriveRowKeys:q,setInvalidRowKeys:$,setFieldAuth:M,setColumnsDefined:K,setScrollXLoad:z,setScrollYLoad:j,setResizeState:V,setHandleState:W,setSummaries:B,setSelectionRows:U,setShouldToTop:G,setRecordsMap:J,setUnMounted:ee,clearElementStore:te,clearRecordsMap:ne}=((e,{getRowKey:t,$size:n})=>{const{rowHeight:r,dynamicThead:a}=e,i=l().useRef({props:e,uid:Ko(),tableManager:jo,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],allParentRowKeys:[],deriveRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!a,scrollBarRef:l().createRef(),rowHeight:r||Bo.rowHeightMaps[n],store:new Wo,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!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,n,r="",a=0)=>e.map((e=>{const i=t(e,e.index),l=r?`${r}.${e.index+1}`:`${e.index+1}`,o={level:a,rowKey:i,indexPath:l};return e.indexPath=l,e._level=a,e._parentRowKey=a?n:null,Array.isArray(e.children)&&(o.children=s(e.children,i,l,a+1)),n?Object.assign(o,{parentRowKey:n}):o}));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},setTableOriginData:e=>{i.current.tableOriginData=e},setAllTableData:e=>{const n=qn(e);i.current.allTableData=n,i.current.allRowKeys=n.map((e=>t(e,e.index)))},setDeriveRowKeys:e=>{const n=e.some((e=>Array.isArray(e.children)));i.current.isTreeTable=n,i.current.deriveRowKeys=n?s(e,""):[],i.current.allParentRowKeys=n?$n(e,(e=>t(e,e.index))):[]},setInvalidRowKeys:e=>{i.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{i.current.fieldAuth[e]=t},setColumnsDefined:e=>{i.current.columnsDefined=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()}}})(n,{getRowKey:k,$size:C}),{tableFlatData:re,setTableFlatData:ie,filters:le,setFilters:oe,sorter:se,setSorter:de,superFilters:ue,setSuperFilters:me,pagination:he,setPagination:fe,selectionKeys:ge,setSelectionKeys:ye,rowExpandedKeys:be,setRowExpandedKeys:ve,highlightKey:xe,setHighlightKey:Ce,updateMark:Se,forceUpdate:Ne,mergedTdCells:Ie,setMergedCells:Te,layout:Re,setLayout:Oe,permission:ke,setPermission:Pe,spinning:Le,setSpinning:Ae,isPingLeft:Fe,setPingLeft:_e,isPingRight:De,setPingRight:He,isFullScreen:$e,setFullScreen:Me,updateTableFlatData:Ke}=(e=>{const{uniqueKey:t,initialSorter:n={},initialFilter:r={},paginationConfig:a,rowSelection:i,expandable:s,rowHighlight:c,mergedCells:d}=e,{global:u}=l().useContext(o),m={current:a?.current??Bo.pagination.current,pageSize:(()=>{if(t)return Number(localStorage.getItem(`tablePager_${t}`))||void 0})()??a?.pageSize??u?.table?.pagination?.pageSize??Bo.pagination.pageSize,total:0},p=i?.selectedRowKeys??i?.defaultSelectedRowKeys??[],h=s?.expandedRowKeys??s?.defaultExpandedRowKeys??[],[f,g]=l().useState([]),[y,b]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),r),[v,x]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),n),[E,w]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),[]),[C,S]=l().useState(m),[N,I]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),p),[T,R]=l().useReducer(((e,t)=>(0,Q.isEqual)(e,t)?e:t),h),[O,k]=l().useState(c?.currentRowKey??""),[P,L]=l().useReducer((e=>e+1),0),[A,F]=Go([],{value:d}),[_,D]=l().useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[H,q]=l().useState({export:!0,import:!0,print:!0}),[$,M]=l().useState(!1),[K,z]=l().useState(!1),[j,V]=l().useState(!1),[W,B]=l().useState(!1);return{tableFlatData:f,setTableFlatData:g,filters:y,setFilters:b,sorter:v,setSorter:x,superFilters:E,setSuperFilters:w,pagination:C,setPagination:S,selectionKeys:N,setSelectionKeys:I,rowExpandedKeys:T,setRowExpandedKeys:R,highlightKey:O,setHighlightKey:k,updateMark:P,forceUpdate:L,mergedTdCells:A,setMergedCells:F,layout:_,permission:H,setPermission:q,setLayout:D,spinning:$,setSpinning:M,isPingLeft:K,setPingLeft:z,isPingRight:j,setPingRight:V,isFullScreen:W,setFullScreen:B,updateTableFlatData:()=>g([...f])}})(n),{isFetch:ze,isWebPagination:je,isScrollPagination:Ve,showPagination:We,tableColumns:Be,flattenColumns:Ue,editableColumns:Ge,summationColumns:Ye,leftFixedColumns:Xe,rightFixedColumns:Qe,derivedMergeCells:Ze,treeExpandIndex:Je,showSummary:et,showFooter:tt,isHeadGroup:nt,bordered:rt,isHeadSorter:at,isHeadFilter:it,isServiceSummation:lt,isSelectCollection:ot,isTableImport:st,isTableClipboard:ct,isSuperSearch:dt,isFastSearch:ut,isPivotGrid:mt,isGroupSummary:ht,isGroupSubtotal:ft,isTableEmpty:gt,summationRows:yt,fetchParams:bt}=Xo(n,{getRowKey:k,tableRef:P,tableFullData:L,tableFlatData:re,sorter:se,filters:le,superFilters:ue,selectionKeys:ge,pagination:he,mergedTdCells:Ie}),{createElementStore:vt,tableStyles:xt,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:St,scrollYToRecord:Nt,calcTableHeight:It,resetTableScroll:Tt,doLayout:Rt}=((e,t)=>{const{height:n,minHeight:r,maxHeight:a,ellipsis:i,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:m,tableBodyRef:p,$size:h,tableColumns:f,flattenColumns:g,leftFixedColumns:y,derivedMergeCells:b,tableFlatData:v,layout:x,showFooter:E,showPagination:w,isFullScreen:C,setLayout:S,setElementStore:N,setShouldToTop:I}=t,T=l().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,i={};return r&&Object.assign(i,{minHeight:`${Vn(r)}px`}),a&&Object.assign(i,{maxHeight:`${Vn(a)}px`}),C?{...i,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...i,height:"auto"!==n?`${Vn(n)}px`:`${t}px`}:i}),[n,a,r,C,x]),R=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r,rowHeight:a}=d.current;if(void 0!==t&&t>=0)if(t<v.length)if(r)p.current.scrollToYIndex(t);else{const e=O(c(v[t],v[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*a);else if(r){const t=v.findIndex((t=>e===c(t,t.index)));t>=0&&p.current.scrollToYIndex(t)}else{const t=O(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},O=e=>d.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{N("$toper",u.current),N("$table",m.current)},tableStyles:T,getSpan:(e,t,n,r,a)=>{let i=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,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===n&&e.col===r));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=An(f,e);e=t?Fn(t).dataIndex:""}let t=0;for(let n=0;n<g.length;n++){const r=g[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=An(f,e);e=t?_n(t).dataIndex:""}const n="thead"===t?(e=>{if(!e.some((e=>e.colSpan>0)))return e;const t=[];let n=[];return e.forEach((e=>{e.colSpan>0&&n.length>0&&(t.push(n),n=[]),n.push(e)})),n.length>0&&t.push(n),t.map((e=>{const[t,n]=e.reduce(((e,t)=>(t.colSpan>0?e[0].push(t):e[1].push(t),e)),[[],[]]);return[...n,...t.reverse()]})).flat()})(g):g;let r=0;for(let t=n.length-1;t>=0;t--){const a=n[t];if(a.dataIndex===e)break;r+=a.width||a.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?g.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=d.current,a=y.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-a)},scrollYToRecord:R,calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=d.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(w?ka["small"!==h?"middle":h]+Po:0)-Po;S((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{d.current.shouldToTop&&R("",0),I(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=Bo,a=[];let i=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,a.push(e))})),a.length>0){const e=g.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===a.length)a[0].renderWidth=(a[0].minWidth||r)+t;else{const e=t/a.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;a.forEach(((t,a)=>{if(0===a)return;const i=Math.floor((t.minWidth||r)*e);n+=i,t.renderWidth=(t.minWidth||r)+i})),a[0].renderWidth=(a[0].minWidth||r)+t-n}}else a.forEach((e=>{e.renderWidth=e.minWidth||r}));S((t=>({...t,tableBodyWidth:Math.max(e,n)})))}else i=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>({...e,tableBodyWidth:i})));S((e=>({...e,tableWidth:n}))),t&&p.current.resetItemXSize(g)})(),ae((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,a=o?e.$header.offsetHeight:x.headerHeight,i=E?e.$footer.offsetHeight:x.footerHeight,l=r-a-i,s=e.$tableBody.offsetHeight;let c=0;if(C){const t=e.$toper?e.$toper.offsetHeight+Po:0,r=e.$pager?e.$pager.offsetHeight+Po:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:l,tableBodyHeight:s,tableFullHeight:c})))})()))}}})(n,{getRowKey:k,tableRef:P,topElementRef:S,tableElementRef:N,tableBodyRef:I,$size:C,tableColumns:Be,flattenColumns:Ue,leftFixedColumns:Xe,derivedMergeCells:Ze,tableFlatData:re,layout:Re,showFooter:tt,showPagination:We,isFullScreen:$e,setLayout:Oe,setElementStore:A,setShouldToTop:G}),{initialTable:Ot,checkDataIndex:kt,createTableFullData:Pt,getTableData:Lt,createTableList:At,createTableData:Ft,createGroupData:_t,createSelectionKeys:Dt,createRowExpandedKeys:Ht,setSelectionKeysEffect:qt,findParentRowKeys:$t,getAllChildRowKeys:Mt,doFieldValidate:Kt,getTableLog:zt,dataChange:jt,tableChange:Vt,toLastPage:Wt,toFirstPage:Bt,getPageCount:Ut,pagerChangeHandle:Gt,scrollBottomDebouncer:Yt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:en,clearTableLog:tn,destroy:nn}=Qo(n,{getRowKey:k,tableRef:P,tableElementRef:N,tableBodyRef:I,$size:C,tableColumns:Be,flattenColumns:Ue,tableFullData:L,pagination:he,layout:Re,filters:le,sorter:se,superFilters:ue,fetchParams:bt,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,summationColumns:Ye,isFetch:ze,isWebPagination:je,isScrollPagination:Ve,isServiceSummation:lt,isGroupSubtotal:ft,doLayout:Rt,setTableFlatData:ie,setTableFullData:_,setTableOriginData:D,setAllTableData:H,setDeriveRowKeys:q,setPagination:fe,setPingRight:He,setPingLeft:_e,setSpinning:Ae,setSorter:de,setFilters:oe,setSuperFilters:me,setSelectionKeys:ye,setRowExpandedKeys:ve,setHighlightKey:Ce,setSelectionRows:U,setScrollXLoad:z,setScrollYLoad:j,setFieldAuth:M,setResizeState:V,setSummaries:B,setPermission:Pe,setRecordsMap:J,resetTableScroll:Tt,clearElementStore:te,clearRecordsMap:ne});((e,t)=>{const{columns:n,summation:r,rowSelection:a,expandable:i,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,summationRows:f,showSummary:g,isWebPagination:y,isScrollPagination:b,checkDataIndex:v,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:C,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:I,setRowExpandedKeys:T,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:P,createSelectionKeys:L,createRowExpandedKeys:A,initialTable:F,destroy:_}=t,D=l().useRef(f);qe((()=>{if(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),m.__prevent__||e?.(m,s.current.selectionRows),zn(m)}),[m]),qe((()=>{if(!i)return;const{onChange:e}=i;p.__prevent__||e?.(p,p.map((e=>s.current.recordsMap.get(e)))),zn(p)}),[p]),qe((()=>{o&&(c.current.setClickedValues(h?[h,""]:[]),o.onChange?.(h,s.current.recordsMap.get(h)??null))}),[h]),qe((()=>{(0,Q.isEqual)(f,D.current)||(D.current=f,g&&r&&r.onChange?.(f))}),[f]),qe((()=>{const e=L(a.selectedRowKeys);(0,Q.isEqual)(e,m)||N(Kn(e))}),[a?.selectedRowKeys]),qe((()=>{const e=A(i.expandedRowKeys);(0,Q.isEqual)(e,p)||T(Kn(e))}),[i?.expandedRowKeys]),qe((()=>{const{currentRowKey:e}=o;e!==h&&R(e??"")}),[o?.currentRowKey]),qe((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(y&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&C({insert:null,remove:!1})}),[u.total]),qe((()=>{P()}),[d]),qe((()=>{(s.current.scrollYLoad||b)&&(e.height||e.maxHeight||pe("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,b]),Zo({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(O(Object.assign({},e,{winHeight:n})),P())},delay:16}),l().useEffect((()=>(I(ce(n)),F(),v(),ae((()=>P())),()=>{_(),k(!0)})),[])})(n,{tableRef:P,tableBodyRef:I,$size:C,pagination:he,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,showSummary:et,summationRows:yt,isWebPagination:je,isScrollPagination:Ve,checkDataIndex:kt,toLastPage:Wt,toFirstPage:Bt,getPageCount:Ut,setHandleState:W,scrollYToRecord:Nt,setOriginColumns:F,setSelectionKeysEffect:qt,setRowExpandedKeys:ve,setHighlightKey:Ce,setResizeState:V,setUnMounted:ee,calcTableHeight:It,createSelectionKeys:Dt,createRowExpandedKeys:Ht,initialTable:Ot,destroy:nn});const rn=l().useMemo((()=>({getRowKey:k,tableRef:P,tableBodyRef:I,prefixCls:O,$size:C,tableFlatData:re,flattenColumns:Ue,editableColumns:Ge,leftFixedColumns:Xe,rightFixedColumns:Qe,treeExpandIndex:Je,sorter:se,filters:le,superFilters:ue,layout:Re,bordered:rt,showFooter:tt,showSummary:et,summationRows:yt,pagination:he,fetchParams:bt,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,mergedTdCells:Ie,derivedMergeCells:Ze,updateMark:Se,isFetch:ze,isPingLeft:Fe,isPingRight:De,isHeadSorter:at,isHeadFilter:it,isFullScreen:$e,isTableEmpty:gt,isHeadGroup:nt,isGroupSubtotal:ft,isWebPagination:je,dataChange:jt,tableChange:Vt,getTableData:Lt,setElementStore:A,createTableList:At,createTableFullData:Pt,updateTableFlatData:Ke,setSorter:de,setFilters:oe,setSuperFilters:me,setHighlightKey:Ce,setRowExpandedKeys:ve,setSelectionRows:U,setSelectionKeysEffect:qt,setInvalidRowKeys:$,setMergedCells:Te,getSpan:Et,getStickyLeft:wt,getStickyRight:Ct,scrollXToColumn:St,scrollYToRecord:Nt,setPagination:fe,setPingLeft:_e,setPingRight:He,setSpinning:Ae,setFullScreen:Me,setShouldToTop:G,doFieldValidate:Kt,createTableData:Ft,createGroupData:_t,findParentRowKeys:$t,getAllChildRowKeys:Mt,scrollBottomDebouncer:Yt,resetTableScroll:Tt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:en})),[C,re,Ue,se,le,ue,Re,rt,tt,et,yt,he,bt,ge,be,xe,Ze,Se,ze,Fe,De,at,it,$e,gt,nt,ft,je]);((e,t)=>{const{getRowKey:n,tableRef:r,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,createTableData:b,createTableFullData:v,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:S,setHandleState:N,setColumnsDefined:I,setSelectionKeysEffect:T,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:P,forceUpdate:L,getTableLog:A,clearRowSelection:F,clearRowHighlight:_,clearTableSorter:D,clearTableFilter:H,clearSuperFilters:q,clearTableLog:$}=t,{columns:M,columnsChange:K}=r.current.props,z=(e,t,r)=>e.filter((e=>{const a=n(e,e.index);e.children&&(e.children=z(e.children,t,r));const i=t.includes(a);return i&&r?.(e,a),!i}));l().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:async e=>{f&&(await y(),e?.())},GET_LOG:()=>A(),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||(F(),_(),D(),H(),q(),$(),b([]))},CLEAR_LOG:()=>{$()},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=>{E(e)},SET_SELECTION:(e,t)=>{T(t?Kn([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?Kn([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{v(e)},DEFINE_INITIAL_COLUMNS:e=>{P(e),I(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=An(M,e);if(!r)return pe("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,Q.isPlainObject)(t))return pe("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return pe("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,Q.set)(r,e,t[e]);n&&(K?K([...M]):pe("Table","需要设置 `columnsChange` 参数"),L())},INSERT_RECORDS:(e,t)=>{const{store:a,tableFullData:i}=r.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:n}=t;[Bo.expandableColumn,Bo.selectionColumn,Bo.operationColumn].includes(n)||Un(e,n,Bn(e,n))})),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=sr(i,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}c&&N(Object.assign({},r.current.handleState,{insert:o?"before":"after"})),b(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:a}=r.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,Q.isPlainObject)(e)?n(e,e.index):e));if(!i.length)return;let l=!1;const o=z(a,i,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:a,editRender:i}=r,l=i?.(e,r);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:n,y:a}),t.removeFromValidate({x:n,y:a}),t.removeFromEdited({x:n,y:a}))})),l=!0}));l&&(N(Object.assign({},r.current.handleState,{remove:!0})),v(o),T(m.filter((e=>!i.includes(e)))),i.includes(h)&&_(),R(p.filter((e=>!i.includes(e)))),g(),ae((()=>{S(z(r.current.tableOriginData,i))})))},VALIDATE_FIELDS:(e,t)=>{r.current.allTableData.forEach((r=>{c.forEach((a=>{const{dataIndex:i,title:l,editRender:o}=a,s=o?.(r,a);if(!s)return;const c=n(r,r.index);if(e&&!e.includes(c))return;if(t&&!t.includes(i))return;const{rules:d=[],disabled:u}=s;u||C(d,Bn(r,i),c,i,nr(l))}))}));const{required:a,validate:i}=A(),l=[...a,...i];return l.length&&w(l[0].rowKey),L(),{required:a,validate:i}}})))})(t,{getRowKey:k,tableRef:P,toolBoxRef:T,tableBodyRef:I,columnFilterRef:R,flattenColumns:Ue,editableColumns:Ge,pagination:he,fetchParams:bt,selectionKeys:ge,rowExpandedKeys:be,highlightKey:xe,isFetch:ze,dataChange:jt,getTableData:Lt,createTableData:Ft,createTableFullData:Pt,calcTableHeight:It,scrollXToColumn:St,scrollYToRecord:Nt,doFieldValidate:Kt,setTableOriginData:D,setHandleState:W,setColumnsDefined:K,setSelectionKeysEffect:qt,setRowExpandedKeys:ve,setHighlightKey:Ce,setSelectionRows:U,setOriginColumns:F,forceUpdate:Ne,getTableLog:zt,clearRowSelection:Jt,clearRowHighlight:en,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearTableLog:tn}),l().useLayoutEffect((()=>{vt(),P.current.tableManager.register(P.current.uid,t??{current:null})}),[]);const an={[`${O}--wrapper`]:!0,[`${O}--lg`]:"large"===C,[`${O}--sm`]:"small"===C,[`${O}--maximize`]:$e,[c]:!!c},ln={[O]:!0,"is--border":rt,"is--fixed":Xe.length||Qe.length,"is--sortable":at,"is--filterable":it,"is--head-group":nt,"is--area-select":!!d,"is--ping-left":Fe,"is--ping-right":De};return l().createElement(Ro.Provider,{value:rn},l().createElement("div",{className:Ee()(an,E),style:w},g&&l().createElement("div",{ref:S,className:`${O}-top`},l().createElement("div",{className:`${O}-top__space`},"bottom"!==p?.position&&l().createElement(Jo,{total:he.total}),l().createElement("div",{className:`${O}-top__space-slot`,style:{justifyContent:qo[f]}},n.children)),l().createElement("div",{className:`${O}-top__actions`},l().createElement(Us,{ref:T,showFullScreen:y,showReload:b&&ze,showPrint:ke.print&&!!u,showImport:ke.import&&st,showExport:ke.export&&!!m,showClipboard:ct,showCollection:ot,showFastSearch:ut,showSuperSearch:dt,showPivotGrid:mt,showGroupSummary:ht,showToolBox:v,tableColumns:Be}),l().createElement(Xs,{ref:R,columns:a}))),l().createElement(pt,{spinning:i??Le},l().createElement("div",{ref:N,className:Ee()(ln),style:xt},l().createElement("div",{className:`${O}--main-wrapper`},x&&l().createElement(ic,{tableColumns:Be}),l().createElement(rd,{ref:I}),tt&&l().createElement(ad,null)),rt&&l().createElement("div",{className:`${O}--border-line`}),gt&&l().createElement(od,null),s&&l().createElement(sd,null))),We&&l().createElement(ld,cd({},he,{onChange:(e,t)=>Gt({current:e,pageSize:t})}))))}));dd.displayName="QmTable";const ud=dd,md=ud;function pd(){return pd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pd.apply(null,arguments)}const hd=e=>{const{uniqueKey:t,multiple:n,initialValue:r,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=Et(h),[v,x]=l().useState(s),[E,w]=l().useState(),[C,S]=l().useState(i),[N,I]=l().useState(!1),[T,R]=l().useState(300),[O,k]=l().useState(o),[P,L]=l().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>l().createElement("span",null,e+1)},...s.columns||[]]),[A,F]=l().useState((0,Q.merge)({},s.fetch?.params,r)),[_,D]=l().useState([]),H=()=>{const e=h.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*ka[m]-30)},q=wt(H,5);g((()=>{q()}),[b.width]),qe((()=>{(0,Q.isEqual)(o,O)||k(o)}),[o]),l().useEffect((()=>{$()}),[A]),l().useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&f.current?.SET_FIELDS_VALUE(r)}),[]);const $=async()=>{const{webPagination:e,fetch:t}=v;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ne}=t;if(i(A)){I(!0);try{const e=await r(A);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];n||(S([]),await re(0)),D(t)}}catch(e){}I(!1)}},M=e=>{n||(w(e),u(e))},K=e=>{F(Object.assign({},A,e))},z=we("search-helper"),j={[`${z}--wrapper`]:!0},V=v.webPagination?{dataSource:_,loading:N,webPagination:!0}:{fetch:{...v.fetch,params:A}};return l().createElement("div",{ref:h,className:Ee()(j,c),style:d},l().createElement("div",{className:"form-wrap"},O.length?l().createElement(zl,{ref:f,items:O,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(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(md,pd({ref:y,uniqueKey:t,height:T,columns:P,rowKey:v.rowKey||"pageIndex"},V,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{S(e),w(n?t:t[0])}},paginationConfig:v.paginationConfig,columnsChange:e=>L(e),onRowDblclick:M,onRowEnter:M}))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ka[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>u(null),style:{marginRight:8}},p("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!E,onClick:()=>u(E,n?C:void 0)},p("qm.dialog.confirm"))))};hd.displayName="QmSearchHelper";const fd=hd;function gd(){return gd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gd.apply(null,arguments)}const yd=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...yd(e.children)),e.children&&t.push(e.value)})),t},bd=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=bd(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},vd=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&vd(e.children,t),t(e)||e.children&&e.children.length))),xd=e=>{const{uniqueKey:t,multiple:n,initialValue:r,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=Et(f),[x,E]=l().useState(s),[w,C]=l().useState(),[S,N]=l().useState(i),[I,T]=l().useState(!1),[R,k]=l().useState(300),[P,L]=l().useState(300),[A,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,q]=l().useState((0,Q.merge)({},s.fetch?.params,r)),[$,M]=l().useState([]),K=()=>{const e=f.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");k(e.offsetHeight-n.offsetHeight-10),L(e.offsetHeight-t.offsetHeight-2*ka[p]-30)},z=wt(K,5);g((()=>{z()}),[v.width]),qe((()=>{(0,Q.isEqual)(o,A)||F(o)}),[o]),l().useEffect((()=>{j()}),[H]),l().useEffect((()=>{a&&b.current.SET_SELECTION_ROWS(a)}),[a]),l().useEffect((()=>{r&&y.current?.SET_FIELDS_VALUE(r),ie()}),[]);const j=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ne}=t;if(i(H)){T(!0);try{const e=await r(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,a)??[];n||(N([]),await re(0)),M(t)}}catch(e){}T(!1)}},V=e=>{n||(C(e),m(e))},W=e=>{q(Object.assign({},H,e))},[B,U]=l().useState([]),[Y,Z]=l().useState([]),[J,ee]=l().useState(""),te=l().useRef(B),ae=l().useRef([]);qe((()=>{Z(yd(B))}),[B]);const ie=async()=>{if(!c.fetch)return;const{api:e,params:t,dataKey:n,valueKey:r="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,n)??[],t=Pr(e,r,a);U(t),te.current=t,ae.current=e}}catch(e){}},le=e=>`${e}|${Xr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe=we("tree-table-helper"),se={[`${oe}--wrapper`]:!0},ce=x.webPagination?{dataSource:$,loading:I,webPagination:!0}:{fetch:{...x.fetch,params:H}};return l().createElement("div",{ref:f,className:Ee()(se,d),style:u},l().createElement(rt,{defaultValue:200,style:{height:"100%"}},l().createElement(rt.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=vd(te.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==le(n).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:B,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,n={};for(const r in t)n[r]=(0,Q.get)(e,t[r]);W(n)})(bd(ae.current,(n=>(0,Q.get)(n,t)===e[0]))||{})}})),l().createElement(rt.Pane,{className:"split-pane"},l().createElement("div",{className:"form-wrap"},A.length?l().createElement(zl,{ref:y,items:A,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>F(e),onCollapse:()=>K(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await y.current.GET_FORM_DATA();e||W(t)}}):null),l().createElement("div",null,l().createElement(md,gd({ref:b,uniqueKey:t,height:P,columns:_,rowKey:x.rowKey||"pageIndex"},ce,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),C(n?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>D(e),onRowDblclick:V,onRowEnter:V}))))),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ka[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>m(null),style:{marginRight:8}},h("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!w,onClick:()=>m(w,n?S:void 0)},h("qm.dialog.confirm"))))};xd.displayName="TreeTableHelper";const Ed=xd,wd=e=>{const{multiple:t,tree:n={},defaultSelectedKeys:r,className:a,style:i,onClose:o}=e,{$size:s}=X(e),{t:c}=G(),[d,u]=l().useState(),[m]=l().useState(n.fetch?.params),p=we("tree-helper"),h={[`${p}--wrapper`]:!0},f=n.fetch?{...se(n.fetch,["params","valueKey","textKey"]),params:m}:void 0;return l().createElement("div",{className:Ee()(h,a),style:i},l().createElement(To,{multiple:t,fetch:f,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},autoFocus:!0,asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:r,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>u(e),onCheckChange:e=>u(e)}),l().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ka[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!d,onClick:()=>o(d)},c("qm.dialog.confirm"))))};wd.displayName="TreeHelper";const Cd=wd;function Sd(){return Sd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sd.apply(null,arguments)}const Nd="_startSign",Id="_endSign",Td=e=>{const{uniqueKey:t,initialValue:n,filters:r=[],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=Et(c),[p,h]=l().useState(a),[f,y]=l().useState(!1),[b,v]=l().useState([]),[x,E]=l().useState(300),[w,C]=l().useState(r),[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:Nd,width:80,align:"right",render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)},...a.columns||[],{title:s("qm.form.rangeSearchHelper")[1],dataIndex:Id,fixed:"right",width:80,render:(e,t)=>l().createElement("span",{className:"icon-sign"},e)}]),[I,T]=l().useState((0,Q.merge)({},a.fetch?.params,n)),[R,k]=l().useState([]),P=l().useMemo((()=>b.map((e=>e?.pageIndex))),[b]),L=l().useMemo((()=>2===P.length&&P.every((e=>void 0!==e))),[P]),A=()=>{const e=c.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*ka[o]-30)},F=wt(A,5);g((()=>{F()}),[m.width]),qe((()=>{(0,Q.isEqual)(r,w)||C(r)}),[r]),l().useEffect((()=>{_()}),[I]);const _=async()=>{const{webPagination:e,fetch:t}=p;if(!e||!t?.api)return;const{api:n,dataKey:r,beforeFetch:a=ne}=t;if(a(I)){y(!0);try{const e=await n(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,Q.get)(e.data,r)??[];k(t)}}catch(e){}y(!1)}},D=(e,t)=>{delete e[t]},H=()=>{b.forEach((e=>{e&&(D(e,Nd),D(e,Id))})),v([])},q=e=>{H(),T(Object.assign({},I,e))},$=we("range-helper"),M=p.webPagination?{dataSource:R,loading:f,webPagination:!0}:{fetch:{...p.fetch,params:I}};return l().createElement("div",{ref:c,className:`${$}--wrapper`},l().createElement("div",{className:"form-wrap"},w.length?l().createElement(zl,{ref:d,items:w,initialValues:n,uniqueKey:t,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>A(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||q(t)}}):null),l().createElement("div",null,l().createElement(md,Sd({ref:u,height:x,columns:S,rowKey:p.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=P[0]&&e.pageIndex<=P[1]?{backgroundColor:"#f5f5f5"}:{}},M,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[Nd,Id].includes(n)&&(n===Nd&&(e[n]?(D(e,n),v([void 0,b[1]])):e.pageIndex>P[1]?O.message.warning(s("qm.searchHelper.rangeStartTip")):(b[0]&&D(b[0],n),e[n]="[",v([e,b[1]]))),n===Id&&(e[n]?(D(e,n),v([b[0],void 0])):e.pageIndex<P[0]?O.message.warning(s("qm.searchHelper.rangeEndTip")):(b[1]&&D(b[1],n),e[n]="]",v([b[0],e]))),u.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===P[0]&&(e[Nd]="["),e.pageIndex===P[1]&&(e[Id]="]")}))}}),l().createElement(ge,{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:`${ka[o]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},l().createElement(ge,{onClick:()=>i(null),style:{marginRight:8}},s("qm.dialog.cancel")),l().createElement(ge,{type:"primary",disabled:!L,onClick:()=>i(b.map((e=>(e=>{const t={};for(const n in e)[Nd,Id].includes(n)||(t[n]=e[n]);return t})(e))))},s("qm.dialog.confirm"))))};Td.displayName="RangeTableHelper";const Rd=Td,Od=e=>null!=e;function kd(e,t,n,r){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,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:a,bottom:i,left:l}=e.getBoundingClientRect();return r>=0&&l>=0&&a<=t&&i<=n})(a)&&t&&a.scrollIntoView(r);const{left:e,top:n,width:i,height:l}=a.getBoundingClientRect(),o={left:e,top:n,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]),Zo({handler:c}),[l().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),a]}const Pd={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"]}},Ld={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"]}},Ad=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Fd(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(Pd).forEach((e=>{const c={...r&&Ld[e]||Pd[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Ad.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:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?8:r}}({contentRadius:i,limitVerticalRadius:!0});if(r)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]=2*-d.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":c.offset[1]=2*d.arrowOffsetHorizontal-o}c.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const a=r&&"object"==typeof r?r:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+n,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,n),l&&(c.htmlRegion="visibleFirst")})),s}const _d=require("@rc-component/portal");var Dd=r.n(_d);const Hd=require("@rc-component/trigger");var qd=r.n(Hd);function $d(){return $d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$d.apply(null,arguments)}const Md={fill:"transparent",pointerEvents:"auto"},Kd=e=>{const{prefixCls:t,rootClassName:n,pos:r,showMask:a,style:i={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${t}-mask-${Ko()}`,m="object"==typeof c?c?.placeholder:c;return l().createElement(Dd(),{open:s,autoLock:!0},l().createElement("div",{className:Ee()(`${t}-mask`,n),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"}),r&&l().createElement("rect",{x:r.left,y:r.top,rx:r.radius,width:r.width,height:r.height,fill:"black",className:m?`${t}-placeholder-animated`:""}))),l().createElement("rect",$d({},r?null:Md,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),r&&l().createElement(l().Fragment,null,l().createElement("rect",$d({},Md,{x:"0",y:"0",width:"100%",height:`${r.top}px`})),l().createElement("rect",$d({},Md,{x:"0",y:"0",width:r.left,height:"100%"})),l().createElement("rect",$d({},Md,{x:"0",y:r.top+r.height,width:"100%",height:`calc(100vh - ${r.top+r.height}px)`})),l().createElement("rect",$d({},Md,{x:r.left+r.width,y:"0",width:`calc(100vw - ${r.left+r.width}px)`,height:"100%"})))):null))},zd=e=>{const{prefixCls:t,zIndex:n,open:r,onPause:a,onPlay:i}=e,[o,s]=Go(void 0,{value:r,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=zt()(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:n+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-Be(t).x,o=e.clientY-Be(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-n-1&&(s=a-n-1),c<0&&(c=0),c>i-r-1&&(c=i-r-1),je(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))},jd=e=>{const{prefixCls:t,current:n,total:r=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=>{C(e),40===e.keyCode&&(n<r-1?p?.():h?.()),38===e.keyCode&&n>0&&m?.()}));l().useEffect((()=>{const e=zt()(document,"keyup",v);return()=>e.remove()}),[]);const x=Od(a)?l().createElement("div",{className:`${t}-cover`},a):null,E=Od(o)?l().createElement("div",{className:`${t}-description`},o):null;let w;w=g?g(n,r):[...Array.from({length:r}).keys()].map(((e,r)=>l().createElement("span",{key:e,className:Ee()(r===n&&`${t}-indicator-active`,`${t}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return l().createElement("div",{className:Ee()(`${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:Ee()(`${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`},r>1&&l().createElement("div",{className:`${t}-indicators`},w),l().createElement(ve,{className:`${t}-buttons`},0!==n?l().createElement(ge,{className:`${t}-prev-btn`,size:"small",onMouseDown:C,onClick:m},y("qm.tour.prevStep")):null,n===r-1?l().createElement(ge,{className:`${t}-finish-btn`,type:b,size:"small",onClick:h},y("qm.tour.finish")):l().createElement(ge,{className:`${t}-next-btn`,type:b,size:"small",onMouseDown:C,onClick:p},y("qm.tour.nextStep"))))))},Vd=e=>{const{current:t,renderPanel:n}=e;return l().createElement(l().Fragment,null,"function"==typeof n?n(e,t):l().createElement(jd,e))};function Wd(){return Wd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wd.apply(null,arguments)}const Bd={left:"50%",top:"50%",width:1,height:1},Ud=l().forwardRef(((e,t)=>{const{steps:n=[],defaultCurrent:r,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:w=!0,scrollIntoViewOptions:C=!0,...S}=e,N=l().useRef(),[I,T]=Go(0,{value:a,defaultValue:r}),[R,O]=Go(void 0,{value:c,postState:e=>!(I<0||I>=n.length)&&(e??!1)}),[k,P]=Go(1051,{value:b,defaultValue:b}),[L,A]=l().useState(),F=l().useRef(R);l().useLayoutEffect((()=>{R&&!F.current&&T(0),F.current=R,A(R)}),[R]),l().useImperativeHandle(t,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>P(e)})));const{target:_,type:D,placement:H,trigger:q,delay:$,style:M,arrow:K,className:z,mask:j,scrollIntoViewOptions:V,zIndex:W,action:B}=n[I]||{},U=W||k,G=D||d,Y=R&&(j??u),X=V??C,[Q,Z]=kd(_,!!c,E,X),J=((e,t,n)=>n??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,I]),qe((()=>{R&&(ie(),B?.(Z,I))}),[R,Z]);const ne=e=>{T(e),i?.(e)},ae=()=>{O(!1),o?.(I)},ie=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||"none"===ze(r=n,"display")||"hidden"===ze(r,"visibility")||"0"===ze(r,"opacity")||e.push(n);for(const e of Array.from(n.childNodes))t(e)}}(Z),e.length&&e[0].focus()};if(void 0===Z)return null;const le=async()=>{if(!q||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[a,i]=[e+n/2,t+r/2],l=new MouseEvent(q,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await re($??320))},oe="boolean"==typeof Y?Y:!!Y,se="boolean"==typeof Y?void 0:Y,ce=Object.assign({},f,M),de=we("tour"),ue=[{[`${de}-primary`]:"primary"===G},h,z],me=Fd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(Kd,{zIndex:U,prefixCls:de,pos:Q,showMask:oe,style:se?.style,fill:se?.color,open:L,animated:w,rootClassName:h}),l().createElement(Dd(),{open:L,autoLock:!0},l().createElement(qd(),Wd({ref:N},S,{zIndex:U,builtinPlacements:me,popupStyle:ce,popupPlacement:J,popupVisible:L,popupClassName:Ee()(ue),prefixCls:de,popup:()=>l().createElement(Vd,Wd({key:"content",arrow:ee,prefixCls:de,total:n.length,helper:y,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await le(),ne(I-1)},onNext:async()=>{await le(),ne(I+1)},onClose:ae,current:I,onFinish:()=>{ae(),s?.()}},Object.assign({},n[I],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),l().createElement("div",{className:Ee()(h,`${de}-target-placeholder`),style:{...Q||Bd,position:"fixed",pointerEvents:"none"}}))),p&&l().createElement(Dd(),{open:R},l().createElement(zd,{zIndex:U,prefixCls:de,onPause:()=>A(!1),onPlay:()=>A(!0)})))}));Ud.displayName="QmTour";const Gd=Ud,Yd=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],Xd=e=>({_s:e,status:Yd[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),Qd=e=>e?6:5,Zd=(e,t,n,r,a)=>{clearTimeout(r.current);const i=Xd(e);t(i),n.current=i,a?.({current:i})},Jd=e=>{const{name:t,in:n,timeout:r,preEnter:a=!0,preExit:o}=e,[s,c]=((e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:a,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:d}=e||{},[u,m]=(0,i.useState)((()=>Xd(o?2:Qd(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 Qd(t)}})(p.current._s,c);e&&Zd(e,m,p,h,d)}),[d,c]),b=(0,i.useCallback)((e=>{const i=e=>{switch(Zd(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?r?0:1:2):l&&i(n?a?3:4:Qd(c))}),[y,d,t,n,r,a,f,g,c]);return(0,i.useEffect)((()=>()=>clearTimeout(h.current)),[]),[u,b,y]})({timeout:r,preEnter:a,preExit:o,initialEntered:n});return g((()=>{c()}),[n]),l().createElement(l().Fragment,null,l().Children.map(e.children,(e=>l().isValidElement(e)?Gc(e,{className:Ee()(e.props.className,t,s.status)}):e)))},eu={previewWidth:1100,defaultDistance:.45,logoHeight:60},tu=(0,i.createContext)(void 0);var nu=null;function ru(){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),n=e.match(/MSIE\D?\d+/i),r=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!n&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){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 au(e,t){var n;try{var r=navigator.userAgent,a=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(ru()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void O.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&r.match(/x64/i),e||t?n=a?e:t:nu?n=nu:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),nu=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n;return n.VERSION<"6.2.2.6"&&ru(),n}catch(e){O.message.error("getLodop 出错:"+e)}}ru();const iu=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:n}=window.screen;if(t&&n)e[0]=t,e[1]=n;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)},lu=l().forwardRef(((e,t)=>{const{templateRender:n,directPrint:r}=e,{global:a}=l().useContext(o),{$$preview:i}=l().useContext(tu),{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:k,createExportHtml:L,createPrintHtml:P,SHOW_PREVIEW:A,DIRECT_PRINT:F}))),qe((()=>{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*eu.defaultDistance+10*eu.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*eu.defaultDistance+10*eu.defaultDistance:0;return("vertical"===e?d[1]:d[0])-t}),[s,c,d]),x=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return iu(b-10*(e.left-eu.defaultDistance)-10*(e.right-eu.defaultDistance))}),[s,b]),E=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return iu(v-10*(e.top-eu.defaultDistance)-10*(e.bottom-eu.defaultDistance))}),[s,v]),w=s.form.scale,C=l().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:iu(10*e.left),right:iu(10*e.right),top:iu(10*e.top),bottom:iu(10*e.bottom)}}),[s]),S=l().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:n,top:r,bottom:a}=C,i=x+t+n,l=eu.previewWidth-i<=0?0:(eu.previewWidth-i)/2,o=Math.abs((1-w)*i/2);let c=0;return w>1&&(c=o>l?-1*l:-1*o),w<1&&(c=i-2*o>eu.previewWidth?0:l>0?o:(eu.previewWidth-(i-2*o))/2),{width:`${x}px`,height:"stylus"===e?"auto":E+"px",paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${w})`,opacity:g?0:1}}),[s,g,C,w,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: ${eu.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,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=m.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},R=()=>{const e=m.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const a=e[r].clientHeight;e[r].style.height=a+"px",n.push(a),t.push(e[r].outerHTML)}h.current=n,p.current=t},O=()=>{if(!p.current.length)return;const{form:{setting:e,printerType:t}}=s;if(r)return f.current.push([I(),N(),...p.current]);const n=e.fixedLogo?E-eu.logoHeight:E;let a=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[N()]:[],...p.current]);else{let t=0;for(let r=0,i=h.current.length;r<i;r++){const l=p.current[r],o=h.current[r];e.fixedLogo||0!==r||(t+=eu.logoHeight),t+=o,t<=n?a.push(l):(f.current.push([I(),...e.fixedLogo?[N()]:[],...a]),a=[],t=0,r-=1),r===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}),k()},k=()=>{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},P=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},L=()=>{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()+I()+e.join("")+"</table>"},A=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();m.current.previewEl.innerHTML||(T(),await re(0),R(),O(),y(!1))},F=async()=>{if("TABLE"!==m.current.templateEl?.tagName)return _();T(),await re(0),R(),O(),y(!1),i.doPrint(P()),await re(0),i.doClose()},_=()=>{pe("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D=we("print-container"),H={[D]:!0,"no-visible":r};return l().createElement("div",{ref:u,className:Ee()(H)},l().createElement(pt,{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`}},n?.()),l().createElement("div",{className:"workspace",style:S}))))}));lu.displayName="Container";const ou=lu;function su(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class cu extends i.Component{constructor(...e){super(...e),su(this,"context",void 0),su(this,"formRef",l().createRef()),su(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:eu.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:eu.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:eu.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:eu.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),su(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})})),su(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")}))),su(this,"state",{formList:this.createFormList()}),su(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())})),su(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return l().createElement(l().Fragment,null,l().createElement(zl,{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(ge,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},p("qm.dialog.close")),l().createElement(ge,{type:"primary",onClick:()=>this.confirmHandle()},p("qm.dialog.confirm"))))}}su(cu,"contextType",o);const du=cu;function uu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class mu extends i.Component{constructor(...e){super(...e),uu(this,"context",void 0),uu(this,"provide",{$$preview:this}),uu(this,"containRef",l().createRef()),uu(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:eu.defaultDistance,right:eu.defaultDistance,top:eu.defaultDistance,bottom:eu.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),uu(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),uu(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),uu(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 As().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),uu(this,"doClose",(()=>{this.props.onClose?.()})),uu(this,"getPrintConfig",(async e=>{const t=this.context.global,n=t?.getComponentConfigApi;if(n)try{const t=await n({key:e});if(200===t.code)return t.data}catch(e){}})),uu(this,"savePrintConfig",(async(e,t)=>{const n=this.context.global,r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})),uu(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 ')),uu(this,"doPrint",(e=>{const t=au();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=eu,{left:d,right:u,top:m,bottom:h}=a.distance;t.PRINT_INIT(n??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?r&&this.doClose():O.message.error(p("qm.print.printError"))},t.PRINT()})),uu(this,"doExport",(e=>{const t=au();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(n??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&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=au(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const n=e.GET_PRINTER_COUNT();for(let r=0;r<n;r++)t.push({text:e.GET_PRINTER_NAME(r),value:r})}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 As().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,Q.isPlainObject)(e)&&await As().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:n,form:r,currentPage:a,totalPage:i,printPage:o}=this.state,s=we("print-preview"),c={visible:n,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:Ee()(d)},l().createElement("div",{className:"outer"},l().createElement("div",{className:"header"},l().createElement("span",null,p("qm.print.printer"),":",l().createElement(O.Select,{value:r.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:r.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:r.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(ge,{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(ge,{type:"text",icon:l().createElement(Ce.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),l().createElement("span",null,l().createElement(ge,{icon:l().createElement(Ce.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),l().createElement("div",{className:"main"},l().createElement(tu.Provider,{value:this.provide},l().createElement(ou,{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:r.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*r.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(mn,c,l().createElement(du,{setting:r.setting,onChange:e=>{this.setState((t=>(0,Q.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):l().createElement(tu.Provider,{value:this.provide},l().createElement(ou,{ref:this.containRef,templateRender:t,directPrint:!0}))}}uu(mu,"contextType",o);const pu=mu;function hu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class fu extends i.Component{constructor(...e){super(...e),hu(this,"context",void 0),hu(this,"previewRef",l().createRef()),hu(this,"state",{visible:!1,loading:!1}),hu(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})})),hu(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${eu.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:t,uniqueKey:n,defaultConfig:r,preview:a,closeAfterPrint:i,onClose:()=>{this.setState({visible:!1})}};return a?l().createElement(mn,o,l().createElement(pu,s)):e?l().createElement(pu,s):null})),hu(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await re(0),this.setState({visible:!0}),await re(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:n,type:r,disabled:a,shape:i}=this.props,o={size:t||this.context.size||"",type:r,shape:i,icon:n,loading:e,disabled:a,click:this.clickHandle};return l().createElement(l().Fragment,null,this.props.children&&l().createElement(ge,o,this.props.children),this.createRender())}}hu(fu,"propTypes",{size:(e,t,n)=>{if(!pr(e[t]||""))return me("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:mr().elementType}),hu(fu,"defaultProps",{preview:!0,type:"primary",icon:l().createElement(Ce.PrinterOutlined,null)}),hu(fu,"contextType",o);const gu=fu;function yu(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function bu(e){const t=yu(e);return t?t.frameElement:null}function vu(e){const t=wu(e);return xu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function xu(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 Eu(e,t){const n=bu(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let a=n,i=!1;for(;a;){const e=vu(a);if(r.push(e),a=bu(a),i)break;a&&yu(a)===t&&(i=!0)}return xu(r)}return e.getBoundingClientRect()}function wu(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 Cu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Su=Object.assign;class Nu{constructor(e,t){Cu(this,"node",void 0),Cu(this,"border",void 0),Cu(this,"padding",void 0),Cu(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=Ou.border,this.padding.style.borderColor=Ou.padding,this.content.style.backgroundColor=Ou.background,Su(this.node.style,{borderColor:Ou.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){Ru(t,"margin",this.node),Ru(t,"border",this.border),Ru(t,"padding",this.padding),Su(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"}),Su(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Iu{constructor(e,t){Cu(this,"tip",void 0),Cu(this,"nameSpan",void 0),Cu(this,"dimSpan",void 0),this.tip=e.createElement("div"),Su(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),Su(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),Su(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,n){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(n)+"px"}updatePosition(e,t){const n=this.tip.getBoundingClientRect(),r=function(e,t,n){const r=Math.max(n.height,20),a=Math.max(n.width,60);let i;i=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-r<=t.top+t.height?e.top-r-5<t.top+5?t.top+5:e.top-r-5:t.top+t.height-r-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:n.width,height:n.height});Su(this.tip.style,r.style)}}class Tu{constructor(){Cu(this,"window",void 0),Cu(this,"tipBoundsWindow",void 0),Cu(this,"container",void 0),Cu(this,"tip",void 0),Cu(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const n=e.document;this.container=n.createElement("div"),this.container.style.zIndex="10000000",this.tip=new Iu(n,this.container),this.rects=[],n.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 n=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>n.length;){const e=this.rects.pop();e?.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new Nu(this.window.document,this.container));const r={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};n.forEach(((e,t)=>{const n=Eu(e,this.window),a=wu(e);r.top=Math.min(r.top,n.top-a.marginTop),r.right=Math.max(r.right,n.left+n.width+a.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+a.marginBottom),r.left=Math.min(r.left,n.left-a.marginLeft),this.rects[t].update(n,a)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const a=Eu(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:r.top,left:r.left,height:r.bottom-r.top,width:r.right-r.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Ru(e,t,n){Su(n.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const Ou={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 ku=null,Pu=null;function Lu(){null!=window.document&&(ku=null,null!==Pu&&(Pu.remove(),Pu=null))}function Au(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Fu{constructor(e){Au(this,"_isRunning",void 0),Au(this,"_selectIgnore",void 0),Au(this,"_lastHoveredNode",null),Au(this,"excludeSelectors",void 0),Au(this,"onSelect",void 0),Au(this,"iframesListeningTo",new Set),Au(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Au(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Au(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),Au(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Ge(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Lu();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 n;n=[t],null,!1,null!=window.document?(null!==ku&&clearTimeout(ku),null!=n&&(null===Pu&&(Pu=new Tu),Pu.inspect(n,null))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}})),Au(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Au(this,"selectFiberForNode",(0,Q.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let n=e;const r=[];for(;n!==t&&null!==n;){let e=n.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,r=Array.from(n.classList).reverse();e<r.length;e++)t.test(r[e])&&n.classList.remove(r[e]);if(n.id&&/^rc-\w+/.test(n.id)&&n.removeAttribute("id"),n.id)e+=`#${n.id}`;else{const t=Array.from(n.parentElement.children).filter((e=>e.tagName===n.tagName)),r=n.className.trim();if(t.filter((e=>e.className.includes(r))).length<=1){if(r){const t=r.split(/\s+/);let n="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(n+=`.${t[e]}`);e+=n}}else n.getAttribute("name")?e+=`[name=${n.getAttribute("name")}]`:e+=`:nth-of-type(${t.indexOf(n)+1})`}n.nodeType!==Node.TEXT_NODE&&r.unshift(e),n=n.parentElement}return r.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(){Lu(),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 _u(e){return document.querySelector(e)}const Du=e=>{const{action:t,onConfirm:n,onCancel:r,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(ve,{style:{width:"100%",justifyContent:"flex-end"}},l().createElement(ge,{size:"small",onClick:()=>r?.()},i("qm.guideTracker.closeButton")),l().createElement(ge,{size:"small",onClick:()=>n?.()},i("add"===t?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),l().createElement(ge,{size:"small",onClick:()=>a?.()},i("qm.guideTracker.finishButton"))))},Hu={left:"50%",top:"50%",width:1,height:1},qu=l().forwardRef(((e,t)=>{const{open:n,current:r,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(),w=l().useRef(i.length),[C,S]=Go(0,{value:r,defaultValue:a}),[N,I]=Go(void 0,{value:n,postState:e=>e??!1}),[T,R]=Go(1051,{value:p,defaultValue:p}),[k,P]=l().useState({}),[L,A]=l().useState(!1),[F,_]=l().useState(N),[D,H]=l().useState(!1),[q,$]=kd(k.node,!!n),[M,K]=l().useState(22),z=l().useRef(!1),j=l().useMemo((()=>C>=i.length?"add":"edit"),[C,i]),V=l().useMemo((()=>`${C+1} / ${i.length}`),[C,i]);l().useLayoutEffect((()=>{E.current=new Fu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),P({id:er(),node:e,path:t}),S(w.current),A(!0),B(),g?.(t,e)}})}),[]),l().useEffect((()=>(N?W():B(),N?setTimeout((()=>_(!0)),16):_(!1),()=>{B()})),[N]),l().useEffect((()=>{w.current=i.length}),[i]);const W=()=>{E.current.startHandle()},B=()=>{E.current.stopHandle()},U=e=>{e.stopPropagation(),e.preventDefault()};l().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:C,selector:k.path})})));const Y=we("guide-tracker"),X=[{[`${Y}-primary`]:!0}],Z=Fd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return l().createElement(l().Fragment,null,l().createElement(Dd(),{open:N&&L,autoLock:!0},l().createElement(qd(),{zIndex:T,builtinPlacements:Z,popupPlacement:o,popupVisible:N&&L,popupClassName:Ee()(X,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{A(!1),W()};return l().createElement("div",{className:`${Y}-content`},l().createElement("div",{className:`${Y}-inner`},l().createElement(Ce.CloseOutlined,{className:`${Y}-close`,onClick:()=>{b?.(C),e()}}),l().createElement(O.Dropdown,{open:D,trigger:["click"],dropdownRender:()=>i.length?l().createElement("div",{className:"ant-dropdown-menu step-list"},l().createElement(ca.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.id)),n=i.map((e=>e.id));if((0,Q.isEqual)(t,n))return;const r=t.findIndex((e=>e===k.id)),a=-1!==r?r:C;S(a),y?.(dr(e),a)}},i.map(((e,t)=>l().createElement("li",{key:t,className:Ee()("item",{actived:e.id===k.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!==C&&(P({id:e.id,node:_u(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:T+1,onConfirm:()=>{const n=i.filter((t=>t.id!==e.id)),r=t===C;let a=t<=C?C-1:C;if(a=a<0?0:a,a=a>n.length?n.length:a,r&&n[a]){const{id:e,selector:t}=n[a];P({id:e,node:_u(t),path:t})}S(a),y?.(n,a)}},l().createElement(Ce.CloseOutlined,{className:"close-icon"})))))))):l().createElement(l().Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:T},onOpenChange:e=>H(e)},l().createElement(Ce.MenuOutlined,{className:Ee()(`${Y}-close`,"menu-icon"),style:{width:M}})),h.content&&l().createElement(O.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:T},content:h.content,title:h.title},l().createElement(Ce.QuestionCircleOutlined,{className:Ee()(`${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"),V)),m?m({id:k.id,selector:k.path,actionStatus:j,DO_CLOSE:e},C):l().createElement(Du,{action:j,onConfirm:()=>{y?.("add"===j?[...i,{id:k.id,selector:k.path,title:"Guide Title"}]:[...i],C),e()},onCancel:()=>{b?.(C),e()},onFinish:()=>{e(),b?.(C),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},l().createElement("div",{className:Ee()(`${Y}-target-placeholder`),style:{...q||Hu,position:"fixed",zIndex:T-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:U,onClick:U}))),s&&l().createElement(Dd(),{open:F},l().createElement(zd,{zIndex:T,prefixCls:Y,onPause:()=>{z.current=L,A(!1),B()},onPlay:()=>{z.current?A(!0):W()}})))}));qu.displayName="QmGuideTracker";const $u=qu,Mu=e=>{const{content:t,image:n,width:r,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",w=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",S=o.textAlign??"center",N=Array.isArray(t)?t:[t],I=s[0],T=s[1],R=I/2,O=T/2,k=c[0]??R,P=c[1]??O,L=l().useMemo((()=>{const e=k-R,t=P-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,k,P,u]),A=()=>{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(!n&&e.measureText){e.font=`${v}px ${w}`;const n=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),i=v*N.length+3*(N.length-1)}return[r??t,a??i]})(t),s=l*i,c=o*i,u=(I+l)*i,p=(T+o)*i,f=I/2*i,g=T/2*i,R=u/2,O=p/2,k=2*(I+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 P=()=>{t.restore(),t.drawImage(e,0,0,u,p,u,p,u,p),h&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),((e,t)=>{if(y.current){const n=b.current.get(y.current);n&&(y.current.contains(n)&&y.current.removeChild(n),b.current.delete(y.current));const r=document.createElement("div");r.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))({...L,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),y.current?.append(r),b.current.set(y.current,r)}})(e.toDataURL(),k)},A=()=>{const e=Number(v)*i;t.font=`${E} normal ${x} ${e}px/${o}px ${w}`,t.fillStyle=C,t.textAlign=S,t.textBaseline="top",t.translate(s/2,0),N.forEach(((n,r)=>{t.fillText(n??"",f,g+r*(e+3*i))})),P()};if(n){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),P()},e.onerror=()=>{A()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=n}else A()},F=e=>Array.from(b.current.values()).includes(e);l().useEffect((()=>{A()}),[t,n,r,a,o,s,c,d,u,m,p,h]),function(e,t,n={}){const r=window&&"MutationObserver"in window,a=i.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};i.useLayoutEffect((()=>(l(),r&&e.current&&(a.current=new MutationObserver(t),a.current.observe(e.current,n)),()=>l())),[e])}(y,(e=>{if(p)for(const t of e){const e=Array.from(t.removedNodes).some((e=>F(e))),n="attributes"===t.type&&F(t.target);if(e||n){A();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const _=we("watermark");return l().createElement("div",{ref:y,className:Ee()(_,f),style:{position:"relative",...g}},e.children)},Ku=new Map,zu=new WeakMap;let ju=0;function Vu(e,t,n={},r=undefined){if(void 0===window.IntersectionObserver&&void 0!==r){const a=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.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?(n=e.root,n?(zu.has(n)||(ju+=1,zu.set(n,ju.toString())),zu.get(n)):"0"):e[t]}`;var n})).toString()}(e);let n=Ku.get(t);if(!n){const r=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const n=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=n),r.get(t.target)?.forEach((e=>{e(n,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:r},Ku.set(t,n)}return n}(n),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(),Ku.delete(a))}}const Wu=e=>{const{forceRender:t,height:n,placeholder:r=null,unmountIfInvisible:a,className:i,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:t,threshold:n,triggerOnce:r,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=Vu(d,((e,t)=>{p({inView:e,entry:t}),h.current?.(e,t),t.isIntersecting&&r&&l&&(l(),l=void 0)}),{root:e,rootMargin:t,threshold:n,trackVisibility:i,delay:s},a),()=>{l&&l()}}),[Array.isArray(n)?n.toString():n,d,e,t,r,o,i,a,s]);const f=m.entry?.target,g=l().useRef();d||!f||r||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((()=>{n||pe("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u=we("lazy-load"),m={[u]:!0};return l().createElement("div",{ref:s,className:Ee()(m,i),style:o},t||c?e.children:l().createElement("div",{className:"placeholder",style:{height:n}},r))},Bu=require("html2canvas");var Uu=r.n(Bu);function Gu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Yu{constructor(e,t,n,r){if(Gu(this,"x",void 0),Gu(this,"y",void 0),Gu(this,"pressure",void 0),Gu(this,"time",void 0),isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||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 Xu{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Xu(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,a=e.y-t.y,i=t.x-n.x,l=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+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 Yu(o+g,s+y),c2:new Yu(c+g,d+y)}}constructor(e,t,n,r,a,i){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=a,this.endWidth=i}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const a=r/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(r>0){const r=i-e,a=l-t;n+=Math.sqrt(r*r+a*a)}e=i,t=l}return n}point(e,t,n,r,a){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+a*e*e*e}}function Qu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Zu{constructor(e,t){Qu(this,"canvas",void 0),Qu(this,"ctx",void 0),Qu(this,"textInput",void 0),Qu(this,"width",320),Qu(this,"height",200),Qu(this,"ratio",Math.max(window.devicePixelRatio||1,1)),Qu(this,"penColor","rgba(0,0,0,1)"),Qu(this,"backgroundColor","rgba(0,0,0,0)"),Qu(this,"canAddHistory",!1),Qu(this,"mode",void 0),Qu(this,"openSmooth",!0),Qu(this,"dotSize",0),Qu(this,"throttle",16),Qu(this,"minDistance",5),Qu(this,"velocityFilterWeight",.7),Qu(this,"compositeOperation","source-over"),Qu(this,"minWidth",.5),Qu(this,"maxWidth",2.5),Qu(this,"fontSize",16),Qu(this,"eraserSize",20),Qu(this,"lineHeight",1.25),Qu(this,"degreeOfBlur",5),Qu(this,"textInputPos",{x:0,y:0}),Qu(this,"onStart",(()=>{})),Qu(this,"onEnd",(()=>{})),Qu(this,"_drawingStroke",!1),Qu(this,"_lastPoints",[]),Qu(this,"_data",[]),Qu(this,"_historyList",[]),Qu(this,"_lastVelocity",0),Qu(this,"_lastWidth",0),Qu(this,"_strokeMoveUpdate",void 0),Qu(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)})),Qu(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))})),Qu(this,"isTouchEvent",(e=>"touches"in e)),Qu(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)})),Qu(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)})),Qu(this,"_isLeftButtonPressed",((e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:!(1&~e.buttons))),Qu(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}))),Qu(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}))),Qu(this,"_strokeBegin",(e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n={...t,points:[]};this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)})),Qu(this,"_strokeUpdate",((e,t=!0)=>{if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);const n=this._createPoint(e.x,e.y,e.pressure),r=this._data[this._data.length-1],a=r.points,i=a.length>0&&a[a.length-1],l=!!i&&n.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(r);if(!i||!i||!l){const e=this._addPoint(n,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(n,o)),a.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}})),Qu(this,"_strokeEnd",((e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)})),Qu(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})),Qu(this,"_drawDot",((e,t)=>{const n=this.ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()})),Qu(this,"_drawCurve",((e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,a=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<a;n+=1){const i=n/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*r,t.maxWidth);this._drawCurveSegment(u,m,p)}n.closePath(),n.fill()})),Qu(this,"_drawCurveSegment",((e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)})),Qu(this,"_createPoint",((e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new Yu(e-r.left,t-r.top,n,(new Date).getTime())})),Qu(this,"_createPointByEvent",(e=>this._createPoint(e.x,e.y,e.pressure))),Qu(this,"_addPoint",((e,t)=>{const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=Xu.fromPoints(n,e);return n.shift(),r}return null})),Qu(this,"_strokeWidth",((e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth))),Qu(this,"_calculateCurveWidths",((e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(r,n),i={end:a,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=a,i})),Qu(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))})),Qu(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)))})),Qu(this,"onDrawEnd",(e=>{this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),this.onEnd?.(e))})),Qu(this,"onInputBlur",(e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()})),Qu(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})),Qu(this,"drawSquare",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,a-n),this.ctx.stroke(),this.ctx.restore()})),Qu(this,"drawRound",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(r,t),l=Math.min(a,n),o=.5*(Math.max(r,t)-i),s=.5*(Math.max(a,n)-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()})),Qu(this,"drawArrow",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:a}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(n-a,t-r)/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,n),this.ctx.lineTo(r,a),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,a);const m=r+s,p=a+c;this.ctx.lineTo(m,p);const h=r+d,f=a+u;this.ctx.lineTo(h,f),this.ctx.lineTo(r,a),this.ctx.fill(),this.ctx.restore()})),Qu(this,"getAxisColor",((e,t,n)=>{const r=e.width,a=e.data,i=[];return i[0]=a[4*(n*r+t)],i[1]=a[4*(n*r+t)+1],i[2]=a[4*(n*r+t)+2],i[3]=a[4*(n*r+t)+3],i})),Qu(this,"setAxisColor",((e,t,n,r)=>{const a=e.width,i=e.data;i[4*(n*a+t)]=r[0],i[4*(n*a+t)+1]=r[1],i[4*(n*a+t)+2]=r[2],i[4*(n*a+t)+3]=r[3]})),Qu(this,"drawMosaic",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),r=this.ctx.getImageData(t*this.ratio,n*this.ratio,this.maxWidth*this.ratio,this.maxWidth*this.ratio),a=r.width,i=r.height,l=a/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const n=this.getAxisColor(r,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(r,t*this.degreeOfBlur+i,e*this.degreeOfBlur+a,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)})),Qu(this,"drawText",(e=>{const{x:t,y:n}=this.textInputPos;if(0===t&&0===n)return;this.ctx.lineWidth=1,this.ctx.fillStyle=this.penColor,this.ctx.textBaseline="middle",this.ctx.font=`bold ${this.fontSize}px none`;const r=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,n+a*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}})),Qu(this,"createPencil",(e=>{if(this.openSmooth||!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),Qu(this,"drawPencil",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()})),Qu(this,"createEraser",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)})),Qu(this,"drawEraser",(e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.globalCompositeOperation="destination-out",this.ctx.lineCap="round",this.ctx.lineWidth=this.eraserSize,this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.globalCompositeOperation="source-over"})),Qu(this,"drawLine",(e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)})),Qu(this,"createTextInput",(e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];0!=this.textInputPos.x&&0!=this.textInputPos.y&&this.textInputPos.x!=t&&this.textInputPos.y!=n?this.textInput.blur():(this.textInput.classList.add("show"),this.setInputStyle(),this.textInput.focus())})),Qu(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}})),Qu(this,"drawBgColor",(()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))})),Qu(this,"clearWorkSpace",(()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)})),Qu(this,"addHistory",(()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))})),Qu(this,"getLastHistory",(()=>this._historyList[this._historyList.length-1])),Qu(this,"setLastHistory",(()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()})),Qu(this,"clear",(()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())})),Qu(this,"undo",(()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()})),Qu(this,"setDrawMode",(e=>{this.mode=e})),Qu(this,"setLineWidth",(e=>{this.maxWidth=e})),Qu(this,"setPenColor",(e=>{this.penColor=e})),Qu(this,"setFontSize",(e=>{this.fontSize=e})),Qu(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()})),Qu(this,"toDataURL",((e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");return n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)})),Qu(this,"getPNG",(()=>this.toDataURL())),Qu(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 n,r,a,i=0,l=null;const o=()=>{i=Date.now(),l=null,n=e.apply(r,a),l||(r=null,a=[])};return function(...s){const c=Date.now(),d=t-(c-i);return r=this,a=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),i=c,n=e.apply(r,a),l||(r=null,a=[])):l||(l=window.setTimeout(o,d)),n}}(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)}}Qu(Zu,"dataURLToBlob",(e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),a=r.length,i=new Uint8Array(a);for(let e=0;e<a;++e)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})})),Qu(Zu,"canvasToDataURL",(e=>e.toDataURL("image/png",1))),Qu(Zu,"canvasToBlob",(e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}))));const Ju=Zu,em=()=>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"})),tm=()=>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"})),nm=()=>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"})),rm=()=>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"})),am=()=>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"})),im=l().forwardRef(((e,t)=>{const{open:n,width:r,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),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,I]=Go(void 0,{value:n,postState:e=>e??!1}),T=l().useMemo((()=>!!e.children),[e.children]),[R,k]=l().useState(s||(T?"square":"line")),[P,L]=l().useState(w[0]),[A,F]=l().useState(T?S[0]:S[4]),[_,D]=l().useState(C[1]),[H,q]=l().useState("bottomLeft"),[$,M]=l().useState(!1),[K,z]=l().useState(!1);l().useEffect((()=>{const e={width:r??x.current?.offsetWidth,height:a??x.current?.offsetHeight,maxWidth:P,mode:R,penColor:A,fontSize:_,backgroundColor:m,openSmooth:!T};return e.openSmooth&&Object.assign(e,{penColor:o,minWidth:d,maxWidth:u}),b.current=new Ju(v.current,e),()=>b.current.destroy()}),[]);const j=e=>{const[t,n]=[r??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),n&&n!==l&&(b.current.height=n,o=!0),(o||e)&&b.current.update()};qe((()=>{T&&N&&j()}),[N,T]),qe((()=>{b.current.setDrawMode(R)}),[R]),qe((()=>{b.current.setLineWidth(P)}),[P]),qe((()=>{b.current.setPenColor(A)}),[A]),qe((()=>{b.current.setFontSize(_)}),[_]);const V=async()=>{const e=T?x.current.parentNode:v.current;if(e)try{const t=await Uu()(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Ju.canvasToDataURL(t)}catch(e){pe("Signature","生成合成图片失败!")}},W=()=>{b.current.clear(),g?.()};l().useImperativeHandle(t,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),CLEAR:()=>b.current.clear(),UNDO:()=>b.current.undo(),IS_EMPTY:()=>b.current.isEmpty(),UPDATE:j,GET_DATE_URL:V})));const B=e=>{e&&q((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},U=e=>l().createElement("div",{className:Ee()("ant-dropdown-menu","content")},"text"!==e?l().createElement("div",{className:"lineWidth"},w.map((e=>l().createElement("span",{key:e,className:Ee()("dot",`s${e}`,{active:e===P}),onClick:()=>L(e)})))):l().createElement("div",{className:"fontSize"},l().createElement(O.Select,{size:"small",value:_,options:C.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:Ee()("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>F(e)},l().createElement(Ce.CheckOutlined,{className:"icon"})))))),Y=we("signature"),X={[Y]:!0,"is-annotation":T},Q=r?{...h,width:r}:h;return l().createElement("div",{className:Ee()(X,p),style:Q},T&&l().createElement(l().Fragment,null,l().createElement("div",{ref:x,className:"content"},e.children),K&&l().createElement(pt,{spinning:!0,className:"spinning"})),l().createElement("div",{className:Ee()("signature",{show:N})},l().createElement("canvas",{ref:v,className:R}),T&&l().createElement("div",{ref:E,className:"signature__tool-bar"},l().createElement("div",{className:"wrapper"},l().createElement("div",{className:Ee()("actions",{hidden:$})},l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("square")},l().createElement(Ce.BorderOutlined,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("round")},l().createElement(em,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("arrow")},l().createElement(nm,null))),l().createElement(O.Dropdown,{dropdownRender:U,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("line")},l().createElement(Ce.EditOutlined,null))),l().createElement(O.Dropdown,{dropdownRender:()=>U("text"),overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:B},l().createElement("button",{className:"btn",onClick:()=>k("text")},l().createElement(tm,null))),l().createElement("button",{className:"btn",onClick:async()=>{await(async()=>{z(!0);const e=await V();if(e){const t=i?i.slice(0,i.lastIndexOf(".")>0?i.lastIndexOf("."):void 0):c()().format(Do);Pt(Ju.dataURLToBlob(e),`${t}.png`)}z(!1)})(),W()}},l().createElement(Ce.DownloadOutlined,null)),l().createElement("button",{className:"btn",onClick:()=>k("eraser")},l().createElement(rm,null)),l().createElement("button",{className:"btn",onClick:()=>b.current.undo()},l().createElement(am,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()=>{z(!0),await re(10);const e=await V();z(!1),W(),f?.(e)}},l().createElement(Ce.CheckOutlined,null))),l().createElement("button",{className:"btn btn-fold",title:y($?"qm.divider.spread":"qm.divider.collect"),onClick:()=>M(!$)},$?l().createElement(Ce.LeftOutlined,null):l().createElement(Ce.RightOutlined,null))))))}));im.displayName="QmSignature";const lm=im,om={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"},sm=e=>[om.selectionColumnDefine,...e].filter((e=>!e.hidden)),cm=e=>e.some((e=>Array.isArray(e.children))),dm=e=>void 0!==e._groupLevel,um=(e,t)=>t.split(om.separator).reduce(((e,t)=>e?.[t]),e),mm=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(mm)):0,pm=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const a=t?`${t}${om.separator}${r}`:r;if(n.push(a),Array.isArray(e[r]))return n;const i=pm(e[r],a);return n.concat(i)}),[]),hm={sum:e=>Xn(e.reduce(((e,t)=>e+t),0)),avg:e=>e.length>0?(e.reduce(((e,t)=>e+t),0)/e.length).toFixed(2):0,max:e=>e.length>0?Math.max(...e):void 0,min:e=>e.length>0?Math.min(...e):void 0,count:e=>Xn(e.length),unique:e=>new Set(e).size,empty:e=>e.filter((e=>le(e))).length,notEmpty:e=>e.filter((e=>!le(e))).length},fm=l().createContext(void 0),gm=e=>{const{prefixCls:t,pivotProps:n,size:r,getRowKey:a,flatColumns:i,tableData:o}=e,{initialGroup:s}=n,c=e=>{const t=new Map;return qn(e).forEach((e=>t.set(a(e,e.index),e))),t},d=l().useRef({props:n,originGridData:o,flatGroupData:[],isTree:cm(o),keyRecordMap:c(o),gridLayoutContext:{}}),[u,m]=l().useState({pivotRef:d,prefixCls:t,size:r,viewMode:"table",columns:i,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=i.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:[],sorterList:[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map}),p=e=>{m((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};g((()=>{y(o),h("originGridData",o),h("isTree",cm(o)),h("keyRecordMap",c(o))}),[o]),g((()=>{f(i)}),[i]),g((()=>{p({size:r})}),[r]);const h=(e,t)=>{u.pivotRef.current[e]=t};h("props",n);const f=e=>{p({columns:e})},y=e=>{p({gridData:e})},b=e=>{p({groupGridData:e})},v=e=>{p({groupList:e})},x=e=>{p({filterList:e})},E=e=>{p({sorterList:e})},w=e=>{p({colorList:e})},C=e=>{p({expandedKeys:e})},S=e=>{p({searchResults:e})},N=e=>{p({switchIndex:e})},I=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),p({fillColorCells:t})},T=l().useMemo((()=>({...u,setContext:p,getRowKey:a,setPivotGridRef:h,setColumns:f,setGridData:y,setGroupGridData:b,setGroupList:v,setFilterList:x,setSorterList:E,setColorList:w,setExpandedKeys:C,setSearchResults:S,setSwitchIndex:N,setFillColor:I})),[u]);return l().createElement(fm.Provider,{value:T},e.children)},ym=()=>l().useContext(fm),bm=()=>{const{prefixCls:e,pivotRef:t,viewMode:n,setContext:r}=ym(),{fromTable:a}=t.current.props,{t:i}=G(),o=[{label:i("qm.pivotGrid.viewMode.table"),value:"table"},{label:i("qm.pivotGrid.viewMode.gantt"),value:"gantt"},{label:i("qm.pivotGrid.viewMode.card"),value:"card"}];return a?null:l().createElement("div",{className:`${e}-view-mode`},l().createElement(O.Segmented,{value:n,options:o,onChange:e=>{r({viewMode:e})}}))},vm=()=>{const{prefixCls:e,pivotRef:t,groupList:n,columns:r,gridData:a,setGroupList:i,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=ym(),{onGroupChange:d,onDataChange:u}=t.current.props,{t:m}=G(),p=l().useRef([]),h=l().useRef([]),f=l().useMemo((()=>n.filter((e=>e.fieldName&&e.order))),[n]),g=l().useMemo((()=>r.map((e=>({label:nr(e.title),value:e.dataIndex,disabled:n.some((t=>t.fieldName===e.dataIndex))})))),[n,r]),y=l().useMemo((()=>{const e=f.map((e=>({[e.fieldName]:e.order})));return(0,Q.isEqual)(e,p.current)?p.current:(p.current=e,e)}),[f]),b=[{label:m("qm.pivotGrid.group.ascend"),value:"ascend"},{label:m("qm.pivotGrid.group.descend"),value:"descend"}];l().useEffect((()=>{o(h.current)}),[y]),l().useLayoutEffect((()=>{const e=((e,t=[],n)=>{const r=(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=>n(e,i))),s=Object.keys(o).sort(((e,t)=>"ascend"===a?e.localeCompare(t):t.localeCompare(e))),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],l)})),c};return r(e,t)})(a,y,((e,t)=>{const{dictItems:n,precision:a}=r.find((e=>e.dataIndex===t))||{},i=Bn(e,t);let l=n?.find((e=>e.value==i))?.text??i??"";return Array.isArray(i)&&(l=i.map((e=>n?.find((t=>t.value==e))?.text??e)).join(",")),a>=0&&""!==l&&(l=Yn(l)?new(Ea())(l).toFixed(a):l),l||m("qm.pivotGrid.group.empty")}));var t;s(e),t=pm(e),h.current=t,c("flatGroupData",(e=>{const t=[];return function e(n,r,a=""){if(Array.isArray(n))n.forEach(((e,t)=>{e._varIndex=t,a?e._parentRowKey=a:delete e._parentRowKey})),t.push(...qn(n));else for(const i in n){const l=a?`${a}${om.separator}${i}`:i;t.push({id:l,_groupLabel:i,_groupLevel:r}),e(n[i],r+1,l)}}(e,0),t})(e))}),[y,a]),qe((()=>{d?.(f)}),[y]),qe((()=>{u?.(a)}),[a]);const v=()=>{i([...n,{fieldName:"",order:"ascend"}])},x=(e,t,r)=>{Object.assign(t,{[e]:r}),i([...n])};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,m("qm.pivotGrid.group.title")),!!f.length&&l().createElement("div",null,l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},m("qm.pivotGrid.group.foldAll")),l().createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(h.current)},m("qm.pivotGrid.group.unfoldAll")))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));(0,Q.isEqual)(t,r)||i(e)}},n.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(r=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(O.Select,{value:r.fieldName||null,placeholder:m("qm.table.editable.selectPlaceholder"),options:g,style:{width:160,margin:"0 10px"},onChange:e=>x("fieldName",r,e)}),l().createElement(O.Select,{value:r.order,options:b,placeholder:m("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>x("order",r,e)}),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(n.filter((t=>t!==e)))})(r)}))));var r})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:v},l().createElement(Ce.PlusOutlined,{className:"icon"}),m("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!f.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.FolderOpenOutlined,{className:"icon"}),m("qm.pivotGrid.group.text"),f.length?`(${f.length})`:null))},xm=()=>{const{prefixCls:e,pivotRef:t,columns:n,filterList:r,setFilterList:a,setGridData:i}=ym(),{originGridData:o,isTree:s}=t.current,{onFilterChange:c}=t.current.props,{t:d}=G(),u=l().useRef([]),m=l().useMemo((()=>r.filter((e=>e.fieldName&&("nil"===e.expression||e.value)))),[r]),p=l().useMemo((()=>n.map((e=>({label:nr(e.title),value:e.dataIndex})))),[n]),[h,f]=l().useState("and"),g=l().useMemo((()=>{const e=m.map((e=>`${e.fieldName},${e.expression},${e.value??""}`));return(0,Q.isEqual)(e,u.current)?u.current:(u.current=e,e)}),[m]);qe((()=>{a(r.map((e=>({...e,logic:h}))))}),[h]),qe((()=>{y(),c?.(m)}),[g]);const y=wt((()=>{const e=ar(m.map((e=>({...se(e,["value"]),expression:"nil"!==e.expression?e.expression:"==",condition:e.value}))));i(e?Rn(o,e,s):o)}),200),b=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],v=()=>{a([...r,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:h}])},x=(e,t,i)=>{if(Object.assign(t,{[e]:i}),"fieldName"===e){const e=n.find((e=>e.dataIndex===i)).filter?.type||"text";Object.assign(t,{type:e,expression:E(e)[0].value,value:""})}"expression"===e&&"nil"===i&&Object.assign(t,{value:""}),a([...r])},E=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.likeText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")}]}return t},w=e=>{switch(e.type){case"number":return l().createElement(O.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{x("value",e,le(t)?"":t)}});case"date":return l().createElement(_,{popupClassName:Bo.popupClassName,defaultValue:Zn(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{x("value",e,Jn(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=n.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(O.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||null,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{x("value",e,t)}},t.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(O.Input,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{x("value",e,t.target.value)}})}};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&l().createElement(O.Select,{value:h,options:b,style:{width:130},onChange:e=>f(e)})),l().createElement("div",{className:"list"},r.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(O.Select,{value:n.fieldName||null,options:p,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>x("fieldName",n,e)}),l().createElement(O.Select,{value:n.expression,placeholder:d("qm.table.editable.selectPlaceholder"),options:E(n.type),style:{width:100,margin:"0 10px"},onChange:e=>x("expression",n,e)}),w(n),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(n)}))));var n}))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:v},l().createElement(Ce.PlusOutlined,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.FilterOutlined,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},Em=()=>{const{prefixCls:e,pivotRef:t,columns:n,gridData:r,sorterList:a,setSorterList:i,setGridData:o}=ym(),{onSorterChange:s}=t.current.props,{t:c}=G(),d=l().useMemo((()=>a.filter((e=>e.fieldName&&e.order))),[a]),u=l().useMemo((()=>n.map((e=>({label:nr(e.title),value:e.dataIndex,disabled:a.some((t=>t.fieldName===e.dataIndex))})))),[a,n]);qe((()=>{h(),s?.(d)}),[l().useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],p=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,h=()=>{var e;o((e=d,r.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:a}=r,i=Bn(t,e),l=Bn(n,e),o=p(i,l);if(0!==o)return"ascend"===a?o:-o}return 0})).slice(0)))},f=()=>{i([...a,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),i([...a])};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.sorter.title"))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,Q.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(O.Select,{value:n.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:e=>g("fieldName",n,e)}),l().createElement(O.Select,{value:n.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:e=>g("order",n,e)}),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:f},l().createElement(Ce.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.SortAscendingOutlined,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},wm=()=>{const{prefixCls:e,getRowKey:t,gridData:n,columns:r,searchResults:a,switchIndex:i,setSearchResults:o,setSwitchIndex:s}=ym(),{t:c}=G(),[d,u]=l().useState(!1),m=l().useMemo((()=>a.length),[a]);qe((()=>{d||setTimeout((()=>{s(0),o([])}),200)}),[d]);const p=(e,n)=>{const a=[];return e.forEach((e=>{r.forEach((r=>{const{dataIndex:i,dictItems:l,precision:o}=r,s=Bn(e,i);let c=l?.find((e=>e.value==s))?.text??s??"";Array.isArray(s)&&(c=s.map((e=>l?.find((t=>t.value==e))?.text??e)).join(",")),o>=0&&""!==c&&(c=Yn(c)?new(Ea())(c).toFixed(o):c),c+="",c.includes(n)&&a.push({value:c,rowKey:t(e,e.index),dataIndex:i})})),Array.isArray(e.children)&&a.push(...p(e.children,n))})),a},h=wt((e=>{const t=e.target.value.trim();s(0),o(t?p(n,t):[])}),200),f=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&g()},g=()=>{m&&s((i+1)%m)};return l().createElement(O.Dropdown,{open:d,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.search.title")),l().createElement("button",{className:"button-icon",onClick:()=>u(!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",onClick:()=>{m&&s((i-1+m)%m)}},l().createElement(Ce.LeftOutlined,null)),l().createElement("span",{className:"num"},m>0?i+1:i,"/",m),l().createElement("button",{className:"button-icon",onClick:()=>g()},l().createElement(Ce.RightOutlined,null))),onChange:h,onKeyUp:f}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},l().createElement("span",{onClick:()=>u(!d)},l().createElement(Ce.MonitorOutlined,{className:"icon"}),c("qm.pivotGrid.search.text")))},Cm=(e,t)=>e.map((e=>(e.children&&(e.children=Cm(e.children,t)),t(e)))),Sm=()=>{const{prefixCls:e,pivotRef:t,columns:n,setColumns:r}=ym(),{uniqueKey:a,onColumnsChange:i}=t.current.props,{t:o}=G(),s=l().useMemo((()=>a?`grid_field_${a}`:""),[a]);l().useLayoutEffect((()=>{c()}),[]),qe((()=>{u(n)}),[n]);const c=()=>{const e=m();e&&i?.(e)},d=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=d(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}})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));(0,Q.isEqual)(t,n)||localStorage.setItem(s,JSON.stringify(t))},m=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));return e?(0,Q.xor)(e.map((e=>e.dataIndex)),n.map((e=>e.dataIndex))).length>0?Cm(n,(t=>{const n=e.find((e=>e.dataIndex===t.dataIndex));return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Cm(e,(e=>{const t=n.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0},p=l().useMemo((()=>{let e=0;for(let t=0;t<n.length-1&&("left"!==n[t].fixed||n[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let r=0;r<n.length;r++)r===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(n[r]);return t}),[n]);return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,o("qm.pivotGrid.field.title"))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:p,setList:e=>{const t=e.map((e=>e.dataIndex)),n=p.map((e=>e.dataIndex));(0,Q.isEqual)(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const a=e[r];r<t?a.fixed="left":delete a.fixed,r!==t&&n.push(a)}r(n),i?.(n)})(dr(e))}},p.map((e=>"__divider__"!==e.dataIndex?l().createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},l().createElement(Ce.HolderOutlined,{className:"handle"}),l().createElement("span",{className:"label"},l().createElement("span",{className:"title"},nr(e.title)),l().createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...n];r(t),i?.(t)})(e)},e.hidden?l().createElement(Ce.EyeInvisibleOutlined,null):l().createElement(Ce.EyeOutlined,null)))):l().createElement("li",{key:e.dataIndex,className:"divider"})))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},l().createElement("span",null,l().createElement(Ce.SettingOutlined,{className:"icon"}),o("qm.pivotGrid.field.text")))},Nm=()=>{const{prefixCls:e,size:t,setContext:n}=ym(),{t:r}=G(),a=[{label:r("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:r("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:r("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},a.map((e=>l().createElement("li",{key:e.value,className:Ee()("ant-dropdown-menu-item check-item",{active:t===e.value}),onClick:()=>n({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"}),r("qm.pivotGrid.lineHeight.text")))},Im="606060",Tm="thin",Rm="d4d4d4",Om=(e,t)=>{t&&(e.height=Math.floor(.75*t))},km=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Pm=()=>({top:{style:Tm,color:{argb:Rm}},left:{style:Tm,color:{argb:Rm}},bottom:{style:Tm,color:{argb:Rm}},right:{style:Tm,color:{argb:Rm}}}),Lm=e=>{const{precision:t,formatType:n}=e,r=t>=0&&t?`.${"0".repeat(t)}`:"";return"percent"===n?{numFmt:r?`0${r}%`:"0%"}:"finance"===n?{numFmt:r?`#,##0${r}`:"#,##0"}:r?{numFmt:`0${r}`}:null},Am=()=>{const{prefixCls:e,pivotRef:t,columns:n}=ym(),{t:r}=G(),{exportXLSX:a}=(()=>{const{size:e}=ym(),{t}=G(),{rowHeightMaps:n}=Bo,r=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(r,a,i,l)=>{const{columns:o,footSummation:s}=r,c=n[e],d=On(o),u=[],m=[],p=[];let h=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=nr(e.title),p.push({key:t,width:(n||r)/8})})),u.push(f),h+=u.length;const g=a.map(((e,t)=>{const n={};return d.forEach(((r,a)=>{const i=["percent","finance"].includes(r.formatType);n[r.dataIndex]=i?Bn(e,r.dataIndex):l(e,t,r,a)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));h+=g.length,s&&i(d,a).forEach(((e,n)=>{const r={};d.forEach(((n,i)=>{const{dataIndex:l,summation:o}=n,s=o?.render?o.render(a):Bn(e,l);r[l]=0===i&&""===s?t("qm.table.config.summaryText"):J(s)?tr(s).join(""):s})),m.push(r)}));const{sheetName:y,useStyle:b}=r,v=new(ss().Workbook),x=v.addWorksheet(y);x.columns=p,x.addRows(u).forEach((e=>{b&&Om(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=An(o,t.key),{align:r,theadAlign:a}=n;km(e,a||r),b&&Object.assign(e,{font:{bold:!0,color:{argb:Im}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Pm()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];b&&Om(e,c),e.eachCell(((e,t)=>{const a=x.getColumn(e.col),i=An(o,a.key),{align:l}=i;km(e,1===t||void 0===r?l:"right"),Object.assign(e,Lm(i)),b&&Object.assign(e,{font:{color:{argb:Im}},border:Pm()}),1===Number(e.col)&&n&&(e.alignment={...e.alignment,indent:n})}))})),s&&x.addRows(m).forEach((e=>{b&&Om(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=An(o,n.key),{align:a}=r;km(e,1===t?a:"right"),Object.assign(e,Lm(r)),b&&Object.assign(e,{font:{color:{argb:Im}},border:Pm()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=await v.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})},importXLSX:(e,n)=>{const{columns:a,file:i}=e,l=On(a),o=new FileReader;o.onerror=()=>{O.message.error(t("qm.table.import.error"))},o.onload=e=>{const a=l.map((e=>nr(e.title))),i=new(ss().Workbook),o=e.target;o?i.xlsx.load(o.result).then((e=>{const i=e.worksheets[0];if(i){const e=i.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(a,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{let r=e;Array.isArray(r?.richText)&&(r=r.richText.map((e=>e.text)).join("")),(0,Q.isPlainObject)(r)&&"text"in r&&(r=r.text),(0,Q.isDate)(r)&&(r=Jn(r,_o)),r?.formula&&(r=r.result??r.value),t[s[n]]=r}));const n={};return a.forEach(((e,a)=>{const{dataIndex:i,dictItems:o}=l[a];Array.isArray(o)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>r(o,e))).filter((e=>""!==e)):t[e]=r(o,t[e])),Un(n,i,t[e])})),n}));n?.(t)}else O.message.error(t("qm.table.import.error"))}else O.message.error(t("qm.table.import.error"))})):O.message.error(t("qm.table.import.error"))},o.readAsArrayBuffer(i)}}})(),{getTitleFromCellValue:i}=as(),o=[{text:r("qm.pivotGrid.count.records"),value:"count"},{text:r("qm.pivotGrid.count.unique"),value:"unique"},{text:r("qm.pivotGrid.count.empty"),value:"empty"},{text:r("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:r("qm.pivotGrid.count.sum"),value:"sum"},{text:r("qm.pivotGrid.count.max"),value:"max"},{text:r("qm.pivotGrid.count.min"),value:"min"},{text:r("qm.pivotGrid.count.avg"),value:"avg"}],s={columns:kn(n),fileName:c()().format(Do),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},d=(e,t,n,r)=>{const{dataIndex:a,precision:l,formatType:o}=n;if(dm(e))return Bn(e,a);let s=i(e,n,t,r);return l>=0&&!o&&""!==s&&(s=Number(s)),s},u=()=>{const{gridLayoutContext:e}=t.current,{countMethod:n,summationData:r}=e;if(!n||!Object.keys(n).length)return[];const a={};return s.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(t>0){let t="";n?.[e]&&(t=o.find((t=>t.value===n[e])).text+" "+r.total[e]),Un(a,e,t)}})),[a]},m=async e=>{const{countMethod:n={}}=t.current.gridLayoutContext,r=await a({...s,footSummation:!!Object.keys(n).length},e,u,d);Pt(r,`${c()().format(Do)}.xlsx`)},p=[{key:"1",label:l().createElement(l().Fragment,null,l().createElement(Ce.FolderOutlined,{style:{marginRight:4}})," ",r("qm.pivotGrid.export.group")),onClick:()=>{m((()=>{const{flatGroupData:e,gridLayoutContext:n}=t.current,{countMethod:r,summationData:a}=n,i=[];let l=0;return e.forEach((e=>{const t={...e};dm(e)?(t._level=e._groupLevel,s.columns.map((e=>e.dataIndex)).forEach(((n,i)=>{if(0===i)Un(t,n,e._groupLabel);else{let i="";r?.[n]&&(i=o.find((e=>e.value===r[n])).text+" "+um(a,e.id).subtotal[n]),Un(t,n,i)}})),l=e._groupLevel):l>0&&(t._level=e._level+l+1),i.push(t)})),i})())}},{key:"2",label:l().createElement(l().Fragment,null,l().createElement(Ce.BarsOutlined,{style:{marginRight:4}})," ",r("qm.pivotGrid.export.list")),onClick:()=>{m(Array.from(t.current.keyRecordMap.values()))}}];return l().createElement(O.Dropdown,{trigger:["click"],menu:{items:p},className:Ee()("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},l().createElement("span",null,l().createElement(Ce.DownloadOutlined,{className:"icon"}),r("qm.pivotGrid.export.text")))},Fm=()=>{const{prefixCls:e,pivotRef:t,groupList:n,filterList:r,sorterList:a,setContext:i}=ym(),{uniqueKey:o}=t.current.props,{t:s}=G(),d=l().useMemo((()=>o?`grid_conf_${o}`:""),[o]),u=l().useRef({}),[m,p]=l().useState([]),[h,f]=l().useState({}),[g,y]=l().useState(""),b=(e,t)=>{f((n=>Object.assign({},n,{[e]:t??!n[e]})))};l().useLayoutEffect((()=>{v()}),[]),qe((()=>{x()}),[m]);const v=async()=>{try{if(!d)return;const e=await As().getItem(d);Array.isArray(e)&&(p(e),f(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}},x=async()=>{try{if(!d)return;await As().setItem(d,m)}catch(e){}},E=()=>{const e=er();p([{id:e,label:c()().format(Do),value:{groupList:n,filterList:r,sorterList:a}},...m]),ae((()=>b(e,!0)))};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},l().createElement("span",null,s("qm.pivotGrid.saved.title"))),l().createElement("div",{className:"list"},l().createElement("ul",null,m.map((e=>l().createElement("li",{key:e.id,className:Ee()("ant-dropdown-menu-item sort-item",{active:e.id===g}),onClick:()=>(e=>{if(h[e.id])return;const t=g!==e.id,n=t?e.value:u.current;i({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList}),y(t?e.id:"")})(e)},l().createElement("div",{className:"label",style:{width:200}},h[e.id]?l().createElement(O.Input,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,p([...m])),b(e.id,!1)}}):l().createElement("span",null,e.label)),l().createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),b(e.id)}},h[e.id]?l().createElement(Ce.CheckOutlined,null):l().createElement(Ce.EditOutlined,null)),l().createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,p(m.filter((e=>e.id!==n)))}},l().createElement(Ce.CloseOutlined,null))))))),l().createElement("div",{className:"add-record",style:{padding:10}},l().createElement("span",{className:"insert",onClick:E},l().createElement(Ce.PlusOutlined,{className:"icon"}),s("qm.pivotGrid.saved.add")))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:n,filterList:r,sorterList:a}:{},u.current=t}},l().createElement("span",null,l().createElement(Ce.SaveOutlined,{className:"icon"}),s("qm.pivotGrid.saved.text")))},_m=()=>{const{gridData:e}=ym(),{t}=G();return l().createElement("div",{className:"alert-info"},l().createElement(Ce.InfoCircleOutlined,{className:"icon"}),t("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},Dm=()=>{const{prefixCls:e,pivotRef:t,getRowKey:n,columns:r,colorList:a,setColorList:i,setFillColor:o}=ym(),{flatGroupData:s}=t.current,{t:c}=G(),d=l().useRef([]),u=l().useMemo((()=>a.filter((e=>e.fieldName&&e.color&&("nil"===e.expression||e.value)))),[a]),m=l().useMemo((()=>r.map((e=>({label:nr(e.title),value:e.dataIndex})))),[r]),p=l().useMemo((()=>sm(r)),[r]),h=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"}];qe((()=>{f()}),[l().useMemo((()=>{const e=u.map((e=>({[e.color]:`${e.mode},${e.fieldName},${e.expression},${e.value??""}`})));return(0,Q.isEqual)(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=wt((()=>{const e=[];u.forEach((t=>{const r=ar([{...se(t,["value"]),expression:"nil"!==t.expression?t.expression:"==",condition:t.value}]),a=Rn(s,r);if("cell"===t.mode)for(let r=0;r<a.length;r++)e.push({color:t.color,rowKey:n(a[r],a[r].index),dataIndex:t.fieldName});if("row"===t.mode)for(let r=0;r<a.length;r++){const i=n(a[r],a[r].index);for(let n=0;n<p.length;n++)e.push({color:t.color,rowKey:i,dataIndex:p[n].dataIndex})}})),o(e)}),200),g=()=>{i([...a,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},y=(e,t,n)=>{if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=r.find((e=>e.dataIndex===n)).filter?.type||"text";Object.assign(t,{type:e,expression:b(e)[0].value,value:""})}"expression"===e&&"nil"===n&&Object.assign(t,{value:""}),i([...a])},b=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.likeText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")}]}return t};return l().createElement(O.Dropdown,{trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container")},l().createElement("div",{className:"label"},l().createElement("span",null,c("qm.pivotGrid.fillColor.title"))),l().createElement("div",{className:"list"},l().createElement(ca.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.fieldName)),n=a.map((e=>e.fieldName));(0,Q.isEqual)(t,n)||i(e)}},a.map(((e,t)=>{return l().createElement("li",{key:`${e.fieldName}-${t}`,className:"item"},(n=e,l().createElement(l().Fragment,null,l().createElement(Ce.HolderOutlined,{className:"icon handle"}),l().createElement(sp,{defaultValue:n.color,style:{marginLeft:5},onChangeComplete:e=>y("color",n,e.hex)}),l().createElement(O.Select,{value:n.mode,options:h,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:e=>y("mode",n,e)}),l().createElement(O.Select,{value:n.fieldName||null,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:e=>y("fieldName",n,e)}),l().createElement(O.Select,{value:n.expression,placeholder:c("qm.table.editable.selectPlaceholder"),options:b(n.type),style:{width:100,margin:"0 10px"},onChange:e=>y("expression",n,e)}),(e=>{switch(e.type){case"number":return l().createElement(O.InputNumber,{defaultValue:e.value,style:{width:150},onChange:t=>{y("value",e,le(t)?"":t)}});case"date":return l().createElement(_,{popupClassName:Bo.popupClassName,defaultValue:Zn(e.value,"YYYY-MM-DD")??void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{y("value",e,Jn(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const t=r.find((t=>t.dataIndex===e.fieldName))?.dictItems||[];return l().createElement(O.Select,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||null,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{y("value",e,t)}},t.map((e=>l().createElement(O.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return l().createElement(O.Input,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{y("value",e,t.target.value)}})}})(n),l().createElement(Ce.CloseOutlined,{className:"icon close",onClick:()=>(e=>{i(a.filter((t=>t!==e)))})(n)}))));var n})))),l().createElement("div",{className:"add-record"},l().createElement("span",{className:"insert",onClick:g},l().createElement(Ce.PlusOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Ee()("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},l().createElement("span",null,l().createElement(Ce.BgColorsOutlined,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Hm=()=>l().createElement("div",{className:"top-bar"},l().createElement(ve,{size:4},l().createElement(_m,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(Sm,null),l().createElement(vm,null),l().createElement(xm,null),l().createElement(Em,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(Nm,null),l().createElement(Dm,null),l().createElement(wm,null),l().createElement(O.Divider,{type:"vertical"}),l().createElement(Am,null),l().createElement(Fm,null)),l().createElement(ve,{size:4},l().createElement(bm,null))),qm=l().createContext(void 0),$m=e=>{const{scrollbar:t}=e,{pivotRef:n,getRowKey:r,columns:a,groupGridData:i,setPivotGridRef:o}=ym(),{rowSelection:s,treeExpandable:c}=n.current.props,d=c?.defaultExpandAllRows??!0,[u,m]=l().useState({scrollbarRef:t,selectionKeys:s?.defaultSelectedRowKeys??[],treeExpandKeys:d?$n(n.current.originGridData,(e=>r(e,e.index))):[],countMethod:{},summationData:{},checkedColumnKey:"",hoverRowKey:"",updateLayout:0}),p=l().useMemo((()=>Math.max(0,mm(i)-1)),[i]),h=e=>{m((t=>{const n={...t};let r=!1;return Object.keys(e).forEach((a=>{const i=a;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};l().useLayoutEffect((()=>{o("gridLayoutContext",((e,t)=>{const n={};for(const t of["countMethod","summationData"])t in e&&(n[t]=e[t]);return n})(u))}),[u]),l().useLayoutEffect((()=>{w(),E()}),[a]),l().useLayoutEffect((()=>{s?.selectedRowKeys&&f(s.selectedRowKeys)}),[s?.selectedRowKeys]);const f=e=>{h({selectionKeys:e})},g=e=>{h({treeExpandKeys:e})},y=e=>{var t;h({countMethod:(t=Object.assign({},u.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},b=e=>{h({summationData:e})},v=e=>{h({checkedColumnKey:e})},x=e=>{h({hoverRowKey:e})},E=()=>{h({updateLayout:u.updateLayout+1})},w=()=>{const e=t.current.container.clientWidth,{defaultColumnWidth:n}=Bo,r=[];let i=0;if(a.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,r.push(e))})),r.length>0){const t=a.reduce(((e,t)=>e+(t.width||t.minWidth||n)),0);if(t<=e){const a=e-t;if(1===r.length)r[0].renderWidth=(r[0].minWidth||n)+a;else{const e=a/r.reduce(((e,t)=>e+(t.minWidth||n)),0);let t=0;r.forEach(((r,a)=>{if(0===a)return;const i=Math.floor((r.minWidth||n)*e);t+=i,r.renderWidth=(r.minWidth||n)+i})),r[0].renderWidth=(r[0].minWidth||n)+a-t}}else r.forEach((e=>{e.renderWidth=e.minWidth||n}))}else i=a.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||n)),0)},C=l().useMemo((()=>({...u,indentDepth:p,setContext:h,setSelectionKeys:f,setTreeExpandKeys:g,setCountMethod:y,setSummationData:b,setCheckColumnKey:v,setHoverRowKey:x,forceUpdateLayout:E,updateColumnsWidth:w})),[u,p]);return l().createElement(qm.Provider,{value:C},e.children)},Mm=()=>l().useContext(qm),Km=e=>{const{column:t}=e,{columns:n,setColumns:r}=ym(),{scrollbarRef:a}=Mm(),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 n=e.clientX-d.current.startX,r=(t.width||t.renderWidth)+n;r<(t.minWidth||Bo.defaultColumnWidth)||(u({columnWidth:r}),i.current.style.left=`${d.current.originSizeX+n}px`)},p=()=>{a.current.container.style.cursor="",t.width=d.current.columnWidth,r([...n]),ae((()=>s(!1))),Me(document,"mousemove",m),Me(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(),a.current.container.style.cursor="col-resize";const n=jn(e.target,a.current.container).left-a.current.scrollLeft+3;u({startX:e.clientX,originSizeX:n,columnWidth:t.width||t.renderWidth||0}),$e(document,"mousemove",m),$e(document,"mouseup",p),s(!0),ae((()=>i.current.style.left=`${n}px`)),c.current=document.onselectstart,document.onselectstart=()=>!1}}),l().createElement(Dd(),{open:o,getContainer:a.current?.container},l().createElement("div",{ref:i,className:"resize-line"})))},zm=e=>{const{left:t}=e,{scrollbarRef:n}=Mm();return l().createElement(Dd(),{open:!0,getContainer:n.current?.container},l().createElement("div",{className:"fixed-line",style:{left:t}}))},jm=()=>{const{pivotRef:e,columns:t}=ym(),{indentDepth:n,updateLayout:r,checkedColumnKey:a,selectionKeys:i,setSelectionKeys:o,setCheckColumnKey:s}=Mm(),{rowSelection:c}=e.current.props,{selectionColumn:d}=Bo,{indentWidth:u,selectionColumnDefine:m}=om,p=l().useMemo((()=>sm(t)),[t]),h=l().useMemo((()=>p.filter((e=>"left"===e.fixed))),[p]),f=l().useMemo((()=>p.filter((e=>"left"!==e.fixed))),[p]),g=l().useMemo((()=>h.reduce(((e,t,r)=>e+(t.width||t.renderWidth||0)+(1===r?n*u:0)),0)),[n,r,h]),y=l().useMemo((()=>i.length===e.current.keyRecordMap.size),[i]),b=l().useMemo((()=>i.length>0&&i.length<e.current.keyRecordMap.size),[i]),v=(t,r)=>l().createElement("div",{className:Ee()(r?"fixed-left":"no-fixed"),style:{width:r?g:""}},t.map(((i,p)=>{const{dataIndex:h,title:f,align:g,width:v,renderWidth:x}=i,E={"selection-column":h===d,"col--center":"center"===g,"col--right":"right"===g,"col--checked":a===h},w=r&&1===p||!r&&p===t.length-1?n*u:0,C={width:`${(v||x||0)+w}px`,minWidth:`${(v||x||0)+w}px`};return l().createElement("div",{key:h,className:Ee()("table-cell",E),style:C,onClick:()=>{return e=h,void([m.dataIndex].includes(e)||s(a!==e?e:""));var e}},h!==d?l().createElement("span",{className:"cell"},f):l().createElement(O.Checkbox,{checked:y,indeterminate:b,onChange:t=>(t=>{const n=t?Array.from(e.current.keyRecordMap.keys()):[];o(n),c?.onChange?.(n,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}),h!==d&&l().createElement(Km,{column:i}))})));return l().createElement("div",{className:"header"},v(h,!0),(e=>v(e))(f),l().createElement(zm,{left:g}))},Vm=e=>{const{column:t,keyPath:n,type:r}=e,{prefixCls:a}=ym(),{summationData:i,countMethod:o,setCountMethod:s}=Mm(),{t:c}=G(),{dataIndex:d,filter:u}=t,[m,p]=l().useState(!1),h=l().useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:hm.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:hm.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:hm.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:hm.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:hm.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:hm.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:hm.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:hm.avg}];return"number"===u?.type?e:e.slice(0,-4)}),[]),f=l().useMemo((()=>{const e=o[d];return e?`${h.find((t=>t.value===e)).text} ${(t=i,a=n,a?um(t,a):t)?.[r]?.[d]??""}`:c("qm.pivotGrid.count.statistic");var t,a}),[i,o]);return l().createElement(O.Dropdown,{open:m,trigger:["click"],dropdownRender:()=>l().createElement("div",{className:Ee()("ant-dropdown-menu","container"),style:{padding:5}},l().createElement("div",{className:"list"},h.map((e=>{const t=e.value===o[d];return l().createElement("li",{key:e.value,className:Ee()("ant-dropdown-menu-item check-item",{active:t}),onClick:()=>{s({[d]:t?void 0:e.value}),p(!1)}},l().createElement("span",{className:"label"},e.text),l().createElement("i",{className:"icon"},l().createElement(Ce.CheckOutlined,null)))})))),className:Ee()("count-select",{show:!!o[d]}),overlayClassName:`${a}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},l().createElement("span",null,f," ",l().createElement(Ce.DownOutlined,{className:"icon"})))},Wm=e=>{const{pivotRef:t,expandedKeys:n,groupGridData:r,searchResults:a,switchIndex:i,fillColorCells:o,setExpandedKeys:s}=ym(),{indentDepth:c,hoverRowKey:d,checkedColumnKey:u,selectionKeys:m,treeExpandKeys:p,setSelectionKeys:h,setTreeExpandKeys:f,setHoverRowKey:g}=Mm(),{keyRecordMap:y,isTree:b}=t.current,{rowSelection:v,treeExpandable:x,onRowClick:E}=t.current.props,{renderText:w,getTitleFromCellNode:C}=as(),{selectionColumn:S,treeTable:N}=Bo,{indentWidth:I}=om,T=l().useMemo((()=>Array.isArray(r)),[r]),R=(e,t)=>a[i]?.rowKey===e&&a[i]?.dataIndex===t,k=(t,r,a,i)=>{const{dataIndex:o,width:d,renderWidth:u}=t,m={"expandable-column":o===S},p=e&&1===r?(c-a._groupLevel)*I:0,h={width:`${(d||u||0)+p}px`,minWidth:`${(d||u||0)+p}px`};return l().createElement("div",{key:o,className:Ee()("label-cell",m),style:h},o!==S?l().createElement(l().Fragment,null,e&&1===r&&l().createElement("span",{className:"title"},a._groupLabel.slice(1)),l().createElement(Vm,{column:t,keyPath:a.id,type:"subtotal"})):(e=>l().createElement("button",{className:Ee()("button-icon",{expand:n.includes(e.id)}),onClick:()=>{return t=e.id,void s(n.includes(t)?n.filter((e=>e!==t)):[...n,t]);var t}},l().createElement(Ce.RightOutlined,null)))(a))},P=(t,n,r,a,i)=>{const{dataIndex:s,width:c,renderWidth:d,align:g,render:I}=t,k=Bn(r,s),P=I?I(k,r,t,r.index,n):w(k,t,r),L=C(P),A=m.includes(i),F={"selection-column":s===S,"col--center":"center"===g,"col--right":"right"===g,"col--checked":u===s,active:R(i,s)},_={width:`${c||d||0}px`,minWidth:`${c||d||0}px`,backgroundColor:o.get(`${i}|${s}`)};return l().createElement("div",{key:s,"data-col-index":n,title:L,className:Ee()("table-cell",F),style:_,onClick:e=>{s!==S&&E?.(r,t,e)}},s!==S?l().createElement(l().Fragment,null,e&&b&&1===n&&l().createElement(l().Fragment,null,(D=r._level)?l().createElement("span",{key:D,className:`cell--indent indent-level-${D}`,style:{paddingLeft:D*N.textIndent+"px"}}):null,((e,t)=>l().createElement(Ce.DownOutlined,{className:Ee()("cell--expand",{fold:!p.includes(t)}),style:{visibility:e.children?.length>0?"visible":"hidden"},onClick:()=>(e=>{const t=p.includes(e),n=t?p.filter((t=>t!==e)):[...p,e];f(n),x?.onExpand?.(!t,y.get(e)),x?.onChange?.(n)})(t)}))(r,i)),l().createElement("span",{className:Ee()("cell",{indent:!T})},P)):l().createElement(l().Fragment,null,l().createElement("span",{className:"order"},((e,t)=>b?0===e._level?e._varIndex+1:null:t+1)(r,a)),l().createElement(O.Checkbox,{className:"checkbox",checked:A,onChange:e=>((e,t)=>{const n=e?[...m,t]:m.filter((e=>e!==t));h(n),v?.onSelect?.(e,y.get(t)),v?.onChange?.(n,(e=>{const t=[];return e.forEach((e=>t.push(y.get(e)))),t})(n))})(e.target.checked,i)})));var D};return{renderGroupRow:(e,t,n)=>l().createElement("div",{className:"label-row"},e.map(((e,n)=>k(e,n,t)))),renderRow:(e,t,n,r)=>{const a={"row--selection":m.includes(r),"row--hover":d===r};return l().createElement("li",{key:r,"data-row-key":r,className:Ee()("table-row",a),onMouseEnter:()=>g(r),onMouseLeave:()=>g("")},e.map(((e,a)=>P(e,a,t,n,r))))}}},Bm=e=>{const{tbodyColumns:t,layout:n,displayList:r,virtualRows:a}=e,{indentDepth:i,updateLayout:o}=Mm(),{indentWidth:s}=om,{renderGroupRow:c,renderRow:d}=Wm(!0),u=l().useMemo((()=>t.filter((e=>"left"===e.fixed))),[t]),m=l().useMemo((()=>u.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?i*s:0)),0)),[i,o,u]);return l().createElement("div",{className:"left-panel",style:{width:m}},l().createElement("div",{className:"container"},a.map((e=>{const t=e.index,a=n[t],i=r[t];if(dm(i))return l().createElement("div",{key:i.id,className:"group-label",style:{top:a.top,left:a.left,right:0,height:a.height}},c(u,i,a.key));const o=t===n.length-1||dm(r[t+1]);return l().createElement("div",{key:a.key,className:Ee()("row-item",{last:o}),style:{top:a.top,left:a.left,right:0,height:a.height}},d(u,i,i._varIndex,a.key))}))))},Um=e=>{const{tbodyColumns:t,layout:n,displayList:r,virtualRows:a}=e,{pivotRef:i}=ym(),{renderGroupRow:o,renderRow:s}=Wm(),c=l().useMemo((()=>t.filter((e=>"left"!==e.fixed))),[t]);return l().createElement("div",{className:"main-panel"},l().createElement("div",{className:"container"},a.map((e=>{const t=e.index,a=n[t],i=r[t];if(dm(i))return l().createElement("div",{key:i.id,className:"group-label",style:{top:a.top,left:0,right:a.right,height:a.height}},o(c,i,a.key));const d=t===n.length-1||dm(r[t+1]);return l().createElement("div",{key:a.key,className:Ee()("row-item",{last:d}),style:{top:a.top,left:0,right:a.right,height:a.height}},s(c,i,i._varIndex,a.key))}))))},Gm=()=>{const{pivotRef:e,getRowKey:t,size:n,columns:r,groupGridData:a,expandedKeys:i,searchResults:o,switchIndex:s}=ym(),{scrollbarRef:c,treeExpandKeys:d}=Mm(),{flatGroupData:u}=e.current,{groupMargin:m}=om,{rowHeightMaps:p}=Bo,h=l().useRef(null),{contextMenu:f}=(({ref:e,popup:t,getTriggerContainer:n,prevent:r,enabled:a=!0})=>{const i=l().useRef(null),o=l().useRef(null),s=e=>{o.current=e},[c,d]=l().useState(!1),[u,m]=l().useState(null),p={width:150,height:200,zIndex:9999};Fc({ref:i,handler:()=>h()});const h=()=>{d(!1),m(null),s(null)},f=Y((e=>{if(e.preventDefault(),r?.(e.target))return h();s(e),d(!0),ae((()=>{const{width:t,height:n}=i.current?.getBoundingClientRect()||p,r=t,a=n,l=window.innerWidth,o=window.innerHeight;let s=e.clientX,c=e.clientY;s+r>l&&(s=Math.max(s-r,0)),c+a>o&&(c=Math.max(c-a,0)),m({x:s,y:c})}))}));l().useEffect((()=>{const t=n?.(e.current)||e.current;return a&&t&&t.addEventListener("contextmenu",f),()=>{t&&t.removeEventListener("contextmenu",f)}}),[e]);const g=we("context-menu"),y={position:"fixed",top:`${u?.y||0}px`,left:`${u?.x||0}px`,zIndex:p.zIndex};return{contextMenu:l().createElement(Dd(),{open:c},l().createElement("div",{ref:i,className:g,style:y},o.current?t(o.current):null)),closeMenu:h}})({ref:h,prevent:e=>e.offsetParent.classList.contains("group-label"),enabled:!1,popup:e=>{const n=Ue(e.target,"table-row"),r=n?.getAttribute("data-row-key")||"";return u.find((e=>t(e,e.index)==r)),l().createElement("ul",{className:"ant-dropdown-menu",style:{height:200,width:150}},"右键菜单。。。")}}),g=l().useMemo((()=>sm(r)),[r]),y=l().useMemo((()=>Array.isArray(a)),[a]),b=l().useMemo((()=>{const e=new Map,n=[];return u.forEach((r=>{if(dm(r)){if(0===r._groupLevel)return e.set(r.id,i.includes(r.id)),void n.push(r);const t=r.id.slice(0,r.id.lastIndexOf(om.separator));return void(i.includes(t)&&e.get(t)&&(e.set(r.id,i.includes(r.id)),n.push(r)))}const a=t(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(a,d.includes(a)),n.push(r))})),e.clear(),n}),[a,i,d]),v=l().useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],a=[],i=n,l=om.indentWidth,o=om.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;a.length>0&&a[a.length-1]._level>=e._groupLevel;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}a[a.length-1];const t={key:e.id,top:s,left:l*e._groupLevel,right:l*e._groupLevel,height:i,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),a.push(t),s+=i}else{const n=a[a.length-1]||{left:0,right:0},l={key:t(e,e.index),top:s,left:n.left,right:n.right,height:i};r.push(l),s+=i,a.length>0&&(n._childHeight+=i)}}));a.length>0;){const e=a.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,a.length>0){const t=a[a.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(b,{getRowKey:t,rowHeight:p[n]})),[b,n]),x=l().useMemo((()=>{if(y)return v.reduce(((e,t)=>e+t.height),0)+2*m;const e=v.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*m+2*m}),[y,v]),{virtualRows:E}=(e=>{const{layout:t,isGroup:n}=e,{size:r}=ym(),{scrollbarRef:a}=Mm(),{rowHeightMaps:i}=Bo,o=l().useMemo((()=>a.current?.container.children[0]??null),[a.current]),s=Cc({count:t.length,getScrollElement:()=>o,estimateSize:e=>t[e].height,overscan:1,noCache:n,rangeExtractor:e=>{if(!n)return pc(e);const l=a.current.scrollTop,c=s.scrollElement?.offsetHeight||o.offsetHeight,d=[];for(let e=0;e<t.length;e++){const n=t[e];l>n.top+n.height+i[r]||l+c+i[r]<n.top||d.push(e)}return d}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:v,isGroup:!y});qe((()=>{const e=u.findIndex((e=>t(e,e.index)===o[s]?.rowKey));e>=0&&c.current.SET_SCROLL_TOP(e*p[n]);const r=g.findIndex((e=>e.dataIndex===o[s]?.dataIndex));if(r>=0){const e=g.slice(0,r).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]);const w={tbodyColumns:g,layout:v,displayList:b,virtualRows:E};return l().createElement("div",{ref:h,className:"body",style:{height:x}},l().createElement(Bm,w),l().createElement(Um,w),f)},Ym=()=>{const{columns:e,groupGridData:t}=ym(),{indentDepth:n,updateLayout:r,countMethod:a,setSummationData:i}=Mm(),{selectionColumn:o}=Bo,{indentWidth:s}=om,c=l().useMemo((()=>sm(e)),[e]),d=l().useMemo((()=>c.filter((e=>"left"===e.fixed))),[c]),u=l().useMemo((()=>c.filter((e=>"left"!==e.fixed))),[c]),m=l().useMemo((()=>d.reduce(((e,t,r)=>e+(t.width||t.renderWidth||0)+(1===r?n*s:0)),0)),[n,r,d]);qe((()=>{i(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const a=e.map((e=>oe(e,r)||0));n[r]=t[r](a)}return n},a=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const i={},l={};Object.keys(t).forEach((e=>{l[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>oe(e,n)||0));e[n]=t[n](r),l[n].push(...r)}i[r]={subtotal:e}}else{const e=a(o);i[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&l[n].push(t)}}}if(0===n.length)return i;const o={};for(const e in t)o[e]=t[e](l[e]);return i.subtotal=o,i},i=Array.isArray(e)?{total:r(e)}:a(e);return n.length>0&&(i.total=r(n)),delete i.subtotal,i})(t,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:hm[e[n]]});return t})(a)))}),[a,t]);const p=(e,t)=>l().createElement("div",{className:Ee()(t?"fixed-left":"no-fixed"),style:{width:t?m:""}},e.map(((r,a)=>{const{dataIndex:i,width:c,renderWidth:d}=r,u={"selection-column":i===o,"col--right":!0},m=t&&1===a||!t&&a===e.length-1?n*s:0,p={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return l().createElement("div",{key:i,className:Ee()("table-cell",u),style:p},i!==o?l().createElement(Vm,{column:r,keyPath:"",type:"total"}):null)})));return l().createElement("div",{className:"footer"},p(d,!0),(e=>p(e))(u))},Xm=()=>{const{prefixCls:e,size:t}=ym(),n=l().useRef(null);return l().createElement($m,{scrollbar:n},l().createElement(Rt,{ref:n,className:Ee()(`${e}__layout`,t)},l().createElement(jm,null),l().createElement(Gm,null),l().createElement(Ym,null)))},Qm=()=>l().createElement("div",{className:"wrapper"},l().createElement(Xm,null)),Zm={rowKey:"id",columns:[],dataSource:[]},Jm=e=>{const t=h(Zm,e),{rowKey:n,fromTable:r,columns:a,dataSource:i,height:o,maxHeight:s,className:c,style:d}=t,{$size:u}=X(t),m=Y(((e,t)=>{const r="function"==typeof n?n(e,t):e?.[n];return void 0===r?(pe("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r})),p=(e,t="",n=0)=>e.map(((e,r)=>{const a=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=p(e.children,a,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),f=l().useMemo((()=>(e=>{let t=!1;const n=(e=>e.filter((e=>![Bo.expandableColumn,Bo.selectionColumn,"index","pageIndex",Bo.operationColumn].includes(e.dataIndex))))(e).map((e=>{"left"===e.fixed&&(t=!0);const n={...e,fixed:"left"===e.fixed?"left":void 0,editRender:void 0};return r&&(void 0===n.fixed&&delete n.fixed,delete n.editRender),n}));return!t&&n.length&&(n[0].fixed="left",pe("PivotGrid","至少需要有一项 `fixed: left` 的固定列")),n})(a)),[a]),g=l().useMemo((()=>p(i)),[i]),y=we("pivot-grid"),b={[y]:!0,"is-from-table":r},v={height:o,maxHeight:o||s?s:500},x={prefixCls:y,size:u,getRowKey:m,flatColumns:f,tableData:g,pivotProps:se(t,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return l().createElement("div",{className:Ee()(b,c),style:{...d,...v}},l().createElement(gm,x,l().createElement(Hm,null),l().createElement(Qm,null)))};Jm.displayName="PivotGrid";const ep=Jm,tp=l().forwardRef(((e,t)=>{const{dataIndex:n,className:r,style:a}=e;return l().createElement("li",{ref:t,"data-index":n,className:Ee()("list-item",r),style:a},e.children)}));tp.displayName="ListItem";const np=tp,rp=l().forwardRef(((e,t)=>{const{dataSource:n=[],height:r,maxHeight:a,itemHeight:i,renderItem:o,onScroll:s,className:c}=e,d=l().useRef(null),u=Cc({count:n.length,getScrollElement:()=>d.current?.container.children[0]??null,estimateSize:()=>i||40,overscan:3,onChange:(e,t)=>s?.(e,t)}),m=u.getVirtualItems();l().useImperativeHandle(t,(()=>({SCROLL_TO_INDEX:e=>u.scrollToIndex(e),SCROLL_TO_OFFSET:e=>u.scrollToOffset(e)})));const p=we("virtual-list");return l().createElement(Rt,{ref:d,className:Ee()(p,c),style:{...e.style,height:r,maxHeight:a}},l().createElement("div",{className:"container",style:{height:u.getTotalSize()}},l().createElement("ul",{style:{transform:`translateY(${m[0]?.start??0}px)`}},m.map((e=>l().createElement(np,{ref:u.measureElement,key:e.index,dataIndex:e.index,style:{height:i}},o?.(n[e.index],e.index)))))))}));rp.displayName="VirtualList";const ap=rp,ip=require("@rc-component/color-picker");var lp=r.n(ip);const op=e=>{const{value:t,defaultValue:n,disabled:r,disabledAlpha:a,className:i,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=Go("",{value:t,defaultValue:n}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),p=Fd({offset:0,arrowWidth:16,borderRadius:6}),h=we("color-picker");return l().createElement(qd(),{action:["click"],prefixCls:h,popupPlacement:"bottomLeft",builtinPlacements:p,popup:()=>l().createElement(lp(),{prefixCls:h,value:d,disabled:r,disabledAlpha:a,onChange:(e,t)=>{u(e.toRgbString()),s?.(m(e),t)},onChangeComplete:(e,t)=>{c?.(m(e),t)}})},l().createElement("div",{className:Ee()(`${h}-btn`,i),style:o},l().createElement(ip.ColorBlock,{color:d,prefixCls:h})))};op.displayName="ColorPicker";const sp=op,cp="1.11.14";return a})()));