dcp-design-react 1.11.6 → 1.11.7
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/pivot-grid/src/grid-layout/Context.d.ts +2 -0
- package/lib/pivot-grid/src/main/Context.d.ts +7 -2
- package/lib/pivot-grid/src/main/index.d.ts +2 -1
- package/lib/pivot-grid/src/top-bar/exportPanel.d.ts +3 -0
- package/lib/pivot-grid/src/utils/index.d.ts +2 -1
- package/lib/pivot-grid/style/grid-layout.less +11 -0
- package/lib/pivot-grid/style/top-bar.less +7 -1
- package/lib/style/index.css +18 -1
- package/lib/style/index.min.css +1 -1
- package/lib/table/src/hooks/useTableRef.d.ts +2 -2
- package/lib/table/src/table/props.d.ts +1 -0
- package/lib/table/src/table/types.d.ts +1 -1
- package/lib/table/src/utils/index.d.ts +2 -0
- package/lib/virtual-list/src/core.d.ts +1 -1
- 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 C,Popconfirm as w,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 D,Col as _,Select as F,Checkbox as H,Dropdown as M,InputNumber as $,Rate as j,Radio as q,Switch as K,Tag as V,TreeSelect as z,Cascader as W,notification as B,Image as U,Tree as G,Menu as Y,Popover as X,Pagination as Q,Slider as Z,Segmented as J,Divider as ee}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 te from"dayjs/plugin/weekYear";import ne from"antd/es/calendar/generateCalendar";import re from"antd/es/date-picker/generatePicker";import ie from"antd/es/locale/zh_CN";import le from"antd/es/locale/en_GB";import{isArray as ae,isPlainObject as oe,isNumber as se,isFunction as ce,isString as de,isUndefined as ue,get as pe,transform as he,isEqual as me,set as fe,xor as ge,isRegExp as ve,merge as ye,uniqBy as be,debounce as xe,intersection as Ee,map as Ce,groupBy as we,flatten as Se,spread as Ne,mergeWith as Te,isDate as Ie,omitBy as Re,sumBy as Oe,maxBy as ke,minBy as Le,union as Ae,pickBy as Pe,throttle as De}from"lodash-es";import _e from"classnames";import{UpOutlined as Fe,DownOutlined as He,UploadOutlined as Me,LinkOutlined as $e,EditOutlined as je,CheckOutlined as qe,EyeOutlined as Ke,DownloadOutlined as Ve,DeleteOutlined as ze,FullscreenExitOutlined as We,FullscreenOutlined as Be,UnorderedListOutlined as Ue,HolderOutlined as Ge,SearchOutlined as Ye,CloseOutlined as Xe,ExclamationCircleOutlined as Qe,ReloadOutlined as Ze,ZoomInOutlined as Je,ZoomOutOutlined as et,RotateRightOutlined as tt,RotateLeftOutlined as nt,InboxOutlined as rt,InfoCircleFilled as it,PrinterOutlined as lt,ImportOutlined as at,SettingOutlined as ot,CopyOutlined as st,CheckSquareOutlined as ct,CloseCircleOutlined as dt,MonitorOutlined as ut,LineChartOutlined as pt,PlusOutlined as ht,PieChartOutlined as mt,FunnelPlotOutlined as ft,AppstoreAddOutlined as gt,StepBackwardOutlined as vt,StepForwardOutlined as yt,InfoCircleOutlined as bt,ClearOutlined as xt,PauseOutlined as Et,CaretRightOutlined as Ct,QuestionCircleOutlined as wt,MenuOutlined as St,BorderOutlined as Nt,RightOutlined as Tt,LeftOutlined as It,FolderOpenOutlined as Rt,FilterOutlined as Ot,SortAscendingOutlined as kt,EyeInvisibleOutlined as Lt,ColumnHeightOutlined as At}from"@ant-design/icons";import Pt from"react-countup";import Dt from"resize-observer-polyfill";import _t from"sortablejs";import Ft from"add-dom-event-listener";import Ht from"scroll-into-view-if-needed";import Mt from"react-draggable";import $t from"memoize-one";import*as jt from"prop-types";import qt from"prop-types";import Kt from"cropperjs";import Vt from"big.js";import zt from"copy-to-clipboard";import Wt from"@rc-component/portal";import Bt from"@rc-component/trigger";import Ut from"html2canvas";import Gt,{flushSync as Yt}from"react-dom";import{ReactSortable as Xt}from"react-sortablejs";import Qt from"localforage";import Zt from"exceljs";import Jt from"china-area-data";const en=n({locale:"zh-cn",size:"middle"});var tn={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"},pivotGrid:{text:"透视表",settingTitle:"透视表看板"}}}};let nn=tn;function rn(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const ln=(...e)=>{const[t,n]=e;let r;const i=t.split(".");let l=nn;for(let e=0,t=i.length;e<t;e++){if(r=l[i[e]],e===t-1)return rn(r,n);if(!r)return"";l=r}return""},an=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})),on=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function sn(e,t){on((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 cn={},dn=[];function un(e,t){if(!e&&void 0!==console){var n=dn.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function pn(e,t){if(!e&&void 0!==console){var n=dn.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function hn(e,t,n){t||cn[n]||(e(!1,n),cn[n]=!0)}function mn(e,t){hn(un,e,t)}function fn(e,t){hn(pn,e,t)}mn.preMessage=function(e){dn.push(e)},mn.resetWarned=function(){cn={}},mn.noteOnce=fn,h.extend(g),h.extend(f),h.extend(b),h.extend(m),h.extend(y),h.extend(te),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 gn={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"},vn=function(e){return gn[e]||e.split("_")[0]},yn=function(){fn(!1,"Not match any format. Please help to fire a issue about this.")},bn={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(vn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(vn(e)).weekday(0)},getWeek:function(e,t){return t.locale(vn(e)).week()},getShortWeekDays:function(e){return h().locale(vn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return h().locale(vn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(vn(e)).format(n)},parse:function(e,t,n){for(var r=vn(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 yn(),null}var p=h(a,l).locale(r);if(p.isValid())return p}return t&&yn(),null}}};const xn=ne(bn),En=re(bn);function Cn(){return Cn=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},Cn.apply(null,arguments)}const wn=e.forwardRef(((t,n)=>e.createElement(En,Cn({},t,{picker:"time",mode:void 0,ref:n}))));wn.displayName="TimePicker";const Sn=e.forwardRef(((t,n)=>e.createElement(En.RangePicker,Cn({},t,{picker:"time",mode:void 0,ref:n}))));Sn.displayName="RangePicker",wn.RangePicker=Sn;var Nn={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel Merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}}}};const Tn={[Nn.name]:{qm:Nn,antd:le},[tn.name]:{qm:tn,antd:ie}},In=e=>{const n=an({locale:"zh-cn",size:"middle"},e),{locale:r,size:i,global:l}=n;t.useMemo((()=>{return e=Object.assign({},Tn,null==l?void 0:l.langPackage)[r].qm,nn=e||nn,void(nn.name&&h.locale(nn.name));var e}),[r]);const a=t.useMemo((()=>Object.assign({},Tn,null==l?void 0:l.langPackage)),[l]),[o,s]=t.useState({locale:r,size:i,global:l});return sn((()=>{s((e=>Object.assign({},e,{locale:r,size:i})))}),[i,r]),t.createElement(en.Provider,{value:o},t.createElement(x,{locale:a[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==l?void 0:l.autoInsertSpaceInButton},n.children))};function Rn(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 On(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 kn(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 Ln(){const{locale:t}=e.useContext(en);return{t:ln,$locale:t}}function An(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 Pn(t){const{size:n}=e.useContext(en);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])}}In.displayName="QmConfigProvider";var Dn="undefined"==typeof window;const _n=e=>t.isValidElement(e),Fn=e=>_n(e)&&e.type===t.Fragment,Hn=()=>{},Mn=()=>!0,$n=e=>kn(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),jn=e=>{Promise.resolve().then(e)},qn=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),Kn=e=>!!(!e&&0!==e||ae(e)&&!e.length||oe(e)&&!Object.keys(e).length),Vn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),zn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Wn=(e,t=new WeakMap)=>{if(oe(e)||ae(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]=Wn(e[l],t)})),r}return e},Bn=e=>se(e)?`${e}px`:e.toString();class Un extends Error{constructor(e){super(e),this.name="QmDesignError"}}function Gn(e,t){throw new Un(`[${e}] ${t}`)}function Yn(e,t){console.warn(new Un(`[${e}] ${t}`))}const Xn=e=>{const{loading:n,shortcutKey:r,authConfig:i,click:l,confirm:a}=e,{t:o}=Ln(),{$size:s}=Pn(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=An((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=ce(l)?{onClick:t=>kn(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){Yn("Button","`click`方法执行出错")}d(!1)}))}:null,h=Object.assign(Object.assign(Object.assign({},zn(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(w,{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,Cn({},h,{onClick:Hn}),e.children)):!r||h.disabled?m:t.createElement(C,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},m)};var Qn;Xn.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(Qn||(Qn={}));const Zn=e=>{const{$size:n}=Pn(e),r=se(e.size)?e.size:Qn[n||"default"],i=Object.assign(Object.assign({},zn(e,["size"])),{size:r});return t.createElement(S,i,e.children)};Zn.displayName="QmSpace";const Jn=e=>`qm-${e}`,er=e=>{const{label:n,extra:r,collapse:i,bordered:l=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=Pn(e),{t:p}=Ln(),h=Jn("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(Fe,null):t.createElement(He,null)))};er.displayName="QmDivider";const tr=()=>({height:0,opacity:0}),nr=(e,t)=>"height"===t.propertyName,rr={motionName:"rc-collapse-motion",onEnterStart:tr,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:tr,onEnterEnd:nr,onLeaveEnd:nr,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"};function ir(e){return ir="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},ir(e)}function lr(e){var t=function(e,t){if("object"!==ir(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ir(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ir(t)?t:String(t)}function ar(e,t,n){return(t=lr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function or(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 sr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?or(Object(n),!0).forEach((function(t){ar(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):or(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function cr(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 dr(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 cr(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)?cr(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 ur(e){return e instanceof HTMLElement||e instanceof SVGElement}function pr(e){var n,r=function(e){return e&&"object"===ir(e)&&ur(e.nativeElement)?e.nativeElement:ur(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Gt.findDOMNode)||void 0===n?void 0:n.call(Gt,e):null)}var hr,mr={exports:{}},fr={};mr.exports=(hr||(hr=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,C=p,w=n,S=l,N=i,T=d,I=u,R=!1,O=!1;fr.ContextConsumer=g,fr.ContextProvider=v,fr.Element=y,fr.ForwardRef=b,fr.Fragment=x,fr.Lazy=E,fr.Memo=C,fr.Portal=w,fr.Profiler=S,fr.StrictMode=N,fr.Suspense=T,fr.SuspenseList=I,fr.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},fr.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},fr.isContextConsumer=function(e){return f(e)===o},fr.isContextProvider=function(e){return f(e)===a},fr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},fr.isForwardRef=function(e){return f(e)===c},fr.isFragment=function(e){return f(e)===r},fr.isLazy=function(e){return f(e)===h},fr.isMemo=function(e){return f(e)===p},fr.isPortal=function(e){return f(e)===n},fr.isProfiler=function(e){return f(e)===l},fr.isStrictMode=function(e){return f(e)===i},fr.isSuspense=function(e){return f(e)===d},fr.isSuspenseList=function(e){return f(e)===u},fr.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)},fr.typeOf=f}()),fr);var gr=function(e,t){"function"==typeof e?e(t):"object"===ir(e)&&e&&"current"in e&&(e.current=t)},vr=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){gr(t,e)}))}},yr=function(e){var t,n,r=mr.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===mr.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===mr.exports.ForwardRef)};function br(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 xr=e.createContext({});function Er(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cr(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,lr(r.key),r)}}function wr(e,t,n){return t&&Cr(e.prototype,t),n&&Cr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sr(e,t){return Sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Sr(e,t)}function Nr(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&&Sr(e,t)}function Tr(e){return Tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Tr(e)}function Ir(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rr(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=Tr(e);if(t){var i=Tr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===ir(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ir(e)}(this,n)}}var Or=function(t){Nr(r,e.Component);var n=Rr(r);function r(){return Er(this,r),n.apply(this,arguments)}return wr(r,[{key:"render",value:function(){return this.props.children}}]),r}();function kr(t){var n=e.useRef(!1),r=dr(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 Lr="none",Ar="appear",Pr="enter",Dr="leave",_r="none",Fr="prepare",Hr="start",Mr="active",$r="end",jr="prepared";function qr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Kr(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 Vr,zr,Wr,Br=(Vr=qr(),zr="undefined"!=typeof window?window:{},Wr={animationend:Kr("Animation","AnimationEnd"),transitionend:Kr("Transition","TransitionEnd")},Vr&&("AnimationEvent"in zr||delete Wr.animationend.animation,"TransitionEvent"in zr||delete Wr.transitionend.transition),Wr),Ur={};if(qr()){var Gr=document.createElement("div");Ur=Gr.style}var Yr={};function Xr(e){if(Yr[e])return Yr[e];var t=Br[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 Ur)return Yr[e]=t[l],Yr[e]}return""}var Qr=Xr("animationend"),Zr=Xr("transitionend"),Jr=!(!Qr||!Zr),ei=Qr||"animationend",ti=Zr||"transitionend";function ni(e,t){return e?"object"===ir(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var ri=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(ti,i),e.removeEventListener(ei,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(ti,i),e.addEventListener(ei,i),n.current=e)},a]},ii=qr()?a:o,li=function(e){return+setTimeout(e,16)},ai=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(li=function(e){return window.requestAnimationFrame(e)},ai=function(e){return window.cancelAnimationFrame(e)});var oi=0,si=new Map;function ci(e){si.delete(e)}var di=function(e){var t=oi+=1;return function n(r){if(0===r)ci(t),e();else{var i=li((function(){n(r-1)}));si.set(t,i)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};di.cancel=function(e){var t=si.get(e);return ci(e),ai(t)},di.ids=function(){return si};var ui=[Fr,Hr,Mr,$r],pi=[Fr,jr],hi=!1,mi=!0;function fi(e){return e===Mr||e===$r}var gi=function(t,n,r){var i=dr(kr(_r),2),l=i[0],a=i[1],o=function(){var t=e.useRef(null);function n(){di.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=di((function(){i<=1?r({isCanceled:function(){return l!==t.current}}):e(r,i-1)}));t.current=l},n]}(),s=dr(o,2),c=s[0],d=s[1];var u=n?pi:ui;return ii((function(){if(l!==_r&&l!==$r){var e=u.indexOf(l),t=u[e+1],n=r(l);n===hi?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(Fr,!0)},l]};var vi=function(t){var n=t;"object"===ir(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(xr).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,C=i.onEnterActive,w=i.onLeaveActive,S=i.onAppearEnd,N=i.onEnterEnd,T=i.onLeaveEnd,I=i.onVisibleChanged,R=dr(kr(),2),O=R[0],k=R[1],L=dr(kr(Lr),2),A=L[0],P=L[1],D=dr(kr(null),2),_=D[0],F=D[1],H=l(!1),M=l(null);function $(){return r()}var j=l(!1);function q(){P(Lr,!0),F(null,!0)}function K(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=j.current;A===Ar&&r?n=null==S?void 0:S(t,e):A===Pr&&r?n=null==N?void 0:N(t,e):A===Dr&&r&&(n=null==T?void 0:T(t,e)),A!==Lr&&r&&!1!==n&&q()}}var V=dr(ri(K),1)[0],z=function(e){var t,n,r;switch(e){case Ar:return ar(t={},Fr,f),ar(t,Hr,y),ar(t,Mr,E),t;case Pr:return ar(n={},Fr,g),ar(n,Hr,b),ar(n,Mr,C),n;case Dr:return ar(r={},Fr,v),ar(r,Hr,x),ar(r,Mr,w),r;default:return{}}},W=e.useMemo((function(){return z(A)}),[A]),B=dr(gi(A,!t,(function(e){if(e===Fr){var t=W[Fr];return t?t($()):hi}var n;return G in W&&F((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===Mr&&(V($()),h>0&&(clearTimeout(M.current),M.current=setTimeout((function(){K({deadline:!0})}),h))),G===jr&&q(),mi})),2),U=B[0],G=B[1],Y=fi(G);j.current=Y,ii((function(){k(n);var e,r=H.current;H.current=!0,!r&&n&&d&&(e=Ar),r&&n&&s&&(e=Pr),(r&&!n&&p||!r&&m&&!n&&p)&&(e=Dr);var i=z(e);e&&(t||i[Fr])?(P(e),U()):P(Lr)}),[n]),o((function(){(A===Ar&&!d||A===Pr&&!s||A===Dr&&!p)&&P(Lr)}),[d,s,p]),o((function(){return function(){H.current=!1,clearTimeout(M.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===Lr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=_;return W[Fr]&&G===Hr&&(Q=sr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:pr(v.current)}catch(e){return null}}),t),b=dr(y,4),x=b[0],E=b[1],C=b[2],w=b[3],S=e.useRef(w);w&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,gr(r,e)}),[r]),I=sr(sr({},m),{},{visible:a});if(u)if(x===Lr)N=w?u(sr({},I),T):!c&&S.current&&h?u(sr(sr({},I),{},{className:h}),T):d||!c&&!h?u(sr(sr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===Fr?O="prepare":fi(E)?O="active":E===Hr&&(O="start");var k=ni(p,"".concat(x,"-").concat(O));N=u(sr(sr({},I),{},{className:_e(ni(p,x),(R={},ar(R,k,k&&O),ar(R,p,"string"==typeof p),R)),style:C}),T)}else N=null;e.isValidElement(N)&&yr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(Or,{ref:v},N)}));return r.displayName="CSSMotion",r}(Jr);function yi(){return yi=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},yi.apply(this,arguments)}var bi="add",xi="keep",Ei="remove",Ci="removed";function wi(e){var t;return sr(sr({},t=e&&"object"===ir(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Si(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(wi)}var Ni=["component","children","onVisibleChanged","onAllRemoved"],Ti=["status"],Ii=["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]:vi,r=function(t){Nr(i,e.Component);var r=Rr(i);function i(){var e;Er(this,i);for(var t=arguments.length,n=new Array(t),l=0;l<t;l++)n[l]=arguments[l];return ar(Ir(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),ar(Ir(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:sr(sr({},e),{},{status:Ci})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==Ci})).length})),e}return wr(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=br(i,Ni),d=l||e.Fragment,u={};return Ii.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=br(r,Ti),c=i===bi||i===xi;return e.createElement(n,yi({},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=Si(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=Si(e),a=Si(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 sr(sr({},e),{},{status:bi})}))),r=l),n.push(sr(sr({},o),{},{status:xi})),r+=1,t=!0;break}}t||n.push(sr(sr({},e),{},{status:Ei}))})),r<i&&(n=n.concat(a.slice(r).map((function(e){return sr(sr({},e),{},{status:bi})}))));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!==Ei}))).forEach((function(t){t.key===e&&(t.status=xi)}))})),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!==Ci||e.status!==Ei}))}}}]),i}();ar(r,"defaultProps",{component:"div"})}(Jr);const Ri=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=Jn("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))}));Ri.displayName="PanelContent";const Oi=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=Jn("collapse"),g=_e({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},l);return t.createElement("div",{className:g,style:a},t.createElement(er,{label:r,extra:i,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),null==p||p(e)}}),t.createElement(vi,Cn({visible:h},rr,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),(({className:n,style:r},i)=>t.createElement(Ri,{ref:i,prefixCls:f,className:n,style:r,boxStyle:o,isActive:h,forceRender:d},e.children))))};Oi.displayName="QmCollapse";const ki=t.createContext(void 0);function Li(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 Ai=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},Pi=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Di=e=>e.preventDefault(),_i=(e,t)=>{if(Dn||!e||!t)return null;"float"===(t=qn(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]}},Fi=(e,t,n)=>{!Dn&&e&&t&&(oe(t)?Object.keys(t).forEach((n=>{Fi(e,n,t[n])})):(t=qn(t),e.style[t]=n))},Hi=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Mi=(e,t)=>Math.abs(Hi(e)-Hi(t)),$i=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}},ji=(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},qi=(e,t)=>{if(Dn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ki=e=>Math.pow(e,3),Vi=e=>e<.5?Ki(2*e)/2:1-Ki(2*(1-e))/2,zi=e=>{const{minValues:n,onDragChange:r,onDragging:i}=e,{splitRef:l,direction:a}=t.useContext(ki),{t:o}=Ln(),s=t.useRef(Dn?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),Pi(document,"mousemove",h),Pi(document,"mouseup",m),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${Jn("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}),Ai(document,"mousemove",h),Ai(document,"mouseup",m),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};zi.displayName="ResizeBar";const Wi=t.forwardRef(((e,n)=>{const{offset:r,className:i,style:l}=e,{direction:a,dragging:o}=t.useContext(ki),s="vertical"===a?"height":"width",c={[Jn("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[i]:!!i},d=void 0!==r?{[s]:Bn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:_e(c),style:Object.assign(Object.assign({},d),l)},e.children)}));Wi.displayName="SplitPane";const Bi=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:l,style:a,onDragStart:o,onDrag:s=Hn,onDragEnd:c}=e,{global:d}=t.useContext(en),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));Li((()=>{v?null==o||o(m(b)):(null==c||c(m(b)),localStorage.setItem(g,b),w(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(h(e)):C(g).then((e=>{localStorage.setItem(g,h(e||r)),E()})).catch((()=>{}))},C=e=>kn(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){}})),w=(e,t)=>kn(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;_n(e)&&!Fn(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={[Jn("split")]:!0,vertical:"vertical"===n};return t.createElement(ki.Provider,{value:S},t.createElement("div",{ref:u,className:_e(O,l),style:a},t.createElement(Wi,Cn({},T.props,{ref:p,offset:b})),t.createElement(zi,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Wi,I.props)))};Bi.displayName="QmSplit",Bi.Pane=Wi;const Ui=e=>{const{className:n,style:r}=e,{$size:i}=Pn(e),l=Jn("countup"),a={[l]:!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i};return t.createElement(Pt,Cn({},e,{className:_e(a,n),style:r}),e.children)};Ui.displayName="QmCountup";const Gi=e=>{const{className:n}=e,{$size:r}=Pn(e),i=Jn("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,Cn({},l,{className:_e(a,n)}))};Gi.displayName="QmEmpty";const Yi=e=>{const n=an({tip:"Loading..."},e),{fullHeight:r,className:i,style:l}=n,a=Jn("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:_e(o,i)},zn(n,["fullHeight"])),{style:Object.assign(Object.assign({},l),{maxHeight:"none"})});return t.createElement(T,s,n.children)};Yi.displayName="QmSpin";const Xi=t.createContext(void 0),Qi=new Map;const Zi=new Dt((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=Qi.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function Ji(e,t){Qi.has(e)||(Qi.set(e,new Set),Zi.observe(e)),Qi.get(e).add(t)}function el(e,t){Qi.has(e)&&(Qi.get(e).delete(t),Qi.get(e).size||(Zi.unobserve(e),Qi.delete(e)))}function tl(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&&Ji(e,n),()=>{e&&el(e,n)}}),[t]),n}function nl(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 rl=6,il={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"}},ll=e=>{const{thumb:n,always:r,className:i,barSize:l=rl,direction:a="vertical",onDrag:o=Hn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(Xi),u=il[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(Dn?null:document.onselectstart),[b,x]=t.useState(!1);t.useLayoutEffect((()=>{p.current=n}),[n]),t.useEffect((()=>{const e=c.current;return Ai(e,"mousemove",S),Ai(e,"mouseleave",N),()=>{w(),Pi(document,"mouseup",C),Pi(e,"mousemove",S),Pi(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)},C=()=>{g.current=!1,f.current={[u.axis]:0},Pi(document,"mousemove",E),Pi(document,"mouseup",C),w(),v.current&&x(!1),o(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},S=()=>{v.current=!1,x(!!p.current.size)},N=()=>{v.current=!0,x(g.current)},T=Jn("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(hh,{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(),Ai(document,"mousemove",E),Ai(document,"mouseup",C),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])})}})))},al=20,ol=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,innerStyle:l,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=al,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=tl(p),C=tl(m);sn((()=>{!s&&w()}),[C.width,C.height,E.width,E.height]);const w=nl((()=>{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)=>{se(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)*Vi(a),i(l)):e.scrollTop=t};i(l)})(h.current,e):h.current.scrollTop=e:Yn("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{se(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)*Vi(a),i(l)):e.scrollLeft=t};i(l)})(h.current,e):h.current.scrollLeft=e:Yn("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=Jn("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(Xi.Provider,{value:I},c&&t.createElement(ll,{className:"top",direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(ll,{direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(ll,{direction:"vertical",thumb:v,barSize:a,always:o,onDrag:S})))}));ol.displayName="QmScrollbar";const sl=(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}},cl=(e,{fileName:t,headers:n,params:r})=>kn(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(ln("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));sl(o,c)})),dl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},ul=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},pl=e=>{var n,r;const i=an({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}=Ln(),{$size:x}=Pn(i),C=t.useRef(null),w=t.useRef(null),[S,N]=t.useState({}),T=t.useMemo((()=>d||u),[d,u]);t.useEffect((()=>(A(),()=>{var e;return null===(e=w.current)||void 0===e?void 0:e.destroy()})),[]);const k=(e,t)=>{N((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},L=An((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&&(w.current=_t.create(ji(C.current,Jn("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:L}))},P=e=>kn(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=i;try{e.url&&(yield cl(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){R.error(b("qm.download.error"))}})),D=Jn("upload-file"),_={[D]:!0,[`${D}--lg`]:"large"===x,[`${D}--sm`]:"small"===x,[`${D}--horizontal`]:"horizontal"===a};return t.createElement(I,Cn({className:_e(_,h)},zn(i,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>kn(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=>kn(void 0,void 0,void 0,(function*(){if("function"==typeof m)return m(e,(t=>P(t||e)));d||(yield P(e))})),onDownload:e=>kn(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($e,null)),t.createElement("div",{className:"ant-upload-list-item-name"},S[a]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:dl(o),onBlur:t=>{const{value:n}=t.target;if(n!==dl(o)){const t=Object.assign({},e,{name:`${n}.${ul(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(je,null)),c&&t.createElement("button",{type:"button",className:_e(h,"preview"),onClick:()=>n.preview()},t.createElement(Ke,null)),t.createElement("button",{type:"button",className:_e(h,"download"),disabled:d,onClick:()=>n.download()},t.createElement(Ve,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:C},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=>kn(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"))))};pl.displayName="QmUploadFile";const hl=e=>{const n=an({icon:t.createElement(Ve,null),withCredentials:!1},e),{$size:r}=Pn(n),{t:i}=Ln(),[l,a]=t.useState(!1),o=zn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,Cn({},o,{size:r,loading:l,onClick:()=>kn(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:l,beforeDownload:a=Mn,onSuccess:o}=n,s=de(e)?e:yield kn(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 Yn("Download","参数 `action` 有误!");if(!a(s))return;yield cl(s,{fileName:t,headers:r,params:l}),yield $n(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 ml(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])}hl.displayName="QmDownload";const fl=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))})))},gl=e=>{const{label:n,showDivider:r,className:i,style:l}=e,a={[Jn("anchor-item")]:!0};return t.createElement("div",{className:_e(a,i),style:l},r&&t.createElement(er,{label:n,style:{marginBottom:10}}),e.children)};gl.displayName="AnchorItem";const vl=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:i,labelWidth:l,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=Pn(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=Ft(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=Mi(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=>Mi(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=ml((e=>{if("ready"!==h.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),C=e=>{const t=x(e);t&&(g(e),h.current="stop",p.current&&clearTimeout(p.current),Ht(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,C(e)}})));const w=Jn("anchor"),S={[w]:!0,[`${w}-left`]:"left"===a,[`${w}-top`]:"top"===a,[`${w}--lg`]:"large"===d,[`${w}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;_n(e)&&!Fn(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?Bn(l):""}},t.createElement(fl,{activeKey:f,labels:T,onTabClick:(e,t)=>{C(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:_e("anchor-container")},v?e.children:N))}));vl.displayName="QmAnchor",vl.Item=gl;const yl=e=>t.createElement(k.TabPane,e,e.children);yl.displayName="TabPane";const bl=e=>{const n=an({tabPosition:"top"},e),{items:r,tabPosition:i,tabBarGutter:l,className:a,authConfig:o}=n,{$size:s}=Pn(n),c=Jn("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},zn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=l?l:["top","bottom"].includes(i)?30:0}),p=[];t.Children.map(n.children,(e=>{var t;_n(e)&&!Fn(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,Cn({},u,{items:h,className:_e(d,a)}))};bl.displayName="QmTabs",bl.TabPane=yl;const xl=t.forwardRef(((e,n)=>{var r;const i=an({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(en),{$size:v}=Pn(i),y=t.useRef(null),b=t.useRef(null),x=t.useRef(!1),[E,C]=t.useState(!1),[w,S]=t.useState(!1),[N,T]=t.useState(!1);Li((()=>{(null!=a?a:l)&&(!p&&x.current||ue(s)&&S(!0))}),[null!=a?a:l]),Li((()=>{b.current&&Fi(b.current,E?{width:"100%"}:{width:Bn(i.width||"72%")})}),[E]);const I=()=>{b.current=ji(y.current,"ant-drawer-content-wrapper"),C(!E),null==f||f(!E)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=Jn("drawer"),O={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===v,[`${R}--sm`]:"small"===v};return t.createElement(L,Cn({},zn(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?We:Be))),footer:null,afterOpenChange:e=>{e?(x.current=!0,ue(s)&&setTimeout((()=>S(!1)),100)):(C(!1),null==m||m())},onClose:h}),i.children,(s||N||w)&&t.createElement(Yi,{spinning:!0,className:_e("spinning")}))}));xl.displayName="QmDrawer";const El="10vh";var Cl;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Cl||(Cl={}));const wl=t.forwardRef(((e,n)=>{var r;const i=an({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:El}},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(en),{$size:E}=Pn(i),C=t.createRef(),w=t.useRef(!1),S=t.useMemo((()=>`calc(100vh - ${El} - ${El} - ${Cl[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}),[F,H]=t.useState();Li((()=>{if(null!=a?a:l){if(!f&&w.current||ue(d)&&R(!0),!f&&w.current)return;setTimeout((()=>{w.current=!0,ue(d)&&R(!1)}),400)}}),[null!=a?a:l]),Li((()=>{H(N?{x:0,y:0}:void 0)}),[N]);const M=e=>{const t=ji(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");N?(Fi(t,{width:Bn(o||"60%"),height:"auto",top:El}),Fi(n,{height:s?Bn(s):S,maxHeight:"auto"===s?S:""})):(Fi(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Fi(n,{height:`calc(100vh - ${Cl[p?E:"none"]}px)`,maxHeight:""})),T(!N),null==v||v(!N)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>k(!0),STOP_LOADING:()=>k(!1)})));const $=Jn("modal"),j={height:s?Bn(s):S,maxHeight:"auto"===s?S:"",overflow:"auto"},q={[$]:!0,"no-header":!p,[`${$}--lg`]:"large"===E,[`${$}--sm`]:"small"===E};return t.createElement(A,Cn({},zn(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(q,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:M},t.createElement(N?We:Be))),footer:null,bodyStyle:Object.assign({},j,g),onCancel:y,afterClose:()=>{null==b||b(),T(!1)},modalRender:e=>t.createElement(Mt,{nodeRef:C,bounds:D,position:F,disabled:!u||L||N,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,i=C.current.getBoundingClientRect();i&&_({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:C},e))}),i.children,(d||O||I)&&t.createElement(Yi,{spinning:!0,className:_e("spinning")}))}));wl.displayName="QmModal";const Sl=n(void 0),Nl=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var Tl={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)Nl.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 Il=["==","<",">","<=",">=","!=","like","likes","in","nin"];var Rl=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},Ol=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++)Il.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),Il.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const kl=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Ll=["string","number","boolean","symbol"],Al=e=>Ll.includes(typeof e),Pl=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Dl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(kl,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Dl(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Dl(t))));break;case"in":Al(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Al(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(Pl(e)?e.slice(0,10):e)!=n;break;case"<":r=(Pl(e)?e.slice(0,10):e)<n;break;case"<=":r=(Pl(e)?e.slice(0,10):e)<=n;break;case">":r=(Pl(e)?e.slice(0,10):e)>n;break;case">=":r=(Pl(e)?e.slice(0,10):e)>=n;break;default:r=(Pl(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const _l=Tl.stringify,Fl=Tl.array_format,Hl=Rl,Ml=(e,t,n)=>{let r=[];t=Tl.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Ol(t,"record")};`);r=ya(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Ol(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)n(e,t)&&r.push(e[t])}}catch(t){Yn("Table","组件 `initialFilter` 参数有误!"),r=e}return r},$l=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...$l(e.children)):t.push(e)})),t},jl=e=>e.filter((e=>(e.children&&(e.children=jl(e.children)),!e.hidden&&!e.noAuth))),ql=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...ql(e.children))})),t},Kl=(e,t)=>e.map((e=>(e.children&&(e.children=Kl(e.children,t)),null==t||t(e),e))),Vl=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Vl(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},Wl=e=>{const t=e.children;return t?t[t.length-1].children?Wl(t[t.length-1]):t[t.length-1]:e},Bl=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Ul=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Ul(n.children,t);if(e)return e}}return null},Gl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Gl(e.children))})),t},Yl=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 ql(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Xl=e=>Object.assign(e,{__prevent__:!0}),Ql=e=>{delete e.__prevent__},Zl=(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 Zl(e.offsetParent,t,n)}return n},Jl=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ea=(e,t)=>he(e,((e,n,r)=>{me(n,t[r])||(e[r]=oe(n)&&oe(t[r])?ea(n,t[r]):n)})),ta=(e,t)=>{var n;return null!==(n=pe(e,t))&&void 0!==n?n:""},na=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),fe(e,t,null!=n?n:"")},ra=(e,t)=>{if(!t.includes("|"))return ta(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(ta(e,t))})),n.every((e=>!e))?"":n.join(" | ")},ia=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),la=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]}`:""}`},aa=(e,t)=>{const n=e.toString();if(!ia(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)},oa=(e,t)=>e?h(e,t):null,sa=(e,t)=>e?h(e).format(t):"",ca=(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)}))},da=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...da(e))}))}else n.push(e);return n},ua=e=>da(e).join(""),pa=e=>e.filter((e=>!e._group)),ha=(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)?Fl(l.condition):_l(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])?Fl(a[e]):_l(a[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},ma=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(ta(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},fa=(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=fa(e[n].children,t);if(r)return[e[n],r].flat()}}},ga=(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=ga(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},va=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=va(n.children,t);if(e)return e}if(t(n))return n}return null},ya=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&ya(e.children,t),t(e)||e.children&&e.children.length))),ba=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),xa=e=>["","small","middle","large"].includes(e),Ea=80,Ca="1",wa="0",Sa=400,Na=["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"],Ta={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 Ia,Ra,Oa;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Ia||(Ia={})),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"}(Ra||(Ra={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Oa||(Oa={}));const ka={items:qt.arrayOf(qt.shape({type:qt.string.isRequired,fieldName:qt.string.isRequired})),initialValues:qt.object,initialExtras:qt.object,layout:qt.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!xa(e[t]||""))return Gn("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:qt.number,className:qt.string,style:qt.object,compactMode:qt.bool,labelWidth:qt.oneOfType([qt.number,qt.string]),labelAlign:qt.oneOf(["left","right"]),labelWrap:qt.bool,formType:qt.oneOf(["default","search","onlyShow"]),disabled:qt.bool,uniqueKey:qt.string,defaultRows:qt.number,defaultExpand:qt.bool,searchButtonCols:qt.number,scrollToFirstError:qt.bool,authConfig:qt.object,isAutoFocus:qt.bool,isCollapse:qt.bool,isFieldsDefine:qt.bool,isSearchBtn:qt.bool,isSubmitBtn:qt.bool,fieldsChange:qt.func,onValuesChange:qt.func,onFieldsChange:qt.func,onFinish:qt.func,onFinishFailed:qt.func,onReset:qt.func,onCollapse:qt.func},La={layout:"horizontal",labelWidth:Ea,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:Hn,onFieldsChange:Hn,onFinish:Hn,onFinishFailed:Hn,onReset:Hn,onCollapse:Hn},Aa=(e,t)=>{if(!e)return null;if(t===Ra.week){const t=e.match(/^(\d{4})-(\d+)/);return t?h().year(Number(t[1])).week(Number(t[2])):null}if(t===Ra.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)},Pa=(e,t)=>e?h(e).format(t):"",Da=e=>""===e||null==e,_a=(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},Fa=(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]]},Ha=(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]]},Ma=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),ue(e.isLeaf)||(r.isLeaf=!!e.isLeaf),ue(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=Ma(e.children,t,n)),r})),$a=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=$a(n.children,t);if(e)return e}}return null},ja=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...ja(e.children,t,n+1))})),r},qa=e=>_n(e)||"string"==typeof e,Ka=e=>_n(e)?da(e).join(""):null!=e?e:"",Va=(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 za={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 Wa="阿",Ba="鿿",Ua=1,Ga=2,Ya=3;let Xa,Qa=null;function Za(e){return e||null===Qa?("object"==typeof Intl&&Intl.Collator?(Xa=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Qa=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Qa=!1,Qa):Qa}function Ja(e){const t=za.UNIHANS,n=za.PINYINS,r=za.EXCEPTIONS,i={source:e};if(e in r)return i.type=Ga,i.target=r[e],i;let l,a=-1;if(e.charCodeAt(0)<256)return i.type=Ua,i.target=e,i;if(l=Xa.compare(e,Wa),l<0)return i.type=Ya,i.target=e,i;if(0===l)i.type=Ga,a=0;else{if(l=Xa.compare(e,Ba),l>0)return i.type=Ya,i.target=e,i;0===l&&(i.type=Ga,a=t.length-1)}if(i.type=Ga,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const i=t[a];if(l=Xa.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=Ya,i.target=i.source),i}function eo(e){return"string"==typeof e&&Za()?e.split("").map((e=>Ja(e))):e}var to={isSupported:Za,parse:eo,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(za)})))},genToken:Ja,convertToPinyin:(e,t,n)=>eo(e).map((e=>t&&e.type===Ga?e.target.toLowerCase():e.target)).join(n||"")};var no={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)}};to.isSupported()&&no.shouldPatch(to.genToken)&&to.patchDict(no);const ro=e=>{const{value:n,bordered:r}=e;return t.createElement(O,{value:n,title:n,bordered:r,readOnly:!0})};ro.displayName="FormItemView";const{Option:io}=F,lo=e=>{const{$$form:n}=t.useContext(Sl),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Ln(),{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=Sa,collapseTags:C,maxTagTextLength:w,dropdownStyle:S,openPyt:N=!0}=u,T=Kn(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(ro,{value:R(r),bordered:m}):t.createElement(F,Cn({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:C?"responsive":void 0,maxTagTextLength:w},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=to.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(io,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class ao extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>kn(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=pe(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;me(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Bn(d)},required:e.getFormItemRequired(f)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(lo,{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(_,null,e.renderFormItemButton(o,h)),p&&t.createElement(_,{flex:Bn(p.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}ao.contextType=Sl;const oo=e=>{const{$$form:n}=t.useContext(Sl),{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=wa,trueValue:h=Ca}=o,{t:m}=Ln(),f=e=>m(e===h?"am.form.trueText":"am.form.falseText");return t.createElement(H,{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 so 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=Hn}=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":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(oo,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}so.contextType=Sl;const co=e=>{const{uniqueKey:n,items:r,fieldsChange:i}=e,{global:l}=t.useContext(en),{$$form:a}=t.useContext(Sl),{$size:o}=Pn(e),{t:s}=Ln(),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,kn(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 ge(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?(ue(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 ue(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(p));var r,i;me(t,n)||(localStorage.setItem(p,JSON.stringify(t)),r=p,i=t,kn(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(Xn,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||Wn(e);return Object.assign(t,{hidden:e.hidden})}));g(t),m(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(Xt,{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(me(t,n))return;a.setExpandHandle(!0);const i=ba(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(H,{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(Ge,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=Jn("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(M,{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(Ue,null)))};co.displayName="FieldsFilter";const uo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Sl),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Ln(),{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:C,pattern:w,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,D=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(ro,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(D),bordered:u}):t.createElement(P,{ref:e=>{L.current=e,"function"==typeof n&&n(e)},value:D,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":D,prefix:b,suffix:x,maxLength:C,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;ve(w)&&(t=w.test(t)?t:null!=i?i:""),S&&(t=t.toUpperCase()),A(t)}})}));uo.displayName="VInput";class po 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(uo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(l,t)}}))),u&&t.createElement(_,null,e.renderFormItemButton(l,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}po.contextType=Sl;const ho=e=>{const{$$form:n}=t.useContext(Sl),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Ln(),{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(ro,{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 mo 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(o)},required:e.getFormItemRequired(u)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ho,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(_,{flex:Bn(c.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}mo.contextType=Sl;const fo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Sl),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Ln(),{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:C,textAlign:w="left",controls:S=!0,formatter:N,parser:T}=s,I=t.useRef(),R=t.useRef(i),O=e=>{const t=Da(e)?"":se(e)?e.toFixed(x):new Vt(e).toFixed(x);return"function"==typeof N?N(t):t},k={[w]:!0,controls:S};return r.isOnlyShow?t.createElement(ro,{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:C,formatter:N,parser:T,bordered:u,readOnly:p,disabled:h,onFocus:e=>{null==m||m(e.target.value,e)},onBlur:t=>{jn((()=>{(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:"";!C&&(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)}})}));fo.displayName="VInputNumber";class go 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(fo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(l,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(l,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}go.contextType=Sl;const vo=e=>{const{$$form:n}=t.useContext(Sl),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Ln(),{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]),C(e)},C=e=>{const t=e.every((e=>null===e))?[]:[...e];null==i||i(t),l(t,w(t))},w=e=>Da(e)?"":e.map((e=>Da(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(ro,{value:w(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=>{C([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=>{C([r[0],e])},onBlur:()=>{E(r)}}))};class yo 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(o)},required:e.getFormItemRequired(u)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(vo,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(_,{flex:Bn(c.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}var bo;yo.contextType=Sl,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(bo||(bo={}));const{Search:xo}=O;class Eo extends s{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=$t((e=>Object.assign({},this.props.helperConfig,e))),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>kn(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||Yn("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)||Yn("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Yn("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>kn(this,void 0,void 0,(function*(){var e;yield this.props.waiting();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||Kn(u))return this._prevValue=void 0;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=pe(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Fa(e,this.alias,c),d&&Ha(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,a){const t=_a(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(oe(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=Mn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>kn(this,void 0,void 0,(function*(){var o;const s=ye({},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=pe(e.data,t.fetch.dataKey))&&void 0!==o?o:[];l(n)}else a()}catch(e){a(e)}finally{jn((()=>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=_a(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=_a(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>kn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=_a(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)=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,i=(null!=r?r:Mn)(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]:_a(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:_a(e,this.extras[n])});const r=_a(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.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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){var e;if(null===this._prevValue)return;const t=this.getItemValue();this._prevValue!==t&&t!==(null===(e=this._record)||void 0===e?void 0:e[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=t}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=ln("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:ln("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${bo[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(ro,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(xo,{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):jn((()=>this.clearSearchHelperValue())))}}),t.createElement(wl,b,t.createElement($p,x)))}}Eo.contextType=Sl;class Co extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>kn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Gn("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 Yn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>kn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Va(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":Bn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Eo,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Co.contextType=Sl;const wo=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=Ft(document,"mousedown",this.mousedownHandler),this.event2=Ft(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,Cn({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,Cn({},e,{forwardedRef:r}))))};function So(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 No(e,t,n,r){var i=Gt.unstable_batchedUpdates?function(e){Gt.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 To=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&&qr()&&(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?Gt.createPortal(i,s.current):null}));function Io(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var Ro;function Oo(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 ko(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=sr({motionAppear:!0},Oo({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(vi,yi({},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 Lo(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 Ao(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lo(Object(n),!0).forEach((function(t){Do(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Po(e){return Po="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},Po(e)}function Do(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _o={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function Fo(){if(void 0!==Ro)return Ro;Ro="";var e=document.createElement("p").style;for(var t in _o)t+"Transform"in e&&(Ro=t);return Ro}function Ho(){return Fo()?"".concat(Fo(),"TransitionProperty"):"transitionProperty"}function Mo(){return Fo()?"".concat(Fo(),"Transform"):"transform"}function $o(e,t){var n=Ho();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function jo(e,t){var n=Mo();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var qo,Ko=/matrix\((.*)\)/,Vo=/matrix3d\((.*)\)/;function zo(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Wo(e,t,n){var r=n;if("object"!==Po(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)&&Wo(e,i,t[i])}function Bo(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 Uo(e){return Bo(e)}function Go(e){return Bo(e,!0)}function Yo(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+=Uo(r),t.top+=Go(r),t}function Xo(e){return null!=e&&e==e.window}function Qo(e){return Xo(e)?e.document:9===e.nodeType?e:e.ownerDocument}var Zo=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),Jo=/^(top|right|bottom|left)$/,es="currentStyle",ts="runtimeStyle",ns="left";function rs(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function is(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function ls(e,t,n){"static"===Wo(e,"position")&&(e.style.position="relative");var r=-999,i=-999,l=rs("left",n),a=rs("top",n),o=is(l),s=is(a);"left"!==l&&(r=999),"top"!==a&&(i=999);var c,d="",u=Yo(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[Ho()]||"",$o(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")),zo(e);var p=Yo(e),h={};for(var m in t)if(t.hasOwnProperty(m)){var f=rs(m,n),g="left"===m?r:i,v=u[m]-p[m];h[f]=f===m?g+v:g-v}Wo(e,h),zo(e),("left"in t||"top"in t)&&$o(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=rs(b,n),E=t[b]-u[b];y[x]=b===x?h[x]+E:h[x]-E}Wo(e,y)}function as(e,t){var n=Yo(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(Mo());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(Mo());if(r&&"none"!==r){var i,l=r.match(Ko);l?((i=(l=l[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,i[5]=t.y,jo(e,"matrix(".concat(i.join(","),")"))):((i=r.match(Vo)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,i[13]=t.y,jo(e,"matrix3d(".concat(i.join(","),")")))}else jo(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,i)}function os(e,t){for(var n=0;n<e.length;n++)t(e[n])}function ss(e){return"border-box"===qo(e,"boxSizing")}"undefined"!=typeof window&&(qo=window.getComputedStyle?function(e,t,n){var r=n,i="",l=Qo(e);return(r=r||l.defaultView.getComputedStyle(e,null))&&(i=r.getPropertyValue(t)||r[t]),i}:function(e,t){var n=e[es]&&e[es][t];if(Zo.test(n)&&!Jo.test(t)){var r=e.style,i=r[ns],l=e[ts][ns];e[ts][ns]=e[es][ns],r[ns]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[ns]=i,e[ts][ns]=l}return""===n?"auto":n});var cs=["margin","border","padding"],ds=-1,us=2,ps=1;function hs(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 ms={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 fs(e,t,n){var r=n;if(Xo(e))return"width"===t?ms.viewportWidth(e):ms.viewportHeight(e);if(9===e.nodeType)return"width"===t?ms.docWidth(e):ms.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],l="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=ss(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?ps:ds);var s=void 0!==l||a,c=l||o;return r===ds?s?c-hs(e,["border","padding"],i):o:s?r===ps?c:c+(r===us?-hs(e,["border"],i):hs(e,["margin"],i)):o+hs(e,cs.slice(r),i)}os(["Width","Height"],(function(e){ms["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],ms["viewport".concat(e)](n))},ms["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 gs={position:"absolute",visibility:"hidden",display:"block"};function vs(){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=fs.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,gs,(function(){r=fs.apply(void 0,t)})),r}function ys(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}os(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);ms["outer".concat(t)]=function(t,n){return t&&vs(t,e,n?0:ps)};var n="width"===e?["Left","Right"]:["Top","Bottom"];ms[e]=function(t,r){var i=r;return void 0!==i?t?(ss(t)&&(i+=hs(t,["padding","border"],n)),Wo(t,e,i)):void 0:t&&vs(t,e,ds)}}));var bs={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:Qo,offset:function(e,t,n){if(void 0===t)return Yo(e);!function(e,t,n){if(n.ignoreShake){var r=Yo(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?ls(e,t,n):n.useCssTransform&&Mo()in document.body.style?as(e,t):ls(e,t,n)}(e,t,n||{})},isWindow:Xo,each:os,css:Wo,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:ys,getWindowScrollLeft:function(e){return Uo(e)},getWindowScrollTop:function(e){return Go(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)bs.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};ys(bs,ms);var xs=bs.getParent;function Es(e){if(bs.isWindow(e)||9===e.nodeType)return null;var t,n=bs.getDocument(e).body,r=bs.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:xs(e);for(t=xs(e);t&&t!==n&&9!==t.nodeType;t=xs(t))if("static"!==(r=bs.css(t,"position")))return t;return null}var Cs=bs.getParent;function ws(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Es(e),i=bs.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"===bs.css(r,"overflow")){if(r===a||r===o)break}else{var s=bs.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=Es(r)}var c=null;bs.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===bs.css(e,"position")&&(e.style.position="fixed"));var d=bs.getWindowScrollLeft(l),u=bs.getWindowScrollTop(l),p=bs.viewportWidth(l),h=bs.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(bs.isWindow(e)||9===e.nodeType)return!1;var t=bs.getDocument(e),n=t.body,r=null;for(r=Cs(e);r&&r!==n&&r!==t;r=Cs(r))if("fixed"===bs.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 Ss(e){var t,n,r;if(bs.isWindow(e)||9===e.nodeType){var i=bs.getWindow(e);t={left:bs.getWindowScrollLeft(i),top:bs.getWindowScrollTop(i)},n=bs.viewportWidth(i),r=bs.viewportHeight(i)}else t=bs.offset(e),n=bs.outerWidth(e),r=bs.outerHeight(e);return t.width=n,t.height=r,t}function Ns(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 Ts(e,t,n,r,i){var l=Ns(t,n[1]),a=Ns(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 Is(e,t,n){return e.left<n.left||e.left+t.width>n.right}function Rs(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function Os(e,t,n){var r=[];return bs.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function ks(e,t){return e[t]=-e[t],e}function Ls(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function As(e,t){e[0]=Ls(e[0],t.width),e[1]=Ls(e[1],t.height)}function Ps(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=ws(s,!(!(o=o||{})||!o.alwaysByViewport)),p=Ss(s);As(l,p),As(a,t);var h=Ts(p,t,i,l,a),m=bs.merge(p,h);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&Is(h,p,u)){var f=Os(i,/[lr]/gi,{l:"r",r:"l"}),g=ks(l,0),v=ks(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Ts(p,t,f,g,v),p,u)||(d=1,i=f,l=g,a=v)}if(o.adjustY&&Rs(h,p,u)){var y=Os(i,/[tb]/gi,{t:"b",b:"t"}),b=ks(l,1),x=ks(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Ts(p,t,y,b,x),p,u)||(d=1,i=y,l=b,a=x)}d&&(h=Ts(p,t,i,l,a),bs.mix(m,h));var E=Is(h,p,u),C=Rs(h,p,u);if(E||C){var w=i;E&&(w=Os(i,/[lr]/gi,{l:"r",r:"l"})),C&&(w=Os(i,/[tb]/gi,{t:"b",b:"t"})),i=w,l=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&C,(c.adjustX||c.adjustY)&&(m=function(e,t,n,r){var i=bs.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)),bs.mix(i,l)}(h,p,u,c))}return m.width!==p.width&&bs.css(s,"width",bs.width(s)+m.width-p.width),m.height!==p.height&&bs.css(s,"height",bs.height(s)+m.height-p.height),bs.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 Ds(e,t,n){var r=n.target||t,i=Ss(r),l=!function(e,t){var n=ws(e,t),r=Ss(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 Ps(e,i,n,l)}Ds.__getOffsetParent=Es,Ds.__getVisibleRectForElement=ws;var _s=qr()?e.useLayoutEffect:e.useEffect,Fs=function(t,n){var r=e.useRef(!0);_s((function(){return t(r.current)}),n),_s((function(){return r.current=!1,function(){r.current=!0}}),[])};function Hs(e,t){var n=null,r=null;var i=new Dt((function(e){var i=dr(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 Ms(e){return"function"!=typeof e?null:e()}function $s(e){return"object"===ir(e)&&e?e:null}var js=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=Ms(n),s=$s(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=Ds(l,o,r):s&&(a=function(e,t,n){var r,i,l=bs.getDocument(e),a=l.defaultView||l.parentWindow,o=bs.getWindowScrollLeft(a),s=bs.getWindowScrollTop(a),c=bs.viewportWidth(a),d=bs.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 Ps(e,u,Ao(Ao({},n),{},{points:h}),p)}(l,s,r)),function(e,t){e!==document.activeElement&&So(t,e)&&"function"==typeof e.focus&&e.focus()}(c,l),i&&a&&i(l,a),!0}return!1}),d),g=dr(f,2),v=g[0],y=g[1],b=dr(t.useState(),2),x=b[0],E=b[1],C=dr(t.useState(),2),w=C[0],S=C[1];return Fs((function(){E(Ms(l)),S($s(l))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=w)||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(mn(!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"===ir(t)&&"object"===ir(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 Hs(p.current,v)}),[p.current]),t.useEffect((function(){return Hs(x,v)}),[x]),t.useEffect((function(){i?y():v()}),[i]),t.useEffect((function(){if(s)return No(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:vr(h.ref,p)})),h},qs=t.forwardRef(js);function Ks(){Ks=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"==ir(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=C(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 C(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,C(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 w(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(w,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 Vs(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 zs(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var l=e.apply(t,n);function a(e){Vs(l,r,i,a,o,"next",e)}function o(e){Vs(l,r,i,a,o,"throw",e)}a(void 0)}))}}qs.displayName="Align";var Ws=["measure","alignPre","align",null,"motion"],Bs=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,C=t.onMouseDown,w=t.onTouchStart,S=t.onClick,N=l(),T=l(),I=dr(u(),2),R=I[0],O=I[1],k=function(t){var n=dr(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=dr(k,2),A=L[0],P=L[1];var D=function(e,t){var n=dr(kr(null),2),r=n[0],i=n[1],a=l();function s(e){i(e,!0)}function c(){di.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=di(zs(Ks().mark((function e(){var t,n;return Ks().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Ws.indexOf(r),(n=Ws[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=di((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){p&&P(v())})),_=dr(D,2),F=_[0],H=_[1],M=dr(u(0),2),$=M[0],j=M[1],q=l();function K(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function V(e,t){var n=y(t);R!==n&&O(n),j((function(e){return e+1})),"align"===F&&(null==b||b(e,t))}Fs((function(){"alignPre"===F&&j(0)}),[F]),Fs((function(){"align"===F&&($<3?K():H((function(){var e;null===(e=q.current)||void 0===e||e.call(q)})))}),[$]);var z=sr({},Oo(t));function W(){return new Promise((function(e){q.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=z[e];z[e]=function(e,n){return H(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==F||H()}),[z.motionName,F]),e.useImperativeHandle(n,(function(){return{forceAlign:K,getElement:function(){return T.current}}}));var B=sr(sr({},A),{},{zIndex:d,opacity:"motion"!==F&&"stable"!==F&&r?0:void 0,pointerEvents:r||"stable"===F?void 0:"none"},s),U=!0;null==f||!f.points||"align"!==F&&"stable"!==F||(U=!1);var G=c;return e.Children.count(c)>1&&(G=e.createElement("div",{className:"".concat(i,"-content")},c)),e.createElement(vi,yi({visible:r,ref:T,leavedClassName:"".concat(i,"-hidden")},z,{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:V},e.createElement("div",{ref:n,className:o,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:C,onTouchStartCapture:w,onClick:S,style:sr(sr({},l),B)},G))}))}));Bs.displayName="PopupInner";var Us=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=sr({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(vi,yi({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:sr(sr({},l),f)},g)}))}));Us.displayName="MobilePopupInner";var Gs=["visible","mobile"],Ys=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,l=br(t,Gs),a=dr(u(r),2),s=a[0],c=a[1],d=dr(u(!1),2),p=d[0],h=d[1],m=sr(sr({},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(Us,yi({},m,{mobile:i,ref:n})):e.createElement(Bs,yi({},m,{ref:n}));return e.createElement("div",null,e.createElement(ko,m),f)}));Ys.displayName="Popup";var Xs=e.createContext(null);function Qs(){}function Zs(){return""}function Js(e){return e?e.ownerDocument:window.document}var ec=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var tc=function(t){var n=function(n){Nr(i,e.Component);var r=Rr(i);function i(t){var n,l;return Er(this,i),ar(Ir(n=r.call(this,t)),"popupRef",e.createRef()),ar(Ir(n),"triggerRef",e.createRef()),ar(Ir(n),"portalContainer",void 0),ar(Ir(n),"attachId",void 0),ar(Ir(n),"clickOutsideHandler",void 0),ar(Ir(n),"touchOutsideHandler",void 0),ar(Ir(n),"contextMenuOutsideHandler1",void 0),ar(Ir(n),"contextMenuOutsideHandler2",void 0),ar(Ir(n),"mouseDownTimeout",void 0),ar(Ir(n),"focusTime",void 0),ar(Ir(n),"preClickTime",void 0),ar(Ir(n),"preTouchTime",void 0),ar(Ir(n),"delayTimer",void 0),ar(Ir(n),"hasPopupMouseDown",void 0),ar(Ir(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),ar(Ir(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),ar(Ir(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),ar(Ir(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),ar(Ir(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&So(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),ar(Ir(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),ar(Ir(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),ar(Ir(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),ar(Ir(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),ar(Ir(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),ar(Ir(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),ar(Ir(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)})),ar(Ir(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)})),ar(Ir(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),i=n.getPopupDomNode();So(r,t)&&!n.isContextMenuOnly()||So(i,t)||n.hasPopupMouseDown||n.close()}})),ar(Ir(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=pr(n.triggerRef.current);if(t)return t}catch(e){}return Gt.findDOMNode(Ir(n))})),ar(Ir(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(Io(e[o].points,i,r))return"".concat(t,"-placement-").concat(o)}return""}(l,a,e,o)),s&&t.push(s(e)),t.join(" ")})),ar(Ir(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,C=n.state,w=C.popupVisible,S=C.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(Ys,yi({prefixCls:r,destroyPopupOnHide:i,visible:w,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)})),ar(Ir(n),"attachParent",(function(e){di.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=di((function(){n.attachParent(e)}))})),ar(Ir(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})),ar(Ir(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),ar(Ir(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),ar(Ir(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),l="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:l,popupVisible:l},ec.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return wr(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=No(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=No(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=No(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=No(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),di.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 sr(sr({},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=sr({},d);yr(c)&&(p.ref=vr(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(Xs.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 ar(n,"contextType",Xs),ar(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Zs,getDocument:Js,onPopupVisibleChange:Qs,afterPopupVisibleChange:Qs,onPopupAlign:Qs,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}(To);let nc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=$t((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Yn("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Yn("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=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Mn)(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(be([...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;me(n,r)||me(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return kn(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(Kn(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=pe(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=ln("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:l,title:ln("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${bo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ye({},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"},ln("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=Jn("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(ro,{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(tc,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ta,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(F,{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(F.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(Ye,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(wl,C,t.createElement($p,w)))}};nc.contextType=Sl,nc=On([wo],nc);class rc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>kn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Gn("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 Yn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>kn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Va(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Bn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(nc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}rc.contextType=Sl;const{Search:ic}=O;class lc extends s{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=$t((e=>Object.assign({},this.props.helperConfig,e))),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>kn(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||Yn("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)||Yn("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Yn("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>kn(this,void 0,void 0,(function*(){var e;yield this.props.waiting();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||Kn(u))return this._prevValue=void 0;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=pe(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Fa(e,this.alias,c),d&&Ha(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,a){const t=_a(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=_a(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]:_a(e,this.extras[n])})},this.openSearchHelper=e=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Mn)(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]:_a(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:_a(e,this.extras[n])});const r=_a(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.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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){var e;if(null===this._prevValue)return;const t=this.getItemValue();this._prevValue!==t&&t!==(null===(e=this._record)||void 0===e?void 0:e[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=t}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=ln("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:ln("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${bo[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:ye({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(ro,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(ic,{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(wl,b,t.createElement(Vp,x)))}}lc.contextType=Sl;class ac extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>kn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Gn("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 Yn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>kn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Va(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Bn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(lc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}ac.contextType=Sl;let oc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=$t((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Yn("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Yn("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=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Mn)(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(be([...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;me(n,r)||me(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return kn(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(Kn(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=pe(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=ln("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:l,title:ln("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${bo[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ye({},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"},ln("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=Jn("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(ro,{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(tc,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ta,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(F,{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(F.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(Ye,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(wl,C,t.createElement(Vp,w)))}};oc.contextType=Sl,oc=On([wo],oc);class sc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>kn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Gn("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 Yn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>kn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Va(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Bn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(oc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}sc.contextType=Sl;const cc=new Array(2).fill("");class dc extends s{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:cc},this.getSearchHelper=$t((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Yn("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Yn("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(cc),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=>kn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:Mn)(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]:Kn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Mn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>kn(this,void 0,void 0,(function*(){var o;const s=ye({},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(jn((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=pe(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return l(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>kn(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;me(t,n)||me(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:i}=this.props.option;if(!me(r[i],this._ceho_data)&&(this._ceho_data=r[i],this.setItemList(r[i]),n.length)){const e=cc.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 kn(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(Kn(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=pe(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=ln("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=l.every((e=>Da(e)))?"":l.join(" - "),f={visible:r,title:ln("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${bo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:ye({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(ro,{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(wl,f,t.createElement(Up,g)))}}dc.contextType=Sl;class uc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>kn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Gn("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 Yn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>kn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Va(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(c),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(dc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{m(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(a,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}uc.contextType=Sl;const pc=e=>{const{$$form:n}=t.useContext(Sl),{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=Kn(p)?i:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(ro,{value:m(r),bordered:c}):t.createElement(H.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(H,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class hc 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;me(r,i)||this.getItemList()}getItemList(){var e;return kn(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=pe(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Bn(c)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(pc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,{flex:Bn(u.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}hc.contextType=Sl;const mc=e=>{const{$$form:n}=t.useContext(Sl),{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(j,{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 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{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,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}fc.contextType=Sl;const gc=e=>{const{$$form:n}=t.useContext(Sl),{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=Kn(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(ro,{value:m(r),bordered:c}):t.createElement(q.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(q,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class vc extends s{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>kn(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=pe(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;me(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Bn(c)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(gc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,{flex:Bn(u.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}vc.contextType=Sl;const yc=e=>{const{$$form:n}=t.useContext(Sl),{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=wa,trueValue:h=Ca}=o,{t:m}=Ln();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(Xe,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 bc 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=Hn}=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":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(yc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}bc.contextType=Sl;const xc=e=>{const{$$form:n}=t.useContext(Sl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Ln(),{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 Ec 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(xc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Ec.contextType=Sl;const Cc=e=>{const{$$form:n}=t.useContext(Sl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Ln(),{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,C=t.createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==i||i(e),l(e,S(e))},S=e=>Da(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Pa(h().subtract(e,"day"),Ra[g]);"date"===g&&(t=t.slice(0,10)),w(t),C.current.blur(),C.current.focus()};return n.isOnlyShow?t.createElement(ro,{value:S(r),bordered:u}):t.createElement(En,{ref:C,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ia[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(V,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(V,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(V,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(V,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:Aa(r,Ra[g]),onChange:(e,t)=>{w(Pa(e,Ra[g]))}})};class wc 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Cc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}wc.contextType=Sl;const Sc=e=>[h().subtract(e,"day"),h()],Nc=e=>{const{$$form:n}=t.useContext(Sl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Ln(),{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:C,shortCuts:w=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:Sc(7),[a("qm.form.dateRangePickers")[1]]:Sc(30),[a("qm.form.dateRangePickers")[2]]:Sc(90),[a("qm.form.dateRangePickers")[3]]:Sc(180)},N=e=>Da(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(ro,{value:N(r),bordered:u}):t.createElement(En.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ia[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,C]),ranges:w&&g.includes("date")?S:void 0,value:Kn(r)?null:[Aa(null==r?void 0:r[0],Ra[g]),Aa(null==r?void 0:r[1],Ra[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))})([Pa(null==e?void 0:e[0],Ra[g]),Pa(null==e?void 0:e[1],Ra[g])])}})};class Tc 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Nc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Tc.contextType=Sl;const Ic=e=>{const{$$form:n}=t.useContext(Sl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Ln(),{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(ro,{value:r,bordered:u}):t.createElement(wn,{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:Oa[f],value:Aa(r,Oa[f]),onChange:(e,t)=>{(e=>{const t=Pa(e,Oa[f]);null==i||i(t),l(t)})(e)}})};class Rc 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ic,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Rc.contextType=Sl;const Oc=e=>{const{$$form:n}=t.useContext(Sl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Ln(),{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=>Da(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(ro,{value:E(r),bordered:u}):t.createElement(wn.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:Oa[f],value:Kn(r)?null:[Aa(null==r?void 0:r[0],Oa[f]),Aa(null==r?void 0:r[1],Oa[f])],onChange:(e,t)=>{(e=>{const t=[Pa(null==e?void 0:e[0],Oa[f]),Pa(null==e?void 0:e[1],Oa[f])];null==i||i(t),l(t,E(t))})(e)}})};class kc 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Oc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}kc.contextType=Sl;class Lc 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=$t(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.initialHandle=()=>kn(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||Yn("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)||Yn("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),l&&!this.valueKey&&Yn("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&Yn("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>{var e;const{$$form:t}=this.context;return null!==(e=t.state.other[this.valueKey])&&void 0!==e?e:t.state.formData[this.valueKey]},this.getItemText=()=>kn(this,void 0,void 0,(function*(){var e;yield this.props.waiting();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){if(Kn(u))return this._prevValue=void 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=pe(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&Fa(e,this.alias,c),d&&Ha(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,a){const t=_a(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=_a(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]:_a(e,this.extras[n])})},this.fetchHandle=xe(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]:_a(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:_a(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=_a(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||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){var t,n,r,i,l,a,o;const s=(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),c=(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);if(me(s,c)||this.getItemList(),null===this._prevValue)return;const d=this.getItemValue();this._prevValue!==d&&d!==(null===(o=this._record)||void 0===o?void 0:o[this.alias[this.valueKey]])&&this.getItemText(),this._prevValue=d}getItemList(e){var t;return kn(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=pe(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=ln("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=Sa}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=Jn("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},pe(e,n.dataIndex))))))))):t.createElement(Gi,null));return t.createElement(en.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(ro,{value:a,bordered:u}):t.createElement(tc,{action:m?[]:["click"],popupVisible:!m&&n,popup:E,popupClassName:_e(s,`form-popper__${o}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ta,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)}})))}))}}Lc.contextType=Sl;class Ac extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>kn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Gn("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 Yn("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>kn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Va(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Bn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Lc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Ac.contextType=Sl;class Pc 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=Hn}=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(er,{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)}}))}}Pc.contextType=Sl;const Dc=(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:Dc(e.children,t,n,r)}):e)),_c=e=>{const{$$form:n}=t.useContext(Sl),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Ln(),{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=Sa,checkStrictly:C,checkStrategy:w="SHOW_CHILD",collapseTags:S,defaultExpandAll:N=!g,defaultExpandedKeys:T,dropdownStyle:I,openPyt:R=!0}=u,[O,k]=t.useState(Kn(b)?i:b),L=t.useRef(O);Li((()=>{const e=Kn(b)?i:b;g?me(e,L.current)||(k(e),L.current=e):k(e)}),[b,i]);const A=e=>{var t;return(null===(t=$a(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(ro,{value:P(r),bordered:m}):t.createElement(z,Cn({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:l,treeCheckable:l,treeCheckStrictly:C,showCheckedStrategy:z[w],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})=>kn(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=pe(t.data,l))&&void 0!==n?n:[],i=Dc(O,e,o,Ma(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=to.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 Fc extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>kn(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=pe(t.data,i))&&void 0!==e?e:[],r=Ma(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;me(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Bn(d)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(_c,{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(_,{flex:Bn(p.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Fc.contextType=Sl;const Hc=e=>{const{$$form:n}=t.useContext(Sl),{value:r,multiple:i,items:l}=e,{t:a}=Ln(),{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:C=!0}=s,[w,S]=t.useState(Kn(g)?l:g),N=t.useRef(w);Li((()=>{const e=Kn(g)?l:g;h?me(e,N.current)||(S(e),N.current=e):S(e)}),[g,l]);const T=e=>ja(w,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(ro,{value:I(r),bordered:u}):t.createElement(W,Cn({value:(e=>Kn(e)?[]:i?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:w,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=to.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:h?e=>kn(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=pe(e.data,l))&&void 0!==t?t:[],i=Dc(w,n.value,o,Ma(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),w)})(((e=[])=>i?e.map((e=>e.join(","))):e.join(","))(t))}}))};class Mc extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>kn(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=pe(t.data,i))&&void 0!==e?e:[],r=Ma(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;me(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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Bn(d)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Hc,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(_,{flex:Bn(p.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Mc.contextType=Sl;const $c=["110000","120000","310000","500000"],jc=["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"}],Kc=[{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"}],Vc=e=>to.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),zc=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...$c,...jc].includes(e))):Object.keys(e[t])).map((r=>({l:Vc(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:zc(e,r,n+1)})))},Wc=(e,t)=>t.map((t=>({l:Vc(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Bc 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}),Ht(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:Wc(Jt,$c)},{l:"Z2",n:"港澳",c:"",p:"",children:Wc(Jt,jc)}]}createProvince(){var e;return(null!==(e=zc(Jt,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Kc.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...$c,...jc].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(q.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(q.Button,{value:"0"},ln("qm.form.citySelectType.0")),t.createElement(q.Button,{value:"1"},ln("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?qc:Kc).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(F,{size:"small",placeholder:ln("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(F.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=ln("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=Jn("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(en.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(ro,{value:m,bordered:s}):t.createElement(tc,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ta,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)}})))}))}}Bc.contextType=Sl;class Uc 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Bc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Uc.contextType=Sl;const Gc=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Gc(e,n)})))};class Yc 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=Gc(Jt,"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=$a(e,t[r]);if(i&&Kn(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 kn(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=pe(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)||`${ln("qm.form.selectPlaceholder").replace("...","")}(${ln("qm.form.regionSelectLabel")[r]})`;return t.createElement(bl.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(bl,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(Gi,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=ln("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=Jn("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(en.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(ro,{value:f,bordered:s}):t.createElement(tc,{action:u?[]:["click"],popupVisible:!u&&n,popup:m,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ta,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&&jn((()=>this.initial()))}})))}))}}Yc.contextType=Sl;class Xc 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Yc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Xc.contextType=Sl;const Qc=e=>{const{$$form:n}=t.useContext(Sl),{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:C}=a,{action:w,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:D}=Ln();return t.createElement(pl,{name:"file",action:w,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(Ve,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||D("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(I?pe(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:C})};class Zc 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Qc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Zc.contextType=Sl;const Jc=e=>{const{$$form:n}=t.useContext(Sl),{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:C,withCredentials:w=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,O="function"==typeof T?T():T||{},{t:k}=Ln();return t.createElement(wd,{name:"file",action:x,multiple:d,headers:E,data:C,withCredentials:w,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?pe(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 ed 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Jc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}ed.contextType=Sl;const td=e=>{const{$$form:n}=t.useContext(Sl),{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(xd,{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 nd 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=Hn}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Bn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(td,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||Ea)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}nd.contextType=Sl;class rd 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=xe(this.resizeObserveHandler,10),this.getFormItems=$t((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=$t((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{oe(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:ln("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Ht(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(){Ji(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){el(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&&Yn("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=>oe(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=>oe(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,Na.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:wa),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=Wn(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),jn((()=>{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 Ka(e);if(oe(e)){const{fieldName:a,label:o,options:s={}}=e;if(qa(o))return Ka(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(Da(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{Da(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)Kn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return kn(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let i=zn(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?pe(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(po,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(mo,{option:e})}INPUT_NUMBER(e){return t.createElement(go,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(yo,{option:e})}SEARCH_HELPER(e){return t.createElement(Co,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(rc,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(ac,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(sc,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(uc,{option:e})}CHECKBOX(e){return t.createElement(so,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(hc,{option:e})}RATE(e){return t.createElement(fc,{option:e})}RADIO(e){return t.createElement(vc,{option:e})}SWITCH(e){return t.createElement(bc,{option:e})}TEXT_AREA(e){return t.createElement(Ec,{option:e})}DATE(e){return t.createElement(wc,{option:e})}RANGE_DATE(e){return t.createElement(Tc,{option:e})}TIME(e){return t.createElement(Rc,{option:e})}RANGE_TIME(e){return t.createElement(kc,{option:e})}SELECT(e){return t.createElement(ao,{option:e})}MULTIPLE_SELECT(e){return t.createElement(ao,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(Ac,{option:e})}DIVIDER(e){return t.createElement(Pc,{option:e})}TREE_SELECT(e){return t.createElement(Fc,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(Fc,{option:e,multiple:!0})}CASCADER(e){return t.createElement(Mc,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(Mc,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(Uc,{option:e})}REGION_SELECT(e){return t.createElement(Xc,{option:e})}UPLOAD_FILE(e){return t.createElement(Zc,{option:e})}UPLOAD_IMG(e){return t.createElement(ed,{option:e})}TINYMCE(e){return t.createElement(nd,{option:e})}renderFormLabel(e){if(qa(e)||!oe(e))return e;const{type:n,fieldName:r,label:i,options:l={},onChange:a=Hn}=e,{itemList:o=[]}=l;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(lo,{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(oo,{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(C,{className:"extra-tooltip",title:a[n]},t.createElement(Qe,{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":Bn(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):null)}createFormItem(e){return ce(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(Yn("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(_,{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(Wn(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(_,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(S,{style:{marginBottom:12}},t.createElement(Xn,{type:"primary",size:this.$size,icon:t.createElement(Ye,null),onClick:()=>this.SUBMIT_FORM()},ln("qm.form.search")),t.createElement(Xn,{size:this.$size,icon:t.createElement(Ze,null),onClick:()=>this.RESET_FORM()},ln("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(Fe,null):t.createElement(He,null)," ",ln(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(D,{gutter:0},t.createElement(_,{key:"-",span:i},t.createElement(P.Item,null,t.createElement(S,{style:{marginBottom:12}},t.createElement(Xn,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},ln("qm.form.save")),t.createElement(Xn,{size:this.$size,onClick:()=>this.RESET_FORM()},ln("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(co,{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)=>kn(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:[ln("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 kn(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 kn(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 kn(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){Yn("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 Yn("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!oe(t))return Yn("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(l.noAuth)return Yn("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||fe(l,n,t[n]));n&&(i?i([...r]):Yn("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:l,labelAlign:a,labelWrap:o,customClass:s}=this.props,c=Jn("form"),d={required:"${label}"+ln("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":Bn(l)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Sl.Provider,{value:this.provide},t.createElement(D,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}rd.contextType=en,rd.propTypes=ka,rd.defaultProps=La;const id={onActivate:jt.func,onAddUndo:jt.func,onBeforeAddUndo:jt.func,onBeforeExecCommand:jt.func,onBeforeGetContent:jt.func,onBeforeRenderUI:jt.func,onBeforeSetContent:jt.func,onBeforePaste:jt.func,onBlur:jt.func,onChange:jt.func,onClearUndos:jt.func,onClick:jt.func,onContextMenu:jt.func,onCommentChange:jt.func,onCopy:jt.func,onCut:jt.func,onDblclick:jt.func,onDeactivate:jt.func,onDirty:jt.func,onDrag:jt.func,onDragDrop:jt.func,onDragEnd:jt.func,onDragGesture:jt.func,onDragOver:jt.func,onDrop:jt.func,onExecCommand:jt.func,onFocus:jt.func,onFocusIn:jt.func,onFocusOut:jt.func,onGetContent:jt.func,onHide:jt.func,onInit:jt.func,onKeyDown:jt.func,onKeyPress:jt.func,onKeyUp:jt.func,onLoadContent:jt.func,onMouseDown:jt.func,onMouseEnter:jt.func,onMouseLeave:jt.func,onMouseMove:jt.func,onMouseOut:jt.func,onMouseOver:jt.func,onMouseUp:jt.func,onNodeChange:jt.func,onObjectResizeStart:jt.func,onObjectResized:jt.func,onObjectSelected:jt.func,onPaste:jt.func,onPostProcess:jt.func,onPostRender:jt.func,onPreProcess:jt.func,onProgressState:jt.func,onRedo:jt.func,onRemove:jt.func,onReset:jt.func,onSaveContent:jt.func,onSelectionChange:jt.func,onSetAttrib:jt.func,onSetContent:jt.func,onShow:jt.func,onSubmit:jt.func,onUndo:jt.func,onVisualAid:jt.func,onSkinLoadError:jt.func,onThemeLoadError:jt.func,onModelLoadError:jt.func,onPluginLoadError:jt.func,onIconsLoadError:jt.func,onLanguageLoadError:jt.func},ld=Object.assign({apiKey:jt.string,id:jt.string,inline:jt.bool,init:jt.object,initialValue:jt.string,onEditorChange:jt.func,value:jt.string,tagName:jt.string,cloudChannel:jt.string,plugins:jt.oneOfType([jt.string,jt.array]),toolbar:jt.oneOfType([jt.string,jt.array]),disabled:jt.bool,textareaName:jt.string,tinymceScriptSrc:jt.string,rollback:jt.oneOfType([jt.number,jt.oneOf([!1])]),scriptLoading:jt.shape({async:jt.bool,defer:jt.bool,delay:jt.number})},id),ad=e=>"function"==typeof e,od=e=>e in id,sd=e=>e.substr(2),cd=(e,t,n,r,i)=>((e,t,n,r,i,l,a)=>{const o=Object.keys(i).filter(od),s=Object.keys(l).filter(od),c=o.filter((e=>void 0===l[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=sd(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const i=r(e,n),l=sd(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 dd=0;const ud=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return dd++,e+"_"+n+dd+String(t)},pd=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),hd=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),md=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},fd=()=>({listeners:[],scriptId:ud("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),gd=(()=>{let e=fd();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=fd()}}})(),vd=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class yd 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=vd(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,hd(o).concat(hd(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&&!pd(i)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&ad(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;md(this.editor,i?"readonly":"design"),this.props.init&&ad(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(i.style.visibility=""),pd(i)&&(i.value=this.getInitialValue()),l.init(a)},this.id=this.props.id||ud("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;md(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,i,l;null!==vd(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&gd.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=vd(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){cd(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 bd;yd.propTypes=ld,yd.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(bd||(bd={}));const xd=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(en),{$size:m}=Pn(e),{$locale:f,t:g}=Ln(),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:bd[f],skin:"tinymce-5"},zn(l,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>new Promise(((t,n)=>kn(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?pe(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)}))}}),C=Jn("tinymce"),w={[C]:!0,[`${C}--lg`]:"large"===m,[`${C}--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(w,r),style:i},t.createElement(yd,S))};xd.displayName="QmTinymce";const Ed=t.forwardRef(((e,n)=>{const r=an({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=Rn(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 Kt(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)},C=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},w=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)},D=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},_=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},F=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},H=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},M=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:C,rotate:w,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:D,setCropBoxData:_,getCroppedCanvas:F,setAspectRatio:H,setDragMode:M})));const $={[Jn("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)}))}));Ed.displayName="Cropper";const Cd=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:i,quality:l,beforeCrop:a,className:o}=e,{t:s}=Ln(),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=Jn("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=Rn(r,["beforeUpload"]);return d.current=i,t.createElement(n.type,Object.assign(Object.assign({},l),{beforeUpload:(e,t)=>new Promise(((n,r)=>kn(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:()=>{kn(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=>kn(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 Yn("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,l),yield $n(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(Ed,{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(Je,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(et,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(tt,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(nt,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},wd=e=>{const n=an({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}=Ln(),{$size:b}=Pn(n),x=t.useRef(null),E=t.useRef(null),C=t.useRef(!1),[w,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",D),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",D)})),[]),Li((()=>{k||(C.current=!1)}),[r]);const L=An((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=_t.create(ji(x.current,Jn("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)=>kn(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)})))),D=An((e=>kn(void 0,void 0,void 0,(function*(){const{action:t,data:i,headers:l}=n;if(C.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){}}})))),_=Jn("upload-img"),F={[_]:!0,[`${_}--lg`]:"large"===b,[`${_}--sm`]:"small"===b},H=t.createElement(I,Cn({className:_e(F,h)},zn(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(Xe,{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(rt,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:()=>{C.current=!0},onBlur:()=>{C.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,i?t.createElement(Cd,{className:m,fixedSize:l,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},H):H,t.createElement("div",{style:{display:"none"}},t.createElement(U.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:w,current:N,rootClassName:m,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(U,{key:e.uid||n,src:e.url,alt:""}))))))};wd.displayName="QmUploadImg";const Sd=(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=Sd(l.children,t,n);e&&(r=e)}}return r},Nd=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Nd(e.children,t),t(e)||e.children&&e.children.length))),Td=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Td(e.children,t)),t(e)&&n.push(e)})),n},Id=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=Id(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Rd=(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:Rd(e.children,t,n,r)}):e)),Od=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Od(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},kd=(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=kd(e[r].children,t,n);if(i)return[e[r][n],i].flat()}}},Ld=(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(...Ld(e,t)))),r},Ad=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:C=!0,onSelectChange:w,onCheckChange:S,onDragStart:N,onDragChange:T,onExpand:I}=e,{$size:R}=Pn(e),{t:k}=Ln(),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),D=t.useRef(null),_=tl(P),[F,H]=t.useState(v),[M,$]=t.useState(!1),j=nl((()=>{H(P.current.offsetHeight-ee.current.offsetHeight-10)}),5);sn((()=>{v||j()}),[_.height]);const[q,K]=t.useState([]),[V,z]=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)),z({}))}),[s]),t.useEffect((()=>{var e;oe(),d&&(null===(e=D.current)||void 0===e||e.focus())}),[]),Li((()=>{oe()}),[null==c?void 0:c.params]),Li((()=>{Y(ae())}),[V]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=Id(q,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],re([...q]))},REMOVE_RECORD:e=>{var t;const n=Sd(q,e,L);if(void 0===n&&q.find((t=>t[L]===e)))re(q.filter((t=>t[L]!==e)));else{const r=Id(q,(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([...q]))}},UPDATE_RECORD:(e,t)=>{const n=Id(q,(t=>e===t[L]));n&&(ye(n,t),re([...q]))}})));const re=e=>{K(e),te.current=e,ne.current=Od(e,L)},ie=e=>{if(a)return y;const t=Td(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},le=e=>{var t;return(null===(t=kd(q,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=$a(q,t);if(n){const r=le(t),i=Ld(n,L);e.push(...r,...[t,...i].filter((e=>ne.current.includes(e))))}}}else e.push(...le(t))})),[...new Set([...b,...e])]},oe=()=>kn(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=pe(a.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,re(t),B(ie(t)),z({}),null==l||l(t)}}catch(e){}$(!1)})),se=e=>`${e}|${to.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ce=Jn("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:D,value:X,size:R,placeholder:m||k("qm.form.inputPlaceholder"),suffix:t.createElement(Ye,null),allowClear:!0,onChange:e=>(e=>{if(!l)return;const t=Nd(te.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==se(n).indexOf(e)}));Q(e),K(t),Y(x||e?Od(t,L):ae())})(e.target.value)}),C&&t.createElement("a",{className:"trigger",onClick:()=>{J(!Z),Y(Z?[]:ne.current)}},Z?t.createElement(Fe,null):t.createElement(He,null)," ",k(Z?"qm.form.collect":"qm.form.spread"))),t.createElement(Yi,{spinning:M},t.createElement(G,{fieldNames:{title:A,key:L,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:F,disabled:e.disabled,checkStrictly:p,selectedKeys:null!=g?g:W,checkedKeys:null!=g?g:W,expandedKeys:U,treeData:q,loadData:u?({key:e,children:t})=>kn(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=pe(t.data,l))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const i=Rd(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=[...q];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,q)},onExpand:(e,t)=>{Kn(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=Td(te.current,(t=>e.includes(pe(t,L))));null==w||w(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(Sd(q,e,L))))));const t=Td(te.current,(t=>e.includes(pe(t,L))));null==S||S(a?t:t[0])}})))}));Ad.displayName="QmSearchTree";const Pd=n(void 0),Dd={dataIndex:qt.string.isRequired,title:qt.string.isRequired,description:qt.string,colSpan:qt.number,width:qt.number,minWidth:qt.number,fixed:qt.oneOf(["left","right"]),align:qt.oneOf(["left","center","right"]),theadAlign:qt.oneOf(["left","center","right"]),printFixed:qt.bool,hidden:qt.bool,noAuth:qt.bool,noFixed:qt.bool,ellipsis:qt.bool,className:qt.string,theadClassName:qt.string,children:qt.array,sorter:qt.oneOfType([qt.bool,qt.func]),filter:qt.shape({type:qt.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:qt.arrayOf(qt.shape({text:qt.string,value:qt.oneOfType([qt.string,qt.number])})),style:qt.object}),precision:qt.number,displayPrecision:qt.number,formatType:qt.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:qt.bool,canCopy:qt.bool,editRender:qt.func,dictItems:qt.arrayOf(qt.shape({text:qt.string,value:qt.oneOfType([qt.string,qt.number])})),summation:qt.shape({sumBySelection:qt.bool,displayWhenNotSelect:qt.bool,dataKey:qt.string,unit:qt.string,render:qt.func}),groupSummary:qt.shape({dataKey:qt.string,unit:qt.string,render:qt.func}),shouldCellUpdate:qt.func,headRender:qt.func,render:qt.func};qt.arrayOf(qt.shape(Dd)).isRequired,qt.func,qt.array,qt.oneOfType([qt.string,qt.func]).isRequired,qt.number,qt.bool,qt.bool,qt.shape({api:qt.func.isRequired,params:qt.object.isRequired,formatter:qt.func,beforeFetch:qt.func,afterFetch:qt.func,stopToFirst:qt.bool,dataKey:qt.string,callback:qt.func}),qt.bool,qt.bool,qt.string,qt.string,qt.object,qt.bool,qt.bool,qt.bool,qt.oneOfType([qt.object,qt.func]),qt.oneOfType([qt.object,qt.func]),qt.array,qt.func,qt.bool,qt.object,qt.object,qt.shape({type:qt.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:qt.array,selectedRowKeys:qt.array,hideSelectAll:qt.bool,checkStrictly:qt.bool,filterable:qt.bool,selectByClickRow:qt.bool,selectFirstRowOnChange:qt.bool,clearableAfterFetched:qt.bool,selectAllOnCurrentPage:qt.bool,fetchSelectedRows:qt.shape({api:qt.func.isRequired,params:qt.object,dataKey:qt.string}),fetchAllRowKeys:qt.shape({api:qt.func.isRequired,params:qt.object,dataKey:qt.string}),disabled:qt.func,onChange:qt.func,onSelect:qt.func,onSelectAll:qt.func}),qt.shape({currentRowKey:qt.oneOfType([qt.number,qt.string]),disabled:qt.func,onChange:qt.func}),qt.shape({virtual:qt.bool,doubleXScrollbar:qt.bool}),qt.shape({expandIconColumn:qt.string}),qt.shape({defaultExpandAllRows:qt.bool,defaultExpandedRowKeys:qt.array,expandedRowKeys:qt.array,hideExpandAll:qt.bool,rowExpandable:qt.func,expandedRowClassName:qt.string,expandedRowRender:qt.func,onExpand:qt.func,onChange:qt.func}),qt.shape({cellMerge:qt.bool,onCellMerge:qt.func,onSelectChange:qt.func}),qt.shape({groupItems:qt.arrayOf(qt.shape({dataIndex:qt.string.isRequired,titleIndex:qt.string,color:qt.string,backgroundColor:qt.string})),fetch:qt.shape({api:qt.func.isRequired,params:qt.object,dataKey:qt.string}),onChange:qt.func}),qt.func,qt.bool,qt.bool,qt.bool,qt.bool,qt.shape({current:qt.number,pageSize:qt.number,pageSizeOptions:qt.array,showSizeChanger:qt.bool,showQuickJumper:qt.bool}),qt.shape({fileName:qt.string,fetch:qt.shape({api:qt.func.isRequired,params:qt.object}),beforeExport:qt.func,cellStyle:qt.bool,hideIcon:qt.bool}),qt.shape({showLogo:qt.bool}),qt.shape({fetch:qt.shape({api:qt.func.isRequired,params:qt.object,dataKey:qt.string}),fieldList:qt.arrayOf(qt.object)}),qt.shape({position:qt.oneOf(["top","bottom"]),hideAlert:qt.bool,hideClearButton:qt.bool}),qt.oneOf(["left","right"]),qt.func,qt.func,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.bool,qt.func,qt.func,qt.func,qt.func,qt.func,qt.func,qt.func,qt.func,qt.func;const _d={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},Fd=10,Hd="1",Md="0",$d="YYYY-MM-DD",jd="YYYY-MM-DD HH:mm:ss",qd="YYYYMMDDHHmmss",Kd={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 Vd;!function(e){e.left="flex-start",e.right="flex-end"}(Vd||(Vd={}));const zd=Object.assign({},e).useId;let Wd=0;var Bd=zd?function(e){const t=zd();return e||t}:function(t){const[n]=e.useState(`qm_unique_${Wd}`);return e.useEffect((()=>{Wd+=1}),[]),t||n};let Ud=[];const Gd={_getInstance:function(e){var t;return null!==(t=Ud.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=Ud[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==Ud.findIndex((e=>e===t))&&(this.deregister(e),Ud=[t,...Ud])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),Ud=[{id:e,vm:t},...Ud])},deregister:function(e){e&&(Ud=Ud.filter((t=>t.id!==e)))}};class Yd{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 Xd={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 Qd(e){return void 0!==e}function Zd(t,n){const{defaultValue:r,value:i,onChange:l,postState:a}=n||{},[o,s]=e.useState((()=>Qd(i)?i:Qd(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=Qd(i)?i:o,d=a?a(c):c,u=An(l),[p,h]=e.useState([c]);sn((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),sn((()=>{Qd(i)||s(i)}),[i]);return[d,An((e=>{s(e),h([c])}))]}const Jd=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=Jd(t.children)),t})),eu=(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:C,tableFlatData:w,selectionKeys:S,sorter:N,filters:T,superFilters:I,pagination:R,mergedTdCells:O}=n,{selectionRows:k,summaries:L}=x.current,{expandIconColumn:A=""}=c||{},{t:P}=Ln(),D=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]})(Jd(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Xd.selectionColumn,title:"radio"===t?P("qm.table.config.selectionText"):"",width:Xd.selectionColumnWidth,fixed:"left",type:t}})(a),r=(null==(i=s)?void 0:i.expandedRowRender)?{dataIndex:Xd.expandableColumn,title:"",width:Xd.selectionColumnWidth,fixed:"left",type:"expand"}:null;var i;return n&&t.unshift(n),r&&t.unshift(r),jl(t)},_=(e,t,n,r,i)=>{const l=`${t},${n}`;e.has(l)||e.set(l,{row:t,col:n,rowSpan:r,colSpan:i})},F=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),H=t.useMemo((()=>!F&&!!d),[F,d]),M=t.useMemo((()=>F&&!!u),[F,u]),$=t.useMemo((()=>(F||H)&&!M),[F,H,M]),j=t.useMemo((()=>D(i)),[i]),q=t.useMemo((()=>$l(j)),[j]),K=t.useMemo((()=>q.filter((e=>"function"==typeof e.editRender))),[q]),V=t.useMemo((()=>q.filter((e=>!!e.summation))),[q]),z=t.useMemo((()=>q.filter((e=>"left"===e.fixed))),[q]),W=t.useMemo((()=>q.filter((e=>"right"===e.fixed))),[q]),B=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=w.findIndex((t=>E(t,t.index)===e.rowKey)),r=q.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){_(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||_(t,n+i,r+l,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(O)),[O,q,C]),U=t.useMemo((()=>{var e,t;const n=q.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,Xd.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:""}),[q,A]),G=t.useMemo((()=>V.length>0),[V]),Y=t.useMemo((()=>!!b||G),[b,G]),X=t.useMemo((()=>Yl(j).length>1),[j]),Q=t.useMemo((()=>l||X),[l,X]),Z=t.useMemo((()=>q.some((e=>e.sorter))),[q]),J=t.useMemo((()=>q.some((e=>e.filter))),[q]),ee=t.useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),te=t.useMemo((()=>!F&&!!f),[F,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((()=>!F&&!!h&&J),[F,h,J]),ae=t.useMemo((()=>!F&&!!y),[F,y]),oe=t.useMemo((()=>!!m&&q.some((e=>!!e.groupSummary))),[q]),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((()=>!w.length),[w]),de=t.useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:i,summation:l}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=l,c=se?pa(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[Xd.summaryIgnore])return e;const r=ta(t,n);return ia(r)?e.plus(r):e}),new Vt(0));!Object.keys(L).includes(n)||a&&!d||(u=new Vt(ta(L,n))),na(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=aa(p,i)),p=la(p),na(e,`${n}_text`,s?`${p} ${s}`:p)})),[e]})()),[w,S,L]),ue=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),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?{[Xd.sorterFieldName]:t}:null,l=n.length?{[Xd.filterFieldName]:n}:null,a=ue?{[Xd.groupSummary.summaryFieldName]:ue,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[Xd.currentPageName]:R.current,[Xd.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:F,isWebPagination:H,isScrollPagination:M,showPagination:$,tableColumns:j,flattenColumns:q,editableColumns:K,summationColumns:V,leftFixedColumns:z,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}},tu=(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:C,tableElementRef:w,tableBodyRef:S,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:A,superFilters:P,fetchParams:D,selectionKeys:_,rowExpandedKeys:F,highlightKey:H,summationColumns:M,isFetch:$,isWebPagination:j,isScrollPagination:q,isServiceSummation:K,isGroupSubtotal:V,doLayout:z,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:ue,setPermission:he,setRecordsMap:me,resetTableScroll:fe,clearElementStore:ge,clearRecordsMap:ve}=n,{t:ye}=Ln(),{store:be}=C.current,xe=t.useRef(Object.assign({},D)),Ce=t.useRef(new Map),we=t.useRef(!1),Se=tl(w);sn((()=>{ke(),z()}),[T]),sn((()=>{Ne()}),[Se,N,i,k.tableAutoHeight]),Li((()=>{ct(),dt(),ut(),$||(j&&et(),Ge(l)),s&&ee(s),c&&te(c)}),[l,null==o?void 0:o.params]),Li((()=>{const e=Ve(D,xe.current);e||$&&(null==d?void 0:d.clearableAfterFetched)&&pt(),!e&&D[Xd.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?et():$&&Be(),xe.current=D}),[D]),Li((()=>{j&<(),q||fe(),je()}),[O.current,O.pageSize]),Li((()=>{$||Ie(R.length),z()}),[R]),Li((()=>{C.current.isTreeTable&&(tt(),lt())}),[F]);const Ne=()=>{const{scrollBarRef:e,resizeState:t}=C.current,{width:n,height:r}=Se;z(),k.tableBodyWidth>n&&Q(!0),e.current.scrollLeft>0&&Z(!0),de(Object.assign({},t,{width:n,height:r}))},Te=()=>{H&&S.current.setClickedValues([H,""]),"radio"===(null==d?void 0:d.type)&&_.length&&S.current.setClickedValues([_[0],""])},Ie=e=>{e!==O.total&&X((t=>Object.assign({},t,{total:e})))},Re=e=>{we.current=e},Oe=nl((e=>{Qe(),null==b||b(e)})),ke=()=>{oe(I.length>Xd.virtualScrollX)},Le=(e=[])=>{let t=e.length>Xd.virtualScrollY;C.current.isTreeTable&&(t=!0),(null==p?void 0:p.virtual)&&(t=!0),se(t)},Ae=e=>V?Pe(De(e,0)):e,Pe=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Pe(e.children)),delete e.children,t.push(e)})),t},De=(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 ma(e,[i.dataIndex]).map((e=>{const n={children:De(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&na(n,r.toString(),ca()),i.titleIndex&&na(n,i.titleIndex,ta(e[0],i.titleIndex)),na(n,i.dataIndex,ta(e[0],i.dataIndex)),M.forEach((e=>{var t;const{dataIndex:r}=e,i=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[Xd.summaryIgnore])return e;const n=Number(ta(t,r));return Number.isNaN(n)?e:e+n}),0);na(n,r,i)})),n}))},_e=e=>{re(e),ae((e=>{const{selectionRows:t,recordsMap:n}=C.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))},Fe=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:_;let i=[];return C.current.isTreeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:l}=C.current,a=Ul(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=ga(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ul(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,flattenRowKeys:r,deriveRowKeys:i,recordsMap:l}=C.current,{defaultExpandAllRows:a,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:F;if(t){s&&Yn("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[..._];H&&e.unshift(H),e.forEach((e=>{const t=ga(i,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)}))}return c=a?n.slice(0):[...new Set(c)],t&&(c=c.filter((e=>!r.includes(e)))),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},$e=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...$e(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...$e(e,n[n.length-1])),n},je=nl((()=>{null==g||g(O,Ke(L),qe(A),P,{currentDataSource:it()})})),qe=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Ke=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},Ve=(e,t)=>{const n=Object.keys(ea(e,t));return 1===n.length&&(n.includes(Xd.currentPageName)||n.includes(Xd.pageSizeName))},ze=()=>kn(void 0,void 0,void 0,(function*(){var t;if(!h)return;let n=zn(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?pe(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=Kl(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=Vl(C.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)}})),We=()=>kn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:i=Mn,afterFetch:l,callback:s}=o;if(!i(D))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(D)),a.fetch.api(r(D))]):[yield o.api(r(D))];if(C.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:Xd.dataKey;let a=null!==(n=pe(e.data,r))&&void 0!==n?n:[];a="function"==typeof l?yield l(a):a;const c=pe(e.data,r.replace(/[^.]+$/,Xd.totalKey))||a.length||0,d=Math.max(Math.ceil(c/O.pageSize),1);if(D[Xd.currentPageName]>d)return Ze(Object.assign(Object.assign({},O),{current:d}));Ge(we.current?C.current.tableFullData.concat(a):a),Ie(c),Ye((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),Re(!1)})),Be=nl(We),Ue=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Ue(e.children)),e.index=t,m||(e.pageIndex=(e=>{const{current:t,pageSize:n}=O;return!$||q?e:(t-1)*n+e})(t)),e))),Ge=e=>{const t=Ae(Ue(e));at(t),ot(t),_e(Fe()),ie(He()),Xe(),null==y||y(t)},Ye=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:Xd.summationKey,l=null!==(r=i?pe(e,i):e)&&void 0!==r?r:{},o={};M.filter((e=>!!e.summation.dataKey)).forEach((e=>{na(o,e.dataIndex,Number(ta(l,e.summation.dataKey)))})),ue(o)},Xe=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=it();if(e.length){const t=E(e[0],e[0].index);_e([t])}else _e([])}},Qe=()=>{if(!q)return;const e=Je();we.current||O.current>=e||(Re(!0),Ze(Object.assign(Object.assign({},O),{current:O.current+1})))},Ze=({current:e,pageSize:t})=>{X((n=>Object.assign({},n,{current:e,pageSize:t})))},Je=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},et=()=>{Ze(Object.assign({},O,{current:1}))},tt=()=>{const{isTreeTable:e,deriveRowKeys:t}=C.current;if(!e)return;const n=nt(t,(()=>{const{allTableData:e,allRowKeys:t}=C.current,{rowExpandable:n}=u||{},r=[];return"function"==typeof n&&e.forEach(((e,i)=>!n(e)&&r.push(t[i]))),r.length?F.filter((e=>!r.includes(e))):F})());Ce.current.clear(),n.forEach(((e,t)=>Ce.current.set(e,t)))},nt=(e,t)=>{const n=[];return e.forEach((e=>{if(e.children&&n.push(...nt(e.children,t)),void 0===e.parentRowKey)n.push(e.rowKey);else if(t.includes(e.parentRowKey)){e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1))&&n.push(e.rowKey)}})),n},rt=()=>{const{current:e,pageSize:t}=O;return C.current.tableFullData.slice((e-1)*t,e*t)},it=()=>j?rt():C.current.tableFullData,lt=()=>{const{allTableData:e,isTreeTable:t}=C.current,n=j?Gl(rt()):e,r=t?(e=>{const{recordsMap:t}=C.current,n=[];for(let r=0,i=e.length;r<i;r++){const i=E(e[r],e[r].index);Ce.current.has(i)&&n.push(t.get(i))}return n})(n):n;Le(r),U(r)},at=e=>{W(e),G(e),Y(e),st(),tt(),lt()},ot=e=>{B(e)},st=()=>{ve(),C.current.allTableData.forEach((e=>me(E(e,e.index),e)))},ct=()=>{ee({})},dt=()=>{te({})},ut=()=>{ne([])},pt=()=>{_e([])};return{initialTable:()=>{ze(),Te(),ke(),Le(),$?We():Ge(l)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Yn("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:at,getTableData:We,createTableList:it,createTableData:Ge,createGroupData:Ae,createSelectionKeys:Fe,createRowExpandedKeys:He,setSelectionKeysEffect:_e,findParentRowKeys:$e,getAllChildRowKeys:Me,doFieldValidate:(e,t,n,r,i)=>{if(!Array.isArray(e))return Yn("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(be.removeFromRequired({x:n,y:r}),be.removeFromValidate({x:n,y:r}),e.forEach((e=>{var l;e.required&&Kn(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=Ee(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=>![...Ee(r,n),...Ee(r,i)].includes(e))),removed:i.filter((e=>!l.includes(e)))}},dataChange:()=>{null==v||v(C.current.tableFullData)},tableChange:je,toLastPage:()=>{const e=Je();O.current!==e&&Ze(Object.assign({},O,{current:e}))},toFirstPage:et,getPageCount:Je,pagerChangeHandle:Ze,scrollBottomDebouncer:Oe,clearTableSorter:ct,clearTableFilter:dt,clearSuperFilters:ut,clearRowSelection:pt,clearRowHighlight:()=>{le("")},clearTableLog:()=>{be.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;ge(),be.destroy(),e.deregister(t)}}},nu=(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:C,isFullScreen:w,setLayout:S,setElementStore:N,setShouldToTop:T}=n,I=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,n={};return i&&Object.assign(n,{minHeight:`${Jl(i)}px`}),l&&Object.assign(n,{maxHeight:`${Jl(l)}px`}),w?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${Jl(r)}px`:`${t}px`}):n}),[r,l,i,w,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]):oe(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=Vl(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=Vl(f,e);e=t?Wl(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-(C?bo["small"!==m?"middle":m]+Fd:0)-Fd;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}=Xd,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)})(),jn((()=>(()=>{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(w){const t=e.$toper?e.$toper.offsetHeight+Fd:0,r=e.$pager?e.$pager.offsetHeight+Fd:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:i,footerHeight:l,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function ru({handler:t,delay:n=0}){const r=ml(t,n),i=An(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",i),()=>window.removeEventListener("resize",i))),[i])}const iu=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(Pd),{infoBarConfig:h,rowSelection:m,rowHighlight:f}=r.current.props,{allTableData:g,invalidRowKeys:v}=r.current,{hideAlert:y,hideClearButton:b}=h||{},{t:x}=Ln(),E=t.useMemo((()=>!y),[y]),C=t.useMemo((()=>!b&&!!(a||o||m||f)),[b,a,o,m,f]),w={[`${i}__alert`]:!0};return E?t.createElement("div",{className:_e(w)},t.createElement("i",{className:"svgicon icon"},t.createElement(it,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)})}`:""),C&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),jn((()=>s()))}},x("qm.table.alert.clear"))):null},lu=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{prefixCls:l,setFullScreen:a}=t.useContext(Pd),{t:o}=Ln(),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(We,null):t.createElement(Be,null))):null}));lu.displayName="FullScreen";const au=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,getTableData:l}=t.useContext(Pd),{t:a}=Ln(),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(Ze,null))):null}));au.displayName="Reload";const ou=()=>{const e={dateFormat:e=>{const t=e?h(e).format($d):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?h(e).format(jd):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?h(e).format(jd.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>ia(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>la(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=ia(m)?new Vt(m).toFixed(c):m),d>=0&&""!==m&&(m=aa(m,d)),u){const t=e[`${qn(u)}Format`];t?m=t(m):Yn("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>_n(e)?da(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,l)=>{const a=ta(e,r.dataIndex),o=r.render?r.render(a,e,r,i,l):t(a,r,e);return n(o)}}},su=t.forwardRef(((e,n)=>{var r,i,l,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(en),{tableRef:d,prefixCls:u,flattenColumns:p,summationRows:h,showSummary:m,getSpan:f}=t.useContext(Pd),{tablePrint:g,showHeader:v}=d.current.props,{t:y}=Ln(),{getTitleFromCellValue:b}=ou(),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:"",C=!(!x&&!E),w=t.useMemo((()=>Wn(Bl(o,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn]))),[o]),S=t.useMemo((()=>Wn(Bl(p,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn]))),[p]),N=t.useMemo((()=>Wn(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},fa(w,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?T(t):t},I=(e,t)=>Ce(we(Se(e),t),Ne(((...e)=>Te(...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(Yl(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||l.minWidth||Xd.defaultColumnWidth,r<=Xd.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=Xd.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,minWidth:t,renderWidth:n})=>`<col style="width:${e||n||t||Xd.defaultColumnWidth}px">`)).join("")}</colgroup>`,v&&(i+=["<thead>",r&&C?`<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}">${ua(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${Gl(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}">${r<=0?`<span style="padding-left:${e._level*Xd.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):ta(e,`${i}_text`);return`<td>${0===r&&""===a?y("qm.table.config.summaryText"):_n(a)?da(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});sl(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(lt,null))):null}));su.displayName="TablePrint";const cu="606060",du="thin",uu="d4d4d4",pu=(e,t)=>{t&&(e.height=Math.floor(.75*t))},hu=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},mu=()=>({top:{style:du,color:{argb:uu}},left:{style:du,color:{argb:uu}},bottom:{style:du,color:{argb:uu}},right:{style:du,color:{argb:uu}}}),fu=e=>{const{children:t}=e;return t&&t.length?fu(t[0]):e},gu=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},vu=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:i}=t.useContext(Pd),{spanMethod:l,showHeader:a}=e.current.props,{t:o}=Ln(),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)=>kn(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:p}=t,{rowHeight:h}=e.current,m=$l(u),f=Yl(u),g=[],v=[],y=[],b=[];let x=0;const E={};m.forEach((e=>{const{dataIndex:t,width:n,minWidth:r,renderWidth:i}=e;E[t]=ua(e.title),y.push({key:t,width:(n||i||r||Xd.defaultColumnWidth)/8})})),a&&(i?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,l=fu(e),a=m.findIndex((({dataIndex:e})=>e===l.dataIndex));n[l.dataIndex]=ua(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 C=Gl(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?ta(e,i.dataIndex):d(e,t,i,a)})),r._level=e._level,r}));x+=C.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):ta(e,i);n[i]=0===r&&""===a?o("qm.table.config.summaryText"):_n(a)?da(a).join(""):a})),v.push(n)}));const{sheetName:w,useStyle:S}=t,N=new Zt.Workbook,T=N.addWorksheet(w);T.columns=y,a&&T.addRows(g).forEach((e=>{S&&pu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Vl(u,t.key),{align:r,theadAlign:i}=n;hu(e,i||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:cu}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:mu()})}))})),T.addRows(C).forEach(((e,t)=>{const{_level:n}=C[t];S&&pu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),r=Vl(u,t.key),{align:i}=r;hu(e,i),Object.assign(e,gu(r)),S&&Object.assign(e,{font:{color:{argb:cu}},border:mu()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),r&&p&&T.addRows(v).forEach((e=>{S&&pu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Vl(u,t.key),{align:r}=n;hu(e,r),Object.assign(e,gu(n)),S&&Object.assign(e,{font:{color:{argb:cu}},border:mu()})}))})),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=$l(n),l=new FileReader;l.onerror=()=>{R.error(o("qm.table.import.error"))},l.onload=e=>{const n=i.map((e=>ua(e.title))),r=new Zt.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("")),oe(i)&&"text"in i&&(i=i.text),Ie(i)&&(i=sa(i,jd)),(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])),na(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)}}},yu=e=>{const{fileType:n,onChange:r}=e,{prefixCls:i}=t.useContext(Pd),{t:l}=Ln();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=()=>kn(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(Xn,{onClick:()=>c()},l("qm.upload.text"))},bu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,prefixCls:l,createTableData:a,dataChange:o}=t.useContext(Pd),{beforeTableImport:s}=i.current.props,{t:c}=Ln(),{importXLSX:d}=vu(),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState(!0),g=e=>e.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.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(yu,{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(rd,{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(Xn,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(Xn,{type:"primary",loading:p,disabled:m,onClick:()=>kn(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=>kn(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"))))},xu=t.forwardRef(((e,n)=>{const{tableColumns:r,open:i=!0}=e,{prefixCls:l}=t.useContext(Pd),{t:a}=Ln(),[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(at,null))),t.createElement(wl,u,t.createElement(bu,{columns:r,onClose:()=>s(!1)})))}));xu.displayName="TableImport";const Eu=e=>{const{columns:n,onChange:r}=e,{prefixCls:i,$size:l}=t.useContext(Pd),{t:a}=Ln(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);Li((()=>{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(tc,{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(Xt,{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));me(t,n)||u(ba(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(H,{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(Ge,null)),t.createElement("span",{className:"text"},ua(e.title)))})(e,"main")))))),popupClassName:_e(m),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Kd,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(ot,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},Cu=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:l,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(Pd),{rowSelection:d}=l.current.props,{t:u}=Ln(),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:Wn(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(Eu,{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(rd,{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(Xn,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(Xn,{type:"primary",loading:m,onClick:()=>kn(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 $n(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},wu=t.forwardRef(((e,n)=>{var r;const{tableColumns:i,open:l=!0}=e,{global:a}=t.useContext(en),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:p,isGroupSubtotal:m,showSummary:f,getSpan:g}=t.useContext(Pd),{exportExcel:v,fetch:y,showHeader:b}=o.current.props,{t:x}=Ln(),{getTitleFromCellValue:E}=ou(),[C,w]=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((()=>Bl(i,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn])),[i]),k=t.useMemo((()=>Bl(c,[Xd.expandableColumn,Xd.selectionColumn,Xd.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&&na(i,t,ta(i,t))})),i})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(m?pa(t):t).reduce(((e,t)=>{if(null==t?void 0:t[Xd.summaryIgnore])return e;const n=Number(ta(t,r));return Number.isNaN(n)?e:e+n}),0);na(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:D,exportCSV:_}=vu(),F=e=>kn(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)),{[Xd.currentPageName]:1,[Xd.pageSizeName]:null!=e?e:d.total}));if(200===o.code){let e=Array.isArray(o.data)?o.data:null!==(t=pe(o.data,l))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,a=L(e)}}catch(e){}return N(!1),a})),H=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){}},M=(e,t)=>{const{columns:n,footSummation:r}=e,i=Yl(n),l=$l(n);let a='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${l.map((({width:e,minWidth:t,renderWidth:n})=>`<col style="width:${e||n||t||Xd.defaultColumnWidth}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}">${ua(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(a+=`<tbody>${Gl(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):ta(e,i);return`<td>${0===r&&""===a?x("qm.table.config.summaryText"):_n(a)?da(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`,j=$.slice($.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(I)return R.warning(x("qm.table.export.warnText"));var e;T?(e=$,kn(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,[Xd.currentPageName]:void 0,[Xd.pageSizeName]:void 0}));r.data&&(sl(r.data,e),H(e))}catch(e){}N(!1)}))):w(!0)};t.useImperativeHandle(n,(()=>({clickHandle:q})));const K={[`${s}-export`]:!0},V={visible:C,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>w(!1)},z={fileName:$.slice(0,$.lastIndexOf(".")),fileType:j,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:()=>q()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ve,null))),t.createElement(wl,V,t.createElement(Cu,{defaultValue:z,onClose:()=>w(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:jl(e.columns)}),kn(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 F()),"custom"===r&&(c=yield F(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 D(t,c,A,P);sl(n,`${e}.xlsx`),H(`${e}.xlsx`)}if("csv"===n){const n=_(t,M(t,c));sl(n,`${e}.csv`),H(`${e}.csv`)}}))}})))}));wu.displayName="TableExport";const Su=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:l,prefixCls:a,dataChange:o}=t.useContext(Pd),{beforeClipboard:s}=i.current.props,{t:c}=Ln(),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:ua(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(rd,{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(Xn,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(Xn,{type:"primary",loading:h,onClick:()=>kn(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&&(na(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"))))},Nu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,flattenColumns:l}=t.useContext(Pd),{t:a}=Ln(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.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(st,null))),t.createElement(wl,p,t.createElement(Su,{columns:c,onClose:()=>s(!1)})))}));Nu.displayName="TableClipboard";const Tu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:l,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext(Pd),{rowKey:s,rowSelection:c}=i.current.props,{t:d}=Ln(),u=t.useRef(null),p=tl(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=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.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=nl((()=>{const e=u.current;y(e.offsetHeight-2*bo[l]-30)}),5);return sn((()=>{b()}),[p.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(Mp,{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(Xn,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},Iu=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(Pd),{rowSelection:h}=l.current.props,{t:m}=Ln(),[f,g]=t.useState(!1),v=t.useRef(!1);Li((()=>{!v.current&&y()}),[d]);const y=()=>kn(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=pe(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(ct,null))),t.createElement(wl,x,t.createElement(Tu,{columns:r,onClose:()=>g(!1)})))}));Iu.displayName="SelectCollection";const Ru=e=>{const{onClose:n}=e,{global:r}=t.useContext(en),{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(Pd),{uniqueKey:g}=i.current.props,{t:v}=Ln(),y=t.useRef(null),b=t.useRef(null),x=t.useRef([]),E=t.useRef(""),C=t.useRef(-1),w=t.useRef("stop");Li((()=>{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:ua(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:null!==(t=e.dictItems)&&void 0!==t?t:[]},onChange:()=>kn(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=Re(Object.assign({},t,r),Kn);k(i)}))}})),T={case:0,fullchar:0},I=t.useMemo((()=>c.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[R,k]=t.useState({}),[L,P]=t.useState(T),[D]=t.useState(N([I[0]])),[_]=t.useState(N(I.slice(1))),[F,M]=t.useState(0),$=t.useMemo((()=>!Object.keys(R).length),[R]);Li((()=>{w.current="ready"}),[R,L]);const j=e=>{P(Object.assign({},L,e))},q=(e,t,n)=>new Promise(((r,i)=>{A.confirm({title:v("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),K=e=>kn(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"===w.current&&(w.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=ta(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),M(x.current.length)),!x.current.length)return h(""),A.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>x.current.length-1&&(yield q(v("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=x.current.length-1)))),"prev"===e&&(C.current=C.current<0?x.current.length-1:C.current-1,C.current<0&&(yield q(v("qm.table.fastSearch.toStart"),(()=>C.current=x.current.length-1),(()=>C.current=0))));const{isTreeTable:t,tableFullData:n,deriveRowKeys:r}=i.current,a=x.current[C.current],o=l(a,a.index);let s=a.index;if(t&&f){const e=ga(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)})),V=()=>{y.current.RESET_FORM(),b.current.RESET_FORM()},z=t.useMemo((()=>g?`fastSearch_${g}`:""),[g]),[W,B]=t.useState([]),[U,G]=t.useState(""),[Y,X]=t.useState("");Li((()=>{if(Y){const{filters:e,config:t}=W.find((e=>e.value===Y)).list;y.current.SET_FIELDS_VALUE(zn(e,_.map((e=>e.fieldName)))),b.current.SET_FIELDS_VALUE(zn(e,D.map((e=>e.fieldName)))),k(e),P(t)}else V(),k({}),P(T)}),[Y]),t.useEffect((()=>{Q()}),[]);const Q=()=>kn(void 0,void 0,void 0,(function*(){if(!z)return;let e=yield Qt.getItem(z);e||(e=yield Z(z),Array.isArray(e)&&(yield Qt.setItem(z,e))),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))})),Z=e=>kn(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)=>kn(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(bl,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,v("qm.table.alert.total",{total:F}))},t.createElement(bl.TabPane,{tab:v("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t.createElement(rd,{ref:y,items:D,cols:1,labelWidth:110})),t.createElement(bl.TabPane,{tab:v("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t.createElement(rd,{ref:b,items:_,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(Xn,{type:"primary",disabled:!U||$,style:{marginLeft:"10px"},onClick:()=>kn(void 0,void 0,void 0,(function*(){if(!z)return Yn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ca(),t=[...W,{text:U,value:e,list:{filters:R,config:L}}];B(t),X(e),G(""),yield Qt.setItem(z,t),yield J(z,t)}))},v("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${Xd.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,kn(void 0,void 0,void 0,(function*(){if(!n)return;const e=W.filter((e=>e.value!==n));B(e),n===Y&&X(""),yield Qt.setItem(z,e),yield J(z,e)}))}},t.createElement(dt,null))))),!W.length&&t.createElement("div",{style:{padding:Fd}},t.createElement(Gi,null)))))),t.createElement("div",{className:"bottom"},t.createElement("div",null,t.createElement(H,{checked:!!L.case,onChange:e=>j({case:e.target.checked})},v("qm.table.fastSearch.matchCase")),t.createElement(H,{checked:!!L.fullchar,onChange:e=>j({fullchar:e.target.checked})},v("qm.table.fastSearch.matchFullchar"))),t.createElement("div",null,t.createElement(Xn,{onClick:()=>V()},v("qm.table.fastSearch.clear"))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${bo[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Xn,{onClick:()=>n(),style:{marginRight:8}},v("qm.table.fastSearch.closeButton")),t.createElement(Xn,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},v("qm.table.fastSearch.queryPrev")),t.createElement(Xn,{type:"primary",onClick:()=>K("next")},v("qm.table.fastSearch.queryNext"))))},Ou=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,$size:l}=t.useContext(Pd),{t:a}=Ln(),[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:`${bo[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(ut,null))),t.createElement(wl,d,t.createElement(Ru,{onClose:()=>s(!1)})))}));Ou.displayName="FastSearch";const ku=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(Pd),{t:l}=Ln(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:l("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>o(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-pivot-grid`,title:l("qm.table.pivotGrid.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(pt,null))),t.createElement(wl,c,t.createElement(Fm,null)))}));ku.displayName="PivotGrid";const Lu=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:l,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext(Pd),{fetch:d}=l.current.props,{t:u}=Ln(),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===Xd.groupSummary.total.value?{dataIndex:e.summary,title:Xd.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,{[Xd.sorterFieldName]:void 0,[Xd.groupSummary.summaryFieldName]:i.map((e=>`${e.formula}|${e.summary}`)).join(","),[Xd.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[Xd.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===Xd.groupSummary.total.value&&(i={dataIndex:Xd.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=ma(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&na(t,r,ta(e[0],r))})),i.forEach((n=>{const r=n.summary!==Xd.groupSummary.total.value?n.summary:Xd.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&na(t,r,e.length),"sum"===i&&na(t,r,Oe(e,r)),"max"===i&&na(t,r,ke(e,r)[r]),"min"===i&&na(t,r,Le(e,r)[r]),"avg"===i&&na(t,r,(Oe(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(Mp,x)},Au=e=>{const{onClose:n}=e,{global:r}=t.useContext(en),{tableRef:i,prefixCls:l,$size:a,flattenColumns:o}=t.useContext(Pd),{uniqueKey:s}=i.current.props,{t:c}=Ln(),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("");Li((()=>{if(y){const{group:e,summary:t}=m.find((e=>e.value===y)).list;T(e),L(t)}else{const e=F();T((null==e?void 0:e.group)||[]),L((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{H()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.operationColumn].includes(e.dataIndex)))),[o]),C=E.filter((e=>!e.groupSummary)).map((e=>({text:ua(e.title),value:e.dataIndex}))),w=[Xd.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:ua(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(Xn,{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:C.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(Xn,{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:w.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===Xd.groupSummary.total.value?S.slice(S.length-1):S})}]),D=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]),_=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}))},F=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},H=()=>kn(void 0,void 0,void 0,(function*(){if(!x)return;const e=F();if(e){const{group:t,summary:n}=e;T(t),L(n)}let t=yield Qt.getItem(x);t||(t=yield M(x),Array.isArray(t)&&(yield Qt.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),M=e=>kn(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)=>kn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),j={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(Mp,{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(Xn,{type:"primary",icon:t.createElement(ht,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(Mp,{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(Xn,{type:"primary",icon:t.createElement(ht,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:D,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(Xn,{type:"primary",disabled:!g||D,style:{marginLeft:"10px"},onClick:()=>kn(void 0,void 0,void 0,(function*(){if(!x)return Yn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ca(),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 Qt.setItem(x,t),yield $(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${Xd.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,kn(void 0,void 0,void 0,(function*(){if(!n)return;const e=m.filter((e=>e.value!==n));f(e),n===y&&b(""),yield Qt.setItem(x,e),yield $(x,e)}))}},t.createElement(dt,null))))),!m.length&&t.createElement("div",{style:{padding:Fd}},t.createElement(Gi,null)))))),t.createElement(wl,j,t.createElement(Lu,{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(Xn,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(Xn,{type:"primary",disabled:D,onClick:()=>(_(),void h(!0))},c("qm.table.groupSummary.confirmButton"))))},Pu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(Pd),{t:l}=Ln(),[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(mt,null))),t.createElement(wl,c,t.createElement(Au,{onClose:()=>o(!1)})))}));Pu.displayName="GroupSummary";const Du=e=>{const{onClose:n}=e,{global:r}=t.useContext(en),{tableRef:i,$size:l,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t.useContext(Pd),{uniqueKey:d}=i.current.props,{t:u}=Ln(),p=t.useRef(null),[h,m]=t.useState([]),[f,g]=t.useState([]),[v,y]=t.useState(""),[b,x]=t.useState("");Li((()=>{m(b?f.find((e=>e.value===b)).list:F()||[])}),[b]),t.useEffect((()=>{H()}),[]);const E=t.useMemo((()=>d?`superSearch_${d}`:""),[d]),C=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=ha(h),S=t.useMemo((()=>!(w&&Hl(w))),[w]),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:ua(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(Xn,{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=C.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=C.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=C.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}})}]),D=()=>{c(),s(h.map((e=>zn(e,["index","pageIndex"])))),_(),n()},_=()=>{E&&sessionStorage.setItem(E,JSON.stringify(h.filter((e=>!!e.fieldName))))},F=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},H=()=>kn(void 0,void 0,void 0,(function*(){if(!E)return;const e=F();e&&m(e);let t=yield Qt.getItem(E);t||(t=yield M(E),Array.isArray(t)&&(yield Qt.setItem(E,t))),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))})),M=e=>kn(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)=>kn(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(Mp,{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(Xn,{type:"primary",icon:t.createElement(ht,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),Xd.highSearch.showSQL&&w&&t.createElement("code",{className:"lang-js"},w)),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(Xn,{type:"primary",disabled:!v||S,style:{marginLeft:"10px"},onClick:()=>kn(void 0,void 0,void 0,(function*(){if(!E)return Yn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=ca(),t=[...f,{text:v,value:e,list:h.filter((e=>!!e.fieldName))}];g(t),x(e),y(""),yield Qt.setItem(E,t),yield $(E,t)}))},u("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${Xd.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,kn(void 0,void 0,void 0,(function*(){if(!n)return;const e=f.filter((e=>e.value!==n));g(e),n===b&&x(""),yield Qt.setItem(E,e),yield $(E,e)}))}},t.createElement(dt,null))))),!f.length&&t.createElement("div",{style:{padding:Fd}},t.createElement(Gi,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(Xn,{onClick:()=>n(),style:{marginRight:8}},u("qm.table.highSearch.closeButton")),t.createElement(Xn,{type:"primary",disabled:N,onClick:()=>D()},u("qm.table.highSearch.searchButton"))))},_u=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(Pd),{t:l}=Ln(),[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(ft,null))),t.createElement(wl,c,t.createElement(Du,{onClose:()=>o(!1)})))}));_u.displayName="SuperSearch";const Fu=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(en),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext(Pd),{uniqueKey:E,exportExcel:C}=v.current.props,{t:w}=Ln(),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),D=t.useRef(null),_=t.useRef(!1),F=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[$,j]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),q={fullScreen:i,reload:l,print:a,import:o,export:s&&!(null==C?void 0:C.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:p,pivotGrid:h,groupSummary:m},[K,V]=t.useState(!1);Li((()=>{_.current&&(W(),_.current=!1)}),[$]),t.useEffect((()=>{z()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return Yn("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const z=()=>{if(!F||!f)return;const e=JSON.parse(localStorage.getItem(F));e||B(F).then((e=>{e&&(j(Object.assign({},$,e)),localStorage.setItem(F,JSON.stringify(e)))})).catch((()=>{})),e&&j(Object.assign({},$,e))},W=()=>{if(!F||!f)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(F,JSON.stringify(e)),U(F,e)},B=e=>kn(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)=>kn(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=>kn(void 0,void 0,void 0,(function*(){V(!1),yield $n(100),e.current.clickHandle()})),X=(e,t)=>{_.current=!0,j(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(lu,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),l&&t.createElement(au,{ref:N,open:!f||$.reload}),a&&t.createElement(su,{ref:T,tableColumns:r,open:!f||$.print}),o&&t.createElement(xu,{ref:I,tableColumns:r,open:!f||$.import}),s&&t.createElement(wu,{ref:R,tableColumns:r,open:(!f||$.export)&&!(null==C?void 0:C.hideIcon)}),c&&t.createElement(Nu,{ref:O,open:!f||$.clipboard}),d&&t.createElement(Iu,{ref:k,columns:r,open:!f||$.collection}),u&&t.createElement(Ou,{ref:L,open:!f||$.fastSearch}),h&&t.createElement(ku,{ref:A,open:!f||$.pivotGrid}),m&&t.createElement(Pu,{ref:P,open:!f||$.groupSummary}),p&&t.createElement(_u,{ref:D,open:!f||$.superSearch}),f&&t.createElement(M,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.screen.full"))),onClick:()=>G(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.refresh.text"))),onClick:()=>G(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.print.text"))),onClick:()=>G(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.import.textNoSpace"))),onClick:()=>G(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.export.textNoSpace"))),onClick:()=>G(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.clipboard.textNoSpace"))),onClick:()=>G(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.selectCollection.text"))),onClick:()=>G(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.fastSearch.text"))),onClick:()=>G(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.pivotGrid.text"))),onClick:()=>G(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.groupSummary.text"))),onClick:()=>G(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.highSearch.text"))),onClick:()=>G(D)}];return t.createElement(Y,{items:e.filter((e=>q[e.key]))})})(),overlayClassName:_e(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{V(e)}},t.createElement("span",{className:`${b}-toolbox`,title:w("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(gt,null)))))}));Fu.displayName="ToolBox";const Hu=(e,t)=>e.map((e=>(e.children&&(e.children=Hu(e.children,t)),t(e)))),Mu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:i}=t.useContext(en),{tableRef:l,prefixCls:a,$size:o}=t.useContext(Pd),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=l.current.props,{t:p}=Ln(),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]);Li((()=>{C(r)}),[r]),t.useLayoutEffect((()=>{w()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:w})));const x=()=>{if(!b)return;const e=JSON.parse(localStorage.getItem(b));var t;if(e||(t=b,kn(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)),w()):(null==i?void 0:i.getComponentConfigApi)&&C(r)})).catch((()=>{})),!e)return;return ge(ql(e).map((e=>e.dataIndex)),ql(r).map((e=>e.dataIndex))).length>0?Hu(r,(t=>{const n=Vl(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})):Hu(e,(e=>{const t=Vl(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)})),C=e=>{if(!b)return;const t=E(e),n=JSON.parse(localStorage.getItem(b));var r,a;l.current.columnsDefined&&!me(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,kn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},w=()=>{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=Vl(r,t.dataIndex)||Wn(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=ua(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(H,{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(Ge,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(vt,null)),t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},t.createElement(yt,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(dt,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(Xt,{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));me(i,l)||((e,t)=>{Vl(r,t).children=e,null==u||u([...r])})(ba(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(tc,{action:["click"],popupVisible:m,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(Xn,{type:"text",size:"small",onClick:N},p("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(Xt,{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));me(t,n)||T([...ba(e),...y,...v])}},g.map((e=>R(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(Xt,{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));me(t,n)||T([...g,...ba(e),...v])}},y.map((e=>R(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(Xt,{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));me(t,n)||T([...g,...y,...ba(e)])}},v.map((e=>R(e,"right")))))),popupClassName:_e(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Kd,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(ot,null)),!d&&t.createElement("span",null,p("qm.table.columnFilter.text")))):null}));Mu.displayName="ColumnFilter";const $u=()=>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"})),ju=e=>{const{column:n,filters:r}=e,{$size:i,prefixCls:l,setFilters:a,clearSuperFilters:o}=t.useContext(Pd),{t:s}=Ln(),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(!Kn(r[y][t])||m){e=!0;break}return e}),[y,r,m]);t.useLayoutEffect((()=>{p&&setTimeout((()=>x()),20)}),[p]),t.useEffect((()=>{var e;me(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(Kn(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)},C={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:ua(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(H,{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:ua(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(H,{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($,Cn({ref:d},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement($,Cn({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement($,Cn({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement($,Cn({},n("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const n=e=>{var t;return{value:oa(null===(t=g[y])||void 0===t?void 0:t[e],$d),format:$d,size:i,onChange:t=>{v((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:sa(t,$d)})})))},onKeyDown:e=>{13===e.keyCode&&E()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(En,Cn({},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(En,Cn({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(En,Cn({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(En,Cn({},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(q.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(q,{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(H.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(H,{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(Ad,{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}})))}}))}},w=()=>t.createElement(S,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t.createElement(Xn,{size:i,onClick:()=>(E({[y]:{}}),void f(!1))},s("qm.table.filter.reset")),t.createElement(Xn,{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(tc,{action:["click"],popupVisible:p,popup:(()=>{const e=n.filter.type,r=C[e];return r?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement("div",null,r(n)),w()):(Yn("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:_e(N),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{h(e)},builtinPlacements:Kd,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($u,null))))},qu=e=>{const{column:n}=e,{tableRef:r,bordered:i}=t.useContext(Pd),{columns:l,resizable:a,columnsChange:o=Hn}=r.current.props,s=t.useMemo((()=>Wl(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=Zl(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||Xd.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&&(Vl(l,s.dataIndex).width=h,o([...l]))},!1}})},Ku=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(Pd),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:f,onSelectAll:g}=p,{t:v}=Ln(),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]),w=()=>{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:Ae(t,w());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 Ae(l,w())})(),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=()=>kn(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=pe(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:l}=p;l&&(n=ge(n,a().filter((e=>l(e))).map((e=>i(e,e.index))))),y.current=n}}catch(e){}return c(!1),n})),k=e=>kn(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:()=>kn(void 0,void 0,void 0,(function*(){let e=[];e=ge(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(H,{checked:R,indeterminate:I,disabled:!S.length,onChange:e=>k(e.target.checked)}),E&&t.createElement(M,{overlayClassName:"all-selection__popper",dropdownRender:()=>L()},t.createElement(He,{className:"svgicon icon"})),x&&t.createElement(C,{placement:"top",title:v("qm.table.selection.currentPage")},t.createElement(bt,{className:"info"})))},Vu=e=>{const{style:n}=e,{tableRef:r,setRowExpandedKeys:i}=t.useContext(Pd),{expandable:l}=r.current.props,[a,o]=t.useState((null==l?void 0:l.defaultExpandAllRows)||!1);Li((()=>{const{allRowKeys:e,flattenRowKeys:t,isTreeTable:n}=r.current;i(a?e.filter((e=>!(n&&t.includes(e)))):[])}),[a]);const s={[`${Jn("expand")}--icon`]:!0,expanded:a,collapsed:!a};return t.createElement("span",{className:_e(s),title:"",onClick:e=>{e.stopPropagation(),o(!a)},style:n})},zu=()=>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"})),Wu=()=>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"})),Bu=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(Pd),{ellipsis:w,resizable:S,multipleSort:N,rowSelection:T,expandable:I}=r.current.props,[R,O]=Xd.sortDirections,{tableOriginData:k}=r.current,{t:L}=Ln(),A=t.useRef(null),P=t.useMemo((()=>k.some((e=>Array.isArray(e.children)))),[k]),D=t.useMemo((()=>!u),[u]),_=t.useMemo((()=>!u),[u]),F=t.useMemo((()=>!(null==I?void 0:I.hideExpandAll)),[I]),H=t.useMemo((()=>!!T&&(u?!(!T.selectAllOnCurrentPage&&!T.fetchAllRowKeys):!T.hideSelectAll)),[u,T]);Li((()=>{z(),m(),v()}),[o]),Li((()=>{G(),m(),v()}),[s]),Li((()=>{G(),m(),v()}),[c]),t.useEffect((()=>{!Kn(o)&&jn((()=>z())),!Kn(s)&&jn((()=>G()))}),[]),t.useLayoutEffect((()=>{M()}),[]);const M=()=>{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 C=m||h,N=["header--column",{"col--ellipsis":null!==(l=e.ellipsis)&&void 0!==l?l:w,"col--center":"center"===C,"col--right":"right"===C,"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&&![Xd.expandableColumn,Xd.selectionColumn].includes(c);return t.createElement("th",{key:c,className:_e(N),colSpan:d,rowSpan:u,style:Object.assign({},T),onClick:t=>V(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"},j(e)),v?K(e):null)),I&&t.createElement(qu,{column:e}))},j=e=>{const{dataIndex:n,type:i,sorter:l,title:a,description:s}=e;if(n===Xd.selectionColumn&&"checkbox"===i){if("checkbox"===i)return t.createElement("div",{className:"cell"},H?t.createElement(Ku,{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:ua(a)},r.current.isTreeTable&&n===h&&F?t.createElement(Vu,null):null,n===Xd.expandableColumn&&F?t.createElement(Vu,null):a)),s&&c.push(t.createElement(C,{key:1,placement:"top",title:s},t.createElement(bt,{className:"tip"}))),l&&c.push(q(o[n])),c},q=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(zu,null)),t.createElement("span",{className:_e(r)},t.createElement(Wu,null)))},K=e=>t.createElement(ju,{column:e,filters:s}),V=(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}))}},z=()=>{D&&W()},W=e=>{const t=Pe(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=ta(e,r),s=ta(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(pa(t)):t,e);E(n)},G=()=>{_&&Y()},Y=()=>{const e=c.length?ha(c):ha(s),t=""!==e?p?x(Ml(pa(k),e,P)):Ml(k,e,P):k;E(t),W(!0)},X=Yl(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))))},Uu=t.createContext([]);function Gu(e,t,n){var r;let i,l=null!==(r=n.initialDeps)&&void 0!==r?r:[];return()=>{var r,a,o,s;n.key&&(null===(r=n.debug)||void 0===r||r.call(n));const c=e();return c.length!==l.length||c.some(((e,t)=>l[t]!==e))?(l=c,n.key&&(null===(a=n.debug)||void 0===a||a.call(n)),i=t(...c),n.key&&(null===(o=n.debug)||void 0===o||o.call(n)),null===(s=null==n?void 0:n.onChange)||void 0===s||s.call(n,i),i):i}}function Yu(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const Xu=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,i)),n)}},Qu=e=>e,Zu=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},Ju=(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)}},ep={passive:!0},tp="undefined"==typeof window||"onscrollend"in window,np=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const l=e.options.useScrollendEvent&&tp?()=>{}:Xu(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,ep),n.addEventListener("scrollend",s,ep),()=>{n.removeEventListener("scroll",o),n.removeEventListener("scrollend",s)}},rp=(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"])},ip=(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 lp{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,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Qu,rangeExtractor:Zu,onChange:()=>{},measureElement:rp,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=Gu((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",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=Gu((()=>[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=Gu((()=>[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=Gu((()=>[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=ap(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=Gu((()=>[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=Gu((()=>[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 Yu(t[ap(0,t.length-1,(e=>Yu(t[e]).start),e)])},this.getOffsetForAlignment=(e,t)=>{const n=this.getSize(),r=this.getScrollOffset();"auto"===t&&(t=e<=r?"start":e>=r+n?"end":"start"),"start"===t?e-=0:"end"===t?e-=n:"center"===t&&(e-=n/2);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="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,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]=Yu(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 ap=(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 op="undefined"!=typeof document?t.useLayoutEffect:t.useEffect,sp=e=>(e=>{const n=t.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},e),{onChange:(t,r)=>{var i;r?Yt(n):n(),null===(i=e.onChange)||void 0===i||i.call(e,t,r)}}),[i]=t.useState((()=>new lp(r)));return i.setOptions(r),op((()=>i._didMount()),[]),op((()=>i._willUpdate())),i})(Object.assign({observeElementRect:Ju,observeElementOffset:np,scrollToFn:ip},e)),cp=(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=dp(o,n.eventKey);if(p<h+m/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=dp(o,t)}const y=v.key,b=v,x=v.key;let E=0,C=0;if(!g.includes(y))for(let e=0;e<f&&pp(v);e+=1)v=v.parent,C+=1;const w=t.data,S=v.node;let N=!0;return hp(v)&&0===v.level&&p<h+m/2&&l({dragNode:w,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?l({dragNode:w,dropNode:S,dropPosition:0})?E=0:N=!1:0===C?f>-1.5?l({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:w,dropNode:S,dropPosition:0})?E=c?1:0:l({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:C,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}},dp=(e,t)=>e[t],up=e=>e.split("-"),pp=e=>{if(e.parent){const t=up(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},hp=e=>{const t=up(e.pos);return 0===Number(t[t.length-1])},mp=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:i,setRowExpandedKeys:l,createTableFullData:a,dataChange:o}=t.useContext(Pd),{tableFullData:s,allRowKeys:c,isTreeTable:d}=n.current,u=Mn,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([]),[C,w]=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)}))}(dp(t,e).children),n})(n,g)),w(2*Xd.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}=cp(e,p.current,t,C,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=dp(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}=cp(e,p.current,t,C,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=dp(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:dp(g,i).node});-1!==x.indexOf(i)&&Yn("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=up(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:C,dropOptions:S}},fp=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,gp=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),vp=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!fp(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function yp({ref:t,handler:n,enabled:r=!0,omitClassNames:i=[]}){const l=An(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{vp(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&vp(e,t)&&gp(e,i)&&(a.current.isPointerDown=!1,l(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&vp(e,t)&&gp(e,i)&&(a.current.isPointerDown=!1,l(e))},c=fp(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 bp(){const[,t]=e.useReducer((e=>e+1),0);return t}const xp=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:C,dragOverNodeKey:w,dropTargetKey:S,dropContainerKey:N}=d,T=w===r&&0===E,I=w===r&&-1===E,R=w===r&&1===E,O=l._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-C*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-C*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,w===r&&null!==E&&null!==C&&t.createElement("td",{className:"drop-indicator",style:k}))}));xp.displayName="DraggableTr";const Ep=e=>{const{selectionKeys:n,column:r,record:i,rowKey:l}=e,{tableRef:a,getAllChildRowKeys:o}=t.useContext(Pd),{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=Ul(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(q,{checked:a,disabled:r})})():(()=>{const e=s.disabled,r=null==e?void 0:e(i),a=!!n.includes(l);return t.createElement(H,{checked:a,indeterminate:d(l),disabled:r})})()},Cp=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:l,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext(Pd),{expandable:s={}}=l.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);Li((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${Jn("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})},wp=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 Vt(t).toFixed(p)),t},E=void 0!==l,[C,w]=t.useState(null!=i?i:""),S=v(E?l:C),N=y(S);Li((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[C]);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):w(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))}})}));wp.displayName="InputNumber";const{Search:Sp}=O,Np=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(Pd),x=t.useContext(Uu),{t:C}=Ln(),w=bp(),{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),D=t.useRef({}),_=t.useRef({}),M=t.useRef([]),[$,j]=t.useState(!1),[q,V]=t.useState(!1),[z,W]=t.useState(T.items||[]),[B,U]=t.useState(),G=(T.editable||me(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||$||q,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&&ae()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;re&&e&&le(e.map((e=>({[_.current.valueKey]:e.value,[_.current.textKey]:e.text}))))}),[]);const ie=()=>{v(),b()},le=e=>{M.current=e},ae=()=>{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:ae,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):"",ue={text:(e,n,r)=>{const{dataIndex:i}=n,{type:l,extra:a={},rules:o=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=ta(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,Cn({ref:R,size:f,value:m,maxLength:a.maxLength,showCount:a.showCount},v,{autoComplete:a.password?"new-password":"off",placeholder:a.placeholder||C("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:"";na(e,i,l),y(o,l,u,p,ua(n.title)),w(),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)=>ue.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=ta(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 Vt(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Vt(e).times(.01).toString()),t.createElement(wp,{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||C("qm.table.editable.inputPlaceholder"),maxLength:s.maxLength,allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,formatter:b,parser:x,onChange:t=>{na(e,i,t),y(c,t,u,p,ua(n.title)),w(),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),na(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=ta(e,l);let b=v;return t.createElement(F,{mode:r?"multiple":void 0,size:f,popupClassName:Xd.popupClassName,value:v||void 0,placeholder:s.placeholder||C("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}|${to.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>j(e),onChange:t=>{na(e,l,t),y(c,t,u,p,ua(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},onSelect:e=>{b=e},onInputKeyDown:t=>{13===t.keyCode&&jn((()=>null==m?void 0:m({[Y]:b},e)))}},g.map((e=>t.createElement(F.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ue.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=ta(e,l);return t.createElement(En,{size:f,popupClassName:Xd.popupClassName,value:null!==(i=oa(h,Ra[d]))&&void 0!==i?i:void 0,picker:Ia[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=sa(t,Ra[d]);na(e,l,r),y(s,r,u,p,ua(n.title)),ce(e,u,p),null==c||c({[Y]:r},e),ie()}})},datetime:(e,t)=>ue.date(e,t,"datetime"),month:(e,t)=>ue.date(e,t,"month"),year:(e,t)=>ue.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=ta(e,i);return t.createElement(wn,{size:f,popupClassName:Xd.popupClassName,value:null!==(r=oa(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=sa(t,c);na(e,i,r),y(o,r,u,p,ua(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=Hd,falseValue:c=Md,disabled:d}=l,h=ta(e,r);return t.createElement(H,{checked:h===s,disabled:d,onChange:t=>{const i=t.target.checked?s:c;na(e,r,i),y(a,i,u,p,ua(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=Hd,falseValue:c=Md,disabled:d}=l,h=ta(e,r);return t.createElement(K,{checked:h===s,disabled:d,onChange:t=>{const i=t?s:c;na(e,r,i),y(a,i,u,p,ua(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=ra(e,ne?c.combinedDataIndex:i),b=c.fieldAliasMap;b||Yn("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(i)||Yn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(c.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Yn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[i].includes("|")&&Yn("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(oe(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},w=e=>{const{autoQueryAssign:t=!0}=c;t&&(D.current=E(e)),j(!0)},S=(t,r)=>{const{beforeOpen:i}=c,l=(null!=i?i:Mn)({[Y]:v},e,n);(null==l?void 0:l.then)?l.then((()=>{w(t),null==r||r()})).catch((()=>{})):!1!==l&&(w(t),null==r||r())},N=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=ra(e,r))}const n=x[i]?ra(e,x[i]):"";R(n,t);const{closed:r}=c;j(!1),null==r||r(e)},I=()=>{const{onlySelect:e=!0}=c;P.current&&R(e?"":v),j(!1)},R=(t="",r)=>{var a;if(oe(r)&&Object.keys(r).length)for(const t in r){const n=r[t],i=g.find((e=>e.dataIndex===t));if(i){na(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,ua(i.title))}else na(e,t,n)}ne&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return na(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&na(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),na(e,i,t,l),y(s,t,u,p,ua(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie(),D.current={},P.current=!1,U(void 0)},O={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:Xd.popupClassName,bodyStyle:{paddingBottom:`${bo[f]+20}px`},onClose:()=>{I()}},k=Object.assign(Object.assign({},c),{size:f,initialValue:Object.assign({},D.current,c.initialValue),onClose:e=>{e?N(e):I()}});return t.createElement(t.Fragment,null,t.createElement(Sp,{ref:L,value:null!=B?B:v,placeholder:o.placeholder||C("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=Mn}=t.fetch;return new Promise(((i,l)=>kn(void 0,void 0,void 0,(function*(){var a;const o=ye({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(o))return l();V(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=pe(e.data,t.fetch.dataKey))&&void 0!==a?a:[];i(n)}else l()}catch(e){l(e)}finally{jn((()=>V(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>ra(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(wl,O,t.createElement($p,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=ta(e,i),v=c.fieldAliasMap;v||Yn("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Yn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),_.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Mn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{j(!0),null==t||t()})).catch((()=>{})):!1!==i&&(j(!0),null==t||t())},w=()=>{j(!1)},S=t=>{na(e,i,t),y(s,t,u,p,ua(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,M.current),ie()},N={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:Xd.popupClassName,bodyStyle:{paddingBottom:`${bo[f]+20}px`},onClose:()=>{w()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ye({},c.initialValue),defaultSelectedKeys:g,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=b;le(be([...M.current.filter((e=>t.includes(e[r]))),...e],r));const i=M.current.map((e=>({text:e[n],value:e[r]}))),l=be([...i,...a],"value").filter((e=>t.includes(e.value)));W(l),S(l.map((e=>e.value)));const{closed:o}=c;j(!1),null==o||o(M.current)})(e,t):w()}});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(F,{mode:"multiple",open:!1,value:g,placeholder:o.placeholder||C("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(M.current.filter((n=>e.includes(n[t])))),S(e)}},z.map((e=>t.createElement(F.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(Ye,null),onClick:()=>{x()}})))),t.createElement(wl,N,t.createElement($p,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=ra(e,ne?d.combinedDataIndex:l),b=d.fieldAliasMap;b||Yn("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(l)||Yn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Yn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[l].includes("|")&&Yn("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:r}=d,i=(null!=r?r:Mn)({[Y]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{j(!0),null==t||t()})).catch((()=>{})):!1!==i&&(j(!0),null==t||t())},w=()=>{j(!1)},S=(t="",r)=>{var i;if(oe(r)&&Object.keys(r).length)for(const t in r){const n=r[t],l=g.find((e=>e.dataIndex===t));if(l){na(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,ua(l.title))}else na(e,t,n)}na(e,l,t,a),y(c,t,u,p,ua(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},N={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:Xd.popupClassName,bodyStyle:{paddingBottom:`${bo[f]+20}px`},onClose:()=>{w()}},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]=ra(e,r))}const n=x[l]?ra(e,x[l]):"";S(n,t);const{closed:r}=d;j(!1),null==r||r(e)})(e):w()}});return t.createElement(t.Fragment,null,t.createElement(Sp,{ref:A,value:v,allowClear:null===(i=s.allowClear)||void 0===i||i,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||C("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(wl,N,t.createElement(zp,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=ta(e,i),v=c.fieldAliasMap;v||Yn("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Yn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),_.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:Mn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{j(!0),null==t||t()})).catch((()=>{})):!1!==i&&(j(!0),null==t||t())},w=()=>{j(!1)},S=t=>{na(e,i,t),y(s,t,u,p,ua(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,M.current),ie()},N={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:Xd.popupClassName,bodyStyle:{paddingBottom:`${bo[f]+20}px`},onClose:()=>{w()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ye({},c.initialValue),defaultSelectedKeys:g,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=b;le(e);const r=M.current.map((e=>({text:e[t],value:e[n]})));W(r),S(r.map((e=>e.value)));const{closed:i}=c;j(!1),null==i||i(M.current)})(e):w()}});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(F,{mode:"multiple",open:!1,value:g,placeholder:a.placeholder||C("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(M.current.filter((n=>e.includes(n[t])))),S(e)}},z.map((e=>t.createElement(F.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(Ye,null),onClick:()=>{x()}})))),t.createElement(wl,N,t.createElement(zp,I)))},custom:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],render:o,onChange:s}=T;if(!o)return Yn("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const c=ta(e,r),d=t=>{na(e,r,t),y(a,t,u,p,ua(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:Xd.popupClassName,onChange:d}):null}};return t.createElement(t.Fragment,null,te?(()=>{const{type:e}=T,n=ue[e];if(!n)return Yn("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"}))}));Np.displayName="CellEdit";const Tp=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,Ip=e=>{const{text:n,options:r,showMessage:i=!0,onCopy:l}=e,{t:a}=Ln();return Tp(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=zt(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)}})};Ip.displayName="QmCopyToClipboard";const Rp=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(Pd),{dataIndex:m,canCopy:f,render:g,editRender:v,shouldCellUpdate:y}=i,{t:b}=Ln(),{renderText:x,getTitleFromCellNode:E}=ou(),C=t.useRef(null),w=ta(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(w,l,i,a,o):x(w,i,l);return[e,v?t.createElement(Np,{ref:r,column:i,record:l,rowKey:s,columnKey:m},e):null]}),[h,l,w,g,v],((e,t)=>{if(y){const[,n]=e,[,r]=t;return y(r,n,l)}return!((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)})(e,t,!0)}));t.useEffect((()=>{if([Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn].includes(m))return;const e=C.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const T=e=>Array.isArray(e.children);return t.createElement("div",{ref:C,className:"cell"},(()=>{if(m===Xd.expandableColumn)return t.createElement(Cp,{record:l,rowKey:s});if(m===Xd.selectionColumn)return t.createElement(Ep,{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*Xd.treeTable.textIndent+"px"}}):null,t.createElement(Cp,{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(Ip,{text:e},t.createElement(st,{className:"icon",title:b("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Rp.displayName="Cell";const Op={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},kp={open:!1,offsetX:0,offsetY:0},Lp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:l,tableFlatData:a,flattenColumns:o,mergedTdCells:s,setMergedCells:c}=t.useContext(Pd),{areaSelection:d={}}=r.current.props,{elementStore:u}=r.current,{t:p}=Ln(),h=t.useRef(document.onselectstart),m=t.useRef(null),f=t.useRef(null),[g,v]=t.useState(null),[y,b]=t.useState(null),[x,E]=t.useState(null);yp({ref:m,handler:()=>M()});const C=t.useRef(Op),w=e=>{C.current=Object.assign({},C.current,e)};t.useEffect((()=>{const e=Ft(u.$tableBody,"mousedown",A),t=Ft(u.$tableBody,"contextmenu",k),n=Ft(document,"keydown",L);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const S=()=>{v(null),b(null),E(null)};t.useImperativeHandle(n,(()=>({blur:S})));const N=()=>u.$tableBody.parentNode,T=e=>{const{offsetLeft:t,offsetTop:n,offsetWidth:r,offsetHeight:i}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:n,w:r,h:i}},I=nl(((e,t)=>{let n=null;const r=u.$tableBody.querySelectorAll("tbody > tr");for(let i=0;i<r.length;i++){if(r[i].offsetTop>t||r[i].offsetTop+r[i].offsetHeight<t)continue;const l=r[i].querySelectorAll("td");for(let t=0;t<l.length;t++)if(!(l[t].offsetLeft>e||l[t].offsetLeft+l[t].offsetWidth<e)){n=l[t];break}break}n&&b(T(n))}),5),R=An((()=>{const e=[];if(!g||!y)return e;const[t,n]=[g.colIndex,y.colIndex],[r,l]=[g.rowKey,y.rowKey];let[s,c]=[0,0];for(let e=0;e<a.length;e++){const t=i(a[e],a[e].index);if(t==r&&(s=e),t==l){c=e;break}}const d=o.slice(Math.min(t,n),Math.max(t,n)+1);return a.slice(s,c+1).forEach((t=>{for(let n=0;n<d.length;n++){const{dataIndex:r}=d[n];e.push({rowKey:i(t,t.index),dataIndex:r,cellValue:ta(t,r)})}})),e})),O=e=>{var t;c(e),null===(t=d.onCellMerge)||void 0===t||t.call(d,e),jn((()=>S()))},k=An((e=>{d.cellMerge&&g&&F(e.clientX,e.clientY)?(e.preventDefault(),H(e)):(null==x?void 0:x.open)&&M()})),L=e=>{27===e.keyCode&&S()},A=An((e=>{e.stopPropagation();const t=(e=>{let t=e;for(;t;){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null})(e.target);if(1!==e.buttons||!t)return;M(),setTimeout((()=>{v(T(t)),b(T(t))}));const[n,r]=[u.$tableBody.getBoundingClientRect().top,N().getBoundingClientRect().left],{offsetWidth:i,offsetHeight:l}=N();w({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-r,startOffsetY:e.clientY-n,containerSizeX:i,containerSizeY:l}),document.addEventListener("mousemove",P),document.addEventListener("mouseup",D),h.current=document.onselectstart,document.onselectstart=()=>!1})),P=e=>{const t=e.clientX-C.current.startX,n=e.clientY-C.current.startY,r=C.current.startOffsetX+t,i=C.current.startOffsetY+n;I(Math.min(r,C.current.containerSizeX),Math.min(i,C.current.containerSizeY))},D=()=>{var e;w(Op),null===(e=d.onSelectChange)||void 0===e||e.call(d,R()),document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",D),_()},_=()=>{document.onselectstart!==h.current&&(document.onselectstart=h.current)},F=(e,t)=>{const{top:n,left:r}=N().getBoundingClientRect(),[i,l]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=q();return!(i<a||i>a+s||l<o||l>o+c)},H=e=>{const{top:t,left:n,height:r}=f.current.getBoundingClientRect();E({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},M=()=>{E((e=>Object.assign(Object.assign({},e),{open:!1})))},$=()=>{if(!g||!y||(t=y,(e=g).rowKey===t.rowKey&&e.colIndex===t.colIndex))return S();var e,t;const[n,r]=g.t<=y.t?[g.rowKey,y.rowKey]:[y.rowKey,g.rowKey],[l,c]=g.l<=y.l?[g.colIndex,y.colIndex]:[y.colIndex,g.colIndex];let[d,u]=[0,0],p=n;for(let e=0;e<a.length;e++){const t=a[e],l=i(t,t.index);if(l==n&&(p=l,d=e),l==r){u=e;break}}const h={rowKey:p,dataIndex:o[Math.min(l,c)].dataIndex,rowSpan:u-d+1,colSpan:Math.abs(c-l+1)};O([...s.filter((e=>!(e.rowKey===h.rowKey&&e.dataIndex===h.dataIndex))),h])},j=()=>{let e=g.rowKey;const t=g.colIndex;for(let t=0;t<a.length;t++){const n=a[t],r=i(n,n.index);if(r==e){e=r;break}}const n=e,r=o[t].dataIndex;O(s.filter((e=>!(e.rowKey===n&&e.dataIndex===r))))},q=()=>{const{w:e,h:t,l:n,t:r}=g;let{w:i,h:l,l:a,t:o}=y;return i=a-n>0?a-n+i:Math.abs(a-n)+e,l=o-r>0?o-r+l:Math.abs(o-r)+t,a=a>n?n:a,o=o>r?r:o,{sl:n,st:r,sw:e,sh:t,el:a,et:o,ew:i,eh:l}};return t.createElement("div",{className:`${l}--area-select`},(()=>{if(!g||!y)return null;const{sl:e,st:n,sw:r,sh:i,el:l,et:a,ew:o,eh:s}=q(),{open:c,offsetX:d,offsetY:u}=x||kp,h=t.createElement("ul",{ref:m,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:$},p("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:j},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(tc,{popupVisible:c,popup:h,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:Xd.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}})))})())}));Lp.displayName="AreaSelect";const Ap=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:C,setSelectionKeysEffect:w,setHighlightKey:S,getStickyLeft:N,getStickyRight:T,setPingLeft:I,setPingRight:R,setFullScreen:O,findParentRowKeys:k,getAllChildRowKeys:L,scrollBottomDebouncer:A}=t.useContext(Pd),{height:P,minHeight:D,maxHeight:_,rowHeight:F,rowSelection:H,rowHighlight:M,expandable:$,stripe:j,summation:q,rowStyle:K,cellStyle:V,spanMethod:z,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:ae,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de,indent:ue,dropOptions:pe}=mp({openDragSort:Y}),{rowVirtualizer:he,columnVirtualizer:fe,virtualRows:ge,virtualColumns:ve,resetItemXSize:ye,getYIndexes:be,virtualTranslateY:xe,virtualTranslateX:Ee,calcVirtualYSize:Ce,calcVirtualXSize:we,scrollToYIndex:Se}=((e,n)=>{const{tableRef:r}=t.useContext(Pd),{scrollBarRef:i,rowHeight:l}=r.current,a=()=>i.current.container.children[0],o=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]),s=sp({count:e.length,getScrollElement:a,estimateSize:()=>l,indexAttribute:"data-row-index",overscan:1,enabled:r.current.scrollYLoad}),c=s.getVirtualItems(),d=sp({horizontal:!0,count:n.length,getScrollElement:a,estimateSize:e=>n[e].width||n[e].renderWidth||0,indexAttribute:"data-col-index",overscan:1,enabled:r.current.scrollXLoad,rangeExtractor:e=>[...new Set([...o[0],...Zu(e),...o[1]])]}),u=d.getVirtualItems();return{rowVirtualizer:s,columnVirtualizer:d,virtualRows:c,virtualColumns:u,resetItemXSize:e=>{e.forEach(((e,t)=>{d.resizeItem(t,e.width||e.renderWidth)}))},getYIndexes:()=>s.getIndexes()||[],getXIndexes:()=>d.getIndexes()||[],virtualTranslateY:()=>{var e,t;return null!==(t=null===(e=c[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},virtualTranslateX:()=>{var e,t,n,r,i,l,a;const s=o[0].length;return s?(null===(n=u[s])||void 0===n?void 0:n.index)===s?null!==(i=null===(r=u[0])||void 0===r?void 0:r.start)&&void 0!==i?i:0:(null!==(a=null===(l=u[s])||void 0===l?void 0:l.start)&&void 0!==a?a:0)-u.slice(0,s).reduce(((e,t)=>e+t.size),0):null!==(t=null===(e=u[0])||void 0===e?void 0:e.start)&&void 0!==t?t:0},calcVirtualYSize:()=>s.getTotalSize()||void 0,calcVirtualXSize:()=>d.getTotalSize()||void 0,scrollToYIndex:e=>{s.scrollToIndex(e)},scrollToXIndex:e=>{d.scrollToIndex(e)}}})(a,o),Ne=e=>{if(e&&!U)return he.measureElement(e)},[Te,Ie]=t.useState([]),Re=bp();yp({ref:ee,omitClassNames:[`.${Xd.popupClassName}`],handler:()=>{var e;Ke([]),null===(e=ne.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:Ke,createFocus:Fe,forceUpdate:Re,resetItemXSize:ye,scrollToYIndex:Se}))),Li((()=>{Te.length&&r.current.tableManager.focus(r.current.uid)}),[Te]),t.useLayoutEffect((()=>{De();const e=Ft(document,"keydown",Le);return()=>e.remove()}),[]);const Oe=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:i}=h,l={};return x&&Object.assign(l,{minHeight:"100px"}),D&&Object.assign(l,{minHeight:Jl(D)-e-n+"px"}),_&&Object.assign(l,{maxHeight:Jl(_)-e-n+"px"}),P||r||i?Object.assign(Object.assign({},l),{maxHeight:"",minHeight:"",height:`${t}px`}):l}),[P,_,D,x,h]),ke=An((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:Hn,stopPropagation:Hn}),re.current={prevST:l,prevSL:a}})),Le=An((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&&(Ke([]),S(""),O(!1)),Te.length&&(qi(document.activeElement,ee.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===p&&("radio"===(null==H?void 0:H.type)||M)){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(!$e(Te[0],Te[1])){if(38===p||40===p){Di(e);const t=a.length;let n=a.findIndex((e=>i(e,e.index)===Te[0]));const r=38===p?(--n+t)%t:++n%t,l=a[r],o=i(l,l.index),s=Me(o,Te[1]);"radio"!==(null==H?void 0:H.type)||(null===(d=H.disabled)||void 0===d?void 0:d.call(H,l))||s||w([o]),!M||(null===(u=M.disabled)||void 0===u?void 0:u.call(M,l))||s||S(o),Ae(38===p?"top":"bottom",r),He(...Te),Ke([o,Te[1]])}if(9===p||e.shiftKey&&9===p){if(Di(e),!s.length)return Ke([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Te[1]));const r=e.shiftKey&&9===p?(--n+t)%t:++n%t;He(...Te),Pe(e.shiftKey&&9===p?"left":"right",r),Ke([Te[0],s[r].dataIndex])}}}})),Ae=(e,t)=>{const{scrollBarRef:n,scrollYLoad:i}=r.current;if(i)return he.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)},Pe=(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)},De=()=>{C("$tableBody",ee.current)},Fe=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.focus()},He=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.blur()},Me=(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},$e=(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},je=e=>{const t=q.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},qe=(e,t,n)=>{var l;const{dataIndex:a}=n;if([Xd.expandableColumn,Xd.operationColumn].includes(a))return;const o=i(t,t.index);Ke([o,a]);const s=Me(o,a),{type:c,selectByClickRow:d=!0,disabled:u=Hn}=H||{};!c||u(t)||s||(d||a===Xd.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:i=!0,onSelect:l}=H||{};if("radio"===n&&w([e]),"checkbox"===n){const n=!f.includes(e),a=r.current.isTreeTable&&!i?ze(e,f,n):Ve(e,f,n);w(a),null==l||l(n,t,a)}})(o,t),[Xd.selectionColumn].includes(a)||(!M||(null===(l=M.disabled)||void 0===l?void 0:l.call(M,t))||s||S(o),null==X||X(t,n,e))},Ke=e=>{me(e,Te)||Ie(e)},Ve=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),ze=(e,t,n)=>{var i;const{disabled:l}=H||{},{deriveRowKeys:a,recordsMap:o}=r.current,s=Ul(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=ga(a,e))||void 0===i?void 0:i.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ul(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},We=(e,n,i,l=0)=>{const{scrollXLoad:a}=r.current,{disabled:s}=H||{},c=["body--row",Object.assign({"body--row-striped":j&&n%2!=0,"body--row-selected":f.includes(i)&&!(null==s?void 0:s(e)),"body--row-current":v===i},E?je(e._group):null)],d=(a?ve:o).map(((t,r)=>Be(a?o[t.index]:t,a?t.index:r,e,n,i,l)));return Y?t.createElement(xp,{key:i,ref:Ne,className:_e(c),rowKey:i,rowIndex:n,row:e,indent:ue,filter:".cell--edit input",dropOption:pe,onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:ae,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de},d):t.createElement("tr",{key:i,ref:Ne,"data-row-key":i,"data-row-index":n,className:_e(c)},d)},Be=(e,n,r,i,l,a)=>{var o,s,u;const{dataIndex:h,fixed:m,align:f,className:g=""}=e,{rowSpan:v,colSpan:y}=Ue(r,e,i,n);if(!v||!y)return null;const b=null!==(o=e.ellipsis)&&void 0!==o?o:U,x=["body--column",{"col--ellipsis":b,"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!p[h],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&(null===(s=c[c.length-y])||void 0===s?void 0:s.dataIndex)===h,"cell-fix-right-first":"right"===m&&(null===(u=d[0])||void 0===u?void 0:u.dataIndex)===h,[g]:!!g}],C={left:"left"===m?`${N(h)}px`:"",right:"right"===m?`${T(h)}px`:""},w=K?"function"==typeof K?K(r,i):K:null,S=V?"function"==typeof V?V(r,e,i,n):V:null,I=E?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=q.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,R=Object.assign({},C,{height:F},I,w,S);return t.createElement("td",{key:h,"data-col-index":n,rowSpan:v>1?v:void 0,colSpan:y>1?y:void 0,className:_e(x),style:R,onClick:t=>qe(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn].includes(r)||null==Q||Q(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn].includes(r)||null==Z||Z(t,n,e)})(t,r,e)},t.createElement(Rp,{ref:e=>te.current[`${l}-${h}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:l,depth:a,showTitle:b}))},Ue=(e,t,n,r)=>{var i;let l=1,o=1;const s=z;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]):oe(c)&&(l=c.rowSpan,o=c.colSpan);const d=null!==(i=be()[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(u.length>0){const e=u.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(ol,{ref:r.current.scrollBarRef,wrapClassName:`${l}--body-wrapper`,wrapStyle:Oe,innerStyle:{height:Ce(),width:we()},showTopScrollbar:null==W?void 0:W.doubleXScrollbar,onScroll:ke},t.createElement(Uu.Provider,{value:Te},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,n=0)=>{const{scrollYLoad:l}=r.current,o=[],s=l?e:a;return s.forEach(((e,r)=>{const c=l?a[e.index]:e,d=l?e.index:r,u=i(c,c.index);if(o.push(We(c,d,u,n)),null==$?void 0:$.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=Mn}=$;g.includes(u)&&n(c)&&o.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:s.length,className:"body--column",style:{paddingLeft:H?2*Xd.selectionColumnWidth:Xd.selectionColumnWidth}},t.createElement("div",{className:_e("cell",e)},$.expandedRowRender(c,d)))))}})),o})(ge)))),!!B&&t.createElement(Lp,{ref:ne})))}));Ap.displayName="TableBody";const Pp=()=>{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(Pd),{footRender:p}=e.current.props,{t:h}=Ln(),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):ta(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 Dp;!function(e){e.small="small",e.middle="default",e.large="default"}(Dp||(Dp={}));const _p=e=>{var n,r,i,l;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(en),{tableRef:u,prefixCls:p,$size:h,setElementStore:m}=t.useContext(Pd),{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:Xd.pagination.showSizeChanger,C=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:Xd.pagination.showQuickJumper,w=(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)||Xd.pagination.pageSizeOptions,S=()=>kn(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=>kn(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)=>kn(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(iu,{total:s})),t.createElement(Q,{size:Dp[h],showSizeChanger:E,showQuickJumper:C,pageSizeOptions:w,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},Fp=()=>{const{prefixCls:e,layout:n}=t.useContext(Pd),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(Gi,null))},Hp=()=>{const{prefixCls:e,setElementStore:n}=t.useContext(Pd),r=t.useRef(null);t.useLayoutEffect((()=>{i()}),[]);const i=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},Mp=t.forwardRef(((e,n)=>{const r=an(_d,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}=Pn(r),C=t.useRef(null),w=t.useRef(null),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=Jn("table"),R=An(((e,t)=>{const n="function"==typeof i?i(e,t):null==e?void 0:e[i];return void 0===n?(Yn("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:D,setAllTableData:_,setDeriveRowKeys:F,setInvalidRowKeys:H,setFieldAuth:M,setColumnsDefined:$,setScrollXLoad:j,setScrollYLoad:q,setResizeState:K,setHandleState:V,setSummaries:z,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:Bd(),tableManager:Gd,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!l,scrollBarRef:t.createRef(),rowHeight:i||Xd.rowHeightMaps[r],store:new Yd,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:!Dn&&/MSIE|Trident/.test(navigator.userAgent)});var o;o=e,a.current.props=o;const s=(e,t,r="",i="",l=0)=>e.map((e=>{const a=n(e,e.index),o=r?`${r}#${a}`:`${a}`,c=i?`${i}.${e.index+1}`:`${e.index+1}`,d={level:l,rowKey:a,rowKeyPath:o,indexPath:c};return e.indexPath=c,e._level=l,Array.isArray(e.children)&&(d.children=s(e.children,a,o,c,l+1)),t?Object.assign({},d,{parentRowKey:t}):d})),c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};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=Gl(e);a.current.allTableData=t,a.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{const t=a.current.tableFullData.some((e=>Array.isArray(e.children)));a.current.isTreeTable=t,a.current.deriveRowKeys=t?s(e,""):[],a.current.flattenRowKeys=t?c(a.current.deriveRowKeys):[]},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:ae,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:pe,setHighlightKey:he,updateMark:ge,forceUpdate:ve,mergedTdCells:ye,setMergedCells:be,layout:xe,setLayout:Ee,permission:Ce,setPermission:we,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(en),C={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:Xd.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:Xd.pagination.pageSize,total:0},w=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)=>me(e,t)?e:t),f),[O,k]=t.useReducer(((e,t)=>me(e,t)?e:t),m),[L,A]=t.useReducer(((e,t)=>me(e,t)?e:t),[]),[P,D]=t.useState(C),[_,F]=t.useReducer(((e,t)=>me(e,t)?e:t),w),[H,M]=t.useReducer(((e,t)=>me(e,t)?e:t),S),[$,j]=t.useState(null!==(p=null==b?void 0:b.currentRowKey)&&void 0!==p?p:""),[q,K]=t.useReducer((e=>e+1),0),[V,z]=Zd([],{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:D,selectionKeys:_,setSelectionKeys:F,rowExpandedKeys:H,setRowExpandedKeys:M,highlightKey:$,setHighlightKey:j,updateMark:q,forceUpdate:K,mergedTdCells:V,setMergedCells:z,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:Fe,showPagination:He,tableColumns:Me,flattenColumns:$e,editableColumns:je,summationColumns:qe,leftFixedColumns:Ke,rightFixedColumns:Ve,derivedMergeCells:ze,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}=eu(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}=nu(r,{getRowKey:R,tableRef:O,topElementRef:C,tableElementRef:w,tableBodyRef:S,$size:E,tableColumns:Me,flattenColumns:$e,leftFixedColumns:Ke,derivedMergeCells:ze,tableFlatData:Q,layout:xe,showFooter:Ue,showPagination:He,isFullScreen:ke,setLayout:Ee,setElementStore:L,setShouldToTop:B}),{initialTable:xt,checkDataIndex:Et,createTableFullData:Ct,getTableData:wt,createTableList:St,createTableData:Nt,createGroupData:Tt,createSelectionKeys:It,createRowExpandedKeys:Rt,setSelectionKeysEffect:Ot,findParentRowKeys:kt,getAllChildRowKeys:Lt,doFieldValidate:At,getTableLog:Pt,dataChange:Dt,tableChange:_t,toLastPage:Ft,toFirstPage:Ht,getPageCount:Mt,pagerChangeHandle:$t,scrollBottomDebouncer:jt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:Vt,clearRowSelection:zt,clearRowHighlight:Wt,clearTableLog:Bt,destroy:Ut}=tu(r,{getRowKey:R,tableRef:O,tableElementRef:w,tableBodyRef:S,$size:E,tableColumns:Me,flattenColumns:$e,tableFullData:k,pagination:le,layout:xe,filters:J,sorter:te,superFilters:re,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,summationColumns:qe,isFetch:Pe,isWebPagination:De,isScrollPagination:Fe,isServiceSummation:Ze,isGroupSubtotal:at,doLayout:bt,setTableFlatData:Z,setTableFullData:P,setTableOriginData:D,setAllTableData:_,setDeriveRowKeys:F,setPagination:ae,setPingRight:Oe,setPingLeft:Ie,setSpinning:Ne,setSorter:ne,setFilters:ee,setSuperFilters:ie,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:he,setSelectionRows:W,setScrollXLoad:j,setScrollYLoad:q,setFieldAuth:M,setResizeState:K,setSummaries:z,setPermission:we,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:C,setHandleState:w,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:T,setRowExpandedKeys:I,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:L,createSelectionKeys:A,createRowExpandedKeys:P,initialTable:D,destroy:_}=n,F=t.useRef(f);Li((()=>{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),Ql(p)}),[p]),Li((()=>{if(!a)return;const{onChange:e}=a;h.__prevent__||null==e||e(h,h.map((e=>s.current.recordsMap.get(e)))),Ql(h)}),[h]),Li((()=>{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]),Li((()=>{var e;me(f,F.current)||(F.current=f,g&&i&&(null===(e=i.onChange)||void 0===e||e.call(i,f)))}),[f]),Li((()=>{const e=A(l.selectedRowKeys);me(e,p)||N(Xl(e))}),[null==l?void 0:l.selectedRowKeys]),Li((()=>{const e=P(a.expandedRowKeys);me(e,h)||I(Xl(e))}),[null==a?void 0:a.expandedRowKeys]),Li((()=>{const{currentRowKey:e}=o;e!==m&&R(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),Li((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>C()&&x(),(e||t)&&w({insert:null,remove:!1})}),[u.total]),Li((()=>{L()}),[d]),Li((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||Yn("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),ru({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(Wn(r)),D(),b(),jn((()=>L())),()=>{_(),k(!0)})),[])})(r,{tableRef:O,tableBodyRef:S,$size:E,pagination:le,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,showSummary:Be,summationRows:st,isWebPagination:De,isScrollPagination:Fe,checkDataIndex:Et,toLastPage:Ft,toFirstPage:Ht,getPageCount:Mt,setHandleState:V,scrollYToRecord:gt,setOriginColumns:A,setSelectionKeysEffect:Ot,setRowExpandedKeys:ue,setHighlightKey:he,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:je,leftFixedColumns:Ke,rightFixedColumns:Ve,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:ze,updateMark:ge,isFetch:Pe,isPingLeft:Te,isPingRight:Re,isHeadSorter:Xe,isHeadFilter:Qe,isFullScreen:ke,isTableEmpty:ot,isHeadGroup:Ge,isGroupSubtotal:at,isWebPagination:De,dataChange:Dt,tableChange:_t,getTableData:wt,setElementStore:L,createTableList:St,createTableFullData:Ct,updateTableFlatData:Ae,setSorter:ne,setFilters:ee,setSuperFilters:ie,setHighlightKey:he,setRowExpandedKeys:ue,setSelectionRows:W,setSelectionKeysEffect:Ot,setInvalidRowKeys:H,setMergedCells:be,getSpan:pt,getStickyLeft:ht,getStickyRight:mt,scrollXToColumn:ft,scrollYToRecord:gt,setPagination:ae,setPingLeft:Ie,setPingRight:Oe,setSpinning:Ne,setFullScreen:Le,setShouldToTop:B,doFieldValidate:At,createTableData:Nt,createGroupData:Tt,findParentRowKeys:kt,getAllChildRowKeys:Lt,scrollBottomDebouncer:jt,resetTableScroll:yt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:Vt,clearRowSelection:zt,clearRowHighlight:Wt})),[E,Q,$e,te,J,re,xe,Ye,Ue,Be,st,le,ct,se,de,pe,ze,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:C,doFieldValidate:w,setTableOriginData:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:D,clearRowHighlight:_,clearTableSorter:F,clearTableFilter:H,clearSuperFilters:M,clearTableLog:$}=n,{columns:j,columnsChange:q}=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=>kn(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(),_(),F(),H(),M(),$(),y([]))},CLEAR_LOG:()=>{$()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?Xl([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?Xl([...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=Vl(j,e);if(!r)return Yn("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!oe(t))return Yn("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return Yn("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&fe(r,e,t[e]);n&&(q?q([...j]):Yn("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:l}=i.current,a=(Array.isArray(e)?e:[e]).filter((e=>oe(e)));if(!a.length)return;a.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn].includes(n)||na(e,n,ta(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=va(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=>oe(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)&&_(),R(h.filter((e=>!l.includes(e)))),g(),jn((()=>{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||w(d,ta(n,l),c,l,ua(a))}))}));const{required:n,validate:l}=P(),a=[...n,...l];return a.length&&C(a[0].rowKey),A(),{required:n,validate:l}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:$e,editableColumns:je,pagination:le,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,isFetch:Pe,dataChange:Dt,getTableData:wt,createTableData:Nt,createTableFullData:Ct,calcTableHeight:vt,scrollXToColumn:ft,scrollYToRecord:gt,doFieldValidate:At,setTableOriginData:D,setHandleState:V,setColumnsDefined:$,setSelectionKeysEffect:Ot,setRowExpandedKeys:ue,setHighlightKey:he,setSelectionRows:W,setOriginColumns:A,forceUpdate:ve,getTableLog:Pt,clearRowSelection:zt,clearRowHighlight:Wt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:Vt,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||Ve.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(Pd.Provider,{value:Gt},t.createElement("div",{className:_e(Yt,b),style:x},m&&t.createElement("div",{ref:C,className:`${I}-top`},t.createElement("div",{className:`${I}-top__space`},"bottom"!==(null==p?void 0:p.position)&&t.createElement(iu,{total:le.total}),t.createElement("div",{className:`${I}-top__space-slot`,style:{justifyContent:Vd[h]}},r.children)),t.createElement("div",{className:`${I}-top__actions`},t.createElement(Fu,{ref:N,showFullScreen:f,showReload:g&&Pe,showPrint:Ce.print&&!!d,showImport:Ce.import&&et,showExport:Ce.export&&!!u,showClipboard:tt,showCollection:Je,showFastSearch:rt,showSuperSearch:nt,showPivotGrid:it,showGroupSummary:lt,showToolBox:v,tableColumns:Me}),t.createElement(Mu,{ref:T,columns:l}))),t.createElement(Yi,{spinning:null!=a?a:Se},t.createElement("div",{ref:w,className:_e(Xt),style:ut},t.createElement("div",{className:`${I}--main-wrapper`},y&&t.createElement(Bu,{tableColumns:Me}),t.createElement(Ap,{ref:S}),Ue&&t.createElement(Pp,null)),Ye&&t.createElement("div",{className:`${I}--border-line`}),ot&&t.createElement(Fp,null),o&&t.createElement(Hp,null))),He&&t.createElement(_p,Cn({},le,{onChange:(e,t)=>$t({current:e,pageSize:t})}))))}));Mp.displayName="QmTable";const $p=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}=Pn(e),{t:m}=Ln(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=tl(f),[b,x]=t.useState(c),[E,C]=t.useState(),[w,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,D]=t.useState(ye({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[_,F]=t.useState([]),H=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*bo[h]-30)},M=nl(H,5);sn((()=>{M()}),[y.width]),Li((()=>{me(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 $=()=>kn(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=Mn}=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=pe(t.data,l))&&void 0!==e?e:[];i||(S([]),yield $n(0)),F(n)}}catch(e){}T(!1)}})),j=e=>{i||(C(e),p(e))},q=e=>{D(Object.assign({},P,e))},K={[`${Jn("search-helper")}--wrapper`]:!0},V=b.webPagination?{dataSource:_,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(rd,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>H(),onFinish:e=>q(e),onReset:()=>kn(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||q(t)}))}):null),t.createElement("div",null,t.createElement(Mp,Cn({ref:v,uniqueKey:r,height:I,columns:L,rowKey:b.rowKey||"pageIndex"},V,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{S(e),C(i?t:t[0])}},paginationConfig:b.paginationConfig,columnsChange:e=>A(e),onRowDblclick:j,onRowEnter:j}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${bo[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Xn,{onClick:()=>p(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(Xn,{type:"primary",disabled:!E,onClick:()=>p(E,i?w:void 0)},m("qm.dialog.confirm"))))};$p.displayName="QmSearchHelper";const jp=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...jp(e.children)),e.children&&t.push(e.value)})),t},qp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=qp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Kp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Kp(e.children,t),t(e)||e.children&&e.children.length))),Vp=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}=Pn(e),{t:f}=Ln(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=tl(g),[x,E]=t.useState(c),[C,w]=t.useState(),[S,N]=t.useState(o),[T,I]=t.useState(!1),[R,k]=t.useState(300),[L,A]=t.useState(300),[P,D]=t.useState(s),[_,F]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[H,M]=t.useState(ye({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[$,j]=t.useState([]),q=()=>{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*bo[m]-30)},K=nl(q,5);sn((()=>{K()}),[b.width]),Li((()=>{me(s,P)||D(s)}),[s]),t.useEffect((()=>{V()}),[H]),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 V=()=>kn(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=Mn}=n;if(a(H)){I(!0);try{const t=yield r(H);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=pe(t.data,l))&&void 0!==e?e:[];i||(N([]),yield $n(0)),j(n)}}catch(e){}I(!1)}})),z=e=>{i||(w(e),h(e))},W=e=>{M(Object.assign({},H,e))},[B,U]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),J=t.useRef(B),ee=t.useRef([]);Li((()=>{X(jp(B))}),[B]);const te=()=>kn(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=pe(a.data,r))&&void 0!==e?e:[],n=Ma(t,i,l);U(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${to.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${Jn("tree-table-helper")}--wrapper`]:!0},ie=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:H})};return t.createElement("div",{ref:g,className:_e(re,u),style:p},t.createElement(Bi,{defaultValue:200,style:{height:"100%"}},t.createElement(Bi.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(Ye,null),allowClear:!0,onChange:e=>(e=>{const t=Kp(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 Yn("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=pe(e,t[r]);W(n)})(qp(ee.current,(n=>pe(n,t)===e[0]))||{})}})),t.createElement(Bi.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},P.length?t.createElement(rd,{ref:v,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>D(e),onCollapse:()=>q(),onFinish:e=>W(e),onReset:()=>kn(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(Mp,Cn({ref:y,uniqueKey:r,height:L,columns:_,rowKey:x.rowKey||"pageIndex"},ie,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),w(i?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>F(e),onRowDblclick:z,onRowEnter:z}))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${bo[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Xn,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(Xn,{type:"primary",disabled:!C,onClick:()=>h(C,i?S:void 0)},f("qm.dialog.confirm"))))};Vp.displayName="TreeTableHelper";const zp=e=>{var n,r,i;const{multiple:l,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=Pn(e),{t:p}=Ln(),[h,m]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${Jn("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},zn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:_e(g,s),style:c},t.createElement(Ad,{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:`${bo[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Xn,{onClick:()=>d(null),style:{marginRight:8}},p("qm.dialog.cancel")),t.createElement(Xn,{type:"primary",disabled:!h,onClick:()=>d(h)},p("qm.dialog.confirm"))))};zp.displayName="TreeHelper";const Wp="_startSign",Bp="_endSign",Up=e=>{var n;const{uniqueKey:r,initialValue:i,filters:l=[],table:a={},onClose:o}=e,{$size:s}=Pn(e),{t:c}=Ln(),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=tl(d),[m,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[C,w]=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:Wp,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:Bp,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[T,I]=t.useState(ye({},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*bo[s]-30)},D=nl(P,5);sn((()=>{D()}),[h.width]),Li((()=>{me(l,C)||w(l)}),[l]),t.useEffect((()=>{_()}),[T]);const _=()=>kn(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=Mn}=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=pe(t.data,i))&&void 0!==e?e:[];k(n)}}catch(e){}v(!1)}})),F=(e,t)=>{delete e[t]},H=()=>{y.forEach((e=>{e&&(F(e,Wp),F(e,Bp))})),b([])},M=e=>{H(),I(Object.assign({},T,e))},$=Jn("range-helper"),j=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"},C.length?t.createElement(rd,{ref:u,items:C,initialValues:i,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>P(),onFinish:e=>M(e),onReset:()=>kn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||M(t)}))}):null),t.createElement("div",null,t.createElement(Mp,Cn({ref:p,height:x,columns:S,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[Wp,Bp].includes(n)&&(n===Wp&&(e[n]?(F(e,n),b([void 0,y[1]])):e.pageIndex>L[1]?R.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&F(y[0],n),e[n]="[",b([e,y[1]]))),n===Bp&&(e[n]?(F(e,n),b([y[0],void 0])):e.pageIndex<L[0]?R.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&F(y[1],n),e[n]="]",b([y[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[Wp]="["),e.pageIndex===L[1]&&(e[Bp]="]")}))}}),t.createElement(Xn,{type:"primary",icon:t.createElement(xt,null),title:c("qm.table.alert.clear"),onClick:()=>H()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${bo[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Xn,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(Xn,{type:"primary",disabled:!A,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[Wp,Bp].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};Up.displayName="RangeTableHelper";const Gp=e=>null!=e;function Yp(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]),ru({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 Xp=8;const Qp={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"]}},Zp={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"]}},Jp=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function eh(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:l,visibleFirst:a}=e,o=t/2,s={};return Object.keys(Qp).forEach((e=>{const c=r&&Zp[e]||Qp[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,Jp.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?Xp: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]=-u.arrowOffsetHorizontal-o;break;case"leftBottom":case"rightBottom":d.offset[1]=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 th={fill:"transparent",pointerEvents:"auto"},nh=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-${Bd()}`,p="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(Wt,{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",Cn({},i?null:th,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),i&&t.createElement(t.Fragment,null,t.createElement("rect",Cn({},th,{x:"0",y:"0",width:"100%",height:`${i.top}px`})),t.createElement("rect",Cn({},th,{x:"0",y:"0",width:i.left,height:"100%"})),t.createElement("rect",Cn({},th,{x:"0",y:i.top+i.height,width:"100%",height:`calc(100vh - ${i.top+i.height}px)`})),t.createElement("rect",Cn({},th,{x:i.left+i.width,y:"0",width:`calc(100vw - ${i.left+i.width}px)`,height:"100%"})))):null))},rh=e=>{const{prefixCls:n,zIndex:r,open:i,onPause:l,onPlay:a}=e,[o,s]=Zd(void 0,{value:i,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=An((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));t.useEffect((()=>{const e=Ft(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-$i(t).x,o=e.clientY-$i(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),Fi(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(Et,null):t.createElement(Ct,null))},ih=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}=Ln(),y="primary"!==c?"primary":"default",b=An((e=>{w(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=Ft(document,"keyup",b);return()=>e.remove()}),[]);const x=Gp(l)?t.createElement("div",{className:`${n}-cover`},l):null,E=Gp(o)?t.createElement("div",{className:`${n}-description`},o):null;let C;C=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 w=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:_e(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(Xe,{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`},C),t.createElement(Zn,{className:`${n}-buttons`},0!==r?t.createElement(Xn,{className:`${n}-prev-btn`,size:"small",onMouseDown:w,onClick:p},v("qm.tour.prevStep")):null,r===i-1?t.createElement(Xn,{className:`${n}-finish-btn`,type:y,size:"small",onClick:m},v("qm.tour.finish")):t.createElement(Xn,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},v("qm.tour.nextStep"))))))},lh=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(ih,e))},ah={left:"50%",top:"50%",width:1,height:1},oh=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:C=!0,scrollIntoViewOptions:w=!0}=e,S=Rn(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]=Zd(0,{value:l,defaultValue:i}),[R,O]=Zd(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=Zd(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),D=t.useRef(R);t.useLayoutEffect((()=>{R&&!D.current&&I(0),D.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:_,type:F,placement:H,trigger:M,delay:$,style:j,arrow:q,className:K,mask:V,scrollIntoViewOptions:z,zIndex:W,action:B}=r[T]||{},U=W||k,G=F||d,Y=R&&(null!=V?V:u),X=null!=z?z:w,[Q,Z]=Yp(_,!!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,H),ee=!!Z&&(void 0===q?p:q),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),Li((()=>{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"===_i(r=n,"display")||"hidden"===_i(r,"visibility")||"0"===_i(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=()=>kn(void 0,void 0,void 0,(function*(){if(!M||!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(M,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:l}),o=document.elementFromPoint(i,l);o&&(o.dispatchEvent(a),yield $n(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,j),ce=Jn("tour"),de=[{[`${ce}-primary`]:"primary"===G},m,K],ue=eh({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(nh,{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:C,rootClassName:m}),t.createElement(Wt,{open:A,autoLock:!0},t.createElement(Bt,Cn({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:_e(de),prefixCls:ce,popup:()=>t.createElement(lh,Cn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>kn(void 0,void 0,void 0,(function*(){yield le(),ne(T-1)})),onNext:()=>kn(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||ah),{position:"fixed",pointerEvents:"none"})}))),h&&t.createElement(Wt,{open:R},t.createElement(rh,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));oh.displayName="QmTour";const sh=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ch=e=>({_s:e,status:sh[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),dh=e=>e?6:5,uh=(e,t,n,r,i)=>{clearTimeout(r.current);const l=ch(e);t(l),n.current=l,null==i||i({current:l})},ph=(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((()=>ch(s?2:dh(c)))),g=l(m),v=l(),[y,b]=(e=>oe(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 dh(t)}})(g.current._s,d);e&&uh(e,f,g,v,h)}),[h,d]),E=p((e=>{const l=e=>{switch(uh(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:dh(d))}),[x,h,t,n,r,i,y,b,d]);return o((()=>()=>clearTimeout(v.current)),[]),[m,E,x]},hh=e=>{const{name:n,in:r,timeout:i,preEnter:l=!0,preExit:a}=e,[o,s]=ph({timeout:i,preEnter:l,preExit:a,initialEntered:r});return sn((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?Tp(e,{className:_e(e.props.className,n,o.status)}):e)))};var mh={previewWidth:1100,defaultDistance:.45,logoHeight:60};const fh=n(void 0);var gh=null;function vh(){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 yh(e,t){var n;try{var r=navigator.userAgent,i=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(vh()){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:gh?n=gh:((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),gh=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&vh(),n}catch(e){R.error("getLodop 出错:"+e)}}vh();const bh=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)},xh=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:i}=e,{global:l}=t.useContext(en),{$$preview:a}=t.useContext(fh),{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}))),Li((()=>{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*mh.defaultDistance+10*mh.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*mh.defaultDistance+10*mh.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return bh(v-10*(e.left-mh.defaultDistance)-10*(e.right-mh.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return bh(y-10*(e.top-mh.defaultDistance)-10*(e.bottom-mh.defaultDistance))}),[o,y]),E=o.form.scale,C=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:bh(10*e.left),right:bh(10*e.right),top:bh(10*e.top),bottom:bh(10*e.bottom)}}),[o]),w=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:i}=C,l=b+t+n,a=mh.previewWidth-l<=0?0:(mh.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>mh.previewWidth?0:a>0?s:(mh.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,C,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: ${mh.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-mh.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+=mh.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=()=>kn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return D();u.current.previewEl.innerHTML||(T(),yield $n(0),I(),R(),g(!1))})),P=()=>kn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return D();T(),yield $n(0),I(),R(),g(!1),a.doPrint(k()),yield $n(0),a.doClose()})),D=()=>{Yn("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_={[Jn("print-container")]:!0,"no-visible":i};return t.createElement("div",{ref:d,className:_e(_)},t.createElement(Yi,{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:w}))))}));xh.displayName="Container";class Eh extends s{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:ln("qm.print.setPanel.printParameter")},{type:"SELECT",label:ln("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:ln("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:ln("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:ln("qm.print.setPanel.vertical"),value:"vertical"},{text:ln("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:ln("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:ln("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:ln("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:ln("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:ln("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:ln("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:ln("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:ln("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:ln("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:ln("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:ln("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:ln("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:ln("qm.print.setPanel.sizeUnit"),disright:ln("qm.print.setPanel.sizeUnit"),distop:ln("qm.print.setPanel.sizeUnit"),disbottom:ln("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>kn(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(rd,{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(Xn,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},ln("qm.dialog.close")),t.createElement(Xn,{type:"primary",onClick:()=>this.confirmHandle()},ln("qm.dialog.confirm"))))}}Eh.contextType=en;class Ch 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:mh.defaultDistance,right:mh.defaultDistance,top:mh.defaultDistance,bottom:mh.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=()=>kn(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 Qt.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=>kn(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)=>kn(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=yh();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}=mh,{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(ln("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=yh();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(ln("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:ln("qm.print.laserPrinter"),value:"laser"},{text:ln("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=yh(),t=[{text:ln("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){Yn("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 kn(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield Qt.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),oe(n)&&(yield Qt.setItem(this.printerKey,n))),oe(n)&&Object.keys(n).length&&ye(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=Jn("print-preview"),c={visible:r,title:ln("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,ln("qm.print.printer"),":",t.createElement(F,{value:i.printerName,onChange:e=>{this.setState((t=>ye({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(F.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,ln("qm.print.type"),":",t.createElement(F,{value:i.printerType,onChange:e=>{this.setState((t=>ye({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(F.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,ln("qm.print.copies"),":",t.createElement($,{value:i.copies,min:1,precision:0,onChange:e=>{this.setState((t=>ye({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,ln("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"}}),ln("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(Xn,{type:"text",icon:t.createElement(ot,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},ln("qm.print.setting"))),t.createElement("span",null,t.createElement(Xn,{type:"text",icon:t.createElement(Ve,null),className:"text-btn",onClick:()=>this.exportClickHandle()},ln("qm.print.export"))),t.createElement("span",null,t.createElement(Xn,{icon:t.createElement(lt,null),type:"primary",onClick:this.printClickHandle},ln("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(fh.Provider,{value:this.provide},t.createElement(xh,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,ln("qm.print.scale"),":",t.createElement(Z,{value:i.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>ye({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*i.scale)}%`)),t.createElement("span",null,ln("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,ln("qm.print.pageNumber"),":",ln("qm.print.pagination",{currentPage:l,totalPage:a}))))),t.createElement(wl,c,t.createElement(Eh,{setting:i.setting,onChange:e=>{this.setState((t=>ye({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(fh.Provider,{value:this.provide},t.createElement(xh,{ref:this.containRef,templateRender:n,directPrint:!0}))}}Ch.contextType=en;class wh extends s{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>kn(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:ln("qm.print.preview"),width:`${mh.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(wl,o,t.createElement(Ch,s)):e?t.createElement(Ch,s):null},this.DO_PRINT=()=>kn(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield $n(0),this.setState({visible:!0}),yield $n(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(Xn,o,this.props.children),this.createRender())}}function Sh(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Nh(e){const t=Sh(e);return t?t.frameElement:null}function Th(e){const t=Oh(e);return Ih([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Ih(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 Rh(e,t){const n=Nh(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let i=n,l=!1;for(;i;){const e=Th(i);if(r.push(e),i=Nh(i),l)break;i&&Sh(i)===t&&(l=!0)}return Ih(r)}return e.getBoundingClientRect()}function Oh(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)}}wh.propTypes={size:(e,t,n)=>{if(!xa(e[t]||""))return Gn("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:qt.elementType},wh.defaultProps={preview:!0,type:"primary",icon:t.createElement(lt,null)},wh.contextType=en;const kh=Object.assign;class Lh{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=_h.border,this.padding.style.borderColor=_h.padding,this.content.style.backgroundColor=_h.background,kh(this.node.style,{borderColor:_h.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){Dh(t,"margin",this.node),Dh(t,"border",this.border),Dh(t,"padding",this.padding),kh(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"}),kh(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class Ah{constructor(e,t){this.tip=e.createElement("div"),kh(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),kh(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),kh(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});kh(this.tip.style,r.style)}}class Ph{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 Ah(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 Lh(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=Rh(e,this.window),i=Oh(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=Rh(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 Dh(e,t,n){kh(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 _h={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 Fh=null,Hh=null;function Mh(){null!=window.document&&(Fh=null,null!==Hh&&(Hh.remove(),Hh=null))}class $h{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=>qi(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Mh();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!==Fh&&clearTimeout(Fh),null!=n&&(null===Hh&&(Hh=new Ph),Hh.inspect(n,r),i&&(Fh=setTimeout((()=>Mh()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=De((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(){Mh(),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 jh(e){return document.querySelector(e)}const qh=e=>{const{action:n,onConfirm:r,onCancel:i,onFinish:l}=e,{t:a}=Ln();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(Zn,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(Xn,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.closeButton")),t.createElement(Xn,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(Xn,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.finishButton"))))},Kh={left:"50%",top:"50%",width:1,height:1},Vh=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}=Ln(),E=t.useRef(),C=t.useRef(a.length),[S,N]=Zd(0,{value:i,defaultValue:l}),[T,I]=Zd(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=Zd(1051,{value:h,defaultValue:h}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[D,_]=t.useState(T),[F,H]=t.useState(!1),[$,j]=Yp(k.node,!!r),[q,K]=t.useState(22),V=t.useRef(!1),z=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),W=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new $h({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:ca(),node:e,path:t}),N(C.current),P(!0),U(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?B():U(),T?setTimeout((()=>_(!0)),16):_(!1),()=>{U()})),[T]),t.useEffect((()=>{C.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=Jn("guide-tracker"),Q=[{[`${Y}-primary`]:!0}],Z=eh({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Wt,{open:T&&A,autoLock:!0},t.createElement(Bt,{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(Xe,{className:`${Y}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(M,{open:F,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Xt,{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(me(t,n))return;const r=t.findIndex((e=>e===k.id)),i=-1!==r?r:S;N(i),null==v||v(ba(e),i)}},a.map(((e,n)=>t.createElement("li",{key:n,className:_e("item",{actived:e.id===k.id})},t.createElement(Ge,{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:jh(e.selector),path:e.selector}),N(n),K(22===q?q+1:q-1),null==v||v(a,n))}},e.title),t.createElement(w,{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:jh(n),path:n})}N(i),null==v||v(t,i)}},t.createElement(Xe,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>H(e)},t.createElement(St,{className:_e(`${Y}-close`,"menu-icon"),style:{width:q}})),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:z,DO_CLOSE:e},S):t.createElement(qh,{action:z,onConfirm:()=>{null==v||v("add"===z?[...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({},$||Kh),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:G,onClick:G}))),s&&t.createElement(Wt,{open:D},t.createElement(rh,{zIndex:R,prefixCls:Y,onPause:()=>{V.current=A,P(!1),U()},onPlay:()=>{V.current?P(!0):B()}})))}));Vh.displayName="QmGuideTracker";const zh=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:C,className:w,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],D=g[0],_=g[1],F=D/2,H=_/2,M=null!==(c=v[0])&&void 0!==c?c:F,$=null!==(d=v[1])&&void 0!==d?d:H,j=t.useMemo((()=>{const e=M-F,t=$-H;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}}),[F,H,M,$,b]),q=(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({},j),{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=(D+r)*n,s=(_+i)*n,c=D/2*n,d=_/2*n,u=o/2,f=s/2,g=2*(D+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),C&&(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),q(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()},V=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{K()}),[u,p,h,m,f,g,v,y,b,x,E,C]),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=>V(e))),n="attributes"===t.type&&V(t.target);if(e||n){K();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=Jn("watermark");return t.createElement("div",{ref:N,className:_e(z,w),style:Object.assign({position:"relative"},S)},n.children)},Wh=new Map,Bh=new WeakMap;let Uh,Gh=0;function Yh(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(Bh.has(n)||(Gh+=1,Bh.set(n,Gh.toString())),Bh.get(n)):"0"):e[t]}`;var n})).toString()}function Xh(e,t,n={},r=Uh){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=Yh(e);let n=Wh.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},Wh.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(),Wh.delete(i))}}const Qh=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=Xh(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||Yn("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[Jn("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 Zh{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 Jh{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 Jh(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 Zh(o+g,s+v),c2:new Zh(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 em{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 Zh(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=Jh.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)}}em.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})},em.canvasToDataURL=e=>e.toDataURL("image/png",1),em.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const tm=()=>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"})),nm=()=>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"})),rm=()=>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"})),im=()=>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"})),lm=()=>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"})),am=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}=Ln(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),C=[2,4,6],w=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=Zd(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(C[0]),[A,P]=t.useState(I?S[0]:S[4]),[D,_]=t.useState(w[1]),[H,$]=t.useState("bottomLeft"),[j,q]=t.useState(!1),[K,V]=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:D,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new em(b.current,n),()=>y.current.destroy()}),[]);const z=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()};Li((()=>{I&&N&&z()}),[N,I]),Li((()=>{y.current.setDrawMode(R)}),[R]),Li((()=>{y.current.setLineWidth(k)}),[k]),Li((()=>{y.current.setPenColor(A)}),[A]),Li((()=>{y.current.setFontSize(D)}),[D]);const W=()=>kn(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield Ut(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return em.canvasToDataURL(t)}catch(e){Yn("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:z,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"},C.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(F,{size:"small",value:D,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(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=Jn("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(Yi,{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:j})},t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(Nt,null))),t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(tm,null))),t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(rm,null))),t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement(je,null))),t.createElement(M,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(nm,null))),t.createElement("button",{className:"btn",onClick:()=>kn(void 0,void 0,void 0,(function*(){yield kn(void 0,void 0,void 0,(function*(){V(!0);const e=yield W();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):h().format(qd);sl(em.dataURLToBlob(e),`${t}.png`)}V(!1)})),B()}))},t.createElement(Ve,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement(im,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(lm,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(xt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(Xe,null)),t.createElement("button",{className:"btn",onClick:()=>kn(void 0,void 0,void 0,(function*(){V(!0),yield $n(10);const e=yield W();V(!1),B(),null==f||f(e)}))},t.createElement(qe,null))),t.createElement("button",{className:"btn btn-fold",title:v(j?"qm.divider.spread":"qm.divider.collect"),onClick:()=>q(!j)},j?t.createElement(It,null):t.createElement(Tt,null))))))}));am.displayName="QmSignature";const om=t.createContext(void 0),sm=e=>{const{prefixCls:n,flatColumns:r,tableData:i}=e,l=t.useRef({originGridData:i,flatGroupData:[]}),[a,o]=t.useState({pivotRef:l,prefixCls:n,viewMode:"table",size:"middle",columns:r,gridData:i,groupGridData:[],groupList:[],filterList:[],sorterList:[],expandedKeys:[],searchResults:[],switchIndex:0}),s=e=>{o((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}))},c=e=>{a.pivotRef.current=Object.assign({},a.pivotRef.current,e)},d=e=>{s({columns:e})},u=e=>{s({gridData:e})},p=e=>{s({groupGridData:e})},h=e=>{s({groupList:e})},m=e=>{s({filterList:e})},f=e=>{s({sorterList:e})},g=e=>{s({expandedKeys:e})},v=e=>{s({searchResults:e})},y=e=>{s({switchIndex:e})},b=t.useMemo((()=>Object.assign(Object.assign({},a),{setContext:s,setPivotGridRef:c,setColumns:d,setGridData:u,setGroupGridData:p,setGroupList:h,setFilterList:m,setSorterList:f,setExpandedKeys:g,setSearchResults:v,setSwitchIndex:y})),[a]);return t.createElement(om.Provider,{value:b},e.children)},cm=()=>t.useContext(om),dm=()=>{const{prefixCls:e,viewMode:n,setContext:r}=cm();Ln();return t.createElement("div",{className:`${e}-view-mode`},t.createElement(J,{value:n,options:[{label:"表格视图",value:"table"},{label:"甘特视图",value:"gantt"},{label:"看板视图",value:"card"},{label:"图表视图",value:"chart"}],onChange:e=>{r({viewMode:e})}}))};var um={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:12};const pm=e=>[um.selectionColumnDefine,...e].filter((e=>!e.hidden)),hm=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){const{dataIndex:i,width:l,renderWidth:a}=e[r];if(i===t)break;n+=l||a||0}return n+1},mm=(e,t="")=>"object"!=typeof e||null===e?[]:Object.keys(e).reduce(((n,r)=>{const i=t?`${t}.${r}`:r;if(n.push(i),Array.isArray(e[r]))return n;const l=mm(e[r],i);return n.concat(l)}),[]),fm={sum:e=>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=>e.length,unique:e=>new Set(e).size,empty:e=>e.filter((e=>Kn(e))).length,notEmpty:e=>e.filter((e=>!Kn(e))).length},gm=e=>{const t=[];return function e(n,r,i=""){if(Array.isArray(n))for(const e of n)t.push(e);else for(const l in n){const a=i?`${i}-${l}`:l;t.push({id:a,_groupLevel:r}),e(n[l],r+1,a)}}(e,0),t},vm=()=>{const{prefixCls:e,groupList:n,columns:r,gridData:i,setGroupList:l,setExpandedKeys:a,setGroupGridData:o,setPivotGridRef:s}=cm(),{t:c}=Ln(),d=t.useRef([]),u=t.useRef([]),p=t.useMemo((()=>n.filter((e=>e.fieldName&&e.order))),[n]),h=t.useMemo((()=>r.map((e=>({label:e.title,value:e.dataIndex,disabled:n.some((t=>t.fieldName===e.dataIndex))})))),[n,r]),m=t.useMemo((()=>{const e=p.map((e=>({[e.fieldName]:e.order})));return me(e,d.current)?d.current:(d.current=e,e)}),[p]),f=[{label:"选项顺序",value:"ascend"},{label:"选项倒叙",value:"descend"}];Li((()=>{a(u.current)}),[p.map((e=>e.fieldName)).join(",")]),t.useLayoutEffect((()=>{const e=((e,t=[],n)=>{if(!Array.isArray(e)||0===t.length)return e;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)})(i,m,((e,t)=>{var n,i,l;const{dictItems:a,precision:o}=r.find((e=>e.dataIndex===t))||{},s=ta(e,t);let c=null!==(l=null!==(i=null===(n=null==a?void 0:a.find((e=>e.value==s)))||void 0===n?void 0:n.text)&&void 0!==i?i: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=ia(c)?new Vt(c).toFixed(o):c),c||"(内容为空)"}));var t;o(e),t=mm(e),u.current=t,s({flatGroupData:gm(e)})}),[m,i]);const g=()=>{l([...n,{fieldName:"",order:"ascend"}])},v=(e,t,r)=>{Object.assign(t,{[e]:r}),l([...n])},y=e=>t.createElement(t.Fragment,null,t.createElement(Ge,{className:"icon handle"}),t.createElement(F,{value:e.fieldName||null,placeholder:c("qm.table.editable.selectPlaceholder"),options:h,style:{width:160,margin:"0 10px"},onChange:t=>v("fieldName",e,t)}),t.createElement(F,{value:e.order,options:f,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>v("order",e,t)}),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{l(n.filter((t=>t!==e)))})(e)}));return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置分组条件"),!!p.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>a([])},"折叠所有"),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>a(u.current)},"展开所有"))),t.createElement("div",{className:"list"},t.createElement(Xt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:n,setList:e=>{const t=e.map((e=>e.fieldName)),r=n.map((e=>e.fieldName));me(t,r)||l(e)}},n.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},y(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(ht,{className:"icon"}),"添加条件"))),className:_e("action-btn",{active:!!p.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Rt,{className:"icon"}),"分组",p.length?`(${p.length})`:null))},ym=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:i,setFilterList:l,setGridData:a}=cm(),{originGridData:o}=n.current,{t:s}=Ln(),c=t.useMemo((()=>i.filter((e=>e.fieldName&&e.expression))),[i]),d=t.useMemo((()=>r.filter((e=>!!e.filter)).map((e=>({label:e.title,value:e.dataIndex})))),[r]),[u,p]=t.useState("and");Li((()=>{l(i.map((e=>Object.assign(Object.assign({},e),{logic:u}))))}),[u]);const h=()=>{const e=ha(c.map((e=>Object.assign(Object.assign({},zn(e,["value"])),{condition:e.value}))));a(e?Ml(o,e):o)},m=[{label:"满足所有条件",value:"and"},{label:"满足任一条件",value:"or"}],f=e=>{let t=[];if(!e)return[];switch(e){case"date":case"number":t=[{value:">",label:s("qm.table.highSearch.gtText")},{value:"<",label:s("qm.table.highSearch.ltText")},{value:">=",label:s("qm.table.highSearch.gteText")},{value:"<=",label:s("qm.table.highSearch.lteText")},{value:"==",label:s("qm.table.highSearch.eqText")},{value:"!=",label:s("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:s("qm.table.highSearch.inText")},{value:"nin",label:s("qm.table.highSearch.ninText")},{value:"==",label:s("qm.table.highSearch.eqText")},{value:"!=",label:s("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:s("qm.table.highSearch.likeText")},{value:"==",label:s("qm.table.highSearch.eqText")},{value:"!=",label:s("qm.table.highSearch.neqText")}]}return t},g=()=>{l([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:u}])},v=(e,t,n)=>{Object.assign(t,{[e]:n}),"fieldName"===e&&Object.assign(t,{type:r.find((e=>e.dataIndex===n)).filter.type,expression:"",value:""}),l([...i])},y=e=>t.createElement(t.Fragment,null,t.createElement(F,{value:e.fieldName||null,options:d,placeholder:s("qm.table.editable.selectPlaceholder"),style:{width:160},onChange:t=>v("fieldName",e,t)}),t.createElement(F,{value:e.expression||null,placeholder:s("qm.table.editable.selectPlaceholder"),options:f(e.type),style:{width:100,margin:"0 10px"},onChange:t=>v("expression",e,t)}),b(e),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{l(i.filter((t=>t!==e)))})(e)})),b=e=>{var n,i;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,Kn(t)?"":t)}});case"date":return t.createElement(En,{popupClassName:Xd.popupClassName,defaultValue:null!==(n=oa(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{v("value",e,sa(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(F,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||null,placeholder:s("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{v("value",e,t)}},n.map((e=>t.createElement(F.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,t.target.value)}})}};return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置筛选条件"),!!c.length&&t.createElement(F,{value:u,options:m,style:{width:130},onChange:e=>p(e)})),t.createElement("div",{className:"list"},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},y(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(ht,{className:"icon"}),"添加条件"),t.createElement(Xn,{type:"primary",size:"small",onClick:h},"确定"))),className:_e("action-btn",{active:!!c.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Ot,{className:"icon"}),"筛选",c.length?`(${c.length})`:null))},bm=()=>{const{prefixCls:e,columns:n,gridData:r,sorterList:i,setSorterList:l,setGridData:a}=cm(),{t:o}=Ln(),s=t.useMemo((()=>i.filter((e=>e.fieldName&&e.order))),[i]),c=t.useMemo((()=>n.map((e=>({label:e.title,value:e.dataIndex,disabled:i.some((t=>t.fieldName===e.dataIndex))})))),[i,n]);Li((()=>{p()}),[t.useMemo((()=>s.map((e=>Object.values(e).join(":"))).join(",")),[s])]);const d=[{label:"字段升序",value:"ascend"},{label:"字段降叙",value:"descend"}],u=(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,p=()=>{var e;a((e=s,r.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:i}=r,l=ta(t,e),a=ta(n,e),o=u(l,a);if(0!==o)return"ascend"===i?o:-o}return 0})).slice(0)))},h=()=>{l([...i,{fieldName:"",order:"ascend"}])},m=(e,t,n)=>{Object.assign(t,{[e]:n}),l([...i])},f=e=>t.createElement(t.Fragment,null,t.createElement(Ge,{className:"icon handle"}),t.createElement(F,{value:e.fieldName||void 0,placeholder:o("qm.table.editable.selectPlaceholder"),options:c,style:{width:160,margin:"0 10px"},onChange:t=>m("fieldName",e,t)}),t.createElement(F,{value:e.order,options:d,placeholder:o("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>m("order",e,t)}),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{l(i.filter((t=>t!==e)))})(e)}));return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置排序条件")),t.createElement("div",{className:"list"},t.createElement(Xt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.fieldName)),n=i.map((e=>e.fieldName));me(t,n)||l(e)}},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},f(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:h},t.createElement(ht,{className:"icon"}),"添加条件"))),className:_e("action-btn",{active:!!s.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(kt,{className:"icon"}),"排序",s.length?`(${s.length})`:null))},xm=()=>{const{getRowKey:e}=t.useContext(Pd),{prefixCls:n,gridData:r,columns:i,searchResults:l,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=cm(),[c,d]=t.useState(!1),u=t.useMemo((()=>l.length),[l]);Li((()=>{c||setTimeout((()=>{s(0),o([])}),200)}),[c]);const p=(t,n)=>{const r=[];return t.forEach((t=>{Array.isArray(t.children)&&r.push(...p(t.children,n)),i.forEach((i=>{var l,a,o;const{dataIndex:s,dictItems:c,precision:d}=i,u=ta(t,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=ia(p)?new Vt(p).toFixed(d):p),p+="",p.includes(n)&&r.push({value:p,rowKey:e(t,t.index),dataIndex:s})}))})),r},h=nl((e=>{const t=e.target.value.trim();s(0),o(t?p(r,t):[])}),200),m=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&f()},f=()=>{if(!u)return;s((a+1)%u)},g=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!u)return;s((a-1+u)%u)})()},t.createElement(It,null)),t.createElement("span",{className:"num"},u>0?a+1:a,"/",u),t.createElement("button",{className:"button-icon",onClick:()=>f()},t.createElement(Tt,null)));return t.createElement(M,{open:c,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置查找条件"),t.createElement("button",{className:"button-icon",onClick:()=>d(!1)},t.createElement(Xe,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(O,{autoFocus:!0,style:{width:280},suffix:g(),onChange:h,onKeyUp:m}))),className:"action-btn",overlayClassName:`${n}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>d(!c)},t.createElement(ut,{className:"icon"}),"查找"))},Em=()=>{const{prefixCls:e,columns:n,setColumns:r}=cm(),i=t.useMemo((()=>{let e=0;for(let t=0;t<n.length-1&&("left"!==n[t].fixed||n[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let r=0;r<n.length;r++)r===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(n[r]);return t}),[n]),l=()=>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,"字段自定义设置")),t.createElement("div",{className:"list"},t.createElement(Xt,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.dataIndex)),n=i.map((e=>e.dataIndex));me(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)}r(n)})(e)}},i.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(Ge,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},e.title),t.createElement("button",{className:"button-icon",onClick:()=>{return(t=e).hidden=!t.hidden,void r([...n]);var t}},e.hidden?t.createElement(Lt,null):t.createElement(Ke,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(M,{trigger:["click"],dropdownRender:()=>l(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(ot,{className:"icon"}),"字段管理"))},Cm=()=>{const{prefixCls:e,size:n,setContext:r}=cm(),i=[{label:"常规",value:"small"},{label:"中等",value:"middle"},{label:"高",value:"large"}];return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},i.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(At,{className:"icon"}),"行高"))},wm=()=>t.createElement("div",{className:"top-bar"},t.createElement(Zn,{size:4},t.createElement(dm,null),t.createElement(ee,{type:"vertical"}),t.createElement(Em,null),t.createElement(vm,null),t.createElement(ym,null),t.createElement(bm,null),t.createElement(ee,{type:"vertical"}),t.createElement(Cm,null),t.createElement(xm,null))),Sm=t.createContext(void 0),Nm=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(Nm)):0,Tm=e=>{const{scrollbar:n}=e,{groupGridData:r}=cm(),[i,l]=t.useState({scrollbarRef:n,selectionKeys:[],countMethod:{},summationData:{}}),a=t.useMemo((()=>{const e=Nm(r);return Math.max(0,e-1)}),[r]),o=e=>{l((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}))},s=e=>{o({selectionKeys:e})},c=e=>{var t;o({countMethod:(t=Object.assign({},i.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},d=e=>{o({summationData:e})},u=t.useMemo((()=>Object.assign(Object.assign({},i),{indentDepth:a,setContext:o,setSelectionKeys:s,setCountMethod:c,setSummationData:d})),[i,a]);return t.createElement(Sm.Provider,{value:u},e.children)},Im=()=>t.useContext(Sm),Rm=e=>{var n;const{column:r}=e,{columns:i,setColumns:l}=cm(),{scrollbarRef:a}=Im(),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||Xd.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]),jn((()=>c(!1))),Pi(document,"mousemove",h),Pi(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=Zl(e.target,a.current.container).left-a.current.scrollLeft+3;p({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),Ai(document,"mousemove",h),Ai(document,"mouseup",m),c(!0),jn((()=>o.current.style.left=`${t}px`)),d.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(Wt,{open:s,getContainer:null===(n=a.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},Om=()=>{const{tableRef:e}=t.useContext(Pd),{columns:n}=cm(),{indentDepth:r,selectionKeys:i,setSelectionKeys:l}=Im(),{allRowKeys:a}=e.current,{selectionColumn:o}=Xd,{indentWidth:s}=um,c=t.useMemo((()=>pm(n)),[n]),d=t.useMemo((()=>i.length===a.length),[i]),u=t.useMemo((()=>i.length>0&&i.length<a.length),[i]);return t.createElement("div",{className:"header"},t.createElement("table",{className:"table",cellSpacing:"0",cellPadding:"0"},t.createElement("colgroup",null,c.map(((e,n)=>{const{dataIndex:i,width:l,renderWidth:a}=e,o=(l||a)+(1===n||n===c.length-1?r*(s+1):0);return t.createElement("col",{key:i,style:{width:`${o}px`,minWidth:`${o}px`}})}))),t.createElement("thead",null,t.createElement("tr",null,c.map(((e,n)=>{const{dataIndex:i,title:p,align:h,fixed:m}=e,f={"selection-column":i===o,"col--center":"center"===h,"col--right":"right"===h,"col--fix-left":"left"===m},g={left:"left"===m?`${hm(c,i)+(n>1?r*(s+1):0)}px`:""};return t.createElement("th",{key:i,className:_e("table-cell",f),style:g},i!==o?t.createElement("span",{className:"cell"},p):t.createElement(H,{checked:d,indeterminate:u,onChange:e=>{return t=e.target.checked,void l(t?a:[]);var t}}),i!==o&&t.createElement(Rm,{column:e}))}))))))},km=e=>{const{records:n}=e,{getRowKey:r}=t.useContext(Pd),{pivotRef:i,size:l,columns:a,searchResults:o,switchIndex:s}=cm(),{scrollbarRef:c,indentDepth:d,selectionKeys:u,setSelectionKeys:p}=Im(),{flatGroupData:h}=i.current,{renderText:m,getTitleFromCellNode:f}=ou(),{selectionColumn:g,rowHeightMaps:v}=Xd,y=t.useRef(null),{contextMenu:b}=(({ref:e,popup:n,enabled:r=!0})=>{const i=t.useRef(null),l=t.useRef(null),a=e=>{l.current=e},[o,s]=t.useState(!1),[c,d]=t.useState(null),u={width:150,height:200,zIndex:9999};yp({ref:i,handler:()=>p()});const p=()=>{s(!1),d(null),a(null)},h=An((e=>{e.preventDefault(),a(e),s(!0),jn((()=>{var t;const{width:n,height:r}=(null===(t=i.current)||void 0===t?void 0:t.getBoundingClientRect())||u,l=n,a=r,o=window.innerWidth,s=window.innerHeight;let c=e.clientX,p=e.clientY;c+l>o&&(c-=l),p+a>s&&(p-=a),d({x:c,y:p})}))}));t.useEffect((()=>{const t=e.current;return r&&t&&t.addEventListener("contextmenu",h),()=>{t&&t.removeEventListener("contextmenu",h)}}),[e]);const m=Jn("context-menu"),f={position:"fixed",top:`${(null==c?void 0:c.y)||0}px`,left:`${(null==c?void 0:c.x)||0}px`,zIndex:u.zIndex};return{contextMenu:t.createElement(Wt,{open:o},t.createElement("div",{ref:i,className:_e(m,"ant-dropdown-menu"),style:f},l.current?n(l.current):null)),closeMenu:p}})({ref:y,enabled:!1,popup:e=>{const i=ji(e.target,"table-row"),l=(null==i?void 0:i.getAttribute("data-row-key"))||"";return n.find((e=>r(e,e.index)==l)),t.createElement("div",{style:{height:200,width:150}},"右键菜单。。。")}}),x=t.useMemo((()=>pm(a)),[a]);Li((()=>{const e=h.findIndex((e=>{var t;return r(e,e.index)===(null===(t=o[s])||void 0===t?void 0:t.rowKey)}));e>=0&&c.current.SET_SCROLL_TOP(e*v[l]);const t=x.findIndex((e=>{var t;return e.dataIndex===(null===(t=o[s])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=x.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]);const E=(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},C=(e,n,r,i,l)=>{const{dataIndex:a,width:o,renderWidth:s,align:c,fixed:h,render:v}=e,y=ta(r,a),b=v?v(y,r,e,i,n):m(y,e,r),C=f(b),w=u.includes(l),S={"selection-column":a===g,"col--center":"center"===c,"col--right":"right"===c,"col--fix-left":"left"===h,active:E(l,a)},N={width:`${o||s}px`,minWidth:`${o||s}px`,left:"left"===h?`${hm(x,a)+d*(um.indentWidth+1)}px`:""};return t.createElement("div",{key:a,"data-col-index":n,title:C,className:_e("table-cell",S),style:N},a!==g?t.createElement("span",{className:"cell"},b):t.createElement(t.Fragment,null,t.createElement("span",{className:"order"},i+1),t.createElement(H,{className:"checkbox",checked:w,onChange:e=>{return t=e.target.checked,n=l,void p(t?[...u,n]:u.filter((e=>e!==n)));var t,n}})))};return t.createElement(t.Fragment,null,t.createElement("div",{ref:y,className:"grid-list"},n.map(((e,n)=>{const i=r(e,e.index),l={"row--selection":u.includes(i)};return t.createElement("li",{key:i,"data-row-key":i,className:_e("table-row",l)},x.map(((t,r)=>C(t,r,e,n,i))))}))),b)},Lm=e=>{const{column:n,keyPath:r,type:i}=e,{prefixCls:l}=cm(),{summationData:a,countMethod:o,setCountMethod:s}=Im(),{dataIndex:c,filter:d}=n,[u,p]=t.useState(!1),h=t.useMemo((()=>{const e=[{text:"记录数",value:"count",fn:fm.count},{text:"唯一值",value:"unique",fn:fm.unique},{text:"空值",value:"empty",fn:fm.empty},{text:"非空值",value:"notEmpty",fn:fm.notEmpty},{text:"合计值",value:"sum",fn:fm.sum},{text:"最大值",value:"max",fn:fm.max},{text:"最小值",value:"min",fn:fm.min},{text:"平均值",value:"avg",fn:fm.avg}];return"number"===(null==d?void 0:d.type)?e:e.slice(0,-4)}),[]),m=t.useMemo((()=>{var e,t,n;const l=o[c];if(!l)return"统计";return`${h.find((e=>e.value===l)).text} ${null!==(n=null===(t=null===(s=a,d=r,e=d?Vn(s,d):s)||void 0===e?void 0:e[i])||void 0===t?void 0:t[c])&&void 0!==n?n:""}`;var s,d}),[a,o]);return t.createElement(M,{open:u,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},h.map((e=>{const n=e.value===o[c];return t.createElement("li",{key:e.value,className:_e("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[c]:n?void 0:e.value}),p(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement(qe,null)))})))),className:_e("count-select",{show:!!o[c]}),overlayClassName:`${l}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},t.createElement("span",null,m," ",t.createElement(He,{className:"icon"})))},Am=e=>{const{dataKey:n,dataKeyPath:r,depth:i,className:l,style:a}=e,{columns:o,expandedKeys:s,setExpandedKeys:c}=cm(),{indentDepth:d}=Im(),{selectionColumn:u}=Xd,p=t.useMemo((()=>pm(o)),[o]),h=t.useMemo((()=>s.includes(r)),[s,r]),m=(e,l)=>{const{dataIndex:a,width:o,renderWidth:m,fixed:f}=e,g=(o||m)+(1===l?(d-i)*(um.indentWidth+1):0),v={"expandable-column":a===u,"col--fix-left":"left"===f},y={width:`${g}px`,minWidth:`${g}px`,left:"left"===f?`${hm(p,a)+i*(um.indentWidth+1)}px`:""};return t.createElement("div",{key:a,className:_e("label-cell",v),style:y},a!==u?t.createElement(t.Fragment,null,1===l&&t.createElement("span",{className:"title"},n.slice(1)),t.createElement(Lm,{column:e,keyPath:r,type:"subtotal"})):t.createElement("button",{className:_e("button-icon",{expand:h}),onClick:()=>{return e=r,void c(h?s.filter((t=>t!==e)):[...s,e]);var e}},t.createElement(Tt,null)))},f={inner:i>0};return t.createElement("div",{className:_e("group-card",f,l),style:a},t.createElement("li",{className:"label-row"},p.map(((e,t)=>m(e,t)))),t.createElement("div",{style:{display:h?"block":"none"}},e.children))},Pm=()=>{const{groupGridData:e}=cm(),n=(e,r="",i=0)=>{const l=oe(e)&&!Array.isArray(e);return t.createElement(t.Fragment,null,l?Object.keys(e).map((l=>{const a=r?`${r}.${l}`:l;return t.createElement(Am,{key:l,dataKey:l,dataKeyPath:a,depth:i},Array.isArray(e[l])?t.createElement(km,{records:e[l]}):n(e[l],a,i+1))})):t.createElement(km,{records:e}))};return t.createElement("div",{className:"body"},n(e))},Dm=()=>{const{columns:e,groupGridData:n}=cm(),{indentDepth:r,countMethod:i,setSummationData:l}=Im(),{selectionColumn:a}=Xd,{indentWidth:o}=um,s=t.useMemo((()=>pm(e)),[e]);Li((()=>{l(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const i=e.map((e=>Vn(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=>Vn(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]:fm[e[n]]});return t})(i)))}),[i,n]);return t.createElement("div",{className:"footer"},t.createElement("table",{className:"table",cellSpacing:"0",cellPadding:"0"},t.createElement("colgroup",null,s.map(((e,n)=>{const{dataIndex:i,width:l,renderWidth:a}=e,c=(l||a)+(1===n||n===s.length-1?r*(o+1):0);return t.createElement("col",{key:i,style:{width:`${c}px`,minWidth:`${c}px`}})}))),t.createElement("tfoot",null,t.createElement("tr",null,s.map(((e,n)=>{const{dataIndex:i,fixed:l}=e,c={"selection-column":i===a,"col--right":!0,"col--fix-left":"left"===l},d={left:"left"===l?`${hm(s,i)+(n>1?r*(o+1):0)}px`:""};return t.createElement("td",{key:i,className:_e("table-cell",c),style:d},i!==a?t.createElement(Lm,{column:e,keyPath:"",type:"total"}):null)}))))))},_m=()=>{const{prefixCls:e,size:n}=cm(),r=t.useRef(null);return t.createElement(Tm,{scrollbar:r},t.createElement(ol,{ref:r,className:_e(`${e}__layout`,n)},t.createElement(Om,null),t.createElement(Pm,null),t.createElement(Dm,null)))},Fm=()=>{const{tableRef:e,flattenColumns:n}=t.useContext(Pd),{tableFullData:r}=e.current,i=t.useMemo((()=>(e=>e.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.operationColumn].includes(e.dataIndex))).map((e=>Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0}))))(n)),[]),l=Jn("pivot-grid");return t.createElement("div",{className:`${l}__main`},t.createElement(sm,{prefixCls:l,flatColumns:i,tableData:r},t.createElement(wm,null),t.createElement("div",{className:"wrapper"},t.createElement(_m,null))))};Fm.displayName="PivotGrid";const Hm=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)}));Hm.displayName="ListItem";const Mm=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=sp({count:l.length,getScrollElement:()=>p.current.container.children[0],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=Jn("virtual-list");return t.createElement(ol,{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(Hm,{ref:h.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(l[e.index],e.index)))))))}));Mm.displayName="VirtualList";const $m="1.11.6";export{xn as Calendar,En as DatePicker,vl as DcpAnchor,Xn as DcpButton,Oi as DcpCollapse,In as DcpConfigProvider,Ip as DcpCopyToClipboard,Ui as DcpCountup,Ed as DcpCropper,er as DcpDivider,hl as DcpDownload,xl as DcpDrawer,Gi as DcpEmpty,rd as DcpForm,Vh as DcpGuideTracker,Qh as DcpLazyLoad,wl as DcpModal,Fm as DcpPivotGrid,wh as DcpPrint,Up as DcpRangeTableHelper,ol as DcpScrollbar,$p as DcpSearchHelper,Ad as DcpSearchTree,am as DcpSignature,Zn as DcpSpace,Yi as DcpSpin,Bi as DcpSplit,Mp as DcpTable,bl as DcpTabs,xd as DcpTinymce,oh as DcpTour,hh as DcpTransition,zp as DcpTreeHelper,Vp as DcpTreeTableHelper,pl as DcpUploadFile,wd as DcpUploadImg,Mm as DcpVirtualList,zh as DcpWatermark,vl as QmAnchor,Xn as QmButton,Oi as QmCollapse,In as QmConfigProvider,Ip as QmCopyToClipboard,Ui as QmCountup,Ed as QmCropper,er as QmDivider,hl as QmDownload,xl as QmDrawer,Gi as QmEmpty,rd as QmForm,Vh as QmGuideTracker,Qh as QmLazyLoad,wl as QmModal,Fm as QmPivotGrid,wh as QmPrint,Up as QmRangeTableHelper,ol as QmScrollbar,$p as QmSearchHelper,Ad as QmSearchTree,am as QmSignature,Zn as QmSpace,Yi as QmSpin,Bi as QmSplit,Mp as QmTable,bl as QmTabs,xd as QmTinymce,oh as QmTour,hh as QmTransition,zp as QmTreeHelper,Vp as QmTreeTableHelper,pl as QmUploadFile,wd as QmUploadImg,Mm as QmVirtualList,zh as QmWatermark,wn as TimePicker,to as pinyin,$m 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 C,Popconfirm as w,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 D,Col as _,Select as F,Checkbox as H,Dropdown as M,InputNumber as $,Rate as j,Radio as q,Switch as K,Tag as V,TreeSelect as z,Cascader as W,notification as B,Image as U,Tree as G,Menu as Y,Popover as X,Pagination as Q,Slider as Z,Segmented as J,Divider as ee}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 te from"dayjs/plugin/weekYear";import ne from"antd/es/calendar/generateCalendar";import re from"antd/es/date-picker/generatePicker";import ie from"antd/es/locale/zh_CN";import le from"antd/es/locale/en_GB";import{isArray as ae,isPlainObject as oe,isNumber as se,isFunction as ce,isString as de,isUndefined as ue,get as pe,transform as he,isEqual as me,set as fe,xor as ge,isRegExp as ve,merge as ye,uniqBy as be,debounce as xe,intersection as Ee,map as Ce,groupBy as we,flatten as Se,spread as Ne,mergeWith as Te,isDate as Ie,omitBy as Re,sumBy as Oe,maxBy as ke,minBy as Le,union as Ae,pickBy as Pe,throttle as De}from"lodash-es";import _e from"classnames";import{UpOutlined as Fe,DownOutlined as He,UploadOutlined as Me,LinkOutlined as $e,EditOutlined as je,CheckOutlined as qe,EyeOutlined as Ke,DownloadOutlined as Ve,DeleteOutlined as ze,FullscreenExitOutlined as We,FullscreenOutlined as Be,UnorderedListOutlined as Ue,HolderOutlined as Ge,SearchOutlined as Ye,CloseOutlined as Xe,ExclamationCircleOutlined as Qe,ReloadOutlined as Ze,ZoomInOutlined as Je,ZoomOutOutlined as et,RotateRightOutlined as tt,RotateLeftOutlined as nt,InboxOutlined as rt,InfoCircleFilled as it,PrinterOutlined as lt,ImportOutlined as at,SettingOutlined as ot,CopyOutlined as st,CheckSquareOutlined as ct,CloseCircleOutlined as dt,MonitorOutlined as ut,LineChartOutlined as pt,PlusOutlined as ht,PieChartOutlined as mt,FunnelPlotOutlined as ft,AppstoreAddOutlined as gt,StepBackwardOutlined as vt,StepForwardOutlined as yt,InfoCircleOutlined as bt,ClearOutlined as xt,PauseOutlined as Et,CaretRightOutlined as Ct,QuestionCircleOutlined as wt,MenuOutlined as St,BorderOutlined as Nt,RightOutlined as Tt,LeftOutlined as It,FolderOpenOutlined as Rt,FilterOutlined as Ot,SortAscendingOutlined as kt,EyeInvisibleOutlined as Lt,ColumnHeightOutlined as At,FolderOutlined as Pt,BarsOutlined as Dt}from"@ant-design/icons";import _t from"react-countup";import Ft from"resize-observer-polyfill";import Ht from"sortablejs";import Mt from"add-dom-event-listener";import $t from"scroll-into-view-if-needed";import jt from"react-draggable";import qt from"memoize-one";import*as Kt from"prop-types";import Vt from"prop-types";import zt from"cropperjs";import Wt from"big.js";import Bt from"copy-to-clipboard";import Ut from"@rc-component/portal";import Gt from"@rc-component/trigger";import Yt from"html2canvas";import Xt,{flushSync as Qt}from"react-dom";import{ReactSortable as Zt}from"react-sortablejs";import Jt from"exceljs";import en from"localforage";import tn from"china-area-data";const nn=n({locale:"zh-cn",size:"middle"});var rn={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?",shortcutKey:"快捷键"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传",remove:"删除文件",batchDownload:"批量下载"},uploadCropper:{dragableText:"拖放或点击",pasteText:"Ctrl+V 粘贴",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},areaSelect:{mergeCell:"合并单元格",cancelMerge:"取消合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"},pivotGrid:{text:"透视表",settingTitle:"透视表看板"}}}};let ln=rn;function an(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const on=(...e)=>{const[t,n]=e;let r;const i=t.split(".");let l=ln;for(let e=0,t=i.length;e<t;e++){if(r=l[i[e]],e===t-1)return an(r,n);if(!r)return"";l=r}return""},sn=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{})),cn=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function dn(e,t){cn((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 un={},pn=[];function hn(e,t){if(!e&&void 0!==console){var n=pn.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function mn(e,t){if(!e&&void 0!==console){var n=pn.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function fn(e,t,n){t||un[n]||(e(!1,n),un[n]=!0)}function gn(e,t){fn(hn,e,t)}function vn(e,t){fn(mn,e,t)}gn.preMessage=function(e){pn.push(e)},gn.resetWarned=function(){un={}},gn.noteOnce=vn,h.extend(g),h.extend(f),h.extend(b),h.extend(m),h.extend(y),h.extend(te),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 yn={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"},bn=function(e){return yn[e]||e.split("_")[0]},xn=function(){vn(!1,"Not match any format. Please help to fire a issue about this.")},En={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(bn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(bn(e)).weekday(0)},getWeek:function(e,t){return t.locale(bn(e)).week()},getShortWeekDays:function(e){return h().locale(bn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return h().locale(bn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(bn(e)).format(n)},parse:function(e,t,n){for(var r=bn(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 xn(),null}var p=h(a,l).locale(r);if(p.isValid())return p}return t&&xn(),null}}};const Cn=ne(En),wn=re(En);function Sn(){return Sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sn.apply(null,arguments)}const Nn=e.forwardRef(((t,n)=>e.createElement(wn,Sn({},t,{picker:"time",mode:void 0,ref:n}))));Nn.displayName="TimePicker";const Tn=e.forwardRef(((t,n)=>e.createElement(wn.RangePicker,Sn({},t,{picker:"time",mode:void 0,ref:n}))));Tn.displayName="RangePicker",Nn.RangePicker=Tn;var In={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?",shortcutKey:"Shortcut Key"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload",remove:"Delete files",batchDownload:"Batch download"},uploadCropper:{dragableText:"Drop or click",pasteText:"Ctrl+V Paste",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},areaSelect:{mergeCell:"Cell Merge",cancelMerge:"Cancel Merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}}}};const Rn={[In.name]:{qm:In,antd:le},[rn.name]:{qm:rn,antd:ie}},On=e=>{const n=sn({locale:"zh-cn",size:"middle"},e),{locale:r,size:i,global:l}=n;t.useMemo((()=>{return e=Object.assign({},Rn,null==l?void 0:l.langPackage)[r].qm,ln=e||ln,void(ln.name&&h.locale(ln.name));var e}),[r]);const a=t.useMemo((()=>Object.assign({},Rn,null==l?void 0:l.langPackage)),[l]),[o,s]=t.useState({locale:r,size:i,global:l});return dn((()=>{s((e=>Object.assign({},e,{locale:r,size:i})))}),[i,r]),t.createElement(nn.Provider,{value:o},t.createElement(x,{locale:a[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==l?void 0:l.autoInsertSpaceInButton},n.children))};function kn(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 Ln(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 An(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 Pn(){const{locale:t}=e.useContext(nn);return{t:on,$locale:t}}function Dn(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 _n(t){const{size:n}=e.useContext(nn);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])}}On.displayName="QmConfigProvider";var Fn="undefined"==typeof window;const Hn=e=>t.isValidElement(e),Mn=e=>Hn(e)&&e.type===t.Fragment,$n=()=>{},jn=()=>!0,qn=e=>An(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),Kn=e=>{Promise.resolve().then(e)},Vn=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),zn=e=>!!(!e&&0!==e||ae(e)&&!e.length||oe(e)&&!Object.keys(e).length),Wn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),Bn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Un=(e,t=new WeakMap)=>{if(oe(e)||ae(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]=Un(e[l],t)})),r}return e},Gn=e=>se(e)?`${e}px`:e.toString();class Yn extends Error{constructor(e){super(e),this.name="QmDesignError"}}function Xn(e,t){throw new Yn(`[${e}] ${t}`)}function Qn(e,t){console.warn(new Yn(`[${e}] ${t}`))}const Zn=e=>{const{loading:n,shortcutKey:r,authConfig:i,click:l,confirm:a}=e,{t:o}=Pn(),{$size:s}=_n(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=Dn((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=ce(l)?{onClick:t=>An(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){Qn("Button","`click`方法执行出错")}d(!1)}))}:null,h=Object.assign(Object.assign(Object.assign({},Bn(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(w,{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,Sn({},h,{onClick:$n}),e.children)):!r||h.disabled?m:t.createElement(C,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},m)};var Jn;Zn.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(Jn||(Jn={}));const er=e=>{const{$size:n}=_n(e),r=se(e.size)?e.size:Jn[n||"default"],i=Object.assign(Object.assign({},Bn(e,["size"])),{size:r});return t.createElement(S,i,e.children)};er.displayName="QmSpace";const tr=e=>`qm-${e}`,nr=e=>{const{label:n,extra:r,collapse:i,bordered:l=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=_n(e),{t:p}=Pn(),h=tr("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(Fe,null):t.createElement(He,null)))};nr.displayName="QmDivider";const rr=()=>({height:0,opacity:0}),ir=(e,t)=>"height"===t.propertyName,lr={motionName:"rc-collapse-motion",onEnterStart:rr,onEnterActive:e=>({height:e.scrollHeight,opacity:1}),onLeaveStart:e=>({height:e.offsetHeight}),onLeaveActive:rr,onEnterEnd:ir,onLeaveEnd:ir,motionDeadline:500,leavedClassName:"rc-collapse-content-hidden"};function ar(e){return ar="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},ar(e)}function or(e){var t=function(e,t){if("object"!==ar(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ar(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ar(t)?t:String(t)}function sr(e,t,n){return(t=or(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cr(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 dr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cr(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ur(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 pr(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 ur(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)?ur(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 hr(e){return e instanceof HTMLElement||e instanceof SVGElement}function mr(e){var n,r=function(e){return e&&"object"===ar(e)&&hr(e.nativeElement)?e.nativeElement:hr(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Xt.findDOMNode)||void 0===n?void 0:n.call(Xt,e):null)}var fr,gr={exports:{}},vr={};gr.exports=(fr||(fr=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,C=p,w=n,S=l,N=i,T=d,I=u,R=!1,O=!1;vr.ContextConsumer=g,vr.ContextProvider=v,vr.Element=y,vr.ForwardRef=b,vr.Fragment=x,vr.Lazy=E,vr.Memo=C,vr.Portal=w,vr.Profiler=S,vr.StrictMode=N,vr.Suspense=T,vr.SuspenseList=I,vr.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},vr.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},vr.isContextConsumer=function(e){return f(e)===o},vr.isContextProvider=function(e){return f(e)===a},vr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},vr.isForwardRef=function(e){return f(e)===c},vr.isFragment=function(e){return f(e)===r},vr.isLazy=function(e){return f(e)===h},vr.isMemo=function(e){return f(e)===p},vr.isPortal=function(e){return f(e)===n},vr.isProfiler=function(e){return f(e)===l},vr.isStrictMode=function(e){return f(e)===i},vr.isSuspense=function(e){return f(e)===d},vr.isSuspenseList=function(e){return f(e)===u},vr.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)},vr.typeOf=f}()),vr);var yr=function(e,t){"function"==typeof e?e(t):"object"===ar(e)&&e&&"current"in e&&(e.current=t)},br=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){yr(t,e)}))}},xr=function(e){var t,n,r=gr.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===gr.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===gr.exports.ForwardRef)};function Er(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 Cr=e.createContext({});function wr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sr(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,or(r.key),r)}}function Nr(e,t,n){return t&&Sr(e.prototype,t),n&&Sr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tr(e,t){return Tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tr(e,t)}function Ir(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&&Tr(e,t)}function Rr(e){return Rr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Rr(e)}function Or(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kr(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=Rr(e);if(t){var i=Rr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===ar(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Or(e)}(this,n)}}var Lr=function(t){Ir(r,e.Component);var n=kr(r);function r(){return wr(this,r),n.apply(this,arguments)}return Nr(r,[{key:"render",value:function(){return this.props.children}}]),r}();function Ar(t){var n=e.useRef(!1),r=pr(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 Pr="none",Dr="appear",_r="enter",Fr="leave",Hr="none",Mr="prepare",$r="start",jr="active",qr="end",Kr="prepared";function Vr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function zr(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 Wr,Br,Ur,Gr=(Wr=Vr(),Br="undefined"!=typeof window?window:{},Ur={animationend:zr("Animation","AnimationEnd"),transitionend:zr("Transition","TransitionEnd")},Wr&&("AnimationEvent"in Br||delete Ur.animationend.animation,"TransitionEvent"in Br||delete Ur.transitionend.transition),Ur),Yr={};if(Vr()){var Xr=document.createElement("div");Yr=Xr.style}var Qr={};function Zr(e){if(Qr[e])return Qr[e];var t=Gr[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 Yr)return Qr[e]=t[l],Qr[e]}return""}var Jr=Zr("animationend"),ei=Zr("transitionend"),ti=!(!Jr||!ei),ni=Jr||"animationend",ri=ei||"transitionend";function ii(e,t){return e?"object"===ar(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var li=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(ri,i),e.removeEventListener(ni,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(ri,i),e.addEventListener(ni,i),n.current=e)},a]},ai=Vr()?a:o,oi=function(e){return+setTimeout(e,16)},si=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(oi=function(e){return window.requestAnimationFrame(e)},si=function(e){return window.cancelAnimationFrame(e)});var ci=0,di=new Map;function ui(e){di.delete(e)}var pi=function(e){var t=ci+=1;return function n(r){if(0===r)ui(t),e();else{var i=oi((function(){n(r-1)}));di.set(t,i)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};pi.cancel=function(e){var t=di.get(e);return ui(e),si(t)},pi.ids=function(){return di};var hi=[Mr,$r,jr,qr],mi=[Mr,Kr],fi=!1,gi=!0;function vi(e){return e===jr||e===qr}var yi=function(t,n,r){var i=pr(Ar(Hr),2),l=i[0],a=i[1],o=function(){var t=e.useRef(null);function n(){pi.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=pi((function(){i<=1?r({isCanceled:function(){return l!==t.current}}):e(r,i-1)}));t.current=l},n]}(),s=pr(o,2),c=s[0],d=s[1];var u=n?mi:hi;return ai((function(){if(l!==Hr&&l!==qr){var e=u.indexOf(l),t=u[e+1],n=r(l);n===fi?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(Mr,!0)},l]};var bi=function(t){var n=t;"object"===ar(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(Cr).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,C=i.onEnterActive,w=i.onLeaveActive,S=i.onAppearEnd,N=i.onEnterEnd,T=i.onLeaveEnd,I=i.onVisibleChanged,R=pr(Ar(),2),O=R[0],k=R[1],L=pr(Ar(Pr),2),A=L[0],P=L[1],D=pr(Ar(null),2),_=D[0],F=D[1],H=l(!1),M=l(null);function $(){return r()}var j=l(!1);function q(){P(Pr,!0),F(null,!0)}function K(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=j.current;A===Dr&&r?n=null==S?void 0:S(t,e):A===_r&&r?n=null==N?void 0:N(t,e):A===Fr&&r&&(n=null==T?void 0:T(t,e)),A!==Pr&&r&&!1!==n&&q()}}var V=pr(li(K),1)[0],z=function(e){var t,n,r;switch(e){case Dr:return sr(t={},Mr,f),sr(t,$r,y),sr(t,jr,E),t;case _r:return sr(n={},Mr,g),sr(n,$r,b),sr(n,jr,C),n;case Fr:return sr(r={},Mr,v),sr(r,$r,x),sr(r,jr,w),r;default:return{}}},W=e.useMemo((function(){return z(A)}),[A]),B=pr(yi(A,!t,(function(e){if(e===Mr){var t=W[Mr];return t?t($()):fi}var n;return G in W&&F((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===jr&&(V($()),h>0&&(clearTimeout(M.current),M.current=setTimeout((function(){K({deadline:!0})}),h))),G===Kr&&q(),gi})),2),U=B[0],G=B[1],Y=vi(G);j.current=Y,ai((function(){k(n);var e,r=H.current;H.current=!0,!r&&n&&d&&(e=Dr),r&&n&&s&&(e=_r),(r&&!n&&p||!r&&m&&!n&&p)&&(e=Fr);var i=z(e);e&&(t||i[Mr])?(P(e),U()):P(Pr)}),[n]),o((function(){(A===Dr&&!d||A===_r&&!s||A===Fr&&!p)&&P(Pr)}),[d,s,p]),o((function(){return function(){H.current=!1,clearTimeout(M.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===Pr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=_;return W[Mr]&&G===$r&&(Q=dr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:mr(v.current)}catch(e){return null}}),t),b=pr(y,4),x=b[0],E=b[1],C=b[2],w=b[3],S=e.useRef(w);w&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,yr(r,e)}),[r]),I=dr(dr({},m),{},{visible:a});if(u)if(x===Pr)N=w?u(dr({},I),T):!c&&S.current&&h?u(dr(dr({},I),{},{className:h}),T):d||!c&&!h?u(dr(dr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===Mr?O="prepare":vi(E)?O="active":E===$r&&(O="start");var k=ii(p,"".concat(x,"-").concat(O));N=u(dr(dr({},I),{},{className:_e(ii(p,x),(R={},sr(R,k,k&&O),sr(R,p,"string"==typeof p),R)),style:C}),T)}else N=null;e.isValidElement(N)&&xr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(Lr,{ref:v},N)}));return r.displayName="CSSMotion",r}(ti);function xi(){return xi=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},xi.apply(this,arguments)}var Ei="add",Ci="keep",wi="remove",Si="removed";function Ni(e){var t;return dr(dr({},t=e&&"object"===ar(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Ti(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(Ni)}var Ii=["component","children","onVisibleChanged","onAllRemoved"],Ri=["status"],Oi=["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]:bi,r=function(t){Ir(i,e.Component);var r=kr(i);function i(){var e;wr(this,i);for(var t=arguments.length,n=new Array(t),l=0;l<t;l++)n[l]=arguments[l];return sr(Or(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),sr(Or(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:dr(dr({},e),{},{status:Si})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==Si})).length})),e}return Nr(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=Er(i,Ii),d=l||e.Fragment,u={};return Oi.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=Er(r,Ri),c=i===Ei||i===Ci;return e.createElement(n,xi({},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=Ti(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=Ti(e),a=Ti(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 dr(dr({},e),{},{status:Ei})}))),r=l),n.push(dr(dr({},o),{},{status:Ci})),r+=1,t=!0;break}}t||n.push(dr(dr({},e),{},{status:wi}))})),r<i&&(n=n.concat(a.slice(r).map((function(e){return dr(dr({},e),{},{status:Ei})}))));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!==wi}))).forEach((function(t){t.key===e&&(t.status=Ci)}))})),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!==Si||e.status!==wi}))}}}]),i}();sr(r,"defaultProps",{component:"div"})}(ti);const ki=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=tr("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))}));ki.displayName="PanelContent";const Li=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=tr("collapse"),g=_e({[`${f}`]:!0,[`${f}-active`]:h,[`${f}-disabled`]:c},l);return t.createElement("div",{className:g,style:a},t.createElement(nr,{label:r,extra:i,collapse:h,bordered:s,disabled:c,onCollapseChange:e=>{m(e),null==p||p(e)}}),t.createElement(bi,Sn({visible:h},lr,{leavedClassName:`${f}-content-hidden`,forceRender:d,removeOnLeave:u}),(({className:n,style:r},i)=>t.createElement(ki,{ref:i,prefixCls:f,className:n,style:r,boxStyle:o,isActive:h,forceRender:d},e.children))))};Li.displayName="QmCollapse";const Ai=t.createContext(void 0);function Pi(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 Di=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},_i=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Fi=e=>e.preventDefault(),Hi=(e,t)=>{if(Fn||!e||!t)return null;"float"===(t=Vn(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]}},Mi=(e,t,n)=>{!Fn&&e&&t&&(oe(t)?Object.keys(t).forEach((n=>{Mi(e,n,t[n])})):(t=Vn(t),e.style[t]=n))},$i=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},ji=(e,t)=>Math.abs($i(e)-$i(t)),qi=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}},Ki=(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},Vi=(e,t)=>{if(Fn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},zi=e=>Math.pow(e,3),Wi=e=>e<.5?zi(2*e)/2:1-zi(2*(1-e))/2,Bi=e=>{const{minValues:n,onDragChange:r,onDragging:i}=e,{splitRef:l,direction:a}=t.useContext(Ai),{t:o}=Pn(),s=t.useRef(Fn?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),_i(document,"mousemove",h),_i(document,"mouseup",m),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${tr("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}),Di(document,"mousemove",h),Di(document,"mouseup",m),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Bi.displayName="ResizeBar";const Ui=t.forwardRef(((e,n)=>{const{offset:r,className:i,style:l}=e,{direction:a,dragging:o}=t.useContext(Ai),s="vertical"===a?"height":"width",c={[tr("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[i]:!!i},d=void 0!==r?{[s]:Gn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:_e(c),style:Object.assign(Object.assign({},d),l)},e.children)}));Ui.displayName="SplitPane";const Gi=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:l,style:a,onDragStart:o,onDrag:s=$n,onDragEnd:c}=e,{global:d}=t.useContext(nn),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));Pi((()=>{v?null==o||o(m(b)):(null==c||c(m(b)),localStorage.setItem(g,b),w(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(h(e)):C(g).then((e=>{localStorage.setItem(g,h(e||r)),E()})).catch((()=>{}))},C=e=>An(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){}})),w=(e,t)=>An(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;Hn(e)&&!Mn(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={[tr("split")]:!0,vertical:"vertical"===n};return t.createElement(Ai.Provider,{value:S},t.createElement("div",{ref:u,className:_e(O,l),style:a},t.createElement(Ui,Sn({},T.props,{ref:p,offset:b})),t.createElement(Bi,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Ui,I.props)))};Gi.displayName="QmSplit",Gi.Pane=Ui;const Yi=e=>{const{className:n,style:r}=e,{$size:i}=_n(e),l=tr("countup"),a={[l]:!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i};return t.createElement(_t,Sn({},e,{className:_e(a,n),style:r}),e.children)};Yi.displayName="QmCountup";const Xi=e=>{const{className:n}=e,{$size:r}=_n(e),i=tr("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,Sn({},l,{className:_e(a,n)}))};Xi.displayName="QmEmpty";const Qi=e=>{const n=sn({tip:"Loading..."},e),{fullHeight:r,className:i,style:l}=n,a=tr("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:_e(o,i)},Bn(n,["fullHeight"])),{style:Object.assign(Object.assign({},l),{maxHeight:"none"})});return t.createElement(T,s,n.children)};Qi.displayName="QmSpin";const Zi=t.createContext(void 0),Ji=new Map;const el=new Ft((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=Ji.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function tl(e,t){Ji.has(e)||(Ji.set(e,new Set),el.observe(e)),Ji.get(e).add(t)}function nl(e,t){Ji.has(e)&&(Ji.get(e).delete(t),Ji.get(e).size||(el.unobserve(e),Ji.delete(e)))}function rl(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&&tl(e,n),()=>{e&&nl(e,n)}}),[t]),n}function il(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 ll=6,al={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"}},ol=e=>{const{thumb:n,always:r,className:i,barSize:l=ll,direction:a="vertical",onDrag:o=$n}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(Zi),u=al[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(Fn?null:document.onselectstart),[b,x]=t.useState(!1);t.useLayoutEffect((()=>{p.current=n}),[n]),t.useEffect((()=>{const e=c.current;return Di(e,"mousemove",S),Di(e,"mouseleave",N),()=>{w(),_i(document,"mouseup",C),_i(e,"mousemove",S),_i(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)},C=()=>{g.current=!1,f.current={[u.axis]:0},_i(document,"mousemove",E),_i(document,"mouseup",C),w(),v.current&&x(!1),o(!1)},w=()=>{document.onselectstart!==y.current&&(document.onselectstart=y.current)},S=()=>{v.current=!1,x(!!p.current.size)},N=()=>{v.current=!0,x(g.current)},T=tr("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(gh,{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(),Di(document,"mousemove",E),Di(document,"mouseup",C),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])})}})))},sl=20,cl=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,innerStyle:l,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=sl,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=rl(p),C=rl(m);dn((()=>{!s&&w()}),[C.width,C.height,E.width,E.height]);const w=il((()=>{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)=>{se(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)*Wi(a),i(l)):e.scrollTop=t};i(l)})(h.current,e):h.current.scrollTop=e:Qn("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},T=(e,t)=>{se(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)*Wi(a),i(l)):e.scrollLeft=t};i(l)})(h.current,e):h.current.scrollLeft=e:Qn("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=tr("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(Zi.Provider,{value:I},c&&t.createElement(ol,{className:"top",direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(ol,{direction:"horizontal",thumb:f,barSize:a,always:o,onDrag:S}),t.createElement(ol,{direction:"vertical",thumb:v,barSize:a,always:o,onDrag:S})))}));cl.displayName="QmScrollbar";const dl=(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}},ul=(e,{fileName:t,headers:n,params:r})=>An(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(on("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));dl(o,c)})),pl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},hl=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},ml=e=>{var n,r;const i=sn({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}=Pn(),{$size:x}=_n(i),C=t.useRef(null),w=t.useRef(null),[S,N]=t.useState({}),T=t.useMemo((()=>d||u),[d,u]);t.useEffect((()=>(A(),()=>{var e;return null===(e=w.current)||void 0===e?void 0:e.destroy()})),[]);const k=(e,t)=>{N((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},L=Dn((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&&(w.current=Ht.create(Ki(C.current,tr("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:L}))},P=e=>An(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=i;try{e.url&&(yield ul(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){R.error(b("qm.download.error"))}})),D=tr("upload-file"),_={[D]:!0,[`${D}--lg`]:"large"===x,[`${D}--sm`]:"small"===x,[`${D}--horizontal`]:"horizontal"===a};return t.createElement(I,Sn({className:_e(_,h)},Bn(i,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>An(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=>An(void 0,void 0,void 0,(function*(){if("function"==typeof m)return m(e,(t=>P(t||e)));d||(yield P(e))})),onDownload:e=>An(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($e,null)),t.createElement("div",{className:"ant-upload-list-item-name"},S[a]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:pl(o),onBlur:t=>{const{value:n}=t.target;if(n!==pl(o)){const t=Object.assign({},e,{name:`${n}.${hl(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(je,null)),c&&t.createElement("button",{type:"button",className:_e(h,"preview"),onClick:()=>n.preview()},t.createElement(Ke,null)),t.createElement("button",{type:"button",className:_e(h,"download"),disabled:d,onClick:()=>n.download()},t.createElement(Ve,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:C},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=>An(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"))))};ml.displayName="QmUploadFile";const fl=e=>{const n=sn({icon:t.createElement(Ve,null),withCredentials:!1},e),{$size:r}=_n(n),{t:i}=Pn(),[l,a]=t.useState(!1),o=Bn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,Sn({},o,{size:r,loading:l,onClick:()=>An(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:l,beforeDownload:a=jn,onSuccess:o}=n,s=de(e)?e:yield An(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 Qn("Download","参数 `action` 有误!");if(!a(s))return;yield ul(s,{fileName:t,headers:r,params:l}),yield qn(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 gl(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])}fl.displayName="QmDownload";const vl=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))})))},yl=e=>{const{label:n,showDivider:r,className:i,style:l}=e,a={[tr("anchor-item")]:!0};return t.createElement("div",{className:_e(a,i),style:l},r&&t.createElement(nr,{label:n,style:{marginBottom:10}}),e.children)};yl.displayName="AnchorItem";const bl=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:i,labelWidth:l,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=_n(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=Mt(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=ji(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=>ji(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=gl((e=>{if("ready"!==h.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),C=e=>{const t=x(e);t&&(g(e),h.current="stop",p.current&&clearTimeout(p.current),$t(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,C(e)}})));const w=tr("anchor"),S={[w]:!0,[`${w}-left`]:"left"===a,[`${w}-top`]:"top"===a,[`${w}--lg`]:"large"===d,[`${w}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;Hn(e)&&!Mn(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?Gn(l):""}},t.createElement(vl,{activeKey:f,labels:T,onTabClick:(e,t)=>{C(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:_e("anchor-container")},v?e.children:N))}));bl.displayName="QmAnchor",bl.Item=yl;const xl=e=>t.createElement(k.TabPane,e,e.children);xl.displayName="TabPane";const El=e=>{const n=sn({tabPosition:"top"},e),{items:r,tabPosition:i,tabBarGutter:l,className:a,authConfig:o}=n,{$size:s}=_n(n),c=tr("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},Bn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=l?l:["top","bottom"].includes(i)?30:0}),p=[];t.Children.map(n.children,(e=>{var t;Hn(e)&&!Mn(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,Sn({},u,{items:h,className:_e(d,a)}))};El.displayName="QmTabs",El.TabPane=xl;const Cl=t.forwardRef(((e,n)=>{var r;const i=sn({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(nn),{$size:v}=_n(i),y=t.useRef(null),b=t.useRef(null),x=t.useRef(!1),[E,C]=t.useState(!1),[w,S]=t.useState(!1),[N,T]=t.useState(!1);Pi((()=>{(null!=a?a:l)&&(!p&&x.current||ue(s)&&S(!0))}),[null!=a?a:l]),Pi((()=>{b.current&&Mi(b.current,E?{width:"100%"}:{width:Gn(i.width||"72%")})}),[E]);const I=()=>{b.current=Ki(y.current,"ant-drawer-content-wrapper"),C(!E),null==f||f(!E)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>T(!0),STOP_LOADING:()=>T(!1)})));const R=tr("drawer"),O={[R]:!0,"no-header":!c,[`${R}--lg`]:"large"===v,[`${R}--sm`]:"small"===v};return t.createElement(L,Sn({},Bn(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?We:Be))),footer:null,afterOpenChange:e=>{e?(x.current=!0,ue(s)&&setTimeout((()=>S(!1)),100)):(C(!1),null==m||m())},onClose:h}),i.children,(s||N||w)&&t.createElement(Qi,{spinning:!0,className:_e("spinning")}))}));Cl.displayName="QmDrawer";const wl="10vh";var Sl;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Sl||(Sl={}));const Nl=t.forwardRef(((e,n)=>{var r;const i=sn({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:wl}},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(nn),{$size:E}=_n(i),C=t.createRef(),w=t.useRef(!1),S=t.useMemo((()=>`calc(100vh - ${wl} - ${wl} - ${Sl[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}),[F,H]=t.useState();Pi((()=>{if(null!=a?a:l){if(!f&&w.current||ue(d)&&R(!0),!f&&w.current)return;setTimeout((()=>{w.current=!0,ue(d)&&R(!1)}),400)}}),[null!=a?a:l]),Pi((()=>{H(N?{x:0,y:0}:void 0)}),[N]);const M=e=>{const t=Ki(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");N?(Mi(t,{width:Gn(o||"60%"),height:"auto",top:wl}),Mi(n,{height:s?Gn(s):S,maxHeight:"auto"===s?S:""})):(Mi(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Mi(n,{height:`calc(100vh - ${Sl[p?E:"none"]}px)`,maxHeight:""})),T(!N),null==v||v(!N)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>k(!0),STOP_LOADING:()=>k(!1)})));const $=tr("modal"),j={height:s?Gn(s):S,maxHeight:"auto"===s?S:"",overflow:"auto"},q={[$]:!0,"no-header":!p,[`${$}--lg`]:"large"===E,[`${$}--sm`]:"small"===E};return t.createElement(A,Sn({},Bn(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(q,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:M},t.createElement(N?We:Be))),footer:null,bodyStyle:Object.assign({},j,g),onCancel:y,afterClose:()=>{null==b||b(),T(!1)},modalRender:e=>t.createElement(jt,{nodeRef:C,bounds:D,position:F,disabled:!u||L||N,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,i=C.current.getBoundingClientRect();i&&_({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:C},e))}),i.children,(d||O||I)&&t.createElement(Qi,{spinning:!0,className:_e("spinning")}))}));Nl.displayName="QmModal";const Tl=n(void 0),Il=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var Rl={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)Il.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 Ol=["==","<",">","<=",">=","!=","like","likes","in","nin"];var kl=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},Ll=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++)Ol.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),Ol.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const Al=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Pl=["string","number","boolean","symbol"],Dl=e=>Pl.includes(typeof e),_l=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Fl=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(Al,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Fl(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Fl(t))));break;case"in":Dl(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Dl(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(_l(e)?e.slice(0,10):e)!=n;break;case"<":r=(_l(e)?e.slice(0,10):e)<n;break;case"<=":r=(_l(e)?e.slice(0,10):e)<=n;break;case">":r=(_l(e)?e.slice(0,10):e)>n;break;case">=":r=(_l(e)?e.slice(0,10):e)>=n;break;default:r=(_l(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const Hl=Rl.stringify,Ml=Rl.array_format,$l=kl,jl=(e,t,n)=>{let r=[];t=Rl.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Ll(t,"record")};`);r=Ea(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Ll(t,"array[i]")};`);for(let t=0,i=e.length;t<i;t++)n(e,t)&&r.push(e[t])}}catch(t){Qn("Table","组件 `initialFilter` 参数有误!"),r=e}return r},ql=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...ql(e.children)):t.push(e)})),t},Kl=e=>e.filter((e=>(e.children&&(e.children=Kl(e.children)),!e.hidden&&!e.noAuth))),Vl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Vl(e.children))})),t},zl=(e,t)=>e.map((e=>(e.children&&(e.children=zl(e.children,t)),null==t||t(e),e))),Wl=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Wl(n.children,t);if(e)return e}}return null},Bl=e=>{const t=e.children;return t?t[0].children?Bl(t[0]):t[0]:e},Ul=e=>{const t=e.children;return t?t[t.length-1].children?Ul(t[t.length-1]):t[t.length-1]:e},Gl=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Yl=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Yl(n.children,t);if(e)return e}}return null},Xl=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Xl(e.children))})),t},Ql=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Ql(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},Zl=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 Vl(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Jl=e=>Object.assign(e,{__prevent__:!0}),ea=e=>{delete e.__prevent__},ta=(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 ta(e.offsetParent,t,n)}return n},na=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ra=(e,t)=>he(e,((e,n,r)=>{me(n,t[r])||(e[r]=oe(n)&&oe(t[r])?ra(n,t[r]):n)})),ia=(e,t)=>{var n;return null!==(n=pe(e,t))&&void 0!==n?n:""},la=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),fe(e,t,null!=n?n:"")},aa=(e,t)=>{if(!t.includes("|"))return ia(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(ia(e,t))})),n.every((e=>!e))?"":n.join(" | ")},oa=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),sa=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]}`:""}`},ca=(e,t)=>{const n=e.toString();if(!oa(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)},da=(e,t)=>e?h(e,t):null,ua=(e,t)=>e?h(e).format(t):"",pa=(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)}))},ha=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...ha(e))}))}else n.push(e);return n},ma=e=>ha(e).join(""),fa=e=>e.filter((e=>!e._group)),ga=(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)?Ml(l.condition):Hl(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])?Ml(a[e]):Hl(a[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},va=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(ia(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},ya=(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=ya(e[n].children,t);if(r)return[e[n],r].flat()}}},ba=(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=ba(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},xa=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=xa(n.children,t);if(e)return e}if(t(n))return n}return null},Ea=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Ea(e.children,t),t(e)||e.children&&e.children.length))),Ca=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),wa=e=>["","small","middle","large"].includes(e),Sa=80,Na="1",Ta="0",Ia=400,Ra=["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"],Oa={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 ka,La,Aa;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(ka||(ka={})),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"}(La||(La={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Aa||(Aa={}));const Pa={items:Vt.arrayOf(Vt.shape({type:Vt.string.isRequired,fieldName:Vt.string.isRequired})),initialValues:Vt.object,initialExtras:Vt.object,layout:Vt.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!wa(e[t]||""))return Xn("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Vt.number,className:Vt.string,style:Vt.object,compactMode:Vt.bool,labelWidth:Vt.oneOfType([Vt.number,Vt.string]),labelAlign:Vt.oneOf(["left","right"]),labelWrap:Vt.bool,formType:Vt.oneOf(["default","search","onlyShow"]),disabled:Vt.bool,uniqueKey:Vt.string,defaultRows:Vt.number,defaultExpand:Vt.bool,searchButtonCols:Vt.number,scrollToFirstError:Vt.bool,authConfig:Vt.object,isAutoFocus:Vt.bool,isCollapse:Vt.bool,isFieldsDefine:Vt.bool,isSearchBtn:Vt.bool,isSubmitBtn:Vt.bool,fieldsChange:Vt.func,onValuesChange:Vt.func,onFieldsChange:Vt.func,onFinish:Vt.func,onFinishFailed:Vt.func,onReset:Vt.func,onCollapse:Vt.func},Da={layout:"horizontal",labelWidth:Sa,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:$n,onFieldsChange:$n,onFinish:$n,onFinishFailed:$n,onReset:$n,onCollapse:$n},_a=(e,t)=>{if(!e)return null;if(t===La.week){const t=e.match(/^(\d{4})-(\d+)/);return t?h().year(Number(t[1])).week(Number(t[2])):null}if(t===La.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)},Fa=(e,t)=>e?h(e).format(t):"",Ha=e=>""===e||null==e,Ma=(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},$a=(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]]},ja=(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]]},qa=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),ue(e.isLeaf)||(r.isLeaf=!!e.isLeaf),ue(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=qa(e.children,t,n)),r})),Ka=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=Ka(n.children,t);if(e)return e}}return null},Va=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...Va(e.children,t,n+1))})),r},za=e=>Hn(e)||"string"==typeof e,Wa=e=>Hn(e)?ha(e).join(""):null!=e?e:"",Ba=(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 Ua={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 Ga="阿",Ya="鿿",Xa=1,Qa=2,Za=3;let Ja,eo=null;function to(e){return e||null===eo?("object"==typeof Intl&&Intl.Collator?(Ja=new Intl.Collator(["zh-Hans-CN","zh-CN"]),eo=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):eo=!1,eo):eo}function no(e){const t=Ua.UNIHANS,n=Ua.PINYINS,r=Ua.EXCEPTIONS,i={source:e};if(e in r)return i.type=Qa,i.target=r[e],i;let l,a=-1;if(e.charCodeAt(0)<256)return i.type=Xa,i.target=e,i;if(l=Ja.compare(e,Ga),l<0)return i.type=Za,i.target=e,i;if(0===l)i.type=Qa,a=0;else{if(l=Ja.compare(e,Ya),l>0)return i.type=Za,i.target=e,i;0===l&&(i.type=Qa,a=t.length-1)}if(i.type=Qa,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const i=t[a];if(l=Ja.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=Za,i.target=i.source),i}function ro(e){return"string"==typeof e&&to()?e.split("").map((e=>no(e))):e}var io={isSupported:to,parse:ro,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Ua)})))},genToken:no,convertToPinyin:(e,t,n)=>ro(e).map((e=>t&&e.type===Qa?e.target.toLowerCase():e.target)).join(n||"")};var lo={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)}};io.isSupported()&&lo.shouldPatch(io.genToken)&&io.patchDict(lo);const ao=e=>{const{value:n,bordered:r}=e;return t.createElement(O,{value:n,title:n,bordered:r,readOnly:!0})};ao.displayName="FormItemView";const{Option:oo}=F,so=e=>{const{$$form:n}=t.useContext(Tl),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Pn(),{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=Ia,collapseTags:C,maxTagTextLength:w,dropdownStyle:S,openPyt:N=!0}=u,T=zn(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(ao,{value:R(r),bordered:m}):t.createElement(F,Sn({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:C?"responsive":void 0,maxTagTextLength:w},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=io.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(oo,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class co extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>An(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=pe(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;me(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Gn(d)},required:e.getFormItemRequired(f)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:f,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(so,{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(_,null,e.renderFormItemButton(o,h)),p&&t.createElement(_,{flex:Gn(p.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}co.contextType=Tl;const uo=e=>{const{$$form:n}=t.useContext(Tl),{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=Ta,trueValue:h=Na}=o,{t:m}=Pn(),f=e=>m(e===h?"am.form.trueText":"am.form.falseText");return t.createElement(H,{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 po 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=$n}=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":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(uo,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}po.contextType=Tl;const ho=e=>{const{uniqueKey:n,items:r,fieldsChange:i}=e,{global:l}=t.useContext(nn),{$$form:a}=t.useContext(Tl),{$size:o}=_n(e),{t:s}=Pn(),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,An(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 ge(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?(ue(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 ue(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(p));var r,i;me(t,n)||(localStorage.setItem(p,JSON.stringify(t)),r=p,i=t,An(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(Zn,{type:"text",size:"small",onClick:()=>(e=>{const t=e.map((e=>{const t=r.find((t=>t.fieldName===e.fieldName))||Un(e);return Object.assign(t,{hidden:e.hidden})}));g(t),m(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(Zt,{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(me(t,n))return;a.setExpandHandle(!0);const i=Ca(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(H,{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(Ge,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=tr("form-fields-filter"),b={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(M,{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(Ue,null)))};ho.displayName="FieldsFilter";const mo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Tl),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Pn(),{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:C,pattern:w,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,D=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(ao,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(D),bordered:u}):t.createElement(P,{ref:e=>{L.current=e,"function"==typeof n&&n(e)},value:D,autoComplete:E?"new-password":I,autoFocus:T,placeholder:d,style:c,title:E?"":D,prefix:b,suffix:x,maxLength:C,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;ve(w)&&(t=w.test(t)?t:null!=i?i:""),S&&(t=t.toUpperCase()),A(t)}})}));mo.displayName="VInput";class fo 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(mo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(l,t)}}))),u&&t.createElement(_,null,e.renderFormItemButton(l,u)),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}fo.contextType=Tl;const go=e=>{const{$$form:n}=t.useContext(Tl),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Pn(),{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(ao,{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 vo 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(o)},required:e.getFormItemRequired(u)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(go,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(_,{flex:Gn(c.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}vo.contextType=Tl;const yo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Tl),{value:i,onChange:l,onValuesChange:a}=e,{t:o}=Pn(),{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:C,textAlign:w="left",controls:S=!0,formatter:N,parser:T}=s,I=t.useRef(),R=t.useRef(i),O=e=>{const t=Ha(e)?"":se(e)?e.toFixed(x):new Wt(e).toFixed(x);return"function"==typeof N?N(t):t},k={[w]:!0,controls:S};return r.isOnlyShow?t.createElement(ao,{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:C,formatter:N,parser:T,bordered:u,readOnly:p,disabled:h,onFocus:e=>{null==m||m(e.target.value,e)},onBlur:t=>{Kn((()=>{(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:"";!C&&(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)}})}));yo.displayName="VInputNumber";class bo 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(yo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(l,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(l,u)),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}bo.contextType=Tl;const xo=e=>{const{$$form:n}=t.useContext(Tl),{value:r=[],onChange:i,onValuesChange:l}=e,{t:a}=Pn(),{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]),C(e)},C=e=>{const t=e.every((e=>null===e))?[]:[...e];null==i||i(t),l(t,w(t))},w=e=>Ha(e)?"":e.map((e=>Ha(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(ao,{value:w(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=>{C([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=>{C([r[0],e])},onBlur:()=>{E(r)}}))};class Eo 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(s),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(o)},required:e.getFormItemRequired(u)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(xo,{option:this.props.option,onValuesChange:(t=[],n)=>{p(t),e.setViewValue(l,n)}}))),c&&t.createElement(_,{flex:Gn(c.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},c)))))}}var Co;Eo.contextType=Tl,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Co||(Co={}));const{Search:wo}=O;class So extends s{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=qt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>An(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=()=>An(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||Qn("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)||Qn("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Qn("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>An(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&&!zn(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=pe(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&$a(e,this.alias,c),d&&ja(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Ma(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(oe(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=jn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>An(this,void 0,void 0,(function*(){var o;const s=ye({},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=pe(e.data,t.fetch.dataKey))&&void 0!==o?o:[];l(n)}else a()}catch(e){a(e)}finally{Kn((()=>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=Ma(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=Ma(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>An(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=Ma(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)=>An(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,i=(null!=r?r:jn)(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]:Ma(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Ma(e,this.extras[n])});const r=Ma(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=on("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:on("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Co[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(ao,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(wo,{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):this.clearSearchHelperValue())}}),t.createElement(Nl,b,t.createElement(Kp,x)))}}So.contextType=Tl;class No extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>An(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Xn("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 Qn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>An(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ba(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":Gn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(So,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Gn(u.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}No.contextType=Tl;const To=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=Mt(document,"mousedown",this.mousedownHandler),this.event2=Mt(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,Sn({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,Sn({},e,{forwardedRef:r}))))};function Io(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 Ro(e,t,n,r){var i=Xt.unstable_batchedUpdates?function(e){Xt.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 Oo=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&&Vr()&&(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?Xt.createPortal(i,s.current):null}));function ko(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var Lo;function Ao(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 Po(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=dr({motionAppear:!0},Ao({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(bi,xi({},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 Do(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 _o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Do(Object(n),!0).forEach((function(t){Ho(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Do(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fo(e){return Fo="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},Fo(e)}function Ho(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mo={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function $o(){if(void 0!==Lo)return Lo;Lo="";var e=document.createElement("p").style;for(var t in Mo)t+"Transform"in e&&(Lo=t);return Lo}function jo(){return $o()?"".concat($o(),"TransitionProperty"):"transitionProperty"}function qo(){return $o()?"".concat($o(),"Transform"):"transform"}function Ko(e,t){var n=jo();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function Vo(e,t){var n=qo();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var zo,Wo=/matrix\((.*)\)/,Bo=/matrix3d\((.*)\)/;function Uo(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Go(e,t,n){var r=n;if("object"!==Fo(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):zo(e,t);for(var i in t)t.hasOwnProperty(i)&&Go(e,i,t[i])}function Yo(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 Xo(e){return Yo(e)}function Qo(e){return Yo(e,!0)}function Zo(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+=Xo(r),t.top+=Qo(r),t}function Jo(e){return null!=e&&e==e.window}function es(e){return Jo(e)?e.document:9===e.nodeType?e:e.ownerDocument}var ts=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),ns=/^(top|right|bottom|left)$/,rs="currentStyle",is="runtimeStyle",ls="left";function as(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function os(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function ss(e,t,n){"static"===Go(e,"position")&&(e.style.position="relative");var r=-999,i=-999,l=as("left",n),a=as("top",n),o=os(l),s=os(a);"left"!==l&&(r=999),"top"!==a&&(i=999);var c,d="",u=Zo(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[jo()]||"",Ko(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")),Uo(e);var p=Zo(e),h={};for(var m in t)if(t.hasOwnProperty(m)){var f=as(m,n),g="left"===m?r:i,v=u[m]-p[m];h[f]=f===m?g+v:g-v}Go(e,h),Uo(e),("left"in t||"top"in t)&&Ko(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=as(b,n),E=t[b]-u[b];y[x]=b===x?h[x]+E:h[x]-E}Go(e,y)}function cs(e,t){var n=Zo(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(qo());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(qo());if(r&&"none"!==r){var i,l=r.match(Wo);l?((i=(l=l[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,i[5]=t.y,Vo(e,"matrix(".concat(i.join(","),")"))):((i=r.match(Bo)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,i[13]=t.y,Vo(e,"matrix3d(".concat(i.join(","),")")))}else Vo(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,i)}function ds(e,t){for(var n=0;n<e.length;n++)t(e[n])}function us(e){return"border-box"===zo(e,"boxSizing")}"undefined"!=typeof window&&(zo=window.getComputedStyle?function(e,t,n){var r=n,i="",l=es(e);return(r=r||l.defaultView.getComputedStyle(e,null))&&(i=r.getPropertyValue(t)||r[t]),i}:function(e,t){var n=e[rs]&&e[rs][t];if(ts.test(n)&&!ns.test(t)){var r=e.style,i=r[ls],l=e[is][ls];e[is][ls]=e[rs][ls],r[ls]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[ls]=i,e[is][ls]=l}return""===n?"auto":n});var ps=["margin","border","padding"],hs=-1,ms=2,fs=1;function gs(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(zo(e,o))||0}return a}var vs={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 ys(e,t,n){var r=n;if(Jo(e))return"width"===t?vs.viewportWidth(e):vs.viewportHeight(e);if(9===e.nodeType)return"width"===t?vs.docWidth(e):vs.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],l="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=us(e),o=0;(null==l||l<=0)&&(l=void 0,(null==(o=zo(e,t))||Number(o)<0)&&(o=e.style[t]||0),o=Math.floor(parseFloat(o))||0),void 0===r&&(r=a?fs:hs);var s=void 0!==l||a,c=l||o;return r===hs?s?c-gs(e,["border","padding"],i):o:s?r===fs?c:c+(r===ms?-gs(e,["border"],i):gs(e,["margin"],i)):o+gs(e,ps.slice(r),i)}ds(["Width","Height"],(function(e){vs["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],vs["viewport".concat(e)](n))},vs["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 bs={position:"absolute",visibility:"hidden",display:"block"};function xs(){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=ys.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,bs,(function(){r=ys.apply(void 0,t)})),r}function Es(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}ds(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);vs["outer".concat(t)]=function(t,n){return t&&xs(t,e,n?0:fs)};var n="width"===e?["Left","Right"]:["Top","Bottom"];vs[e]=function(t,r){var i=r;return void 0!==i?t?(us(t)&&(i+=gs(t,["padding","border"],n)),Go(t,e,i)):void 0:t&&xs(t,e,hs)}}));var Cs={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:es,offset:function(e,t,n){if(void 0===t)return Zo(e);!function(e,t,n){if(n.ignoreShake){var r=Zo(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?ss(e,t,n):n.useCssTransform&&qo()in document.body.style?cs(e,t):ss(e,t,n)}(e,t,n||{})},isWindow:Jo,each:ds,css:Go,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:Es,getWindowScrollLeft:function(e){return Xo(e)},getWindowScrollTop:function(e){return Qo(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Cs.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Es(Cs,vs);var ws=Cs.getParent;function Ss(e){if(Cs.isWindow(e)||9===e.nodeType)return null;var t,n=Cs.getDocument(e).body,r=Cs.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:ws(e);for(t=ws(e);t&&t!==n&&9!==t.nodeType;t=ws(t))if("static"!==(r=Cs.css(t,"position")))return t;return null}var Ns=Cs.getParent;function Ts(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Ss(e),i=Cs.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"===Cs.css(r,"overflow")){if(r===a||r===o)break}else{var s=Cs.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=Ss(r)}var c=null;Cs.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Cs.css(e,"position")&&(e.style.position="fixed"));var d=Cs.getWindowScrollLeft(l),u=Cs.getWindowScrollTop(l),p=Cs.viewportWidth(l),h=Cs.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(Cs.isWindow(e)||9===e.nodeType)return!1;var t=Cs.getDocument(e),n=t.body,r=null;for(r=Ns(e);r&&r!==n&&r!==t;r=Ns(r))if("fixed"===Cs.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 Is(e){var t,n,r;if(Cs.isWindow(e)||9===e.nodeType){var i=Cs.getWindow(e);t={left:Cs.getWindowScrollLeft(i),top:Cs.getWindowScrollTop(i)},n=Cs.viewportWidth(i),r=Cs.viewportHeight(i)}else t=Cs.offset(e),n=Cs.outerWidth(e),r=Cs.outerHeight(e);return t.width=n,t.height=r,t}function Rs(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 Os(e,t,n,r,i){var l=Rs(t,n[1]),a=Rs(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 ks(e,t,n){return e.left<n.left||e.left+t.width>n.right}function Ls(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function As(e,t,n){var r=[];return Cs.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function Ps(e,t){return e[t]=-e[t],e}function Ds(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function _s(e,t){e[0]=Ds(e[0],t.width),e[1]=Ds(e[1],t.height)}function Fs(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=Ts(s,!(!(o=o||{})||!o.alwaysByViewport)),p=Is(s);_s(l,p),_s(a,t);var h=Os(p,t,i,l,a),m=Cs.merge(p,h);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&ks(h,p,u)){var f=As(i,/[lr]/gi,{l:"r",r:"l"}),g=Ps(l,0),v=Ps(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Os(p,t,f,g,v),p,u)||(d=1,i=f,l=g,a=v)}if(o.adjustY&&Ls(h,p,u)){var y=As(i,/[tb]/gi,{t:"b",b:"t"}),b=Ps(l,1),x=Ps(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Os(p,t,y,b,x),p,u)||(d=1,i=y,l=b,a=x)}d&&(h=Os(p,t,i,l,a),Cs.mix(m,h));var E=ks(h,p,u),C=Ls(h,p,u);if(E||C){var w=i;E&&(w=As(i,/[lr]/gi,{l:"r",r:"l"})),C&&(w=As(i,/[tb]/gi,{t:"b",b:"t"})),i=w,l=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&C,(c.adjustX||c.adjustY)&&(m=function(e,t,n,r){var i=Cs.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)),Cs.mix(i,l)}(h,p,u,c))}return m.width!==p.width&&Cs.css(s,"width",Cs.width(s)+m.width-p.width),m.height!==p.height&&Cs.css(s,"height",Cs.height(s)+m.height-p.height),Cs.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 Hs(e,t,n){var r=n.target||t,i=Is(r),l=!function(e,t){var n=Ts(e,t),r=Is(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 Fs(e,i,n,l)}Hs.__getOffsetParent=Ss,Hs.__getVisibleRectForElement=Ts;var Ms=Vr()?e.useLayoutEffect:e.useEffect,$s=function(t,n){var r=e.useRef(!0);Ms((function(){return t(r.current)}),n),Ms((function(){return r.current=!1,function(){r.current=!0}}),[])};function js(e,t){var n=null,r=null;var i=new Ft((function(e){var i=pr(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 qs(e){return"function"!=typeof e?null:e()}function Ks(e){return"object"===ar(e)&&e?e:null}var Vs=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=qs(n),s=Ks(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=Hs(l,o,r):s&&(a=function(e,t,n){var r,i,l=Cs.getDocument(e),a=l.defaultView||l.parentWindow,o=Cs.getWindowScrollLeft(a),s=Cs.getWindowScrollTop(a),c=Cs.viewportWidth(a),d=Cs.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 Fs(e,u,_o(_o({},n),{},{points:h}),p)}(l,s,r)),function(e,t){e!==document.activeElement&&Io(t,e)&&"function"==typeof e.focus&&e.focus()}(c,l),i&&a&&i(l,a),!0}return!1}),d),g=pr(f,2),v=g[0],y=g[1],b=pr(t.useState(),2),x=b[0],E=b[1],C=pr(t.useState(),2),w=C[0],S=C[1];return $s((function(){E(qs(l)),S(Ks(l))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=w)||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(gn(!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"===ar(t)&&"object"===ar(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 js(p.current,v)}),[p.current]),t.useEffect((function(){return js(x,v)}),[x]),t.useEffect((function(){i?y():v()}),[i]),t.useEffect((function(){if(s)return Ro(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:br(h.ref,p)})),h},zs=t.forwardRef(Vs);function Ws(){Ws=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"==ar(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=C(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 C(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,C(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 w(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(w,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 Bs(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 Us(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var l=e.apply(t,n);function a(e){Bs(l,r,i,a,o,"next",e)}function o(e){Bs(l,r,i,a,o,"throw",e)}a(void 0)}))}}zs.displayName="Align";var Gs=["measure","alignPre","align",null,"motion"],Ys=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,C=t.onMouseDown,w=t.onTouchStart,S=t.onClick,N=l(),T=l(),I=pr(u(),2),R=I[0],O=I[1],k=function(t){var n=pr(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=pr(k,2),A=L[0],P=L[1];var D=function(e,t){var n=pr(Ar(null),2),r=n[0],i=n[1],a=l();function s(e){i(e,!0)}function c(){pi.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=pi(Us(Ws().mark((function e(){var t,n;return Ws().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Gs.indexOf(r),(n=Gs[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=pi((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){p&&P(v())})),_=pr(D,2),F=_[0],H=_[1],M=pr(u(0),2),$=M[0],j=M[1],q=l();function K(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function V(e,t){var n=y(t);R!==n&&O(n),j((function(e){return e+1})),"align"===F&&(null==b||b(e,t))}$s((function(){"alignPre"===F&&j(0)}),[F]),$s((function(){"align"===F&&($<3?K():H((function(){var e;null===(e=q.current)||void 0===e||e.call(q)})))}),[$]);var z=dr({},Ao(t));function W(){return new Promise((function(e){q.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=z[e];z[e]=function(e,n){return H(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==F||H()}),[z.motionName,F]),e.useImperativeHandle(n,(function(){return{forceAlign:K,getElement:function(){return T.current}}}));var B=dr(dr({},A),{},{zIndex:d,opacity:"motion"!==F&&"stable"!==F&&r?0:void 0,pointerEvents:r||"stable"===F?void 0:"none"},s),U=!0;null==f||!f.points||"align"!==F&&"stable"!==F||(U=!1);var G=c;return e.Children.count(c)>1&&(G=e.createElement("div",{className:"".concat(i,"-content")},c)),e.createElement(bi,xi({visible:r,ref:T,leavedClassName:"".concat(i,"-hidden")},z,{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(zs,{target:g||v,key:"popup",ref:N,monitorWindowResize:!0,disabled:U,align:f,onAlign:V},e.createElement("div",{ref:n,className:o,onMouseEnter:x,onMouseLeave:E,onMouseDownCapture:C,onTouchStartCapture:w,onClick:S,style:dr(dr({},l),B)},G))}))}));Ys.displayName="PopupInner";var Xs=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=dr({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(bi,xi({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:dr(dr({},l),f)},g)}))}));Xs.displayName="MobilePopupInner";var Qs=["visible","mobile"],Zs=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,l=Er(t,Qs),a=pr(u(r),2),s=a[0],c=a[1],d=pr(u(!1),2),p=d[0],h=d[1],m=dr(dr({},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(Xs,xi({},m,{mobile:i,ref:n})):e.createElement(Ys,xi({},m,{ref:n}));return e.createElement("div",null,e.createElement(Po,m),f)}));Zs.displayName="Popup";var Js=e.createContext(null);function ec(){}function tc(){return""}function nc(e){return e?e.ownerDocument:window.document}var rc=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var ic=function(t){var n=function(n){Ir(i,e.Component);var r=kr(i);function i(t){var n,l;return wr(this,i),sr(Or(n=r.call(this,t)),"popupRef",e.createRef()),sr(Or(n),"triggerRef",e.createRef()),sr(Or(n),"portalContainer",void 0),sr(Or(n),"attachId",void 0),sr(Or(n),"clickOutsideHandler",void 0),sr(Or(n),"touchOutsideHandler",void 0),sr(Or(n),"contextMenuOutsideHandler1",void 0),sr(Or(n),"contextMenuOutsideHandler2",void 0),sr(Or(n),"mouseDownTimeout",void 0),sr(Or(n),"focusTime",void 0),sr(Or(n),"preClickTime",void 0),sr(Or(n),"preTouchTime",void 0),sr(Or(n),"delayTimer",void 0),sr(Or(n),"hasPopupMouseDown",void 0),sr(Or(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),sr(Or(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),sr(Or(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),sr(Or(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),sr(Or(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&Io(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),sr(Or(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),sr(Or(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),sr(Or(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),sr(Or(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),sr(Or(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),sr(Or(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),sr(Or(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)})),sr(Or(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)})),sr(Or(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),i=n.getPopupDomNode();Io(r,t)&&!n.isContextMenuOnly()||Io(i,t)||n.hasPopupMouseDown||n.close()}})),sr(Or(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=mr(n.triggerRef.current);if(t)return t}catch(e){}return Xt.findDOMNode(Or(n))})),sr(Or(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(ko(e[o].points,i,r))return"".concat(t,"-placement-").concat(o)}return""}(l,a,e,o)),s&&t.push(s(e)),t.join(" ")})),sr(Or(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,C=n.state,w=C.popupVisible,S=C.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(Zs,xi({prefixCls:r,destroyPopupOnHide:i,visible:w,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)})),sr(Or(n),"attachParent",(function(e){pi.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=pi((function(){n.attachParent(e)}))})),sr(Or(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})),sr(Or(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),sr(Or(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),sr(Or(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),l="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:l,popupVisible:l},rc.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return Nr(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=Ro(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Ro(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Ro(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Ro(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),pi.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 dr(dr({},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=dr({},d);xr(c)&&(p.ref=br(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(Js.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 sr(n,"contextType",Js),sr(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:tc,getDocument:nc,onPopupVisibleChange:ec,afterPopupVisibleChange:ec,onPopupAlign:ec,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}(Oo);let lc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=qt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>An(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Qn("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Qn("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=>An(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:jn)(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(be([...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;me(n,r)||me(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return An(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(zn(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=pe(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=on("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:l,title:on("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Co[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ye({},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"},on("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=tr("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(ao,{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(ic,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Oa,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(F,{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(F.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(Ye,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Nl,C,t.createElement(Kp,w)))}};lc.contextType=Tl,lc=Ln([To],lc);class ac extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>An(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Xn("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 Qn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>An(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ba(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Gn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(lc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Gn(u.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}ac.contextType=Tl;const{Search:oc}=O;class sc extends s{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=qt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>An(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=()=>An(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||Qn("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)||Qn("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Qn("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=()=>An(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&&!zn(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=pe(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&$a(e,this.alias,c),d&&ja(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Ma(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=Ma(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]:Ma(e,this.extras[n])})},this.openSearchHelper=e=>An(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:jn)(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]:Ma(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:Ma(e,this.extras[n])});const r=Ma(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=on("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:on("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Co[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:ye({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(ao,{value:l,bordered:p}):t.createElement(t.Fragment,null,t.createElement(oc,{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(Nl,b,t.createElement(Bp,x)))}}sc.contextType=Tl;class cc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>An(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Xn("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 Qn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>An(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ba(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Gn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(sc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Gn(u.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}cc.contextType=Tl;let dc=class extends s{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=qt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>An(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Qn("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Qn("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=>An(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:jn)(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(be([...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;me(n,r)||me(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),i&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return An(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(zn(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=pe(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=on("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:l,title:on("qm.searchHelper.text"),width:null!==(e=p.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Co[i.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:i.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:ye({},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"},on("qm.table.config.emptyText"))),T=this.searchRef.current?this.searchRef.current.offsetWidth:300,I=tr("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(ao,{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(ic,{popupVisible:!y&&a,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Oa,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(F,{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(F.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(Ye,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Nl,C,t.createElement(Bp,w)))}};dc.contextType=Tl,dc=Ln([To],dc);class uc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>An(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Xn("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 Qn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>An(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ba(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Gn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(dc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Gn(u.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}uc.contextType=Tl;const pc=new Array(2).fill("");class hc extends s{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:pc},this.getSearchHelper=qt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>An(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Qn("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Qn("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(pc),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=>An(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:jn)(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]:zn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=jn,formatter:i=(e=>e)}=t.fetch;return new Promise(((l,a)=>An(this,void 0,void 0,(function*(){var o;const s=ye({},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(Kn((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=pe(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return l(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>An(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;me(t,n)||me(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:i}=this.props.option;if(!me(r[i],this._ceho_data)&&(this._ceho_data=r[i],this.setItemList(r[i]),n.length)){const e=pc.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 An(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(zn(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=pe(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=on("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=l.every((e=>Ha(e)))?"":l.join(" - "),f={visible:r,title:on("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Co[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:ye({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(ao,{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(Nl,f,t.createElement(Xp,g)))}}hc.contextType=Tl;class mc extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>An(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Xn("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 Qn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>An(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ba(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(c),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(hc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{m(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(a,u)),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}mc.contextType=Tl;const fc=e=>{const{$$form:n}=t.useContext(Tl),{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=zn(p)?i:p,m=e=>h.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(ao,{value:m(r),bordered:c}):t.createElement(H.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(H,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class gc 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;me(r,i)||this.getItemList()}getItemList(){var e;return An(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=pe(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Gn(c)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(fc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,{flex:Gn(u.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}gc.contextType=Tl;const vc=e=>{const{$$form:n}=t.useContext(Tl),{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(j,{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 yc 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(vc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}yc.contextType=Tl;const bc=e=>{const{$$form:n}=t.useContext(Tl),{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=zn(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(ao,{value:m(r),bordered:c}):t.createElement(q.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(q,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class xc extends s{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>An(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=pe(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;me(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Gn(c)},required:e.getFormItemRequired(h)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(bc,{option:this.props.option,items:n,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,{flex:Gn(u.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}xc.contextType=Tl;const Ec=e=>{const{$$form:n}=t.useContext(Tl),{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=Ta,trueValue:h=Na}=o,{t:m}=Pn();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(Xe,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 Cc 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=$n}=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":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ec,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Cc.contextType=Tl;const wc=e=>{const{$$form:n}=t.useContext(Tl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Pn(),{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 Sc 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(wc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Sc.contextType=Tl;const Nc=e=>{const{$$form:n}=t.useContext(Tl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Pn(),{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,C=t.createRef(),w=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==i||i(e),l(e,S(e))},S=e=>Ha(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Fa(h().subtract(e,"day"),La[g]);"date"===g&&(t=t.slice(0,10)),w(t),C.current.blur(),C.current.focus()};return n.isOnlyShow?t.createElement(ao,{value:S(r),bordered:u}):t.createElement(wn,{ref:C,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:ka[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(V,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(V,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(V,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(V,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:_a(r,La[g]),onChange:(e,t)=>{w(Fa(e,La[g]))}})};class Tc 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Nc,{option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Tc.contextType=Tl;const Ic=e=>[h().subtract(e,"day"),h()],Rc=e=>{const{$$form:n}=t.useContext(Tl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Pn(),{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:C,shortCuts:w=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:Ic(7),[a("qm.form.dateRangePickers")[1]]:Ic(30),[a("qm.form.dateRangePickers")[2]]:Ic(90),[a("qm.form.dateRangePickers")[3]]:Ic(180)},N=e=>Ha(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(ao,{value:N(r),bordered:u}):t.createElement(wn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:ka[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,C]),ranges:w&&g.includes("date")?S:void 0,value:zn(r)?null:[_a(null==r?void 0:r[0],La[g]),_a(null==r?void 0:r[1],La[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))})([Fa(null==e?void 0:e[0],La[g]),Fa(null==e?void 0:e[1],La[g])])}})};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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{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(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Oc.contextType=Tl;const kc=e=>{const{$$form:n}=t.useContext(Tl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Pn(),{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(ao,{value:r,bordered:u}):t.createElement(Nn,{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:Aa[f],value:_a(r,Aa[f]),onChange:(e,t)=>{(e=>{const t=Fa(e,Aa[f]);null==i||i(t),l(t)})(e)}})};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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{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(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Lc.contextType=Tl;const Ac=e=>{const{$$form:n}=t.useContext(Tl),{value:r,onChange:i,onValuesChange:l}=e,{t:a}=Pn(),{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=>Ha(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(ao,{value:E(r),bordered:u}):t.createElement(Nn.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:Aa[f],value:zn(r)?null:[_a(null==r?void 0:r[0],Aa[f]),_a(null==r?void 0:r[1],Aa[f])],onChange:(e,t)=>{(e=>{const t=[Fa(null==e?void 0:e[0],Aa[f]),Fa(null==e?void 0:e[1],Aa[f])];null==i||i(t),l(t,E(t))})(e)}})};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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{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(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Pc.contextType=Tl;class Dc 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=qt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.paramsChangeHandler=(e,t)=>An(this,void 0,void 0,(function*(){yield this.props.waiting(),me(e,t)||this.getItemList()})),this.echoSearchHelper=()=>An(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.initialHandle=()=>An(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||Qn("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)||Qn("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),l&&!this.valueKey&&Qn("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&Qn("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getItemText=()=>An(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&&!zn(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=pe(o.data,i))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&$a(e,this.alias,c),d&&ja(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=Ma(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=Ma(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]:Ma(e,this.extras[n])})},this.fetchHandle=xe(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]:Ma(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:Ma(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=Ma(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 An(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=pe(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=on("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=Ia}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=tr("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},pe(e,n.dataIndex))))))))):t.createElement(Xi,null));return t.createElement(nn.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(ao,{value:a,bordered:u}):t.createElement(ic,{action:m?[]:["click"],popupVisible:!m&&n,popup:E,popupClassName:_e(s,`form-popper__${o}`),popupStyle:{minWidth:x,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Oa,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)}})))}))}}Dc.contextType=Tl;class _c extends s{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>An(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Xn("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 Qn("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>An(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:i});if(200===n.code){const t=Ba(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(i),className:_e(d),tooltip:l,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Gn(c)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:a,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Dc,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(a,p)),u&&t.createElement(_,{flex:Gn(u.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}_c.contextType=Tl;class Fc 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=$n}=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(nr,{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)}}))}}Fc.contextType=Tl;const Hc=(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:Hc(e.children,t,n,r)}):e)),Mc=e=>{const{$$form:n}=t.useContext(Tl),{value:r,items:i,multiple:l,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Pn(),{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=Ia,checkStrictly:C,checkStrategy:w="SHOW_CHILD",collapseTags:S,defaultExpandAll:N=!g,defaultExpandedKeys:T,dropdownStyle:I,openPyt:R=!0}=u,[O,k]=t.useState(zn(b)?i:b),L=t.useRef(O);Pi((()=>{const e=zn(b)?i:b;g?me(e,L.current)||(k(e),L.current=e):k(e)}),[b,i]);const A=e=>{var t;return(null===(t=Ka(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(ao,{value:P(r),bordered:m}):t.createElement(z,Sn({fieldNames:{label:"text",value:"value",children:"children"},value:r,multiple:l,treeCheckable:l,treeCheckStrictly:C,showCheckedStrategy:z[w],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})=>An(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=pe(t.data,l))&&void 0!==n?n:[],i=Hc(O,e,o,qa(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=io.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 $c extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>An(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=pe(t.data,i))&&void 0!==e?e:[],r=qa(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;me(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Gn(d)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Mc,{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(_,{flex:Gn(p.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}$c.contextType=Tl;const jc=e=>{const{$$form:n}=t.useContext(Tl),{value:r,multiple:i,items:l}=e,{t:a}=Pn(),{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:C=!0}=s,[w,S]=t.useState(zn(g)?l:g),N=t.useRef(w);Pi((()=>{const e=zn(g)?l:g;h?me(e,N.current)||(S(e),N.current=e):S(e)}),[g,l]);const T=e=>Va(w,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(ao,{value:I(r),bordered:u}):t.createElement(W,Sn({value:(e=>zn(e)?[]:i?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:w,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=io.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${r}|${i}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:h?e=>An(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=pe(e.data,l))&&void 0!==t?t:[],i=Hc(w,n.value,o,qa(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),w)})(((e=[])=>i?e.map((e=>e.join(","))):e.join(","))(t))}}))};class qc extends s{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>An(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=pe(t.data,i))&&void 0!==e?e:[],r=qa(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;me(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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(l),className:_e(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Gn(d)},required:e.getFormItemRequired(m)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:o,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(jc,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(_,{flex:Gn(p.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}qc.contextType=Tl;const Kc=["110000","120000","310000","500000"],Vc=["810000","820000"],zc=[{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"}],Wc=[{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"}],Bc=e=>io.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Uc=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...Kc,...Vc].includes(e))):Object.keys(e[t])).map((r=>({l:Bc(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:Uc(e,r,n+1)})))},Gc=(e,t)=>t.map((t=>({l:Bc(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class Yc 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}),$t(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:Gc(tn,Kc)},{l:"Z2",n:"港澳",c:"",p:"",children:Gc(tn,Vc)}]}createProvince(){var e;return(null!==(e=Uc(tn,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Wc.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Kc,...Vc].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(q.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(q.Button,{value:"0"},on("qm.form.citySelectType.0")),t.createElement(q.Button,{value:"1"},on("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?zc:Wc).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(F,{size:"small",placeholder:on("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(F.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=on("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=tr("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(nn.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(ao,{value:m,bordered:s}):t.createElement(ic,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Oa,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)}})))}))}}Yc.contextType=Tl;class Xc 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Yc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Xc.contextType=Tl;const Qc=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:Qc(e,n)})))};class Zc 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=Qc(tn,"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=Ka(e,t[r]);if(i&&zn(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 An(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=pe(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)||`${on("qm.form.selectPlaceholder").replace("...","")}(${on("qm.form.regionSelectLabel")[r]})`;return t.createElement(El.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(El,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(Xi,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:i,options:l={},style:a={},placeholder:o=on("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,p=tr("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(nn.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(ao,{value:f,bordered:s}):t.createElement(ic,{action:u?[]:["click"],popupVisible:!u&&n,popup:m,popupClassName:_e(l,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Oa,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&&Kn((()=>this.initial()))}})))}))}}Zc.contextType=Tl;class Jc 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Zc,{option:this.props.option,onValuesChange:(t,n)=>{h(t,n),e.setViewValue(l,n)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}Jc.contextType=Tl;const ed=e=>{const{$$form:n}=t.useContext(Tl),{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:C}=a,{action:w,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:D}=Pn();return t.createElement(ml,{name:"file",action:w,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(Ve,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||D("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(I?pe(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:C})};class td 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ed,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}td.contextType=Tl;const nd=e=>{const{$$form:n}=t.useContext(Tl),{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:C,withCredentials:w=!1,dataKey:S="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,O="function"==typeof T?T():T||{},{t:k}=Pn();return t.createElement(Td,{name:"file",action:x,multiple:d,headers:E,data:C,withCredentials:w,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?pe(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 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{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=>{h(t),e.setViewValue(l,"")}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}rd.contextType=Tl;const id=e=>{const{$$form:n}=t.useContext(Tl),{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(wd,{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 ld 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=$n}=this.props.option;return t.createElement(P.Item,{label:e.renderFormLabel(r),className:_e(c),tooltip:i,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Gn(s)},required:e.getFormItemRequired(p)},t.createElement(D,{wrap:!1,gutter:4},t.createElement(_,{flex:"auto"},t.createElement(P.Item,{name:l,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(id,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(l,t)}}))),d&&t.createElement(_,{flex:Gn(d.labelWidth||Sa)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}ld.contextType=Tl;class ad 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=xe(this.resizeObserveHandler,10),this.getFormItems=qt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=qt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{oe(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:on("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&$t(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(){tl(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){nl(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&&Qn("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=>oe(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=>oe(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,Ra.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:Ta),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=Un(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),Kn((()=>{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(za(e))return Wa(e);if(oe(e)){const{fieldName:a,label:o,options:s={}}=e;if(za(o))return Wa(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(Ha(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{Ha(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)zn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return An(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let i=Bn(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?pe(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(fo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(vo,{option:e})}INPUT_NUMBER(e){return t.createElement(bo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(Eo,{option:e})}SEARCH_HELPER(e){return t.createElement(No,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(ac,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(cc,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(uc,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(mc,{option:e})}CHECKBOX(e){return t.createElement(po,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(gc,{option:e})}RATE(e){return t.createElement(yc,{option:e})}RADIO(e){return t.createElement(xc,{option:e})}SWITCH(e){return t.createElement(Cc,{option:e})}TEXT_AREA(e){return t.createElement(Sc,{option:e})}DATE(e){return t.createElement(Tc,{option:e})}RANGE_DATE(e){return t.createElement(Oc,{option:e})}TIME(e){return t.createElement(Lc,{option:e})}RANGE_TIME(e){return t.createElement(Pc,{option:e})}SELECT(e){return t.createElement(co,{option:e})}MULTIPLE_SELECT(e){return t.createElement(co,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(_c,{option:e})}DIVIDER(e){return t.createElement(Fc,{option:e})}TREE_SELECT(e){return t.createElement($c,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement($c,{option:e,multiple:!0})}CASCADER(e){return t.createElement(qc,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(qc,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(Xc,{option:e})}REGION_SELECT(e){return t.createElement(Jc,{option:e})}UPLOAD_FILE(e){return t.createElement(td,{option:e})}UPLOAD_IMG(e){return t.createElement(rd,{option:e})}TINYMCE(e){return t.createElement(ld,{option:e})}renderFormLabel(e){if(za(e)||!oe(e))return e;const{type:n,fieldName:r,label:i,options:l={},onChange:a=$n}=e,{itemList:o=[]}=l;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(so,{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(uo,{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(C,{className:"extra-tooltip",title:a[n]},t.createElement(Qe,{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":Gn(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):null)}createFormItem(e){return ce(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(Qn("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(_,{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(Un(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(_,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(S,{style:{marginBottom:12}},t.createElement(Zn,{type:"primary",size:this.$size,icon:t.createElement(Ye,null),onClick:()=>this.SUBMIT_FORM()},on("qm.form.search")),t.createElement(Zn,{size:this.$size,icon:t.createElement(Ze,null),onClick:()=>this.RESET_FORM()},on("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(Fe,null):t.createElement(He,null)," ",on(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(D,{gutter:0},t.createElement(_,{key:"-",span:i},t.createElement(P.Item,null,t.createElement(S,{style:{marginBottom:12}},t.createElement(Zn,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},on("qm.form.save")),t.createElement(Zn,{size:this.$size,onClick:()=>this.RESET_FORM()},on("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(ho,{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)=>An(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:[on("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 An(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 An(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 An(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){Qn("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 Qn("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!oe(t))return Qn("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(l.noAuth)return Qn("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||fe(l,n,t[n]));n&&(i?i([...r]):Qn("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:l,labelAlign:a,labelWrap:o,customClass:s}=this.props,c=tr("form"),d={required:"${label}"+on("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":Gn(l)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Tl.Provider,{value:this.provide},t.createElement(D,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}ad.contextType=nn,ad.propTypes=Pa,ad.defaultProps=Da;const od={onActivate:Kt.func,onAddUndo:Kt.func,onBeforeAddUndo:Kt.func,onBeforeExecCommand:Kt.func,onBeforeGetContent:Kt.func,onBeforeRenderUI:Kt.func,onBeforeSetContent:Kt.func,onBeforePaste:Kt.func,onBlur:Kt.func,onChange:Kt.func,onClearUndos:Kt.func,onClick:Kt.func,onContextMenu:Kt.func,onCommentChange:Kt.func,onCopy:Kt.func,onCut:Kt.func,onDblclick:Kt.func,onDeactivate:Kt.func,onDirty:Kt.func,onDrag:Kt.func,onDragDrop:Kt.func,onDragEnd:Kt.func,onDragGesture:Kt.func,onDragOver:Kt.func,onDrop:Kt.func,onExecCommand:Kt.func,onFocus:Kt.func,onFocusIn:Kt.func,onFocusOut:Kt.func,onGetContent:Kt.func,onHide:Kt.func,onInit:Kt.func,onKeyDown:Kt.func,onKeyPress:Kt.func,onKeyUp:Kt.func,onLoadContent:Kt.func,onMouseDown:Kt.func,onMouseEnter:Kt.func,onMouseLeave:Kt.func,onMouseMove:Kt.func,onMouseOut:Kt.func,onMouseOver:Kt.func,onMouseUp:Kt.func,onNodeChange:Kt.func,onObjectResizeStart:Kt.func,onObjectResized:Kt.func,onObjectSelected:Kt.func,onPaste:Kt.func,onPostProcess:Kt.func,onPostRender:Kt.func,onPreProcess:Kt.func,onProgressState:Kt.func,onRedo:Kt.func,onRemove:Kt.func,onReset:Kt.func,onSaveContent:Kt.func,onSelectionChange:Kt.func,onSetAttrib:Kt.func,onSetContent:Kt.func,onShow:Kt.func,onSubmit:Kt.func,onUndo:Kt.func,onVisualAid:Kt.func,onSkinLoadError:Kt.func,onThemeLoadError:Kt.func,onModelLoadError:Kt.func,onPluginLoadError:Kt.func,onIconsLoadError:Kt.func,onLanguageLoadError:Kt.func},sd=Object.assign({apiKey:Kt.string,id:Kt.string,inline:Kt.bool,init:Kt.object,initialValue:Kt.string,onEditorChange:Kt.func,value:Kt.string,tagName:Kt.string,cloudChannel:Kt.string,plugins:Kt.oneOfType([Kt.string,Kt.array]),toolbar:Kt.oneOfType([Kt.string,Kt.array]),disabled:Kt.bool,textareaName:Kt.string,tinymceScriptSrc:Kt.string,rollback:Kt.oneOfType([Kt.number,Kt.oneOf([!1])]),scriptLoading:Kt.shape({async:Kt.bool,defer:Kt.bool,delay:Kt.number})},od),cd=e=>"function"==typeof e,dd=e=>e in od,ud=e=>e.substr(2),pd=(e,t,n,r,i)=>((e,t,n,r,i,l,a)=>{const o=Object.keys(i).filter(dd),s=Object.keys(l).filter(dd),c=o.filter((e=>void 0===l[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=ud(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const i=r(e,n),l=ud(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 hd=0;const md=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return hd++,e+"_"+n+hd+String(t)},fd=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),gd=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),vd=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},yd=()=>({listeners:[],scriptId:md("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),bd=(()=>{let e=yd();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=yd()}}})(),xd=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Ed 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=xd(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,gd(o).concat(gd(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&&!fd(i)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&cd(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;vd(this.editor,i?"readonly":"design"),this.props.init&&cd(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(i.style.visibility=""),fd(i)&&(i.value=this.getInitialValue()),l.init(a)},this.id=this.props.id||md("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;vd(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,i,l;null!==xd(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&bd.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=xd(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){pd(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 Cd;Ed.propTypes=sd,Ed.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(Cd||(Cd={}));const wd=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(nn),{$size:m}=_n(e),{$locale:f,t:g}=Pn(),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:Cd[f],skin:"tinymce-5"},Bn(l,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>new Promise(((t,n)=>An(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?pe(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)}))}}),C=tr("tinymce"),w={[C]:!0,[`${C}--lg`]:"large"===m,[`${C}--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(w,r),style:i},t.createElement(Ed,S))};wd.displayName="QmTinymce";const Sd=t.forwardRef(((e,n)=>{const r=sn({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=kn(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 zt(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)},C=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},w=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)},D=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},_=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},F=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},H=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},M=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:C,rotate:w,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:D,setCropBoxData:_,getCroppedCanvas:F,setAspectRatio:H,setDragMode:M})));const $={[tr("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)}))}));Sd.displayName="Cropper";const Nd=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:i,quality:l,beforeCrop:a,className:o}=e,{t:s}=Pn(),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=tr("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=kn(r,["beforeUpload"]);return d.current=i,t.createElement(n.type,Object.assign(Object.assign({},l),{beforeUpload:(e,t)=>new Promise(((n,r)=>An(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:()=>{An(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=>An(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 Qn("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,l),yield qn(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(Sd,{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(Je,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(et,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(tt,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(E,{type:"primary",size:"middle",icon:t.createElement(nt,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},Td=e=>{const n=sn({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}=Pn(),{$size:b}=_n(n),x=t.useRef(null),E=t.useRef(null),C=t.useRef(!1),[w,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",D),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",D)})),[]),Pi((()=>{k||(C.current=!1)}),[r]);const L=Dn((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=Ht.create(Ki(x.current,tr("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)=>An(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)})))),D=Dn((e=>An(void 0,void 0,void 0,(function*(){const{action:t,data:i,headers:l}=n;if(C.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){}}})))),_=tr("upload-img"),F={[_]:!0,[`${_}--lg`]:"large"===b,[`${_}--sm`]:"small"===b},H=t.createElement(I,Sn({className:_e(F,h)},Bn(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(Xe,{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(rt,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:()=>{C.current=!0},onBlur:()=>{C.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,i?t.createElement(Nd,{className:m,fixedSize:l,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},H):H,t.createElement("div",{style:{display:"none"}},t.createElement(U.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:w,current:N,rootClassName:m,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(U,{key:e.uid||n,src:e.url,alt:""}))))))};Td.displayName="QmUploadImg";const Id=(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=Id(l.children,t,n);e&&(r=e)}}return r},Rd=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Rd(e.children,t),t(e)||e.children&&e.children.length))),Od=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Od(e.children,t)),t(e)&&n.push(e)})),n},kd=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=kd(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Ld=(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:Ld(e.children,t,n,r)}):e)),Ad=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...Ad(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},Pd=(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=Pd(e[r].children,t,n);if(i)return[e[r][n],i].flat()}}},Dd=(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(...Dd(e,t)))),r},_d=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:C=!0,onSelectChange:w,onCheckChange:S,onDragStart:N,onDragChange:T,onExpand:I}=e,{$size:R}=_n(e),{t:k}=Pn(),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),D=t.useRef(null),_=rl(P),[F,H]=t.useState(v),[M,$]=t.useState(!1),j=il((()=>{H(P.current.offsetHeight-ee.current.offsetHeight-10)}),5);dn((()=>{v||j()}),[_.height]);const[q,K]=t.useState([]),[V,z]=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)),z({}))}),[s]),t.useEffect((()=>{var e;oe(),d&&(null===(e=D.current)||void 0===e||e.focus())}),[]),Pi((()=>{oe()}),[null==c?void 0:c.params]),Pi((()=>{Y(ae())}),[V]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=kd(q,(t=>e===t[L]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],re([...q]))},REMOVE_RECORD:e=>{var t;const n=Id(q,e,L);if(void 0===n&&q.find((t=>t[L]===e)))re(q.filter((t=>t[L]!==e)));else{const r=kd(q,(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([...q]))}},UPDATE_RECORD:(e,t)=>{const n=kd(q,(t=>e===t[L]));n&&(ye(n,t),re([...q]))}})));const re=e=>{K(e),te.current=e,ne.current=Ad(e,L)},ie=e=>{if(a)return y;const t=Od(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},le=e=>{var t;return(null===(t=Pd(q,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=Ka(q,t);if(n){const r=le(t),i=Dd(n,L);e.push(...r,...[t,...i].filter((e=>ne.current.includes(e))))}}}else e.push(...le(t))})),[...new Set([...b,...e])]},oe=()=>An(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=pe(a.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,re(t),B(ie(t)),z({}),null==l||l(t)}}catch(e){}$(!1)})),se=e=>`${e}|${io.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ce=tr("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:D,value:X,size:R,placeholder:m||k("qm.form.inputPlaceholder"),suffix:t.createElement(Ye,null),allowClear:!0,onChange:e=>(e=>{if(!l)return;const t=Rd(te.current,(t=>{if(!e)return!0;const n=t[A]||"";return-1!==se(n).indexOf(e)}));Q(e),K(t),Y(x||e?Ad(t,L):ae())})(e.target.value)}),C&&t.createElement("a",{className:"trigger",onClick:()=>{J(!Z),Y(Z?[]:ne.current)}},Z?t.createElement(Fe,null):t.createElement(He,null)," ",k(Z?"qm.form.collect":"qm.form.spread"))),t.createElement(Qi,{spinning:M},t.createElement(G,{fieldNames:{title:A,key:L,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:F,disabled:e.disabled,checkStrictly:p,selectedKeys:null!=g?g:W,checkedKeys:null!=g?g:W,expandedKeys:U,treeData:q,loadData:u?({key:e,children:t})=>An(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=pe(t.data,l))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const i=Ld(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=[...q];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,q)},onExpand:(e,t)=>{zn(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=Od(te.current,(t=>e.includes(pe(t,L))));null==w||w(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(Id(q,e,L))))));const t=Od(te.current,(t=>e.includes(pe(t,L))));null==S||S(a?t:t[0])}})))}));_d.displayName="QmSearchTree";const Fd=n(void 0),Hd={dataIndex:Vt.string.isRequired,title:Vt.string.isRequired,description:Vt.string,colSpan:Vt.number,width:Vt.number,minWidth:Vt.number,fixed:Vt.oneOf(["left","right"]),align:Vt.oneOf(["left","center","right"]),theadAlign:Vt.oneOf(["left","center","right"]),printFixed:Vt.bool,hidden:Vt.bool,noAuth:Vt.bool,noFixed:Vt.bool,ellipsis:Vt.bool,className:Vt.string,theadClassName:Vt.string,children:Vt.array,sorter:Vt.oneOfType([Vt.bool,Vt.func]),filter:Vt.shape({type:Vt.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Vt.arrayOf(Vt.shape({text:Vt.string,value:Vt.oneOfType([Vt.string,Vt.number])})),style:Vt.object}),precision:Vt.number,displayPrecision:Vt.number,formatType:Vt.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Vt.bool,canCopy:Vt.bool,editRender:Vt.func,dictItems:Vt.arrayOf(Vt.shape({text:Vt.string,value:Vt.oneOfType([Vt.string,Vt.number])})),summation:Vt.shape({sumBySelection:Vt.bool,displayWhenNotSelect:Vt.bool,dataKey:Vt.string,unit:Vt.string,render:Vt.func}),groupSummary:Vt.shape({dataKey:Vt.string,unit:Vt.string,render:Vt.func}),shouldCellUpdate:Vt.func,headRender:Vt.func,render:Vt.func};Vt.arrayOf(Vt.shape(Hd)).isRequired,Vt.func,Vt.array,Vt.oneOfType([Vt.string,Vt.func]).isRequired,Vt.number,Vt.bool,Vt.bool,Vt.shape({api:Vt.func.isRequired,params:Vt.object.isRequired,formatter:Vt.func,beforeFetch:Vt.func,afterFetch:Vt.func,stopToFirst:Vt.bool,dataKey:Vt.string,callback:Vt.func}),Vt.bool,Vt.bool,Vt.string,Vt.string,Vt.object,Vt.bool,Vt.bool,Vt.bool,Vt.oneOfType([Vt.object,Vt.func]),Vt.oneOfType([Vt.object,Vt.func]),Vt.array,Vt.func,Vt.bool,Vt.object,Vt.object,Vt.shape({type:Vt.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Vt.array,selectedRowKeys:Vt.array,hideSelectAll:Vt.bool,checkStrictly:Vt.bool,filterable:Vt.bool,selectByClickRow:Vt.bool,selectFirstRowOnChange:Vt.bool,clearableAfterFetched:Vt.bool,selectAllOnCurrentPage:Vt.bool,fetchSelectedRows:Vt.shape({api:Vt.func.isRequired,params:Vt.object,dataKey:Vt.string}),fetchAllRowKeys:Vt.shape({api:Vt.func.isRequired,params:Vt.object,dataKey:Vt.string}),disabled:Vt.func,onChange:Vt.func,onSelect:Vt.func,onSelectAll:Vt.func}),Vt.shape({currentRowKey:Vt.oneOfType([Vt.number,Vt.string]),disabled:Vt.func,onChange:Vt.func}),Vt.shape({virtual:Vt.bool,overscan:Vt.number,doubleXScrollbar:Vt.bool}),Vt.shape({expandIconColumn:Vt.string}),Vt.shape({defaultExpandAllRows:Vt.bool,defaultExpandedRowKeys:Vt.array,expandedRowKeys:Vt.array,hideExpandAll:Vt.bool,rowExpandable:Vt.func,expandedRowClassName:Vt.string,expandedRowRender:Vt.func,onExpand:Vt.func,onChange:Vt.func}),Vt.shape({cellMerge:Vt.bool,onCellMerge:Vt.func,onSelectChange:Vt.func}),Vt.shape({groupItems:Vt.arrayOf(Vt.shape({dataIndex:Vt.string.isRequired,titleIndex:Vt.string,color:Vt.string,backgroundColor:Vt.string})),fetch:Vt.shape({api:Vt.func.isRequired,params:Vt.object,dataKey:Vt.string}),onChange:Vt.func}),Vt.func,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.shape({current:Vt.number,pageSize:Vt.number,pageSizeOptions:Vt.array,showSizeChanger:Vt.bool,showQuickJumper:Vt.bool}),Vt.shape({fileName:Vt.string,fetch:Vt.shape({api:Vt.func.isRequired,params:Vt.object}),beforeExport:Vt.func,cellStyle:Vt.bool,hideIcon:Vt.bool}),Vt.shape({showLogo:Vt.bool}),Vt.shape({fetch:Vt.shape({api:Vt.func.isRequired,params:Vt.object,dataKey:Vt.string}),fieldList:Vt.arrayOf(Vt.object)}),Vt.shape({position:Vt.oneOf(["top","bottom"]),hideAlert:Vt.bool,hideClearButton:Vt.bool}),Vt.oneOf(["left","right"]),Vt.func,Vt.func,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.bool,Vt.func,Vt.func,Vt.func,Vt.func,Vt.func,Vt.func,Vt.func,Vt.func,Vt.func;const Md={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},$d=10,jd="1",qd="0",Kd="YYYY-MM-DD",Vd="YYYY-MM-DD HH:mm:ss",zd="YYYYMMDDHHmmss",Wd={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 Bd;!function(e){e.left="flex-start",e.right="flex-end"}(Bd||(Bd={}));const Ud=Object.assign({},e).useId;let Gd=0;var Yd=Ud?function(e){const t=Ud();return e||t}:function(t){const[n]=e.useState(`qm_unique_${Gd}`);return e.useEffect((()=>{Gd+=1}),[]),t||n};let Xd=[];const Qd={_getInstance:function(e){var t;return null!==(t=Xd.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=Xd[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==Xd.findIndex((e=>e===t))&&(this.deregister(e),Xd=[t,...Xd])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),Xd=[{id:e,vm:t},...Xd])},deregister:function(e){e&&(Xd=Xd.filter((t=>t.id!==e)))}};class Zd{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 Jd={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 eu(e){return void 0!==e}function tu(t,n){const{defaultValue:r,value:i,onChange:l,postState:a}=n||{},[o,s]=e.useState((()=>eu(i)?i:eu(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=eu(i)?i:o,d=a?a(c):c,u=Dn(l),[p,h]=e.useState([c]);dn((()=>{const e=p[0];o!==e&&u(o,e)}),[p]),dn((()=>{eu(i)||s(i)}),[i]);return[d,Dn((e=>{s(e),h([c])}))]}const nu=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=nu(t.children)),t})),ru=(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:C,tableFlatData:w,selectionKeys:S,sorter:N,filters:T,superFilters:I,pagination:R,mergedTdCells:O}=n,{selectionRows:k,summaries:L}=x.current,{expandIconColumn:A=""}=c||{},{t:P}=Pn(),D=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]})(nu(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Jd.selectionColumn,title:"radio"===t?P("qm.table.config.selectionText"):"",width:Jd.selectionColumnWidth,fixed:"left",type:t}})(a),r=(null==(i=s)?void 0:i.expandedRowRender)?{dataIndex:Jd.expandableColumn,title:"",width:Jd.selectionColumnWidth,fixed:"left",type:"expand"}:null;var i;return n&&t.unshift(n),r&&t.unshift(r),Kl(t)},_=(e,t,n,r,i)=>{const l=`${t},${n}`;e.has(l)||e.set(l,{row:t,col:n,rowSpan:r,colSpan:i})},F=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),H=t.useMemo((()=>!F&&!!d),[F,d]),M=t.useMemo((()=>F&&!!u),[F,u]),$=t.useMemo((()=>(F||H)&&!M),[F,H,M]),j=t.useMemo((()=>D(i)),[i]),q=t.useMemo((()=>ql(j)),[j]),K=t.useMemo((()=>q.filter((e=>"function"==typeof e.editRender))),[q]),V=t.useMemo((()=>q.filter((e=>!!e.summation))),[q]),z=t.useMemo((()=>q.filter((e=>"left"===e.fixed))),[q]),W=t.useMemo((()=>q.filter((e=>"right"===e.fixed))),[q]),B=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=w.findIndex((t=>E(t,t.index)===e.rowKey)),r=q.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){_(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||_(t,n+i,r+l,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(O)),[O,q,C]),U=t.useMemo((()=>{var e,t;const n=q.filter((e=>![Jd.expandableColumn,Jd.selectionColumn,Jd.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:""}),[q,A]),G=t.useMemo((()=>V.length>0),[V]),Y=t.useMemo((()=>!!b||G),[b,G]),X=t.useMemo((()=>Zl(j).length>1),[j]),Q=t.useMemo((()=>l||X),[l,X]),Z=t.useMemo((()=>q.some((e=>e.sorter))),[q]),J=t.useMemo((()=>q.some((e=>e.filter))),[q]),ee=t.useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),te=t.useMemo((()=>!F&&!!f),[F,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((()=>!F&&!!h&&J),[F,h,J]),ae=t.useMemo((()=>!F&&!!y),[F,y]),oe=t.useMemo((()=>!!m&&q.some((e=>!!e.groupSummary))),[q]),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((()=>!w.length),[w]),de=t.useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:i,summation:l}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=l,c=se?fa(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[Jd.summaryIgnore])return e;const r=ia(t,n);return oa(r)?e.plus(r):e}),new Wt(0));!Object.keys(L).includes(n)||a&&!d||(u=new Wt(ia(L,n))),la(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=ca(p,i)),p=sa(p),la(e,`${n}_text`,s?`${p} ${s}`:p)})),[e]})()),[w,S,L]),ue=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),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?{[Jd.sorterFieldName]:t}:null,l=n.length?{[Jd.filterFieldName]:n}:null,a=ue?{[Jd.groupSummary.summaryFieldName]:ue,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[Jd.currentPageName]:R.current,[Jd.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:F,isWebPagination:H,isScrollPagination:M,showPagination:$,tableColumns:j,flattenColumns:q,editableColumns:K,summationColumns:V,leftFixedColumns:z,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}},iu=(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:C,tableElementRef:w,tableBodyRef:S,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:A,superFilters:P,fetchParams:D,selectionKeys:_,rowExpandedKeys:F,highlightKey:H,summationColumns:M,isFetch:$,isWebPagination:j,isScrollPagination:q,isServiceSummation:K,isGroupSubtotal:V,doLayout:z,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:ue,setPermission:he,setRecordsMap:me,resetTableScroll:fe,clearElementStore:ge,clearRecordsMap:ve}=n,{t:ye}=Pn(),{store:be}=C.current,xe=t.useRef(Object.assign({},D)),Ce=t.useRef(!1),we=rl(w);dn((()=>{Oe(),z()}),[T]),dn((()=>{Se()}),[we,N,i,k.tableAutoHeight]),Pi((()=>{at(),ot(),st(),$||(j&&Je(),Ue(l)),s&&ee(s),c&&te(c)}),[l,null==o?void 0:o.params]),Pi((()=>{const e=Ke(D,xe.current);e||$&&(null==d?void 0:d.clearableAfterFetched)&&ct(),!e&&D[Jd.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?Je():$&&We(),xe.current=D}),[D]),Pi((()=>{j&&nt(),q||fe(),$e()}),[O.current,O.pageSize]),Pi((()=>{$||Te(R.length),z()}),[R]),Pi((()=>{C.current.isTreeTable&&nt()}),[F]);const Se=()=>{const{scrollBarRef:e,resizeState:t}=C.current,{width:n,height:r}=we;z(),k.tableBodyWidth>n&&Q(!0),e.current.scrollLeft>0&&Z(!0),de(Object.assign({},t,{width:n,height:r}))},Ne=()=>{H&&S.current.setClickedValues([H,""]),"radio"===(null==d?void 0:d.type)&&_.length&&S.current.setClickedValues([_[0],""])},Te=e=>{e!==O.total&&X((t=>Object.assign({},t,{total:e})))},Ie=e=>{Ce.current=e},Re=il((e=>{Xe(),null==b||b(e)})),Oe=()=>{oe(I.length>Jd.virtualScrollX)},ke=(e=[])=>{let t=e.length>Jd.virtualScrollY;C.current.isTreeTable&&(t=!0),(null==p?void 0:p.virtual)&&(t=!0),se(t)},Le=e=>V?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 va(e,[i.dataIndex]).map((e=>{const n={children:Pe(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&la(n,r.toString(),pa()),i.titleIndex&&la(n,i.titleIndex,ia(e[0],i.titleIndex)),la(n,i.dataIndex,ia(e[0],i.dataIndex)),M.forEach((e=>{var t;const{dataIndex:r}=e,i=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[Jd.summaryIgnore])return e;const n=Number(ia(t,r));return Number.isNaN(n)?e:e+n}),0);la(n,r,i)})),n}))},De=e=>{re(e),ae((e=>{const{selectionRows:t,recordsMap:n}=C.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))},_e=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:_;let i=[];return C.current.isTreeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:l}=C.current,a=Yl(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=ba(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Yl(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},Fe=e=>{const{isTreeTable:t,allRowKeys:n,allParentRowKeys:r,deriveRowKeys:i,recordsMap:l}=C.current,{defaultExpandAllRows:a,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:F;if(t){s&&Qn("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[..._];H&&e.unshift(H),e.forEach((e=>{const t=ba(i,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)}))}return c=a?n.slice(0):[...new Set(c)],t&&(c=r.slice(0)),o&&c.filter((e=>{const t=l.get(e);return!!t&&o(t)})),c},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},$e=il((()=>{null==g||g(O,qe(L),je(A),P,{currentDataSource:tt()})})),je=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},Ke=(e,t)=>{const n=Object.keys(ra(e,t));return 1===n.length&&(n.includes(Jd.currentPageName)||n.includes(Jd.pageSizeName))},Ve=()=>An(void 0,void 0,void 0,(function*(){var t;if(!h)return;let n=Bn(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?pe(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=zl(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=Wl(C.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=()=>An(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:i=jn,afterFetch:l,callback:s}=o;if(!i(D))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(D)),a.fetch.api(r(D))]):[yield o.api(r(D))];if(C.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:Jd.dataKey;let a=null!==(n=pe(e.data,r))&&void 0!==n?n:[];a="function"==typeof l?yield l(a):a;const c=pe(e.data,r.replace(/[^.]+$/,Jd.totalKey))||a.length||0,d=Math.max(Math.ceil(c/O.pageSize),1);if(D[Jd.currentPageName]>d)return Qe(Object.assign(Object.assign({},O),{current:d}));Ue(Ce.current?C.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=il(ze),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!$||q?e:(t-1)*n+e})(t)),e))),Ue=e=>{const t=Le(Be(e));rt(t),it(t),De(_e()),ie(Fe()),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:Jd.summationKey,l=null!==(r=i?pe(e,i):e)&&void 0!==r?r:{},o={};M.filter((e=>!!e.summation.dataKey)).forEach((e=>{la(o,e.dataIndex,Number(ia(l,e.summation.dataKey)))})),ue(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);De([t])}else De([])}},Xe=()=>{if(!q)return;const e=Ze();Ce.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 C.current.tableFullData.slice((e-1)*t,e*t)},tt=()=>j?et():C.current.tableFullData,nt=()=>{const{allTableData:e,isTreeTable:t}=C.current,n=j?Xl(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);F.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(),C.current.allTableData.forEach((e=>me(E(e,e.index),e)))},at=()=>{ee({})},ot=()=>{te({})},st=()=>{ne([])},ct=()=>{De([])};return{initialTable:()=>{Ve(),Ne(),Oe(),ke(),$?ze():Ue(l)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Qn("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:rt,getTableData:ze,createTableList:tt,createTableData:Ue,createGroupData:Le,createSelectionKeys:_e,createRowExpandedKeys:Fe,setSelectionKeysEffect:De,findParentRowKeys:Me,getAllChildRowKeys:He,doFieldValidate:(e,t,n,r,i)=>{if(!Array.isArray(e))return Qn("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(be.removeFromRequired({x:n,y:r}),be.removeFromValidate({x:n,y:r}),e.forEach((e=>{var l;e.required&&zn(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=Ee(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=>![...Ee(r,n),...Ee(r,i)].includes(e))),removed:i.filter((e=>!l.includes(e)))}},dataChange:()=>{null==v||v(C.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}=C.current;ge(),be.destroy(),e.deregister(t)}}},lu=(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:C,isFullScreen:w,setLayout:S,setElementStore:N,setShouldToTop:T}=n,I=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=x,n={};return i&&Object.assign(n,{minHeight:`${na(i)}px`}),l&&Object.assign(n,{maxHeight:`${na(l)}px`}),w?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${na(r)}px`:`${t}px`}):n}),[r,l,i,w,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]):oe(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=Wl(f,e);e=t?Bl(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=Wl(f,e);e=t?Ul(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-(C?Co["small"!==m?"middle":m]+$d:0)-$d;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}=Jd,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)})(),Kn((()=>(()=>{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(w){const t=e.$toper?e.$toper.offsetHeight+$d:0,r=e.$pager?e.$pager.offsetHeight+$d:0;c=n.winHeight-t-r-20}S((e=>Object.assign({},e,{headerHeight:i,footerHeight:l,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function au({handler:t,delay:n=0}){const r=gl(t,n),i=Dn(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",i),()=>window.removeEventListener("resize",i))),[i])}const ou=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(Fd),{infoBarConfig:h,rowSelection:m,rowHighlight:f}=r.current.props,{allTableData:g,invalidRowKeys:v}=r.current,{hideAlert:y,hideClearButton:b}=h||{},{t:x}=Pn(),E=t.useMemo((()=>!y),[y]),C=t.useMemo((()=>!b&&!!(a||o||m||f)),[b,a,o,m,f]),w={[`${i}__alert`]:!0};return E?t.createElement("div",{className:_e(w)},t.createElement("i",{className:"svgicon icon"},t.createElement(it,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)})}`:""),C&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),Kn((()=>s()))}},x("qm.table.alert.clear"))):null},su=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{prefixCls:l,setFullScreen:a}=t.useContext(Fd),{t:o}=Pn(),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(We,null):t.createElement(Be,null))):null}));su.displayName="FullScreen";const cu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,getTableData:l}=t.useContext(Fd),{t:a}=Pn(),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(Ze,null))):null}));cu.displayName="Reload";const du=()=>{const e={dateFormat:e=>{const t=e?h(e).format(Kd):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?h(e).format(Vd):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?h(e).format(Vd.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>oa(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>sa(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=oa(m)?new Wt(m).toFixed(c):m),d>=0&&""!==m&&(m=ca(m,d)),u){const t=e[`${Vn(u)}Format`];t?m=t(m):Qn("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>Hn(e)?ha(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,l)=>{const a=ia(e,r.dataIndex),o=r.render?r.render(a,e,r,i,l):t(a,r,e);return n(o)}}},uu=t.forwardRef(((e,n)=>{var r,i,l,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(nn),{tableRef:d,prefixCls:u,flattenColumns:p,summationRows:h,showSummary:m,getSpan:f}=t.useContext(Fd),{tablePrint:g,showHeader:v}=d.current.props,{t:y}=Pn(),{getTitleFromCellValue:b}=du(),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:"",C=!(!x&&!E),w=t.useMemo((()=>Un(Gl(o,[Jd.expandableColumn,Jd.selectionColumn,Jd.operationColumn]))),[o]),S=t.useMemo((()=>Un(Gl(p,[Jd.expandableColumn,Jd.selectionColumn,Jd.operationColumn]))),[p]),N=t.useMemo((()=>Un(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},ya(w,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?T(t):t},I=(e,t)=>Ce(we(Se(e),t),Ne(((...e)=>Te(...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(Zl(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||l.minWidth||Jd.defaultColumnWidth,r<=Jd.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=Jd.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,minWidth:t,renderWidth:n})=>`<col style="width:${e||n||t||Jd.defaultColumnWidth}px">`)).join("")}</colgroup>`,v&&(i+=["<thead>",r&&C?`<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}">${ma(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${Xl(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*Jd.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):ia(e,`${i}_text`);return`<td>${0===r&&""===a?y("qm.table.config.summaryText"):Hn(a)?ha(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});dl(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(lt,null))):null}));uu.displayName="TablePrint";const pu="606060",hu="thin",mu="d4d4d4",fu=(e,t)=>{t&&(e.height=Math.floor(.75*t))},gu=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},vu=()=>({top:{style:hu,color:{argb:mu}},left:{style:hu,color:{argb:mu}},bottom:{style:hu,color:{argb:mu}},right:{style:hu,color:{argb:mu}}}),yu=e=>{const{children:t}=e;return t&&t.length?yu(t[0]):e},bu=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},xu=()=>{const{tableRef:e,getSpan:n,showSummary:r,isHeadGroup:i}=t.useContext(Fd),{spanMethod:l,showHeader:a}=e.current.props,{t:o}=Pn(),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)=>An(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:p}=t,{rowHeight:h}=e.current,m=ql(u),f=Zl(u),g=[],v=[],y=[],b=[];let x=0;const E={};m.forEach((e=>{const{dataIndex:t,width:n,minWidth:r,renderWidth:i}=e;E[t]=ma(e.title),y.push({key:t,width:(n||i||r||Jd.defaultColumnWidth)/8})})),a&&(i?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,l=yu(e),a=m.findIndex((({dataIndex:e})=>e===l.dataIndex));n[l.dataIndex]=ma(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 C=Xl(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?ia(e,i.dataIndex):d(e,t,i,a)})),r._level=e._level,r}));x+=C.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):ia(e,i);n[i]=0===r&&""===a?o("qm.table.config.summaryText"):Hn(a)?ha(a).join(""):a})),v.push(n)}));const{sheetName:w,useStyle:S}=t,N=new Jt.Workbook,T=N.addWorksheet(w);T.columns=y,a&&T.addRows(g).forEach((e=>{S&&fu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Wl(u,t.key),{align:r,theadAlign:i}=n;gu(e,i||r),S&&Object.assign(e,{font:{bold:!0,color:{argb:pu}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:vu()})}))})),T.addRows(C).forEach(((e,t)=>{const{_level:n}=C[t];S&&fu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),r=Wl(u,t.key),{align:i}=r;gu(e,i),Object.assign(e,bu(r)),S&&Object.assign(e,{font:{color:{argb:pu}},border:vu()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),r&&p&&T.addRows(v).forEach((e=>{S&&fu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Wl(u,t.key),{align:r}=n;gu(e,r),Object.assign(e,bu(n)),S&&Object.assign(e,{font:{color:{argb:pu}},border:vu()})}))})),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=ql(n),l=new FileReader;l.onerror=()=>{R.error(o("qm.table.import.error"))},l.onload=e=>{const n=i.map((e=>ma(e.title))),r=new Jt.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("")),oe(i)&&"text"in i&&(i=i.text),Ie(i)&&(i=ua(i,Vd)),(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])),la(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)}}},Eu=e=>{const{fileType:n,onChange:r}=e,{prefixCls:i}=t.useContext(Fd),{t:l}=Pn();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=()=>An(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(Zn,{onClick:()=>c()},l("qm.upload.text"))},Cu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,prefixCls:l,createTableData:a,dataChange:o}=t.useContext(Fd),{beforeTableImport:s}=i.current.props,{t:c}=Pn(),{importXLSX:d}=xu(),u=t.useRef(null),[p,h]=t.useState(!1),[m,f]=t.useState(!0),g=e=>e.filter((e=>![Jd.expandableColumn,Jd.selectionColumn,"index","pageIndex",Jd.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(Eu,{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(ad,{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(Zn,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(Zn,{type:"primary",loading:p,disabled:m,onClick:()=>An(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=>An(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"))))},wu=t.forwardRef(((e,n)=>{const{tableColumns:r,open:i=!0}=e,{prefixCls:l}=t.useContext(Fd),{t:a}=Pn(),[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(at,null))),t.createElement(Nl,u,t.createElement(Cu,{columns:r,onClose:()=>s(!1)})))}));wu.displayName="TableImport";const Su=e=>{const{columns:n,onChange:r}=e,{prefixCls:i,$size:l}=t.useContext(Fd),{t:a}=Pn(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);Pi((()=>{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(ic,{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(Zt,{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));me(t,n)||u(Ca(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(H,{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(Ge,null)),t.createElement("span",{className:"text"},ma(e.title)))})(e,"main")))))),popupClassName:_e(m),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Wd,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(ot,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},Nu=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:l,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(Fd),{rowSelection:d}=l.current.props,{t:u}=Pn(),p=t.useRef(null),[m,f]=t.useState(!1),g=t.useMemo((()=>Object.assign({},{fileName:`${h().format(zd)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:c?1:0,useStyle:0},n,{columns:Un(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(Su,{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(ad,{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(Zn,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(Zn,{type:"primary",loading:m,onClick:()=>An(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 qn(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},Tu=t.forwardRef(((e,n)=>{var r;const{tableColumns:i,open:l=!0}=e,{global:a}=t.useContext(nn),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:p,isGroupSubtotal:m,showSummary:f,getSpan:g}=t.useContext(Fd),{exportExcel:v,fetch:y,showHeader:b}=o.current.props,{t:x}=Pn(),{getTitleFromCellValue:E}=du(),[C,w]=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((()=>Gl(i,[Jd.expandableColumn,Jd.selectionColumn,Jd.operationColumn])),[i]),k=t.useMemo((()=>Gl(c,[Jd.expandableColumn,Jd.selectionColumn,Jd.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&&la(i,t,ia(i,t))})),i})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(m?fa(t):t).reduce(((e,t)=>{if(null==t?void 0:t[Jd.summaryIgnore])return e;const n=Number(ia(t,r));return Number.isNaN(n)?e:e+n}),0);la(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:D,exportCSV:_}=xu(),F=e=>An(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)),{[Jd.currentPageName]:1,[Jd.pageSizeName]:null!=e?e:d.total}));if(200===o.code){let e=Array.isArray(o.data)?o.data:null!==(t=pe(o.data,l))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,a=L(e)}}catch(e){}return N(!1),a})),H=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){}},M=(e,t)=>{const{columns:n,footSummation:r}=e,i=Zl(n),l=ql(n);let a='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${l.map((({width:e,minWidth:t,renderWidth:n})=>`<col style="width:${e||n||t||Jd.defaultColumnWidth}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}">${ma(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(a+=`<tbody>${Xl(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):ia(e,i);return`<td>${0===r&&""===a?x("qm.table.config.summaryText"):Hn(a)?ha(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(zd)}.xlsx`,j=$.slice($.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(I)return R.warning(x("qm.table.export.warnText"));var e;T?(e=$,An(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,[Jd.currentPageName]:void 0,[Jd.pageSizeName]:void 0}));r.data&&(dl(r.data,e),H(e))}catch(e){}N(!1)}))):w(!0)};t.useImperativeHandle(n,(()=>({clickHandle:q})));const K={[`${s}-export`]:!0},V={visible:C,title:x("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>w(!1)},z={fileName:$.slice(0,$.lastIndexOf(".")),fileType:j,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:()=>q()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ve,null))),t.createElement(Nl,V,t.createElement(Nu,{defaultValue:z,onClose:()=>w(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:Kl(e.columns)}),An(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 F()),"custom"===r&&(c=yield F(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 D(t,c,A,P);dl(n,`${e}.xlsx`),H(`${e}.xlsx`)}if("csv"===n){const n=_(t,M(t,c));dl(n,`${e}.csv`),H(`${e}.csv`)}}))}})))}));Tu.displayName="TableExport";const Iu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:l,prefixCls:a,dataChange:o}=t.useContext(Fd),{beforeClipboard:s}=i.current.props,{t:c}=Pn(),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:ma(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(ad,{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(Zn,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(Zn,{type:"primary",loading:h,onClick:()=>An(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&&(la(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"))))},Ru=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,flattenColumns:l}=t.useContext(Fd),{t:a}=Pn(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![Jd.expandableColumn,Jd.selectionColumn,"index","pageIndex",Jd.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(st,null))),t.createElement(Nl,p,t.createElement(Iu,{columns:c,onClose:()=>s(!1)})))}));Ru.displayName="TableClipboard";const Ou=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:l,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext(Fd),{rowKey:s,rowSelection:c}=i.current.props,{t:d}=Pn(),u=t.useRef(null),p=rl(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=>![Jd.expandableColumn,Jd.selectionColumn,"index","pageIndex",Jd.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=il((()=>{const e=u.current;y(e.offsetHeight-2*Co[l]-30)}),5);return dn((()=>{b()}),[p.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(qp,{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(Zn,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},ku=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(Fd),{rowSelection:h}=l.current.props,{t:m}=Pn(),[f,g]=t.useState(!1),v=t.useRef(!1);Pi((()=>{!v.current&&y()}),[d]);const y=()=>An(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=pe(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(ct,null))),t.createElement(Nl,x,t.createElement(Ou,{columns:r,onClose:()=>g(!1)})))}));ku.displayName="SelectCollection";const Lu=e=>{const{onClose:n}=e,{global:r}=t.useContext(nn),{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(Fd),{uniqueKey:g}=i.current.props,{t:v}=Pn(),y=t.useRef(null),b=t.useRef(null),x=t.useRef([]),E=t.useRef(""),C=t.useRef(-1),w=t.useRef("stop");Pi((()=>{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:ma(e.title),tooltip:e.description,options:{dateType:"exactdate",itemList:null!==(t=e.dictItems)&&void 0!==t?t:[]},onChange:()=>An(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=Re(Object.assign({},t,r),zn);k(i)}))}})),T={case:0,fullchar:0},I=t.useMemo((()=>c.filter((e=>![Jd.expandableColumn,Jd.selectionColumn,"index","pageIndex",Jd.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[c]),[R,k]=t.useState({}),[L,P]=t.useState(T),[D]=t.useState(N([I[0]])),[_]=t.useState(N(I.slice(1))),[F,M]=t.useState(0),$=t.useMemo((()=>!Object.keys(R).length),[R]);Pi((()=>{w.current="ready"}),[R,L]);const j=e=>{P(Object.assign({},L,e))},q=(e,t,n)=>new Promise(((r,i)=>{A.confirm({title:v("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),K=e=>An(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"===w.current&&(w.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=ia(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),M(x.current.length)),!x.current.length)return h(""),A.warning({title:v("qm.button.confirmPrompt"),content:v("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>x.current.length-1&&(yield q(v("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=x.current.length-1)))),"prev"===e&&(C.current=C.current<0?x.current.length-1:C.current-1,C.current<0&&(yield q(v("qm.table.fastSearch.toStart"),(()=>C.current=x.current.length-1),(()=>C.current=0))));const{isTreeTable:t,tableFullData:n,deriveRowKeys:r}=i.current,a=x.current[C.current],o=l(a,a.index);let s=a.index;if(t&&f){const e=ba(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)})),V=()=>{y.current.RESET_FORM(),b.current.RESET_FORM()},z=t.useMemo((()=>g?`fastSearch_${g}`:""),[g]),[W,B]=t.useState([]),[U,G]=t.useState(""),[Y,X]=t.useState("");Pi((()=>{if(Y){const{filters:e,config:t}=W.find((e=>e.value===Y)).list;y.current.SET_FIELDS_VALUE(Bn(e,_.map((e=>e.fieldName)))),b.current.SET_FIELDS_VALUE(Bn(e,D.map((e=>e.fieldName)))),k(e),P(t)}else V(),k({}),P(T)}),[Y]),t.useEffect((()=>{Q()}),[]);const Q=()=>An(void 0,void 0,void 0,(function*(){if(!z)return;let e=yield en.getItem(z);e||(e=yield Z(z),Array.isArray(e)&&(yield en.setItem(z,e))),Array.isArray(e)&&e.length&&(B(e),X(e[0].value))})),Z=e=>An(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)=>An(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(El,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,v("qm.table.alert.total",{total:F}))},t.createElement(El.TabPane,{tab:v("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t.createElement(ad,{ref:y,items:D,cols:1,labelWidth:110})),t.createElement(El.TabPane,{tab:v("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t.createElement(ad,{ref:b,items:_,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(Zn,{type:"primary",disabled:!U||$,style:{marginLeft:"10px"},onClick:()=>An(void 0,void 0,void 0,(function*(){if(!z)return Qn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=pa(),t=[...W,{text:U,value:e,list:{filters:R,config:L}}];B(t),X(e),G(""),yield en.setItem(z,t),yield J(z,t)}))},v("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${Jd.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,An(void 0,void 0,void 0,(function*(){if(!n)return;const e=W.filter((e=>e.value!==n));B(e),n===Y&&X(""),yield en.setItem(z,e),yield J(z,e)}))}},t.createElement(dt,null))))),!W.length&&t.createElement("div",{style:{padding:$d}},t.createElement(Xi,null)))))),t.createElement("div",{className:"bottom"},t.createElement("div",null,t.createElement(H,{checked:!!L.case,onChange:e=>j({case:e.target.checked})},v("qm.table.fastSearch.matchCase")),t.createElement(H,{checked:!!L.fullchar,onChange:e=>j({fullchar:e.target.checked})},v("qm.table.fastSearch.matchFullchar"))),t.createElement("div",null,t.createElement(Zn,{onClick:()=>V()},v("qm.table.fastSearch.clear"))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${Co[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Zn,{onClick:()=>n(),style:{marginRight:8}},v("qm.table.fastSearch.closeButton")),t.createElement(Zn,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},v("qm.table.fastSearch.queryPrev")),t.createElement(Zn,{type:"primary",onClick:()=>K("next")},v("qm.table.fastSearch.queryNext"))))},Au=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,$size:l}=t.useContext(Fd),{t:a}=Pn(),[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:`${Co[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(ut,null))),t.createElement(Nl,d,t.createElement(Lu,{onClose:()=>s(!1)})))}));Au.displayName="FastSearch";const Pu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{tableRef:i,prefixCls:l,flattenColumns:a}=t.useContext(Fd),{t:o}=Pn(),{tableFullData:s}=i.current,[c,d]=t.useState(!1),u=()=>{d(!0)};t.useImperativeHandle(n,(()=>({clickHandle:u})));const p={visible:c,title:o("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>d(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-pivot-grid`,title:o("qm.table.pivotGrid.text"),onClick:()=>u()},t.createElement("i",{className:"svgicon icon"},t.createElement(pt,null))),t.createElement(Nl,p,t.createElement($m,{tableColumns:a,tableDataSource:s})))}));Pu.displayName="PivotGrid";const Du=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:l,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext(Fd),{fetch:d}=l.current.props,{t:u}=Pn(),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===Jd.groupSummary.total.value?{dataIndex:e.summary,title:Jd.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,{[Jd.sorterFieldName]:void 0,[Jd.groupSummary.summaryFieldName]:i.map((e=>`${e.formula}|${e.summary}`)).join(","),[Jd.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[Jd.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===Jd.groupSummary.total.value&&(i={dataIndex:Jd.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=va(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&la(t,r,ia(e[0],r))})),i.forEach((n=>{const r=n.summary!==Jd.groupSummary.total.value?n.summary:Jd.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&la(t,r,e.length),"sum"===i&&la(t,r,Oe(e,r)),"max"===i&&la(t,r,ke(e,r)[r]),"min"===i&&la(t,r,Le(e,r)[r]),"avg"===i&&la(t,r,(Oe(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(zd)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)});return t.createElement(qp,x)},_u=e=>{const{onClose:n}=e,{global:r}=t.useContext(nn),{tableRef:i,prefixCls:l,$size:a,flattenColumns:o}=t.useContext(Fd),{uniqueKey:s}=i.current.props,{t:c}=Pn(),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("");Pi((()=>{if(y){const{group:e,summary:t}=m.find((e=>e.value===y)).list;T(e),L(t)}else{const e=F();T((null==e?void 0:e.group)||[]),L((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{H()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![Jd.expandableColumn,Jd.selectionColumn,"index","pageIndex",Jd.operationColumn].includes(e.dataIndex)))),[o]),C=E.filter((e=>!e.groupSummary)).map((e=>({text:ma(e.title),value:e.dataIndex}))),w=[Jd.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:ma(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(Zn,{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:C.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(Zn,{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:w.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===Jd.groupSummary.total.value?S.slice(S.length-1):S})}]),D=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]),_=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:k.filter((e=>!!e.summary))}))},F=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},H=()=>An(void 0,void 0,void 0,(function*(){if(!x)return;const e=F();if(e){const{group:t,summary:n}=e;T(t),L(n)}let t=yield en.getItem(x);t||(t=yield M(x),Array.isArray(t)&&(yield en.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),M=e=>An(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)=>An(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),j={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(qp,{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(Zn,{type:"primary",icon:t.createElement(ht,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(qp,{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(Zn,{type:"primary",icon:t.createElement(ht,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:D,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(Zn,{type:"primary",disabled:!g||D,style:{marginLeft:"10px"},onClick:()=>An(void 0,void 0,void 0,(function*(){if(!x)return Qn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=pa(),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 en.setItem(x,t),yield $(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${Jd.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,An(void 0,void 0,void 0,(function*(){if(!n)return;const e=m.filter((e=>e.value!==n));f(e),n===y&&b(""),yield en.setItem(x,e),yield $(x,e)}))}},t.createElement(dt,null))))),!m.length&&t.createElement("div",{style:{padding:$d}},t.createElement(Xi,null)))))),t.createElement(Nl,j,t.createElement(Du,{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(Zn,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(Zn,{type:"primary",disabled:D,onClick:()=>(_(),void h(!0))},c("qm.table.groupSummary.confirmButton"))))},Fu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(Fd),{t:l}=Pn(),[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(mt,null))),t.createElement(Nl,c,t.createElement(_u,{onClose:()=>o(!1)})))}));Fu.displayName="GroupSummary";const Hu=e=>{const{onClose:n}=e,{global:r}=t.useContext(nn),{tableRef:i,$size:l,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t.useContext(Fd),{uniqueKey:d}=i.current.props,{t:u}=Pn(),p=t.useRef(null),[h,m]=t.useState([]),[f,g]=t.useState([]),[v,y]=t.useState(""),[b,x]=t.useState("");Pi((()=>{m(b?f.find((e=>e.value===b)).list:F()||[])}),[b]),t.useEffect((()=>{H()}),[]);const E=t.useMemo((()=>d?`superSearch_${d}`:""),[d]),C=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=ga(h),S=t.useMemo((()=>!(w&&$l(w))),[w]),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:ma(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(Zn,{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=C.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=C.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=C.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}})}]),D=()=>{c(),s(h.map((e=>Bn(e,["index","pageIndex"])))),_(),n()},_=()=>{E&&sessionStorage.setItem(E,JSON.stringify(h.filter((e=>!!e.fieldName))))},F=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},H=()=>An(void 0,void 0,void 0,(function*(){if(!E)return;const e=F();e&&m(e);let t=yield en.getItem(E);t||(t=yield M(E),Array.isArray(t)&&(yield en.setItem(E,t))),Array.isArray(t)&&t.length&&(g(t),!e&&x(t[0].value))})),M=e=>An(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)=>An(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(qp,{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(Zn,{type:"primary",icon:t.createElement(ht,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),Jd.highSearch.showSQL&&w&&t.createElement("code",{className:"lang-js"},w)),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(Zn,{type:"primary",disabled:!v||S,style:{marginLeft:"10px"},onClick:()=>An(void 0,void 0,void 0,(function*(){if(!E)return Qn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=pa(),t=[...f,{text:v,value:e,list:h.filter((e=>!!e.fieldName))}];g(t),x(e),y(""),yield en.setItem(E,t),yield $(E,t)}))},u("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${Jd.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,An(void 0,void 0,void 0,(function*(){if(!n)return;const e=f.filter((e=>e.value!==n));g(e),n===b&&x(""),yield en.setItem(E,e),yield $(E,e)}))}},t.createElement(dt,null))))),!f.length&&t.createElement("div",{style:{padding:$d}},t.createElement(Xi,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(Zn,{onClick:()=>n(),style:{marginRight:8}},u("qm.table.highSearch.closeButton")),t.createElement(Zn,{type:"primary",disabled:N,onClick:()=>D()},u("qm.table.highSearch.searchButton"))))},Mu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i}=t.useContext(Fd),{t:l}=Pn(),[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(ft,null))),t.createElement(Nl,c,t.createElement(Hu,{onClose:()=>o(!1)})))}));Mu.displayName="SuperSearch";const $u=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(nn),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext(Fd),{uniqueKey:E,exportExcel:C}=v.current.props,{t:w}=Pn(),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),D=t.useRef(null),_=t.useRef(!1),F=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[$,j]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),q={fullScreen:i,reload:l,print:a,import:o,export:s&&!(null==C?void 0:C.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:p,pivotGrid:h,groupSummary:m},[K,V]=t.useState(!1);Pi((()=>{_.current&&(W(),_.current=!1)}),[$]),t.useEffect((()=>{z()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return Qn("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const z=()=>{if(!F||!f)return;const e=JSON.parse(localStorage.getItem(F));e||B(F).then((e=>{e&&(j(Object.assign({},$,e)),localStorage.setItem(F,JSON.stringify(e)))})).catch((()=>{})),e&&j(Object.assign({},$,e))},W=()=>{if(!F||!f)return;const e={};for(const t in $)$[t]&&(e[t]=$[t]);localStorage.setItem(F,JSON.stringify(e)),U(F,e)},B=e=>An(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)=>An(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=>An(void 0,void 0,void 0,(function*(){V(!1),yield qn(100),e.current.clickHandle()})),X=(e,t)=>{_.current=!0,j(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(su,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),l&&t.createElement(cu,{ref:N,open:!f||$.reload}),a&&t.createElement(uu,{ref:T,tableColumns:r,open:!f||$.print}),o&&t.createElement(wu,{ref:I,tableColumns:r,open:!f||$.import}),s&&t.createElement(Tu,{ref:R,tableColumns:r,open:(!f||$.export)&&!(null==C?void 0:C.hideIcon)}),c&&t.createElement(Ru,{ref:O,open:!f||$.clipboard}),d&&t.createElement(ku,{ref:k,columns:r,open:!f||$.collection}),u&&t.createElement(Au,{ref:L,open:!f||$.fastSearch}),h&&t.createElement(Pu,{ref:A,open:!f||$.pivotGrid}),m&&t.createElement(Fu,{ref:P,open:!f||$.groupSummary}),p&&t.createElement(Mu,{ref:D,open:!f||$.superSearch}),f&&t.createElement(M,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.fullScreen,style:{marginRight:6},onChange:e=>X(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.screen.full"))),onClick:()=>G(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.reload,style:{marginRight:6},onChange:e=>X(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.refresh.text"))),onClick:()=>G(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.print,style:{marginRight:6},onChange:e=>X(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.print.text"))),onClick:()=>G(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.import,style:{marginRight:6},onChange:e=>X(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.import.textNoSpace"))),onClick:()=>G(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.export,style:{marginRight:6},onChange:e=>X(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.export.textNoSpace"))),onClick:()=>G(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.clipboard,style:{marginRight:6},onChange:e=>X(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.clipboard.textNoSpace"))),onClick:()=>G(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.collection,style:{marginRight:6},onChange:e=>X(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.selectCollection.text"))),onClick:()=>G(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.fastSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.fastSearch.text"))),onClick:()=>G(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.pivotGrid,style:{marginRight:6},onChange:e=>X(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.pivotGrid.text"))),onClick:()=>G(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.groupSummary,style:{marginRight:6},onChange:e=>X(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.groupSummary.text"))),onClick:()=>G(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(H,{checked:$.superSearch,style:{marginRight:6},onChange:e=>X(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,w("qm.table.highSearch.text"))),onClick:()=>G(D)}];return t.createElement(Y,{items:e.filter((e=>q[e.key]))})})(),overlayClassName:_e(Q),overlayStyle:{minWidth:120},onOpenChange:e=>{V(e)}},t.createElement("span",{className:`${b}-toolbox`,title:w("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(gt,null)))))}));$u.displayName="ToolBox";const ju=(e,t)=>e.map((e=>(e.children&&(e.children=ju(e.children,t)),t(e)))),qu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:i}=t.useContext(nn),{tableRef:l,prefixCls:a,$size:o}=t.useContext(Fd),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=l.current.props,{t:p}=Pn(),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]);Pi((()=>{C(r)}),[r]),t.useLayoutEffect((()=>{w()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:w})));const x=()=>{if(!b)return;const e=JSON.parse(localStorage.getItem(b));var t;if(e||(t=b,An(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)),w()):(null==i?void 0:i.getComponentConfigApi)&&C(r)})).catch((()=>{})),!e)return;return ge(Vl(e).map((e=>e.dataIndex)),Vl(r).map((e=>e.dataIndex))).length>0?ju(r,(t=>{const n=Wl(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})):ju(e,(e=>{const t=Wl(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)})),C=e=>{if(!b)return;const t=E(e),n=JSON.parse(localStorage.getItem(b));var r,a;l.current.columnsDefined&&!me(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,An(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},w=()=>{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=Wl(r,t.dataIndex)||Un(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=ma(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(H,{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(Ge,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(vt,null)),t.createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>I(e,"right")},t.createElement(yt,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(dt,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(Zt,{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));me(i,l)||((e,t)=>{Wl(r,t).children=e,null==u||u([...r])})(Ca(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(ic,{action:["click"],popupVisible:m,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(Zn,{type:"text",size:"small",onClick:N},p("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(Zt,{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));me(t,n)||T([...Ca(e),...y,...v])}},g.map((e=>R(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(Zt,{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));me(t,n)||T([...g,...Ca(e),...v])}},y.map((e=>R(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(Zt,{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));me(t,n)||T([...g,...y,...Ca(e)])}},v.map((e=>R(e,"right")))))),popupClassName:_e(k),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Wd,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(ot,null)),!d&&t.createElement("span",null,p("qm.table.columnFilter.text")))):null}));qu.displayName="ColumnFilter";const Ku=()=>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"})),Vu=e=>{const{column:n,filters:r}=e,{$size:i,prefixCls:l,setFilters:a,clearSuperFilters:o}=t.useContext(Fd),{t:s}=Pn(),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(!zn(r[y][t])||m){e=!0;break}return e}),[y,r,m]);t.useLayoutEffect((()=>{p&&setTimeout((()=>x()),20)}),[p]),t.useEffect((()=>{var e;me(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(zn(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)},C={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:ma(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(H,{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:ma(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(H,{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($,Sn({ref:d},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement($,Sn({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement($,Sn({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement($,Sn({},n("!="),{placeholder:s("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const n=e=>{var t;return{value:da(null===(t=g[y])||void 0===t?void 0:t[e],Kd),format:Kd,size:i,onChange:t=>{v((n=>Object.assign({},n,{[y]:Object.assign({},n[y],{[e]:ua(t,Kd)})})))},onKeyDown:e=>{13===e.keyCode&&E()}}};return t.createElement("ul",null,t.createElement("li",null,t.createElement("span",null,"> "),t.createElement(wn,Sn({},n(">"),{placeholder:s("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"< "),t.createElement(wn,Sn({},n("<"),{placeholder:s("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"= "),t.createElement(wn,Sn({},n("=="),{placeholder:s("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",null,"!="),t.createElement(wn,Sn({},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(q.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(q,{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(H.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(H,{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(_d,{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}})))}}))}},w=()=>t.createElement(S,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t.createElement(Zn,{size:i,onClick:()=>(E({[y]:{}}),void f(!1))},s("qm.table.filter.reset")),t.createElement(Zn,{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(ic,{action:["click"],popupVisible:p,popup:(()=>{const e=n.filter.type,r=C[e];return r?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement("div",null,r(n)),w()):(Qn("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:_e(N),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{h(e)},builtinPlacements:Wd,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(Ku,null))))},zu=e=>{const{column:n}=e,{tableRef:r,bordered:i}=t.useContext(Fd),{columns:l,resizable:a,columnsChange:o=$n}=r.current.props,s=t.useMemo((()=>Ul(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=ta(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||Jd.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&&(Wl(l,s.dataIndex).width=h,o([...l]))},!1}})},Wu=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(Fd),{rowSelection:p}=r.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:m,filterable:f,onSelectAll:g}=p,{t:v}=Pn(),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]),w=()=>{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:Ae(t,w());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 Ae(l,w())})(),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=()=>An(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=pe(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:l}=p;l&&(n=ge(n,a().filter((e=>l(e))).map((e=>i(e,e.index))))),y.current=n}}catch(e){}return c(!1),n})),k=e=>An(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:()=>An(void 0,void 0,void 0,(function*(){let e=[];e=ge(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(H,{checked:R,indeterminate:I,disabled:!S.length,onChange:e=>k(e.target.checked)}),E&&t.createElement(M,{overlayClassName:"all-selection__popper",dropdownRender:()=>L()},t.createElement(He,{className:"svgicon icon"})),x&&t.createElement(C,{placement:"top",title:v("qm.table.selection.currentPage")},t.createElement(bt,{className:"info"})))},Bu=e=>{const{style:n}=e,{tableRef:r,setRowExpandedKeys:i}=t.useContext(Fd),{expandable:l}=r.current.props,[a,o]=t.useState((null==l?void 0:l.defaultExpandAllRows)||!1);Pi((()=>{i(a?[...r.current.allParentRowKeys]:[])}),[a]);const s={[`${tr("expand")}--icon`]:!0,expanded:a,collapsed:!a};return t.createElement("span",{className:_e(s),title:"",onClick:e=>{e.stopPropagation(),o(!a)},style:n})},Uu=()=>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"})),Gu=()=>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"})),Yu=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(Fd),{ellipsis:w,resizable:S,multipleSort:N,rowSelection:T,expandable:I}=r.current.props,[R,O]=Jd.sortDirections,{tableOriginData:k}=r.current,{t:L}=Pn(),A=t.useRef(null),P=t.useMemo((()=>k.some((e=>Array.isArray(e.children)))),[k]),D=t.useMemo((()=>!u),[u]),_=t.useMemo((()=>!u),[u]),F=t.useMemo((()=>!(null==I?void 0:I.hideExpandAll)),[I]),H=t.useMemo((()=>!!T&&(u?!(!T.selectAllOnCurrentPage&&!T.fetchAllRowKeys):!T.hideSelectAll)),[u,T]);Pi((()=>{z(),m(),v()}),[o]),Pi((()=>{G(),m(),v()}),[s]),Pi((()=>{G(),m(),v()}),[c]),t.useEffect((()=>{!zn(o)&&Kn((()=>z())),!zn(s)&&Kn((()=>G()))}),[]),t.useLayoutEffect((()=>{M()}),[]);const M=()=>{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 C=m||h,N=["header--column",{"col--ellipsis":null!==(l=e.ellipsis)&&void 0!==l?l:w,"col--center":"center"===C,"col--right":"right"===C,"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&&![Jd.expandableColumn,Jd.selectionColumn].includes(c);return t.createElement("th",{key:c,className:_e(N),colSpan:d,rowSpan:u,style:Object.assign({},T),onClick:t=>V(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"},j(e)),v?K(e):null)),I&&t.createElement(zu,{column:e}))},j=e=>{const{dataIndex:n,type:i,sorter:l,title:a,description:s}=e;if(n===Jd.selectionColumn&&"checkbox"===i){if("checkbox"===i)return t.createElement("div",{className:"cell"},H?t.createElement(Wu,{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:ma(a)},r.current.isTreeTable&&n===h&&F?t.createElement(Bu,null):null,n===Jd.expandableColumn&&F?t.createElement(Bu,null):a)),s&&c.push(t.createElement(C,{key:1,placement:"top",title:s},t.createElement(bt,{className:"tip"}))),l&&c.push(q(o[n])),c},q=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(Uu,null)),t.createElement("span",{className:_e(r)},t.createElement(Gu,null)))},K=e=>t.createElement(Vu,{column:e,filters:s}),V=(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}))}},z=()=>{D&&W()},W=e=>{const t=Pe(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=ia(e,r),s=ia(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(fa(t)):t,e);E(n)},G=()=>{_&&Y()},Y=()=>{const e=c.length?ga(c):ga(s),t=""!==e?p?x(jl(fa(k),e,P)):jl(k,e,P):k;E(t),W(!0)},X=Zl(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))))},Xu=t.createContext([]);function Qu(e,t,n){var r;let i,l=null!==(r=n.initialDeps)&&void 0!==r?r:[];return()=>{var r,a,o,s;n.key&&(null===(r=n.debug)||void 0===r||r.call(n));const c=e();return c.length!==l.length||c.some(((e,t)=>l[t]!==e))?(l=c,n.key&&(null===(a=n.debug)||void 0===a||a.call(n)),i=t(...c),n.key&&(null===(o=n.debug)||void 0===o||o.call(n)),null===(s=null==n?void 0:n.onChange)||void 0===s||s.call(n,i),i):i}}function Zu(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const Ju=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,i)),n)}},ep=e=>e,tp=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},np=(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)}},rp={passive:!0},ip="undefined"==typeof window||"onscrollend"in window,lp=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const l=e.options.useScrollendEvent&&ip?()=>{}:Ju(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,rp),n.addEventListener("scrollend",s,rp),()=>{n.removeEventListener("scroll",o),n.removeEventListener("scrollend",s)}},ap=(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"])},op=(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 sp{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,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ep,rangeExtractor:tp,onChange:()=>{},measureElement:ap,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=Qu((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",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=Qu((()=>[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=Qu((()=>[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=Qu((()=>[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=cp(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=Qu((()=>[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=Qu((()=>[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 Zu(t[cp(0,t.length-1,(e=>Zu(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]=Zu(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 cp=(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 dp="undefined"!=typeof document?t.useLayoutEffect:t.useEffect,up=e=>(e=>{const n=t.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},e),{onChange:(t,r)=>{var i;r?Qt(n):n(),null===(i=e.onChange)||void 0===i||i.call(e,t,r)}}),[i]=t.useState((()=>new sp(r)));return i.setOptions(r),dp((()=>i._didMount()),[]),dp((()=>i._willUpdate())),i})(Object.assign({observeElementRect:np,observeElementOffset:lp,scrollToFn:op},e)),pp=(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=hp(o,n.eventKey);if(p<h+m/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=hp(o,t)}const y=v.key,b=v,x=v.key;let E=0,C=0;if(!g.includes(y))for(let e=0;e<f&&fp(v);e+=1)v=v.parent,C+=1;const w=t.data,S=v.node;let N=!0;return gp(v)&&0===v.level&&p<h+m/2&&l({dragNode:w,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?l({dragNode:w,dropNode:S,dropPosition:0})?E=0:N=!1:0===C?f>-1.5?l({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:w,dropNode:S,dropPosition:0})?E=c?1:0:l({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:l({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:C,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}},hp=(e,t)=>e[t],mp=e=>e.split("-"),fp=e=>{if(e.parent){const t=mp(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},gp=e=>{const t=mp(e.pos);return 0===Number(t[t.length-1])},vp=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:i,setRowExpandedKeys:l,createTableFullData:a,dataChange:o}=t.useContext(Fd),{tableFullData:s,allRowKeys:c,isTreeTable:d}=n.current,u=jn,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([]),[C,w]=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)}))}(hp(t,e).children),n})(n,g)),w(2*Jd.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}=pp(e,p.current,t,C,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=hp(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}=pp(e,p.current,t,C,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=hp(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:hp(g,i).node});-1!==x.indexOf(i)&&Qn("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=mp(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:C,dropOptions:S}},yp=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,bp=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),xp=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!yp(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Ep({ref:t,handler:n,enabled:r=!0,omitClassNames:i=[]}){const l=Dn(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{xp(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&xp(e,t)&&bp(e,i)&&(a.current.isPointerDown=!1,l(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&xp(e,t)&&bp(e,i)&&(a.current.isPointerDown=!1,l(e))},c=yp(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 Cp(){const[,t]=e.useReducer((e=>e+1),0);return t}const wp=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:C,dragOverNodeKey:w,dropTargetKey:S,dropContainerKey:N}=d,T=w===r&&0===E,I=w===r&&-1===E,R=w===r&&1===E,O=l._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-C*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-C*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,w===r&&null!==E&&null!==C&&t.createElement("td",{className:"drop-indicator",style:k}))}));wp.displayName="DraggableTr";const Sp=e=>{const{selectionKeys:n,column:r,record:i,rowKey:l}=e,{tableRef:a,getAllChildRowKeys:o}=t.useContext(Fd),{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=Yl(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(q,{checked:a,disabled:r})})():(()=>{const e=s.disabled,r=null==e?void 0:e(i),a=!!n.includes(l);return t.createElement(H,{checked:a,indeterminate:d(l),disabled:r})})()},Np=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:l,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext(Fd),{expandable:s={}}=l.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);Pi((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${tr("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})},Tp=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 Wt(t).toFixed(p)),t},E=void 0!==l,[C,w]=t.useState(null!=i?i:""),S=v(E?l:C),N=y(S);Pi((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[C]);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):w(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))}})}));Tp.displayName="InputNumber";const{Search:Ip}=O,Rp=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(Fd),x=t.useContext(Xu),{t:C}=Pn(),w=Cp(),{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),D=t.useRef({}),_=t.useRef({}),M=t.useRef([]),[$,j]=t.useState(!1),[q,V]=t.useState(!1),[z,W]=t.useState(T.items||[]),[B,U]=t.useState(),G=(T.editable||me(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||$||q,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&&ae()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;re&&e&&le(e.map((e=>({[_.current.valueKey]:e.value,[_.current.textKey]:e.text}))))}),[]);const ie=()=>{v(),b()},le=e=>{M.current=e},ae=()=>{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:ae,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):"",ue={text:(e,n,r)=>{const{dataIndex:i}=n,{type:l,extra:a={},rules:o=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=ia(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,Sn({ref:R,size:f,value:m,maxLength:a.maxLength,showCount:a.showCount},v,{autoComplete:a.password?"new-password":"off",placeholder:a.placeholder||C("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:"";la(e,i,l),y(o,l,u,p,ma(n.title)),w(),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)=>ue.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=ia(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 Wt(e).times(100).toNumber()}`,x=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Wt(e).times(.01).toString()),t.createElement(Tp,{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||C("qm.table.editable.inputPlaceholder"),maxLength:s.maxLength,allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,formatter:b,parser:x,onChange:t=>{la(e,i,t),y(c,t,u,p,ma(n.title)),w(),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),la(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=ia(e,l);let b=v;return t.createElement(F,{mode:r?"multiple":void 0,size:f,popupClassName:Jd.popupClassName,value:v||void 0,placeholder:s.placeholder||C("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}|${io.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onDropdownVisibleChange:e=>j(e),onChange:t=>{la(e,l,t),y(c,t,u,p,ma(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},onSelect:e=>{b=e},onInputKeyDown:t=>{13===t.keyCode&&Kn((()=>null==m?void 0:m({[Y]:b},e)))}},g.map((e=>t.createElement(F.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ue.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=ia(e,l);return t.createElement(wn,{size:f,popupClassName:Jd.popupClassName,value:null!==(i=da(h,La[d]))&&void 0!==i?i:void 0,picker:ka[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=ua(t,La[d]);la(e,l,r),y(s,r,u,p,ma(n.title)),ce(e,u,p),null==c||c({[Y]:r},e),ie()}})},datetime:(e,t)=>ue.date(e,t,"datetime"),month:(e,t)=>ue.date(e,t,"month"),year:(e,t)=>ue.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=ia(e,i);return t.createElement(Nn,{size:f,popupClassName:Jd.popupClassName,value:null!==(r=da(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=ua(t,c);la(e,i,r),y(o,r,u,p,ma(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=jd,falseValue:c=qd,disabled:d}=l,h=ia(e,r);return t.createElement(H,{checked:h===s,disabled:d,onChange:t=>{const i=t.target.checked?s:c;la(e,r,i),y(a,i,u,p,ma(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=jd,falseValue:c=qd,disabled:d}=l,h=ia(e,r);return t.createElement(K,{checked:h===s,disabled:d,onChange:t=>{const i=t?s:c;la(e,r,i),y(a,i,u,p,ma(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=aa(e,ne?c.combinedDataIndex:i),b=c.fieldAliasMap;b||Qn("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(i)||Qn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(c.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Qn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[i].includes("|")&&Qn("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(oe(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},w=e=>{const{autoQueryAssign:t=!0}=c;t&&(D.current=E(e)),j(!0)},S=(t,r)=>{const{beforeOpen:i}=c,l=(null!=i?i:jn)({[Y]:v},e,n);(null==l?void 0:l.then)?l.then((()=>{w(t),null==r||r()})).catch((()=>{})):!1!==l&&(w(t),null==r||r())},N=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=aa(e,r))}const n=x[i]?aa(e,x[i]):"";R(n,t);const{closed:r}=c;j(!1),null==r||r(e)},I=()=>{const{onlySelect:e=!0}=c;P.current&&R(e?"":v),j(!1)},R=(t="",r)=>{var a;if(oe(r)&&Object.keys(r).length)for(const t in r){const n=r[t],i=g.find((e=>e.dataIndex===t));if(i){la(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,ma(i.title))}else la(e,t,n)}ne&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return la(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&la(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),la(e,i,t,l),y(s,t,u,p,ma(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie(),D.current={},P.current=!1,U(void 0)},O={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:Jd.popupClassName,bodyStyle:{paddingBottom:`${Co[f]+20}px`},onClose:()=>{I()}},k=Object.assign(Object.assign({},c),{size:f,initialValue:Object.assign({},D.current,c.initialValue),onClose:e=>{e?N(e):I()}});return t.createElement(t.Fragment,null,t.createElement(Ip,{ref:L,value:null!=B?B:v,placeholder:o.placeholder||C("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=jn}=t.fetch;return new Promise(((i,l)=>An(void 0,void 0,void 0,(function*(){var a;const o=ye({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(o))return l();V(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=pe(e.data,t.fetch.dataKey))&&void 0!==a?a:[];i(n)}else l()}catch(e){l(e)}finally{Kn((()=>V(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>aa(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(Nl,O,t.createElement(Kp,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=ia(e,i),v=c.fieldAliasMap;v||Qn("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Qn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),_.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:jn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{j(!0),null==t||t()})).catch((()=>{})):!1!==i&&(j(!0),null==t||t())},w=()=>{j(!1)},S=t=>{la(e,i,t),y(s,t,u,p,ma(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,M.current),ie()},N={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"60%",loading:!1,wrapClassName:Jd.popupClassName,bodyStyle:{paddingBottom:`${Co[f]+20}px`},onClose:()=>{w()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ye({},c.initialValue),defaultSelectedKeys:g,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=b;le(be([...M.current.filter((e=>t.includes(e[r]))),...e],r));const i=M.current.map((e=>({text:e[n],value:e[r]}))),l=be([...i,...a],"value").filter((e=>t.includes(e.value)));W(l),S(l.map((e=>e.value)));const{closed:o}=c;j(!1),null==o||o(M.current)})(e,t):w()}});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(F,{mode:"multiple",open:!1,value:g,placeholder:o.placeholder||C("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(M.current.filter((n=>e.includes(n[t])))),S(e)}},z.map((e=>t.createElement(F.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(Ye,null),onClick:()=>{x()}})))),t.createElement(Nl,N,t.createElement(Kp,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=aa(e,ne?d.combinedDataIndex:l),b=d.fieldAliasMap;b||Qn("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(l)||Qn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Qn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[l].includes("|")&&Qn("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const E=t=>{const{beforeOpen:r}=d,i=(null!=r?r:jn)({[Y]:v},e,n);(null==i?void 0:i.then)?i.then((()=>{j(!0),null==t||t()})).catch((()=>{})):!1!==i&&(j(!0),null==t||t())},w=()=>{j(!1)},S=(t="",r)=>{var i;if(oe(r)&&Object.keys(r).length)for(const t in r){const n=r[t],l=g.find((e=>e.dataIndex===t));if(l){la(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,ma(l.title))}else la(e,t,n)}la(e,l,t,a),y(c,t,u,p,ma(n.title)),ce(e,u,p),null==h||h({[Y]:t},e),ie()},N={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=d.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:Jd.popupClassName,bodyStyle:{paddingBottom:`${Co[f]+20}px`},onClose:()=>{w()}},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]=aa(e,r))}const n=x[l]?aa(e,x[l]):"";S(n,t);const{closed:r}=d;j(!1),null==r||r(e)})(e):w()}});return t.createElement(t.Fragment,null,t.createElement(Ip,{ref:A,value:v,allowClear:null===(i=s.allowClear)||void 0===i||i,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||C("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(Nl,N,t.createElement(Up,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=ia(e,i),v=c.fieldAliasMap;v||Qn("Table","helper 需要配置 `fieldAliasMap` 选项");const b="function"==typeof v?v():v||{};Object.keys(b).includes("valueKey")&&Object.keys(b).includes("textKey")||Qn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),_.current=b;const x=t=>{const{beforeOpen:r}=c,i=(null!=r?r:jn)({[Y]:g},e,n);(null==i?void 0:i.then)?i.then((()=>{j(!0),null==t||t()})).catch((()=>{})):!1!==i&&(j(!0),null==t||t())},w=()=>{j(!1)},S=t=>{la(e,i,t),y(s,t,u,p,ma(n.title)),ce(e,u,p),null==h||h({[Y]:t},e,M.current),ie()},N={visible:$,title:C("qm.searchHelper.text"),width:null!==(r=c.width)&&void 0!==r?r:"40%",loading:!1,wrapClassName:Jd.popupClassName,bodyStyle:{paddingBottom:`${Co[f]+20}px`},onClose:()=>{w()}},I=Object.assign(Object.assign({},c),{size:f,multiple:!0,initialValue:ye({},c.initialValue),defaultSelectedKeys:g,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=b;le(e);const r=M.current.map((e=>({text:e[t],value:e[n]})));W(r),S(r.map((e=>e.value)));const{closed:i}=c;j(!1),null==i||i(M.current)})(e):w()}});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(F,{mode:"multiple",open:!1,value:g,placeholder:a.placeholder||C("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(M.current.filter((n=>e.includes(n[t])))),S(e)}},z.map((e=>t.createElement(F.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(Ye,null),onClick:()=>{x()}})))),t.createElement(Nl,N,t.createElement(Up,I)))},custom:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:l={},rules:a=[],render:o,onChange:s}=T;if(!o)return Qn("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const c=ia(e,r),d=t=>{la(e,r,t),y(a,t,u,p,ma(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:Jd.popupClassName,onChange:d}):null}};return t.createElement(t.Fragment,null,te?(()=>{const{type:e}=T,n=ue[e];if(!n)return Qn("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"}))}));Rp.displayName="CellEdit";const Op=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,kp=e=>{const{text:n,options:r,showMessage:i=!0,onCopy:l}=e,{t:a}=Pn();return Op(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=Bt(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)}})};kp.displayName="QmCopyToClipboard";const Lp=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(Fd),{dataIndex:m,canCopy:f,render:g,editRender:v,shouldCellUpdate:y}=i,{t:b}=Pn(),{renderText:x,getTitleFromCellNode:E}=du(),C=t.useRef(null),w=ia(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(w,l,i,a,o):x(w,i,l);return[e,v?t.createElement(Rp,{ref:r,column:i,record:l,rowKey:s,columnKey:m},e):null]}),[h,l,w,g,v],((e,t)=>{if(y){const[,n]=e,[,r]=t;return y(r,n,l)}return!((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)})(e,t,!0)}));t.useEffect((()=>{if([Jd.expandableColumn,Jd.selectionColumn,Jd.operationColumn].includes(m))return;const e=C.current.parentNode;c?e.title=E(S):e.removeAttribute("title")}),[c,S]);const T=e=>Array.isArray(e.children);return t.createElement("div",{ref:C,className:"cell"},(()=>{if(m===Jd.expandableColumn)return t.createElement(Np,{record:l,rowKey:s});if(m===Jd.selectionColumn)return t.createElement(Sp,{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*Jd.treeTable.textIndent+"px"}}):null,t.createElement(Np,{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(kp,{text:e},t.createElement(st,{className:"icon",title:b("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return S})())}));Lp.displayName="Cell";const Ap={startX:0,startY:0,startOffsetX:0,startOffsetY:0,containerSizeX:0,containerSizeY:0},Pp={open:!1,offsetX:0,offsetY:0},Dp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:l,tableFlatData:a,flattenColumns:o,mergedTdCells:s,setMergedCells:c}=t.useContext(Fd),{areaSelection:d={}}=r.current.props,{elementStore:u}=r.current,{t:p}=Pn(),h=t.useRef(document.onselectstart),m=t.useRef(null),f=t.useRef(null),[g,v]=t.useState(null),[y,b]=t.useState(null),[x,E]=t.useState(null);Ep({ref:m,handler:()=>M()});const C=t.useRef(Ap),w=e=>{C.current=Object.assign({},C.current,e)};t.useEffect((()=>{const e=Mt(u.$tableBody,"mousedown",A),t=Mt(u.$tableBody,"contextmenu",k),n=Mt(document,"keydown",L);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const S=()=>{v(null),b(null),E(null)};t.useImperativeHandle(n,(()=>({blur:S})));const N=()=>u.$tableBody.parentNode,T=e=>{const{offsetLeft:t,offsetTop:n,offsetWidth:r,offsetHeight:i}=e;return{rowKey:e.parentNode.getAttribute("data-row-key"),colIndex:Number(e.getAttribute("data-col-index")),l:t,t:n,w:r,h:i}},I=il(((e,t)=>{let n=null;const r=u.$tableBody.querySelectorAll("tbody > tr");for(let i=0;i<r.length;i++){if(r[i].offsetTop>t||r[i].offsetTop+r[i].offsetHeight<t)continue;const l=r[i].querySelectorAll("td");for(let t=0;t<l.length;t++)if(!(l[t].offsetLeft>e||l[t].offsetLeft+l[t].offsetWidth<e)){n=l[t];break}break}n&&b(T(n))}),5),R=Dn((()=>{const e=[];if(!g||!y)return e;const[t,n]=[g.colIndex,y.colIndex],[r,l]=[g.rowKey,y.rowKey];let[s,c]=[0,0];for(let e=0;e<a.length;e++){const t=i(a[e],a[e].index);if(t==r&&(s=e),t==l){c=e;break}}const d=o.slice(Math.min(t,n),Math.max(t,n)+1);return a.slice(s,c+1).forEach((t=>{for(let n=0;n<d.length;n++){const{dataIndex:r}=d[n];e.push({rowKey:i(t,t.index),dataIndex:r,cellValue:ia(t,r)})}})),e})),O=e=>{var t;c(e),null===(t=d.onCellMerge)||void 0===t||t.call(d,e),Kn((()=>S()))},k=Dn((e=>{d.cellMerge&&g&&F(e.clientX,e.clientY)?(e.preventDefault(),H(e)):(null==x?void 0:x.open)&&M()})),L=e=>{27===e.keyCode&&S()},A=Dn((e=>{e.stopPropagation();const t=(e=>{let t=e;for(;t;){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null})(e.target);if(1!==e.buttons||!t)return;M(),setTimeout((()=>{v(T(t)),b(T(t))}));const[n,r]=[u.$tableBody.getBoundingClientRect().top,N().getBoundingClientRect().left],{offsetWidth:i,offsetHeight:l}=N();w({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-r,startOffsetY:e.clientY-n,containerSizeX:i,containerSizeY:l}),document.addEventListener("mousemove",P),document.addEventListener("mouseup",D),h.current=document.onselectstart,document.onselectstart=()=>!1})),P=e=>{const t=e.clientX-C.current.startX,n=e.clientY-C.current.startY,r=C.current.startOffsetX+t,i=C.current.startOffsetY+n;I(Math.min(r,C.current.containerSizeX),Math.min(i,C.current.containerSizeY))},D=()=>{var e;w(Ap),null===(e=d.onSelectChange)||void 0===e||e.call(d,R()),document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",D),_()},_=()=>{document.onselectstart!==h.current&&(document.onselectstart=h.current)},F=(e,t)=>{const{top:n,left:r}=N().getBoundingClientRect(),[i,l]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=q();return!(i<a||i>a+s||l<o||l>o+c)},H=e=>{const{top:t,left:n,height:r}=f.current.getBoundingClientRect();E({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},M=()=>{E((e=>Object.assign(Object.assign({},e),{open:!1})))},$=()=>{if(!g||!y||(t=y,(e=g).rowKey===t.rowKey&&e.colIndex===t.colIndex))return S();var e,t;const[n,r]=g.t<=y.t?[g.rowKey,y.rowKey]:[y.rowKey,g.rowKey],[l,c]=g.l<=y.l?[g.colIndex,y.colIndex]:[y.colIndex,g.colIndex];let[d,u]=[0,0],p=n;for(let e=0;e<a.length;e++){const t=a[e],l=i(t,t.index);if(l==n&&(p=l,d=e),l==r){u=e;break}}const h={rowKey:p,dataIndex:o[Math.min(l,c)].dataIndex,rowSpan:u-d+1,colSpan:Math.abs(c-l+1)};O([...s.filter((e=>!(e.rowKey===h.rowKey&&e.dataIndex===h.dataIndex))),h])},j=()=>{let e=g.rowKey;const t=g.colIndex;for(let t=0;t<a.length;t++){const n=a[t],r=i(n,n.index);if(r==e){e=r;break}}const n=e,r=o[t].dataIndex;O(s.filter((e=>!(e.rowKey===n&&e.dataIndex===r))))},q=()=>{const{w:e,h:t,l:n,t:r}=g;let{w:i,h:l,l:a,t:o}=y;return i=a-n>0?a-n+i:Math.abs(a-n)+e,l=o-r>0?o-r+l:Math.abs(o-r)+t,a=a>n?n:a,o=o>r?r:o,{sl:n,st:r,sw:e,sh:t,el:a,et:o,ew:i,eh:l}};return t.createElement("div",{className:`${l}--area-select`},(()=>{if(!g||!y)return null;const{sl:e,st:n,sw:r,sh:i,el:l,et:a,ew:o,eh:s}=q(),{open:c,offsetX:d,offsetY:u}=x||Pp,h=t.createElement("ul",{ref:m,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:$},p("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:j},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(ic,{popupVisible:c,popup:h,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:Jd.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}})))})())}));Dp.displayName="AreaSelect";const _p=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:C,setSelectionKeysEffect:w,setHighlightKey:S,getStickyLeft:N,getStickyRight:T,setPingLeft:I,setPingRight:R,setFullScreen:O,findParentRowKeys:k,getAllChildRowKeys:L,scrollBottomDebouncer:A}=t.useContext(Fd),{height:P,minHeight:D,maxHeight:_,rowHeight:F,rowSelection:H,rowHighlight:M,expandable:$,stripe:j,summation:q,rowStyle:K,cellStyle:V,spanMethod:z,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:ae,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de,indent:ue,dropOptions:pe}=vp({openDragSort:Y}),{rowVirtualizer:he,columnVirtualizer:fe,virtualRows:ge,virtualColumns:ve,resetItemXSize:ye,getYIndexes:be,virtualTranslateY:xe,virtualTranslateX:Ee,calcVirtualYSize:Ce,calcVirtualXSize:we,scrollToYIndex:Se}=((e,n)=>{var r;const{tableRef:i}=t.useContext(Fd),{props:l,scrollBarRef:a,rowHeight:o}=i.current,s=(null===(r=l.tableConfig)||void 0===r?void 0:r.overscan)||1,c=()=>a.current.container.children[0],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=up({count:e.length,getScrollElement:c,estimateSize:()=>o,indexAttribute:"data-row-index",overscan:s,enabled:i.current.scrollYLoad}),p=u.getVirtualItems(),h=up({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],...tp(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)}))},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=e=>{if(e&&!U)return he.measureElement(e)},[Te,Ie]=t.useState([]),Re=Cp();Ep({ref:ee,omitClassNames:[`.${Jd.popupClassName}`],handler:()=>{var e;Ke([]),null===(e=ne.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:Ke,createFocus:Fe,forceUpdate:Re,resetItemXSize:ye,scrollToYIndex:Se}))),Pi((()=>{Te.length&&r.current.tableManager.focus(r.current.uid)}),[Te]),t.useLayoutEffect((()=>{De();const e=Mt(document,"keydown",Le);return()=>e.remove()}),[]);const Oe=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:i}=h,l={};return x&&Object.assign(l,{minHeight:"100px"}),D&&Object.assign(l,{minHeight:na(D)-e-n+"px"}),_&&Object.assign(l,{maxHeight:na(_)-e-n+"px"}),P||r||i?Object.assign(Object.assign({},l),{maxHeight:"",minHeight:"",height:`${t}px`}):l}),[P,_,D,x,h]),ke=Dn((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:$n,stopPropagation:$n}),re.current={prevST:l,prevSL:a}})),Le=Dn((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&&(Ke([]),S(""),O(!1)),Te.length&&(Vi(document.activeElement,ee.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)))){if(13===p&&("radio"===(null==H?void 0:H.type)||M)){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(!$e(Te[0],Te[1])){if(38===p||40===p){Fi(e);const t=a.length;let n=a.findIndex((e=>i(e,e.index)===Te[0]));const r=38===p?(--n+t)%t:++n%t,l=a[r],o=i(l,l.index),s=Me(o,Te[1]);"radio"!==(null==H?void 0:H.type)||(null===(d=H.disabled)||void 0===d?void 0:d.call(H,l))||s||w([o]),!M||(null===(u=M.disabled)||void 0===u?void 0:u.call(M,l))||s||S(o),Ae(38===p?"top":"bottom",r),He(...Te),Ke([o,Te[1]])}if(9===p||e.shiftKey&&9===p){if(Fi(e),!s.length)return Ke([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Te[1]));const r=e.shiftKey&&9===p?(--n+t)%t:++n%t;He(...Te),Pe(e.shiftKey&&9===p?"left":"right",r),Ke([Te[0],s[r].dataIndex])}}}})),Ae=(e,t)=>{const{scrollBarRef:n,scrollYLoad:i}=r.current;if(i)return he.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)},Pe=(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)},De=()=>{C("$tableBody",ee.current)},Fe=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.focus()},He=(e,t)=>{var n;null===(n=te.current[`${e}-${t}`])||void 0===n||n.blur()},Me=(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},$e=(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},je=e=>{const t=q.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},qe=(e,t,n)=>{var l;const{dataIndex:a}=n;if([Jd.expandableColumn,Jd.operationColumn].includes(a))return;const o=i(t,t.index);Ke([o,a]);const s=Me(o,a),{type:c,selectByClickRow:d=!0,disabled:u=$n}=H||{};!c||u(t)||s||(d||a===Jd.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:i=!0,onSelect:l}=H||{};if("radio"===n&&w([e]),"checkbox"===n){const n=!f.includes(e),a=r.current.isTreeTable&&!i?ze(e,f,n):Ve(e,f,n);w(a),null==l||l(n,t,a)}})(o,t),[Jd.selectionColumn].includes(a)||(!M||(null===(l=M.disabled)||void 0===l?void 0:l.call(M,t))||s||S(o),null==X||X(t,n,e))},Ke=e=>{me(e,Te)||Ie(e)},Ve=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),ze=(e,t,n)=>{var i;const{disabled:l}=H||{},{deriveRowKeys:a,recordsMap:o}=r.current,s=Yl(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=ba(a,e))||void 0===i?void 0:i.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Yl(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},We=(e,n,i,l=0)=>{const{scrollXLoad:a}=r.current,{disabled:s}=H||{},c=["body--row",Object.assign({"body--row-striped":j&&n%2!=0,"body--row-selected":f.includes(i)&&!(null==s?void 0:s(e)),"body--row-current":v===i},E?je(e._group):null)],d=(a?ve:o).map(((t,r)=>Be(a?o[t.index]:t,a?t.index:r,e,n,i,l)));return Y?t.createElement(wp,{key:i,ref:Ne,className:_e(c),rowKey:i,rowIndex:n,row:e,indent:ue,filter:".cell--edit input",dropOption:pe,onNodeDragStart:ie,onNodeDragEnter:le,onNodeDragOver:ae,onNodeDragLeave:se,onNodeDragEnd:ce,onNodeDrop:de},d):t.createElement("tr",{key:i,ref:Ne,"data-row-key":i,"data-row-index":n,className:_e(c)},d)},Be=(e,n,r,i,l,a)=>{var o,s,u;const{dataIndex:h,fixed:m,align:f,className:g=""}=e,{rowSpan:v,colSpan:y}=Ue(r,e,i,n);if(!v||!y)return null;const b=null!==(o=e.ellipsis)&&void 0!==o?o:U,x=["body--column",{"col--ellipsis":b,"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!p[h],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&(null===(s=c[c.length-y])||void 0===s?void 0:s.dataIndex)===h,"cell-fix-right-first":"right"===m&&(null===(u=d[0])||void 0===u?void 0:u.dataIndex)===h,[g]:!!g}],C={left:"left"===m?`${N(h)}px`:"",right:"right"===m?`${T(h)}px`:""},w=K?"function"==typeof K?K(r,i):K:null,S=V?"function"==typeof V?V(r,e,i,n):V:null,I=E?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=q.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,R=Object.assign({},C,{height:F},I,w,S);return t.createElement("td",{key:h,"data-col-index":n,rowSpan:v>1?v:void 0,colSpan:y>1?y:void 0,className:_e(x),style:R,onClick:t=>qe(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[Jd.expandableColumn,Jd.selectionColumn,Jd.operationColumn].includes(r)||null==Q||Q(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[Jd.expandableColumn,Jd.selectionColumn,Jd.operationColumn].includes(r)||null==Z||Z(t,n,e)})(t,r,e)},t.createElement(Lp,{ref:e=>te.current[`${l}-${h}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:l,depth:a,showTitle:b}))},Ue=(e,t,n,r)=>{var i;let l=1,o=1;const s=z;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]):oe(c)&&(l=c.rowSpan,o=c.colSpan);const d=null!==(i=be()[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(u.length>0){const e=u.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(cl,{ref:r.current.scrollBarRef,wrapClassName:`${l}--body-wrapper`,wrapStyle:Oe,innerStyle:{height:Ce(),width:we()},showTopScrollbar:null==W?void 0:W.doubleXScrollbar,onScroll:ke},t.createElement(Xu.Provider,{value:Te},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,n=0)=>{const{scrollYLoad:l}=r.current,o=[],s=l?e:a;return s.forEach(((e,r)=>{const c=l?a[e.index]:e,d=l?e.index:r,u=i(c,c.index);if(o.push(We(c,d,u,n)),null==$?void 0:$.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=jn}=$;g.includes(u)&&n(c)&&o.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:s.length,className:"body--column",style:{paddingLeft:H?2*Jd.selectionColumnWidth:Jd.selectionColumnWidth}},t.createElement("div",{className:_e("cell",e)},$.expandedRowRender(c,d)))))}})),o})(ge)))),!!B&&t.createElement(Dp,{ref:ne})))}));_p.displayName="TableBody";const Fp=()=>{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(Fd),{footRender:p}=e.current.props,{t:h}=Pn(),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):ia(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 Hp;!function(e){e.small="small",e.middle="default",e.large="default"}(Hp||(Hp={}));const Mp=e=>{var n,r,i,l;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(nn),{tableRef:u,prefixCls:p,$size:h,setElementStore:m}=t.useContext(Fd),{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:Jd.pagination.showSizeChanger,C=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:Jd.pagination.showQuickJumper,w=(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)||Jd.pagination.pageSizeOptions,S=()=>An(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=>An(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)=>An(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(ou,{total:s})),t.createElement(Q,{size:Hp[h],showSizeChanger:E,showQuickJumper:C,pageSizeOptions:w,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},$p=()=>{const{prefixCls:e,layout:n}=t.useContext(Fd),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(Xi,null))},jp=()=>{const{prefixCls:e,setElementStore:n}=t.useContext(Fd),r=t.useRef(null);t.useLayoutEffect((()=>{i()}),[]);const i=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},qp=t.forwardRef(((e,n)=>{const r=sn(Md,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}=_n(r),C=t.useRef(null),w=t.useRef(null),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=tr("table"),R=Dn(((e,t)=>{const n="function"==typeof i?i(e,t):null==e?void 0:e[i];return void 0===n?(Qn("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:D,setAllTableData:_,setDeriveRowKeys:F,setInvalidRowKeys:H,setFieldAuth:M,setColumnsDefined:$,setScrollXLoad:j,setScrollYLoad:q,setResizeState:K,setHandleState:V,setSummaries:z,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:Yd(),tableManager:Qd,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],allParentRowKeys:[],deriveRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!l,scrollBarRef:t.createRef(),rowHeight:i||Jd.rowHeightMaps[r],store:new Zd,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:!Fn&&/MSIE|Trident/.test(navigator.userAgent)}),o=(e,t,r="",i=0)=>e.map((e=>{const l=n(e,e.index),a=r?`${r}.${e.index+1}`:`${e.index+1}`,s={level:i,rowKey:l,indexPath:a};return e.indexPath=a,e._level=i,e._parentRowKey=i?t:null,Array.isArray(e.children)&&(s.children=o(e.children,l,a,i+1)),t?Object.assign(s,{parentRowKey:t}):s}));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=Xl(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?o(e,""):[],a.current.allParentRowKeys=t?Ql(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:ae,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:pe,setHighlightKey:he,updateMark:ge,forceUpdate:ve,mergedTdCells:ye,setMergedCells:be,layout:xe,setLayout:Ee,permission:Ce,setPermission:we,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(nn),C={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:Jd.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:Jd.pagination.pageSize,total:0},w=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)=>me(e,t)?e:t),f),[O,k]=t.useReducer(((e,t)=>me(e,t)?e:t),m),[L,A]=t.useReducer(((e,t)=>me(e,t)?e:t),[]),[P,D]=t.useState(C),[_,F]=t.useReducer(((e,t)=>me(e,t)?e:t),w),[H,M]=t.useReducer(((e,t)=>me(e,t)?e:t),S),[$,j]=t.useState(null!==(p=null==b?void 0:b.currentRowKey)&&void 0!==p?p:""),[q,K]=t.useReducer((e=>e+1),0),[V,z]=tu([],{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:D,selectionKeys:_,setSelectionKeys:F,rowExpandedKeys:H,setRowExpandedKeys:M,highlightKey:$,setHighlightKey:j,updateMark:q,forceUpdate:K,mergedTdCells:V,setMergedCells:z,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:Fe,showPagination:He,tableColumns:Me,flattenColumns:$e,editableColumns:je,summationColumns:qe,leftFixedColumns:Ke,rightFixedColumns:Ve,derivedMergeCells:ze,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}=ru(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}=lu(r,{getRowKey:R,tableRef:O,topElementRef:C,tableElementRef:w,tableBodyRef:S,$size:E,tableColumns:Me,flattenColumns:$e,leftFixedColumns:Ke,derivedMergeCells:ze,tableFlatData:Q,layout:xe,showFooter:Ue,showPagination:He,isFullScreen:ke,setLayout:Ee,setElementStore:L,setShouldToTop:B}),{initialTable:xt,checkDataIndex:Et,createTableFullData:Ct,getTableData:wt,createTableList:St,createTableData:Nt,createGroupData:Tt,createSelectionKeys:It,createRowExpandedKeys:Rt,setSelectionKeysEffect:Ot,findParentRowKeys:kt,getAllChildRowKeys:Lt,doFieldValidate:At,getTableLog:Pt,dataChange:Dt,tableChange:_t,toLastPage:Ft,toFirstPage:Ht,getPageCount:Mt,pagerChangeHandle:$t,scrollBottomDebouncer:jt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:Vt,clearRowSelection:zt,clearRowHighlight:Wt,clearTableLog:Bt,destroy:Ut}=iu(r,{getRowKey:R,tableRef:O,tableElementRef:w,tableBodyRef:S,$size:E,tableColumns:Me,flattenColumns:$e,tableFullData:k,pagination:le,layout:xe,filters:J,sorter:te,superFilters:re,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,summationColumns:qe,isFetch:Pe,isWebPagination:De,isScrollPagination:Fe,isServiceSummation:Ze,isGroupSubtotal:at,doLayout:bt,setTableFlatData:Z,setTableFullData:P,setTableOriginData:D,setAllTableData:_,setDeriveRowKeys:F,setPagination:ae,setPingRight:Oe,setPingLeft:Ie,setSpinning:Ne,setSorter:ne,setFilters:ee,setSuperFilters:ie,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:he,setSelectionRows:W,setScrollXLoad:j,setScrollYLoad:q,setFieldAuth:M,setResizeState:K,setSummaries:z,setPermission:we,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:C,setHandleState:w,scrollYToRecord:S,setSelectionKeysEffect:N,setOriginColumns:T,setRowExpandedKeys:I,setHighlightKey:R,setResizeState:O,setUnMounted:k,calcTableHeight:L,createSelectionKeys:A,createRowExpandedKeys:P,initialTable:D,destroy:_}=n,F=t.useRef(f);Pi((()=>{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),ea(p)}),[p]),Pi((()=>{if(!a)return;const{onChange:e}=a;h.__prevent__||null==e||e(h,h.map((e=>s.current.recordsMap.get(e)))),ea(h)}),[h]),Pi((()=>{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]),Pi((()=>{var e;me(f,F.current)||(F.current=f,g&&i&&(null===(e=i.onChange)||void 0===e||e.call(i,f)))}),[f]),Pi((()=>{const e=A(l.selectedRowKeys);me(e,p)||N(Jl(e))}),[null==l?void 0:l.selectedRowKeys]),Pi((()=>{const e=P(a.expandedRowKeys);me(e,h)||I(Jl(e))}),[null==a?void 0:a.expandedRowKeys]),Pi((()=>{const{currentRowKey:e}=o;e!==m&&R(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),Pi((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),S("","after"===e?1e5:0)),t&&u.current>C()&&x(),(e||t)&&w({insert:null,remove:!1})}),[u.total]),Pi((()=>{L()}),[d]),Pi((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||Qn("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),au({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(Un(r)),D(),b(),Kn((()=>L())),()=>{_(),k(!0)})),[])})(r,{tableRef:O,tableBodyRef:S,$size:E,pagination:le,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,showSummary:Be,summationRows:st,isWebPagination:De,isScrollPagination:Fe,checkDataIndex:Et,toLastPage:Ft,toFirstPage:Ht,getPageCount:Mt,setHandleState:V,scrollYToRecord:gt,setOriginColumns:A,setSelectionKeysEffect:Ot,setRowExpandedKeys:ue,setHighlightKey:he,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:je,leftFixedColumns:Ke,rightFixedColumns:Ve,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:ze,updateMark:ge,isFetch:Pe,isPingLeft:Te,isPingRight:Re,isHeadSorter:Xe,isHeadFilter:Qe,isFullScreen:ke,isTableEmpty:ot,isHeadGroup:Ge,isGroupSubtotal:at,isWebPagination:De,dataChange:Dt,tableChange:_t,getTableData:wt,setElementStore:L,createTableList:St,createTableFullData:Ct,updateTableFlatData:Ae,setSorter:ne,setFilters:ee,setSuperFilters:ie,setHighlightKey:he,setRowExpandedKeys:ue,setSelectionRows:W,setSelectionKeysEffect:Ot,setInvalidRowKeys:H,setMergedCells:be,getSpan:pt,getStickyLeft:ht,getStickyRight:mt,scrollXToColumn:ft,scrollYToRecord:gt,setPagination:ae,setPingLeft:Ie,setPingRight:Oe,setSpinning:Ne,setFullScreen:Le,setShouldToTop:B,doFieldValidate:At,createTableData:Nt,createGroupData:Tt,findParentRowKeys:kt,getAllChildRowKeys:Lt,scrollBottomDebouncer:jt,resetTableScroll:yt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:Vt,clearRowSelection:zt,clearRowHighlight:Wt})),[E,Q,$e,te,J,re,xe,Ye,Ue,Be,st,le,ct,se,de,pe,ze,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:C,doFieldValidate:w,setTableOriginData:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:D,clearRowHighlight:_,clearTableSorter:F,clearTableFilter:H,clearSuperFilters:M,clearTableLog:$}=n,{columns:j,columnsChange:q}=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=>An(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(),_(),F(),H(),M(),$(),y([]))},CLEAR_LOG:()=>{$()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{l.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?Jl([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?Jl([...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=Wl(j,e);if(!r)return Qn("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!oe(t))return Qn("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return Qn("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&fe(r,e,t[e]);n&&(q?q([...j]):Qn("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:l}=i.current,a=(Array.isArray(e)?e:[e]).filter((e=>oe(e)));if(!a.length)return;a.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[Jd.expandableColumn,Jd.selectionColumn,Jd.operationColumn].includes(n)||la(e,n,ia(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=xa(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=>oe(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)&&_(),R(h.filter((e=>!l.includes(e)))),g(),Kn((()=>{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||w(d,ia(n,l),c,l,ma(a))}))}));const{required:n,validate:l}=P(),a=[...n,...l];return a.length&&C(a[0].rowKey),A(),{required:n,validate:l}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:$e,editableColumns:je,pagination:le,fetchParams:ct,selectionKeys:se,rowExpandedKeys:de,highlightKey:pe,isFetch:Pe,dataChange:Dt,getTableData:wt,createTableData:Nt,createTableFullData:Ct,calcTableHeight:vt,scrollXToColumn:ft,scrollYToRecord:gt,doFieldValidate:At,setTableOriginData:D,setHandleState:V,setColumnsDefined:$,setSelectionKeysEffect:Ot,setRowExpandedKeys:ue,setHighlightKey:he,setSelectionRows:W,setOriginColumns:A,forceUpdate:ve,getTableLog:Pt,clearRowSelection:zt,clearRowHighlight:Wt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:Vt,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||Ve.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(Fd.Provider,{value:Gt},t.createElement("div",{className:_e(Yt,b),style:x},m&&t.createElement("div",{ref:C,className:`${I}-top`},t.createElement("div",{className:`${I}-top__space`},"bottom"!==(null==p?void 0:p.position)&&t.createElement(ou,{total:le.total}),t.createElement("div",{className:`${I}-top__space-slot`,style:{justifyContent:Bd[h]}},r.children)),t.createElement("div",{className:`${I}-top__actions`},t.createElement($u,{ref:N,showFullScreen:f,showReload:g&&Pe,showPrint:Ce.print&&!!d,showImport:Ce.import&&et,showExport:Ce.export&&!!u,showClipboard:tt,showCollection:Je,showFastSearch:rt,showSuperSearch:nt,showPivotGrid:it,showGroupSummary:lt,showToolBox:v,tableColumns:Me}),t.createElement(qu,{ref:T,columns:l}))),t.createElement(Qi,{spinning:null!=a?a:Se},t.createElement("div",{ref:w,className:_e(Xt),style:ut},t.createElement("div",{className:`${I}--main-wrapper`},y&&t.createElement(Yu,{tableColumns:Me}),t.createElement(_p,{ref:S}),Ue&&t.createElement(Fp,null)),Ye&&t.createElement("div",{className:`${I}--border-line`}),ot&&t.createElement($p,null),o&&t.createElement(jp,null))),He&&t.createElement(Mp,Sn({},le,{onChange:(e,t)=>$t({current:e,pageSize:t})}))))}));qp.displayName="QmTable";const Kp=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}=_n(e),{t:m}=Pn(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=rl(f),[b,x]=t.useState(c),[E,C]=t.useState(),[w,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,D]=t.useState(ye({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[_,F]=t.useState([]),H=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*Co[h]-30)},M=il(H,5);dn((()=>{M()}),[y.width]),Pi((()=>{me(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 $=()=>An(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=jn}=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=pe(t.data,l))&&void 0!==e?e:[];i||(S([]),yield qn(0)),F(n)}}catch(e){}T(!1)}})),j=e=>{i||(C(e),p(e))},q=e=>{D(Object.assign({},P,e))},K={[`${tr("search-helper")}--wrapper`]:!0},V=b.webPagination?{dataSource:_,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(ad,{ref:g,items:O,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>k(e),onCollapse:()=>H(),onFinish:e=>q(e),onReset:()=>An(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||q(t)}))}):null),t.createElement("div",null,t.createElement(qp,Sn({ref:v,uniqueKey:r,height:I,columns:L,rowKey:b.rowKey||"pageIndex"},V,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{S(e),C(i?t:t[0])}},paginationConfig:b.paginationConfig,columnsChange:e=>A(e),onRowDblclick:j,onRowEnter:j}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Co[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Zn,{onClick:()=>p(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(Zn,{type:"primary",disabled:!E,onClick:()=>p(E,i?w:void 0)},m("qm.dialog.confirm"))))};Kp.displayName="QmSearchHelper";const Vp=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Vp(e.children)),e.children&&t.push(e.value)})),t},zp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=zp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},Wp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&Wp(e.children,t),t(e)||e.children&&e.children.length))),Bp=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}=_n(e),{t:f}=Pn(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=rl(g),[x,E]=t.useState(c),[C,w]=t.useState(),[S,N]=t.useState(o),[T,I]=t.useState(!1),[R,k]=t.useState(300),[L,A]=t.useState(300),[P,D]=t.useState(s),[_,F]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[H,M]=t.useState(ye({},null===(n=c.fetch)||void 0===n?void 0:n.params,l)),[$,j]=t.useState([]),q=()=>{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*Co[m]-30)},K=il(q,5);dn((()=>{K()}),[b.width]),Pi((()=>{me(s,P)||D(s)}),[s]),t.useEffect((()=>{V()}),[H]),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 V=()=>An(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=jn}=n;if(a(H)){I(!0);try{const t=yield r(H);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=pe(t.data,l))&&void 0!==e?e:[];i||(N([]),yield qn(0)),j(n)}}catch(e){}I(!1)}})),z=e=>{i||(w(e),h(e))},W=e=>{M(Object.assign({},H,e))},[B,U]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),J=t.useRef(B),ee=t.useRef([]);Pi((()=>{X(Vp(B))}),[B]);const te=()=>An(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=pe(a.data,r))&&void 0!==e?e:[],n=qa(t,i,l);U(n),J.current=n,ee.current=t}}catch(e){}})),ne=e=>`${e}|${io.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,re={[`${tr("tree-table-helper")}--wrapper`]:!0},ie=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:Object.assign(Object.assign({},x.fetch),{params:H})};return t.createElement("div",{ref:g,className:_e(re,u),style:p},t.createElement(Gi,{defaultValue:200,style:{height:"100%"}},t.createElement(Gi.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(Ye,null),allowClear:!0,onChange:e=>(e=>{const t=Wp(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 Qn("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=pe(e,t[r]);W(n)})(zp(ee.current,(n=>pe(n,t)===e[0]))||{})}})),t.createElement(Gi.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},P.length?t.createElement(ad,{ref:v,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>D(e),onCollapse:()=>q(),onFinish:e=>W(e),onReset:()=>An(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(qp,Sn({ref:y,uniqueKey:r,height:L,columns:_,rowKey:x.rowKey||"pageIndex"},ie,{rowSelection:{type:i?"checkbox":"radio",clearableAfterFetched:!i,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:S,onChange:(e,t)=>{N(e),w(i?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>F(e),onRowDblclick:z,onRowEnter:z}))))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Co[m]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Zn,{onClick:()=>h(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(Zn,{type:"primary",disabled:!C,onClick:()=>h(C,i?S:void 0)},f("qm.dialog.confirm"))))};Bp.displayName="TreeTableHelper";const Up=e=>{var n,r,i;const{multiple:l,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=_n(e),{t:p}=Pn(),[h,m]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${tr("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},Bn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:_e(g,s),style:c},t.createElement(_d,{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:`${Co[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Zn,{onClick:()=>d(null),style:{marginRight:8}},p("qm.dialog.cancel")),t.createElement(Zn,{type:"primary",disabled:!h,onClick:()=>d(h)},p("qm.dialog.confirm"))))};Up.displayName="TreeHelper";const Gp="_startSign",Yp="_endSign",Xp=e=>{var n;const{uniqueKey:r,initialValue:i,filters:l=[],table:a={},onClose:o}=e,{$size:s}=_n(e),{t:c}=Pn(),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=rl(d),[m,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[C,w]=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:Gp,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:Yp,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[T,I]=t.useState(ye({},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*Co[s]-30)},D=il(P,5);dn((()=>{D()}),[h.width]),Pi((()=>{me(l,C)||w(l)}),[l]),t.useEffect((()=>{_()}),[T]);const _=()=>An(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=jn}=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=pe(t.data,i))&&void 0!==e?e:[];k(n)}}catch(e){}v(!1)}})),F=(e,t)=>{delete e[t]},H=()=>{y.forEach((e=>{e&&(F(e,Gp),F(e,Yp))})),b([])},M=e=>{H(),I(Object.assign({},T,e))},$=tr("range-helper"),j=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"},C.length?t.createElement(ad,{ref:u,items:C,initialValues:i,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>P(),onFinish:e=>M(e),onReset:()=>An(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||M(t)}))}):null),t.createElement("div",null,t.createElement(qp,Sn({ref:p,height:x,columns:S,rowKey:m.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=L[0]&&e.pageIndex<=L[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>N(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[Gp,Yp].includes(n)&&(n===Gp&&(e[n]?(F(e,n),b([void 0,y[1]])):e.pageIndex>L[1]?R.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&F(y[0],n),e[n]="[",b([e,y[1]]))),n===Yp&&(e[n]?(F(e,n),b([y[0],void 0])):e.pageIndex<L[0]?R.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&F(y[1],n),e[n]="]",b([y[0],e]))),p.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===L[0]&&(e[Gp]="["),e.pageIndex===L[1]&&(e[Yp]="]")}))}}),t.createElement(Zn,{type:"primary",icon:t.createElement(xt,null),title:c("qm.table.alert.clear"),onClick:()=>H()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Co[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Zn,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(Zn,{type:"primary",disabled:!A,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[Gp,Yp].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};Xp.displayName="RangeTableHelper";const Qp=e=>null!=e;function Zp(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]),au({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 Jp=8;const eh={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"]}},th={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"]}},nh=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function rh(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:l,visibleFirst:a}=e,o=t/2,s={};return Object.keys(eh).forEach((e=>{const c=r&&th[e]||eh[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,nh.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?Jp: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]=-u.arrowOffsetHorizontal-o;break;case"leftBottom":case"rightBottom":d.offset[1]=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 ih={fill:"transparent",pointerEvents:"auto"},lh=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-${Yd()}`,p="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(Ut,{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",Sn({},i?null:ih,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),i&&t.createElement(t.Fragment,null,t.createElement("rect",Sn({},ih,{x:"0",y:"0",width:"100%",height:`${i.top}px`})),t.createElement("rect",Sn({},ih,{x:"0",y:"0",width:i.left,height:"100%"})),t.createElement("rect",Sn({},ih,{x:"0",y:i.top+i.height,width:"100%",height:`calc(100vh - ${i.top+i.height}px)`})),t.createElement("rect",Sn({},ih,{x:i.left+i.width,y:"0",width:`calc(100vw - ${i.left+i.width}px)`,height:"100%"})))):null))},ah=e=>{const{prefixCls:n,zIndex:r,open:i,onPause:l,onPlay:a}=e,[o,s]=tu(void 0,{value:i,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=Dn((e=>{p(e),e.shiftKey&&32===e.keyCode&&h()}));t.useEffect((()=>{const e=Mt(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-qi(t).x,o=e.clientY-qi(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),Mi(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(Et,null):t.createElement(Ct,null))},oh=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}=Pn(),y="primary"!==c?"primary":"default",b=Dn((e=>{w(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=Mt(document,"keyup",b);return()=>e.remove()}),[]);const x=Qp(l)?t.createElement("div",{className:`${n}-cover`},l):null,E=Qp(o)?t.createElement("div",{className:`${n}-description`},o):null;let C;C=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 w=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:_e(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(Xe,{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`},C),t.createElement(er,{className:`${n}-buttons`},0!==r?t.createElement(Zn,{className:`${n}-prev-btn`,size:"small",onMouseDown:w,onClick:p},v("qm.tour.prevStep")):null,r===i-1?t.createElement(Zn,{className:`${n}-finish-btn`,type:y,size:"small",onClick:m},v("qm.tour.finish")):t.createElement(Zn,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:w,onClick:h},v("qm.tour.nextStep"))))))},sh=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(oh,e))},ch={left:"50%",top:"50%",width:1,height:1},dh=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:C=!0,scrollIntoViewOptions:w=!0}=e,S=kn(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]=tu(0,{value:l,defaultValue:i}),[R,O]=tu(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=tu(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),D=t.useRef(R);t.useLayoutEffect((()=>{R&&!D.current&&I(0),D.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:_,type:F,placement:H,trigger:M,delay:$,style:j,arrow:q,className:K,mask:V,scrollIntoViewOptions:z,zIndex:W,action:B}=r[T]||{},U=W||k,G=F||d,Y=R&&(null!=V?V:u),X=null!=z?z:w,[Q,Z]=Zp(_,!!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,H),ee=!!Z&&(void 0===q?p:q),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),Pi((()=>{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"===Hi(r=n,"display")||"hidden"===Hi(r,"visibility")||"0"===Hi(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=()=>An(void 0,void 0,void 0,(function*(){if(!M||!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(M,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:l}),o=document.elementFromPoint(i,l);o&&(o.dispatchEvent(a),yield qn(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,j),ce=tr("tour"),de=[{[`${ce}-primary`]:"primary"===G},m,K],ue=rh({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(lh,{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:C,rootClassName:m}),t.createElement(Ut,{open:A,autoLock:!0},t.createElement(Gt,Sn({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:_e(de),prefixCls:ce,popup:()=>t.createElement(sh,Sn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>An(void 0,void 0,void 0,(function*(){yield le(),ne(T-1)})),onNext:()=>An(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||ch),{position:"fixed",pointerEvents:"none"})}))),h&&t.createElement(Ut,{open:R},t.createElement(ah,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));dh.displayName="QmTour";const uh=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ph=e=>({_s:e,status:uh[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),hh=e=>e?6:5,mh=(e,t,n,r,i)=>{clearTimeout(r.current);const l=ph(e);t(l),n.current=l,null==i||i({current:l})},fh=(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((()=>ph(s?2:hh(c)))),g=l(m),v=l(),[y,b]=(e=>oe(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 hh(t)}})(g.current._s,d);e&&mh(e,f,g,v,h)}),[h,d]),E=p((e=>{const l=e=>{switch(mh(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:hh(d))}),[x,h,t,n,r,i,y,b,d]);return o((()=>()=>clearTimeout(v.current)),[]),[m,E,x]},gh=e=>{const{name:n,in:r,timeout:i,preEnter:l=!0,preExit:a}=e,[o,s]=fh({timeout:i,preEnter:l,preExit:a,initialEntered:r});return dn((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?Op(e,{className:_e(e.props.className,n,o.status)}):e)))};var vh={previewWidth:1100,defaultDistance:.45,logoHeight:60};const yh=n(void 0);var bh=null;function xh(){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 Eh(e,t){var n;try{var r=navigator.userAgent,i=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(xh()){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:bh?n=bh:((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),bh=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&xh(),n}catch(e){R.error("getLodop 出错:"+e)}}xh();const Ch=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)},wh=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:i}=e,{global:l}=t.useContext(nn),{$$preview:a}=t.useContext(yh),{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}))),Pi((()=>{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*vh.defaultDistance+10*vh.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*vh.defaultDistance+10*vh.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Ch(v-10*(e.left-vh.defaultDistance)-10*(e.right-vh.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return Ch(y-10*(e.top-vh.defaultDistance)-10*(e.bottom-vh.defaultDistance))}),[o,y]),E=o.form.scale,C=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:Ch(10*e.left),right:Ch(10*e.right),top:Ch(10*e.top),bottom:Ch(10*e.bottom)}}),[o]),w=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:i}=C,l=b+t+n,a=vh.previewWidth-l<=0?0:(vh.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>vh.previewWidth?0:a>0?s:(vh.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,C,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: ${vh.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-vh.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+=vh.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=()=>An(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return D();u.current.previewEl.innerHTML||(T(),yield qn(0),I(),R(),g(!1))})),P=()=>An(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return D();T(),yield qn(0),I(),R(),g(!1),a.doPrint(k()),yield qn(0),a.doClose()})),D=()=>{Qn("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_={[tr("print-container")]:!0,"no-visible":i};return t.createElement("div",{ref:d,className:_e(_)},t.createElement(Qi,{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:w}))))}));wh.displayName="Container";class Sh extends s{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:on("qm.print.setPanel.printParameter")},{type:"SELECT",label:on("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:on("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:on("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:on("qm.print.setPanel.vertical"),value:"vertical"},{text:on("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:on("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:on("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:on("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:on("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:on("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:vh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:on("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:on("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:vh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:on("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:on("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:vh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:on("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:on("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:vh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:on("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:on("qm.print.setPanel.sizeUnit"),disright:on("qm.print.setPanel.sizeUnit"),distop:on("qm.print.setPanel.sizeUnit"),disbottom:on("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>An(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(ad,{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(Zn,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},on("qm.dialog.close")),t.createElement(Zn,{type:"primary",onClick:()=>this.confirmHandle()},on("qm.dialog.confirm"))))}}Sh.contextType=nn;class Nh 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:vh.defaultDistance,right:vh.defaultDistance,top:vh.defaultDistance,bottom:vh.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=()=>An(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 en.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=>An(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)=>An(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=Eh();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}=vh,{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(on("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=Eh();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(on("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:on("qm.print.laserPrinter"),value:"laser"},{text:on("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=Eh(),t=[{text:on("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){Qn("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 An(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield en.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),oe(n)&&(yield en.setItem(this.printerKey,n))),oe(n)&&Object.keys(n).length&&ye(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=tr("print-preview"),c={visible:r,title:on("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,on("qm.print.printer"),":",t.createElement(F,{value:i.printerName,onChange:e=>{this.setState((t=>ye({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(F.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,on("qm.print.type"),":",t.createElement(F,{value:i.printerType,onChange:e=>{this.setState((t=>ye({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(F.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,on("qm.print.copies"),":",t.createElement($,{value:i.copies,min:1,precision:0,onChange:e=>{this.setState((t=>ye({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,on("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"}}),on("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(Zn,{type:"text",icon:t.createElement(ot,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},on("qm.print.setting"))),t.createElement("span",null,t.createElement(Zn,{type:"text",icon:t.createElement(Ve,null),className:"text-btn",onClick:()=>this.exportClickHandle()},on("qm.print.export"))),t.createElement("span",null,t.createElement(Zn,{icon:t.createElement(lt,null),type:"primary",onClick:this.printClickHandle},on("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(yh.Provider,{value:this.provide},t.createElement(wh,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,on("qm.print.scale"),":",t.createElement(Z,{value:i.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>ye({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*i.scale)}%`)),t.createElement("span",null,on("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,on("qm.print.pageNumber"),":",on("qm.print.pagination",{currentPage:l,totalPage:a}))))),t.createElement(Nl,c,t.createElement(Sh,{setting:i.setting,onChange:e=>{this.setState((t=>ye({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(yh.Provider,{value:this.provide},t.createElement(wh,{ref:this.containRef,templateRender:n,directPrint:!0}))}}Nh.contextType=nn;class Th extends s{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>An(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:on("qm.print.preview"),width:`${vh.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(Nl,o,t.createElement(Nh,s)):e?t.createElement(Nh,s):null},this.DO_PRINT=()=>An(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield qn(0),this.setState({visible:!0}),yield qn(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(Zn,o,this.props.children),this.createRender())}}function Ih(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Rh(e){const t=Ih(e);return t?t.frameElement:null}function Oh(e){const t=Ah(e);return kh([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function kh(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 Lh(e,t){const n=Rh(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let i=n,l=!1;for(;i;){const e=Oh(i);if(r.push(e),i=Rh(i),l)break;i&&Ih(i)===t&&(l=!0)}return kh(r)}return e.getBoundingClientRect()}function Ah(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)}}Th.propTypes={size:(e,t,n)=>{if(!wa(e[t]||""))return Xn("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Vt.elementType},Th.defaultProps={preview:!0,type:"primary",icon:t.createElement(lt,null)},Th.contextType=nn;const Ph=Object.assign;class Dh{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=Mh.border,this.padding.style.borderColor=Mh.padding,this.content.style.backgroundColor=Mh.background,Ph(this.node.style,{borderColor:Mh.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){Hh(t,"margin",this.node),Hh(t,"border",this.border),Hh(t,"padding",this.padding),Ph(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"}),Ph(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class _h{constructor(e,t){this.tip=e.createElement("div"),Ph(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),Ph(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),Ph(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});Ph(this.tip.style,r.style)}}class Fh{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 _h(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 Dh(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=Lh(e,this.window),i=Ah(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=Lh(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 Hh(e,t,n){Ph(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 Mh={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 $h=null,jh=null;function qh(){null!=window.document&&($h=null,null!==jh&&(jh.remove(),jh=null))}class Kh{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=>Vi(t,window.document.querySelector(e)))))return this._selectIgnore=!0,qh();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!==$h&&clearTimeout($h),null!=n&&(null===jh&&(jh=new Fh),jh.inspect(n,r),i&&($h=setTimeout((()=>qh()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=De((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(){qh(),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 Vh(e){return document.querySelector(e)}const zh=e=>{const{action:n,onConfirm:r,onCancel:i,onFinish:l}=e,{t:a}=Pn();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(er,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(Zn,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.closeButton")),t.createElement(Zn,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(Zn,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.finishButton"))))},Wh={left:"50%",top:"50%",width:1,height:1},Bh=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}=Pn(),E=t.useRef(),C=t.useRef(a.length),[S,N]=tu(0,{value:i,defaultValue:l}),[T,I]=tu(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=tu(1051,{value:h,defaultValue:h}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[D,_]=t.useState(T),[F,H]=t.useState(!1),[$,j]=Zp(k.node,!!r),[q,K]=t.useState(22),V=t.useRef(!1),z=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),W=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new Kh({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:pa(),node:e,path:t}),N(C.current),P(!0),U(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?B():U(),T?setTimeout((()=>_(!0)),16):_(!1),()=>{U()})),[T]),t.useEffect((()=>{C.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=tr("guide-tracker"),Q=[{[`${Y}-primary`]:!0}],Z=rh({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Ut,{open:T&&A,autoLock:!0},t.createElement(Gt,{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(Xe,{className:`${Y}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(M,{open:F,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Zt,{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(me(t,n))return;const r=t.findIndex((e=>e===k.id)),i=-1!==r?r:S;N(i),null==v||v(Ca(e),i)}},a.map(((e,n)=>t.createElement("li",{key:n,className:_e("item",{actived:e.id===k.id})},t.createElement(Ge,{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:Vh(e.selector),path:e.selector}),N(n),K(22===q?q+1:q-1),null==v||v(a,n))}},e.title),t.createElement(w,{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:Vh(n),path:n})}N(i),null==v||v(t,i)}},t.createElement(Xe,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${Y}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>H(e)},t.createElement(St,{className:_e(`${Y}-close`,"menu-icon"),style:{width:q}})),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:z,DO_CLOSE:e},S):t.createElement(zh,{action:z,onConfirm:()=>{null==v||v("add"===z?[...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({},$||Wh),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:G,onClick:G}))),s&&t.createElement(Ut,{open:D},t.createElement(ah,{zIndex:R,prefixCls:Y,onPause:()=>{V.current=A,P(!1),U()},onPlay:()=>{V.current?P(!0):B()}})))}));Bh.displayName="QmGuideTracker";const Uh=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:C,className:w,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],D=g[0],_=g[1],F=D/2,H=_/2,M=null!==(c=v[0])&&void 0!==c?c:F,$=null!==(d=v[1])&&void 0!==d?d:H,j=t.useMemo((()=>{const e=M-F,t=$-H;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}}),[F,H,M,$,b]),q=(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({},j),{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=(D+r)*n,s=(_+i)*n,c=D/2*n,d=_/2*n,u=o/2,f=s/2,g=2*(D+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),C&&(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),q(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()},V=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{K()}),[u,p,h,m,f,g,v,y,b,x,E,C]),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=>V(e))),n="attributes"===t.type&&V(t.target);if(e||n){K();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=tr("watermark");return t.createElement("div",{ref:N,className:_e(z,w),style:Object.assign({position:"relative"},S)},n.children)},Gh=new Map,Yh=new WeakMap;let Xh,Qh=0;function Zh(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(Yh.has(n)||(Qh+=1,Yh.set(n,Qh.toString())),Yh.get(n)):"0"):e[t]}`;var n})).toString()}function Jh(e,t,n={},r=Xh){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=Zh(e);let n=Gh.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},Gh.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(),Gh.delete(i))}}const em=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=Jh(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||Qn("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[tr("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 tm{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 nm{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 nm(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 tm(o+g,s+v),c2:new tm(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 rm{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 tm(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=nm.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)}}rm.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})},rm.canvasToDataURL=e=>e.toDataURL("image/png",1),rm.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const im=()=>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"})),lm=()=>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"})),am=()=>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"})),om=()=>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"})),sm=()=>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"})),cm=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}=Pn(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),C=[2,4,6],w=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=tu(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(C[0]),[A,P]=t.useState(I?S[0]:S[4]),[D,_]=t.useState(w[1]),[H,$]=t.useState("bottomLeft"),[j,q]=t.useState(!1),[K,V]=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:D,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new rm(b.current,n),()=>y.current.destroy()}),[]);const z=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()};Pi((()=>{I&&N&&z()}),[N,I]),Pi((()=>{y.current.setDrawMode(R)}),[R]),Pi((()=>{y.current.setLineWidth(k)}),[k]),Pi((()=>{y.current.setPenColor(A)}),[A]),Pi((()=>{y.current.setFontSize(D)}),[D]);const W=()=>An(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield Yt(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return rm.canvasToDataURL(t)}catch(e){Qn("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:z,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"},C.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(F,{size:"small",value:D,options:w.map((e=>({value:e,label:e.toString()}))),onChange:e=>_(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=tr("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(Qi,{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:j})},t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(Nt,null))),t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(im,null))),t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(am,null))),t.createElement(M,{dropdownRender:G,overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement(je,null))),t.createElement(M,{dropdownRender:()=>G("text"),overlayClassName:`${Y}__popper`,placement:H,trigger:["click"],onOpenChange:U},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(lm,null))),t.createElement("button",{className:"btn",onClick:()=>An(void 0,void 0,void 0,(function*(){yield An(void 0,void 0,void 0,(function*(){V(!0);const e=yield W();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):h().format(zd);dl(rm.dataURLToBlob(e),`${t}.png`)}V(!1)})),B()}))},t.createElement(Ve,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement(om,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(sm,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(xt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(Xe,null)),t.createElement("button",{className:"btn",onClick:()=>An(void 0,void 0,void 0,(function*(){V(!0),yield qn(10);const e=yield W();V(!1),B(),null==f||f(e)}))},t.createElement(qe,null))),t.createElement("button",{className:"btn btn-fold",title:v(j?"qm.divider.spread":"qm.divider.collect"),onClick:()=>q(!j)},j?t.createElement(It,null):t.createElement(Tt,null))))))}));cm.displayName="QmSignature";const dm=t.createContext(void 0),um=e=>{const{prefixCls:n,flatColumns:r,tableData:i}=e,{getRowKey:l}=t.useContext(Fd),a=t.useRef({originGridData:i,flatGroupData:[],keyRecordMap:new Map,isTree:i.some((e=>Array.isArray(e.children))),gridLayoutContext:{}}),[o,s]=t.useState({pivotRef:a,prefixCls:n,viewMode:"table",size:"middle",columns:r,gridData:i,groupGridData:[],groupList:[],filterList:[],sorterList:[],expandedKeys:[],searchResults:[],switchIndex:0}),c=e=>{s((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}))},d=(e,t)=>{o.pivotRef.current[e]=t},u=e=>{c({columns:e})},p=e=>{c({gridData:e})},h=e=>{c({groupGridData:e})},m=e=>{c({groupList:e})},f=e=>{c({filterList:e})},g=e=>{c({sorterList:e})},v=e=>{c({expandedKeys:e})},y=e=>{c({searchResults:e})},b=e=>{c({switchIndex:e})},x=t.useMemo((()=>Object.assign(Object.assign({},o),{setContext:c,getRowKey:l,setPivotGridRef:d,setColumns:u,setGridData:p,setGroupGridData:h,setGroupList:m,setFilterList:f,setSorterList:g,setExpandedKeys:v,setSearchResults:y,setSwitchIndex:b})),[o]);return t.createElement(dm.Provider,{value:x},e.children)},pm=()=>t.useContext(dm);var hm={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:80,fixed:"left"},indentWidth:12};const mm=e=>[hm.selectionColumnDefine,...e].filter((e=>!e.hidden)),fm=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){const{dataIndex:i,width:l,renderWidth:a}=e[r];if(i===t)break;n+=l||a||0}return n+1},gm=(e,t="")=>"object"!=typeof e||null===e?[]:Object.keys(e).reduce(((n,r)=>{const i=t?`${t}.${r}`:r;if(n.push(i),Array.isArray(e[r]))return n;const l=gm(e[r],i);return n.concat(l)}),[]),vm={sum:e=>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=>e.length,unique:e=>new Set(e).size,empty:e=>e.filter((e=>zn(e))).length,notEmpty:e=>e.filter((e=>!zn(e))).length},ym=()=>{const{prefixCls:e,viewMode:n,setContext:r}=pm();Pn();return t.createElement("div",{className:`${e}-view-mode`},t.createElement(J,{value:n,options:[{label:"表格视图",value:"table"},{label:"甘特视图",value:"gantt"},{label:"看板视图",value:"card"},{label:"图表视图",value:"chart"}],onChange:e=>{r({viewMode:e})}}))},bm=()=>{const{prefixCls:e,pivotRef:n,groupList:r,columns:i,gridData:l,setGroupList:a,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=pm(),{t:d}=Pn(),u=t.useRef([]),p=t.useRef([]),h=t.useMemo((()=>r.filter((e=>e.fieldName&&e.order))),[r]),m=t.useMemo((()=>i.map((e=>({label:ma(e.title),value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,i]),f=t.useMemo((()=>{const e=h.map((e=>({[e.fieldName]:e.order})));return me(e,u.current)?u.current:(u.current=e,e)}),[h]),g=[{label:"选项顺序",value:"ascend"},{label:"选项倒叙",value:"descend"}];Pi((()=>{o(p.current)}),[h.map((e=>e.fieldName)).join(",")]),t.useLayoutEffect((()=>{const e=((e,t=[],n,r)=>{const i=(e,t)=>{if(0===t.length)return n&&e.forEach(((e,t)=>e._varIndex=t)),Xl(e);const[{[Object.keys(t[0])[0]]:l}]=t,a=Object.keys(t[0])[0],o=t.slice(1),s=Object.groupBy(e,(e=>r(e,a))),c=Object.keys(s).sort(((e,t)=>"ascend"===l?e.localeCompare(t):t.localeCompare(e))),d={};return c.forEach((e=>{d[`#${e}`]=i(s[e],o)})),d};return i(e,t)})(l,f,n.current.isTree,((e,t)=>{var n,r,l;const{dictItems:a,precision:o}=i.find((e=>e.dataIndex===t))||{},s=ia(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=oa(c)?new Wt(c).toFixed(o):c),c||"(内容为空)"}));var t;s(e),t=gm(e),p.current=t,c("flatGroupData",(e=>{const t=[];return function e(n,r,i=""){if(Array.isArray(n))for(const e of n)t.push(e);else for(const l in n){const a=i?`${i}.${l}`:l;t.push({id:a,_groupLabel:l,_groupLevel:r}),e(n[l],r+1,a)}}(e,0),t})(e))}),[f,l]);const v=()=>{a([...r,{fieldName:"",order:"ascend"}])},y=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...r])},b=e=>t.createElement(t.Fragment,null,t.createElement(Ge,{className:"icon handle"}),t.createElement(F,{value:e.fieldName||null,placeholder:d("qm.table.editable.selectPlaceholder"),options:m,style:{width:160,margin:"0 10px"},onChange:t=>y("fieldName",e,t)}),t.createElement(F,{value:e.order,options:g,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>y("order",e,t)}),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(e)}));return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置分组条件"),!!h.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},"折叠所有"),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(p.current)},"展开所有"))),t.createElement("div",{className:"list"},t.createElement(Zt,{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));me(t,n)||a(e)}},r.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:v},t.createElement(ht,{className:"icon"}),"添加条件"))),className:_e("action-btn",{active:!!h.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Rt,{className:"icon"}),"分组",h.length?`(${h.length})`:null))},xm=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:i,setFilterList:l,setGridData:a}=pm(),{originGridData:o,isTree:s}=n.current,{t:c}=Pn(),d=t.useMemo((()=>i.filter((e=>e.fieldName&&e.expression))),[i]),u=t.useMemo((()=>r.filter((e=>!!e.filter)).map((e=>({label:ma(e.title),value:e.dataIndex})))),[r]),[p,h]=t.useState("and");Pi((()=>{l(i.map((e=>Object.assign(Object.assign({},e),{logic:p}))))}),[p]);const m=()=>{const e=ga(d.map((e=>Object.assign(Object.assign({},Bn(e,["value"])),{condition:e.value}))));a(e?jl(o,e,s):o)},f=[{label:"满足所有条件",value:"and"},{label:"满足任一条件",value:"or"}],g=e=>{let t=[];if(!e)return[];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")}]}return t},v=()=>{l([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:p}])},y=(e,t,n)=>{Object.assign(t,{[e]:n}),"fieldName"===e&&Object.assign(t,{type:r.find((e=>e.dataIndex===n)).filter.type,expression:"",value:""}),l([...i])},b=e=>t.createElement(t.Fragment,null,t.createElement(F,{value:e.fieldName||null,options:u,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:160},onChange:t=>y("fieldName",e,t)}),t.createElement(F,{value:e.expression||null,placeholder:c("qm.table.editable.selectPlaceholder"),options:g(e.type),style:{width:100,margin:"0 10px"},onChange:t=>y("expression",e,t)}),x(e),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{l(i.filter((t=>t!==e)))})(e)})),x=e=>{var n,i;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{y("value",e,zn(t)?"":t)}});case"date":return t.createElement(wn,{popupClassName:Jd.popupClassName,defaultValue:null!==(n=da(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{y("value",e,ua(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(F,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||null,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{y("value",e,t)}},n.map((e=>t.createElement(F.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(O,{defaultValue:e.value,style:{width:150},onChange:t=>{y("value",e,t.target.value)}})}};return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置筛选条件"),!!d.length&&t.createElement(F,{value:p,options:f,style:{width:130},onChange:e=>h(e)})),t.createElement("div",{className:"list"},i.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:v},t.createElement(ht,{className:"icon"}),"添加条件"),t.createElement(Zn,{type:"primary",size:"small",onClick:m},"确定"))),className:_e("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Ot,{className:"icon"}),"筛选",d.length?`(${d.length})`:null))},Em=()=>{const{prefixCls:e,columns:n,gridData:r,sorterList:i,setSorterList:l,setGridData:a}=pm(),{t:o}=Pn(),s=t.useMemo((()=>i.filter((e=>e.fieldName&&e.order))),[i]),c=t.useMemo((()=>n.map((e=>({label:ma(e.title),value:e.dataIndex,disabled:i.some((t=>t.fieldName===e.dataIndex))})))),[i,n]);Pi((()=>{p()}),[t.useMemo((()=>s.map((e=>Object.values(e).join(":"))).join(",")),[s])]);const d=[{label:"字段升序",value:"ascend"},{label:"字段降叙",value:"descend"}],u=(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,p=()=>{var e;a((e=s,r.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:i}=r,l=ia(t,e),a=ia(n,e),o=u(l,a);if(0!==o)return"ascend"===i?o:-o}return 0})).slice(0)))},h=()=>{l([...i,{fieldName:"",order:"ascend"}])},m=(e,t,n)=>{Object.assign(t,{[e]:n}),l([...i])},f=e=>t.createElement(t.Fragment,null,t.createElement(Ge,{className:"icon handle"}),t.createElement(F,{value:e.fieldName||void 0,placeholder:o("qm.table.editable.selectPlaceholder"),options:c,style:{width:160,margin:"0 10px"},onChange:t=>m("fieldName",e,t)}),t.createElement(F,{value:e.order,options:d,placeholder:o("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>m("order",e,t)}),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{l(i.filter((t=>t!==e)))})(e)}));return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置排序条件")),t.createElement("div",{className:"list"},t.createElement(Zt,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.fieldName)),n=i.map((e=>e.fieldName));me(t,n)||l(e)}},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},f(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:h},t.createElement(ht,{className:"icon"}),"添加条件"))),className:_e("action-btn",{active:!!s.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(kt,{className:"icon"}),"排序",s.length?`(${s.length})`:null))},Cm=()=>{const{prefixCls:e,getRowKey:n,gridData:r,columns:i,searchResults:l,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=pm(),[c,d]=t.useState(!1),u=t.useMemo((()=>l.length),[l]);Pi((()=>{c||setTimeout((()=>{s(0),o([])}),200)}),[c]);const p=(e,t)=>{const r=[];return e.forEach((e=>{i.forEach((i=>{var l,a,o;const{dataIndex:s,dictItems:c,precision:d}=i,u=ia(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=oa(p)?new Wt(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(...p(e.children,t))})),r},h=il((e=>{const t=e.target.value.trim();s(0),o(t?p(r,t):[])}),200),m=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&f()},f=()=>{if(!u)return;s((a+1)%u)},g=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!u)return;s((a-1+u)%u)})()},t.createElement(It,null)),t.createElement("span",{className:"num"},u>0?a+1:a,"/",u),t.createElement("button",{className:"button-icon",onClick:()=>f()},t.createElement(Tt,null)));return t.createElement(M,{open:c,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,"设置查找条件"),t.createElement("button",{className:"button-icon",onClick:()=>d(!1)},t.createElement(Xe,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(O,{autoFocus:!0,style:{width:280},suffix:g(),onChange:h,onKeyUp:m}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>d(!c)},t.createElement(ut,{className:"icon"}),"查找"))},wm=()=>{const{prefixCls:e,columns:n,setColumns:r}=pm(),i=t.useMemo((()=>{let e=0;for(let t=0;t<n.length-1&&("left"!==n[t].fixed||n[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let r=0;r<n.length;r++)r===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(n[r]);return t}),[n]),l=()=>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,"字段自定义设置")),t.createElement("div",{className:"list"},t.createElement(Zt,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:i,setList:e=>{const t=e.map((e=>e.dataIndex)),n=i.map((e=>e.dataIndex));me(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)}r(n)})(Ca(e))}},i.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(Ge,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},ma(e.title)),t.createElement("button",{className:"button-icon",onClick:()=>{return(t=e).hidden=!t.hidden,void r([...n]);var t}},e.hidden?t.createElement(Lt,null):t.createElement(Ke,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(M,{trigger:["click"],dropdownRender:()=>l(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(ot,{className:"icon"}),"字段管理"))},Sm=()=>{const{prefixCls:e,size:n,setContext:r}=pm(),i=[{label:"常规",value:"small"},{label:"中等",value:"middle"},{label:"高",value:"large"}];return t.createElement(M,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},i.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(At,{className:"icon"}),"行高"))},Nm=()=>{const{prefixCls:e,pivotRef:n,columns:r}=pm(),{exportXLSX:i}=xu(),{getTitleFromCellValue:l}=du(),a=[{text:"记录数",value:"count"},{text:"唯一值",value:"unique"},{text:"空值",value:"empty"},{text:"非空值",value:"notEmpty"},{text:"合计值",value:"sum"},{text:"最大值",value:"max"},{text:"最小值",value:"min"},{text:"平均值",value:"avg"}],o={columns:Kl(r),fileName:h().format(zd),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},s=e=>void 0!==e._groupLevel,c=(e,t,n,r)=>{const{dataIndex:i,precision:a,formatType:o}=n;if(s(e))return ia(e,i);let c=l(e,n,t,r);return a>=0&&!o&&""!==c&&(c=Number(c)),c},d=()=>{const{gridLayoutContext:e}=n.current,{countMethod:t,summationData:r}=e;if(!t||!Object.keys(t).length)return[];const i={};return o.columns.map((e=>e.dataIndex)).forEach(((e,n)=>{if(n>0){let n="";(null==t?void 0:t[e])&&(n=a.find((n=>n.value===t[e])).text+" "+r.total[e]),la(i,e,n)}})),[i]},u=e=>An(void 0,void 0,void 0,(function*(){const{countMethod:t={}}=n.current.gridLayoutContext,r=yield i(Object.assign(Object.assign({},o),{footSummation:!!Object.keys(t).length}),e,d,c);dl(r,`${h().format(zd)}.xlsx`)})),p=[{key:"1",label:t.createElement(t.Fragment,null,t.createElement(Pt,{style:{marginRight:4}})," 导出分组"),onClick:()=>{u((()=>{const{flatGroupData:e,gridLayoutContext:t}=n.current,{countMethod:r,summationData:i}=t,l=[];let c=0;return e.forEach((e=>{const t=Object.assign({},e);s(e)?(t._level=e._groupLevel,o.columns.map((e=>e.dataIndex)).forEach(((n,l)=>{if(0===l)la(t,n,e._groupLabel);else{let l="";(null==r?void 0:r[n])&&(l=a.find((e=>e.value===r[n])).text+" "+Wn(i,e.id).subtotal[n]),la(t,n,l)}})),c=e._groupLevel):c>0&&(t._level=e._level+c+1),l.push(t)})),l})())}},{key:"2",label:t.createElement(t.Fragment,null,t.createElement(Dt,{style:{marginRight:4}})," 导出列表"),onClick:()=>{u(Array.from(n.current.keyRecordMap.values()))}}];return t.createElement(M,{trigger:["click"],menu:{items:p},className:_e("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},t.createElement("span",null,t.createElement(Ve,{className:"icon"}),"导出"))},Tm=()=>t.createElement("div",{className:"top-bar"},t.createElement(er,{size:4},t.createElement(ym,null),t.createElement(ee,{type:"vertical"}),t.createElement(wm,null),t.createElement(bm,null),t.createElement(xm,null),t.createElement(Em,null),t.createElement(ee,{type:"vertical"}),t.createElement(Sm,null),t.createElement(Cm,null),t.createElement(ee,{type:"vertical"}),t.createElement(Nm,null))),Im=t.createContext(void 0),Rm=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(Rm)):0,Om=e=>{const{scrollbar:n}=e,{groupGridData:r,setPivotGridRef:i}=pm(),[l,a]=t.useState({scrollbarRef:n,selectionKeys:[],treeExpandKeys:[],countMethod:{},summationData:{}});t.useLayoutEffect((()=>{i("gridLayoutContext",((e,t)=>{const n={};for(const r of t)r in e&&(n[r]=e[r]);return n})(l,["countMethod","summationData"]))}),[l]);const o=t.useMemo((()=>{const e=Rm(r);return Math.max(0,e-1)}),[r]),s=e=>{a((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}))},c=e=>{s({selectionKeys:e})},d=e=>{s({treeExpandKeys:e})},u=e=>{var t;s({countMethod:(t=Object.assign({},l.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},p=e=>{s({summationData:e})},h=t.useMemo((()=>Object.assign(Object.assign({},l),{indentDepth:o,setContext:s,setSelectionKeys:c,setTreeExpandKeys:d,setCountMethod:u,setSummationData:p})),[l,o]);return t.createElement(Im.Provider,{value:h},e.children)},km=()=>t.useContext(Im),Lm=e=>{var n;const{column:r}=e,{columns:i,setColumns:l}=pm(),{scrollbarRef:a}=km(),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||Jd.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]),Kn((()=>c(!1))),_i(document,"mousemove",h),_i(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=ta(e.target,a.current.container).left-a.current.scrollLeft+3;p({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),Di(document,"mousemove",h),Di(document,"mouseup",m),c(!0),Kn((()=>o.current.style.left=`${t}px`)),d.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(Ut,{open:s,getContainer:null===(n=a.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},Am=()=>{const{pivotRef:e,columns:n}=pm(),{indentDepth:r,selectionKeys:i,setSelectionKeys:l}=km(),{selectionColumn:a}=Jd,{indentWidth:o}=hm,s=t.useMemo((()=>mm(n)),[n]),c=t.useMemo((()=>i.length===e.current.keyRecordMap.size),[i]),d=t.useMemo((()=>i.length>0&&i.length<e.current.keyRecordMap.size),[i]);return t.createElement("div",{className:"header"},t.createElement("table",{className:"table",cellSpacing:"0",cellPadding:"0"},t.createElement("colgroup",null,s.map(((e,n)=>{const{dataIndex:i,width:l,renderWidth:a}=e,c=(l||a)+(1===n||n===s.length-1?r*(o+1):0);return t.createElement("col",{key:i,style:{width:`${c}px`,minWidth:`${c}px`}})}))),t.createElement("thead",null,t.createElement("tr",null,s.map(((n,i)=>{const{dataIndex:u,title:p,align:h,fixed:m}=n,f={"selection-column":u===a,"col--center":"center"===h,"col--right":"right"===h,"col--fix-left":"left"===m},g={left:"left"===m?`${fm(s,u)+(i>1?r*(o+1):0)}px`:""};return t.createElement("th",{key:u,className:_e("table-cell",f),style:g},u!==a?t.createElement("span",{className:"cell"},p):t.createElement(H,{checked:c,indeterminate:d,onChange:t=>{return n=t.target.checked,void l(n?Array.from(e.current.keyRecordMap.keys()):[]);var n}}),u!==a&&t.createElement(Lm,{column:n}))}))))))},Pm=e=>{const{records:n}=e,{pivotRef:r,getRowKey:i,size:l,columns:a,searchResults:o,switchIndex:s}=pm(),{scrollbarRef:c,indentDepth:d,selectionKeys:u,treeExpandKeys:p,setSelectionKeys:h,setTreeExpandKeys:m}=km(),{flatGroupData:f,isTree:g}=r.current,{renderText:v,getTitleFromCellNode:y}=du(),{selectionColumn:b,rowHeightMaps:x,treeTable:E}=Jd,C=t.useRef(null),{contextMenu:w}=(({ref:e,popup:n,enabled:r=!0})=>{const i=t.useRef(null),l=t.useRef(null),a=e=>{l.current=e},[o,s]=t.useState(!1),[c,d]=t.useState(null),u={width:150,height:200,zIndex:9999};Ep({ref:i,handler:()=>p()});const p=()=>{s(!1),d(null),a(null)},h=Dn((e=>{e.preventDefault(),a(e),s(!0),Kn((()=>{var t;const{width:n,height:r}=(null===(t=i.current)||void 0===t?void 0:t.getBoundingClientRect())||u,l=n,a=r,o=window.innerWidth,s=window.innerHeight;let c=e.clientX,p=e.clientY;c+l>o&&(c-=l),p+a>s&&(p-=a),d({x:c,y:p})}))}));t.useEffect((()=>{const t=e.current;return r&&t&&t.addEventListener("contextmenu",h),()=>{t&&t.removeEventListener("contextmenu",h)}}),[e]);const m=tr("context-menu"),f={position:"fixed",top:`${(null==c?void 0:c.y)||0}px`,left:`${(null==c?void 0:c.x)||0}px`,zIndex:u.zIndex};return{contextMenu:t.createElement(Ut,{open:o},t.createElement("div",{ref:i,className:_e(m,"ant-dropdown-menu"),style:f},l.current?n(l.current):null)),closeMenu:p}})({ref:C,enabled:!1,popup:e=>{const r=Ki(e.target,"table-row"),l=(null==r?void 0:r.getAttribute("data-row-key"))||"";return n.find((e=>i(e,e.index)==l)),t.createElement("div",{style:{height:200,width:150}},"右键菜单。。。")}}),S=t.useMemo((()=>{const e=new Map;return g&&n.forEach((t=>{const n=i(t,t.index);if(!t._parentRowKey)return e.set(n,!0);p.includes(t._parentRowKey)&&e.get(t._parentRowKey)?e.set(n,!0):e.set(n,!1)})),e}),[n,p]),N=t.useMemo((()=>mm(a)),[a]);Pi((()=>{const e=f.findIndex((e=>{var t;return i(e,e.index)===(null===(t=o[s])||void 0===t?void 0:t.rowKey)}));e>=0&&c.current.SET_SCROLL_TOP(e*x[l]);const t=N.findIndex((e=>{var t;return e.dataIndex===(null===(t=o[s])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=N.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]);const T=(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},I=(e,n)=>{var r;return t.createElement(He,{className:_e("cell--expand",{fold:!p.includes(n)}),style:{visibility:(null===(r=e.children)||void 0===r?void 0:r.length)>0?"visible":"hidden"},onClick:()=>(e=>{const t=p.includes(e);m(t?p.filter((t=>t!==e)):[...p,e])})(n)})},R=(e,n,r,i,l)=>{const{dataIndex:a,width:o,renderWidth:s,align:c,fixed:p,render:m}=e,f=ia(r,a),x=m?m(f,r,e,i,n):v(f,e,r),C=y(x),w=u.includes(l),S={"selection-column":a===b,"col--center":"center"===c,"col--right":"right"===c,"col--fix-left":"left"===p,active:T(l,a)},R={width:`${o||s}px`,minWidth:`${o||s}px`,left:"left"===p?`${fm(N,a)+d*(hm.indentWidth+1)}px`:""};return t.createElement("div",{key:a,"data-col-index":n,title:C,className:_e("table-cell",S),style:R},a!==b?t.createElement(t.Fragment,null,g&&1===n&&t.createElement(t.Fragment,null,(O=r._level)?t.createElement("span",{key:O,className:`cell--indent indent-level-${O}`,style:{paddingLeft:O*E.textIndent+"px"}}):null,I(r,l)),t.createElement("span",{className:"cell"},x)):t.createElement(t.Fragment,null,t.createElement("span",{className:"order"},((e,t)=>g?0===e._level?e._varIndex+1:null:t+1)(r,i)),t.createElement(H,{className:"checkbox",checked:w,onChange:e=>{return t=e.target.checked,n=l,void h(t?[...u,n]:u.filter((e=>e!==n)));var t,n}})));var O};return t.createElement(t.Fragment,null,t.createElement("div",{ref:C,className:"grid-list"},n.map(((e,n)=>{const r=i(e,e.index);if(g&&!S.get(r))return null;const l={"row--selection":u.includes(r)};return t.createElement("li",{key:r,"data-row-key":r,className:_e("table-row",l)},N.map(((t,i)=>R(t,i,e,n,r))))}))),w)},Dm=e=>{const{column:n,keyPath:r,type:i}=e,{prefixCls:l}=pm(),{summationData:a,countMethod:o,setCountMethod:s}=km(),{dataIndex:c,filter:d}=n,[u,p]=t.useState(!1),h=t.useMemo((()=>{const e=[{text:"记录数",value:"count",fn:vm.count},{text:"唯一值",value:"unique",fn:vm.unique},{text:"空值",value:"empty",fn:vm.empty},{text:"非空值",value:"notEmpty",fn:vm.notEmpty},{text:"合计值",value:"sum",fn:vm.sum},{text:"最大值",value:"max",fn:vm.max},{text:"最小值",value:"min",fn:vm.min},{text:"平均值",value:"avg",fn:vm.avg}];return"number"===(null==d?void 0:d.type)?e:e.slice(0,-4)}),[]),m=t.useMemo((()=>{var e,t,n;const l=o[c];if(!l)return"统计";return`${h.find((e=>e.value===l)).text} ${null!==(n=null===(t=null===(s=a,d=r,e=d?Wn(s,d):s)||void 0===e?void 0:e[i])||void 0===t?void 0:t[c])&&void 0!==n?n:""}`;var s,d}),[a,o]);return t.createElement(M,{open:u,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},h.map((e=>{const n=e.value===o[c];return t.createElement("li",{key:e.value,className:_e("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[c]:n?void 0:e.value}),p(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement(qe,null)))})))),className:_e("count-select",{show:!!o[c]}),overlayClassName:`${l}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},t.createElement("span",null,m," ",t.createElement(He,{className:"icon"})))},_m=e=>{const{dataKey:n,dataKeyPath:r,depth:i,className:l,style:a}=e,{columns:o,expandedKeys:s,setExpandedKeys:c}=pm(),{indentDepth:d}=km(),{selectionColumn:u}=Jd,p=t.useMemo((()=>mm(o)),[o]),h=t.useMemo((()=>s.includes(r)),[s,r]),m=(e,l)=>{const{dataIndex:a,width:o,renderWidth:m,fixed:f}=e,g=(o||m)+(1===l?(d-i)*(hm.indentWidth+1):0),v={"expandable-column":a===u,"col--fix-left":"left"===f},y={width:`${g}px`,minWidth:`${g}px`,left:"left"===f?`${fm(p,a)+i*(hm.indentWidth+1)}px`:""};return t.createElement("div",{key:a,className:_e("label-cell",v),style:y},a!==u?t.createElement(t.Fragment,null,1===l&&t.createElement("span",{className:"title"},n.slice(1)),t.createElement(Dm,{column:e,keyPath:r,type:"subtotal"})):t.createElement("button",{className:_e("button-icon",{expand:h}),onClick:()=>{return e=r,void c(h?s.filter((t=>t!==e)):[...s,e]);var e}},t.createElement(Tt,null)))},f={inner:i>0};return t.createElement("div",{className:_e("group-card",f,l),style:a},t.createElement("li",{className:"label-row"},p.map(((e,t)=>m(e,t)))),t.createElement("div",{style:{display:h?"block":"none"}},e.children))},Fm=()=>{const{pivotRef:e,getRowKey:n,groupGridData:r}=pm(),{setTreeExpandKeys:i}=km();t.useLayoutEffect((()=>{const{originGridData:t,isTree:r}=e.current;r&&i(Ql(t,(e=>n(e,e.index))))}),[]);const l=(e,n="",r=0)=>{const i=oe(e)&&!Array.isArray(e);return t.createElement(t.Fragment,null,i?Object.keys(e).map((i=>{const a=n?`${n}.${i}`:i;return t.createElement(_m,{key:i,dataKey:i,dataKeyPath:a,depth:r},Array.isArray(e[i])?t.createElement(Pm,{records:e[i]}):l(e[i],a,r+1))})):t.createElement(Pm,{records:e}))};return t.createElement("div",{className:"body"},l(r))},Hm=()=>{const{columns:e,groupGridData:n}=pm(),{indentDepth:r,countMethod:i,setSummationData:l}=km(),{selectionColumn:a}=Jd,{indentWidth:o}=hm,s=t.useMemo((()=>mm(e)),[e]);Pi((()=>{l(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const i=e.map((e=>Wn(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=>Wn(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]:vm[e[n]]});return t})(i)))}),[i,n]);return t.createElement("div",{className:"footer"},t.createElement("table",{className:"table",cellSpacing:"0",cellPadding:"0"},t.createElement("colgroup",null,s.map(((e,n)=>{const{dataIndex:i,width:l,renderWidth:a}=e,c=(l||a)+(1===n||n===s.length-1?r*(o+1):0);return t.createElement("col",{key:i,style:{width:`${c}px`,minWidth:`${c}px`}})}))),t.createElement("tfoot",null,t.createElement("tr",null,s.map(((e,n)=>{const{dataIndex:i,fixed:l}=e,c={"selection-column":i===a,"col--right":!0,"col--fix-left":"left"===l},d={left:"left"===l?`${fm(s,i)+(n>1?r*(o+1):0)}px`:""};return t.createElement("td",{key:i,className:_e("table-cell",c),style:d},i!==a?t.createElement(Dm,{column:e,keyPath:"",type:"total"}):null)}))))))},Mm=()=>{const{prefixCls:e,pivotRef:n,getRowKey:r,size:i}=pm(),l=t.useRef(null);return t.useMemo((()=>{const{originGridData:e,keyRecordMap:t}=n.current;Xl(e).forEach((e=>t.set(r(e,e.index),e)))}),[]),t.createElement(Om,{scrollbar:l},t.createElement(cl,{ref:l,className:_e(`${e}__layout`,i)},t.createElement(Am,null),t.createElement(Fm,null),t.createElement(Hm,null)))},$m=e=>{const{tableColumns:n=[],tableDataSource:r=[]}=e,{getRowKey:i}=t.useContext(Fd),l=(e,t="",n=0)=>e.map((e=>{const r=i(e,e.index);return e._level=n,Array.isArray(e.children)&&(e.children=l(e.children,r,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),a=t.useMemo((()=>(e=>e.filter((e=>![Jd.expandableColumn,Jd.selectionColumn,"index","pageIndex",Jd.operationColumn].includes(e.dataIndex))))(n).map((e=>Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0})))),[]),o=t.useMemo((()=>l(r)),[]),s=tr("pivot-grid");return t.createElement("div",{className:`${s}__main`},t.createElement(um,{prefixCls:s,flatColumns:a,tableData:o},t.createElement(Tm,null),t.createElement("div",{className:"wrapper"},t.createElement(Mm,null))))};$m.displayName="PivotGrid";const jm=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)}));jm.displayName="ListItem";const qm=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=up({count:l.length,getScrollElement:()=>p.current.container.children[0],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=tr("virtual-list");return t.createElement(cl,{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(jm,{ref:h.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(l[e.index],e.index)))))))}));qm.displayName="VirtualList";const Km="1.11.7";export{Cn as Calendar,wn as DatePicker,bl as DcpAnchor,Zn as DcpButton,Li as DcpCollapse,On as DcpConfigProvider,kp as DcpCopyToClipboard,Yi as DcpCountup,Sd as DcpCropper,nr as DcpDivider,fl as DcpDownload,Cl as DcpDrawer,Xi as DcpEmpty,ad as DcpForm,Bh as DcpGuideTracker,em as DcpLazyLoad,Nl as DcpModal,$m as DcpPivotGrid,Th as DcpPrint,Xp as DcpRangeTableHelper,cl as DcpScrollbar,Kp as DcpSearchHelper,_d as DcpSearchTree,cm as DcpSignature,er as DcpSpace,Qi as DcpSpin,Gi as DcpSplit,qp as DcpTable,El as DcpTabs,wd as DcpTinymce,dh as DcpTour,gh as DcpTransition,Up as DcpTreeHelper,Bp as DcpTreeTableHelper,ml as DcpUploadFile,Td as DcpUploadImg,qm as DcpVirtualList,Uh as DcpWatermark,bl as QmAnchor,Zn as QmButton,Li as QmCollapse,On as QmConfigProvider,kp as QmCopyToClipboard,Yi as QmCountup,Sd as QmCropper,nr as QmDivider,fl as QmDownload,Cl as QmDrawer,Xi as QmEmpty,ad as QmForm,Bh as QmGuideTracker,em as QmLazyLoad,Nl as QmModal,$m as QmPivotGrid,Th as QmPrint,Xp as QmRangeTableHelper,cl as QmScrollbar,Kp as QmSearchHelper,_d as QmSearchTree,cm as QmSignature,er as QmSpace,Qi as QmSpin,Gi as QmSplit,qp as QmTable,El as QmTabs,wd as QmTinymce,dh as QmTour,gh as QmTransition,Up as QmTreeHelper,Bp as QmTreeTableHelper,ml as QmUploadFile,Td as QmUploadImg,qm as QmVirtualList,Uh as QmWatermark,Nn as TimePicker,io as pinyin,Km as version};
|