dcp-design-react 1.11.16 → 1.11.17
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.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/style/index.css +5 -0
- package/lib/style/index.min.css +1 -1
- package/lib/table/src/hooks/useTableCore.d.ts +0 -2
- package/lib/table/src/hooks/useTableEffect.d.ts +0 -2
- package/lib/table/style/table.less +377 -373
- package/lib/virtual-list/src/core.d.ts +1 -1
- package/lib/virtual-list/style/index.less +23 -22
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t,{createContext as n,version as r,isValidElement as i,useRef as l,useLayoutEffect as a,useEffect as o,Component as s,forwardRef as c,useImperativeHandle as d,useState as u,useCallback as p}from"react";import h from"dayjs";import"dayjs/locale/zh-cn";import m from"dayjs/plugin/localeData";import f from"dayjs/plugin/advancedFormat";import g from"dayjs/plugin/customParseFormat";import v from"dayjs/plugin/quarterOfYear";import y from"dayjs/plugin/weekOfYear";import b from"dayjs/plugin/weekday";import{ConfigProvider as x,Button as E,Tooltip as w,Popconfirm as C,Space as S,Empty as N,Spin as T,Upload as I,message as R,Input as O,Tabs as k,Drawer as L,Modal as A,Form as P,Row as _,Col as D,Select as H,Checkbox as M,Dropdown as F,InputNumber as $,Rate as q,Radio as j,Switch as K,Tag as z,TreeSelect as V,Cascader as W,notification as B,Image as U,Tree as G,Menu as Y,Popover as X,Pagination as Q,Slider as Z,Divider as J}from"antd";export{Affix,Alert,Anchor,AutoComplete,Avatar,BackTop,Badge,Breadcrumb,Button,Card,Carousel,Cascader,Checkbox,Col,Collapse,Comment,ConfigProvider,Descriptions,Divider,Drawer,Dropdown,Empty,Form,Grid,Image,Input,InputNumber,Layout,List,Mentions,Menu,Modal,PageHeader,Pagination,Popconfirm,Popover,Progress,Radio,Rate,Result,Row,Segmented,Select,Skeleton,Slider,Space,Spin,Statistic,Steps,Switch,Table,Tabs,Tag,Timeline,Tooltip,Transfer,Tree,TreeSelect,Typography,Upload,message,notification}from"antd";import ee from"dayjs/plugin/weekYear";import te from"antd/es/calendar/generateCalendar";import ne from"antd/es/date-picker/generatePicker";import re from"antd/es/locale/zh_CN";import ie from"antd/es/locale/en_GB";import{isArray as le,isPlainObject as ae,isNumber as oe,isFunction as se,isString as ce,isUndefined as de,get as ue,transform as pe,isEqual as he,set as me,xor as fe,isRegExp as ge,merge as ve,uniqBy as ye,debounce as be,intersection as xe,map as Ee,groupBy as we,flatten as Ce,spread as Se,mergeWith as Ne,isDate as Te,omitBy as Ie,sumBy as Re,maxBy as Oe,minBy as ke,union as Le,pickBy as Ae,throttle as Pe}from"lodash-es";import _e from"classnames";import{UpOutlined as De,DownOutlined as He,UploadOutlined as Me,LinkOutlined as Fe,EditOutlined as $e,CheckOutlined as qe,EyeOutlined as je,DownloadOutlined as Ke,DeleteOutlined as ze,FullscreenExitOutlined as Ve,FullscreenOutlined as We,UnorderedListOutlined as Be,HolderOutlined as Ue,SearchOutlined as Ge,CloseOutlined as Ye,ExclamationCircleOutlined as Xe,ReloadOutlined as Qe,ZoomInOutlined as Ze,ZoomOutOutlined as Je,RotateRightOutlined as et,RotateLeftOutlined as tt,InboxOutlined as nt,InfoCircleFilled as rt,PrinterOutlined as it,ImportOutlined as lt,SettingOutlined as at,CopyOutlined as ot,CheckSquareOutlined as st,CloseCircleOutlined as ct,MonitorOutlined as dt,LineChartOutlined as ut,PlusOutlined as pt,PieChartOutlined as ht,FunnelPlotOutlined as mt,AppstoreAddOutlined as ft,StepBackwardOutlined as gt,StepForwardOutlined as vt,InfoCircleOutlined as yt,ClearOutlined as bt,PauseOutlined as xt,CaretRightOutlined as Et,QuestionCircleOutlined as wt,MenuOutlined as Ct,BorderOutlined as St,RightOutlined as Nt,LeftOutlined as Tt,FolderOpenOutlined as It,FilterOutlined as Rt,SortAscendingOutlined as Ot,EyeInvisibleOutlined as kt,ColumnHeightOutlined as Lt,FolderOutlined as At,BarsOutlined as Pt,SaveOutlined as _t,BgColorsOutlined as Dt,CaretDownOutlined as Ht,ExpandAltOutlined as Mt}from"@ant-design/icons";import Ft from"react-countup";import $t from"resize-observer-polyfill";import qt from"sortablejs";import jt from"add-dom-event-listener";import Kt from"scroll-into-view-if-needed";import zt from"react-draggable";import Vt from"memoize-one";import*as Wt from"prop-types";import Bt from"prop-types";import Ut from"cropperjs";import Gt from"big.js";import Yt from"copy-to-clipboard";import Xt from"@rc-component/portal";import Qt from"@rc-component/trigger";import Zt from"html2canvas";import Jt,{flushSync as en}from"react-dom";import tn,{ColorBlock as nn}from"@rc-component/color-picker";import{ReactSortable as rn}from"react-sortablejs";import ln from"exceljs";import an from"localforage";import on from"china-area-data";const sn=n({locale:"zh-cn",size:"middle"});var cn={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:"看板视图"}}}};let dn=cn;function un(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const pn=(...e)=>{const[t,n]=e;let r;const i=t.split(".");let l=dn;for(let e=0,t=i.length;e<t;e++){if(r=l[i[e]],e===t-1)return un(r,n);if(!r)return"";l=r}return""},hn=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})),mn=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function fn(e,t){mn((t=>{if(!t)return e()}),t)}h.extend(m),h.extend(f),h.extend(g),h.extend(v),h.extend(y),h.extend(b);var gn={},vn=[];function yn(e,t){if(!e&&void 0!==console){var n=vn.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function bn(e,t){if(!e&&void 0!==console){var n=vn.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function xn(e,t,n){t||gn[n]||(e(!1,n),gn[n]=!0)}function En(e,t){xn(yn,e,t)}function wn(e,t){xn(bn,e,t)}En.preMessage=function(e){vn.push(e)},En.resetWarned=function(){gn={}},En.noteOnce=wn,h.extend(g),h.extend(f),h.extend(b),h.extend(m),h.extend(y),h.extend(ee),h.extend((function(e,t){var n=t.prototype,r=n.format;n.format=function(e){var t=(e||"").replace("Wo","wo");return r.bind(this)(t)}}));var Cn={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},Sn=function(e){return Cn[e]||e.split("_")[0]},Nn=function(){wn(!1,"Not match any format. Please help to fire a issue about this.")},Tn={getNow:function(){return h()},getFixedDate:function(e){return h(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var t=e.locale("en");return t.weekday()+t.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},addYear:function(e,t){return e.add(t,"year")},addMonth:function(e,t){return e.add(t,"month")},addDate:function(e,t){return e.add(t,"day")},setYear:function(e,t){return e.year(t)},setMonth:function(e,t){return e.month(t)},setDate:function(e,t){return e.date(t)},setHour:function(e,t){return e.hour(t)},setMinute:function(e,t){return e.minute(t)},setSecond:function(e,t){return e.second(t)},isAfter:function(e,t){return e.isAfter(t)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return h().locale(Sn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(Sn(e)).weekday(0)},getWeek:function(e,t){return t.locale(Sn(e)).week()},getShortWeekDays:function(e){return h().locale(Sn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return h().locale(Sn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(Sn(e)).format(n)},parse:function(e,t,n){for(var r=Sn(e),i=0;i<n.length;i+=1){var l=n[i],a=t;if(l.includes("wo")||l.includes("Wo")){for(var o=a.split("-")[0],s=a.split("-")[1],c=h(o,"YYYY").startOf("year").locale(r),d=0;d<=52;d+=1){var u=c.add(d,"week");if(u.format("Wo")===s)return u}return Nn(),null}var p=h(a,l).locale(r);if(p.isValid())return p}return t&&Nn(),null}}};const In=te(Tn),Rn=ne(Tn);function On(){return On=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},On.apply(null,arguments)}const kn=e.forwardRef(((t,n)=>e.createElement(Rn,On({},t,{picker:"time",mode:void 0,ref:n}))));kn.displayName="TimePicker";const Ln=e.forwardRef(((t,n)=>e.createElement(Rn.RangePicker,On({},t,{picker:"time",mode:void 0,ref:n}))));Ln.displayName="RangePicker",kn.RangePicker=Ln;var An={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"}}}};const Pn={[An.name]:{qm:An,antd:ie},[cn.name]:{qm:cn,antd:re}},_n=e=>{const n=hn({locale:"zh-cn",size:"middle"},e),{locale:r,size:i,global:l}=n;t.useMemo((()=>{return e=Object.assign({},Pn,null==l?void 0:l.langPackage)[r].qm,dn=e||dn,void(dn.name&&h.locale(dn.name));var e}),[r]);const a=t.useMemo((()=>Object.assign({},Pn,null==l?void 0:l.langPackage)),[l]),[o,s]=t.useState({locale:r,size:i,global:l});return fn((()=>{s((e=>Object.assign({},e,{locale:r,size:i})))}),[i,r]),t.createElement(sn.Provider,{value:o},t.createElement(x,{locale:a[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==l?void 0:l.autoInsertSpaceInButton},n.children))};function Dn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function Hn(e,t,n,r){var i,l=arguments.length,a=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(l<3?i(a):l>3?i(t,n,a):i(t,n))||a);return l>3&&a&&Object.defineProperty(t,n,a),a}function Mn(e,t,n,r){return new(n||(n=Promise))((function(i,l){function a(e){try{s(r.next(e))}catch(e){l(e)}}function o(e){try{s(r.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}s((r=r.apply(e,t||[])).next())}))}function Fn(){const{locale:t}=e.useContext(sn);return{t:pn,$locale:t}}function $n(t){const n=e.useRef();n.current=t;return e.useCallback(((...e)=>{var t;return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)}),[])}function qn(t){const{size:n}=e.useContext(sn);return{$size:e.useMemo((()=>{var e,r;return null!==(r=null!==(e=t.size)&&void 0!==e?e:n)&&void 0!==r?r:""}),[t.size,n])}}_n.displayName="QmConfigProvider";var jn="undefined"==typeof window;const Kn=e=>t.isValidElement(e),zn=e=>Kn(e)&&e.type===t.Fragment,Vn=()=>{},Wn=()=>!0,Bn=e=>Mn(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),Un=e=>{Promise.resolve().then(e)},Gn=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),Yn=e=>!!(!e&&0!==e||le(e)&&!e.length||ae(e)&&!Object.keys(e).length),Xn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),Qn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Zn=(e,t=new WeakMap)=>{if(ae(e)||le(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const i=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(i||e,((n,l)=>{i&&(l=n),r[l]=Zn(e[l],t)})),r}return e},Jn=e=>oe(e)?`${e}px`:e.toString();class er extends Error{constructor(e){super(e),this.name="QmDesignError"}}function tr(e,t){throw new er(`[${e}] ${t}`)}function nr(e,t){console.warn(new er(`[${e}] ${t}`))}const rr=e=>{const{loading:n,shortcutKey:r,authConfig:i,click:l,confirm:a}=e,{t:o}=Fn(),{$size:s}=qn(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=$n((e=>{var t;const n=r.split("+").map((e=>e.trim().toLowerCase())),i=n.includes("alt"),l=n.includes("ctrl"),a=n.includes("shift"),o=n[n.length-1];i&&!e.altKey||l&&!e.ctrlKey||a&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),h.disabled||null===(t=h.onClick)||void 0===t||t.call(h,e))})),p=se(l)?{onClick:t=>Mn(void 0,void 0,void 0,(function*(){var n;d(!0);try{yield null===(n=e.click)||void 0===n?void 0:n.call(e,t)}catch(e){nr("Button","`click`方法执行出错")}d(!1)}))}:null,h=Object.assign(Object.assign(Object.assign({},Qn(e,["shortcutKey","authConfig","click","confirm"])),{size:s,loading:c||n||!1}),p);if(i){const{visible:e=1,disabled:t}=i||{};if(!e)return null;t&&(h.disabled=!0)}const m=t.createElement(E,h,e.children);return a?t.createElement(C,{title:a.title||o("qm.button.confirmTitle"),disabled:h.disabled,onConfirm:e=>{var t,n;null===(t=a.onConfirm)||void 0===t||t.call(a),null===(n=h.onClick)||void 0===n||n.call(h,e)},onCancel:e=>{var t;null===(t=a.onCancel)||void 0===t||t.call(a,e)}},t.createElement(E,On({},h,{onClick:Vn}),e.children)):!r||h.disabled?m:t.createElement(w,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},m)};var ir;rr.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(ir||(ir={}));const lr=e=>{const{$size:n}=qn(e),r=oe(e.size)?e.size:ir[n||"default"],i=Object.assign(Object.assign({},Qn(e,["size"])),{size:r});return t.createElement(S,i,e.children)};lr.displayName="QmSpace";const ar=e=>`qm-${e}`,or=e=>{const{label:n,extra:r,collapse:i,bordered:l=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=qn(e),{t:p}=Fn(),h=ar("divider"),m={[h]:!0,[`${h}-borderless`]:!l,[`${h}--lg`]:"large"===u,[`${h}--sm`]:"small"===u};return t.createElement("div",{id:o,className:_e(m,s),style:c},t.createElement("span",{className:`${h}__title`},n),t.createElement("div",{className:`${h}__extra`},r),void 0!==i&&t.createElement(E,{type:"link",className:`${h}__collapse`,disabled:a,onClick:()=>{null==d||d(!i)}},p(i?"qm.divider.collect":"qm.divider.spread"),i?t.createElement(De,null):t.createElement(He,null)))};or.displayName="QmDivider";const sr=()=>({height:0,opacity:0}),cr=e=>({height:e.scrollHeight,opacity:1}),dr=e=>({height:e?e.offsetHeight:0}),ur=(e,t)=>!0===(null==t?void 0:t.deadline)||"height"===t.propertyName;function pr(e){return pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pr(e)}function hr(e){var t=function(e,t){if("object"!==pr(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==pr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===pr(t)?t:String(t)}function mr(e,t,n){return(t=hr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fr(Object(n),!0).forEach((function(t){mr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,l,a,o=[],s=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=l.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function br(e){return e instanceof HTMLElement||e instanceof SVGElement}function xr(e){var n,r=function(e){return e&&"object"===pr(e)&&br(e.nativeElement)?e.nativeElement:br(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Jt.findDOMNode)||void 0===n?void 0:n.call(Jt,e):null)}var Er,wr={exports:{}},Cr={};wr.exports=(Er||(Er=1,function(){var e,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case t:var f=e.type;switch(f){case r:case l:case i:case d:case u:return f;default:var g=f&&f.$$typeof;switch(g){case s:case o:case c:case h:case p:case a:return g;default:return m}}case n:return m}}}e=Symbol.for("react.module.reference");var g=o,v=a,y=t,b=c,x=r,E=h,w=p,C=n,S=l,N=i,T=d,I=u,R=!1,O=!1;Cr.ContextConsumer=g,Cr.ContextProvider=v,Cr.Element=y,Cr.ForwardRef=b,Cr.Fragment=x,Cr.Lazy=E,Cr.Memo=w,Cr.Portal=C,Cr.Profiler=S,Cr.StrictMode=N,Cr.Suspense=T,Cr.SuspenseList=I,Cr.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},Cr.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},Cr.isContextConsumer=function(e){return f(e)===o},Cr.isContextProvider=function(e){return f(e)===a},Cr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Cr.isForwardRef=function(e){return f(e)===c},Cr.isFragment=function(e){return f(e)===r},Cr.isLazy=function(e){return f(e)===h},Cr.isMemo=function(e){return f(e)===p},Cr.isPortal=function(e){return f(e)===n},Cr.isProfiler=function(e){return f(e)===l},Cr.isStrictMode=function(e){return f(e)===i},Cr.isSuspense=function(e){return f(e)===d},Cr.isSuspenseList=function(e){return f(e)===u},Cr.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===l||t===i||t===d||t===u||t===m||"object"==typeof t&&null!==t&&(t.$$typeof===h||t.$$typeof===p||t.$$typeof===a||t.$$typeof===o||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},Cr.typeOf=f}()),Cr);var Sr=function(e,t){"function"==typeof e?e(t):"object"===pr(e)&&e&&"current"in e&&(e.current=t)},Nr=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);return r.length<=1?r[0]:function(e){t.forEach((function(t){Sr(t,e)}))}},Tr=function(e){var t,n,r=wr.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===wr.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===wr.exports.ForwardRef)};function Ir(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}Number(r.split(".")[0]);var Rr=e.createContext({});function Or(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,hr(r.key),r)}}function Lr(e,t,n){return t&&kr(e.prototype,t),n&&kr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ar(e,t){return Ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ar(e,t)}function Pr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ar(e,t)}function _r(e){return _r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_r(e)}function Dr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_r(e);if(t){var i=_r(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===pr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Dr(e)}(this,n)}}var Mr=function(t){Pr(r,e.Component);var n=Hr(r);function r(){return Or(this,r),n.apply(this,arguments)}return Lr(r,[{key:"render",value:function(){return this.props.children}}]),r}();function Fr(t){var n=e.useRef(!1),r=yr(e.useState(t),2),i=r[0],l=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[i,function(e,t){t&&n.current||l(e)}]}var $r="none",qr="appear",jr="enter",Kr="leave",zr="none",Vr="prepare",Wr="start",Br="active",Ur="end",Gr="prepared";function Yr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var Qr,Zr,Jr,ei=(Qr=Yr(),Zr="undefined"!=typeof window?window:{},Jr={animationend:Xr("Animation","AnimationEnd"),transitionend:Xr("Transition","TransitionEnd")},Qr&&("AnimationEvent"in Zr||delete Jr.animationend.animation,"TransitionEvent"in Zr||delete Jr.transitionend.transition),Jr),ti={};if(Yr()){var ni=document.createElement("div");ti=ni.style}var ri={};function ii(e){if(ri[e])return ri[e];var t=ei[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var l=n[i];if(Object.prototype.hasOwnProperty.call(t,l)&&l in ti)return ri[e]=t[l],ri[e]}return""}var li=ii("animationend"),ai=ii("transitionend"),oi=!(!li||!ai),si=li||"animationend",ci=ai||"transitionend";function di(e,t){return e?"object"===pr(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var ui=function(t){var n=l(),r=l(t);r.current=t;var i=e.useCallback((function(e){r.current(e)}),[]);function a(e){e&&(e.removeEventListener(ci,i),e.removeEventListener(si,i))}return e.useEffect((function(){return function(){a(n.current)}}),[]),[function(e){n.current&&n.current!==e&&a(n.current),e&&e!==n.current&&(e.addEventListener(ci,i),e.addEventListener(si,i),n.current=e)},a]},pi=Yr()?a:o,hi=function(e){return+setTimeout(e,16)},mi=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(hi=function(e){return window.requestAnimationFrame(e)},mi=function(e){return window.cancelAnimationFrame(e)});var fi=0,gi=new Map;function vi(e){gi.delete(e)}var yi=function(e){var t=fi+=1;return function n(r){if(0===r)vi(t),e();else{var i=hi((function(){n(r-1)}));gi.set(t,i)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};yi.cancel=function(e){var t=gi.get(e);return vi(e),mi(t)},yi.ids=function(){return gi};var bi=[Vr,Wr,Br,Ur],xi=[Vr,Gr],Ei=!1,wi=!0;function Ci(e){return e===Br||e===Ur}var Si=function(t,n,r){var i=yr(Fr(zr),2),l=i[0],a=i[1],o=function(){var t=e.useRef(null);function n(){yi.cancel(t.current)}return e.useEffect((function(){return function(){n()}}),[]),[function e(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;n();var l=yi((function(){i<=1?r({isCanceled:function(){return l!==t.current}}):e(r,i-1)}));t.current=l},n]}(),s=yr(o,2),c=s[0],d=s[1];var u=n?xi:bi;return pi((function(){if(l!==zr&&l!==Ur){var e=u.indexOf(l),t=u[e+1],n=r(l);n===Ei?a(t,!0):t&&c((function(e){function r(){e.isCanceled()||a(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,l]),e.useEffect((function(){return function(){d()}}),[]),[function(){a(Vr,!0)},l]};var Ni=function(t){var n=t;"object"===pr(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var i=t.visible,a=void 0===i||i,s=t.removeOnLeave,c=void 0===s||s,d=t.forceRender,u=t.children,p=t.motionName,h=t.leavedClassName,m=t.eventProps,f=function(e,t){return!(!e.motionName||!n||!1===t)}(t,e.useContext(Rr).motion),g=l(),v=l();var y=function(t,n,r,i){var a=i.motionEnter,s=void 0===a||a,c=i.motionAppear,d=void 0===c||c,u=i.motionLeave,p=void 0===u||u,h=i.motionDeadline,m=i.motionLeaveImmediately,f=i.onAppearPrepare,g=i.onEnterPrepare,v=i.onLeavePrepare,y=i.onAppearStart,b=i.onEnterStart,x=i.onLeaveStart,E=i.onAppearActive,w=i.onEnterActive,C=i.onLeaveActive,S=i.onAppearEnd,N=i.onEnterEnd,T=i.onLeaveEnd,I=i.onVisibleChanged,R=yr(Fr(),2),O=R[0],k=R[1],L=yr(Fr($r),2),A=L[0],P=L[1],_=yr(Fr(null),2),D=_[0],H=_[1],M=l(!1),F=l(null);function $(){return r()}var q=l(!1);function j(){P($r,!0),H(null,!0)}function K(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=q.current;A===qr&&r?n=null==S?void 0:S(t,e):A===jr&&r?n=null==N?void 0:N(t,e):A===Kr&&r&&(n=null==T?void 0:T(t,e)),A!==$r&&r&&!1!==n&&j()}}var z=yr(ui(K),1)[0],V=function(e){var t,n,r;switch(e){case qr:return mr(t={},Vr,f),mr(t,Wr,y),mr(t,Br,E),t;case jr:return mr(n={},Vr,g),mr(n,Wr,b),mr(n,Br,w),n;case Kr:return mr(r={},Vr,v),mr(r,Wr,x),mr(r,Br,C),r;default:return{}}},W=e.useMemo((function(){return V(A)}),[A]),B=yr(Si(A,!t,(function(e){if(e===Vr){var t=W[Vr];return t?t($()):Ei}var n;return G in W&&H((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===Br&&(z($()),h>0&&(clearTimeout(F.current),F.current=setTimeout((function(){K({deadline:!0})}),h))),G===Gr&&j(),wi})),2),U=B[0],G=B[1],Y=Ci(G);q.current=Y,pi((function(){k(n);var e,r=M.current;M.current=!0,!r&&n&&d&&(e=qr),r&&n&&s&&(e=jr),(r&&!n&&p||!r&&m&&!n&&p)&&(e=Kr);var i=V(e);e&&(t||i[Vr])?(P(e),U()):P($r)}),[n]),o((function(){(A===qr&&!d||A===jr&&!s||A===Kr&&!p)&&P($r)}),[d,s,p]),o((function(){return function(){M.current=!1,clearTimeout(F.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===$r&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=D;return W[Vr]&&G===Wr&&(Q=gr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:xr(v.current)}catch(e){return null}}),t),b=yr(y,4),x=b[0],E=b[1],w=b[2],C=b[3],S=e.useRef(C);C&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,Sr(r,e)}),[r]),I=gr(gr({},m),{},{visible:a});if(u)if(x===$r)N=C?u(gr({},I),T):!c&&S.current&&h?u(gr(gr({},I),{},{className:h}),T):d||!c&&!h?u(gr(gr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===Vr?O="prepare":Ci(E)?O="active":E===Wr&&(O="start");var k=di(p,"".concat(x,"-").concat(O));N=u(gr(gr({},I),{},{className:_e(di(p,x),(R={},mr(R,k,k&&O),mr(R,p,"string"==typeof p),R)),style:w}),T)}else N=null;e.isValidElement(N)&&Tr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(Mr,{ref:v},N)}));return r.displayName="CSSMotion",r}(oi);function Ti(){return Ti=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ti.apply(this,arguments)}var Ii="add",Ri="keep",Oi="remove",ki="removed";function Li(e){var t;return gr(gr({},t=e&&"object"===pr(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Ai(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(Li)}var Pi=["component","children","onVisibleChanged","onAllRemoved"],_i=["status"],Di=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];!function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ni,r=function(t){Pr(i,e.Component);var r=Hr(i);function i(){var e;Or(this,i);for(var t=arguments.length,n=new Array(t),l=0;l<t;l++)n[l]=arguments[l];return mr(Dr(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),mr(Dr(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:gr(gr({},e),{},{status:ki})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==ki})).length})),e}return Lr(i,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,i=this.props,l=i.component,a=i.children,o=i.onVisibleChanged,s=i.onAllRemoved,c=Ir(i,Pi),d=l||e.Fragment,u={};return Di.forEach((function(e){u[e]=c[e],delete c[e]})),delete c.keys,e.createElement(d,c,r.map((function(r){var i=r.status,l=Ir(r,_i),c=i===Ii||i===Ri;return e.createElement(n,Ti({},u,{key:l.key,visible:c,eventProps:l,onVisibleChanged:function(e){(null==o||o(e,{key:l.key}),e)||0===t.removeKey(l.key)&&s&&s()}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,i=Ai(n),l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,i=t.length,l=Ai(e),a=Ai(t);l.forEach((function(e){for(var t=!1,l=r;l<i;l+=1){var o=a[l];if(o.key===e.key){r<l&&(n=n.concat(a.slice(r,l).map((function(e){return gr(gr({},e),{},{status:Ii})}))),r=l),n.push(gr(gr({},o),{},{status:Ri})),r+=1,t=!0;break}}t||n.push(gr(gr({},e),{},{status:Oi}))})),r<i&&(n=n.concat(a.slice(r).map((function(e){return gr(gr({},e),{},{status:Ii})}))));var o={};return n.forEach((function(e){var t=e.key;o[t]=(o[t]||0)+1})),Object.keys(o).filter((function(e){return o[e]>1})).forEach((function(e){(n=n.filter((function(t){var n=t.key,r=t.status;return n!==e||r!==Oi}))).forEach((function(t){t.key===e&&(t.status=Ri)}))})),n}(r,i);return{keyEntities:l.filter((function(e){var t=r.find((function(t){var n=t.key;return e.key===n}));return!t||t.status!==ki||e.status!==Oi}))}}}]),i}();mr(r,"defaultProps",{component:"div"})}(oi);const Hi=t.forwardRef(((e,n)=>{const{forceRender:r,className:i,style:l,boxStyle:a,isActive:o}=e,[s,c]=t.useState(o||r);if(t.useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=ar("collapse");return t.createElement("div",{ref:n,className:_e(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},i),style:l},t.createElement("div",{className:`${d}-content-box`,style:a},e.children))}));Hi.displayName="PanelContent";const Mi=e=>{const{defaultActive:n,label:r,extra:i,className:l,style:a,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=t.useState(!!n),f=ar("collapse"),g=_e({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},l);return t.createElement("div",{className:g,style:a},t.createElement(or,{label:r,extra:i,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),null==p||p(e)}}),t.createElement(Ni,On({visible:h},((e=ar("motion-collapse"))=>({motionName:e,onAppearStart:sr,onEnterStart:sr,onAppearActive:cr,onEnterActive:cr,onLeaveStart:dr,onLeaveActive:sr,onAppearEnd:ur,onEnterEnd:ur,onLeaveEnd:ur,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:n,style:r},i)=>t.createElement(Hi,{ref:i,prefixCls:f,className:n,style:r,boxStyle:o,isActive:h,forceRender:d},e.children))))};Mi.displayName="QmCollapse";const Fi=t.createContext(void 0);function $i(t,n){((t,n)=>{const r=e.useRef(!0);e.useEffect((()=>t(r.current)),n),e.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})((e=>{if(!e)return t()}),n)}const qi=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},ji=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Ki=e=>e.preventDefault(),zi=(e,t)=>{if(jn||!e||!t)return null;"float"===(t=Gn(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]}},Vi=(e,t,n)=>{!jn&&e&&t&&(ae(t)?Object.keys(t).forEach((n=>{Vi(e,n,t[n])})):(t=Gn(t),e.style[t]=n))},Wi=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Bi=(e,t)=>Math.abs(Wi(e)-Wi(t)),Ui=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}},Gi=(e,t)=>{var n;let r=e;for(;r;){if(null===(n=r.classList)||void 0===n?void 0:n.contains(t))return r;r=r.parentNode}return null},Yi=(e,t)=>{if(jn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Xi=e=>Math.pow(e,3),Qi=e=>e<.5?Xi(2*e)/2:1-Xi(2*(1-e))/2,Zi=e=>{const{minValues:n,onDragChange:r,onDragging:i}=e,{splitRef:l,direction:a}=t.useContext(Fi),{t:o}=Fn(),s=t.useRef(jn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===a),[a]),d=t.useMemo((()=>c?"X":"Y"),[c]),u=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),p=e=>{u.current=Object.assign({},u.current,e)},h=e=>{if(1!==e.buttons)return m();const t=e[`page${d}`]-u.current[`start${d}`],r=[n[0],u.current[`containerSize${d}`]-n[1]];let l=u.current[`firstElementSize${d}`]+t;l=Math.max(r[0],l),l=Math.min(r[1],l),i(l)},m=()=>{p({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),ji(document,"mousemove",h),ji(document,"mouseup",m),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${ar("split")}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return t.createElement("div",{className:_e(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=l.current,n=t.children[0];p({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),qi(document,"mousemove",h),qi(document,"mouseup",m),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Zi.displayName="ResizeBar";const Ji=t.forwardRef(((e,n)=>{const{offset:r,className:i,style:l}=e,{direction:a,dragging:o}=t.useContext(Fi),s="vertical"===a?"height":"width",c={[ar("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[i]:!!i},d=void 0!==r?{[s]:Jn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:_e(c),style:Object.assign(Object.assign({},d),l)},e.children)}));Ji.displayName="SplitPane";const el=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:l,style:a,onDragStart:o,onDrag:s=Vn,onDragEnd:c}=e,{global:d}=t.useContext(sn),u=t.useRef(null),p=t.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`,m=e=>Number.parseInt(e,10),f=e=>{var t;const n=Number.parseInt((null===(t=e.props)||void 0===t?void 0:t.min)||0);return n>=0?n:0},g=t.useMemo((()=>i?`split_${i}`:""),[i]),[v,y]=t.useState(!1),[b,x]=t.useState(h(r));$i((()=>{v?null==o||o(m(b)):(null==c||c(m(b)),localStorage.setItem(g,b),C(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(h(e)):w(g).then((e=>{localStorage.setItem(g,h(e||r)),E()})).catch((()=>{}))},w=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),C=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),S=t.useMemo((()=>({splitRef:u,direction:n,dragging:v})),[n,v]),N=[];t.Children.map(e.children,(e=>{var t;Kn(e)&&!zn(e)&&"SplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const[T,I]=N,R=t.useMemo((()=>[f(T),f(I)]),[T,I]),O={[ar("split")]:!0,vertical:"vertical"===n};return t.createElement(Fi.Provider,{value:S},t.createElement("div",{ref:u,className:_e(O,l),style:a},t.createElement(Ji,On({},T.props,{ref:p,offset:b})),t.createElement(Zi,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Ji,I.props)))};el.displayName="QmSplit",el.Pane=Ji;const tl=e=>{const{className:n,style:r}=e,{$size:i}=qn(e),l=ar("countup"),a={[l]:!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i};return t.createElement(Ft,On({},e,{className:_e(a,n),style:r}),e.children)};tl.displayName="QmCountup";const nl=e=>{const{className:n}=e,{$size:r}=qn(e),i=ar("empty"),l=Object.assign(Object.assign({},e),{image:N.PRESENTED_IMAGE_SIMPLE}),a={[i]:!0,[`${i}--lg`]:"large"===r,[`${i}--sm`]:"small"===r};return t.createElement(N,On({},l,{className:_e(a,n)}))};nl.displayName="QmEmpty";const rl=e=>{const n=hn({tip:"Loading..."},e),{fullHeight:r,className:i,style:l}=n,a=ar("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:_e(o,i)},Qn(n,["fullHeight"])),{style:Object.assign(Object.assign({},l),{maxHeight:"none"})});return t.createElement(T,s,n.children)};rl.displayName="QmSpin";const il=t.createContext(void 0),ll=new Map;const al=new $t((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=ll.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function ol(e,t){ll.has(e)||(ll.set(e,new Set),al.observe(e)),ll.get(e).add(t)}function sl(e,t){ll.has(e)&&(ll.get(e).delete(t),ll.get(e).size||(al.unobserve(e),ll.delete(e)))}function cl(t){const[n,r]=e.useState({width:0,height:0});return e.useLayoutEffect((()=>{const e=t.current,n=e=>{r({width:e.offsetWidth,height:e.offsetHeight})};return e&&ol(e,n),()=>{e&&sl(e,n)}}),[t]),n}function dl(t,n){const r=e.useRef(null);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{r.current&&clearTimeout(r.current),r.current=setTimeout((()=>t.apply(this,e)),n)}),[t,n])}const ul=6,pl={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"}},hl=e=>{const{thumb:n,always:r,className:i,barSize:l=ul,direction:a="vertical",onDrag:o=Vn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(il),u=pl[a],p=t.useRef(n),h=t.useRef(null),m=t.useRef(null),f=t.useRef({}),g=t.useRef(!1),v=t.useRef(!1),y=t.useRef(jn?null:document.onselectstart),[b,x]=t.useState(!1);t.useLayoutEffect((()=>{p.current=n}),[n]),t.useEffect((()=>{const e=c.current;return qi(e,"mousemove",S),qi(e,"mouseleave",N),()=>{C(),ji(document,"mouseup",w),ji(e,"mousemove",S),ji(e,"mouseleave",N)}}),[]);const E=e=>{if(!h.current||!m.current)return;if(!g.current)return;const t=f.current[u.axis];if(!t)return;const n=100*(-1*(h.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/h.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},w=()=>{g.current=!1,f.current={[u.axis]:0},ji(document,"mousemove",E),ji(document,"mouseup",w),C(),v.current&&x(!1),o(!1)},C=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},S=()=>{v.current=!1,x(!!p.current.size)},N=()=>{v.current=!0,x(g.current)},T=ar("scrollbar"),I={[`${T}__bar`]:!0,"is-vertical":"vertical"===a,"is-horizontal":"horizontal"===a},R={[u.reverse]:l},O={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(wh,{name:"fade",in:r||s||b,timeout:300},t.createElement("div",{ref:h,className:_e(I,i),style:R},t.createElement("div",{ref:m,className:`${T}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),qi(document,"mousemove",E),qi(document,"mouseup",w),g.current=!0,y.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(f.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},ml=20,fl=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,innerStyle:l,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=ml,onScroll:u}=e,p=t.useRef(null),h=t.useRef(null),m=t.useRef(null),[f,g]=t.useState({size:0,offset:0,ratio:1}),[v,y]=t.useState({size:0,offset:0,ratio:1}),[b,x]=t.useState(!1),E=cl(p),w=cl(m);fn((()=>{!s&&C()}),[w.width,w.height,E.width,E.height]);const C=dl((()=>{if(!h.current)return;const e=h.current.offsetHeight-4,t=h.current.offsetWidth-4,n=Math.pow(e,2)/h.current.scrollHeight,r=Math.pow(t,2)/h.current.scrollWidth,i=Math.max(n,d),l=Math.max(r,d),a=n/(e-n)/(i/(e-i)),o=r/(t-r)/(l/(t-l)),s=i+4<e?i:0,c=l+4<t?l:0,u=100*h.current.scrollTop/e*a,p=100*h.current.scrollLeft/t*o;g(Object.assign({},f,{size:c,ratio:o,offset:p})),y(Object.assign({},v,{size:s,ratio:a,offset:u}))}),5),S=e=>{x(e)},N=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,i=window.requestAnimationFrame,l=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollTop=r+(t-r)*Qi(a),i(l)):e.scrollTop=t};i(l)})(h.current,e):h.current.scrollTop=e:nr("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,i=window.requestAnimationFrame,l=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollLeft=r+(t-r)*Qi(a),i(l)):e.scrollLeft=t};i(l)})(h.current,e):h.current.scrollLeft=e:nr("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:p.current,scrollTop:(null===(e=h.current)||void 0===e?void 0:e.scrollTop)||0,scrollLeft:(null===(t=h.current)||void 0===t?void 0:t.scrollLeft)||0,SET_SCROLL_TOP:N,SET_SCROLL_LEFT:T}}));const I=t.useMemo((()=>({dragging:b,scrollbarElement:p,wrapElement:h})),[b]),R=ar("scrollbar"),O={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!s};return t.createElement("div",{ref:p,className:_e(R,e.className),style:e.style},t.createElement("div",{ref:h,className:_e(O,r),style:i,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(()=>{if(!h.current)return;const e=h.current.offsetHeight-4,t=h.current.offsetWidth-4,n=100*h.current.scrollTop/e*v.ratio,r=100*h.current.scrollLeft/t*f.ratio;g(Object.assign({},f,{offset:r})),y(Object.assign({},v,{offset:n}))})(),null==u||u({scrollTop:t,scrollLeft:n})}},t.createElement("div",{ref:m,className:`${R}__view`,style:l},e.children)),!s&&t.createElement(il.Provider,{value:I},c&&t.createElement(hl,{className:"top",direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(hl,{direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(hl,{direction:"vertical",thumb:v,barSize:a,always:o,onDrag:S})))}));fl.displayName="QmScrollbar";const gl=(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}},vl=(e,{fileName:t,headers:n,params:r})=>Mn(void 0,void 0,void 0,(function*(){const i=r?new URLSearchParams(r).toString():"",l=i?e.includes("?")?"&":"?":"",a=yield fetch(e+`${l+i}`,{method:"GET",headers:n});if(!a.ok)throw new Error(pn("qm.download.error"));const o=yield a.blob(),s=a.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));gl(o,c)})),yl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},bl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},xl=e=>{var n,r;const i=hn({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:l=[],fileDirection:a="vertical",batchDownload:o,draggable:s,editable:c,disabled:d,readOnly:u,button:p={},className:h,onPreview:m,onSortChange:f,onEditChange:g,onDownload:v,onChange:y}=i,{t:b}=Fn(),{$size:x}=qn(i),w=t.useRef(null),C=t.useRef(null),[S,N]=t.useState({}),T=t.useMemo((()=>d||u),[d,u]);t.useEffect((()=>(A(),()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.destroy()})),[]);const k=(e,t)=>{N((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},L=$n((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...l],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:l[t],fileList:e})}})),A=()=>{s&&(C.current=qt.create(Gi(w.current,ar("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:L}))},P=e=>Mn(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=i;try{e.url&&(yield vl(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){R.error(b("qm.download.error"))}})),_=ar("upload-file"),D={[_]:!0,[`${_}--lg`]:"large"===x,[`${_}--sm`]:"small"===x,[`${_}--horizontal`]:"horizontal"===a};return t.createElement(I,On({className:_e(D,h)},Qn(i,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>Mn(void 0,void 0,void 0,(function*(){const{fileTypes:l=[],fileSize:a,maxCount:o,fileList:s=[],beforeUpload:c}=i,d=!l.length||l.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!a||e.size/1024/1024<a,p=!(o>1)||s.length<o,h=d&&u&&p;if(d||R.warning(b("qm.upload.tooltip",{type:l.join(",")})),u||R.warning(b("qm.upload.sizeLimit",{size:a})),p||R.warning(b("qm.upload.countLimit",{count:o})),!h)return I.LIST_IGNORE;if(c){const i=c(e,t);if(!0===i)return n(e);if(!1===i)return r("not upload");if(i&&"function"==typeof i.then)try{const e=yield i;n(e)}catch(e){r(e)}}else n(e)})))),disabled:T,onChange:y,onPreview:e=>Mn(void 0,void 0,void 0,(function*(){if("function"==typeof m)return m(e,(t=>P(t||e)));d||(yield P(e))})),onDownload:e=>Mn(void 0,void 0,void 0,(function*(){yield P(e)})),itemRender:(e,n,r,a)=>((e,n)=>{const{iconRender:r}=i,{uid:a,name:o,url:u,status:p="done"}=e,h="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return t.createElement("div",{className:_e("ant-upload-list-item",`ant-upload-list-item-${p}`,"ant-upload-list-item-list-type-text",{handle:s})},t.createElement("div",{className:"ant-upload-list-item-info"},t.createElement("span",{className:"ant-upload-span"},t.createElement("div",{className:"ant-upload-text-icon"},r?r(e):t.createElement(Fe,null)),t.createElement("div",{className:"ant-upload-list-item-name"},S[a]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:yl(o),onBlur:t=>{const{value:n}=t.target;if(n!==yl(o)){const t=Object.assign({},e,{name:`${n}.${bl(o)}`}),r=l.map((e=>e.uid!==a?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}k(a,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?T||k(a,!0):n.preview()}},o)),t.createElement("span",{className:"ant-upload-list-item-card-actions"},c&&!T&&t.createElement("button",{type:"button",className:h,onClick:()=>k(a)},S[a]?t.createElement(qe,null):t.createElement($e,null)),c&&t.createElement("button",{type:"button",className:_e(h,"preview"),onClick:()=>n.preview()},t.createElement(je,null)),t.createElement("button",{type:"button",className:_e(h,"download"),disabled:d,onClick:()=>n.download()},t.createElement(Ke,null)),t.createElement("button",{type:"button",className:_e(h,"delete"),disabled:T,onClick:()=>n.remove()},t.createElement(ze,null))))))})(n,a)}),t.createElement("span",{className:"inner",ref:w},i.children||u&&l.length?i.children:t.createElement(E,{type:null!==(n=p.type)&&void 0!==n?n:"default",icon:null!==(r=p.icon)&&void 0!==r?r:t.createElement(Me,null),disabled:T},p.text||b("qm.upload.text")),o&&!!l.length&&t.createElement(E,{disabled:d,style:{marginLeft:8},onClick:e=>Mn(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),"function"==typeof o)yield o(l);else for(const e of l)yield P(e)}))},b("qm.upload.batchDownload"))))};xl.displayName="QmUploadFile";const El=e=>{const n=hn({icon:t.createElement(Ke,null),withCredentials:!1},e),{$size:r}=qn(n),{t:i}=Fn(),[l,a]=t.useState(!1),o=Qn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,On({},o,{size:r,loading:l,onClick:()=>Mn(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:l,beforeDownload:a=Wn,onSuccess:o}=n,s=ce(e)?e:yield Mn(void 0,void 0,void 0,(function*(){const e=n.action;if(e.api)try{const t=yield e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}));if(!s)return nr("Download","参数 `action` 有误!");if(!a(s))return;yield vl(s,{fileName:t,headers:r,params:l}),yield Bn(100),null==o||o(),R.success(i("qm.download.success"))}catch(t){null===(e=n.onError)||void 0===e||e.call(n,t),R.error(i("qm.download.error"))}a(!1)}))}),n.children||i("qm.download.text"))};function wl(t,n){const r=e.useRef(null),i=e.useRef(0);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{const r=Date.now();(!i.current||r-i.current>n)&&(t.apply(this,e),i.current=r)}),[t,n])}El.displayName="QmDownload";const Cl=e=>{const{activeKey:n,labels:r,onTabClick:i}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const l={item:!0,actived:r===n};return t.createElement("div",{key:r,className:_e(l),onClick:e=>i(r,e)},t.createElement("span",null,e))})))},Sl=e=>{const{label:n,showDivider:r,className:i,style:l}=e,a={[ar("anchor-item")]:!0};return t.createElement("div",{className:_e(a,i),style:l},r&&t.createElement(or,{label:n,style:{marginBottom:10}}),e.children)};Sl.displayName="AnchorItem";const Nl=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:i,labelWidth:l,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=qn(e),u=t.useRef(null),p=t.useRef(),h=t.useRef("ready"),m=t.useRef(0),[f,g]=t.useState(i||0),v=t.useMemo((()=>!!(null==r?void 0:r.length)),[r]);t.useEffect((()=>{y();const e=jt(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=Bi(x(f),u.current))},b=e=>{const t=Math.abs(e),n=(v?r.map((e=>document.getElementById(e.id))):Array.from((null===(i=u.current)||void 0===i?void 0:i.children)||[])).map((e=>Bi(e,u.current)));var i;let l=-1;for(let e=0;e<n.length;e++){const r=n[e],i=n[e+1]||1e4;t>=r-1&&t<i&&(l=e)}return l},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=wl((e=>{if("ready"!==h.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),w=e=>{const t=x(e);t&&(g(e),h.current="stop",p.current&&clearTimeout(p.current),Kt(t,{block:"start",behavior:"smooth",boundary:u.current}),p.current=setTimeout((()=>h.current="ready"),500))};t.useImperativeHandle(n,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>m.current?m.current:e,w(e)}})));const C=ar("anchor"),S={[C]:!0,[`${C}-left`]:"left"===a,[`${C}-top`]:"top"===a,[`${C}--lg`]:"large"===d,[`${C}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;Kn(e)&&!zn(e)&&"AnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const T=v?r.map((e=>e.label)):N.map((e=>e.props.label)),I=v?r.map((e=>e.id)):N.map(((e,t)=>e.props["data-id"]||t.toString()));return m.current=T.length,t.createElement("div",{className:_e(S,s),style:c},t.createElement("div",{className:_e("anchor-nav"),style:{width:l?Jn(l):""}},t.createElement(Cl,{activeKey:f,labels:T,onTabClick:(e,t)=>{w(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:_e("anchor-container")},v?e.children:N))}));Nl.displayName="QmAnchor",Nl.Item=Sl;const Tl=e=>t.createElement(k.TabPane,e,e.children);Tl.displayName="TabPane";const Il=e=>{const n=hn({tabPosition:"top"},e),{items:r,tabPosition:i,tabBarGutter:l,className:a,authConfig:o}=n,{$size:s}=qn(n),c=ar("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},Qn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=l?l:["top","bottom"].includes(i)?30:0}),p=[];t.Children.map(n.children,(e=>{var t;Kn(e)&&!zn(e)&&"TabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&p.push(e)}));const h=r?[...r]:p.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<h.length;t++){const n=h[t],r=e.find((e=>e.dataIndex===n.key)),{visible:i=1,disabled:l}=r||{};i?l&&(n.disabled=!0):(h.splice(t,1),t--)}}return t.createElement(k,On({},u,{items:h,className:_e(d,a)}))};Il.displayName="QmTabs",Il.TabPane=Tl;const Rl=t.forwardRef(((e,n)=>{var r;const i=hn({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:l,open:a,className:o,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:p,onClose:h,onClosed:m,onFullChange:f}=i,{global:g}=t.useContext(sn),{$size:v}=qn(i),y=t.useRef(null),b=t.useRef(null),x=t.useRef(!1),[E,w]=t.useState(!1),[C,S]=t.useState(!1),[N,T]=t.useState(!1);$i((()=>{(null!=a?a:l)&&(!p&&x.current||de(s)&&S(!0))}),[null!=a?a:l]),$i((()=>{b.current&&Vi(b.current,E?{width:"100%"}:{width:Jn(i.width||"72%")})}),[E]);const I=()=>{b.current=Gi(y.current,"ant-drawer-content-wrapper"),w(!E),null==f||f(!E)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=ar("drawer"),O={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===v,[`${R}--sm`]:"small"===v};return t.createElement(L,On({},Qn(i,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=a?a:l,maskClosable:null!==(r=null!=u?u:null==g?void 0:g.maskClosable)&&void 0!==r&&r,className:_e(O,o),title:t.createElement(t.Fragment,null,t.createElement("span",{ref:y,className:"text"},c&&i.title),d&&t.createElement("button",{type:"button",className:"full-screen",onClick:I},t.createElement(E?Ve:We))),footer:null,afterOpenChange:e=>{e?(x.current=!0,de(s)&&setTimeout((()=>S(!1)),100)):(w(!1),null==m||m())},onClose:h}),i.children,(s||N||C)&&t.createElement(rl,{spinning:!0,className:_e("spinning")}))}));Rl.displayName="QmDrawer";const Ol="10vh";var kl;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(kl||(kl={}));const Ll=t.forwardRef(((e,n)=>{var r;const i=hn({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Ol}},e),{visible:l,open:a,width:o,height:s,className:c,loading:d,draggable:u,showHeader:p,showFullScreen:h,maskClosable:m,destroyOnClose:f,bodyStyle:g,onFullChange:v,onClose:y,onClosed:b}=i,{global:x}=t.useContext(sn),{$size:E}=qn(i),w=t.createRef(),C=t.useRef(!1),S=t.useMemo((()=>`calc(100vh - ${Ol} - ${Ol} - ${kl[p?E:"none"]}px)`),[E,p]),[N,T]=t.useState(!1),[I,R]=t.useState(!1),[O,k]=t.useState(!1),[L,P]=t.useState(!0),[_,D]=t.useState({left:0,top:0,bottom:0,right:0}),[H,M]=t.useState();$i((()=>{if(null!=a?a:l){if(!f&&C.current||de(d)&&R(!0),!f&&C.current)return;setTimeout((()=>{C.current=!0,de(d)&&R(!1)}),400)}}),[null!=a?a:l]),$i((()=>{M(N?{x:0,y:0}:void 0)}),[N]);const F=e=>{const t=Gi(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");N?(Vi(t,{width:Jn(o||"60%"),height:"auto",top:Ol}),Vi(n,{height:s?Jn(s):S,maxHeight:"auto"===s?S:""})):(Vi(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Vi(n,{height:`calc(100vh - ${kl[p?E:"none"]}px)`,maxHeight:""})),T(!N),null==v||v(!N)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>k(!0),STOP_LOADING:()=>k(!1)})));const $=ar("modal"),q={height:s?Jn(s):S,maxHeight:"auto"===s?S:"",overflow:"auto"},j={[$]:!0,"no-header":!p,[`${$}--lg`]:"large"===E,[`${$}--sm`]:"small"===E};return t.createElement(A,On({},Qn(i,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:null!=a?a:l,maskClosable:null!==(r=null!=m?m:null==x?void 0:x.maskClosable)&&void 0!==r&&r,className:_e(j,c),title:t.createElement("div",{onMouseOver:()=>{L&&P(!1)},onMouseOut:()=>{P(!0)}},t.createElement("span",{className:"text"},p&&i.title),h&&t.createElement("button",{type:"button",className:"full-screen",onClick:F},t.createElement(N?Ve:We))),footer:null,bodyStyle:Object.assign({},q,g),onCancel:y,afterClose:()=>{null==b||b(),T(!1)},modalRender:e=>t.createElement(zt,{nodeRef:w,bounds:_,position:H,disabled:!u||L||N,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,i=w.current.getBoundingClientRect();i&&D({left:-i.left+t.x,right:n-(i.right-t.x)-1,top:-i.top+t.y,bottom:r-(i.bottom-t.y)-1})})(0,t)},t.createElement("div",{ref:w},e))}),i.children,(d||O||I)&&t.createElement(rl,{spinning:!0,className:_e("spinning")}))}));Ll.displayName="QmModal";const Al=n(void 0),Pl=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var _l={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)Pl.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 "),e=this.find_replace(e," NIN "," nin ")}};const Dl=["==","<",">","<=",">=","!=","like","likes","in","nin"];var Hl=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},Ml=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++)Dl.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),Dl.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const Fl=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,$l=["string","number","boolean","symbol"],ql=e=>$l.includes(typeof e),jl=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Kl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Fl,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Kl(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Kl(t))));break;case"in":ql(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":ql(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(jl(e)?e.slice(0,10):e)!=n;break;case"<":r=(jl(e)?e.slice(0,10):e)<n;break;case"<=":r=(jl(e)?e.slice(0,10):e)<=n;break;case">":r=(jl(e)?e.slice(0,10):e)>n;break;case">=":r=(jl(e)?e.slice(0,10):e)>=n;break;default:r=(jl(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const zl=_l.stringify,Vl=_l.array_format,Wl=Hl,Bl=(e,t,n)=>{let r=[];t=_l.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Ml(t,"record")};`);r=Ia(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Ml(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)n(e,t)&&r.push(e[t])}}catch(t){nr("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Ul=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Ul(e.children)):t.push(e)})),t},Gl=e=>e.filter((e=>(e.children&&(e.children=Gl(e.children)),!e.hidden&&!e.noAuth))),Yl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Yl(e.children))})),t},Xl=(e,t)=>e.map((e=>(e.children&&(e.children=Xl(e.children,t)),null==t||t(e),e))),Ql=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Ql(n.children,t);if(e)return e}}return null},Zl=e=>{const t=e.children;return t?t[0].children?Zl(t[0]):t[0]:e},Jl=e=>{const t=e.children;return t?t[t.length-1].children?Jl(t[t.length-1]):t[t.length-1]:e},ea=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),ta=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=ta(n.children,t);if(e)return e}}return null},na=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...na(e.children))})),t},ra=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ra(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},ia=e=>{let t=1;const n=(e,r)=>{var i;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=null!==(i=e.colSpan)&&void 0!==i?i:1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return Yl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},la=e=>Object.assign(e,{__prevent__:!0}),aa=e=>{delete e.__prevent__},oa=(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 oa(e.offsetParent,t,n)}return n},sa=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ca=(e,t)=>pe(e,((e,n,r)=>{he(n,t[r])||(e[r]=ae(n)&&ae(t[r])?ca(n,t[r]):n)})),da=(e,t)=>{var n;return null!==(n=ue(e,t))&&void 0!==n?n:""},ua=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),me(e,t,null!=n?n:"")},pa=(e,t)=>{if(!t.includes("|"))return da(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(da(e,t))})),n.every((e=>!e))?"":n.join(" | ")},ha=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),ma=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],i="";for(;r.length>3;)i=`,${r.slice(-3)}${i}`,r=r.slice(0,r.length-3);return r&&(i=r+i),`${n}${i}${t[1]?`.${t[1]}`:""}`},fa=(e,t)=>{const n=e.toString();if(!ha(n)||0===t)return e;const r=Number.parseFloat(n).toString(),i=r.indexOf(".");if(-1===i)return r+"."+"0".repeat(t);const l=Math.max(0,t-(r.length-i-1));return r+"0".repeat(l)},ga=(e,t)=>e?h(e,t):null,va=(e,t)=>e?h(e).format(t):"",ya=(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)}))},ba=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...ba(e))}))}else n.push(e);return n},xa=e=>ba(e).join(""),Ea=e=>e.filter((e=>!e._group)),wa=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let i=0,l=e.length;i<l;i++){const l=e[i];if(!l.fieldName)continue;const a=Array.isArray(l.condition)?Vl(l.condition):zl(l.condition,"^");n+=`${l.bracketLeft} ${t?`${l.fieldName}|${l.fieldType}`:l.fieldName} ${l.expression} ${a} ${l.bracketRight} ${l.logic} `,r=l.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[i,l]=r.includes("|")?r.split("|"):[r,""],a=e[r];for(const e in a){n+=`${t?`${i}|${l}`:i} ${e} ${Array.isArray(a[e])?Vl(a[e]):zl(a[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},Ca=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(da(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},Sa=(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=Sa(e[n].children,t);if(r)return[e[n],r].flat()}}},Na=(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=Na(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},Ta=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=Ta(n.children,t);if(e)return e}if(t(n))return n}return null},Ia=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Ia(e.children,t),t(e)||e.children&&e.children.length))),Ra=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Oa=(e,t,n=!1)=>{const r=new Set;return function e(t,i,l=1){if(r.has(t))return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);const a=l+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],i[n],a))return!1;return!0}if(t&&i&&"object"==typeof t&&"object"==typeof i){const n=Object.keys(t);return n.length===Object.keys(i).length&&n.every((n=>e(t[n],i[n],a)))}return!1}(e,t)},ka=e=>["","small","middle","large"].includes(e),La=80,Aa="1",Pa="0",_a=400,Da=["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"],Ha={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Ma,Fa,$a;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Ma||(Ma={})),function(e){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"}(Fa||(Fa={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}($a||($a={}));const qa={items:Bt.arrayOf(Bt.shape({type:Bt.string.isRequired,fieldName:Bt.string.isRequired})),initialValues:Bt.object,initialExtras:Bt.object,layout:Bt.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!ka(e[t]||""))return tr("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Bt.number,className:Bt.string,style:Bt.object,compactMode:Bt.bool,labelWidth:Bt.oneOfType([Bt.number,Bt.string]),labelAlign:Bt.oneOf(["left","right"]),labelWrap:Bt.bool,formType:Bt.oneOf(["default","search","onlyShow"]),disabled:Bt.bool,uniqueKey:Bt.string,defaultRows:Bt.number,defaultExpand:Bt.bool,searchButtonCols:Bt.number,scrollToFirstError:Bt.bool,authConfig:Bt.object,isAutoFocus:Bt.bool,isCollapse:Bt.bool,isFieldsDefine:Bt.bool,isSearchBtn:Bt.bool,isSubmitBtn:Bt.bool,fieldsChange:Bt.func,onValuesChange:Bt.func,onFieldsChange:Bt.func,onFinish:Bt.func,onFinishFailed:Bt.func,onReset:Bt.func,onCollapse:Bt.func},ja={layout:"horizontal",labelWidth:La,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:Vn,onFieldsChange:Vn,onFinish:Vn,onFinishFailed:Vn,onReset:Vn,onCollapse:Vn},Ka=(e,t)=>{if(!e)return null;if(t===Fa.week){const t=e.match(/^(\d{4})-(\d+)/);return t?h().year(Number(t[1])).week(Number(t[2])):null}if(t===Fa.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?h().year(Number(t[1])).quarter(Number(t[2])):null}return h(e,t)},za=(e,t)=>e?h(e).format(t):"",Va=e=>""===e||null==e,Wa=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let i="";for(let t=0,l=r.length;t<l;t++){i+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===l-1?"":" | ")}return i},Ba=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const i=t[r].split("|"),l=n[r].split("|");i.forEach(((t,n)=>e[t]=e[l[n]]))}else e[t[r]]=e[n[r]]},Ua=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const i=t[r].split("|"),l=n[r].split("|");i.forEach(((t,n)=>e[t]=e[l[n]]))}else e[t[r]]=e[n[r]]},Ga=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),de(e.isLeaf)||(r.isLeaf=!!e.isLeaf),de(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=Ga(e.children,t,n)),r})),Ya=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=Ya(n.children,t);if(e)return e}}return null},Xa=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...Xa(e.children,t,n+1))})),r},Qa=e=>Kn(e)||"string"==typeof e,Za=e=>Kn(e)?ba(e).join(""):null!=e?e:"",Ja=(e,t,n,r)=>{var i;const l={};return l.filters=(null===(i=e.filters)||void 0===i?void 0:i.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})))||[],l.table={columns:e.columns||[],rowKey:e.valueName},l.fieldsDefine={valueKey:e.valueKey||e.valueName},l.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(l.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(l.echoRequest={fetchApi:n(e.echoSetting.api),formatter:t=>{var n;return Object.assign({},t,{[e.echoSetting.paramKey]:null!==(n=t.key)&&void 0!==n?n:t.keys})},dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(l.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(l.tree={fetch:{api:n(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const n={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>n[e.tableField]=e.treeField)),n}}),e.emmediateSetting&&(l.columns=e.emmediateSetting.columns,l.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),l};var eo={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"}};const to="阿",no="鿿",ro=1,io=2,lo=3;let ao,oo=null;function so(e){return e||null===oo?("object"==typeof Intl&&Intl.Collator?(ao=new Intl.Collator(["zh-Hans-CN","zh-CN"]),oo=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):oo=!1,oo):oo}function co(e){const t=eo.UNIHANS,n=eo.PINYINS,r=eo.EXCEPTIONS,i={source:e};if(e in r)return i.type=io,i.target=r[e],i;let l,a=-1;if(e.charCodeAt(0)<256)return i.type=ro,i.target=e,i;if(l=ao.compare(e,to),l<0)return i.type=lo,i.target=e,i;if(0===l)i.type=io,a=0;else{if(l=ao.compare(e,no),l>0)return i.type=lo,i.target=e,i;0===l&&(i.type=io,a=t.length-1)}if(i.type=io,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const i=t[a];if(l=ao.compare(e,i),0===l)break;l>0?n=a+1:r=a-1}}return l<0&&a--,i.target=n[a],i.target||(i.type=lo,i.target=i.source),i}function uo(e){return"string"==typeof e&&so()?e.split("").map((e=>co(e))):e}var po={isSupported:so,parse:uo,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(eo)})))},genToken:co,convertToPinyin:(e,t,n)=>uo(e).map((e=>t&&e.type===io?e.target.toLowerCase():e.target)).join(n||"")};var ho={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)}};po.isSupported()&&ho.shouldPatch(po.genToken)&&po.patchDict(ho);const mo=e=>{const{value:n,bordered:r}=e;return t.createElement(O,{value:n,title:n,bordered:r,readOnly:!0})};mo.displayName="FormItemView";const{Option:fo}=H,go=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Fn(),{fieldName:d,options:u={},style:p={},placeholder:h=c("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:f=!0,readOnly:g,disabled:v,onClear:y}=e.option,{itemList:b=[],filterable:x=!0,listHeight:E=_a,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,T=Yn(b)?i:b,I=e=>{var t;return(null===(t=T.find((t=>t.value===e)))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},R=e=>l?(null==e?void 0:e.map((e=>I(e))).join(","))||"":I(e);return n.isOnlyShow?t.createElement(mo,{value:R(r),bordered:m}):t.createElement(H,On({value:r,mode:l?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:h,style:p,loading:a,bordered:m,allowClear:f,disabled:v,showSearch:x,listHeight:E,maxTagCount:w?"responsive":void 0,maxTagTextLength:C},l?{title:R(r)}:null,{filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"",i=po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,R(e),T)})(e)},onClear:y}),T.map((e=>t.createElement(fo,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class vo extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Jn(d)},required:e.getFormItemRequired(f)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(go,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),h&&t.createElement(D,null,e.renderFormItemButton(o,h)),p&&t.createElement(D,{flex:Jn(p.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}vo.contextType=Al;const yo=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=Pa,trueValue:h=Aa}=o,{t:m}=Fn(),f=e=>m(e===h?"am.form.trueText":"am.form.falseText");return t.createElement(M,{checked:r===h,style:s,disabled:d||n.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==i||i(e),l(e,f(e))})(t?h:p)}},u?a:null)};class bo extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option,{labelToCheckbox:m}=o;return t.createElement(P.Item,{label:m?" ":e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(yo,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}bo.contextType=Al;const xo=e=>{const{uniqueKey:n,items:r,fieldsChange:i}=e,{global:l}=t.useContext(sn),{$$form:a}=t.useContext(Al),{$size:o}=qn(e),{t:s}=Fn(),c=t.useRef(null),[d,u]=t.useState(!1),p=t.useMemo((()=>n?`form_${n}`:""),[n]);t.useLayoutEffect((()=>{f()}),[]);const h=()=>{if(!p)return;const e=JSON.parse(localStorage.getItem(p));var t;if(e||(t=p,Mn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(p,JSON.stringify(e)),f()):(null==l?void 0:l.getComponentConfigApi)&&m(r)})).catch((()=>{})),!e)return;return fe(e.map((e=>e.fieldName)),r.map((e=>e.fieldName))).length>0?r.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?(de(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName));return Object.assign(Object.assign({},t),e)}))},m=e=>{if(!p)return;const t=e.map((e=>{const t={};return de(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(p));var r,i;he(t,n)||(localStorage.setItem(p,JSON.stringify(t)),r=p,i=t,Mn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.saveComponentConfigApi;if(e)try{yield e({[r]:i})}catch(e){}})))},f=()=>{const e=h();e&&g(e)},g=e=>{null==i||i([...e])},v=()=>t.createElement("div",{className:_e("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(rr,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||Zn(e);return Object.assign(t,{hidden:e.hidden})}));g(t),m(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));if(he(t,n))return;a.setExpandHandle(!0);const i=Ra(e);g(i),m(i)}},r.map((e=>{var n;return t.createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},t.createElement(M,{disabled:(null===(n=e.rules)||void 0===n?void 0:n.findIndex((e=>e.required)))>-1,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,g(r),m(r)}}),t.createElement(Ue,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=ar("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(F,{open:d,trigger:["click"],dropdownRender:()=>v(),overlayClassName:_e(b),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>c.current,onOpenChange:e=>{u(e)}},t.createElement("a",{ref:c,style:{padding:"5px 0"}},t.createElement(Be,null)))};xo.displayName="FieldsFilter";const Eo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Al),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Fn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m,onFocus:f,onBlur:g,onEnter:v,onClear:y}=e.option,{prefix:b,suffix:x,password:E,maxLength:w,pattern:C,toUpper:S,toTrim:N,autoFocus:T,autoComplete:I,secretType:R}=s,k=R&&(h||m),L=t.useRef();t.useEffect((()=>{var e;const t=()=>null==y?void 0:y(),n=null===(e=L.current)||void 0===e?void 0:e.input.parentNode.querySelector("span[class*='clear-icon']");return p&&n&&n.addEventListener("click",t),()=>{null==n||n.removeEventListener("click",t)}}),[]);const A=e=>{null==l||l(e),a(e)},P=E?O.Password:O,_=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))(i,R):i;return r.isOnlyShow?t.createElement(mo,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(_),bordered:u}):t.createElement(P,{ref:e=>{L.current=e,"function"==typeof n&&n(e)},value:_,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":_,prefix:b,suffix:x,maxLength:w,bordered:u,allowClear:p,readOnly:h,disabled:m,onFocus:e=>{null==f||f(e.target.value,e)},onBlur:t=>{var n;let r=null!==(n=t.target.value)&&void 0!==n?n:"";if(N){const e=r.trim();r!==e&&(r=e,A(r))}(t=>{const{onBlur:n}=e;null==n||n(t)})(r),null==g||g(r,t)},onKeyUp:e=>{var t;if(13===e.keyCode){const{value:n}=e.target;null==v||v(n,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=L.current)||void 0===t||t.blur())}},onChange:e=>{let t=e.target.value;ge(C)&&(t=C.test(t)?t:null!=i?i:""),S&&(t=t.toUpperCase()),A(t)}})}));Eo.displayName="VInput";class wo extends s{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Eo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(l,t)}}))),u&&t.createElement(D,null,e.renderFormItemButton(l,u)),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}wo.contextType=Al;const Co=e=>{const{$$form:n}=t.useContext(Al),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p}=e.option,{prefix:h,suffix:m,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;null==i||i(t),l(t,v(t))},v=e=>e.join(" - ");return n.isOnlyShow?t.createElement(mo,{value:v(r),bordered:c}):t.createElement(O.Group,null,t.createElement(O,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:h,suffix:m,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:p,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:p,readOnly:!0}),t.createElement(O,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:h,suffix:m,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:p,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class So extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(o)},required:e.getFormItemRequired(u)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Co,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(D,{flex:Jn(c.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}So.contextType=Al;const No=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Al),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Fn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:p,disabled:h,onFocus:m,onBlur:f,onEnter:g}=e.option,{step:v=1,min:y,max:b,precision:x,autoFocus:E,stringMode:w,textAlign:C="left",controls:S=!0,formatter:N,parser:T}=s,I=t.useRef(),R=t.useRef(i),O=e=>{const t=Va(e)?"":oe(e)?e.toFixed(x):new Gt(e).toFixed(x);return"function"==typeof N?N(t):t},k={[C]:!0,controls:S};return r.isOnlyShow?t.createElement(mo,{value:O(i),bordered:u}):t.createElement($,{ref:e=>{I.current=e,"function"==typeof n&&n(e)},value:i,className:_e(k),placeholder:d,style:Object.assign({width:"100%"},c),step:v,min:y,max:b,controls:S,precision:x,autoFocus:E,stringMode:w,formatter:N,parser:T,bordered:u,readOnly:p,disabled:h,onFocus:e=>{null==m||m(e.target.value,e)},onBlur:t=>{Un((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(R.current),null==f||f(R.current,t)}))},onKeyUp:e=>{var t;13===e.keyCode&&(null==g||g(i,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=I.current)||void 0===t||t.blur()))},onChange:e=>{const t=null!=e?e:"";!w&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,null==l||l(e),a(e,O(e))})(t)}})}));No.displayName="VInputNumber";class To extends s{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(No,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(l,n)}}))),u&&t.createElement(D,null,e.renderFormItemButton(l,u)),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}To.contextType=Al;const Io=e=>{const{$$form:n}=t.useContext(Al),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p}=e.option,{step:h=1,min:m=0,max:f,textAlign:g="left",controls:v=!0,precision:y,formatter:b,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];null==i||i(t),l(t,C(t))},C=e=>Va(e)?"":e.map((e=>Va(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(mo,{value:C(r),bordered:c}):t.createElement(O.Group,null,t.createElement($,{value:r[0],className:_e("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:h,min:m,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:p,onChange:e=>{w([e,r[1]])},onBlur:()=>{E(r)}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:p,readOnly:!0}),t.createElement($,{value:r[1],className:_e("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:h,min:m,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:p,onChange:e=>{w([r[0],e])},onBlur:()=>{E(r)}}))};class Ro extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(o)},required:e.getFormItemRequired(u)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Io,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(D,{flex:Jn(c.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}var Oo;Ro.contextType=Al,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Oo||(Oo={}));const{Search:ko}=O;class Lo extends s{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||nr("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)||nr("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&nr("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Mn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Yn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Ba(e,this.alias,c),d&&Ua(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Wa(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==l||l([e])}}}catch(e){}this.setState({loading:!1})}})),this.todoOpen=e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)},this.createFilters=e=>{const{fieldName:t}=this.props.option,{filterAliasMap:n}=this.searchHelper,r=""!==e?e:void 0,i=("function"==typeof n?n():n)||[],l={[t]:r};return(Array.isArray(i)?i:[i]).forEach((e=>{if(ae(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](r):r;else l[e]=r})),l},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Wn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>Mn(this,void 0,void 0,(function*(){var o;const s=ve({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return a();this.setState({loading:!0});try{const e=yield t.fetch.api(s);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];l(n)}else a()}catch(e){a(e)}finally{Un((()=>this.setState({loading:!1})))}}))))},this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const i=Wa(e,this.alias[r]);void 0!==i&&(t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i))}for(const n in this.extras){const r=Wa(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>Mn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=Wa(e,this.alias[n]))||void 0===r?void 0:r.toString().toLowerCase().includes(t.toLowerCase())}));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),this.openSearchHelper=(e,t)=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,i=(null!=r?r:Wn)(n.state.formData);(null==i?void 0:i.then)?i.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==i&&(this.todoOpen(e),null==t||t())})),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]:Wa(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])});const r=Wa(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(e)),200)}))},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)},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("")}},this.searchHelperChangeHandle=e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,null==t||t(e,this._record)},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},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(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=pn("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:pn("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:Object.assign({},this.deriveParams,c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(mo,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(ko,{ref:e=>this[`${a}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,disabled:f,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:i=!0,table:l}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?i?(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.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:t}=e.target;!r&&this.openSearchHelper(t)}},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"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):Un((()=>this.clearSearchHelperValue())))}}),t.createElement(Ll,b,t.createElement(Gp,x)))}}Lo.contextType=Al;class Ao extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Lo,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Ao.contextType=Al;const Po=e=>{class n extends s{constructor(){super(...arguments),this.event1=null,this.event2=null,this.$el=null,this.omitClassNames=[],this.state={clickOutside:!1},this.mousedownHandler=e=>{this.startClick=e},this.mouseupHandler=e=>{this.documentHandler(e,this.startClick)},this.documentHandler=(e,t)=>{var n,r;const i=e.target,l=null==t?void 0:t.target,a=!i||!l,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(i))||(null===(r=this.$el)||void 0===r?void 0:r.contains(l)),s=this.$el===i,c=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),d=c.some((e=>null==e?void 0:e.contains(i)))||c.includes(l);let u;u=!(a||o||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=(e=[])=>{this.omitClassNames=e}}componentDidMount(){this.event1=jt(document,"mousedown",this.mousedownHandler),this.event2=jt(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){var e,t;null===(e=this.event1)||void 0===e||e.remove(),null===(t=this.event2)||void 0===t||t.remove()}render(){const{forwardedRef:n}=this.props,{clickOutside:r}=this.state;return t.createElement(e,On({ref:n},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return n.displayName=`OutsideClick(${e.displayName||e.name})`,t.forwardRef(((e,r)=>t.createElement(n,On({},e,{forwardedRef:r}))))};function _o(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}function Do(e,t,n,r){var i=Jt.unstable_batchedUpdates?function(e){Jt.unstable_batchedUpdates(n,e)}:n;return null!=e&&e.addEventListener&&e.addEventListener(t,i,r),{remove:function(){null!=e&&e.removeEventListener&&e.removeEventListener(t,i,r)}}}var Ho=c((function(e,t){var n=e.didUpdate,r=e.getContainer,i=e.children,a=l(),s=l();d(t,(function(){return{}}));var c=l(!1);return!c.current&&Yr()&&(s.current=r(),a.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==a.current&&a.current.appendChild(s.current),function(){var e;null===(e=s.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(s.current)}}),[]),s.current?Jt.createPortal(i,s.current):null}));function Mo(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var Fo;function $o(e){var t=e.prefixCls,n=e.motion,r=e.animation,i=e.transitionName;return n||(r?{motionName:"".concat(t,"-").concat(r)}:i?{motionName:i}:null)}function qo(t){var n=t.prefixCls,r=t.visible,i=t.zIndex,l=t.mask,a=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!l)return null;var c={};return(a||s||o)&&(c=gr({motionAppear:!0},$o({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(Ni,Ti({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:i},className:_e("".concat(n,"-mask"),r)})}))}function jo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ko(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jo(Object(n),!0).forEach((function(t){Vo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zo(e){return zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zo(e)}function Vo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wo={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function Bo(){if(void 0!==Fo)return Fo;Fo="";var e=document.createElement("p").style;for(var t in Wo)t+"Transform"in e&&(Fo=t);return Fo}function Uo(){return Bo()?"".concat(Bo(),"TransitionProperty"):"transitionProperty"}function Go(){return Bo()?"".concat(Bo(),"Transform"):"transform"}function Yo(e,t){var n=Uo();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function Xo(e,t){var n=Go();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var Qo,Zo=/matrix\((.*)\)/,Jo=/matrix3d\((.*)\)/;function es(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function ts(e,t,n){var r=n;if("object"!==zo(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):Qo(e,t);for(var i in t)t.hasOwnProperty(i)&&ts(e,i,t[i])}function ns(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var i=e.document;"number"!=typeof(n=i.documentElement[r])&&(n=i.body[r])}return n}function rs(e){return ns(e)}function is(e){return ns(e,!0)}function ls(e){var t=function(e){var t,n,r,i=e.ownerDocument,l=i.body,a=i&&i.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=a.clientLeft||l.clientLeft||0,top:r-=a.clientTop||l.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=rs(r),t.top+=is(r),t}function as(e){return null!=e&&e==e.window}function os(e){return as(e)?e.document:9===e.nodeType?e:e.ownerDocument}var ss=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),cs=/^(top|right|bottom|left)$/,ds="currentStyle",us="runtimeStyle",ps="left";function hs(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function ms(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function fs(e,t,n){"static"===ts(e,"position")&&(e.style.position="relative");var r=-999,i=-999,l=hs("left",n),a=hs("top",n),o=ms(l),s=ms(a);"left"!==l&&(r=999),"top"!==a&&(i=999);var c,d="",u=ls(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[Uo()]||"",Yo(e,"none")),"left"in t&&(e.style[o]="",e.style[l]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[a]="".concat(i,"px")),es(e);var p=ls(e),h={};for(var m in t)if(t.hasOwnProperty(m)){var f=hs(m,n),g="left"===m?r:i,v=u[m]-p[m];h[f]=f===m?g+v:g-v}ts(e,h),es(e),("left"in t||"top"in t)&&Yo(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=hs(b,n),E=t[b]-u[b];y[x]=b===x?h[x]+E:h[x]-E}ts(e,y)}function gs(e,t){var n=ls(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(Go());if(n&&"none"!==n){var r=n.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(r[12]||r[4],0),y:parseFloat(r[13]||r[5],0)}}return{x:0,y:0}}(e),i={x:r.x,y:r.y};"left"in t&&(i.x=r.x+t.left-n.left),"top"in t&&(i.y=r.y+t.top-n.top),function(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(Go());if(r&&"none"!==r){var i,l=r.match(Zo);l?((i=(l=l[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,i[5]=t.y,Xo(e,"matrix(".concat(i.join(","),")"))):((i=r.match(Jo)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,i[13]=t.y,Xo(e,"matrix3d(".concat(i.join(","),")")))}else Xo(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,i)}function vs(e,t){for(var n=0;n<e.length;n++)t(e[n])}function ys(e){return"border-box"===Qo(e,"boxSizing")}"undefined"!=typeof window&&(Qo=window.getComputedStyle?function(e,t,n){var r=n,i="",l=os(e);return(r=r||l.defaultView.getComputedStyle(e,null))&&(i=r.getPropertyValue(t)||r[t]),i}:function(e,t){var n=e[ds]&&e[ds][t];if(ss.test(n)&&!cs.test(t)){var r=e.style,i=r[ps],l=e[us][ps];e[us][ps]=e[ds][ps],r[ps]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[ps]=i,e[us][ps]=l}return""===n?"auto":n});var bs=["margin","border","padding"],xs=-1,Es=2,ws=1;function Cs(e,t,n){var r,i,l,a=0;for(i=0;i<t.length;i++)if(r=t[i])for(l=0;l<n.length;l++){var o=void 0;o="border"===r?"".concat(r).concat(n[l],"Width"):r+n[l],a+=parseFloat(Qo(e,o))||0}return a}var Ss={getParent:function(e){var t=e;do{t=11===t.nodeType&&t.host?t.host:t.parentNode}while(t&&1!==t.nodeType&&9!==t.nodeType);return t}};function Ns(e,t,n){var r=n;if(as(e))return"width"===t?Ss.viewportWidth(e):Ss.viewportHeight(e);if(9===e.nodeType)return"width"===t?Ss.docWidth(e):Ss.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],l="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=ys(e),o=0;(null==l||l<=0)&&(l=void 0,(null==(o=Qo(e,t))||Number(o)<0)&&(o=e.style[t]||0),o=Math.floor(parseFloat(o))||0),void 0===r&&(r=a?ws:xs);var s=void 0!==l||a,c=l||o;return r===xs?s?c-Cs(e,["border","padding"],i):o:s?r===ws?c:c+(r===Es?-Cs(e,["border"],i):Cs(e,["margin"],i)):o+Cs(e,bs.slice(r),i)}vs(["Width","Height"],(function(e){Ss["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],Ss["viewport".concat(e)](n))},Ss["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,i=r.body,l=r.documentElement[n];return"CSS1Compat"===r.compatMode&&l||i&&i[n]||l}}));var Ts={position:"absolute",visibility:"hidden",display:"block"};function Is(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=t[0];return 0!==i.offsetWidth?r=Ns.apply(void 0,t):function(e,t,n){var r,i={},l=e.style;for(r in t)t.hasOwnProperty(r)&&(i[r]=l[r],l[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(l[r]=i[r])}(i,Ts,(function(){r=Ns.apply(void 0,t)})),r}function Rs(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}vs(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);Ss["outer".concat(t)]=function(t,n){return t&&Is(t,e,n?0:ws)};var n="width"===e?["Left","Right"]:["Top","Bottom"];Ss[e]=function(t,r){var i=r;return void 0!==i?t?(ys(t)&&(i+=Cs(t,["padding","border"],n)),ts(t,e,i)):void 0:t&&Is(t,e,xs)}}));var Os={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:os,offset:function(e,t,n){if(void 0===t)return ls(e);!function(e,t,n){if(n.ignoreShake){var r=ls(e),i=r.left.toFixed(0),l=r.top.toFixed(0),a=t.left.toFixed(0),o=t.top.toFixed(0);if(i===a&&l===o)return}n.useCssRight||n.useCssBottom?fs(e,t,n):n.useCssTransform&&Go()in document.body.style?gs(e,t):fs(e,t,n)}(e,t,n||{})},isWindow:as,each:vs,css:ts,clone:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);if(e.overflow)for(t in e)e.hasOwnProperty(t)&&(n.overflow[t]=e.overflow[t]);return n},mix:Rs,getWindowScrollLeft:function(e){return rs(e)},getWindowScrollTop:function(e){return is(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Os.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Rs(Os,Ss);var ks=Os.getParent;function Ls(e){if(Os.isWindow(e)||9===e.nodeType)return null;var t,n=Os.getDocument(e).body,r=Os.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:ks(e);for(t=ks(e);t&&t!==n&&9!==t.nodeType;t=ks(t))if("static"!==(r=Os.css(t,"position")))return t;return null}var As=Os.getParent;function Ps(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Ls(e),i=Os.getDocument(e),l=i.defaultView||i.parentWindow,a=i.body,o=i.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===a||r===o||"visible"===Os.css(r,"overflow")){if(r===a||r===o)break}else{var s=Os.offset(r);s.left+=r.clientLeft,s.top+=r.clientTop,n.top=Math.max(n.top,s.top),n.right=Math.min(n.right,s.left+r.clientWidth),n.bottom=Math.min(n.bottom,s.top+r.clientHeight),n.left=Math.max(n.left,s.left)}r=Ls(r)}var c=null;Os.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Os.css(e,"position")&&(e.style.position="fixed"));var d=Os.getWindowScrollLeft(l),u=Os.getWindowScrollTop(l),p=Os.viewportWidth(l),h=Os.viewportHeight(l),m=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(a);if("hidden"===g.overflowX&&(m=l.innerWidth),"hidden"===g.overflowY&&(f=l.innerHeight),e.style&&(e.style.position=c),t||function(e){if(Os.isWindow(e)||9===e.nodeType)return!1;var t=Os.getDocument(e),n=t.body,r=null;for(r=As(e);r&&r!==n&&r!==t;r=As(r))if("fixed"===Os.css(r,"position"))return!0;return!1}(e))n.left=Math.max(n.left,d),n.top=Math.max(n.top,u),n.right=Math.min(n.right,d+p),n.bottom=Math.min(n.bottom,u+h);else{var v=Math.max(m,d+p);n.right=Math.min(n.right,v);var y=Math.max(f,u+h);n.bottom=Math.min(n.bottom,y)}return n.top>=0&&n.left>=0&&n.bottom>n.top&&n.right>n.left?n:null}function _s(e){var t,n,r;if(Os.isWindow(e)||9===e.nodeType){var i=Os.getWindow(e);t={left:Os.getWindowScrollLeft(i),top:Os.getWindowScrollTop(i)},n=Os.viewportWidth(i),r=Os.viewportHeight(i)}else t=Os.offset(e),n=Os.outerWidth(e),r=Os.outerHeight(e);return t.width=n,t.height=r,t}function Ds(e,t){var n=t.charAt(0),r=t.charAt(1),i=e.width,l=e.height,a=e.left,o=e.top;return"c"===n?o+=l/2:"b"===n&&(o+=l),"c"===r?a+=i/2:"r"===r&&(a+=i),{left:a,top:o}}function Hs(e,t,n,r,i){var l=Ds(t,n[1]),a=Ds(e,n[0]),o=[a.left-l.left,a.top-l.top];return{left:Math.round(e.left-o[0]+r[0]-i[0]),top:Math.round(e.top-o[1]+r[1]-i[1])}}function Ms(e,t,n){return e.left<n.left||e.left+t.width>n.right}function Fs(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function $s(e,t,n){var r=[];return Os.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function qs(e,t){return e[t]=-e[t],e}function js(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function Ks(e,t){e[0]=js(e[0],t.width),e[1]=js(e[1],t.height)}function zs(e,t,n,r){var i=n.points,l=n.offset||[0,0],a=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;l=[].concat(l),a=[].concat(a);var c={},d=0,u=Ps(s,!(!(o=o||{})||!o.alwaysByViewport)),p=_s(s);Ks(l,p),Ks(a,t);var h=Hs(p,t,i,l,a),m=Os.merge(p,h);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&Ms(h,p,u)){var f=$s(i,/[lr]/gi,{l:"r",r:"l"}),g=qs(l,0),v=qs(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Hs(p,t,f,g,v),p,u)||(d=1,i=f,l=g,a=v)}if(o.adjustY&&Fs(h,p,u)){var y=$s(i,/[tb]/gi,{t:"b",b:"t"}),b=qs(l,1),x=qs(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Hs(p,t,y,b,x),p,u)||(d=1,i=y,l=b,a=x)}d&&(h=Hs(p,t,i,l,a),Os.mix(m,h));var E=Ms(h,p,u),w=Fs(h,p,u);if(E||w){var C=i;E&&(C=$s(i,/[lr]/gi,{l:"r",r:"l"})),w&&(C=$s(i,/[tb]/gi,{t:"b",b:"t"})),i=C,l=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&w,(c.adjustX||c.adjustY)&&(m=function(e,t,n,r){var i=Os.clone(e),l={width:t.width,height:t.height};return r.adjustX&&i.left<n.left&&(i.left=n.left),r.resizeWidth&&i.left>=n.left&&i.left+l.width>n.right&&(l.width-=i.left+l.width-n.right),r.adjustX&&i.left+l.width>n.right&&(i.left=Math.max(n.right-l.width,n.left)),r.adjustY&&i.top<n.top&&(i.top=n.top),r.resizeHeight&&i.top>=n.top&&i.top+l.height>n.bottom&&(l.height-=i.top+l.height-n.bottom),r.adjustY&&i.top+l.height>n.bottom&&(i.top=Math.max(n.bottom-l.height,n.top)),Os.mix(i,l)}(h,p,u,c))}return m.width!==p.width&&Os.css(s,"width",Os.width(s)+m.width-p.width),m.height!==p.height&&Os.css(s,"height",Os.height(s)+m.height-p.height),Os.offset(s,{left:m.left,top:m.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:i,offset:l,targetOffset:a,overflow:c}}function Vs(e,t,n){var r=n.target||t,i=_s(r),l=!function(e,t){var n=Ps(e,t),r=_s(e);return!n||r.left+r.width<=n.left||r.top+r.height<=n.top||r.left>=n.right||r.top>=n.bottom}(r,n.overflow&&n.overflow.alwaysByViewport);return zs(e,i,n,l)}Vs.__getOffsetParent=Ls,Vs.__getVisibleRectForElement=Ps;var Ws=Yr()?e.useLayoutEffect:e.useEffect,Bs=function(t,n){var r=e.useRef(!0);Ws((function(){return t(r.current)}),n),Ws((function(){return r.current=!1,function(){r.current=!0}}),[])};function Us(e,t){var n=null,r=null;var i=new $t((function(e){var i=yr(e,1)[0].target;if(document.documentElement.contains(i)){var l=i.getBoundingClientRect(),a=l.width,o=l.height,s=Math.floor(a),c=Math.floor(o);n===s&&r===c||Promise.resolve().then((function(){t({width:s,height:c})})),n=s,r=c}}));return e&&i.observe(e),function(){i.disconnect()}}function Gs(e){return"function"!=typeof e?null:e()}function Ys(e){return"object"===pr(e)&&e?e:null}var Xs=function(e,n){var r=e.children,i=e.disabled,l=e.target,a=e.align,o=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),p=t.useRef(),h=t.Children.only(r),m=t.useRef({});m.current.disabled=i,m.current.target=l,m.current.align=a,m.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),i=t.useRef(null);function l(){window.clearTimeout(i.current)}return[function t(a){if(l(),r.current&&!0!==a)i.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(a))return;r.current=!0,i.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,l()}]}((function(){var e=m.current,t=e.disabled,n=e.target,r=e.align,i=e.onAlign,l=p.current;if(!t&&n&&l){var a,o=Gs(n),s=Ys(n);u.current.element=o,u.current.point=s,u.current.align=r;var c=document.activeElement;return o&&function(e){if(!e)return!1;if(e instanceof Element){if(e.offsetParent)return!0;if(e.getBBox){var t=e.getBBox(),n=t.width,r=t.height;if(n||r)return!0}if(e.getBoundingClientRect){var i=e.getBoundingClientRect(),l=i.width,a=i.height;if(l||a)return!0}}return!1}(o)?a=Vs(l,o,r):s&&(a=function(e,t,n){var r,i,l=Os.getDocument(e),a=l.defaultView||l.parentWindow,o=Os.getWindowScrollLeft(a),s=Os.getWindowScrollTop(a),c=Os.viewportWidth(a),d=Os.viewportHeight(a),u={left:r="pageX"in t?t.pageX:o+t.clientX,top:i="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},p=r>=0&&r<=o+c&&i>=0&&i<=s+d,h=[n.points[0],"cc"];return zs(e,u,Ko(Ko({},n),{},{points:h}),p)}(l,s,r)),function(e,t){e!==document.activeElement&&_o(t,e)&&"function"==typeof e.focus&&e.focus()}(c,l),i&&a&&i(l,a),!0}return!1}),d),g=yr(f,2),v=g[0],y=g[1],b=yr(t.useState(),2),x=b[0],E=b[1],w=yr(t.useState(),2),C=w[0],S=w[1];return Bs((function(){E(Gs(l)),S(Ys(l))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=C)||e&&t&&("pageX"in t&&"pageY"in t?e.pageX===t.pageX&&e.pageY===t.pageY:"clientX"in t&&"clientY"in t&&e.clientX===t.clientX&&e.clientY===t.clientY))&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new Set;return function e(t,i){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=r.has(t);if(En(!a,"Warning: There may be circular references"),a)return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);var o=l+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(var s=0;s<t.length;s++)if(!e(t[s],i[s],o))return!1;return!0}if(t&&i&&"object"===pr(t)&&"object"===pr(i)){var c=Object.keys(t);return c.length===Object.keys(i).length&&c.every((function(n){return e(t[n],i[n],o)}))}return!1}(e,t)}(u.current.align,a)||v()})),t.useEffect((function(){return Us(p.current,v)}),[p.current]),t.useEffect((function(){return Us(x,v)}),[x]),t.useEffect((function(){i?y():v()}),[i]),t.useEffect((function(){if(s)return Do(window,"resize",v).remove}),[s]),t.useEffect((function(){return function(){y()}}),[]),t.useImperativeHandle(n,(function(){return{forceAlign:function(){return v(!0)}}})),t.isValidElement(h)&&(h=t.cloneElement(h,{ref:Nr(h.ref,p)})),h},Qs=t.forwardRef(Xs);function Zs(){Zs=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},l=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var l=t&&t.prototype instanceof p?t:p,a=Object.create(l.prototype),o=new N(i||[]);return r(a,"_invoke",{value:E(e,n,o)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function p(){}function h(){}function m(){}var f={};s(f,l,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,l)&&(f=v);var y=m.prototype=p.prototype=Object.create(f);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function i(r,l,a,o){var s=d(e[r],e,l);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==pr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,a,o)}),(function(e){i("throw",e,a,o)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,o)}))}o(s.arg)}var l;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return l=l?l.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,l){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw l;return I()}for(n.method=i,n.arg=l;;){var a=n.delegate;if(a){var o=w(a,n);if(o){if(o===u)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,u;var l=i.arg;return l?l.done?(t[e.resultName]=l.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):l:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function T(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return h.prototype=m,r(y,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:h,configurable:!0}),h.displayName=s(m,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,l){void 0===l&&(l=Promise);var a=new x(c(t,n,r,i),l);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),s(y,o,"Generator"),s(y,l,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var l=this.tryEntries[i],a=l.completion;if("root"===l.tryLoc)return r("end");if(l.tryLoc<=this.prev){var o=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(o&&s){if(this.prev<l.catchLoc)return r(l.catchLoc,!0);if(this.prev<l.finallyLoc)return r(l.finallyLoc)}else if(o){if(this.prev<l.catchLoc)return r(l.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return r(l.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var l=i;break}}l&&("break"===e||"continue"===e)&&l.tryLoc<=t&&t<=l.finallyLoc&&(l=null);var a=l?l.completion:{};return a.type=e,a.arg=t,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function Js(e,t,n,r,i,l,a){try{var o=e[l](a),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,i)}function ec(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var l=e.apply(t,n);function a(e){Js(l,r,i,a,o,"next",e)}function o(e){Js(l,r,i,a,o,"throw",e)}a(void 0)}))}}Qs.displayName="Align";var tc=["measure","alignPre","align",null,"motion"],nc=e.forwardRef((function(t,n){var r=t.visible,i=t.prefixCls,a=t.className,s=t.style,c=t.children,d=t.zIndex,p=t.stretch,h=t.destroyPopupOnHide,m=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,w=t.onMouseDown,C=t.onTouchStart,S=t.onClick,N=l(),T=l(),I=yr(u(),2),R=I[0],O=I[1],k=function(t){var n=yr(e.useState({width:0,height:0}),2),r=n[0],i=n[1];return[e.useMemo((function(){var e={};if(t){var n=r.width,i=r.height;-1!==t.indexOf("height")&&i?e.height=i:-1!==t.indexOf("minHeight")&&i&&(e.minHeight=i),-1!==t.indexOf("width")&&n?e.width=n:-1!==t.indexOf("minWidth")&&n&&(e.minWidth=n)}return e}),[t,r]),function(e){var t=e.offsetWidth,n=e.offsetHeight,r=e.getBoundingClientRect(),l=r.width,a=r.height;Math.abs(t-l)<1&&Math.abs(n-a)<1&&(t=l,n=a),i({width:t,height:n})}]}(p),L=yr(k,2),A=L[0],P=L[1];var _=function(e,t){var n=yr(Fr(null),2),r=n[0],i=n[1],a=l();function s(e){i(e,!0)}function c(){yi.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=yi(ec(Zs().mark((function e(){var t,n;return Zs().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=tc.indexOf(r),(n=tc[t+1])&&-1!==t&&s(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),o((function(){return function(){c()}}),[]),[r,function(e){c(),a.current=yi((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){p&&P(v())})),D=yr(_,2),H=D[0],M=D[1],F=yr(u(0),2),$=F[0],q=F[1],j=l();function K(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function z(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===H&&(null==b||b(e,t))}Bs((function(){"alignPre"===H&&q(0)}),[H]),Bs((function(){"align"===H&&($<3?K():M((function(){var e;null===(e=j.current)||void 0===e||e.call(j)})))}),[$]);var V=gr({},$o(t));function W(){return new Promise((function(e){j.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=V[e];V[e]=function(e,n){return M(),null==t?void 0:t(e,n)}})),e.useEffect((function(){V.motionName||"motion"!==H||M()}),[V.motionName,H]),e.useImperativeHandle(n,(function(){return{forceAlign:K,getElement:function(){return T.current}}}));var B=gr(gr({},A),{},{zIndex:d,opacity:"motion"!==H&&"stable"!==H&&r?0:void 0,pointerEvents:r||"stable"===H?void 0:"none"},s),U=!0;null==f||!f.points||"align"!==H&&"stable"!==H||(U=!1);var G=c;return e.Children.count(c)>1&&(G=e.createElement("div",{className:"".concat(i,"-content")},c)),e.createElement(Ni,Ti({visible:r,ref:T,leavedClassName:"".concat(i,"-hidden")},V,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:h,forceRender:m}),(function(t,n){var r=t.className,l=t.style,o=_e(i,a,R,r);return e.createElement(Qs,{target:g||v,key:"popup",ref:N,monitorWindowResize:!0,disabled:U,align:f,onAlign:z},e.createElement("div",{ref:n,className:o,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:w,onTouchStartCapture:C,onClick:S,style:gr(gr({},l),B)},G))}))}));nc.displayName="PopupInner";var rc=e.forwardRef((function(t,n){var r=t.prefixCls,i=t.visible,l=t.zIndex,a=t.children,o=t.mobile,s=(o=void 0===o?{}:o).popupClassName,c=o.popupStyle,d=o.popupMotion,u=void 0===d?{}:d,p=o.popupRender,h=t.onClick,m=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return m.current}}}));var f=gr({zIndex:l},c),g=a;return e.Children.count(a)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},a)),p&&(g=p(g)),e.createElement(Ni,Ti({visible:i,ref:m,removeOnLeave:!0},u),(function(t,n){var i=t.className,l=t.style,a=_e(r,s,i);return e.createElement("div",{ref:n,className:a,onClick:h,style:gr(gr({},l),f)},g)}))}));rc.displayName="MobilePopupInner";var ic=["visible","mobile"],lc=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,l=Ir(t,ic),a=yr(u(r),2),s=a[0],c=a[1],d=yr(u(!1),2),p=d[0],h=d[1],m=gr(gr({},l),{},{visible:s});o((function(){c(r),r&&i&&h(function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(null==e?void 0:e.substr(0,4))}())}),[r,i]);var f=p?e.createElement(rc,Ti({},m,{mobile:i,ref:n})):e.createElement(nc,Ti({},m,{ref:n}));return e.createElement("div",null,e.createElement(qo,m),f)}));lc.displayName="Popup";var ac=e.createContext(null);function oc(){}function sc(){return""}function cc(e){return e?e.ownerDocument:window.document}var dc=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var uc=function(t){var n=function(n){Pr(i,e.Component);var r=Hr(i);function i(t){var n,l;return Or(this,i),mr(Dr(n=r.call(this,t)),"popupRef",e.createRef()),mr(Dr(n),"triggerRef",e.createRef()),mr(Dr(n),"portalContainer",void 0),mr(Dr(n),"attachId",void 0),mr(Dr(n),"clickOutsideHandler",void 0),mr(Dr(n),"touchOutsideHandler",void 0),mr(Dr(n),"contextMenuOutsideHandler1",void 0),mr(Dr(n),"contextMenuOutsideHandler2",void 0),mr(Dr(n),"mouseDownTimeout",void 0),mr(Dr(n),"focusTime",void 0),mr(Dr(n),"preClickTime",void 0),mr(Dr(n),"preTouchTime",void 0),mr(Dr(n),"delayTimer",void 0),mr(Dr(n),"hasPopupMouseDown",void 0),mr(Dr(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),mr(Dr(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),mr(Dr(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),mr(Dr(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),mr(Dr(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&_o(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),mr(Dr(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),mr(Dr(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),mr(Dr(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),mr(Dr(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),mr(Dr(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),mr(Dr(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),mr(Dr(n),"onClick",(function(e){if(n.fireEvents("onClick",e),n.focusTime){var t;if(n.preClickTime&&n.preTouchTime?t=Math.min(n.preClickTime,n.preTouchTime):n.preClickTime?t=n.preClickTime:n.preTouchTime&&(t=n.preTouchTime),Math.abs(t-n.focusTime)<20)return;n.focusTime=0}n.preClickTime=0,n.preTouchTime=0,n.isClickToShow()&&(n.isClickToHide()||n.isBlurToHide())&&e&&e.preventDefault&&e.preventDefault();var r=!n.state.popupVisible;(n.isClickToHide()&&!r||r&&n.isClickToShow())&&n.setPopupVisible(!n.state.popupVisible,e)})),mr(Dr(n),"onPopupMouseDown",(function(){var e;(n.hasPopupMouseDown=!0,clearTimeout(n.mouseDownTimeout),n.mouseDownTimeout=window.setTimeout((function(){n.hasPopupMouseDown=!1}),0),n.context)&&(e=n.context).onPopupMouseDown.apply(e,arguments)})),mr(Dr(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),i=n.getPopupDomNode();_o(r,t)&&!n.isContextMenuOnly()||_o(i,t)||n.hasPopupMouseDown||n.close()}})),mr(Dr(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=xr(n.triggerRef.current);if(t)return t}catch(e){}return Jt.findDOMNode(Dr(n))})),mr(Dr(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,i=r.popupPlacement,l=r.builtinPlacements,a=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return i&&l&&t.push(function(e,t,n,r){for(var i=n.points,l=Object.keys(e),a=0;a<l.length;a+=1){var o=l[a];if(Mo(e[o].points,i,r))return"".concat(t,"-placement-").concat(o)}return""}(l,a,e,o)),s&&t.push(s(e)),t.join(" ")})),mr(Dr(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,i=t.destroyPopupOnHide,l=t.popupClassName,a=t.onPopupAlign,o=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,p=t.maskAnimation,h=t.maskTransitionName,m=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,w=n.state,C=w.popupVisible,S=w.point,N=n.getPopupAlign(),T={};return n.isMouseEnterToShow()&&(T.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(T.onMouseLeave=n.onPopupMouseLeave),T.onMouseDown=n.onPopupMouseDown,T.onTouchStart=n.onPopupMouseDown,e.createElement(lc,Ti({prefixCls:r,destroyPopupOnHide:i,visible:C,point:y&&S,className:l,align:N,onAlign:a,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},T,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:p,maskTransitionName:h,maskMotion:m,ref:n.popupRef,motion:o,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),mr(Dr(n),"attachParent",(function(e){yi.cancel(n.attachId);var t,r=n.props,i=r.getPopupContainer,l=r.getDocument,a=n.getRootDomNode();i?(a||0===i.length)&&(t=i(a)):t=l(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=yi((function(){n.attachParent(e)}))})),mr(Dr(n),"getContainer",(function(){if(!n.portalContainer){var e=(0,n.props.getDocument)(n.getRootDomNode()).createElement("div");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",n.portalContainer=e}return n.attachParent(n.portalContainer),n.portalContainer})),mr(Dr(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),mr(Dr(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),mr(Dr(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),l="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:l,popupVisible:l},dc.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return Lr(i,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var e,t=this.props;if(this.state.popupVisible)return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(e=t.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Do(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Do(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Do(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Do(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),yi.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var e;return(null===(e=this.popupRef.current)||void 0===e?void 0:e.getElement())||null}},{key:"getPopupAlign",value:function(){var e=this.props,t=e.popupPlacement,n=e.popupAlign,r=e.builtinPlacements;return t&&r?function(e,t,n){return gr(gr({},e[t]||{}),n)}(r,t,n):n}},{key:"setPopupVisible",value:function(e,t){var n=this.props.alignPoint,r=this.state.popupVisible;this.clearDelayTimer(),r!==e&&("popupVisible"in this.props||this.setState({popupVisible:e,prevPopupVisible:r}),this.props.onPopupVisibleChange(e)),n&&t&&e&&this.setPoint(t)}},{key:"delaySetPopupVisible",value:function(e,t,n){var r=this,i=1e3*t;if(this.clearDelayTimer(),i){var l=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,l),r.clearDelayTimer()}),i)}else this.setPopupVisible(e,n)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(e){var t=this.props.children.props,n=this.props;return t[e]&&n[e]?this["fire".concat(e)]:t[e]||n[e]}},{key:"isClickToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isContextMenuOnly",value:function(){var e=this.props.action;return"contextMenu"===e||1===e.length&&"contextMenu"===e[0]}},{key:"isContextMenuToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("contextMenu")||-1!==n.indexOf("contextMenu")}},{key:"isClickToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isMouseEnterToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseEnter")}},{key:"isMouseLeaveToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseLeave")}},{key:"isFocusToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("focus")}},{key:"isBlurToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("blur")}},{key:"forcePopupAlign",value:function(){var e;this.state.popupVisible&&(null===(e=this.popupRef.current)||void 0===e||e.forceAlign())}},{key:"fireEvents",value:function(e,t){var n=this.props.children.props[e];n&&n(t);var r=this.props[e];r&&r(t)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var n=this.state.popupVisible,r=this.props,i=r.children,l=r.forceRender,a=r.alignPoint,o=r.className,s=r.autoDestroy,c=e.Children.only(i),d={key:"trigger"};this.isContextMenuToShow()?d.onContextMenu=this.onContextMenu:d.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(d.onClick=this.onClick,d.onMouseDown=this.onMouseDown,d.onTouchStart=this.onTouchStart):(d.onClick=this.createTwoChains("onClick"),d.onMouseDown=this.createTwoChains("onMouseDown"),d.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(d.onMouseEnter=this.onMouseEnter,a&&(d.onMouseMove=this.onMouseMove)):d.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?d.onMouseLeave=this.onMouseLeave:d.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(d.onFocus=this.onFocus,d.onBlur=this.onBlur):(d.onFocus=this.createTwoChains("onFocus"),d.onBlur=this.createTwoChains("onBlur"));var u=_e(c&&c.props&&c.props.className,o);u&&(d.className=u);var p=gr({},d);Tr(c)&&(p.ref=Nr(this.triggerRef,c.ref));var h,m=e.cloneElement(c,p);return(n||this.popupRef.current||l)&&(h=e.createElement(t,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!n&&s&&(h=null),e.createElement(ac.Provider,{value:this.triggerContextValue},m,h)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.popupVisible,r={};return void 0!==n&&t.popupVisible!==n&&(r.popupVisible=n,r.prevPopupVisible=t.popupVisible),r}}]),i}();return mr(n,"contextType",ac),mr(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:sc,getDocument:cc,onPopupVisibleChange:oc,afterPopupVisibleChange:oc,onPopupAlign:oc,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1}),n}(Ho);let pc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||nr("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||nr("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ye([...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:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||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:i}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:a=(e=>e),dataKey:o,callback:s,fieldAliasMap:c}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},d="function"==typeof c?c():c||{},{value:u}=this.props;if(i){if(Yn(u))return this.setRecords([]);this.setState({loading:!0});try{const e=yield i(a(Object.assign(Object.assign({},l),{keys:u})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];i.forEach((e=>{(null==d?void 0:d.valueKey)&&d.valueKey!==r&&(e[r]=e[d.valueKey]),(null==d?void 0:d.textKey)&&d.textKey!==n&&(e[n]=e[d.textKey])})),i=i.filter((e=>u.includes(e[r])));const l=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(l),this.setViewValue(u),null==s||s(i)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:i}=this.context,{visible:l,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=pn("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:l,title:pn("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ve({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},pn("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=ar("form-multiple-search-helper"),{size:R}=i.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return i.isOnlyShow?t.createElement(mo,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(uc,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ha,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(H,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},h),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Ge,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Ll,w,t.createElement(Gp,C)))}};pc.contextType=Al,pc=Hn([Po],pc);class hc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(pc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}hc.contextType=Al;const{Search:mc}=O;class fc extends s{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||nr("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)||nr("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&nr("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Mn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Yn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Ba(e,this.alias,c),d&&Ua(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Wa(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==l||l([e])}}}catch(e){}this.setState({loading:!1})}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const i=Wa(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])})},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),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]:Wa(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])});const r=Wa(e,this.alias[n]);this.triggerChange(r);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(e)),200)}))},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("")},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||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(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l=""}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=pn("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:pn("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:ve({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(mo,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(mc,{ref:e=>this[`${a}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,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"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t.createElement(Ll,b,t.createElement(Zp,x)))}}fc.contextType=Al;class gc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(fc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}gc.contextType=Al;let vc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||nr("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||nr("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ye([...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:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||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:i}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:a=(e=>e),dataKey:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(i){if(Yn(d))return this.setRecords([]);this.setState({loading:!0});try{const e=yield i(a(Object.assign(Object.assign({},l),{keys:d})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];i.forEach((e=>{(null==c?void 0:c.valueKey)&&c.valueKey!==r&&(e[r]=e[c.valueKey]),(null==c?void 0:c.textKey)&&c.textKey!==n&&(e[n]=e[c.textKey])})),i=i.filter((e=>d.includes(e[r])));const l=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(l),this.setViewValue(d)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:i}=this.context,{visible:l,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=pn("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:l,title:pn("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ve({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},pn("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=ar("form-multiple-tree-table-helper"),{size:R}=i.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return i.isOnlyShow?t.createElement(mo,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(uc,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ha,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(H,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},h),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Ge,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Ll,w,t.createElement(Zp,C)))}};vc.contextType=Al,vc=Hn([Po],vc);class yc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(vc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}yc.contextType=Al;const bc=new Array(2).fill("");class xc extends s{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:bc},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||nr("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||nr("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setItemList=e=>{this.setState({itemList:e})},this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setTextValue=e=>{this.setState({textValue:e})},this.setRecords=e=>{this._records=e},this.setViewValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,null==t||t(e),n(e,this.createViewText(),this._records)},this.clearSearchHelperValue=()=>{this.setRecords([]),this.setTextValue(bc),this.triggerChange([])},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=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.triggerChange(e.map((e=>e[t])));const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.createFilters=e=>{const{fieldName:t}=this.props.option;return{[t]:Yn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Wn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>Mn(this,void 0,void 0,(function*(){var o;const s=ve({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return a();this.setState({loading:!0});const e=yield t.fetch.api(s);if(Un((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return l(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>Mn(this,void 0,void 0,(function*(){const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{var r;const i=null===(r=e[n])||void 0===r?void 0:r.toString().toLowerCase();return t.some((e=>null==i?void 0:i.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),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;he(t,n)||he(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:i}=this.props.option;if(!he(r[i],this._ceho_data)&&(this._ceho_data=r[i],this.setItemList(r[i]),n.length)){const e=bc.map(((e,t)=>{var l,a;return null!==(a=null===(l=r[i].find((e=>e.value===n[t])))||void 0===l?void 0:l.text)&&void 0!==a?a:""}));this.setTextValue(e)}}getItemList(){var e;return Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:t,valueKey:n}=this.alias,{fetchApi:r,params:i={},formatter:l=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(Yn(c))return this.setRecords([]);this.setState({loading:!0});try{const o=yield r(l(Object.assign(Object.assign({},i),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,a))&&void 0!==e?e:[];r.forEach((e=>{(null==s?void 0:s.valueKey)&&s.valueKey!==n&&(e[n]=e[s.valueKey]),(null==s?void 0:s.textKey)&&s.textKey!==t&&(e[t]=e[s.textKey])})),r=r.filter((e=>c.includes(e[n]))).slice(0,2);const i=r.map((e=>({value:e[n],text:e[t]})));this.setRecords(r),this.setItemList(i),this.setTextValue(i.map((e=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}))}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){var e;const{$$form:n}=this.context;this.props;const{visible:r,loading:i,textValue:l}=this.state,{fieldName:a,options:o={},searchHelper:s={},placeholder:c=pn("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=l.every((e=>Va(e)))?"":l.join(" - "),f={visible:r,title:pn("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:ve({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(mo,{value:m,bordered:d}):t.createElement(t.Fragment,null,t.createElement(O.Group,null,t.createElement(O,{value:l[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?l.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(l).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):l.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,l[1]]))}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:p,readOnly:!0}),t.createElement(O.Search,{value:l[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:i,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?l.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(l).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):l.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([l[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t.createElement(Ll,f,t.createElement(nh,g)))}}xc.contextType=Al;class Ec extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(c),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(xc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{m(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(D,null,e.renderFormItemButton(a,u)),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Ec.contextType=Al;const wc=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,onChange:l,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,h=Yn(p)?i:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(mo,{value:m(r),bordered:c}):t.createElement(M.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==l||l(e),a(e,m(e))})(e)}},h.map((e=>t.createElement(M,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Cc extends s{constructor(){super(...arguments),this.state={itemList:[]}}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}getItemList(){var e;return Mn(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(wc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Cc.contextType=Al;const Sc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=a,m=e=>h?h[Math.ceil(e)-1]:e.toString();return t.createElement(q,{value:r,count:p,style:o,allowHalf:u,allowClear:s,tooltips:h,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==i||i(e),l(e,m(e))})(e)}})};class Nc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Sc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Nc.contextType=Al;const Tc=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,onChange:l,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:p=[]}=o,h=Yn(p)?i:p,m=e=>{var t,n;return null!==(n=null===(t=h.find((t=>t.value===e)))||void 0===t?void 0:t.text)&&void 0!==n?n:""};return n.isOnlyShow?t.createElement(mo,{value:m(r),bordered:c}):t.createElement(j.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u||n.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==l||l(e),a(e,m(e))})(t)}},h.map((e=>t.createElement(j,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ic extends s{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Tc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Ic.contextType=Al;const Rc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=Pa,trueValue:h=Aa}=o,{t:m}=Fn();return t.createElement(t.Fragment,null,t.createElement(K,{checked:r===h,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement(qe,null),unCheckedChildren:t.createElement(Ye,null),onChange:e=>{(e=>{null==i||i(e),l(e,m(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class Oc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option,{labelToSwitch:m}=o;return t.createElement(P.Item,{label:m?" ":e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Rc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Oc.contextType=Al;const kc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{options:o={},style:s={},placeholder:c=a("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:p,disabled:h,onFocus:m,onBlur:f,onEnter:g}=e.option,{showCount:v,maxLength:y,autoSize:b}=o,x=Object.assign({},{minRows:1,maxRows:3},b);return t.createElement(O.TextArea,{value:r,placeholder:c,style:s,maxLength:y,showCount:v,autoSize:x,bordered:d,allowClear:u,readOnly:p||n.isOnlyShow,disabled:h,onFocus:e=>{null==m||m(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),null==f||f(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;null==g||g(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),l(e)})(t)}})};class Lc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(kc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Lc.contextType=Al;const Ac=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.datePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:m,disabled:f}=e.option,{dateType:g="date",format:v,disabledDate:y,minDateTime:b,maxDateTime:x,shortCuts:E=!0}=s,w=t.createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==i||i(e),l(e,S(e))},S=e=>Va(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=za(h().subtract(e,"day"),Fa[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return n.isOnlyShow?t.createElement(mo,{value:S(r),bordered:u}):t.createElement(Rn,{ref:w,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ma[g],format:v,bordered:u,showToday:!1,showTime:"datetime"===g&&{defaultValue:h("00:00:00","HH:mm:ss")},allowClear:p,disabled:f,inputReadOnly:m,disabledDate:null!=y?y: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,[b,x]),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():t.createElement(t.Fragment,null,t.createElement(z,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(z,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(z,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(z,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:Ka(r,Fa[g]),onChange:(e,t)=>{C(za(e,Fa[g]))}})};class Pc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ac,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Pc.contextType=Al;const _c=e=>[h().subtract(e,"day"),h()],Dc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:m,disabled:f=n.isFormDisabled}=e.option,{dateType:g="date",format:v,disableds:y=[!1,!1],allowEmpty:b,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:C=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:_c(7),[a("qm.form.dateRangePickers")[1]]:_c(30),[a("qm.form.dateRangePickers")[2]]:_c(90),[a("qm.form.dateRangePickers")[3]]:_c(180)},N=e=>Va(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(mo,{value:N(r),bordered:u}):t.createElement(Rn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ma[g],format:v,bordered:u,showTime:"datetime"===g&&{defaultValue:[h("00:00:00","HH:mm:ss"),h("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:b,disabled:f?[!0,!0]:y,inputReadOnly:m,disabledDate:null!=x?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:Yn(r)?null:[Ka(null==r?void 0:r[0],Fa[g]),Ka(null==r?void 0:r[1],Fa[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=[]),null==i||i(e),l(e,N(e))})([za(null==e?void 0:e[0],Fa[g]),za(null==e?void 0:e[1],Fa[g])])}})};class Hc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Dc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Hc.contextType=Al;const Mc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:v=1,secondStep:y=1}=s;return n.isOnlyShow?t.createElement(mo,{value:r,bordered:u}):t.createElement(kn,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:v,secondStep:y,allowClear:p,disabled:m,inputReadOnly:h,format:$a[f],value:Ka(r,$a[f]),onChange:(e,t)=>{(e=>{const t=za(e,$a[f]);null==i||i(t),l(t)})(e)}})};class Fc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Mc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Fc.contextType=Al;const $c=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m=n.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:v,hourStep:y=1,minuteStep:b=1,secondStep:x=1}=s,E=e=>Va(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(mo,{value:E(r),bordered:u}):t.createElement(kn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:y,minuteStep:b,secondStep:x,allowClear:p,allowEmpty:v,disabled:m?[!0,!0]:g,inputReadOnly:h,format:$a[f],value:Yn(r)?null:[Ka(null==r?void 0:r[0],$a[f]),Ka(null==r?void 0:r[1],$a[f])],onChange:(e,t)=>{(e=>{const t=[za(null==e?void 0:e[0],$a[f]),za(null==e?void 0:e[1],$a[f])];null==i||i(t),l(t,E(t))})(e)}})};class qc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement($c,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}qc.contextType=Al;class jc extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._clicking=!1,this._prevValue=null,this.state={itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0},this.getSearchHelper=Vt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.paramsChangeHandler=(e,t)=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting(),he(e,t)||this.getItemList()})),this.echoSearchHelper=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:i,echoRequest:l}=this.searchHelper;if(r||nr("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),i){const e=["valueKey","displayKey","extraKey"];for(const t in i)e.includes(t)&&(this[t]=i[t])}Object.keys(this.alias).includes(e)||nr("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),l&&!this.valueKey&&nr("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&nr("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getItemText=()=>Mn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Yn(u))try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Ba(e,this.alias,c),d&&Ua(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Wa(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==l||l([e])}}}catch(e){}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const i=Wa(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])})},this.fetchHandle=be(this.getItemList,200),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},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]:Wa(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:Wa(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=Wa(e,this.alias[r]);this.triggerChange(i),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){var t,n,r,i,l,a;const o=(null===(n=null===(t=e.option.searchHelper)||void 0===t?void 0:t.request)||void 0===n?void 0:n.params)||(null===(r=e.option.request)||void 0===r?void 0:r.params),s=(null===(l=null===(i=this.props.option.searchHelper)||void 0===i?void 0:i.request)||void 0===l?void 0:l.params)||(null===(a=this.props.option.request)||void 0===a?void 0:a.params);this.paramsChangeHandler(s,o),this.echoSearchHelper()}getItemList(e){var t;return Mn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:i={},formatter:l=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(l(Object.assign(Object.assign({},i),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=ue(o.data,a))&&void 0!==t?t:[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}))}render(){const{$$form:e}=this.context,{visible:n,loading:r,itemList:i,inputText:l}=this.state,{value:a}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=pn("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=_a}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=ar("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t.createElement(T,{spinning:r},i.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:_e("table")},!g&&t.createElement("thead",null,t.createElement("tr",null,y.filter((e=>!e.hidden)).map((e=>t.createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t.createElement("tbody",null,i.map(((e,n)=>t.createElement("tr",{key:n,className:this.state.activeIndex===n?"active":"",onMouseEnter:()=>{this.setState({activeIndex:n})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},y.filter((e=>!e.hidden)).map((n=>t.createElement("td",{key:n.dataIndex},ue(e,n.dataIndex))))))))):t.createElement(nl,null));return t.createElement(sn.Consumer,null,(r=>{const s={[b]:!0,[`${b}--lg`]:"large"===(null==r?void 0:r.size),[`${b}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(mo,{value:a,bordered:u}):t.createElement(uc,{action:m?[]:["click"],popupVisible:!m&&n,popup:E,popupClassName:_e(s,`form-popper__${o}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ha,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:d,allowClear:p,bordered:u,readOnly:h,disabled:m,style:Object.assign({width:"100%"},c),value:null!=l?l:a,title:a,onFocus:()=>{!i.length&&this.fetchHandle(a)},onBlur:e=>{v&&!this._clicking&&l!==a&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(i[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%i.length:(--t+i.length)%i.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)}})))}))}}jc.contextType=Al;class Kc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(jc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Kc.contextType=Al;class zc extends s{render(){var e;const{$$form:n}=this.context,{type:r,label:i,fieldName:l,className:a,style:o={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:p=Vn}=s,h=[];if(u.length){const t=null!==(e=n.getBlockDerivedItems().find((e=>e[0].fieldName===l)))&&void 0!==e?e:[],r=null!=d?d:t.length-1;t.slice(r+1).forEach((e=>{var t;const r=u.find((t=>t.fieldName===e.fieldName));if(!r)return;const i=r.showLabel?`${e.label}:`:"",l=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==l&&h.push(Object.assign(Object.assign({},e),{text:`${i}${l}`}))}))}return t.createElement(P.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(or,{id:l,label:i,className:a,extra:h.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[l],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[l]:e})}))),p(e)}}))}}zc.contextType=Al;const Vc=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:Vc(e.children,t,n,r)}):e)),Wc=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Fn(),{fieldName:d,options:u={},style:p={},placeholder:h=c("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:f=!0,asyncLoad:g,readOnly:v,disabled:y}=e.option,{itemList:b,filterable:x=!0,listHeight:E=_a,checkStrictly:w,checkStrategy:C="SHOW_CHILD",collapseTags:S,defaultExpandAll:N=!g,defaultExpandedKeys:T,dropdownStyle:I,openPyt:R=!0}=u,[O,k]=t.useState(Yn(b)?i:b),L=t.useRef(O);$i((()=>{const e=Yn(b)?i:b;g?he(e,L.current)||(k(e),L.current=e):k(e)}),[b,i]);const A=e=>{var t;return(null===(t=Ya(O,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},P=e=>l?(null==e?void 0:e.map((e=>A(e))).join(","))||"":A(e);return n.isOnlyShow?t.createElement(mo,{value:P(r),bordered:m}):t.createElement(V,On({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:l,treeCheckable:l,treeCheckStrictly:w,showCheckedStrategy:V[C],popupClassName:`form-popper__${d}`,dropdownStyle:I,placeholder:h,listHeight:E,style:p,loading:a,bordered:m,allowClear:f,disabled:y,treeDefaultExpandAll:N,treeDefaultExpandedKeys:T,showSearch:x,maxTagCount:S?"responsive":void 0,loadData:g?({key:e,children:t})=>Mn(void 0,void 0,void 0,(function*(){var n;if(!g||t)return;const{fetchApi:r,params:i,dataKey:l,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=g;if(r)try{const t=yield r(c(Object.assign(Object.assign({},i),{[o]:e})));if(200===t.code){const r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,l))&&void 0!==n?n:[],i=Vc(O,e,o,Ga(r,o,a));k(i),null==s||s(r)}}catch(e){}})):void 0,treeData:O},l?{title:P(r)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,P(e),O)})(e)}}))};class Bc extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=Ga(n,l,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Jn(d)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Wc,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(D,{flex:Jn(p.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Bc.contextType=Al;const Uc=e=>{const{$$form:n}=t.useContext(Al),{value:r,multiple:i,items:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,asyncLoad:h,readOnly:m,disabled:f}=e.option,{itemList:g,changeOnSelect:v,checkStrictly:y,checkStrategy:b="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:w=!0}=s,[C,S]=t.useState(Yn(g)?l:g),N=t.useRef(C);$i((()=>{const e=Yn(g)?l:g;h?he(e,N.current)||(S(e),N.current=e):S(e)}),[g,l]);const T=e=>Xa(C,null!=e?e:"").map((e=>e.text)).join("/"),I=e=>i?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement(mo,{value:I(r),bordered:u}):t.createElement(W,On({value:(e=>Yn(e)?[]:i?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:C,multiple:i,maxTagCount:"responsive",changeOnSelect:v||y,showCheckedStrategy:W[b],popupClassName:`form-popper__${o}`,dropdownStyle:E,placeholder:d,style:c,bordered:u,allowClear:p,disabled:f,showSearch:x&&!h&&{filter:(e,t)=>t.some((t=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:h?e=>Mn(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!h||n.children)return;const{fetchApi:r,params:i,dataKey:l,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=h;if(r)try{const e=yield r(c(Object.assign(Object.assign({},i),{[o]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,l))&&void 0!==t?t:[],i=Vc(C,n.value,o,Ga(r,o,a));S(i),null==s||s(r)}}catch(e){}})):void 0},i?{title:I(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,I(t),C)})(((e=[])=>i?e.map((e=>e.join(","))):e.join(","))(t))}}))};class Gc extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=Ga(n,l,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Jn(d)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Uc,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(D,{flex:Jn(p.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Gc.contextType=Al;const Yc=["110000","120000","310000","500000"],Xc=["810000","820000"],Qc=[{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"}],Zc=[{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"}],Jc=e=>po.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),ed=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...Yc,...Xc].includes(e))):Object.keys(e[t])).map((r=>({l:Jc(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:ed(e,r,n+1)})))},td=(e,t)=>t.map((t=>({l:Jc(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class nd extends s{constructor(e){super(e),this.searchRef=t.createRef(),this.scrollRef=t.createRef(),this.state={visible:!1,select_type:"0",active_key:""},this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||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(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Kt(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){var t;return(null===(t=this.allCities.find((t=>t.c===e)))||void 0===t?void 0:t.n)||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:td(on,Yc)},{l:"Z2",n:"港澳",c:"",p:"",children:td(on,Xc)}]}createProvince(){var e;return(null!==(e=ed(on,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Zc.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Yc,...Xc].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(j.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}))}},t.createElement(j.Button,{value:"0"},pn("qm.form.citySelectType.0")),t.createElement(j.Button,{value:"1"},pn("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?Qc:Zc).map((n=>t.createElement("li",{key:n.value,className:_e({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement(H,{size:"small",placeholder:pn("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>{var n;return((null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"").toLowerCase().indexOf(e.toLowerCase())>=0},value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t.createElement(H.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:n}=this.state;return("0"===n?this.provinces:this.letterCities).map(((n,r)=>{var i;return t.createElement("div",{key:r},t.createElement("dt",{ref:e=>this[`${n.l}Ref`]=e},n.n,":"),t.createElement("dd",null,null===(i=n.children)||void 0===i?void 0:i.map((n=>t.createElement("li",{key:n.c,className:_e({actived:n.c===e}),onClick:()=>this.clickHadnle(n.c)},n.n)))))}))}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=pn("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=ar("form-city-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},a)},t.createElement("div",{className:"city-drop"},t.createElement("div",{className:"city-drop-toper"},t.createElement("div",{className:"city-drop-toper__type"},this.renderType()),t.createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t.createElement("div",{className:"city-drop-letter"},this.renderLetter()),t.createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t.createElement("dl",null,this.renderCity(r)))));return t.createElement(sn.Consumer,null,(r=>{const l={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(mo,{value:m,bordered:s}):t.createElement(uc,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ha,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},a),value:m,title:m,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}nd.contextType=Al;class rd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(nd,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}rd.contextType=Al;const id=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:id(e,n)})))};class ld extends s{constructor(e){super(e),this.searchRef=t.createRef(),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)};const n=id(on,"86")||[];this.state={results:n,visible:!1,values:[],tabs:[n.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(",")!==(null!=n?n:"")&&this.initial()}get isFetch(){var e;return!!(null===(e=this.props.option.request)||void 0===e?void 0:e.fetchApi)}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>{var n,r;return null===(r=null===(n=this.state.tabs[t])||void 0===n?void 0:n.find((t=>t.value===e)))||void 0===r?void 0:r.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 i=Ya(e,t[r]);if(i&&Yn(i.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(null==i?void 0:i.children)&&(n[r+1]=null==i?void 0:i.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}getStreetList(e){var t;return Mn(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:i=(e=>e),dataKey:l,valueKey:a="value",textKey:o="text"}=n;if(r)try{const n=yield r(i({code:e}));if(200===n.code){const e=Array.isArray(n.data)?n.data:null!==(t=ue(n.data,l))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var i;const l=(null===(i=n.find((t=>t.value===e[r])))||void 0===i?void 0:i.text)||`${pn("qm.form.selectPlaceholder").replace("...","")}(${pn("qm.form.regionSelectLabel")[r]})`;return t.createElement(Il.TabPane,{key:r.toString(),tab:l},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:_e({"region-box__item":!0,actived:e.includes(n.value.toString())}),title:n.text,onClick:()=>{let{values:e}=this.state;e[r]=n.value.toString(),e=e.slice(0,r+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(r+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(r+1)}))}},n.text)))))}));return n.length?t.createElement(Il,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(nl,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=pn("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=ar("form-region-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=t.createElement("div",{className:"container"},this.renderTabs());let f=this.prevText;if(!n){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(f=e,this.prevText=f)}return t.createElement(sn.Consumer,null,(r=>{const l={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(mo,{value:f,bordered:s}):t.createElement(uc,{action:u?[]:["click"],popupVisible:!u&&n,popup:m,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ha,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:Object.assign({width:"100%"},a),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&Un((()=>this.initial()))}})))}))}}ld.contextType=Al;class ad extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ld,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}ad.contextType=Al;const od=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:p,fileSize:h,draggable:m,editable:f,batchDownload:g,fileDirection:v,onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w}=a,{action:C,headers:S,params:N,withCredentials:T=!1,dataKey:I="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:A}=o,P="function"==typeof k?k():k||{},{t:_}=Fn();return t.createElement(xl,{name:"file",action:C,multiple:d,headers:S,data:N,withCredentials:T,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:p,fileSize:h,draggable:m,editable:f,batchDownload:g,fileDirection:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(Ke,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in P)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[P[i]])||"";return e.response&&200!==n.code&&R.error(n.message||_("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(I?ue(n.data,I):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(e)},onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w})};class sd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(od,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}sd.contextType=Al;const cd=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,draggable:v,onRemove:y,onSortChange:b}=a,{action:x,headers:E,params:w,withCredentials:C=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,O="function"==typeof T?T():T||{},{t:k}=Fn();return t.createElement(Pd,{name:"file",action:x,multiple:d,headers:E,data:w,withCredentials:C,popupClassName:N,beforeUpload:I,maxCount:u,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,draggable:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in O)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[O[i]])||"";return e.response&&200!==n.code&&R.error(n.message||k("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(S?ue(n.data,S):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(e)},onRemove:y,onSortChange:b})};class dd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(cd,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}dd.contextType=Al;const ud=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=a;return t.createElement(kd,{value:r,tinymce:u,upload:o,thresholdSize:p,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{null==i||i(e),l(e)})(e)}})};class pd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ud,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}pd.contextType=Al;class hd extends s{constructor(e){var n;super(e),this.provide={$$form:this,echo_data:{}},this._fieldAuth={},this.wrapperRef=t.createRef(),this.formRef=t.createRef(),this.originItems=[],this.state={formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:null!==(n=this.props.cols)&&void 0!==n?n:4,collapse:!!this.props.defaultExpand},this.resizeObserveHandler=()=>{var e;const t=null===(e=this.wrapperRef.current)||void 0===e?void 0:e.offsetWidth;if(void 0===t||0===t||this.props.cols>0)return;let n=Math.floor(t/300);n=24%n==0?n:n-1,n=n<1?1:n,n=n>8?8:n,n!==this.state.flexCols&&this.setState({flexCols:n})},this.resizeListenerHandle=be(this.resizeObserveHandler,10),this.getFormItems=Vt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=Vt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{ae(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t})),this.valuesChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onValuesChange)||void 0===r||r.call(n,e,this._initialValues)},this.fieldsChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onFieldsChange)||void 0===r||r.call(n,e,t)},this.finishHandle=e=>{var t,n;null===(n=(t=this.props).onFinish)||void 0===n||n.call(t,Object.assign({},this.get_fields_other(),this.formatFormValue(e)))},this.finishFailedHandle=({values:e,errorFields:t})=>{var n,r;null===(r=(n=this.props).onFinishFailed)||void 0===r||r.call(n,t)},this.openValidateInfo=e=>{const n=t.createElement("ul",null,e.map((e=>{const{label:n}=this.formItems.find((t=>t.fieldName===e.name[0]));return t.createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof n?`${n}: `:"")+e.errors.join(","),"]")})));B.error({message:pn("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Kt(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})},this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){var e,t;return null!==(t=null!==(e=this.props.size)&&void 0!==e?e:this.context.size)&&void 0!==t?t:""}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(){var e;const t=this.context.global;return null!==(e=this.props.compactMode)&&void 0!==e?e:"small"===this.$size&&!!(null==t?void 0:t.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(){ol(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){sl(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&&nr("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=>ae(e.extra))).forEach((n=>{var r;t[n.fieldName]=null!==(r=e[n.fieldName])&&void 0!==r?r:""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>ae(e.collapse))).forEach((t=>{var n;e[t.fieldName]=null!==(n=t.collapse.defaultExpand)&&void 0!==n&&n})),Object.assign({},e)}getInitialValue(e,t){var n;const{type:r,options:i}=e;return t=null!=t?t:void 0,Da.includes(r)&&(t=null!=t?t:[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=null!==(n=null!=t?t:null==i?void 0:i.falseValue)&&void 0!==n?n:Pa),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=Zn(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){var t;return null!==(t=this.state.viewData[e])&&void 0!==t?t:""}setExpandHandle(e){var t,n;e!==this.state.collapse&&(this.setState({collapse:e}),null===(n=(t=this.props).onCollapse)||void 0===n||n.call(t,e),Un((()=>{var t,n;return null===(n=(t=this.props).onCollapse)||void 0===n?void 0:n.call(t,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){var t,n,r,i,l;if(Qa(e))return Za(e);if(ae(e)){const{fieldName:a,label:o,options:s={}}=e;if(Qa(o))return Za(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([a])[a])&&void 0!==n?n:this._initialValues[a])&&void 0!==r?r:null===(i=c[0])||void 0===i?void 0:i.value;return(null===(l=c.find((e=>e.value===d)))||void 0===l?void 0:l.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}){var n,r;if("DIVIDER"===e)return!0;const i=this.getBlockDerivedItems();for(let e=0,l=i.length;e<l;e++){const l=i[e],a=this.dividers.find((e=>e.fieldName===l[0].fieldName)),o=null!==(r=null===(n=null==a?void 0:a.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:l.length-1;for(let e=1;e<l.length;e++){if(l[e].fieldName===t&&e>o)return this.state.expand[l[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const i=e[r];if(Va(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{Va(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(i)){const[l,a]=r.split("|");e[l]=null!==(t=i[0])&&void 0!==t?t:"",e[a]=null!==(n=i[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)Yn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return Mn(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let i=Qn(r,["fetch"]);if(r.fetch){const{api:t,params:n,dataKey:l}=r.fetch;try{const r=yield t(n);200===r.code&&(i=null!==(e=l?ue(r.data,l):r.data)&&void 0!==e?e:{})}catch(e){}}if(Array.isArray(i.fieldList)){const e=this.props.items.map((e=>{const{fieldName:t}=e,n=i.fieldList.find((e=>e.dataIndex===t));if(n){const r=this.originItems.find((e=>e.fieldName===t)),{visible:i=1,disabled:l,secretName:a}=n;i||(e.noAuth=!0,r.noAuth=!0),l&&(e.disabled=!0,r.disabled=!0),a&&(e.options?e.options.secretType=a:e.options={secretType:a},r.options=Object.assign({},r.options,{secretType:a})),this.setFieldAuth(t,{visible:i,disabled:l,secretName:a})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(wo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(So,{option:e})}INPUT_NUMBER(e){return t.createElement(To,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(Ro,{option:e})}SEARCH_HELPER(e){return t.createElement(Ao,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(hc,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(gc,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(yc,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(Ec,{option:e})}CHECKBOX(e){return t.createElement(bo,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(Cc,{option:e})}RATE(e){return t.createElement(Nc,{option:e})}RADIO(e){return t.createElement(Ic,{option:e})}SWITCH(e){return t.createElement(Oc,{option:e})}TEXT_AREA(e){return t.createElement(Lc,{option:e})}DATE(e){return t.createElement(Pc,{option:e})}RANGE_DATE(e){return t.createElement(Hc,{option:e})}TIME(e){return t.createElement(Fc,{option:e})}RANGE_TIME(e){return t.createElement(qc,{option:e})}SELECT(e){return t.createElement(vo,{option:e})}MULTIPLE_SELECT(e){return t.createElement(vo,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(Kc,{option:e})}DIVIDER(e){return t.createElement(zc,{option:e})}TREE_SELECT(e){return t.createElement(Bc,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(Bc,{option:e,multiple:!0})}CASCADER(e){return t.createElement(Gc,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(Gc,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(rd,{option:e})}REGION_SELECT(e){return t.createElement(ad,{option:e})}UPLOAD_FILE(e){return t.createElement(sd,{option:e})}UPLOAD_IMG(e){return t.createElement(dd,{option:e})}TINYMCE(e){return t.createElement(pd,{option:e})}renderFormLabel(e){if(Qa(e)||!ae(e))return e;const{type:n,fieldName:r,label:i,options:l={},onChange:a=Vn}=e,{itemList:o=[]}=l;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(go,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{style:{paddingRight:5}},i),t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(yo,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:i={},render:l}=e,{extra:a}=this.state;if(r)return t.createElement(w,{className:"extra-tooltip",title:a[n]},t.createElement(Xe,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:l?"":a[n],style:i},t.createElement("span",{className:"extra-overflow-cut"},l?l(o,this):a[n]))}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:n,fieldName:r,invisible:i,tooltip:l,className:a,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return t.createElement(P.Item,{label:this.renderFormLabel(n),name:r,rules:c,tooltip:l,hidden:i,className:_e(a),style:Object.assign({width:"100%"},d),labelCol:{flex:this.verticalLayout?"initial":Jn(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):t.createElement(t.Fragment,null))}createFormItem(e){return se(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(nr("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:r,isFieldsDefine:i}=this.props,l=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)l.push({});l.push(e);for(let e=0;e<n;e++)l.push({})}));const a=24/e,o=[],s=l.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=l.map(((n,r)=>{let{selfCol:i=1}=n;const{type:l,fieldName:s}=n;i=i>=24||"DIVIDER"===l||"TINYMCE"===l?e:i;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(o[r]),t.createElement(D,{key:null!=s?s:r,className:s,span:i*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},l?this.createFormItem(Zn(n)):null)}));return i&&"default"===n&&u.push(t.createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:n,collapse:r}=this.state,{searchButtonCols:i,isSearchBtn:l,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=i||1,c=n-e%n-s;return l?t.createElement(D,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(S,{style:{marginBottom:12}},t.createElement(rr,{type:"primary",size:this.$size,icon:t.createElement(Ge,null),onClick:()=>this.SUBMIT_FORM()},pn("qm.form.search")),t.createElement(rr,{size:this.$size,icon:t.createElement(Qe,null),onClick:()=>this.RESET_FORM()},pn("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(De,null):t.createElement(He,null)," ",pn(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:n,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const i=24/e;return r&&"default"===n?t.createElement(_,{gutter:0},t.createElement(D,{key:"-",span:i},t.createElement(P.Item,null,t.createElement(S,{style:{marginBottom:12}},t.createElement(rr,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},pn("qm.form.save")),t.createElement(rr,{size:this.$size,onClick:()=>this.RESET_FORM()},pn("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(xo,{uniqueKey:e,items:n,fieldsChange:r})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){const[n,r]=yield this.VALIDATE_FIELDS(),i=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>{var t;return null===(t=this[`${e.fieldName}_Ref`])||void 0===t?void 0:t.searchRef._is_change})).map((e=>({name:[e.fieldName],errors:[pn("qm.form.searchHelperTips")],warnings:[]})));n||i.length?t((n||[]).concat(i)):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))}GET_FORM_DATA(){return Mn(this,void 0,void 0,(function*(){try{const e=yield 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]}}))}VALIDATE_FIELDS(e){return Mn(this,void 0,void 0,(function*(){try{return[null,yield 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)}SUBMIT_FORM(){return Mn(this,void 0,void 0,(function*(){try{yield this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}))}RESET_FORM(){var e,t;const n=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),r=this.flattenItems.map((e=>e.fieldName)).filter((e=>!n.includes(e)));r.length&&this.formRef.current.resetFields(r),this.setState((e=>{const t=Object.keys(e.other),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),i={};return r.forEach((e=>i[e]=void 0)),{other:Object.assign({},this._initialOthers,i)}})),this.setState({extra:Object.assign({},this._initialExtras)}),null===(t=(e=this.props).onReset)||void 0===t||t.call(e)}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){nr("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:i}=this.props,l=r.find((t=>t.fieldName===e));if(!l)return nr("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!ae(t))return nr("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(l.noAuth)return nr("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||me(l,n,t[n]));n&&(i?i([...r]):nr("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:l,labelAlign:a,labelWrap:o,customClass:s}=this.props,c=ar("form"),d={required:"${label}"+pn("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 t.createElement("div",{ref:this.wrapperRef,className:_e(u,e),style:n},t.createElement(P,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:a,labelWrap:o,colon:!1,disabled:i,labelCol:{flex:this.verticalLayout?"initial":Jn(l)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Al.Provider,{value:this.provide},t.createElement(_,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}hd.contextType=sn,hd.propTypes=qa,hd.defaultProps=ja;const md={onActivate:Wt.func,onAddUndo:Wt.func,onBeforeAddUndo:Wt.func,onBeforeExecCommand:Wt.func,onBeforeGetContent:Wt.func,onBeforeRenderUI:Wt.func,onBeforeSetContent:Wt.func,onBeforePaste:Wt.func,onBlur:Wt.func,onChange:Wt.func,onClearUndos:Wt.func,onClick:Wt.func,onContextMenu:Wt.func,onCommentChange:Wt.func,onCopy:Wt.func,onCut:Wt.func,onDblclick:Wt.func,onDeactivate:Wt.func,onDirty:Wt.func,onDrag:Wt.func,onDragDrop:Wt.func,onDragEnd:Wt.func,onDragGesture:Wt.func,onDragOver:Wt.func,onDrop:Wt.func,onExecCommand:Wt.func,onFocus:Wt.func,onFocusIn:Wt.func,onFocusOut:Wt.func,onGetContent:Wt.func,onHide:Wt.func,onInit:Wt.func,onKeyDown:Wt.func,onKeyPress:Wt.func,onKeyUp:Wt.func,onLoadContent:Wt.func,onMouseDown:Wt.func,onMouseEnter:Wt.func,onMouseLeave:Wt.func,onMouseMove:Wt.func,onMouseOut:Wt.func,onMouseOver:Wt.func,onMouseUp:Wt.func,onNodeChange:Wt.func,onObjectResizeStart:Wt.func,onObjectResized:Wt.func,onObjectSelected:Wt.func,onPaste:Wt.func,onPostProcess:Wt.func,onPostRender:Wt.func,onPreProcess:Wt.func,onProgressState:Wt.func,onRedo:Wt.func,onRemove:Wt.func,onReset:Wt.func,onSaveContent:Wt.func,onSelectionChange:Wt.func,onSetAttrib:Wt.func,onSetContent:Wt.func,onShow:Wt.func,onSubmit:Wt.func,onUndo:Wt.func,onVisualAid:Wt.func,onSkinLoadError:Wt.func,onThemeLoadError:Wt.func,onModelLoadError:Wt.func,onPluginLoadError:Wt.func,onIconsLoadError:Wt.func,onLanguageLoadError:Wt.func},fd=Object.assign({apiKey:Wt.string,id:Wt.string,inline:Wt.bool,init:Wt.object,initialValue:Wt.string,onEditorChange:Wt.func,value:Wt.string,tagName:Wt.string,cloudChannel:Wt.string,plugins:Wt.oneOfType([Wt.string,Wt.array]),toolbar:Wt.oneOfType([Wt.string,Wt.array]),disabled:Wt.bool,textareaName:Wt.string,tinymceScriptSrc:Wt.string,rollback:Wt.oneOfType([Wt.number,Wt.oneOf([!1])]),scriptLoading:Wt.shape({async:Wt.bool,defer:Wt.bool,delay:Wt.number})},md),gd=e=>"function"==typeof e,vd=e=>e in md,yd=e=>e.substr(2),bd=(e,t,n,r,i)=>((e,t,n,r,i,l,a)=>{const o=Object.keys(i).filter(vd),s=Object.keys(l).filter(vd),c=o.filter((e=>void 0===l[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=yd(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const i=r(e,n),l=yd(n);a[l]=i,t(l,i)}))})(i,e.on.bind(e),e.off.bind(e),((t,n)=>r=>{var i;return null===(i=t(n))||void 0===i?void 0:i(r,e)}),t,n,r);let xd=0;const Ed=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return xd++,e+"_"+n+xd+String(t)},wd=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Cd=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Sd=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Nd=()=>({listeners:[],scriptId:Ed("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Td=(()=>{let e=Nd();return{load:(t,n,r,i,l,a)=>{const o=()=>((e,t,n,r,i,l)=>{const a=t.createElement("script");a.referrerPolicy="origin",a.type="application/javascript",a.id=e,a.src=n,a.async=r,a.defer=i;const o=()=>{a.removeEventListener("load",o),l()};a.addEventListener("load",o),t.head&&t.head.appendChild(a)})(e.scriptId,t,n,r,i,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?a():(e.listeners.push(a),e.scriptLoading||(e.scriptLoading=!0,l>0?setTimeout(o,l):o()))},reinitialize:()=>{e=Nd()}}})(),Id=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Rd extends e.Component{constructor(t){var n,r,i;super(t),this.rollbackTimer=void 0,this.valueCursor=void 0,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},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){}},this.handleBeforeInputSpecial=e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)},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))}},this.handleEditorChangeSpecial=e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)},this.initialise=(e=0)=>{var t,n,r;const i=this.elementRef.current;if(!i)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})(i)){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 l=Id(this.view);if(!l)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},this.props.init),{selector:void 0,target:i,readonly:this.props.disabled,inline:this.inline,plugins:(o=null===(t=this.props.init)||void 0===t?void 0:t.plugins,s=this.props.plugins,Cd(o).concat(Cd(s))),toolbar:null!==(n=this.props.toolbar)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!wd(i)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&gd(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{var t,n;const r=this.getInitialValue();this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t:e.getContent(),this.currentContent!==r&&(this.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const i=null!==(n=this.props.disabled)&&void 0!==n&&n;Sd(this.editor,i?"readonly":"design"),this.props.init&&gd(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(i.style.visibility=""),wd(i)&&(i.value=this.getInitialValue()),l.init(a)},this.id=this.props.id||Ed("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(i=null!==(n=this.props.inline)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.inline)&&void 0!==i&&i,this.boundHandlers={}}get view(){var e,t;return null!==(t=null===(e=this.elementRef.current)||void 0===e?void 0:e.ownerDocument.defaultView)&&void 0!==t?t:window}componentDidUpdate(e){var t,n;if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t: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=null!==(n=this.props.disabled)&&void 0!==n&&n;Sd(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,i,l;null!==Id(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Td.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),null!==(t=null===(e=this.props.scriptLoading)||void 0===e?void 0:e.async)&&void 0!==t&&t,null!==(r=null===(n=this.props.scriptLoading)||void 0===n?void 0:n.defer)&&void 0!==r&&r,null!==(l=null===(i=this.props.scriptLoading)||void 0===i?void 0:i.delay)&&void 0!==l?l: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(){var e,t,n;return(null===(n=null===(t=null===(e=Id(this.view))||void 0===e?void 0:e.Env)||void 0===t?void 0:t.browser)||void 0===n?void 0:n.isIE())?"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:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.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){bd(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))}}}var Od;Rd.propTypes=fd,Rd.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(Od||(Od={}));const kd=e=>{var n;const{className:r,style:i,tinymce:l={},upload:a={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:p}=e,{global:h}=t.useContext(sn),{$size:m}=qn(e),{$locale:f,t:g}=Fn(),v=400,y="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",b="file edit view insert format tools table help",x="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",E=Object.assign(Object.assign({height:l.height||v,plugins:l.plugins||y,toolbar:l.toolbar||x,menubar:l.menubar||b,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:Od[f],skin:"tinymce-5"},Qn(l,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>new Promise(((t,n)=>Mn(void 0,void 0,void 0,(function*(){const{action:n,headers:r,dataKey:i}=a,l=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(n&&c/1024/1024>o)try{const e=yield fetch(n,{method:"POST",body:s,headers:r});if(!e.ok)throw new Error(g("qm.upload.uploadError"));const l=yield e.json();if(200===l.code){const e=i?ue(l.data,i):l.data;t(e)}}catch(e){R.error(g("qm.uploadCropper.uploadError"))}else t(l)})))),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),w=ar("tinymce"),C={[w]:!0,[`${w}--lg`]:"large"===m,[`${w}--sm`]:"small"===m},S={init:E,value:d,disabled:c,tinymceScriptSrc:s||(null===(n=null==h?void 0:h.tinymce)||void 0===n?void 0:n.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==p||p(t.getContent(),t)}};return t.createElement("div",{className:_e(C,r),style:i},t.createElement(Rd,S))};kd.displayName="QmTinymce";const Ld=t.forwardRef(((e,n)=>{const r=hn({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:i,style:l,src:a,alt:o,imgStyle:s}=r,c=Dn(r,["className","style","src","alt","imgStyle"]),d=t.useRef(null),u=t.useRef(null);t.useEffect((()=>{const e={};for(const t in c)void 0!==r[t]&&(e[t]=r[t]);return u.current=new Ut(d.current,e),()=>{y(),u.current=null}}),[]);const p=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.reset()},h=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},m=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.crop()},f=(e,t=!1)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.replace(e,t)},g=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.enable()},v=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.disable()},y=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.destroy()},b=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.move(e,t)},x=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.moveTo(e,t)},E=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoom(e)},w=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},C=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotate(e)},S=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotateTo(e)},N=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleX(e)},T=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleY(e)},I=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.scale(e,t)},R=(e=!1)=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getData(e)},O=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setData(e)},k=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getContainerData()},L=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getImageData()},A=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCanvasData()},P=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCanvasData(e)},_=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},D=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},H=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},M=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},F=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setDragMode(e)};t.useImperativeHandle(n,(()=>({reset:p,clear:h,initCrop:m,replace:f,enable:g,disable:v,destroy:y,move:b,moveTo:x,relativeZoom:E,zoomTo:w,rotate:C,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:_,setCropBoxData:D,getCroppedCanvas:H,setAspectRatio:M,setDragMode:F})));const $={[ar("cropper")]:!0};return t.createElement("div",{className:_e($,i),style:l},t.createElement("img",{ref:d,src:a,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));Ld.displayName="Cropper";const Ad=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:i,quality:l,beforeCrop:a,className:o}=e,{t:s}=Fn(),c=t.useRef(null),d=t.useRef(),u=t.useRef(),p=t.useRef(),h=t.useRef(),[m,f]=t.useState(""),g=e=>{c.current.relativeZoom(e)},v=e=>{c.current.rotate(e)},y=()=>{f("")},b=ar("cropper-preview");return t.createElement(t.Fragment,null,(()=>{const n=Array.isArray(e.children)?e.children[0]:e.children;if(!n)return null;const r=n.props,{beforeUpload:i}=r,l=Dn(r,["beforeUpload"]);return d.current=i,t.createElement(n.type,Object.assign(Object.assign({},l),{beforeUpload:(e,t)=>new Promise(((n,r)=>Mn(void 0,void 0,void 0,(function*(){const r=()=>n(I.LIST_IGNORE);if(a&&!(yield a(e,t)))return void r();u.current=e,p.current=n,h.current=r;const i=new FileReader;i.onload=()=>{f(i.result),i.onload=null},i.readAsDataURL(e)}))))}))})(),m&&t.createElement(A,{open:!0,wrapClassName:_e(b,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{Mn(void 0,void 0,void 0,(function*(){const{type:e,name:t,uid:r}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((i=>Mn(void 0,void 0,void 0,(function*(){let l=new File([i],t,{type:e});if(Object.assign(l,{uid:r}),n.length&&!n.includes(l.name.slice(l.name.lastIndexOf(".")+1).toLowerCase()))return R.warning(s("qm.upload.tooltip",{type:n.join(",")})),h.current("file type is error");if("function"!=typeof d.current)return p.current(l);const a=d.current(l,[l]);if("boolean"==typeof a||a){if(!0===a)return p.current(l);if(!1===a)return h.current("not upload");if(a&&"function"==typeof a.then)try{const e=yield a,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(l=e),p.current(l)}catch(e){h.current(e)}}else nr("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,l),yield Bn(100),y()}))},onCancel:y,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:i?`calc(380px * ${i[1]/i[0]})`:"auto"};return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(Ld,{ref:c,aspectRatio:i?i[0]/i[1]:i,src:m,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(S,{size:"small"},t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Ze,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Je,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(et,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(tt,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},Pd=e=>{const n=hn({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:i=!0,fixedSize:l,quality:a=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:p,className:h,popupClassName:m,beforeCrop:f,onSortChange:g,onChange:v}=n,{t:y}=Fn(),{$size:b}=qn(n),x=t.useRef(null),E=t.useRef(null),w=t.useRef(!1),[C,S]=t.useState(!1),[N,T]=t.useState(0),O=t.useMemo((()=>u||p),[u,p]),k=t.useMemo((()=>!c||r.length<c),[r,c]);t.useEffect((()=>(A(),document.addEventListener("paste",_),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",_)})),[]),$i((()=>{k||(w.current=!1)}),[r]);const L=$n((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[i]=e.splice(t,1);e.splice(n,0,i),null==g||g(e),null==v||v({file:r[t],fileList:e})}})),A=()=>{d&&(E.current=qt.create(Gi(x.current,ar("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:L}))},P=(e,t)=>new Promise(((r,i)=>Mn(void 0,void 0,void 0,(function*(){const{fileTypes:l=[],fileSize:a,beforeUpload:o}=n,s=!l.length||l.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!a||e.size/1024/1024<a,d=s&&c;if(s||R.warning(y("qm.upload.tooltip",{type:l.join(",")})),c||R.warning(y("qm.upload.sizeLimit",{size:a})),!d)return I.LIST_IGNORE;if(o){const n=o(e,t);if(!0===n)return r(e);if(!1===n)return i("not upload");if(n&&"function"==typeof n.then)try{const e=yield n;r(e)}catch(e){i(e)}}else r(e)})))),_=$n((e=>Mn(void 0,void 0,void 0,(function*(){const{action:t,data:i,headers:l}=n;if(w.current&&k&&t)for(const n of e.clipboardData.items)if("file"===n.kind&&n.type.startsWith("image/")){const e=n.getAsFile(),a=Date.now(),o=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${a}`});try{yield P(o,[...r,o]);const e=new FormData;if(e.append("file",o),i)for(const t in i)e.append(t,i[t]);const n="string"==typeof t?t:yield t(o),a=yield fetch(n,{method:"POST",body:e,headers:l});if(!a.ok)throw new Error(y("qm.upload.uploadError"));const s=yield a.json();null==v||v({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})))),D=ar("upload-img"),H={[D]:!0,[`${D}--lg`]:"large"===b,[`${D}--sm`]:"small"===b},M=t.createElement(I,On({className:_e(H,h)},Qn(n,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:P,disabled:O,onPreview:e=>{const t=r.findIndex((t=>t.url===e.url));t<0||(T(t),S(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,n,r,i)=>t.createElement("div",{className:_e("upload-item",{handle:d})},e,!O&&t.createElement(Ye,{title:y("qm.upload.remove"),className:"icon",onClick:()=>i.remove()}))}),t.createElement("span",{className:"inner",ref:x},k&&!(p&&r.length)&&t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(nt,null)),t.createElement("p",{className:"ant-upload-text"},y("qm.uploadCropper.dragableText")),t.createElement("button",{className:_e("ant-upload-button",{disabled:O}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,i?t.createElement(Ad,{className:m,fixedSize:l,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},M):M,t.createElement("div",{style:{display:"none"}},t.createElement(U.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:C,current:N,rootClassName:m,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(U,{key:e.uid||n,src:e.url,alt:""}))))))};Pd.displayName="QmUploadImg";const _d=(e,t,n)=>{let r;for(let i=0;i<e.length;i++){const l=e[i];if(l.children)if(l.children.some((e=>e[n]===t)))r=l[n];else{const e=_d(l.children,t,n);e&&(r=e)}}return r},Dd=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Dd(e.children,t),t(e)||e.children&&e.children.length))),Hd=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Hd(e.children,t)),t(e)&&n.push(e)})),n},Md=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Md(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Fd=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:Fd(e.children,t,n,r)}):e)),$d=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...$d(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},qd=(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 i=qd(e[r].children,t,n);if(i)return[e[r][n],i].flat()}}},jd=(e,t)=>{var n;const r=(null===(n=e.children)||void 0===n?void 0:n.map((e=>e[t])))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...jd(e,t)))),r},Kd=t.forwardRef(((e,n)=>{const{className:r,style:i,filterable:l=!0,multiple:a,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:m,fieldsDefine:f,value:g,height:v,defaultSelectedKeys:y=[],defaultExpandedKeys:b=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:w=!0,onSelectChange:C,onCheckChange:S,onDragStart:N,onDragChange:T,onExpand:I}=e,{$size:R}=qn(e),{t:k}=Fn(),L=(null==f?void 0:f.valueKey)||"value",A=(null==f?void 0:f.textKey)||"text";null==f||f.children;const P=t.useRef(null),_=t.useRef(null),D=cl(P),[H,M]=t.useState(v),[F,$]=t.useState(!1),q=dl((()=>{M(P.current.offsetHeight-ee.current.offsetHeight-10)}),5);fn((()=>{v||q()}),[D.height]);const[j,K]=t.useState([]),[z,V]=t.useState({}),[W,B]=t.useState([]),[U,Y]=t.useState([]),[X,Q]=t.useState(""),[Z,J]=t.useState(x),ee=t.useRef(null),te=t.useRef([]),ne=t.useRef([]);t.useEffect((()=>{Array.isArray(s)&&(re(s),B(ie(s)),V({}))}),[s]),t.useEffect((()=>{var e;oe(),d&&(null===(e=_.current)||void 0===e||e.focus())}),[]),$i((()=>{oe()}),[null==c?void 0:c.params]),$i((()=>{Y(ae())}),[z]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=Md(j,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],re([...j]))},REMOVE_RECORD:e=>{var t;const n=_d(j,e,L);if(void 0===n&&j.find((t=>t[L]===e)))re(j.filter((t=>t[L]!==e)));else{const r=Md(j,(e=>n===e[L]));if(!r)return;const i=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[L]));i>=0&&(r.children.splice(i,1),re([...j]))}},UPDATE_RECORD:(e,t)=>{const n=Md(j,(t=>e===t[L]));n&&(ve(n,t),re([...j]))}})));const re=e=>{K(e),te.current=e,ne.current=$d(e,L)},ie=e=>{if(a)return y;const t=Hd(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},le=e=>{var t;return(null===(t=qd(j,e,L))||void 0===t?void 0:t.slice(0,-1))||[]},ae=()=>{if(x)return ne.current;const e=[];return W.forEach((t=>{if(a){if("SHOW_ALL"===h&&!ne.current.includes(t)&&e.push(...le(t)),"SHOW_CHILD"===h&&e.push(...le(t)),"SHOW_PARENT"===h){const n=Ya(j,t);if(n){const r=le(t),i=jd(n,L);e.push(...r,...[t,...i].filter((e=>ne.current.includes(e))))}}}else e.push(...le(t))})),[...new Set([...b,...e])]},oe=()=>Mn(void 0,void 0,void 0,(function*(){var e;if(!c)return;const{api:t,params:n,dataKey:r,afterFetch:i,callback:l}=c;try{$(!0);const a=yield t(n);if(200===a.code){let t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,re(t),B(ie(t)),V({}),null==l||l(t)}}catch(e){}$(!1)})),se=e=>`${e}|${po.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ce=ar("search-tree"),de={[ce]:!0,[`${ce}--lg`]:"large"===R,[`${ce}--sm`]:"small"===R};return t.createElement("div",{ref:P,className:_e(de,r),style:i},t.createElement("div",{ref:ee,className:"topper"},E&&t.createElement(O,{ref:_,value:X,size:R,placeholder:m||k("qm.form.inputPlaceholder"),suffix:t.createElement(Ge,null),allowClear:!0,onChange:e=>(e=>{if(!l)return;const t=Dd(te.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==se(n).indexOf(e)}));Q(e),K(t),Y(x||e?$d(t,L):ae())})(e.target.value)}),w&&t.createElement("a",{className:"trigger",onClick:()=>{J(!Z),Y(Z?[]:ne.current)}},Z?t.createElement(De,null):t.createElement(He,null)," ",k(Z?"qm.form.collect":"qm.form.spread"))),t.createElement(rl,{spinning:F},t.createElement(G,{fieldNames:{title:A,key:L,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:H,disabled:e.disabled,checkStrictly:p,selectedKeys:null!=g?g:W,checkedKeys:null!=g?g:W,expandedKeys:U,treeData:j,loadData:u?({key:e,children:t})=>Mn(void 0,void 0,void 0,(function*(){var n;if(!c||t)return;const{api:r,params:i,dataKey:l,formatter:a=(e=>e),afterFetch:o}=c;try{const t=yield r(a(Object.assign(Object.assign({},i),{[L]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,l))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const i=Fd(te.current,e,L,r);re(i)}}catch(e){}})):void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!X)return!1;const t=e[A]||"";return-1!==se(t).indexOf(X)},onDragStart:N,onDragEnter:e=>{Y(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),i=e.dropPosition-Number(r[r.length-1]),l=(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&&l(e[r].children,t,n)}},a=[...j];let o;if(l(a,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)l(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];l(a,t,((t,r,i)=>{n=i,e=r})),-1===i?n.splice(e,0,o):n.splice(e+1,0,o)}else l(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(a)},onDragEnd:e=>{null==T||T(e,j)},onExpand:(e,t)=>{Yn(e)&&J(!1),ne.current.every((t=>e.includes(t)))&&J(!0),Y(e),null==I||I(e,t)},onSelect:e=>{B(e);const t=Hd(te.current,(t=>e.includes(ue(t,L))));null==C||C(a?t:t[0])},onCheck:e=>{p&&(e=e.checked),B(e),p||("SHOW_CHILD"===h&&(e=e.filter((e=>!ne.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,n)=>!n.includes(_d(j,e,L))))));const t=Hd(te.current,(t=>e.includes(ue(t,L))));null==S||S(a?t:t[0])}})))}));Kd.displayName="QmSearchTree";const zd=n(void 0),Vd={dataIndex:Bt.string.isRequired,title:Bt.string.isRequired,description:Bt.string,colSpan:Bt.number,width:Bt.number,minWidth:Bt.number,fixed:Bt.oneOf(["left","right"]),align:Bt.oneOf(["left","center","right"]),theadAlign:Bt.oneOf(["left","center","right"]),printFixed:Bt.bool,hidden:Bt.bool,noAuth:Bt.bool,noFixed:Bt.bool,ellipsis:Bt.bool,className:Bt.string,theadClassName:Bt.string,children:Bt.array,sorter:Bt.oneOfType([Bt.bool,Bt.func]),filter:Bt.shape({type:Bt.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Bt.arrayOf(Bt.shape({text:Bt.string,value:Bt.oneOfType([Bt.string,Bt.number])})),style:Bt.object}),precision:Bt.number,displayPrecision:Bt.number,formatType:Bt.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Bt.bool,canCopy:Bt.bool,editRender:Bt.func,dictItems:Bt.arrayOf(Bt.shape({text:Bt.string,value:Bt.oneOfType([Bt.string,Bt.number])})),summation:Bt.shape({sumBySelection:Bt.bool,displayWhenNotSelect:Bt.bool,dataKey:Bt.string,unit:Bt.string,render:Bt.func}),groupSummary:Bt.shape({dataKey:Bt.string,unit:Bt.string,render:Bt.func}),shouldCellUpdate:Bt.func,headRender:Bt.func,render:Bt.func};Bt.arrayOf(Bt.shape(Vd)).isRequired,Bt.func,Bt.array,Bt.oneOfType([Bt.string,Bt.func]).isRequired,Bt.number,Bt.bool,Bt.bool,Bt.shape({api:Bt.func.isRequired,params:Bt.object.isRequired,formatter:Bt.func,beforeFetch:Bt.func,afterFetch:Bt.func,stopToFirst:Bt.bool,dataKey:Bt.string,callback:Bt.func}),Bt.bool,Bt.bool,Bt.string,Bt.string,Bt.object,Bt.bool,Bt.bool,Bt.bool,Bt.oneOfType([Bt.object,Bt.func]),Bt.oneOfType([Bt.object,Bt.func]),Bt.array,Bt.func,Bt.bool,Bt.object,Bt.object,Bt.shape({type:Bt.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Bt.array,selectedRowKeys:Bt.array,hideSelectAll:Bt.bool,checkStrictly:Bt.bool,filterable:Bt.bool,selectByClickRow:Bt.bool,selectFirstRowOnChange:Bt.bool,clearableAfterFetched:Bt.bool,selectAllOnCurrentPage:Bt.bool,fetchSelectedRows:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),fetchAllRowKeys:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),disabled:Bt.func,onChange:Bt.func,onSelect:Bt.func,onSelectAll:Bt.func}),Bt.shape({currentRowKey:Bt.oneOfType([Bt.number,Bt.string]),disabled:Bt.func,onChange:Bt.func}),Bt.shape({virtual:Bt.bool,overscan:Bt.number,doubleXScrollbar:Bt.bool}),Bt.shape({expandIconColumn:Bt.string}),Bt.shape({defaultExpandAllRows:Bt.bool,defaultExpandedRowKeys:Bt.array,expandedRowKeys:Bt.array,hideExpandAll:Bt.bool,rowExpandable:Bt.func,expandedRowClassName:Bt.string,expandedRowRender:Bt.func,onExpand:Bt.func,onChange:Bt.func}),Bt.shape({cellMerge:Bt.bool,onCellMerge:Bt.func,onSelectChange:Bt.func}),Bt.shape({groupItems:Bt.arrayOf(Bt.shape({dataIndex:Bt.string.isRequired,titleIndex:Bt.string,color:Bt.string,backgroundColor:Bt.string})),fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),onChange:Bt.func}),Bt.func,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.shape({current:Bt.number,pageSize:Bt.number,pageSizeOptions:Bt.array,showSizeChanger:Bt.bool,showQuickJumper:Bt.bool}),Bt.shape({fileName:Bt.string,fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object}),beforeExport:Bt.func,cellStyle:Bt.bool,hideIcon:Bt.bool}),Bt.shape({showLogo:Bt.bool}),Bt.shape({fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),fieldList:Bt.arrayOf(Bt.object)}),Bt.shape({position:Bt.oneOf(["top","bottom"]),hideAlert:Bt.bool,hideClearButton:Bt.bool}),Bt.oneOf(["left","right"]),Bt.func,Bt.func,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func;const Wd={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},Bd=10,Ud="1",Gd="0",Yd="YYYY-MM-DD",Xd="YYYY-MM-DD HH:mm:ss",Qd="YYYYMMDDHHmmss",Zd={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Jd;!function(e){e.left="flex-start",e.right="flex-end"}(Jd||(Jd={}));const eu=Object.assign({},e).useId;let tu=0;var nu=eu?function(e){const t=eu();return e||t}:function(t){const[n]=e.useState(`qm_unique_${tu}`);return e.useEffect((()=>{tu+=1}),[]),t||n};let ru=[];const iu={_getInstance:function(e){var t;return null!==(t=ru.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=ru[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==ru.findIndex((e=>e===t))&&(this.deregister(e),ru=[t,...ru])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),ru=[{id:e,vm:t},...ru])},deregister:function(e){e&&(ru=ru.filter((t=>t.id!==e)))}};class lu{constructor(){this.state={required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]},this.addToRequired=e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)},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)},this.addToValidate=e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)},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)},this.addToEdited=e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)},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)},this.addToInserted=e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)},this.removeFromInserted=e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)},this.addToUpdated=e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)},this.removeFromUpdated=e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)},this.addToRemoved=e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)},this.removeFromRemoved=e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)},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)}}const au={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 ou(e){return void 0!==e}function su(t,n){const{defaultValue:r,value:i,onChange:l,postState:a}=n||{},[o,s]=e.useState((()=>ou(i)?i:ou(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=ou(i)?i:o,d=a?a(c):c,u=$n(l),[p,h]=e.useState([c]);fn((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),fn((()=>{ou(i)||s(i)}),[i]);return[d,$n((e=>{s(e),h([c])}))]}const cu=e=>e.map((e=>{const t=Object.assign({},e);return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=cu(t.children)),t})),du=(e,n)=>{const{fetch:r,columns:i,border:l,rowSelection:a,summation:o,expandable:s,treeConfig:c,webPagination:d,scrollPagination:u,showSuperSearch:p,showFastSearch:h,showGroupSummary:m,showTableImport:f,showClipboard:g,showSelectCollection:v,showPivotGrid:y,footRender:b}=e,{tableRef:x,getRowKey:E,tableFullData:w,tableFlatData:C,selectionKeys:S,sorter:N,filters:T,superFilters:I,pagination:R,mergedTdCells:O}=n,{selectionRows:k,summaries:L}=x.current,{expandIconColumn:A=""}=c||{},{t:P}=Fn(),_=e=>{const t=(e=>{const t=[],n=[],r=[];for(let i=0;i<e.length;i++){const l=e[i];"left"===l.fixed?t.push(l):"right"===l.fixed?n.push(l):r.push(l)}return[...t,...r,...n]})(cu(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:au.selectionColumn,title:"radio"===t?P("qm.table.config.selectionText"):"",width:au.selectionColumnWidth,fixed:"left",type:t}})(a),r=(null==(i=s)?void 0:i.expandedRowRender)?{dataIndex:au.expandableColumn,title:"",width:au.selectionColumnWidth,fixed:"left",type:"expand"}:null;var i;return n&&t.unshift(n),r&&t.unshift(r),Gl(t)},D=(e,t,n,r,i)=>{const l=`${t},${n}`;e.has(l)||e.set(l,{row:t,col:n,rowSpan:r,colSpan:i})},H=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),M=t.useMemo((()=>!H&&!!d),[H,d]),F=t.useMemo((()=>H&&!!u),[H,u]),$=t.useMemo((()=>(H||M)&&!F),[H,M,F]),q=t.useMemo((()=>_(i)),[i]),j=t.useMemo((()=>Ul(q)),[q]),K=t.useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),z=t.useMemo((()=>j.filter((e=>!!e.summation))),[j]),V=t.useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),W=t.useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),B=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=C.findIndex((t=>E(t,t.index)===e.rowKey)),r=j.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){D(t,n,r,e.rowSpan,e.colSpan);for(let i=0;i<e.rowSpan;i++)for(let l=0;l<e.colSpan;l++)0===i&&0===l||D(t,n+i,r+l,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(O)),[O,j,w]),U=t.useMemo((()=>{var e,t;const n=j.filter((e=>![au.expandableColumn,au.selectionColumn,au.operationColumn].includes(e.dataIndex)));return A&&n.some((e=>e.dataIndex===A))?A:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[j,A]),G=t.useMemo((()=>z.length>0),[z]),Y=t.useMemo((()=>!!b||G),[b,G]),X=t.useMemo((()=>ia(q).length>1),[q]),Q=t.useMemo((()=>l||X),[l,X]),Z=t.useMemo((()=>j.some((e=>e.sorter))),[j]),J=t.useMemo((()=>j.some((e=>e.filter))),[j]),ee=t.useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),te=t.useMemo((()=>!H&&!!f),[H,f]),ne=t.useMemo((()=>!!g&&K.length>0),[g,K]),re=t.useMemo((()=>!!v&&"checkbox"===(null==a?void 0:a.type)),[v,a]),ie=t.useMemo((()=>!!p&&J),[p,J]),le=t.useMemo((()=>!H&&!!h&&J),[H,h,J]),ae=t.useMemo((()=>!H&&!!y),[H,y]),oe=t.useMemo((()=>!!m&&j.some((e=>!!e.groupSummary))),[j]),se=t.useMemo((()=>{var e;return!!(null===(e=null==o?void 0:o.groupItems)||void 0===e?void 0:e.length)}),[o]),ce=t.useMemo((()=>!C.length),[C]),de=t.useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:i,summation:l}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=l,c=se?Ea(x.current.tableFullData):x.current.tableFullData,d=!k.length&&!!o;let u=(!a||d?c:k).reduce(((e,t)=>{if(null==t?void 0:t[au.summaryIgnore])return e;const r=da(t,n);return ha(r)?e.plus(r):e}),new Gt(0));!Object.keys(L).includes(n)||a&&!d||(u=new Gt(da(L,n))),ua(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=fa(p,i)),p=ma(p),ua(e,`${n}_text`,s?`${p} ${s}`:p)})),[e]})()),[C,S,L]),ue=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),pe=t.useMemo((()=>{var e;const t=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(N),n=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,i]=t.split("|"),l=e[t];Object.keys(l).forEach((e=>{n.push({type:i,bracketLeft:"",fieldName:r,expression:e,value:l[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{n.push({type: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})(T,I),i=t?{[au.sorterFieldName]:t}:null,l=n.length?{[au.filterFieldName]:n}:null,a=ue?{[au.groupSummary.summaryFieldName]:ue,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[au.currentPageName]:R.current,[au.pageSizeName]:R.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i),l),a),o),s)}),[null==r?void 0:r.params,R.current,R.pageSize,N,T,I,ue]);return{isFetch:H,isWebPagination:M,isScrollPagination:F,showPagination:$,tableColumns:q,flattenColumns:j,editableColumns:K,summationColumns:z,leftFixedColumns:V,rightFixedColumns:W,derivedMergeCells:B,treeExpandIndex:U,showSummary:G,showFooter:Y,isHeadGroup:X,bordered:Q,isHeadSorter:Z,isHeadFilter:J,isServiceSummation:ee,isSelectCollection:re,isTableImport:te,isTableClipboard:ne,isSuperSearch:ie,isFastSearch:le,isPivotGrid:ae,isGroupSummary:oe,isGroupSubtotal:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}},uu=(e,n)=>{const{rowKey:r,height:i,dataSource:l,summation:a,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,authConfig:h,ignorePageIndex:m,columnsChange:f,onChange:g,onDataChange:v,onDataLoad:y,onScrollEnd:b,onFetchError:x}=e,{getRowKey:E,tableRef:w,tableElementRef:C,tableBodyRef:S,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:A,superFilters:P,fetchParams:_,selectionKeys:D,rowExpandedKeys:H,highlightKey:M,summationColumns:F,isFetch:$,isWebPagination:q,isScrollPagination:j,isServiceSummation:K,isGroupSubtotal:z,doLayout:V,setTableFullData:W,setTableOriginData:B,setTableFlatData:U,setAllTableData:G,setDeriveRowKeys:Y,setPagination:X,setPingRight:Q,setPingLeft:Z,setSpinning:J,setSorter:ee,setFilters:te,setSuperFilters:ne,setSelectionKeys:re,setRowExpandedKeys:ie,setHighlightKey:le,setSelectionRows:ae,setScrollXLoad:oe,setScrollYLoad:se,setFieldAuth:ce,setResizeState:de,setSummaries:pe,setPermission:he,setRecordsMap:me,resetTableScroll:fe,clearElementStore:ge,clearRecordsMap:ve}=n,{t:ye}=Fn(),{store:be}=w.current,Ee=t.useRef(Object.assign({},_)),we=t.useRef(!1),Ce=cl(C);fn((()=>{Oe(),V()}),[T]),fn((()=>{Se()}),[Ce,N,i,k.tableAutoHeight]),$i((()=>{at(),ot(),st(),$||(q&&Je(),Ue(l)),s&&ee(s),c&&te(c)}),[l,null==o?void 0:o.params]),$i((()=>{const e=Ke(_,Ee.current);e||$&&(null==d?void 0:d.clearableAfterFetched)&&ct(),!e&&_[au.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?Je():$&&We(),Ee.current=_}),[_]),$i((()=>{q&&nt(),j||fe(),$e()}),[O.current,O.pageSize]),$i((()=>{$||Te(R.length),V()}),[R]),$i((()=>{w.current.isTreeTable&&nt()}),[H]);const Se=()=>{const{scrollBarRef:e,resizeState:t}=w.current,{width:n,height:r}=Ce;V(),k.tableBodyWidth>n&&Q(!0),e.current.scrollLeft>0&&Z(!0),de(Object.assign({},t,{width:n,height:r}))},Ne=()=>{M&&S.current.setClickedValues([M,""]),"radio"===(null==d?void 0:d.type)&&D.length&&S.current.setClickedValues([D[0],""])},Te=e=>{e!==O.total&&X((t=>Object.assign({},t,{total:e})))},Ie=e=>{we.current=e},Re=dl((e=>{Xe(),null==b||b(e)})),Oe=()=>{oe(I.length>au.virtualScrollX)},ke=(e=[])=>{let t=e.length>au.virtualScrollY;w.current.isTreeTable&&(t=!0),(null==p?void 0:p.virtual)&&(t=!0),se(t)},Le=e=>z?Ae(Pe(e,0)):e,Ae=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ae(e.children)),delete e.children,t.push(e)})),t},Pe=(e,t)=>{var n;const i=null===(n=a.groupItems)||void 0===n?void 0:n[t];if(!i)return e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e;return Ca(e,[i.dataIndex]).map((e=>{const n={children:Pe(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&ua(n,r.toString(),ya()),i.titleIndex&&ua(n,i.titleIndex,da(e[0],i.titleIndex)),ua(n,i.dataIndex,da(e[0],i.dataIndex)),F.forEach((e=>{var t;const{dataIndex:r}=e,i=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[au.summaryIgnore])return e;const n=Number(da(t,r));return Number.isNaN(n)?e:e+n}),0);ua(n,r,i)})),n}))},_e=e=>{re(e),ae((e=>{const{selectionRows:t,recordsMap:n}=w.current,r=new Map;t.forEach((e=>r.set(E(e,e.index),e)));const i=[];for(let t=0,l=e.length;t<l;t++){const l=r.get(e[t])||n.get(e[t]);l&&i.push(l)}return i})(e))},De=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:D;let i=[];return w.current.isTreeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:l}=w.current,a=ta(i,e);let o=[];if(!a)return o;let s=Me((null==a?void 0:a.children)||[]);return r&&(s=s.filter((e=>!l.has(e)||!r(l.get(e))))),o=[...new Set([...t,...s])],((null===(n=Na(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=ta(i,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,r))})),i="radio"===t?r.slice(0,1):[...new Set([...r,...i])],i},He=e=>{const{isTreeTable:t,allRowKeys:n,allParentRowKeys:r,deriveRowKeys:i,recordsMap:l}=w.current,{defaultExpandAllRows:a,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:H;if(a)c=(t?r:n).slice(0);else if(t){s&&nr("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];M&&e.unshift(M),e.forEach((e=>{const t=Na(i,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)})),c=[...new Set(c)]}return o&&c.filter((e=>{const t=l.get(e);return!!t&&o(t)})),c},Me=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...Me(e[n].children)),t.push(e[n].rowKey);return t},Fe=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Fe(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...Fe(e,n[n.length-1])),n},$e=dl((()=>{null==g||g(O,je(L),qe(A),P,{currentDataSource:tt()})})),qe=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},je=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},Ke=(e,t)=>{const n=Object.keys(ca(e,t));return 1===n.length&&(n.includes(au.currentPageName)||n.includes(au.pageSizeName))},ze=()=>Mn(void 0,void 0,void 0,(function*(){var t;if(!h)return;let n=Qn(h,["fetch"]);if(h.fetch){const{api:e,params:r,dataKey:i}=h.fetch;try{const l=yield e(r);200===l.code&&(n=null!==(t=i?ue(l.data,i):l.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;he((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=Xl(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:i,secretName:l}=r,a=Ql(w.current.originColumns,t);ce(t,{visible:n,disabled:i,secretName:l}),n||(e.noAuth=!0,a.noAuth=!0),l&&(e.formatType=`secret-${l}`,a.formatType=`secret-${l}`)}}));null==f||f(t)}})),Ve=()=>Mn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:i=Wn,afterFetch:l,callback:s}=o;if(!i(_))return;const c=!!(null===(e=null==a?void 0:a.fetch)||void 0===e?void 0:e.api);J(!0);try{const[e,i]=c?yield Promise.all([o.api(r(_)),a.fetch.api(r(_))]):[yield o.api(r(_))];if(w.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:au.dataKey;let a=null!==(n=ue(e.data,r))&&void 0!==n?n:[];a="function"==typeof l?yield l(a):a;const c=ue(e.data,r.replace(/[^.]+$/,au.totalKey))||a.length||0,d=Math.max(Math.ceil(c/O.pageSize),1);if(_[au.currentPageName]>d)return Qe(Object.assign(Object.assign({},O),{current:d}));Ue(we.current?w.current.tableFullData.concat(a):a),Te(c),Ge((null==i?void 0:i.data)||e.data),null==s||s(e.data,e)}}catch(e){null==x||x(e)}var d,u;d=o,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(o.stopToFirst=!1),J(!1),Ie(!1)})),We=dl(Ve),Be=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Be(e.children)),e.index=t,m||(e.pageIndex=(e=>{const{current:t,pageSize:n}=O;return!$||j?e:(t-1)*n+e})(t)),e))),Ue=e=>{const t=Le(Be(e));rt(t),it(t),_e(De()),ie(He()),Ye(),null==y||y(t)},Ge=e=>{var t,n,r;if(!K)return;const i=null!==(n=null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:au.summationKey,l=null!==(r=i?ue(e,i):e)&&void 0!==r?r:{},o={};F.filter((e=>!!e.summation.dataKey)).forEach((e=>{ua(o,e.dataIndex,Number(da(l,e.summation.dataKey)))})),pe(o)},Ye=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=tt();if(e.length){const t=E(e[0],e[0].index);_e([t])}else _e([])}},Xe=()=>{if(!j)return;const e=Ze();we.current||O.current>=e||(Ie(!0),Qe(Object.assign(Object.assign({},O),{current:O.current+1})))},Qe=({current:e,pageSize:t})=>{X((n=>Object.assign({},n,{current:e,pageSize:t})))},Ze=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Je=()=>{Qe(Object.assign({},O,{current:1}))},et=()=>{const{current:e,pageSize:t}=O;return w.current.tableFullData.slice((e-1)*t,e*t)},tt=()=>q?et():w.current.tableFullData,nt=()=>{const{allTableData:e,isTreeTable:t}=w.current,n=q?na(et()):e,r=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=E(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;ke(r),U(r)},rt=e=>{W(e),G(e),Y(e),lt(),nt()},it=e=>{B(e)},lt=()=>{ve(),w.current.allTableData.forEach((e=>me(E(e,e.index),e)))},at=()=>{ee({})},ot=()=>{te({})},st=()=>{ne([])},ct=()=>{_e([])};return{initialTable:()=>{ze(),Ne(),Oe(),ke(),$?Ve():Ue(l)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&nr("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:rt,getTableData:Ve,createTableList:tt,createTableData:Ue,createGroupData:Le,createSelectionKeys:De,createRowExpandedKeys:He,setSelectionKeysEffect:_e,findParentRowKeys:Fe,getAllChildRowKeys:Me,doFieldValidate:(e,t,n,r,i)=>{if(!Array.isArray(e))return nr("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(be.removeFromRequired({x:n,y:r}),be.removeFromValidate({x:n,y:r}),e.forEach((e=>{var l;e.required&&Yn(t)&&be.addToRequired({x:n,y:r,text:e.message||i+ye("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(l=e.validator)||void 0===l?void 0:l.call(e,t))||be.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:i}=be.state,l=xe(n,i),a=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:a(e),validate:a(t),inserted:n.filter((e=>!l.includes(e))),updated:r.filter((e=>![...xe(r,n),...xe(r,i)].includes(e))),removed:i.filter((e=>!l.includes(e)))}},dataChange:()=>{null==v||v(w.current.tableFullData)},tableChange:$e,toLastPage:()=>{const e=Ze();O.current!==e&&Qe(Object.assign({},O,{current:e}))},toFirstPage:Je,getPageCount:Ze,pagerChangeHandle:Qe,scrollBottomDebouncer:Re,clearTableSorter:at,clearTableFilter:ot,clearSuperFilters:st,clearRowSelection:ct,clearRowHighlight:()=>{le("")},clearTableLog:()=>{be.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;ge(),be.destroy(),e.deregister(t)}}},pu=(e,n)=>{const{height:r,minHeight:i,maxHeight:l,ellipsis:a,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:p,tableBodyRef:h,$size:m,tableColumns:f,flattenColumns:g,leftFixedColumns:v,derivedMergeCells:y,tableFlatData:b,layout:x,showFooter:E,showPagination:w,isFullScreen:C,setLayout:S,setElementStore:N,setShouldToTop:T}=n,I=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,n={};return i&&Object.assign(n,{minHeight:`${sa(i)}px`}),l&&Object.assign(n,{maxHeight:`${sa(l)}px`}),C?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${sa(r)}px`:`${t}px`}):n}),[r,l,i,C,x]),R=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r,rowHeight:i}=d.current;if(void 0!==t&&t>=0)if(t<b.length)if(r)h.current.scrollToYIndex(t);else{const e=O(c(b[t],b[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*i);else if(r){const t=b.findIndex((t=>e===c(t,t.index)));t>=0&&h.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",p.current)},tableStyles:I,getSpan:(e,t,n,r,i)=>{let l=1,a=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(o)?(l=o[0],a=o[1]):ae(o)&&(l=o.rowSpan,a=o.colSpan)}if(y.length>0){const e=y.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,a=e.colSpan)}return{rowSpan:l,colSpan:a}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=Ql(f,e);e=t?Zl(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=Ql(f,e);e=t?Jl(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 i=n[t];if(i.dataIndex===e)break;r+=i.width||i.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,i=v.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),l=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(l-i)},scrollYToRecord:R,calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(w?Oo["small"!==m?"middle":m]+Bd:0)-Bd;S((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{d.current.shouldToTop&&R("",0),T(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=au,i=[];let l=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,l+=e.width):(e.renderWidth=void 0,i.push(e))})),i.length>0){const e=g.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===i.length)i[0].renderWidth=(i[0].minWidth||r)+t;else{const e=t/i.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;i.forEach(((t,i)=>{if(0===i)return;const l=Math.floor((t.minWidth||r)*e);n+=l,t.renderWidth=(t.minWidth||r)+l})),i[0].renderWidth=(i[0].minWidth||r)+t-n}}else i.forEach((e=>{e.renderWidth=e.minWidth||r}));S((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else l=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>Object.assign(Object.assign({},e),{tableBodyWidth:l})));S((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&h.current.resetItemXSize(g)})(),Un((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,i=o?e.$header.offsetHeight:x.headerHeight,l=E?e.$footer.offsetHeight:x.footerHeight,a=r-i-l,s=e.$tableBody.offsetHeight;let c=0;if(C){const t=e.$toper?e.$toper.offsetHeight+Bd:0,r=e.$pager?e.$pager.offsetHeight+Bd:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:i,footerHeight:l,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function hu({handler:t,delay:n=0}){const r=wl(t,n),i=$n(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",i),()=>window.removeEventListener("resize",i))),[i])}const mu=e=>{const{total:n}=e,{tableRef:r,prefixCls:i,selectionKeys:l,isHeadSorter:a,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=t.useContext(zd),{infoBarConfig:h,rowSelection:m,rowHighlight:f}=r.current.props,{allTableData:g,invalidRowKeys:v}=r.current,{hideAlert:y,hideClearButton:b}=h||{},{t:x}=Fn(),E=t.useMemo((()=>!y),[y]),w=t.useMemo((()=>!b&&!!(a||o||m||f)),[b,a,o,m,f]),C={[`${i}__alert`]:!0};return E?t.createElement("div",{className:_e(C)},t.createElement("i",{className:"svgicon icon"},t.createElement(rt,null)),t.createElement("span",null,x("qm.table.alert.total",{total:r.current.isTreeTable?g.length:n}),m?`,${x("qm.table.alert.selected",{total:Math.max(l.length-v.length,0)})}`:""),w&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),Un((()=>s()))}},x("qm.table.alert.clear"))):null},fu=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{prefixCls:l,setFullScreen:a}=t.useContext(zd),{t:o}=Fn(),s=()=>{a(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),i?t.createElement("span",{className:`${l}-full-screen`,title:o(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(Ve,null):t.createElement(We,null))):null}));fu.displayName="FullScreen";const gu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,getTableData:l}=t.useContext(zd),{t:a}=Fn(),o=()=>{l()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${i}-reload`,title:a("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null))):null}));gu.displayName="Reload";const vu=()=>{const e={dateFormat:e=>{const t=e?h(e).format(Yd):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?h(e).format(Xd):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?h(e).format(Xd.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>ha(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>ma(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)=>{var i,l,a,o;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:p}=n,h=s||(null===(i=null==p?void 0:p(r,n))||void 0===i?void 0:i.items)||[];let m=null!==(o=null!==(a=null===(l=h.find((e=>e.value==t)))||void 0===l?void 0:l.text)&&void 0!==a?a:t)&&void 0!==o?o:"";if(Array.isArray(t)&&(m=t.map((e=>{var t,n;return null!==(n=null===(t=h.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),c>=0&&""!==m&&(m=ha(m)?new Gt(m).toFixed(c):m),d>=0&&""!==m&&(m=fa(m,d)),u){const t=e[`${Gn(u)}Format`];t?m=t(m):nr("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>Kn(e)?ba(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,l)=>{const a=da(e,r.dataIndex),o=r.render?r.render(a,e,r,i,l):t(a,r,e);return n(o)}}},yu=t.forwardRef(((e,n)=>{var r,i,l,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(sn),{tableRef:d,prefixCls:u,flattenColumns:p,summationRows:h,showSummary:m,getSpan:f}=t.useContext(zd),{tablePrint:g,showHeader:v}=d.current.props,{t:y}=Fn(),{getTitleFromCellValue:b}=vu(),x=null!==(i=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==i?i:"",E=null!==(a=null===(l=null==c?void 0:c.print)||void 0===l?void 0:l.rightLogo)&&void 0!==a?a:"",w=!(!x&&!E),C=t.useMemo((()=>Zn(ea(o,[au.expandableColumn,au.selectionColumn,au.operationColumn]))),[o]),S=t.useMemo((()=>Zn(ea(p,[au.expandableColumn,au.selectionColumn,au.operationColumn]))),[p]),N=t.useMemo((()=>Zn(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},Sa(C,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?T(t):t},I=(e,t)=>Ee(we(Ce(e),t),Se(((...e)=>Ne(...e,((e,n)=>{if(Array.isArray(e))return I(e.concat(n),t)}))))),R=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(T(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]:I(n,"dataIndex")[0]})))(n),t.push(ia(n))})),t},O=()=>{const e=(e=>{const t=[];let n=[],r=0,i=0;for(;i<e.length;){const l=e[i];r+=l.width||l.renderWidth,r<=au.printWidth?(n.push(l),i===e.length-1&&t.push(n),i++):i>0?(e.splice(0,i),N.length&&e.unshift(...N),t.push(n),n=[],r=0,i=0):(l.width=au.printWidth,n.push(l),t.push(n),i++)}return t})([...S]),t=R(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+=k(t[r],e[r],d.current.tableFullData),n+='<div class="page-break"></div>';return n+"</body></html>"},k=(e,t,n)=>{const{showLogo:r=!0}=g;let i='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,v&&(i+=["<thead>",r&&w?`<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">',x?`<img src="${x}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',E?`<img src="${E}" 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}">${xa(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${na(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:i,colSpan:l}=f(e,t,e.index,r,n);if(!i||!l)return null;return`<td rowspan="${i}" colspan="${l}">${0===r&&e._level?`<span style="padding-left:${e._level*au.treeTable.textIndent}px"></span>`:""}${b(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),m&&h.length&&(i+=["<tfoot>",h.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:i,summation:l}=t,a=(null==l?void 0:l.render)?l.render(n):da(e,`${i}_text`);return`<td>${0===r&&""===a?y("qm.table.config.summaryText"):Kn(a)?ba(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},L=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:i}=e,l=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!i)return Promise.resolve({type:r,content:t,blob:e});gl(e,l)}})({filename:"print",type:"html",isDownload:!1},O()))||void 0===e||e.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),d.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 t.useImperativeHandle(n,(()=>({clickHandle:L}))),s?t.createElement("span",{className:`${u}-print`,title:y("qm.table.print.text"),onClick:()=>L()},t.createElement("i",{className:"svgicon icon"},t.createElement(it,null))):null}));yu.displayName="TablePrint";const bu="606060",xu="thin",Eu="d4d4d4",wu=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Cu=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Su=()=>({top:{style:xu,color:{argb:Eu}},left:{style:xu,color:{argb:Eu}},bottom:{style:xu,color:{argb:Eu}},right:{style:xu,color:{argb:Eu}}}),Nu=e=>{const{children:t}=e;return t&&t.length?Nu(t[0]):e},Tu=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},Iu=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:i}=t.useContext(zd),{spanMethod:l,showHeader:a}=e.current.props,{t:o}=Fn(),s=(e,t)=>{var n,r,i;return null!==(i=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==i?i:""};return{exportXLSX:(t,s,c,d)=>Mn(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:p}=t,{rowHeight:h}=e.current,m=Ul(u),f=ia(u),g=[],v=[],y=[],b=[];let x=0;const E={};m.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;E[t]=xa(e.title),y.push({key:t,width:(n||r||au.defaultColumnWidth)/8})})),a&&(i?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,l=Nu(e),a=m.findIndex((({dataIndex:e})=>e===l.dataIndex));n[l.dataIndex]=xa(e.title),0!==r&&(r>1||i>1)&&b.push({s:{r:t,c:a},e:{r:t+i-1,c:a+r-1}})})),g.push(n)})):(m.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&b.push({s:{r:x,c:t},e:{r:x+r-1,c:t+n-1}})})),g.push(E)),x+=g.length);const w=na(s).map(((e,t)=>{const r={};return m.forEach(((i,a)=>{if("function"==typeof l){const{rowSpan:r,colSpan:l}=n(e,i,t,a,s);(l>1||r>1)&&b.push({s:{r:t+x,c:a},e:{r:t+x+r-1,c:a+l-1}})}const o=["percent","finance"].includes(i.formatType);r[i.dataIndex]=o?da(e,i.dataIndex):d(e,t,i,a)})),r._level=e._level,r}));x+=w.length,r&&p&&c(m,s).forEach(((e,t)=>{const n={};m.forEach(((t,r)=>{const{dataIndex:i,summation:l}=t,a=(null==l?void 0:l.render)?l.render(s):da(e,i);n[i]=0===r&&""===a?o("qm.table.config.summaryText"):Kn(a)?ba(a).join(""):a})),v.push(n)}));const{sheetName:C,useStyle:S}=t,N=new ln.Workbook,T=N.addWorksheet(C);T.columns=y,a&&T.addRows(g).forEach((e=>{S&&wu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Ql(u,t.key),{align:r,theadAlign:i}=n;Cu(e,i||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:bu}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Su()})}))})),T.addRows(w).forEach(((e,t)=>{const{_level:n}=w[t];S&&wu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),r=Ql(u,t.key),{align:i}=r;Cu(e,i),Object.assign(e,Tu(r)),S&&Object.assign(e,{font:{color:{argb:bu}},border:Su()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),r&&p&&T.addRows(v).forEach((e=>{S&&wu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Ql(u,t.key),{align:r}=n;Cu(e,r),Object.assign(e,Tu(n)),S&&Object.assign(e,{font:{color:{argb:bu}},border:Su()})}))})),b.forEach((({s:e,e:t})=>{T.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const I=yield N.xlsx.writeBuffer();return new Blob([I],{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,i,l,a="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],r=0;r<i.cells.length;r+=1)l=i.cells[r],a=a+(r?",":"")+n(l.textContent.trim());a+="\r\n"}return a})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var i;return((e,t,n)=>{t=t||"",n=n||512;const r=window.atob(e),i=[];let l;for(l=0;l<r.length;l+=n){const e=r.slice(l,l+n),t=new Array(e.length);let a;for(a=0;a<e.length;a+=1)t[a]=e.charCodeAt(a);const o=new window.Uint8Array(t);i.push(o)}return new window.Blob(i,{type:t})})((i=r,window.btoa(unescape(encodeURIComponent(i)))),"application/csv")},importXLSX:(e,t)=>{const{columns:n,file:r}=e,i=Ul(n),l=new FileReader;l.onerror=()=>{R.error(o("qm.table.import.error"))},l.onload=e=>{const n=i.map((e=>xa(e.title))),r=new ln.Workbook,l=e.target;l?r.xlsx.load(l.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),l=e.findIndex((e=>e&&e.length>0)),a=e[l],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,a);if(c){const r=e.slice(l+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let i=e;Array.isArray(null==i?void 0:i.richText)&&(i=i.richText.map((e=>e.text)).join("")),ae(i)&&"text"in i&&(i=i.text),Te(i)&&(i=va(i,Xd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[a[n]]=i}));const r={};return n.forEach(((e,n)=>{var l;const{dataIndex:a,dictItems:o}=i[n];Array.isArray(o)&&((null===(l=t[e])||void 0===l?void 0:l.toString().includes(","))?t[e]=t[e].split(",").map((e=>s(o,e))).filter((e=>""!==e)):t[e]=s(o,t[e])),ua(r,a,t[e])})),r}));null==t||t(r)}else R.error(o("qm.table.import.error"))}else R.error(o("qm.table.import.error"))})):R.error(o("qm.table.import.error"))},l.readAsArrayBuffer(r)}}},Ru=e=>{const{fileType:n,onChange:r}=e,{prefixCls:i}=t.useContext(zd),{t:l}=Fn();let a,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}},c=()=>Mn(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),o=document.createElement("input"),a.className=`${i}--file-form`,o.name="file",o.type="file",a.appendChild(o),document.body.appendChild(a)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=i=>{const{files:c}=i.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?(R.warning(l("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(a),a=null,o=null},a.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(rr,{onClick:()=>c()},l("qm.upload.text"))},Ou=e=>{const{columns:n,onClose:r}=e,{tableRef:i,prefixCls:l,createTableData:a,dataChange:o}=t.useContext(zd),{beforeTableImport:s}=i.current.props,{t:c}=Fn(),{importXLSX:d}=Iu(),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState(!0),g=e=>e.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))),v={posIndex:"条"},[y,b]=t.useState([{type:"INPUT",label:c("qm.table.export.fileName"),fieldName:"fileName",render:(e,n)=>{const{fileName:r}=n.GET_FIELDS_VALUE(["fileName"]);return t.createElement(t.Fragment,null,r?t.createElement("span",null,r):t.createElement(Ru,{fileType:n.state.formData.fileType,onChange:(e,t)=>{n.SET_FIELDS_VALUE({fileName:e,file:t}),t&&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=>{y.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&u.current.SET_FIELDS_EXTRA(v),b([...y])}},{type:"INPUT_NUMBER",label:c("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:i.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]);return t.createElement("div",{className:`${l}-import__setting`},t.createElement(hd,{ref:u,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:v,items:y,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(rr,{type:"primary",loading:p,disabled:m,onClick:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||(h(!0),d({columns:g(n),file:t.file},(e=>Mn(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:l}=i.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&a(e),"add"===t.importType&&a([...n,...e]),"insert"===t.importType){const r=t.posIndex,i=n.slice(0,r).concat(e).concat(n.slice(r));a(i)}e.forEach((e=>{l.addToInserted(e)})),o(),R.success(c("qm.table.import.success",{total:e.length})),h(!1),r()})))))}))},c("qm.table.import.text"))))},ku=t.forwardRef(((e,n)=>{const{tableColumns:r,open:i=!0}=e,{prefixCls:l}=t.useContext(zd),{t:a}=Fn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${l}-import`]:!0},u={visible:o,title:a("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:_e(d),title:a("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(lt,null))),t.createElement(Ll,u,t.createElement(Ou,{columns:r,onClose:()=>s(!1)})))}));ku.displayName="TableImport";const Lu=e=>{const{columns:n,onChange:r}=e,{prefixCls:i,$size:l}=t.useContext(zd),{t:a}=Fn(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);$i((()=>{h()}),[d]),t.useEffect((()=>{p()}),[n]);const p=()=>{const e=[];n.forEach(((t,r)=>{const i=t.colSpan;i>1&&n.slice(r+1,r+i).every((({colSpan:e})=>0===e))&&e.push(n.slice(r,r+i))})),o.current=e},h=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const i=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===i)return e.push(t);e.push(...o.current[i].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),null==r||r(e)},m={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l},f=[`${i}-column-filter`,{selected:s}];return t.createElement(uc,{action:["click"],popupVisible:s,popup:t.createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"main"},t.createElement(rn,{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));he(t,n)||u(Ra(e))}},d.map((e=>((e,n)=>{const{colSpan:r}=e;if(0===r)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${n}-handle`];return t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),t.createElement("i",{className:_e(i),title:a("qm.table.columnFilter.draggable")},t.createElement(Ue,null)),t.createElement("span",{className:"text"},xa(e.title)))})(e,"main")))))),popupClassName:_e(m),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Zd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:_e(f),title:a("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(at,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},Au=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:l,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(zd),{rowSelection:d}=l.current.props,{t:u}=Fn(),p=t.useRef(null),[m,f]=t.useState(!1),g=t.useMemo((()=>Object.assign({},{fileName:`${h().format(Qd)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:c?1:0,useStyle:0},n,{columns:Zn(n.columns||[])})),[]),[v,y]=t.useState([{type:"INPUT",label:u("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:u("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:u("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:u("qm.table.export.all"),value:"all"},{text:u("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==d?void 0:d.type)},{text:u("qm.table.export.custom"),value:"custom"}]},onChange:e=>{v.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,y([...v])}},options:{min:1},disabled:!0},{type:"INPUT",label:u("qm.table.columnFilter.text"),fieldName:"columns",render:(e,n)=>t.createElement(Lu,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:u("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:u("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return t.createElement("div",{className:`${a}-export__setting`},t.createElement(hd,{ref:p,initialValues:g,items:v,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(rr,{type:"primary",loading:m,onClick:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield p.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);i(t),yield Bn(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},Pu=t.forwardRef(((e,n)=>{var r;const{tableColumns:i,open:l=!0}=e,{global:a}=t.useContext(sn),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:p,isGroupSubtotal:m,showSummary:f,getSpan:g}=t.useContext(zd),{exportExcel:v,fetch:y,showHeader:b}=o.current.props,{t:x}=Fn(),{getTitleFromCellValue:E}=vu(),[w,C]=t.useState(!1),[S,N]=t.useState(!1),T=t.useMemo((()=>{var e;return!!(null===(e=null==v?void 0:v.fetch)||void 0===e?void 0:e.api)}),[v]),I=t.useMemo((()=>!d.total||S),[d.total,S]),O=t.useMemo((()=>ea(i,[au.expandableColumn,au.selectionColumn,au.operationColumn])),[i]),k=t.useMemo((()=>ea(c,[au.expandableColumn,au.selectionColumn,au.operationColumn])),[c]),L=(e,t="",n=0)=>e.map(((e,r)=>{const i=Object.assign(Object.assign({},e),{index:r,pageIndex:r}),l=t?`${t}.${i.index+1}`:`${i.index+1}`;return i.indexPath=l,i._level=n,Array.isArray(e.children)&&(i.children=L(e.children,l,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&ua(i,t,da(i,t))})),i})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(m?Ea(t):t).reduce(((e,t)=>{if(null==t?void 0:t[au.summaryIgnore])return e;const n=Number(da(t,r));return Number.isNaN(n)?e:e+n}),0);ua(n,r,i)})),[n]},P=(e,t,n,r)=>{const{precision:i,formatType:l}=n;let a=E(e,n,t,r);return i>=0&&!l&&""!==a&&(a=Number(a)),a},{exportXLSX:_,exportCSV:D}=Iu(),H=e=>Mn(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:i,dataKey:l}=y;let a=[];try{N(!0);const o=yield n(Object.assign(Object.assign({},r(u)),{[au.currentPageName]:1,[au.pageSizeName]:null!=e?e:d.total}));if(200===o.code){let e=Array.isArray(o.data)?o.data:null!==(t=ue(o.data,l))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,a=L(e)}}catch(e){}return N(!1),a})),M=e=>{var t;const n=null===(t=null==a?void 0:a.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},F=(e,t)=>{const{columns:n,footSummation:r}=e,i=ia(n),l=Ul(n);let a='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${l.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,b&&(a+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${xa(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(a+=`<tbody>${na(t).map((e=>`<tr>${l.map(((n,r)=>{const{rowSpan:i,colSpan:l}=g(e,n,e.index,r,t);return i&&l?`<td rowspan="${i}" colspan="${l}">${P(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(a+=["<tfoot>",A(l,t).map((e=>`<tr>${l.map(((n,r)=>{const{dataIndex:i,summation:l}=n,a=(null==l?void 0:l.render)?l.render(t):da(e,i);return`<td>${0===r&&""===a?x("qm.table.config.summaryText"):Kn(a)?ba(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},$=null!==(r=null==v?void 0:v.fileName)&&void 0!==r?r:`${h().format(Qd)}.xlsx`,q=$.slice($.lastIndexOf(".")+1).toLowerCase(),j=()=>{if(I)return R.warning(x("qm.table.export.warnText"));var e;T?(e=$,Mn(void 0,void 0,void 0,(function*(){N(!0);try{const{api:t,params:n}=v.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:i}=e.filter||{};return{title:t,dataIndex:n,type:i,hidden:r}}))},u),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[au.currentPageName]:void 0,[au.pageSizeName]:void 0}));r.data&&(gl(r.data,e),M(e))}catch(e){}N(!1)}))):C(!0)};t.useImperativeHandle(n,(()=>({clickHandle:j})));const K={[`${s}-export`]:!0},z={visible:w,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},V={fileName:$.slice(0,$.lastIndexOf(".")),fileType:q,columns:O,useStyle:(null==v?void 0:v.cellStyle)?1:0};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:_e(K),title:x("qm.table.export.textNoSpace"),onClick:()=>j()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ke,null))),t.createElement(Ll,z,t.createElement(Au,{defaultValue:V,onClose:()=>C(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:Gl(e.columns)}),Mn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:i=1,endIndex:l}=t,{tableFullData:a,selectionRows:s}=o.current;let c=[];if(p?("all"===r&&(c=yield H()),"custom"===r&&(c=yield H(l),c=c.slice(i-1))):("all"===r&&(c=a.slice(0)),"custom"===r&&(c=a.slice(i-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==v?void 0:v.beforeExport))try{c=null==v?void 0:v.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield _(t,c,A,P);gl(n,`${e}.xlsx`),M(`${e}.xlsx`)}if("csv"===n){const n=D(t,F(t,c));gl(n,`${e}.csv`),M(`${e}.csv`)}}))}})))}));Pu.displayName="TableExport";const _u=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:l,prefixCls:a,dataChange:o}=t.useContext(zd),{beforeClipboard:s}=i.current.props,{t:c}=Fn(),d=t.useRef(null),[u,p]=t.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:n.map(((e,t)=>({value:t,text:xa(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}]}]),[h,m]=t.useState(!1);return t.createElement("div",{className:`${a}-clipboard__setting`},t.createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),t.createElement(hd,{ref:d,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:u,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(rr,{type:"primary",loading:h,onClick:()=>Mn(void 0,void 0,void 0,(function*(){var e;const[t,a]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:p,fieldAuth:h}=i.current;m(!0);const f=a.content.trim().replace(/(\r|\n)$/,"");let g=f.replace(/"[^"]+"/g,"^");((null===(e=f.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{g=g.replace(/\^/,e)}));let v=g.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{v=yield s(v,v[0].map(((e,t)=>n[a.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var i,l;const o=u[a.rowIndex-1+t],s=n[a.colIndex+r];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||(null===(i=e.extra)||void 0===i?void 0:i.disabled)||(null===(l=h[s.dataIndex])||void 0===l?void 0:l.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(ua(o,s.dataIndex,e),p.addToUpdated(o))}}))})),l.current.forceUpdate(),o(),R.success(c("qm.table.clipboard.success",{total:v.length})),m(!1),r()}))},c("qm.table.clipboard.text"))))},Du=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,flattenColumns:l}=t.useContext(zd),{t:a}=Fn(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))))(l)),[l]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${i}-clipboard`]:!0},p={visible:o,title:a("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:_e(u),title:a("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(ot,null))),t.createElement(Ll,p,t.createElement(_u,{columns:c,onClose:()=>s(!1)})))}));Du.displayName="TableClipboard";const Hu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:l,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext(zd),{rowKey:s,rowSelection:c}=i.current.props,{t:d}=Fn(),u=t.useRef(null),p=cl(u),h=e=>e.map((e=>{var t;const n={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:null!==(t=e.dictItems)&&void 0!==t?t:[],render:e.render};return Array.isArray(e.children)&&(n.children=h(e.children)),n})),[m,f]=t.useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...h(n.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))))]),[g]=t.useState((()=>{const{disabled:e}=c||{},t=i.current.selectionRows.map((e=>Object.assign(Object.assign({},e),{children:void 0})));return e?t.filter((t=>!e(t))):t})()),[v,y]=t.useState(300),b=dl((()=>{const e=u.current;y(e.offsetHeight-2*Oo[l]-30)}),5);return fn((()=>{b()}),[p.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(Up,{size:l,columns:m,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t.createElement("div",{style:{height:10}}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},Mu=t.forwardRef(((e,n)=>{const{columns:r,open:i=!0}=e,{tableRef:l,getRowKey:a,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:p}=t.useContext(zd),{rowSelection:h}=l.current.props,{t:m}=Fn(),[f,g]=t.useState(!1),v=t.useRef(!1);$i((()=>{!v.current&&y()}),[d]);const y=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=h;if(c&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:s},t.params));if(200===r.code){let i=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];i=i.filter((e=>!n(e))),u(i.map(((e,t)=>a(e,t)))),p(i),v.current=!0}}catch(e){}})),b=()=>{g(!0)};t.useImperativeHandle(n,(()=>({clickHandle:b})));const x={visible:f,title:m("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:`${o}-select-collection`,title:m("qm.table.selectCollection.text"),onClick:()=>b()},t.createElement("i",{className:"svgicon icon"},t.createElement(st,null))),t.createElement(Ll,x,t.createElement(Hu,{columns:r,onClose:()=>g(!1)})))}));Mu.displayName="SelectCollection";const Fu=e=>{const{onClose:n}=e,{global:r}=t.useContext(sn),{tableRef:i,getRowKey:l,prefixCls:a,$size:o,tableFlatData:s,flattenColumns:c,pagination:d,setPagination:u,scrollYToRecord:p,setHighlightKey:h,setShouldToTop:m,isWebPagination:f}=t.useContext(zd),{uniqueKey:g}=i.current.props,{t:v}=Fn(),y=t.useRef(null),b=t.useRef(null),x=t.useRef([]),E=t.useRef(""),w=t.useRef(-1),C=t.useRef("stop");$i((()=>{const e=s.findIndex((e=>l(e,e.index)===E.current));p("",e)}),[d.current]);const S=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},N=e=>e.filter((e=>null==e?void 0:e.dataIndex)).map((e=>{var t;return{type:S(e.filter.type),fieldName:e.dataIndex,label:xa(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:null!==(t=e.dictItems)&&void 0!==t?t:[]},onChange:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield y.current.GET_FORM_DATA(),[n,r]=yield b.current.GET_FORM_DATA(),i=Ie(Object.assign({},t,r),Yn);k(i)}))}})),T={case:0,fullchar:0},I=t.useMemo((()=>c.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[R,k]=t.useState({}),[L,P]=t.useState(T),[_]=t.useState(N([I[0]])),[D]=t.useState(N(I.slice(1))),[H,F]=t.useState(0),$=t.useMemo((()=>!Object.keys(R).length),[R]);$i((()=>{C.current="ready"}),[R,L]);const q=e=>{P(Object.assign({},L,e))},j=(e,t,n)=>new Promise(((r,i)=>{A.confirm({title:v("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),K=e=>Mn(void 0,void 0,void 0,(function*(){if(!Object.keys(R).length)return A.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.queryCondition")});if("ready"===C.current&&(C.current="stop",x.current=(e=>{const{allTableData:t}=i.current,n=[];for(let i=0,l=t.length;i<l;i++){const l=t[i];let a=!0;for(const t in e){const{type:n}=I.find((e=>e.dataIndex===t)).filter;let i=da(l,t),o=!0;if("text"===n||"textarea"===n?o=new RegExp(L.fullchar?`^${e[t]}$`:e[t],L.case?"":"i").test(i):(i="string"==typeof(r=i)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(r)?i.slice(0,10):i,o=i==e[t]),!o){a=!1;break}}a&&n.push(l)}var r;return n})(R),F(x.current.length)),!x.current.length)return h(""),A.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>x.current.length-1&&(yield j(v("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=x.current.length-1)))),"prev"===e&&(w.current=w.current<0?x.current.length-1:w.current-1,w.current<0&&(yield j(v("qm.table.fastSearch.toStart"),(()=>w.current=x.current.length-1),(()=>w.current=0))));const{isTreeTable:t,tableFullData:n,deriveRowKeys:r}=i.current,a=x.current[w.current],o=l(a,a.index);let s=a.index;if(t&&f){const e=Na(r,o)[0];s=n.findIndex((t=>l(t,t.index)===e))}((e,t)=>{if(E.current=e,f){const{pageSize:e}=d,n=Math.ceil((t+1)/e);m(!1),u(Object.assign({},d,{current:n}))}else p(e)})(o,s),h(o)})),z=()=>{y.current.RESET_FORM(),b.current.RESET_FORM()},V=t.useMemo((()=>g?`fastSearch_${g}`:""),[g]),[W,B]=t.useState([]),[U,G]=t.useState(""),[Y,X]=t.useState("");$i((()=>{if(Y){const{filters:e,config:t}=W.find((e=>e.value===Y)).list;y.current.SET_FIELDS_VALUE(Qn(e,D.map((e=>e.fieldName)))),b.current.SET_FIELDS_VALUE(Qn(e,_.map((e=>e.fieldName)))),k(e),P(t)}else z(),k({}),P(T)}),[Y]),t.useEffect((()=>{Q()}),[]);const Q=()=>Mn(void 0,void 0,void 0,(function*(){if(!V)return;let e=yield an.getItem(V);e||(e=yield Z(V),Array.isArray(e)&&(yield an.setItem(V,e))),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))})),Z=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),J=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"top"},t.createElement("div",{className:"container"},t.createElement(Il,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,v("qm.table.alert.total",{total:H}))},t.createElement(Il.TabPane,{tab:v("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t.createElement(hd,{ref:y,items:_,cols:1,labelWidth:110})),t.createElement(Il.TabPane,{tab:v("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t.createElement(hd,{ref:b,items:D,cols:1,labelWidth:110})))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:o,value:U,placeholder:v("qm.table.highSearch.configText"),disabled:$,onChange:e=>{const{value:t}=e.target;G(t)}}),t.createElement(rr,{type:"primary",disabled:!U||$,style:{marginLeft:"10px"},onClick:()=>Mn(void 0,void 0,void 0,(function*(){if(!V)return nr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ya(),t=[...W,{text:U,value:e,list:{filters:R,config:L}}];B(t),X(e),G(""),yield an.setItem(V,t),yield J(V,t)}))},v("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${au.rowHeightMaps[o]}px`}},t.createElement("span",null,v("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,W.map((e=>t.createElement("li",{key:e.value,className:_e({selected:e.value===Y}),title:e.text,onClick:()=>{return t=e.value,void X(t!==Y?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:v("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Mn(void 0,void 0,void 0,(function*(){if(!n)return;const e=W.filter((e=>e.value!==n));B(e),n===Y&&X(""),yield an.setItem(V,e),yield J(V,e)}))}},t.createElement(ct,null))))),!W.length&&t.createElement("div",{style:{padding:Bd}},t.createElement(nl,null)))))),t.createElement("div",{className:"bottom"},t.createElement("div",null,t.createElement(M,{checked:!!L.case,onChange:e=>q({case:e.target.checked})},v("qm.table.fastSearch.matchCase")),t.createElement(M,{checked:!!L.fullchar,onChange:e=>q({fullchar:e.target.checked})},v("qm.table.fastSearch.matchFullchar"))),t.createElement("div",null,t.createElement(rr,{onClick:()=>z()},v("qm.table.fastSearch.clear"))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Oo[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>n(),style:{marginRight:8}},v("qm.table.fastSearch.closeButton")),t.createElement(rr,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},v("qm.table.fastSearch.queryPrev")),t.createElement(rr,{type:"primary",onClick:()=>K("next")},v("qm.table.fastSearch.queryNext"))))},$u=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,$size:l}=t.useContext(zd),{t:a}=Fn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:a("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Oo[l]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:a("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(dt,null))),t.createElement(Ll,d,t.createElement(Fu,{onClose:()=>s(!1)})))}));$u.displayName="FastSearch";const qu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{tableRef:i,prefixCls:l,flattenColumns:a}=t.useContext(zd),{rowKey:o,uniqueKey:s}=i.current.props,{t:c}=Fn(),{tableFullData:d}=i.current,[u,p]=t.useState(!1),h=()=>{p(!0)};t.useImperativeHandle(n,(()=>({clickHandle:h})));const m={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>p(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>h()},t.createElement("i",{className:"svgicon icon"},t.createElement(ut,null))),t.createElement(Ll,m,t.createElement(cf,{fromTable:!0,rowKey:o,uniqueKey:s,columns:a,dataSource:d})))}));qu.displayName="PivotGrid";const ju=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:l,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext(zd),{fetch:d}=l.current.props,{t:u}=Fn(),p=e=>{var t;const r=n.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:null!==(t=r.dictItems)&&void 0!==t?t:[]}},m=r.map((e=>Object.assign({dataIndex:e.group},p(e.group)))),f=i.map((e=>e.summary===au.groupSummary.total.value?{dataIndex:e.summary,title:au.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},p(e.summary)),{formula:e.formula}))),g=t.useMemo((()=>Object.assign({},s,{[au.sorterFieldName]:void 0,[au.groupSummary.summaryFieldName]:i.map((e=>`${e.formula}|${e.summary}`)).join(","),[au.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[au.currentPageName]:1})),[s,r,i]),[v,y]=t.useState(((e,t)=>[{title:u("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{var t;const r=null===(t=n.find((t=>t.dataIndex===e.dataIndex)))||void 0===t?void 0:t.groupSummary;let i=r?{summation:r}:null;return e.dataIndex===au.groupSummary.total.value&&(i={dataIndex:au.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?i:null)}))])(m,f)),[b]=t.useState(c?[]:(e=>{const t=Ca(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&ua(t,r,da(e[0],r))})),i.forEach((n=>{const r=n.summary!==au.groupSummary.total.value?n.summary:au.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&ua(t,r,e.length),"sum"===i&&ua(t,r,Re(e,r)),"max"===i&&ua(t,r,Oe(e,r)[r]),"min"===i&&ua(t,r,ke(e,r)[r]),"avg"===i&&ua(t,r,(Re(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(l.current.tableFullData)),x=Object.assign(Object.assign({size:a,height:400},c?{fetch:{api:d.api,params:g,dataKey:null==d?void 0:d.dataKey}}:{dataSource:b}),{columns:v,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${h().format(Qd)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)});return t.createElement(Up,x)},Ku=e=>{const{onClose:n}=e,{global:r}=t.useContext(sn),{tableRef:i,prefixCls:l,$size:a,flattenColumns:o}=t.useContext(zd),{uniqueKey:s}=i.current.props,{t:c}=Fn(),d=t.useRef(null),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState([]),[g,v]=t.useState(""),[y,b]=t.useState("");$i((()=>{if(y){const{group:e,summary:t}=m.find((e=>e.value===y)).list;T(e),L(t)}else{const e=H();T((null==e?void 0:e.group)||[]),L((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{M()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex)))),[o]),w=E.filter((e=>!e.groupSummary)).map((e=>({text:xa(e.title),value:e.dataIndex}))),C=[au.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:xa(e.title),value:e.dataIndex})))],S=[{text:c("qm.table.groupSummary.sumText"),value:"sum"},{text:c("qm.table.groupSummary.maxText"),value:"max"},{text:c("qm.table.groupSummary.minText"),value:"min"},{text:c("qm.table.groupSummary.avgText"),value:"avg"},{text:c("qm.table.groupSummary.countText"),value:"count"}],[N,T]=t.useState([]),[I,R]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(rr,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:c("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>Object.assign(Object.assign({},e),{disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[k,L]=t.useState([]),[A,P]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(rr,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:c("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>Object.assign(Object.assign({},e),{disabled:k.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:c("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===au.groupSummary.total.value?S.slice(S.length-1):S})}]),_=t.useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=k.length&&k.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,k]),D=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}))},H=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},M=()=>Mn(void 0,void 0,void 0,(function*(){if(!x)return;const e=H();if(e){const{group:t,summary:n}=e;T(t),L(n)}let t=yield an.getItem(x);t||(t=yield F(x),Array.isArray(t)&&(yield an.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),F=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),$=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),q={visible:p,title:c("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return t.createElement("div",{className:`${l}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(Up,{ref:d,size:a,columns:I,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>R(e),onDataChange:e=>{T(e)}},t.createElement(rr,{type:"primary",icon:t.createElement(pt,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(Up,{ref:u,size:a,columns:A,dataSource:k,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{L(e)}},t.createElement(rr,{type:"primary",icon:t.createElement(pt,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:a,value:g,placeholder:c("qm.table.groupSummary.configText"),disabled:_,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(rr,{type:"primary",disabled:!g||_,style:{marginLeft:"10px"},onClick:()=>Mn(void 0,void 0,void 0,(function*(){if(!x)return nr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ya(),t=[...m,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}}];f(t),b(e),v(""),yield an.setItem(x,t),yield $(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${au.rowHeightMaps[a]}px`}},t.createElement("span",null,c("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,m.map((e=>t.createElement("li",{key:e.value,className:_e({selected:e.value===y}),title:e.text,onClick:()=>{return t=e.value,void b(t!==y?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:c("qm.table.groupSummary.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Mn(void 0,void 0,void 0,(function*(){if(!n)return;const e=m.filter((e=>e.value!==n));f(e),n===y&&b(""),yield an.setItem(x,e),yield $(x,e)}))}},t.createElement(ct,null))))),!m.length&&t.createElement("div",{style:{padding:Bd}},t.createElement(nl,null)))))),t.createElement(Ll,q,t.createElement(ju,{columns:E,group:N,summary:k})),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(rr,{type:"primary",disabled:_,onClick:()=>(D(),void h(!0))},c("qm.table.groupSummary.confirmButton"))))},zu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(zd),{t:l}=Fn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:l("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-group-summary`,title:l("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(ht,null))),t.createElement(Ll,c,t.createElement(Ku,{onClose:()=>o(!1)})))}));zu.displayName="GroupSummary";const Vu=e=>{const{onClose:n}=e,{global:r}=t.useContext(sn),{tableRef:i,$size:l,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t.useContext(zd),{uniqueKey:d}=i.current.props,{t:u}=Fn(),p=t.useRef(null),[h,m]=t.useState([]),[f,g]=t.useState([]),[v,y]=t.useState(""),[b,x]=t.useState("");$i((()=>{m(b?f.find((e=>e.value===b)).list:H()||[])}),[b]),t.useEffect((()=>{M()}),[]);const E=t.useMemo((()=>d?`superSearch_${d}`:""),[d]),w=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),C=wa(h),S=t.useMemo((()=>!(C&&Wl(C))),[C]),N=t.useMemo((()=>!!h.length&&S),[h,S]),T=[{value:"and",text:u("qm.table.highSearch.andText")},{value:"or",text:u("qm.table.highSearch.orText")}],I=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:xa(e.title)}))),R=e=>["in","nin"].includes(e),k=(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:u("qm.table.highSearch.gtText")},{value:"<",text:u("qm.table.highSearch.ltText")},{value:">=",text:u("qm.table.highSearch.gteText")},{value:"<=",text:u("qm.table.highSearch.lteText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",text:u("qm.table.highSearch.inText")},{value:"nin",text:u("qm.table.highSearch.ninText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:u("qm.table.highSearch.likeText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}]}return t},[A,P]=t.useState([{title:u("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(rr,{type:"text",onClick:()=>{p.current.REMOVE_RECORDS(n)}},u("qm.table.highSearch.removeText")))},{title:u("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:u("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:u("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const i=Object.values(t)[0],l=null===(n=w.find((e=>e.dataIndex===i)))||void 0===n?void 0:n.filter.type,a=L(l);e.fieldType=l,e.expression=i?null===(r=a[0])||void 0===r?void 0:r.value:"",e.condition=R(e.expression)?[]:"",i||(e.bracketLeft=e.bracketRight="")}})},{title:u("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:u("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{var t;const n=null===(t=w.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:L(n),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=R(e.expression)?[]:""}}}},{title:u("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const i=w.find((t=>t.dataIndex===e.fieldName)),l=null==i?void 0:i.filter.type,a=null!==(r=null!==(n=null===(t=null==i?void 0:i.filter)||void 0===t?void 0:t.items)&&void 0!==n?n:null==i?void 0:i.dictItems)&&void 0!==r?r:[];return{type:k(l,R(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:u("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:u("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:T,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{c(),s(h.map((e=>Qn(e,["index","pageIndex"])))),D(),n()},D=()=>{E&&sessionStorage.setItem(E,JSON.stringify(h.filter((e=>!!e.fieldName))))},H=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},M=()=>Mn(void 0,void 0,void 0,(function*(){if(!E)return;const e=H();e&&m(e);let t=yield an.getItem(E);t||(t=yield F(E),Array.isArray(t)&&(yield an.setItem(E,t))),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))})),F=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),$=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(Up,{ref:p,size:l,columns:A,dataSource:h,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(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]?"":")"),m([...h]))},onDataChange:e=>{m(e)}},t.createElement(rr,{type:"primary",icon:t.createElement(pt,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),au.highSearch.showSQL&&C&&t.createElement("code",{className:"lang-js"},C)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:l,value:v,placeholder:u("qm.table.highSearch.configText"),disabled:S,onChange:e=>{const{value:t}=e.target;y(t)}}),t.createElement(rr,{type:"primary",disabled:!v||S,style:{marginLeft:"10px"},onClick:()=>Mn(void 0,void 0,void 0,(function*(){if(!E)return nr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ya(),t=[...f,{text:v,value:e,list:h.filter((e=>!!e.fieldName))}];g(t),x(e),y(""),yield an.setItem(E,t),yield $(E,t)}))},u("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${au.rowHeightMaps[l]}px`}},t.createElement("span",null,u("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,f.map((e=>t.createElement("li",{key:e.value,className:_e({selected:e.value===b}),title:e.text,onClick:()=>{return t=e.value,void x(t!==b?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:u("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Mn(void 0,void 0,void 0,(function*(){if(!n)return;const e=f.filter((e=>e.value!==n));g(e),n===b&&x(""),yield an.setItem(E,e),yield $(E,e)}))}},t.createElement(ct,null))))),!f.length&&t.createElement("div",{style:{padding:Bd}},t.createElement(nl,null)))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>n(),style:{marginRight:8}},u("qm.table.highSearch.closeButton")),t.createElement(rr,{type:"primary",disabled:N,onClick:()=>_()},u("qm.table.highSearch.searchButton"))))},Wu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(zd),{t:l}=Fn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:l("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:l("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(mt,null))),t.createElement(Ll,c,t.createElement(Vu,{onClose:()=>o(!1)})))}));Wu.displayName="SuperSearch";const Bu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:i,showReload:l,showPrint:a,showImport:o,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:p,showPivotGrid:h,showGroupSummary:m,showToolBox:f}=e,{global:g}=t.useContext(sn),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext(zd),{uniqueKey:E,exportExcel:w}=v.current.props,{t:C}=Fn(),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(null),_=t.useRef(null),D=t.useRef(!1),H=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[$,q]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),j={fullScreen:i,reload:l,print:a,import:o,export:s&&!(null==w?void 0:w.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:p,pivotGrid:h,groupSummary:m},[K,z]=t.useState(!1);$i((()=>{D.current&&(W(),D.current=!1)}),[$]),t.useEffect((()=>{V()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return nr("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const V=()=>{if(!H||!f)return;const e=JSON.parse(localStorage.getItem(H));e||B(H).then((e=>{e&&(q(Object.assign({},$,e)),localStorage.setItem(H,JSON.stringify(e)))})).catch((()=>{})),e&&q(Object.assign({},$,e))},W=()=>{if(!H||!f)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(H,JSON.stringify(e)),U(H,e)},B=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==g?void 0:g.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),U=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==g?void 0:g.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),G=e=>Mn(void 0,void 0,void 0,(function*(){z(!1),yield Bn(100),e.current.clickHandle()})),X=(e,t)=>{D.current=!0,q(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${b}--lg`]:"large"===y,[`${b}--sm`]:"small"===y};return t.createElement(t.Fragment,null,i&&t.createElement(fu,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),l&&t.createElement(gu,{ref:N,open:!f||$.reload}),a&&t.createElement(yu,{ref:T,tableColumns:r,open:!f||$.print}),o&&t.createElement(ku,{ref:I,tableColumns:r,open:!f||$.import}),s&&t.createElement(Pu,{ref:R,tableColumns:r,open:(!f||$.export)&&!(null==w?void 0:w.hideIcon)}),c&&t.createElement(Du,{ref:O,open:!f||$.clipboard}),d&&t.createElement(Mu,{ref:k,columns:r,open:!f||$.collection}),u&&t.createElement($u,{ref:L,open:!f||$.fastSearch}),h&&t.createElement(qu,{ref:A,open:!f||$.pivotGrid}),m&&t.createElement(zu,{ref:P,open:!f||$.groupSummary}),p&&t.createElement(Wu,{ref:_,open:!f||$.superSearch}),f&&t.createElement(F,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.screen.full"))),onClick:()=>G(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.refresh.text"))),onClick:()=>G(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.print.text"))),onClick:()=>G(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.import.textNoSpace"))),onClick:()=>G(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.export.textNoSpace"))),onClick:()=>G(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.clipboard.textNoSpace"))),onClick:()=>G(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.selectCollection.text"))),onClick:()=>G(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.fastSearch.text"))),onClick:()=>G(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.pivotGrid.text"))),onClick:()=>G(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.groupSummary.text"))),onClick:()=>G(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.highSearch.text"))),onClick:()=>G(_)}];return t.createElement(Y,{items:e.filter((e=>j[e.key]))})})(),overlayClassName:_e(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{z(e)}},t.createElement("span",{className:`${b}-toolbox`,title:C("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(ft,null)))))}));Bu.displayName="ToolBox";const Uu=(e,t)=>e.map((e=>(e.children&&(e.children=Uu(e.children,t)),t(e)))),Gu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:i}=t.useContext(sn),{tableRef:l,prefixCls:a,$size:o}=t.useContext(zd),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=l.current.props,{t:p}=Fn(),h=t.useRef([]),[m,f]=t.useState(!1),g=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),v=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),b=t.useMemo((()=>c?`table_${c}`:""),[c]);$i((()=>{w(r)}),[r]),t.useLayoutEffect((()=>{C()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:C})));const x=()=>{if(!b)return;const e=JSON.parse(localStorage.getItem(b));var t;if(e||(t=b,Mn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(b,JSON.stringify(e)),C()):(null==i?void 0:i.getComponentConfigApi)&&w(r)})).catch((()=>{})),!e)return;return fe(Yl(e).map((e=>e.dataIndex)),Yl(r).map((e=>e.dataIndex))).length>0?Uu(r,(t=>{const n=Ql(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})):Uu(e,(e=>{const t=Ql(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},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),Object.assign({dataIndex:e.dataIndex},t)})),w=e=>{if(!b)return;const t=E(e),n=JSON.parse(localStorage.getItem(b));var r,a;l.current.columnsDefined&&!he(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,Mn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},C=()=>{const e=x();var t;e&&(t=S(e),h.current=t,null==u||u(e))},S=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const i=n.colSpan;i>1&&e.slice(r+1,r+i).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+i))})),t},N=()=>{const e=t=>t.map((t=>{const n=Ql(r,t.dataIndex)||Zn(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));null==u||u(e(l.current.originColumns))},T=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:i}=n;if(0===r)return;if(1===r)return t.push(n);const l=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===l)return t.push(n);t.push(...h.current[l].map((({dataIndex:t},r)=>{const i=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(i.hidden=n.hidden),void 0!==n.fixed?i.fixed=n.fixed:i.fixed&&delete i.fixed),i})))})),r.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),null==u||u(t)},I=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,T(r))},R=(e,n)=>{var i;const{colSpan:l,noFixed:a}=e;if(0===l)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=xa(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,T(r)}}),t.createElement("i",{className:_e(s),title:p("qm.table.columnFilter.draggable")},t.createElement(Ue,null)),t.createElement("span",{className:"text",title:o},o),"main"===n?t.createElement("span",{className:_e("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>I(e,"left")},t.createElement(gt,null)),t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},t.createElement(vt,null))):"sub"!==n?t.createElement("span",{className:_e("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>I(e)},t.createElement(ct,null))):null);return!e.hidden&&(null===(i=e.children)||void 0===i?void 0:i.length)?t.createElement(X,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:O(e.children,e.dataIndex)},c):c},O=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement(rn,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const i=t.map((e=>e.dataIndex)),l=e.map((e=>e.dataIndex));he(i,l)||((e,t)=>{Ql(r,t).children=e,null==u||u([...r])})(Ra(t),n)}},e.map((e=>R(e,"sub"))))),k={[`${a}__popper`]:!0,"column-filter__popper":!0,[`${a}--lg`]:"large"===o,[`${a}--sm`]:"small"===o},L=[`${a}-column-filter`,{selected:m}];return s?t.createElement(uc,{action:["click"],popupVisible:m,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(rr,{type:"text",size:"small",onClick:N},p("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(rn,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),n=g.map((e=>e.dataIndex));he(t,n)||T([...Ra(e),...y,...v])}},g.map((e=>R(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(rn,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),n=y.map((e=>e.dataIndex));he(t,n)||T([...g,...Ra(e),...v])}},y.map((e=>R(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(rn,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));he(t,n)||T([...g,...y,...Ra(e)])}},v.map((e=>R(e,"right")))))),popupClassName:_e(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Zd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:_e(L),title:d?p("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(at,null)),!d&&t.createElement("span",null,p("qm.table.columnFilter.text")))):null}));Gu.displayName="ColumnFilter";const Yu=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),Xu=e=>{const{column:n,filters:r}=e,{$size:i,prefixCls:l,setFilters:a,clearSuperFilters:o}=t.useContext(zd),{t:s}=Fn(),c=t.useRef(null),d=t.useRef(null),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState(!1),[g,v]=t.useState({}),y=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),b=t.useMemo((()=>{let e=!1;for(const t in r[y])if(!Yn(r[y][t])||m){e=!0;break}return e}),[y,r,m]);t.useLayoutEffect((()=>{p&&setTimeout((()=>x()),20)}),[p]),t.useEffect((()=>{var e;he(g[y],r[y])||v({[y]:r[y]||{}}),f(""===(null===(e=r[y])||void 0===e?void 0:e["=="]))}),[r]);const x=()=>{switch(n.filter.type){case"text":c.current.focus();break;case"number":d.current.focus();break;case"textarea":u.current.focus()}},E=e=>{e&&v(e),o(),a((e=>{for(const t in e){for(const n in e[t])if(Yn(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})(Object.assign(Object.assign(Object.assign({},r),g),e))),h(!1)},w={text:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(O,{ref:c,size:i,placeholder:s("qm.table.filter.searchText",{text:xa(e.title)}),style:{width:"180px"},value:null!==(r=null===(n=g[y])||void 0===n?void 0:n.like)&&void 0!==r?r:"",disabled:m,onChange:e=>{const{value:t}=e.target;v((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:m,onChange:e=>{const{checked:t}=e.target,n=t?"":null;v((e=>Object.assign({},e,{[y]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue"))))},textarea:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(O.TextArea,{ref:u,size:i,placeholder:s("qm.table.filter.searchAreaText",{text:xa(e.title)}),style:{width:"220px"},value:null!==(r=null===(n=g[y])||void 0===n?void 0:n.likes)&&void 0!==r?r:"",disabled:m,onChange:e=>{const{value:t}=e.target;v((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),E())}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:m,onChange:e=>{const{checked:t}=e.target,n=t?"":null;v((e=>Object.assign({},e,{[y]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue"))))},number:e=>{const n=e=>{var t,n;return{value:null!==(n=null===(t=g[y])||void 0===t?void 0:t[e])&&void 0!==n?n:"",size:i,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||v((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement($,On({ref:d},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement($,On({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement($,On({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement($,On({},n("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const n=e=>{var t;return{value:ga(null===(t=g[y])||void 0===t?void 0:t[e],Yd),format:Yd,size:i,onChange:t=>{v((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:va(t,Yd)})})))},onKeyDown:e=>{13===e.keyCode&&E()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(Rn,On({},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(Rn,On({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(Rn,On({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(Rn,On({},n("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("ul",null,t.createElement(j.Group,{style:{width:"100%"},value:null===(n=g[y])||void 0===n?void 0:n["=="],onChange:e=>{const{value:t}=e.target;v((e=>Object.assign({},e,{[y]:{"==":t}})))}},l.map((e=>t.createElement("li",{key:e.value},t.createElement(j,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("ul",null,t.createElement(M.Group,{style:{width:"100%"},value:null===(n=g[y])||void 0===n?void 0:n.in,onChange:e=>{v((t=>Object.assign({},t,{[y]:{in:e}})))}},l.map((e=>t.createElement("li",{key:e.value},t.createElement(M,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("div",{style:Object.assign({height:200},r.style)},t.createElement(Kd,{multiple:!0,value:(null===(n=g[y])||void 0===n?void 0:n.in)||[],dataSource:l,onCheckChange:e=>{const t=e.map((e=>e.value));v((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},C=()=>t.createElement(S,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t.createElement(rr,{size:i,onClick:()=>(E({[y]:{}}),void f(!1))},s("qm.table.filter.reset")),t.createElement(rr,{type:"primary",size:i,onClick:()=>E()},s("qm.table.filter.search"))),N={"head-filter__popper":!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i},T=["cell--filter",{selected:p,actived:b}];return t.createElement(uc,{action:["click"],popupVisible:p,popup:(()=>{const e=n.filter.type,r=w[e];return r?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement("div",null,r(n)),C()):(nr("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:_e(N),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{h(e)},builtinPlacements:Zd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:_e(T),title:s("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(Yu,null))))},Qu=e=>{const{column:n}=e,{tableRef:r,bordered:i}=t.useContext(zd),{columns:l,resizable:a,columnsChange:o=Vn}=r.current.props,s=t.useMemo((()=>Jl(n)),[n]),c={resizable:!0,"is--line":a&&!i};return t.createElement("div",{className:_e(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:i}=r.current,a=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=oa(t,n.$table).left-i.current.scrollLeft+c;n.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const p=s.width||s.renderWidth;let h=p;return document.onmousemove=function(e){if("number"!=typeof p)return;const t=e.clientX-d,n=p+t;n<(s.minWidth||au.defaultColumnWidth)||(h=Math.floor(n),a.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof h&&(Ql(l,s.dataIndex).width=h,o([...l]))},!1}})},Zu=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:i,fetchParams:l,createTableList:a,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=t.useContext(zd),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:f,onSelectAll:g}=p,{t:v}=Fn(),y=t.useRef([]),b=t.useMemo((()=>d&&!!h),[d,h]),x=t.useMemo((()=>!b&&!!m),[b,m]),E=t.useMemo((()=>(null==f||f)&&!x),[f,x]),C=()=>{const{selectionRows:e}=r.current,{disabled:t}=p;return(t?e.filter((e=>!t(e))):e).map((e=>i(e,e.index)))},S=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:n}=p;if(b)return y.current.length?y.current:Le(t,C());if(!x)return n?t.filter((t=>!n(e.get(t)))):t;const l=n?a().filter((e=>!n(e))).map((e=>i(e,e.index))):a().map((e=>i(e,e.index)));return Le(l,C())})(),N=n.filter((e=>!S.includes(e))),T=n.length-N.length,I=T>0&&T<S.length,R=!!T&&T===S.length;s(N);const O=()=>Mn(void 0,void 0,void 0,(function*(){var e;const t=h;let n=[];c(!0);try{const r=yield t.api(l);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:l}=p;l&&(n=fe(n,a().filter((e=>l(e))).map((e=>i(e,e.index))))),y.current=n}}catch(e){}return c(!1),n})),k=e=>Mn(void 0,void 0,void 0,(function*(){let t=[];t=b?e?yield O():[]:e?S.slice(0):[],t=[...new Set([...t,...N])],o(t),null==g||g(e,t)})),L=()=>{const e=[{key:1,label:v("qm.table.selection.all"),onClick:()=>{k(!0)}},{key:2,label:v("qm.table.selection.invert"),onClick:()=>Mn(void 0,void 0,void 0,(function*(){let e=[];e=fe(n,b?yield O():S),e=[...new Set([...e,...N])],o(e)}))},{key:3,label:v("qm.table.selection.clear"),onClick:()=>{k(!1)}}];return t.createElement(Y,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(M,{checked:R,indeterminate:I,disabled:!S.length,onChange:e=>k(e.target.checked)}),E&&t.createElement(F,{overlayClassName:"all-selection__popper",dropdownRender:()=>L()},t.createElement(He,{className:"svgicon icon"})),x&&t.createElement(w,{placement:"top",title:v("qm.table.selection.currentPage")},t.createElement(yt,{className:"info"})))},Ju=e=>{const{style:n}=e,{tableRef:r,setRowExpandedKeys:i}=t.useContext(zd),{expandable:l}=r.current.props,[a,o]=t.useState((null==l?void 0:l.defaultExpandAllRows)||!1);$i((()=>{i(a?[...r.current.allParentRowKeys]:[])}),[a]);const s={[`${ar("expand")}--icon`]:!0,expanded:a,collapsed:!a};return t.createElement("span",{className:_e(s),title:"",onClick:e=>{e.stopPropagation(),o(!a)},style:n})},ep=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),tp=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),np=e=>{const{tableColumns:n}=e,{tableRef:r,prefixCls:i,layout:l,flattenColumns:a,sorter:o,filters:s,superFilters:c,selectionKeys:d,isFetch:u,isGroupSubtotal:p,treeExpandIndex:h,tableChange:m,setSorter:f,setElementStore:g,resetTableScroll:v,getStickyLeft:y,getStickyRight:b,createGroupData:x,createTableFullData:E}=t.useContext(zd),{ellipsis:C,resizable:S,multipleSort:N,rowSelection:T,expandable:I}=r.current.props,[R,O]=au.sortDirections,{tableOriginData:k}=r.current,{t:L}=Fn(),A=t.useRef(null),P=t.useMemo((()=>k.some((e=>Array.isArray(e.children)))),[k]),_=t.useMemo((()=>!u),[u]),D=t.useMemo((()=>!u),[u]),H=t.useMemo((()=>!(null==I?void 0:I.hideExpandAll)),[I]),M=t.useMemo((()=>!!T&&(u?!(!T.selectAllOnCurrentPage&&!T.fetchAllRowKeys):!T.hideSelectAll)),[u,T]);$i((()=>{V(),m(),v()}),[o]),$i((()=>{G(),m(),v()}),[s]),$i((()=>{G(),m(),v()}),[c]),t.useEffect((()=>{!Yn(o)&&Un((()=>V())),!Yn(s)&&Un((()=>G()))}),[]),t.useLayoutEffect((()=>{F()}),[]);const F=()=>{g("$header",A.current)},$=(e,n,i)=>{var l,a,s;const{dataIndex:c,colSpan:d,rowSpan:u,fixed:p,align:h,theadAlign:m,theadClassName:f="",sorter:g,filter:v,required:x,headRender:E}=e;if(0===d)return null;const w=m||h,N=["header--column",{"col--ellipsis":null!==(l=e.ellipsis)&&void 0!==l?l:C,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!x,"column-has-sorter":g,"column-has-filter":v,"column--sort":!!o[c],"cell-fix-left":"left"===p,"cell-fix-right":"right"===p,"cell-fix-left-last":"left"===p&&!(null===(a=i[n+(null!=d?d:1)])||void 0===a?void 0:a.fixed),"cell-fix-right-first":"right"===p&&!(null===(s=i[n-1])||void 0===s?void 0:s.fixed),[f]:!!f}],T={left:"left"===p?`${y(c)}px`:"",right:"right"===p?`${b(c,"thead")}px`:""},I=S&&![au.expandableColumn,au.selectionColumn].includes(c);return t.createElement("th",{key:c,className:_e(N),colSpan:d,rowSpan:u,style:Object.assign({},T),onClick:t=>z(t,e)},t.createElement("div",{className:"cell--wrapper"},E?t.createElement("div",{className:"cell--text cell"},E(e,r.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},q(e)),v?K(e):null)),I&&t.createElement(Qu,{column:e}))},q=e=>{const{dataIndex:n,type:i,sorter:l,title:a,description:s}=e;if(n===au.selectionColumn&&"checkbox"===i){if("checkbox"===i)return t.createElement("div",{className:"cell"},M?t.createElement(Zu,{selectionKeys:d}):L("qm.table.config.selectionText"));if("radio"===i)return t.createElement("div",{className:"cell"},a)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:xa(a)},r.current.isTreeTable&&n===h&&H?t.createElement(Ju,null):null,n===au.expandableColumn&&H?t.createElement(Ju,null):a)),s&&c.push(t.createElement(w,{key:1,placement:"top",title:s},t.createElement(yt,{className:"tip"}))),l&&c.push(j(o[n])),c},j=e=>{const n=["svgicon cell--sorter__asc",{actived:e===R}],r=["svgicon cell--sorter__desc",{actived:e===O}];return t.createElement("div",{key:2,className:"cell--sorter",title:L("qm.table.sorter.text")},t.createElement("span",{className:_e(n)},t.createElement(ep,null)),t.createElement("span",{className:_e(r)},t.createElement(tp,null)))},K=e=>t.createElement(Xu,{column:e,filters:s}),z=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===O?null:O:R;N?(delete o[r],f(Object.assign({},o,{[r]:t}))):f(Object.assign({},{[r]:t}))}},V=()=>{_&&W()},W=e=>{const t=Ae(o,(e=>null!==e));U(t),e||Object.keys(t).length||U({index:R})},B=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,U=e=>{const{tableFullData:t}=r.current,n=((e,t)=>e.sort(((e,n)=>{for(const r in t){const i=a.find((e=>e.dataIndex===r)),l=t[r],o=da(e,r),s=da(n,r),c="function"!=typeof(null==i?void 0:i.sorter)?B(o,s):i.sorter(e,n);if(0!==c)return"ascend"===l?c:-c}return 0})).slice(0))(p?x(Ea(t)):t,e);E(n)},G=()=>{D&&Y()},Y=()=>{const e=c.length?wa(c):wa(s),t=""!==e?p?x(Bl(Ea(k),e,P)):Bl(k,e,P):k;E(t),W(!0)},X=ia(n),{tableBodyWidth:Q}=l;return t.createElement("div",{ref:A,className:`${i}--header-wrapper`},t.createElement("table",{className:`${i}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Q?`${Q}px`:""}},t.createElement("colgroup",null,a.map((e=>{const{dataIndex:n,width:r,renderWidth:i}=e;return t.createElement("col",{key:n,style:{width:`${r||i}px`,minWidth:`${r||i}px`}})}))),t.createElement("thead",null,(e=>e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>$(t,n,e)))))))(X))))},rp=t.createContext([]);function ip(e,t,n){var r;let i,l=null!==(r=n.initialDeps)&&void 0!==r?r:[];return()=>{var r,a,o,s,c;let d;n.key&&(null===(r=n.debug)||void 0===r?void 0:r.call(n))&&(d=Date.now());const u=e(),p=u.length!==l.length||u.some(((e,t)=>l[t]!==e));if(!(null===(a=n.noCache)||void 0===a?void 0:a.call(n))&&!p)return i;let h;if(l=u,n.key&&(null===(o=n.debug)||void 0===o?void 0:o.call(n))&&(h=Date.now()),i=t(...u),n.key&&(null===(s=n.debug)||void 0===s?void 0:s.call(n))){const e=Math.round(100*(Date.now()-d))/100,t=Math.round(100*(Date.now()-h))/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} / ${i(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%);`,null==n?void 0:n.key)}return null===(c=null==n?void 0:n.onChange)||void 0===c||c.call(n,i),i}}function lp(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const ap=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,i)),n)}},op=e=>e,sp=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},cp=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const l=new r.ResizeObserver((e=>{const t=e[0];if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void i({width:e.inlineSize,height:e.blockSize})}i(n.getBoundingClientRect())}));return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},dp={passive:!0},up="undefined"==typeof window||"onscrollend"in window,pp=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const l=e.options.useScrollendEvent&&up?()=>{}:ap(r,(()=>{t(i,!1)}),e.options.isScrollingResetDelay),a=r=>()=>{const{horizontal:a,isRtl:o}=e.options;i=a?n.scrollLeft*(o?-1:1):n.scrollTop,l(),t(i,r)},o=a(!0),s=a(!1);return s(),n.addEventListener("scroll",o,dp),n.addEventListener("scrollend",s,dp),()=>{n.removeEventListener("scroll",o),n.removeEventListener("scrollend",s)}},hp=(e,t,n)=>{if(null==t?void 0: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"])},mp=(e,{adjustments:t=0,behavior:n},r)=>{var i,l;const a=e+t;null===(l=null===(i=r.scrollElement)||void 0===i?void 0:i.scrollTo)||void 0===l||l.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class fp{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,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:()=>{var n;null===(n=t())||void 0===n||n.disconnect(),e=null},observe:e=>{var n;return null===(n=t())||void 0===n?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null===(n=t())||void 0===n?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options=Object.assign({debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:op,rangeExtractor:sp,onChange:()=>{},measureElement:hp,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0},e)},this.notify=e=>{var t,n;null===(n=(t=this.options).onChange)||void 0===n||n.call(t,this,e)},this.maybeNotify=ip((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e,t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n)return void this.maybeNotify();this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=null!==(t=null===(e=this.scrollElement)||void 0===e?void 0:e.window)&&void 0!==t?t: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()})))}},this.getSize=()=>{var e;return this.options.enabled?(this.scrollRect=null!==(e=this.scrollRect)&&void 0!==e?e:this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=null!==(e=this.scrollOffset)&&void 0!==e?e:"function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let i=t-1;i>=0;i--){const t=e[i];if(n.has(t.lane))continue;const l=r.get(t.lane);if(null==l||t.end>l.end?r.set(t.lane,t):t.end<l.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},this.getMeasurementOptions=ip((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i})),{key:!1}),this.getMeasurements=ip((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i},l)=>{if(!i)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 a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,a);for(let i=a;i<e;i++){const e=r(i),a=1===this.options.lanes?o[i-1]:this.getFurthestMeasurement(o,i),s=a?a.end+this.options.gap:t+n,c=l.get(e),d="number"==typeof c?c:this.options.estimateSize(i),u=s+d,p=a?a.lane:i%this.options.lanes;o[i]={index:i,start:s,size:d,end:u,key:e,lane:p}}return this.measurementsCache=o,o}),{key:"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=ip((()=>[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,i=t=>e[t].start,l=gp(0,r,i,n);let a=l;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:l,endIndex:a}}({measurements:e,outerSize:t,scrollOffset:n}):null),{key:"calculateRange",debug:()=>this.options.debug}),this.getIndexes=ip((()=>[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:"getIndexes",debug:()=>this.options.debug}),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)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const i=r.key,l=this.elementsCache.get(i);l!==e&&(l&&this.observer.unobserve(l),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))},this.resizeItem=(e,t)=>{var n;const r=this.measurementsCache[e];if(!r)return;const i=t-(null!==(n=this.itemSizeCache.get(r.key))&&void 0!==n?n:r.size);0!==i&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,t)),this.notify(!1))},this.measureElement=e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))},this.getVirtualItems=ip((()=>[this.getIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,i=e.length;r<i;r++){const i=t[e[r]];n.push(i)}return n}),{key:"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return lp(t[gp(0,t.length-1,(e=>lp(t[e]).start),e)])},this.getOffsetForAlignment=(e,t)=>{const n=this.getSize(),r=this.getScrollOffset();"auto"===t&&e>=r+n&&(t="end"),"end"===t&&(e-=n);const i=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-n;return Math.max(Math.min(l,e),0)},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(),i=this.getScrollOffset();if("auto"===t)if(n.end>=i+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=i+this.options.scrollPaddingStart))return[i,t];t="start"}const l=n.start-this.options.scrollPaddingStart+(n.size-r)/2;switch(t){case"center":return[this.getOffsetForAlignment(l,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]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{null!==this.scrollToIndexTimeoutId&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},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})},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[i,l]=r;this._scrollToOffset(i,{adjustments:void 0,behavior:n}),"smooth"!==n&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout((()=>{this.scrollToIndexTimeoutId=null;if(this.elementsCache.has(this.options.getItemKey(e))){const[i]=lp(this.getOffsetForIndex(e,l));t=i,r=this.getScrollOffset(),Math.abs(t-r)<1||this.scrollToIndex(e,{align:l,behavior:n})}else this.scrollToIndex(e,{align:l,behavior:n});var t,r})))},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})},this.getTotalSize=()=>{var e,t;const n=this.getMeasurements();let r;return r=0===n.length?this.options.paddingStart:1===this.options.lanes?null!==(t=null===(e=n[n.length-1])||void 0===e?void 0:e.end)&&void 0!==t?t:0:Math.max(...n.slice(-this.options.lanes).map((e=>e.end))),Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const gp=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<r)e=i+1;else{if(!(l>r))return i;t=i-1}}return e>0?e-1:0};const vp="undefined"!=typeof document?t.useLayoutEffect:t.useEffect,yp=e=>(e=>{const n=t.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},e),{onChange:(t,r)=>{var i;r?en(n):n(),null===(i=e.onChange)||void 0===i||i.call(e,t,r)}}),[i]=t.useState((()=>new fp(r)));return i.setOptions(r),vp((()=>i._didMount()),[]),vp((()=>i._willUpdate())),i})(Object.assign({observeElementRect:cp,observeElementOffset:pp,scrollToFn:mp},e)),bp=(e,t,n,r,i,l,a,o,s,c)=>{var d;const{clientX:u,clientY:p}=e,{top:h,height:m}=e.target.getBoundingClientRect(),f=(((null==i?void 0:i.x)||0)-u-12)/r,g=s.filter((e=>{var t,n;return null===(n=null===(t=o[e])||void 0===t?void 0:t.children)||void 0===n?void 0:n.length}));let v=xp(o,n.eventKey);if(p<h+m/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=xp(o,t)}const y=v.key,b=v,x=v.key;let E=0,w=0;if(!g.includes(y))for(let e=0;e<f&&wp(v);e+=1)v=v.parent,w+=1;const C=t.data,S=v.node;let N=!0;return Cp(v)&&0===v.level&&p<h+m/2&&l({dragNode:C,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?l({dragNode:C,dropNode:S,dropPosition:0})?E=0:N=!1:0===w?f>-1.5?l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:C,dropNode:S,dropPosition:0})?E=c?1:0:l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:w,dropTargetKey:v.key,dropTargetPos:v.pos,dragOverNodeKey:x,dropContainerKey:0===E?null:(null===(d=v.parent)||void 0===d?void 0:d.key)||null,dropAllowed:N}},xp=(e,t)=>e[t],Ep=e=>e.split("-"),wp=e=>{if(e.parent){const t=Ep(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Cp=e=>{const t=Ep(e.pos);return 0===Number(t[t.length-1])},Sp=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:i,setRowExpandedKeys:l,createTableFullData:a,dataChange:o}=t.useContext(zd),{tableFullData:s,allRowKeys:c,isTreeTable:d}=n.current,u=Wn,p=t.useRef(null),h=t.useRef(null),m=t.useRef(null),f=t.useRef(),[g,v]=t.useState({}),[y,b]=t.useState(null),[x,E]=t.useState([]),[w,C]=t.useState(0),[S,N]=t.useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),T=e=>{N((t=>Object.assign({},t,e)))};t.useLayoutEffect((()=>{e&&v((e=>{const t={},n=(e,i=null,l=0)=>{const a=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:l,node:e,parent:i,pos:(d=(null==i?void 0:i.pos)||"0",u=o,`${d}-${u}`),nodes:[...(null==i?void 0:i.nodes)||[],e]};var d,u;Array.isArray(e.children)&&(c.children=n(e.children,c,l+1)),t[s]=c,a.push(c)})),a};return n(e),t})(s))}),[s]),t.useEffect((()=>()=>{window.removeEventListener("dragend",O)}),[]);const I=()=>{T({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},R=()=>{null!==y&&(b(null),T({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),h.current=null,m.current=null},O=e=>{k(),window.removeEventListener("dragend",O)},k=(e,t,n)=>{T({dragOverNodeKey:null}),R(),p.current=null,window.removeEventListener("dragend",O)},L=e=>{const t=e.node.eventKey,n=e.dragNode.eventKey,i=e.node.pos.split("-"),l=e.dropPosition-Number(i[i.length-1]),c=(e,t,n)=>{for(let i=0;i<e.length;i++){if(r(e[i],e[i].index)===t)return n(e[i],i,e);e[i].children&&c(e[i].children,t,n)}},d=[...s];let u;if(c(d,n,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,i)=>{n=i,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)}));a(d),o()};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;p.current=t,h.current={x:e.clientX,y:e.clientY};const r=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(i,n);b(n),E(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(xp(t,e).children),n})(n,g)),C(2*au.treeTable.textIndent),l(r),window.addEventListener("dragend",O)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(m.current!==n&&(m.current=n),!p.current)return void I();const{dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b,dragOverNodeKey:E}=bp(e,p.current,t,w,h.current,u,c,g,i,!d);-1===x.indexOf(o)&&b?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),p.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{var e;if(null===y)return;let t=[...i];const r=xp(g,n);r&&(null===(e=r.children)||void 0===e?void 0:e.length)&&(t=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(i,n)),l(t)}),800)),p.current.eventKey!==o||0!==a?T({dragOverNodeKey:E,dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b}):I()):I()},onNodeDragOver:(e,t)=>{if(!p.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:l,dropContainerKey:a,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:m}=bp(e,p.current,t,w,h.current,u,c,g,i,!d);-1===x.indexOf(l)&&o&&(p.current.eventKey===l&&0===r?null===S.dropPosition&&null===S.dropLevelOffset&&null===S.dropTargetKey&&null===S.dropContainerKey&&null===S.dropTargetPos&&!1===S.dropAllowed&&null===S.dragOverNodeKey||I():n===S.dropPosition&&r===S.dropLevelOffset&&l===S.dropTargetKey&&a===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&m===S.dragOverNodeKey||T({dropPosition:n,dropLevelOffset:r,dropTargetKey:l,dropContainerKey:a,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:m}))},onNodeDragLeave:(e,t)=>{m.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(I(),m.current=null)},onNodeDragEnd:k,onNodeDrop:(e,t,n=!1)=>{const{dropPosition:r,dropTargetKey:i,dropTargetPos:l,dropAllowed:a,dragOverNodeKey:o}=S;if(!a)return;if(T({dragOverNodeKey:null}),R(),null===i)return;const s=Object.assign(Object.assign({},((e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const i=xp(r,e);return{eventKey:e,pos:i?i.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}})(i,{dropPosition:r,dragOverNodeKey:o,keyEntities:g})),{data:xp(g,i).node});-1!==x.indexOf(i)&&nr("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=Ep(l),d={event:e,node:s,dragNode:p.current,dragNodesKeys:[p.current.eventKey].concat(x),dropToGap:0!==r,dropPosition:r+Number(c[c.length-1])};n||L(d),p.current=null},indent:w,dropOptions:S}},Np=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Tp=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Ip=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!Np(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Rp({ref:t,handler:n,enabled:r=!0,omitClassNames:i=[]}){const l=$n(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{Ip(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&Ip(e,t)&&Tp(e,i)&&(a.current.isPointerDown=!1,l(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&Ip(e,t)&&Tp(e,i)&&(a.current.isPointerDown=!1,l(e))},c=Np(t.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[n,t,l,a,r])}function Op(){const[,t]=e.useReducer((e=>e+1),0);return t}const kp=t.forwardRef(((e,n)=>{const{rowKey:r,rowIndex:i,row:l,className:a,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:p,onNodeDragOver:h,onNodeDragLeave:m,onNodeDragEnd:f,onNodeDrop:g}=e,v=t.useRef({eventKey:r,data:l,props:e}),y=t.useRef(!1),[b,x]=t.useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===r&&0===E,I=C===r&&-1===E,R=C===r&&1===E,O=l._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 L={"body--row-draggable":!0,"body--row-dragging":b,"drop-target":S===r,"drop-container":N===r,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return t.createElement("tr",{ref:n,"data-row-key":r,"data-row-index":i,className:_e(a,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),y.current=t)},onDragStart:e=>{if(e.stopPropagation(),y.current)return e.preventDefault();x(!0),u(e,v.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),p(e,v.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),h(e,v.current)},onDragLeave:e=>{e.stopPropagation(),m(e,v.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,v.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,v.current)}},e.children,C===r&&null!==E&&null!==w&&t.createElement("td",{className:"drop-indicator",style:k}))}));kp.displayName="DraggableTr";const Lp=e=>{const{selectionKeys:n,column:r,record:i,rowKey:l}=e,{tableRef:a,getAllChildRowKeys:o}=t.useContext(zd),{rowSelection:s}=a.current.props,c=t.useMemo((()=>r.type||""),[r.type]),d=e=>{var t,r;const i=null===(t=s.checkStrictly)||void 0===t||t;if(!a.current.isTreeTable||i)return!1;const l=ta(a.current.deriveRowKeys,e);return((e,t)=>{const n=new Set(t);let r=!1,i=!1;for(const t of e)if(n.has(t)?r=!0:i=!0,r&&i)break;return r&&i})(o(null!==(r=null==l?void 0:l.children)&&void 0!==r?r:[]),n)};return"radio"===c?(()=>{const e=s.disabled,r=null==e?void 0:e(i),a=!r&&n[0]===l;return t.createElement(j,{checked:a,disabled:r})})():(()=>{const e=s.disabled,r=null==e?void 0:e(i),a=!!n.includes(l);return t.createElement(M,{checked:a,indeterminate:d(l),disabled:r})})()},Ap=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:l,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext(zd),{expandable:s={}}=l.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);$i((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${ar("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:_e(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];o(t)},style:i})},Pp=t.forwardRef(((e,n)=>{const{size:r,defaultValue:i,value:l,min:a,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:v=(e=>e.toString()),parser:y=(e=>e),onFocus:b}=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)<a&&(t=a.toString()),p>=0&&""!==t&&(t=new Gt(t).toFixed(p)),t},E=void 0!==l,[w,C]=t.useState(null!=i?i:""),S=v(E?l:w),N=y(S);$i((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[w]);return t.createElement(O,{ref:n,size:r,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const n=y(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===p&&n.includes(".")&&(r=!1),a>=0&&n.startsWith("-")&&(r=!1),r){if(!h&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{var n;E?null===(n=e.onChange)||void 0===n||n.call(e,t):C(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(N);null===(t=e.onBlur)||void 0===t||t.call(e,n,N)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(N),N))}})}));Pp.displayName="InputNumber";const{Search:_p}=O,Dp=t.forwardRef(((e,n)=>{var r,i,l,a,o,s;const{column:c,record:d,rowKey:u,columnKey:p}=e,{tableRef:h,tableBodyRef:m,$size:f,flattenColumns:g,updateTableFlatData:v,doFieldValidate:y,dataChange:b}=t.useContext(zd),x=t.useContext(rp),{t:w}=Fn(),C=Op(),{store:S,fieldAuth:N}=h.current,T=(null===(r=c.editRender)||void 0===r?void 0:r.call(c,d,c))||{},I=t.useRef(null),R=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(!1),_=t.useRef({}),D=t.useRef({}),F=t.useRef([]),[$,q]=t.useState(!1),[j,z]=t.useState(!1),[V,W]=t.useState(T.items||[]),[B,U]=t.useState(),G=(T.editable||he(x,[u,p]))&&!T.disabled&&!(null===(i=N[p])||void 0===i?void 0:i.disabled),Y=`${u}|${p}`,X=2===x.length?`${x[0]}|${x[1]}`:"",Q=![...S.state.required,...S.state.validate].some((({x:e,y:t})=>e===u&&t===p)),Z=(null===(l=S.state.required.find((({x:e,y:t})=>e===u&&t===p)))||void 0===l?void 0:l.text)||"",J=(null===(a=S.state.validate.find((({x:e,y:t})=>e===u&&t===p)))||void 0===a?void 0:a.text)||"",ee=S.state.edited.some((({x:e,y:t})=>e===u&&t===p)),te=G||!Q||$||j,ne=!!(null===(o=T.helper)||void 0===o?void 0:o.combinedDataIndex)&&("search-helper"===T.type||"tree-helper"===T.type),re=null===(s=T.type)||void 0===s?void 0:s.endsWith("multiple");t.useLayoutEffect((()=>{te&&X===Y&&oe()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;re&&e&&le(e.map((e=>({[D.current.valueKey]:e.value,[D.current.textKey]:e.text}))))}),[]);const ie=()=>{v(),b()},le=e=>{F.current=e},oe=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=R.current)||void 0===e||e.focus();break;case"number":null===(t=k.current)||void 0===t||t.select();break;case"search-helper":null===(n=L.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=A.current)||void 0===r||r.focus()}},se=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=R.current)||void 0===e||e.blur();break;case"number":null===(t=k.current)||void 0===t||t.blur();break;case"search-helper":null===(n=L.current)||void 0===n||n.blur();break;case"tree-helper":null===(r=A.current)||void 0===r||r.blur()}};t.useImperativeHandle(n,(()=>({focus:oe,blur:se,isEditable:()=>!T.disabled,isOpening:()=>$})));const ce=(e,t,n)=>{const{cornerSign:r=!0}=T.extra||{};S.addToUpdated(e),r&&S.addToEdited({x:t,y:n})},de=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",pe={text:(e,n,r)=>{const{dataIndex:i}=n,{type:l,extra:a={},rules:o=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=da(e,i),g=Object.assign({},{minRows:1,maxRows:4},a.autoSize),v=r?{rows:g.minRows,autoSize:g}:null,b=a.password?O.Password:r?O.TextArea:O;return t.createElement(b,On({ref:R,size:f,value:m,maxLength:a.maxLength,showCount:a.showCount},v,{autoComplete:a.password?"new-password":"off",placeholder:a.placeholder||w("qm.table.editable.inputPlaceholder"),allowClear:a.allowClear,readOnly:a.readOnly,disabled:a.disabled,suffix:a.suffix,onChange:t=>{var r;const l=null!==(r=t.target.value)&&void 0!==r?r:"";ua(e,i,l),y(o,l,u,p,xa(n.title)),C(),null==s||s({[Y]:l}),P.current=!0},onBlur:t=>{var n;const r=null!==(n=t.target.value)&&void 0!==n?n:"";P.current&&(P.current=!1,ce(e,u,p),null==c||c({[Y]:r},e),null==h||h({[Y]:r},e),ie())},onKeyUp:t=>{var n;if(13===t.keyCode&&!t.shiftKey){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==d||d({[Y]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&d&&e.preventDefault()}}))},textarea:(e,t)=>pe.text(e,t,!0),number:(e,n)=>{var r;const{dataIndex:i,precision:l,formatType:a}=n,{type:o,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:m,onBlur:g}=T,v=da(e,i);let b,x;return"finance"===a&&(b=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},x=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===a&&(b=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Gt(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Gt(e).times(.01).toString()),t.createElement(Pp,{ref:k,size:f,value:v,min:s.min,max:s.max,precision:l,stringMode:s.stringMode,prefix:s.prefix,suffix:null!==(r=s.suffix)&&void 0!==r?r:"percent"===a?"%":void 0,placeholder:s.placeholder||w("qm.table.editable.inputPlaceholder"),maxLength:s.maxLength,allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,formatter:b,parser:x,onChange:t=>{ua(e,i,t),y(c,t,u,p,xa(n.title)),C(),null==d||d({[Y]:t}),P.current=!0},onBlur:(t,n)=>{if(!P.current)return;P.current=!1;let r=s.stringMode?t:de(t);"percent"===a&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),ua(e,i,r),ce(e,u,p),null==h||h({[Y]:r},e),null==g||g({[Y]:r},e),ie()},onEnter:(t,n)=>{let r=s.stringMode?t:de(t);"percent"===a&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),null==m||m({[Y]:r},e)}})},select:(e,n,r)=>{var i;const{dataIndex:l,dictItems:a=[]}=n,{type:o,extra:s={},rules:c=[],items:d,onChange:h,onEnter:m}=T,g=d||a,v=da(e,l);let b=v;return t.createElement(H,{mode:r?"multiple":void 0,size:f,popupClassName:au.popupClassName,value:v||void 0,placeholder:s.placeholder||w("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,listHeight:s.listHeight,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},showSearch:null===(i=s.filterable)||void 0===i||i,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>q(e),onChange:t=>{ua(e,l,t),y(c,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},onSelect:e=>{b=e},onInputKeyDown:t=>{13===t.keyCode&&Un((()=>null==m?void 0:m({[Y]:b},e)))}},g.map((e=>t.createElement(H.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>pe.select(e,t,!0),date:(e,n,r)=>{var i;const{dataIndex:l}=n,{type:a,extra:o={},rules:s=[],onChange:c}=T,d=r||"exactdate",h=da(e,l);return t.createElement(Rn,{size:f,popupClassName:au.popupClassName,value:null!==(i=ga(h,Fa[d]))&&void 0!==i?i:void 0,picker:Ma[d],format:o.format,showTime:"datetime"===d,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=o;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=va(t,Fa[d]);ua(e,l,r),y(s,r,u,p,xa(n.title)),ce(e,u,p),null==c||c({[Y]:r},e),ie()}})},datetime:(e,t)=>pe.date(e,t,"datetime"),month:(e,t)=>pe.date(e,t,"month"),year:(e,t)=>pe.date(e,t,"year"),time:(e,n)=>{var r;const{dataIndex:i}=n,{type:l,extra:a={},rules:o=[],onChange:s}=T,c="HH:mm:ss",d=da(e,i);return t.createElement(kn,{size:f,popupClassName:au.popupClassName,value:null!==(r=ga(d,c))&&void 0!==r?r:void 0,format:a.format||c,placeholder:a.placeholder,allowClear:a.allowClear,disabled:a.disabled,style:{width:"100%"},onChange:t=>{const r=va(t,c);ua(e,i,r),y(o,r,u,p,xa(n.title)),ce(e,u,p),null==s||s({[Y]:r},e),ie()}})},checkbox:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],onChange:o}=T,{trueValue:s=Ud,falseValue:c=Gd,disabled:d}=l,h=da(e,r);return t.createElement(M,{checked:h===s,disabled:d,onChange:t=>{const i=t.target.checked?s:c;ua(e,r,i),y(a,i,u,p,xa(n.title)),ce(e,u,p),null==o||o({[Y]:i},e),ie()}})},switch:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],onChange:o}=T,{trueValue:s=Ud,falseValue:c=Gd,disabled:d}=l,h=da(e,r);return t.createElement(K,{checked:h===s,disabled:d,onChange:t=>{const i=t?s:c;ua(e,r,i),y(a,i,u,p,xa(n.title)),ce(e,u,p),null==o||o({[Y]:i},e),ie()}})},"search-helper":(e,n)=>{var r;const{dataIndex:i,precision:l}=n,{type:a,extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,v=pa(e,ne?c.combinedDataIndex:i),b=c.fieldAliasMap;b||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(i)||nr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(c.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||nr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[i].includes("|")&&nr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=e=>{const{filterAliasMap:t}=c,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],l={[i]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(ae(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},C=e=>{const{autoQueryAssign:t=!0}=c;t&&(_.current=E(e)),q(!0)},S=(t,r)=>{const{beforeOpen:i}=c,l=(null!=i?i:Wn)({[Y]:v},e,n);(null==l?void 0:l.then)?l.then((()=>{C(t),null==r||r()})).catch((()=>{})):!1!==l&&(C(t),null==r||r())},N=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=pa(e,r))}const n=x[i]?pa(e,x[i]):"";R(n,t);const{closed:r}=c;q(!1),null==r||r(e)},I=()=>{const{onlySelect:e=!0}=c;P.current&&R(e?"":v),q(!1)},R=(t="",r)=>{var a;if(ae(r)&&Object.keys(r).length)for(const t in r){const n=r[t],i=g.find((e=>e.dataIndex===t));if(i){ua(e,t,n,i.precision);const r=null===(a=i.editRender)||void 0===a?void 0:a.call(i,e,i);r&&Array.isArray(r.rules)&&y(r.rules,n,u,t,xa(i.title))}else ua(e,t,n)}ne&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return ua(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&ua(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),ua(e,i,t,l),y(s,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie(),_.current={},P.current=!1,U(void 0)},O={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{I()}},k=Object.assign(Object.assign({},c),{size:f,initialValue:Object.assign({},_.current,c.initialValue),onClose:e=>{e?N(e):I()}});return t.createElement(t.Fragment,null,t.createElement(_p,{ref:L,value:null!=B?B:v,placeholder:o.placeholder||w("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,readOnly:o.readOnly,disabled:o.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:l}=c;if(P.current&&!$)return n&&r&&(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=c,{beforeFetch:r=Wn}=t.fetch;return new Promise(((i,l)=>Mn(void 0,void 0,void 0,(function*(){var a;const o=ve({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(o))return l();z(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=ue(e.data,t.fetch.dataKey))&&void 0!==a?a:[];i(n)}else l()}catch(e){l(e)}finally{Un((()=>z(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>pa(e,x[i]).toString().includes(t)));if(1===n.length)return N(n[0]);S(t)})(e,n))).catch((()=>R(""))):void R(n)},onChange:e=>{const{value:t}=e.target;null==d||d({[Y]:t}),P.current=!0,U(t)},onKeyDown:e=>{var t;if(13===e.keyCode){const n=null!==(t=e.target.value)&&void 0!==t?t:"";!$&&S(n)}},onDoubleClick:e=>{const{value:t}=e.target;S(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&S(e)}}),t.createElement(Ll,O,t.createElement(Gp,k)))},"search-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:l,items:a=[],extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=da(e,i),v=c.fieldAliasMap;v||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||nr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),D.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Wn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},C=()=>{q(!1)},S=t=>{ua(e,i,t),y(s,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,F.current),ie()},N={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{C()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ve({},c.initialValue),defaultSelectedKeys:g,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=b;le(ye([...F.current.filter((e=>t.includes(e[r]))),...e],r));const i=F.current.map((e=>({text:e[n],value:e[r]}))),l=ye([...i,...a],"value").filter((e=>t.includes(e.value)));W(l),S(l.map((e=>e.value)));const{closed:o}=c;q(!1),null==o||o(F.current)})(e,t):C()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(H,{mode:"multiple",open:!1,value:g,placeholder:o.placeholder||w("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&&!$&&x()},onDoubleClick:()=>{o.disabled||x()},onChange:e=>{const{valueKey:t}=b;le(F.current.filter((n=>e.includes(n[t])))),S(e)}},V.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:o.disabled,icon:t.createElement(Ge,null),onClick:()=>{x()}})))),t.createElement(Ll,N,t.createElement(Gp,I)))},"tree-helper":(e,n)=>{var r,i;const{dataIndex:l,precision:a}=n,{type:o,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:m}=T,v=pa(e,ne?d.combinedDataIndex:l),b=d.fieldAliasMap;b||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(l)||nr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||nr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[l].includes("|")&&nr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:r}=d,i=(null!=r?r:Wn)({[Y]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},C=()=>{q(!1)},S=(t="",r)=>{var i;if(ae(r)&&Object.keys(r).length)for(const t in r){const n=r[t],l=g.find((e=>e.dataIndex===t));if(l){ua(e,t,n,l.precision);const r=null===(i=l.editRender)||void 0===i?void 0:i.call(l,e,l);r&&Array.isArray(r.rules)&&y(r.rules,n,u,t,xa(l.title))}else ua(e,t,n)}ua(e,l,t,a),y(c,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},N={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{C()}},I=Object.assign(Object.assign({},d),{defaultSelectedKeys:[v],size:f,onClose:e=>{e?(e=>{const t={};for(const n in x){const r=x[n];n!==l&&(t[n]=pa(e,r))}const n=x[l]?pa(e,x[l]):"";S(n,t);const{closed:r}=d;q(!1),null==r||r(e)})(e):C()}});return t.createElement(t.Fragment,null,t.createElement(_p,{ref:A,value:v,allowClear:null===(i=s.allowClear)||void 0===i||i,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||w("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!$&&E())},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?E():S(""))}}),t.createElement(Ll,N,t.createElement(Jp,I)))},"tree-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:l,extra:a={},items:o=[],rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=da(e,i),v=c.fieldAliasMap;v||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||nr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),D.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Wn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},C=()=>{q(!1)},S=t=>{ua(e,i,t),y(s,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,F.current),ie()},N={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{C()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ve({},c.initialValue),defaultSelectedKeys:g,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=b;le(e);const r=F.current.map((e=>({text:e[t],value:e[n]})));W(r),S(r.map((e=>e.value)));const{closed:i}=c;q(!1),null==i||i(F.current)})(e):C()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(H,{mode:"multiple",open:!1,value:g,placeholder:a.placeholder||w("qm.table.editable.selectPlaceholder"),allowClear:a.allowClear,maxTagCount:a.collapseTags?"responsive":void 0,maxTagTextLength:a.maxTagTextLength,disabled:a.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!$&&x()},onDoubleClick:()=>{a.disabled||x()},onChange:e=>{const{valueKey:t}=b;le(F.current.filter((n=>e.includes(n[t])))),S(e)}},V.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:a.disabled,icon:t.createElement(Ge,null),onClick:()=>{x()}})))),t.createElement(Ll,N,t.createElement(Jp,I)))},custom:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],render:o,onChange:s}=T;if(!o)return nr("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const c=da(e,r),d=t=>{ua(e,r,t),y(a,t,u,p,xa(n.title)),ce(e,u,p),null==s||s({[Y]:t},e),ie()},h=o(e,n,d);return t.isValidElement(h)?t.cloneElement(h,{value:c,disabled:l.disabled,readOnly:l.readOnly,popupClassName:au.popupClassName,onChange:d}):null}};return t.createElement(t.Fragment,null,te?(()=>{const{type:e}=T,n=pe[e];if(!n)return nr("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!Q}];return t.createElement("div",{ref:I,className:_e(r)},n(d,c),!Q&&t.createElement("div",{className:"cell-error"},Z||J))})():(()=>{const{disabled:n,extra:r={}}=T,{disabledColor:i,disabledBgColor:l}=r,a=["cell--show",{"is-cell-bg":n&&l}];return t.createElement(t.Fragment,null,t.createElement("span",{className:_e(a),style:{color:n?i:""}},e.children),n&&l&&t.createElement("i",{className:"cell--bg",style:{background:l}}))})(),ee&&t.createElement("i",{className:"cell--sign"}))}));Dp.displayName="CellEdit";const Hp=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,Mp=e=>{const{text:n,options:r,showMessage:i=!0,onCopy:l}=e,{t:a}=Fn();return Hp(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=Yt(n,r);null==l||l(n,c),c&&i&&R.success(a("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Mp.displayName="QmCopyToClipboard";const Fp=t.forwardRef(((n,r)=>{const{column:i,row:l,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c}=n,{tableRef:d,selectionKeys:u,treeExpandIndex:p,updateMark:h}=t.useContext(zd),{dataIndex:m,canCopy:f,render:g,editRender:v,shouldCellUpdate:y}=i,{t:b}=Fn(),{renderText:x,getTitleFromCellNode:E}=vu(),w=t.useRef(null),C=da(l,m),[S,N]=function(t,n,r){const i=e.useRef({});return"value"in i.current&&!r(i.current.condition,n)||(i.current.value=t(),i.current.condition=n),i.current.value}((()=>{const e=g?g(C,l,i,a,o):x(C,i,l);return[e,v?t.createElement(Dp,{ref:r,column:i,record:l,rowKey:s,columnKey:m},e):null]}),[h,l,C,g,v],((e,t)=>{if(y){const[,n]=e,[,r]=t;return y(r,n,l)}return!Oa(e,t,!0)}));t.useEffect((()=>{if([au.expandableColumn,au.selectionColumn,au.operationColumn].includes(m))return;const e=w.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const T=e=>Array.isArray(e.children);return t.createElement("div",{ref:w,className:"cell"},(()=>{if(m===au.expandableColumn)return t.createElement(Ap,{record:l,rowKey:s});if(m===au.selectionColumn)return t.createElement(Lp,{selectionKeys:u,column:i,record:l,rowKey:s});if(N)return N;if(d.current.isTreeTable&&m===p)return t.createElement(t.Fragment,null,(e=l._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*au.treeTable.textIndent+"px"}}):null,t.createElement(Ap,{key:"expand",record:l,rowKey:s,style:T(l)?{}:{visibility:"hidden"}}),S);var e;if(f){const e=E(S);return t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},S),e&&t.createElement(Mp,{text:e},t.createElement(ot,{className:"icon",title:b("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Fp.displayName="Cell";const $p={open:!1,offsetX:0,offsetY:0},qp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:l,tableFlatData:a,flattenColumns:o,mergedTdCells:s,setMergedCells:c}=t.useContext(zd),{areaSelection:d={}}=r.current.props,{elementStore:u}=r.current,{t:p}=Fn(),h=t.useRef(document.onselectstart),m=t.useRef(null),f=t.useRef(null),g=t.useRef(null),v=e=>{g.current=e},[y,b]=t.useState(null),[x,E]=t.useState(null),[w,C]=t.useState(null),S=e=>{if(!e)return C(null);let t=!1;for(const n in e)if((null==w?void 0:w[n])!==e[n]){t=!0;break}t&&C(Object.assign({},w,e))};Rp({ref:m,handler:()=>q()}),t.useEffect((()=>{const e=jt(u.$tableBody,"mousedown",_),t=jt(u.$tableBody,"contextmenu",A),n=jt(document,"keydown",P);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const N=()=>{b(null),S(null),v(null),E(null)};t.useImperativeHandle(n,(()=>({blur:N})));const T=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},I=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,i]=[1/0,-1/0,1/0,-1/0];for(const l of e)t=Math.min(t,l.rowStart),n=Math.max(n,l.rowEnd),r=Math.min(r,l.colStart),i=Math.max(i,l.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:i}},k=dl((e=>{let t=O([R(e),g.current]);s.forEach((e=>{const n=a.findIndex((t=>i(t,t.index)===e.rowKey)),r=o.findIndex((t=>t.dataIndex===e.dataIndex)),l={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+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),L=e=>{var t;c(e),null===(t=d.onCellMerge)||void 0===t||t.call(d,e),Un((()=>N()))},A=$n((e=>{d.cellMerge&&y&&F(e.clientX,e.clientY)?(e.preventDefault(),$(e)):(null==x?void 0:x.open)&&q()})),P=$n((e=>{27===e.keyCode&&N()})),_=$n((e=>{e.stopPropagation();const t=T(e.target);if(1!==e.buttons||!t)return;q();const n=I(t);b(n);const r=R(n);v(r),S(r),document.addEventListener("mousemove",D),document.addEventListener("mouseup",H),h.current=document.onselectstart,document.onselectstart=()=>!1})),D=$n((e=>{const t=T(e.target);t&&k(I(t))})),H=$n((()=>{var e;null===(e=d.onSelectChange)||void 0===e||e.call(d,(()=>{const e=[];if(!y||!w)return e;for(let t=w.rowStart;t<w.rowEnd;t++)for(let n=w.colStart;n<w.colEnd;n++)e.push({rowKey:i(a[t],a[t].index),dataIndex:o[n].dataIndex,cellValue:da(a[t],o[n].dataIndex)});return e})()),document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",H),M()})),M=()=>{document.onselectstart!==h.current&&(document.onselectstart=h.current)},F=(e,t)=>{const{top:n,left:r}=u.$tableBody.parentNode.getBoundingClientRect(),[i,l]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=V();return!(i<a||i>a+s||l<o||l>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))})},q=()=>{E((e=>Object.assign(Object.assign({},e),{open:!1})))},j=e=>({rowIndex:a.findIndex((t=>i(t,t.index)===e.rowKey)),colIndex:o.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),K=()=>{if(!y||!w||(t=w,(e=y).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:i(a[w.rowStart],a[w.rowStart].index),dataIndex:o[w.colStart].dataIndex,rowSpan:w.rowEnd-w.rowStart,colSpan:w.colEnd-w.colStart};L([...s.filter((e=>!((e,t)=>{const n=j(e),r=j(t),[i,l,a,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 i<=s&&l<=c&&a>=d&&o>=u||s<=i&&c<=l&&d>=a&&u>=o})(e,n))),n])},z=()=>{const e=i(a[w.rowStart],a[w.rowStart].index),t=o[w.colStart].dataIndex;L(s.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},V=()=>{const{w:e,h:t,l:n,t:i}=y,l=o.slice(0,w.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),a=r.current.rowHeight*w.rowStart;return{sl:n,st:i,sw:e,sh:t,el:l,et:a,ew:o.slice(0,w.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-l,eh:r.current.rowHeight*w.rowEnd-a}};return t.createElement("div",{className:`${l}--area-select`},(()=>{if(!y||!w)return null;const{sl:e,st:n,sw:r,sh:i,el:l,et:a,ew:o,eh:s}=V(),{open:c,offsetX:d,offsetY:u}=x||$p,h=t.createElement("ul",{ref:m,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:K},p("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:z},p("qm.table.areaSelect.cancelMerge")));return t.createElement(t.Fragment,null,t.createElement("div",{className:"active-area",style:{left:e,top:n,width:r,height:i}}),t.createElement(uc,{popupVisible:c,popup:h,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:au.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},t.createElement("div",{ref:f,className:"checked-area",style:{left:l,top:a,width:o,height:s}})))})())}));qp.displayName="AreaSelect";const jp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:l,tableFlatData:a,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:p,layout:h,showFooter:m,selectionKeys:f,rowExpandedKeys:g,highlightKey:v,isPingLeft:y,isPingRight:b,isTableEmpty:x,isGroupSubtotal:E,setElementStore:w,setSelectionKeysEffect:C,setHighlightKey:S,getStickyLeft:N,getStickyRight:T,setPingLeft:I,setPingRight:R,setFullScreen:O,findParentRowKeys:k,getAllChildRowKeys:L,scrollBottomDebouncer:A}=t.useContext(zd),{height:P,minHeight:_,maxHeight:D,rowHeight:H,rowSelection:M,rowHighlight:F,expandable:$,stripe:q,summation:j,rowStyle:K,cellStyle:z,spanMethod:V,tableConfig:W,areaSelection:B,ellipsis:U,showHeader:G,rowDraggable:Y,onRowClick:X,onRowDblclick:Q,onRowContextmenu:Z,onRowEnter:J}=r.current.props,ee=t.useRef(null),te=t.useRef({}),ne=t.useRef(null),re=t.useRef({prevST:0,prevSL:0}),{onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de,indent:ue,dropOptions:pe}=Sp({openDragSort:Y}),{rowVirtualizer:me,columnVirtualizer:fe,virtualRows:ge,virtualColumns:ve,resetItemXSize:ye,getYIndexes:be,virtualTranslateY:xe,virtualTranslateX:Ee,calcVirtualYSize:we,calcVirtualXSize:Ce,scrollToYIndex:Se}=((e,n)=>{var r;const{tableRef:i}=t.useContext(zd),{props:l,scrollBarRef:a,rowHeight:o}=i.current,s=(null===(r=l.tableConfig)||void 0===r?void 0:r.overscan)||1,c=t.useMemo((()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[a.current]),d=t.useMemo((()=>{const e=[],t=[];return n.forEach(((n,r)=>{"left"===n.fixed&&e.push(r),"right"===n.fixed&&t.push(r)})),[e,t]}),[n]),u=yp({count:e.length,getScrollElement:()=>c,estimateSize:()=>o,indexAttribute:"data-row-index",overscan:s,enabled:i.current.scrollYLoad}),p=u.getVirtualItems(),h=yp({horizontal:!0,count:n.length,getScrollElement:()=>c,estimateSize:e=>n[e].width||n[e].renderWidth||0,indexAttribute:"data-col-index",overscan:s,enabled:i.current.scrollXLoad,rangeExtractor:e=>[...new Set([...d[0],...sp(e),...d[1]])]}),m=h.getVirtualItems();return{rowVirtualizer:u,columnVirtualizer:h,virtualRows:p,virtualColumns:m,resetItemXSize:e=>{e.forEach(((e,t)=>{h.resizeItem(t,e.width||e.renderWidth||au.defaultColumnWidth)}))},getYIndexes:()=>u.getIndexes()||[],getXIndexes:()=>h.getIndexes()||[],virtualTranslateY:()=>{var e,t;return null!==(t=null===(e=p[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},virtualTranslateX:()=>{var e,t,n,r,i,l,a;const o=d[0].length;return o?(null===(n=m[o])||void 0===n?void 0:n.index)===o?null!==(i=null===(r=m[0])||void 0===r?void 0:r.start)&&void 0!==i?i:0:(null!==(a=null===(l=m[o])||void 0===l?void 0:l.start)&&void 0!==a?a:0)-m.slice(0,o).reduce(((e,t)=>e+t.size),0):null!==(t=null===(e=m[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},calcVirtualYSize:()=>u.getTotalSize()||void 0,calcVirtualXSize:()=>h.getTotalSize()||void 0,scrollToYIndex:e=>{u.scrollToIndex(e)},scrollToXIndex:e=>{h.scrollToIndex(e)}}})(a,o),Ne=be(),Te=e=>{if(e&&!U)return me.measureElement(e)},Ie=t.useMemo((()=>u.length&&r.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:i,colSpan:l})=>{const a=e+i-1,o=[];for(let t=e;t<=a;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:l});for(let i=t;i<t+l;i++)0===r&&i===t||n.push({row:e,col:i,rowSpan:0,colSpan:0})}))})),n})(u,Ne):u),[u,Ne.join(",")]),[Re,Oe]=t.useState([]),ke=Op();Rp({ref:ee,omitClassNames:[`.${au.popupClassName}`],handler:()=>{var e;Ve([]),null===(e=ne.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:Ve,createFocus:Fe,forceUpdate:ke,resetItemXSize:ye,scrollToYIndex:Se}))),$i((()=>{Re.length&&r.current.tableManager.focus(r.current.uid)}),[Re]),t.useLayoutEffect((()=>{Me();const e=jt(document,"keydown",Pe);return()=>e.remove()}),[]);const Le=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:i}=h,l={};return x&&Object.assign(l,{minHeight:"100px"}),_&&Object.assign(l,{minHeight:sa(_)-e-n+"px"}),D&&Object.assign(l,{maxHeight:sa(D)-e-n+"px"}),P||r||i?Object.assign(Object.assign({},l),{maxHeight:"",minHeight:"",height:`${t}px`}):l}),[P,D,_,x,h]),Ae=$n((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:i}=re.current,{scrollTop:l,scrollLeft:a}=e;if(a!==i){G&&(t.$header.scrollLeft=a),m&&(t.$footer.scrollLeft=a);const e=a>0,n=Math.ceil(a)+h.tableWidth<h.tableBodyWidth;y!==e&&I(e),b!==n&&R(n)}l!==n&&Math.ceil(l)+h.viewportHeight>=ee.current.parentNode.offsetHeight&&A({type:"scroll",target:e,preventDefault:Vn,stopPropagation:Vn}),re.current={prevST:l,prevSL:a}})),Pe=$n((e=>{var t,n,l,o,c,d,u;const{keyCode:p}=e;if(r.current.uid===(null===(t=r.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id)&&(27===p&&(Ve([]),S(""),O(!1)),Re.length&&(Yi(document.activeElement,ee.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===p&&("radio"===(null==M?void 0:M.type)||F)){const t=null!==(o=null!==(l=f[0])&&void 0!==l?l:v)&&void 0!==o?o:null,n=null!==(c=a.find((e=>i(e,e.index)===t)))&&void 0!==c?c:null;n&&(null==J||J(n,e))}if(!je(Re[0],Re[1])){if(38===p||40===p){Ki(e);const t=a.length;let n=a.findIndex((e=>i(e,e.index)===Re[0]));const r=38===p?(--n+t)%t:++n%t,l=a[r],o=i(l,l.index),s=qe(o,Re[1]);"radio"!==(null==M?void 0:M.type)||(null===(d=M.disabled)||void 0===d?void 0:d.call(M,l))||s||C([o]),!F||(null===(u=F.disabled)||void 0===u?void 0:u.call(F,l))||s||S(o),De(38===p?"top":"bottom",r),$e(...Re),Ve([o,Re[1]])}if(9===p||e.shiftKey&&9===p){if(Ki(e),!s.length)return Ve([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Re[1]));const r=e.shiftKey&&9===p?(--n+t)%t:++n%t;$e(...Re),He(e.shiftKey&&9===p?"left":"right",r),Ve([Re[0],s[r].dataIndex])}}}})),De=(e,t)=>{const{scrollBarRef:n,scrollYLoad:i}=r.current;if(i)return me.scrollToIndex(t);const l=a.length,o=t,s=ee.current.querySelectorAll("tbody > tr"),c=a.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<n.current.scrollTop?n.current.SET_SCROLL_TOP(c):t===l-1&&n.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):c+d>n.current.scrollTop+h.viewportHeight?n.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):0===t&&n.current.SET_SCROLL_TOP(c)},He=(e,t)=>{const{scrollBarRef:n}=r.current,i=s.length,l=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),a=o.slice(0,l).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[l].width||o[l].renderWidth,p=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),m=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?a<n.current.scrollLeft+p?n.current.SET_SCROLL_LEFT(a-p):t===i-1&&n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+m):a+u>n.current.scrollLeft+(h.tableWidth-m)?n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+m):0===t&&n.current.SET_SCROLL_LEFT(a-p)},Me=()=>{w("$tableBody",ee.current)},Fe=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.focus()},$e=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.blur()},qe=(e,t)=>{var n,r;return null!==(r=null===(n=te.current[`${e}-${t}`])||void 0===n?void 0:n.isEditable())&&void 0!==r&&r},je=(e,t)=>{var n,r;return null!==(r=null===(n=te.current[`${e}-${t}`])||void 0===n?void 0:n.isOpening())&&void 0!==r&&r},Ke=e=>{const t=j.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},ze=(e,t,n)=>{var l;const{dataIndex:a}=n;if([au.expandableColumn,au.operationColumn].includes(a))return;const o=i(t,t.index);Ve([o,a]);const s=qe(o,a),{type:c,selectByClickRow:d=!0,disabled:u=Vn}=M||{};!c||u(t)||s||(d||a===au.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:i=!0,onSelect:l}=M||{};if("radio"===n&&C([e]),"checkbox"===n){const n=!f.includes(e),a=r.current.isTreeTable&&!i?Be(e,f,n):We(e,f,n);C(a),null==l||l(n,t,a)}})(o,t),[au.selectionColumn].includes(a)||(!F||(null===(l=F.disabled)||void 0===l?void 0:l.call(F,t))||s||S(o),null==X||X(t,n,e))},Ve=e=>{he(e,Re)||Oe(e)},We=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Be=(e,t,n)=>{var i;const{disabled:l}=M||{},{deriveRowKeys:a,recordsMap:o}=r.current,s=ta(a,e);let c=[],d=L((null==s?void 0:s.children)||[]);l&&(d=d.filter((e=>!o.has(e)||!l(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(i=Na(a,e))||void 0===i?void 0:i.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=ta(a,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>c.includes(e.rowKey)));c=r?[...c,e]:c.filter((t=>t!==e))})),c},Ue=(e,n,i)=>{const{scrollXLoad:l}=r.current,{disabled:a}=M||{},s=["body--row",Object.assign({"body--row-striped":q&&n%2!=0,"body--row-selected":f.includes(i)&&!(null==a?void 0:a(e)),"body--row-current":v===i},E?Ke(e._group):null)],c=(l?ve:o).map(((t,r)=>Ge(l?o[t.index]:t,l?t.index:r,e,n,i)));return Y?t.createElement(kp,{key:i,ref:Te,className:_e(s),rowKey:i,rowIndex:n,row:e,indent:ue,filter:".cell--edit input",dropOption:pe,onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de},c):t.createElement("tr",{key:i,ref:Te,"data-row-key":i,"data-row-index":n,className:_e(s)},c)},Ge=(e,n,r,i,l)=>{var a,o,s;const{dataIndex:u,fixed:h,align:m,className:f=""}=e,{rowSpan:g,colSpan:v}=Ye(r,e,i,n);if(!g||!v)return null;const y=null!==(a=e.ellipsis)&&void 0!==a?a:U,b=["body--column",{"col--ellipsis":y,"col--center":"center"===m,"col--right":"right"===m,"column--sort":!!p[u],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(o=c[c.length-v])||void 0===o?void 0:o.dataIndex)===u,"cell-fix-right-first":"right"===h&&(null===(s=d[0])||void 0===s?void 0:s.dataIndex)===u,[f]:!!f}],x={left:"left"===h?`${N(u)}px`:"",right:"right"===h?`${T(u)}px`:""},w=K?"function"==typeof K?K(r,i):K:null,C=z?"function"==typeof z?z(r,e,i,n):z:null,S=E?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=j.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,I=Object.assign({},x,{height:H},S,w,C);return t.createElement("td",{key:u,"data-col-index":n,rowSpan:g>1?g:void 0,colSpan:v>1?v:void 0,className:_e(b),style:I,onClick:t=>ze(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[au.expandableColumn,au.selectionColumn,au.operationColumn].includes(r)||null==Q||Q(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[au.expandableColumn,au.selectionColumn,au.operationColumn].includes(r)||null==Z||Z(t,n,e)})(t,r,e)},t.createElement(Fp,{ref:e=>te.current[`${l}-${u}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:l,showTitle:y}))},Ye=(e,t,n,r)=>{var i;let l=1,o=1;const s=V;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(c)?(l=c[0],o=c[1]):ae(c)&&(l=c.rowSpan,o=c.colSpan);const d=null!==(i=Ne[0])&&void 0!==i?i:0;if(e===a[d]&&0===l)for(let e=d;e<a.length;e++){const n=s({row:a[e],column:t,rowIndex:e,columnIndex:r,tableData:a});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;l++}}if(Ie.length>0){const e=Ie.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,o=e.colSpan)}return{rowSpan:l,colSpan:o}};return t.createElement(t.Fragment,null,t.createElement(fl,{ref:r.current.scrollBarRef,wrapClassName:`${l}--body-wrapper`,wrapStyle:Le,innerStyle:{height:we(),width:Ce()},showTopScrollbar:null==W?void 0:W.doubleXScrollbar,onScroll:Ae},t.createElement(rp.Provider,{value:Re},t.createElement("table",{ref:ee,style:{width:0,marginTop:xe(),marginLeft:Ee()},className:`${l}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=r.current;return t.createElement("colgroup",null,(e?ve:o).map((n=>{const{dataIndex:r,width:i,renderWidth:l}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${i||l}px`,minWidth:`${i||l}px`}})})))})(),t.createElement("tbody",null,(e=>{const{scrollYLoad:n,scrollXLoad:l}=r.current,s=[];return(n?e:a).forEach(((e,r)=>{const c=n?a[e.index]:e,d=n?e.index:r,u=i(c,c.index);if(s.push(Ue(c,d,u)),null==$?void 0:$.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=Wn}=$;g.includes(u)&&n(c)&&s.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:(l?ve:o).length,className:"body--column",style:{paddingLeft:M?2*au.selectionColumnWidth:au.selectionColumnWidth}},t.createElement("div",{className:_e("cell",e)},$.expandedRowRender(c,d)))))}})),s})(ge)))),!!B&&t.createElement(qp,{ref:ne})))}));jp.displayName="TableBody";const Kp=()=>{const{tableRef:e,prefixCls:n,sorter:r,layout:i,flattenColumns:l,leftFixedColumns:a,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=t.useContext(zd),{footRender:p}=e.current.props,{t:h}=Fn(),m=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",m.current)},g=(n,i,l)=>{var s,c;const{dataIndex:p,fixed:m,align:f,summation:g}=n,v=["footer--column","col--ellipsis",{"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!r[p],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&(null===(s=a[a.length-1])||void 0===s?void 0:s.dataIndex)===p,"cell-fix-right-first":"right"===m&&(null===(c=o[0])||void 0===c?void 0:c.dataIndex)===p}],y={left:"left"===m?`${d(p)}px`:"",right:"right"===m?`${u(p)}px`:""},b=(null==g?void 0:g.render)?g.render(e.current.tableFullData):da(i,`${p}_text`),x=0===l&&""===b?h("qm.table.config.summaryText"):b;return t.createElement("td",{key:p,title:x,className:_e(v),style:Object.assign({},y)},t.createElement("div",{className:"cell"},x))},{tableBodyWidth:v}=i;return t.createElement("div",{ref:m,className:`${n}--footer-wrapper`},p?p(l,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}px`:""}},t.createElement("colgroup",null,l.map((e=>{const{dataIndex:n,width:r,renderWidth:i}=e;return t.createElement("col",{key:n,style:{width:`${r||i}px`,minWidth:`${r||i}px`}})}))),t.createElement("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},l.map(((t,n)=>g(t,e,n)))))))))};var zp;!function(e){e.small="small",e.middle="default",e.large="default"}(zp||(zp={}));const Vp=e=>{var n,r,i,l;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(sn),{tableRef:u,prefixCls:p,$size:h,setElementStore:m}=t.useContext(zd),{uniqueKey:f,paginationConfig:g,infoBarConfig:v}=u.current.props,y=t.useRef(null),b=t.useMemo((()=>f?`tablePager_${f}`:""),[f]);t.useLayoutEffect((()=>{x(),S()}),[]);const x=()=>{m("$pager",y.current)},E=null!==(n=null==g?void 0:g.showSizeChanger)&&void 0!==n?n:au.pagination.showSizeChanger,w=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:au.pagination.showQuickJumper,C=(null==g?void 0:g.pageSizeOptions)||(null===(l=null===(i=null==d?void 0:d.table)||void 0===i?void 0:i.pagination)||void 0===l?void 0:l.pageSizeOptions)||au.pagination.pageSizeOptions,S=()=>Mn(void 0,void 0,void 0,(function*(){if(!b)return;const e=yield N(b);e&&e!==o&&(c(a,e),localStorage.setItem(b,e.toString()))})),N=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t&&!localStorage.getItem(b))try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),T=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),I={[`${p}-pager`]:!0};return t.createElement("div",{ref:y,className:_e(I)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==v?void 0:v.position)&&t.createElement(mu,{total:s})),t.createElement(Q,{size:zp[h],showSizeChanger:E,showQuickJumper:w,pageSizeOptions:C,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},Wp=()=>{const{prefixCls:e,layout:n}=t.useContext(zd),r=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t}=n;return{top:`${e}px`,height:`${t}px`}}),[n]);return t.createElement("div",{className:`${e}--empty`,style:r},t.createElement(nl,null))},Bp=()=>{const{prefixCls:e,setElementStore:n}=t.useContext(zd),r=t.useRef(null);t.useLayoutEffect((()=>{i()}),[]);const i=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},Up=t.forwardRef(((e,n)=>{const r=hn(Wd,e),{rowKey:i,columns:l,loading:a,resizable:o,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:p,topSpaceAlign:h,showTableInfo:m,showFullScreen:f,showRefresh:g,showToolBox:v,showHeader:y,className:b,style:x}=r,{$size:E}=qn(r),w=t.useRef(null),C=t.useRef(null),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=ar("table"),R=$n(((e,t)=>{const n="function"==typeof i?i(e,t):null==e?void 0:e[i];return void 0===n?(nr("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:O,tableFullData:k,setElementStore:L,setOriginColumns:A,setTableFullData:P,setTableOriginData:_,setAllTableData:D,setDeriveRowKeys:H,setInvalidRowKeys:M,setFieldAuth:F,setColumnsDefined:$,setScrollXLoad:q,setScrollYLoad:j,setResizeState:K,setHandleState:z,setSummaries:V,setSelectionRows:W,setShouldToTop:B,setRecordsMap:U,setUnMounted:G,clearElementStore:Y,clearRecordsMap:X}=((e,{getRowKey:n,$size:r})=>{const{rowHeight:i,dynamicThead:l}=e,a=t.useRef({props:e,uid:nu(),tableManager:iu,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],allParentRowKeys:[],deriveRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!l,scrollBarRef:t.createRef(),rowHeight:i||au.rowHeightMaps[r],store:new lu,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:!jn&&/MSIE|Trident/.test(navigator.userAgent)});var o;o=e,a.current.props=o;const s=(e,t,r="",i=0)=>e.map((e=>{const l=n(e,e.index),a=r?`${r}.${e.index+1}`:`${e.index+1}`,o={level:i,rowKey:l,indexPath:a};return e.indexPath=a,e._level=i,e._parentRowKey=i?t:null,Array.isArray(e.children)&&(o.children=s(e.children,l,a,i+1)),t?Object.assign(o,{parentRowKey:t}):o}));return Object.assign(Object.assign({tableRef:a},a.current),{setElementStore:(e,t)=>{a.current.elementStore[e]=t},setOriginColumns:e=>{a.current.originColumns=e},setTableFullData:e=>{a.current.tableFullData=e},setTableOriginData:e=>{a.current.tableOriginData=e},setAllTableData:e=>{const t=na(e);a.current.allTableData=t,a.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{const t=e.some((e=>Array.isArray(e.children)));a.current.isTreeTable=t,a.current.deriveRowKeys=t?s(e,""):[],a.current.allParentRowKeys=t?ra(e,(e=>n(e,e.index))):[]},setInvalidRowKeys:e=>{a.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{a.current.fieldAuth[e]=t},setColumnsDefined:e=>{a.current.columnsDefined=e},setResizeState:e=>{a.current.resizeState=e},setHandleState:e=>{a.current.handleState=e},setSummaries:e=>{a.current.summaries=e},setScrollXLoad:e=>{a.current.scrollXLoad=e},setScrollYLoad:e=>{a.current.scrollYLoad=e},setShouldToTop:e=>{a.current.shouldToTop=e},setSelectionRows:e=>{a.current.selectionRows=e},setRecordsMap:(e,t)=>{a.current.recordsMap.set(e,t)},setUnMounted:e=>{a.current.unMounted=e},clearElementStore:()=>{for(const e in a.current.elementStore)a.current.elementStore[e]=null},clearRecordsMap:()=>{a.current.recordsMap.clear()}})})(r,{getRowKey:R,$size:E}),{tableFlatData:Q,setTableFlatData:Z,filters:J,setFilters:ee,sorter:te,setSorter:ne,superFilters:re,setSuperFilters:ie,pagination:le,setPagination:oe,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:pe,setHighlightKey:fe,updateMark:ge,forceUpdate:ve,mergedTdCells:ye,setMergedCells:be,layout:xe,setLayout:Ee,permission:we,setPermission:Ce,spinning:Se,setSpinning:Ne,isPingLeft:Te,setPingLeft:Ie,isPingRight:Re,setPingRight:Oe,isFullScreen:ke,setFullScreen:Le,updateTableFlatData:Ae}=(e=>{var n,r,i,l,a,o,s,c,d,u,p;const{uniqueKey:h,initialSorter:m={},initialFilter:f={},paginationConfig:g,rowSelection:v,expandable:y,rowHighlight:b,mergedCells:x}=e,{global:E}=t.useContext(sn),w={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:au.pagination.current,pageSize:null!==(o=null!==(i=null!==(r=(()=>{if(h)return Number(localStorage.getItem(`tablePager_${h}`))||void 0})())&&void 0!==r?r:null==g?void 0:g.pageSize)&&void 0!==i?i:null===(a=null===(l=null==E?void 0:E.table)||void 0===l?void 0:l.pagination)||void 0===a?void 0:a.pageSize)&&void 0!==o?o:au.pagination.pageSize,total:0},C=null!==(c=null!==(s=null==v?void 0:v.selectedRowKeys)&&void 0!==s?s:null==v?void 0:v.defaultSelectedRowKeys)&&void 0!==c?c:[],S=null!==(u=null!==(d=null==y?void 0:y.expandedRowKeys)&&void 0!==d?d:null==y?void 0:y.defaultExpandedRowKeys)&&void 0!==u?u:[],[N,T]=t.useState([]),[I,R]=t.useReducer(((e,t)=>he(e,t)?e:t),f),[O,k]=t.useReducer(((e,t)=>he(e,t)?e:t),m),[L,A]=t.useReducer(((e,t)=>he(e,t)?e:t),[]),[P,_]=t.useState(w),[D,H]=t.useReducer(((e,t)=>he(e,t)?e:t),C),[M,F]=t.useReducer(((e,t)=>he(e,t)?e:t),S),[$,q]=t.useState(null!==(p=null==b?void 0:b.currentRowKey)&&void 0!==p?p:""),[j,K]=t.useReducer((e=>e+1),0),[z,V]=su([],{value:x}),[W,B]=t.useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[U,G]=t.useState({export:!0,import:!0,print:!0}),[Y,X]=t.useState(!1),[Q,Z]=t.useState(!1),[J,ee]=t.useState(!1),[te,ne]=t.useState(!1);return{tableFlatData:N,setTableFlatData:T,filters:I,setFilters:R,sorter:O,setSorter:k,superFilters:L,setSuperFilters:A,pagination:P,setPagination:_,selectionKeys:D,setSelectionKeys:H,rowExpandedKeys:M,setRowExpandedKeys:F,highlightKey:$,setHighlightKey:q,updateMark:j,forceUpdate:K,mergedTdCells:z,setMergedCells:V,layout:W,permission:U,setPermission:G,setLayout:B,spinning:Y,setSpinning:X,isPingLeft:Q,setPingLeft:Z,isPingRight:J,setPingRight:ee,isFullScreen:te,setFullScreen:ne,updateTableFlatData:()=>T([...N])}})(r),{isFetch:Pe,isWebPagination:De,isScrollPagination:He,showPagination:Me,tableColumns:Fe,flattenColumns:$e,editableColumns:qe,summationColumns:je,leftFixedColumns:Ke,rightFixedColumns:ze,derivedMergeCells:Ve,treeExpandIndex:We,showSummary:Be,showFooter:Ue,isHeadGroup:Ge,bordered:Ye,isHeadSorter:Xe,isHeadFilter:Qe,isServiceSummation:Ze,isSelectCollection:Je,isTableImport:et,isTableClipboard:tt,isSuperSearch:nt,isFastSearch:rt,isPivotGrid:it,isGroupSummary:lt,isGroupSubtotal:at,isTableEmpty:ot,summationRows:st,fetchParams:ct}=du(r,{getRowKey:R,tableRef:O,tableFullData:k,tableFlatData:Q,sorter:te,filters:J,superFilters:re,selectionKeys:se,pagination:le,mergedTdCells:ye}),{createElementStore:dt,tableStyles:ut,getSpan:pt,getStickyLeft:ht,getStickyRight:mt,scrollXToColumn:ft,scrollYToRecord:gt,calcTableHeight:vt,resetTableScroll:yt,doLayout:bt}=pu(r,{getRowKey:R,tableRef:O,topElementRef:w,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:Fe,flattenColumns:$e,leftFixedColumns:Ke,derivedMergeCells:Ve,tableFlatData:Q,layout:xe,showFooter:Ue,showPagination:Me,isFullScreen:ke,setLayout:Ee,setElementStore:L,setShouldToTop:B}),{initialTable:xt,checkDataIndex:Et,createTableFullData:wt,getTableData:Ct,createTableList:St,createTableData:Nt,createGroupData:Tt,createSelectionKeys:It,createRowExpandedKeys:Rt,setSelectionKeysEffect:Ot,findParentRowKeys:kt,getAllChildRowKeys:Lt,doFieldValidate:At,getTableLog:Pt,dataChange:_t,tableChange:Dt,toLastPage:Ht,toFirstPage:Mt,getPageCount:Ft,pagerChangeHandle:$t,scrollBottomDebouncer:qt,clearTableSorter:jt,clearTableFilter:Kt,clearSuperFilters:zt,clearRowSelection:Vt,clearRowHighlight:Wt,clearTableLog:Bt,destroy:Ut}=uu(r,{getRowKey:R,tableRef:O,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:Fe,flattenColumns:$e,tableFullData:k,pagination:le,layout:xe,filters:J,sorter:te,superFilters:re,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,summationColumns:je,isFetch:Pe,isWebPagination:De,isScrollPagination:He,isServiceSummation:Ze,isGroupSubtotal:at,doLayout:bt,setTableFlatData:Z,setTableFullData:P,setTableOriginData:_,setAllTableData:D,setDeriveRowKeys:H,setPagination:oe,setPingRight:Oe,setPingLeft:Ie,setSpinning:Ne,setSorter:ne,setFilters:ee,setSuperFilters:ie,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setScrollXLoad:q,setScrollYLoad:j,setFieldAuth:F,setResizeState:K,setSummaries:V,setPermission:Ce,setRecordsMap:U,resetTableScroll:yt,clearElementStore:Y,clearRecordsMap:X});((e,n)=>{const{columns:r,summation:i,rowSelection:l,expandable:a,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,summationRows:f,showSummary:g,isWebPagination:v,isScrollPagination:y,checkDataIndex:b,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:C,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:T,setRowExpandedKeys:I,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:L,createSelectionKeys:A,createRowExpandedKeys:P,initialTable:_,destroy:D}=n,H=t.useRef(f);$i((()=>{if(!l)return;const{onChange:e}=l;"radio"===l.type&&c.current.setClickedValues(p.length?[p[0],""]:[]),p.__prevent__||null==e||e(p,s.current.selectionRows),aa(p)}),[p]),$i((()=>{if(!a)return;const{onChange:e}=a;h.__prevent__||null==e||e(h,h.map((e=>s.current.recordsMap.get(e)))),aa(h)}),[h]),$i((()=>{var e,t;o&&(c.current.setClickedValues(m?[m,""]:[]),null===(e=o.onChange)||void 0===e||e.call(o,m,null!==(t=s.current.recordsMap.get(m))&&void 0!==t?t:null))}),[m]),$i((()=>{var e;he(f,H.current)||(H.current=f,g&&i&&(null===(e=i.onChange)||void 0===e||e.call(i,f)))}),[f]),$i((()=>{const e=A(l.selectedRowKeys);he(e,p)||N(la(e))}),[null==l?void 0:l.selectedRowKeys]),$i((()=>{const e=P(a.expandedRowKeys);he(e,h)||I(la(e))}),[null==a?void 0:a.expandedRowKeys]),$i((()=>{const{currentRowKey:e}=o;e!==m&&R(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),$i((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&C({insert:null,remove:!1})}),[u.total]),$i((()=>{L()}),[d]),$i((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||nr("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),hu({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(O(Object.assign({},e,{winHeight:n})),L())},delay:16}),t.useEffect((()=>(T(Zn(r)),_(),b(),Un((()=>L())),()=>{D(),k(!0)})),[])})(r,{tableRef:O,tableBodyRef:S,$size:E,pagination:le,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,showSummary:Be,summationRows:st,isWebPagination:De,isScrollPagination:He,checkDataIndex:Et,toLastPage:Ht,toFirstPage:Mt,getPageCount:Ft,setHandleState:z,scrollYToRecord:gt,setOriginColumns:A,setSelectionKeysEffect:Ot,setRowExpandedKeys:ue,setHighlightKey:fe,setResizeState:K,setUnMounted:G,calcTableHeight:vt,createSelectionKeys:It,createRowExpandedKeys:Rt,initialTable:xt,destroy:Ut});const Gt=t.useMemo((()=>({getRowKey:R,tableRef:O,tableBodyRef:S,prefixCls:I,$size:E,tableFlatData:Q,flattenColumns:$e,editableColumns:qe,leftFixedColumns:Ke,rightFixedColumns:ze,treeExpandIndex:We,sorter:te,filters:J,superFilters:re,layout:xe,bordered:Ye,showFooter:Ue,showSummary:Be,summationRows:st,pagination:le,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,mergedTdCells:ye,derivedMergeCells:Ve,updateMark:ge,isFetch:Pe,isPingLeft:Te,isPingRight:Re,isHeadSorter:Xe,isHeadFilter:Qe,isFullScreen:ke,isTableEmpty:ot,isHeadGroup:Ge,isGroupSubtotal:at,isWebPagination:De,dataChange:_t,tableChange:Dt,getTableData:Ct,setElementStore:L,createTableList:St,createTableFullData:wt,updateTableFlatData:Ae,setSorter:ne,setFilters:ee,setSuperFilters:ie,setHighlightKey:fe,setRowExpandedKeys:ue,setSelectionRows:W,setSelectionKeysEffect:Ot,setInvalidRowKeys:M,setMergedCells:be,getSpan:pt,getStickyLeft:ht,getStickyRight:mt,scrollXToColumn:ft,scrollYToRecord:gt,setPagination:oe,setPingLeft:Ie,setPingRight:Oe,setSpinning:Ne,setFullScreen:Le,setShouldToTop:B,doFieldValidate:At,createTableData:Nt,createGroupData:Tt,findParentRowKeys:kt,getAllChildRowKeys:Lt,scrollBottomDebouncer:qt,resetTableScroll:yt,clearTableSorter:jt,clearTableFilter:Kt,clearSuperFilters:zt,clearRowSelection:Vt,clearRowHighlight:Wt})),[E,Q,$e,te,J,re,xe,Ye,Ue,Be,st,le,ct,se,de,pe,Ve,ge,Pe,Te,Re,Xe,Qe,ke,ot,Ge,at,De]);((e,n)=>{const{getRowKey:r,tableRef:i,toolBoxRef:l,tableBodyRef:a,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:v,createTableData:y,createTableFullData:b,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:_,clearRowHighlight:D,clearTableSorter:H,clearTableFilter:M,clearSuperFilters:F,clearTableLog:$}=n,{columns:q,columnsChange:j}=i.current.props,K=(e,t,n)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=K(e.children,t,n));const l=t.includes(i);return l&&(null==n||n(e,i)),!l}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:e=>Mn(void 0,void 0,void 0,(function*(){f&&(yield v(),null==e||e())})),GET_LOG:()=>P(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(_(),D(),H(),M(),F(),$(),y([]))},CLEAR_LOG:()=>{$(),A()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?la([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?la([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=Ql(q,e);if(!r)return nr("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!ae(t))return nr("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return nr("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&me(r,e,t[e]);n&&(j?j([...q]):nr("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:l}=i.current,a=(Array.isArray(e)?e:[e]).filter((e=>ae(e)));if(!a.length)return;a.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[au.expandableColumn,au.selectionColumn,au.operationColumn].includes(n)||ua(e,n,da(e,n))})),n.addToInserted(e)}));const o="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=l;if(c)o?d.unshift(...a):d.push(...a);else{const e=Ta(l,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...a):e.children.push(...a):e.children=a)}c&&N(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),y(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=i.current,l=(Array.isArray(e)?e:[e]).map((e=>ae(e)?r(e,e.index):e));if(!l.length)return;let a=!1;const o=K(n,l,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:i,editRender:l}=r,a=null==l?void 0:l(e,r);if(!a)return;const{rules:o=[],disabled:s}=a;!s&&o.length&&(t.removeFromRequired({x:n,y:i}),t.removeFromValidate({x:n,y:i}),t.removeFromEdited({x:n,y:i}))})),a=!0}));a&&(N(Object.assign({},i.current.handleState,{remove:!0})),b(o),I(p.filter((e=>!l.includes(e)))),l.includes(m)&&D(),R(h.filter((e=>!l.includes(e)))),g(),Un((()=>{S(K(i.current.tableOriginData,l))})))},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:l,title:a,editRender:o}=i,s=null==o?void 0:o(n,i);if(!s)return;const c=r(n,n.index);if(e&&!e.includes(c))return;if(t&&!t.includes(l))return;const{rules:d=[],disabled:u}=s;u||C(d,da(n,l),c,l,xa(a))}))}));const{required:n,validate:l}=P(),a=[...n,...l];return a.length&&w(a[0].rowKey),A(),{required:n,validate:l}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:$e,editableColumns:qe,pagination:le,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,isFetch:Pe,dataChange:_t,getTableData:Ct,createTableData:Nt,createTableFullData:wt,calcTableHeight:vt,scrollXToColumn:ft,scrollYToRecord:gt,doFieldValidate:At,setTableOriginData:_,setHandleState:z,setColumnsDefined:$,setSelectionKeysEffect:Ot,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setOriginColumns:A,forceUpdate:ve,getTableLog:Pt,clearRowSelection:Vt,clearRowHighlight:Wt,clearTableSorter:jt,clearTableFilter:Kt,clearSuperFilters:zt,clearTableLog:Bt}),t.useLayoutEffect((()=>{dt(),O.current.tableManager.register(O.current.uid,null!=n?n:{current:null})}),[]);const Yt={[`${I}--wrapper`]:!0,[`${I}--lg`]:"large"===E,[`${I}--sm`]:"small"===E,[`${I}--maximize`]:ke,[s]:!!s},Xt={[I]:!0,"is--border":Ye,"is--fixed":Ke.length||ze.length,"is--sortable":Xe,"is--filterable":Qe,"is--head-group":Ge,"is--area-select":!!c,"is--ping-left":Te,"is--ping-right":Re};return t.createElement(zd.Provider,{value:Gt},t.createElement("div",{className:_e(Yt,b),style:x},m&&t.createElement("div",{ref:w,className:`${I}-top`},t.createElement("div",{className:`${I}-top__space`},"bottom"!==(null==p?void 0:p.position)&&t.createElement(mu,{total:le.total}),t.createElement("div",{className:`${I}-top__space-slot`,style:{justifyContent:Jd[h]}},r.children)),t.createElement("div",{className:`${I}-top__actions`},t.createElement(Bu,{ref:N,showFullScreen:f,showReload:g&&Pe,showPrint:we.print&&!!d,showImport:we.import&&et,showExport:we.export&&!!u,showClipboard:tt,showCollection:Je,showFastSearch:rt,showSuperSearch:nt,showPivotGrid:it,showGroupSummary:lt,showToolBox:v,tableColumns:Fe}),t.createElement(Gu,{ref:T,columns:l}))),t.createElement(rl,{spinning:null!=a?a:Se},t.createElement("div",{ref:C,className:_e(Xt),style:ut},t.createElement("div",{className:`${I}--main-wrapper`},y&&t.createElement(np,{tableColumns:Fe}),t.createElement(jp,{ref:S}),Ue&&t.createElement(Kp,null)),Ye&&t.createElement("div",{className:`${I}--border-line`}),ot&&t.createElement(Wp,null),o&&t.createElement(Bp,null))),Me&&t.createElement(Vp,On({},le,{onChange:(e,t)=>$t({current:e,pageSize:t})}))))}));Up.displayName="QmTable";const Gp=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:p}=e,{$size:h}=qn(e),{t:m}=Fn(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=cl(f),[b,x]=t.useState(c),[E,w]=t.useState(),[C,S]=t.useState(o),[N,T]=t.useState(!1),[I,R]=t.useState(300),[O,k]=t.useState(s),[L,A]=t.useState((e=>[{title:m("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[P,_]=t.useState(ve({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[D,H]=t.useState([]),M=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Oo[h]-30)},F=dl(M,5);fn((()=>{F()}),[y.width]),$i((()=>{he(s,O)||k(s)}),[s]),t.useEffect((()=>{$()}),[P]),t.useEffect((()=>{a&&v.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;l&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(l))}),[]);const $=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=b;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:a=Wn}=n;if(a(P)){T(!0);try{const t=yield r(P);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[];i||(S([]),yield Bn(0)),H(n)}}catch(e){}T(!1)}})),q=e=>{i||(w(e),p(e))},j=e=>{_(Object.assign({},P,e))},K={[`${ar("search-helper")}--wrapper`]:!0},z=b.webPagination?{dataSource:D,loading:N,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:P})};return t.createElement("div",{ref:f,className:_e(K,d),style:u},t.createElement("div",{className:"form-wrap"},O.length?t.createElement(hd,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>M(),onFinish:e=>j(e),onReset:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||j(t)}))}):null),t.createElement("div",null,t.createElement(Up,On({ref:v,uniqueKey:r,height:I,columns:L,rowKey:b.rowKey||"pageIndex"},z,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{S(e),w(i?t:t[0])}},paginationConfig:b.paginationConfig,columnsChange:e=>A(e),onRowDblclick:q,onRowEnter:q}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>p(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!E,onClick:()=>p(E,i?C:void 0)},m("qm.dialog.confirm"))))};Gp.displayName="QmSearchHelper";const Yp=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Yp(e.children)),e.children&&t.push(e.value)})),t},Xp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Xp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Qp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Qp(e.children,t),t(e)||e.children&&e.children.length))),Zp=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:p,onClose:h}=e,{$size:m}=qn(e),{t:f}=Fn(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=cl(g),[x,E]=t.useState(c),[w,C]=t.useState(),[S,N]=t.useState(o),[T,I]=t.useState(!1),[R,k]=t.useState(300),[L,A]=t.useState(300),[P,_]=t.useState(s),[D,H]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[M,F]=t.useState(ve({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[$,q]=t.useState([]),j=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");k(e.offsetHeight-n.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Oo[m]-30)},K=dl(j,5);fn((()=>{K()}),[b.width]),$i((()=>{he(s,P)||_(s)}),[s]),t.useEffect((()=>{z()}),[M]),t.useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;l&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(l)),te()}),[]);const z=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=x;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:a=Wn}=n;if(a(M)){I(!0);try{const t=yield r(M);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[];i||(N([]),yield Bn(0)),q(n)}}catch(e){}I(!1)}})),V=e=>{i||(C(e),h(e))},W=e=>{F(Object.assign({},M,e))},[B,U]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),J=t.useRef(B),ee=t.useRef([]);$i((()=>{X(Yp(B))}),[B]);const te=()=>Mn(void 0,void 0,void 0,(function*(){var e;if(!d.fetch)return;const{api:t,params:n,dataKey:r,valueKey:i="value",textKey:l="text"}=d.fetch;try{const a=yield t(n);if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[],n=Ga(t,i,l);U(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${po.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${ar("tree-table-helper")}--wrapper`]:!0},ie=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:M})};return t.createElement("div",{ref:g,className:_e(re,u),style:p},t.createElement(el,{defaultValue:200,style:{height:"100%"}},t.createElement(el.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(O,{className:"input-wrap",value:Q,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),suffix:t.createElement(Ge,null),allowClear:!0,onChange:e=>(e=>{const t=Qp(J.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==ne(n).indexOf(e)}));Z(e),U(t)})(e.target.value)}),t.createElement(G,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:Y,treeData:B,filterTreeNode:e=>{if(!Q)return!1;const t=e.text||"";return-1!==ne(t).indexOf(Q)},onExpand:e=>{X(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return nr("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=ue(e,t[r]);W(n)})(Xp(ee.current,(n=>ue(n,t)===e[0]))||{})}})),t.createElement(el.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},P.length?t.createElement(hd,{ref:v,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>_(e),onCollapse:()=>j(),onFinish:e=>W(e),onReset:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||W(t)}))}):null),t.createElement("div",null,t.createElement(Up,On({ref:y,uniqueKey:r,height:L,columns:D,rowKey:x.rowKey||"pageIndex"},ie,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),C(i?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>H(e),onRowDblclick:V,onRowEnter:V}))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!w,onClick:()=>h(w,i?S:void 0)},f("qm.dialog.confirm"))))};Zp.displayName="TreeTableHelper";const Jp=e=>{var n,r,i;const{multiple:l,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=qn(e),{t:p}=Fn(),[h,m]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${ar("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},Qn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:_e(g,s),style:c},t.createElement(Kd,{multiple:l,fetch:v,fieldsDefine:{valueKey:null===(r=a.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(i=a.fetch)||void 0===i?void 0:i.textKey},autoFocus:!0,asyncLoad:a.asyncLoad,checkStrictly:a.checkStrictly,checkStrategy:a.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:a.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>d(null),style:{marginRight:8}},p("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!h,onClick:()=>d(h)},p("qm.dialog.confirm"))))};Jp.displayName="TreeHelper";const eh="_startSign",th="_endSign",nh=e=>{var n;const{uniqueKey:r,initialValue:i,filters:l=[],table:a={},onClose:o}=e,{$size:s}=qn(e),{t:c}=Fn(),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=cl(d),[m,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[w,C]=t.useState(l),[S,N]=t.useState((e=>[{title:c("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},{title:c("qm.form.rangeSearchHelper")[0],dataIndex:eh,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:th,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[T,I]=t.useState(ve({},null===(n=a.fetch)||void 0===n?void 0:n.params,i)),[O,k]=t.useState([]),L=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),A=t.useMemo((()=>2===L.length&&L.every((e=>void 0!==e))),[L]),P=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Oo[s]-30)},_=dl(P,5);fn((()=>{_()}),[h.width]),$i((()=>{he(l,w)||C(l)}),[l]),t.useEffect((()=>{D()}),[T]);const D=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=m;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:l=Wn}=n;if(l(T)){v(!0);try{const t=yield r(T);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[];k(n)}}catch(e){}v(!1)}})),H=(e,t)=>{delete e[t]},M=()=>{y.forEach((e=>{e&&(H(e,eh),H(e,th))})),b([])},F=e=>{M(),I(Object.assign({},T,e))},$=ar("range-helper"),q=m.webPagination?{dataSource:O,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},m.fetch),{params:T})};return t.createElement("div",{ref:d,className:`${$}--wrapper`},t.createElement("div",{className:"form-wrap"},w.length?t.createElement(hd,{ref:u,items:w,initialValues:i,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>P(),onFinish:e=>F(e),onReset:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||F(t)}))}):null),t.createElement("div",null,t.createElement(Up,On({ref:p,height:x,columns:S,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},q,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[eh,th].includes(n)&&(n===eh&&(e[n]?(H(e,n),b([void 0,y[1]])):e.pageIndex>L[1]?R.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&H(y[0],n),e[n]="[",b([e,y[1]]))),n===th&&(e[n]?(H(e,n),b([y[0],void 0])):e.pageIndex<L[0]?R.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&H(y[1],n),e[n]="]",b([y[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[eh]="["),e.pageIndex===L[1]&&(e[th]="]")}))}}),t.createElement(rr,{type:"primary",icon:t.createElement(bt,null),title:c("qm.table.alert.clear"),onClick:()=>M()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!A,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[eh,th].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};nh.displayName="RangeTableHelper";const rh=e=>null!=e;function ih(e,n,r,i){const[l,a]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[o,s]=t.useState(null),c=()=>{if(l){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:i,bottom:l,left:a}=e.getBoundingClientRect();return r>=0&&a>=0&&i<=t&&l<=n})(l)&&n&&l.scrollIntoView(i);const{left:e,top:t,width:r,height:a}=l.getBoundingClientRect(),o={left:e,top:t,width:r,height:a,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[l,n]),hu({handler:c});return[t.useMemo((()=>{if(!o)return o;const e=(null==r?void 0:r.offset)||6,t=(null==r?void 0:r.radius)||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,r]),l]}const lh=8;const ah={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"]}},oh={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"]}},sh=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function ch(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:l,visibleFirst:a}=e,o=t/2,s={};return Object.keys(ah).forEach((e=>{const c=r&&oh[e]||ah[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,sh.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-o-i;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=o+i;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-o-i;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=o+i}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?lh:r}}({contentRadius:l,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":d.offset[1]=2*-u.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":d.offset[1]=2*u.arrowOffsetHorizontal-o}d.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const i=r&&"object"==typeof r?r:{},l={};switch(e){case"top":case"bottom":l.shiftX=2*t.arrowOffsetHorizontal+n,l.shiftY=!0,l.adjustY=!0;break;case"left":case"right":l.shiftY=2*t.arrowOffsetVertical+n,l.shiftX=!0,l.adjustX=!0}const a=Object.assign(Object.assign({},l),i);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,u,t,n),a&&(d.htmlRegion="visibleFirst")})),s}const dh={fill:"transparent",pointerEvents:"auto"},uh=e=>{const{prefixCls:n,rootClassName:r,pos:i,showMask:l,style:a={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${nu()}`,p="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(Xt,{open:s,autoLock:!0},t.createElement("div",{className:_e(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},a)},l?t.createElement("svg",{style:{width:"100%",height:"100%"}},t.createElement("defs",null,t.createElement("mask",{id:u},t.createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),i&&t.createElement("rect",{x:i.left,y:i.top,rx:i.radius,width:i.width,height:i.height,fill:"black",className:p?`${n}-placeholder-animated`:""}))),t.createElement("rect",On({},i?null:dh,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),i&&t.createElement(t.Fragment,null,t.createElement("rect",On({},dh,{x:"0",y:"0",width:"100%",height:`${i.top}px`})),t.createElement("rect",On({},dh,{x:"0",y:"0",width:i.left,height:"100%"})),t.createElement("rect",On({},dh,{x:"0",y:i.top+i.height,width:"100%",height:`calc(100vh - ${i.top+i.height}px)`})),t.createElement("rect",On({},dh,{x:i.left+i.width,y:"0",width:`calc(100vw - ${i.left+i.width}px)`,height:"100%"})))):null))},ph=e=>{const{prefixCls:n,zIndex:r,open:i,onPause:l,onPlay:a}=e,[o,s]=su(void 0,{value:i,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=$n((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));t.useEffect((()=>{const e=jt(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!o),o?null==l||l():null==a||a())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,i=window.innerWidth,l=window.innerHeight,a=e.clientX-Ui(t).x,o=e.clientY-Ui(t).y;return document.onmousemove=e=>{let s=e.clientX-a,c=e.clientY-o;s<0&&(s=0),s>i-n-1&&(s=i-n-1),c<0&&(c=0),c>l-r-1&&(c=l-r-1),Vi(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},o?t.createElement(xt,null):t.createElement(Et,null))},hh=e=>{const{prefixCls:n,current:r,total:i=0,cover:l,title:a,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:v}=Fn(),y="primary"!==c?"primary":"default",b=$n((e=>{C(e),40===e.keyCode&&(r<i-1?null==h||h():null==m||m()),38===e.keyCode&&r>0&&(null==p||p())}));t.useEffect((()=>{const e=jt(document,"keyup",b);return()=>e.remove()}),[]);const x=rh(l)?t.createElement("div",{className:`${n}-cover`},l):null,E=rh(o)?t.createElement("div",{className:`${n}-description`},o):null;let w;w=g?g(r,i):[...Array.from({length:i}).keys()].map(((e,i)=>t.createElement("span",{key:e,className:_e(i===r&&`${n}-indicator-active`,`${n}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:_e(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(Ye,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(X,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(wt,{className:_e(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},a)),E,t.createElement("div",{className:`${n}-footer`},i>1&&t.createElement("div",{className:`${n}-indicators`},w),t.createElement(lr,{className:`${n}-buttons`},0!==r?t.createElement(rr,{className:`${n}-prev-btn`,size:"small",onMouseDown:C,onClick:p},v("qm.tour.prevStep")):null,r===i-1?t.createElement(rr,{className:`${n}-finish-btn`,type:y,size:"small",onClick:m},v("qm.tour.finish")):t.createElement(rr,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:h},v("qm.tour.nextStep"))))))},mh=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(hh,e))},fh={left:"50%",top:"50%",width:1,height:1},gh=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:i,current:l,onChange:a,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:w=!0,scrollIntoViewOptions:C=!0}=e,S=Dn(e,["steps","defaultCurrent","current","onChange","onClose","onFinish","open","type","mask","arrow","control","overlayClassName","overlayStyle","placement","helper","zIndex","renderPanel","indicatorsRender","gap","animated","scrollIntoViewOptions"]),N=t.useRef(),[T,I]=su(0,{value:l,defaultValue:i}),[R,O]=su(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=su(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),_=t.useRef(R);t.useLayoutEffect((()=>{R&&!_.current&&I(0),_.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:D,type:H,placement:M,trigger:F,delay:$,style:q,arrow:j,className:K,mask:z,scrollIntoViewOptions:V,zIndex:W,action:B}=r[T]||{},U=W||k,G=H||d,Y=R&&(null!=z?z:u),X=null!=V?V:C,[Q,Z]=ih(D,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Z,g,M),ee=!!Z&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),$i((()=>{R&&(ie(),null==B||B(Z,T))}),[R,Z]);const ne=e=>{I(e),null==a||a(e)},re=()=>{O(!1),null==o||o(T)},ie=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===zi(r=n,"display")||"hidden"===zi(r,"visibility")||"0"===zi(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=()=>Mn(void 0,void 0,void 0,(function*(){if(!F||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[i,l]=[e+n/2,t+r/2],a=new MouseEvent(F,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:l}),o=document.elementFromPoint(i,l);o&&(o.dispatchEvent(a),yield Bn(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=ar("tour"),de=[{[`${ce}-primary`]:"primary"===G},m,K],ue=ch({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(uh,{zIndex:U,prefixCls:ce,pos:Q,showMask:ae,style:null==oe?void 0:oe.style,fill:null==oe?void 0:oe.color,open:A,animated:w,rootClassName:m}),t.createElement(Xt,{open:A,autoLock:!0},t.createElement(Qt,On({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:_e(de),prefixCls:ce,popup:()=>t.createElement(mh,On({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>Mn(void 0,void 0,void 0,(function*(){yield le(),ne(T-1)})),onNext:()=>Mn(void 0,void 0,void 0,(function*(){yield le(),ne(T+1)})),onClose:re,current:T,onFinish:()=>{re(),null==s||s()}},Object.assign({},r[T],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),t.createElement("div",{className:_e(m,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Q||fh),{position:"fixed",pointerEvents:"none"})}))),h&&t.createElement(Xt,{open:R},t.createElement(ph,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));gh.displayName="QmTour";const vh=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],yh=e=>({_s:e,status:vh[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),bh=e=>e?6:5,xh=(e,t,n,r,i)=>{clearTimeout(r.current);const l=yh(e);t(l),n.current=l,null==i||i({current:l})},Eh=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:i,timeout:a,initialEntered:s,mountOnEnter:c,unmountOnExit:d,onStateChange:h}=e||{},[m,f]=u((()=>yh(s?2:bh(c)))),g=l(m),v=l(),[y,b]=(e=>ae(e)?[e.enter,e.exit]:[e,e])(a),x=p((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return bh(t)}})(g.current._s,d);e&&xh(e,f,g,v,h)}),[h,d]),E=p((e=>{const l=e=>{switch(xh(e,f,g,v,h),e){case 1:y>=0&&(v.current=setTimeout(x,y));break;case 4:b>=0&&(v.current=setTimeout(x,b));break;case 0:case 3:v.current=setTimeout((()=>l(e+1)),0)}},a=g.current.isEnter;"boolean"!=typeof e&&(e=!a),e?!a&&l(t?r?0:1:2):a&&l(n?i?3:4:bh(d))}),[x,h,t,n,r,i,y,b,d]);return o((()=>()=>clearTimeout(v.current)),[]),[m,E,x]},wh=e=>{const{name:n,in:r,timeout:i,preEnter:l=!0,preExit:a}=e,[o,s]=Eh({timeout:i,preEnter:l,preExit:a,initialEntered:r});return fn((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?Hp(e,{className:_e(e.props.className,n,o.status)}):e)))};var Ch={previewWidth:1100,defaultDistance:.45,logoHeight:60};const Sh=n(void 0);var Nh=null;function Th(){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),i=e.match(/Firefox\D?\d+/i),l=e.match(/x64/i);if(!t&&!n&&l)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||l)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var a=e.match(/Chrome\D?\d+/i);if(a&&(a=a[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function Ih(e,t){var n;try{var r=navigator.userAgent,i=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(Th()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void R.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else{i&&r.match(/x64/i);if(e||t?n=i?e:t:Nh?n=Nh:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),i?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),Nh=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&Th(),n}catch(e){R.error("getLodop 出错:"+e)}}Th();const Rh=e=>{const t=e/25.4*(()=>{var e;const t=[],{deviceXDPI:n,deviceYDPI:r}=window.screen;if(n&&r)t[0]=n,t[1]=r;else{let n=document.createElement("DIV");n.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(n),t[0]=parseInt(n.offsetWidth.toString()),t[1]=parseInt(n.offsetHeight.toString()),null===(e=n.parentNode)||void 0===e||e.removeChild(n),n=null}return t})()[0];return Math.ceil(t)},Oh=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:i}=e,{global:l}=t.useContext(sn),{$$preview:a}=t.useContext(Sh),{state:o,isWindowsPrinter:s,pageSize:c}=a,d=t.useRef(null),u=t.useRef({}),p=t.useRef([]),h=t.useRef([]),m=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:L,createPrintHtml:k,SHOW_PREVIEW:A,DIRECT_PRINT:P}))),$i((()=>{R()}),[o.form.printerType,o.form.setting.direction,o.form.setting.distance,o.form.setting.fixedLogo]),t.useEffect((()=>{u.current.templateEl=d.current.querySelector(".origin-template").children[0],u.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Ch.defaultDistance+10*Ch.defaultDistance:0;return("vertical"===e?c[0]:c[1])-t}),[o,s,c]),y=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Ch.defaultDistance+10*Ch.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Rh(v-10*(e.left-Ch.defaultDistance)-10*(e.right-Ch.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Rh(y-10*(e.top-Ch.defaultDistance)-10*(e.bottom-Ch.defaultDistance))}),[o,y]),E=o.form.scale,w=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:Rh(10*e.left),right:Rh(10*e.right),top:Rh(10*e.top),bottom:Rh(10*e.bottom)}}),[o]),C=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:i}=w,l=b+t+n,a=Ch.previewWidth-l<=0?0:(Ch.previewWidth-l)/2,s=Math.abs((1-E)*l/2);let c=0;return E>1&&(c=s>a?-1*a:-1*s),E<1&&(c=l-2*s>Ch.previewWidth?0:a>0?s:(Ch.previewWidth-(l-2*s))/2),{width:`${b}px`,height:""+("stylus"===e?"auto":x+"px"),paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${i}px`,transform:`translateX(${c}px) scale(${E})`,opacity:f?0:1}}),[o,f,w,E,x,b]);p.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const S=()=>{var e,t,n,r;const i=null!==(t=null===(e=null==l?void 0:l.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",a=null!==(r=null===(n=null==l?void 0:l.print)||void 0===n?void 0:n.rightLogo)&&void 0!==r?r:"";return[`<tr style="height: ${Ch.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',i?`<img src="${i}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',a?`<img src="${a}" border="0" height="46" />`:"","</td>","</tr>"].join("")},N=()=>{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=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=u.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},I=()=>{const e=u.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const i=e[r].clientHeight;e[r].style.height=i+"px",n.push(i),t.push(e[r].outerHTML)}h.current=n,p.current=t},R=()=>{var e;if(!p.current.length)return;const{form:{setting:t,printerType:n}}=o;if(i)return m.current.push([N(),S(),...p.current]);const r=t.fixedLogo?x-Ch.logoHeight:x;let l=[];if(m.current=[],"stylus"===n)m.current.push([N(),...t.fixedLogo?[S()]:[],...p.current]);else{let e=0;for(let n=0,i=h.current.length;n<i;n++){const a=p.current[n],o=h.current[n];t.fixedLogo||0!==n||(e+=Ch.logoHeight),e+=o,e<=r?l.push(a):(m.current.push([N(),...t.fixedLogo?[S()]:[],...l]),l=[],e=0,n-=1),n===i-1&&l.length&&m.current.push([N(),...t.fixedLogo?[S()]:[],...l])}}t.fixedLogo||null===(e=m.current[0])||void 0===e||e.splice(1,0,S());for(let e=0,t=m.current.length;e<t&&e!==t-1;e++)m.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:m.current.length}),O()},O=()=>{var e,t;const{currentPage:n}=o;let r=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;r+=null!==(t=null===(e=m.current[n-1])||void 0===e?void 0:e.join(""))&&void 0!==t?t:"",r+="</table>",u.current.previewEl.innerHTML=r,u.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;if(void 0!==e){t+=[...m.current[e-1]].join("")}else for(let e=0;e<m.current.length;e++)t+=m.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>"+S()+N()+e.join("")+"</table>"},A=()=>Mn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();u.current.previewEl.innerHTML||(T(),yield Bn(0),I(),R(),g(!1))})),P=()=>Mn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();T(),yield Bn(0),I(),R(),g(!1),a.doPrint(k()),yield Bn(0),a.doClose()})),_=()=>{nr("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D={[ar("print-container")]:!0,"no-visible":i};return t.createElement("div",{ref:d,className:_e(D)},t.createElement(rl,{wrapperClassName:"spin",spinning:f,tip:"Loading..."},t.createElement("div",{className:"preview"},t.createElement("div",{className:"origin-template",style:{width:`${b}px`,marginLeft:`-${Math.floor(b/2)}px`}},null==r?void 0:r()),t.createElement("div",{className:"workspace",style:C}))))}));Oh.displayName="Container";class kh extends s{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:pn("qm.print.setPanel.printParameter")},{type:"SELECT",label:pn("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:pn("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:pn("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:pn("qm.print.setPanel.vertical"),value:"vertical"},{text:pn("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:pn("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:pn("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:pn("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:pn("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]}],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})},this.getInitialExtra=()=>({disleft:pn("qm.print.setPanel.sizeUnit"),disright:pn("qm.print.setPanel.sizeUnit"),distop:pn("qm.print.setPanel.sizeUnit"),disbottom:pn("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>Mn(this,void 0,void 0,(function*(){const[e,t]=yield 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())})),this.cancelHandle=()=>{this.props.onClose()}}render(){const{formList:e}=this.state;return t.createElement(t.Fragment,null,t.createElement(hd,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},pn("qm.dialog.close")),t.createElement(rr,{type:"primary",onClick:()=>this.confirmHandle()},pn("qm.dialog.confirm"))))}}kh.contextType=sn;class Lh extends s{constructor(){var e,n,r;super(...arguments),this.provide={$$preview:this},this.containRef=t.createRef(),this.state={visible:!1,form:{printerName:-1,printerType:(null===(e=this.props.defaultConfig)||void 0===e?void 0:e.printerType)||"laser",copies:(null===(n=this.props.defaultConfig)||void 0===n?void 0:n.copies)||1,scale:1,setting:{distance:{left:Ch.defaultDistance,right:Ch.defaultDistance,top:Ch.defaultDistance,bottom:Ch.defaultDistance},pageSize:"210*297",direction:(null===(r=this.props.defaultConfig)||void 0===r?void 0:r.direction)||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0},this.pageChangeHandle=e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))},this.exportClickHandle=()=>{this.doExport(this.containRef.current.createExportHtml())},this.printClickHandle=()=>Mn(this,void 0,void 0,(function*(){if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e=Object.assign(Object.assign({},this.state.form),{printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text});yield an.setItem(this.printerKey,e),yield this.savePrintConfig(this.printerKey,e)}catch(e){}})),this.doClose=()=>{var e,t;null===(t=(e=this.props).onClose)||void 0===t||t.call(e)},this.getPrintConfig=e=>Mn(this,void 0,void 0,(function*(){const t=this.context.global,n=null==t?void 0:t.getComponentConfigApi;if(n)try{const t=yield n({key:e});if(200===t.code)return t.data}catch(e){}})),this.savePrintConfig=(e,t)=>Mn(this,void 0,void 0,(function*(){const n=this.context.global,r=null==n?void 0:n.saveComponentConfigApi;if(r)try{yield r({[e]:t})}catch(e){}})),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 ',this.doPrint=e=>{const t=Ih();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i,printerName:l,printerType:a,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Ch,{left:d,right:u,top:p,bottom:h}=i.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(l),t.SET_PRINT_COPIES(o),i.doubleSide&&("auto"===i.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"===a&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===a&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==a?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(pn("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=Ih();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i}}=this.state;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(pn("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===i.direction?1:2),t.SAVE_TO_FILE(`${h().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:pn("qm.print.laserPrinter"),value:"laser"},{text:pn("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Ih(),t=[{text:pn("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){nr("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}`:""}componentDidMount(){var e,t;return Mn(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield an.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),ae(n)&&(yield an.setItem(this.printerKey,n))),ae(n)&&Object.keys(n).length&&ve(this.state.form,Object.assign(Object.assign({},n),{printerName:null!==(t=null===(e=this.printerItems.find((e=>e.text===n.printerName)))||void 0===e?void 0:e.value)&&void 0!==t?t:-1}))}catch(e){}}))}render(){const{preview:e,templateRender:n}=this.props,{visible:r,form:i,currentPage:l,totalPage:a,printPage:o}=this.state,s=ar("print-preview"),c={visible:r,title:pn("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t.createElement(t.Fragment,null,t.createElement("div",{className:_e(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,pn("qm.print.printer"),":",t.createElement(H,{value:i.printerName,onChange:e=>{this.setState((t=>ve({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,pn("qm.print.type"),":",t.createElement(H,{value:i.printerType,onChange:e=>{this.setState((t=>ve({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,pn("qm.print.copies"),":",t.createElement($,{value:i.copies,min:1,precision:0,onChange:e=>{this.setState((t=>ve({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,pn("qm.print.printPage.0"),t.createElement($,{value:o,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),pn("qm.print.printPage.1")),t.createElement("span",null,t.createElement(Q,{size:"small",current:l,pageSize:1,total:a,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(rr,{type:"text",icon:t.createElement(at,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},pn("qm.print.setting"))),t.createElement("span",null,t.createElement(rr,{type:"text",icon:t.createElement(Ke,null),className:"text-btn",onClick:()=>this.exportClickHandle()},pn("qm.print.export"))),t.createElement("span",null,t.createElement(rr,{icon:t.createElement(it,null),type:"primary",onClick:this.printClickHandle},pn("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(Sh.Provider,{value:this.provide},t.createElement(Oh,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,pn("qm.print.scale"),":",t.createElement(Z,{value:i.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>ve({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*i.scale)}%`)),t.createElement("span",null,pn("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,pn("qm.print.pageNumber"),":",pn("qm.print.pagination",{currentPage:l,totalPage:a}))))),t.createElement(Ll,c,t.createElement(kh,{setting:i.setting,onChange:e=>{this.setState((t=>ve({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(Sh.Provider,{value:this.provide},t.createElement(Oh,{ref:this.containRef,templateRender:n,directPrint:!0}))}}Lh.contextType=sn;class Ah extends s{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>Mn(this,void 0,void 0,(function*(){var e,t;this.setState({loading:!0});try{const n=yield null===(t=(e=this.props).click)||void 0===t?void 0:t.call(e);if(this.setState({loading:!1}),"boolean"==typeof n&&!n)return;yield this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),this.createRender=()=>{const{visible:e}=this.state,{templateRender:n,uniqueKey:r,defaultConfig:i,preview:l,closeAfterPrint:a}=this.props,o={visible:e,title:pn("qm.print.preview"),width:`${Ch.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:i,preview:l,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return l?t.createElement(Ll,o,t.createElement(Lh,s)):e?t.createElement(Lh,s):null},this.DO_PRINT=()=>Mn(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield Bn(0),this.setState({visible:!0}),yield Bn(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:n,icon:r,type:i,disabled:l,shape:a}=this.props,o={size:n||this.context.size||"",type:i,shape:a,icon:r,loading:e,disabled:l,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(rr,o,this.props.children),this.createRender())}}function Ph(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function _h(e){const t=Ph(e);return t?t.frameElement:null}function Dh(e){const t=Fh(e);return Hh([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Hh(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 Mh(e,t){const n=_h(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let i=n,l=!1;for(;i;){const e=Dh(i);if(r.push(e),i=_h(i),l)break;i&&Ph(i)===t&&(l=!0)}return Hh(r)}return e.getBoundingClientRect()}function Fh(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)}}Ah.propTypes={size:(e,t,n)=>{if(!ka(e[t]||""))return tr("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Bt.elementType},Ah.defaultProps={preview:!0,type:"primary",icon:t.createElement(it,null)},Ah.contextType=sn;const $h=Object.assign;class qh{constructor(e,t){this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=Vh.border,this.padding.style.borderColor=Vh.padding,this.content.style.backgroundColor=Vh.background,$h(this.node.style,{borderColor:Vh.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){zh(t,"margin",this.node),zh(t,"border",this.border),zh(t,"padding",this.padding),$h(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"}),$h(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class jh{constructor(e,t){this.tip=e.createElement("div"),$h(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),$h(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),$h(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),i=Math.max(n.width,60),l=5;let a;a=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+l:e.top+e.height+l:e.top-r<=t.top+t.height?e.top-r-l<t.top+l?t.top+l:e.top-r-l:t.top+t.height-r-l;let o=e.left+l;e.left<t.left&&(o=t.left+l);e.left+i>t.left+t.width&&(o=t.left+t.width-i-l);return a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:n.width,height:n.height});$h(this.tip.style,r.style)}}class Kh{constructor(){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 jh(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();null==e||e.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new qh(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=Mh(e,this.window),i=Fh(e);r.top=Math.min(r.top,n.top-i.marginTop),r.right=Math.max(r.right,n.left+n.width+i.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+i.marginBottom),r.left=Math.min(r.left,n.left-i.marginLeft);this.rects[t].update(n,i)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const i=Mh(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:i.top+this.tipBoundsWindow.scrollY,left:i.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function zh(e,t,n){$h(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 Vh={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 Wh=null,Bh=null;function Uh(){null!=window.document&&(Wh=null,null!==Bh&&(Bh.remove(),Bh=null))}class Gh{constructor(e){this._lastHoveredNode=null,this.iframesListeningTo=new Set,this.onClick=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onMouseEvent=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onPointerDown=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))},this.onPointerMove=e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Yi(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Uh();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,r,i;n=[t],r=null,i=!1,null!=window.document?(null!==Wh&&clearTimeout(Wh),null!=n&&(null===Bh&&(Bh=new Kh),Bh.inspect(n,r),i&&(Wh=setTimeout((()=>Uh()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=Pe((e=>{var t;this._selectIgnore||null===(t=this.onSelect)||void 0===t||t.call(this,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(){Uh(),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 Yh(e){return document.querySelector(e)}const Xh=e=>{const{action:n,onConfirm:r,onCancel:i,onFinish:l}=e,{t:a}=Fn();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(lr,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(rr,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.closeButton")),t.createElement(rr,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(rr,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.finishButton"))))},Qh={left:"50%",top:"50%",width:1,height:1},Zh=t.forwardRef(((e,n)=>{const{open:r,current:i,defaultCurrent:l,steps:a=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=Fn(),E=t.useRef(),w=t.useRef(a.length),[S,N]=su(0,{value:i,defaultValue:l}),[T,I]=su(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=su(1051,{value:h,defaultValue:h}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[_,D]=t.useState(T),[H,M]=t.useState(!1),[$,q]=ih(k.node,!!r),[j,K]=t.useState(22),z=t.useRef(!1),V=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),W=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new Gh({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:ya(),node:e,path:t}),N(w.current),P(!0),U(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?B():U(),T?setTimeout((()=>D(!0)),16):D(!1),()=>{U()})),[T]),t.useEffect((()=>{w.current=a.length}),[a]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},G=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:S,selector:k.path})})));const Y=ar("guide-tracker"),Q=[{[`${Y}-primary`]:!0}],Z=ch({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Xt,{open:T&&A,autoLock:!0},t.createElement(Qt,{zIndex:R,builtinPlacements:Z,popupPlacement:o,popupVisible:T&&A,popupClassName:_e(Q,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{P(!1),B()};return t.createElement("div",{className:`${Y}-content`},t.createElement("div",{className:`${Y}-inner`},t.createElement(Ye,{className:`${Y}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(F,{open:H,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(rn,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),n=a.map((e=>e.id));if(he(t,n))return;const r=t.findIndex((e=>e===k.id)),i=-1!==r?r:S;N(i),null==v||v(Ra(e),i)}},a.map(((e,n)=>t.createElement("li",{key:n,className:_e("item",{actived:e.id===k.id})},t.createElement(Ue,{className:"handle",title:x("qm.form.draggable")}),t.createElement("span",{className:"box"},t.createElement("span",{className:"title",title:e.title,onClick:()=>{n!==S&&(L({id:e.id,node:Yh(e.selector),path:e.selector}),N(n),K(22===j?j+1:j-1),null==v||v(a,n))}},e.title),t.createElement(C,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=a.filter((t=>t.id!==e.id)),r=n===S;let i=n<=S?S-1:S;if(i=i<0?0:i,i=i>t.length?t.length:i,r&&t[i]){const{id:e,selector:n}=t[i];L({id:e,node:Yh(n),path:n})}N(i),null==v||v(t,i)}},t.createElement(Ye,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>M(e)},t.createElement(Ct,{className:_e(`${Y}-close`,"menu-icon"),style:{width:j}})),m.content&&t.createElement(X,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:m.content,title:m.title},t.createElement(wt,{className:_e(`${Y}-close`,"help-icon")})),t.createElement("div",{className:"panel-label"},t.createElement("span",{className:"title"},x("qm.guideTracker.label")),t.createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),W)),p?p({id:k.id,selector:k.path,actionStatus:V,DO_CLOSE:e},S):t.createElement(Xh,{action:V,onConfirm:()=>{null==v||v("add"===V?[...a,{id:k.id,selector:k.path,title:"Guide Title"}]:[...a],S),e()},onCancel:()=>{null==y||y(S),e()},onFinish:()=>{e(),null==y||y(S),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:_e(`${Y}-target-placeholder`),style:Object.assign(Object.assign({},$||Qh),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:G,onClick:G}))),s&&t.createElement(Xt,{open:_},t.createElement(ph,{zIndex:R,prefixCls:Y,onPause:()=>{z.current=A,P(!1),U()},onPlay:()=>{z.current?P(!0):B()}})))}));Zh.displayName="QmGuideTracker";const Jh=n=>{var r,i,l,a,o,s,c,d;const{content:u,image:p,width:h,height:m,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:w,className:C,style:S}=n,N=t.useRef(null),T=t.useRef(new Map),I=null!==(r=f.fontSize)&&void 0!==r?r:16,R=null!==(i=f.fontWeight)&&void 0!==i?i:"normal",O=null!==(l=f.fontStyle)&&void 0!==l?l:"normal",k=null!==(a=f.fontFamily)&&void 0!==a?a:"sans-serif",L=null!==(o=f.color)&&void 0!==o?o:"rgba(0, 0, 0, 0.15)",A=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],_=g[0],D=g[1],H=_/2,M=D/2,F=null!==(c=v[0])&&void 0!==c?c:H,$=null!==(d=v[1])&&void 0!==d?d:M,q=t.useMemo((()=>{const e=F-H,t=$-M;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:b}}),[H,M,F,$,b]),j=(e,t)=>{var n;if(N.current){const r=T.current.get(N.current);r&&(N.current.contains(r)&&N.current.removeChild(r),T.current.delete(N.current));const i=document.createElement("div");i.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(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=N.current)||void 0===n||n.append(i),T.current.set(N.current,i)}},K=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const n=(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),[r,i]=(e=>{let t=120,n=64;if(!p&&e.measureText){e.font=`${I}px ${k}`;const r=P.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),n=I*P.length+3*(P.length-1)}return[null!=h?h:t,null!=m?m:n]})(t),l=r*n,a=i*n,o=(_+r)*n,s=(D+i)*n,c=_/2*n,d=D/2*n,u=o/2,f=s/2,g=2*(_+r);e.width=2*o,e.height=2*s,t.globalAlpha=x,t.save(),t.translate(u,f),t.rotate(Math.PI/180*y),t.translate(-u,-f);const v=()=>{t.restore(),t.drawImage(e,0,0,o,s,o,s,o,s),w&&(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),j(e.toDataURL(),g)},b=()=>{const e=Number(I)*n;t.font=`${O} normal ${R} ${e}px/${i}px ${k}`,t.fillStyle=L,t.textAlign=A,t.textBaseline="top",t.translate(l/2,0),P.forEach(((r,i)=>{t.fillText(null!=r?r:"",c,d+i*(e+3*n))})),v()};if(p){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,l,a),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=p}else b()},z=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{K()}),[u,p,h,m,f,g,v,y,b,x,E,w]),function(t,n,r={}){const i=window&&"MutationObserver"in window,l=e.useRef(),a=()=>{l.current&&(l.current.disconnect(),l.current=void 0)};e.useLayoutEffect((()=>(a(),i&&t.current&&(l.current=new MutationObserver(n),l.current.observe(t.current,r)),()=>a())),[t])}(N,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>z(e))),n="attributes"===t.type&&z(t.target);if(e||n){K();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const V=ar("watermark");return t.createElement("div",{ref:N,className:_e(V,C),style:Object.assign({position:"relative"},S)},n.children)},em=new Map,tm=new WeakMap;let nm,rm=0;function im(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(tm.has(n)||(rm+=1,tm.set(n,rm.toString())),tm.get(n)):"0"):e[t]}`;var n})).toString()}function lm(e,t,n={},r=nm){if(void 0===window.IntersectionObserver&&void 0!==r){const i=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:i,intersectionRect:i,rootBounds:i}),()=>{}}const{id:i,observer:l,elements:a}=function(e){const t=im(e);let n=em.get(t);if(!n){const r=new Map;let i=[];const l=new IntersectionObserver((t=>{t.forEach((t=>{var n;const l=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=l),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(l,t)}))}))}),e);i=l.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:l,elements:r},em.set(t,n)}return n}(n),o=a.get(e)||[];return a.has(e)||a.set(e,o),o.push(t),l.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(a.delete(e),l.unobserve(e)),0===a.size&&(l.disconnect(),em.delete(i))}}const am=e=>{const{forceRender:n,height:r,placeholder:i=null,unmountIfInvisible:l,className:a,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:i,fallbackInView:l,trackVisibility:a,skip:o,delay:s,onChange:c}={})=>{var d;const[u,p]=t.useState(null),[h,m]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(o||!u)return;let t;return t=lm(u,((e,n)=>{var r;m({inView:e,entry:n}),null===(r=f.current)||void 0===r||r.call(f,e,n),n.isIntersecting&&i&&t&&(t(),t=void 0)}),{root:e,rootMargin:n,threshold:r,trackVisibility:a,delay:s},l),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,i,o,a,l,s]);const g=null===(d=h.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||i||o||v.current===g||(v.current=g,m({inView:!1,entry:void 0}));const y=[p,h.inView,h.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!l}));t.useEffect((()=>{r||nr("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[ar("lazy-load")]:!0};return t.createElement("div",{ref:s,className:_e(u,a),style:o},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},i))};class om{constructor(e,t,n,r){if(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 sm{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 sm(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,i=e.y-t.y,l=t.x-n.x,a=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+i*i),p=Math.sqrt(l*l+a*a),h=p/(u+p),m=c+(o-c)*h,f=d+(s-d)*h,g=t.x-m,v=t.y-f;return{c1:new om(o+g,s+v),c2:new om(c+g,d+v)}}constructor(e,t,n,r,i,l){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=l}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,l=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=l-e,i=a-t;n+=Math.sqrt(r*r+i*i)}e=l,t=a}return n}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}}class cm{constructor(e,t){this.width=320,this.height=200,this.ratio=Math.max(window.devicePixelRatio||1,1),this.penColor="rgba(0,0,0,1)",this.backgroundColor="rgba(0,0,0,0)",this.canAddHistory=!1,this.openSmooth=!0,this.dotSize=0,this.throttle=16,this.minDistance=5,this.velocityFilterWeight=.7,this.compositeOperation="source-over",this.minWidth=.5,this.maxWidth=2.5,this.fontSize=16,this.eraserSize=20,this.lineHeight=1.25,this.degreeOfBlur=5,this.textInputPos={x:0,y:0},this.onStart=()=>{},this.onEnd=()=>{},this._drawingStroke=!1,this._lastPoints=[],this._data=[],this._historyList=[],this._lastVelocity=0,this._lastWidth=0,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)},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))},this.isTouchEvent=e=>"touches"in e,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)},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)},this._isLeftButtonPressed=(e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:1==(1&e.buttons),this._pointerEventToSignatureEvent=e=>{var t,n;return{event:e,type:e.type,x:this.isTouchEvent(e)?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX,y:this.isTouchEvent(e)?null===(n=e.touches[0])||void 0===n?void 0:n.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}},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}),this._strokeBegin=e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n=Object.assign(Object.assign({},t),{points:[]});this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)},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],i=r.points,l=i.length>0&&i[i.length-1],a=!!l&&n.distanceTo(l)<=this.minDistance,o=this._getPointGroupOptions(r);if(!l||!l||!a){const e=this._addPoint(n,o);t&&(l?e&&this._drawCurve(e,o):this._drawDot(n,o)),i.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}},this._strokeEnd=(e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)},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},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()},this._drawCurve=(e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){const l=n/i,a=l*l,o=a*l,s=1-l,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*l*e.control1.x,u+=3*s*a*e.control2.x,u+=o*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*l*e.control1.y,p+=3*s*a*e.control2.y,p+=o*e.endPoint.y;const h=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,p,h)}n.closePath(),n.fill()},this._drawCurveSegment=(e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)},this._createPoint=(e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new om(e-r.left,t-r.top,n,(new Date).getTime())},this._createPointByEvent=e=>this._createPoint(e.x,e.y,e.pressure),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=sm.fromPoints(n,e);return n.shift(),r}return null},this._strokeWidth=(e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth),this._calculateCurveWidths=(e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),l={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,l},this.onDrawStart=e=>{var t;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),null===(t=this.onStart)||void 0===t||t.call(this,e))},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)))},this.onDrawEnd=e=>{var t;this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),null===(t=this.onEnd)||void 0===t||t.call(this,e))},this.onInputBlur=e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()},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},this.drawSquare=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,i-n),this.ctx.stroke(),this.ctx.restore()},this.drawRound=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),l=Math.min(r,t),a=Math.min(i,n),o=.5*(Math.max(r,t)-l),s=.5*(Math.max(i,n)-a),c=l+o,d=a+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()},this.drawArrow=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),l=180*Math.atan2(n-i,t-r)/Math.PI,a=(l+25)*Math.PI/180,o=(l-25)*Math.PI/180,s=15*Math.cos(a),c=15*Math.sin(a),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,i),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,i);const p=r+s,h=i+c;this.ctx.lineTo(p,h);const m=r+d,f=i+u;this.ctx.lineTo(m,f),this.ctx.lineTo(r,i),this.ctx.fill(),this.ctx.restore()},this.getAxisColor=(e,t,n)=>{const r=e.width,i=e.data,l=[];return l[0]=i[4*(n*r+t)],l[1]=i[4*(n*r+t)+1],l[2]=i[4*(n*r+t)+2],l[3]=i[4*(n*r+t)+3],l},this.setAxisColor=(e,t,n,r)=>{const i=e.width,l=e.data;l[4*(n*i+t)]=r[0],l[4*(n*i+t)+1]=r[1],l[4*(n*i+t)+2]=r[2],l[4*(n*i+t)+3]=r[3]},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),i=r.width,l=r.height,a=i/this.degreeOfBlur,o=l/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<a;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 i=0;i<this.degreeOfBlur;i++)for(let l=0;l<this.degreeOfBlur;l++)this.setAxisColor(r,t*this.degreeOfBlur+l,e*this.degreeOfBlur+i,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)},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,i=this.width-t,l=e.target.innerText,a=[];let o="";for(let e=0;e<l.length;e++){const t=o+l[e];this.ctx.measureText(t).width>i&&o.length>0?(a.push(o),o=l[e]):o=t}a.push(o),a.forEach(((e,i)=>{this.ctx.fillText(e,t+1,n+i*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}},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)},this.drawPencil=e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()},this.createEraser=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)},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"},this.drawLine=e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)},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())},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}},this.drawBgColor=()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))},this.clearWorkSpace=()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},this.addHistory=()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))},this.getLastHistory=()=>this._historyList[this._historyList.length-1],this.setLastHistory=()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()},this.clear=()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())},this.undo=()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()},this.setDrawMode=e=>{this.mode=e},this.setLineWidth=e=>{this.maxWidth=e},this.setPenColor=e=>{this.penColor=e},this.setFontSize=e=>{this.fontSize=e},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()},this.toDataURL=(e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");n.width=this.width,n.height=this.height;return n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)},this.getPNG=()=>this.toDataURL(),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,i,l=0,a=null;const o=()=>{l=Date.now(),a=null,n=e.apply(r,i),a||(r=null,i=[])};return function(...s){const c=Date.now(),d=t-(c-l);return r=this,i=s,d<=0||d>t?(a&&(clearTimeout(a),a=null),l=c,n=e.apply(r,i),a||(r=null,i=[])):a||(a=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)}}cm.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),i=r.length,l=new Uint8Array(i);for(let e=0;e<i;++e)l[e]=r.charCodeAt(e);return new Blob([l],{type:n})},cm.canvasToDataURL=e=>e.toDataURL("image/png",1),cm.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const dm=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),um=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),pm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),hm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),mm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),fm=t.forwardRef(((e,n)=>{const{open:r,width:i,height:l,imageName:a,penColor:o,penMode:s,minWidth:c,maxWidth:d,backgroundColor:u,className:p,style:m,onOk:f,onCancel:g}=e,{t:v}=Fn(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=su(void 0,{value:r,postState:e=>null!=e&&e}),I=t.useMemo((()=>!!e.children),[e.children]),[R,O]=t.useState(s||(I?"square":"line")),[k,L]=t.useState(w[0]),[A,P]=t.useState(I?S[0]:S[4]),[_,D]=t.useState(C[1]),[M,$]=t.useState("bottomLeft"),[q,j]=t.useState(!1),[K,z]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=i?i:null===(e=x.current)||void 0===e?void 0:e.offsetWidth,height:null!=l?l:null===(t=x.current)||void 0===t?void 0:t.offsetHeight,maxWidth:k,mode:R,penColor:A,fontSize:_,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new cm(b.current,n),()=>y.current.destroy()}),[]);const V=e=>{var t,n;const[r,a]=[null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=l?l:null===(n=x.current)||void 0===n?void 0:n.offsetHeight],{width:o,height:s}=y.current;let c=!1;r&&r!==o&&(y.current.width=r,c=!0),a&&a!==s&&(y.current.height=a,c=!0),(c||e)&&y.current.update()};$i((()=>{I&&N&&V()}),[N,I]),$i((()=>{y.current.setDrawMode(R)}),[R]),$i((()=>{y.current.setLineWidth(k)}),[k]),$i((()=>{y.current.setPenColor(A)}),[A]),$i((()=>{y.current.setFontSize(_)}),[_]);const W=()=>Mn(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield Zt(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return cm.canvasToDataURL(t)}catch(e){nr("Signature","生成合成图片失败!")}})),B=()=>{y.current.clear(),null==g||g()};t.useImperativeHandle(n,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>y.current.clear(),UNDO:()=>y.current.undo(),IS_EMPTY:()=>y.current.isEmpty(),UPDATE:V,GET_DATE_URL:W})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},G=e=>t.createElement("div",{className:_e("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},w.map((e=>t.createElement("span",{key:e,className:_e("dot",`s${e}`,{active:e===k}),onClick:()=>L(e)})))):t.createElement("div",{className:"fontSize"},t.createElement(H,{size:"small",value:_,options:C.map((e=>({value:e,label:e.toString()}))),onChange:e=>D(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},S.map((e=>t.createElement("span",{key:e,className:_e("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>P(e)},t.createElement(qe,{className:"icon"})))))),Y=ar("signature"),X={[Y]:!0,"is-annotation":I},Q=i?Object.assign(Object.assign({},m),{width:i}):m;return t.createElement("div",{className:_e(X,p),style:Q},I&&t.createElement(t.Fragment,null,t.createElement("div",{ref:x,className:"content"},e.children),K&&t.createElement(rl,{spinning:!0,className:"spinning"})),t.createElement("div",{className:_e("signature",{show:N})},t.createElement("canvas",{ref:b,className:R}),I&&t.createElement("div",{ref:E,className:"signature__tool-bar"},t.createElement("div",{className:"wrapper"},t.createElement("div",{className:_e("actions",{hidden:q})},t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(St,null))),t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(dm,null))),t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(pm,null))),t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement($e,null))),t.createElement(F,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(um,null))),t.createElement("button",{className:"btn",onClick:()=>Mn(void 0,void 0,void 0,(function*(){yield Mn(void 0,void 0,void 0,(function*(){z(!0);const e=yield W();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):h().format(Qd);gl(cm.dataURLToBlob(e),`${t}.png`)}z(!1)})),B()}))},t.createElement(Ke,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement(hm,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(mm,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(bt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(Ye,null)),t.createElement("button",{className:"btn",onClick:()=>Mn(void 0,void 0,void 0,(function*(){z(!0),yield Bn(10);const e=yield W();z(!1),B(),null==f||f(e)}))},t.createElement(qe,null))),t.createElement("button",{className:"btn btn-fold",title:v(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>j(!q)},q?t.createElement(Tt,null):t.createElement(Nt,null))))))}));fm.displayName="QmSignature";var gm={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"};const vm=e=>[gm.selectionColumnDefine,...e].filter((e=>!e.hidden)),ym=e=>e.some((e=>Array.isArray(e.children))),bm=e=>void 0!==e._groupLevel,xm=(e,t)=>t.split(gm.separator).reduce(((e,t)=>null==e?void 0:e[t]),e),Em=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(Em)):0,wm=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const i=t?`${t}${gm.separator}${r}`:r;if(n.push(i),Array.isArray(e[r]))return n;const l=wm(e[r],i);return n.concat(l)}),[]),Cm={sum:e=>ma(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=>ma(e.length),unique:e=>new Set(e).size,empty:e=>e.filter((e=>Yn(e))).length,notEmpty:e=>e.filter((e=>!Yn(e))).length},Sm=t.createContext(void 0),Nm=e=>{const{prefixCls:n,pivotProps:r,size:i,getRowKey:l,flatColumns:a,tableData:o}=e,{initialGroup:s,initialCount:c}=r,d=e=>{const t=new Map;return na(e).forEach((e=>t.set(l(e,e.index),e))),t},u=t.useRef({props:r,originGridData:o,flatGroupData:[],isTree:ym(o),keyRecordMap:d(o)}),[p,h]=t.useState({pivotRef:u,prefixCls:n,size:i,viewMode:"table",columns:a,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=a.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,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=a.map((e=>e.dataIndex)),r={};for(const i in e)n.includes(i)&&t.includes(e[i])&&(r[i]=e[i]);return r})(c):{},summationData:{}}),m=e=>{h((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const l=i;Object.is(t[l],e[l])||(n[l]=e[l],r=!0)})),r?n:t}))};fn((()=>{v(o),f("originGridData",o),f("isTree",ym(o)),f("keyRecordMap",d(o))}),[o]),fn((()=>{g(a)}),[a]),fn((()=>{m({size:i})}),[i]);const f=(e,t)=>{p.pivotRef.current[e]=t};f("props",r);const g=e=>{m({columns:e})},v=e=>{m({gridData:e})},y=e=>{m({groupGridData:e})},b=e=>{m({groupList:e})},x=e=>{m({filterList:e})},E=e=>{m({sorterList:e})},w=e=>{m({colorList:e})},C=e=>{m({expandedKeys:e})},S=e=>{m({searchResults:e})},N=e=>{m({switchIndex:e})},T=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),m({fillColorCells:t})},I=e=>{var t;m({countMethod:(t=Object.assign({},p.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},R=e=>{m({summationData:e})},O=t.useMemo((()=>Object.assign(Object.assign({},p),{setContext:m,getRowKey:l,setPivotGridRef:f,setColumns:g,setGridData:v,setGroupGridData:y,setGroupList:b,setFilterList:x,setSorterList:E,setColorList:w,setExpandedKeys:C,setSearchResults:S,setSwitchIndex:N,setFillColor:T,setCountMethod:I,setSummationData:R})),[p]);return t.createElement(Sm.Provider,{value:O},e.children)},Tm=()=>t.useContext(Sm),Im=()=>{const{prefixCls:e,pivotRef:n,groupList:r,columns:i,gridData:l,setGroupList:a,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=Tm(),{originGridData:d}=n.current,{onGroupChange:u,onDataChange:p}=n.current.props,{t:h}=Fn(),m=t.useRef([]),f=t.useRef([]),g=t.useMemo((()=>r.filter((e=>e.fieldName&&e.order))),[r]),v=t.useMemo((()=>i.map((e=>({label:xa(e.title),value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,i]),y=t.useMemo((()=>{const e=g.map((e=>({[e.fieldName]:e.order})));return he(e,m.current)?m.current:(m.current=e,e)}),[g]),b=[{label:h("qm.pivotGrid.group.ascend"),value:"ascend"},{label:h("qm.pivotGrid.group.descend"),value:"descend"}];t.useEffect((()=>{o(f.current)}),[y,d]),t.useLayoutEffect((()=>{const e=((e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:i}]=t,l=Object.keys(t[0])[0],a=t.slice(1),o=Object.groupBy(e,(e=>n(e,l))),s=Object.keys(o).sort(((e,t)=>"ascend"===i?e.localeCompare(t):t.localeCompare(e))),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],a)})),c};return r(e,t)})(l,y,((e,t)=>{var n,r,l;const{dictItems:a,precision:o}=i.find((e=>e.dataIndex===t))||{},s=da(e,t);let c=null!==(l=null!==(r=null===(n=null==a?void 0:a.find((e=>e.value==s)))||void 0===n?void 0:n.text)&&void 0!==r?r:s)&&void 0!==l?l:"";return Array.isArray(s)&&(c=s.map((e=>{var t,n;return null!==(n=null===(t=null==a?void 0:a.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),o>=0&&""!==c&&(c=ha(c)?new Gt(c).toFixed(o):c),c||h("qm.pivotGrid.group.empty")}));var t;s(e),t=wm(e),f.current=t,c("flatGroupData",(e=>{const t=[];return function e(n,r,i=""){if(Array.isArray(n))n.forEach(((e,t)=>{e._varIndex=t,i?e._parentRowKey=i:delete e._parentRowKey})),t.push(...na(n));else for(const l in n){const a=i?`${i}${gm.separator}${l}`:l;t.push({id:a,_groupLabel:l,_groupLevel:r}),e(n[l],r+1,a)}}(e,0),t})(e))}),[y,l]),$i((()=>{null==u||u(g)}),[y]),$i((()=>{null==p||p(l)}),[l]);const x=()=>{a([...r,{fieldName:"",order:"ascend"}])},E=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...r])},w=e=>t.createElement(t.Fragment,null,t.createElement(Ue,{className:"icon handle"}),t.createElement(H,{value:e.fieldName||void 0,placeholder:h("qm.table.editable.selectPlaceholder"),options:v,style:{width:160,margin:"0 10px"},onChange:t=>E("fieldName",e,t)}),t.createElement(H,{value:e.order,options:b,placeholder:h("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>E("order",e,t)}),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(e)}));return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,h("qm.pivotGrid.group.title")),!!g.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},h("qm.pivotGrid.group.foldAll")),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(f.current)},h("qm.pivotGrid.group.unfoldAll")))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));he(t,n)||a(e)}},r.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},w(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:x},t.createElement(pt,{className:"icon"}),h("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!g.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(It,{className:"icon"}),h("qm.pivotGrid.group.text"),g.length?`(${g.length})`:null))},Rm=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:i,setFilterList:l,setGridData:a}=Tm(),{originGridData:o,isTree:s}=n.current,{onFilterChange:c}=n.current.props,{t:d}=Fn(),u=t.useRef([]),p=t.useMemo((()=>i.filter((e=>e.fieldName&&("nil"===e.expression||!Yn(e.value))))),[i]),h=t.useMemo((()=>r.map((e=>({label:xa(e.title),value:e.dataIndex})))),[r]),[m,f]=t.useState("and"),g=t.useMemo((()=>{const e=p.map((e=>{var t;return`${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}));return he(e,u.current)?u.current:(u.current=e,e)}),[p]);$i((()=>{l(i.map((e=>Object.assign(Object.assign({},e),{logic:m}))))}),[m]),$i((()=>{v(),null==c||c(p)}),[g]);const v=dl((()=>{const e=wa(p.map((e=>Object.assign(Object.assign({},Qn(e,["value"])),{expression:"nil"!==e.expression?e.expression:"==",condition:e.value}))));a(e?Bl(o,e,s):o)}),200),y=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],b=()=>{l([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:m}])},x=(e,t,n)=>{var a;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(a=r.find((e=>e.dataIndex===n)).filter)||void 0===a?void 0:a.type)||"text";Object.assign(t,{type:e,expression:w(e)[0].value,value:""})}"expression"===e&&"nil"===n&&Object.assign(t,{value:""}),l([...i])},E=e=>t.createElement(t.Fragment,null,t.createElement(H,{value:e.fieldName||void 0,options:h,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>x("fieldName",e,t)}),t.createElement(H,{value:e.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:w(e.type),style:{width:100,margin:"0 10px"},onChange:t=>x("expression",e,t)}),C(e),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{l(i.filter((t=>t!==e)))})(e)})),w=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},C=e=>{var n,i;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{x("value",e,Yn(t)?"":t)}});case"date":return t.createElement(Rn,{popupClassName:au.popupClassName,defaultValue:null!==(n=ga(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{x("value",e,va(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(i=r.find((t=>t.dataIndex===e.fieldName)))||void 0===i?void 0:i.dictItems)||[];return t.createElement(H,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{x("value",e,t)}},n.map((e=>t.createElement(H.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{x("value",e,t.target.value)}})}};return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,d("qm.pivotGrid.filter.title")),!!p.length&&t.createElement(H,{value:m,options:y,style:{width:130},onChange:e=>f(e)})),t.createElement("div",{className:"list"},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},E(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:b},t.createElement(pt,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!p.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Rt,{className:"icon"}),d("qm.pivotGrid.filter.text"),p.length?`(${p.length})`:null))},Om=()=>{const{prefixCls:e,pivotRef:n,columns:r,gridData:i,sorterList:l,setSorterList:a,setGridData:o}=Tm(),{onSorterChange:s}=n.current.props,{t:c}=Fn(),d=t.useMemo((()=>l.filter((e=>e.fieldName&&e.order))),[l]),u=t.useMemo((()=>r.map((e=>({label:xa(e.title),value:e.dataIndex,disabled:l.some((t=>t.fieldName===e.dataIndex))})))),[l,r]);$i((()=>{m(),null==s||s(d)}),[t.useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]);const p=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],h=(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,m=()=>{var e;o((e=d,i.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:i}=r,l=da(t,e),a=da(n,e),o=h(l,a);if(0!==o)return"ascend"===i?o:-o}return 0})).slice(0)))},f=()=>{a([...l,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...l])},v=e=>t.createElement(t.Fragment,null,t.createElement(Ue,{className:"icon handle"}),t.createElement(H,{value:e.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(H,{value:e.order,options:p,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{a(l.filter((t=>t!==e)))})(e)}));return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.sorter.title"))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.fieldName)),n=l.map((e=>e.fieldName));he(t,n)||a(e)}},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(pt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Ot,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},km=()=>{const{prefixCls:e,getRowKey:n,gridData:r,columns:i,searchResults:l,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=Tm(),{t:c}=Fn(),[d,u]=t.useState(!1),p=t.useMemo((()=>l.length),[l]);$i((()=>{d||setTimeout((()=>{s(0),o([])}),200)}),[d]);const h=(e,t)=>{const r=[];return e.forEach((e=>{i.forEach((i=>{var l,a,o;const{dataIndex:s,dictItems:c,precision:d}=i,u=da(e,s);let p=null!==(o=null!==(a=null===(l=null==c?void 0:c.find((e=>e.value==u)))||void 0===l?void 0:l.text)&&void 0!==a?a:u)&&void 0!==o?o:"";Array.isArray(u)&&(p=u.map((e=>{var t,n;return null!==(n=null===(t=null==c?void 0:c.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),d>=0&&""!==p&&(p=ha(p)?new Gt(p).toFixed(d):p),p+="",p.includes(t)&&r.push({value:p,rowKey:n(e,e.index),dataIndex:s})})),Array.isArray(e.children)&&r.push(...h(e.children,t))})),r},m=dl((e=>{const t=e.target.value.trim();s(0),o(t?h(r,t):[])}),200),f=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&g()},g=()=>{if(!p)return;s((a+1)%p)},v=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!p)return;s((a-1+p)%p)})()},t.createElement(Tt,null)),t.createElement("span",{className:"num"},p>0?a+1:a,"/",p),t.createElement("button",{className:"button-icon",onClick:()=>g()},t.createElement(Nt,null)));return t.createElement(F,{open:d,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.search.title")),t.createElement("button",{className:"button-icon",onClick:()=>u(!1)},t.createElement(Ye,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(O,{autoFocus:!0,style:{width:280},suffix:v(),onChange:m,onKeyUp:f}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>u(!d)},t.createElement(dt,{className:"icon"}),c("qm.pivotGrid.search.text")))},Lm=(e,t)=>e.map((e=>(e.children&&(e.children=Lm(e.children,t)),t(e)))),Am=()=>{const{prefixCls:e,pivotRef:n,columns:r,setColumns:i}=Tm(),{uniqueKey:l,onColumnsChange:a}=n.current.props,{t:o}=Fn(),s=t.useMemo((()=>l?`grid_field_${l}`:""),[l]);t.useLayoutEffect((()=>{c()}),[]),$i((()=>{u(r)}),[r]);const c=()=>{const e=p();e&&(null==a||a(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),Object.assign({dataIndex:e.dataIndex},t)})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));he(t,n)||localStorage.setItem(s,JSON.stringify(t))},p=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));if(!e)return;return fe(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?Lm(r,(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})):Lm(e,(e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},h=t.useMemo((()=>{let e=0;for(let t=0;t<r.length-1&&("left"!==r[t].fixed||r[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let n=0;n<r.length;n++)n===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(r[n]);return t}),[r]),m=()=>t.createElement("div",{className:_e("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,o("qm.pivotGrid.field.title"))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:h,setList:e=>{const t=e.map((e=>e.dataIndex)),n=h.map((e=>e.dataIndex));he(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const i=e[r];r<t?i.fixed="left":delete i.fixed,r!==t&&n.push(i)}i(n),null==a||a(n)})(Ra(e))}},h.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(Ue,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},xa(e.title)),t.createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...r];i(t),null==a||a(t)})(e)},e.hidden?t.createElement(kt,null):t.createElement(je,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(F,{trigger:["click"],dropdownRender:()=>m(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(at,{className:"icon"}),o("qm.pivotGrid.field.text")))},Pm=()=>{const{prefixCls:e,size:n,setContext:r}=Tm(),{t:i}=Fn(),l=[{label:i("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:i("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:i("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},l.map((e=>t.createElement("li",{key:e.value,className:_e("ant-dropdown-menu-item check-item",{active:n===e.value}),onClick:()=>r({size:e.value})},t.createElement("span",{className:"label"},e.label),t.createElement("i",{className:"icon"},t.createElement(qe,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},t.createElement("span",null,t.createElement(Lt,{className:"icon"}),i("qm.pivotGrid.lineHeight.text")))},_m="606060",Dm="thin",Hm="d4d4d4",Mm=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Fm=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},$m=()=>({top:{style:Dm,color:{argb:Hm}},left:{style:Dm,color:{argb:Hm}},bottom:{style:Dm,color:{argb:Hm}},right:{style:Dm,color:{argb:Hm}}}),qm=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},jm=()=>{const{prefixCls:e,pivotRef:n,columns:r,countMethod:i,summationData:l}=Tm(),{t:a}=Fn(),{exportXLSX:o}=(()=>{const{size:e}=Tm(),{t:t}=Fn(),{rowHeightMaps:n}=au,r=(e,t)=>{var n,r,i;return null!==(i=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==i?i:""};return{exportXLSX:(r,i,l,a)=>Mn(void 0,void 0,void 0,(function*(){const{columns:o,footSummation:s}=r,c=n[e],d=Ul(o),u=[],p=[],h=[];let m=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=xa(e.title),h.push({key:t,width:(n||r)/8})})),u.push(f),m+=u.length;const g=i.map(((e,t)=>{const n={};return d.forEach(((r,i)=>{const l=["percent","finance"].includes(r.formatType);n[r.dataIndex]=l?da(e,r.dataIndex):a(e,t,r,i)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));m+=g.length,s&&l(d,i).forEach(((e,n)=>{const r={};d.forEach(((n,l)=>{const{dataIndex:a,summation:o}=n,s=(null==o?void 0:o.render)?o.render(i):da(e,a);r[a]=0===l&&""===s?t("qm.table.config.summaryText"):Kn(s)?ba(s).join(""):s})),p.push(r)}));const{sheetName:v,useStyle:y}=r,b=new ln.Workbook,x=b.addWorksheet(v);x.columns=h,x.addRows(u).forEach((e=>{y&&Mm(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=Ql(o,t.key),{align:r,theadAlign:i}=n;Fm(e,i||r),y&&Object.assign(e,{font:{bold:!0,color:{argb:_m}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:$m()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];y&&Mm(e,c),e.eachCell(((e,t)=>{const i=x.getColumn(e.col),l=Ql(o,i.key),{align:a}=l;Fm(e,1===t||void 0===r?a:"right"),Object.assign(e,qm(l)),y&&Object.assign(e,{font:{color:{argb:_m}},border:$m()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),s&&x.addRows(p).forEach((e=>{y&&Mm(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=Ql(o,n.key),{align:i}=r;Fm(e,1===t?i:"right"),Object.assign(e,qm(r)),y&&Object.assign(e,{font:{color:{argb:_m}},border:$m()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=yield b.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})})),importXLSX:(e,n)=>{const{columns:i,file:l}=e,a=Ul(i),o=new FileReader;o.onerror=()=>{R.error(t("qm.table.import.error"))},o.onload=e=>{const i=a.map((e=>xa(e.title))),l=new ln.Workbook,o=e.target;o?l.xlsx.load(o.result).then((e=>{const l=e.worksheets[0];if(l){const e=l.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(i,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let i=e;Array.isArray(null==i?void 0:i.richText)&&(i=i.richText.map((e=>e.text)).join("")),ae(i)&&"text"in i&&(i=i.text),Te(i)&&(i=va(i,Xd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[s[n]]=i}));const n={};return i.forEach(((e,i)=>{var l;const{dataIndex:o,dictItems:s}=a[i];Array.isArray(s)&&((null===(l=t[e])||void 0===l?void 0:l.toString().includes(","))?t[e]=t[e].split(",").map((e=>r(s,e))).filter((e=>""!==e)):t[e]=r(s,t[e])),ua(n,o,t[e])})),n}));null==n||n(t)}else R.error(t("qm.table.import.error"))}else R.error(t("qm.table.import.error"))})):R.error(t("qm.table.import.error"))},o.readAsArrayBuffer(l)}}})(),{getTitleFromCellValue:s}=vu(),c=[{text:a("qm.pivotGrid.count.records"),value:"count"},{text:a("qm.pivotGrid.count.unique"),value:"unique"},{text:a("qm.pivotGrid.count.empty"),value:"empty"},{text:a("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:a("qm.pivotGrid.count.sum"),value:"sum"},{text:a("qm.pivotGrid.count.max"),value:"max"},{text:a("qm.pivotGrid.count.min"),value:"min"},{text:a("qm.pivotGrid.count.avg"),value:"avg"}],d={columns:Gl(r),fileName:h().format(Qd),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},u=(e,t,n,r)=>{const{dataIndex:i,precision:l,formatType:a}=n;if(bm(e))return da(e,i);let o=s(e,n,t,r);return l>=0&&!a&&""!==o&&(o=Number(o)),o},p=()=>{if(!i||!Object.keys(i).length)return[];const e={};return d.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";(null==i?void 0:i[t])&&(n=c.find((e=>e.value===i[t])).text+" "+l.total[t]),ua(e,t,n)}})),[e]},m=e=>Mn(void 0,void 0,void 0,(function*(){const t=yield o(Object.assign(Object.assign({},d),{footSummation:!!Object.keys(i).length}),e,p,u);gl(t,`${h().format(Qd)}.xlsx`)})),f=[{key:"1",label:t.createElement(t.Fragment,null,t.createElement(At,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.group")),onClick:()=>{m((()=>{const e=[];let t=0;return n.current.flatGroupData.forEach((n=>{const r=Object.assign({},n);bm(n)?(r._level=n._groupLevel,d.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(0===t)ua(r,e,n._groupLabel);else{let t="";(null==i?void 0:i[e])&&(t=c.find((t=>t.value===i[e])).text+" "+xm(l,n.id).subtotal[e]),ua(r,e,t)}})),t=n._groupLevel):t>0&&(r._level=n._level+t+1),e.push(r)})),e})())}},{key:"2",label:t.createElement(t.Fragment,null,t.createElement(Pt,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.list")),onClick:()=>{m(Array.from(n.current.keyRecordMap.values()))}}];return t.createElement(F,{trigger:["click"],menu:{items:f},className:_e("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},t.createElement("span",null,t.createElement(Ke,{className:"icon"}),a("qm.pivotGrid.export.text")))},Km=()=>{const{prefixCls:e,pivotRef:n,groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o,setContext:s}=Tm(),{uniqueKey:c}=n.current.props,{t:d}=Fn(),u=t.useMemo((()=>c?`grid_conf_${c}`:""),[c]),p=t.useRef({}),[m,f]=t.useState([]),[g,v]=t.useState({}),[y,b]=t.useState(""),x=(e,t)=>{v((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))};t.useLayoutEffect((()=>{E()}),[]),$i((()=>{w()}),[m]);const E=()=>Mn(void 0,void 0,void 0,(function*(){try{if(!u)return;const e=yield an.getItem(u);Array.isArray(e)&&(f(e),v(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}})),w=()=>Mn(void 0,void 0,void 0,(function*(){try{if(!u)return;yield an.setItem(u,m)}catch(e){}})),C=()=>{const e=ya();f([{id:e,label:h().format(Qd),value:{groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o}},...m]),Un((()=>x(e,!0)))},S=()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,d("qm.pivotGrid.saved.title"))),t.createElement("div",{className:"list"},t.createElement("ul",null,m.map((e=>t.createElement("li",{key:e.id,className:_e("ant-dropdown-menu-item sort-item",{active:e.id===y}),onClick:()=>(e=>{if(g[e.id])return;const t=y!==e.id,n=t?e.value:p.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),b(t?e.id:"")})(e)},t.createElement("div",{className:"label",style:{width:200}},g[e.id]?t.createElement(O,{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,f([...m])),x(e.id,!1)}}):t.createElement("span",null,e.label)),t.createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?t.createElement(qe,null):t.createElement($e,null)),t.createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(m.filter((e=>e.id!==n)))}},t.createElement(Ye,null))))))),t.createElement("div",{className:"add-record",style:{padding:10}},t.createElement("span",{className:"insert",onClick:C},t.createElement(pt,{className:"icon"}),d("qm.pivotGrid.saved.add"))));return t.createElement(F,{trigger:["click"],dropdownRender:()=>S(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o}:{},p.current=t}},t.createElement("span",null,t.createElement(_t,{className:"icon"}),d("qm.pivotGrid.saved.text")))},zm=()=>{const{gridData:e}=Tm(),{t:n}=Fn();return t.createElement("div",{className:"alert-info"},t.createElement(yt,{className:"icon"}),n("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})()}))},Vm=()=>{const{prefixCls:e,pivotRef:n,getRowKey:r,columns:i,colorList:l,setColorList:a,setFillColor:o}=Tm(),{flatGroupData:s}=n.current,{t:c}=Fn(),d=t.useRef([]),u=t.useMemo((()=>l.filter((e=>e.fieldName&&e.color&&("nil"===e.expression||!Yn(e.value))))),[l]),p=t.useMemo((()=>i.map((e=>({label:xa(e.title),value:e.dataIndex})))),[i]),h=t.useMemo((()=>vm(i)),[i]),m=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"}];$i((()=>{f()}),[t.useMemo((()=>{const e=u.map((e=>{var t;return{[e.color]:`${e.mode},${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}}));return he(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=dl((()=>{const e=[];u.forEach((t=>{const n=wa([Object.assign(Object.assign({},Qn(t,["value"])),{expression:"nil"!==t.expression?t.expression:"==",condition:t.value})]),i=Bl(s.filter((e=>!bm(e))),n);if("cell"===t.mode)for(let n=0;n<i.length;n++)e.push({color:t.color,rowKey:r(i[n],i[n].index),dataIndex:t.fieldName});if("row"===t.mode)for(let n=0;n<i.length;n++){const l=r(i[n],i[n].index);for(let n=0;n<h.length;n++)e.push({color:t.color,rowKey:l,dataIndex:h[n].dataIndex})}})),o(e)}),200),g=()=>{a([...l,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},v=(e,t,n)=>{var r;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(r=i.find((e=>e.dataIndex===n)).filter)||void 0===r?void 0:r.type)||"text";Object.assign(t,{type:e,expression:y(e)[0].value,value:""})}"expression"===e&&"nil"===n&&Object.assign(t,{value:""}),a([...l])},y=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},b=e=>t.createElement(t.Fragment,null,t.createElement(Ue,{className:"icon handle"}),t.createElement(pf,{defaultValue:e.color,style:{marginLeft:5},onChangeComplete:t=>v("color",e,t.hex)}),t.createElement(H,{value:e.mode,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:t=>v("mode",e,t)}),t.createElement(H,{value:e.fieldName||void 0,options:p,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>v("fieldName",e,t)}),t.createElement(H,{value:e.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:y(e.type),style:{width:100,margin:"0 10px"},onChange:t=>v("expression",e,t)}),(e=>{var n,r;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,Yn(t)?"":t)}});case"date":return t.createElement(Rn,{popupClassName:au.popupClassName,defaultValue:null!==(n=ga(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{v("value",e,va(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(r=i.find((t=>t.dataIndex===e.fieldName)))||void 0===r?void 0:r.dictItems)||[];return t.createElement(H,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{v("value",e,t)}},n.map((e=>t.createElement(H.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{v("value",e,t.target.value)}})}})(e),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{a(l.filter((t=>t!==e)))})(e)}));return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.fillColor.title"))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.fieldName)),n=l.map((e=>e.fieldName));he(t,n)||a(e)}},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},b(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(pt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Dt,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Wm=()=>t.createElement("div",{className:"top-bar"},t.createElement(lr,{size:4},t.createElement(zm,null),t.createElement(J,{type:"vertical"}),t.createElement(Am,null),t.createElement(Im,null),t.createElement(Rm,null),t.createElement(Om,null),t.createElement(J,{type:"vertical"}),t.createElement(Pm,null),t.createElement(Vm,null),t.createElement(km,null),t.createElement(J,{type:"vertical"}),t.createElement(jm,null)),t.createElement(lr,{size:4},t.createElement(Km,null))),Bm=t.createContext(void 0),Um=e=>{var n,r;const{scrollbar:i}=e,{pivotRef:l,getRowKey:a,columns:o,groupGridData:s,setPivotGridRef:c}=Tm(),{rowSelection:d,treeExpandable:u,rowHighlight:p}=l.current.props,h=null===(n=null==u?void 0:u.defaultExpandAllRows)||void 0===n||n,[m,f]=t.useState({scrollbarRef:i,selectionKeys:null!==(r=null==d?void 0:d.defaultSelectedRowKeys)&&void 0!==r?r:[],treeExpandKeys:h?ra(l.current.originGridData,(e=>a(e,e.index))):[],highlightKey:"",checkedColumnKey:"",hoverRowKey:"",updateLayout:0,clicked:[]}),g=t.useMemo((()=>Math.max(0,Em(s)-1)),[s]),v=e=>{f((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const l=i;Object.is(t[l],e[l])||(n[l]=e[l],r=!0)})),r?n:t}))};t.useLayoutEffect((()=>{N(),C()}),[o]),t.useLayoutEffect((()=>{(null==d?void 0:d.selectedRowKeys)&&v({selectionKeys:d.selectedRowKeys})}),[null==d?void 0:d.selectedRowKeys]),t.useLayoutEffect((()=>{void 0!==(null==p?void 0:p.currentRowKey)&&v({highlightKey:p.currentRowKey})}),[null==p?void 0:p.currentRowKey]);const y=e=>{Array.isArray(null==d?void 0:d.selectedRowKeys)||v({selectionKeys:e})},b=e=>{v({treeExpandKeys:e})},x=e=>{void 0===(null==p?void 0:p.currentRowKey)&&v({highlightKey:e})},E=e=>{v({checkedColumnKey:e})},w=e=>{v({hoverRowKey:e})},C=()=>{v({updateLayout:m.updateLayout+1})},S=e=>{Oa(e,m.clicked,!0)||v({clicked:e})},N=()=>{const e=i.current.container.clientWidth,{defaultColumnWidth:t}=au,n=[];let r=0;if(o.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,r+=e.width):(e.renderWidth=void 0,n.push(e))})),n.length>0){const r=o.reduce(((e,n)=>e+(n.width||n.minWidth||t)),0);if(r<=e){const i=e-r;if(1===n.length)n[0].renderWidth=(n[0].minWidth||t)+i;else{const e=i/n.reduce(((e,n)=>e+(n.minWidth||t)),0);let r=0;n.forEach(((n,i)=>{if(0===i)return;const l=Math.floor((n.minWidth||t)*e);r+=l,n.renderWidth=(n.minWidth||t)+l})),n[0].renderWidth=(n[0].minWidth||t)+i-r}}else n.forEach((e=>{e.renderWidth=e.minWidth||t}))}else r=o.reduce(((e,n)=>e+(n.renderWidth=n.width||n.minWidth||t)),0)},T=t.useMemo((()=>Object.assign(Object.assign({},m),{indentDepth:g,setContext:v,setSelectionKeys:y,setTreeExpandKeys:b,setHighlightKey:x,setCheckColumnKey:E,setHoverRowKey:w,forceUpdateLayout:C,setClicked:S,updateColumnsWidth:N})),[m,g]);return t.createElement(Bm.Provider,{value:T},e.children)},Gm=()=>t.useContext(Bm),Ym=e=>{var n;const{column:r}=e,{columns:i,setColumns:l}=Tm(),{scrollbarRef:a}=Gm(),o=t.useRef(null),[s,c]=t.useState(!1),d=t.useRef(document.onselectstart),u=t.useRef({startX:0,originSizeX:0,columnWidth:0}),p=e=>{u.current=Object.assign({},u.current,e)},h=e=>{if(1!==e.buttons)return m();const t=e.clientX-u.current.startX,n=(r.width||r.renderWidth)+t;n<(r.minWidth||au.defaultColumnWidth)||(p({columnWidth:n}),o.current.style.left=`${u.current.originSizeX+t}px`)},m=()=>{a.current.container.style.cursor="",r.width=u.current.columnWidth,l([...i]),Un((()=>c(!1))),ji(document,"mousemove",h),ji(document,"mouseup",m),p({startX:0,originSizeX:0,columnWidth:0}),f()},f=()=>{document.onselectstart!==d.current&&(document.onselectstart=d.current)};return t.createElement(t.Fragment,null,t.createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),a.current.container.style.cursor="col-resize";const t=oa(e.target,a.current.container).left-a.current.scrollLeft+3;p({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),qi(document,"mousemove",h),qi(document,"mouseup",m),c(!0),Un((()=>o.current.style.left=`${t}px`)),d.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(Xt,{open:s,getContainer:null===(n=a.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},Xm=e=>{var n;const{left:r}=e,{scrollbarRef:i}=Gm();return t.createElement(Xt,{open:!0,getContainer:null===(n=i.current)||void 0===n?void 0:n.container},t.createElement("div",{className:"fixed-line",style:{left:r}}))},Qm=()=>{const{pivotRef:e,columns:n}=Tm(),{indentDepth:r,updateLayout:i,checkedColumnKey:l,selectionKeys:a,setSelectionKeys:o,setCheckColumnKey:s}=Gm(),{rowSelection:c}=e.current.props,{selectionColumn:d}=au,{indentWidth:u,selectionColumnDefine:p}=gm,h=t.useMemo((()=>vm(n)),[n]),m=t.useMemo((()=>h.filter((e=>"left"===e.fixed))),[h]),f=t.useMemo((()=>h.filter((e=>"left"!==e.fixed))),[h]),g=t.useMemo((()=>"radio"!==(null==c?void 0:c.type)),[c]),v=t.useMemo((()=>m.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?r*u:0)),0)),[r,i,m]),y=t.useMemo((()=>a.length>0&&a.length===e.current.keyRecordMap.size),[a]),b=t.useMemo((()=>a.length>0&&a.length<e.current.keyRecordMap.size),[a]),x=(n,i)=>t.createElement("div",{className:_e(i?"fixed-left":"no-fixed"),style:{width:i?v:""}},n.map(((a,h)=>{const{dataIndex:m,title:f,align:v,width:x,renderWidth:E}=a,w={"selection-column":m===d,"col--center":"center"===v,"col--right":"right"===v,"col--checked":l===m},C=i&&1===h||!i&&h===n.length-1?r*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return t.createElement("div",{key:m,className:_e("table-cell",w),style:S,onClick:()=>{return e=m,void([p.dataIndex].includes(e)||s(l!==e?e:""));var e}},m!==d?t.createElement("span",{className:"cell"},f):g?t.createElement(M,{checked:y,indeterminate:b,onChange:t=>(t=>{var n;const r=t?Array.from(e.current.keyRecordMap.keys()):[];o(r),null===(n=null==c?void 0:c.onChange)||void 0===n||n.call(c,r,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",m!==d&&t.createElement(Ym,{column:a}))})));return t.createElement("div",{className:"header"},x(m,!0),(e=>x(e))(f),t.createElement(Xm,{left:v}))},Zm=e=>{const{pivotRef:n,getRowKey:r,size:i}=Tm(),{scrollbarRef:l,clicked:a,setHighlightKey:o,setClicked:s}=Gm(),{flatGroupData:c}=n.current,{rowHighlight:d}=n.current.props,u=t.useMemo((()=>2*au.rowHeightMaps[i]),[i]),p=t.useMemo((()=>c.filter((e=>!bm(e)))),[c]),h=$n((t=>{var n;const{keyCode:i}=t;if(!Yn(a)&&(27===i&&(o(""),s([])),38===i||40===i)){Ki(t);const c=p.length;let h=p.findIndex((e=>r(e,e.index)===a[0]));const m=38===i?(--h+c)%c:++h%c,f=p[m],g=r(f,f.index);d&&(o(g),null===(n=d.onChange)||void 0===n||n.call(d,g,f)),((t,n,r)=>{const i=p.length,a=e.find((e=>e.key===r)),o=l.current.scrollTop,s=l.current.container.offsetHeight,c=a.top,d=a.height;"top"===t?c<o?l.current.SET_SCROLL_TOP(c):n===i-1&&l.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?l.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&l.current.SET_SCROLL_TOP(c)})(38===i?"top":"bottom",m,g),s([g,a[1]])}}));t.useLayoutEffect((()=>(window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h))),[])},Jm=e=>{const{column:n,keyPath:r,type:i}=e,{prefixCls:l,countMethod:a,summationData:o,setCountMethod:s}=Tm(),{t:c}=Fn(),{dataIndex:d,filter:u}=n,[p,h]=t.useState(!1),m=t.useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:Cm.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:Cm.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:Cm.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:Cm.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:Cm.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:Cm.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:Cm.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:Cm.avg}];return"number"===(null==u?void 0:u.type)?e:e.slice(0,-4)}),[]),f=t.useMemo((()=>{var e,t,n;const l=a[d];if(!l)return c("qm.pivotGrid.count.statistic");return`${m.find((e=>e.value===l)).text} ${null!==(n=null===(t=null===(s=o,u=r,e=u?xm(s,u):s)||void 0===e?void 0:e[i])||void 0===t?void 0:t[d])&&void 0!==n?n:""}`;var s,u}),[o,a]);return t.createElement(F,{open:p,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},m.map((e=>{const n=e.value===a[d];return t.createElement("li",{key:e.value,className:_e("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[d]:n?void 0:e.value}),h(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement(qe,null)))})))),className:_e("count-select",{show:!!a[d]}),overlayClassName:`${l}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>h(e)},t.createElement("span",null,f," ",t.createElement(Ht,{className:"icon"})))},ef=(e,n)=>{const{pivotRef:r,columns:i,expandedKeys:l,groupGridData:a,searchResults:o,switchIndex:s,fillColorCells:c,setExpandedKeys:d}=Tm(),{indentDepth:u,hoverRowKey:p,highlightKey:h,checkedColumnKey:m,selectionKeys:f,treeExpandKeys:g,setSelectionKeys:v,setTreeExpandKeys:y,setHighlightKey:b,setHoverRowKey:x,setClicked:E}=Gm(),{keyRecordMap:w,isTree:C}=r.current,{rowSelection:S,treeExpandable:N,rowHighlight:T,onRowEdit:I,onRowClick:R}=r.current.props;Fn();const{renderText:O,getTitleFromCellNode:k}=vu(),{selectionColumn:L,treeTable:A}=au,{indentWidth:P}=gm,_=t.useMemo((()=>Array.isArray(a)),[a]),D=t.useMemo((()=>n?0:vm(i).length-e.length),[i,e]),H=t.useMemo((()=>"radio"!==(null==S?void 0:S.type)),[S]),F=(e,t)=>{var n,r;const i=H?e?[...f,t]:f.filter((e=>e!==t)):[t];v(i),null===(n=null==S?void 0:S.onSelect)||void 0===n||n.call(S,e,w.get(t)),null===(r=null==S?void 0:S.onChange)||void 0===r||r.call(S,i,$(i))},$=e=>{const t=[];return e.forEach((e=>t.push(w.get(e)))),t},q=(e,t)=>{var n,r;return(null===(n=o[s])||void 0===n?void 0:n.rowKey)===e&&(null===(r=o[s])||void 0===r?void 0:r.dataIndex)===t},K=e=>t.createElement("button",{className:_e("button-icon",{expand:l.includes(e.id)}),onClick:()=>{return t=e.id,void d(l.includes(t)?l.filter((e=>e!==t)):[...l,t]);var t}},t.createElement(Et,null)),z=(e,n,r,i)=>{const{dataIndex:l,width:a,renderWidth:o}=e,s={"expandable-column":l===L},c=1===n?(u-r._groupLevel)*P:0,d={width:`${(a||o||0)+c}px`,minWidth:`${(a||o||0)+c}px`};return t.createElement("div",{key:l,className:_e("label-cell",s),style:d},l!==L?t.createElement(t.Fragment,null,1===n&&t.createElement("span",{className:"title"},r._groupLabel.slice(1)),t.createElement(Jm,{column:e,keyPath:r.id,type:"subtotal"})):K(r))},V=(e,n)=>{var r;return t.createElement(He,{className:_e("cell--expand",{fold:!g.includes(n)}),style:{visibility:(null===(r=e.children)||void 0===r?void 0:r.length)>0?"visible":"hidden"},onClick:()=>(e=>{var t,n;const r=g.includes(e),i=r?g.filter((t=>t!==e)):[...g,e];y(i),null===(t=null==N?void 0:N.onExpand)||void 0===t||t.call(N,!r,w.get(e)),null===(n=null==N?void 0:N.onChange)||void 0===n||n.call(N,i)})(n)})},W=(e,n,r,i,l)=>{const{dataIndex:a,width:o,renderWidth:s,align:d,render:u}=e,p=da(r,a),h=u?u(p,r,e,r.index,n):O(p,e,r),g=k(h),v=f.includes(l),y={"selection-column":a===L,"col--center":"center"===d,"col--right":"right"===d,"col--checked":m===a,active:q(l,a)},x={width:`${o||s||0}px`,minWidth:`${o||s||0}px`,backgroundColor:c.get(`${l}|${a}`)};return t.createElement("div",{key:a,"data-col-index":n,title:g,className:_e("table-cell",y),style:x,onClick:t=>{var n;a!==L&&(E([l,a]),T&&(b(l),null===(n=T.onChange)||void 0===n||n.call(T,l,r)),null==R||R(r,e,t))}},a!==L?t.createElement(t.Fragment,null,C&&1===n&&t.createElement(t.Fragment,null,(w=r._level)?t.createElement("span",{key:w,className:`cell--indent indent-level-${w}`,style:{paddingLeft:w*A.textIndent+"px"}}):null,V(r,l)),t.createElement("span",{className:_e("cell",{indent:!_&&1===n})},h)):t.createElement("div",{className:"action"},t.createElement("span",{className:"drag-icon"}),t.createElement("div",{className:"middle"},t.createElement("span",{className:"order"},((e,t)=>C?0===e._level?e._varIndex+1:null:t+1)(r,i)),H?t.createElement(M,{className:"checkbox",checked:v,onChange:e=>F(e.target.checked,l)}):t.createElement(j,{className:"checkbox",checked:v,onChange:e=>F(e.target.checked,l)})),t.createElement("span",{className:"expand-icon",onClick:()=>null==I?void 0:I(r,i)},I?t.createElement(Mt,null):null)));var w};return{renderGroupRow:(n,r)=>t.createElement("div",{className:"label-row"},e.map(((e,t)=>z(e,D+t,n)))),renderRow:(n,r,i)=>{const l={"row--selection":f.includes(i),"row--highlight":h===i,"row--hover":p===i};return t.createElement("li",{key:i,"data-row-key":i,className:_e("table-row",l),onMouseEnter:()=>x(i),onMouseLeave:()=>x("")},e.map(((e,t)=>W(e,D+t,n,r,i))))}}},tf=e=>{const{tbodyColumns:n,layout:r,displayList:i,virtualRows:l}=e,{indentDepth:a,updateLayout:o}=Gm(),{indentWidth:s}=gm,c=t.useMemo((()=>n.filter((e=>"left"===e.fixed))),[n]),d=t.useMemo((()=>c.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?a*s:0)),0)),[a,o,c]),{renderGroupRow:u,renderRow:p}=ef(c,!0);return t.createElement("div",{className:"left-panel",style:{width:d}},t.createElement("div",{className:"container"},l.map((e=>{const n=e.index,l=r[n],a=i[n];if(bm(a))return t.createElement("div",{key:a.id,className:"group-label",style:{top:l.top,left:l.left,right:0,height:l.height}},u(a,l.key));const o=n===r.length-1||bm(i[n+1]);return t.createElement("div",{key:l.key,className:_e("row-item",{last:o}),style:{top:l.top,left:l.left,right:0,height:l.height}},p(a,a._varIndex,l.key))}))))},nf=e=>{const{tbodyColumns:n,layout:r,displayList:i,virtualRows:l}=e;Tm();const a=t.useMemo((()=>n.filter((e=>"left"!==e.fixed))),[n]),{renderGroupRow:o,renderRow:s}=ef(a);return t.createElement("div",{className:"main-panel"},t.createElement("div",{className:"container"},l.map((e=>{const n=e.index,l=r[n],a=i[n];if(bm(a))return t.createElement("div",{key:a.id,className:"group-label",style:{top:l.top,left:0,right:l.right,height:l.height}},o(a,l.key));const c=n===r.length-1||bm(i[n+1]);return t.createElement("div",{key:l.key,className:_e("row-item",{last:c}),style:{top:l.top,left:0,right:l.right,height:l.height}},s(a,a._varIndex,l.key))}))))},rf=()=>{const{pivotRef:e,getRowKey:n,prefixCls:r,size:i,columns:l,groupGridData:a,expandedKeys:o,searchResults:s,switchIndex:c}=Tm(),{scrollbarRef:d,treeExpandKeys:u}=Gm(),{flatGroupData:p}=e.current,{contextMenues:h}=e.current.props,{groupMargin:m}=gm,{rowHeightMaps:f}=au,g=t.useRef(null),v=t.useMemo((()=>vm(l)),[l]),y=t.useMemo((()=>Array.isArray(a)),[a]),{contextMenu:b,closeMenu:x}=(({ref:e,popup:n,getTriggerContainer:r,prevent:i,prefixCls:l="",enabled:a=!0})=>{const o=t.useRef(null),s=t.useRef(null),c=e=>{s.current=e},[d,u]=t.useState(!1),[p,h]=t.useState(null),m={width:150,height:200,zIndex:9999};Rp({ref:o,handler:()=>f()});const f=()=>{u(!1),h(null),c(null)},g=$n((e=>{if(e.preventDefault(),null==i?void 0:i(e.target))return f();c(e),u(!0),Un((()=>{var t;const{width:n,height:r}=(null===(t=o.current)||void 0===t?void 0:t.getBoundingClientRect())||m,i=n,l=r,a=window.innerWidth,s=window.innerHeight;let c=e.clientX,d=e.clientY;c+i>a&&(c=Math.max(c-i,0)),d+l>s&&(d=Math.max(d-l,0)),h({x:c,y:d})}))}));t.useEffect((()=>{const t=(null==r?void 0:r(e.current))||e.current;return a&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const v={position:"fixed",top:`${(null==p?void 0:p.y)||0}px`,left:`${(null==p?void 0:p.x)||0}px`,zIndex:m.zIndex};return{contextMenu:t.createElement(Xt,{open:d},t.createElement("div",{ref:o,className:`${l}__context-menu`,style:v},s.current?n(s.current):null)),closeMenu:f}})({ref:g,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:r,enabled:!!h,popup:e=>{var r;const i=Gi(e.target,"table-cell"),l=(null===(r=null==i?void 0:i.parentNode)||void 0===r?void 0:r.getAttribute("data-row-key"))||"",a=p.find((e=>n(e,e.index)==l)),o=Number((null==i?void 0:i.getAttribute("data-col-index"))||-1),s=v[o];return t.createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},h.map((e=>{var n;const r=(null===(n=e.disabled)||void 0===n?void 0:n.call(e,a,s))||!1;return t.createElement("li",{key:e.key,className:_e("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":r}),onClick:()=>{var t;r||(Un((()=>x())),null===(t=e.onClick)||void 0===t||t.call(e,a,s))}},e.prefix&&t.createElement("span",{className:"prefix"},e.prefix),t.createElement("span",{className:"label"},e.label),e.suffix&&t.createElement("span",{className:"suffix"},e.suffix))})))}}),E=t.useMemo((()=>{const e=new Map,t=[];return p.forEach((r=>{if(bm(r)){if(0===r._groupLevel)return e.set(r.id,o.includes(r.id)),void t.push(r);const n=r.id.slice(0,r.id.lastIndexOf(gm.separator));return void(o.includes(n)&&e.get(n)&&(e.set(r.id,o.includes(r.id)),t.push(r)))}const i=n(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(i,u.includes(i)),t.push(r))})),e.clear(),t}),[a,o,u]),w=t.useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],i=[],l=n,a=gm.indentWidth,o=gm.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;i.length>0&&i[i.length-1]._level>=e._groupLevel;){const e=i.pop();if(e.height=e._childHeight+l,r[e._index].height=e.height,i.length>0){const t=i[i.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}i[i.length-1];const t={key:e.id,top:s,left:a*e._groupLevel,right:a*e._groupLevel,height:l,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),i.push(t),s+=l}else{const n=i[i.length-1]||{left:0,right:0},a={key:t(e,e.index),top:s,left:n.left,right:n.right,height:l};r.push(a),s+=l,i.length>0&&(n._childHeight+=l)}}));i.length>0;){const e=i.pop();if(e.height=e._childHeight+l,r[e._index].height=e.height,i.length>0){const t=i[i.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(E,{getRowKey:n,rowHeight:f[i]})),[E,i]);Zm(w);const C=t.useMemo((()=>{if(y)return w.reduce(((e,t)=>e+t.height),0)+2*m;const e=w.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*m+2*m}),[y,w]),{virtualRows:S}=(e=>{const{layout:n,isGroup:r}=e,{size:i}=Tm(),{scrollbarRef:l}=Gm(),{rowHeightMaps:a}=au,o=t.useMemo((()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[l.current]),s=yp({count:n.length,getScrollElement:()=>o,estimateSize:e=>n[e].height,overscan:1,noCache:r,rangeExtractor:e=>{var t;if(!r)return sp(e);const c=l.current.scrollTop,d=(null===(t=s.scrollElement)||void 0===t?void 0:t.offsetHeight)||o.offsetHeight,u=[];for(let e=0;e<n.length;e++){const t=n[e];c>t.top+t.height+a[i]||c+d+a[i]<t.top||u.push(e)}return u}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:w,isGroup:!y});$i((()=>{const e=p.findIndex((e=>{var t;return n(e,e.index)===(null===(t=s[c])||void 0===t?void 0:t.rowKey)}));e>=0&&d.current.SET_SCROLL_TOP(e*f[i]);const t=v.findIndex((e=>{var t;return e.dataIndex===(null===(t=s[c])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=v.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);d.current.SET_SCROLL_LEFT(e)}}),[c,s]);const N={tbodyColumns:v,layout:w,displayList:E,virtualRows:S};return t.createElement("div",{ref:g,className:"body",style:{height:C}},t.createElement(tf,N),t.createElement(nf,N),b)},lf=()=>{const{columns:e,groupGridData:n,countMethod:r,setSummationData:i}=Tm(),{indentDepth:l,updateLayout:a}=Gm(),{selectionColumn:o}=au,{indentWidth:s}=gm,c=t.useMemo((()=>vm(e)),[e]),d=t.useMemo((()=>c.filter((e=>"left"===e.fixed))),[c]),u=t.useMemo((()=>c.filter((e=>"left"!==e.fixed))),[c]),p=t.useMemo((()=>d.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?l*s:0)),0)),[l,a,d]);$i((()=>{i(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const i=e.map((e=>Xn(e,r)||0));n[r]=t[r](i)}return n},i=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const l={},a={};Object.keys(t).forEach((e=>{a[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=>Xn(e,n)||0));e[n]=t[n](r),a[n].push(...r)}l[r]={subtotal:e}}else{const e=i(o);l[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&a[n].push(t)}}}if(0===n.length)return l;const o={};for(const e in t)o[e]=t[e](a[e]);return l.subtotal=o,l},l=Array.isArray(e)?{total:r(e)}:i(e);return n.length>0&&(l.total=r(n)),delete l.subtotal,l})(n,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:Cm[e[n]]});return t})(r)))}),[r,n]);const h=(e,n)=>t.createElement("div",{className:_e(n?"fixed-left":"no-fixed"),style:{width:n?p:""}},e.map(((r,i)=>{const{dataIndex:a,width:c,renderWidth:d}=r,u={"selection-column":a===o,"col--right":!0},p=n&&1===i||!n&&i===e.length-1?l*s:0,h={width:`${(c||d||0)+p}px`,minWidth:`${(c||d||0)+p}px`};return t.createElement("div",{key:a,className:_e("table-cell",u),style:h},a!==o?t.createElement(Jm,{column:r,keyPath:"",type:"total"}):null)})));return t.createElement("div",{className:"footer"},h(d,!0),(e=>h(e))(u))},af=()=>{const{prefixCls:e,size:n}=Tm(),r=t.useRef(null);return t.createElement(Um,{scrollbar:r},t.createElement(fl,{ref:r,className:_e(`${e}__layout`,n)},t.createElement(Qm,null),t.createElement(rf,null),t.createElement(lf,null)))},of=()=>t.createElement("div",{className:"wrapper"},t.createElement(af,null)),sf={rowKey:"id",columns:[],dataSource:[]},cf=e=>{const n=hn(sf,e),{rowKey:r,fromTable:i,columns:l,dataSource:a,height:o,maxHeight:s,className:c,style:d}=n,{$size:u}=qn(n),p=$n(((e,t)=>{const n="function"==typeof r?r(e,t):null==e?void 0:e[r];return void 0===n?(nr("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),h=(e,t="",n=0)=>e.map(((e,r)=>{const i=p(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=h(e.children,i,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),m=e=>{let t=!1;const n=(e=>e.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))))(e).map((e=>{"left"===e.fixed&&(t=!0);const n=Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0});return i&&(void 0===n.fixed&&delete n.fixed,delete n.editRender),n}));return!t&&n.length&&(n[0].fixed="left",nr("PivotGrid","至少需要有一项 `fixed: left` 的固定列")),n},f=t.useMemo((()=>m(l)),[l]),g=t.useMemo((()=>h(a)),[a]),v=ar("pivot-grid"),y={[v]:!0,"is-from-table":i},b={height:o,maxHeight:o||s?s:500},x={prefixCls:v,size:u,getRowKey:p,flatColumns:f,tableData:g,pivotProps:Qn(n,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return t.createElement("div",{className:_e(y,c),style:Object.assign(Object.assign({},d),b)},t.createElement(Nm,x,t.createElement(Wm,null),t.createElement(of,null)))};cf.displayName="PivotGrid";const df=t.forwardRef(((e,n)=>{const{dataIndex:r,className:i,style:l}=e;return t.createElement("li",{ref:n,"data-index":r,className:_e("list-item",i),style:l},e.children)}));df.displayName="ListItem";const uf=t.forwardRef(((e,n)=>{var r,i;const{dataSource:l=[],height:a,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,p=t.useRef(null),h=yp({count:l.length,getScrollElement:()=>{var e,t;return null!==(t=null===(e=p.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null},estimateSize:()=>s||40,overscan:3,onChange:(e,t)=>null==d?void 0:d(e,t)}),m=h.getVirtualItems();t.useImperativeHandle(n,(()=>({SCROLL_TO_INDEX:e=>h.scrollToIndex(e),SCROLL_TO_OFFSET:e=>h.scrollToOffset(e)})));const f=ar("virtual-list");return t.createElement(fl,{ref:p,className:_e(f,u),style:Object.assign(Object.assign({},e.style),{height:a,maxHeight:o})},t.createElement("div",{className:"container",style:{height:h.getTotalSize()}},t.createElement("ul",{style:{transform:`translateY(${null!==(i=null===(r=m[0])||void 0===r?void 0:r.start)&&void 0!==i?i:0}px)`}},m.map((e=>t.createElement(df,{ref:h.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(l[e.index],e.index)))))))}));uf.displayName="VirtualList";const pf=e=>{const{value:n,defaultValue:r,disabled:i,disabledAlpha:l,className:a,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=su("",{value:n,defaultValue:r}),p=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),h=ch({offset:0,arrowWidth:16,borderRadius:6}),m=ar("color-picker");return t.createElement(Qt,{action:["click"],prefixCls:m,popupPlacement:"bottomLeft",builtinPlacements:h,popup:()=>t.createElement(tn,{prefixCls:m,value:d,disabled:i,disabledAlpha:l,onChange:(e,t)=>{u(e.toRgbString()),null==s||s(p(e),t)},onChangeComplete:(e,t)=>{null==c||c(p(e),t)}})},t.createElement("div",{className:_e(`${m}-btn`,a),style:o},t.createElement(nn,{color:d,prefixCls:m})))};pf.displayName="ColorPicker";const hf="1.11.16";export{In as Calendar,Rn as DatePicker,Nl as DcpAnchor,rr as DcpButton,Mi as DcpCollapse,pf as DcpColorPicker,_n as DcpConfigProvider,Mp as DcpCopyToClipboard,tl as DcpCountup,Ld as DcpCropper,or as DcpDivider,El as DcpDownload,Rl as DcpDrawer,nl as DcpEmpty,hd as DcpForm,Zh as DcpGuideTracker,am as DcpLazyLoad,Ll as DcpModal,cf as DcpPivotGrid,Ah as DcpPrint,nh as DcpRangeTableHelper,fl as DcpScrollbar,Gp as DcpSearchHelper,Kd as DcpSearchTree,fm as DcpSignature,lr as DcpSpace,rl as DcpSpin,el as DcpSplit,Up as DcpTable,Il as DcpTabs,kd as DcpTinymce,gh as DcpTour,wh as DcpTransition,Jp as DcpTreeHelper,Zp as DcpTreeTableHelper,xl as DcpUploadFile,Pd as DcpUploadImg,uf as DcpVirtualList,Jh as DcpWatermark,Nl as QmAnchor,rr as QmButton,Mi as QmCollapse,pf as QmColorPicker,_n as QmConfigProvider,Mp as QmCopyToClipboard,tl as QmCountup,Ld as QmCropper,or as QmDivider,El as QmDownload,Rl as QmDrawer,nl as QmEmpty,hd as QmForm,Zh as QmGuideTracker,am as QmLazyLoad,Ll as QmModal,cf as QmPivotGrid,Ah as QmPrint,nh as QmRangeTableHelper,fl as QmScrollbar,Gp as QmSearchHelper,Kd as QmSearchTree,fm as QmSignature,lr as QmSpace,rl as QmSpin,el as QmSplit,Up as QmTable,Il as QmTabs,kd as QmTinymce,gh as QmTour,wh as QmTransition,Jp as QmTreeHelper,Zp as QmTreeTableHelper,xl as QmUploadFile,Pd as QmUploadImg,uf as QmVirtualList,Jh as QmWatermark,kn as TimePicker,po as pinyin,hf as version};
|
|
1
|
+
import*as e from"react";import t,{createContext as n,version as r,isValidElement as i,useRef as l,useLayoutEffect as a,useEffect as o,Component as s,forwardRef as c,useImperativeHandle as d,useState as u,useCallback as p}from"react";import h from"dayjs";import"dayjs/locale/zh-cn";import m from"dayjs/plugin/localeData";import f from"dayjs/plugin/advancedFormat";import g from"dayjs/plugin/customParseFormat";import v from"dayjs/plugin/quarterOfYear";import y from"dayjs/plugin/weekOfYear";import b from"dayjs/plugin/weekday";import{ConfigProvider as x,Button as E,Tooltip as w,Popconfirm as C,Space as S,Empty as N,Spin as T,Upload as I,message as R,Input as O,Tabs as k,Drawer as L,Modal as A,Form as P,Row as _,Col as D,Select as H,Checkbox as M,Dropdown as F,InputNumber as $,Rate as q,Radio as j,Switch as K,Tag as z,TreeSelect as V,Cascader as W,notification as B,Image as U,Tree as G,Menu as Y,Popover as X,Pagination as Q,Slider as Z,Divider as J}from"antd";export{Affix,Alert,Anchor,AutoComplete,Avatar,BackTop,Badge,Breadcrumb,Button,Card,Carousel,Cascader,Checkbox,Col,Collapse,Comment,ConfigProvider,Descriptions,Divider,Drawer,Dropdown,Empty,Form,Grid,Image,Input,InputNumber,Layout,List,Mentions,Menu,Modal,PageHeader,Pagination,Popconfirm,Popover,Progress,Radio,Rate,Result,Row,Segmented,Select,Skeleton,Slider,Space,Spin,Statistic,Steps,Switch,Table,Tabs,Tag,Timeline,Tooltip,Transfer,Tree,TreeSelect,Typography,Upload,message,notification}from"antd";import ee from"dayjs/plugin/weekYear";import te from"antd/es/calendar/generateCalendar";import ne from"antd/es/date-picker/generatePicker";import re from"antd/es/locale/zh_CN";import ie from"antd/es/locale/en_GB";import{isArray as le,isPlainObject as ae,isNumber as oe,isFunction as se,isString as ce,isUndefined as de,get as ue,transform as pe,isEqual as he,set as me,xor as fe,isRegExp as ge,merge as ve,uniqBy as ye,debounce as be,intersection as xe,map as Ee,groupBy as we,flatten as Ce,spread as Se,mergeWith as Ne,isDate as Te,omitBy as Ie,sumBy as Re,maxBy as Oe,minBy as ke,union as Le,pickBy as Ae,throttle as Pe}from"lodash-es";import _e from"classnames";import{UpOutlined as De,DownOutlined as He,UploadOutlined as Me,LinkOutlined as Fe,EditOutlined as $e,CheckOutlined as qe,EyeOutlined as je,DownloadOutlined as Ke,DeleteOutlined as ze,FullscreenExitOutlined as Ve,FullscreenOutlined as We,UnorderedListOutlined as Be,HolderOutlined as Ue,SearchOutlined as Ge,CloseOutlined as Ye,ExclamationCircleOutlined as Xe,ReloadOutlined as Qe,ZoomInOutlined as Ze,ZoomOutOutlined as Je,RotateRightOutlined as et,RotateLeftOutlined as tt,InboxOutlined as nt,InfoCircleFilled as rt,PrinterOutlined as it,ImportOutlined as lt,SettingOutlined as at,CopyOutlined as ot,CheckSquareOutlined as st,CloseCircleOutlined as ct,MonitorOutlined as dt,LineChartOutlined as ut,PlusOutlined as pt,PieChartOutlined as ht,FunnelPlotOutlined as mt,AppstoreAddOutlined as ft,StepBackwardOutlined as gt,StepForwardOutlined as vt,InfoCircleOutlined as yt,ClearOutlined as bt,PauseOutlined as xt,CaretRightOutlined as Et,QuestionCircleOutlined as wt,MenuOutlined as Ct,BorderOutlined as St,RightOutlined as Nt,LeftOutlined as Tt,FolderOpenOutlined as It,FilterOutlined as Rt,SortAscendingOutlined as Ot,EyeInvisibleOutlined as kt,ColumnHeightOutlined as Lt,FolderOutlined as At,BarsOutlined as Pt,SaveOutlined as _t,BgColorsOutlined as Dt,CaretDownOutlined as Ht,ExpandAltOutlined as Mt}from"@ant-design/icons";import Ft from"react-countup";import $t from"resize-observer-polyfill";import qt from"sortablejs";import jt from"add-dom-event-listener";import Kt from"scroll-into-view-if-needed";import zt from"react-draggable";import Vt from"memoize-one";import*as Wt from"prop-types";import Bt from"prop-types";import Ut from"cropperjs";import Gt from"big.js";import Yt from"copy-to-clipboard";import Xt from"@rc-component/portal";import Qt from"@rc-component/trigger";import Zt from"html2canvas";import Jt,{flushSync as en}from"react-dom";import tn,{ColorBlock as nn}from"@rc-component/color-picker";import{ReactSortable as rn}from"react-sortablejs";import ln from"exceljs";import an from"localforage";import on from"china-area-data";const sn=n({locale:"zh-cn",size:"middle"});var cn={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:"看板视图"}}}};let dn=cn;function un(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const pn=(...e)=>{const[t,n]=e;let r;const i=t.split(".");let l=dn;for(let e=0,t=i.length;e<t;e++){if(r=l[i[e]],e===t-1)return un(r,n);if(!r)return"";l=r}return""},hn=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})),mn=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function fn(e,t){mn((t=>{if(!t)return e()}),t)}h.extend(m),h.extend(f),h.extend(g),h.extend(v),h.extend(y),h.extend(b);var gn={},vn=[];function yn(e,t){if(!e&&void 0!==console){var n=vn.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function bn(e,t){if(!e&&void 0!==console){var n=vn.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function xn(e,t,n){t||gn[n]||(e(!1,n),gn[n]=!0)}function En(e,t){xn(yn,e,t)}function wn(e,t){xn(bn,e,t)}En.preMessage=function(e){vn.push(e)},En.resetWarned=function(){gn={}},En.noteOnce=wn,h.extend(g),h.extend(f),h.extend(b),h.extend(m),h.extend(y),h.extend(ee),h.extend((function(e,t){var n=t.prototype,r=n.format;n.format=function(e){var t=(e||"").replace("Wo","wo");return r.bind(this)(t)}}));var Cn={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},Sn=function(e){return Cn[e]||e.split("_")[0]},Nn=function(){wn(!1,"Not match any format. Please help to fire a issue about this.")},Tn={getNow:function(){return h()},getFixedDate:function(e){return h(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var t=e.locale("en");return t.weekday()+t.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},addYear:function(e,t){return e.add(t,"year")},addMonth:function(e,t){return e.add(t,"month")},addDate:function(e,t){return e.add(t,"day")},setYear:function(e,t){return e.year(t)},setMonth:function(e,t){return e.month(t)},setDate:function(e,t){return e.date(t)},setHour:function(e,t){return e.hour(t)},setMinute:function(e,t){return e.minute(t)},setSecond:function(e,t){return e.second(t)},isAfter:function(e,t){return e.isAfter(t)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return h().locale(Sn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(Sn(e)).weekday(0)},getWeek:function(e,t){return t.locale(Sn(e)).week()},getShortWeekDays:function(e){return h().locale(Sn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return h().locale(Sn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(Sn(e)).format(n)},parse:function(e,t,n){for(var r=Sn(e),i=0;i<n.length;i+=1){var l=n[i],a=t;if(l.includes("wo")||l.includes("Wo")){for(var o=a.split("-")[0],s=a.split("-")[1],c=h(o,"YYYY").startOf("year").locale(r),d=0;d<=52;d+=1){var u=c.add(d,"week");if(u.format("Wo")===s)return u}return Nn(),null}var p=h(a,l).locale(r);if(p.isValid())return p}return t&&Nn(),null}}};const In=te(Tn),Rn=ne(Tn);function On(){return On=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},On.apply(null,arguments)}const kn=e.forwardRef(((t,n)=>e.createElement(Rn,On({},t,{picker:"time",mode:void 0,ref:n}))));kn.displayName="TimePicker";const Ln=e.forwardRef(((t,n)=>e.createElement(Rn.RangePicker,On({},t,{picker:"time",mode:void 0,ref:n}))));Ln.displayName="RangePicker",kn.RangePicker=Ln;var An={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"}}}};const Pn={[An.name]:{qm:An,antd:ie},[cn.name]:{qm:cn,antd:re}},_n=e=>{const n=hn({locale:"zh-cn",size:"middle"},e),{locale:r,size:i,global:l}=n;t.useMemo((()=>{return e=Object.assign({},Pn,null==l?void 0:l.langPackage)[r].qm,dn=e||dn,void(dn.name&&h.locale(dn.name));var e}),[r]);const a=t.useMemo((()=>Object.assign({},Pn,null==l?void 0:l.langPackage)),[l]),[o,s]=t.useState({locale:r,size:i,global:l});return fn((()=>{s((e=>Object.assign({},e,{locale:r,size:i})))}),[i,r]),t.createElement(sn.Provider,{value:o},t.createElement(x,{locale:a[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==l?void 0:l.autoInsertSpaceInButton},n.children))};function Dn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function Hn(e,t,n,r){var i,l=arguments.length,a=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(l<3?i(a):l>3?i(t,n,a):i(t,n))||a);return l>3&&a&&Object.defineProperty(t,n,a),a}function Mn(e,t,n,r){return new(n||(n=Promise))((function(i,l){function a(e){try{s(r.next(e))}catch(e){l(e)}}function o(e){try{s(r.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}s((r=r.apply(e,t||[])).next())}))}function Fn(){const{locale:t}=e.useContext(sn);return{t:pn,$locale:t}}function $n(t){const n=e.useRef();n.current=t;return e.useCallback(((...e)=>{var t;return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)}),[])}function qn(t){const{size:n}=e.useContext(sn);return{$size:e.useMemo((()=>{var e,r;return null!==(r=null!==(e=t.size)&&void 0!==e?e:n)&&void 0!==r?r:""}),[t.size,n])}}_n.displayName="QmConfigProvider";var jn="undefined"==typeof window;const Kn=e=>t.isValidElement(e),zn=e=>Kn(e)&&e.type===t.Fragment,Vn=()=>{},Wn=()=>!0,Bn=e=>Mn(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),Un=e=>{Promise.resolve().then(e)},Gn=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),Yn=e=>!!(!e&&0!==e||le(e)&&!e.length||ae(e)&&!Object.keys(e).length),Xn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),Qn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Zn=(e,t=new WeakMap)=>{if(ae(e)||le(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const i=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(i||e,((n,l)=>{i&&(l=n),r[l]=Zn(e[l],t)})),r}return e},Jn=e=>oe(e)?`${e}px`:e.toString();class er extends Error{constructor(e){super(e),this.name="QmDesignError"}}function tr(e,t){throw new er(`[${e}] ${t}`)}function nr(e,t){console.warn(new er(`[${e}] ${t}`))}const rr=e=>{const{loading:n,shortcutKey:r,authConfig:i,click:l,confirm:a}=e,{t:o}=Fn(),{$size:s}=qn(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=$n((e=>{var t;const n=r.split("+").map((e=>e.trim().toLowerCase())),i=n.includes("alt"),l=n.includes("ctrl"),a=n.includes("shift"),o=n[n.length-1];i&&!e.altKey||l&&!e.ctrlKey||a&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),h.disabled||null===(t=h.onClick)||void 0===t||t.call(h,e))})),p=se(l)?{onClick:t=>Mn(void 0,void 0,void 0,(function*(){var n;d(!0);try{yield null===(n=e.click)||void 0===n?void 0:n.call(e,t)}catch(e){nr("Button","`click`方法执行出错")}d(!1)}))}:null,h=Object.assign(Object.assign(Object.assign({},Qn(e,["shortcutKey","authConfig","click","confirm"])),{size:s,loading:c||n||!1}),p);if(i){const{visible:e=1,disabled:t}=i||{};if(!e)return null;t&&(h.disabled=!0)}const m=t.createElement(E,h,e.children);return a?t.createElement(C,{title:a.title||o("qm.button.confirmTitle"),disabled:h.disabled,onConfirm:e=>{var t,n;null===(t=a.onConfirm)||void 0===t||t.call(a),null===(n=h.onClick)||void 0===n||n.call(h,e)},onCancel:e=>{var t;null===(t=a.onCancel)||void 0===t||t.call(a,e)}},t.createElement(E,On({},h,{onClick:Vn}),e.children)):!r||h.disabled?m:t.createElement(w,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},m)};var ir;rr.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(ir||(ir={}));const lr=e=>{const{$size:n}=qn(e),r=oe(e.size)?e.size:ir[n||"default"],i=Object.assign(Object.assign({},Qn(e,["size"])),{size:r});return t.createElement(S,i,e.children)};lr.displayName="QmSpace";const ar=e=>`qm-${e}`,or=e=>{const{label:n,extra:r,collapse:i,bordered:l=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=qn(e),{t:p}=Fn(),h=ar("divider"),m={[h]:!0,[`${h}-borderless`]:!l,[`${h}--lg`]:"large"===u,[`${h}--sm`]:"small"===u};return t.createElement("div",{id:o,className:_e(m,s),style:c},t.createElement("span",{className:`${h}__title`},n),t.createElement("div",{className:`${h}__extra`},r),void 0!==i&&t.createElement(E,{type:"link",className:`${h}__collapse`,disabled:a,onClick:()=>{null==d||d(!i)}},p(i?"qm.divider.collect":"qm.divider.spread"),i?t.createElement(De,null):t.createElement(He,null)))};or.displayName="QmDivider";const sr=()=>({height:0,opacity:0}),cr=e=>({height:e.scrollHeight,opacity:1}),dr=e=>({height:e?e.offsetHeight:0}),ur=(e,t)=>!0===(null==t?void 0:t.deadline)||"height"===t.propertyName;function pr(e){return pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pr(e)}function hr(e){var t=function(e,t){if("object"!==pr(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==pr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===pr(t)?t:String(t)}function mr(e,t,n){return(t=hr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fr(Object(n),!0).forEach((function(t){mr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,l,a,o=[],s=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=l.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function br(e){return e instanceof HTMLElement||e instanceof SVGElement}function xr(e){var n,r=function(e){return e&&"object"===pr(e)&&br(e.nativeElement)?e.nativeElement:br(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Jt.findDOMNode)||void 0===n?void 0:n.call(Jt,e):null)}var Er,wr={exports:{}},Cr={};wr.exports=(Er||(Er=1,function(){var e,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case t:var f=e.type;switch(f){case r:case l:case i:case d:case u:return f;default:var g=f&&f.$$typeof;switch(g){case s:case o:case c:case h:case p:case a:return g;default:return m}}case n:return m}}}e=Symbol.for("react.module.reference");var g=o,v=a,y=t,b=c,x=r,E=h,w=p,C=n,S=l,N=i,T=d,I=u,R=!1,O=!1;Cr.ContextConsumer=g,Cr.ContextProvider=v,Cr.Element=y,Cr.ForwardRef=b,Cr.Fragment=x,Cr.Lazy=E,Cr.Memo=w,Cr.Portal=C,Cr.Profiler=S,Cr.StrictMode=N,Cr.Suspense=T,Cr.SuspenseList=I,Cr.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},Cr.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},Cr.isContextConsumer=function(e){return f(e)===o},Cr.isContextProvider=function(e){return f(e)===a},Cr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Cr.isForwardRef=function(e){return f(e)===c},Cr.isFragment=function(e){return f(e)===r},Cr.isLazy=function(e){return f(e)===h},Cr.isMemo=function(e){return f(e)===p},Cr.isPortal=function(e){return f(e)===n},Cr.isProfiler=function(e){return f(e)===l},Cr.isStrictMode=function(e){return f(e)===i},Cr.isSuspense=function(e){return f(e)===d},Cr.isSuspenseList=function(e){return f(e)===u},Cr.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===l||t===i||t===d||t===u||t===m||"object"==typeof t&&null!==t&&(t.$$typeof===h||t.$$typeof===p||t.$$typeof===a||t.$$typeof===o||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},Cr.typeOf=f}()),Cr);var Sr=function(e,t){"function"==typeof e?e(t):"object"===pr(e)&&e&&"current"in e&&(e.current=t)},Nr=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);return r.length<=1?r[0]:function(e){t.forEach((function(t){Sr(t,e)}))}},Tr=function(e){var t,n,r=wr.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===wr.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===wr.exports.ForwardRef)};function Ir(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}Number(r.split(".")[0]);var Rr=e.createContext({});function Or(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,hr(r.key),r)}}function Lr(e,t,n){return t&&kr(e.prototype,t),n&&kr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ar(e,t){return Ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ar(e,t)}function Pr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ar(e,t)}function _r(e){return _r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_r(e)}function Dr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_r(e);if(t){var i=_r(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===pr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Dr(e)}(this,n)}}var Mr=function(t){Pr(r,e.Component);var n=Hr(r);function r(){return Or(this,r),n.apply(this,arguments)}return Lr(r,[{key:"render",value:function(){return this.props.children}}]),r}();function Fr(t){var n=e.useRef(!1),r=yr(e.useState(t),2),i=r[0],l=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[i,function(e,t){t&&n.current||l(e)}]}var $r="none",qr="appear",jr="enter",Kr="leave",zr="none",Vr="prepare",Wr="start",Br="active",Ur="end",Gr="prepared";function Yr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var Qr,Zr,Jr,ei=(Qr=Yr(),Zr="undefined"!=typeof window?window:{},Jr={animationend:Xr("Animation","AnimationEnd"),transitionend:Xr("Transition","TransitionEnd")},Qr&&("AnimationEvent"in Zr||delete Jr.animationend.animation,"TransitionEvent"in Zr||delete Jr.transitionend.transition),Jr),ti={};if(Yr()){var ni=document.createElement("div");ti=ni.style}var ri={};function ii(e){if(ri[e])return ri[e];var t=ei[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var l=n[i];if(Object.prototype.hasOwnProperty.call(t,l)&&l in ti)return ri[e]=t[l],ri[e]}return""}var li=ii("animationend"),ai=ii("transitionend"),oi=!(!li||!ai),si=li||"animationend",ci=ai||"transitionend";function di(e,t){return e?"object"===pr(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var ui=function(t){var n=l(),r=l(t);r.current=t;var i=e.useCallback((function(e){r.current(e)}),[]);function a(e){e&&(e.removeEventListener(ci,i),e.removeEventListener(si,i))}return e.useEffect((function(){return function(){a(n.current)}}),[]),[function(e){n.current&&n.current!==e&&a(n.current),e&&e!==n.current&&(e.addEventListener(ci,i),e.addEventListener(si,i),n.current=e)},a]},pi=Yr()?a:o,hi=function(e){return+setTimeout(e,16)},mi=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(hi=function(e){return window.requestAnimationFrame(e)},mi=function(e){return window.cancelAnimationFrame(e)});var fi=0,gi=new Map;function vi(e){gi.delete(e)}var yi=function(e){var t=fi+=1;return function n(r){if(0===r)vi(t),e();else{var i=hi((function(){n(r-1)}));gi.set(t,i)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};yi.cancel=function(e){var t=gi.get(e);return vi(e),mi(t)},yi.ids=function(){return gi};var bi=[Vr,Wr,Br,Ur],xi=[Vr,Gr],Ei=!1,wi=!0;function Ci(e){return e===Br||e===Ur}var Si=function(t,n,r){var i=yr(Fr(zr),2),l=i[0],a=i[1],o=function(){var t=e.useRef(null);function n(){yi.cancel(t.current)}return e.useEffect((function(){return function(){n()}}),[]),[function e(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;n();var l=yi((function(){i<=1?r({isCanceled:function(){return l!==t.current}}):e(r,i-1)}));t.current=l},n]}(),s=yr(o,2),c=s[0],d=s[1];var u=n?xi:bi;return pi((function(){if(l!==zr&&l!==Ur){var e=u.indexOf(l),t=u[e+1],n=r(l);n===Ei?a(t,!0):t&&c((function(e){function r(){e.isCanceled()||a(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,l]),e.useEffect((function(){return function(){d()}}),[]),[function(){a(Vr,!0)},l]};var Ni=function(t){var n=t;"object"===pr(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var i=t.visible,a=void 0===i||i,s=t.removeOnLeave,c=void 0===s||s,d=t.forceRender,u=t.children,p=t.motionName,h=t.leavedClassName,m=t.eventProps,f=function(e,t){return!(!e.motionName||!n||!1===t)}(t,e.useContext(Rr).motion),g=l(),v=l();var y=function(t,n,r,i){var a=i.motionEnter,s=void 0===a||a,c=i.motionAppear,d=void 0===c||c,u=i.motionLeave,p=void 0===u||u,h=i.motionDeadline,m=i.motionLeaveImmediately,f=i.onAppearPrepare,g=i.onEnterPrepare,v=i.onLeavePrepare,y=i.onAppearStart,b=i.onEnterStart,x=i.onLeaveStart,E=i.onAppearActive,w=i.onEnterActive,C=i.onLeaveActive,S=i.onAppearEnd,N=i.onEnterEnd,T=i.onLeaveEnd,I=i.onVisibleChanged,R=yr(Fr(),2),O=R[0],k=R[1],L=yr(Fr($r),2),A=L[0],P=L[1],_=yr(Fr(null),2),D=_[0],H=_[1],M=l(!1),F=l(null);function $(){return r()}var q=l(!1);function j(){P($r,!0),H(null,!0)}function K(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=q.current;A===qr&&r?n=null==S?void 0:S(t,e):A===jr&&r?n=null==N?void 0:N(t,e):A===Kr&&r&&(n=null==T?void 0:T(t,e)),A!==$r&&r&&!1!==n&&j()}}var z=yr(ui(K),1)[0],V=function(e){var t,n,r;switch(e){case qr:return mr(t={},Vr,f),mr(t,Wr,y),mr(t,Br,E),t;case jr:return mr(n={},Vr,g),mr(n,Wr,b),mr(n,Br,w),n;case Kr:return mr(r={},Vr,v),mr(r,Wr,x),mr(r,Br,C),r;default:return{}}},W=e.useMemo((function(){return V(A)}),[A]),B=yr(Si(A,!t,(function(e){if(e===Vr){var t=W[Vr];return t?t($()):Ei}var n;return G in W&&H((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===Br&&(z($()),h>0&&(clearTimeout(F.current),F.current=setTimeout((function(){K({deadline:!0})}),h))),G===Gr&&j(),wi})),2),U=B[0],G=B[1],Y=Ci(G);q.current=Y,pi((function(){k(n);var e,r=M.current;M.current=!0,!r&&n&&d&&(e=qr),r&&n&&s&&(e=jr),(r&&!n&&p||!r&&m&&!n&&p)&&(e=Kr);var i=V(e);e&&(t||i[Vr])?(P(e),U()):P($r)}),[n]),o((function(){(A===qr&&!d||A===jr&&!s||A===Kr&&!p)&&P($r)}),[d,s,p]),o((function(){return function(){M.current=!1,clearTimeout(F.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===$r&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=D;return W[Vr]&&G===Wr&&(Q=gr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:xr(v.current)}catch(e){return null}}),t),b=yr(y,4),x=b[0],E=b[1],w=b[2],C=b[3],S=e.useRef(C);C&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,Sr(r,e)}),[r]),I=gr(gr({},m),{},{visible:a});if(u)if(x===$r)N=C?u(gr({},I),T):!c&&S.current&&h?u(gr(gr({},I),{},{className:h}),T):d||!c&&!h?u(gr(gr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===Vr?O="prepare":Ci(E)?O="active":E===Wr&&(O="start");var k=di(p,"".concat(x,"-").concat(O));N=u(gr(gr({},I),{},{className:_e(di(p,x),(R={},mr(R,k,k&&O),mr(R,p,"string"==typeof p),R)),style:w}),T)}else N=null;e.isValidElement(N)&&Tr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(Mr,{ref:v},N)}));return r.displayName="CSSMotion",r}(oi);function Ti(){return Ti=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ti.apply(this,arguments)}var Ii="add",Ri="keep",Oi="remove",ki="removed";function Li(e){var t;return gr(gr({},t=e&&"object"===pr(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Ai(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(Li)}var Pi=["component","children","onVisibleChanged","onAllRemoved"],_i=["status"],Di=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];!function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ni,r=function(t){Pr(i,e.Component);var r=Hr(i);function i(){var e;Or(this,i);for(var t=arguments.length,n=new Array(t),l=0;l<t;l++)n[l]=arguments[l];return mr(Dr(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),mr(Dr(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:gr(gr({},e),{},{status:ki})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==ki})).length})),e}return Lr(i,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,i=this.props,l=i.component,a=i.children,o=i.onVisibleChanged,s=i.onAllRemoved,c=Ir(i,Pi),d=l||e.Fragment,u={};return Di.forEach((function(e){u[e]=c[e],delete c[e]})),delete c.keys,e.createElement(d,c,r.map((function(r){var i=r.status,l=Ir(r,_i),c=i===Ii||i===Ri;return e.createElement(n,Ti({},u,{key:l.key,visible:c,eventProps:l,onVisibleChanged:function(e){(null==o||o(e,{key:l.key}),e)||0===t.removeKey(l.key)&&s&&s()}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,i=Ai(n),l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,i=t.length,l=Ai(e),a=Ai(t);l.forEach((function(e){for(var t=!1,l=r;l<i;l+=1){var o=a[l];if(o.key===e.key){r<l&&(n=n.concat(a.slice(r,l).map((function(e){return gr(gr({},e),{},{status:Ii})}))),r=l),n.push(gr(gr({},o),{},{status:Ri})),r+=1,t=!0;break}}t||n.push(gr(gr({},e),{},{status:Oi}))})),r<i&&(n=n.concat(a.slice(r).map((function(e){return gr(gr({},e),{},{status:Ii})}))));var o={};return n.forEach((function(e){var t=e.key;o[t]=(o[t]||0)+1})),Object.keys(o).filter((function(e){return o[e]>1})).forEach((function(e){(n=n.filter((function(t){var n=t.key,r=t.status;return n!==e||r!==Oi}))).forEach((function(t){t.key===e&&(t.status=Ri)}))})),n}(r,i);return{keyEntities:l.filter((function(e){var t=r.find((function(t){var n=t.key;return e.key===n}));return!t||t.status!==ki||e.status!==Oi}))}}}]),i}();mr(r,"defaultProps",{component:"div"})}(oi);const Hi=t.forwardRef(((e,n)=>{const{forceRender:r,className:i,style:l,boxStyle:a,isActive:o}=e,[s,c]=t.useState(o||r);if(t.useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=ar("collapse");return t.createElement("div",{ref:n,className:_e(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},i),style:l},t.createElement("div",{className:`${d}-content-box`,style:a},e.children))}));Hi.displayName="PanelContent";const Mi=e=>{const{defaultActive:n,label:r,extra:i,className:l,style:a,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:p}=e,[h,m]=t.useState(!!n),f=ar("collapse"),g=_e({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},l);return t.createElement("div",{className:g,style:a},t.createElement(or,{label:r,extra:i,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),null==p||p(e)}}),t.createElement(Ni,On({visible:h},((e=ar("motion-collapse"))=>({motionName:e,onAppearStart:sr,onEnterStart:sr,onAppearActive:cr,onEnterActive:cr,onLeaveStart:dr,onLeaveActive:sr,onAppearEnd:ur,onEnterEnd:ur,onLeaveEnd:ur,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:n,style:r},i)=>t.createElement(Hi,{ref:i,prefixCls:f,className:n,style:r,boxStyle:o,isActive:h,forceRender:d},e.children))))};Mi.displayName="QmCollapse";const Fi=t.createContext(void 0);function $i(t,n){((t,n)=>{const r=e.useRef(!0);e.useEffect((()=>t(r.current)),n),e.useEffect((()=>(r.current=!1,()=>{r.current=!0})),[])})((e=>{if(!e)return t()}),n)}const qi=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},ji=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Ki=e=>e.preventDefault(),zi=(e,t)=>{if(jn||!e||!t)return null;"float"===(t=Gn(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]}},Vi=(e,t,n)=>{!jn&&e&&t&&(ae(t)?Object.keys(t).forEach((n=>{Vi(e,n,t[n])})):(t=Gn(t),e.style[t]=n))},Wi=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Bi=(e,t)=>Math.abs(Wi(e)-Wi(t)),Ui=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}},Gi=(e,t)=>{var n;let r=e;for(;r;){if(null===(n=r.classList)||void 0===n?void 0:n.contains(t))return r;r=r.parentNode}return null},Yi=(e,t)=>{if(jn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Xi=e=>Math.pow(e,3),Qi=e=>e<.5?Xi(2*e)/2:1-Xi(2*(1-e))/2,Zi=e=>{const{minValues:n,onDragChange:r,onDragging:i}=e,{splitRef:l,direction:a}=t.useContext(Fi),{t:o}=Fn(),s=t.useRef(jn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===a),[a]),d=t.useMemo((()=>c?"X":"Y"),[c]),u=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),p=e=>{u.current=Object.assign({},u.current,e)},h=e=>{if(1!==e.buttons)return m();const t=e[`page${d}`]-u.current[`start${d}`],r=[n[0],u.current[`containerSize${d}`]-n[1]];let l=u.current[`firstElementSize${d}`]+t;l=Math.max(r[0],l),l=Math.min(r[1],l),i(l)},m=()=>{p({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),ji(document,"mousemove",h),ji(document,"mouseup",m),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${ar("split")}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return t.createElement("div",{className:_e(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=l.current,n=t.children[0];p({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),qi(document,"mousemove",h),qi(document,"mouseup",m),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Zi.displayName="ResizeBar";const Ji=t.forwardRef(((e,n)=>{const{offset:r,className:i,style:l}=e,{direction:a,dragging:o}=t.useContext(Fi),s="vertical"===a?"height":"width",c={[ar("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[i]:!!i},d=void 0!==r?{[s]:Jn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:_e(c),style:Object.assign(Object.assign({},d),l)},e.children)}));Ji.displayName="SplitPane";const el=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:l,style:a,onDragStart:o,onDrag:s=Vn,onDragEnd:c}=e,{global:d}=t.useContext(sn),u=t.useRef(null),p=t.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`,m=e=>Number.parseInt(e,10),f=e=>{var t;const n=Number.parseInt((null===(t=e.props)||void 0===t?void 0:t.min)||0);return n>=0?n:0},g=t.useMemo((()=>i?`split_${i}`:""),[i]),[v,y]=t.useState(!1),[b,x]=t.useState(h(r));$i((()=>{v?null==o||o(m(b)):(null==c||c(m(b)),localStorage.setItem(g,b),C(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(h(e)):w(g).then((e=>{localStorage.setItem(g,h(e||r)),E()})).catch((()=>{}))},w=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),C=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),S=t.useMemo((()=>({splitRef:u,direction:n,dragging:v})),[n,v]),N=[];t.Children.map(e.children,(e=>{var t;Kn(e)&&!zn(e)&&"SplitPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const[T,I]=N,R=t.useMemo((()=>[f(T),f(I)]),[T,I]),O={[ar("split")]:!0,vertical:"vertical"===n};return t.createElement(Fi.Provider,{value:S},t.createElement("div",{ref:u,className:_e(O,l),style:a},t.createElement(Ji,On({},T.props,{ref:p,offset:b})),t.createElement(Zi,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Ji,I.props)))};el.displayName="QmSplit",el.Pane=Ji;const tl=e=>{const{className:n,style:r}=e,{$size:i}=qn(e),l=ar("countup"),a={[l]:!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i};return t.createElement(Ft,On({},e,{className:_e(a,n),style:r}),e.children)};tl.displayName="QmCountup";const nl=e=>{const{className:n}=e,{$size:r}=qn(e),i=ar("empty"),l=Object.assign(Object.assign({},e),{image:N.PRESENTED_IMAGE_SIMPLE}),a={[i]:!0,[`${i}--lg`]:"large"===r,[`${i}--sm`]:"small"===r};return t.createElement(N,On({},l,{className:_e(a,n)}))};nl.displayName="QmEmpty";const rl=e=>{const n=hn({tip:"Loading..."},e),{fullHeight:r,className:i,style:l}=n,a=ar("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:_e(o,i)},Qn(n,["fullHeight"])),{style:Object.assign(Object.assign({},l),{maxHeight:"none"})});return t.createElement(T,s,n.children)};rl.displayName="QmSpin";const il=t.createContext(void 0),ll=new Map;const al=new $t((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=ll.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function ol(e,t){ll.has(e)||(ll.set(e,new Set),al.observe(e)),ll.get(e).add(t)}function sl(e,t){ll.has(e)&&(ll.get(e).delete(t),ll.get(e).size||(al.unobserve(e),ll.delete(e)))}function cl(t){const[n,r]=e.useState({width:0,height:0});return e.useLayoutEffect((()=>{const e=t.current,n=e=>{r({width:e.offsetWidth,height:e.offsetHeight})};return e&&ol(e,n),()=>{e&&sl(e,n)}}),[t]),n}function dl(t,n){const r=e.useRef(null);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{r.current&&clearTimeout(r.current),r.current=setTimeout((()=>t.apply(this,e)),n)}),[t,n])}const ul=6,pl={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"}},hl=e=>{const{thumb:n,always:r,className:i,barSize:l=ul,direction:a="vertical",onDrag:o=Vn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(il),u=pl[a],p=t.useRef(n),h=t.useRef(null),m=t.useRef(null),f=t.useRef({}),g=t.useRef(!1),v=t.useRef(!1),y=t.useRef(jn?null:document.onselectstart),[b,x]=t.useState(!1);t.useLayoutEffect((()=>{p.current=n}),[n]),t.useEffect((()=>{const e=c.current;return qi(e,"mousemove",S),qi(e,"mouseleave",N),()=>{C(),ji(document,"mouseup",w),ji(e,"mousemove",S),ji(e,"mouseleave",N)}}),[]);const E=e=>{if(!h.current||!m.current)return;if(!g.current)return;const t=f.current[u.axis];if(!t)return;const n=100*(-1*(h.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/h.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},w=()=>{g.current=!1,f.current={[u.axis]:0},ji(document,"mousemove",E),ji(document,"mouseup",w),C(),v.current&&x(!1),o(!1)},C=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},S=()=>{v.current=!1,x(!!p.current.size)},N=()=>{v.current=!0,x(g.current)},T=ar("scrollbar"),I={[`${T}__bar`]:!0,"is-vertical":"vertical"===a,"is-horizontal":"horizontal"===a},R={[u.reverse]:l},O={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(wh,{name:"fade",in:r||s||b,timeout:300},t.createElement("div",{ref:h,className:_e(I,i),style:R},t.createElement("div",{ref:m,className:`${T}__thumb`,style:O,onMouseDown:e=>{e.stopPropagation(),qi(document,"mousemove",E),qi(document,"mouseup",w),g.current=!0,y.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(f.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},ml=20,fl=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,innerStyle:l,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=ml,onScroll:u}=e,p=t.useRef(null),h=t.useRef(null),m=t.useRef(null),[f,g]=t.useState({size:0,offset:0,ratio:1}),[v,y]=t.useState({size:0,offset:0,ratio:1}),[b,x]=t.useState(!1),E=cl(p),w=cl(m);fn((()=>{!s&&C()}),[w.width,w.height,E.width,E.height]);const C=dl((()=>{if(!h.current)return;const e=h.current.offsetHeight-4,t=h.current.offsetWidth-4,n=Math.pow(e,2)/h.current.scrollHeight,r=Math.pow(t,2)/h.current.scrollWidth,i=Math.max(n,d),l=Math.max(r,d),a=n/(e-n)/(i/(e-i)),o=r/(t-r)/(l/(t-l)),s=i+4<e?i:0,c=l+4<t?l:0,u=100*h.current.scrollTop/e*a,p=100*h.current.scrollLeft/t*o;g(Object.assign({},f,{size:c,ratio:o,offset:p})),y(Object.assign({},v,{size:s,ratio:a,offset:u}))}),5),S=e=>{x(e)},N=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,i=window.requestAnimationFrame,l=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollTop=r+(t-r)*Qi(a),i(l)):e.scrollTop=t};i(l)})(h.current,e):h.current.scrollTop=e:nr("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{oe(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,i=window.requestAnimationFrame,l=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollLeft=r+(t-r)*Qi(a),i(l)):e.scrollLeft=t};i(l)})(h.current,e):h.current.scrollLeft=e:nr("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:p.current,scrollTop:(null===(e=h.current)||void 0===e?void 0:e.scrollTop)||0,scrollLeft:(null===(t=h.current)||void 0===t?void 0:t.scrollLeft)||0,SET_SCROLL_TOP:N,SET_SCROLL_LEFT:T}}));const I=t.useMemo((()=>({dragging:b,scrollbarElement:p,wrapElement:h})),[b]),R=ar("scrollbar"),O={[`${R}__wrap`]:!0,[`${R}__wrap--hidden`]:!s};return t.createElement("div",{ref:p,className:_e(R,e.className),style:e.style},t.createElement("div",{ref:h,className:_e(O,r),style:i,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(()=>{if(!h.current)return;const e=h.current.offsetHeight-4,t=h.current.offsetWidth-4,n=100*h.current.scrollTop/e*v.ratio,r=100*h.current.scrollLeft/t*f.ratio;g(Object.assign({},f,{offset:r})),y(Object.assign({},v,{offset:n}))})(),null==u||u({scrollTop:t,scrollLeft:n})}},t.createElement("div",{ref:m,className:`${R}__view`,style:l},e.children)),!s&&t.createElement(il.Provider,{value:I},c&&t.createElement(hl,{className:"top",direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(hl,{direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(hl,{direction:"vertical",thumb:v,barSize:a,always:o,onDrag:S})))}));fl.displayName="QmScrollbar";const gl=(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}},vl=(e,{fileName:t,headers:n,params:r})=>Mn(void 0,void 0,void 0,(function*(){const i=r?new URLSearchParams(r).toString():"",l=i?e.includes("?")?"&":"?":"",a=yield fetch(e+`${l+i}`,{method:"GET",headers:n});if(!a.ok)throw new Error(pn("qm.download.error"));const o=yield a.blob(),s=a.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));gl(o,c)})),yl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},bl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},xl=e=>{var n,r;const i=hn({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:l=[],fileDirection:a="vertical",batchDownload:o,draggable:s,editable:c,disabled:d,readOnly:u,button:p={},className:h,onPreview:m,onSortChange:f,onEditChange:g,onDownload:v,onChange:y}=i,{t:b}=Fn(),{$size:x}=qn(i),w=t.useRef(null),C=t.useRef(null),[S,N]=t.useState({}),T=t.useMemo((()=>d||u),[d,u]);t.useEffect((()=>(A(),()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.destroy()})),[]);const k=(e,t)=>{N((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},L=$n((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...l],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:l[t],fileList:e})}})),A=()=>{s&&(C.current=qt.create(Gi(w.current,ar("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:L}))},P=e=>Mn(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=i;try{e.url&&(yield vl(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){R.error(b("qm.download.error"))}})),_=ar("upload-file"),D={[_]:!0,[`${_}--lg`]:"large"===x,[`${_}--sm`]:"small"===x,[`${_}--horizontal`]:"horizontal"===a};return t.createElement(I,On({className:_e(D,h)},Qn(i,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>Mn(void 0,void 0,void 0,(function*(){const{fileTypes:l=[],fileSize:a,maxCount:o,fileList:s=[],beforeUpload:c}=i,d=!l.length||l.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!a||e.size/1024/1024<a,p=!(o>1)||s.length<o,h=d&&u&&p;if(d||R.warning(b("qm.upload.tooltip",{type:l.join(",")})),u||R.warning(b("qm.upload.sizeLimit",{size:a})),p||R.warning(b("qm.upload.countLimit",{count:o})),!h)return I.LIST_IGNORE;if(c){const i=c(e,t);if(!0===i)return n(e);if(!1===i)return r("not upload");if(i&&"function"==typeof i.then)try{const e=yield i;n(e)}catch(e){r(e)}}else n(e)})))),disabled:T,onChange:y,onPreview:e=>Mn(void 0,void 0,void 0,(function*(){if("function"==typeof m)return m(e,(t=>P(t||e)));d||(yield P(e))})),onDownload:e=>Mn(void 0,void 0,void 0,(function*(){yield P(e)})),itemRender:(e,n,r,a)=>((e,n)=>{const{iconRender:r}=i,{uid:a,name:o,url:u,status:p="done"}=e,h="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return t.createElement("div",{className:_e("ant-upload-list-item",`ant-upload-list-item-${p}`,"ant-upload-list-item-list-type-text",{handle:s})},t.createElement("div",{className:"ant-upload-list-item-info"},t.createElement("span",{className:"ant-upload-span"},t.createElement("div",{className:"ant-upload-text-icon"},r?r(e):t.createElement(Fe,null)),t.createElement("div",{className:"ant-upload-list-item-name"},S[a]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:yl(o),onBlur:t=>{const{value:n}=t.target;if(n!==yl(o)){const t=Object.assign({},e,{name:`${n}.${bl(o)}`}),r=l.map((e=>e.uid!==a?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}k(a,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?T||k(a,!0):n.preview()}},o)),t.createElement("span",{className:"ant-upload-list-item-card-actions"},c&&!T&&t.createElement("button",{type:"button",className:h,onClick:()=>k(a)},S[a]?t.createElement(qe,null):t.createElement($e,null)),c&&t.createElement("button",{type:"button",className:_e(h,"preview"),onClick:()=>n.preview()},t.createElement(je,null)),t.createElement("button",{type:"button",className:_e(h,"download"),disabled:d,onClick:()=>n.download()},t.createElement(Ke,null)),t.createElement("button",{type:"button",className:_e(h,"delete"),disabled:T,onClick:()=>n.remove()},t.createElement(ze,null))))))})(n,a)}),t.createElement("span",{className:"inner",ref:w},i.children||u&&l.length?i.children:t.createElement(E,{type:null!==(n=p.type)&&void 0!==n?n:"default",icon:null!==(r=p.icon)&&void 0!==r?r:t.createElement(Me,null),disabled:T},p.text||b("qm.upload.text")),o&&!!l.length&&t.createElement(E,{disabled:d,style:{marginLeft:8},onClick:e=>Mn(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),"function"==typeof o)yield o(l);else for(const e of l)yield P(e)}))},b("qm.upload.batchDownload"))))};xl.displayName="QmUploadFile";const El=e=>{const n=hn({icon:t.createElement(Ke,null),withCredentials:!1},e),{$size:r}=qn(n),{t:i}=Fn(),[l,a]=t.useState(!1),o=Qn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,On({},o,{size:r,loading:l,onClick:()=>Mn(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:l,beforeDownload:a=Wn,onSuccess:o}=n,s=ce(e)?e:yield Mn(void 0,void 0,void 0,(function*(){const e=n.action;if(e.api)try{const t=yield e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}));if(!s)return nr("Download","参数 `action` 有误!");if(!a(s))return;yield vl(s,{fileName:t,headers:r,params:l}),yield Bn(100),null==o||o(),R.success(i("qm.download.success"))}catch(t){null===(e=n.onError)||void 0===e||e.call(n,t),R.error(i("qm.download.error"))}a(!1)}))}),n.children||i("qm.download.text"))};function wl(t,n){const r=e.useRef(null),i=e.useRef(0);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{const r=Date.now();(!i.current||r-i.current>n)&&(t.apply(this,e),i.current=r)}),[t,n])}El.displayName="QmDownload";const Cl=e=>{const{activeKey:n,labels:r,onTabClick:i}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const l={item:!0,actived:r===n};return t.createElement("div",{key:r,className:_e(l),onClick:e=>i(r,e)},t.createElement("span",null,e))})))},Sl=e=>{const{label:n,showDivider:r,className:i,style:l}=e,a={[ar("anchor-item")]:!0};return t.createElement("div",{className:_e(a,i),style:l},r&&t.createElement(or,{label:n,style:{marginBottom:10}}),e.children)};Sl.displayName="AnchorItem";const Nl=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:i,labelWidth:l,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=qn(e),u=t.useRef(null),p=t.useRef(),h=t.useRef("ready"),m=t.useRef(0),[f,g]=t.useState(i||0),v=t.useMemo((()=>!!(null==r?void 0:r.length)),[r]);t.useEffect((()=>{y();const e=jt(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=Bi(x(f),u.current))},b=e=>{const t=Math.abs(e),n=(v?r.map((e=>document.getElementById(e.id))):Array.from((null===(i=u.current)||void 0===i?void 0:i.children)||[])).map((e=>Bi(e,u.current)));var i;let l=-1;for(let e=0;e<n.length;e++){const r=n[e],i=n[e+1]||1e4;t>=r-1&&t<i&&(l=e)}return l},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=wl((e=>{if("ready"!==h.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),w=e=>{const t=x(e);t&&(g(e),h.current="stop",p.current&&clearTimeout(p.current),Kt(t,{block:"start",behavior:"smooth",boundary:u.current}),p.current=setTimeout((()=>h.current="ready"),500))};t.useImperativeHandle(n,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>m.current?m.current:e,w(e)}})));const C=ar("anchor"),S={[C]:!0,[`${C}-left`]:"left"===a,[`${C}-top`]:"top"===a,[`${C}--lg`]:"large"===d,[`${C}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;Kn(e)&&!zn(e)&&"AnchorItem"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&N.push(e)}));const T=v?r.map((e=>e.label)):N.map((e=>e.props.label)),I=v?r.map((e=>e.id)):N.map(((e,t)=>e.props["data-id"]||t.toString()));return m.current=T.length,t.createElement("div",{className:_e(S,s),style:c},t.createElement("div",{className:_e("anchor-nav"),style:{width:l?Jn(l):""}},t.createElement(Cl,{activeKey:f,labels:T,onTabClick:(e,t)=>{w(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:_e("anchor-container")},v?e.children:N))}));Nl.displayName="QmAnchor",Nl.Item=Sl;const Tl=e=>t.createElement(k.TabPane,e,e.children);Tl.displayName="TabPane";const Il=e=>{const n=hn({tabPosition:"top"},e),{items:r,tabPosition:i,tabBarGutter:l,className:a,authConfig:o}=n,{$size:s}=qn(n),c=ar("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},Qn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=l?l:["top","bottom"].includes(i)?30:0}),p=[];t.Children.map(n.children,(e=>{var t;Kn(e)&&!zn(e)&&"TabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&p.push(e)}));const h=r?[...r]:p.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<h.length;t++){const n=h[t],r=e.find((e=>e.dataIndex===n.key)),{visible:i=1,disabled:l}=r||{};i?l&&(n.disabled=!0):(h.splice(t,1),t--)}}return t.createElement(k,On({},u,{items:h,className:_e(d,a)}))};Il.displayName="QmTabs",Il.TabPane=Tl;const Rl=t.forwardRef(((e,n)=>{var r;const i=hn({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:l,open:a,className:o,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:p,onClose:h,onClosed:m,onFullChange:f}=i,{global:g}=t.useContext(sn),{$size:v}=qn(i),y=t.useRef(null),b=t.useRef(null),x=t.useRef(!1),[E,w]=t.useState(!1),[C,S]=t.useState(!1),[N,T]=t.useState(!1);$i((()=>{(null!=a?a:l)&&(!p&&x.current||de(s)&&S(!0))}),[null!=a?a:l]),$i((()=>{b.current&&Vi(b.current,E?{width:"100%"}:{width:Jn(i.width||"72%")})}),[E]);const I=()=>{b.current=Gi(y.current,"ant-drawer-content-wrapper"),w(!E),null==f||f(!E)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=ar("drawer"),O={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===v,[`${R}--sm`]:"small"===v};return t.createElement(L,On({},Qn(i,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=a?a:l,maskClosable:null!==(r=null!=u?u:null==g?void 0:g.maskClosable)&&void 0!==r&&r,className:_e(O,o),title:t.createElement(t.Fragment,null,t.createElement("span",{ref:y,className:"text"},c&&i.title),d&&t.createElement("button",{type:"button",className:"full-screen",onClick:I},t.createElement(E?Ve:We))),footer:null,afterOpenChange:e=>{e?(x.current=!0,de(s)&&setTimeout((()=>S(!1)),100)):(w(!1),null==m||m())},onClose:h}),i.children,(s||N||C)&&t.createElement(rl,{spinning:!0,className:_e("spinning")}))}));Rl.displayName="QmDrawer";const Ol="10vh";var kl;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(kl||(kl={}));const Ll=t.forwardRef(((e,n)=>{var r;const i=hn({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Ol}},e),{visible:l,open:a,width:o,height:s,className:c,loading:d,draggable:u,showHeader:p,showFullScreen:h,maskClosable:m,destroyOnClose:f,bodyStyle:g,onFullChange:v,onClose:y,onClosed:b}=i,{global:x}=t.useContext(sn),{$size:E}=qn(i),w=t.createRef(),C=t.useRef(!1),S=t.useMemo((()=>`calc(100vh - ${Ol} - ${Ol} - ${kl[p?E:"none"]}px)`),[E,p]),[N,T]=t.useState(!1),[I,R]=t.useState(!1),[O,k]=t.useState(!1),[L,P]=t.useState(!0),[_,D]=t.useState({left:0,top:0,bottom:0,right:0}),[H,M]=t.useState();$i((()=>{if(null!=a?a:l){if(!f&&C.current||de(d)&&R(!0),!f&&C.current)return;setTimeout((()=>{C.current=!0,de(d)&&R(!1)}),400)}}),[null!=a?a:l]),$i((()=>{M(N?{x:0,y:0}:void 0)}),[N]);const F=e=>{const t=Gi(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");N?(Vi(t,{width:Jn(o||"60%"),height:"auto",top:Ol}),Vi(n,{height:s?Jn(s):S,maxHeight:"auto"===s?S:""})):(Vi(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Vi(n,{height:`calc(100vh - ${kl[p?E:"none"]}px)`,maxHeight:""})),T(!N),null==v||v(!N)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>k(!0),STOP_LOADING:()=>k(!1)})));const $=ar("modal"),q={height:s?Jn(s):S,maxHeight:"auto"===s?S:"",overflow:"auto"},j={[$]:!0,"no-header":!p,[`${$}--lg`]:"large"===E,[`${$}--sm`]:"small"===E};return t.createElement(A,On({},Qn(i,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:null!=a?a:l,maskClosable:null!==(r=null!=m?m:null==x?void 0:x.maskClosable)&&void 0!==r&&r,className:_e(j,c),title:t.createElement("div",{onMouseOver:()=>{L&&P(!1)},onMouseOut:()=>{P(!0)}},t.createElement("span",{className:"text"},p&&i.title),h&&t.createElement("button",{type:"button",className:"full-screen",onClick:F},t.createElement(N?Ve:We))),footer:null,bodyStyle:Object.assign({},q,g),onCancel:y,afterClose:()=>{null==b||b(),T(!1)},modalRender:e=>t.createElement(zt,{nodeRef:w,bounds:_,position:H,disabled:!u||L||N,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,i=w.current.getBoundingClientRect();i&&D({left:-i.left+t.x,right:n-(i.right-t.x)-1,top:-i.top+t.y,bottom:r-(i.bottom-t.y)-1})})(0,t)},t.createElement("div",{ref:w},e))}),i.children,(d||O||I)&&t.createElement(rl,{spinning:!0,className:_e("spinning")}))}));Ll.displayName="QmModal";const Al=n(void 0),Pl=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var _l={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)Pl.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 "),e=this.find_replace(e," NIN "," nin ")}};const Dl=["==","<",">","<=",">=","!=","like","likes","in","nin"];var Hl=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},Ml=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++)Dl.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),Dl.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const Fl=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,$l=["string","number","boolean","symbol"],ql=e=>$l.includes(typeof e),jl=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Kl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Fl,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Kl(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Kl(t))));break;case"in":ql(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":ql(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(jl(e)?e.slice(0,10):e)!=n;break;case"<":r=(jl(e)?e.slice(0,10):e)<n;break;case"<=":r=(jl(e)?e.slice(0,10):e)<=n;break;case">":r=(jl(e)?e.slice(0,10):e)>n;break;case">=":r=(jl(e)?e.slice(0,10):e)>=n;break;default:r=(jl(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const zl=_l.stringify,Vl=_l.array_format,Wl=Hl,Bl=(e,t,n)=>{let r=[];t=_l.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Ml(t,"record")};`);r=Ia(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Ml(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)n(e,t)&&r.push(e[t])}}catch(t){nr("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Ul=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Ul(e.children)):t.push(e)})),t},Gl=e=>e.filter((e=>(e.children&&(e.children=Gl(e.children)),!e.hidden&&!e.noAuth))),Yl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Yl(e.children))})),t},Xl=(e,t)=>e.map((e=>(e.children&&(e.children=Xl(e.children,t)),null==t||t(e),e))),Ql=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Ql(n.children,t);if(e)return e}}return null},Zl=e=>{const t=e.children;return t?t[0].children?Zl(t[0]):t[0]:e},Jl=e=>{const t=e.children;return t?t[t.length-1].children?Jl(t[t.length-1]):t[t.length-1]:e},ea=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),ta=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=ta(n.children,t);if(e)return e}}return null},na=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...na(e.children))})),t},ra=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ra(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},ia=e=>{let t=1;const n=(e,r)=>{var i;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=null!==(i=e.colSpan)&&void 0!==i?i:1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return Yl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},la=e=>Object.assign(e,{__prevent__:!0}),aa=e=>{delete e.__prevent__},oa=(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 oa(e.offsetParent,t,n)}return n},sa=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ca=(e,t)=>pe(e,((e,n,r)=>{he(n,t[r])||(e[r]=ae(n)&&ae(t[r])?ca(n,t[r]):n)})),da=(e,t)=>{var n;return null!==(n=ue(e,t))&&void 0!==n?n:""},ua=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),me(e,t,null!=n?n:"")},pa=(e,t)=>{if(!t.includes("|"))return da(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(da(e,t))})),n.every((e=>!e))?"":n.join(" | ")},ha=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),ma=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],i="";for(;r.length>3;)i=`,${r.slice(-3)}${i}`,r=r.slice(0,r.length-3);return r&&(i=r+i),`${n}${i}${t[1]?`.${t[1]}`:""}`},fa=(e,t)=>{const n=e.toString();if(!ha(n)||0===t)return e;const r=Number.parseFloat(n).toString(),i=r.indexOf(".");if(-1===i)return r+"."+"0".repeat(t);const l=Math.max(0,t-(r.length-i-1));return r+"0".repeat(l)},ga=(e,t)=>e?h(e,t):null,va=(e,t)=>e?h(e).format(t):"",ya=(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)}))},ba=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...ba(e))}))}else n.push(e);return n},xa=e=>ba(e).join(""),Ea=e=>e.filter((e=>!e._group)),wa=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let i=0,l=e.length;i<l;i++){const l=e[i];if(!l.fieldName)continue;const a=Array.isArray(l.condition)?Vl(l.condition):zl(l.condition,"^");n+=`${l.bracketLeft} ${t?`${l.fieldName}|${l.fieldType}`:l.fieldName} ${l.expression} ${a} ${l.bracketRight} ${l.logic} `,r=l.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[i,l]=r.includes("|")?r.split("|"):[r,""],a=e[r];for(const e in a){n+=`${t?`${i}|${l}`:i} ${e} ${Array.isArray(a[e])?Vl(a[e]):zl(a[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},Ca=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(da(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},Sa=(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=Sa(e[n].children,t);if(r)return[e[n],r].flat()}}},Na=(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=Na(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},Ta=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=Ta(n.children,t);if(e)return e}if(t(n))return n}return null},Ia=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Ia(e.children,t),t(e)||e.children&&e.children.length))),Ra=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Oa=(e,t,n=!1)=>{const r=new Set;return function e(t,i,l=1){if(r.has(t))return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);const a=l+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],i[n],a))return!1;return!0}if(t&&i&&"object"==typeof t&&"object"==typeof i){const n=Object.keys(t);return n.length===Object.keys(i).length&&n.every((n=>e(t[n],i[n],a)))}return!1}(e,t)},ka=e=>["","small","middle","large"].includes(e),La=80,Aa="1",Pa="0",_a=400,Da=["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"],Ha={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Ma,Fa,$a;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Ma||(Ma={})),function(e){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"}(Fa||(Fa={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}($a||($a={}));const qa={items:Bt.arrayOf(Bt.shape({type:Bt.string.isRequired,fieldName:Bt.string.isRequired})),initialValues:Bt.object,initialExtras:Bt.object,layout:Bt.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!ka(e[t]||""))return tr("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Bt.number,className:Bt.string,style:Bt.object,compactMode:Bt.bool,labelWidth:Bt.oneOfType([Bt.number,Bt.string]),labelAlign:Bt.oneOf(["left","right"]),labelWrap:Bt.bool,formType:Bt.oneOf(["default","search","onlyShow"]),disabled:Bt.bool,uniqueKey:Bt.string,defaultRows:Bt.number,defaultExpand:Bt.bool,searchButtonCols:Bt.number,scrollToFirstError:Bt.bool,authConfig:Bt.object,isAutoFocus:Bt.bool,isCollapse:Bt.bool,isFieldsDefine:Bt.bool,isSearchBtn:Bt.bool,isSubmitBtn:Bt.bool,fieldsChange:Bt.func,onValuesChange:Bt.func,onFieldsChange:Bt.func,onFinish:Bt.func,onFinishFailed:Bt.func,onReset:Bt.func,onCollapse:Bt.func},ja={layout:"horizontal",labelWidth:La,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:Vn,onFieldsChange:Vn,onFinish:Vn,onFinishFailed:Vn,onReset:Vn,onCollapse:Vn},Ka=(e,t)=>{if(!e)return null;if(t===Fa.week){const t=e.match(/^(\d{4})-(\d+)/);return t?h().year(Number(t[1])).week(Number(t[2])):null}if(t===Fa.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?h().year(Number(t[1])).quarter(Number(t[2])):null}return h(e,t)},za=(e,t)=>e?h(e).format(t):"",Va=e=>""===e||null==e,Wa=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let i="";for(let t=0,l=r.length;t<l;t++){i+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===l-1?"":" | ")}return i},Ba=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const i=t[r].split("|"),l=n[r].split("|");i.forEach(((t,n)=>e[t]=e[l[n]]))}else e[t[r]]=e[n[r]]},Ua=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const i=t[r].split("|"),l=n[r].split("|");i.forEach(((t,n)=>e[t]=e[l[n]]))}else e[t[r]]=e[n[r]]},Ga=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),de(e.isLeaf)||(r.isLeaf=!!e.isLeaf),de(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=Ga(e.children,t,n)),r})),Ya=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=Ya(n.children,t);if(e)return e}}return null},Xa=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...Xa(e.children,t,n+1))})),r},Qa=e=>Kn(e)||"string"==typeof e,Za=e=>Kn(e)?ba(e).join(""):null!=e?e:"",Ja=(e,t,n,r)=>{var i;const l={};return l.filters=(null===(i=e.filters)||void 0===i?void 0:i.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})))||[],l.table={columns:e.columns||[],rowKey:e.valueName},l.fieldsDefine={valueKey:e.valueKey||e.valueName},l.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(l.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(l.echoRequest={fetchApi:n(e.echoSetting.api),formatter:t=>{var n;return Object.assign({},t,{[e.echoSetting.paramKey]:null!==(n=t.key)&&void 0!==n?n:t.keys})},dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(l.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(l.tree={fetch:{api:n(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const n={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>n[e.tableField]=e.treeField)),n}}),e.emmediateSetting&&(l.columns=e.emmediateSetting.columns,l.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),l};var eo={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"}};const to="阿",no="鿿",ro=1,io=2,lo=3;let ao,oo=null;function so(e){return e||null===oo?("object"==typeof Intl&&Intl.Collator?(ao=new Intl.Collator(["zh-Hans-CN","zh-CN"]),oo=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):oo=!1,oo):oo}function co(e){const t=eo.UNIHANS,n=eo.PINYINS,r=eo.EXCEPTIONS,i={source:e};if(e in r)return i.type=io,i.target=r[e],i;let l,a=-1;if(e.charCodeAt(0)<256)return i.type=ro,i.target=e,i;if(l=ao.compare(e,to),l<0)return i.type=lo,i.target=e,i;if(0===l)i.type=io,a=0;else{if(l=ao.compare(e,no),l>0)return i.type=lo,i.target=e,i;0===l&&(i.type=io,a=t.length-1)}if(i.type=io,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const i=t[a];if(l=ao.compare(e,i),0===l)break;l>0?n=a+1:r=a-1}}return l<0&&a--,i.target=n[a],i.target||(i.type=lo,i.target=i.source),i}function uo(e){return"string"==typeof e&&so()?e.split("").map((e=>co(e))):e}var po={isSupported:so,parse:uo,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(eo)})))},genToken:co,convertToPinyin:(e,t,n)=>uo(e).map((e=>t&&e.type===io?e.target.toLowerCase():e.target)).join(n||"")};var ho={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)}};po.isSupported()&&ho.shouldPatch(po.genToken)&&po.patchDict(ho);const mo=e=>{const{value:n,bordered:r}=e;return t.createElement(O,{value:n,title:n,bordered:r,readOnly:!0})};mo.displayName="FormItemView";const{Option:fo}=H,go=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Fn(),{fieldName:d,options:u={},style:p={},placeholder:h=c("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:f=!0,readOnly:g,disabled:v,onClear:y}=e.option,{itemList:b=[],filterable:x=!0,listHeight:E=_a,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,T=Yn(b)?i:b,I=e=>{var t;return(null===(t=T.find((t=>t.value===e)))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},R=e=>l?(null==e?void 0:e.map((e=>I(e))).join(","))||"":I(e);return n.isOnlyShow?t.createElement(mo,{value:R(r),bordered:m}):t.createElement(H,On({value:r,mode:l?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:h,style:p,loading:a,bordered:m,allowClear:f,disabled:v,showSearch:x,listHeight:E,maxTagCount:w?"responsive":void 0,maxTagTextLength:C},l?{title:R(r)}:null,{filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"",i=po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,R(e),T)})(e)},onClear:y}),T.map((e=>t.createElement(fo,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class vo extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,buttonAfter:h,validateTrigger:m,rules:f=[],onChange:g=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Jn(d)},required:e.getFormItemRequired(f)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(go,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),h&&t.createElement(D,null,e.renderFormItemButton(o,h)),p&&t.createElement(D,{flex:Jn(p.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}vo.contextType=Al;const yo=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=Pa,trueValue:h=Aa}=o,{t:m}=Fn(),f=e=>m(e===h?"am.form.trueText":"am.form.falseText");return t.createElement(M,{checked:r===h,style:s,disabled:d||n.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==i||i(e),l(e,f(e))})(t?h:p)}},u?a:null)};class bo extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option,{labelToCheckbox:m}=o;return t.createElement(P.Item,{label:m?" ":e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(yo,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}bo.contextType=Al;const xo=e=>{const{uniqueKey:n,items:r,fieldsChange:i}=e,{global:l}=t.useContext(sn),{$$form:a}=t.useContext(Al),{$size:o}=qn(e),{t:s}=Fn(),c=t.useRef(null),[d,u]=t.useState(!1),p=t.useMemo((()=>n?`form_${n}`:""),[n]);t.useLayoutEffect((()=>{f()}),[]);const h=()=>{if(!p)return;const e=JSON.parse(localStorage.getItem(p));var t;if(e||(t=p,Mn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(p,JSON.stringify(e)),f()):(null==l?void 0:l.getComponentConfigApi)&&m(r)})).catch((()=>{})),!e)return;return fe(e.map((e=>e.fieldName)),r.map((e=>e.fieldName))).length>0?r.map((t=>{const{fieldName:n}=t,r=e.find((e=>e.fieldName===n));return r?(de(r.hidden)||(t.hidden=r.hidden),t):t})):e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName));return Object.assign(Object.assign({},t),e)}))},m=e=>{if(!p)return;const t=e.map((e=>{const t={};return de(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(p));var r,i;he(t,n)||(localStorage.setItem(p,JSON.stringify(t)),r=p,i=t,Mn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.saveComponentConfigApi;if(e)try{yield e({[r]:i})}catch(e){}})))},f=()=>{const e=h();e&&g(e)},g=e=>{null==i||i([...e])},v=()=>t.createElement("div",{className:_e("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(rr,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||Zn(e);return Object.assign(t,{hidden:e.hidden})}));g(t),m(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));if(he(t,n))return;a.setExpandHandle(!0);const i=Ra(e);g(i),m(i)}},r.map((e=>{var n;return t.createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},t.createElement(M,{disabled:(null===(n=e.rules)||void 0===n?void 0:n.findIndex((e=>e.required)))>-1,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,g(r),m(r)}}),t.createElement(Ue,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=ar("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(F,{open:d,trigger:["click"],dropdownRender:()=>v(),overlayClassName:_e(b),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>c.current,onOpenChange:e=>{u(e)}},t.createElement("a",{ref:c,style:{padding:"5px 0"}},t.createElement(Be,null)))};xo.displayName="FieldsFilter";const Eo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Al),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Fn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m,onFocus:f,onBlur:g,onEnter:v,onClear:y}=e.option,{prefix:b,suffix:x,password:E,maxLength:w,pattern:C,toUpper:S,toTrim:N,autoFocus:T,autoComplete:I,secretType:R}=s,k=R&&(h||m),L=t.useRef();t.useEffect((()=>{var e;const t=()=>null==y?void 0:y(),n=null===(e=L.current)||void 0===e?void 0:e.input.parentNode.querySelector("span[class*='clear-icon']");return p&&n&&n.addEventListener("click",t),()=>{null==n||n.removeEventListener("click",t)}}),[]);const A=e=>{null==l||l(e),a(e)},P=E?O.Password:O,_=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))(i,R):i;return r.isOnlyShow?t.createElement(mo,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(_),bordered:u}):t.createElement(P,{ref:e=>{L.current=e,"function"==typeof n&&n(e)},value:_,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":_,prefix:b,suffix:x,maxLength:w,bordered:u,allowClear:p,readOnly:h,disabled:m,onFocus:e=>{null==f||f(e.target.value,e)},onBlur:t=>{var n;let r=null!==(n=t.target.value)&&void 0!==n?n:"";if(N){const e=r.trim();r!==e&&(r=e,A(r))}(t=>{const{onBlur:n}=e;null==n||n(t)})(r),null==g||g(r,t)},onKeyUp:e=>{var t;if(13===e.keyCode){const{value:n}=e.target;null==v||v(n,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=L.current)||void 0===t||t.blur())}},onChange:e=>{let t=e.target.value;ge(C)&&(t=C.test(t)?t:null!=i?i:""),S&&(t=t.toUpperCase()),A(t)}})}));Eo.displayName="VInput";class wo extends s{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Eo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(l,t)}}))),u&&t.createElement(D,null,e.renderFormItemButton(l,u)),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}wo.contextType=Al;const Co=e=>{const{$$form:n}=t.useContext(Al),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p}=e.option,{prefix:h,suffix:m,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;null==i||i(t),l(t,v(t))},v=e=>e.join(" - ");return n.isOnlyShow?t.createElement(mo,{value:v(r),bordered:c}):t.createElement(O.Group,null,t.createElement(O,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:h,suffix:m,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:p,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:p,readOnly:!0}),t.createElement(O,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:h,suffix:m,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:p,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class So extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(o)},required:e.getFormItemRequired(u)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Co,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(D,{flex:Jn(c.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}So.contextType=Al;const No=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Al),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Fn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:p,disabled:h,onFocus:m,onBlur:f,onEnter:g}=e.option,{step:v=1,min:y,max:b,precision:x,autoFocus:E,stringMode:w,textAlign:C="left",controls:S=!0,formatter:N,parser:T}=s,I=t.useRef(),R=t.useRef(i),O=e=>{const t=Va(e)?"":oe(e)?e.toFixed(x):new Gt(e).toFixed(x);return"function"==typeof N?N(t):t},k={[C]:!0,controls:S};return r.isOnlyShow?t.createElement(mo,{value:O(i),bordered:u}):t.createElement($,{ref:e=>{I.current=e,"function"==typeof n&&n(e)},value:i,className:_e(k),placeholder:d,style:Object.assign({width:"100%"},c),step:v,min:y,max:b,controls:S,precision:x,autoFocus:E,stringMode:w,formatter:N,parser:T,bordered:u,readOnly:p,disabled:h,onFocus:e=>{null==m||m(e.target.value,e)},onBlur:t=>{Un((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(R.current),null==f||f(R.current,t)}))},onKeyUp:e=>{var t;13===e.keyCode&&(null==g||g(i,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=I.current)||void 0===t||t.blur()))},onChange:e=>{const t=null!=e?e:"";!w&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{R.current=e,null==l||l(e),a(e,O(e))})(t)}})}));No.displayName="VInputNumber";class To extends s{constructor(){super(...arguments),this.focus=()=>{const{type:e}=this.props.option;this[e].focus()}}render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(No,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(l,n)}}))),u&&t.createElement(D,null,e.renderFormItemButton(l,u)),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}To.contextType=Al;const Io=e=>{const{$$form:n}=t.useContext(Al),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:p}=e.option,{step:h=1,min:m=0,max:f,textAlign:g="left",controls:v=!0,precision:y,formatter:b,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];null==i||i(t),l(t,C(t))},C=e=>Va(e)?"":e.map((e=>Va(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(mo,{value:C(r),bordered:c}):t.createElement(O.Group,null,t.createElement($,{value:r[0],className:_e("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:h,min:m,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:p,onChange:e=>{w([e,r[1]])},onBlur:()=>{E(r)}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:p,readOnly:!0}),t.createElement($,{value:r[1],className:_e("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:h,min:m,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:p,onChange:e=>{w([r[0],e])},onBlur:()=>{E(r)}}))};class Ro extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:p=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(o)},required:e.getFormItemRequired(u)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Io,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(D,{flex:Jn(c.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}var Oo;Ro.contextType=Al,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Oo||(Oo={}));const{Search:ko}=O;class Lo extends s{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||nr("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)||nr("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&nr("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Mn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Yn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Ba(e,this.alias,c),d&&Ua(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Wa(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==l||l([e])}}}catch(e){}this.setState({loading:!1})}})),this.todoOpen=e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)},this.createFilters=e=>{const{fieldName:t}=this.props.option,{filterAliasMap:n}=this.searchHelper,r=""!==e?e:void 0,i=("function"==typeof n?n():n)||[],l={[t]:r};return(Array.isArray(i)?i:[i]).forEach((e=>{if(ae(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](r):r;else l[e]=r})),l},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Wn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>Mn(this,void 0,void 0,(function*(){var o;const s=ve({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return a();this.setState({loading:!0});try{const e=yield t.fetch.api(s);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];l(n)}else a()}catch(e){a(e)}finally{Un((()=>this.setState({loading:!1})))}}))))},this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const i=Wa(e,this.alias[r]);void 0!==i&&(t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i))}for(const n in this.extras){const r=Wa(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>Mn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=Wa(e,this.alias[n]))||void 0===r?void 0:r.toString().toLowerCase().includes(t.toLowerCase())}));if(1===r.length)return this.closeSearchHelper(r[0]);this.openSearchHelper(t)})),this.openSearchHelper=(e,t)=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,i=(null!=r?r:Wn)(n.state.formData);(null==i?void 0:i.then)?i.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==i&&(this.todoOpen(e),null==t||t())})),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]:Wa(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])});const r=Wa(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(e)),200)}))},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)},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("")}},this.searchHelperChangeHandle=e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,null==t||t(e,this._record)},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},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(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=pn("qm.form.inputPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:pn("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:Object.assign({},this.deriveParams,c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(mo,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(ko,{ref:e=>this[`${a}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,disabled:f,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:i=!0,table:l}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?i?(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.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:t}=e.target;!r&&this.openSearchHelper(t)}},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"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):Un((()=>this.clearSearchHelperValue())))}}),t.createElement(Ll,b,t.createElement(Gp,x)))}}Lo.contextType=Al;class Ao extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[]}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Lo,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Ao.contextType=Al;const Po=e=>{class n extends s{constructor(){super(...arguments),this.event1=null,this.event2=null,this.$el=null,this.omitClassNames=[],this.state={clickOutside:!1},this.mousedownHandler=e=>{this.startClick=e},this.mouseupHandler=e=>{this.documentHandler(e,this.startClick)},this.documentHandler=(e,t)=>{var n,r;const i=e.target,l=null==t?void 0:t.target,a=!i||!l,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(i))||(null===(r=this.$el)||void 0===r?void 0:r.contains(l)),s=this.$el===i,c=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),d=c.some((e=>null==e?void 0:e.contains(i)))||c.includes(l);let u;u=!(a||o||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=(e=[])=>{this.omitClassNames=e}}componentDidMount(){this.event1=jt(document,"mousedown",this.mousedownHandler),this.event2=jt(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){var e,t;null===(e=this.event1)||void 0===e||e.remove(),null===(t=this.event2)||void 0===t||t.remove()}render(){const{forwardedRef:n}=this.props,{clickOutside:r}=this.state;return t.createElement(e,On({ref:n},this.props,{clickOutside:r,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return n.displayName=`OutsideClick(${e.displayName||e.name})`,t.forwardRef(((e,r)=>t.createElement(n,On({},e,{forwardedRef:r}))))};function _o(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}function Do(e,t,n,r){var i=Jt.unstable_batchedUpdates?function(e){Jt.unstable_batchedUpdates(n,e)}:n;return null!=e&&e.addEventListener&&e.addEventListener(t,i,r),{remove:function(){null!=e&&e.removeEventListener&&e.removeEventListener(t,i,r)}}}var Ho=c((function(e,t){var n=e.didUpdate,r=e.getContainer,i=e.children,a=l(),s=l();d(t,(function(){return{}}));var c=l(!1);return!c.current&&Yr()&&(s.current=r(),a.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==a.current&&a.current.appendChild(s.current),function(){var e;null===(e=s.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(s.current)}}),[]),s.current?Jt.createPortal(i,s.current):null}));function Mo(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var Fo;function $o(e){var t=e.prefixCls,n=e.motion,r=e.animation,i=e.transitionName;return n||(r?{motionName:"".concat(t,"-").concat(r)}:i?{motionName:i}:null)}function qo(t){var n=t.prefixCls,r=t.visible,i=t.zIndex,l=t.mask,a=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!l)return null;var c={};return(a||s||o)&&(c=gr({motionAppear:!0},$o({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(Ni,Ti({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:i},className:_e("".concat(n,"-mask"),r)})}))}function jo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ko(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jo(Object(n),!0).forEach((function(t){Vo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zo(e){return zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zo(e)}function Vo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wo={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function Bo(){if(void 0!==Fo)return Fo;Fo="";var e=document.createElement("p").style;for(var t in Wo)t+"Transform"in e&&(Fo=t);return Fo}function Uo(){return Bo()?"".concat(Bo(),"TransitionProperty"):"transitionProperty"}function Go(){return Bo()?"".concat(Bo(),"Transform"):"transform"}function Yo(e,t){var n=Uo();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function Xo(e,t){var n=Go();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var Qo,Zo=/matrix\((.*)\)/,Jo=/matrix3d\((.*)\)/;function es(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function ts(e,t,n){var r=n;if("object"!==zo(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):Qo(e,t);for(var i in t)t.hasOwnProperty(i)&&ts(e,i,t[i])}function ns(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var i=e.document;"number"!=typeof(n=i.documentElement[r])&&(n=i.body[r])}return n}function rs(e){return ns(e)}function is(e){return ns(e,!0)}function ls(e){var t=function(e){var t,n,r,i=e.ownerDocument,l=i.body,a=i&&i.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=a.clientLeft||l.clientLeft||0,top:r-=a.clientTop||l.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=rs(r),t.top+=is(r),t}function as(e){return null!=e&&e==e.window}function os(e){return as(e)?e.document:9===e.nodeType?e:e.ownerDocument}var ss=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),cs=/^(top|right|bottom|left)$/,ds="currentStyle",us="runtimeStyle",ps="left";function hs(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function ms(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function fs(e,t,n){"static"===ts(e,"position")&&(e.style.position="relative");var r=-999,i=-999,l=hs("left",n),a=hs("top",n),o=ms(l),s=ms(a);"left"!==l&&(r=999),"top"!==a&&(i=999);var c,d="",u=ls(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[Uo()]||"",Yo(e,"none")),"left"in t&&(e.style[o]="",e.style[l]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[a]="".concat(i,"px")),es(e);var p=ls(e),h={};for(var m in t)if(t.hasOwnProperty(m)){var f=hs(m,n),g="left"===m?r:i,v=u[m]-p[m];h[f]=f===m?g+v:g-v}ts(e,h),es(e),("left"in t||"top"in t)&&Yo(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=hs(b,n),E=t[b]-u[b];y[x]=b===x?h[x]+E:h[x]-E}ts(e,y)}function gs(e,t){var n=ls(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(Go());if(n&&"none"!==n){var r=n.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(r[12]||r[4],0),y:parseFloat(r[13]||r[5],0)}}return{x:0,y:0}}(e),i={x:r.x,y:r.y};"left"in t&&(i.x=r.x+t.left-n.left),"top"in t&&(i.y=r.y+t.top-n.top),function(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(Go());if(r&&"none"!==r){var i,l=r.match(Zo);l?((i=(l=l[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,i[5]=t.y,Xo(e,"matrix(".concat(i.join(","),")"))):((i=r.match(Jo)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,i[13]=t.y,Xo(e,"matrix3d(".concat(i.join(","),")")))}else Xo(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,i)}function vs(e,t){for(var n=0;n<e.length;n++)t(e[n])}function ys(e){return"border-box"===Qo(e,"boxSizing")}"undefined"!=typeof window&&(Qo=window.getComputedStyle?function(e,t,n){var r=n,i="",l=os(e);return(r=r||l.defaultView.getComputedStyle(e,null))&&(i=r.getPropertyValue(t)||r[t]),i}:function(e,t){var n=e[ds]&&e[ds][t];if(ss.test(n)&&!cs.test(t)){var r=e.style,i=r[ps],l=e[us][ps];e[us][ps]=e[ds][ps],r[ps]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[ps]=i,e[us][ps]=l}return""===n?"auto":n});var bs=["margin","border","padding"],xs=-1,Es=2,ws=1;function Cs(e,t,n){var r,i,l,a=0;for(i=0;i<t.length;i++)if(r=t[i])for(l=0;l<n.length;l++){var o=void 0;o="border"===r?"".concat(r).concat(n[l],"Width"):r+n[l],a+=parseFloat(Qo(e,o))||0}return a}var Ss={getParent:function(e){var t=e;do{t=11===t.nodeType&&t.host?t.host:t.parentNode}while(t&&1!==t.nodeType&&9!==t.nodeType);return t}};function Ns(e,t,n){var r=n;if(as(e))return"width"===t?Ss.viewportWidth(e):Ss.viewportHeight(e);if(9===e.nodeType)return"width"===t?Ss.docWidth(e):Ss.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],l="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=ys(e),o=0;(null==l||l<=0)&&(l=void 0,(null==(o=Qo(e,t))||Number(o)<0)&&(o=e.style[t]||0),o=Math.floor(parseFloat(o))||0),void 0===r&&(r=a?ws:xs);var s=void 0!==l||a,c=l||o;return r===xs?s?c-Cs(e,["border","padding"],i):o:s?r===ws?c:c+(r===Es?-Cs(e,["border"],i):Cs(e,["margin"],i)):o+Cs(e,bs.slice(r),i)}vs(["Width","Height"],(function(e){Ss["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],Ss["viewport".concat(e)](n))},Ss["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,i=r.body,l=r.documentElement[n];return"CSS1Compat"===r.compatMode&&l||i&&i[n]||l}}));var Ts={position:"absolute",visibility:"hidden",display:"block"};function Is(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=t[0];return 0!==i.offsetWidth?r=Ns.apply(void 0,t):function(e,t,n){var r,i={},l=e.style;for(r in t)t.hasOwnProperty(r)&&(i[r]=l[r],l[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(l[r]=i[r])}(i,Ts,(function(){r=Ns.apply(void 0,t)})),r}function Rs(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}vs(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);Ss["outer".concat(t)]=function(t,n){return t&&Is(t,e,n?0:ws)};var n="width"===e?["Left","Right"]:["Top","Bottom"];Ss[e]=function(t,r){var i=r;return void 0!==i?t?(ys(t)&&(i+=Cs(t,["padding","border"],n)),ts(t,e,i)):void 0:t&&Is(t,e,xs)}}));var Os={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:os,offset:function(e,t,n){if(void 0===t)return ls(e);!function(e,t,n){if(n.ignoreShake){var r=ls(e),i=r.left.toFixed(0),l=r.top.toFixed(0),a=t.left.toFixed(0),o=t.top.toFixed(0);if(i===a&&l===o)return}n.useCssRight||n.useCssBottom?fs(e,t,n):n.useCssTransform&&Go()in document.body.style?gs(e,t):fs(e,t,n)}(e,t,n||{})},isWindow:as,each:vs,css:ts,clone:function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);if(e.overflow)for(t in e)e.hasOwnProperty(t)&&(n.overflow[t]=e.overflow[t]);return n},mix:Rs,getWindowScrollLeft:function(e){return rs(e)},getWindowScrollTop:function(e){return is(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Os.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Rs(Os,Ss);var ks=Os.getParent;function Ls(e){if(Os.isWindow(e)||9===e.nodeType)return null;var t,n=Os.getDocument(e).body,r=Os.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:ks(e);for(t=ks(e);t&&t!==n&&9!==t.nodeType;t=ks(t))if("static"!==(r=Os.css(t,"position")))return t;return null}var As=Os.getParent;function Ps(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Ls(e),i=Os.getDocument(e),l=i.defaultView||i.parentWindow,a=i.body,o=i.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===a||r===o||"visible"===Os.css(r,"overflow")){if(r===a||r===o)break}else{var s=Os.offset(r);s.left+=r.clientLeft,s.top+=r.clientTop,n.top=Math.max(n.top,s.top),n.right=Math.min(n.right,s.left+r.clientWidth),n.bottom=Math.min(n.bottom,s.top+r.clientHeight),n.left=Math.max(n.left,s.left)}r=Ls(r)}var c=null;Os.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Os.css(e,"position")&&(e.style.position="fixed"));var d=Os.getWindowScrollLeft(l),u=Os.getWindowScrollTop(l),p=Os.viewportWidth(l),h=Os.viewportHeight(l),m=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(a);if("hidden"===g.overflowX&&(m=l.innerWidth),"hidden"===g.overflowY&&(f=l.innerHeight),e.style&&(e.style.position=c),t||function(e){if(Os.isWindow(e)||9===e.nodeType)return!1;var t=Os.getDocument(e),n=t.body,r=null;for(r=As(e);r&&r!==n&&r!==t;r=As(r))if("fixed"===Os.css(r,"position"))return!0;return!1}(e))n.left=Math.max(n.left,d),n.top=Math.max(n.top,u),n.right=Math.min(n.right,d+p),n.bottom=Math.min(n.bottom,u+h);else{var v=Math.max(m,d+p);n.right=Math.min(n.right,v);var y=Math.max(f,u+h);n.bottom=Math.min(n.bottom,y)}return n.top>=0&&n.left>=0&&n.bottom>n.top&&n.right>n.left?n:null}function _s(e){var t,n,r;if(Os.isWindow(e)||9===e.nodeType){var i=Os.getWindow(e);t={left:Os.getWindowScrollLeft(i),top:Os.getWindowScrollTop(i)},n=Os.viewportWidth(i),r=Os.viewportHeight(i)}else t=Os.offset(e),n=Os.outerWidth(e),r=Os.outerHeight(e);return t.width=n,t.height=r,t}function Ds(e,t){var n=t.charAt(0),r=t.charAt(1),i=e.width,l=e.height,a=e.left,o=e.top;return"c"===n?o+=l/2:"b"===n&&(o+=l),"c"===r?a+=i/2:"r"===r&&(a+=i),{left:a,top:o}}function Hs(e,t,n,r,i){var l=Ds(t,n[1]),a=Ds(e,n[0]),o=[a.left-l.left,a.top-l.top];return{left:Math.round(e.left-o[0]+r[0]-i[0]),top:Math.round(e.top-o[1]+r[1]-i[1])}}function Ms(e,t,n){return e.left<n.left||e.left+t.width>n.right}function Fs(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function $s(e,t,n){var r=[];return Os.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function qs(e,t){return e[t]=-e[t],e}function js(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function Ks(e,t){e[0]=js(e[0],t.width),e[1]=js(e[1],t.height)}function zs(e,t,n,r){var i=n.points,l=n.offset||[0,0],a=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;l=[].concat(l),a=[].concat(a);var c={},d=0,u=Ps(s,!(!(o=o||{})||!o.alwaysByViewport)),p=_s(s);Ks(l,p),Ks(a,t);var h=Hs(p,t,i,l,a),m=Os.merge(p,h);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&Ms(h,p,u)){var f=$s(i,/[lr]/gi,{l:"r",r:"l"}),g=qs(l,0),v=qs(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Hs(p,t,f,g,v),p,u)||(d=1,i=f,l=g,a=v)}if(o.adjustY&&Fs(h,p,u)){var y=$s(i,/[tb]/gi,{t:"b",b:"t"}),b=qs(l,1),x=qs(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Hs(p,t,y,b,x),p,u)||(d=1,i=y,l=b,a=x)}d&&(h=Hs(p,t,i,l,a),Os.mix(m,h));var E=Ms(h,p,u),w=Fs(h,p,u);if(E||w){var C=i;E&&(C=$s(i,/[lr]/gi,{l:"r",r:"l"})),w&&(C=$s(i,/[tb]/gi,{t:"b",b:"t"})),i=C,l=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&w,(c.adjustX||c.adjustY)&&(m=function(e,t,n,r){var i=Os.clone(e),l={width:t.width,height:t.height};return r.adjustX&&i.left<n.left&&(i.left=n.left),r.resizeWidth&&i.left>=n.left&&i.left+l.width>n.right&&(l.width-=i.left+l.width-n.right),r.adjustX&&i.left+l.width>n.right&&(i.left=Math.max(n.right-l.width,n.left)),r.adjustY&&i.top<n.top&&(i.top=n.top),r.resizeHeight&&i.top>=n.top&&i.top+l.height>n.bottom&&(l.height-=i.top+l.height-n.bottom),r.adjustY&&i.top+l.height>n.bottom&&(i.top=Math.max(n.bottom-l.height,n.top)),Os.mix(i,l)}(h,p,u,c))}return m.width!==p.width&&Os.css(s,"width",Os.width(s)+m.width-p.width),m.height!==p.height&&Os.css(s,"height",Os.height(s)+m.height-p.height),Os.offset(s,{left:m.left,top:m.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:i,offset:l,targetOffset:a,overflow:c}}function Vs(e,t,n){var r=n.target||t,i=_s(r),l=!function(e,t){var n=Ps(e,t),r=_s(e);return!n||r.left+r.width<=n.left||r.top+r.height<=n.top||r.left>=n.right||r.top>=n.bottom}(r,n.overflow&&n.overflow.alwaysByViewport);return zs(e,i,n,l)}Vs.__getOffsetParent=Ls,Vs.__getVisibleRectForElement=Ps;var Ws=Yr()?e.useLayoutEffect:e.useEffect,Bs=function(t,n){var r=e.useRef(!0);Ws((function(){return t(r.current)}),n),Ws((function(){return r.current=!1,function(){r.current=!0}}),[])};function Us(e,t){var n=null,r=null;var i=new $t((function(e){var i=yr(e,1)[0].target;if(document.documentElement.contains(i)){var l=i.getBoundingClientRect(),a=l.width,o=l.height,s=Math.floor(a),c=Math.floor(o);n===s&&r===c||Promise.resolve().then((function(){t({width:s,height:c})})),n=s,r=c}}));return e&&i.observe(e),function(){i.disconnect()}}function Gs(e){return"function"!=typeof e?null:e()}function Ys(e){return"object"===pr(e)&&e?e:null}var Xs=function(e,n){var r=e.children,i=e.disabled,l=e.target,a=e.align,o=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),p=t.useRef(),h=t.Children.only(r),m=t.useRef({});m.current.disabled=i,m.current.target=l,m.current.align=a,m.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),i=t.useRef(null);function l(){window.clearTimeout(i.current)}return[function t(a){if(l(),r.current&&!0!==a)i.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(a))return;r.current=!0,i.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,l()}]}((function(){var e=m.current,t=e.disabled,n=e.target,r=e.align,i=e.onAlign,l=p.current;if(!t&&n&&l){var a,o=Gs(n),s=Ys(n);u.current.element=o,u.current.point=s,u.current.align=r;var c=document.activeElement;return o&&function(e){if(!e)return!1;if(e instanceof Element){if(e.offsetParent)return!0;if(e.getBBox){var t=e.getBBox(),n=t.width,r=t.height;if(n||r)return!0}if(e.getBoundingClientRect){var i=e.getBoundingClientRect(),l=i.width,a=i.height;if(l||a)return!0}}return!1}(o)?a=Vs(l,o,r):s&&(a=function(e,t,n){var r,i,l=Os.getDocument(e),a=l.defaultView||l.parentWindow,o=Os.getWindowScrollLeft(a),s=Os.getWindowScrollTop(a),c=Os.viewportWidth(a),d=Os.viewportHeight(a),u={left:r="pageX"in t?t.pageX:o+t.clientX,top:i="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},p=r>=0&&r<=o+c&&i>=0&&i<=s+d,h=[n.points[0],"cc"];return zs(e,u,Ko(Ko({},n),{},{points:h}),p)}(l,s,r)),function(e,t){e!==document.activeElement&&_o(t,e)&&"function"==typeof e.focus&&e.focus()}(c,l),i&&a&&i(l,a),!0}return!1}),d),g=yr(f,2),v=g[0],y=g[1],b=yr(t.useState(),2),x=b[0],E=b[1],w=yr(t.useState(),2),C=w[0],S=w[1];return Bs((function(){E(Gs(l)),S(Ys(l))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=C)||e&&t&&("pageX"in t&&"pageY"in t?e.pageX===t.pageX&&e.pageY===t.pageY:"clientX"in t&&"clientY"in t&&e.clientX===t.clientX&&e.clientY===t.clientY))&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new Set;return function e(t,i){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=r.has(t);if(En(!a,"Warning: There may be circular references"),a)return!1;if(t===i)return!0;if(n&&l>1)return!1;r.add(t);var o=l+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(var s=0;s<t.length;s++)if(!e(t[s],i[s],o))return!1;return!0}if(t&&i&&"object"===pr(t)&&"object"===pr(i)){var c=Object.keys(t);return c.length===Object.keys(i).length&&c.every((function(n){return e(t[n],i[n],o)}))}return!1}(e,t)}(u.current.align,a)||v()})),t.useEffect((function(){return Us(p.current,v)}),[p.current]),t.useEffect((function(){return Us(x,v)}),[x]),t.useEffect((function(){i?y():v()}),[i]),t.useEffect((function(){if(s)return Do(window,"resize",v).remove}),[s]),t.useEffect((function(){return function(){y()}}),[]),t.useImperativeHandle(n,(function(){return{forceAlign:function(){return v(!0)}}})),t.isValidElement(h)&&(h=t.cloneElement(h,{ref:Nr(h.ref,p)})),h},Qs=t.forwardRef(Xs);function Zs(){Zs=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},l=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var l=t&&t.prototype instanceof p?t:p,a=Object.create(l.prototype),o=new N(i||[]);return r(a,"_invoke",{value:E(e,n,o)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function p(){}function h(){}function m(){}var f={};s(f,l,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,l)&&(f=v);var y=m.prototype=p.prototype=Object.create(f);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function i(r,l,a,o){var s=d(e[r],e,l);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==pr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,a,o)}),(function(e){i("throw",e,a,o)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,o)}))}o(s.arg)}var l;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return l=l?l.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,l){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw l;return I()}for(n.method=i,n.arg=l;;){var a=n.delegate;if(a){var o=w(a,n);if(o){if(o===u)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,u;var l=i.arg;return l?l.done?(t[e.resultName]=l.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):l:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function T(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return h.prototype=m,r(y,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:h,configurable:!0}),h.displayName=s(m,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,l){void 0===l&&(l=Promise);var a=new x(c(t,n,r,i),l);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),s(y,o,"Generator"),s(y,l,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var l=this.tryEntries[i],a=l.completion;if("root"===l.tryLoc)return r("end");if(l.tryLoc<=this.prev){var o=n.call(l,"catchLoc"),s=n.call(l,"finallyLoc");if(o&&s){if(this.prev<l.catchLoc)return r(l.catchLoc,!0);if(this.prev<l.finallyLoc)return r(l.finallyLoc)}else if(o){if(this.prev<l.catchLoc)return r(l.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return r(l.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var l=i;break}}l&&("break"===e||"continue"===e)&&l.tryLoc<=t&&t<=l.finallyLoc&&(l=null);var a=l?l.completion:{};return a.type=e,a.arg=t,l?(this.method="next",this.next=l.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function Js(e,t,n,r,i,l,a){try{var o=e[l](a),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,i)}function ec(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var l=e.apply(t,n);function a(e){Js(l,r,i,a,o,"next",e)}function o(e){Js(l,r,i,a,o,"throw",e)}a(void 0)}))}}Qs.displayName="Align";var tc=["measure","alignPre","align",null,"motion"],nc=e.forwardRef((function(t,n){var r=t.visible,i=t.prefixCls,a=t.className,s=t.style,c=t.children,d=t.zIndex,p=t.stretch,h=t.destroyPopupOnHide,m=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,w=t.onMouseDown,C=t.onTouchStart,S=t.onClick,N=l(),T=l(),I=yr(u(),2),R=I[0],O=I[1],k=function(t){var n=yr(e.useState({width:0,height:0}),2),r=n[0],i=n[1];return[e.useMemo((function(){var e={};if(t){var n=r.width,i=r.height;-1!==t.indexOf("height")&&i?e.height=i:-1!==t.indexOf("minHeight")&&i&&(e.minHeight=i),-1!==t.indexOf("width")&&n?e.width=n:-1!==t.indexOf("minWidth")&&n&&(e.minWidth=n)}return e}),[t,r]),function(e){var t=e.offsetWidth,n=e.offsetHeight,r=e.getBoundingClientRect(),l=r.width,a=r.height;Math.abs(t-l)<1&&Math.abs(n-a)<1&&(t=l,n=a),i({width:t,height:n})}]}(p),L=yr(k,2),A=L[0],P=L[1];var _=function(e,t){var n=yr(Fr(null),2),r=n[0],i=n[1],a=l();function s(e){i(e,!0)}function c(){yi.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=yi(ec(Zs().mark((function e(){var t,n;return Zs().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=tc.indexOf(r),(n=tc[t+1])&&-1!==t&&s(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),o((function(){return function(){c()}}),[]),[r,function(e){c(),a.current=yi((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){p&&P(v())})),D=yr(_,2),H=D[0],M=D[1],F=yr(u(0),2),$=F[0],q=F[1],j=l();function K(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function z(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===H&&(null==b||b(e,t))}Bs((function(){"alignPre"===H&&q(0)}),[H]),Bs((function(){"align"===H&&($<3?K():M((function(){var e;null===(e=j.current)||void 0===e||e.call(j)})))}),[$]);var V=gr({},$o(t));function W(){return new Promise((function(e){j.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=V[e];V[e]=function(e,n){return M(),null==t?void 0:t(e,n)}})),e.useEffect((function(){V.motionName||"motion"!==H||M()}),[V.motionName,H]),e.useImperativeHandle(n,(function(){return{forceAlign:K,getElement:function(){return T.current}}}));var B=gr(gr({},A),{},{zIndex:d,opacity:"motion"!==H&&"stable"!==H&&r?0:void 0,pointerEvents:r||"stable"===H?void 0:"none"},s),U=!0;null==f||!f.points||"align"!==H&&"stable"!==H||(U=!1);var G=c;return e.Children.count(c)>1&&(G=e.createElement("div",{className:"".concat(i,"-content")},c)),e.createElement(Ni,Ti({visible:r,ref:T,leavedClassName:"".concat(i,"-hidden")},V,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:h,forceRender:m}),(function(t,n){var r=t.className,l=t.style,o=_e(i,a,R,r);return e.createElement(Qs,{target:g||v,key:"popup",ref:N,monitorWindowResize:!0,disabled:U,align:f,onAlign:z},e.createElement("div",{ref:n,className:o,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:w,onTouchStartCapture:C,onClick:S,style:gr(gr({},l),B)},G))}))}));nc.displayName="PopupInner";var rc=e.forwardRef((function(t,n){var r=t.prefixCls,i=t.visible,l=t.zIndex,a=t.children,o=t.mobile,s=(o=void 0===o?{}:o).popupClassName,c=o.popupStyle,d=o.popupMotion,u=void 0===d?{}:d,p=o.popupRender,h=t.onClick,m=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return m.current}}}));var f=gr({zIndex:l},c),g=a;return e.Children.count(a)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},a)),p&&(g=p(g)),e.createElement(Ni,Ti({visible:i,ref:m,removeOnLeave:!0},u),(function(t,n){var i=t.className,l=t.style,a=_e(r,s,i);return e.createElement("div",{ref:n,className:a,onClick:h,style:gr(gr({},l),f)},g)}))}));rc.displayName="MobilePopupInner";var ic=["visible","mobile"],lc=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,l=Ir(t,ic),a=yr(u(r),2),s=a[0],c=a[1],d=yr(u(!1),2),p=d[0],h=d[1],m=gr(gr({},l),{},{visible:s});o((function(){c(r),r&&i&&h(function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(null==e?void 0:e.substr(0,4))}())}),[r,i]);var f=p?e.createElement(rc,Ti({},m,{mobile:i,ref:n})):e.createElement(nc,Ti({},m,{ref:n}));return e.createElement("div",null,e.createElement(qo,m),f)}));lc.displayName="Popup";var ac=e.createContext(null);function oc(){}function sc(){return""}function cc(e){return e?e.ownerDocument:window.document}var dc=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var uc=function(t){var n=function(n){Pr(i,e.Component);var r=Hr(i);function i(t){var n,l;return Or(this,i),mr(Dr(n=r.call(this,t)),"popupRef",e.createRef()),mr(Dr(n),"triggerRef",e.createRef()),mr(Dr(n),"portalContainer",void 0),mr(Dr(n),"attachId",void 0),mr(Dr(n),"clickOutsideHandler",void 0),mr(Dr(n),"touchOutsideHandler",void 0),mr(Dr(n),"contextMenuOutsideHandler1",void 0),mr(Dr(n),"contextMenuOutsideHandler2",void 0),mr(Dr(n),"mouseDownTimeout",void 0),mr(Dr(n),"focusTime",void 0),mr(Dr(n),"preClickTime",void 0),mr(Dr(n),"preTouchTime",void 0),mr(Dr(n),"delayTimer",void 0),mr(Dr(n),"hasPopupMouseDown",void 0),mr(Dr(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),mr(Dr(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),mr(Dr(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),mr(Dr(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),mr(Dr(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&_o(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),mr(Dr(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),mr(Dr(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),mr(Dr(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),mr(Dr(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),mr(Dr(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),mr(Dr(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),mr(Dr(n),"onClick",(function(e){if(n.fireEvents("onClick",e),n.focusTime){var t;if(n.preClickTime&&n.preTouchTime?t=Math.min(n.preClickTime,n.preTouchTime):n.preClickTime?t=n.preClickTime:n.preTouchTime&&(t=n.preTouchTime),Math.abs(t-n.focusTime)<20)return;n.focusTime=0}n.preClickTime=0,n.preTouchTime=0,n.isClickToShow()&&(n.isClickToHide()||n.isBlurToHide())&&e&&e.preventDefault&&e.preventDefault();var r=!n.state.popupVisible;(n.isClickToHide()&&!r||r&&n.isClickToShow())&&n.setPopupVisible(!n.state.popupVisible,e)})),mr(Dr(n),"onPopupMouseDown",(function(){var e;(n.hasPopupMouseDown=!0,clearTimeout(n.mouseDownTimeout),n.mouseDownTimeout=window.setTimeout((function(){n.hasPopupMouseDown=!1}),0),n.context)&&(e=n.context).onPopupMouseDown.apply(e,arguments)})),mr(Dr(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),i=n.getPopupDomNode();_o(r,t)&&!n.isContextMenuOnly()||_o(i,t)||n.hasPopupMouseDown||n.close()}})),mr(Dr(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=xr(n.triggerRef.current);if(t)return t}catch(e){}return Jt.findDOMNode(Dr(n))})),mr(Dr(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,i=r.popupPlacement,l=r.builtinPlacements,a=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return i&&l&&t.push(function(e,t,n,r){for(var i=n.points,l=Object.keys(e),a=0;a<l.length;a+=1){var o=l[a];if(Mo(e[o].points,i,r))return"".concat(t,"-placement-").concat(o)}return""}(l,a,e,o)),s&&t.push(s(e)),t.join(" ")})),mr(Dr(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,i=t.destroyPopupOnHide,l=t.popupClassName,a=t.onPopupAlign,o=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,p=t.maskAnimation,h=t.maskTransitionName,m=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,w=n.state,C=w.popupVisible,S=w.point,N=n.getPopupAlign(),T={};return n.isMouseEnterToShow()&&(T.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(T.onMouseLeave=n.onPopupMouseLeave),T.onMouseDown=n.onPopupMouseDown,T.onTouchStart=n.onPopupMouseDown,e.createElement(lc,Ti({prefixCls:r,destroyPopupOnHide:i,visible:C,point:y&&S,className:l,align:N,onAlign:a,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},T,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:p,maskTransitionName:h,maskMotion:m,ref:n.popupRef,motion:o,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),mr(Dr(n),"attachParent",(function(e){yi.cancel(n.attachId);var t,r=n.props,i=r.getPopupContainer,l=r.getDocument,a=n.getRootDomNode();i?(a||0===i.length)&&(t=i(a)):t=l(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=yi((function(){n.attachParent(e)}))})),mr(Dr(n),"getContainer",(function(){if(!n.portalContainer){var e=(0,n.props.getDocument)(n.getRootDomNode()).createElement("div");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",n.portalContainer=e}return n.attachParent(n.portalContainer),n.portalContainer})),mr(Dr(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),mr(Dr(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),mr(Dr(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),l="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:l,popupVisible:l},dc.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return Lr(i,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var e,t=this.props;if(this.state.popupVisible)return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(e=t.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Do(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Do(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Do(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Do(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),yi.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var e;return(null===(e=this.popupRef.current)||void 0===e?void 0:e.getElement())||null}},{key:"getPopupAlign",value:function(){var e=this.props,t=e.popupPlacement,n=e.popupAlign,r=e.builtinPlacements;return t&&r?function(e,t,n){return gr(gr({},e[t]||{}),n)}(r,t,n):n}},{key:"setPopupVisible",value:function(e,t){var n=this.props.alignPoint,r=this.state.popupVisible;this.clearDelayTimer(),r!==e&&("popupVisible"in this.props||this.setState({popupVisible:e,prevPopupVisible:r}),this.props.onPopupVisibleChange(e)),n&&t&&e&&this.setPoint(t)}},{key:"delaySetPopupVisible",value:function(e,t,n){var r=this,i=1e3*t;if(this.clearDelayTimer(),i){var l=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,l),r.clearDelayTimer()}),i)}else this.setPopupVisible(e,n)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(e){var t=this.props.children.props,n=this.props;return t[e]&&n[e]?this["fire".concat(e)]:t[e]||n[e]}},{key:"isClickToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isContextMenuOnly",value:function(){var e=this.props.action;return"contextMenu"===e||1===e.length&&"contextMenu"===e[0]}},{key:"isContextMenuToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("contextMenu")||-1!==n.indexOf("contextMenu")}},{key:"isClickToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isMouseEnterToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseEnter")}},{key:"isMouseLeaveToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseLeave")}},{key:"isFocusToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("focus")}},{key:"isBlurToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("blur")}},{key:"forcePopupAlign",value:function(){var e;this.state.popupVisible&&(null===(e=this.popupRef.current)||void 0===e||e.forceAlign())}},{key:"fireEvents",value:function(e,t){var n=this.props.children.props[e];n&&n(t);var r=this.props[e];r&&r(t)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var n=this.state.popupVisible,r=this.props,i=r.children,l=r.forceRender,a=r.alignPoint,o=r.className,s=r.autoDestroy,c=e.Children.only(i),d={key:"trigger"};this.isContextMenuToShow()?d.onContextMenu=this.onContextMenu:d.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(d.onClick=this.onClick,d.onMouseDown=this.onMouseDown,d.onTouchStart=this.onTouchStart):(d.onClick=this.createTwoChains("onClick"),d.onMouseDown=this.createTwoChains("onMouseDown"),d.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(d.onMouseEnter=this.onMouseEnter,a&&(d.onMouseMove=this.onMouseMove)):d.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?d.onMouseLeave=this.onMouseLeave:d.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(d.onFocus=this.onFocus,d.onBlur=this.onBlur):(d.onFocus=this.createTwoChains("onFocus"),d.onBlur=this.createTwoChains("onBlur"));var u=_e(c&&c.props&&c.props.className,o);u&&(d.className=u);var p=gr({},d);Tr(c)&&(p.ref=Nr(this.triggerRef,c.ref));var h,m=e.cloneElement(c,p);return(n||this.popupRef.current||l)&&(h=e.createElement(t,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!n&&s&&(h=null),e.createElement(ac.Provider,{value:this.triggerContextValue},m,h)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.popupVisible,r={};return void 0!==n&&t.popupVisible!==n&&(r.popupVisible=n,r.prevPopupVisible=t.popupVisible),r}}]),i}();return mr(n,"contextType",ac),mr(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:sc,getDocument:cc,onPopupVisibleChange:oc,afterPopupVisibleChange:oc,onPopupAlign:oc,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1}),n}(Ho);let pc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||nr("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||nr("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ye([...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:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||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:i}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:a=(e=>e),dataKey:o,callback:s,fieldAliasMap:c}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},d="function"==typeof c?c():c||{},{value:u}=this.props;if(i){if(Yn(u))return this.setRecords([]);this.setState({loading:!0});try{const e=yield i(a(Object.assign(Object.assign({},l),{keys:u})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];i.forEach((e=>{(null==d?void 0:d.valueKey)&&d.valueKey!==r&&(e[r]=e[d.valueKey]),(null==d?void 0:d.textKey)&&d.textKey!==n&&(e[n]=e[d.textKey])})),i=i.filter((e=>u.includes(e[r])));const l=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(l),this.setViewValue(u),null==s||s(i)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:i}=this.context,{visible:l,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=pn("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:l,title:pn("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ve({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},pn("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=ar("form-multiple-search-helper"),{size:R}=i.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return i.isOnlyShow?t.createElement(mo,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(uc,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ha,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(H,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},h),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Ge,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Ll,w,t.createElement(Gp,C)))}};pc.contextType=Al,pc=Hn([Po],pc);class hc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(pc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}hc.contextType=Al;const{Search:mc}=O;class fc extends s{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:n,echoRequest:r}=this.searchHelper;if(t||nr("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)||nr("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&nr("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>Mn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Yn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Ba(e,this.alias,c),d&&Ua(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Wa(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==l||l([e])}}}catch(e){}this.setState({loading:!1})}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const i=Wa(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])})},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),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]:Wa(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])});const r=Wa(e,this.alias[n]);this.triggerChange(r);const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(e)),200)}))},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("")},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||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(){var e;const{$$form:n}=this.context,{visible:r,loading:i}=this.state,{value:l=""}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=pn("qm.form.selectPlaceholder"),bordered:p=!0,allowClear:h=!0,readOnly:m,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:pn("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:ve({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(mo,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(mc,{ref:e=>this[`${a}_Ref`]=e,value:l,title:l,loading:i,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:p,allowClear:h,readOnly:m,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"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t.createElement(Ll,b,t.createElement(Zp,x)))}}fc.contextType=Al;class gc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(fc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}gc.contextType=Al;let vc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||nr("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||nr("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setItemList=e=>{this.setState({itemList:e})},this.setRecords=e=>{this._records=e},this.recordsToDict=()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))),this.setViewValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;t.setViewValue(n,this.createViewText(e))},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.closeSearchHelper=(e,t=[])=>{const{valueKey:n}=this.alias;this.setRecords(ye([...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:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props,{valueKey:r}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[r])))),null==t||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:i}=this.props;he(n,r)||he(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:i,params:l={},formatter:a=(e=>e),dataKey:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(i){if(Yn(d))return this.setRecords([]);this.setState({loading:!0});try{const e=yield i(a(Object.assign(Object.assign({},l),{keys:d})));if(200===e.code){let i=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,o))&&void 0!==t?t:[];i.forEach((e=>{(null==c?void 0:c.valueKey)&&c.valueKey!==r&&(e[r]=e[c.valueKey]),(null==c?void 0:c.textKey)&&c.textKey!==n&&(e[n]=e[c.textKey])})),i=i.filter((e=>d.includes(e[r])));const l=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(l),this.setViewValue(d)}}catch(e){}this.setState({loading:!1})}}))}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){var e,n,r;const{$$form:i}=this.context,{visible:l,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=pn("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,w={visible:l,title:pn("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},C=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ve({},p.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),S=s.filter((e=>null==c?void 0:c.includes(e.value))),N=t.createElement("ul",{className:"ant-dropdown-menu"},S.length?S.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},pn("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=ar("form-multiple-tree-table-helper"),{size:R}=i.context,O={[I]:!0,[`${I}--lg`]:"large"===R,[`${I}--sm`]:"small"===R};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${I}`]);const k=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return i.isOnlyShow?t.createElement(mo,{value:k,bordered:f}):t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t.createElement(uc,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ha,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(H,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:m,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},h),title:k,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{var t,n;const r=e.target;r.classList.contains("ant-select-selection-overflow-item-rest")&&(null===(n=(t=this.props).setCurrentElement)||void 0===n||n.call(t,r),this.setState({visible2:!0}))},onDoubleClick:()=>{y||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},s.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Ge,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Ll,w,t.createElement(Zp,C)))}};vc.contextType=Al,vc=Hn([Po],vc);class yc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(vc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}yc.contextType=Al;const bc=new Array(2).fill("");class xc extends s{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:bc},this.getSearchHelper=Vt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||nr("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||nr("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),this.getDerivedSearchHelper=()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper),this.setItemList=e=>{this.setState({itemList:e})},this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.setTextValue=e=>{this.setState({textValue:e})},this.setRecords=e=>{this._records=e},this.setViewValue=()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;this._is_change=!1,null==t||t(e),n(e,this.createViewText(),this._records)},this.clearSearchHelperValue=()=>{this.setRecords([]),this.setTextValue(bc),this.triggerChange([])},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=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.triggerChange(e.map((e=>e[t])));const{closed:i}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==i?void 0:i(this._records)),200)}))},this.openSearchHelper=e=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Wn)(t.state.formData);(null==r?void 0:r.then)?r.then((()=>{this.setVisible(!0),null==e||e()})).catch((()=>{})):!1!==r&&(this.setVisible(!0),null==e||e())})),this.createFilters=e=>{const{fieldName:t}=this.props.option;return{[t]:Yn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Wn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>Mn(this,void 0,void 0,(function*(){var o;const s=ve({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),i(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return a();this.setState({loading:!0});const e=yield t.fetch.api(s);if(Un((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=ue(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return l(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>Mn(this,void 0,void 0,(function*(){const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{var r;const i=null===(r=e[n])||void 0===r?void 0:r.toString().toLowerCase();return t.some((e=>null==i?void 0:i.includes(e.toLowerCase())))}));if(2===r.length)return this.closeSearchHelper(r);this.openSearchHelper()})),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;he(t,n)||he(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:i}=this.props.option;if(!he(r[i],this._ceho_data)&&(this._ceho_data=r[i],this.setItemList(r[i]),n.length)){const e=bc.map(((e,t)=>{var l,a;return null!==(a=null===(l=r[i].find((e=>e.value===n[t])))||void 0===l?void 0:l.text)&&void 0!==a?a:""}));this.setTextValue(e)}}getItemList(){var e;return Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:t,valueKey:n}=this.alias,{fetchApi:r,params:i={},formatter:l=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(Yn(c))return this.setRecords([]);this.setState({loading:!0});try{const o=yield r(l(Object.assign(Object.assign({},i),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,a))&&void 0!==e?e:[];r.forEach((e=>{(null==s?void 0:s.valueKey)&&s.valueKey!==n&&(e[n]=e[s.valueKey]),(null==s?void 0:s.textKey)&&s.textKey!==t&&(e[t]=e[s.textKey])})),r=r.filter((e=>c.includes(e[n]))).slice(0,2);const i=r.map((e=>({value:e[n],text:e[t]})));this.setRecords(r),this.setItemList(i),this.setTextValue(i.map((e=>{var t;return null!==(t=e.text)&&void 0!==t?t:""}))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}))}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){var e;const{$$form:n}=this.context;this.props;const{visible:r,loading:i,textValue:l}=this.state,{fieldName:a,options:o={},searchHelper:s={},placeholder:c=pn("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=l.every((e=>Va(e)))?"":l.join(" - "),f={visible:r,title:pn("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Oo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:ve({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(mo,{value:m,bordered:d}):t.createElement(t.Fragment,null,t.createElement(O.Group,null,t.createElement(O,{value:l[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:p,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?l.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(l).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):l.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,l[1]]))}}),t.createElement(O,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:p,readOnly:!0}),t.createElement(O.Search,{value:l[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:i,bordered:d,allowClear:!0,readOnly:u,disabled:p,onBlur:e=>{var t,n;const{value:i}=e.target;this._is_change&&!r&&(i?l.every((e=>!!e))&&(null===(n=null===(t=this.searchHelper.table)||void 0===t?void 0:t.fetch)||void 0===n?void 0:n.api)&&this.getSearchHelperTableData(l).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):l.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([l[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t.createElement(Ll,f,t.createElement(nh,g)))}}xc.contextType=Al;class Ec extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(c),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(xc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{m(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(D,null,e.renderFormItemButton(a,u)),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Ec.contextType=Al;const wc=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,onChange:l,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:p=[]}=o,h=Yn(p)?i:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(mo,{value:m(r),bordered:c}):t.createElement(M.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==l||l(e),a(e,m(e))})(e)}},h.map((e=>t.createElement(M,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Cc extends s{constructor(){super(...arguments),this.state={itemList:[]}}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}getItemList(){var e;return Mn(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(wc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Cc.contextType=Al;const Sc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=a,m=e=>h?h[Math.ceil(e)-1]:e.toString();return t.createElement(q,{value:r,count:p,style:o,allowHalf:u,allowClear:s,tooltips:h,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==i||i(e),l(e,m(e))})(e)}})};class Nc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Sc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Nc.contextType=Al;const Tc=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,onChange:l,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:p=[]}=o,h=Yn(p)?i:p,m=e=>{var t,n;return null!==(n=null===(t=h.find((t=>t.value===e)))||void 0===t?void 0:t.text)&&void 0!==n?n:""};return n.isOnlyShow?t.createElement(mo,{value:m(r),bordered:c}):t.createElement(j.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u||n.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==l||l(e),a(e,m(e))})(t)}},h.map((e=>t.createElement(j,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ic extends s{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=n.map((e=>({value:e[l],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:p,rules:h=[],onChange:m=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(h)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Tc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Ic.contextType=Al;const Rc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=Pa,trueValue:h=Aa}=o,{t:m}=Fn();return t.createElement(t.Fragment,null,t.createElement(K,{checked:r===h,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement(qe,null),unCheckedChildren:t.createElement(Ye,null),onChange:e=>{(e=>{null==i||i(e),l(e,m(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class Oc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option,{labelToSwitch:m}=o;return t.createElement(P.Item,{label:m?" ":e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Rc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Oc.contextType=Al;const kc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{options:o={},style:s={},placeholder:c=a("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:p,disabled:h,onFocus:m,onBlur:f,onEnter:g}=e.option,{showCount:v,maxLength:y,autoSize:b}=o,x=Object.assign({},{minRows:1,maxRows:3},b);return t.createElement(O.TextArea,{value:r,placeholder:c,style:s,maxLength:y,showCount:v,autoSize:x,bordered:d,allowClear:u,readOnly:p||n.isOnlyShow,disabled:h,onFocus:e=>{null==m||m(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),null==f||f(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;null==g||g(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),l(e)})(t)}})};class Lc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(kc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Lc.contextType=Al;const Ac=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.datePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:m,disabled:f}=e.option,{dateType:g="date",format:v,disabledDate:y,minDateTime:b,maxDateTime:x,shortCuts:E=!0}=s,w=t.createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==i||i(e),l(e,S(e))},S=e=>Va(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=za(h().subtract(e,"day"),Fa[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return n.isOnlyShow?t.createElement(mo,{value:S(r),bordered:u}):t.createElement(Rn,{ref:w,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ma[g],format:v,bordered:u,showToday:!1,showTime:"datetime"===g&&{defaultValue:h("00:00:00","HH:mm:ss")},allowClear:p,disabled:f,inputReadOnly:m,disabledDate:null!=y?y: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,[b,x]),renderExtraFooter:E&&g.includes("date")?()=>"function"==typeof E?E():t.createElement(t.Fragment,null,t.createElement(z,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(z,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(z,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(z,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:Ka(r,Fa[g]),onChange:(e,t)=>{C(za(e,Fa[g]))}})};class Pc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ac,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Pc.contextType=Al;const _c=e=>[h().subtract(e,"day"),h()],Dc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:m,disabled:f=n.isFormDisabled}=e.option,{dateType:g="date",format:v,disableds:y=[!1,!1],allowEmpty:b,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:C=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:_c(7),[a("qm.form.dateRangePickers")[1]]:_c(30),[a("qm.form.dateRangePickers")[2]]:_c(90),[a("qm.form.dateRangePickers")[3]]:_c(180)},N=e=>Va(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(mo,{value:N(r),bordered:u}):t.createElement(Rn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ma[g],format:v,bordered:u,showTime:"datetime"===g&&{defaultValue:[h("00:00:00","HH:mm:ss"),h("23:59:59","HH:mm:ss")]},allowClear:p,allowEmpty:b,disabled:f?[!0,!0]:y,inputReadOnly:m,disabledDate:null!=x?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:Yn(r)?null:[Ka(null==r?void 0:r[0],Fa[g]),Ka(null==r?void 0:r[1],Fa[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=[]),null==i||i(e),l(e,N(e))})([za(null==e?void 0:e[0],Fa[g]),za(null==e?void 0:e[1],Fa[g])])}})};class Hc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Dc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Hc.contextType=Al;const Mc=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:v=1,secondStep:y=1}=s;return n.isOnlyShow?t.createElement(mo,{value:r,bordered:u}):t.createElement(kn,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:v,secondStep:y,allowClear:p,disabled:m,inputReadOnly:h,format:$a[f],value:Ka(r,$a[f]),onChange:(e,t)=>{(e=>{const t=za(e,$a[f]);null==i||i(t),l(t)})(e)}})};class Fc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Mc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Fc.contextType=Al;const $c=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m=n.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],allowEmpty:v,hourStep:y=1,minuteStep:b=1,secondStep:x=1}=s,E=e=>Va(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(mo,{value:E(r),bordered:u}):t.createElement(kn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:y,minuteStep:b,secondStep:x,allowClear:p,allowEmpty:v,disabled:m?[!0,!0]:g,inputReadOnly:h,format:$a[f],value:Yn(r)?null:[Ka(null==r?void 0:r[0],$a[f]),Ka(null==r?void 0:r[1],$a[f])],onChange:(e,t)=>{(e=>{const t=[za(null==e?void 0:e[0],$a[f]),za(null==e?void 0:e[1],$a[f])];null==i||i(t),l(t,E(t))})(e)}})};class qc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement($c,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}qc.contextType=Al;class jc extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._clicking=!1,this._prevValue=null,this.state={itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0},this.getSearchHelper=Vt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.paramsChangeHandler=(e,t)=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting(),he(e,t)||this.getItemList()})),this.echoSearchHelper=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.initialHandle=()=>Mn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:i,echoRequest:l}=this.searchHelper;if(r||nr("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),i){const e=["valueKey","displayKey","extraKey"];for(const t in i)e.includes(t)&&(this[t]=i[t])}Object.keys(this.alias).includes(e)||nr("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),l&&!this.valueKey&&nr("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&nr("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getItemText=()=>Mn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:i,callback:l,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Yn(u))try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=ue(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Ba(e,this.alias,c),d&&Ua(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Wa(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==l||l([e])}}}catch(e){}})),this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;this._record=e;for(const r in this.alias){const i=Wa(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:i}),r===n&&t.setViewValue(n,i)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Wa(e,this.extras[n])})},this.fetchHandle=be(this.getItemList,200),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this._record)},this.triggerBlur=e=>{const{onBlur:t}=this.props;null==t||t(e)},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]:Wa(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:Wa(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=Wa(e,this.alias[r]);this.triggerChange(i),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){var t,n,r,i,l,a;const o=(null===(n=null===(t=e.option.searchHelper)||void 0===t?void 0:t.request)||void 0===n?void 0:n.params)||(null===(r=e.option.request)||void 0===r?void 0:r.params),s=(null===(l=null===(i=this.props.option.searchHelper)||void 0===i?void 0:i.request)||void 0===l?void 0:l.params)||(null===(a=this.props.option.request)||void 0===a?void 0:a.params);this.paramsChangeHandler(s,o),this.echoSearchHelper()}getItemList(e){var t;return Mn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:i={},formatter:l=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(l(Object.assign(Object.assign({},i),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=ue(o.data,a))&&void 0!==t?t:[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}))}render(){const{$$form:e}=this.context,{visible:n,loading:r,itemList:i,inputText:l}=this.state,{value:a}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=pn("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=_a}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=ar("form-immediate"),x=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,E=t.createElement(T,{spinning:r},i.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:_e("table")},!g&&t.createElement("thead",null,t.createElement("tr",null,y.filter((e=>!e.hidden)).map((e=>t.createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t.createElement("tbody",null,i.map(((e,n)=>t.createElement("tr",{key:n,className:this.state.activeIndex===n?"active":"",onMouseEnter:()=>{this.setState({activeIndex:n})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},y.filter((e=>!e.hidden)).map((n=>t.createElement("td",{key:n.dataIndex},ue(e,n.dataIndex))))))))):t.createElement(nl,null));return t.createElement(sn.Consumer,null,(r=>{const s={[b]:!0,[`${b}--lg`]:"large"===(null==r?void 0:r.size),[`${b}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(mo,{value:a,bordered:u}):t.createElement(uc,{action:m?[]:["click"],popupVisible:!m&&n,popup:E,popupClassName:_e(s,`form-popper__${o}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ha,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:d,allowClear:p,bordered:u,readOnly:h,disabled:m,style:Object.assign({width:"100%"},c),value:null!=l?l:a,title:a,onFocus:()=>{!i.length&&this.fetchHandle(a)},onBlur:e=>{v&&!this._clicking&&l!==a&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(i[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%i.length:(--t+i.length)%i.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)}})))}))}}jc.contextType=Al;class Kc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>Mn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){tr("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:i,fieldsDefine:l}=this.props.option.searchHelper||{};if(!i)return;if(!(null===(t=null==r?void 0:r.searchHelper)||void 0===t?void 0:t.getServerConfig)||!(null===(n=null==r?void 0:r.searchHelper)||void 0===n?void 0:n.createFetchApi))return nr("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ja(Object.assign({},n.data,l),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:i,tooltip:l,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Jn(c)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(jc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(D,null,e.renderFormItemButton(a,p)),u&&t.createElement(D,{flex:Jn(u.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Kc.contextType=Al;class zc extends s{render(){var e;const{$$form:n}=this.context,{type:r,label:i,fieldName:l,className:a,style:o={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:p=Vn}=s,h=[];if(u.length){const t=null!==(e=n.getBlockDerivedItems().find((e=>e[0].fieldName===l)))&&void 0!==e?e:[],r=null!=d?d:t.length-1;t.slice(r+1).forEach((e=>{var t;const r=u.find((t=>t.fieldName===e.fieldName));if(!r)return;const i=r.showLabel?`${e.label}:`:"",l=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==l&&h.push(Object.assign(Object.assign({},e),{text:`${i}${l}`}))}))}return t.createElement(P.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(or,{id:l,label:i,className:a,extra:h.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[l],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[l]:e})}))),p(e)}}))}}zc.contextType=Al;const Vc=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:Vc(e.children,t,n,r)}):e)),Wc=e=>{const{$$form:n}=t.useContext(Al),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Fn(),{fieldName:d,options:u={},style:p={},placeholder:h=c("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:f=!0,asyncLoad:g,readOnly:v,disabled:y}=e.option,{itemList:b,filterable:x=!0,listHeight:E=_a,checkStrictly:w,checkStrategy:C="SHOW_CHILD",collapseTags:S,defaultExpandAll:N=!g,defaultExpandedKeys:T,dropdownStyle:I,openPyt:R=!0}=u,[O,k]=t.useState(Yn(b)?i:b),L=t.useRef(O);$i((()=>{const e=Yn(b)?i:b;g?he(e,L.current)||(k(e),L.current=e):k(e)}),[b,i]);const A=e=>{var t;return(null===(t=Ya(O,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},P=e=>(w&&Array.isArray(r)&&r.every((e=>ae(e)))&&(e=e.map((e=>e.value))),l?(null==e?void 0:e.map((e=>A(e))).join(","))||"":A(e));return n.isOnlyShow?t.createElement(mo,{value:P(r),bordered:m}):t.createElement(V,On({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:l,treeCheckable:l,treeCheckStrictly:w,showCheckedStrategy:V[C],popupClassName:`form-popper__${d}`,dropdownStyle:I,placeholder:h,listHeight:E,style:p,loading:a,bordered:m,allowClear:f,disabled:y,treeDefaultExpandAll:N,treeDefaultExpandedKeys:T,showSearch:x,maxTagCount:S?"responsive":void 0,loadData:g?({key:e,children:t})=>Mn(void 0,void 0,void 0,(function*(){var n;if(!g||t)return;const{fetchApi:r,params:i,dataKey:l,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=g;if(r)try{const t=yield r(c(Object.assign(Object.assign({},i),{[o]:e})));if(200===t.code){const r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,l))&&void 0!==n?n:[],i=Vc(O,e,o,Ga(r,o,a));k(i),null==s||s(r)}}catch(e){}})):void 0,treeData:O},l?{title:P(r)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(R?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,P(e),O)})(e)}}))};class Bc extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=Ga(n,l,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Jn(d)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Wc,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(D,{flex:Jn(p.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Bc.contextType=Al;const Uc=e=>{const{$$form:n}=t.useContext(Al),{value:r,multiple:i,items:l}=e,{t:a}=Fn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:p=!0,asyncLoad:h,readOnly:m,disabled:f}=e.option,{itemList:g,changeOnSelect:v,checkStrictly:y,checkStrategy:b="SHOW_PARENT",filterable:x=!0,dropdownStyle:E,openPyt:w=!0}=s,[C,S]=t.useState(Yn(g)?l:g),N=t.useRef(C);$i((()=>{const e=Yn(g)?l:g;h?he(e,N.current)||(S(e),N.current=e):S(e)}),[g,l]);const T=e=>Xa(C,null!=e?e:"").map((e=>e.text)).join("/"),I=e=>i?(null==e?void 0:e.map((e=>T(e))).join(","))||"":T(e);return n.isOnlyShow?t.createElement(mo,{value:I(r),bordered:u}):t.createElement(W,On({value:(e=>Yn(e)?[]:i?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:C,multiple:i,maxTagCount:"responsive",changeOnSelect:v||y,showCheckedStrategy:W[b],popupClassName:`form-popper__${o}`,dropdownStyle:E,placeholder:d,style:c,bordered:u,allowClear:p,disabled:f,showSearch:x&&!h&&{filter:(e,t)=>t.some((t=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",i=po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(w?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:h?e=>Mn(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!h||n.children)return;const{fetchApi:r,params:i,dataKey:l,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=h;if(r)try{const e=yield r(c(Object.assign(Object.assign({},i),{[o]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=ue(e.data,l))&&void 0!==t?t:[],i=Vc(C,n.value,o,Ga(r,o,a));S(i),null==s||s(r)}}catch(e){}})):void 0},i?{title:I(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,I(t),C)})(((e=[])=>i?e.map((e=>e.join(","))):e.join(","))(t))}}))};class Gc extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>Mn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:i,valueKey:l="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[],r=Ga(n,l,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,i=null===(n=this.props.option.request)||void 0===n?void 0:n.params;he(r,i)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:i,label:l,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:p,validateTrigger:h,rules:m=[],onChange:f=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Jn(d)},required:e.getFormItemRequired(m)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Uc,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(D,{flex:Jn(p.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Gc.contextType=Al;const Yc=["110000","120000","310000","500000"],Xc=["810000","820000"],Qc=[{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"}],Zc=[{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"}],Jc=e=>po.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),ed=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...Yc,...Xc].includes(e))):Object.keys(e[t])).map((r=>({l:Jc(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:ed(e,r,n+1)})))},td=(e,t)=>t.map((t=>({l:Jc(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class nd extends s{constructor(e){super(e),this.searchRef=t.createRef(),this.scrollRef=t.createRef(),this.state={visible:!1,select_type:"0",active_key:""},this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||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(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Kt(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){var t;return(null===(t=this.allCities.find((t=>t.c===e)))||void 0===t?void 0:t.n)||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:td(on,Yc)},{l:"Z2",n:"港澳",c:"",p:"",children:td(on,Xc)}]}createProvince(){var e;return(null!==(e=ed(on,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Zc.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Yc,...Xc].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(j.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}))}},t.createElement(j.Button,{value:"0"},pn("qm.form.citySelectType.0")),t.createElement(j.Button,{value:"1"},pn("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?Qc:Zc).map((n=>t.createElement("li",{key:n.value,className:_e({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement(H,{size:"small",placeholder:pn("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>{var n;return((null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"").toLowerCase().indexOf(e.toLowerCase())>=0},value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t.createElement(H.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:n}=this.state;return("0"===n?this.provinces:this.letterCities).map(((n,r)=>{var i;return t.createElement("div",{key:r},t.createElement("dt",{ref:e=>this[`${n.l}Ref`]=e},n.n,":"),t.createElement("dd",null,null===(i=n.children)||void 0===i?void 0:i.map((n=>t.createElement("li",{key:n.c,className:_e({actived:n.c===e}),onClick:()=>this.clickHadnle(n.c)},n.n)))))}))}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=pn("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=ar("form-city-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},a)},t.createElement("div",{className:"city-drop"},t.createElement("div",{className:"city-drop-toper"},t.createElement("div",{className:"city-drop-toper__type"},this.renderType()),t.createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t.createElement("div",{className:"city-drop-letter"},this.renderLetter()),t.createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t.createElement("dl",null,this.renderCity(r)))));return t.createElement(sn.Consumer,null,(r=>{const l={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(mo,{value:m,bordered:s}):t.createElement(uc,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ha,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},a),value:m,title:m,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}nd.contextType=Al;class rd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(nd,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}rd.contextType=Al;const id=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:id(e,n)})))};class ld extends s{constructor(e){super(e),this.searchRef=t.createRef(),this.handleVisibleChange=e=>{this.setState({visible:e})},this.triggerChange=e=>{const{onChange:t,onValuesChange:n}=this.props;null==t||t(e),n(e,this.createTextValue(e)),this.handleVisibleChange(!1)};const n=id(on,"86")||[];this.state={results:n,visible:!1,values:[],tabs:[n.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(",")!==(null!=n?n:"")&&this.initial()}get isFetch(){var e;return!!(null===(e=this.props.option.request)||void 0===e?void 0:e.fetchApi)}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){var e;null===(e=this.searchRef.current)||void 0===e||e.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>{var n,r;return null===(r=null===(n=this.state.tabs[t])||void 0===n?void 0:n.find((t=>t.value===e)))||void 0===r?void 0:r.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 i=Ya(e,t[r]);if(i&&Yn(i.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(null==i?void 0:i.children)&&(n[r+1]=null==i?void 0:i.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}getStreetList(e){var t;return Mn(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:i=(e=>e),dataKey:l,valueKey:a="value",textKey:o="text"}=n;if(r)try{const n=yield r(i({code:e}));if(200===n.code){const e=Array.isArray(n.data)?n.data:null!==(t=ue(n.data,l))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var i;const l=(null===(i=n.find((t=>t.value===e[r])))||void 0===i?void 0:i.text)||`${pn("qm.form.selectPlaceholder").replace("...","")}(${pn("qm.form.regionSelectLabel")[r]})`;return t.createElement(Il.TabPane,{key:r.toString(),tab:l},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:_e({"region-box__item":!0,actived:e.includes(n.value.toString())}),title:n.text,onClick:()=>{let{values:e}=this.state;e[r]=n.value.toString(),e=e.slice(0,r+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(r+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(r+1)}))}},n.text)))))}));return n.length?t.createElement(Il,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(nl,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=pn("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=ar("form-region-select"),h=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,m=t.createElement("div",{className:"container"},this.renderTabs());let f=this.prevText;if(!n){const e=this.createTextValue(r);(""===e||e.split("/").every((e=>""!==e)))&&(f=e,this.prevText=f)}return t.createElement(sn.Consumer,null,(r=>{const l={[p]:!0,[`${p}--lg`]:"large"===(null==r?void 0:r.size),[`${p}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(mo,{value:f,bordered:s}):t.createElement(uc,{action:u?[]:["click"],popupVisible:!u&&n,popup:m,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ha,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(O,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:Object.assign({width:"100%"},a),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&Un((()=>this.initial()))}})))}))}}ld.contextType=Al;class ad extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ld,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}ad.contextType=Al;const od=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:p,fileSize:h,draggable:m,editable:f,batchDownload:g,fileDirection:v,onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w}=a,{action:C,headers:S,params:N,withCredentials:T=!1,dataKey:I="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:A}=o,P="function"==typeof k?k():k||{},{t:_}=Fn();return t.createElement(xl,{name:"file",action:C,multiple:d,headers:S,data:N,withCredentials:T,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:p,fileSize:h,draggable:m,editable:f,batchDownload:g,fileDirection:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(Ke,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in P)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[P[i]])||"";return e.response&&200!==n.code&&R.error(n.message||_("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(I?ue(n.data,I):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(e)},onPreview:y,onDownload:b,onRemove:x,onSortChange:E,onEditChange:w})};class sd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(od,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}sd.contextType=Al;const cd=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,draggable:v,onRemove:y,onSortChange:b}=a,{action:x,headers:E,params:w,withCredentials:C=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,O="function"==typeof T?T():T||{},{t:k}=Fn();return t.createElement(Pd,{name:"file",action:x,multiple:d,headers:E,data:w,withCredentials:C,popupClassName:N,beforeUpload:I,maxCount:u,fixedSize:p,quality:h,openCropper:m,fileTypes:f,fileSize:g,draggable:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const i in O)r[i]=e[i]||(null===(t=n.data)||void 0===t?void 0:t[O[i]])||"";return e.response&&200!==n.code&&R.error(n.message||k("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(S?ue(n.data,S):n.data)||"",status:e.status})}));null==i||i(t),t.every((e=>"done"===e.status&&e.url))&&l(t)})(e)},onRemove:y,onSortChange:b})};class dd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(cd,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}dd.contextType=Al;const ud=e=>{const{$$form:n}=t.useContext(Al),{value:r,onChange:i,onValuesChange:l}=e,{options:a={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=a;return t.createElement(kd,{value:r,tinymce:u,upload:o,thresholdSize:p,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:h,onChange:e=>{(e=>{null==i||i(e),l(e)})(e)}})};class pd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:l,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:p=[],onChange:h=Vn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Jn(s)},required:e.getFormItemRequired(p)},t.createElement(_,{wrap:!1,gutter:4},t.createElement(D,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ud,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(D,{flex:Jn(d.labelWidth||La)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}pd.contextType=Al;class hd extends s{constructor(e){var n;super(e),this.provide={$$form:this,echo_data:{}},this._fieldAuth={},this.wrapperRef=t.createRef(),this.formRef=t.createRef(),this.originItems=[],this.state={formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:null!==(n=this.props.cols)&&void 0!==n?n:4,collapse:!!this.props.defaultExpand},this.resizeObserveHandler=()=>{var e;const t=null===(e=this.wrapperRef.current)||void 0===e?void 0:e.offsetWidth;if(void 0===t||0===t||this.props.cols>0)return;let n=Math.floor(t/300);n=24%n==0?n:n-1,n=n<1?1:n,n=n>8?8:n,n!==this.state.flexCols&&this.setState({flexCols:n})},this.resizeListenerHandle=be(this.resizeObserveHandler,10),this.getFormItems=Vt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=Vt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{ae(e.label)&&e.label.fieldName&&t.push(e.label),t.push(e)})),t})),this.valuesChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onValuesChange)||void 0===r||r.call(n,e,this._initialValues)},this.fieldsChangeHandle=(e,t)=>{var n,r;null===(r=(n=this.props).onFieldsChange)||void 0===r||r.call(n,e,t)},this.finishHandle=e=>{var t,n;null===(n=(t=this.props).onFinish)||void 0===n||n.call(t,Object.assign({},this.get_fields_other(),this.formatFormValue(e)))},this.finishFailedHandle=({values:e,errorFields:t})=>{var n,r;null===(r=(n=this.props).onFinishFailed)||void 0===r||r.call(n,t)},this.openValidateInfo=e=>{const n=t.createElement("ul",null,e.map((e=>{const{label:n}=this.formItems.find((t=>t.fieldName===e.name[0]));return t.createElement("li",{key:e.name[0],style:{color:"#ff4d4f"}},"[",("string"==typeof n?`${n}: `:"")+e.errors.join(","),"]")})));B.error({message:pn("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Kt(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})},this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){var e,t;return null!==(t=null!==(e=this.props.size)&&void 0!==e?e:this.context.size)&&void 0!==t?t:""}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(){var e;const t=this.context.global;return null!==(e=this.props.compactMode)&&void 0!==e?e:"small"===this.$size&&!!(null==t?void 0:t.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(){ol(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){sl(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&&nr("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=>ae(e.extra))).forEach((n=>{var r;t[n.fieldName]=null!==(r=e[n.fieldName])&&void 0!==r?r:""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>ae(e.collapse))).forEach((t=>{var n;e[t.fieldName]=null!==(n=t.collapse.defaultExpand)&&void 0!==n&&n})),Object.assign({},e)}getInitialValue(e,t){var n;const{type:r,options:i}=e;return t=null!=t?t:void 0,Da.includes(r)&&(t=null!=t?t:[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=null!==(n=null!=t?t:null==i?void 0:i.falseValue)&&void 0!==n?n:Pa),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=Zn(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){var t;return null!==(t=this.state.viewData[e])&&void 0!==t?t:""}setExpandHandle(e){var t,n;e!==this.state.collapse&&(this.setState({collapse:e}),null===(n=(t=this.props).onCollapse)||void 0===n||n.call(t,e),Un((()=>{var t,n;return null===(n=(t=this.props).onCollapse)||void 0===n?void 0:n.call(t,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){var t,n,r,i,l;if(Qa(e))return Za(e);if(ae(e)){const{fieldName:a,label:o,options:s={}}=e;if(Qa(o))return Za(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([a])[a])&&void 0!==n?n:this._initialValues[a])&&void 0!==r?r:null===(i=c[0])||void 0===i?void 0:i.value;return(null===(l=c.find((e=>e.value===d)))||void 0===l?void 0:l.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}){var n,r;if("DIVIDER"===e)return!0;const i=this.getBlockDerivedItems();for(let e=0,l=i.length;e<l;e++){const l=i[e],a=this.dividers.find((e=>e.fieldName===l[0].fieldName)),o=null!==(r=null===(n=null==a?void 0:a.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:l.length-1;for(let e=1;e<l.length;e++){if(l[e].fieldName===t&&e>o)return this.state.expand[l[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const i=e[r];if(Va(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{Va(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(i)){const[l,a]=r.split("|");e[l]=null!==(t=i[0])&&void 0!==t?t:"",e[a]=null!==(n=i[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)Yn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return Mn(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let i=Qn(r,["fetch"]);if(r.fetch){const{api:t,params:n,dataKey:l}=r.fetch;try{const r=yield t(n);200===r.code&&(i=null!==(e=l?ue(r.data,l):r.data)&&void 0!==e?e:{})}catch(e){}}if(Array.isArray(i.fieldList)){const e=this.props.items.map((e=>{const{fieldName:t}=e,n=i.fieldList.find((e=>e.dataIndex===t));if(n){const r=this.originItems.find((e=>e.fieldName===t)),{visible:i=1,disabled:l,secretName:a}=n;i||(e.noAuth=!0,r.noAuth=!0),l&&(e.disabled=!0,r.disabled=!0),a&&(e.options?e.options.secretType=a:e.options={secretType:a},r.options=Object.assign({},r.options,{secretType:a})),this.setFieldAuth(t,{visible:i,disabled:l,secretName:a})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(wo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(So,{option:e})}INPUT_NUMBER(e){return t.createElement(To,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(Ro,{option:e})}SEARCH_HELPER(e){return t.createElement(Ao,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(hc,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(gc,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(yc,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(Ec,{option:e})}CHECKBOX(e){return t.createElement(bo,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(Cc,{option:e})}RATE(e){return t.createElement(Nc,{option:e})}RADIO(e){return t.createElement(Ic,{option:e})}SWITCH(e){return t.createElement(Oc,{option:e})}TEXT_AREA(e){return t.createElement(Lc,{option:e})}DATE(e){return t.createElement(Pc,{option:e})}RANGE_DATE(e){return t.createElement(Hc,{option:e})}TIME(e){return t.createElement(Fc,{option:e})}RANGE_TIME(e){return t.createElement(qc,{option:e})}SELECT(e){return t.createElement(vo,{option:e})}MULTIPLE_SELECT(e){return t.createElement(vo,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(Kc,{option:e})}DIVIDER(e){return t.createElement(zc,{option:e})}TREE_SELECT(e){return t.createElement(Bc,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(Bc,{option:e,multiple:!0})}CASCADER(e){return t.createElement(Gc,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(Gc,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(rd,{option:e})}REGION_SELECT(e){return t.createElement(ad,{option:e})}UPLOAD_FILE(e){return t.createElement(sd,{option:e})}UPLOAD_IMG(e){return t.createElement(dd,{option:e})}TINYMCE(e){return t.createElement(pd,{option:e})}renderFormLabel(e){if(Qa(e)||!ae(e))return e;const{type:n,fieldName:r,label:i,options:l={},onChange:a=Vn}=e,{itemList:o=[]}=l;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(go,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{style:{paddingRight:5}},i),t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(yo,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:i={},render:l}=e,{extra:a}=this.state;if(r)return t.createElement(w,{className:"extra-tooltip",title:a[n]},t.createElement(Xe,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:l?"":a[n],style:i},t.createElement("span",{className:"extra-overflow-cut"},l?l(o,this):a[n]))}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:n,fieldName:r,invisible:i,tooltip:l,className:a,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return t.createElement(P.Item,{label:this.renderFormLabel(n),name:r,rules:c,tooltip:l,hidden:i,className:_e(a),style:Object.assign({width:"100%"},d),labelCol:{flex:this.verticalLayout?"initial":Jn(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):t.createElement(t.Fragment,null))}createFormItem(e){return se(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(nr("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:r,isFieldsDefine:i}=this.props,l=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)l.push({});l.push(e);for(let e=0;e<n;e++)l.push({})}));const a=24/e,o=[],s=l.reduce(((e,t)=>{const{selfCol:n=1}=t,r=e+n;return o.push(r),r}),0),c=r>Math.ceil(s/e)?Math.ceil(s/e):r,d=[],u=l.map(((n,r)=>{let{selfCol:i=1}=n;const{type:l,fieldName:s}=n;i=i>=24||"DIVIDER"===l||"TINYMCE"===l?e:i;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(o[r]),t.createElement(D,{key:null!=s?s:r,className:s,span:i*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},l?this.createFormItem(Zn(n)):null)}));return i&&"default"===n&&u.push(t.createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...u,this.createSearchButtonLayout(d[d.length-1])]}createSearchButtonLayout(e=0){const{flexCols:n,collapse:r}=this.state,{searchButtonCols:i,isSearchBtn:l,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=i||1,c=n-e%n-s;return l?t.createElement(D,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(S,{style:{marginBottom:12}},t.createElement(rr,{type:"primary",size:this.$size,icon:t.createElement(Ge,null),onClick:()=>this.SUBMIT_FORM()},pn("qm.form.search")),t.createElement(rr,{size:this.$size,icon:t.createElement(Qe,null),onClick:()=>this.RESET_FORM()},pn("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(De,null):t.createElement(He,null)," ",pn(r?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:n,isSubmitBtn:r}=this.props;if(this.isFilterType)return null;const i=24/e;return r&&"default"===n?t.createElement(_,{gutter:0},t.createElement(D,{key:"-",span:i},t.createElement(P.Item,null,t.createElement(S,{style:{marginBottom:12}},t.createElement(rr,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},pn("qm.form.save")),t.createElement(rr,{size:this.$size,onClick:()=>this.RESET_FORM()},pn("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(xo,{uniqueKey:e,items:n,fieldsChange:r})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise(((e,t)=>Mn(this,void 0,void 0,(function*(){const[n,r]=yield this.VALIDATE_FIELDS(),i=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>{var t;return null===(t=this[`${e.fieldName}_Ref`])||void 0===t?void 0:t.searchRef._is_change})).map((e=>({name:[e.fieldName],errors:[pn("qm.form.searchHelperTips")],warnings:[]})));n||i.length?t((n||[]).concat(i)):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))}GET_FORM_DATA(){return Mn(this,void 0,void 0,(function*(){try{const e=yield 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]}}))}VALIDATE_FIELDS(e){return Mn(this,void 0,void 0,(function*(){try{return[null,yield 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)}SUBMIT_FORM(){return Mn(this,void 0,void 0,(function*(){try{yield this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}))}RESET_FORM(){var e,t;const n=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),r=this.flattenItems.map((e=>e.fieldName)).filter((e=>!n.includes(e)));r.length&&this.formRef.current.resetFields(r),this.setState((e=>{const t=Object.keys(e.other),n=Object.keys(this._initialOthers),r=t.filter((e=>!n.includes(e))),i={};return r.forEach((e=>i[e]=void 0)),{other:Object.assign({},this._initialOthers,i)}})),this.setState({extra:Object.assign({},this._initialExtras)}),null===(t=(e=this.props).onReset)||void 0===t||t.call(e)}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){nr("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:i}=this.props,l=r.find((t=>t.fieldName===e));if(!l)return nr("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!ae(t))return nr("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(l.noAuth)return nr("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||me(l,n,t[n]));n&&(i?i([...r]):nr("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:l,labelAlign:a,labelWrap:o,customClass:s}=this.props,c=ar("form"),d={required:"${label}"+pn("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 t.createElement("div",{ref:this.wrapperRef,className:_e(u,e),style:n},t.createElement(P,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:r,labelAlign:a,labelWrap:o,colon:!1,disabled:i,labelCol:{flex:this.verticalLayout?"initial":Jn(l)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Al.Provider,{value:this.provide},t.createElement(_,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}hd.contextType=sn,hd.propTypes=qa,hd.defaultProps=ja;const md={onActivate:Wt.func,onAddUndo:Wt.func,onBeforeAddUndo:Wt.func,onBeforeExecCommand:Wt.func,onBeforeGetContent:Wt.func,onBeforeRenderUI:Wt.func,onBeforeSetContent:Wt.func,onBeforePaste:Wt.func,onBlur:Wt.func,onChange:Wt.func,onClearUndos:Wt.func,onClick:Wt.func,onContextMenu:Wt.func,onCommentChange:Wt.func,onCopy:Wt.func,onCut:Wt.func,onDblclick:Wt.func,onDeactivate:Wt.func,onDirty:Wt.func,onDrag:Wt.func,onDragDrop:Wt.func,onDragEnd:Wt.func,onDragGesture:Wt.func,onDragOver:Wt.func,onDrop:Wt.func,onExecCommand:Wt.func,onFocus:Wt.func,onFocusIn:Wt.func,onFocusOut:Wt.func,onGetContent:Wt.func,onHide:Wt.func,onInit:Wt.func,onKeyDown:Wt.func,onKeyPress:Wt.func,onKeyUp:Wt.func,onLoadContent:Wt.func,onMouseDown:Wt.func,onMouseEnter:Wt.func,onMouseLeave:Wt.func,onMouseMove:Wt.func,onMouseOut:Wt.func,onMouseOver:Wt.func,onMouseUp:Wt.func,onNodeChange:Wt.func,onObjectResizeStart:Wt.func,onObjectResized:Wt.func,onObjectSelected:Wt.func,onPaste:Wt.func,onPostProcess:Wt.func,onPostRender:Wt.func,onPreProcess:Wt.func,onProgressState:Wt.func,onRedo:Wt.func,onRemove:Wt.func,onReset:Wt.func,onSaveContent:Wt.func,onSelectionChange:Wt.func,onSetAttrib:Wt.func,onSetContent:Wt.func,onShow:Wt.func,onSubmit:Wt.func,onUndo:Wt.func,onVisualAid:Wt.func,onSkinLoadError:Wt.func,onThemeLoadError:Wt.func,onModelLoadError:Wt.func,onPluginLoadError:Wt.func,onIconsLoadError:Wt.func,onLanguageLoadError:Wt.func},fd=Object.assign({apiKey:Wt.string,id:Wt.string,inline:Wt.bool,init:Wt.object,initialValue:Wt.string,onEditorChange:Wt.func,value:Wt.string,tagName:Wt.string,cloudChannel:Wt.string,plugins:Wt.oneOfType([Wt.string,Wt.array]),toolbar:Wt.oneOfType([Wt.string,Wt.array]),disabled:Wt.bool,textareaName:Wt.string,tinymceScriptSrc:Wt.string,rollback:Wt.oneOfType([Wt.number,Wt.oneOf([!1])]),scriptLoading:Wt.shape({async:Wt.bool,defer:Wt.bool,delay:Wt.number})},md),gd=e=>"function"==typeof e,vd=e=>e in md,yd=e=>e.substr(2),bd=(e,t,n,r,i)=>((e,t,n,r,i,l,a)=>{const o=Object.keys(i).filter(vd),s=Object.keys(l).filter(vd),c=o.filter((e=>void 0===l[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=yd(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const i=r(e,n),l=yd(n);a[l]=i,t(l,i)}))})(i,e.on.bind(e),e.off.bind(e),((t,n)=>r=>{var i;return null===(i=t(n))||void 0===i?void 0:i(r,e)}),t,n,r);let xd=0;const Ed=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return xd++,e+"_"+n+xd+String(t)},wd=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Cd=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Sd=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Nd=()=>({listeners:[],scriptId:Ed("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Td=(()=>{let e=Nd();return{load:(t,n,r,i,l,a)=>{const o=()=>((e,t,n,r,i,l)=>{const a=t.createElement("script");a.referrerPolicy="origin",a.type="application/javascript",a.id=e,a.src=n,a.async=r,a.defer=i;const o=()=>{a.removeEventListener("load",o),l()};a.addEventListener("load",o),t.head&&t.head.appendChild(a)})(e.scriptId,t,n,r,i,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?a():(e.listeners.push(a),e.scriptLoading||(e.scriptLoading=!0,l>0?setTimeout(o,l):o()))},reinitialize:()=>{e=Nd()}}})(),Id=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Rd extends e.Component{constructor(t){var n,r,i;super(t),this.rollbackTimer=void 0,this.valueCursor=void 0,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},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){}},this.handleBeforeInputSpecial=e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)},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))}},this.handleEditorChangeSpecial=e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)},this.initialise=(e=0)=>{var t,n,r;const i=this.elementRef.current;if(!i)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})(i)){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 l=Id(this.view);if(!l)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},this.props.init),{selector:void 0,target:i,readonly:this.props.disabled,inline:this.inline,plugins:(o=null===(t=this.props.init)||void 0===t?void 0:t.plugins,s=this.props.plugins,Cd(o).concat(Cd(s))),toolbar:null!==(n=this.props.toolbar)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.toolbar,setup:e=>{this.editor=e,this.bindHandlers({}),this.inline&&!wd(i)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&gd(this.props.init.setup)&&this.props.init.setup(e)},init_instance_callback:e=>{var t,n;const r=this.getInitialValue();this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t:e.getContent(),this.currentContent!==r&&(this.currentContent=r,e.setContent(r),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const i=null!==(n=this.props.disabled)&&void 0!==n&&n;Sd(this.editor,i?"readonly":"design"),this.props.init&&gd(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(i.style.visibility=""),wd(i)&&(i.value=this.getInitialValue()),l.init(a)},this.id=this.props.id||Ed("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(i=null!==(n=this.props.inline)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.inline)&&void 0!==i&&i,this.boundHandlers={}}get view(){var e,t;return null!==(t=null===(e=this.elementRef.current)||void 0===e?void 0:e.ownerDocument.defaultView)&&void 0!==t?t:window}componentDidUpdate(e){var t,n;if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=null!==(t=this.currentContent)&&void 0!==t?t: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=null!==(n=this.props.disabled)&&void 0!==n&&n;Sd(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,i,l;null!==Id(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Td.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),null!==(t=null===(e=this.props.scriptLoading)||void 0===e?void 0:e.async)&&void 0!==t&&t,null!==(r=null===(n=this.props.scriptLoading)||void 0===n?void 0:n.defer)&&void 0!==r&&r,null!==(l=null===(i=this.props.scriptLoading)||void 0===i?void 0:i.delay)&&void 0!==l?l: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(){var e,t,n;return(null===(n=null===(t=null===(e=Id(this.view))||void 0===e?void 0:e.Env)||void 0===t?void 0:t.browser)||void 0===n?void 0:n.isIE())?"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:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.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){bd(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))}}}var Od;Rd.propTypes=fd,Rd.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(Od||(Od={}));const kd=e=>{var n;const{className:r,style:i,tinymce:l={},upload:a={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:p}=e,{global:h}=t.useContext(sn),{$size:m}=qn(e),{$locale:f,t:g}=Fn(),v=400,y="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",b="file edit view insert format tools table help",x="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",E=Object.assign(Object.assign({height:l.height||v,plugins:l.plugins||y,toolbar:l.toolbar||x,menubar:l.menubar||b,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:Od[f],skin:"tinymce-5"},Qn(l,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>new Promise(((t,n)=>Mn(void 0,void 0,void 0,(function*(){const{action:n,headers:r,dataKey:i}=a,l=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(n&&c/1024/1024>o)try{const e=yield fetch(n,{method:"POST",body:s,headers:r});if(!e.ok)throw new Error(g("qm.upload.uploadError"));const l=yield e.json();if(200===l.code){const e=i?ue(l.data,i):l.data;t(e)}}catch(e){R.error(g("qm.uploadCropper.uploadError"))}else t(l)})))),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),w=ar("tinymce"),C={[w]:!0,[`${w}--lg`]:"large"===m,[`${w}--sm`]:"small"===m},S={init:E,value:d,disabled:c,tinymceScriptSrc:s||(null===(n=null==h?void 0:h.tinymce)||void 0===n?void 0:n.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==p||p(t.getContent(),t)}};return t.createElement("div",{className:_e(C,r),style:i},t.createElement(Rd,S))};kd.displayName="QmTinymce";const Ld=t.forwardRef(((e,n)=>{const r=hn({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:i,style:l,src:a,alt:o,imgStyle:s}=r,c=Dn(r,["className","style","src","alt","imgStyle"]),d=t.useRef(null),u=t.useRef(null);t.useEffect((()=>{const e={};for(const t in c)void 0!==r[t]&&(e[t]=r[t]);return u.current=new Ut(d.current,e),()=>{y(),u.current=null}}),[]);const p=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.reset()},h=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},m=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.crop()},f=(e,t=!1)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.replace(e,t)},g=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.enable()},v=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.disable()},y=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.destroy()},b=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.move(e,t)},x=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.moveTo(e,t)},E=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoom(e)},w=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},C=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotate(e)},S=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotateTo(e)},N=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleX(e)},T=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleY(e)},I=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.scale(e,t)},R=(e=!1)=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getData(e)},O=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setData(e)},k=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getContainerData()},L=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getImageData()},A=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCanvasData()},P=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCanvasData(e)},_=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},D=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},H=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},M=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},F=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setDragMode(e)};t.useImperativeHandle(n,(()=>({reset:p,clear:h,initCrop:m,replace:f,enable:g,disable:v,destroy:y,move:b,moveTo:x,relativeZoom:E,zoomTo:w,rotate:C,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:_,setCropBoxData:D,getCroppedCanvas:H,setAspectRatio:M,setDragMode:F})));const $={[ar("cropper")]:!0};return t.createElement("div",{className:_e($,i),style:l},t.createElement("img",{ref:d,src:a,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));Ld.displayName="Cropper";const Ad=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:i,quality:l,beforeCrop:a,className:o}=e,{t:s}=Fn(),c=t.useRef(null),d=t.useRef(),u=t.useRef(),p=t.useRef(),h=t.useRef(),[m,f]=t.useState(""),g=e=>{c.current.relativeZoom(e)},v=e=>{c.current.rotate(e)},y=()=>{f("")},b=ar("cropper-preview");return t.createElement(t.Fragment,null,(()=>{const n=Array.isArray(e.children)?e.children[0]:e.children;if(!n)return null;const r=n.props,{beforeUpload:i}=r,l=Dn(r,["beforeUpload"]);return d.current=i,t.createElement(n.type,Object.assign(Object.assign({},l),{beforeUpload:(e,t)=>new Promise(((n,r)=>Mn(void 0,void 0,void 0,(function*(){const r=()=>n(I.LIST_IGNORE);if(a&&!(yield a(e,t)))return void r();u.current=e,p.current=n,h.current=r;const i=new FileReader;i.onload=()=>{f(i.result),i.onload=null},i.readAsDataURL(e)}))))}))})(),m&&t.createElement(A,{open:!0,wrapClassName:_e(b,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{Mn(void 0,void 0,void 0,(function*(){const{type:e,name:t,uid:r}=u.current;c.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===e?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((i=>Mn(void 0,void 0,void 0,(function*(){let l=new File([i],t,{type:e});if(Object.assign(l,{uid:r}),n.length&&!n.includes(l.name.slice(l.name.lastIndexOf(".")+1).toLowerCase()))return R.warning(s("qm.upload.tooltip",{type:n.join(",")})),h.current("file type is error");if("function"!=typeof d.current)return p.current(l);const a=d.current(l,[l]);if("boolean"==typeof a||a){if(!0===a)return p.current(l);if(!1===a)return h.current("not upload");if(a&&"function"==typeof a.then)try{const e=yield a,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(l=e),p.current(l)}catch(e){h.current(e)}}else nr("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,l),yield Bn(100),y()}))},onCancel:y,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:i?`calc(380px * ${i[1]/i[0]})`:"auto"};return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(Ld,{ref:c,aspectRatio:i?i[0]/i[1]:i,src:m,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(S,{size:"small"},t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Ze,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(Je,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(et,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(tt,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},Pd=e=>{const n=hn({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:i=!0,fixedSize:l,quality:a=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:p,className:h,popupClassName:m,beforeCrop:f,onSortChange:g,onChange:v}=n,{t:y}=Fn(),{$size:b}=qn(n),x=t.useRef(null),E=t.useRef(null),w=t.useRef(!1),[C,S]=t.useState(!1),[N,T]=t.useState(0),O=t.useMemo((()=>u||p),[u,p]),k=t.useMemo((()=>!c||r.length<c),[r,c]);t.useEffect((()=>(A(),document.addEventListener("paste",_),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",_)})),[]),$i((()=>{k||(w.current=!1)}),[r]);const L=$n((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[i]=e.splice(t,1);e.splice(n,0,i),null==g||g(e),null==v||v({file:r[t],fileList:e})}})),A=()=>{d&&(E.current=qt.create(Gi(x.current,ar("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:L}))},P=(e,t)=>new Promise(((r,i)=>Mn(void 0,void 0,void 0,(function*(){const{fileTypes:l=[],fileSize:a,beforeUpload:o}=n,s=!l.length||l.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!a||e.size/1024/1024<a,d=s&&c;if(s||R.warning(y("qm.upload.tooltip",{type:l.join(",")})),c||R.warning(y("qm.upload.sizeLimit",{size:a})),!d)return I.LIST_IGNORE;if(o){const n=o(e,t);if(!0===n)return r(e);if(!1===n)return i("not upload");if(n&&"function"==typeof n.then)try{const e=yield n;r(e)}catch(e){i(e)}}else r(e)})))),_=$n((e=>Mn(void 0,void 0,void 0,(function*(){const{action:t,data:i,headers:l}=n;if(w.current&&k&&t)for(const n of e.clipboardData.items)if("file"===n.kind&&n.type.startsWith("image/")){const e=n.getAsFile(),a=Date.now(),o=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${a}`});try{yield P(o,[...r,o]);const e=new FormData;if(e.append("file",o),i)for(const t in i)e.append(t,i[t]);const n="string"==typeof t?t:yield t(o),a=yield fetch(n,{method:"POST",body:e,headers:l});if(!a.ok)throw new Error(y("qm.upload.uploadError"));const s=yield a.json();null==v||v({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})))),D=ar("upload-img"),H={[D]:!0,[`${D}--lg`]:"large"===b,[`${D}--sm`]:"small"===b},M=t.createElement(I,On({className:_e(H,h)},Qn(n,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:P,disabled:O,onPreview:e=>{const t=r.findIndex((t=>t.url===e.url));t<0||(T(t),S(!0))},showUploadList:{showRemoveIcon:!1,showDownloadIcon:!1},itemRender:(e,n,r,i)=>t.createElement("div",{className:_e("upload-item",{handle:d})},e,!O&&t.createElement(Ye,{title:y("qm.upload.remove"),className:"icon",onClick:()=>i.remove()}))}),t.createElement("span",{className:"inner",ref:x},k&&!(p&&r.length)&&t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(nt,null)),t.createElement("p",{className:"ant-upload-text"},y("qm.uploadCropper.dragableText")),t.createElement("button",{className:_e("ant-upload-button",{disabled:O}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,i?t.createElement(Ad,{className:m,fixedSize:l,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},M):M,t.createElement("div",{style:{display:"none"}},t.createElement(U.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:C,current:N,rootClassName:m,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(U,{key:e.uid||n,src:e.url,alt:""}))))))};Pd.displayName="QmUploadImg";const _d=(e,t,n)=>{let r;for(let i=0;i<e.length;i++){const l=e[i];if(l.children)if(l.children.some((e=>e[n]===t)))r=l[n];else{const e=_d(l.children,t,n);e&&(r=e)}}return r},Dd=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Dd(e.children,t),t(e)||e.children&&e.children.length))),Hd=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Hd(e.children,t)),t(e)&&n.push(e)})),n},Md=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Md(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Fd=(e,t,n,r)=>e.map((e=>e[n]===t?Object.assign(Object.assign({},e),{children:r}):e.children?Object.assign(Object.assign({},e),{children:Fd(e.children,t,n,r)}):e)),$d=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...$d(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},qd=(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 i=qd(e[r].children,t,n);if(i)return[e[r][n],i].flat()}}},jd=(e,t)=>{var n;const r=(null===(n=e.children)||void 0===n?void 0:n.map((e=>e[t])))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...jd(e,t)))),r},Kd=t.forwardRef(((e,n)=>{const{className:r,style:i,filterable:l=!0,multiple:a,draggable:o,dataSource:s,fetch:c,autoFocus:d,asyncLoad:u,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:m,fieldsDefine:f,value:g,height:v,defaultSelectedKeys:y=[],defaultExpandedKeys:b=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:w=!0,onSelectChange:C,onCheckChange:S,onDragStart:N,onDragChange:T,onExpand:I}=e,{$size:R}=qn(e),{t:k}=Fn(),L=(null==f?void 0:f.valueKey)||"value",A=(null==f?void 0:f.textKey)||"text";null==f||f.children;const P=t.useRef(null),_=t.useRef(null),D=cl(P),[H,M]=t.useState(v),[F,$]=t.useState(!1),q=dl((()=>{M(P.current.offsetHeight-ee.current.offsetHeight-10)}),5);fn((()=>{v||q()}),[D.height]);const[j,K]=t.useState([]),[z,V]=t.useState({}),[W,B]=t.useState([]),[U,Y]=t.useState([]),[X,Q]=t.useState(""),[Z,J]=t.useState(x),ee=t.useRef(null),te=t.useRef([]),ne=t.useRef([]);t.useEffect((()=>{Array.isArray(s)&&(re(s),B(ie(s)),V({}))}),[s]),t.useEffect((()=>{var e;oe(),d&&(null===(e=_.current)||void 0===e||e.focus())}),[]),$i((()=>{oe()}),[null==c?void 0:c.params]),$i((()=>{Y(ae())}),[z]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=Md(j,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],re([...j]))},REMOVE_RECORD:e=>{var t;const n=_d(j,e,L);if(void 0===n&&j.find((t=>t[L]===e)))re(j.filter((t=>t[L]!==e)));else{const r=Md(j,(e=>n===e[L]));if(!r)return;const i=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[L]));i>=0&&(r.children.splice(i,1),re([...j]))}},UPDATE_RECORD:(e,t)=>{const n=Md(j,(t=>e===t[L]));n&&(ve(n,t),re([...j]))}})));const re=e=>{K(e),te.current=e,ne.current=$d(e,L)},ie=e=>{if(a)return y;const t=Hd(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},le=e=>{var t;return(null===(t=qd(j,e,L))||void 0===t?void 0:t.slice(0,-1))||[]},ae=()=>{if(x)return ne.current;const e=[];return W.forEach((t=>{if(a){if("SHOW_ALL"===h&&!ne.current.includes(t)&&e.push(...le(t)),"SHOW_CHILD"===h&&e.push(...le(t)),"SHOW_PARENT"===h){const n=Ya(j,t);if(n){const r=le(t),i=jd(n,L);e.push(...r,...[t,...i].filter((e=>ne.current.includes(e))))}}}else e.push(...le(t))})),[...new Set([...b,...e])]},oe=()=>Mn(void 0,void 0,void 0,(function*(){var e;if(!c)return;const{api:t,params:n,dataKey:r,afterFetch:i,callback:l}=c;try{$(!0);const a=yield t(n);if(200===a.code){let t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,re(t),B(ie(t)),V({}),null==l||l(t)}}catch(e){}$(!1)})),se=e=>`${e}|${po.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ce=ar("search-tree"),de={[ce]:!0,[`${ce}--lg`]:"large"===R,[`${ce}--sm`]:"small"===R};return t.createElement("div",{ref:P,className:_e(de,r),style:i},t.createElement("div",{ref:ee,className:"topper"},E&&t.createElement(O,{ref:_,value:X,size:R,placeholder:m||k("qm.form.inputPlaceholder"),suffix:t.createElement(Ge,null),allowClear:!0,onChange:e=>(e=>{if(!l)return;const t=Dd(te.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==se(n).indexOf(e)}));Q(e),K(t),Y(x||e?$d(t,L):ae())})(e.target.value)}),w&&t.createElement("a",{className:"trigger",onClick:()=>{J(!Z),Y(Z?[]:ne.current)}},Z?t.createElement(De,null):t.createElement(He,null)," ",k(Z?"qm.form.collect":"qm.form.spread"))),t.createElement(rl,{spinning:F},t.createElement(G,{fieldNames:{title:A,key:L,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:H,disabled:e.disabled,checkStrictly:p,selectedKeys:null!=g?g:W,checkedKeys:null!=g?g:W,expandedKeys:U,treeData:j,loadData:u?({key:e,children:t})=>Mn(void 0,void 0,void 0,(function*(){var n;if(!c||t)return;const{api:r,params:i,dataKey:l,formatter:a=(e=>e),afterFetch:o}=c;try{const t=yield r(a(Object.assign(Object.assign({},i),{[L]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=ue(t.data,l))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const i=Fd(te.current,e,L,r);re(i)}}catch(e){}})):void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!X)return!1;const t=e[A]||"";return-1!==se(t).indexOf(X)},onDragStart:N,onDragEnter:e=>{Y(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),i=e.dropPosition-Number(r[r.length-1]),l=(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&&l(e[r].children,t,n)}},a=[...j];let o;if(l(a,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)l(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];l(a,t,((t,r,i)=>{n=i,e=r})),-1===i?n.splice(e,0,o):n.splice(e+1,0,o)}else l(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(a)},onDragEnd:e=>{null==T||T(e,j)},onExpand:(e,t)=>{Yn(e)&&J(!1),ne.current.every((t=>e.includes(t)))&&J(!0),Y(e),null==I||I(e,t)},onSelect:e=>{B(e);const t=Hd(te.current,(t=>e.includes(ue(t,L))));null==C||C(a?t:t[0])},onCheck:e=>{p&&(e=e.checked),B(e),p||("SHOW_CHILD"===h&&(e=e.filter((e=>!ne.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,n)=>!n.includes(_d(j,e,L))))));const t=Hd(te.current,(t=>e.includes(ue(t,L))));null==S||S(a?t:t[0])}})))}));Kd.displayName="QmSearchTree";const zd=n(void 0),Vd={dataIndex:Bt.string.isRequired,title:Bt.string.isRequired,description:Bt.string,colSpan:Bt.number,width:Bt.number,minWidth:Bt.number,fixed:Bt.oneOf(["left","right"]),align:Bt.oneOf(["left","center","right"]),theadAlign:Bt.oneOf(["left","center","right"]),printFixed:Bt.bool,hidden:Bt.bool,noAuth:Bt.bool,noFixed:Bt.bool,ellipsis:Bt.bool,className:Bt.string,theadClassName:Bt.string,children:Bt.array,sorter:Bt.oneOfType([Bt.bool,Bt.func]),filter:Bt.shape({type:Bt.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Bt.arrayOf(Bt.shape({text:Bt.string,value:Bt.oneOfType([Bt.string,Bt.number])})),style:Bt.object}),precision:Bt.number,displayPrecision:Bt.number,formatType:Bt.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Bt.bool,canCopy:Bt.bool,editRender:Bt.func,dictItems:Bt.arrayOf(Bt.shape({text:Bt.string,value:Bt.oneOfType([Bt.string,Bt.number])})),summation:Bt.shape({sumBySelection:Bt.bool,displayWhenNotSelect:Bt.bool,dataKey:Bt.string,unit:Bt.string,render:Bt.func}),groupSummary:Bt.shape({dataKey:Bt.string,unit:Bt.string,render:Bt.func}),shouldCellUpdate:Bt.func,headRender:Bt.func,render:Bt.func};Bt.arrayOf(Bt.shape(Vd)).isRequired,Bt.func,Bt.array,Bt.oneOfType([Bt.string,Bt.func]).isRequired,Bt.number,Bt.bool,Bt.bool,Bt.shape({api:Bt.func.isRequired,params:Bt.object.isRequired,formatter:Bt.func,beforeFetch:Bt.func,afterFetch:Bt.func,stopToFirst:Bt.bool,dataKey:Bt.string,callback:Bt.func}),Bt.bool,Bt.bool,Bt.string,Bt.string,Bt.object,Bt.bool,Bt.bool,Bt.bool,Bt.oneOfType([Bt.object,Bt.func]),Bt.oneOfType([Bt.object,Bt.func]),Bt.array,Bt.func,Bt.bool,Bt.object,Bt.object,Bt.shape({type:Bt.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Bt.array,selectedRowKeys:Bt.array,hideSelectAll:Bt.bool,checkStrictly:Bt.bool,filterable:Bt.bool,selectByClickRow:Bt.bool,selectFirstRowOnChange:Bt.bool,clearableAfterFetched:Bt.bool,selectAllOnCurrentPage:Bt.bool,fetchSelectedRows:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),fetchAllRowKeys:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),disabled:Bt.func,onChange:Bt.func,onSelect:Bt.func,onSelectAll:Bt.func}),Bt.shape({currentRowKey:Bt.oneOfType([Bt.number,Bt.string]),disabled:Bt.func,onChange:Bt.func}),Bt.shape({virtual:Bt.bool,overscan:Bt.number,doubleXScrollbar:Bt.bool}),Bt.shape({expandIconColumn:Bt.string}),Bt.shape({defaultExpandAllRows:Bt.bool,defaultExpandedRowKeys:Bt.array,expandedRowKeys:Bt.array,hideExpandAll:Bt.bool,rowExpandable:Bt.func,expandedRowClassName:Bt.string,expandedRowRender:Bt.func,onExpand:Bt.func,onChange:Bt.func}),Bt.shape({cellMerge:Bt.bool,onCellMerge:Bt.func,onSelectChange:Bt.func}),Bt.shape({groupItems:Bt.arrayOf(Bt.shape({dataIndex:Bt.string.isRequired,titleIndex:Bt.string,color:Bt.string,backgroundColor:Bt.string})),fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),onChange:Bt.func}),Bt.func,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.shape({current:Bt.number,pageSize:Bt.number,pageSizeOptions:Bt.array,showSizeChanger:Bt.bool,showQuickJumper:Bt.bool}),Bt.shape({fileName:Bt.string,fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object}),beforeExport:Bt.func,cellStyle:Bt.bool,hideIcon:Bt.bool}),Bt.shape({showLogo:Bt.bool}),Bt.shape({fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),fieldList:Bt.arrayOf(Bt.object)}),Bt.shape({position:Bt.oneOf(["top","bottom"]),hideAlert:Bt.bool,hideClearButton:Bt.bool}),Bt.oneOf(["left","right"]),Bt.func,Bt.func,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func;const Wd={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},Bd=10,Ud="1",Gd="0",Yd="YYYY-MM-DD",Xd="YYYY-MM-DD HH:mm:ss",Qd="YYYYMMDDHHmmss",Zd={bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}}};var Jd;!function(e){e.left="flex-start",e.right="flex-end"}(Jd||(Jd={}));const eu=Object.assign({},e).useId;let tu=0;var nu=eu?function(e){const t=eu();return e||t}:function(t){const[n]=e.useState(`qm_unique_${tu}`);return e.useEffect((()=>{tu+=1}),[]),t||n};let ru=[];const iu={_getInstance:function(e){var t;return null!==(t=ru.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=ru[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==ru.findIndex((e=>e===t))&&(this.deregister(e),ru=[t,...ru])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),ru=[{id:e,vm:t},...ru])},deregister:function(e){e&&(ru=ru.filter((t=>t.id!==e)))}};class lu{constructor(){this.state={required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]},this.addToRequired=e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)},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)},this.addToValidate=e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)},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)},this.addToEdited=e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)},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)},this.addToInserted=e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)},this.removeFromInserted=e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)},this.addToUpdated=e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)},this.removeFromUpdated=e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)},this.addToRemoved=e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)},this.removeFromRemoved=e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)},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)}}const au={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 ou(e){return void 0!==e}function su(t,n){const{defaultValue:r,value:i,onChange:l,postState:a}=n||{},[o,s]=e.useState((()=>ou(i)?i:ou(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=ou(i)?i:o,d=a?a(c):c,u=$n(l),[p,h]=e.useState([c]);fn((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),fn((()=>{ou(i)||s(i)}),[i]);return[d,$n((e=>{s(e),h([c])}))]}const cu=e=>e.map((e=>{const t=Object.assign({},e);return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=cu(t.children)),t})),du=(e,n)=>{const{fetch:r,columns:i,border:l,rowSelection:a,summation:o,expandable:s,treeConfig:c,webPagination:d,scrollPagination:u,showSuperSearch:p,showFastSearch:h,showGroupSummary:m,showTableImport:f,showClipboard:g,showSelectCollection:v,showPivotGrid:y,footRender:b}=e,{tableRef:x,getRowKey:E,tableFullData:w,tableFlatData:C,selectionKeys:S,sorter:N,filters:T,superFilters:I,pagination:R,mergedTdCells:O}=n,{selectionRows:k,summaries:L}=x.current,{expandIconColumn:A=""}=c||{},{t:P}=Fn(),_=e=>{const t=(e=>{const t=[],n=[],r=[];for(let i=0;i<e.length;i++){const l=e[i];"left"===l.fixed?t.push(l):"right"===l.fixed?n.push(l):r.push(l)}return[...t,...r,...n]})(cu(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:au.selectionColumn,title:"radio"===t?P("qm.table.config.selectionText"):"",width:au.selectionColumnWidth,fixed:"left",type:t}})(a),r=(null==(i=s)?void 0:i.expandedRowRender)?{dataIndex:au.expandableColumn,title:"",width:au.selectionColumnWidth,fixed:"left",type:"expand"}:null;var i;return n&&t.unshift(n),r&&t.unshift(r),Gl(t)},D=(e,t,n,r,i)=>{const l=`${t},${n}`;e.has(l)||e.set(l,{row:t,col:n,rowSpan:r,colSpan:i})},H=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),M=t.useMemo((()=>!H&&!!d),[H,d]),F=t.useMemo((()=>H&&!!u),[H,u]),$=t.useMemo((()=>(H||M)&&!F),[H,M,F]),q=t.useMemo((()=>_(i)),[i]),j=t.useMemo((()=>Ul(q)),[q]),K=t.useMemo((()=>j.filter((e=>"function"==typeof e.editRender))),[j]),z=t.useMemo((()=>j.filter((e=>!!e.summation))),[j]),V=t.useMemo((()=>j.filter((e=>"left"===e.fixed))),[j]),W=t.useMemo((()=>j.filter((e=>"right"===e.fixed))),[j]),B=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=C.findIndex((t=>E(t,t.index)===e.rowKey)),r=j.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){D(t,n,r,e.rowSpan,e.colSpan);for(let i=0;i<e.rowSpan;i++)for(let l=0;l<e.colSpan;l++)0===i&&0===l||D(t,n+i,r+l,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(O)),[O,j,w]),U=t.useMemo((()=>{var e,t;const n=j.filter((e=>![au.expandableColumn,au.selectionColumn,au.operationColumn].includes(e.dataIndex)));return A&&n.some((e=>e.dataIndex===A))?A:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[j,A]),G=t.useMemo((()=>z.length>0),[z]),Y=t.useMemo((()=>!!b||G),[b,G]),X=t.useMemo((()=>ia(q).length>1),[q]),Q=t.useMemo((()=>l||X),[l,X]),Z=t.useMemo((()=>j.some((e=>e.sorter))),[j]),J=t.useMemo((()=>j.some((e=>e.filter))),[j]),ee=t.useMemo((()=>z.some((e=>!!e.summation.dataKey))),[z]),te=t.useMemo((()=>!H&&!!f),[H,f]),ne=t.useMemo((()=>!!g&&K.length>0),[g,K]),re=t.useMemo((()=>!!v&&"checkbox"===(null==a?void 0:a.type)),[v,a]),ie=t.useMemo((()=>!!p&&J),[p,J]),le=t.useMemo((()=>!H&&!!h&&J),[H,h,J]),ae=t.useMemo((()=>!H&&!!y),[H,y]),oe=t.useMemo((()=>!!m&&j.some((e=>!!e.groupSummary))),[j]),se=t.useMemo((()=>{var e;return!!(null===(e=null==o?void 0:o.groupItems)||void 0===e?void 0:e.length)}),[o]),ce=t.useMemo((()=>!C.length),[C]),de=t.useMemo((()=>(()=>{const e={};return z.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:i,summation:l}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=l,c=se?Ea(x.current.tableFullData):x.current.tableFullData,d=!k.length&&!!o;let u=(!a||d?c:k).reduce(((e,t)=>{if(null==t?void 0:t[au.summaryIgnore])return e;const r=da(t,n);return ha(r)?e.plus(r):e}),new Gt(0));!Object.keys(L).includes(n)||a&&!d||(u=new Gt(da(L,n))),ua(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=fa(p,i)),p=ma(p),ua(e,`${n}_text`,s?`${p} ${s}`:p)})),[e]})()),[C,S,L]),ue=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(z)),[z]),pe=t.useMemo((()=>{var e;const t=(e=>{const t=[];return Object.keys(e).forEach((n=>{null!==e[n]&&t.push(`${n}|${e[n]}`)})),t.join(",")})(N),n=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,i]=t.split("|"),l=e[t];Object.keys(l).forEach((e=>{n.push({type:i,bracketLeft:"",fieldName:r,expression:e,value:l[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{n.push({type: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})(T,I),i=t?{[au.sorterFieldName]:t}:null,l=n.length?{[au.filterFieldName]:n}:null,a=ue?{[au.groupSummary.summaryFieldName]:ue,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[au.currentPageName]:R.current,[au.pageSizeName]:R.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},i),l),a),o),s)}),[null==r?void 0:r.params,R.current,R.pageSize,N,T,I,ue]);return{isFetch:H,isWebPagination:M,isScrollPagination:F,showPagination:$,tableColumns:q,flattenColumns:j,editableColumns:K,summationColumns:z,leftFixedColumns:V,rightFixedColumns:W,derivedMergeCells:B,treeExpandIndex:U,showSummary:G,showFooter:Y,isHeadGroup:X,bordered:Q,isHeadSorter:Z,isHeadFilter:J,isServiceSummation:ee,isSelectCollection:re,isTableImport:te,isTableClipboard:ne,isSuperSearch:ie,isFastSearch:le,isPivotGrid:ae,isGroupSummary:oe,isGroupSubtotal:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}},uu=(e,n)=>{const{rowKey:r,height:i,dataSource:l,summation:a,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,authConfig:h,ignorePageIndex:m,columnsChange:f,onChange:g,onDataChange:v,onDataLoad:y,onScrollEnd:b,onFetchError:x}=e,{getRowKey:E,tableRef:w,tableElementRef:C,tableBodyRef:S,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:A,superFilters:P,fetchParams:_,selectionKeys:D,rowExpandedKeys:H,highlightKey:M,summationColumns:F,isFetch:$,isWebPagination:q,isScrollPagination:j,isServiceSummation:K,isGroupSubtotal:z,doLayout:V,setTableFullData:W,setTableOriginData:B,setTableFlatData:U,setAllTableData:G,setDeriveRowKeys:Y,setPagination:X,setPingRight:Q,setPingLeft:Z,setSpinning:J,setSorter:ee,setFilters:te,setSuperFilters:ne,setSelectionKeys:re,setRowExpandedKeys:ie,setHighlightKey:le,setSelectionRows:ae,setScrollXLoad:oe,setScrollYLoad:se,setFieldAuth:ce,setResizeState:de,setSummaries:pe,setPermission:he,setRecordsMap:me,resetTableScroll:fe,clearElementStore:ge,clearRecordsMap:ve}=n,{t:ye}=Fn(),{store:be}=w.current,Ee=t.useRef(Object.assign({},_)),we=t.useRef(!1),Ce=cl(C);fn((()=>{Oe(),V()}),[T]),fn((()=>{Se()}),[Ce,N,i,k.tableAutoHeight]),$i((()=>{lt(),at(),ot(),$||(q&&Ze(),Be(l)),s&&ee(s),c&&te(c)}),[l,null==o?void 0:o.params]),$i((()=>{const e=je(_,Ee.current);e||$&&(null==d?void 0:d.clearableAfterFetched)&&st(),!e&&_[au.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?Ze():$&&Ve(),Ee.current=_}),[_]),$i((()=>{q&&tt(),j||fe(),Fe()}),[O.current,O.pageSize]),$i((()=>{$||Te(R.length),V()}),[R]),$i((()=>{w.current.isTreeTable&&tt()}),[H]);const Se=()=>{const{scrollBarRef:e,resizeState:t}=w.current,{width:n,height:r}=Ce;V(),k.tableBodyWidth>n&&Q(!0),e.current.scrollLeft>0&&Z(!0),de(Object.assign({},t,{width:n,height:r}))},Ne=()=>{M&&S.current.setClickedValues([M,""]),"radio"===(null==d?void 0:d.type)&&D.length&&S.current.setClickedValues([D[0],""])},Te=e=>{e!==O.total&&X((t=>Object.assign({},t,{total:e})))},Ie=e=>{we.current=e},Re=dl((e=>{Ye(),null==b||b(e)})),Oe=()=>{oe(I.length>au.virtualScrollX)},ke=(e=[])=>{let t=e.length>au.virtualScrollY;w.current.isTreeTable&&(t=!0),(null==p?void 0:p.virtual)&&(t=!0),se(t)},Le=e=>z?Ae(Pe(e,0)):e,Ae=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ae(e.children)),delete e.children,t.push(e)})),t},Pe=(e,t)=>{var n;const i=null===(n=a.groupItems)||void 0===n?void 0:n[t];if(!i)return e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e;return Ca(e,[i.dataIndex]).map((e=>{const n={children:Pe(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&ua(n,r.toString(),ya()),i.titleIndex&&ua(n,i.titleIndex,da(e[0],i.titleIndex)),ua(n,i.dataIndex,da(e[0],i.dataIndex)),F.forEach((e=>{var t;const{dataIndex:r}=e,i=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[au.summaryIgnore])return e;const n=Number(da(t,r));return Number.isNaN(n)?e:e+n}),0);ua(n,r,i)})),n}))},_e=e=>{re(e),ae((e=>{const{selectionRows:t,recordsMap:n}=w.current,r=new Map;t.forEach((e=>r.set(E(e,e.index),e)));const i=[];for(let t=0,l=e.length;t<l;t++){const l=r.get(e[t])||n.get(e[t]);l&&i.push(l)}return i})(e))},De=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:D;let i=[];return w.current.isTreeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:l}=w.current,a=ta(i,e);let o=[];if(!a)return o;let s=He((null==a?void 0:a.children)||[]);return r&&(s=s.filter((e=>!l.has(e)||!r(l.get(e))))),o=[...new Set([...t,...s])],((null===(n=Na(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=ta(i,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>o.includes(e.rowKey)));o=r?[...o,e]:o.filter((t=>t!==e))})),o})(e,r))})),i="radio"===t?r.slice(0,1):[...new Set([...r,...i])],i},He=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...He(e[n].children)),t.push(e[n].rowKey);return t},Me=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Me(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...Me(e,n[n.length-1])),n},Fe=dl((()=>{null==g||g(O,qe(L),$e(A),P,{currentDataSource:et()})})),$e=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},qe=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},je=(e,t)=>{const n=Object.keys(ca(e,t));return 1===n.length&&(n.includes(au.currentPageName)||n.includes(au.pageSizeName))},Ke=()=>Mn(void 0,void 0,void 0,(function*(){var t;if(!h)return;let n=Qn(h,["fetch"]);if(h.fetch){const{api:e,params:r,dataKey:i}=h.fetch;try{const l=yield e(r);200===l.code&&(n=null!==(t=i?ue(l.data,i):l.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;he((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=Xl(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:i,secretName:l}=r,a=Ql(w.current.originColumns,t);ce(t,{visible:n,disabled:i,secretName:l}),n||(e.noAuth=!0,a.noAuth=!0),l&&(e.formatType=`secret-${l}`,a.formatType=`secret-${l}`)}}));null==f||f(t)}})),ze=()=>Mn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:i=Wn,afterFetch:l,callback:s}=o;if(!i(_))return;const c=!!(null===(e=null==a?void 0:a.fetch)||void 0===e?void 0:e.api);J(!0);try{const[e,i]=c?yield Promise.all([o.api(r(_)),a.fetch.api(r(_))]):[yield o.api(r(_))];if(w.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:au.dataKey;let a=null!==(n=ue(e.data,r))&&void 0!==n?n:[];a="function"==typeof l?yield l(a):a;const c=ue(e.data,r.replace(/[^.]+$/,au.totalKey))||a.length||0,d=Math.max(Math.ceil(c/O.pageSize),1);if(_[au.currentPageName]>d)return Xe(Object.assign(Object.assign({},O),{current:d}));Be(we.current?w.current.tableFullData.concat(a):a),Te(c),Ue((null==i?void 0:i.data)||e.data),null==s||s(e.data,e)}}catch(e){null==x||x(e)}var d,u;d=o,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(o.stopToFirst=!1),J(!1),Ie(!1)})),Ve=dl(ze),We=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=We(e.children)),e.index=t,m||(e.pageIndex=(e=>{const{current:t,pageSize:n}=O;return!$||j?e:(t-1)*n+e})(t)),e))),Be=e=>{const t=Le(We(e));nt(t),rt(t),_e(De()),ie((e=>{const{isTreeTable:t,allRowKeys:n,allParentRowKeys:r,deriveRowKeys:i,recordsMap:l}=w.current,{defaultExpandAllRows:a,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:[...H];if(a)c=t?r:n;else if(t){s&&nr("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];M&&e.unshift(M),e.forEach((e=>{const t=Na(i,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)})),c=[...new Set(c)]}return o&&c.filter((e=>{const t=l.get(e);return!!t&&o(t)})),c})()),Ge(),null==y||y(t)},Ue=e=>{var t,n,r;if(!K)return;const i=null!==(n=null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:au.summationKey,l=null!==(r=i?ue(e,i):e)&&void 0!==r?r:{},o={};F.filter((e=>!!e.summation.dataKey)).forEach((e=>{ua(o,e.dataIndex,Number(da(l,e.summation.dataKey)))})),pe(o)},Ge=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=et();if(e.length){const t=E(e[0],e[0].index);_e([t])}else _e([])}},Ye=()=>{if(!j)return;const e=Qe();we.current||O.current>=e||(Ie(!0),Xe(Object.assign(Object.assign({},O),{current:O.current+1})))},Xe=({current:e,pageSize:t})=>{X((n=>Object.assign({},n,{current:e,pageSize:t})))},Qe=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Ze=()=>{Xe(Object.assign({},O,{current:1}))},Je=()=>{const{current:e,pageSize:t}=O;return w.current.tableFullData.slice((e-1)*t,e*t)},et=()=>q?Je():w.current.tableFullData,tt=()=>{const{allTableData:e,isTreeTable:t}=w.current,n=q?na(Je()):e,r=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=E(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;ke(r),U(r)},nt=e=>{W(e),G(e),Y(e),it(),tt()},rt=e=>{B(e)},it=()=>{ve(),w.current.allTableData.forEach((e=>me(E(e,e.index),e)))},lt=()=>{ee({})},at=()=>{te({})},ot=()=>{ne([])},st=()=>{_e([])};return{initialTable:()=>{Ke(),Ne(),Oe(),ke(),$?ze():Be(l)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&nr("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:nt,getTableData:ze,createTableList:et,createTableData:Be,createGroupData:Le,setSelectionKeysEffect:_e,findParentRowKeys:Me,getAllChildRowKeys:He,doFieldValidate:(e,t,n,r,i)=>{if(!Array.isArray(e))return nr("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(be.removeFromRequired({x:n,y:r}),be.removeFromValidate({x:n,y:r}),e.forEach((e=>{var l;e.required&&Yn(t)&&be.addToRequired({x:n,y:r,text:e.message||i+ye("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(l=e.validator)||void 0===l?void 0:l.call(e,t))||be.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:i}=be.state,l=xe(n,i),a=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:a(e),validate:a(t),inserted:n.filter((e=>!l.includes(e))),updated:r.filter((e=>![...xe(r,n),...xe(r,i)].includes(e))),removed:i.filter((e=>!l.includes(e)))}},dataChange:()=>{null==v||v(w.current.tableFullData)},tableChange:Fe,toLastPage:()=>{const e=Qe();O.current!==e&&Xe(Object.assign({},O,{current:e}))},toFirstPage:Ze,getPageCount:Qe,pagerChangeHandle:Xe,scrollBottomDebouncer:Re,clearTableSorter:lt,clearTableFilter:at,clearSuperFilters:ot,clearRowSelection:st,clearRowHighlight:()=>{le("")},clearTableLog:()=>{be.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;ge(),be.destroy(),e.deregister(t)}}},pu=(e,n)=>{const{height:r,minHeight:i,maxHeight:l,ellipsis:a,showHeader:o,spanMethod:s}=e,{getRowKey:c,tableRef:d,topElementRef:u,tableElementRef:p,tableBodyRef:h,$size:m,tableColumns:f,flattenColumns:g,leftFixedColumns:v,derivedMergeCells:y,tableFlatData:b,layout:x,showFooter:E,showPagination:w,isFullScreen:C,setLayout:S,setElementStore:N,setShouldToTop:T}=n,I=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,n={};return i&&Object.assign(n,{minHeight:`${sa(i)}px`}),l&&Object.assign(n,{maxHeight:`${sa(l)}px`}),C?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${sa(r)}px`:`${t}px`}):n}),[r,l,i,C,x]),R=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r,rowHeight:i}=d.current;if(void 0!==t&&t>=0)if(t<b.length)if(r)h.current.scrollToYIndex(t);else{const e=O(c(b[t],b[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*i);else if(r){const t=b.findIndex((t=>e===c(t,t.index)));t>=0&&h.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",p.current)},tableStyles:I,getSpan:(e,t,n,r,i)=>{let l=1,a=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(o)?(l=o[0],a=o[1]):ae(o)&&(l=o.rowSpan,a=o.colSpan)}if(y.length>0){const e=y.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,a=e.colSpan)}return{rowSpan:l,colSpan:a}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=Ql(f,e);e=t?Zl(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=Ql(f,e);e=t?Jl(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 i=n[t];if(i.dataIndex===e)break;r+=i.width||i.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,i=v.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),l=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(l-i)},scrollYToRecord:R,calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=d.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(w?Oo["small"!==m?"middle":m]+Bd:0)-Bd;S((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{d.current.shouldToTop&&R("",0),T(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=d.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=au,i=[];let l=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,l+=e.width):(e.renderWidth=void 0,i.push(e))})),i.length>0){const e=g.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===i.length)i[0].renderWidth=(i[0].minWidth||r)+t;else{const e=t/i.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;i.forEach(((t,i)=>{if(0===i)return;const l=Math.floor((t.minWidth||r)*e);n+=l,t.renderWidth=(t.minWidth||r)+l})),i[0].renderWidth=(i[0].minWidth||r)+t-n}}else i.forEach((e=>{e.renderWidth=e.minWidth||r}));S((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else l=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>Object.assign(Object.assign({},e),{tableBodyWidth:l})));S((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&h.current.resetItemXSize(g)})(),Un((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=d.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,i=o?e.$header.offsetHeight:x.headerHeight,l=E?e.$footer.offsetHeight:x.footerHeight,a=r-i-l,s=e.$tableBody.offsetHeight;let c=0;if(C){const t=e.$toper?e.$toper.offsetHeight+Bd:0,r=e.$pager?e.$pager.offsetHeight+Bd:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:i,footerHeight:l,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function hu({handler:t,delay:n=0}){const r=wl(t,n),i=$n(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",i),()=>window.removeEventListener("resize",i))),[i])}const mu=e=>{const{total:n}=e,{tableRef:r,prefixCls:i,selectionKeys:l,isHeadSorter:a,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearRowSelection:u,clearRowHighlight:p}=t.useContext(zd),{infoBarConfig:h,rowSelection:m,rowHighlight:f}=r.current.props,{allTableData:g,invalidRowKeys:v}=r.current,{hideAlert:y,hideClearButton:b}=h||{},{t:x}=Fn(),E=t.useMemo((()=>!y),[y]),w=t.useMemo((()=>!b&&!!(a||o||m||f)),[b,a,o,m,f]),C={[`${i}__alert`]:!0};return E?t.createElement("div",{className:_e(C)},t.createElement("i",{className:"svgicon icon"},t.createElement(rt,null)),t.createElement("span",null,x("qm.table.alert.total",{total:r.current.isTreeTable?g.length:n}),m?`,${x("qm.table.alert.selected",{total:Math.max(l.length-v.length,0)})}`:""),w&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),Un((()=>s()))}},x("qm.table.alert.clear"))):null},fu=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{prefixCls:l,setFullScreen:a}=t.useContext(zd),{t:o}=Fn(),s=()=>{a(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),i?t.createElement("span",{className:`${l}-full-screen`,title:o(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(Ve,null):t.createElement(We,null))):null}));fu.displayName="FullScreen";const gu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,getTableData:l}=t.useContext(zd),{t:a}=Fn(),o=()=>{l()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${i}-reload`,title:a("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null))):null}));gu.displayName="Reload";const vu=()=>{const e={dateFormat:e=>{const t=e?h(e).format(Yd):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?h(e).format(Xd):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?h(e).format(Xd.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>ha(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>ma(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)=>{var i,l,a,o;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:p}=n,h=s||(null===(i=null==p?void 0:p(r,n))||void 0===i?void 0:i.items)||[];let m=null!==(o=null!==(a=null===(l=h.find((e=>e.value==t)))||void 0===l?void 0:l.text)&&void 0!==a?a:t)&&void 0!==o?o:"";if(Array.isArray(t)&&(m=t.map((e=>{var t,n;return null!==(n=null===(t=h.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),c>=0&&""!==m&&(m=ha(m)?new Gt(m).toFixed(c):m),d>=0&&""!==m&&(m=fa(m,d)),u){const t=e[`${Gn(u)}Format`];t?m=t(m):nr("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>Kn(e)?ba(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,l)=>{const a=da(e,r.dataIndex),o=r.render?r.render(a,e,r,i,l):t(a,r,e);return n(o)}}},yu=t.forwardRef(((e,n)=>{var r,i,l,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(sn),{tableRef:d,prefixCls:u,flattenColumns:p,summationRows:h,showSummary:m,getSpan:f}=t.useContext(zd),{tablePrint:g,showHeader:v}=d.current.props,{t:y}=Fn(),{getTitleFromCellValue:b}=vu(),x=null!==(i=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==i?i:"",E=null!==(a=null===(l=null==c?void 0:c.print)||void 0===l?void 0:l.rightLogo)&&void 0!==a?a:"",w=!(!x&&!E),C=t.useMemo((()=>Zn(ea(o,[au.expandableColumn,au.selectionColumn,au.operationColumn]))),[o]),S=t.useMemo((()=>Zn(ea(p,[au.expandableColumn,au.selectionColumn,au.operationColumn]))),[p]),N=t.useMemo((()=>Zn(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},Sa(C,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?T(t):t},I=(e,t)=>Ee(we(Ce(e),t),Se(((...e)=>Ne(...e,((e,n)=>{if(Array.isArray(e))return I(e.concat(n),t)}))))),R=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(T(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]:I(n,"dataIndex")[0]})))(n),t.push(ia(n))})),t},O=()=>{const e=(e=>{const t=[];let n=[],r=0,i=0;for(;i<e.length;){const l=e[i];r+=l.width||l.renderWidth,r<=au.printWidth?(n.push(l),i===e.length-1&&t.push(n),i++):i>0?(e.splice(0,i),N.length&&e.unshift(...N),t.push(n),n=[],r=0,i=0):(l.width=au.printWidth,n.push(l),t.push(n),i++)}return t})([...S]),t=R(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+=k(t[r],e[r],d.current.tableFullData),n+='<div class="page-break"></div>';return n+"</body></html>"},k=(e,t,n)=>{const{showLogo:r=!0}=g;let i='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,v&&(i+=["<thead>",r&&w?`<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">',x?`<img src="${x}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',E?`<img src="${E}" 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}">${xa(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${na(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:i,colSpan:l}=f(e,t,e.index,r,n);if(!i||!l)return null;return`<td rowspan="${i}" colspan="${l}">${0===r&&e._level?`<span style="padding-left:${e._level*au.treeTable.textIndent}px"></span>`:""}${b(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),m&&h.length&&(i+=["<tfoot>",h.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:i,summation:l}=t,a=(null==l?void 0:l.render)?l.render(n):da(e,`${i}_text`);return`<td>${0===r&&""===a?y("qm.table.config.summaryText"):Kn(a)?ba(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},L=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:i}=e,l=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!i)return Promise.resolve({type:r,content:t,blob:e});gl(e,l)}})({filename:"print",type:"html",isDownload:!1},O()))||void 0===e||e.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),d.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 t.useImperativeHandle(n,(()=>({clickHandle:L}))),s?t.createElement("span",{className:`${u}-print`,title:y("qm.table.print.text"),onClick:()=>L()},t.createElement("i",{className:"svgicon icon"},t.createElement(it,null))):null}));yu.displayName="TablePrint";const bu="606060",xu="thin",Eu="d4d4d4",wu=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Cu=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Su=()=>({top:{style:xu,color:{argb:Eu}},left:{style:xu,color:{argb:Eu}},bottom:{style:xu,color:{argb:Eu}},right:{style:xu,color:{argb:Eu}}}),Nu=e=>{const{children:t}=e;return t&&t.length?Nu(t[0]):e},Tu=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},Iu=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:i}=t.useContext(zd),{spanMethod:l,showHeader:a}=e.current.props,{t:o}=Fn(),s=(e,t)=>{var n,r,i;return null!==(i=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==i?i:""};return{exportXLSX:(t,s,c,d)=>Mn(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:p}=t,{rowHeight:h}=e.current,m=Ul(u),f=ia(u),g=[],v=[],y=[],b=[];let x=0;const E={};m.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;E[t]=xa(e.title),y.push({key:t,width:(n||r||au.defaultColumnWidth)/8})})),a&&(i?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,l=Nu(e),a=m.findIndex((({dataIndex:e})=>e===l.dataIndex));n[l.dataIndex]=xa(e.title),0!==r&&(r>1||i>1)&&b.push({s:{r:t,c:a},e:{r:t+i-1,c:a+r-1}})})),g.push(n)})):(m.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&b.push({s:{r:x,c:t},e:{r:x+r-1,c:t+n-1}})})),g.push(E)),x+=g.length);const w=na(s).map(((e,t)=>{const r={};return m.forEach(((i,a)=>{if("function"==typeof l){const{rowSpan:r,colSpan:l}=n(e,i,t,a,s);(l>1||r>1)&&b.push({s:{r:t+x,c:a},e:{r:t+x+r-1,c:a+l-1}})}const o=["percent","finance"].includes(i.formatType);r[i.dataIndex]=o?da(e,i.dataIndex):d(e,t,i,a)})),r._level=e._level,r}));x+=w.length,r&&p&&c(m,s).forEach(((e,t)=>{const n={};m.forEach(((t,r)=>{const{dataIndex:i,summation:l}=t,a=(null==l?void 0:l.render)?l.render(s):da(e,i);n[i]=0===r&&""===a?o("qm.table.config.summaryText"):Kn(a)?ba(a).join(""):a})),v.push(n)}));const{sheetName:C,useStyle:S}=t,N=new ln.Workbook,T=N.addWorksheet(C);T.columns=y,a&&T.addRows(g).forEach((e=>{S&&wu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Ql(u,t.key),{align:r,theadAlign:i}=n;Cu(e,i||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:bu}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Su()})}))})),T.addRows(w).forEach(((e,t)=>{const{_level:n}=w[t];S&&wu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),r=Ql(u,t.key),{align:i}=r;Cu(e,i),Object.assign(e,Tu(r)),S&&Object.assign(e,{font:{color:{argb:bu}},border:Su()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),r&&p&&T.addRows(v).forEach((e=>{S&&wu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Ql(u,t.key),{align:r}=n;Cu(e,r),Object.assign(e,Tu(n)),S&&Object.assign(e,{font:{color:{argb:bu}},border:Su()})}))})),b.forEach((({s:e,e:t})=>{T.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const I=yield N.xlsx.writeBuffer();return new Blob([I],{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,i,l,a="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],r=0;r<i.cells.length;r+=1)l=i.cells[r],a=a+(r?",":"")+n(l.textContent.trim());a+="\r\n"}return a})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var i;return((e,t,n)=>{t=t||"",n=n||512;const r=window.atob(e),i=[];let l;for(l=0;l<r.length;l+=n){const e=r.slice(l,l+n),t=new Array(e.length);let a;for(a=0;a<e.length;a+=1)t[a]=e.charCodeAt(a);const o=new window.Uint8Array(t);i.push(o)}return new window.Blob(i,{type:t})})((i=r,window.btoa(unescape(encodeURIComponent(i)))),"application/csv")},importXLSX:(e,t)=>{const{columns:n,file:r}=e,i=Ul(n),l=new FileReader;l.onerror=()=>{R.error(o("qm.table.import.error"))},l.onload=e=>{const n=i.map((e=>xa(e.title))),r=new ln.Workbook,l=e.target;l?r.xlsx.load(l.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),l=e.findIndex((e=>e&&e.length>0)),a=e[l],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,a);if(c){const r=e.slice(l+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let i=e;Array.isArray(null==i?void 0:i.richText)&&(i=i.richText.map((e=>e.text)).join("")),ae(i)&&"text"in i&&(i=i.text),Te(i)&&(i=va(i,Xd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[a[n]]=i}));const r={};return n.forEach(((e,n)=>{var l;const{dataIndex:a,dictItems:o}=i[n];Array.isArray(o)&&((null===(l=t[e])||void 0===l?void 0:l.toString().includes(","))?t[e]=t[e].split(",").map((e=>s(o,e))).filter((e=>""!==e)):t[e]=s(o,t[e])),ua(r,a,t[e])})),r}));null==t||t(r)}else R.error(o("qm.table.import.error"))}else R.error(o("qm.table.import.error"))})):R.error(o("qm.table.import.error"))},l.readAsArrayBuffer(r)}}},Ru=e=>{const{fileType:n,onChange:r}=e,{prefixCls:i}=t.useContext(zd),{t:l}=Fn();let a,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}},c=()=>Mn(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),o=document.createElement("input"),a.className=`${i}--file-form`,o.name="file",o.type="file",a.appendChild(o),document.body.appendChild(a)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=i=>{const{files:c}=i.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?(R.warning(l("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(a),a=null,o=null},a.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(rr,{onClick:()=>c()},l("qm.upload.text"))},Ou=e=>{const{columns:n,onClose:r}=e,{tableRef:i,prefixCls:l,createTableData:a,dataChange:o}=t.useContext(zd),{beforeTableImport:s}=i.current.props,{t:c}=Fn(),{importXLSX:d}=Iu(),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState(!0),g=e=>e.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))),v={posIndex:"条"},[y,b]=t.useState([{type:"INPUT",label:c("qm.table.export.fileName"),fieldName:"fileName",render:(e,n)=>{const{fileName:r}=n.GET_FIELDS_VALUE(["fileName"]);return t.createElement(t.Fragment,null,r?t.createElement("span",null,r):t.createElement(Ru,{fileType:n.state.formData.fileType,onChange:(e,t)=>{n.SET_FIELDS_VALUE({fileName:e,file:t}),t&&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=>{y.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,"insert"===e&&u.current.SET_FIELDS_EXTRA(v),b([...y])}},{type:"INPUT_NUMBER",label:c("qm.table.import.insertPos"),fieldName:"posIndex",hidden:!0,rules:[{required:!0}],options:{min:0,max:i.current.tableFullData.length,formatter:e=>`第 ${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","),parser:e=>e.replace(/第\s?|(,*)/g,"")},extra:{labelWidth:50}}]);return t.createElement("div",{className:`${l}-import__setting`},t.createElement(hd,{ref:u,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:v,items:y,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(rr,{type:"primary",loading:p,disabled:m,onClick:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||(h(!0),d({columns:g(n),file:t.file},(e=>Mn(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:l}=i.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&a(e),"add"===t.importType&&a([...n,...e]),"insert"===t.importType){const r=t.posIndex,i=n.slice(0,r).concat(e).concat(n.slice(r));a(i)}e.forEach((e=>{l.addToInserted(e)})),o(),R.success(c("qm.table.import.success",{total:e.length})),h(!1),r()})))))}))},c("qm.table.import.text"))))},ku=t.forwardRef(((e,n)=>{const{tableColumns:r,open:i=!0}=e,{prefixCls:l}=t.useContext(zd),{t:a}=Fn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${l}-import`]:!0},u={visible:o,title:a("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:_e(d),title:a("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(lt,null))),t.createElement(Ll,u,t.createElement(Ou,{columns:r,onClose:()=>s(!1)})))}));ku.displayName="TableImport";const Lu=e=>{const{columns:n,onChange:r}=e,{prefixCls:i,$size:l}=t.useContext(zd),{t:a}=Fn(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);$i((()=>{h()}),[d]),t.useEffect((()=>{p()}),[n]);const p=()=>{const e=[];n.forEach(((t,r)=>{const i=t.colSpan;i>1&&n.slice(r+1,r+i).every((({colSpan:e})=>0===e))&&e.push(n.slice(r,r+i))})),o.current=e},h=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const i=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===i)return e.push(t);e.push(...o.current[i].map((({dataIndex:e},n)=>{const r=d.find((t=>t.dataIndex===e));return n>0&&void 0!==t.hidden&&(r.hidden=t.hidden),r})))})),null==r||r(e)},m={[`${i}__popper`]:!0,"column-filter__popper":!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l},f=[`${i}-column-filter`,{selected:s}];return t.createElement(uc,{action:["click"],popupVisible:s,popup:t.createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"main"},t.createElement(rn,{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));he(t,n)||u(Ra(e))}},d.map((e=>((e,n)=>{const{colSpan:r}=e;if(0===r)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${n}-handle`];return t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),t.createElement("i",{className:_e(i),title:a("qm.table.columnFilter.draggable")},t.createElement(Ue,null)),t.createElement("span",{className:"text"},xa(e.title)))})(e,"main")))))),popupClassName:_e(m),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Zd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:_e(f),title:a("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(at,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},Au=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:l,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(zd),{rowSelection:d}=l.current.props,{t:u}=Fn(),p=t.useRef(null),[m,f]=t.useState(!1),g=t.useMemo((()=>Object.assign({},{fileName:`${h().format(Qd)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:c?1:0,useStyle:0},n,{columns:Zn(n.columns||[])})),[]),[v,y]=t.useState([{type:"INPUT",label:u("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:u("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:u("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:u("qm.table.export.all"),value:"all"},{text:u("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==(null==d?void 0:d.type)},{text:u("qm.table.export.custom"),value:"custom"}]},onChange:e=>{v.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,y([...v])}},options:{min:1},disabled:!0},{type:"INPUT",label:u("qm.table.columnFilter.text"),fieldName:"columns",render:(e,n)=>t.createElement(Lu,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:u("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:u("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return t.createElement("div",{className:`${a}-export__setting`},t.createElement(hd,{ref:p,initialValues:g,items:v,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(rr,{type:"primary",loading:m,onClick:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield p.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);i(t),yield Bn(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},Pu=t.forwardRef(((e,n)=>{var r;const{tableColumns:i,open:l=!0}=e,{global:a}=t.useContext(sn),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:p,isGroupSubtotal:m,showSummary:f,getSpan:g}=t.useContext(zd),{exportExcel:v,fetch:y,showHeader:b}=o.current.props,{t:x}=Fn(),{getTitleFromCellValue:E}=vu(),[w,C]=t.useState(!1),[S,N]=t.useState(!1),T=t.useMemo((()=>{var e;return!!(null===(e=null==v?void 0:v.fetch)||void 0===e?void 0:e.api)}),[v]),I=t.useMemo((()=>!d.total||S),[d.total,S]),O=t.useMemo((()=>ea(i,[au.expandableColumn,au.selectionColumn,au.operationColumn])),[i]),k=t.useMemo((()=>ea(c,[au.expandableColumn,au.selectionColumn,au.operationColumn])),[c]),L=(e,t="",n=0)=>e.map(((e,r)=>{const i=Object.assign(Object.assign({},e),{index:r,pageIndex:r}),l=t?`${t}.${i.index+1}`:`${i.index+1}`;return i.indexPath=l,i._level=n,Array.isArray(e.children)&&(i.children=L(e.children,l,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&ua(i,t,da(i,t))})),i})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(m?Ea(t):t).reduce(((e,t)=>{if(null==t?void 0:t[au.summaryIgnore])return e;const n=Number(da(t,r));return Number.isNaN(n)?e:e+n}),0);ua(n,r,i)})),[n]},P=(e,t,n,r)=>{const{precision:i,formatType:l}=n;let a=E(e,n,t,r);return i>=0&&!l&&""!==a&&(a=Number(a)),a},{exportXLSX:_,exportCSV:D}=Iu(),H=e=>Mn(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:i,dataKey:l}=y;let a=[];try{N(!0);const o=yield n(Object.assign(Object.assign({},r(u)),{[au.currentPageName]:1,[au.pageSizeName]:null!=e?e:d.total}));if(200===o.code){let e=Array.isArray(o.data)?o.data:null!==(t=ue(o.data,l))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,a=L(e)}}catch(e){}return N(!1),a})),M=e=>{var t;const n=null===(t=null==a?void 0:a.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},F=(e,t)=>{const{columns:n,footSummation:r}=e,i=ia(n),l=Ul(n);let a='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${l.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,b&&(a+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${xa(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(a+=`<tbody>${na(t).map((e=>`<tr>${l.map(((n,r)=>{const{rowSpan:i,colSpan:l}=g(e,n,e.index,r,t);return i&&l?`<td rowspan="${i}" colspan="${l}">${P(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(a+=["<tfoot>",A(l,t).map((e=>`<tr>${l.map(((n,r)=>{const{dataIndex:i,summation:l}=n,a=(null==l?void 0:l.render)?l.render(t):da(e,i);return`<td>${0===r&&""===a?x("qm.table.config.summaryText"):Kn(a)?ba(a).join(""):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},$=null!==(r=null==v?void 0:v.fileName)&&void 0!==r?r:`${h().format(Qd)}.xlsx`,q=$.slice($.lastIndexOf(".")+1).toLowerCase(),j=()=>{if(I)return R.warning(x("qm.table.export.warnText"));var e;T?(e=$,Mn(void 0,void 0,void 0,(function*(){N(!0);try{const{api:t,params:n}=v.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:i}=e.filter||{};return{title:t,dataIndex:n,type:i,hidden:r}}))},u),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[au.currentPageName]:void 0,[au.pageSizeName]:void 0}));r.data&&(gl(r.data,e),M(e))}catch(e){}N(!1)}))):C(!0)};t.useImperativeHandle(n,(()=>({clickHandle:j})));const K={[`${s}-export`]:!0},z={visible:w,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},V={fileName:$.slice(0,$.lastIndexOf(".")),fileType:q,columns:O,useStyle:(null==v?void 0:v.cellStyle)?1:0};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:_e(K),title:x("qm.table.export.textNoSpace"),onClick:()=>j()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ke,null))),t.createElement(Ll,z,t.createElement(Au,{defaultValue:V,onClose:()=>C(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:Gl(e.columns)}),Mn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:i=1,endIndex:l}=t,{tableFullData:a,selectionRows:s}=o.current;let c=[];if(p?("all"===r&&(c=yield H()),"custom"===r&&(c=yield H(l),c=c.slice(i-1))):("all"===r&&(c=a.slice(0)),"custom"===r&&(c=a.slice(i-1,l||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==v?void 0:v.beforeExport))try{c=null==v?void 0:v.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield _(t,c,A,P);gl(n,`${e}.xlsx`),M(`${e}.xlsx`)}if("csv"===n){const n=D(t,F(t,c));gl(n,`${e}.csv`),M(`${e}.csv`)}}))}})))}));Pu.displayName="TableExport";const _u=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:l,prefixCls:a,dataChange:o}=t.useContext(zd),{beforeClipboard:s}=i.current.props,{t:c}=Fn(),d=t.useRef(null),[u,p]=t.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:n.map(((e,t)=>({value:t,text:xa(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}]}]),[h,m]=t.useState(!1);return t.createElement("div",{className:`${a}-clipboard__setting`},t.createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),t.createElement(hd,{ref:d,initialValues:{},initialExtras:{rowIndex:"行",colIndex:"列"},items:u,cols:1,labelWidth:100}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(rr,{type:"primary",loading:h,onClick:()=>Mn(void 0,void 0,void 0,(function*(){var e;const[t,a]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:p,fieldAuth:h}=i.current;m(!0);const f=a.content.trim().replace(/(\r|\n)$/,"");let g=f.replace(/"[^"]+"/g,"^");((null===(e=f.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{g=g.replace(/\^/,e)}));let v=g.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{v=yield s(v,v[0].map(((e,t)=>n[a.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var i,l;const o=u[a.rowIndex-1+t],s=n[a.colIndex+r];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||(null===(i=e.extra)||void 0===i?void 0:i.disabled)||(null===(l=h[s.dataIndex])||void 0===l?void 0:l.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(ua(o,s.dataIndex,e),p.addToUpdated(o))}}))})),l.current.forceUpdate(),o(),R.success(c("qm.table.clipboard.success",{total:v.length})),m(!1),r()}))},c("qm.table.clipboard.text"))))},Du=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,flattenColumns:l}=t.useContext(zd),{t:a}=Fn(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))))(l)),[l]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${i}-clipboard`]:!0},p={visible:o,title:a("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:_e(u),title:a("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(ot,null))),t.createElement(Ll,p,t.createElement(_u,{columns:c,onClose:()=>s(!1)})))}));Du.displayName="TableClipboard";const Hu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:l,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext(zd),{rowKey:s,rowSelection:c}=i.current.props,{t:d}=Fn(),u=t.useRef(null),p=cl(u),h=e=>e.map((e=>{var t;const n={dataIndex:e.dataIndex,title:e.title,width:e.width,minWidth:e.minWidth,precision:e.precision,dictItems:null!==(t=e.dictItems)&&void 0!==t?t:[],render:e.render};return Array.isArray(e.children)&&(n.children=h(e.children)),n})),[m,f]=t.useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...h(n.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))))]),[g]=t.useState((()=>{const{disabled:e}=c||{},t=i.current.selectionRows.map((e=>Object.assign(Object.assign({},e),{children:void 0})));return e?t.filter((t=>!e(t))):t})()),[v,y]=t.useState(300),b=dl((()=>{const e=u.current;y(e.offsetHeight-2*Oo[l]-30)}),5);return fn((()=>{b()}),[p.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(Up,{size:l,columns:m,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t.createElement("div",{style:{height:10}}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},Mu=t.forwardRef(((e,n)=>{const{columns:r,open:i=!0}=e,{tableRef:l,getRowKey:a,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:p}=t.useContext(zd),{rowSelection:h}=l.current.props,{t:m}=Fn(),[f,g]=t.useState(!1),v=t.useRef(!1);$i((()=>{!v.current&&y()}),[d]);const y=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=h;if(c&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:s},t.params));if(200===r.code){let i=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];i=i.filter((e=>!n(e))),u(i.map(((e,t)=>a(e,t)))),p(i),v.current=!0}}catch(e){}})),b=()=>{g(!0)};t.useImperativeHandle(n,(()=>({clickHandle:b})));const x={visible:f,title:m("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:`${o}-select-collection`,title:m("qm.table.selectCollection.text"),onClick:()=>b()},t.createElement("i",{className:"svgicon icon"},t.createElement(st,null))),t.createElement(Ll,x,t.createElement(Hu,{columns:r,onClose:()=>g(!1)})))}));Mu.displayName="SelectCollection";const Fu=e=>{const{onClose:n}=e,{global:r}=t.useContext(sn),{tableRef:i,getRowKey:l,prefixCls:a,$size:o,tableFlatData:s,flattenColumns:c,pagination:d,setPagination:u,scrollYToRecord:p,setHighlightKey:h,setShouldToTop:m,isWebPagination:f}=t.useContext(zd),{uniqueKey:g}=i.current.props,{t:v}=Fn(),y=t.useRef(null),b=t.useRef(null),x=t.useRef([]),E=t.useRef(""),w=t.useRef(-1),C=t.useRef("stop");$i((()=>{const e=s.findIndex((e=>l(e,e.index)===E.current));p("",e)}),[d.current]);const S=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},N=e=>e.filter((e=>null==e?void 0:e.dataIndex)).map((e=>{var t;return{type:S(e.filter.type),fieldName:e.dataIndex,label:xa(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:null!==(t=e.dictItems)&&void 0!==t?t:[]},onChange:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield y.current.GET_FORM_DATA(),[n,r]=yield b.current.GET_FORM_DATA(),i=Ie(Object.assign({},t,r),Yn);k(i)}))}})),T={case:0,fullchar:0},I=t.useMemo((()=>c.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[R,k]=t.useState({}),[L,P]=t.useState(T),[_]=t.useState(N([I[0]])),[D]=t.useState(N(I.slice(1))),[H,F]=t.useState(0),$=t.useMemo((()=>!Object.keys(R).length),[R]);$i((()=>{C.current="ready"}),[R,L]);const q=e=>{P(Object.assign({},L,e))},j=(e,t,n)=>new Promise(((r,i)=>{A.confirm({title:v("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),K=e=>Mn(void 0,void 0,void 0,(function*(){if(!Object.keys(R).length)return A.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.queryCondition")});if("ready"===C.current&&(C.current="stop",x.current=(e=>{const{allTableData:t}=i.current,n=[];for(let i=0,l=t.length;i<l;i++){const l=t[i];let a=!0;for(const t in e){const{type:n}=I.find((e=>e.dataIndex===t)).filter;let i=da(l,t),o=!0;if("text"===n||"textarea"===n?o=new RegExp(L.fullchar?`^${e[t]}$`:e[t],L.case?"":"i").test(i):(i="string"==typeof(r=i)&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(r)?i.slice(0,10):i,o=i==e[t]),!o){a=!1;break}}a&&n.push(l)}var r;return n})(R),F(x.current.length)),!x.current.length)return h(""),A.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.notMatch")});"next"===e&&(w.current=w.current<0?0:w.current+1,w.current>x.current.length-1&&(yield j(v("qm.table.fastSearch.toTheEnd"),(()=>w.current=0),(()=>w.current=x.current.length-1)))),"prev"===e&&(w.current=w.current<0?x.current.length-1:w.current-1,w.current<0&&(yield j(v("qm.table.fastSearch.toStart"),(()=>w.current=x.current.length-1),(()=>w.current=0))));const{isTreeTable:t,tableFullData:n,deriveRowKeys:r}=i.current,a=x.current[w.current],o=l(a,a.index);let s=a.index;if(t&&f){const e=Na(r,o)[0];s=n.findIndex((t=>l(t,t.index)===e))}((e,t)=>{if(E.current=e,f){const{pageSize:e}=d,n=Math.ceil((t+1)/e);m(!1),u(Object.assign({},d,{current:n}))}else p(e)})(o,s),h(o)})),z=()=>{y.current.RESET_FORM(),b.current.RESET_FORM()},V=t.useMemo((()=>g?`fastSearch_${g}`:""),[g]),[W,B]=t.useState([]),[U,G]=t.useState(""),[Y,X]=t.useState("");$i((()=>{if(Y){const{filters:e,config:t}=W.find((e=>e.value===Y)).list;y.current.SET_FIELDS_VALUE(Qn(e,D.map((e=>e.fieldName)))),b.current.SET_FIELDS_VALUE(Qn(e,_.map((e=>e.fieldName)))),k(e),P(t)}else z(),k({}),P(T)}),[Y]),t.useEffect((()=>{Q()}),[]);const Q=()=>Mn(void 0,void 0,void 0,(function*(){if(!V)return;let e=yield an.getItem(V);e||(e=yield Z(V),Array.isArray(e)&&(yield an.setItem(V,e))),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))})),Z=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),J=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"top"},t.createElement("div",{className:"container"},t.createElement(Il,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,v("qm.table.alert.total",{total:H}))},t.createElement(Il.TabPane,{tab:v("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t.createElement(hd,{ref:y,items:_,cols:1,labelWidth:110})),t.createElement(Il.TabPane,{tab:v("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t.createElement(hd,{ref:b,items:D,cols:1,labelWidth:110})))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:o,value:U,placeholder:v("qm.table.highSearch.configText"),disabled:$,onChange:e=>{const{value:t}=e.target;G(t)}}),t.createElement(rr,{type:"primary",disabled:!U||$,style:{marginLeft:"10px"},onClick:()=>Mn(void 0,void 0,void 0,(function*(){if(!V)return nr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ya(),t=[...W,{text:U,value:e,list:{filters:R,config:L}}];B(t),X(e),G(""),yield an.setItem(V,t),yield J(V,t)}))},v("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${au.rowHeightMaps[o]}px`}},t.createElement("span",null,v("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,W.map((e=>t.createElement("li",{key:e.value,className:_e({selected:e.value===Y}),title:e.text,onClick:()=>{return t=e.value,void X(t!==Y?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:v("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Mn(void 0,void 0,void 0,(function*(){if(!n)return;const e=W.filter((e=>e.value!==n));B(e),n===Y&&X(""),yield an.setItem(V,e),yield J(V,e)}))}},t.createElement(ct,null))))),!W.length&&t.createElement("div",{style:{padding:Bd}},t.createElement(nl,null)))))),t.createElement("div",{className:"bottom"},t.createElement("div",null,t.createElement(M,{checked:!!L.case,onChange:e=>q({case:e.target.checked})},v("qm.table.fastSearch.matchCase")),t.createElement(M,{checked:!!L.fullchar,onChange:e=>q({fullchar:e.target.checked})},v("qm.table.fastSearch.matchFullchar"))),t.createElement("div",null,t.createElement(rr,{onClick:()=>z()},v("qm.table.fastSearch.clear"))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Oo[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>n(),style:{marginRight:8}},v("qm.table.fastSearch.closeButton")),t.createElement(rr,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},v("qm.table.fastSearch.queryPrev")),t.createElement(rr,{type:"primary",onClick:()=>K("next")},v("qm.table.fastSearch.queryNext"))))},$u=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,$size:l}=t.useContext(zd),{t:a}=Fn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:a("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${Oo[l]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:a("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(dt,null))),t.createElement(Ll,d,t.createElement(Fu,{onClose:()=>s(!1)})))}));$u.displayName="FastSearch";const qu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{tableRef:i,prefixCls:l,flattenColumns:a}=t.useContext(zd),{rowKey:o,uniqueKey:s}=i.current.props,{t:c}=Fn(),{tableFullData:d}=i.current,[u,p]=t.useState(!1),h=()=>{p(!0)};t.useImperativeHandle(n,(()=>({clickHandle:h})));const m={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>p(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>h()},t.createElement("i",{className:"svgicon icon"},t.createElement(ut,null))),t.createElement(Ll,m,t.createElement(cf,{fromTable:!0,rowKey:o,uniqueKey:s,columns:a,dataSource:d})))}));qu.displayName="PivotGrid";const ju=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:l,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext(zd),{fetch:d}=l.current.props,{t:u}=Fn(),p=e=>{var t;const r=n.find((t=>t.dataIndex===e));return{title:r.title,precision:r.precision,dictItems:null!==(t=r.dictItems)&&void 0!==t?t:[]}},m=r.map((e=>Object.assign({dataIndex:e.group},p(e.group)))),f=i.map((e=>e.summary===au.groupSummary.total.value?{dataIndex:e.summary,title:au.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},p(e.summary)),{formula:e.formula}))),g=t.useMemo((()=>Object.assign({},s,{[au.sorterFieldName]:void 0,[au.groupSummary.summaryFieldName]:i.map((e=>`${e.formula}|${e.summary}`)).join(","),[au.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[au.currentPageName]:1})),[s,r,i]),[v,y]=t.useState(((e,t)=>[{title:u("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{var t;const r=null===(t=n.find((t=>t.dataIndex===e.dataIndex)))||void 0===t?void 0:t.groupSummary;let i=r?{summation:r}:null;return e.dataIndex===au.groupSummary.total.value&&(i={dataIndex:au.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?i:null)}))])(m,f)),[b]=t.useState(c?[]:(e=>{const t=Ca(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&ua(t,r,da(e[0],r))})),i.forEach((n=>{const r=n.summary!==au.groupSummary.total.value?n.summary:au.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&ua(t,r,e.length),"sum"===i&&ua(t,r,Re(e,r)),"max"===i&&ua(t,r,Oe(e,r)[r]),"min"===i&&ua(t,r,ke(e,r)[r]),"avg"===i&&ua(t,r,(Re(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(l.current.tableFullData)),x=Object.assign(Object.assign({size:a,height:400},c?{fetch:{api:d.api,params:g,dataKey:null==d?void 0:d.dataKey}}:{dataSource:b}),{columns:v,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${h().format(Qd)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)});return t.createElement(Up,x)},Ku=e=>{const{onClose:n}=e,{global:r}=t.useContext(sn),{tableRef:i,prefixCls:l,$size:a,flattenColumns:o}=t.useContext(zd),{uniqueKey:s}=i.current.props,{t:c}=Fn(),d=t.useRef(null),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState([]),[g,v]=t.useState(""),[y,b]=t.useState("");$i((()=>{if(y){const{group:e,summary:t}=m.find((e=>e.value===y)).list;T(e),L(t)}else{const e=H();T((null==e?void 0:e.group)||[]),L((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{M()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex)))),[o]),w=E.filter((e=>!e.groupSummary)).map((e=>({text:xa(e.title),value:e.dataIndex}))),C=[au.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:xa(e.title),value:e.dataIndex})))],S=[{text:c("qm.table.groupSummary.sumText"),value:"sum"},{text:c("qm.table.groupSummary.maxText"),value:"max"},{text:c("qm.table.groupSummary.minText"),value:"min"},{text:c("qm.table.groupSummary.avgText"),value:"avg"},{text:c("qm.table.groupSummary.countText"),value:"count"}],[N,T]=t.useState([]),[I,R]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(rr,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:c("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>Object.assign(Object.assign({},e),{disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[k,L]=t.useState([]),[A,P]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(rr,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:c("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>Object.assign(Object.assign({},e),{disabled:k.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:c("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===au.groupSummary.total.value?S.slice(S.length-1):S})}]),_=t.useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=k.length&&k.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,k]),D=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}))},H=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},M=()=>Mn(void 0,void 0,void 0,(function*(){if(!x)return;const e=H();if(e){const{group:t,summary:n}=e;T(t),L(n)}let t=yield an.getItem(x);t||(t=yield F(x),Array.isArray(t)&&(yield an.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),F=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),$=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),q={visible:p,title:c("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>h(!1)};return t.createElement("div",{className:`${l}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(Up,{ref:d,size:a,columns:I,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>R(e),onDataChange:e=>{T(e)}},t.createElement(rr,{type:"primary",icon:t.createElement(pt,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(Up,{ref:u,size:a,columns:A,dataSource:k,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(e),onDataChange:e=>{L(e)}},t.createElement(rr,{type:"primary",icon:t.createElement(pt,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:a,value:g,placeholder:c("qm.table.groupSummary.configText"),disabled:_,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(rr,{type:"primary",disabled:!g||_,style:{marginLeft:"10px"},onClick:()=>Mn(void 0,void 0,void 0,(function*(){if(!x)return nr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ya(),t=[...m,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}}];f(t),b(e),v(""),yield an.setItem(x,t),yield $(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${au.rowHeightMaps[a]}px`}},t.createElement("span",null,c("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,m.map((e=>t.createElement("li",{key:e.value,className:_e({selected:e.value===y}),title:e.text,onClick:()=>{return t=e.value,void b(t!==y?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:c("qm.table.groupSummary.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Mn(void 0,void 0,void 0,(function*(){if(!n)return;const e=m.filter((e=>e.value!==n));f(e),n===y&&b(""),yield an.setItem(x,e),yield $(x,e)}))}},t.createElement(ct,null))))),!m.length&&t.createElement("div",{style:{padding:Bd}},t.createElement(nl,null)))))),t.createElement(Ll,q,t.createElement(ju,{columns:E,group:N,summary:k})),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(rr,{type:"primary",disabled:_,onClick:()=>(D(),void h(!0))},c("qm.table.groupSummary.confirmButton"))))},zu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(zd),{t:l}=Fn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:l("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-group-summary`,title:l("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(ht,null))),t.createElement(Ll,c,t.createElement(Ku,{onClose:()=>o(!1)})))}));zu.displayName="GroupSummary";const Vu=e=>{const{onClose:n}=e,{global:r}=t.useContext(sn),{tableRef:i,$size:l,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t.useContext(zd),{uniqueKey:d}=i.current.props,{t:u}=Fn(),p=t.useRef(null),[h,m]=t.useState([]),[f,g]=t.useState([]),[v,y]=t.useState(""),[b,x]=t.useState("");$i((()=>{m(b?f.find((e=>e.value===b)).list:H()||[])}),[b]),t.useEffect((()=>{M()}),[]);const E=t.useMemo((()=>d?`superSearch_${d}`:""),[d]),w=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),C=wa(h),S=t.useMemo((()=>!(C&&Wl(C))),[C]),N=t.useMemo((()=>!!h.length&&S),[h,S]),T=[{value:"and",text:u("qm.table.highSearch.andText")},{value:"or",text:u("qm.table.highSearch.orText")}],I=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:xa(e.title)}))),R=e=>["in","nin"].includes(e),k=(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:u("qm.table.highSearch.gtText")},{value:"<",text:u("qm.table.highSearch.ltText")},{value:">=",text:u("qm.table.highSearch.gteText")},{value:"<=",text:u("qm.table.highSearch.lteText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",text:u("qm.table.highSearch.inText")},{value:"nin",text:u("qm.table.highSearch.ninText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:u("qm.table.highSearch.likeText")},{value:"==",text:u("qm.table.highSearch.eqText")},{value:"!=",text:u("qm.table.highSearch.neqText")}]}return t},[A,P]=t.useState([{title:u("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(rr,{type:"text",onClick:()=>{p.current.REMOVE_RECORDS(n)}},u("qm.table.highSearch.removeText")))},{title:u("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:u("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:u("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const i=Object.values(t)[0],l=null===(n=w.find((e=>e.dataIndex===i)))||void 0===n?void 0:n.filter.type,a=L(l);e.fieldType=l,e.expression=i?null===(r=a[0])||void 0===r?void 0:r.value:"",e.condition=R(e.expression)?[]:"",i||(e.bracketLeft=e.bracketRight="")}})},{title:u("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:u("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{var t;const n=null===(t=w.find((t=>t.dataIndex===e.fieldName)))||void 0===t?void 0:t.filter.type;return{type:"select",editable:!0,items:L(n),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=R(e.expression)?[]:""}}}},{title:u("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const i=w.find((t=>t.dataIndex===e.fieldName)),l=null==i?void 0:i.filter.type,a=null!==(r=null!==(n=null===(t=null==i?void 0:i.filter)||void 0===t?void 0:t.items)&&void 0!==n?n:null==i?void 0:i.dictItems)&&void 0!==r?r:[];return{type:k(l,R(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:u("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:u("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:T,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{c(),s(h.map((e=>Qn(e,["index","pageIndex"])))),D(),n()},D=()=>{E&&sessionStorage.setItem(E,JSON.stringify(h.filter((e=>!!e.fieldName))))},H=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},M=()=>Mn(void 0,void 0,void 0,(function*(){if(!E)return;const e=H();e&&m(e);let t=yield an.getItem(E);t||(t=yield F(E),Array.isArray(t)&&(yield an.setItem(E,t))),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))})),F=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==r?void 0:r.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),$=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(Up,{ref:p,size:l,columns:A,dataSource:h,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>P(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]?"":")"),m([...h]))},onDataChange:e=>{m(e)}},t.createElement(rr,{type:"primary",icon:t.createElement(pt,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),au.highSearch.showSQL&&C&&t.createElement("code",{className:"lang-js"},C)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(O,{size:l,value:v,placeholder:u("qm.table.highSearch.configText"),disabled:S,onChange:e=>{const{value:t}=e.target;y(t)}}),t.createElement(rr,{type:"primary",disabled:!v||S,style:{marginLeft:"10px"},onClick:()=>Mn(void 0,void 0,void 0,(function*(){if(!E)return nr("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ya(),t=[...f,{text:v,value:e,list:h.filter((e=>!!e.fieldName))}];g(t),x(e),y(""),yield an.setItem(E,t),yield $(E,t)}))},u("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${au.rowHeightMaps[l]}px`}},t.createElement("span",null,u("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,f.map((e=>t.createElement("li",{key:e.value,className:_e({selected:e.value===b}),title:e.text,onClick:()=>{return t=e.value,void x(t!==b?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:u("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,Mn(void 0,void 0,void 0,(function*(){if(!n)return;const e=f.filter((e=>e.value!==n));g(e),n===b&&x(""),yield an.setItem(E,e),yield $(E,e)}))}},t.createElement(ct,null))))),!f.length&&t.createElement("div",{style:{padding:Bd}},t.createElement(nl,null)))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>n(),style:{marginRight:8}},u("qm.table.highSearch.closeButton")),t.createElement(rr,{type:"primary",disabled:N,onClick:()=>_()},u("qm.table.highSearch.searchButton"))))},Wu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(zd),{t:l}=Fn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:l("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:l("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(mt,null))),t.createElement(Ll,c,t.createElement(Vu,{onClose:()=>o(!1)})))}));Wu.displayName="SuperSearch";const Bu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:i,showReload:l,showPrint:a,showImport:o,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:p,showPivotGrid:h,showGroupSummary:m,showToolBox:f}=e,{global:g}=t.useContext(sn),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext(zd),{uniqueKey:E,exportExcel:w}=v.current.props,{t:C}=Fn(),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(null),_=t.useRef(null),D=t.useRef(!1),H=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[$,q]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),j={fullScreen:i,reload:l,print:a,import:o,export:s&&!(null==w?void 0:w.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:p,pivotGrid:h,groupSummary:m},[K,z]=t.useState(!1);$i((()=>{D.current&&(W(),D.current=!1)}),[$]),t.useEffect((()=>{V()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return nr("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const V=()=>{if(!H||!f)return;const e=JSON.parse(localStorage.getItem(H));e||B(H).then((e=>{e&&(q(Object.assign({},$,e)),localStorage.setItem(H,JSON.stringify(e)))})).catch((()=>{})),e&&q(Object.assign({},$,e))},W=()=>{if(!H||!f)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(H,JSON.stringify(e)),U(H,e)},B=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==g?void 0:g.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),U=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==g?void 0:g.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),G=e=>Mn(void 0,void 0,void 0,(function*(){z(!1),yield Bn(100),e.current.clickHandle()})),X=(e,t)=>{D.current=!0,q(Object.assign({},$,{[t]:e}))},Q={"top-toolbox__popper":!0,[`${b}--lg`]:"large"===y,[`${b}--sm`]:"small"===y};return t.createElement(t.Fragment,null,i&&t.createElement(fu,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),l&&t.createElement(gu,{ref:N,open:!f||$.reload}),a&&t.createElement(yu,{ref:T,tableColumns:r,open:!f||$.print}),o&&t.createElement(ku,{ref:I,tableColumns:r,open:!f||$.import}),s&&t.createElement(Pu,{ref:R,tableColumns:r,open:(!f||$.export)&&!(null==w?void 0:w.hideIcon)}),c&&t.createElement(Du,{ref:O,open:!f||$.clipboard}),d&&t.createElement(Mu,{ref:k,columns:r,open:!f||$.collection}),u&&t.createElement($u,{ref:L,open:!f||$.fastSearch}),h&&t.createElement(qu,{ref:A,open:!f||$.pivotGrid}),m&&t.createElement(zu,{ref:P,open:!f||$.groupSummary}),p&&t.createElement(Wu,{ref:_,open:!f||$.superSearch}),f&&t.createElement(F,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.screen.full"))),onClick:()=>G(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.refresh.text"))),onClick:()=>G(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.print.text"))),onClick:()=>G(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.import.textNoSpace"))),onClick:()=>G(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.export.textNoSpace"))),onClick:()=>G(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.clipboard.textNoSpace"))),onClick:()=>G(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.selectCollection.text"))),onClick:()=>G(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.fastSearch.text"))),onClick:()=>G(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.pivotGrid.text"))),onClick:()=>G(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.groupSummary.text"))),onClick:()=>G(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(M,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.highSearch.text"))),onClick:()=>G(_)}];return t.createElement(Y,{items:e.filter((e=>j[e.key]))})})(),overlayClassName:_e(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{z(e)}},t.createElement("span",{className:`${b}-toolbox`,title:C("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(ft,null)))))}));Bu.displayName="ToolBox";const Uu=(e,t)=>e.map((e=>(e.children&&(e.children=Uu(e.children,t)),t(e)))),Gu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:i}=t.useContext(sn),{tableRef:l,prefixCls:a,$size:o}=t.useContext(zd),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=l.current.props,{t:p}=Fn(),h=t.useRef([]),[m,f]=t.useState(!1),g=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)))(r)),[r]),v=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)))(r)),[r]),y=t.useMemo((()=>(e=>e.filter((e=>!e.noAuth&&!e.fixed)))(r)),[r]),b=t.useMemo((()=>c?`table_${c}`:""),[c]);$i((()=>{w(r)}),[r]),t.useLayoutEffect((()=>{C()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:C})));const x=()=>{if(!b)return;const e=JSON.parse(localStorage.getItem(b));var t;if(e||(t=b,Mn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(b,JSON.stringify(e)),C()):(null==i?void 0:i.getComponentConfigApi)&&w(r)})).catch((()=>{})),!e)return;return fe(Yl(e).map((e=>e.dataIndex)),Yl(r).map((e=>e.dataIndex))).length>0?Uu(r,(t=>{const n=Ql(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})):Uu(e,(e=>{const t=Ql(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},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),Object.assign({dataIndex:e.dataIndex},t)})),w=e=>{if(!b)return;const t=E(e),n=JSON.parse(localStorage.getItem(b));var r,a;l.current.columnsDefined&&!he(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,Mn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},C=()=>{const e=x();var t;e&&(t=S(e),h.current=t,null==u||u(e))},S=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const i=n.colSpan;i>1&&e.slice(r+1,r+i).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+i))})),t},N=()=>{const e=t=>t.map((t=>{const n=Ql(r,t.dataIndex)||Zn(t);return t.children&&(n.children=e(t.children)),Object.assign(n,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));null==u||u(e(l.current.originColumns))},T=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:i}=n;if(0===r)return;if(1===r)return t.push(n);const l=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===l)return t.push(n);t.push(...h.current[l].map((({dataIndex:t},r)=>{const i=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(i.hidden=n.hidden),void 0!==n.fixed?i.fixed=n.fixed:i.fixed&&delete i.fixed),i})))})),r.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),null==u||u(t)},I=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,T(r))},R=(e,n)=>{var i;const{colSpan:l,noFixed:a}=e;if(0===l)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=xa(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(M,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,T(r)}}),t.createElement("i",{className:_e(s),title:p("qm.table.columnFilter.draggable")},t.createElement(Ue,null)),t.createElement("span",{className:"text",title:o},o),"main"===n?t.createElement("span",{className:_e("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>I(e,"left")},t.createElement(gt,null)),t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},t.createElement(vt,null))):"sub"!==n?t.createElement("span",{className:_e("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>I(e)},t.createElement(ct,null))):null);return!e.hidden&&(null===(i=e.children)||void 0===i?void 0:i.length)?t.createElement(X,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:O(e.children,e.dataIndex)},c):c},O=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement(rn,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const i=t.map((e=>e.dataIndex)),l=e.map((e=>e.dataIndex));he(i,l)||((e,t)=>{Ql(r,t).children=e,null==u||u([...r])})(Ra(t),n)}},e.map((e=>R(e,"sub"))))),k={[`${a}__popper`]:!0,"column-filter__popper":!0,[`${a}--lg`]:"large"===o,[`${a}--sm`]:"small"===o},L=[`${a}-column-filter`,{selected:m}];return s?t.createElement(uc,{action:["click"],popupVisible:m,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(rr,{type:"text",size:"small",onClick:N},p("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(rn,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:g,setList:e=>{const t=e.map((e=>e.dataIndex)),n=g.map((e=>e.dataIndex));he(t,n)||T([...Ra(e),...y,...v])}},g.map((e=>R(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(rn,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:y,setList:e=>{const t=e.map((e=>e.dataIndex)),n=y.map((e=>e.dataIndex));he(t,n)||T([...g,...Ra(e),...v])}},y.map((e=>R(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(rn,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),n=v.map((e=>e.dataIndex));he(t,n)||T([...g,...y,...Ra(e)])}},v.map((e=>R(e,"right")))))),popupClassName:_e(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Zd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:_e(L),title:d?p("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(at,null)),!d&&t.createElement("span",null,p("qm.table.columnFilter.text")))):null}));Gu.displayName="ColumnFilter";const Yu=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"filter",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),Xu=e=>{const{column:n,filters:r}=e,{$size:i,prefixCls:l,setFilters:a,clearSuperFilters:o}=t.useContext(zd),{t:s}=Fn(),c=t.useRef(null),d=t.useRef(null),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState(!1),[g,v]=t.useState({}),y=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),b=t.useMemo((()=>{let e=!1;for(const t in r[y])if(!Yn(r[y][t])||m){e=!0;break}return e}),[y,r,m]);t.useLayoutEffect((()=>{p&&setTimeout((()=>x()),20)}),[p]),t.useEffect((()=>{var e;he(g[y],r[y])||v({[y]:r[y]||{}}),f(""===(null===(e=r[y])||void 0===e?void 0:e["=="]))}),[r]);const x=()=>{switch(n.filter.type){case"text":c.current.focus();break;case"number":d.current.focus();break;case"textarea":u.current.focus()}},E=e=>{e&&v(e),o(),a((e=>{for(const t in e){for(const n in e[t])if(Yn(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})(Object.assign(Object.assign(Object.assign({},r),g),e))),h(!1)},w={text:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(O,{ref:c,size:i,placeholder:s("qm.table.filter.searchText",{text:xa(e.title)}),style:{width:"180px"},value:null!==(r=null===(n=g[y])||void 0===n?void 0:n.like)&&void 0!==r?r:"",disabled:m,onChange:e=>{const{value:t}=e.target;v((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:m,onChange:e=>{const{checked:t}=e.target,n=t?"":null;v((e=>Object.assign({},e,{[y]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue"))))},textarea:e=>{var n,r;return t.createElement(t.Fragment,null,t.createElement(O.TextArea,{ref:u,size:i,placeholder:s("qm.table.filter.searchAreaText",{text:xa(e.title)}),style:{width:"220px"},value:null!==(r=null===(n=g[y])||void 0===n?void 0:n.likes)&&void 0!==r?r:"",disabled:m,onChange:e=>{const{value:t}=e.target;v((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13!==e.keyCode||e.shiftKey||(e.preventDefault(),E())}}),t.createElement("div",{style:{marginTop:8}},t.createElement(M,{checked:m,onChange:e=>{const{checked:t}=e.target,n=t?"":null;v((e=>Object.assign({},e,{[y]:{"==":n,like:null}}))),f(t)}},s("qm.table.filter.nullValue"))))},number:e=>{const n=e=>{var t,n;return{value:null!==(n=null===(t=g[y])||void 0===t?void 0:t[e])&&void 0!==n?n:"",size:i,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||v((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement($,On({ref:d},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement($,On({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement($,On({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement($,On({},n("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const n=e=>{var t;return{value:ga(null===(t=g[y])||void 0===t?void 0:t[e],Yd),format:Yd,size:i,onChange:t=>{v((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:va(t,Yd)})})))},onKeyDown:e=>{13===e.keyCode&&E()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(Rn,On({},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(Rn,On({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(Rn,On({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(Rn,On({},n("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("ul",null,t.createElement(j.Group,{style:{width:"100%"},value:null===(n=g[y])||void 0===n?void 0:n["=="],onChange:e=>{const{value:t}=e.target;v((e=>Object.assign({},e,{[y]:{"==":t}})))}},l.map((e=>t.createElement("li",{key:e.value},t.createElement(j,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("ul",null,t.createElement(M.Group,{style:{width:"100%"},value:null===(n=g[y])||void 0===n?void 0:n.in,onChange:e=>{v((t=>Object.assign({},t,{[y]:{in:e}})))}},l.map((e=>t.createElement("li",{key:e.value},t.createElement(M,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{var n;const{filter:r,dictItems:i=[]}=e,l=r.items||i;return t.createElement("div",{style:Object.assign({height:200},r.style)},t.createElement(Kd,{multiple:!0,value:(null===(n=g[y])||void 0===n?void 0:n.in)||[],dataSource:l,onCheckChange:e=>{const t=e.map((e=>e.value));v((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},C=()=>t.createElement(S,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t.createElement(rr,{size:i,onClick:()=>(E({[y]:{}}),void f(!1))},s("qm.table.filter.reset")),t.createElement(rr,{type:"primary",size:i,onClick:()=>E()},s("qm.table.filter.search"))),N={"head-filter__popper":!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i},T=["cell--filter",{selected:p,actived:b}];return t.createElement(uc,{action:["click"],popupVisible:p,popup:(()=>{const e=n.filter.type,r=w[e];return r?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement("div",null,r(n)),C()):(nr("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:_e(N),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{h(e)},builtinPlacements:Zd,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:_e(T),title:s("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(Yu,null))))},Qu=e=>{const{column:n}=e,{tableRef:r,bordered:i}=t.useContext(zd),{columns:l,resizable:a,columnsChange:o=Vn}=r.current.props,s=t.useMemo((()=>Jl(n)),[n]),c={resizable:!0,"is--line":a&&!i};return t.createElement("div",{className:_e(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:i}=r.current,a=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=oa(t,n.$table).left-i.current.scrollLeft+c;n.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const p=s.width||s.renderWidth;let h=p;return document.onmousemove=function(e){if("number"!=typeof p)return;const t=e.clientX-d,n=p+t;n<(s.minWidth||au.defaultColumnWidth)||(h=Math.floor(n),a.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof h&&(Ql(l,s.dataIndex).width=h,o([...l]))},!1}})},Zu=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:i,fetchParams:l,createTableList:a,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:d,isWebPagination:u}=t.useContext(zd),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:f,onSelectAll:g}=p,{t:v}=Fn(),y=t.useRef([]),b=t.useMemo((()=>d&&!!h),[d,h]),x=t.useMemo((()=>!b&&!!m),[b,m]),E=t.useMemo((()=>(null==f||f)&&!x),[f,x]),C=()=>{const{selectionRows:e}=r.current,{disabled:t}=p;return(t?e.filter((e=>!t(e))):e).map((e=>i(e,e.index)))},S=(()=>{const{recordsMap:e,allRowKeys:t}=r.current,{disabled:n}=p;if(b)return y.current.length?y.current:Le(t,C());if(!x)return n?t.filter((t=>!n(e.get(t)))):t;const l=n?a().filter((e=>!n(e))).map((e=>i(e,e.index))):a().map((e=>i(e,e.index)));return Le(l,C())})(),N=n.filter((e=>!S.includes(e))),T=n.length-N.length,I=T>0&&T<S.length,R=!!T&&T===S.length;s(N);const O=()=>Mn(void 0,void 0,void 0,(function*(){var e;const t=h;let n=[];c(!0);try{const r=yield t.api(l);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=ue(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:l}=p;l&&(n=fe(n,a().filter((e=>l(e))).map((e=>i(e,e.index))))),y.current=n}}catch(e){}return c(!1),n})),k=e=>Mn(void 0,void 0,void 0,(function*(){let t=[];t=b?e?yield O():[]:e?S.slice(0):[],t=[...new Set([...t,...N])],o(t),null==g||g(e,t)})),L=()=>{const e=[{key:1,label:v("qm.table.selection.all"),onClick:()=>{k(!0)}},{key:2,label:v("qm.table.selection.invert"),onClick:()=>Mn(void 0,void 0,void 0,(function*(){let e=[];e=fe(n,b?yield O():S),e=[...new Set([...e,...N])],o(e)}))},{key:3,label:v("qm.table.selection.clear"),onClick:()=>{k(!1)}}];return t.createElement(Y,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(M,{checked:R,indeterminate:I,disabled:!S.length,onChange:e=>k(e.target.checked)}),E&&t.createElement(F,{overlayClassName:"all-selection__popper",dropdownRender:()=>L()},t.createElement(He,{className:"svgicon icon"})),x&&t.createElement(w,{placement:"top",title:v("qm.table.selection.currentPage")},t.createElement(yt,{className:"info"})))},Ju=e=>{const{style:n}=e,{tableRef:r,setRowExpandedKeys:i}=t.useContext(zd),{expandable:l}=r.current.props,[a,o]=t.useState((null==l?void 0:l.defaultExpandAllRows)||!1);$i((()=>{i(a?[...r.current.allParentRowKeys]:[])}),[a]);const s={[`${ar("expand")}--icon`]:!0,expanded:a,collapsed:!a};return t.createElement("span",{className:_e(s),title:"",onClick:e=>{e.stopPropagation(),o(!a)},style:n})},ep=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-up",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),tp=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),np=e=>{const{tableColumns:n}=e,{tableRef:r,prefixCls:i,layout:l,flattenColumns:a,sorter:o,filters:s,superFilters:c,selectionKeys:d,isFetch:u,isGroupSubtotal:p,treeExpandIndex:h,tableChange:m,setSorter:f,setElementStore:g,resetTableScroll:v,getStickyLeft:y,getStickyRight:b,createGroupData:x,createTableFullData:E}=t.useContext(zd),{ellipsis:C,resizable:S,multipleSort:N,rowSelection:T,expandable:I}=r.current.props,[R,O]=au.sortDirections,{tableOriginData:k}=r.current,{t:L}=Fn(),A=t.useRef(null),P=t.useMemo((()=>k.some((e=>Array.isArray(e.children)))),[k]),_=t.useMemo((()=>!u),[u]),D=t.useMemo((()=>!u),[u]),H=t.useMemo((()=>!(null==I?void 0:I.hideExpandAll)),[I]),M=t.useMemo((()=>!!T&&(u?!(!T.selectAllOnCurrentPage&&!T.fetchAllRowKeys):!T.hideSelectAll)),[u,T]);$i((()=>{V(),m(),v()}),[o]),$i((()=>{G(),m(),v()}),[s]),$i((()=>{G(),m(),v()}),[c]),t.useEffect((()=>{!Yn(o)&&Un((()=>V())),!Yn(s)&&Un((()=>G()))}),[]),t.useLayoutEffect((()=>{F()}),[]);const F=()=>{g("$header",A.current)},$=(e,n,i)=>{var l,a,s;const{dataIndex:c,colSpan:d,rowSpan:u,fixed:p,align:h,theadAlign:m,theadClassName:f="",sorter:g,filter:v,required:x,headRender:E}=e;if(0===d)return null;const w=m||h,N=["header--column",{"col--ellipsis":null!==(l=e.ellipsis)&&void 0!==l?l:C,"col--center":"center"===w,"col--right":"right"===w,"column--required":!!x,"column-has-sorter":g,"column-has-filter":v,"column--sort":!!o[c],"cell-fix-left":"left"===p,"cell-fix-right":"right"===p,"cell-fix-left-last":"left"===p&&!(null===(a=i[n+(null!=d?d:1)])||void 0===a?void 0:a.fixed),"cell-fix-right-first":"right"===p&&!(null===(s=i[n-1])||void 0===s?void 0:s.fixed),[f]:!!f}],T={left:"left"===p?`${y(c)}px`:"",right:"right"===p?`${b(c,"thead")}px`:""},I=S&&![au.expandableColumn,au.selectionColumn].includes(c);return t.createElement("th",{key:c,className:_e(N),colSpan:d,rowSpan:u,style:Object.assign({},T),onClick:t=>z(t,e)},t.createElement("div",{className:"cell--wrapper"},E?t.createElement("div",{className:"cell--text cell"},E(e,r.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},q(e)),v?K(e):null)),I&&t.createElement(Qu,{column:e}))},q=e=>{const{dataIndex:n,type:i,sorter:l,title:a,description:s}=e;if(n===au.selectionColumn&&"checkbox"===i){if("checkbox"===i)return t.createElement("div",{className:"cell"},M?t.createElement(Zu,{selectionKeys:d}):L("qm.table.config.selectionText"));if("radio"===i)return t.createElement("div",{className:"cell"},a)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:xa(a)},r.current.isTreeTable&&n===h&&H?t.createElement(Ju,null):null,n===au.expandableColumn&&H?t.createElement(Ju,null):a)),s&&c.push(t.createElement(w,{key:1,placement:"top",title:s},t.createElement(yt,{className:"tip"}))),l&&c.push(j(o[n])),c},j=e=>{const n=["svgicon cell--sorter__asc",{actived:e===R}],r=["svgicon cell--sorter__desc",{actived:e===O}];return t.createElement("div",{key:2,className:"cell--sorter",title:L("qm.table.sorter.text")},t.createElement("span",{className:_e(n)},t.createElement(ep,null)),t.createElement("span",{className:_e(r)},t.createElement(tp,null)))},K=e=>t.createElement(Xu,{column:e,filters:s}),z=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=o[r],t=e?e===O?null:O:R;N?(delete o[r],f(Object.assign({},o,{[r]:t}))):f(Object.assign({},{[r]:t}))}},V=()=>{_&&W()},W=e=>{const t=Ae(o,(e=>null!==e));U(t),e||Object.keys(t).length||U({index:R})},B=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,U=e=>{const{tableFullData:t}=r.current,n=((e,t)=>e.sort(((e,n)=>{for(const r in t){const i=a.find((e=>e.dataIndex===r)),l=t[r],o=da(e,r),s=da(n,r),c="function"!=typeof(null==i?void 0:i.sorter)?B(o,s):i.sorter(e,n);if(0!==c)return"ascend"===l?c:-c}return 0})).slice(0))(p?x(Ea(t)):t,e);E(n)},G=()=>{D&&Y()},Y=()=>{const e=c.length?wa(c):wa(s),t=""!==e?p?x(Bl(Ea(k),e,P)):Bl(k,e,P):k;E(t),W(!0)},X=ia(n),{tableBodyWidth:Q}=l;return t.createElement("div",{ref:A,className:`${i}--header-wrapper`},t.createElement("table",{className:`${i}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Q?`${Q}px`:""}},t.createElement("colgroup",null,a.map((e=>{const{dataIndex:n,width:r,renderWidth:i}=e;return t.createElement("col",{key:n,style:{width:`${r||i}px`,minWidth:`${r||i}px`}})}))),t.createElement("thead",null,(e=>e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>$(t,n,e)))))))(X))))},rp=t.createContext([]);function ip(e,t,n){var r;let i,l=null!==(r=n.initialDeps)&&void 0!==r?r:[];return()=>{var r,a,o,s,c;let d;n.key&&(null===(r=n.debug)||void 0===r?void 0:r.call(n))&&(d=Date.now());const u=e(),p=u.length!==l.length||u.some(((e,t)=>l[t]!==e));if(!(null===(a=n.noCache)||void 0===a?void 0:a.call(n))&&!p)return i;let h;if(l=u,n.key&&(null===(o=n.debug)||void 0===o?void 0:o.call(n))&&(h=Date.now()),i=t(...u),n.key&&(null===(s=n.debug)||void 0===s?void 0:s.call(n))){const e=Math.round(100*(Date.now()-d))/100,t=Math.round(100*(Date.now()-h))/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} / ${i(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%);`,null==n?void 0:n.key)}return null===(c=null==n?void 0:n.onChange)||void 0===c||c.call(n,i),i}}function lp(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const ap=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,i)),n)}},op=e=>e,sp=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},cp=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const l=new r.ResizeObserver((e=>{const t=e[0];if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void i({width:e.inlineSize,height:e.blockSize})}i(n.getBoundingClientRect())}));return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},dp={passive:!0},up="undefined"==typeof window||"onscrollend"in window,pp=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const l=e.options.useScrollendEvent&&up?()=>{}:ap(r,(()=>{t(i,!1)}),e.options.isScrollingResetDelay),a=r=>()=>{const{horizontal:a,isRtl:o}=e.options;i=a?n.scrollLeft*(o?-1:1):n.scrollTop,l(),t(i,r)},o=a(!0),s=a(!1);return s(),n.addEventListener("scroll",o,dp),n.addEventListener("scrollend",s,dp),()=>{n.removeEventListener("scroll",o),n.removeEventListener("scrollend",s)}},hp=(e,t,n)=>{if(null==t?void 0: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"])},mp=(e,{adjustments:t=0,behavior:n},r)=>{var i,l;const a=e+t;null===(l=null===(i=r.scrollElement)||void 0===i?void 0:i.scrollTo)||void 0===l||l.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class fp{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,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:()=>{var n;null===(n=t())||void 0===n||n.disconnect(),e=null},observe:e=>{var n;return null===(n=t())||void 0===n?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null===(n=t())||void 0===n?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options=Object.assign({debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:op,rangeExtractor:sp,onChange:()=>{},measureElement:hp,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0},e)},this.notify=e=>{var t,n;null===(n=(t=this.options).onChange)||void 0===n||n.call(t,this,e)},this.maybeNotify=ip((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e,t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n)return void this.maybeNotify();this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=null!==(t=null===(e=this.scrollElement)||void 0===e?void 0:e.window)&&void 0!==t?t: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()})))}},this.getSize=()=>{var e;return this.options.enabled?(this.scrollRect=null!==(e=this.scrollRect)&&void 0!==e?e:this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=null!==(e=this.scrollOffset)&&void 0!==e?e:"function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let i=t-1;i>=0;i--){const t=e[i];if(n.has(t.lane))continue;const l=r.get(t.lane);if(null==l||t.end>l.end?r.set(t.lane,t):t.end<l.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},this.getMeasurementOptions=ip((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i})),{key:!1}),this.getMeasurements=ip((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i},l)=>{if(!i)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 a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,a);for(let i=a;i<e;i++){const e=r(i),a=1===this.options.lanes?o[i-1]:this.getFurthestMeasurement(o,i),s=a?a.end+this.options.gap:t+n,c=l.get(e),d="number"==typeof c?c:this.options.estimateSize(i),u=s+d,p=a?a.lane:i%this.options.lanes;o[i]={index:i,start:s,size:d,end:u,key:e,lane:p}}return this.measurementsCache=o,o}),{key:"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=ip((()=>[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,i=t=>e[t].start,l=gp(0,r,i,n);let a=l;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:l,endIndex:a}}({measurements:e,outerSize:t,scrollOffset:n}):null),{key:"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=ip((()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]}),((e,t,n,r,i)=>null===r||null===i?[]:e({startIndex:r,endIndex:i,overscan:t,count:n})),{key:"getVirtualIndexes",debug:()=>this.options.debug}),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)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const i=r.key,l=this.elementsCache.get(i);l!==e&&(l&&this.observer.unobserve(l),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))},this.resizeItem=(e,t)=>{var n;const r=this.measurementsCache[e];if(!r)return;const i=t-(null!==(n=this.itemSizeCache.get(r.key))&&void 0!==n?n:r.size);0!==i&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,t)),this.notify(!1))},this.measureElement=e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach(((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))}))},this.getVirtualItems=ip((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,i=e.length;r<i;r++){const i=t[e[r]];n.push(i)}return n}),{key:"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return lp(t[gp(0,t.length-1,(e=>lp(t[e]).start),e)])},this.getOffsetForAlignment=(e,t)=>{const n=this.getSize(),r=this.getScrollOffset();"auto"===t&&e>=r+n&&(t="end"),"end"===t&&(e-=n);const i=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-n;return Math.max(Math.min(l,e),0)},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(),i=this.getScrollOffset();if("auto"===t)if(n.end>=i+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=i+this.options.scrollPaddingStart))return[i,t];t="start"}const l=n.start-this.options.scrollPaddingStart+(n.size-r)/2;switch(t){case"center":return[this.getOffsetForAlignment(l,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]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{null!==this.scrollToIndexTimeoutId&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},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})},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[i,l]=r;this._scrollToOffset(i,{adjustments:void 0,behavior:n}),"smooth"!==n&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout((()=>{this.scrollToIndexTimeoutId=null;if(this.elementsCache.has(this.options.getItemKey(e))){const[i]=lp(this.getOffsetForIndex(e,l));t=i,r=this.getScrollOffset(),Math.abs(t-r)<1||this.scrollToIndex(e,{align:l,behavior:n})}else this.scrollToIndex(e,{align:l,behavior:n});var t,r})))},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})},this.getTotalSize=()=>{var e,t;const n=this.getMeasurements();let r;return r=0===n.length?this.options.paddingStart:1===this.options.lanes?null!==(t=null===(e=n[n.length-1])||void 0===e?void 0:e.end)&&void 0!==t?t:0:Math.max(...n.slice(-this.options.lanes).map((e=>e.end))),Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const gp=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,l=n(i);if(l<r)e=i+1;else{if(!(l>r))return i;t=i-1}}return e>0?e-1:0};const vp="undefined"!=typeof document?t.useLayoutEffect:t.useEffect,yp=e=>(e=>{const n=t.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},e),{onChange:(t,r)=>{var i;r?en(n):n(),null===(i=e.onChange)||void 0===i||i.call(e,t,r)}}),[i]=t.useState((()=>new fp(r)));return i.setOptions(r),vp((()=>i._didMount()),[]),vp((()=>i._willUpdate())),i})(Object.assign({observeElementRect:cp,observeElementOffset:pp,scrollToFn:mp},e)),bp=(e,t,n,r,i,l,a,o,s,c)=>{var d;const{clientX:u,clientY:p}=e,{top:h,height:m}=e.target.getBoundingClientRect(),f=(((null==i?void 0:i.x)||0)-u-12)/r,g=s.filter((e=>{var t,n;return null===(n=null===(t=o[e])||void 0===t?void 0:t.children)||void 0===n?void 0:n.length}));let v=xp(o,n.eventKey);if(p<h+m/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=xp(o,t)}const y=v.key,b=v,x=v.key;let E=0,w=0;if(!g.includes(y))for(let e=0;e<f&&wp(v);e+=1)v=v.parent,w+=1;const C=t.data,S=v.node;let N=!0;return Cp(v)&&0===v.level&&p<h+m/2&&l({dragNode:C,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?l({dragNode:C,dropNode:S,dropPosition:0})?E=0:N=!1:0===w?f>-1.5?l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:C,dropNode:S,dropPosition:0})?E=c?1:0:l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:w,dropTargetKey:v.key,dropTargetPos:v.pos,dragOverNodeKey:x,dropContainerKey:0===E?null:(null===(d=v.parent)||void 0===d?void 0:d.key)||null,dropAllowed:N}},xp=(e,t)=>e[t],Ep=e=>e.split("-"),wp=e=>{if(e.parent){const t=Ep(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Cp=e=>{const t=Ep(e.pos);return 0===Number(t[t.length-1])},Sp=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:i,setRowExpandedKeys:l,createTableFullData:a,dataChange:o}=t.useContext(zd),{tableFullData:s,allRowKeys:c,isTreeTable:d}=n.current,u=Wn,p=t.useRef(null),h=t.useRef(null),m=t.useRef(null),f=t.useRef(),[g,v]=t.useState({}),[y,b]=t.useState(null),[x,E]=t.useState([]),[w,C]=t.useState(0),[S,N]=t.useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),T=e=>{N((t=>Object.assign({},t,e)))};t.useLayoutEffect((()=>{e&&v((e=>{const t={},n=(e,i=null,l=0)=>{const a=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:l,node:e,parent:i,pos:(d=(null==i?void 0:i.pos)||"0",u=o,`${d}-${u}`),nodes:[...(null==i?void 0:i.nodes)||[],e]};var d,u;Array.isArray(e.children)&&(c.children=n(e.children,c,l+1)),t[s]=c,a.push(c)})),a};return n(e),t})(s))}),[s]),t.useEffect((()=>()=>{window.removeEventListener("dragend",O)}),[]);const I=()=>{T({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},R=()=>{null!==y&&(b(null),T({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),h.current=null,m.current=null},O=e=>{k(),window.removeEventListener("dragend",O)},k=(e,t,n)=>{T({dragOverNodeKey:null}),R(),p.current=null,window.removeEventListener("dragend",O)},L=e=>{const t=e.node.eventKey,n=e.dragNode.eventKey,i=e.node.pos.split("-"),l=e.dropPosition-Number(i[i.length-1]),c=(e,t,n)=>{for(let i=0;i<e.length;i++){if(r(e[i],e[i].index)===t)return n(e[i],i,e);e[i].children&&c(e[i].children,t,n)}},d=[...s];let u;if(c(d,n,((e,t,n)=>{n.splice(t,1),u=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,i)=>{n=i,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)}));a(d),o()};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;p.current=t,h.current={x:e.clientX,y:e.clientY};const r=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(i,n);b(n),E(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(xp(t,e).children),n})(n,g)),C(2*au.treeTable.textIndent),l(r),window.addEventListener("dragend",O)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(m.current!==n&&(m.current=n),!p.current)return void I();const{dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b,dragOverNodeKey:E}=bp(e,p.current,t,w,h.current,u,c,g,i,!d);-1===x.indexOf(o)&&b?(f.current||(f.current={}),Object.keys(f.current).forEach((e=>{clearTimeout(f.current[e])})),p.current.eventKey!==n&&(e.persist(),f.current[n]=window.setTimeout((()=>{var e;if(null===y)return;let t=[...i];const r=xp(g,n);r&&(null===(e=r.children)||void 0===e?void 0:e.length)&&(t=((e,t)=>{const n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n})(i,n)),l(t)}),800)),p.current.eventKey!==o||0!==a?T({dragOverNodeKey:E,dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b}):I()):I()},onNodeDragOver:(e,t)=>{if(!p.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:l,dropContainerKey:a,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:m}=bp(e,p.current,t,w,h.current,u,c,g,i,!d);-1===x.indexOf(l)&&o&&(p.current.eventKey===l&&0===r?null===S.dropPosition&&null===S.dropLevelOffset&&null===S.dropTargetKey&&null===S.dropContainerKey&&null===S.dropTargetPos&&!1===S.dropAllowed&&null===S.dragOverNodeKey||I():n===S.dropPosition&&r===S.dropLevelOffset&&l===S.dropTargetKey&&a===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&m===S.dragOverNodeKey||T({dropPosition:n,dropLevelOffset:r,dropTargetKey:l,dropContainerKey:a,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:m}))},onNodeDragLeave:(e,t)=>{m.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(I(),m.current=null)},onNodeDragEnd:k,onNodeDrop:(e,t,n=!1)=>{const{dropPosition:r,dropTargetKey:i,dropTargetPos:l,dropAllowed:a,dragOverNodeKey:o}=S;if(!a)return;if(T({dragOverNodeKey:null}),R(),null===i)return;const s=Object.assign(Object.assign({},((e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const i=xp(r,e);return{eventKey:e,pos:i?i.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}})(i,{dropPosition:r,dragOverNodeKey:o,keyEntities:g})),{data:xp(g,i).node});-1!==x.indexOf(i)&&nr("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=Ep(l),d={event:e,node:s,dragNode:p.current,dragNodesKeys:[p.current.eventKey].concat(x),dropToGap:0!==r,dropPosition:r+Number(c[c.length-1])};n||L(d),p.current=null},indent:w,dropOptions:S}},Np=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,Tp=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Ip=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!Np(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Rp({ref:t,handler:n,enabled:r=!0,omitClassNames:i=[]}){const l=$n(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{Ip(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&Ip(e,t)&&Tp(e,i)&&(a.current.isPointerDown=!1,l(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&Ip(e,t)&&Tp(e,i)&&(a.current.isPointerDown=!1,l(e))},c=Np(t.current);return c.addEventListener("mousedown",e,!0),c.addEventListener("mouseup",o,!0),c.addEventListener("touchstart",e,!0),c.addEventListener("touchend",s,!0),()=>{c.removeEventListener("mousedown",e,!0),c.removeEventListener("mouseup",o,!0),c.removeEventListener("touchstart",e,!0),c.removeEventListener("touchend",s,!0)}}),[n,t,l,a,r])}function Op(){const[,t]=e.useReducer((e=>e+1),0);return t}const kp=t.forwardRef(((e,n)=>{const{rowKey:r,rowIndex:i,row:l,className:a,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:p,onNodeDragOver:h,onNodeDragLeave:m,onNodeDragEnd:f,onNodeDrop:g}=e,v=t.useRef({eventKey:r,data:l,props:e}),y=t.useRef(!1),[b,x]=t.useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===r&&0===E,I=C===r&&-1===E,R=C===r&&1===E,O=l._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 L={"body--row-draggable":!0,"body--row-dragging":b,"drop-target":S===r,"drop-container":N===r,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return t.createElement("tr",{ref:n,"data-row-key":r,"data-row-index":i,className:_e(a,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),y.current=t)},onDragStart:e=>{if(e.stopPropagation(),y.current)return e.preventDefault();x(!0),u(e,v.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),p(e,v.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),h(e,v.current)},onDragLeave:e=>{e.stopPropagation(),m(e,v.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,v.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,v.current)}},e.children,C===r&&null!==E&&null!==w&&t.createElement("td",{className:"drop-indicator",style:k}))}));kp.displayName="DraggableTr";const Lp=e=>{const{selectionKeys:n,column:r,record:i,rowKey:l}=e,{tableRef:a,getAllChildRowKeys:o}=t.useContext(zd),{rowSelection:s}=a.current.props,c=t.useMemo((()=>r.type||""),[r.type]),d=e=>{var t,r;const i=null===(t=s.checkStrictly)||void 0===t||t;if(!a.current.isTreeTable||i)return!1;const l=ta(a.current.deriveRowKeys,e);return((e,t)=>{const n=new Set(t);let r=!1,i=!1;for(const t of e)if(n.has(t)?r=!0:i=!0,r&&i)break;return r&&i})(o(null!==(r=null==l?void 0:l.children)&&void 0!==r?r:[]),n)};return"radio"===c?(()=>{const e=s.disabled,r=null==e?void 0:e(i),a=!r&&n[0]===l;return t.createElement(j,{checked:a,disabled:r})})():(()=>{const e=s.disabled,r=null==e?void 0:e(i),a=!!n.includes(l);return t.createElement(M,{checked:a,indeterminate:d(l),disabled:r})})()},Ap=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:l,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext(zd),{expandable:s={}}=l.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);$i((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${ar("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:_e(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];o(t)},style:i})},Pp=t.forwardRef(((e,n)=>{const{size:r,defaultValue:i,value:l,min:a,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:p,stringMode:h,allowClear:m,readOnly:f,disabled:g,formatter:v=(e=>e.toString()),parser:y=(e=>e),onFocus:b}=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)<a&&(t=a.toString()),p>=0&&""!==t&&(t=new Gt(t).toFixed(p)),t},E=void 0!==l,[w,C]=t.useState(null!=i?i:""),S=v(E?l:w),N=y(S);$i((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[w]);return t.createElement(O,{ref:n,size:r,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:m,readOnly:f,disabled:g,onChange:t=>{const n=y(t.target.value.replace(/\s+/g,""));let r=/^-?\d*(\.\d*)?$/.test(n)||""===n||"-"===n;if(0===p&&n.includes(".")&&(r=!1),a>=0&&n.startsWith("-")&&(r=!1),r){if(!h&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{var n;E?null===(n=e.onChange)||void 0===n||n.call(e,t):C(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(N);null===(t=e.onBlur)||void 0===t||t.call(e,n,N)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(N),N))}})}));Pp.displayName="InputNumber";const{Search:_p}=O,Dp=t.forwardRef(((e,n)=>{var r,i,l,a,o,s;const{column:c,record:d,rowKey:u,columnKey:p}=e,{tableRef:h,tableBodyRef:m,$size:f,flattenColumns:g,updateTableFlatData:v,doFieldValidate:y,dataChange:b}=t.useContext(zd),x=t.useContext(rp),{t:w}=Fn(),C=Op(),{store:S,fieldAuth:N}=h.current,T=(null===(r=c.editRender)||void 0===r?void 0:r.call(c,d,c))||{},I=t.useRef(null),R=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(!1),_=t.useRef({}),D=t.useRef({}),F=t.useRef([]),[$,q]=t.useState(!1),[j,z]=t.useState(!1),[V,W]=t.useState(T.items||[]),[B,U]=t.useState(),G=(T.editable||he(x,[u,p]))&&!T.disabled&&!(null===(i=N[p])||void 0===i?void 0:i.disabled),Y=`${u}|${p}`,X=2===x.length?`${x[0]}|${x[1]}`:"",Q=![...S.state.required,...S.state.validate].some((({x:e,y:t})=>e===u&&t===p)),Z=(null===(l=S.state.required.find((({x:e,y:t})=>e===u&&t===p)))||void 0===l?void 0:l.text)||"",J=(null===(a=S.state.validate.find((({x:e,y:t})=>e===u&&t===p)))||void 0===a?void 0:a.text)||"",ee=S.state.edited.some((({x:e,y:t})=>e===u&&t===p)),te=G||!Q||$||j,ne=!!(null===(o=T.helper)||void 0===o?void 0:o.combinedDataIndex)&&("search-helper"===T.type||"tree-helper"===T.type),re=null===(s=T.type)||void 0===s?void 0:s.endsWith("multiple");t.useLayoutEffect((()=>{te&&X===Y&&oe()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;re&&e&&le(e.map((e=>({[D.current.valueKey]:e.value,[D.current.textKey]:e.text}))))}),[]);const ie=()=>{v(),b()},le=e=>{F.current=e},oe=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=R.current)||void 0===e||e.focus();break;case"number":null===(t=k.current)||void 0===t||t.select();break;case"search-helper":null===(n=L.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=A.current)||void 0===r||r.focus()}},se=()=>{var e,t,n,r;const{type:i}=T;switch(i){case"text":null===(e=R.current)||void 0===e||e.blur();break;case"number":null===(t=k.current)||void 0===t||t.blur();break;case"search-helper":null===(n=L.current)||void 0===n||n.blur();break;case"tree-helper":null===(r=A.current)||void 0===r||r.blur()}};t.useImperativeHandle(n,(()=>({focus:oe,blur:se,isEditable:()=>!T.disabled,isOpening:()=>$})));const ce=(e,t,n)=>{const{cornerSign:r=!0}=T.extra||{};S.addToUpdated(e),r&&S.addToEdited({x:t,y:n})},de=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",pe={text:(e,n,r)=>{const{dataIndex:i}=n,{type:l,extra:a={},rules:o=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=da(e,i),g=Object.assign({},{minRows:1,maxRows:4},a.autoSize),v=r?{rows:g.minRows,autoSize:g}:null,b=a.password?O.Password:r?O.TextArea:O;return t.createElement(b,On({ref:R,size:f,value:m,maxLength:a.maxLength,showCount:a.showCount},v,{autoComplete:a.password?"new-password":"off",placeholder:a.placeholder||w("qm.table.editable.inputPlaceholder"),allowClear:a.allowClear,readOnly:a.readOnly,disabled:a.disabled,suffix:a.suffix,onChange:t=>{var r;const l=null!==(r=t.target.value)&&void 0!==r?r:"";ua(e,i,l),y(o,l,u,p,xa(n.title)),C(),null==s||s({[Y]:l}),P.current=!0},onBlur:t=>{var n;const r=null!==(n=t.target.value)&&void 0!==n?n:"";P.current&&(P.current=!1,ce(e,u,p),null==c||c({[Y]:r},e),null==h||h({[Y]:r},e),ie())},onKeyUp:t=>{var n;if(13===t.keyCode&&!t.shiftKey){const r=null!==(n=t.target.value)&&void 0!==n?n:"";null==d||d({[Y]:r},e)}},onKeyDown:e=>{r&&13===e.keyCode&&!e.shiftKey&&d&&e.preventDefault()}}))},textarea:(e,t)=>pe.text(e,t,!0),number:(e,n)=>{var r;const{dataIndex:i,precision:l,formatType:a}=n,{type:o,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:m,onBlur:g}=T,v=da(e,i);let b,x;return"finance"===a&&(b=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},x=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===a&&(b=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Gt(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Gt(e).times(.01).toString()),t.createElement(Pp,{ref:k,size:f,value:v,min:s.min,max:s.max,precision:l,stringMode:s.stringMode,prefix:s.prefix,suffix:null!==(r=s.suffix)&&void 0!==r?r:"percent"===a?"%":void 0,placeholder:s.placeholder||w("qm.table.editable.inputPlaceholder"),maxLength:s.maxLength,allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,formatter:b,parser:x,onChange:t=>{ua(e,i,t),y(c,t,u,p,xa(n.title)),C(),null==d||d({[Y]:t}),P.current=!0},onBlur:(t,n)=>{if(!P.current)return;P.current=!1;let r=s.stringMode?t:de(t);"percent"===a&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),ua(e,i,r),ce(e,u,p),null==h||h({[Y]:r},e),null==g||g({[Y]:r},e),ie()},onEnter:(t,n)=>{let r=s.stringMode?t:de(t);"percent"===a&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),null==m||m({[Y]:r},e)}})},select:(e,n,r)=>{var i;const{dataIndex:l,dictItems:a=[]}=n,{type:o,extra:s={},rules:c=[],items:d,onChange:h,onEnter:m}=T,g=d||a,v=da(e,l);let b=v;return t.createElement(H,{mode:r?"multiple":void 0,size:f,popupClassName:au.popupClassName,value:v||void 0,placeholder:s.placeholder||w("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,listHeight:s.listHeight,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},showSearch:null===(i=s.filterable)||void 0===i||i,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${po.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>q(e),onChange:t=>{ua(e,l,t),y(c,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},onSelect:e=>{b=e},onInputKeyDown:t=>{13===t.keyCode&&Un((()=>null==m?void 0:m({[Y]:b},e)))}},g.map((e=>t.createElement(H.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>pe.select(e,t,!0),date:(e,n,r)=>{var i;const{dataIndex:l}=n,{type:a,extra:o={},rules:s=[],onChange:c}=T,d=r||"exactdate",h=da(e,l);return t.createElement(Rn,{size:f,popupClassName:au.popupClassName,value:null!==(i=ga(h,Fa[d]))&&void 0!==i?i:void 0,picker:Ma[d],format:o.format,showTime:"datetime"===d,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=o;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=va(t,Fa[d]);ua(e,l,r),y(s,r,u,p,xa(n.title)),ce(e,u,p),null==c||c({[Y]:r},e),ie()}})},datetime:(e,t)=>pe.date(e,t,"datetime"),month:(e,t)=>pe.date(e,t,"month"),year:(e,t)=>pe.date(e,t,"year"),time:(e,n)=>{var r;const{dataIndex:i}=n,{type:l,extra:a={},rules:o=[],onChange:s}=T,c="HH:mm:ss",d=da(e,i);return t.createElement(kn,{size:f,popupClassName:au.popupClassName,value:null!==(r=ga(d,c))&&void 0!==r?r:void 0,format:a.format||c,placeholder:a.placeholder,allowClear:a.allowClear,disabled:a.disabled,style:{width:"100%"},onChange:t=>{const r=va(t,c);ua(e,i,r),y(o,r,u,p,xa(n.title)),ce(e,u,p),null==s||s({[Y]:r},e),ie()}})},checkbox:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],onChange:o}=T,{trueValue:s=Ud,falseValue:c=Gd,disabled:d}=l,h=da(e,r);return t.createElement(M,{checked:h===s,disabled:d,onChange:t=>{const i=t.target.checked?s:c;ua(e,r,i),y(a,i,u,p,xa(n.title)),ce(e,u,p),null==o||o({[Y]:i},e),ie()}})},switch:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],onChange:o}=T,{trueValue:s=Ud,falseValue:c=Gd,disabled:d}=l,h=da(e,r);return t.createElement(K,{checked:h===s,disabled:d,onChange:t=>{const i=t?s:c;ua(e,r,i),y(a,i,u,p,xa(n.title)),ce(e,u,p),null==o||o({[Y]:i},e),ie()}})},"search-helper":(e,n)=>{var r;const{dataIndex:i,precision:l}=n,{type:a,extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,v=pa(e,ne?c.combinedDataIndex:i),b=c.fieldAliasMap;b||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(i)||nr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(c.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||nr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[i].includes("|")&&nr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=e=>{const{filterAliasMap:t}=c,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],l={[i]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(ae(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},C=e=>{const{autoQueryAssign:t=!0}=c;t&&(_.current=E(e)),q(!0)},S=(t,r)=>{const{beforeOpen:i}=c,l=(null!=i?i:Wn)({[Y]:v},e,n);(null==l?void 0:l.then)?l.then((()=>{C(t),null==r||r()})).catch((()=>{})):!1!==l&&(C(t),null==r||r())},N=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=pa(e,r))}const n=x[i]?pa(e,x[i]):"";R(n,t);const{closed:r}=c;q(!1),null==r||r(e)},I=()=>{const{onlySelect:e=!0}=c;P.current&&R(e?"":v),q(!1)},R=(t="",r)=>{var a;if(ae(r)&&Object.keys(r).length)for(const t in r){const n=r[t],i=g.find((e=>e.dataIndex===t));if(i){ua(e,t,n,i.precision);const r=null===(a=i.editRender)||void 0===a?void 0:a.call(i,e,i);r&&Array.isArray(r.rules)&&y(r.rules,n,u,t,xa(i.title))}else ua(e,t,n)}ne&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return ua(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&ua(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),ua(e,i,t,l),y(s,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie(),_.current={},P.current=!1,U(void 0)},O={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{I()}},k=Object.assign(Object.assign({},c),{size:f,initialValue:Object.assign({},_.current,c.initialValue),onClose:e=>{e?N(e):I()}});return t.createElement(t.Fragment,null,t.createElement(_p,{ref:L,value:null!=B?B:v,placeholder:o.placeholder||w("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,readOnly:o.readOnly,disabled:o.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:l}=c;if(P.current&&!$)return n&&r&&(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=c,{beforeFetch:r=Wn}=t.fetch;return new Promise(((i,l)=>Mn(void 0,void 0,void 0,(function*(){var a;const o=ve({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(o))return l();z(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=ue(e.data,t.fetch.dataKey))&&void 0!==a?a:[];i(n)}else l()}catch(e){l(e)}finally{Un((()=>z(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>pa(e,x[i]).toString().includes(t)));if(1===n.length)return N(n[0]);S(t)})(e,n))).catch((()=>R(""))):void R(n)},onChange:e=>{const{value:t}=e.target;null==d||d({[Y]:t}),P.current=!0,U(t)},onKeyDown:e=>{var t;if(13===e.keyCode){const n=null!==(t=e.target.value)&&void 0!==t?t:"";!$&&S(n)}},onDoubleClick:e=>{const{value:t}=e.target;S(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&S(e)}}),t.createElement(Ll,O,t.createElement(Gp,k)))},"search-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:l,items:a=[],extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=da(e,i),v=c.fieldAliasMap;v||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||nr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),D.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Wn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},C=()=>{q(!1)},S=t=>{ua(e,i,t),y(s,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,F.current),ie()},N={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{C()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ve({},c.initialValue),defaultSelectedKeys:g,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=b;le(ye([...F.current.filter((e=>t.includes(e[r]))),...e],r));const i=F.current.map((e=>({text:e[n],value:e[r]}))),l=ye([...i,...a],"value").filter((e=>t.includes(e.value)));W(l),S(l.map((e=>e.value)));const{closed:o}=c;q(!1),null==o||o(F.current)})(e,t):C()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(H,{mode:"multiple",open:!1,value:g,placeholder:o.placeholder||w("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&&!$&&x()},onDoubleClick:()=>{o.disabled||x()},onChange:e=>{const{valueKey:t}=b;le(F.current.filter((n=>e.includes(n[t])))),S(e)}},V.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:o.disabled,icon:t.createElement(Ge,null),onClick:()=>{x()}})))),t.createElement(Ll,N,t.createElement(Gp,I)))},"tree-helper":(e,n)=>{var r,i;const{dataIndex:l,precision:a}=n,{type:o,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:m}=T,v=pa(e,ne?d.combinedDataIndex:l),b=d.fieldAliasMap;b||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(l)||nr("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||nr("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[l].includes("|")&&nr("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:r}=d,i=(null!=r?r:Wn)({[Y]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},C=()=>{q(!1)},S=(t="",r)=>{var i;if(ae(r)&&Object.keys(r).length)for(const t in r){const n=r[t],l=g.find((e=>e.dataIndex===t));if(l){ua(e,t,n,l.precision);const r=null===(i=l.editRender)||void 0===i?void 0:i.call(l,e,l);r&&Array.isArray(r.rules)&&y(r.rules,n,u,t,xa(l.title))}else ua(e,t,n)}ua(e,l,t,a),y(c,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},N={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{C()}},I=Object.assign(Object.assign({},d),{defaultSelectedKeys:[v],size:f,onClose:e=>{e?(e=>{const t={};for(const n in x){const r=x[n];n!==l&&(t[n]=pa(e,r))}const n=x[l]?pa(e,x[l]):"";S(n,t);const{closed:r}=d;q(!1),null==r||r(e)})(e):C()}});return t.createElement(t.Fragment,null,t.createElement(_p,{ref:A,value:v,allowClear:null===(i=s.allowClear)||void 0===i||i,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||w("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!$&&E())},onDoubleClick:()=>{E()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?E():S(""))}}),t.createElement(Ll,N,t.createElement(Jp,I)))},"tree-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:l,extra:a={},items:o=[],rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=da(e,i),v=c.fieldAliasMap;v||nr("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||nr("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),D.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Wn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{q(!0),null==t||t()})).catch((()=>{})):!1!==i&&(q(!0),null==t||t())},C=()=>{q(!1)},S=t=>{ua(e,i,t),y(s,t,u,p,xa(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,F.current),ie()},N={visible:$,title:w("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:au.popupClassName,bodyStyle:{paddingBottom:`${Oo[f]+20}px`},onClose:()=>{C()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ve({},c.initialValue),defaultSelectedKeys:g,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=b;le(e);const r=F.current.map((e=>({text:e[t],value:e[n]})));W(r),S(r.map((e=>e.value)));const{closed:i}=c;q(!1),null==i||i(F.current)})(e):C()}});return t.createElement(t.Fragment,null,t.createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t.createElement("span",{className:"ant-input-wrapper ant-input-group"},t.createElement(H,{mode:"multiple",open:!1,value:g,placeholder:a.placeholder||w("qm.table.editable.selectPlaceholder"),allowClear:a.allowClear,maxTagCount:a.collapseTags?"responsive":void 0,maxTagTextLength:a.maxTagTextLength,disabled:a.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!$&&x()},onDoubleClick:()=>{a.disabled||x()},onChange:e=>{const{valueKey:t}=b;le(F.current.filter((n=>e.includes(n[t])))),S(e)}},V.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(E,{className:"ant-input-search-button",disabled:a.disabled,icon:t.createElement(Ge,null),onClick:()=>{x()}})))),t.createElement(Ll,N,t.createElement(Jp,I)))},custom:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],render:o,onChange:s}=T;if(!o)return nr("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const c=da(e,r),d=t=>{ua(e,r,t),y(a,t,u,p,xa(n.title)),ce(e,u,p),null==s||s({[Y]:t},e),ie()},h=o(e,n,d);return t.isValidElement(h)?t.cloneElement(h,{value:c,disabled:l.disabled,readOnly:l.readOnly,popupClassName:au.popupClassName,onChange:d}):null}};return t.createElement(t.Fragment,null,te?(()=>{const{type:e}=T,n=pe[e];if(!n)return nr("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!Q}];return t.createElement("div",{ref:I,className:_e(r)},n(d,c),!Q&&t.createElement("div",{className:"cell-error"},Z||J))})():(()=>{const{disabled:n,extra:r={}}=T,{disabledColor:i,disabledBgColor:l}=r,a=["cell--show",{"is-cell-bg":n&&l}];return t.createElement(t.Fragment,null,t.createElement("span",{className:_e(a),style:{color:n?i:""}},e.children),n&&l&&t.createElement("i",{className:"cell--bg",style:{background:l}}))})(),ee&&t.createElement("i",{className:"cell--sign"}))}));Dp.displayName="CellEdit";const Hp=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,Mp=e=>{const{text:n,options:r,showMessage:i=!0,onCopy:l}=e,{t:a}=Fn();return Hp(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=Yt(n,r);null==l||l(n,c),c&&i&&R.success(a("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Mp.displayName="QmCopyToClipboard";const Fp=t.forwardRef(((n,r)=>{const{column:i,row:l,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c}=n,{tableRef:d,selectionKeys:u,treeExpandIndex:p,updateMark:h}=t.useContext(zd),{dataIndex:m,canCopy:f,render:g,editRender:v,shouldCellUpdate:y}=i,{t:b}=Fn(),{renderText:x,getTitleFromCellNode:E}=vu(),w=t.useRef(null),C=da(l,m),[S,N]=function(t,n,r){const i=e.useRef({});return"value"in i.current&&!r(i.current.condition,n)||(i.current.value=t(),i.current.condition=n),i.current.value}((()=>{const e=g?g(C,l,i,a,o):x(C,i,l);return[e,v?t.createElement(Dp,{ref:r,column:i,record:l,rowKey:s,columnKey:m},e):null]}),[h,l,C,g,v],((e,t)=>{if(y){const[,n]=e,[,r]=t;return y(r,n,l)}return!Oa(e,t,!0)}));t.useEffect((()=>{if([au.expandableColumn,au.selectionColumn,au.operationColumn].includes(m))return;const e=w.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const T=e=>Array.isArray(e.children);return t.createElement("div",{ref:w,className:"cell"},(()=>{if(m===au.expandableColumn)return t.createElement(Ap,{record:l,rowKey:s});if(m===au.selectionColumn)return t.createElement(Lp,{selectionKeys:u,column:i,record:l,rowKey:s});if(N)return N;if(d.current.isTreeTable&&m===p)return t.createElement(t.Fragment,null,(e=l._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*au.treeTable.textIndent+"px"}}):null,t.createElement(Ap,{key:"expand",record:l,rowKey:s,style:T(l)?{}:{visibility:"hidden"}}),S);var e;if(f){const e=E(S);return t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},S),e&&t.createElement(Mp,{text:e},t.createElement(ot,{className:"icon",title:b("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Fp.displayName="Cell";const $p={open:!1,offsetX:0,offsetY:0},qp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:l,tableFlatData:a,flattenColumns:o,mergedTdCells:s,setMergedCells:c}=t.useContext(zd),{areaSelection:d={}}=r.current.props,{elementStore:u}=r.current,{t:p}=Fn(),h=t.useRef(document.onselectstart),m=t.useRef(null),f=t.useRef(null),g=t.useRef(null),v=e=>{g.current=e},[y,b]=t.useState(null),[x,E]=t.useState(null),[w,C]=t.useState(null),S=e=>{if(!e)return C(null);let t=!1;for(const n in e)if((null==w?void 0:w[n])!==e[n]){t=!0;break}t&&C(Object.assign({},w,e))};Rp({ref:m,handler:()=>q()}),t.useEffect((()=>{const e=jt(u.$tableBody,"mousedown",_),t=jt(u.$tableBody,"contextmenu",A),n=jt(document,"keydown",P);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const N=()=>{b(null),S(null),v(null),E(null)};t.useImperativeHandle(n,(()=>({blur:N})));const T=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},I=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,i]=[1/0,-1/0,1/0,-1/0];for(const l of e)t=Math.min(t,l.rowStart),n=Math.max(n,l.rowEnd),r=Math.min(r,l.colStart),i=Math.max(i,l.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:i}},k=dl((e=>{let t=O([R(e),g.current]);s.forEach((e=>{const n=a.findIndex((t=>i(t,t.index)===e.rowKey)),r=o.findIndex((t=>t.dataIndex===e.dataIndex)),l={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+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),L=e=>{var t;c(e),null===(t=d.onCellMerge)||void 0===t||t.call(d,e),Un((()=>N()))},A=$n((e=>{d.cellMerge&&y&&F(e.clientX,e.clientY)?(e.preventDefault(),$(e)):(null==x?void 0:x.open)&&q()})),P=$n((e=>{27===e.keyCode&&N()})),_=$n((e=>{e.stopPropagation();const t=T(e.target);if(1!==e.buttons||!t)return;q();const n=I(t);b(n);const r=R(n);v(r),S(r),document.addEventListener("mousemove",D),document.addEventListener("mouseup",H),h.current=document.onselectstart,document.onselectstart=()=>!1})),D=$n((e=>{const t=T(e.target);t&&k(I(t))})),H=$n((()=>{var e;null===(e=d.onSelectChange)||void 0===e||e.call(d,(()=>{const e=[];if(!y||!w)return e;for(let t=w.rowStart;t<w.rowEnd;t++)for(let n=w.colStart;n<w.colEnd;n++)e.push({rowKey:i(a[t],a[t].index),dataIndex:o[n].dataIndex,cellValue:da(a[t],o[n].dataIndex)});return e})()),document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",H),M()})),M=()=>{document.onselectstart!==h.current&&(document.onselectstart=h.current)},F=(e,t)=>{const{top:n,left:r}=u.$tableBody.parentNode.getBoundingClientRect(),[i,l]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=V();return!(i<a||i>a+s||l<o||l>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))})},q=()=>{E((e=>Object.assign(Object.assign({},e),{open:!1})))},j=e=>({rowIndex:a.findIndex((t=>i(t,t.index)===e.rowKey)),colIndex:o.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),K=()=>{if(!y||!w||(t=w,(e=y).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:i(a[w.rowStart],a[w.rowStart].index),dataIndex:o[w.colStart].dataIndex,rowSpan:w.rowEnd-w.rowStart,colSpan:w.colEnd-w.colStart};L([...s.filter((e=>!((e,t)=>{const n=j(e),r=j(t),[i,l,a,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 i<=s&&l<=c&&a>=d&&o>=u||s<=i&&c<=l&&d>=a&&u>=o})(e,n))),n])},z=()=>{const e=i(a[w.rowStart],a[w.rowStart].index),t=o[w.colStart].dataIndex;L(s.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},V=()=>{const{w:e,h:t,l:n,t:i}=y,l=o.slice(0,w.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),a=r.current.rowHeight*w.rowStart;return{sl:n,st:i,sw:e,sh:t,el:l,et:a,ew:o.slice(0,w.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-l,eh:r.current.rowHeight*w.rowEnd-a}};return t.createElement("div",{className:`${l}--area-select`},(()=>{if(!y||!w)return null;const{sl:e,st:n,sw:r,sh:i,el:l,et:a,ew:o,eh:s}=V(),{open:c,offsetX:d,offsetY:u}=x||$p,h=t.createElement("ul",{ref:m,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:K},p("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:z},p("qm.table.areaSelect.cancelMerge")));return t.createElement(t.Fragment,null,t.createElement("div",{className:"active-area",style:{left:e,top:n,width:r,height:i}}),t.createElement(uc,{popupVisible:c,popup:h,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:au.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},t.createElement("div",{ref:f,className:"checked-area",style:{left:l,top:a,width:o,height:s}})))})())}));qp.displayName="AreaSelect";const jp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:l,tableFlatData:a,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,sorter:p,layout:h,showFooter:m,selectionKeys:f,rowExpandedKeys:g,highlightKey:v,isPingLeft:y,isPingRight:b,isTableEmpty:x,isGroupSubtotal:E,setElementStore:w,setSelectionKeysEffect:C,setHighlightKey:S,getStickyLeft:N,getStickyRight:T,setPingLeft:I,setPingRight:R,setFullScreen:O,findParentRowKeys:k,getAllChildRowKeys:L,scrollBottomDebouncer:A}=t.useContext(zd),{height:P,minHeight:_,maxHeight:D,rowHeight:H,rowSelection:M,rowHighlight:F,expandable:$,stripe:q,summation:j,rowStyle:K,cellStyle:z,spanMethod:V,tableConfig:W,areaSelection:B,ellipsis:U,showHeader:G,rowDraggable:Y,onRowClick:X,onRowDblclick:Q,onRowContextmenu:Z,onRowEnter:J}=r.current.props,ee=t.useRef(null),te=t.useRef({}),ne=t.useRef(null),re=t.useRef({prevST:0,prevSL:0}),{onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de,indent:ue,dropOptions:pe}=Sp({openDragSort:Y}),{rowVirtualizer:me,columnVirtualizer:fe,virtualRows:ge,virtualColumns:ve,resetItemXSize:ye,getYIndexes:be,virtualTranslateY:xe,virtualTranslateX:Ee,calcVirtualYSize:we,calcVirtualXSize:Ce,scrollToYIndex:Se}=((e,n)=>{var r;const{tableRef:i}=t.useContext(zd),{props:l,scrollBarRef:a,rowHeight:o}=i.current,s=(null===(r=l.tableConfig)||void 0===r?void 0:r.overscan)||1,c=t.useMemo((()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[a.current]),d=t.useMemo((()=>{const e=[],t=[];return n.forEach(((n,r)=>{"left"===n.fixed&&e.push(r),"right"===n.fixed&&t.push(r)})),[e,t]}),[n]),u=yp({count:e.length,getScrollElement:()=>c,estimateSize:()=>o,indexAttribute:"data-row-index",overscan:s,enabled:i.current.scrollYLoad}),p=u.getVirtualItems(),h=yp({horizontal:!0,count:n.length,getScrollElement:()=>c,estimateSize:e=>n[e].width||n[e].renderWidth||0,indexAttribute:"data-col-index",overscan:s,enabled:i.current.scrollXLoad,rangeExtractor:e=>[...new Set([...d[0],...sp(e),...d[1]])]}),m=h.getVirtualItems();return{rowVirtualizer:u,columnVirtualizer:h,virtualRows:p,virtualColumns:m,resetItemXSize:e=>{e.forEach(((e,t)=>{h.resizeItem(t,e.width||e.renderWidth||au.defaultColumnWidth)}))},getYIndexes:()=>u.getVirtualIndexes()||[],getXIndexes:()=>h.getVirtualIndexes()||[],virtualTranslateY:()=>{var e,t;return null!==(t=null===(e=p[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},virtualTranslateX:()=>{var e,t,n,r,i,l,a;const o=d[0].length;return o?(null===(n=m[o])||void 0===n?void 0:n.index)===o?null!==(i=null===(r=m[0])||void 0===r?void 0:r.start)&&void 0!==i?i:0:(null!==(a=null===(l=m[o])||void 0===l?void 0:l.start)&&void 0!==a?a:0)-m.slice(0,o).reduce(((e,t)=>e+t.size),0):null!==(t=null===(e=m[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},calcVirtualYSize:()=>u.getTotalSize()||void 0,calcVirtualXSize:()=>h.getTotalSize()||void 0,scrollToYIndex:e=>{u.scrollToIndex(e)},scrollToXIndex:e=>{h.scrollToIndex(e)}}})(a,o),Ne=be(),Te=e=>{if(e&&!U)return me.measureElement(e)},Ie=t.useMemo((()=>u.length&&r.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:i,colSpan:l})=>{const a=e+i-1,o=[];for(let t=e;t<=a;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:l});for(let i=t;i<t+l;i++)0===r&&i===t||n.push({row:e,col:i,rowSpan:0,colSpan:0})}))})),n})(u,Ne):u),[u,Ne.join(",")]),[Re,Oe]=t.useState([]),ke=Op();Rp({ref:ee,omitClassNames:[`.${au.popupClassName}`],handler:()=>{var e;Ve([]),null===(e=ne.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:Ve,createFocus:Fe,forceUpdate:ke,resetItemXSize:ye,scrollToYIndex:Se}))),$i((()=>{Re.length&&r.current.tableManager.focus(r.current.uid)}),[Re]),t.useLayoutEffect((()=>{Me();const e=jt(document,"keydown",Pe);return()=>e.remove()}),[]);const Le=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:i}=h,l={};return x&&Object.assign(l,{minHeight:"100px"}),_&&Object.assign(l,{minHeight:sa(_)-e-n+"px"}),D&&Object.assign(l,{maxHeight:sa(D)-e-n+"px"}),P||r||i?Object.assign(Object.assign({},l),{maxHeight:"",minHeight:"",height:`${t}px`}):l}),[P,D,_,x,h]),Ae=$n((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:i}=re.current,{scrollTop:l,scrollLeft:a}=e;if(a!==i){G&&(t.$header.scrollLeft=a),m&&(t.$footer.scrollLeft=a);const e=a>0,n=Math.ceil(a)+h.tableWidth<h.tableBodyWidth;y!==e&&I(e),b!==n&&R(n)}l!==n&&Math.ceil(l)+h.viewportHeight>=ee.current.parentNode.offsetHeight&&A({type:"scroll",target:e,preventDefault:Vn,stopPropagation:Vn}),re.current={prevST:l,prevSL:a}})),Pe=$n((e=>{var t,n,l,o,c,d,u;const{keyCode:p}=e;if(r.current.uid===(null===(t=r.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id)&&(27===p&&(Ve([]),S(""),O(!1)),Re.length&&(Yi(document.activeElement,ee.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===p&&("radio"===(null==M?void 0:M.type)||F)){const t=null!==(o=null!==(l=f[0])&&void 0!==l?l:v)&&void 0!==o?o:null,n=null!==(c=a.find((e=>i(e,e.index)===t)))&&void 0!==c?c:null;n&&(null==J||J(n,e))}if(!je(Re[0],Re[1])){if(38===p||40===p){Ki(e);const t=a.length;let n=a.findIndex((e=>i(e,e.index)===Re[0]));const r=38===p?(--n+t)%t:++n%t,l=a[r],o=i(l,l.index),s=qe(o,Re[1]);"radio"!==(null==M?void 0:M.type)||(null===(d=M.disabled)||void 0===d?void 0:d.call(M,l))||s||C([o]),!F||(null===(u=F.disabled)||void 0===u?void 0:u.call(F,l))||s||S(o),De(38===p?"top":"bottom",r),$e(...Re),Ve([o,Re[1]])}if(9===p||e.shiftKey&&9===p){if(Ki(e),!s.length)return Ve([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Re[1]));const r=e.shiftKey&&9===p?(--n+t)%t:++n%t;$e(...Re),He(e.shiftKey&&9===p?"left":"right",r),Ve([Re[0],s[r].dataIndex])}}}})),De=(e,t)=>{const{scrollBarRef:n,scrollYLoad:i}=r.current;if(i)return me.scrollToIndex(t);const l=a.length,o=t,s=ee.current.querySelectorAll("tbody > tr"),c=a.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<n.current.scrollTop?n.current.SET_SCROLL_TOP(c):t===l-1&&n.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):c+d>n.current.scrollTop+h.viewportHeight?n.current.SET_SCROLL_TOP(c-(h.viewportHeight-d)):0===t&&n.current.SET_SCROLL_TOP(c)},He=(e,t)=>{const{scrollBarRef:n}=r.current,i=s.length,l=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),a=o.slice(0,l).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[l].width||o[l].renderWidth,p=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),m=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?a<n.current.scrollLeft+p?n.current.SET_SCROLL_LEFT(a-p):t===i-1&&n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+m):a+u>n.current.scrollLeft+(h.tableWidth-m)?n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+m):0===t&&n.current.SET_SCROLL_LEFT(a-p)},Me=()=>{w("$tableBody",ee.current)},Fe=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.focus()},$e=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.blur()},qe=(e,t)=>{var n,r;return null!==(r=null===(n=te.current[`${e}-${t}`])||void 0===n?void 0:n.isEditable())&&void 0!==r&&r},je=(e,t)=>{var n,r;return null!==(r=null===(n=te.current[`${e}-${t}`])||void 0===n?void 0:n.isOpening())&&void 0!==r&&r},Ke=e=>{const t=j.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},ze=(e,t,n)=>{var l;const{dataIndex:a}=n;if([au.expandableColumn,au.operationColumn].includes(a))return;const o=i(t,t.index);Ve([o,a]);const s=qe(o,a),{type:c,selectByClickRow:d=!0,disabled:u=Vn}=M||{};!c||u(t)||s||(d||a===au.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:i=!0,onSelect:l}=M||{};if("radio"===n&&C([e]),"checkbox"===n){const n=!f.includes(e),a=r.current.isTreeTable&&!i?Be(e,f,n):We(e,f,n);C(a),null==l||l(n,t,a)}})(o,t),[au.selectionColumn].includes(a)||(!F||(null===(l=F.disabled)||void 0===l?void 0:l.call(F,t))||s||S(o),null==X||X(t,n,e))},Ve=e=>{he(e,Re)||Oe(e)},We=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Be=(e,t,n)=>{var i;const{disabled:l}=M||{},{deriveRowKeys:a,recordsMap:o}=r.current,s=ta(a,e);let c=[],d=L((null==s?void 0:s.children)||[]);l&&(d=d.filter((e=>!o.has(e)||!l(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(i=Na(a,e))||void 0===i?void 0:i.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=ta(a,e),r=null===(t=null==n?void 0:n.children)||void 0===t?void 0:t.every((e=>c.includes(e.rowKey)));c=r?[...c,e]:c.filter((t=>t!==e))})),c},Ue=(e,n,i)=>{const{scrollXLoad:l}=r.current,{disabled:a}=M||{},s=["body--row",Object.assign({"body--row-striped":q&&n%2!=0,"body--row-selected":f.includes(i)&&!(null==a?void 0:a(e)),"body--row-current":v===i},E?Ke(e._group):null)],c=(l?ve:o).map(((t,r)=>Ge(l?o[t.index]:t,l?t.index:r,e,n,i)));return Y?t.createElement(kp,{key:i,ref:Te,className:_e(s),rowKey:i,rowIndex:n,row:e,indent:ue,filter:".cell--edit input",dropOption:pe,onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:oe,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de},c):t.createElement("tr",{key:i,ref:Te,"data-row-key":i,"data-row-index":n,className:_e(s)},c)},Ge=(e,n,r,i,l)=>{var a,o,s;const{dataIndex:u,fixed:h,align:m,className:f=""}=e,{rowSpan:g,colSpan:v}=Ye(r,e,i,n);if(!g||!v)return null;const y=null!==(a=e.ellipsis)&&void 0!==a?a:U,b=["body--column",{"col--ellipsis":y,"col--center":"center"===m,"col--right":"right"===m,"column--sort":!!p[u],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(o=c[c.length-v])||void 0===o?void 0:o.dataIndex)===u,"cell-fix-right-first":"right"===h&&(null===(s=d[0])||void 0===s?void 0:s.dataIndex)===u,[f]:!!f}],x={left:"left"===h?`${N(u)}px`:"",right:"right"===h?`${T(u)}px`:""},w=K?"function"==typeof K?K(r,i):K:null,C=z?"function"==typeof z?z(r,e,i,n):z:null,S=E?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=j.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,I=Object.assign({},x,{height:H},S,w,C);return t.createElement("td",{key:u,"data-col-index":n,rowSpan:g>1?g:void 0,colSpan:v>1?v:void 0,className:_e(b),style:I,onClick:t=>ze(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[au.expandableColumn,au.selectionColumn,au.operationColumn].includes(r)||null==Q||Q(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[au.expandableColumn,au.selectionColumn,au.operationColumn].includes(r)||null==Z||Z(t,n,e)})(t,r,e)},t.createElement(Fp,{ref:e=>te.current[`${l}-${u}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:l,showTitle:y}))},Ye=(e,t,n,r)=>{var i;let l=1,o=1;const s=V;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(c)?(l=c[0],o=c[1]):ae(c)&&(l=c.rowSpan,o=c.colSpan);const d=null!==(i=Ne[0])&&void 0!==i?i:0;if(e===a[d]&&0===l)for(let e=d;e<a.length;e++){const n=s({row:a[e],column:t,rowIndex:e,columnIndex:r,tableData:a});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;l++}}if(Ie.length>0){const e=Ie.find((e=>e.row===n&&e.col===r));e&&(l=e.rowSpan,o=e.colSpan)}return{rowSpan:l,colSpan:o}};return t.createElement(t.Fragment,null,t.createElement(fl,{ref:r.current.scrollBarRef,wrapClassName:`${l}--body-wrapper`,wrapStyle:Le,innerStyle:{height:we(),width:Ce()},showTopScrollbar:null==W?void 0:W.doubleXScrollbar,onScroll:Ae},t.createElement(rp.Provider,{value:Re},t.createElement("table",{ref:ee,style:{width:0,marginTop:xe(),marginLeft:Ee()},className:_e(`${l}--body`,{"virtual-container":r.current.scrollYLoad||r.current.scrollXLoad}),tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=r.current;return t.createElement("colgroup",null,(e?ve:o).map((n=>{const{dataIndex:r,width:i,renderWidth:l}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${i||l}px`,minWidth:`${i||l}px`}})})))})(),t.createElement("tbody",null,(e=>{const{scrollYLoad:n,scrollXLoad:l}=r.current,s=[];return(n?e:a).forEach(((e,r)=>{const c=n?a[e.index]:e,d=n?e.index:r,u=i(c,c.index);if(s.push(Ue(c,d,u)),null==$?void 0:$.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=Wn}=$;g.includes(u)&&n(c)&&s.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:(l?ve:o).length,className:"body--column",style:{paddingLeft:M?2*au.selectionColumnWidth:au.selectionColumnWidth}},t.createElement("div",{className:_e("cell",e)},$.expandedRowRender(c,d)))))}})),s})(ge)))),!!B&&t.createElement(qp,{ref:ne})))}));jp.displayName="TableBody";const Kp=()=>{const{tableRef:e,prefixCls:n,sorter:r,layout:i,flattenColumns:l,leftFixedColumns:a,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=t.useContext(zd),{footRender:p}=e.current.props,{t:h}=Fn(),m=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",m.current)},g=(n,i,l)=>{var s,c;const{dataIndex:p,fixed:m,align:f,summation:g}=n,v=["footer--column","col--ellipsis",{"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!r[p],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&(null===(s=a[a.length-1])||void 0===s?void 0:s.dataIndex)===p,"cell-fix-right-first":"right"===m&&(null===(c=o[0])||void 0===c?void 0:c.dataIndex)===p}],y={left:"left"===m?`${d(p)}px`:"",right:"right"===m?`${u(p)}px`:""},b=(null==g?void 0:g.render)?g.render(e.current.tableFullData):da(i,`${p}_text`),x=0===l&&""===b?h("qm.table.config.summaryText"):b;return t.createElement("td",{key:p,title:x,className:_e(v),style:Object.assign({},y)},t.createElement("div",{className:"cell"},x))},{tableBodyWidth:v}=i;return t.createElement("div",{ref:m,className:`${n}--footer-wrapper`},p?p(l,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}px`:""}},t.createElement("colgroup",null,l.map((e=>{const{dataIndex:n,width:r,renderWidth:i}=e;return t.createElement("col",{key:n,style:{width:`${r||i}px`,minWidth:`${r||i}px`}})}))),t.createElement("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},l.map(((t,n)=>g(t,e,n)))))))))};var zp;!function(e){e.small="small",e.middle="default",e.large="default"}(zp||(zp={}));const Vp=e=>{var n,r,i,l;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(sn),{tableRef:u,prefixCls:p,$size:h,setElementStore:m}=t.useContext(zd),{uniqueKey:f,paginationConfig:g,infoBarConfig:v}=u.current.props,y=t.useRef(null),b=t.useMemo((()=>f?`tablePager_${f}`:""),[f]);t.useLayoutEffect((()=>{x(),S()}),[]);const x=()=>{m("$pager",y.current)},E=null!==(n=null==g?void 0:g.showSizeChanger)&&void 0!==n?n:au.pagination.showSizeChanger,w=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:au.pagination.showQuickJumper,C=(null==g?void 0:g.pageSizeOptions)||(null===(l=null===(i=null==d?void 0:d.table)||void 0===i?void 0:i.pagination)||void 0===l?void 0:l.pageSizeOptions)||au.pagination.pageSizeOptions,S=()=>Mn(void 0,void 0,void 0,(function*(){if(!b)return;const e=yield N(b);e&&e!==o&&(c(a,e),localStorage.setItem(b,e.toString()))})),N=e=>Mn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t&&!localStorage.getItem(b))try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),T=(e,t)=>Mn(void 0,void 0,void 0,(function*(){const n=null==d?void 0:d.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),I={[`${p}-pager`]:!0};return t.createElement("div",{ref:y,className:_e(I)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==v?void 0:v.position)&&t.createElement(mu,{total:s})),t.createElement(Q,{size:zp[h],showSizeChanger:E,showQuickJumper:w,pageSizeOptions:C,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},Wp=()=>{const{prefixCls:e,layout:n}=t.useContext(zd),r=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t}=n;return{top:`${e}px`,height:`${t}px`}}),[n]);return t.createElement("div",{className:`${e}--empty`,style:r},t.createElement(nl,null))},Bp=()=>{const{prefixCls:e,setElementStore:n}=t.useContext(zd),r=t.useRef(null);t.useLayoutEffect((()=>{i()}),[]);const i=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},Up=t.forwardRef(((e,n)=>{const r=hn(Wd,e),{rowKey:i,columns:l,loading:a,resizable:o,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:p,topSpaceAlign:h,showTableInfo:m,showFullScreen:f,showRefresh:g,showToolBox:v,showHeader:y,className:b,style:x}=r,{$size:E}=qn(r),w=t.useRef(null),C=t.useRef(null),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=ar("table"),R=$n(((e,t)=>{const n="function"==typeof i?i(e,t):null==e?void 0:e[i];return void 0===n?(nr("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:O,tableFullData:k,setElementStore:L,setOriginColumns:A,setTableFullData:P,setTableOriginData:_,setAllTableData:D,setDeriveRowKeys:H,setInvalidRowKeys:M,setFieldAuth:F,setColumnsDefined:$,setScrollXLoad:q,setScrollYLoad:j,setResizeState:K,setHandleState:z,setSummaries:V,setSelectionRows:W,setShouldToTop:B,setRecordsMap:U,setUnMounted:G,clearElementStore:Y,clearRecordsMap:X}=((e,{getRowKey:n,$size:r})=>{const{rowHeight:i,dynamicThead:l}=e,a=t.useRef({props:e,uid:nu(),tableManager:iu,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],allParentRowKeys:[],deriveRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!l,scrollBarRef:t.createRef(),rowHeight:i||au.rowHeightMaps[r],store:new lu,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:!jn&&/MSIE|Trident/.test(navigator.userAgent)});var o;o=e,a.current.props=o;const s=(e,t,r="",i=0)=>e.map((e=>{const l=n(e,e.index),a=r?`${r}.${e.index+1}`:`${e.index+1}`,o={level:i,rowKey:l,indexPath:a};return e.indexPath=a,e._level=i,e._parentRowKey=i?t:null,Array.isArray(e.children)&&(o.children=s(e.children,l,a,i+1)),t?Object.assign(o,{parentRowKey:t}):o}));return Object.assign(Object.assign({tableRef:a},a.current),{setElementStore:(e,t)=>{a.current.elementStore[e]=t},setOriginColumns:e=>{a.current.originColumns=e},setTableFullData:e=>{a.current.tableFullData=e},setTableOriginData:e=>{a.current.tableOriginData=e},setAllTableData:e=>{const t=na(e);a.current.allTableData=t,a.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{const t=e.some((e=>Array.isArray(e.children)));a.current.isTreeTable=t,a.current.deriveRowKeys=t?s(e,""):[],a.current.allParentRowKeys=t?ra(e,(e=>n(e,e.index))):[]},setInvalidRowKeys:e=>{a.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{a.current.fieldAuth[e]=t},setColumnsDefined:e=>{a.current.columnsDefined=e},setResizeState:e=>{a.current.resizeState=e},setHandleState:e=>{a.current.handleState=e},setSummaries:e=>{a.current.summaries=e},setScrollXLoad:e=>{a.current.scrollXLoad=e},setScrollYLoad:e=>{a.current.scrollYLoad=e},setShouldToTop:e=>{a.current.shouldToTop=e},setSelectionRows:e=>{a.current.selectionRows=e},setRecordsMap:(e,t)=>{a.current.recordsMap.set(e,t)},setUnMounted:e=>{a.current.unMounted=e},clearElementStore:()=>{for(const e in a.current.elementStore)a.current.elementStore[e]=null},clearRecordsMap:()=>{a.current.recordsMap.clear()}})})(r,{getRowKey:R,$size:E}),{tableFlatData:Q,setTableFlatData:Z,filters:J,setFilters:ee,sorter:te,setSorter:ne,superFilters:re,setSuperFilters:ie,pagination:le,setPagination:oe,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:pe,setHighlightKey:fe,updateMark:ge,forceUpdate:ve,mergedTdCells:ye,setMergedCells:be,layout:xe,setLayout:Ee,permission:we,setPermission:Ce,spinning:Se,setSpinning:Ne,isPingLeft:Te,setPingLeft:Ie,isPingRight:Re,setPingRight:Oe,isFullScreen:ke,setFullScreen:Le,updateTableFlatData:Ae}=(e=>{var n,r,i,l,a,o,s,c,d,u,p;const{uniqueKey:h,initialSorter:m={},initialFilter:f={},paginationConfig:g,rowSelection:v,expandable:y,rowHighlight:b,mergedCells:x}=e,{global:E}=t.useContext(sn),w={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:au.pagination.current,pageSize:null!==(o=null!==(i=null!==(r=(()=>{if(h)return Number(localStorage.getItem(`tablePager_${h}`))||void 0})())&&void 0!==r?r:null==g?void 0:g.pageSize)&&void 0!==i?i:null===(a=null===(l=null==E?void 0:E.table)||void 0===l?void 0:l.pagination)||void 0===a?void 0:a.pageSize)&&void 0!==o?o:au.pagination.pageSize,total:0},C=null!==(c=null!==(s=null==v?void 0:v.selectedRowKeys)&&void 0!==s?s:null==v?void 0:v.defaultSelectedRowKeys)&&void 0!==c?c:[],S=null!==(u=null!==(d=null==y?void 0:y.expandedRowKeys)&&void 0!==d?d:null==y?void 0:y.defaultExpandedRowKeys)&&void 0!==u?u:[],[N,T]=t.useState([]),[I,R]=t.useReducer(((e,t)=>he(e,t)?e:t),f),[O,k]=t.useReducer(((e,t)=>he(e,t)?e:t),m),[L,A]=t.useReducer(((e,t)=>he(e,t)?e:t),[]),[P,_]=t.useState(w),[D,H]=t.useReducer(((e,t)=>he(e,t)?e:t),C),[M,F]=t.useReducer(((e,t)=>he(e,t)?e:t),S),[$,q]=t.useState(null!==(p=null==b?void 0:b.currentRowKey)&&void 0!==p?p:""),[j,K]=t.useReducer((e=>e+1),0),[z,V]=su([],{value:x}),[W,B]=t.useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[U,G]=t.useState({export:!0,import:!0,print:!0}),[Y,X]=t.useState(!1),[Q,Z]=t.useState(!1),[J,ee]=t.useState(!1),[te,ne]=t.useState(!1);return{tableFlatData:N,setTableFlatData:T,filters:I,setFilters:R,sorter:O,setSorter:k,superFilters:L,setSuperFilters:A,pagination:P,setPagination:_,selectionKeys:D,setSelectionKeys:H,rowExpandedKeys:M,setRowExpandedKeys:F,highlightKey:$,setHighlightKey:q,updateMark:j,forceUpdate:K,mergedTdCells:z,setMergedCells:V,layout:W,permission:U,setPermission:G,setLayout:B,spinning:Y,setSpinning:X,isPingLeft:Q,setPingLeft:Z,isPingRight:J,setPingRight:ee,isFullScreen:te,setFullScreen:ne,updateTableFlatData:()=>T([...N])}})(r),{isFetch:Pe,isWebPagination:De,isScrollPagination:He,showPagination:Me,tableColumns:Fe,flattenColumns:$e,editableColumns:qe,summationColumns:je,leftFixedColumns:Ke,rightFixedColumns:ze,derivedMergeCells:Ve,treeExpandIndex:We,showSummary:Be,showFooter:Ue,isHeadGroup:Ge,bordered:Ye,isHeadSorter:Xe,isHeadFilter:Qe,isServiceSummation:Ze,isSelectCollection:Je,isTableImport:et,isTableClipboard:tt,isSuperSearch:nt,isFastSearch:rt,isPivotGrid:it,isGroupSummary:lt,isGroupSubtotal:at,isTableEmpty:ot,summationRows:st,fetchParams:ct}=du(r,{getRowKey:R,tableRef:O,tableFullData:k,tableFlatData:Q,sorter:te,filters:J,superFilters:re,selectionKeys:se,pagination:le,mergedTdCells:ye}),{createElementStore:dt,tableStyles:ut,getSpan:pt,getStickyLeft:ht,getStickyRight:mt,scrollXToColumn:ft,scrollYToRecord:gt,calcTableHeight:vt,resetTableScroll:yt,doLayout:bt}=pu(r,{getRowKey:R,tableRef:O,topElementRef:w,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:Fe,flattenColumns:$e,leftFixedColumns:Ke,derivedMergeCells:Ve,tableFlatData:Q,layout:xe,showFooter:Ue,showPagination:Me,isFullScreen:ke,setLayout:Ee,setElementStore:L,setShouldToTop:B}),{initialTable:xt,checkDataIndex:Et,createTableFullData:wt,getTableData:Ct,createTableList:St,createTableData:Nt,createGroupData:Tt,setSelectionKeysEffect:It,findParentRowKeys:Rt,getAllChildRowKeys:Ot,doFieldValidate:kt,getTableLog:Lt,dataChange:At,tableChange:Pt,toLastPage:_t,toFirstPage:Dt,getPageCount:Ht,pagerChangeHandle:Mt,scrollBottomDebouncer:Ft,clearTableSorter:$t,clearTableFilter:qt,clearSuperFilters:jt,clearRowSelection:Kt,clearRowHighlight:zt,clearTableLog:Vt,destroy:Wt}=uu(r,{getRowKey:R,tableRef:O,tableElementRef:C,tableBodyRef:S,$size:E,tableColumns:Fe,flattenColumns:$e,tableFullData:k,pagination:le,layout:xe,filters:J,sorter:te,superFilters:re,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,summationColumns:je,isFetch:Pe,isWebPagination:De,isScrollPagination:He,isServiceSummation:Ze,isGroupSubtotal:at,doLayout:bt,setTableFlatData:Z,setTableFullData:P,setTableOriginData:_,setAllTableData:D,setDeriveRowKeys:H,setPagination:oe,setPingRight:Oe,setPingLeft:Ie,setSpinning:Ne,setSorter:ne,setFilters:ee,setSuperFilters:ie,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setScrollXLoad:q,setScrollYLoad:j,setFieldAuth:F,setResizeState:K,setSummaries:V,setPermission:Ce,setRecordsMap:U,resetTableScroll:yt,clearElementStore:Y,clearRecordsMap:X});((e,n)=>{const{columns:r,summation:i,rowSelection:l,expandable:a,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,summationRows:f,showSummary:g,isWebPagination:v,isScrollPagination:y,checkDataIndex:b,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:C,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:T,setRowExpandedKeys:I,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:L,initialTable:A,destroy:P}=n,_=t.useRef(f);$i((()=>{if(!l)return;const{onChange:e}=l;"radio"===l.type&&c.current.setClickedValues(p.length?[p[0],""]:[]),p.__prevent__||null==e||e(p,s.current.selectionRows),aa(p)}),[p]),$i((()=>{if(!a)return;const{onChange:e}=a;h.__prevent__||null==e||e(h,h.map((e=>s.current.recordsMap.get(e)))),aa(h)}),[h]),$i((()=>{var e,t;o&&(c.current.setClickedValues(m?[m,""]:[]),null===(e=o.onChange)||void 0===e||e.call(o,m,null!==(t=s.current.recordsMap.get(m))&&void 0!==t?t:null))}),[m]),$i((()=>{var e;he(f,_.current)||(_.current=f,g&&i&&(null===(e=i.onChange)||void 0===e||e.call(i,f)))}),[f]),$i((()=>{const e=l.selectedRowKeys||[];he(e,p)||N(la(e))}),[null==l?void 0:l.selectedRowKeys]),$i((()=>{const e=a.expandedRowKeys||[];he(e,h)||I(la(e))}),[null==a?void 0:a.expandedRowKeys]),$i((()=>{const{currentRowKey:e}=o;e!==m&&R(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),$i((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&C({insert:null,remove:!1})}),[u.total]),$i((()=>{L()}),[d]),$i((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||nr("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),hu({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(O(Object.assign({},e,{winHeight:n})),L())},delay:16}),t.useEffect((()=>(T(Zn(r)),A(),b(),Un((()=>L())),()=>{P(),k(!0)})),[])})(r,{tableRef:O,tableBodyRef:S,$size:E,pagination:le,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,showSummary:Be,summationRows:st,isWebPagination:De,isScrollPagination:He,checkDataIndex:Et,toLastPage:_t,toFirstPage:Dt,getPageCount:Ht,setHandleState:z,scrollYToRecord:gt,setOriginColumns:A,setSelectionKeysEffect:It,setRowExpandedKeys:ue,setHighlightKey:fe,setResizeState:K,setUnMounted:G,calcTableHeight:vt,initialTable:xt,destroy:Wt});const Bt=t.useMemo((()=>({getRowKey:R,tableRef:O,tableBodyRef:S,prefixCls:I,$size:E,tableFlatData:Q,flattenColumns:$e,editableColumns:qe,leftFixedColumns:Ke,rightFixedColumns:ze,treeExpandIndex:We,sorter:te,filters:J,superFilters:re,layout:xe,bordered:Ye,showFooter:Ue,showSummary:Be,summationRows:st,pagination:le,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,mergedTdCells:ye,derivedMergeCells:Ve,updateMark:ge,isFetch:Pe,isPingLeft:Te,isPingRight:Re,isHeadSorter:Xe,isHeadFilter:Qe,isFullScreen:ke,isTableEmpty:ot,isHeadGroup:Ge,isGroupSubtotal:at,isWebPagination:De,dataChange:At,tableChange:Pt,getTableData:Ct,setElementStore:L,createTableList:St,createTableFullData:wt,updateTableFlatData:Ae,setSorter:ne,setFilters:ee,setSuperFilters:ie,setHighlightKey:fe,setRowExpandedKeys:ue,setSelectionRows:W,setSelectionKeysEffect:It,setInvalidRowKeys:M,setMergedCells:be,getSpan:pt,getStickyLeft:ht,getStickyRight:mt,scrollXToColumn:ft,scrollYToRecord:gt,setPagination:oe,setPingLeft:Ie,setPingRight:Oe,setSpinning:Ne,setFullScreen:Le,setShouldToTop:B,doFieldValidate:kt,createTableData:Nt,createGroupData:Tt,findParentRowKeys:Rt,getAllChildRowKeys:Ot,scrollBottomDebouncer:Ft,resetTableScroll:yt,clearTableSorter:$t,clearTableFilter:qt,clearSuperFilters:jt,clearRowSelection:Kt,clearRowHighlight:zt})),[E,Q,$e,te,J,re,xe,Ye,Ue,Be,st,le,ct,se,de,pe,Ve,ge,Pe,Te,Re,Xe,Qe,ke,ot,Ge,at,De]);((e,n)=>{const{getRowKey:r,tableRef:i,toolBoxRef:l,tableBodyRef:a,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:p,rowExpandedKeys:h,highlightKey:m,isFetch:f,dataChange:g,getTableData:v,createTableData:y,createTableFullData:b,calcTableHeight:x,scrollXToColumn:E,scrollYToRecord:w,doFieldValidate:C,setTableOriginData:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:_,clearRowHighlight:D,clearTableSorter:H,clearTableFilter:M,clearSuperFilters:F,clearTableLog:$}=n,{columns:q,columnsChange:j}=i.current.props,K=(e,t,n)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=K(e.children,t,n));const l=t.includes(i);return l&&(null==n||n(e,i)),!l}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:e=>Mn(void 0,void 0,void 0,(function*(){f&&(yield v(),null==e||e())})),GET_LOG:()=>P(),GET_FETCH_PARAMS:()=>{const e={};for(const t in u)Object.keys(d).includes(t)||(e[t]=u[t]);return e},CLEAR_TABLE_DATA:()=>{f||(_(),D(),H(),M(),F(),$(),y([]))},CLEAR_LOG:()=>{$(),A()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{w(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?la([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?la([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{L(e),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=Ql(q,e);if(!r)return nr("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!ae(t))return nr("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return nr("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&me(r,e,t[e]);n&&(j?j([...q]):nr("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:l}=i.current,a=(Array.isArray(e)?e:[e]).filter((e=>ae(e)));if(!a.length)return;a.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[au.expandableColumn,au.selectionColumn,au.operationColumn].includes(n)||ua(e,n,da(e,n))})),n.addToInserted(e)}));const o="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=l;if(c)o?d.unshift(...a):d.push(...a);else{const e=Ta(l,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...a):e.children.push(...a):e.children=a)}c&&N(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),y(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=i.current,l=(Array.isArray(e)?e:[e]).map((e=>ae(e)?r(e,e.index):e));if(!l.length)return;let a=!1;const o=K(n,l,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:i,editRender:l}=r,a=null==l?void 0:l(e,r);if(!a)return;const{rules:o=[],disabled:s}=a;!s&&o.length&&(t.removeFromRequired({x:n,y:i}),t.removeFromValidate({x:n,y:i}),t.removeFromEdited({x:n,y:i}))})),a=!0}));a&&(N(Object.assign({},i.current.handleState,{remove:!0})),b(o),I(p.filter((e=>!l.includes(e)))),l.includes(m)&&D(),R(h.filter((e=>!l.includes(e)))),g(),Un((()=>{S(K(i.current.tableOriginData,l))})))},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:l,title:a,editRender:o}=i,s=null==o?void 0:o(n,i);if(!s)return;const c=r(n,n.index);if(e&&!e.includes(c))return;if(t&&!t.includes(l))return;const{rules:d=[],disabled:u}=s;u||C(d,da(n,l),c,l,xa(a))}))}));const{required:n,validate:l}=P(),a=[...n,...l];return a.length&&w(a[0].rowKey),A(),{required:n,validate:l}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:$e,editableColumns:qe,pagination:le,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,isFetch:Pe,dataChange:At,getTableData:Ct,createTableData:Nt,createTableFullData:wt,calcTableHeight:vt,scrollXToColumn:ft,scrollYToRecord:gt,doFieldValidate:kt,setTableOriginData:_,setHandleState:z,setColumnsDefined:$,setSelectionKeysEffect:It,setRowExpandedKeys:ue,setHighlightKey:fe,setSelectionRows:W,setOriginColumns:A,forceUpdate:ve,getTableLog:Lt,clearRowSelection:Kt,clearRowHighlight:zt,clearTableSorter:$t,clearTableFilter:qt,clearSuperFilters:jt,clearTableLog:Vt}),t.useLayoutEffect((()=>{dt(),O.current.tableManager.register(O.current.uid,null!=n?n:{current:null})}),[]);const Ut={[`${I}--wrapper`]:!0,[`${I}--lg`]:"large"===E,[`${I}--sm`]:"small"===E,[`${I}--maximize`]:ke,[s]:!!s},Gt={[I]:!0,"is--border":Ye,"is--fixed":Ke.length||ze.length,"is--sortable":Xe,"is--filterable":Qe,"is--head-group":Ge,"is--area-select":!!c,"is--ping-left":Te,"is--ping-right":Re};return t.createElement(zd.Provider,{value:Bt},t.createElement("div",{className:_e(Ut,b),style:x},m&&t.createElement("div",{ref:w,className:`${I}-top`},t.createElement("div",{className:`${I}-top__space`},"bottom"!==(null==p?void 0:p.position)&&t.createElement(mu,{total:le.total}),t.createElement("div",{className:`${I}-top__space-slot`,style:{justifyContent:Jd[h]}},r.children)),t.createElement("div",{className:`${I}-top__actions`},t.createElement(Bu,{ref:N,showFullScreen:f,showReload:g&&Pe,showPrint:we.print&&!!d,showImport:we.import&&et,showExport:we.export&&!!u,showClipboard:tt,showCollection:Je,showFastSearch:rt,showSuperSearch:nt,showPivotGrid:it,showGroupSummary:lt,showToolBox:v,tableColumns:Fe}),t.createElement(Gu,{ref:T,columns:l}))),t.createElement(rl,{spinning:null!=a?a:Se},t.createElement("div",{ref:C,className:_e(Gt),style:ut},t.createElement("div",{className:`${I}--main-wrapper`},y&&t.createElement(np,{tableColumns:Fe}),t.createElement(jp,{ref:S}),Ue&&t.createElement(Kp,null)),Ye&&t.createElement("div",{className:`${I}--border-line`}),ot&&t.createElement(Wp,null),o&&t.createElement(Bp,null))),Me&&t.createElement(Vp,On({},le,{onChange:(e,t)=>Mt({current:e,pageSize:t})}))))}));Up.displayName="QmTable";const Gp=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:p}=e,{$size:h}=qn(e),{t:m}=Fn(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=cl(f),[b,x]=t.useState(c),[E,w]=t.useState(),[C,S]=t.useState(o),[N,T]=t.useState(!1),[I,R]=t.useState(300),[O,k]=t.useState(s),[L,A]=t.useState((e=>[{title:m("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[P,_]=t.useState(ve({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[D,H]=t.useState([]),M=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Oo[h]-30)},F=dl(M,5);fn((()=>{F()}),[y.width]),$i((()=>{he(s,O)||k(s)}),[s]),t.useEffect((()=>{$()}),[P]),t.useEffect((()=>{a&&v.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;l&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(l))}),[]);const $=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=b;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:a=Wn}=n;if(a(P)){T(!0);try{const t=yield r(P);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[];i||(S([]),yield Bn(0)),H(n)}}catch(e){}T(!1)}})),q=e=>{i||(w(e),p(e))},j=e=>{_(Object.assign({},P,e))},K={[`${ar("search-helper")}--wrapper`]:!0},z=b.webPagination?{dataSource:D,loading:N,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:P})};return t.createElement("div",{ref:f,className:_e(K,d),style:u},t.createElement("div",{className:"form-wrap"},O.length?t.createElement(hd,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>M(),onFinish:e=>j(e),onReset:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||j(t)}))}):null),t.createElement("div",null,t.createElement(Up,On({ref:v,uniqueKey:r,height:I,columns:L,rowKey:b.rowKey||"pageIndex"},z,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:C,onChange:(e,t)=>{S(e),w(i?t:t[0])}},paginationConfig:b.paginationConfig,columnsChange:e=>A(e),onRowDblclick:q,onRowEnter:q}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>p(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!E,onClick:()=>p(E,i?C:void 0)},m("qm.dialog.confirm"))))};Gp.displayName="QmSearchHelper";const Yp=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Yp(e.children)),e.children&&t.push(e.value)})),t},Xp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Xp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Qp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Qp(e.children,t),t(e)||e.children&&e.children.length))),Zp=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:l,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:p,onClose:h}=e,{$size:m}=qn(e),{t:f}=Fn(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=cl(g),[x,E]=t.useState(c),[w,C]=t.useState(),[S,N]=t.useState(o),[T,I]=t.useState(!1),[R,k]=t.useState(300),[L,A]=t.useState(300),[P,_]=t.useState(s),[D,H]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[M,F]=t.useState(ve({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[$,q]=t.useState([]),j=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");k(e.offsetHeight-n.offsetHeight-10),A(e.offsetHeight-t.offsetHeight-2*Oo[m]-30)},K=dl(j,5);fn((()=>{K()}),[b.width]),$i((()=>{he(s,P)||_(s)}),[s]),t.useEffect((()=>{z()}),[M]),t.useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;l&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(l)),te()}),[]);const z=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=x;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:a=Wn}=n;if(a(M)){I(!0);try{const t=yield r(M);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,l))&&void 0!==e?e:[];i||(N([]),yield Bn(0)),q(n)}}catch(e){}I(!1)}})),V=e=>{i||(C(e),h(e))},W=e=>{F(Object.assign({},M,e))},[B,U]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),J=t.useRef(B),ee=t.useRef([]);$i((()=>{X(Yp(B))}),[B]);const te=()=>Mn(void 0,void 0,void 0,(function*(){var e;if(!d.fetch)return;const{api:t,params:n,dataKey:r,valueKey:i="value",textKey:l="text"}=d.fetch;try{const a=yield t(n);if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=ue(a.data,r))&&void 0!==e?e:[],n=Ga(t,i,l);U(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${po.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${ar("tree-table-helper")}--wrapper`]:!0},ie=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:M})};return t.createElement("div",{ref:g,className:_e(re,u),style:p},t.createElement(el,{defaultValue:200,style:{height:"100%"}},t.createElement(el.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(O,{className:"input-wrap",value:Q,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),suffix:t.createElement(Ge,null),allowClear:!0,onChange:e=>(e=>{const t=Qp(J.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==ne(n).indexOf(e)}));Z(e),U(t)})(e.target.value)}),t.createElement(G,{fieldNames:{title:"text",key:"value",children:"children"},height:R,defaultExpandAll:!0,expandedKeys:Y,treeData:B,filterTreeNode:e=>{if(!Q)return!1;const t=e.text||"";return-1!==ne(t).indexOf(Q)},onExpand:e=>{X(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return nr("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=ue(e,t[r]);W(n)})(Xp(ee.current,(n=>ue(n,t)===e[0]))||{})}})),t.createElement(el.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},P.length?t.createElement(hd,{ref:v,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>_(e),onCollapse:()=>j(),onFinish:e=>W(e),onReset:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||W(t)}))}):null),t.createElement("div",null,t.createElement(Up,On({ref:y,uniqueKey:r,height:L,columns:D,rowKey:x.rowKey||"pageIndex"},ie,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),C(i?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>H(e),onRowDblclick:V,onRowEnter:V}))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!w,onClick:()=>h(w,i?S:void 0)},f("qm.dialog.confirm"))))};Zp.displayName="TreeTableHelper";const Jp=e=>{var n,r,i;const{multiple:l,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=qn(e),{t:p}=Fn(),[h,m]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${ar("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},Qn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:_e(g,s),style:c},t.createElement(Kd,{multiple:l,fetch:v,fieldsDefine:{valueKey:null===(r=a.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(i=a.fetch)||void 0===i?void 0:i.textKey},autoFocus:!0,asyncLoad:a.asyncLoad,checkStrictly:a.checkStrictly,checkStrategy:a.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:a.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>d(null),style:{marginRight:8}},p("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!h,onClick:()=>d(h)},p("qm.dialog.confirm"))))};Jp.displayName="TreeHelper";const eh="_startSign",th="_endSign",nh=e=>{var n;const{uniqueKey:r,initialValue:i,filters:l=[],table:a={},onClose:o}=e,{$size:s}=qn(e),{t:c}=Fn(),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=cl(d),[m,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[w,C]=t.useState(l),[S,N]=t.useState((e=>[{title:c("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},{title:c("qm.form.rangeSearchHelper")[0],dataIndex:eh,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:th,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[T,I]=t.useState(ve({},null===(n=a.fetch)||void 0===n?void 0:n.params,i)),[O,k]=t.useState([]),L=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),A=t.useMemo((()=>2===L.length&&L.every((e=>void 0!==e))),[L]),P=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");E(e.offsetHeight-t.offsetHeight-2*Oo[s]-30)},_=dl(P,5);fn((()=>{_()}),[h.width]),$i((()=>{he(l,w)||C(l)}),[l]),t.useEffect((()=>{D()}),[T]);const D=()=>Mn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=m;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:l=Wn}=n;if(l(T)){v(!0);try{const t=yield r(T);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=ue(t.data,i))&&void 0!==e?e:[];k(n)}}catch(e){}v(!1)}})),H=(e,t)=>{delete e[t]},M=()=>{y.forEach((e=>{e&&(H(e,eh),H(e,th))})),b([])},F=e=>{M(),I(Object.assign({},T,e))},$=ar("range-helper"),q=m.webPagination?{dataSource:O,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},m.fetch),{params:T})};return t.createElement("div",{ref:d,className:`${$}--wrapper`},t.createElement("div",{className:"form-wrap"},w.length?t.createElement(hd,{ref:u,items:w,initialValues:i,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>C(e),onCollapse:()=>P(),onFinish:e=>F(e),onReset:()=>Mn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||F(t)}))}):null),t.createElement("div",null,t.createElement(Up,On({ref:p,height:x,columns:S,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},q,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[eh,th].includes(n)&&(n===eh&&(e[n]?(H(e,n),b([void 0,y[1]])):e.pageIndex>L[1]?R.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&H(y[0],n),e[n]="[",b([e,y[1]]))),n===th&&(e[n]?(H(e,n),b([y[0],void 0])):e.pageIndex<L[0]?R.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&H(y[1],n),e[n]="]",b([y[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[eh]="["),e.pageIndex===L[1]&&(e[th]="]")}))}}),t.createElement(rr,{type:"primary",icon:t.createElement(bt,null),title:c("qm.table.alert.clear"),onClick:()=>M()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Oo[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(rr,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(rr,{type:"primary",disabled:!A,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[eh,th].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};nh.displayName="RangeTableHelper";const rh=e=>null!=e;function ih(e,n,r,i){const[l,a]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[o,s]=t.useState(null),c=()=>{if(l){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:i,bottom:l,left:a}=e.getBoundingClientRect();return r>=0&&a>=0&&i<=t&&l<=n})(l)&&n&&l.scrollIntoView(i);const{left:e,top:t,width:r,height:a}=l.getBoundingClientRect(),o={left:e,top:t,width:r,height:a,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[l,n]),hu({handler:c});return[t.useMemo((()=>{if(!o)return o;const e=(null==r?void 0:r.offset)||6,t=(null==r?void 0:r.radius)||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,r]),l]}const lh=8;const ah={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"]}},oh={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"]}},sh=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function ch(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:l,visibleFirst:a}=e,o=t/2,s={};return Object.keys(ah).forEach((e=>{const c=r&&oh[e]||ah[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,sh.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-o-i;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=o+i;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-o-i;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=o+i}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?lh:r}}({contentRadius:l,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":d.offset[1]=2*-u.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":d.offset[1]=2*u.arrowOffsetHorizontal-o}d.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const i=r&&"object"==typeof r?r:{},l={};switch(e){case"top":case"bottom":l.shiftX=2*t.arrowOffsetHorizontal+n,l.shiftY=!0,l.adjustY=!0;break;case"left":case"right":l.shiftY=2*t.arrowOffsetVertical+n,l.shiftX=!0,l.adjustX=!0}const a=Object.assign(Object.assign({},l),i);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,u,t,n),a&&(d.htmlRegion="visibleFirst")})),s}const dh={fill:"transparent",pointerEvents:"auto"},uh=e=>{const{prefixCls:n,rootClassName:r,pos:i,showMask:l,style:a={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${nu()}`,p="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(Xt,{open:s,autoLock:!0},t.createElement("div",{className:_e(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},a)},l?t.createElement("svg",{style:{width:"100%",height:"100%"}},t.createElement("defs",null,t.createElement("mask",{id:u},t.createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),i&&t.createElement("rect",{x:i.left,y:i.top,rx:i.radius,width:i.width,height:i.height,fill:"black",className:p?`${n}-placeholder-animated`:""}))),t.createElement("rect",On({},i?null:dh,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),i&&t.createElement(t.Fragment,null,t.createElement("rect",On({},dh,{x:"0",y:"0",width:"100%",height:`${i.top}px`})),t.createElement("rect",On({},dh,{x:"0",y:"0",width:i.left,height:"100%"})),t.createElement("rect",On({},dh,{x:"0",y:i.top+i.height,width:"100%",height:`calc(100vh - ${i.top+i.height}px)`})),t.createElement("rect",On({},dh,{x:i.left+i.width,y:"0",width:`calc(100vw - ${i.left+i.width}px)`,height:"100%"})))):null))},ph=e=>{const{prefixCls:n,zIndex:r,open:i,onPause:l,onPlay:a}=e,[o,s]=su(void 0,{value:i,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=$n((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));t.useEffect((()=>{const e=jt(document,"keyup",u);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},h=()=>{d.current?d.current=!1:(s(!o),o?null==l||l():null==a||a())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{p(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,i=window.innerWidth,l=window.innerHeight,a=e.clientX-Ui(t).x,o=e.clientY-Ui(t).y;return document.onmousemove=e=>{let s=e.clientX-a,c=e.clientY-o;s<0&&(s=0),s>i-n-1&&(s=i-n-1),c<0&&(c=0),c>l-r-1&&(c=l-r-1),Vi(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>h()},o?t.createElement(xt,null):t.createElement(Et,null))},hh=e=>{const{prefixCls:n,current:r,total:i=0,cover:l,title:a,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:p,onNext:h,onFinish:m,className:f,indicatorsRender:g}=e,{t:v}=Fn(),y="primary"!==c?"primary":"default",b=$n((e=>{C(e),40===e.keyCode&&(r<i-1?null==h||h():null==m||m()),38===e.keyCode&&r>0&&(null==p||p())}));t.useEffect((()=>{const e=jt(document,"keyup",b);return()=>e.remove()}),[]);const x=rh(l)?t.createElement("div",{className:`${n}-cover`},l):null,E=rh(o)?t.createElement("div",{className:`${n}-description`},o):null;let w;w=g?g(r,i):[...Array.from({length:i}).keys()].map(((e,i)=>t.createElement("span",{key:e,className:_e(i===r&&`${n}-indicator-active`,`${n}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:_e(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(Ye,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(X,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(wt,{className:_e(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},a)),E,t.createElement("div",{className:`${n}-footer`},i>1&&t.createElement("div",{className:`${n}-indicators`},w),t.createElement(lr,{className:`${n}-buttons`},0!==r?t.createElement(rr,{className:`${n}-prev-btn`,size:"small",onMouseDown:C,onClick:p},v("qm.tour.prevStep")):null,r===i-1?t.createElement(rr,{className:`${n}-finish-btn`,type:y,size:"small",onClick:m},v("qm.tour.finish")):t.createElement(rr,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:h},v("qm.tour.nextStep"))))))},mh=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(hh,e))},fh={left:"50%",top:"50%",width:1,height:1},gh=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:i,current:l,onChange:a,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:p=!0,control:h=!0,overlayClassName:m,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:w=!0,scrollIntoViewOptions:C=!0}=e,S=Dn(e,["steps","defaultCurrent","current","onChange","onClose","onFinish","open","type","mask","arrow","control","overlayClassName","overlayStyle","placement","helper","zIndex","renderPanel","indicatorsRender","gap","animated","scrollIntoViewOptions"]),N=t.useRef(),[T,I]=su(0,{value:l,defaultValue:i}),[R,O]=su(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=su(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),_=t.useRef(R);t.useLayoutEffect((()=>{R&&!_.current&&I(0),_.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:D,type:H,placement:M,trigger:F,delay:$,style:q,arrow:j,className:K,mask:z,scrollIntoViewOptions:V,zIndex:W,action:B}=r[T]||{},U=W||k,G=H||d,Y=R&&(null!=z?z:u),X=null!=V?V:C,[Q,Z]=ih(D,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Z,g,M),ee=!!Z&&(void 0===j?p:j),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),$i((()=>{R&&(ie(),null==B||B(Z,T))}),[R,Z]);const ne=e=>{I(e),null==a||a(e)},re=()=>{O(!1),null==o||o(T)},ie=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===zi(r=n,"display")||"hidden"===zi(r,"visibility")||"0"===zi(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=()=>Mn(void 0,void 0,void 0,(function*(){if(!F||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[i,l]=[e+n/2,t+r/2],a=new MouseEvent(F,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:l}),o=document.elementFromPoint(i,l);o&&(o.dispatchEvent(a),yield Bn(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=ar("tour"),de=[{[`${ce}-primary`]:"primary"===G},m,K],ue=ch({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(uh,{zIndex:U,prefixCls:ce,pos:Q,showMask:ae,style:null==oe?void 0:oe.style,fill:null==oe?void 0:oe.color,open:A,animated:w,rootClassName:m}),t.createElement(Xt,{open:A,autoLock:!0},t.createElement(Qt,On({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:_e(de),prefixCls:ce,popup:()=>t.createElement(mh,On({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>Mn(void 0,void 0,void 0,(function*(){yield le(),ne(T-1)})),onNext:()=>Mn(void 0,void 0,void 0,(function*(){yield le(),ne(T+1)})),onClose:re,current:T,onFinish:()=>{re(),null==s||s()}},Object.assign({},r[T],{zIndex:U,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),t.createElement("div",{className:_e(m,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Q||fh),{position:"fixed",pointerEvents:"none"})}))),h&&t.createElement(Xt,{open:R},t.createElement(ph,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));gh.displayName="QmTour";const vh=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],yh=e=>({_s:e,status:vh[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),bh=e=>e?6:5,xh=(e,t,n,r,i)=>{clearTimeout(r.current);const l=yh(e);t(l),n.current=l,null==i||i({current:l})},Eh=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:i,timeout:a,initialEntered:s,mountOnEnter:c,unmountOnExit:d,onStateChange:h}=e||{},[m,f]=u((()=>yh(s?2:bh(c)))),g=l(m),v=l(),[y,b]=(e=>ae(e)?[e.enter,e.exit]:[e,e])(a),x=p((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return bh(t)}})(g.current._s,d);e&&xh(e,f,g,v,h)}),[h,d]),E=p((e=>{const l=e=>{switch(xh(e,f,g,v,h),e){case 1:y>=0&&(v.current=setTimeout(x,y));break;case 4:b>=0&&(v.current=setTimeout(x,b));break;case 0:case 3:v.current=setTimeout((()=>l(e+1)),0)}},a=g.current.isEnter;"boolean"!=typeof e&&(e=!a),e?!a&&l(t?r?0:1:2):a&&l(n?i?3:4:bh(d))}),[x,h,t,n,r,i,y,b,d]);return o((()=>()=>clearTimeout(v.current)),[]),[m,E,x]},wh=e=>{const{name:n,in:r,timeout:i,preEnter:l=!0,preExit:a}=e,[o,s]=Eh({timeout:i,preEnter:l,preExit:a,initialEntered:r});return fn((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?Hp(e,{className:_e(e.props.className,n,o.status)}):e)))};var Ch={previewWidth:1100,defaultDistance:.45,logoHeight:60};const Sh=n(void 0);var Nh=null;function Th(){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),i=e.match(/Firefox\D?\d+/i),l=e.match(/x64/i);if(!t&&!n&&l)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||l)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var a=e.match(/Chrome\D?\d+/i);if(a&&(a=a[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function Ih(e,t){var n;try{var r=navigator.userAgent,i=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(Th()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void R.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else{i&&r.match(/x64/i);if(e||t?n=i?e:t:Nh?n=Nh:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),i?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),Nh=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&Th(),n}catch(e){R.error("getLodop 出错:"+e)}}Th();const Rh=e=>{const t=e/25.4*(()=>{var e;const t=[],{deviceXDPI:n,deviceYDPI:r}=window.screen;if(n&&r)t[0]=n,t[1]=r;else{let n=document.createElement("DIV");n.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(n),t[0]=parseInt(n.offsetWidth.toString()),t[1]=parseInt(n.offsetHeight.toString()),null===(e=n.parentNode)||void 0===e||e.removeChild(n),n=null}return t})()[0];return Math.ceil(t)},Oh=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:i}=e,{global:l}=t.useContext(sn),{$$preview:a}=t.useContext(Sh),{state:o,isWindowsPrinter:s,pageSize:c}=a,d=t.useRef(null),u=t.useRef({}),p=t.useRef([]),h=t.useRef([]),m=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:L,createPrintHtml:k,SHOW_PREVIEW:A,DIRECT_PRINT:P}))),$i((()=>{R()}),[o.form.printerType,o.form.setting.direction,o.form.setting.distance,o.form.setting.fixedLogo]),t.useEffect((()=>{u.current.templateEl=d.current.querySelector(".origin-template").children[0],u.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Ch.defaultDistance+10*Ch.defaultDistance:0;return("vertical"===e?c[0]:c[1])-t}),[o,s,c]),y=t.useMemo((()=>{const{form:{setting:{direction:e}}}=o,t=s?10*Ch.defaultDistance+10*Ch.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Rh(v-10*(e.left-Ch.defaultDistance)-10*(e.right-Ch.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Rh(y-10*(e.top-Ch.defaultDistance)-10*(e.bottom-Ch.defaultDistance))}),[o,y]),E=o.form.scale,w=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:Rh(10*e.left),right:Rh(10*e.right),top:Rh(10*e.top),bottom:Rh(10*e.bottom)}}),[o]),C=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:i}=w,l=b+t+n,a=Ch.previewWidth-l<=0?0:(Ch.previewWidth-l)/2,s=Math.abs((1-E)*l/2);let c=0;return E>1&&(c=s>a?-1*a:-1*s),E<1&&(c=l-2*s>Ch.previewWidth?0:a>0?s:(Ch.previewWidth-(l-2*s))/2),{width:`${b}px`,height:""+("stylus"===e?"auto":x+"px"),paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${i}px`,transform:`translateX(${c}px) scale(${E})`,opacity:f?0:1}}),[o,f,w,E,x,b]);p.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const S=()=>{var e,t,n,r;const i=null!==(t=null===(e=null==l?void 0:l.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",a=null!==(r=null===(n=null==l?void 0:l.print)||void 0===n?void 0:n.rightLogo)&&void 0!==r?r:"";return[`<tr style="height: ${Ch.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',i?`<img src="${i}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',a?`<img src="${a}" border="0" height="46" />`:"","</td>","</tr>"].join("")},N=()=>{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=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=u.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},I=()=>{const e=u.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const i=e[r].clientHeight;e[r].style.height=i+"px",n.push(i),t.push(e[r].outerHTML)}h.current=n,p.current=t},R=()=>{var e;if(!p.current.length)return;const{form:{setting:t,printerType:n}}=o;if(i)return m.current.push([N(),S(),...p.current]);const r=t.fixedLogo?x-Ch.logoHeight:x;let l=[];if(m.current=[],"stylus"===n)m.current.push([N(),...t.fixedLogo?[S()]:[],...p.current]);else{let e=0;for(let n=0,i=h.current.length;n<i;n++){const a=p.current[n],o=h.current[n];t.fixedLogo||0!==n||(e+=Ch.logoHeight),e+=o,e<=r?l.push(a):(m.current.push([N(),...t.fixedLogo?[S()]:[],...l]),l=[],e=0,n-=1),n===i-1&&l.length&&m.current.push([N(),...t.fixedLogo?[S()]:[],...l])}}t.fixedLogo||null===(e=m.current[0])||void 0===e||e.splice(1,0,S());for(let e=0,t=m.current.length;e<t&&e!==t-1;e++)m.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:m.current.length}),O()},O=()=>{var e,t;const{currentPage:n}=o;let r=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;r+=null!==(t=null===(e=m.current[n-1])||void 0===e?void 0:e.join(""))&&void 0!==t?t:"",r+="</table>",u.current.previewEl.innerHTML=r,u.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${u.current.templateEl.className}">`;if(void 0!==e){t+=[...m.current[e-1]].join("")}else for(let e=0;e<m.current.length;e++)t+=m.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>"+S()+N()+e.join("")+"</table>"},A=()=>Mn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();u.current.previewEl.innerHTML||(T(),yield Bn(0),I(),R(),g(!1))})),P=()=>Mn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();T(),yield Bn(0),I(),R(),g(!1),a.doPrint(k()),yield Bn(0),a.doClose()})),_=()=>{nr("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},D={[ar("print-container")]:!0,"no-visible":i};return t.createElement("div",{ref:d,className:_e(D)},t.createElement(rl,{wrapperClassName:"spin",spinning:f,tip:"Loading..."},t.createElement("div",{className:"preview"},t.createElement("div",{className:"origin-template",style:{width:`${b}px`,marginLeft:`-${Math.floor(b/2)}px`}},null==r?void 0:r()),t.createElement("div",{className:"workspace",style:C}))))}));Oh.displayName="Container";class kh extends s{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:pn("qm.print.setPanel.printParameter")},{type:"SELECT",label:pn("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:pn("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:pn("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:pn("qm.print.setPanel.vertical"),value:"vertical"},{text:pn("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:pn("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:pn("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:pn("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:pn("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:pn("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Ch.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:pn("qm.print.setPanel.noEmpty")}]}],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})},this.getInitialExtra=()=>({disleft:pn("qm.print.setPanel.sizeUnit"),disright:pn("qm.print.setPanel.sizeUnit"),distop:pn("qm.print.setPanel.sizeUnit"),disbottom:pn("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>Mn(this,void 0,void 0,(function*(){const[e,t]=yield 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())})),this.cancelHandle=()=>{this.props.onClose()}}render(){const{formList:e}=this.state;return t.createElement(t.Fragment,null,t.createElement(hd,{ref:this.formRef,items:e,initialValues:this.getInitialvalue(),initialExtras:this.getInitialExtra(),labelWidth:120,cols:2}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(rr,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},pn("qm.dialog.close")),t.createElement(rr,{type:"primary",onClick:()=>this.confirmHandle()},pn("qm.dialog.confirm"))))}}kh.contextType=sn;class Lh extends s{constructor(){var e,n,r;super(...arguments),this.provide={$$preview:this},this.containRef=t.createRef(),this.state={visible:!1,form:{printerName:-1,printerType:(null===(e=this.props.defaultConfig)||void 0===e?void 0:e.printerType)||"laser",copies:(null===(n=this.props.defaultConfig)||void 0===n?void 0:n.copies)||1,scale:1,setting:{distance:{left:Ch.defaultDistance,right:Ch.defaultDistance,top:Ch.defaultDistance,bottom:Ch.defaultDistance},pageSize:"210*297",direction:(null===(r=this.props.defaultConfig)||void 0===r?void 0:r.direction)||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0},this.pageChangeHandle=e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))},this.exportClickHandle=()=>{this.doExport(this.containRef.current.createExportHtml())},this.printClickHandle=()=>Mn(this,void 0,void 0,(function*(){if(this.doPrint(this.containRef.current.createPrintHtml(this.state.printPage)),this.props.uniqueKey)try{const e=Object.assign(Object.assign({},this.state.form),{printerName:this.printerItems.find((e=>e.value===this.state.form.printerName)).text});yield an.setItem(this.printerKey,e),yield this.savePrintConfig(this.printerKey,e)}catch(e){}})),this.doClose=()=>{var e,t;null===(t=(e=this.props).onClose)||void 0===t||t.call(e)},this.getPrintConfig=e=>Mn(this,void 0,void 0,(function*(){const t=this.context.global,n=null==t?void 0:t.getComponentConfigApi;if(n)try{const t=yield n({key:e});if(200===t.code)return t.data}catch(e){}})),this.savePrintConfig=(e,t)=>Mn(this,void 0,void 0,(function*(){const n=this.context.global,r=null==n?void 0:n.saveComponentConfigApi;if(r)try{yield r({[e]:t})}catch(e){}})),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 ',this.doPrint=e=>{const t=Ih();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i,printerName:l,printerType:a,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Ch,{left:d,right:u,top:p,bottom:h}=i.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(l),t.SET_PRINT_COPIES(o),i.doubleSide&&("auto"===i.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"===a&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===a&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==a?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(pn("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=Ih();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:i}}=this.state;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(pn("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===i.direction?1:2),t.SAVE_TO_FILE(`${h().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:pn("qm.print.laserPrinter"),value:"laser"},{text:pn("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Ih(),t=[{text:pn("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){nr("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}`:""}componentDidMount(){var e,t;return Mn(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield an.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),ae(n)&&(yield an.setItem(this.printerKey,n))),ae(n)&&Object.keys(n).length&&ve(this.state.form,Object.assign(Object.assign({},n),{printerName:null!==(t=null===(e=this.printerItems.find((e=>e.text===n.printerName)))||void 0===e?void 0:e.value)&&void 0!==t?t:-1}))}catch(e){}}))}render(){const{preview:e,templateRender:n}=this.props,{visible:r,form:i,currentPage:l,totalPage:a,printPage:o}=this.state,s=ar("print-preview"),c={visible:r,title:pn("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},d={[s]:!0};return e?t.createElement(t.Fragment,null,t.createElement("div",{className:_e(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,pn("qm.print.printer"),":",t.createElement(H,{value:i.printerName,onChange:e=>{this.setState((t=>ve({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,pn("qm.print.type"),":",t.createElement(H,{value:i.printerType,onChange:e=>{this.setState((t=>ve({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(H.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,pn("qm.print.copies"),":",t.createElement($,{value:i.copies,min:1,precision:0,onChange:e=>{this.setState((t=>ve({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,pn("qm.print.printPage.0"),t.createElement($,{value:o,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),pn("qm.print.printPage.1")),t.createElement("span",null,t.createElement(Q,{size:"small",current:l,pageSize:1,total:a,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(rr,{type:"text",icon:t.createElement(at,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},pn("qm.print.setting"))),t.createElement("span",null,t.createElement(rr,{type:"text",icon:t.createElement(Ke,null),className:"text-btn",onClick:()=>this.exportClickHandle()},pn("qm.print.export"))),t.createElement("span",null,t.createElement(rr,{icon:t.createElement(it,null),type:"primary",onClick:this.printClickHandle},pn("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(Sh.Provider,{value:this.provide},t.createElement(Oh,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,pn("qm.print.scale"),":",t.createElement(Z,{value:i.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>ve({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*i.scale)}%`)),t.createElement("span",null,pn("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,pn("qm.print.pageNumber"),":",pn("qm.print.pagination",{currentPage:l,totalPage:a}))))),t.createElement(Ll,c,t.createElement(kh,{setting:i.setting,onChange:e=>{this.setState((t=>ve({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(Sh.Provider,{value:this.provide},t.createElement(Oh,{ref:this.containRef,templateRender:n,directPrint:!0}))}}Lh.contextType=sn;class Ah extends s{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>Mn(this,void 0,void 0,(function*(){var e,t;this.setState({loading:!0});try{const n=yield null===(t=(e=this.props).click)||void 0===t?void 0:t.call(e);if(this.setState({loading:!1}),"boolean"==typeof n&&!n)return;yield this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),this.createRender=()=>{const{visible:e}=this.state,{templateRender:n,uniqueKey:r,defaultConfig:i,preview:l,closeAfterPrint:a}=this.props,o={visible:e,title:pn("qm.print.preview"),width:`${Ch.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:i,preview:l,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return l?t.createElement(Ll,o,t.createElement(Lh,s)):e?t.createElement(Lh,s):null},this.DO_PRINT=()=>Mn(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield Bn(0),this.setState({visible:!0}),yield Bn(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:n,icon:r,type:i,disabled:l,shape:a}=this.props,o={size:n||this.context.size||"",type:i,shape:a,icon:r,loading:e,disabled:l,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(rr,o,this.props.children),this.createRender())}}function Ph(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function _h(e){const t=Ph(e);return t?t.frameElement:null}function Dh(e){const t=Fh(e);return Hh([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Hh(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 Mh(e,t){const n=_h(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let i=n,l=!1;for(;i;){const e=Dh(i);if(r.push(e),i=_h(i),l)break;i&&Ph(i)===t&&(l=!0)}return Hh(r)}return e.getBoundingClientRect()}function Fh(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)}}Ah.propTypes={size:(e,t,n)=>{if(!ka(e[t]||""))return tr("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Bt.elementType},Ah.defaultProps={preview:!0,type:"primary",icon:t.createElement(it,null)},Ah.contextType=sn;const $h=Object.assign;class qh{constructor(e,t){this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=Vh.border,this.padding.style.borderColor=Vh.padding,this.content.style.backgroundColor=Vh.background,$h(this.node.style,{borderColor:Vh.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){zh(t,"margin",this.node),zh(t,"border",this.border),zh(t,"padding",this.padding),$h(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"}),$h(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class jh{constructor(e,t){this.tip=e.createElement("div"),$h(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),$h(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),$h(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),i=Math.max(n.width,60),l=5;let a;a=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+l:e.top+e.height+l:e.top-r<=t.top+t.height?e.top-r-l<t.top+l?t.top+l:e.top-r-l:t.top+t.height-r-l;let o=e.left+l;e.left<t.left&&(o=t.left+l);e.left+i>t.left+t.width&&(o=t.left+t.width-i-l);return a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:n.width,height:n.height});$h(this.tip.style,r.style)}}class Kh{constructor(){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 jh(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();null==e||e.remove()}if(0===n.length)return;for(;this.rects.length<n.length;)this.rects.push(new qh(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=Mh(e,this.window),i=Fh(e);r.top=Math.min(r.top,n.top-i.marginTop),r.right=Math.max(r.right,n.left+n.width+i.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+i.marginBottom),r.left=Math.min(r.left,n.left-i.marginLeft);this.rects[t].update(n,i)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const i=Mh(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:i.top+this.tipBoundsWindow.scrollY,left:i.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function zh(e,t,n){$h(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 Vh={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 Wh=null,Bh=null;function Uh(){null!=window.document&&(Wh=null,null!==Bh&&(Bh.remove(),Bh=null))}class Gh{constructor(e){this._lastHoveredNode=null,this.iframesListeningTo=new Set,this.onClick=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onMouseEvent=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.onPointerDown=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))},this.onPointerMove=e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Yi(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Uh();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,r,i;n=[t],r=null,i=!1,null!=window.document?(null!==Wh&&clearTimeout(Wh),null!=n&&(null===Bh&&(Bh=new Kh),Bh.inspect(n,r),i&&(Wh=setTimeout((()=>Uh()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=Pe((e=>{var t;this._selectIgnore||null===(t=this.onSelect)||void 0===t||t.call(this,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(){Uh(),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 Yh(e){return document.querySelector(e)}const Xh=e=>{const{action:n,onConfirm:r,onCancel:i,onFinish:l}=e,{t:a}=Fn();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(lr,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(rr,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.closeButton")),t.createElement(rr,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(rr,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.finishButton"))))},Qh={left:"50%",top:"50%",width:1,height:1},Zh=t.forwardRef(((e,n)=>{const{open:r,current:i,defaultCurrent:l,steps:a=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:p,zIndex:h,helper:m={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=Fn(),E=t.useRef(),w=t.useRef(a.length),[S,N]=su(0,{value:i,defaultValue:l}),[T,I]=su(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=su(1051,{value:h,defaultValue:h}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[_,D]=t.useState(T),[H,M]=t.useState(!1),[$,q]=ih(k.node,!!r),[j,K]=t.useState(22),z=t.useRef(!1),V=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),W=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new Gh({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:ya(),node:e,path:t}),N(w.current),P(!0),U(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?B():U(),T?setTimeout((()=>D(!0)),16):D(!1),()=>{U()})),[T]),t.useEffect((()=>{w.current=a.length}),[a]);const B=()=>{E.current.startHandle()},U=()=>{E.current.stopHandle()},G=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:S,selector:k.path})})));const Y=ar("guide-tracker"),Q=[{[`${Y}-primary`]:!0}],Z=ch({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Xt,{open:T&&A,autoLock:!0},t.createElement(Qt,{zIndex:R,builtinPlacements:Z,popupPlacement:o,popupVisible:T&&A,popupClassName:_e(Q,c),popupStyle:d,prefixCls:Y,popup:()=>{const e=()=>{P(!1),B()};return t.createElement("div",{className:`${Y}-content`},t.createElement("div",{className:`${Y}-inner`},t.createElement(Ye,{className:`${Y}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(F,{open:H,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(rn,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),n=a.map((e=>e.id));if(he(t,n))return;const r=t.findIndex((e=>e===k.id)),i=-1!==r?r:S;N(i),null==v||v(Ra(e),i)}},a.map(((e,n)=>t.createElement("li",{key:n,className:_e("item",{actived:e.id===k.id})},t.createElement(Ue,{className:"handle",title:x("qm.form.draggable")}),t.createElement("span",{className:"box"},t.createElement("span",{className:"title",title:e.title,onClick:()=>{n!==S&&(L({id:e.id,node:Yh(e.selector),path:e.selector}),N(n),K(22===j?j+1:j-1),null==v||v(a,n))}},e.title),t.createElement(C,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=a.filter((t=>t.id!==e.id)),r=n===S;let i=n<=S?S-1:S;if(i=i<0?0:i,i=i>t.length?t.length:i,r&&t[i]){const{id:e,selector:n}=t[i];L({id:e,node:Yh(n),path:n})}N(i),null==v||v(t,i)}},t.createElement(Ye,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>M(e)},t.createElement(Ct,{className:_e(`${Y}-close`,"menu-icon"),style:{width:j}})),m.content&&t.createElement(X,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:m.content,title:m.title},t.createElement(wt,{className:_e(`${Y}-close`,"help-icon")})),t.createElement("div",{className:"panel-label"},t.createElement("span",{className:"title"},x("qm.guideTracker.label")),t.createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),W)),p?p({id:k.id,selector:k.path,actionStatus:V,DO_CLOSE:e},S):t.createElement(Xh,{action:V,onConfirm:()=>{null==v||v("add"===V?[...a,{id:k.id,selector:k.path,title:"Guide Title"}]:[...a],S),e()},onCancel:()=>{null==y||y(S),e()},onFinish:()=>{e(),null==y||y(S),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:_e(`${Y}-target-placeholder`),style:Object.assign(Object.assign({},$||Qh),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:G,onClick:G}))),s&&t.createElement(Xt,{open:_},t.createElement(ph,{zIndex:R,prefixCls:Y,onPause:()=>{z.current=A,P(!1),U()},onPlay:()=>{z.current?P(!0):B()}})))}));Zh.displayName="QmGuideTracker";const Jh=n=>{var r,i,l,a,o,s,c,d;const{content:u,image:p,width:h,height:m,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:w,className:C,style:S}=n,N=t.useRef(null),T=t.useRef(new Map),I=null!==(r=f.fontSize)&&void 0!==r?r:16,R=null!==(i=f.fontWeight)&&void 0!==i?i:"normal",O=null!==(l=f.fontStyle)&&void 0!==l?l:"normal",k=null!==(a=f.fontFamily)&&void 0!==a?a:"sans-serif",L=null!==(o=f.color)&&void 0!==o?o:"rgba(0, 0, 0, 0.15)",A=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],_=g[0],D=g[1],H=_/2,M=D/2,F=null!==(c=v[0])&&void 0!==c?c:H,$=null!==(d=v[1])&&void 0!==d?d:M,q=t.useMemo((()=>{const e=F-H,t=$-M;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:b}}),[H,M,F,$,b]),j=(e,t)=>{var n;if(N.current){const r=T.current.get(N.current);r&&(N.current.contains(r)&&N.current.removeChild(r),T.current.delete(N.current));const i=document.createElement("div");i.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(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=N.current)||void 0===n||n.append(i),T.current.set(N.current,i)}},K=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const n=(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),[r,i]=(e=>{let t=120,n=64;if(!p&&e.measureText){e.font=`${I}px ${k}`;const r=P.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...r)),n=I*P.length+3*(P.length-1)}return[null!=h?h:t,null!=m?m:n]})(t),l=r*n,a=i*n,o=(_+r)*n,s=(D+i)*n,c=_/2*n,d=D/2*n,u=o/2,f=s/2,g=2*(_+r);e.width=2*o,e.height=2*s,t.globalAlpha=x,t.save(),t.translate(u,f),t.rotate(Math.PI/180*y),t.translate(-u,-f);const v=()=>{t.restore(),t.drawImage(e,0,0,o,s,o,s,o,s),w&&(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),j(e.toDataURL(),g)},b=()=>{const e=Number(I)*n;t.font=`${O} normal ${R} ${e}px/${i}px ${k}`,t.fillStyle=L,t.textAlign=A,t.textBaseline="top",t.translate(l/2,0),P.forEach(((r,i)=>{t.fillText(null!=r?r:"",c,d+i*(e+3*n))})),v()};if(p){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,l,a),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=p}else b()},z=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{K()}),[u,p,h,m,f,g,v,y,b,x,E,w]),function(t,n,r={}){const i=window&&"MutationObserver"in window,l=e.useRef(),a=()=>{l.current&&(l.current.disconnect(),l.current=void 0)};e.useLayoutEffect((()=>(a(),i&&t.current&&(l.current=new MutationObserver(n),l.current.observe(t.current,r)),()=>a())),[t])}(N,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>z(e))),n="attributes"===t.type&&z(t.target);if(e||n){K();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const V=ar("watermark");return t.createElement("div",{ref:N,className:_e(V,C),style:Object.assign({position:"relative"},S)},n.children)},em=new Map,tm=new WeakMap;let nm,rm=0;function im(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(tm.has(n)||(rm+=1,tm.set(n,rm.toString())),tm.get(n)):"0"):e[t]}`;var n})).toString()}function lm(e,t,n={},r=nm){if(void 0===window.IntersectionObserver&&void 0!==r){const i=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:i,intersectionRect:i,rootBounds:i}),()=>{}}const{id:i,observer:l,elements:a}=function(e){const t=im(e);let n=em.get(t);if(!n){const r=new Map;let i=[];const l=new IntersectionObserver((t=>{t.forEach((t=>{var n;const l=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=l),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(l,t)}))}))}),e);i=l.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:l,elements:r},em.set(t,n)}return n}(n),o=a.get(e)||[];return a.has(e)||a.set(e,o),o.push(t),l.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(a.delete(e),l.unobserve(e)),0===a.size&&(l.disconnect(),em.delete(i))}}const am=e=>{const{forceRender:n,height:r,placeholder:i=null,unmountIfInvisible:l,className:a,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:i,fallbackInView:l,trackVisibility:a,skip:o,delay:s,onChange:c}={})=>{var d;const[u,p]=t.useState(null),[h,m]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(o||!u)return;let t;return t=lm(u,((e,n)=>{var r;m({inView:e,entry:n}),null===(r=f.current)||void 0===r||r.call(f,e,n),n.isIntersecting&&i&&t&&(t(),t=void 0)}),{root:e,rootMargin:n,threshold:r,trackVisibility:a,delay:s},l),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,i,o,a,l,s]);const g=null===(d=h.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||i||o||v.current===g||(v.current=g,m({inView:!1,entry:void 0}));const y=[p,h.inView,h.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!l}));t.useEffect((()=>{r||nr("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[ar("lazy-load")]:!0};return t.createElement("div",{ref:s,className:_e(u,a),style:o},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},i))};class om{constructor(e,t,n,r){if(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 sm{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 sm(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,i=e.y-t.y,l=t.x-n.x,a=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+i*i),p=Math.sqrt(l*l+a*a),h=p/(u+p),m=c+(o-c)*h,f=d+(s-d)*h,g=t.x-m,v=t.y-f;return{c1:new om(o+g,s+v),c2:new om(c+g,d+v)}}constructor(e,t,n,r,i,l){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=l}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,l=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=l-e,i=a-t;n+=Math.sqrt(r*r+i*i)}e=l,t=a}return n}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}}class cm{constructor(e,t){this.width=320,this.height=200,this.ratio=Math.max(window.devicePixelRatio||1,1),this.penColor="rgba(0,0,0,1)",this.backgroundColor="rgba(0,0,0,0)",this.canAddHistory=!1,this.openSmooth=!0,this.dotSize=0,this.throttle=16,this.minDistance=5,this.velocityFilterWeight=.7,this.compositeOperation="source-over",this.minWidth=.5,this.maxWidth=2.5,this.fontSize=16,this.eraserSize=20,this.lineHeight=1.25,this.degreeOfBlur=5,this.textInputPos={x:0,y:0},this.onStart=()=>{},this.onEnd=()=>{},this._drawingStroke=!1,this._lastPoints=[],this._data=[],this._historyList=[],this._lastVelocity=0,this._lastWidth=0,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)},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))},this.isTouchEvent=e=>"touches"in e,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)},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)},this._isLeftButtonPressed=(e,t)=>this.isTouchEvent(e)?!!e.touches.length:t?1===e.buttons:1==(1&e.buttons),this._pointerEventToSignatureEvent=e=>{var t,n;return{event:e,type:e.type,x:this.isTouchEvent(e)?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX,y:this.isTouchEvent(e)?null===(n=e.touches[0])||void 0===n?void 0:n.clientY:e.clientY,pressure:"pressure"in e?e.pressure:0}},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}),this._strokeBegin=e=>{this._drawingStroke=!0;const t=this._getPointGroupOptions(),n=Object.assign(Object.assign({},t),{points:[]});this._data.push(n),this._reset(t),this._strokeUpdate(e,!1)},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],i=r.points,l=i.length>0&&i[i.length-1],a=!!l&&n.distanceTo(l)<=this.minDistance,o=this._getPointGroupOptions(r);if(!l||!l||!a){const e=this._addPoint(n,o);t&&(l?e&&this._drawCurve(e,o):this._drawDot(n,o)),i.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}},this._strokeEnd=(e,t=!1)=>{this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1)},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},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()},this._drawCurve=(e,t)=>{const n=this.ctx,r=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){const l=n/i,a=l*l,o=a*l,s=1-l,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*l*e.control1.x,u+=3*s*a*e.control2.x,u+=o*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*l*e.control1.y,p+=3*s*a*e.control2.y,p+=o*e.endPoint.y;const h=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,p,h)}n.closePath(),n.fill()},this._drawCurveSegment=(e,t,n)=>{const r=this.ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1)},this._createPoint=(e,t,n)=>{const r=this.canvas.getBoundingClientRect();return new om(e-r.left,t-r.top,n,(new Date).getTime())},this._createPointByEvent=e=>this._createPoint(e.x,e.y,e.pressure),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=sm.fromPoints(n,e);return n.shift(),r}return null},this._strokeWidth=(e,t)=>Math.max(t.maxWidth/(e+1),t.minWidth),this._calculateCurveWidths=(e,t,n)=>{const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),l={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,l},this.onDrawStart=e=>{var t;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),null===(t=this.onStart)||void 0===t||t.call(this,e))},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)))},this.onDrawEnd=e=>{var t;this._isLeftButtonPressed(e)||(this._strokeEnd(this._pointerEventToSignatureEvent(e)),"text"!==this.mode&&this.addHistory(),null===(t=this.onEnd)||void 0===t||t.call(this,e))},this.onInputBlur=e=>{this.textInput.classList.remove("show"),this.drawHandler(e),this.textInput.innerText="",this.addHistory()},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},this.drawSquare=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,i-n),this.ctx.stroke(),this.ctx.restore()},this.drawRound=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),l=Math.min(r,t),a=Math.min(i,n),o=.5*(Math.max(r,t)-l),s=.5*(Math.max(i,n)-a),c=l+o,d=a+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()},this.drawArrow=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:i}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),l=180*Math.atan2(n-i,t-r)/Math.PI,a=(l+25)*Math.PI/180,o=(l-25)*Math.PI/180,s=15*Math.cos(a),c=15*Math.sin(a),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,i),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,i);const p=r+s,h=i+c;this.ctx.lineTo(p,h);const m=r+d,f=i+u;this.ctx.lineTo(m,f),this.ctx.lineTo(r,i),this.ctx.fill(),this.ctx.restore()},this.getAxisColor=(e,t,n)=>{const r=e.width,i=e.data,l=[];return l[0]=i[4*(n*r+t)],l[1]=i[4*(n*r+t)+1],l[2]=i[4*(n*r+t)+2],l[3]=i[4*(n*r+t)+3],l},this.setAxisColor=(e,t,n,r)=>{const i=e.width,l=e.data;l[4*(n*i+t)]=r[0],l[4*(n*i+t)+1]=r[1],l[4*(n*i+t)+2]=r[2],l[4*(n*i+t)+3]=r[3]},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),i=r.width,l=r.height,a=i/this.degreeOfBlur,o=l/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<a;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 i=0;i<this.degreeOfBlur;i++)for(let l=0;l<this.degreeOfBlur;l++)this.setAxisColor(r,t*this.degreeOfBlur+l,e*this.degreeOfBlur+i,n)}this.ctx.putImageData(r,t*this.ratio,n*this.ratio)},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,i=this.width-t,l=e.target.innerText,a=[];let o="";for(let e=0;e<l.length;e++){const t=o+l[e];this.ctx.measureText(t).width>i&&o.length>0?(a.push(o),o=l[e]):o=t}a.push(o),a.forEach(((e,i)=>{this.ctx.fillText(e,t+1,n+i*r+2)})),this.ctx.restore(),this.textInputPos={x:0,y:0}},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)},this.drawPencil=e=>{const{x:t,y:n}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.ctx.lineTo(t,n),this.ctx.stroke(),this.ctx.restore()},this.createEraser=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0];this.ctx.beginPath(),this.ctx.moveTo(t,n)},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"},this.drawLine=e=>{this.openSmooth?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this.drawPencil(e)},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())},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}},this.drawBgColor=()=>{this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))},this.clearWorkSpace=()=>{this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)},this.addHistory=()=>{this.canAddHistory&&(this.canAddHistory=!1,this._historyList.push(this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height)))},this.getLastHistory=()=>this._historyList[this._historyList.length-1],this.setLastHistory=()=>{const e=this.getLastHistory();e?this.ctx.putImageData(e,0,0):this.clearWorkSpace()},this.clear=()=>{this.clearWorkSpace(),this.drawBgColor(),this._historyList=[],this._data=[],this._reset(this._getPointGroupOptions())},this.undo=()=>{const e=this._historyList[this._historyList.length-2];e?(this.ctx.putImageData(e,0,0),this._historyList.pop()):this.clear()},this.setDrawMode=e=>{this.mode=e},this.setLineWidth=e=>{this.maxWidth=e},this.setPenColor=e=>{this.penColor=e},this.setFontSize=e=>{this.fontSize=e},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()},this.toDataURL=(e="image/png",t=1)=>{if(this.canvas.width===this.width)return this.canvas.toDataURL(e,t);const n=document.createElement("canvas");n.width=this.width,n.height=this.height;return n.getContext("2d").drawImage(this.canvas,0,0,n.width,n.height),n.toDataURL(e,t)},this.getPNG=()=>this.toDataURL(),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,i,l=0,a=null;const o=()=>{l=Date.now(),a=null,n=e.apply(r,i),a||(r=null,i=[])};return function(...s){const c=Date.now(),d=t-(c-l);return r=this,i=s,d<=0||d>t?(a&&(clearTimeout(a),a=null),l=c,n=e.apply(r,i),a||(r=null,i=[])):a||(a=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)}}cm.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),i=r.length,l=new Uint8Array(i);for(let e=0;e<i;++e)l[e]=r.charCodeAt(e);return new Blob([l],{type:n})},cm.canvasToDataURL=e=>e.toDataURL("image/png",1),cm.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const dm=()=>t.createElement("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),um=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),pm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),hm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),mm=()=>t.createElement("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},t.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"})),fm=t.forwardRef(((e,n)=>{const{open:r,width:i,height:l,imageName:a,penColor:o,penMode:s,minWidth:c,maxWidth:d,backgroundColor:u,className:p,style:m,onOk:f,onCancel:g}=e,{t:v}=Fn(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=su(void 0,{value:r,postState:e=>null!=e&&e}),I=t.useMemo((()=>!!e.children),[e.children]),[R,O]=t.useState(s||(I?"square":"line")),[k,L]=t.useState(w[0]),[A,P]=t.useState(I?S[0]:S[4]),[_,D]=t.useState(C[1]),[M,$]=t.useState("bottomLeft"),[q,j]=t.useState(!1),[K,z]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=i?i:null===(e=x.current)||void 0===e?void 0:e.offsetWidth,height:null!=l?l:null===(t=x.current)||void 0===t?void 0:t.offsetHeight,maxWidth:k,mode:R,penColor:A,fontSize:_,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new cm(b.current,n),()=>y.current.destroy()}),[]);const V=e=>{var t,n;const[r,a]=[null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=l?l:null===(n=x.current)||void 0===n?void 0:n.offsetHeight],{width:o,height:s}=y.current;let c=!1;r&&r!==o&&(y.current.width=r,c=!0),a&&a!==s&&(y.current.height=a,c=!0),(c||e)&&y.current.update()};$i((()=>{I&&N&&V()}),[N,I]),$i((()=>{y.current.setDrawMode(R)}),[R]),$i((()=>{y.current.setLineWidth(k)}),[k]),$i((()=>{y.current.setPenColor(A)}),[A]),$i((()=>{y.current.setFontSize(_)}),[_]);const W=()=>Mn(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield Zt(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return cm.canvasToDataURL(t)}catch(e){nr("Signature","生成合成图片失败!")}})),B=()=>{y.current.clear(),null==g||g()};t.useImperativeHandle(n,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),CLEAR:()=>y.current.clear(),UNDO:()=>y.current.undo(),IS_EMPTY:()=>y.current.isEmpty(),UPDATE:V,GET_DATE_URL:W})));const U=e=>{e&&$((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},G=e=>t.createElement("div",{className:_e("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},w.map((e=>t.createElement("span",{key:e,className:_e("dot",`s${e}`,{active:e===k}),onClick:()=>L(e)})))):t.createElement("div",{className:"fontSize"},t.createElement(H,{size:"small",value:_,options:C.map((e=>({value:e,label:e.toString()}))),onChange:e=>D(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},S.map((e=>t.createElement("span",{key:e,className:_e("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>P(e)},t.createElement(qe,{className:"icon"})))))),Y=ar("signature"),X={[Y]:!0,"is-annotation":I},Q=i?Object.assign(Object.assign({},m),{width:i}):m;return t.createElement("div",{className:_e(X,p),style:Q},I&&t.createElement(t.Fragment,null,t.createElement("div",{ref:x,className:"content"},e.children),K&&t.createElement(rl,{spinning:!0,className:"spinning"})),t.createElement("div",{className:_e("signature",{show:N})},t.createElement("canvas",{ref:b,className:R}),I&&t.createElement("div",{ref:E,className:"signature__tool-bar"},t.createElement("div",{className:"wrapper"},t.createElement("div",{className:_e("actions",{hidden:q})},t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(St,null))),t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(dm,null))),t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(pm,null))),t.createElement(F,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement($e,null))),t.createElement(F,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:M,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(um,null))),t.createElement("button",{className:"btn",onClick:()=>Mn(void 0,void 0,void 0,(function*(){yield Mn(void 0,void 0,void 0,(function*(){z(!0);const e=yield W();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):h().format(Qd);gl(cm.dataURLToBlob(e),`${t}.png`)}z(!1)})),B()}))},t.createElement(Ke,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement(hm,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(mm,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(bt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(Ye,null)),t.createElement("button",{className:"btn",onClick:()=>Mn(void 0,void 0,void 0,(function*(){z(!0),yield Bn(10);const e=yield W();z(!1),B(),null==f||f(e)}))},t.createElement(qe,null))),t.createElement("button",{className:"btn btn-fold",title:v(q?"qm.divider.spread":"qm.divider.collect"),onClick:()=>j(!q)},q?t.createElement(Tt,null):t.createElement(Nt,null))))))}));fm.displayName="QmSignature";var gm={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"};const vm=e=>[gm.selectionColumnDefine,...e].filter((e=>!e.hidden)),ym=e=>e.some((e=>Array.isArray(e.children))),bm=e=>void 0!==e._groupLevel,xm=(e,t)=>t.split(gm.separator).reduce(((e,t)=>null==e?void 0:e[t]),e),Em=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(Em)):0,wm=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const i=t?`${t}${gm.separator}${r}`:r;if(n.push(i),Array.isArray(e[r]))return n;const l=wm(e[r],i);return n.concat(l)}),[]),Cm={sum:e=>ma(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=>ma(e.length),unique:e=>new Set(e).size,empty:e=>e.filter((e=>Yn(e))).length,notEmpty:e=>e.filter((e=>!Yn(e))).length},Sm=t.createContext(void 0),Nm=e=>{const{prefixCls:n,pivotProps:r,size:i,getRowKey:l,flatColumns:a,tableData:o}=e,{initialGroup:s,initialCount:c}=r,d=e=>{const t=new Map;return na(e).forEach((e=>t.set(l(e,e.index),e))),t},u=t.useRef({props:r,originGridData:o,flatGroupData:[],isTree:ym(o),keyRecordMap:d(o)}),[p,h]=t.useState({pivotRef:u,prefixCls:n,size:i,viewMode:"table",columns:a,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=a.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,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=a.map((e=>e.dataIndex)),r={};for(const i in e)n.includes(i)&&t.includes(e[i])&&(r[i]=e[i]);return r})(c):{},summationData:{}}),m=e=>{h((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const l=i;Object.is(t[l],e[l])||(n[l]=e[l],r=!0)})),r?n:t}))};fn((()=>{v(o),f("originGridData",o),f("isTree",ym(o)),f("keyRecordMap",d(o))}),[o]),fn((()=>{g(a)}),[a]),fn((()=>{m({size:i})}),[i]);const f=(e,t)=>{p.pivotRef.current[e]=t};f("props",r);const g=e=>{m({columns:e})},v=e=>{m({gridData:e})},y=e=>{m({groupGridData:e})},b=e=>{m({groupList:e})},x=e=>{m({filterList:e})},E=e=>{m({sorterList:e})},w=e=>{m({colorList:e})},C=e=>{m({expandedKeys:e})},S=e=>{m({searchResults:e})},N=e=>{m({switchIndex:e})},T=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),m({fillColorCells:t})},I=e=>{var t;m({countMethod:(t=Object.assign({},p.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},R=e=>{m({summationData:e})},O=t.useMemo((()=>Object.assign(Object.assign({},p),{setContext:m,getRowKey:l,setPivotGridRef:f,setColumns:g,setGridData:v,setGroupGridData:y,setGroupList:b,setFilterList:x,setSorterList:E,setColorList:w,setExpandedKeys:C,setSearchResults:S,setSwitchIndex:N,setFillColor:T,setCountMethod:I,setSummationData:R})),[p]);return t.createElement(Sm.Provider,{value:O},e.children)},Tm=()=>t.useContext(Sm),Im=()=>{const{prefixCls:e,pivotRef:n,groupList:r,columns:i,gridData:l,setGroupList:a,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=Tm(),{originGridData:d}=n.current,{onGroupChange:u,onDataChange:p}=n.current.props,{t:h}=Fn(),m=t.useRef([]),f=t.useRef([]),g=t.useMemo((()=>r.filter((e=>e.fieldName&&e.order))),[r]),v=t.useMemo((()=>i.map((e=>({label:xa(e.title),value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,i]),y=t.useMemo((()=>{const e=g.map((e=>({[e.fieldName]:e.order})));return he(e,m.current)?m.current:(m.current=e,e)}),[g]),b=[{label:h("qm.pivotGrid.group.ascend"),value:"ascend"},{label:h("qm.pivotGrid.group.descend"),value:"descend"}];t.useEffect((()=>{o(f.current)}),[y,d]),t.useLayoutEffect((()=>{const e=((e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:i}]=t,l=Object.keys(t[0])[0],a=t.slice(1),o=Object.groupBy(e,(e=>n(e,l))),s=Object.keys(o).sort(((e,t)=>"ascend"===i?e.localeCompare(t):t.localeCompare(e))),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],a)})),c};return r(e,t)})(l,y,((e,t)=>{var n,r,l;const{dictItems:a,precision:o}=i.find((e=>e.dataIndex===t))||{},s=da(e,t);let c=null!==(l=null!==(r=null===(n=null==a?void 0:a.find((e=>e.value==s)))||void 0===n?void 0:n.text)&&void 0!==r?r:s)&&void 0!==l?l:"";return Array.isArray(s)&&(c=s.map((e=>{var t,n;return null!==(n=null===(t=null==a?void 0:a.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),o>=0&&""!==c&&(c=ha(c)?new Gt(c).toFixed(o):c),c||h("qm.pivotGrid.group.empty")}));var t;s(e),t=wm(e),f.current=t,c("flatGroupData",(e=>{const t=[];return function e(n,r,i=""){if(Array.isArray(n))n.forEach(((e,t)=>{e._varIndex=t,i?e._parentRowKey=i:delete e._parentRowKey})),t.push(...na(n));else for(const l in n){const a=i?`${i}${gm.separator}${l}`:l;t.push({id:a,_groupLabel:l,_groupLevel:r}),e(n[l],r+1,a)}}(e,0),t})(e))}),[y,l]),$i((()=>{null==u||u(g)}),[y]),$i((()=>{null==p||p(l)}),[l]);const x=()=>{a([...r,{fieldName:"",order:"ascend"}])},E=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...r])},w=e=>t.createElement(t.Fragment,null,t.createElement(Ue,{className:"icon handle"}),t.createElement(H,{value:e.fieldName||void 0,placeholder:h("qm.table.editable.selectPlaceholder"),options:v,style:{width:160,margin:"0 10px"},onChange:t=>E("fieldName",e,t)}),t.createElement(H,{value:e.order,options:b,placeholder:h("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>E("order",e,t)}),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(e)}));return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,h("qm.pivotGrid.group.title")),!!g.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},h("qm.pivotGrid.group.foldAll")),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(f.current)},h("qm.pivotGrid.group.unfoldAll")))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:r,setList:e=>{const t=e.map((e=>e.fieldName)),n=r.map((e=>e.fieldName));he(t,n)||a(e)}},r.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},w(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:x},t.createElement(pt,{className:"icon"}),h("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!g.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(It,{className:"icon"}),h("qm.pivotGrid.group.text"),g.length?`(${g.length})`:null))},Rm=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:i,setFilterList:l,setGridData:a}=Tm(),{originGridData:o,isTree:s}=n.current,{onFilterChange:c}=n.current.props,{t:d}=Fn(),u=t.useRef([]),p=t.useMemo((()=>i.filter((e=>e.fieldName&&("nil"===e.expression||!Yn(e.value))))),[i]),h=t.useMemo((()=>r.map((e=>({label:xa(e.title),value:e.dataIndex})))),[r]),[m,f]=t.useState("and"),g=t.useMemo((()=>{const e=p.map((e=>{var t;return`${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}));return he(e,u.current)?u.current:(u.current=e,e)}),[p]);$i((()=>{l(i.map((e=>Object.assign(Object.assign({},e),{logic:m}))))}),[m]),$i((()=>{v(),null==c||c(p)}),[g]);const v=dl((()=>{const e=wa(p.map((e=>Object.assign(Object.assign({},Qn(e,["value"])),{expression:"nil"!==e.expression?e.expression:"==",condition:e.value}))));a(e?Bl(o,e,s):o)}),200),y=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],b=()=>{l([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:m}])},x=(e,t,n)=>{var a;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(a=r.find((e=>e.dataIndex===n)).filter)||void 0===a?void 0:a.type)||"text";Object.assign(t,{type:e,expression:w(e)[0].value,value:""})}"expression"===e&&"nil"===n&&Object.assign(t,{value:""}),l([...i])},E=e=>t.createElement(t.Fragment,null,t.createElement(H,{value:e.fieldName||void 0,options:h,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>x("fieldName",e,t)}),t.createElement(H,{value:e.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:w(e.type),style:{width:100,margin:"0 10px"},onChange:t=>x("expression",e,t)}),C(e),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{l(i.filter((t=>t!==e)))})(e)})),w=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},C=e=>{var n,i;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{x("value",e,Yn(t)?"":t)}});case"date":return t.createElement(Rn,{popupClassName:au.popupClassName,defaultValue:null!==(n=ga(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{x("value",e,va(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(i=r.find((t=>t.dataIndex===e.fieldName)))||void 0===i?void 0:i.dictItems)||[];return t.createElement(H,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{x("value",e,t)}},n.map((e=>t.createElement(H.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{x("value",e,t.target.value)}})}};return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,d("qm.pivotGrid.filter.title")),!!p.length&&t.createElement(H,{value:m,options:y,style:{width:130},onChange:e=>f(e)})),t.createElement("div",{className:"list"},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},E(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:b},t.createElement(pt,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!p.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Rt,{className:"icon"}),d("qm.pivotGrid.filter.text"),p.length?`(${p.length})`:null))},Om=()=>{const{prefixCls:e,pivotRef:n,columns:r,gridData:i,sorterList:l,setSorterList:a,setGridData:o}=Tm(),{onSorterChange:s}=n.current.props,{t:c}=Fn(),d=t.useMemo((()=>l.filter((e=>e.fieldName&&e.order))),[l]),u=t.useMemo((()=>r.map((e=>({label:xa(e.title),value:e.dataIndex,disabled:l.some((t=>t.fieldName===e.dataIndex))})))),[l,r]);$i((()=>{m(),null==s||s(d)}),[t.useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]);const p=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],h=(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,m=()=>{var e;o((e=d,i.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:i}=r,l=da(t,e),a=da(n,e),o=h(l,a);if(0!==o)return"ascend"===i?o:-o}return 0})).slice(0)))},f=()=>{a([...l,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...l])},v=e=>t.createElement(t.Fragment,null,t.createElement(Ue,{className:"icon handle"}),t.createElement(H,{value:e.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(H,{value:e.order,options:p,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{a(l.filter((t=>t!==e)))})(e)}));return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.sorter.title"))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.fieldName)),n=l.map((e=>e.fieldName));he(t,n)||a(e)}},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(pt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Ot,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},km=()=>{const{prefixCls:e,getRowKey:n,gridData:r,columns:i,searchResults:l,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=Tm(),{t:c}=Fn(),[d,u]=t.useState(!1),p=t.useMemo((()=>l.length),[l]);$i((()=>{d||setTimeout((()=>{s(0),o([])}),200)}),[d]);const h=(e,t)=>{const r=[];return e.forEach((e=>{i.forEach((i=>{var l,a,o;const{dataIndex:s,dictItems:c,precision:d}=i,u=da(e,s);let p=null!==(o=null!==(a=null===(l=null==c?void 0:c.find((e=>e.value==u)))||void 0===l?void 0:l.text)&&void 0!==a?a:u)&&void 0!==o?o:"";Array.isArray(u)&&(p=u.map((e=>{var t,n;return null!==(n=null===(t=null==c?void 0:c.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),d>=0&&""!==p&&(p=ha(p)?new Gt(p).toFixed(d):p),p+="",p.includes(t)&&r.push({value:p,rowKey:n(e,e.index),dataIndex:s})})),Array.isArray(e.children)&&r.push(...h(e.children,t))})),r},m=dl((e=>{const t=e.target.value.trim();s(0),o(t?h(r,t):[])}),200),f=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&g()},g=()=>{if(!p)return;s((a+1)%p)},v=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!p)return;s((a-1+p)%p)})()},t.createElement(Tt,null)),t.createElement("span",{className:"num"},p>0?a+1:a,"/",p),t.createElement("button",{className:"button-icon",onClick:()=>g()},t.createElement(Nt,null)));return t.createElement(F,{open:d,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.search.title")),t.createElement("button",{className:"button-icon",onClick:()=>u(!1)},t.createElement(Ye,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(O,{autoFocus:!0,style:{width:280},suffix:v(),onChange:m,onKeyUp:f}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>u(!d)},t.createElement(dt,{className:"icon"}),c("qm.pivotGrid.search.text")))},Lm=(e,t)=>e.map((e=>(e.children&&(e.children=Lm(e.children,t)),t(e)))),Am=()=>{const{prefixCls:e,pivotRef:n,columns:r,setColumns:i}=Tm(),{uniqueKey:l,onColumnsChange:a}=n.current.props,{t:o}=Fn(),s=t.useMemo((()=>l?`grid_field_${l}`:""),[l]);t.useLayoutEffect((()=>{c()}),[]),$i((()=>{u(r)}),[r]);const c=()=>{const e=p();e&&(null==a||a(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),Object.assign({dataIndex:e.dataIndex},t)})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));he(t,n)||localStorage.setItem(s,JSON.stringify(t))},p=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));if(!e)return;return fe(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?Lm(r,(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})):Lm(e,(e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},h=t.useMemo((()=>{let e=0;for(let t=0;t<r.length-1&&("left"!==r[t].fixed||r[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let n=0;n<r.length;n++)n===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(r[n]);return t}),[r]),m=()=>t.createElement("div",{className:_e("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,o("qm.pivotGrid.field.title"))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:h,setList:e=>{const t=e.map((e=>e.dataIndex)),n=h.map((e=>e.dataIndex));he(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const i=e[r];r<t?i.fixed="left":delete i.fixed,r!==t&&n.push(i)}i(n),null==a||a(n)})(Ra(e))}},h.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(Ue,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},xa(e.title)),t.createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...r];i(t),null==a||a(t)})(e)},e.hidden?t.createElement(kt,null):t.createElement(je,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(F,{trigger:["click"],dropdownRender:()=>m(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(at,{className:"icon"}),o("qm.pivotGrid.field.text")))},Pm=()=>{const{prefixCls:e,size:n,setContext:r}=Tm(),{t:i}=Fn(),l=[{label:i("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:i("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:i("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},l.map((e=>t.createElement("li",{key:e.value,className:_e("ant-dropdown-menu-item check-item",{active:n===e.value}),onClick:()=>r({size:e.value})},t.createElement("span",{className:"label"},e.label),t.createElement("i",{className:"icon"},t.createElement(qe,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},t.createElement("span",null,t.createElement(Lt,{className:"icon"}),i("qm.pivotGrid.lineHeight.text")))},_m="606060",Dm="thin",Hm="d4d4d4",Mm=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Fm=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},$m=()=>({top:{style:Dm,color:{argb:Hm}},left:{style:Dm,color:{argb:Hm}},bottom:{style:Dm,color:{argb:Hm}},right:{style:Dm,color:{argb:Hm}}}),qm=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},jm=()=>{const{prefixCls:e,pivotRef:n,columns:r,countMethod:i,summationData:l}=Tm(),{t:a}=Fn(),{exportXLSX:o}=(()=>{const{size:e}=Tm(),{t:t}=Fn(),{rowHeightMaps:n}=au,r=(e,t)=>{var n,r,i;return null!==(i=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==i?i:""};return{exportXLSX:(r,i,l,a)=>Mn(void 0,void 0,void 0,(function*(){const{columns:o,footSummation:s}=r,c=n[e],d=Ul(o),u=[],p=[],h=[];let m=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=xa(e.title),h.push({key:t,width:(n||r)/8})})),u.push(f),m+=u.length;const g=i.map(((e,t)=>{const n={};return d.forEach(((r,i)=>{const l=["percent","finance"].includes(r.formatType);n[r.dataIndex]=l?da(e,r.dataIndex):a(e,t,r,i)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));m+=g.length,s&&l(d,i).forEach(((e,n)=>{const r={};d.forEach(((n,l)=>{const{dataIndex:a,summation:o}=n,s=(null==o?void 0:o.render)?o.render(i):da(e,a);r[a]=0===l&&""===s?t("qm.table.config.summaryText"):Kn(s)?ba(s).join(""):s})),p.push(r)}));const{sheetName:v,useStyle:y}=r,b=new ln.Workbook,x=b.addWorksheet(v);x.columns=h,x.addRows(u).forEach((e=>{y&&Mm(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=Ql(o,t.key),{align:r,theadAlign:i}=n;Fm(e,i||r),y&&Object.assign(e,{font:{bold:!0,color:{argb:_m}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:$m()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];y&&Mm(e,c),e.eachCell(((e,t)=>{const i=x.getColumn(e.col),l=Ql(o,i.key),{align:a}=l;Fm(e,1===t||void 0===r?a:"right"),Object.assign(e,qm(l)),y&&Object.assign(e,{font:{color:{argb:_m}},border:$m()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),s&&x.addRows(p).forEach((e=>{y&&Mm(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=Ql(o,n.key),{align:i}=r;Fm(e,1===t?i:"right"),Object.assign(e,qm(r)),y&&Object.assign(e,{font:{color:{argb:_m}},border:$m()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=yield b.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})})),importXLSX:(e,n)=>{const{columns:i,file:l}=e,a=Ul(i),o=new FileReader;o.onerror=()=>{R.error(t("qm.table.import.error"))},o.onload=e=>{const i=a.map((e=>xa(e.title))),l=new ln.Workbook,o=e.target;o?l.xlsx.load(o.result).then((e=>{const l=e.worksheets[0];if(l){const e=l.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(i,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let i=e;Array.isArray(null==i?void 0:i.richText)&&(i=i.richText.map((e=>e.text)).join("")),ae(i)&&"text"in i&&(i=i.text),Te(i)&&(i=va(i,Xd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[s[n]]=i}));const n={};return i.forEach(((e,i)=>{var l;const{dataIndex:o,dictItems:s}=a[i];Array.isArray(s)&&((null===(l=t[e])||void 0===l?void 0:l.toString().includes(","))?t[e]=t[e].split(",").map((e=>r(s,e))).filter((e=>""!==e)):t[e]=r(s,t[e])),ua(n,o,t[e])})),n}));null==n||n(t)}else R.error(t("qm.table.import.error"))}else R.error(t("qm.table.import.error"))})):R.error(t("qm.table.import.error"))},o.readAsArrayBuffer(l)}}})(),{getTitleFromCellValue:s}=vu(),c=[{text:a("qm.pivotGrid.count.records"),value:"count"},{text:a("qm.pivotGrid.count.unique"),value:"unique"},{text:a("qm.pivotGrid.count.empty"),value:"empty"},{text:a("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:a("qm.pivotGrid.count.sum"),value:"sum"},{text:a("qm.pivotGrid.count.max"),value:"max"},{text:a("qm.pivotGrid.count.min"),value:"min"},{text:a("qm.pivotGrid.count.avg"),value:"avg"}],d={columns:Gl(r),fileName:h().format(Qd),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},u=(e,t,n,r)=>{const{dataIndex:i,precision:l,formatType:a}=n;if(bm(e))return da(e,i);let o=s(e,n,t,r);return l>=0&&!a&&""!==o&&(o=Number(o)),o},p=()=>{if(!i||!Object.keys(i).length)return[];const e={};return d.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";(null==i?void 0:i[t])&&(n=c.find((e=>e.value===i[t])).text+" "+l.total[t]),ua(e,t,n)}})),[e]},m=e=>Mn(void 0,void 0,void 0,(function*(){const t=yield o(Object.assign(Object.assign({},d),{footSummation:!!Object.keys(i).length}),e,p,u);gl(t,`${h().format(Qd)}.xlsx`)})),f=[{key:"1",label:t.createElement(t.Fragment,null,t.createElement(At,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.group")),onClick:()=>{m((()=>{const e=[];let t=0;return n.current.flatGroupData.forEach((n=>{const r=Object.assign({},n);bm(n)?(r._level=n._groupLevel,d.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(0===t)ua(r,e,n._groupLabel);else{let t="";(null==i?void 0:i[e])&&(t=c.find((t=>t.value===i[e])).text+" "+xm(l,n.id).subtotal[e]),ua(r,e,t)}})),t=n._groupLevel):t>0&&(r._level=n._level+t+1),e.push(r)})),e})())}},{key:"2",label:t.createElement(t.Fragment,null,t.createElement(Pt,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.list")),onClick:()=>{m(Array.from(n.current.keyRecordMap.values()))}}];return t.createElement(F,{trigger:["click"],menu:{items:f},className:_e("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},t.createElement("span",null,t.createElement(Ke,{className:"icon"}),a("qm.pivotGrid.export.text")))},Km=()=>{const{prefixCls:e,pivotRef:n,groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o,setContext:s}=Tm(),{uniqueKey:c}=n.current.props,{t:d}=Fn(),u=t.useMemo((()=>c?`grid_conf_${c}`:""),[c]),p=t.useRef({}),[m,f]=t.useState([]),[g,v]=t.useState({}),[y,b]=t.useState(""),x=(e,t)=>{v((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))};t.useLayoutEffect((()=>{E()}),[]),$i((()=>{w()}),[m]);const E=()=>Mn(void 0,void 0,void 0,(function*(){try{if(!u)return;const e=yield an.getItem(u);Array.isArray(e)&&(f(e),v(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}})),w=()=>Mn(void 0,void 0,void 0,(function*(){try{if(!u)return;yield an.setItem(u,m)}catch(e){}})),C=()=>{const e=ya();f([{id:e,label:h().format(Qd),value:{groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o}},...m]),Un((()=>x(e,!0)))},S=()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,d("qm.pivotGrid.saved.title"))),t.createElement("div",{className:"list"},t.createElement("ul",null,m.map((e=>t.createElement("li",{key:e.id,className:_e("ant-dropdown-menu-item sort-item",{active:e.id===y}),onClick:()=>(e=>{if(g[e.id])return;const t=y!==e.id,n=t?e.value:p.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),b(t?e.id:"")})(e)},t.createElement("div",{className:"label",style:{width:200}},g[e.id]?t.createElement(O,{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,f([...m])),x(e.id,!1)}}):t.createElement("span",null,e.label)),t.createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?t.createElement(qe,null):t.createElement($e,null)),t.createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(m.filter((e=>e.id!==n)))}},t.createElement(Ye,null))))))),t.createElement("div",{className:"add-record",style:{padding:10}},t.createElement("span",{className:"insert",onClick:C},t.createElement(pt,{className:"icon"}),d("qm.pivotGrid.saved.add"))));return t.createElement(F,{trigger:["click"],dropdownRender:()=>S(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:r,filterList:i,sorterList:l,colorList:a,countMethod:o}:{},p.current=t}},t.createElement("span",null,t.createElement(_t,{className:"icon"}),d("qm.pivotGrid.saved.text")))},zm=()=>{const{gridData:e}=Tm(),{t:n}=Fn();return t.createElement("div",{className:"alert-info"},t.createElement(yt,{className:"icon"}),n("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})()}))},Vm=()=>{const{prefixCls:e,pivotRef:n,getRowKey:r,columns:i,colorList:l,setColorList:a,setFillColor:o}=Tm(),{flatGroupData:s}=n.current,{t:c}=Fn(),d=t.useRef([]),u=t.useMemo((()=>l.filter((e=>e.fieldName&&e.color&&("nil"===e.expression||!Yn(e.value))))),[l]),p=t.useMemo((()=>i.map((e=>({label:xa(e.title),value:e.dataIndex})))),[i]),h=t.useMemo((()=>vm(i)),[i]),m=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"}];$i((()=>{f()}),[t.useMemo((()=>{const e=u.map((e=>{var t;return{[e.color]:`${e.mode},${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}}));return he(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=dl((()=>{const e=[];u.forEach((t=>{const n=wa([Object.assign(Object.assign({},Qn(t,["value"])),{expression:"nil"!==t.expression?t.expression:"==",condition:t.value})]),i=Bl(s.filter((e=>!bm(e))),n);if("cell"===t.mode)for(let n=0;n<i.length;n++)e.push({color:t.color,rowKey:r(i[n],i[n].index),dataIndex:t.fieldName});if("row"===t.mode)for(let n=0;n<i.length;n++){const l=r(i[n],i[n].index);for(let n=0;n<h.length;n++)e.push({color:t.color,rowKey:l,dataIndex:h[n].dataIndex})}})),o(e)}),200),g=()=>{a([...l,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},v=(e,t,n)=>{var r;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(r=i.find((e=>e.dataIndex===n)).filter)||void 0===r?void 0:r.type)||"text";Object.assign(t,{type:e,expression:y(e)[0].value,value:""})}"expression"===e&&"nil"===n&&Object.assign(t,{value:""}),a([...l])},y=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},b=e=>t.createElement(t.Fragment,null,t.createElement(Ue,{className:"icon handle"}),t.createElement(pf,{defaultValue:e.color,style:{marginLeft:5},onChangeComplete:t=>v("color",e,t.hex)}),t.createElement(H,{value:e.mode,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:t=>v("mode",e,t)}),t.createElement(H,{value:e.fieldName||void 0,options:p,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>v("fieldName",e,t)}),t.createElement(H,{value:e.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:y(e.type),style:{width:100,margin:"0 10px"},onChange:t=>v("expression",e,t)}),(e=>{var n,r;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,Yn(t)?"":t)}});case"date":return t.createElement(Rn,{popupClassName:au.popupClassName,defaultValue:null!==(n=ga(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{v("value",e,va(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(r=i.find((t=>t.dataIndex===e.fieldName)))||void 0===r?void 0:r.dictItems)||[];return t.createElement(H,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{v("value",e,t)}},n.map((e=>t.createElement(H.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{value:e.value,style:{width:150},disabled:"nil"===e.expression,onChange:t=>{v("value",e,t.target.value)}})}})(e),t.createElement(Ye,{className:"icon close",onClick:()=>(e=>{a(l.filter((t=>t!==e)))})(e)}));return t.createElement(F,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.fillColor.title"))),t.createElement("div",{className:"list"},t.createElement(rn,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.fieldName)),n=l.map((e=>e.fieldName));he(t,n)||a(e)}},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},b(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(pt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:_e("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Dt,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Wm=()=>t.createElement("div",{className:"top-bar"},t.createElement(lr,{size:4},t.createElement(zm,null),t.createElement(J,{type:"vertical"}),t.createElement(Am,null),t.createElement(Im,null),t.createElement(Rm,null),t.createElement(Om,null),t.createElement(J,{type:"vertical"}),t.createElement(Pm,null),t.createElement(Vm,null),t.createElement(km,null),t.createElement(J,{type:"vertical"}),t.createElement(jm,null)),t.createElement(lr,{size:4},t.createElement(Km,null))),Bm=t.createContext(void 0),Um=e=>{var n,r;const{scrollbar:i}=e,{pivotRef:l,getRowKey:a,columns:o,groupGridData:s,setPivotGridRef:c}=Tm(),{rowSelection:d,treeExpandable:u,rowHighlight:p}=l.current.props,h=null===(n=null==u?void 0:u.defaultExpandAllRows)||void 0===n||n,[m,f]=t.useState({scrollbarRef:i,selectionKeys:null!==(r=null==d?void 0:d.defaultSelectedRowKeys)&&void 0!==r?r:[],treeExpandKeys:h?ra(l.current.originGridData,(e=>a(e,e.index))):[],highlightKey:"",checkedColumnKey:"",hoverRowKey:"",updateLayout:0,clicked:[]}),g=t.useMemo((()=>Math.max(0,Em(s)-1)),[s]),v=e=>{f((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const l=i;Object.is(t[l],e[l])||(n[l]=e[l],r=!0)})),r?n:t}))};t.useLayoutEffect((()=>{N(),C()}),[o]),t.useLayoutEffect((()=>{(null==d?void 0:d.selectedRowKeys)&&v({selectionKeys:d.selectedRowKeys})}),[null==d?void 0:d.selectedRowKeys]),t.useLayoutEffect((()=>{void 0!==(null==p?void 0:p.currentRowKey)&&v({highlightKey:p.currentRowKey})}),[null==p?void 0:p.currentRowKey]);const y=e=>{Array.isArray(null==d?void 0:d.selectedRowKeys)||v({selectionKeys:e})},b=e=>{v({treeExpandKeys:e})},x=e=>{void 0===(null==p?void 0:p.currentRowKey)&&v({highlightKey:e})},E=e=>{v({checkedColumnKey:e})},w=e=>{v({hoverRowKey:e})},C=()=>{v({updateLayout:m.updateLayout+1})},S=e=>{Oa(e,m.clicked,!0)||v({clicked:e})},N=()=>{const e=i.current.container.clientWidth,{defaultColumnWidth:t}=au,n=[];let r=0;if(o.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,r+=e.width):(e.renderWidth=void 0,n.push(e))})),n.length>0){const r=o.reduce(((e,n)=>e+(n.width||n.minWidth||t)),0);if(r<=e){const i=e-r;if(1===n.length)n[0].renderWidth=(n[0].minWidth||t)+i;else{const e=i/n.reduce(((e,n)=>e+(n.minWidth||t)),0);let r=0;n.forEach(((n,i)=>{if(0===i)return;const l=Math.floor((n.minWidth||t)*e);r+=l,n.renderWidth=(n.minWidth||t)+l})),n[0].renderWidth=(n[0].minWidth||t)+i-r}}else n.forEach((e=>{e.renderWidth=e.minWidth||t}))}else r=o.reduce(((e,n)=>e+(n.renderWidth=n.width||n.minWidth||t)),0)},T=t.useMemo((()=>Object.assign(Object.assign({},m),{indentDepth:g,setContext:v,setSelectionKeys:y,setTreeExpandKeys:b,setHighlightKey:x,setCheckColumnKey:E,setHoverRowKey:w,forceUpdateLayout:C,setClicked:S,updateColumnsWidth:N})),[m,g]);return t.createElement(Bm.Provider,{value:T},e.children)},Gm=()=>t.useContext(Bm),Ym=e=>{var n;const{column:r}=e,{columns:i,setColumns:l}=Tm(),{scrollbarRef:a}=Gm(),o=t.useRef(null),[s,c]=t.useState(!1),d=t.useRef(document.onselectstart),u=t.useRef({startX:0,originSizeX:0,columnWidth:0}),p=e=>{u.current=Object.assign({},u.current,e)},h=e=>{if(1!==e.buttons)return m();const t=e.clientX-u.current.startX,n=(r.width||r.renderWidth)+t;n<(r.minWidth||au.defaultColumnWidth)||(p({columnWidth:n}),o.current.style.left=`${u.current.originSizeX+t}px`)},m=()=>{a.current.container.style.cursor="",r.width=u.current.columnWidth,l([...i]),Un((()=>c(!1))),ji(document,"mousemove",h),ji(document,"mouseup",m),p({startX:0,originSizeX:0,columnWidth:0}),f()},f=()=>{document.onselectstart!==d.current&&(document.onselectstart=d.current)};return t.createElement(t.Fragment,null,t.createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),a.current.container.style.cursor="col-resize";const t=oa(e.target,a.current.container).left-a.current.scrollLeft+3;p({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),qi(document,"mousemove",h),qi(document,"mouseup",m),c(!0),Un((()=>o.current.style.left=`${t}px`)),d.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(Xt,{open:s,getContainer:null===(n=a.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},Xm=e=>{var n;const{left:r}=e,{scrollbarRef:i}=Gm();return t.createElement(Xt,{open:!0,getContainer:null===(n=i.current)||void 0===n?void 0:n.container},t.createElement("div",{className:"fixed-line",style:{left:r}}))},Qm=()=>{const{pivotRef:e,columns:n}=Tm(),{indentDepth:r,updateLayout:i,checkedColumnKey:l,selectionKeys:a,setSelectionKeys:o,setCheckColumnKey:s}=Gm(),{rowSelection:c}=e.current.props,{selectionColumn:d}=au,{indentWidth:u,selectionColumnDefine:p}=gm,h=t.useMemo((()=>vm(n)),[n]),m=t.useMemo((()=>h.filter((e=>"left"===e.fixed))),[h]),f=t.useMemo((()=>h.filter((e=>"left"!==e.fixed))),[h]),g=t.useMemo((()=>"radio"!==(null==c?void 0:c.type)),[c]),v=t.useMemo((()=>m.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?r*u:0)),0)),[r,i,m]),y=t.useMemo((()=>a.length>0&&a.length===e.current.keyRecordMap.size),[a]),b=t.useMemo((()=>a.length>0&&a.length<e.current.keyRecordMap.size),[a]),x=(n,i)=>t.createElement("div",{className:_e(i?"fixed-left":"no-fixed"),style:{width:i?v:""}},n.map(((a,h)=>{const{dataIndex:m,title:f,align:v,width:x,renderWidth:E}=a,w={"selection-column":m===d,"col--center":"center"===v,"col--right":"right"===v,"col--checked":l===m},C=i&&1===h||!i&&h===n.length-1?r*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return t.createElement("div",{key:m,className:_e("table-cell",w),style:S,onClick:()=>{return e=m,void([p.dataIndex].includes(e)||s(l!==e?e:""));var e}},m!==d?t.createElement("span",{className:"cell"},f):g?t.createElement(M,{checked:y,indeterminate:b,onChange:t=>(t=>{var n;const r=t?Array.from(e.current.keyRecordMap.keys()):[];o(r),null===(n=null==c?void 0:c.onChange)||void 0===n||n.call(c,r,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",m!==d&&t.createElement(Ym,{column:a}))})));return t.createElement("div",{className:"header"},x(m,!0),(e=>x(e))(f),t.createElement(Xm,{left:v}))},Zm=e=>{const{pivotRef:n,getRowKey:r,size:i}=Tm(),{scrollbarRef:l,clicked:a,setHighlightKey:o,setClicked:s}=Gm(),{flatGroupData:c}=n.current,{rowHighlight:d}=n.current.props,u=t.useMemo((()=>2*au.rowHeightMaps[i]),[i]),p=t.useMemo((()=>c.filter((e=>!bm(e)))),[c]),h=$n((t=>{var n;const{keyCode:i}=t;if(!Yn(a)&&(27===i&&(o(""),s([])),38===i||40===i)){Ki(t);const c=p.length;let h=p.findIndex((e=>r(e,e.index)===a[0]));const m=38===i?(--h+c)%c:++h%c,f=p[m],g=r(f,f.index);d&&(o(g),null===(n=d.onChange)||void 0===n||n.call(d,g,f)),((t,n,r)=>{const i=p.length,a=e.find((e=>e.key===r)),o=l.current.scrollTop,s=l.current.container.offsetHeight,c=a.top,d=a.height;"top"===t?c<o?l.current.SET_SCROLL_TOP(c):n===i-1&&l.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?l.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&l.current.SET_SCROLL_TOP(c)})(38===i?"top":"bottom",m,g),s([g,a[1]])}}));t.useLayoutEffect((()=>(window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h))),[])},Jm=e=>{const{column:n,keyPath:r,type:i}=e,{prefixCls:l,countMethod:a,summationData:o,setCountMethod:s}=Tm(),{t:c}=Fn(),{dataIndex:d,filter:u}=n,[p,h]=t.useState(!1),m=t.useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:Cm.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:Cm.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:Cm.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:Cm.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:Cm.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:Cm.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:Cm.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:Cm.avg}];return"number"===(null==u?void 0:u.type)?e:e.slice(0,-4)}),[]),f=t.useMemo((()=>{var e,t,n;const l=a[d];if(!l)return c("qm.pivotGrid.count.statistic");return`${m.find((e=>e.value===l)).text} ${null!==(n=null===(t=null===(s=o,u=r,e=u?xm(s,u):s)||void 0===e?void 0:e[i])||void 0===t?void 0:t[d])&&void 0!==n?n:""}`;var s,u}),[o,a]);return t.createElement(F,{open:p,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},m.map((e=>{const n=e.value===a[d];return t.createElement("li",{key:e.value,className:_e("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[d]:n?void 0:e.value}),h(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement(qe,null)))})))),className:_e("count-select",{show:!!a[d]}),overlayClassName:`${l}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>h(e)},t.createElement("span",null,f," ",t.createElement(Ht,{className:"icon"})))},ef=(e,n)=>{const{pivotRef:r,columns:i,expandedKeys:l,groupGridData:a,searchResults:o,switchIndex:s,fillColorCells:c,setExpandedKeys:d}=Tm(),{indentDepth:u,hoverRowKey:p,highlightKey:h,checkedColumnKey:m,selectionKeys:f,treeExpandKeys:g,setSelectionKeys:v,setTreeExpandKeys:y,setHighlightKey:b,setHoverRowKey:x,setClicked:E}=Gm(),{keyRecordMap:w,isTree:C}=r.current,{rowSelection:S,treeExpandable:N,rowHighlight:T,onRowEdit:I,onRowClick:R}=r.current.props;Fn();const{renderText:O,getTitleFromCellNode:k}=vu(),{selectionColumn:L,treeTable:A}=au,{indentWidth:P}=gm,_=t.useMemo((()=>Array.isArray(a)),[a]),D=t.useMemo((()=>n?0:vm(i).length-e.length),[i,e]),H=t.useMemo((()=>"radio"!==(null==S?void 0:S.type)),[S]),F=(e,t)=>{var n,r;const i=H?e?[...f,t]:f.filter((e=>e!==t)):[t];v(i),null===(n=null==S?void 0:S.onSelect)||void 0===n||n.call(S,e,w.get(t)),null===(r=null==S?void 0:S.onChange)||void 0===r||r.call(S,i,$(i))},$=e=>{const t=[];return e.forEach((e=>t.push(w.get(e)))),t},q=(e,t)=>{var n,r;return(null===(n=o[s])||void 0===n?void 0:n.rowKey)===e&&(null===(r=o[s])||void 0===r?void 0:r.dataIndex)===t},K=e=>t.createElement("button",{className:_e("button-icon",{expand:l.includes(e.id)}),onClick:()=>{return t=e.id,void d(l.includes(t)?l.filter((e=>e!==t)):[...l,t]);var t}},t.createElement(Et,null)),z=(e,n,r,i)=>{const{dataIndex:l,width:a,renderWidth:o}=e,s={"expandable-column":l===L},c=1===n?(u-r._groupLevel)*P:0,d={width:`${(a||o||0)+c}px`,minWidth:`${(a||o||0)+c}px`};return t.createElement("div",{key:l,className:_e("label-cell",s),style:d},l!==L?t.createElement(t.Fragment,null,1===n&&t.createElement("span",{className:"title"},r._groupLabel.slice(1)),t.createElement(Jm,{column:e,keyPath:r.id,type:"subtotal"})):K(r))},V=(e,n)=>{var r;return t.createElement(He,{className:_e("cell--expand",{fold:!g.includes(n)}),style:{visibility:(null===(r=e.children)||void 0===r?void 0:r.length)>0?"visible":"hidden"},onClick:()=>(e=>{var t,n;const r=g.includes(e),i=r?g.filter((t=>t!==e)):[...g,e];y(i),null===(t=null==N?void 0:N.onExpand)||void 0===t||t.call(N,!r,w.get(e)),null===(n=null==N?void 0:N.onChange)||void 0===n||n.call(N,i)})(n)})},W=(e,n,r,i,l)=>{const{dataIndex:a,width:o,renderWidth:s,align:d,render:u}=e,p=da(r,a),h=u?u(p,r,e,r.index,n):O(p,e,r),g=k(h),v=f.includes(l),y={"selection-column":a===L,"col--center":"center"===d,"col--right":"right"===d,"col--checked":m===a,active:q(l,a)},x={width:`${o||s||0}px`,minWidth:`${o||s||0}px`,backgroundColor:c.get(`${l}|${a}`)};return t.createElement("div",{key:a,"data-col-index":n,title:g,className:_e("table-cell",y),style:x,onClick:t=>{var n;a!==L&&(E([l,a]),T&&(b(l),null===(n=T.onChange)||void 0===n||n.call(T,l,r)),null==R||R(r,e,t))}},a!==L?t.createElement(t.Fragment,null,C&&1===n&&t.createElement(t.Fragment,null,(w=r._level)?t.createElement("span",{key:w,className:`cell--indent indent-level-${w}`,style:{paddingLeft:w*A.textIndent+"px"}}):null,V(r,l)),t.createElement("span",{className:_e("cell",{indent:!_&&1===n})},h)):t.createElement("div",{className:"action"},t.createElement("span",{className:"drag-icon"}),t.createElement("div",{className:"middle"},t.createElement("span",{className:"order"},((e,t)=>C?0===e._level?e._varIndex+1:null:t+1)(r,i)),H?t.createElement(M,{className:"checkbox",checked:v,onChange:e=>F(e.target.checked,l)}):t.createElement(j,{className:"checkbox",checked:v,onChange:e=>F(e.target.checked,l)})),t.createElement("span",{className:"expand-icon",onClick:()=>null==I?void 0:I(r,i)},I?t.createElement(Mt,null):null)));var w};return{renderGroupRow:(n,r)=>t.createElement("div",{className:"label-row"},e.map(((e,t)=>z(e,D+t,n)))),renderRow:(n,r,i)=>{const l={"row--selection":f.includes(i),"row--highlight":h===i,"row--hover":p===i};return t.createElement("li",{key:i,"data-row-key":i,className:_e("table-row",l),onMouseEnter:()=>x(i),onMouseLeave:()=>x("")},e.map(((e,t)=>W(e,D+t,n,r,i))))}}},tf=e=>{const{tbodyColumns:n,layout:r,displayList:i,virtualRows:l}=e,{indentDepth:a,updateLayout:o}=Gm(),{indentWidth:s}=gm,c=t.useMemo((()=>n.filter((e=>"left"===e.fixed))),[n]),d=t.useMemo((()=>c.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?a*s:0)),0)),[a,o,c]),{renderGroupRow:u,renderRow:p}=ef(c,!0);return t.createElement("div",{className:"left-panel",style:{width:d}},t.createElement("div",{className:"container"},l.map((e=>{const n=e.index,l=r[n],a=i[n];if(bm(a))return t.createElement("div",{key:a.id,className:"group-label",style:{top:l.top,left:l.left,right:0,height:l.height}},u(a,l.key));const o=n===r.length-1||bm(i[n+1]);return t.createElement("div",{key:l.key,className:_e("row-item",{last:o}),style:{top:l.top,left:l.left,right:0,height:l.height}},p(a,a._varIndex,l.key))}))))},nf=e=>{const{tbodyColumns:n,layout:r,displayList:i,virtualRows:l}=e;Tm();const a=t.useMemo((()=>n.filter((e=>"left"!==e.fixed))),[n]),{renderGroupRow:o,renderRow:s}=ef(a);return t.createElement("div",{className:"main-panel"},t.createElement("div",{className:"container"},l.map((e=>{const n=e.index,l=r[n],a=i[n];if(bm(a))return t.createElement("div",{key:a.id,className:"group-label",style:{top:l.top,left:0,right:l.right,height:l.height}},o(a,l.key));const c=n===r.length-1||bm(i[n+1]);return t.createElement("div",{key:l.key,className:_e("row-item",{last:c}),style:{top:l.top,left:0,right:l.right,height:l.height}},s(a,a._varIndex,l.key))}))))},rf=()=>{const{pivotRef:e,getRowKey:n,prefixCls:r,size:i,columns:l,groupGridData:a,expandedKeys:o,searchResults:s,switchIndex:c}=Tm(),{scrollbarRef:d,treeExpandKeys:u}=Gm(),{flatGroupData:p}=e.current,{contextMenues:h}=e.current.props,{groupMargin:m}=gm,{rowHeightMaps:f}=au,g=t.useRef(null),v=t.useMemo((()=>vm(l)),[l]),y=t.useMemo((()=>Array.isArray(a)),[a]),{contextMenu:b,closeMenu:x}=(({ref:e,popup:n,getTriggerContainer:r,prevent:i,prefixCls:l="",enabled:a=!0})=>{const o=t.useRef(null),s=t.useRef(null),c=e=>{s.current=e},[d,u]=t.useState(!1),[p,h]=t.useState(null),m={width:150,height:200,zIndex:9999};Rp({ref:o,handler:()=>f()});const f=()=>{u(!1),h(null),c(null)},g=$n((e=>{if(e.preventDefault(),null==i?void 0:i(e.target))return f();c(e),u(!0),Un((()=>{var t;const{width:n,height:r}=(null===(t=o.current)||void 0===t?void 0:t.getBoundingClientRect())||m,i=n,l=r,a=window.innerWidth,s=window.innerHeight;let c=e.clientX,d=e.clientY;c+i>a&&(c=Math.max(c-i,0)),d+l>s&&(d=Math.max(d-l,0)),h({x:c,y:d})}))}));t.useEffect((()=>{const t=(null==r?void 0:r(e.current))||e.current;return a&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const v={position:"fixed",top:`${(null==p?void 0:p.y)||0}px`,left:`${(null==p?void 0:p.x)||0}px`,zIndex:m.zIndex};return{contextMenu:t.createElement(Xt,{open:d},t.createElement("div",{ref:o,className:`${l}__context-menu`,style:v},s.current?n(s.current):null)),closeMenu:f}})({ref:g,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:r,enabled:!!h,popup:e=>{var r;const i=Gi(e.target,"table-cell"),l=(null===(r=null==i?void 0:i.parentNode)||void 0===r?void 0:r.getAttribute("data-row-key"))||"",a=p.find((e=>n(e,e.index)==l)),o=Number((null==i?void 0:i.getAttribute("data-col-index"))||-1),s=v[o];return t.createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},h.map((e=>{var n;const r=(null===(n=e.disabled)||void 0===n?void 0:n.call(e,a,s))||!1;return t.createElement("li",{key:e.key,className:_e("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":r}),onClick:()=>{var t;r||(Un((()=>x())),null===(t=e.onClick)||void 0===t||t.call(e,a,s))}},e.prefix&&t.createElement("span",{className:"prefix"},e.prefix),t.createElement("span",{className:"label"},e.label),e.suffix&&t.createElement("span",{className:"suffix"},e.suffix))})))}}),E=t.useMemo((()=>{const e=new Map,t=[];return p.forEach((r=>{if(bm(r)){if(0===r._groupLevel)return e.set(r.id,o.includes(r.id)),void t.push(r);const n=r.id.slice(0,r.id.lastIndexOf(gm.separator));return void(o.includes(n)&&e.get(n)&&(e.set(r.id,o.includes(r.id)),t.push(r)))}const i=n(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(i,u.includes(i)),t.push(r))})),e.clear(),t}),[a,o,u]),w=t.useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],i=[],l=n,a=gm.indentWidth,o=gm.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;i.length>0&&i[i.length-1]._level>=e._groupLevel;){const e=i.pop();if(e.height=e._childHeight+l,r[e._index].height=e.height,i.length>0){const t=i[i.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}i[i.length-1];const t={key:e.id,top:s,left:a*e._groupLevel,right:a*e._groupLevel,height:l,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),i.push(t),s+=l}else{const n=i[i.length-1]||{left:0,right:0},a={key:t(e,e.index),top:s,left:n.left,right:n.right,height:l};r.push(a),s+=l,i.length>0&&(n._childHeight+=l)}}));i.length>0;){const e=i.pop();if(e.height=e._childHeight+l,r[e._index].height=e.height,i.length>0){const t=i[i.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(E,{getRowKey:n,rowHeight:f[i]})),[E,i]);Zm(w);const C=t.useMemo((()=>{if(y)return w.reduce(((e,t)=>e+t.height),0)+2*m;const e=w.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*m+2*m}),[y,w]),{virtualRows:S}=(e=>{const{layout:n,isGroup:r}=e,{size:i}=Tm(),{scrollbarRef:l}=Gm(),{rowHeightMaps:a}=au,o=t.useMemo((()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null}),[l.current]),s=yp({count:n.length,getScrollElement:()=>o,estimateSize:e=>n[e].height,overscan:1,noCache:r,rangeExtractor:e=>{var t;if(!r)return sp(e);const c=l.current.scrollTop,d=(null===(t=s.scrollElement)||void 0===t?void 0:t.offsetHeight)||o.offsetHeight,u=[];for(let e=0;e<n.length;e++){const t=n[e];c>t.top+t.height+a[i]||c+d+a[i]<t.top||u.push(e)}return u}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:w,isGroup:!y});$i((()=>{const e=p.findIndex((e=>{var t;return n(e,e.index)===(null===(t=s[c])||void 0===t?void 0:t.rowKey)}));e>=0&&d.current.SET_SCROLL_TOP(e*f[i]);const t=v.findIndex((e=>{var t;return e.dataIndex===(null===(t=s[c])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=v.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);d.current.SET_SCROLL_LEFT(e)}}),[c,s]);const N={tbodyColumns:v,layout:w,displayList:E,virtualRows:S};return t.createElement("div",{ref:g,className:"body",style:{height:C}},t.createElement(tf,N),t.createElement(nf,N),b)},lf=()=>{const{columns:e,groupGridData:n,countMethod:r,setSummationData:i}=Tm(),{indentDepth:l,updateLayout:a}=Gm(),{selectionColumn:o}=au,{indentWidth:s}=gm,c=t.useMemo((()=>vm(e)),[e]),d=t.useMemo((()=>c.filter((e=>"left"===e.fixed))),[c]),u=t.useMemo((()=>c.filter((e=>"left"!==e.fixed))),[c]),p=t.useMemo((()=>d.reduce(((e,t,n)=>e+(t.width||t.renderWidth||0)+(1===n?l*s:0)),0)),[l,a,d]);$i((()=>{i(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const i=e.map((e=>Xn(e,r)||0));n[r]=t[r](i)}return n},i=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const l={},a={};Object.keys(t).forEach((e=>{a[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=>Xn(e,n)||0));e[n]=t[n](r),a[n].push(...r)}l[r]={subtotal:e}}else{const e=i(o);l[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&a[n].push(t)}}}if(0===n.length)return l;const o={};for(const e in t)o[e]=t[e](a[e]);return l.subtotal=o,l},l=Array.isArray(e)?{total:r(e)}:i(e);return n.length>0&&(l.total=r(n)),delete l.subtotal,l})(n,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:Cm[e[n]]});return t})(r)))}),[r,n]);const h=(e,n)=>t.createElement("div",{className:_e(n?"fixed-left":"no-fixed"),style:{width:n?p:""}},e.map(((r,i)=>{const{dataIndex:a,width:c,renderWidth:d}=r,u={"selection-column":a===o,"col--right":!0},p=n&&1===i||!n&&i===e.length-1?l*s:0,h={width:`${(c||d||0)+p}px`,minWidth:`${(c||d||0)+p}px`};return t.createElement("div",{key:a,className:_e("table-cell",u),style:h},a!==o?t.createElement(Jm,{column:r,keyPath:"",type:"total"}):null)})));return t.createElement("div",{className:"footer"},h(d,!0),(e=>h(e))(u))},af=()=>{const{prefixCls:e,size:n}=Tm(),r=t.useRef(null);return t.createElement(Um,{scrollbar:r},t.createElement(fl,{ref:r,className:_e(`${e}__layout`,n)},t.createElement(Qm,null),t.createElement(rf,null),t.createElement(lf,null)))},of=()=>t.createElement("div",{className:"wrapper"},t.createElement(af,null)),sf={rowKey:"id",columns:[],dataSource:[]},cf=e=>{const n=hn(sf,e),{rowKey:r,fromTable:i,columns:l,dataSource:a,height:o,maxHeight:s,className:c,style:d}=n,{$size:u}=qn(n),p=$n(((e,t)=>{const n="function"==typeof r?r(e,t):null==e?void 0:e[r];return void 0===n?(nr("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),h=(e,t="",n=0)=>e.map(((e,r)=>{const i=p(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=h(e.children,i,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),m=e=>{let t=!1;const n=(e=>e.filter((e=>![au.expandableColumn,au.selectionColumn,"index","pageIndex",au.operationColumn].includes(e.dataIndex))))(e).map((e=>{"left"===e.fixed&&(t=!0);const n=Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0});return i&&(void 0===n.fixed&&delete n.fixed,delete n.editRender),n}));return!t&&n.length&&(n[0].fixed="left",nr("PivotGrid","至少需要有一项 `fixed: left` 的固定列")),n},f=t.useMemo((()=>m(l)),[l]),g=t.useMemo((()=>h(a)),[a]),v=ar("pivot-grid"),y={[v]:!0,"is-from-table":i},b={height:o,maxHeight:o||s?s:500},x={prefixCls:v,size:u,getRowKey:p,flatColumns:f,tableData:g,pivotProps:Qn(n,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return t.createElement("div",{className:_e(y,c),style:Object.assign(Object.assign({},d),b)},t.createElement(Nm,x,t.createElement(Wm,null),t.createElement(of,null)))};cf.displayName="PivotGrid";const df=t.forwardRef(((e,n)=>{const{dataIndex:r,className:i,style:l}=e;return t.createElement("li",{ref:n,"data-index":r,className:_e("list-item",i),style:l},e.children)}));df.displayName="ListItem";const uf=t.forwardRef(((e,n)=>{var r,i;const{dataSource:l=[],height:a,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,p=t.useRef(null),h=yp({count:l.length,getScrollElement:()=>{var e,t;return null!==(t=null===(e=p.current)||void 0===e?void 0:e.container.children[0])&&void 0!==t?t:null},estimateSize:()=>s||40,overscan:3,onChange:(e,t)=>null==d?void 0:d(e,t)}),m=h.getVirtualItems();t.useImperativeHandle(n,(()=>({SCROLL_TO_INDEX:e=>h.scrollToIndex(e),SCROLL_TO_OFFSET:e=>h.scrollToOffset(e)})));const f=ar("virtual-list");return t.createElement(fl,{ref:p,className:_e(f,u),style:Object.assign(Object.assign({},e.style),{height:a,maxHeight:o})},t.createElement("div",{className:"container",style:{height:h.getTotalSize()}},t.createElement("ul",{style:{transform:`translateY(${null!==(i=null===(r=m[0])||void 0===r?void 0:r.start)&&void 0!==i?i:0}px)`}},m.map((e=>t.createElement(df,{ref:h.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(l[e.index],e.index)))))))}));uf.displayName="VirtualList";const pf=e=>{const{value:n,defaultValue:r,disabled:i,disabledAlpha:l,className:a,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=su("",{value:n,defaultValue:r}),p=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),h=ch({offset:0,arrowWidth:16,borderRadius:6}),m=ar("color-picker");return t.createElement(Qt,{action:["click"],prefixCls:m,popupPlacement:"bottomLeft",builtinPlacements:h,popup:()=>t.createElement(tn,{prefixCls:m,value:d,disabled:i,disabledAlpha:l,onChange:(e,t)=>{u(e.toRgbString()),null==s||s(p(e),t)},onChangeComplete:(e,t)=>{null==c||c(p(e),t)}})},t.createElement("div",{className:_e(`${m}-btn`,a),style:o},t.createElement(nn,{color:d,prefixCls:m})))};pf.displayName="ColorPicker";const hf="1.11.17";export{In as Calendar,Rn as DatePicker,Nl as DcpAnchor,rr as DcpButton,Mi as DcpCollapse,pf as DcpColorPicker,_n as DcpConfigProvider,Mp as DcpCopyToClipboard,tl as DcpCountup,Ld as DcpCropper,or as DcpDivider,El as DcpDownload,Rl as DcpDrawer,nl as DcpEmpty,hd as DcpForm,Zh as DcpGuideTracker,am as DcpLazyLoad,Ll as DcpModal,cf as DcpPivotGrid,Ah as DcpPrint,nh as DcpRangeTableHelper,fl as DcpScrollbar,Gp as DcpSearchHelper,Kd as DcpSearchTree,fm as DcpSignature,lr as DcpSpace,rl as DcpSpin,el as DcpSplit,Up as DcpTable,Il as DcpTabs,kd as DcpTinymce,gh as DcpTour,wh as DcpTransition,Jp as DcpTreeHelper,Zp as DcpTreeTableHelper,xl as DcpUploadFile,Pd as DcpUploadImg,uf as DcpVirtualList,Jh as DcpWatermark,Nl as QmAnchor,rr as QmButton,Mi as QmCollapse,pf as QmColorPicker,_n as QmConfigProvider,Mp as QmCopyToClipboard,tl as QmCountup,Ld as QmCropper,or as QmDivider,El as QmDownload,Rl as QmDrawer,nl as QmEmpty,hd as QmForm,Zh as QmGuideTracker,am as QmLazyLoad,Ll as QmModal,cf as QmPivotGrid,Ah as QmPrint,nh as QmRangeTableHelper,fl as QmScrollbar,Gp as QmSearchHelper,Kd as QmSearchTree,fm as QmSignature,lr as QmSpace,rl as QmSpin,el as QmSplit,Up as QmTable,Il as QmTabs,kd as QmTinymce,gh as QmTour,wh as QmTransition,Jp as QmTreeHelper,Zp as QmTreeTableHelper,xl as QmUploadFile,Pd as QmUploadImg,uf as QmVirtualList,Jh as QmWatermark,kn as TimePicker,po as pinyin,hf as version};
|