dcp-design-react 1.11.4 → 1.11.5

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 CHANGED
@@ -1 +1 @@
1
- import*as e from"react";import t,{createContext as n,version as r,isValidElement as i,useRef as a,useLayoutEffect as l,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 ae from"antd/es/locale/en_GB";import{isArray as le,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 at,ImportOutlined as lt,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,CreditCardOutlined 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 an=(...e)=>{const[t,n]=e;let r;const i=t.split(".");let a=nn;for(let e=0,t=i.length;e<t;e++){if(r=a[i[e]],e===t-1)return rn(r,n);if(!r)return"";a=r}return""},ln=(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 a=n[i],l=t;if(a.includes("wo")||a.includes("Wo")){for(var o=l.split("-")[0],s=l.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(l,a).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:ae},[tn.name]:{qm:tn,antd:ie}},In=e=>{const n=ln({locale:"zh-cn",size:"middle"},e),{locale:r,size:i,global:a}=n;t.useMemo((()=>{return e=Object.assign({},Tn,null==a?void 0:a.langPackage)[r].qm,nn=e||nn,void(nn.name&&h.locale(nn.name));var e}),[r]);const l=t.useMemo((()=>Object.assign({},Tn,null==a?void 0:a.langPackage)),[a]),[o,s]=t.useState({locale:r,size:i,global:a});return sn((()=>{s((e=>Object.assign({},e,{locale:r,size:i})))}),[i,r]),t.createElement(en.Provider,{value:o},t.createElement(x,{locale:l[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==a?void 0:a.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,a=arguments.length,l=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(l=(a<3?i(l):a>3?i(t,n,l):i(t,n))||l);return a>3&&l&&Object.defineProperty(t,n,l),l}function kn(e,t,n,r){return new(n||(n=Promise))((function(i,a){function l(e){try{s(r.next(e))}catch(e){a(e)}}function o(e){try{s(r.throw(e))}catch(e){a(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(l,o)}s((r=r.apply(e,t||[])).next())}))}function Ln(){const{locale:t}=e.useContext(en);return{t:an,$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||le(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)||le(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const i=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(i||e,((n,a)=>{i&&(a=n),r[a]=Wn(e[a],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:a,confirm:l}=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"),a=n.includes("ctrl"),l=n.includes("shift"),o=n[n.length-1];i&&!e.altKey||a&&!e.ctrlKey||l&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),h.disabled||null===(t=h.onClick)||void 0===t||t.call(h,e))})),p=ce(a)?{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 l?t.createElement(w,{title:l.title||o("qm.button.confirmTitle"),disabled:h.disabled,onConfirm:e=>{var t,n;null===(t=l.onConfirm)||void 0===t||t.call(l),null===(n=h.onClick)||void 0===n||n.call(h,e)},onCancel:e=>{var t;null===(t=l.onCancel)||void 0===t||t.call(l,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:a=!0,disabled:l,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=Pn(e),{t:p}=Ln(),h=Jn("divider"),m={[h]:!0,[`${h}-borderless`]:!a,[`${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:l,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 ar(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 lr(e,t,n){return(t=ar(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){lr(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,a,l,o=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.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&&(l=n.return(),Object(l)!==l))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"),a=Symbol.for("react.profiler"),l=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 a: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 l:return g;default:return m}}case n:return m}}}e=Symbol.for("react.module.reference");var g=o,v=l,y=t,b=c,x=r,E=h,C=p,w=n,S=a,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)===l},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)===a},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===a||t===i||t===d||t===u||t===m||"object"==typeof t&&null!==t&&(t.$$typeof===h||t.$$typeof===p||t.$$typeof===l||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={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[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,ar(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],a=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[i,function(e,t){t&&n.current||a(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 a=n[i];if(Object.prototype.hasOwnProperty.call(t,a)&&a in Ur)return Yr[e]=t[a],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=a(),r=a(t);r.current=t;var i=e.useCallback((function(e){r.current(e)}),[]);function l(e){e&&(e.removeEventListener(ti,i),e.removeEventListener(ei,i))}return e.useEffect((function(){return function(){l(n.current)}}),[]),[function(e){n.current&&n.current!==e&&l(n.current),e&&e!==n.current&&(e.addEventListener(ti,i),e.addEventListener(ei,i),n.current=e)},l]},ii=qr()?l:o,ai=function(e){return+setTimeout(e,16)},li=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(ai=function(e){return window.requestAnimationFrame(e)},li=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=ai((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),li(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),a=i[0],l=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 a=di((function(){i<=1?r({isCanceled:function(){return a!==t.current}}):e(r,i-1)}));t.current=a},n]}(),s=dr(o,2),c=s[0],d=s[1];var u=n?pi:ui;return ii((function(){if(a!==_r&&a!==$r){var e=u.indexOf(a),t=u[e+1],n=r(a);n===hi?l(t,!0):t&&c((function(e){function r(){e.isCanceled()||l(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,a]),e.useEffect((function(){return function(){d()}}),[]),[function(){l(Fr,!0)},a]};var vi=function(t){var n=t;"object"===ir(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var i=t.visible,l=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=a(),v=a();var y=function(t,n,r,i){var l=i.motionEnter,s=void 0===l||l,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=a(!1),M=a(null);function $(){return r()}var j=a(!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 lr(t={},Fr,f),lr(t,Hr,y),lr(t,Mr,E),t;case Pr:return lr(n={},Fr,g),lr(n,Hr,b),lr(n,Mr,C),n;case Dr:return lr(r={},Fr,v),lr(r,Hr,x),lr(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,l,(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:l});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={},lr(R,k,k&&O),lr(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),a=0;a<t;a++)n[a]=arguments[a];return lr(Ir(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),lr(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,a=i.component,l=i.children,o=i.onVisibleChanged,s=i.onAllRemoved,c=br(i,Ni),d=a||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,a=br(r,Ti),c=i===bi||i===xi;return e.createElement(n,yi({},u,{key:a.key,visible:c,eventProps:a,onVisibleChanged:function(e){(null==o||o(e,{key:a.key}),e)||0===t.removeKey(a.key)&&s&&s()}}),l)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,i=Si(n),a=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,a=Si(e),l=Si(t);a.forEach((function(e){for(var t=!1,a=r;a<i;a+=1){var o=l[a];if(o.key===e.key){r<a&&(n=n.concat(l.slice(r,a).map((function(e){return sr(sr({},e),{},{status:bi})}))),r=a),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(l.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:a.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}();lr(r,"defaultProps",{component:"div"})}(Jr);const Ri=t.forwardRef(((e,n)=>{const{forceRender:r,className:i,style:a,boxStyle:l,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:a},t.createElement("div",{className:`${d}-content-box`,style:l},e.children))}));Ri.displayName="PanelContent";const Oi=e=>{const{defaultActive:n,label:r,extra:i,className:a,style:l,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},a);return t.createElement("div",{className:g,style:l},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:a,direction:l}=t.useContext(ki),{t:o}=Ln(),s=t.useRef(Dn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===l),[l]),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 a=u.current[`firstElementSize${d}`]+t;a=Math.max(r[0],a),a=Math.min(r[1],a),i(a)},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"===l,horizontal:"horizontal"===l};return t.createElement("div",{className:_e(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,n=t.children[0];p({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),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:a}=e,{direction:l,dragging:o}=t.useContext(ki),s="vertical"===l?"height":"width",c={[Jn("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===l,vertical:"vertical"===l,[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),a)},e.children)}));Wi.displayName="SplitPane";const Bi=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:a,style:l,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,a),style:l},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),a=Jn("countup"),l={[a]:!0,[`${a}--lg`]:"large"===i,[`${a}--sm`]:"small"===i};return t.createElement(Pt,Cn({},e,{className:_e(l,n),style:r}),e.children)};Ui.displayName="QmCountup";const Gi=e=>{const{className:n}=e,{$size:r}=Pn(e),i=Jn("empty"),a=Object.assign(Object.assign({},e),{image:N.PRESENTED_IMAGE_SIMPLE}),l={[i]:!0,[`${i}--lg`]:"large"===r,[`${i}--sm`]:"small"===r};return t.createElement(N,Cn({},a,{className:_e(l,n)}))};Gi.displayName="QmEmpty";const Yi=e=>{const n=ln({tip:"Loading..."},e),{fullHeight:r,className:i,style:a}=n,l=Jn("spin"),o={[l]:!0,[`${l}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:_e(o,i)},zn(n,["fullHeight"])),{style:Object.assign(Object.assign({},a),{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 ea(e,t){Qi.has(e)&&(Qi.get(e).delete(t),Qi.get(e).size||(Zi.unobserve(e),Qi.delete(e)))}function ta(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&&ea(e,n)}}),[t]),n}function na(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 ra=6,ia={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"}},aa=e=>{const{thumb:n,always:r,className:i,barSize:a=ra,direction:l="vertical",onDrag:o=Hn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(Xi),u=ia[l],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"===l,"is-horizontal":"horizontal"===l},R={[u.reverse]:a},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])})}})))},la=20,oa=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,innerStyle:a,barWidth:l,always:o,native:s,showTopScrollbar:c,minSize:d=la,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=ta(p),C=ta(m);sn((()=>{!s&&w()}),[C.width,C.height,E.width,E.height]);const w=na((()=>{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),a=Math.max(r,d),l=n/(e-n)/(i/(e-i)),o=r/(t-r)/(a/(t-a)),s=i+4<e?i:0,c=a+4<t?a:0,u=100*h.current.scrollTop/e*l,p=100*h.current.scrollLeft/t*o;g(Object.assign({},f,{size:c,ratio:o,offset:p})),y(Object.assign({},v,{size:s,ratio:l,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,a=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollTop=r+(t-r)*Vi(l),i(a)):e.scrollTop=t};i(a)})(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,a=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollLeft=r+(t-r)*Vi(l),i(a)):e.scrollLeft=t};i(a)})(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:a},e.children)),!s&&t.createElement(Xi.Provider,{value:I},c&&t.createElement(aa,{className:"top",direction:"horizontal",thumb:f,barSize:l,always:o,onDrag:S}),t.createElement(aa,{direction:"horizontal",thumb:f,barSize:l,always:o,onDrag:S}),t.createElement(aa,{direction:"vertical",thumb:v,barSize:l,always:o,onDrag:S})))}));oa.displayName="QmScrollbar";const sa=(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}},ca=(e,{fileName:t,headers:n,params:r})=>kn(void 0,void 0,void 0,(function*(){const i=r?new URLSearchParams(r).toString():"",a=i?e.includes("?")?"&":"?":"",l=yield fetch(e+`${a+i}`,{method:"GET",headers:n});if(!l.ok)throw new Error(an("qm.download.error"));const o=yield l.blob(),s=l.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));sa(o,c)})),da=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},ua=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},pa=e=>{var n,r;const i=ln({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:a=[],fileDirection:l="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=[...a],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:a[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 ca(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"===l};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:a=[],fileSize:l,maxCount:o,fileList:s=[],beforeUpload:c}=i,d=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!l||e.size/1024/1024<l,p=!(o>1)||s.length<o,h=d&&u&&p;if(d||R.warning(b("qm.upload.tooltip",{type:a.join(",")})),u||R.warning(b("qm.upload.sizeLimit",{size:l})),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,l)=>((e,n)=>{const{iconRender:r}=i,{uid:l,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[l]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:da(o),onBlur:t=>{const{value:n}=t.target;if(n!==da(o)){const t=Object.assign({},e,{name:`${n}.${ua(o)}`}),r=a.map((e=>e.uid!==l?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}k(l,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?T||k(l,!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(l)},S[l]?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,l)}),t.createElement("span",{className:"inner",ref:C},i.children||u&&a.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&&!!a.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(a);else for(const e of a)yield P(e)}))},b("qm.upload.batchDownload"))))};pa.displayName="QmUploadFile";const ha=e=>{const n=ln({icon:t.createElement(Ve,null),withCredentials:!1},e),{$size:r}=Pn(n),{t:i}=Ln(),[a,l]=t.useState(!1),o=zn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,Cn({},o,{size:r,loading:a,onClick:()=>kn(void 0,void 0,void 0,(function*(){var e;l(!0);try{const{action:e,fileName:t,headers:r,params:a,beforeDownload:l=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(!l(s))return;yield ca(s,{fileName:t,headers:r,params:a}),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"))}l(!1)}))}),n.children||i("qm.download.text"))};function ma(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])}ha.displayName="QmDownload";const fa=e=>{const{activeKey:n,labels:r,onTabClick:i}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const a={item:!0,actived:r===n};return t.createElement("div",{key:r,className:_e(a),onClick:e=>i(r,e)},t.createElement("span",null,e))})))},ga=e=>{const{label:n,showDivider:r,className:i,style:a}=e,l={[Jn("anchor-item")]:!0};return t.createElement("div",{className:_e(l,i),style:a},r&&t.createElement(er,{label:n,style:{marginBottom:10}}),e.children)};ga.displayName="AnchorItem";const va=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:i,labelWidth:a,tabPosition:l="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 a=-1;for(let e=0;e<n.length;e++){const r=n[e],i=n[e+1]||1e4;t>=r-1&&t<i&&(a=e)}return a},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=ma((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"===l,[`${w}-top`]:"top"===l,[`${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:a?Bn(a):""}},t.createElement(fa,{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))}));va.displayName="QmAnchor",va.Item=ga;const ya=e=>t.createElement(k.TabPane,e,e.children);ya.displayName="TabPane";const ba=e=>{const n=ln({tabPosition:"top"},e),{items:r,tabPosition:i,tabBarGutter:a,className:l,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!=a?a:["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:a}=r||{};i?a&&(n.disabled=!0):(h.splice(t,1),t--)}}return t.createElement(k,Cn({},u,{items:h,className:_e(d,l)}))};ba.displayName="QmTabs",ba.TabPane=ya;const xa=t.forwardRef(((e,n)=>{var r;const i=ln({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:a,open:l,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!=l?l:a)&&(!p&&x.current||ue(s)&&S(!0))}),[null!=l?l:a]),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!=l?l:a,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")}))}));xa.displayName="QmDrawer";const Ea="10vh";var Ca;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Ca||(Ca={}));const wa=t.forwardRef(((e,n)=>{var r;const i=ln({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Ea}},e),{visible:a,open:l,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 - ${Ea} - ${Ea} - ${Ca[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!=l?l:a){if(!f&&w.current||ue(d)&&R(!0),!f&&w.current)return;setTimeout((()=>{w.current=!0,ue(d)&&R(!1)}),400)}}),[null!=l?l:a]),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:Ea}),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 - ${Ca[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!=l?l:a,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")}))}));wa.displayName="QmModal";const Sa=n(void 0),Na=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var Ta={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)Na.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 Ia=["==","<",">","<=",">=","!=","like","likes","in","nin"];var Ra=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},Oa=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++)Ia.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),Ia.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const ka=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,La=["string","number","boolean","symbol"],Aa=e=>La.includes(typeof e),Pa=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Da=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(ka,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Da(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Da(t))));break;case"in":Aa(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Aa(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(Pa(e)?e.slice(0,10):e)!=n;break;case"<":r=(Pa(e)?e.slice(0,10):e)<n;break;case"<=":r=(Pa(e)?e.slice(0,10):e)<=n;break;case">":r=(Pa(e)?e.slice(0,10):e)>n;break;case">=":r=(Pa(e)?e.slice(0,10):e)>=n;break;default:r=(Pa(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const _a=Ta.stringify,Fa=Ta.array_format,Ha=Ra,Ma=(e,t,n)=>{let r=[];t=Ta.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Oa(t,"record")};`);r=yl(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Oa(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},$a=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...$a(e.children)):t.push(e)})),t},ja=e=>e.filter((e=>(e.children&&(e.children=ja(e.children)),!e.hidden&&!e.noAuth))),qa=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...qa(e.children))})),t},Ka=(e,t)=>e.map((e=>(e.children&&(e.children=Ka(e.children,t)),null==t||t(e),e))),Va=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Va(n.children,t);if(e)return e}}return null},za=e=>{const t=e.children;return t?t[0].children?za(t[0]):t[0]:e},Wa=e=>{const t=e.children;return t?t[t.length-1].children?Wa(t[t.length-1]):t[t.length-1]:e},Ba=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Ua=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Ua(n.children,t);if(e)return e}}return null},Ga=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Ga(e.children))})),t},Ya=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 qa(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Xa=e=>Object.assign(e,{__prevent__:!0}),Qa=e=>{delete e.__prevent__},Za=(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 Za(e.offsetParent,t,n)}return n},Ja=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,el=(e,t)=>he(e,((e,n,r)=>{me(n,t[r])||(e[r]=oe(n)&&oe(t[r])?el(n,t[r]):n)})),tl=(e,t)=>{var n;return null!==(n=pe(e,t))&&void 0!==n?n:""},nl=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),fe(e,t,null!=n?n:"")},rl=(e,t)=>{if(!t.includes("|"))return tl(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(tl(e,t))})),n.every((e=>!e))?"":n.join(" | ")},il=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),al=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]}`:""}`},ll=(e,t)=>{const n=e.toString();if(!il(n)||0===t)return e;const r=Number.parseFloat(n).toString(),i=r.indexOf(".");if(-1===i)return r+"."+"0".repeat(t);const a=Math.max(0,t-(r.length-i-1));return r+"0".repeat(a)},ol=(e,t)=>e?h(e,t):null,sl=(e,t)=>e?h(e).format(t):"",cl=(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)}))},dl=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...dl(e))}))}else n.push(e);return n},ul=e=>dl(e).join(""),pl=e=>e.filter((e=>!e._group)),hl=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let i=0,a=e.length;i<a;i++){const a=e[i];if(!a.fieldName)continue;const l=Array.isArray(a.condition)?Fa(a.condition):_a(a.condition,"^");n+=`${a.bracketLeft} ${t?`${a.fieldName}|${a.fieldType}`:a.fieldName} ${a.expression} ${l} ${a.bracketRight} ${a.logic} `,r=a.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[i,a]=r.includes("|")?r.split("|"):[r,""],l=e[r];for(const e in l){n+=`${t?`${i}|${a}`:i} ${e} ${Array.isArray(l[e])?Fa(l[e]):_a(l[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},ml=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(tl(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},fl=(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=fl(e[n].children,t);if(r)return[e[n],r].flat()}}},gl=(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=gl(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},vl=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=vl(n.children,t);if(e)return e}if(t(n))return n}return null},yl=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&yl(e.children,t),t(e)||e.children&&e.children.length))),bl=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),xl=e=>["","small","middle","large"].includes(e),El=80,Cl="1",wl="0",Sl=400,Nl=["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"],Tl={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 Il,Rl,Ol;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Il||(Il={})),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"}(Rl||(Rl={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Ol||(Ol={}));const kl={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(!xl(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},Ll={layout:"horizontal",labelWidth:El,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},Al=(e,t)=>{if(!e)return null;if(t===Rl.week){const t=e.match(/^(\d{4})-(\d+)/);return t?h().year(Number(t[1])).week(Number(t[2])):null}if(t===Rl.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)},Pl=(e,t)=>e?h(e).format(t):"",Dl=e=>""===e||null==e,_l=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let i="";for(let t=0,a=r.length;t<a;t++){i+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===a-1?"":" | ")}return i},Fl=(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("|"),a=n[r].split("|");i.forEach(((t,n)=>e[t]=e[a[n]]))}else e[t[r]]=e[n[r]]},Hl=(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("|"),a=n[r].split("|");i.forEach(((t,n)=>e[t]=e[a[n]]))}else e[t[r]]=e[n[r]]},Ml=(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=Ml(e.children,t,n)),r})),$l=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=$l(n.children,t);if(e)return e}}return null},jl=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...jl(e.children,t,n+1))})),r},ql=e=>_n(e)||"string"==typeof e,Kl=e=>_n(e)?dl(e).join(""):null!=e?e:"",Vl=(e,t,n,r)=>{var i;const a={};return a.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})))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:n(e.echoSetting.api),formatter:t=>{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&&(a.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:n(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const n={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>n[e.tableField]=e.treeField)),n}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a};var zl={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 Wl="阿",Bl="鿿",Ul=1,Gl=2,Yl=3;let Xl,Ql=null;function Zl(e){return e||null===Ql?("object"==typeof Intl&&Intl.Collator?(Xl=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Ql=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Ql=!1,Ql):Ql}function Jl(e){const t=zl.UNIHANS,n=zl.PINYINS,r=zl.EXCEPTIONS,i={source:e};if(e in r)return i.type=Gl,i.target=r[e],i;let a,l=-1;if(e.charCodeAt(0)<256)return i.type=Ul,i.target=e,i;if(a=Xl.compare(e,Wl),a<0)return i.type=Yl,i.target=e,i;if(0===a)i.type=Gl,l=0;else{if(a=Xl.compare(e,Bl),a>0)return i.type=Yl,i.target=e,i;0===a&&(i.type=Gl,l=t.length-1)}if(i.type=Gl,l<0){let n=0,r=t.length-1;for(;n<=r;){l=~~((n+r)/2);const i=t[l];if(a=Xl.compare(e,i),0===a)break;a>0?n=l+1:r=l-1}}return a<0&&l--,i.target=n[l],i.target||(i.type=Yl,i.target=i.source),i}function eo(e){return"string"==typeof e&&Zl()?e.split("").map((e=>Jl(e))):e}var to={isSupported:Zl,parse:eo,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(zl)})))},genToken:Jl,convertToPinyin:(e,t,n)=>eo(e).map((e=>t&&e.type===Gl?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,ao=e=>{const{$$form:n}=t.useContext(Sa),{value:r,items:i,multiple:a,loading:l,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=Sl,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=>a?(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:a?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:h,style:p,loading:l,bordered:m,allowClear:f,disabled:v,showSearch:x,listHeight:E,maxTagCount:C?"responsive":void 0,maxTagTextLength:w},a?{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 lo 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:a="value",textKey:l="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[a],text:e[l]})));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:a,tooltip:l,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(a),className:_e(u),tooltip:l,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(a)}},t.createElement(ao,{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||El)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}lo.contextType=Sa;const oo=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=wl,trueValue:h=Cl}=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),a(e,f(e))})(t?h:p)}},u?l:null)};class so extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}so.contextType=Sa;const co=e=>{const{uniqueKey:n,items:r,fieldsChange:i}=e,{global:a}=t.useContext(en),{$$form:l}=t.useContext(Sa),{$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==a?void 0:a.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==a?void 0:a.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==a?void 0:a.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)})(l.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;l.setExpandHandle(!0);const i=bl(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"},l.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(Sa),{value:i,onChange:a,onValuesChange:l}=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==a||a(e),l(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:a,invisible:l,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:l,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(r)}},t.createElement(uo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,t)}}))),u&&t.createElement(_,null,e.renderFormItemButton(a,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}po.contextType=Sa;const ho=e=>{const{$$form:n}=t.useContext(Sa),{value:r=[],onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{options:o={},placeholder:s=l("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),a(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:a,invisible:l,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:l,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:a,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(a,n)}}))),c&&t.createElement(_,{flex:Bn(c.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},c)))))}}mo.contextType=Sa;const fo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Sa),{value:i,onChange:a,onValuesChange:l}=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=Dl(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==a||a(e),l(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:a,invisible:l,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:l,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(r)}},t.createElement(fo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(a,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}go.contextType=Sa;const vo=e=>{const{$$form:n}=t.useContext(Sa),{value:r=[],onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{options:o={},placeholder:s=l("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),a(t,w(t))},w=e=>Dl(e)?"":e.map((e=>Dl(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:a,invisible:l,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:l,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:a,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(a,n)}}))),c&&t.createElement(_,{flex:Bn(c.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},c)))))}}var bo;yo.contextType=Sa,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:a,triggeredChange:l,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&&Fl(e,this.alias,c),d&&Hl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=_l(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==a||a([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)||[],a={[t]:r};return(Array.isArray(i)?i:[i]).forEach((e=>{if(oe(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](r):r;else a[e]=r})),a},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Mn,formatter:i=(e=>e)}=t.fetch;return new Promise(((a,l)=>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 l();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:[];a(n)}else l()}catch(e){l(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=_l(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=_l(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=_l(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]:_l(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:_l(e,this.extras[n])});const r=_l(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:a}=this.props,{type:l,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=an("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:an("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:a,bordered:p}):t.createElement(t.Fragment,null,t.createElement(xo,{ref:e=>this[`${l}_Ref`]=e,value:a,title:a,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:a}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?i?(null===(t=null==a?void 0:a.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(wa,b,t.createElement($p,x)))}}Eo.contextType=Sa;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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Co.contextType=Sa;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,a=null==t?void 0:t.target,l=!i||!a,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(i))||(null===(r=this.$el)||void 0===r?void 0:r.contains(a)),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(a);let u;u=!(l||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,l=a(),s=a();d(t,(function(){return{}}));var c=a(!1);return!c.current&&qr()&&(s.current=r(),l.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==l.current&&l.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,a=t.mask,l=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!a)return null;var c={};return(l||s||o)&&(c=sr({motionAppear:!0},Oo({motion:l,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,a=i.body,l=i&&i.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=l.clientLeft||a.clientLeft||0,top:r-=l.clientTop||a.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 as(e,t,n){"static"===Wo(e,"position")&&(e.style.position="relative");var r=-999,i=-999,a=rs("left",n),l=rs("top",n),o=is(a),s=is(l);"left"!==a&&(r=999),"top"!==l&&(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[a]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[l]="".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 ls(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,a=r.match(Ko);a?((i=(a=a[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="",a=Qo(e);return(r=r||a.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],a=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]=a}return""===n?"auto":n});var cs=["margin","border","padding"],ds=-1,us=2,ps=1;function hs(e,t,n){var r,i,a,l=0;for(i=0;i<t.length;i++)if(r=t[i])for(a=0;a<n.length;a++){var o=void 0;o="border"===r?"".concat(r).concat(n[a],"Width"):r+n[a],l+=parseFloat(qo(e,o))||0}return l}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"],a="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),l=ss(e),o=0;(null==a||a<=0)&&(a=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=l?ps:ds);var s=void 0!==a||l,c=a||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,a=r.documentElement[n];return"CSS1Compat"===r.compatMode&&a||i&&i[n]||a}}));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={},a=e.style;for(r in t)t.hasOwnProperty(r)&&(i[r]=a[r],a[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(a[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),a=r.top.toFixed(0),l=t.left.toFixed(0),o=t.top.toFixed(0);if(i===l&&a===o)return}n.useCssRight||n.useCssBottom?as(e,t,n):n.useCssTransform&&Mo()in document.body.style?ls(e,t):as(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),a=i.defaultView||i.parentWindow,l=i.body,o=i.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===l||r===o||"visible"===bs.css(r,"overflow")){if(r===l||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(a),u=bs.getWindowScrollTop(a),p=bs.viewportWidth(a),h=bs.viewportHeight(a),m=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(l);if("hidden"===g.overflowX&&(m=a.innerWidth),"hidden"===g.overflowY&&(f=a.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,a=e.height,l=e.left,o=e.top;return"c"===n?o+=a/2:"b"===n&&(o+=a),"c"===r?l+=i/2:"r"===r&&(l+=i),{left:l,top:o}}function Ts(e,t,n,r,i){var a=Ns(t,n[1]),l=Ns(e,n[0]),o=[l.left-a.left,l.top-a.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,a=n.offset||[0,0],l=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;a=[].concat(a),l=[].concat(l);var c={},d=0,u=ws(s,!(!(o=o||{})||!o.alwaysByViewport)),p=Ss(s);As(a,p),As(l,t);var h=Ts(p,t,i,a,l),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(a,0),v=ks(l,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,a=g,l=v)}if(o.adjustY&&Rs(h,p,u)){var y=Os(i,/[tb]/gi,{t:"b",b:"t"}),b=ks(a,1),x=ks(l,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,a=b,l=x)}d&&(h=Ts(p,t,i,a,l),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,a=n.offset||[0,0],l=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),a={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+a.width>n.right&&(a.width-=i.left+a.width-n.right),r.adjustX&&i.left+a.width>n.right&&(i.left=Math.max(n.right-a.width,n.left)),r.adjustY&&i.top<n.top&&(i.top=n.top),r.resizeHeight&&i.top>=n.top&&i.top+a.height>n.bottom&&(a.height-=i.top+a.height-n.bottom),r.adjustY&&i.top+a.height>n.bottom&&(i.top=Math.max(n.bottom-a.height,n.top)),bs.mix(i,a)}(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:a,targetOffset:l,overflow:c}}function Ds(e,t,n){var r=n.target||t,i=Ss(r),a=!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,a)}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 a=i.getBoundingClientRect(),l=a.width,o=a.height,s=Math.floor(l),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,a=e.target,l=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=a,m.current.align=l,m.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),i=t.useRef(null);function a(){window.clearTimeout(i.current)}return[function t(l){if(a(),r.current&&!0!==l)i.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(l))return;r.current=!0,i.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,a()}]}((function(){var e=m.current,t=e.disabled,n=e.target,r=e.align,i=e.onAlign,a=p.current;if(!t&&n&&a){var l,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(),a=i.width,l=i.height;if(a||l)return!0}}return!1}(o)?l=Ds(a,o,r):s&&(l=function(e,t,n){var r,i,a=bs.getDocument(e),l=a.defaultView||a.parentWindow,o=bs.getWindowScrollLeft(l),s=bs.getWindowScrollTop(l),c=bs.viewportWidth(l),d=bs.viewportHeight(l),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)}(a,s,r)),function(e,t){e!==document.activeElement&&So(t,e)&&"function"==typeof e.focus&&e.focus()}(c,a),i&&l&&i(a,l),!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(a)),S($s(a))})),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 a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,l=r.has(t);if(mn(!l,"Warning: There may be circular references"),l)return!1;if(t===i)return!0;if(n&&a>1)return!1;r.add(t);var o=a+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,l)||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:{},a=i.iterator||"@@iterator",l=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 a=t&&t.prototype instanceof p?t:p,l=Object.create(a.prototype),o=new N(i||[]);return r(l,"_invoke",{value:E(e,n,o)}),l}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,a,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,a)&&(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,a,l,o){var s=d(e[r],e,a);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,l,o)}),(function(e){i("throw",e,l,o)})):t.resolve(u).then((function(e){c.value=e,l(c)}),(function(e){return i("throw",e,l,o)}))}o(s.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return I()}for(n.method=i,n.arg=a;;){var l=n.delegate;if(l){var o=C(l,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 a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(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[a];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,l,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var l=new x(c(t,n,r,i),a);return e.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},b(y),s(y,o,"Generator"),s(y,a,(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 l.type="throw",l.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 a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(o&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(l)},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,a,l){try{var o=e[a](l),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 a=e.apply(t,n);function l(e){Vs(a,r,i,l,o,"next",e)}function o(e){Vs(a,r,i,l,o,"throw",e)}l(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,l=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=a(),T=a(),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(),a=r.width,l=r.height;Math.abs(t-a)<1&&Math.abs(n-l)<1&&(t=a,n=l),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],l=a();function s(e){i(e,!0)}function c(){di.cancel(l.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(l.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(),l.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=a();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,a=t.style,o=_e(i,l,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({},a),B)},G))}))}));Bs.displayName="PopupInner";var Us=e.forwardRef((function(t,n){var r=t.prefixCls,i=t.visible,a=t.zIndex,l=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:a},c),g=l;return e.Children.count(l)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},l)),p&&(g=p(g)),e.createElement(vi,yi({visible:i,ref:m,removeOnLeave:!0},u),(function(t,n){var i=t.className,a=t.style,l=_e(r,s,i);return e.createElement("div",{ref:n,className:l,onClick:h,style:sr(sr({},a),f)},g)}))}));Us.displayName="MobilePopupInner";var Gs=["visible","mobile"],Ys=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,a=br(t,Gs),l=dr(u(r),2),s=l[0],c=l[1],d=dr(u(!1),2),p=d[0],h=d[1],m=sr(sr({},a),{},{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,a;return Er(this,i),lr(Ir(n=r.call(this,t)),"popupRef",e.createRef()),lr(Ir(n),"triggerRef",e.createRef()),lr(Ir(n),"portalContainer",void 0),lr(Ir(n),"attachId",void 0),lr(Ir(n),"clickOutsideHandler",void 0),lr(Ir(n),"touchOutsideHandler",void 0),lr(Ir(n),"contextMenuOutsideHandler1",void 0),lr(Ir(n),"contextMenuOutsideHandler2",void 0),lr(Ir(n),"mouseDownTimeout",void 0),lr(Ir(n),"focusTime",void 0),lr(Ir(n),"preClickTime",void 0),lr(Ir(n),"preTouchTime",void 0),lr(Ir(n),"delayTimer",void 0),lr(Ir(n),"hasPopupMouseDown",void 0),lr(Ir(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),lr(Ir(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),lr(Ir(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),lr(Ir(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),lr(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)})),lr(Ir(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),lr(Ir(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),lr(Ir(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),lr(Ir(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),lr(Ir(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),lr(Ir(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),lr(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)})),lr(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)})),lr(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()}})),lr(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))})),lr(Ir(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,i=r.popupPlacement,a=r.builtinPlacements,l=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return i&&a&&t.push(function(e,t,n,r){for(var i=n.points,a=Object.keys(e),l=0;l<a.length;l+=1){var o=a[l];if(Io(e[o].points,i,r))return"".concat(t,"-placement-").concat(o)}return""}(a,l,e,o)),s&&t.push(s(e)),t.join(" ")})),lr(Ir(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,i=t.destroyPopupOnHide,a=t.popupClassName,l=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:a,align:N,onAlign:l,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)})),lr(Ir(n),"attachParent",(function(e){di.cancel(n.attachId);var t,r=n.props,i=r.getPopupContainer,a=r.getDocument,l=n.getRootDomNode();i?(l||0===i.length)&&(t=i(l)):t=a(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=di((function(){n.attachParent(e)}))})),lr(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})),lr(Ir(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),lr(Ir(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),lr(Ir(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),a="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:a,popupVisible:a},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 a=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,a),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,a=r.forceRender,l=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,l&&(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||a)&&(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 lr(n,"contextType",Xs),lr(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:a={},formatter:l=(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(l(Object.assign(Object.assign({},a),{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 a=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(a),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:a,visible2:l,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=an("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:a,title:an("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"},an("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&&l,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Tl,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(wa,C,t.createElement($p,w)))}};nc.contextType=Sa,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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}rc.contextType=Sa;const{Search:ic}=O;class ac 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:a,triggeredChange:l,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&&Fl(e,this.alias,c),d&&Hl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=_l(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==a||a([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=_l(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]:_l(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]:_l(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:_l(e,this.extras[n])});const r=_l(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:a=""}=this.props,{type:l,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=an("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:an("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:a,bordered:p}):t.createElement(t.Fragment,null,t.createElement(ic,{ref:e=>this[`${l}_Ref`]=e,value:a,title:a,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(wa,b,t.createElement(Vp,x)))}}ac.contextType=Sa;class lc 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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(ac,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(l,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}lc.contextType=Sa;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:a={},formatter:l=(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(l(Object.assign(Object.assign({},a),{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 a=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(a),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:a,visible2:l,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=an("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:a,title:an("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"},an("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&&l,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Tl,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(wa,C,t.createElement(Vp,w)))}};oc.contextType=Sa,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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}sc.contextType=Sa;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(((a,l)=>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 l();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 a(n)}}catch(e){this.setState({loading:!1})}l()}))))},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 a,l;return null!==(l=null===(a=r[i].find((e=>e.value===n[t])))||void 0===a?void 0:a.text)&&void 0!==l?l:""}));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:a=(e=>e),dataKey:l,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(a(Object.assign(Object.assign({},i),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=pe(o.data,l))&&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:a}=this.state,{fieldName:l,options:o={},searchHelper:s={},placeholder:c=an("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=a.every((e=>Dl(e)))?"":a.join(" - "),f={visible:r,title:an("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${l}`,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}_${l}`:"",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:a[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?a.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(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),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:a[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?a.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(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([a[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t.createElement(wa,f,t.createElement(Up,g)))}}dc.contextType=Sa;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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(l,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}uc.contextType=Sa;const pc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,items:i,onChange:a,onValuesChange:l}=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==a||a(e),l(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:a="value",textKey:l="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[a],text:e[l]})));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:a,fieldName:l,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:a,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:l,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(l,n)}}))),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}hc.contextType=Sa;const mc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=l,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),a(e,m(e))})(e)}})};class fc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}fc.contextType=Sa;const gc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,items:i,onChange:a,onValuesChange:l}=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==a||a(e),l(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:a="value",textKey:l="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[a],text:e[l]})));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:a,fieldName:l,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:a,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:l,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(l,n)}}))),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}vc.contextType=Sa;const yc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=wl,trueValue:h=Cl}=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),a(e,m(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class bc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}bc.contextType=Sa;const xc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{options:o={},style:s={},placeholder:c=l("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),a(e)})(t)}})};class Ec extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(xc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Ec.contextType=Sa;const Cc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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),a(e,S(e))},S=e=>Dl(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Pl(h().subtract(e,"day"),Rl[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:Il[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)},l("qm.form.datePickers")[0]),t.createElement(V,{color:"processing",onClick:()=>N(1)},l("qm.form.datePickers")[1]),t.createElement(V,{color:"processing",onClick:()=>N(7)},l("qm.form.datePickers")[2]),t.createElement(V,{color:"processing",onClick:()=>N(30)},l("qm.form.datePickers")[3])):void 0,value:Al(r,Rl[g]),onChange:(e,t)=>{w(Pl(e,Rl[g]))}})};class wc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}wc.contextType=Sa;const Sc=e=>[h().subtract(e,"day"),h()],Nc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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={[l("qm.form.dateRangePickers")[0]]:Sc(7),[l("qm.form.dateRangePickers")[1]]:Sc(30),[l("qm.form.dateRangePickers")[2]]:Sc(90),[l("qm.form.dateRangePickers")[3]]:Sc(180)},N=e=>Dl(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:Il[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:[Al(null==r?void 0:r[0],Rl[g]),Al(null==r?void 0:r[1],Rl[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),a(e,N(e))})([Pl(null==e?void 0:e[0],Rl[g]),Pl(null==e?void 0:e[1],Rl[g])])}})};class Tc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Tc.contextType=Sa;const Ic=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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:Ol[f],value:Al(r,Ol[f]),onChange:(e,t)=>{(e=>{const t=Pl(e,Ol[f]);null==i||i(t),a(t)})(e)}})};class Rc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ic,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Rc.contextType=Sa;const Oc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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=>Dl(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:Ol[f],value:Kn(r)?null:[Al(null==r?void 0:r[0],Ol[f]),Al(null==r?void 0:r[1],Ol[f])],onChange:(e,t)=>{(e=>{const t=[Pl(null==e?void 0:e[0],Ol[f]),Pl(null==e?void 0:e[1],Ol[f])];null==i||i(t),a(t,E(t))})(e)}})};class kc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}kc.contextType=Sa;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:a}=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` 值"),a&&!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:a,triggeredChange:l,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&&Fl(e,this.alias,c),d&&Hl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=_l(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==a||a([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=_l(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]:_l(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]:_l(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:_l(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=_l(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,a,l,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===(a=null===(i=this.props.option.searchHelper)||void 0===i?void 0:i.request)||void 0===a?void 0:a.params)||(null===(l=this.props.option.request)||void 0===l?void 0:l.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:a=(e=>e),dataKey:l}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(a(Object.assign(Object.assign({},i),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=pe(o.data,l))&&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:a}=this.state,{value:l}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=an("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=Sl}=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:l,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:Tl,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!=a?a:l,title:l,onFocus:()=>{!i.length&&this.fetchHandle(l)},onBlur:e=>{v&&!this._clicking&&a!==l&&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=Sa;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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Ac.contextType=Sa;class Pc extends s{render(){var e;const{$$form:n}=this.context,{type:r,label:i,fieldName:a,className:l,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===a)))&&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}:`:"",a=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==a&&h.push(Object.assign(Object.assign({},e),{text:`${i}${a}`}))}))}return t.createElement(P.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(er,{id:a,label:i,className:l,extra:h.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[a],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[a]:e})}))),p(e)}}))}}Pc.contextType=Sa;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(Sa),{value:r,items:i,multiple:a,loading:l,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=Sl,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=$l(O,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},P=e=>a?(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:a,treeCheckable:a,treeCheckStrictly:C,showCheckedStrategy:z[w],popupClassName:`form-popper__${d}`,dropdownStyle:I,placeholder:h,listHeight:E,style:p,loading:l,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:a,textKey:l="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,a))&&void 0!==n?n:[],i=Dc(O,e,o,Ml(r,o,l));k(i),null==s||s(r)}}catch(e){}})):void 0,treeData:O},a?{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:a="value",textKey:l="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=Ml(n,a,l);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:a,tooltip:l,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(a),className:_e(u),tooltip:l,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(a)}},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||El)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Fc.contextType=Sa;const Hc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,multiple:i,items:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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)?a:g),N=t.useRef(w);Li((()=>{const e=Kn(g)?a:g;h?me(e,N.current)||(S(e),N.current=e):S(e)}),[g,a]);const T=e=>jl(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:a,textKey:l="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,a))&&void 0!==t?t:[],i=Dc(w,n.value,o,Ml(r,o,l));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:a="value",textKey:l="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=Ml(n,a,l);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:a,tooltip:l,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(a),className:_e(u),tooltip:l,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(a)}},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||El)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Mc.contextType=Sa;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"},an("qm.form.citySelectType.0")),t.createElement(q.Button,{value:"1"},an("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:an("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:a={},style:l={},placeholder:o=an("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({},l)},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 a={[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(a,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Tl,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%"},l),value:m,title:m,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Bc.contextType=Sa;class Uc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Uc.contextType=Sa;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=$l(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:a,valueKey:l="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,a))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[l]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var i;const a=(null===(i=n.find((t=>t.value===e[r])))||void 0===i?void 0:i.text)||`${an("qm.form.selectPlaceholder").replace("...","")}(${an("qm.form.regionSelectLabel")[r]})`;return t.createElement(ba.TabPane,{key:r.toString(),tab:a},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(ba,{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:a={},style:l={},placeholder:o=an("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 a={[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(a,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Tl,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%"},l),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&jn((()=>this.initial()))}})))}))}}Yc.contextType=Sa;class Xc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Xc.contextType=Sa;const Qc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},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}=l,{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(pa,{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))&&a(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:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Qc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Zc.contextType=Sa;const Jc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},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}=l,{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))&&a(t)})(e)},onRemove:y,onSortChange:b})};class ed extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Jc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}ed.contextType=Sa;const td=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=l;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),a(e)})(e)}})};class nd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(td,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}nd.contextType=Sa;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:an("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(){ea(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,Nl.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:wl),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,a;if(ql(e))return Kl(e);if(oe(e)){const{fieldName:l,label:o,options:s={}}=e;if(ql(o))return Kl(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([l])[l])&&void 0!==n?n:this._initialValues[l])&&void 0!==r?r:null===(i=c[0])||void 0===i?void 0:i.value;return(null===(a=c.find((e=>e.value===d)))||void 0===a?void 0:a.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,a=i.length;e<a;e++){const a=i[e],l=this.dividers.find((e=>e.fieldName===a[0].fieldName)),o=null!==(r=null===(n=null==l?void 0:l.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:a.length-1;for(let e=1;e<a.length;e++){if(a[e].fieldName===t&&e>o)return this.state.expand[a[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const i=e[r];if(Dl(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{Dl(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(i)){const[a,l]=r.split("|");e[a]=null!==(t=i[0])&&void 0!==t?t:"",e[l]=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:a}=r.fetch;try{const r=yield t(n);200===r.code&&(i=null!==(e=a?pe(r.data,a):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:a,secretName:l}=n;i||(e.noAuth=!0,r.noAuth=!0),a&&(e.disabled=!0,r.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},r.options=Object.assign({},r.options,{secretType:l})),this.setFieldAuth(t,{visible:i,disabled:a,secretName:l})}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(lc,{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(lo,{option:e})}MULTIPLE_SELECT(e){return t.createElement(lo,{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(ql(e)||!oe(e))return e;const{type:n,fieldName:r,label:i,options:a={},onChange:l=Hn}=e,{itemList:o=[]}=a;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(ao,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>l(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=>l(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:i={},render:a}=e,{extra:l}=this.state;if(r)return t.createElement(C,{className:"extra-tooltip",title:l[n]},t.createElement(Qe,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:a?"":l[n],style:i},t.createElement("span",{className:"extra-overflow-cut"},a?a(o,this):l[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:a,className:l,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:a,hidden:i,className:_e(l),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,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<n;e++)a.push({})}));const l=24/e,o=[],s=a.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=a.map(((n,r)=>{let{selfCol:i=1}=n;const{type:a,fieldName:s}=n;i=i>=24||"DIVIDER"===a||"TINYMCE"===a?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*l,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},a?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:a,isFieldsDefine:l=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=i||1,c=n-e%n-s;return a?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()},an("qm.form.search")),t.createElement(Xn,{size:this.$size,icon:t.createElement(Ze,null),onClick:()=>this.RESET_FORM()},an("qm.form.reset")),l?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(Fe,null):t.createElement(He,null)," ",an(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()},an("qm.form.save")),t.createElement(Xn,{size:this.$size,onClick:()=>this.RESET_FORM()},an("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:[an("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,a=r.find((t=>t.fieldName===e));if(!a)return Yn("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!oe(t))return Yn("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(a.noAuth)return Yn("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||fe(a,n,t[n]));n&&(i?i([...r]):Yn("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:a,labelAlign:l,labelWrap:o,customClass:s}=this.props,c=Jn("form"),d={required:"${label}"+an("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:l,labelWrap:o,colon:!1,disabled:i,labelCol:{flex:this.verticalLayout?"initial":Bn(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Sa.Provider,{value:this.provide},t.createElement(D,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}rd.contextType=en,rd.propTypes=kl,rd.defaultProps=Ll;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},ad=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),ld=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,a,l)=>{const o=Object.keys(i).filter(od),s=Object.keys(a).filter(od),c=o.filter((e=>void 0===a[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=sd(e),r=l[t];n(t,r),delete l[t]})),d.forEach((n=>{const i=r(e,n),a=sd(n);l[a]=i,t(a,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,a,l)=>{const o=()=>((e,t,n,r,i,a)=>{const l=t.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=e,l.src=n,l.async=r,l.defer=i;const o=()=>{l.removeEventListener("load",o),a()};l.addEventListener("load",o),t.head&&t.head.appendChild(l)})(e.scriptId,t,n,r,i,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,a>0?setTimeout(o,a):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 a=vd(this.view);if(!a)throw new Error("tinymce should have been loaded into global scope");const l=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&&ld(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&&ld(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()),a.init(l)},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,a;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!==(a=null===(i=this.props.scriptLoading)||void 0===i?void 0:i.delay)&&void 0!==a?a: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=ad,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:a={},upload:l={},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:a.height||v,plugins:a.plugins||y,toolbar:a.toolbar||x,menubar:a.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(a,["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}=l,a=`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 a=yield e.json();if(200===a.code){const e=i?pe(a.data,i):a.data;t(e)}}catch(e){R.error(g("qm.uploadCropper.uploadError"))}else t(a)})))),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=ln({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:a,src:l,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:a},t.createElement("img",{ref:d,src:l,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));Ed.displayName="Cropper";const Cd=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:i,quality:a,beforeCrop:l,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,a=Rn(r,["beforeUpload"]);return d.current=i,t.createElement(n.type,Object.assign(Object.assign({},a),{beforeUpload:(e,t)=>new Promise(((n,r)=>kn(void 0,void 0,void 0,(function*(){const r=()=>n(I.LIST_IGNORE);if(l&&!(yield l(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 a=new File([i],t,{type:e});if(Object.assign(a,{uid:r}),n.length&&!n.includes(a.name.slice(a.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(a);const l=d.current(a,[a]);if("boolean"==typeof l||l){if(!0===l)return p.current(a);if(!1===l)return h.current("not upload");if(l&&"function"==typeof l.then)try{const e=yield l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),p.current(a)}catch(e){h.current(e)}}else Yn("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,a),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=ln({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:i=!0,fixedSize:a,quality:l=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:a=[],fileSize:l,beforeUpload:o}=n,s=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!l||e.size/1024/1024<l,d=s&&c;if(s||R.warning(y("qm.upload.tooltip",{type:a.join(",")})),c||R.warning(y("qm.upload.sizeLimit",{size:l})),!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:a}=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(),l=Date.now(),o=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${l}`});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),l=yield fetch(n,{method:"POST",body:e,headers:a});if(!l.ok)throw new Error(y("qm.upload.uploadError"));const s=yield l.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:a,quality:l,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 a=e[i];if(a.children)if(a.children.some((e=>e[n]===t)))r=a[n];else{const e=Sd(a.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:a=!0,multiple:l,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),_=ta(P),[F,H]=t.useState(v),[M,$]=t.useState(!1),j=na((()=>{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(le())}),[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(l)return y;const t=Td(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},ae=e=>{var t;return(null===(t=kd(q,e,L))||void 0===t?void 0:t.slice(0,-1))||[]},le=()=>{if(x)return ne.current;const e=[];return W.forEach((t=>{if(l){if("SHOW_ALL"===h&&!ne.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const n=$l(q,t);if(n){const r=ae(t),i=Ld(n,L);e.push(...r,...[t,...i].filter((e=>ne.current.includes(e))))}}}else e.push(...ae(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:a}=c;try{$(!0);const l=yield t(n);if(200===l.code){let t=Array.isArray(l.data)?l.data:null!==(e=pe(l.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,re(t),B(ie(t)),z({}),null==a||a(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(!a)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):le())})(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:l,draggable:o,blockNode:o,checkable:l,selectable:!l,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:a,formatter:l=(e=>e),afterFetch:o}=c;try{const t=yield r(l(Object.assign(Object.assign({},i),{[L]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=pe(t.data,a))&&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]),a=(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&&a(e[r].children,t,n)}},l=[...q];let o;if(a(l,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)a(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];a(l,t,((t,r,i)=>{n=i,e=r})),-1===i?n.splice(e,0,o):n.splice(e+1,0,o)}else a(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(l)},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(l?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(l?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({virtual:qt.bool,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:a,postState:l}=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=l?l(c):c,u=An(a),[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:a,rowSelection:l,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 a=e[i];"left"===a.fixed?t.push(a):"right"===a.fixed?n.push(a):r.push(a)}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}})(l),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),ja(t)},_=(e,t,n,r,i)=>{const a=`${t},${n}`;e.has(a)||e.set(a,{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((()=>$a(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 a=0;a<e.colSpan;a++)0===i&&0===a||_(t,n+i,r+a,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((()=>Ya(j).length>1),[j]),Q=t.useMemo((()=>a||X),[a,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==l?void 0:l.type)),[v,l]),ie=t.useMemo((()=>!!p&&J),[p,J]),ae=t.useMemo((()=>!F&&!!h&&J),[F,h,J]),le=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:a}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=a,c=se?pl(x.current.tableFullData):x.current.tableFullData,d=!k.length&&!!o;let u=(!l||d?c:k).reduce(((e,t)=>{if(null==t?void 0:t[Xd.summaryIgnore])return e;const r=tl(t,n);return il(r)?e.plus(r):e}),new Vt(0));!Object.keys(L).includes(n)||l&&!d||(u=new Vt(tl(L,n))),nl(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=ll(p,i)),p=al(p),nl(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("|"),a=e[t];Object.keys(a).forEach((e=>{n.push({type:i,bracketLeft:"",fieldName:r,expression:e,value:a[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,a=n.length?{[Xd.filterFieldName]:n}:null,l=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),a),l),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:ae,isPivotGrid:le,isGroupSummary:oe,isGroupSubtotal:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}},tu=(e,n)=>{const{rowKey:r,height:i,dataSource:a,summation:l,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:p,treeConfig:h,authConfig:m,ignorePageIndex:f,columnsChange:g,onChange:v,onDataChange:y,onDataLoad:b,onScrollEnd:x,onFetchError:E}=e,{getRowKey:C,tableRef:w,tableElementRef:S,tableBodyRef:N,$size:T,tableColumns:I,flattenColumns:R,editableColumns:O,tableFullData:k,pagination:L,layout:A,filters:P,sorter:D,superFilters:_,fetchParams:F,selectionKeys:H,rowExpandedKeys:M,highlightKey:$,summationColumns:j,isFetch:q,isWebPagination:K,isScrollPagination:V,isServiceSummation:z,isGroupSubtotal:W,doLayout:B,setTableFullData:U,setTableOriginData:G,setTableFlatData:Y,setAllTableData:X,setDeriveRowKeys:Q,setPagination:Z,setPingRight:J,setPingLeft:ee,setSpinning:te,setSorter:ne,setFilters:re,setSuperFilters:ie,setSelectionKeys:ae,setRowExpandedKeys:le,setHighlightKey:oe,setSelectionRows:se,setScrollXLoad:ce,setScrollYLoad:de,setFieldAuth:ue,setResizeState:he,setSummaries:me,setPermission:fe,setRecordsMap:ge,resetTableScroll:ve,clearElementStore:ye,clearRecordsMap:be}=n,{t:xe}=Ln(),{store:Ce}=w.current,we=t.useRef(Object.assign({},F)),Se=t.useRef(new Map),Ne=t.useRef(!1),Te=ta(S);sn((()=>{Ae(),B()}),[I]),sn((()=>{Ie()}),[Te,T,i,A.tableAutoHeight]),Li((()=>{ut(),pt(),ht(),q||(K&&nt(),Xe(a)),s&&ne(s),c&&re(c)}),[a,null==o?void 0:o.params]),Li((()=>{const e=We(F,we.current);e||q&&(null==d?void 0:d.clearableAfterFetched)&&mt(),!e&&F[Xd.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?nt():q&&Ge(),we.current=F}),[F]),Li((()=>{K&&ot(),V||ve(),Ke()}),[L.current,L.pageSize]),Li((()=>{q||Oe(k.length),B()}),[k]),Li((()=>{w.current.isTreeTable&&w.current.scrollYLoad&&(rt(),ot())}),[M]);const Ie=()=>{const{scrollBarRef:e,resizeState:t}=w.current,{width:n,height:r}=Te;B(),A.tableBodyWidth>n&&J(!0),e.current.scrollLeft>0&&ee(!0),he(Object.assign({},t,{width:n,height:r}))},Re=()=>{$&&N.current.setClickedValues([$,""]),"radio"===(null==d?void 0:d.type)&&H.length&&N.current.setClickedValues([H[0],""])},Oe=e=>{e!==L.total&&Z((t=>Object.assign({},t,{total:e})))},ke=e=>{Ne.current=e},Le=na((e=>{Je(),null==x||x(e)})),Ae=()=>{ce(R.length>Xd.virtualScrollX)},Pe=(e=[])=>{let t=e.length>Xd.virtualScrollY;(null==p?void 0:p.virtual)&&(t=!0),(null==h?void 0:h.virtual)&&(t=!0),de(t)},De=e=>W?_e(Fe(e,0)):e,_e=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(..._e(e.children)),delete e.children,t.push(e)})),t},Fe=(e,t)=>{var n;const i=null===(n=l.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 ml(e,[i.dataIndex]).map((e=>{const n={children:Fe(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&nl(n,r.toString(),cl()),i.titleIndex&&nl(n,i.titleIndex,tl(e[0],i.titleIndex)),nl(n,i.dataIndex,tl(e[0],i.dataIndex)),j.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(tl(t,r));return Number.isNaN(n)?e:e+n}),0);nl(n,r,i)})),n}))},He=e=>{ae(e),se((e=>{const{selectionRows:t,recordsMap:n}=w.current,r=new Map;t.forEach((e=>r.set(C(e,e.index),e)));const i=[];for(let t=0,a=e.length;t<a;t++){const a=r.get(e[t])||n.get(e[t]);a&&i.push(a)}return i})(e))},Me=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:H;let i=[];return w.current.isTreeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:a}=w.current,l=Ua(i,e);let o=[];if(!l)return o;let s=je((null==l?void 0:l.children)||[]);return r&&(s=s.filter((e=>!a.has(e)||!r(a.get(e))))),o=[...new Set([...t,...s])],((null===(n=gl(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ua(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},$e=e=>{const{isTreeTable:t,allRowKeys:n,flattenRowKeys:r,deriveRowKeys:i,recordsMap:a}=w.current,{defaultExpandAllRows:l,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:M;if(t){s&&Yn("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...H];$&&e.unshift($),e.forEach((e=>{const t=gl(i,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)}))}return c=l?n.slice(0):[...new Set(c)],t&&(c=c.filter((e=>!r.includes(e)))),o&&c.filter((e=>{const t=a.get(e);return!!t&&o(t)})),c},je=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...je(e[n].children)),t.push(e[n].rowKey);return t},qe=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...qe(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...qe(e,n[n.length-1])),n},Ke=na((()=>{null==v||v(L,ze(P),Ve(D),_,{currentDataSource:lt()})})),Ve=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},ze=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},We=(e,t)=>{const n=Object.keys(el(e,t));return 1===n.length&&(n.includes(Xd.currentPageName)||n.includes(Xd.pageSizeName))},Be=()=>kn(void 0,void 0,void 0,(function*(){var t;if(!m)return;let n=zn(m,["fetch"]);if(m.fetch){const{api:e,params:r,dataKey:i}=m.fetch;try{const a=yield e(r);200===a.code&&(n=null!==(t=i?pe(a.data,i):a.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;fe((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=Ka(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:i,secretName:a}=r,l=Va(w.current.originColumns,t);ue(t,{visible:n,disabled:i,secretName:a}),n||(e.noAuth=!0,l.noAuth=!0),a&&(e.formatType=`secret-${a}`,l.formatType=`secret-${a}`)}}));null==g||g(t)}})),Ue=()=>kn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:i=Mn,afterFetch:a,callback:s}=o;if(!i(F))return;const c=!!(null===(e=null==l?void 0:l.fetch)||void 0===e?void 0:e.api);te(!0);try{const[e,i]=c?yield Promise.all([o.api(r(F)),l.fetch.api(r(F))]):[yield o.api(r(F))];if(w.current.unMounted)return;if(c?200===e.code&&200===i.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:Xd.dataKey;let l=null!==(n=pe(e.data,r))&&void 0!==n?n:[];l="function"==typeof a?yield a(l):l;const c=pe(e.data,r.replace(/[^.]+$/,Xd.totalKey))||l.length||0,d=Math.max(Math.ceil(c/L.pageSize),1);if(F[Xd.currentPageName]>d)return et(Object.assign(Object.assign({},L),{current:d}));Xe(Ne.current?w.current.tableFullData.concat(l):l),Oe(c),Qe((null==i?void 0:i.data)||e.data),null==s||s(e.data,e)}}catch(e){null==E||E(e)}var d,u;d=o,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(o.stopToFirst=!1),te(!1),ke(!1)})),Ge=na(Ue),Ye=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Ye(e.children)),e.index=t,f||(e.pageIndex=(e=>{const{current:t,pageSize:n}=L;return!q||V?e:(t-1)*n+e})(t)),e))),Xe=e=>{const t=De(Ye(e));st(t),ct(t),He(Me()),le($e()),Ze(),null==b||b(t)},Qe=e=>{var t,n,r;if(!z)return;const i=null!==(n=null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:Xd.summationKey,a=null!==(r=i?pe(e,i):e)&&void 0!==r?r:{},o={};j.filter((e=>!!e.summation.dataKey)).forEach((e=>{nl(o,e.dataIndex,Number(tl(a,e.summation.dataKey)))})),me(o)},Ze=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=lt();if(e.length){const t=C(e[0],e[0].index);He([t])}else He([])}},Je=()=>{if(!V)return;const e=tt();Ne.current||L.current>=e||(ke(!0),et(Object.assign(Object.assign({},L),{current:L.current+1})))},et=({current:e,pageSize:t})=>{Z((n=>Object.assign({},n,{current:e,pageSize:t})))},tt=()=>{const{pageSize:e,total:t}=L;return Math.ceil(t/e)||1},nt=()=>{et(Object.assign({},L,{current:1}))},rt=()=>{const{isTreeTable:e,scrollYLoad:t,deriveRowKeys:n}=w.current;if(!e||!t)return;const r=it(n,(()=>{const{allTableData:e,allRowKeys:t}=w.current,{rowExpandable:n}=u||{},r=[];return"function"==typeof n&&e.forEach(((e,i)=>!n(e)&&r.push(t[i]))),r.length?M.filter((e=>!r.includes(e))):M})());Se.current.clear(),r.forEach(((e,t)=>Se.current.set(e,t)))},it=(e,t)=>{const n=[];return e.forEach((e=>{if(e.children&&n.push(...it(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},at=()=>{const{current:e,pageSize:t}=L;return w.current.tableFullData.slice((e-1)*t,e*t)},lt=()=>K?at():w.current.tableFullData,ot=()=>{const{allTableData:e,isTreeTable:t}=w.current,n=K?Ga(at()):e;Pe(n),Y(t?(e=>{const{recordsMap:t}=w.current,n=[];for(let r=0,i=e.length;r<i;r++){const i=C(e[r],e[r].index);Se.current.has(i)&&n.push(t.get(i))}return n})(n):n)},st=e=>{U(e),X(e),Q(e),dt(),rt(),ot()},ct=e=>{G(e)},dt=()=>{be(),w.current.allTableData.forEach((e=>ge(C(e,e.index),e)))},ut=()=>{ne({})},pt=()=>{re({})},ht=()=>{ie([])},mt=()=>{He([])};return{initialTable:()=>{Be(),Re(),Ae(),Pe(),q?Ue():Xe(a)},checkDataIndex:()=>{const e=R.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Yn("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:st,getTableData:Ue,createTableList:lt,createTableData:Xe,createGroupData:De,createSelectionKeys:Me,createRowExpandedKeys:$e,setSelectionKeysEffect:He,findParentRowKeys:qe,getAllChildRowKeys:je,doFieldValidate:(e,t,n,r)=>{if(!Array.isArray(e))return Yn("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ce.removeFromRequired({x:n,y:r}),Ce.removeFromValidate({x:n,y:r}),e.forEach((e=>{var i;e.required&&Kn(t)&&Ce.addToRequired({x:n,y:r,text:e.message||O.find((({dataIndex:e})=>e===r)).title+xe("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(i=e.validator)||void 0===i?void 0:i.call(e,t))||Ce.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:i}=Ce.state,a=Ee(n,i),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:n.filter((e=>!a.includes(e))),updated:r.filter((e=>![...Ee(r,n),...Ee(r,i)].includes(e))),removed:i.filter((e=>!a.includes(e)))}},dataChange:()=>{null==y||y(w.current.tableFullData)},tableChange:Ke,toLastPage:()=>{const e=tt();L.current!==e&&et(Object.assign({},L,{current:e}))},toFirstPage:nt,getPageCount:tt,pagerChangeHandle:et,scrollBottomDebouncer:Le,clearTableSorter:ut,clearTableFilter:pt,clearSuperFilters:ht,clearRowSelection:mt,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{Ce.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;ye(),Ce.destroy(),e.deregister(t)}}},nu=(e,n)=>{const{height:r,minHeight:i,maxHeight:a,ellipsis:l,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:`${Ja(i)}px`}),a&&Object.assign(n,{maxHeight:`${Ja(a)}px`}),w?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${Ja(r)}px`:`${t}px`}):n}),[r,a,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 a=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(o)?(a=o[0],l=o[1]):oe(o)&&(a=o.rowSpan,l=o.colSpan)}if(y.length>0){const e=y.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,l=e.colSpan)}return{rowSpan:a,colSpan:l}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=Va(f,e);e=t?za(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=Va(f,e);e=t?Wa(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),a=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(a-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 a=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,a+=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 a=Math.floor((t.minWidth||r)*e);n+=a,t.renderWidth=(t.minWidth||r)+a})),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 a=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>Object.assign(Object.assign({},e),{tableBodyWidth:a})));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,a=E?e.$footer.offsetHeight:x.footerHeight,l=r-i-a,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:a,viewportHeight:l,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function ru({handler:t,delay:n=0}){const r=ma(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:a,isHeadSorter:l,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&&!!(l||o||m||f)),[b,l,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(a.length-v.length,0)})}`:""),C&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),jn((()=>s()))}},x("qm.table.alert.clear"))):null},au=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{prefixCls:a,setFullScreen:l}=t.useContext(Pd),{t:o}=Ln(),s=()=>{l(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),i?t.createElement("span",{className:`${a}-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}));au.displayName="FullScreen";const lu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,getTableData:a}=t.useContext(Pd),{t:l}=Ln(),o=()=>{a()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${i}-reload`,title:l("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ze,null))):null}));lu.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=>il(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>al(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,a,l,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!==(l=null===(a=h.find((e=>e.value==t)))||void 0===a?void 0:a.text)&&void 0!==l?l: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=il(m)?new Vt(m).toFixed(c):m),d>=0&&""!==m&&(m=ll(m,d)),u){const t=e[`${qn(u)}Format`];t?m=t(m):Yn("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>_n(e)?dl(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,a)=>{const l=tl(e,r.dataIndex),o=r.render?r.render(l,e,r,i,a):t(l,r,e);return n(o)}}},su=t.forwardRef(((e,n)=>{var r,i,a,l;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!==(l=null===(a=null==c?void 0:c.print)||void 0===a?void 0:a.rightLogo)&&void 0!==l?l:"",C=!(!x&&!E),w=t.useMemo((()=>Wn(Ba(o,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn]))),[o]),S=t.useMemo((()=>Wn(Ba(p,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn]))),[p]),N=t.useMemo((()=>Wn(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},fl(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(Ya(n))})),t},O=()=>{const e=(e=>{const t=[];let n=[],r=0,i=0;for(;i<e.length;){const a=e[i];r+=a.width||a.renderWidth||a.minWidth||Xd.defaultColumnWidth,r<=Xd.printWidth?(n.push(a),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):(a.width=Xd.printWidth,n.push(a),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}">${ul(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${Ga(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:i,colSpan:a}=f(e,t,e.index,r,n);if(!i||!a)return null;return`<td rowspan="${i}" colspan="${a}">${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:a}=t,l=(null==a?void 0:a.render)?a.render(n):tl(e,`${i}_text`);return`<td>${0===r&&""===l?y("qm.table.config.summaryText"):_n(l)?dl(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},L=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:i}=e,a=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!i)return Promise.resolve({type:r,content:t,blob:e});sa(e,a)}})({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(at,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:a,showHeader:l}=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=$a(u),f=Ya(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]=ul(e.title),y.push({key:t,width:(n||i||r||Xd.defaultColumnWidth)/8})})),l&&(i?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,a=fu(e),l=m.findIndex((({dataIndex:e})=>e===a.dataIndex));n[a.dataIndex]=ul(e.title),0!==r&&(r>1||i>1)&&b.push({s:{r:t,c:l},e:{r:t+i-1,c:l+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=Ga(s).map(((e,t)=>{const r={};return m.forEach(((i,l)=>{if("function"==typeof a){const{rowSpan:r,colSpan:a}=n(e,i,t,l,s);(a>1||r>1)&&b.push({s:{r:t+x,c:l},e:{r:t+x+r-1,c:l+a-1}})}const o=["percent","finance"].includes(i.formatType);r[i.dataIndex]=o?tl(e,i.dataIndex):d(e,t,i,l)})),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:a}=t,l=(null==a?void 0:a.render)?a.render(s):tl(e,i);n[i]=0===r&&""===l?o("qm.table.config.summaryText"):_n(l)?dl(l).join(""):l})),v.push(n)}));const{sheetName:w,useStyle:S}=t,N=new Zt.Workbook,T=N.addWorksheet(w);T.columns=y,l&&T.addRows(g).forEach((e=>{S&&pu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Va(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=Va(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=Va(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,a,l="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],r=0;r<i.cells.length;r+=1)a=i.cells[r],l=l+(r?",":"")+n(a.textContent.trim());l+="\r\n"}return l})((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 a;for(a=0;a<r.length;a+=n){const e=r.slice(a,a+n),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);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=$a(n),a=new FileReader;a.onerror=()=>{R.error(o("qm.table.import.error"))},a.onload=e=>{const n=i.map((e=>ul(e.title))),r=new Zt.Workbook,a=e.target;a?r.xlsx.load(a.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),a=e.findIndex((e=>e&&e.length>0)),l=e[a],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,l);if(c){const r=e.slice(a+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=sl(i,jd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[l[n]]=i}));const r={};return n.forEach(((e,n)=>{var a;const{dataIndex:l,dictItems:o}=i[n];Array.isArray(o)&&((null===(a=t[e])||void 0===a?void 0:a.toString().includes(","))?t[e]=t[e].split(",").map((e=>s(o,e))).filter((e=>""!==e)):t[e]=s(o,t[e])),nl(r,l,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"))},a.readAsArrayBuffer(r)}}},yu=e=>{const{fileType:n,onChange:r}=e,{prefixCls:i}=t.useContext(Pd),{t:a}=Ln();let l,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 l||(l=document.createElement("form"),o=document.createElement("input"),l.className=`${i}--file-form`,o.name="file",o.type="file",l.appendChild(o),document.body.appendChild(l)),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(a("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(l),l=null,o=null},l.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(Xn,{onClick:()=>c()},a("qm.upload.text"))},bu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,prefixCls:a,createTableData:l,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:`${a}-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:a}=i.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&l(e),"add"===t.importType&&l([...n,...e]),"insert"===t.importType){const r=t.posIndex,i=n.slice(0,r).concat(e).concat(n.slice(r));l(i)}e.forEach((e=>{a.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:a}=t.useContext(Pd),{t:l}=Ln(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${a}-import`]:!0},u={visible:o,title:l("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:l("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(lt,null))),t.createElement(wa,u,t.createElement(bu,{columns:r,onClose:()=>s(!1)})))}));xu.displayName="TableImport";const Eu=e=>{const{columns:n,onChange:r}=e,{prefixCls:i,$size:a}=t.useContext(Pd),{t:l}=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"===a,[`${i}--sm`]:"small"===a},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(bl(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:l("qm.table.columnFilter.draggable")},t.createElement(Ge,null)),t.createElement("span",{className:"text"},ul(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:l("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(ot,null)),t.createElement("span",null,l("qm.table.columnFilter.text"))))},Cu=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:a,prefixCls:l,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(Pd),{rowSelection:d}=a.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:`${l}-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:a=!0}=e,{global:l}=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((()=>Ba(i,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn])),[i]),k=t.useMemo((()=>Ba(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}),a=t?`${t}.${i.index+1}`:`${i.index+1}`;return i.indexPath=a,i._level=n,Array.isArray(e.children)&&(i.children=L(e.children,a,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&nl(i,t,tl(i,t))})),i})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(m?pl(t):t).reduce(((e,t)=>{if(null==t?void 0:t[Xd.summaryIgnore])return e;const n=Number(tl(t,r));return Number.isNaN(n)?e:e+n}),0);nl(n,r,i)})),[n]},P=(e,t,n,r)=>{const{precision:i,formatType:a}=n;let l=E(e,n,t,r);return i>=0&&!a&&""!==l&&(l=Number(l)),l},{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:a}=y;let l=[];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,a))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,l=L(e)}}catch(e){}return N(!1),l})),H=e=>{var t;const n=null===(t=null==l?void 0:l.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=Ya(n),a=$a(n);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${a.map((({width:e,minWidth:t,renderWidth:n})=>`<col style="width:${e||n||t||Xd.defaultColumnWidth}px">`)).join("")}</colgroup>`,b&&(l+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${ul(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${Ga(t).map((e=>`<tr>${a.map(((n,r)=>{const{rowSpan:i,colSpan:a}=g(e,n,e.index,r,t);return i&&a?`<td rowspan="${i}" colspan="${a}">${P(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(l+=["<tfoot>",A(a,t).map((e=>`<tr>${a.map(((n,r)=>{const{dataIndex:i,summation:a}=n,l=(null==a?void 0:a.render)?a.render(t):tl(e,i);return`<td>${0===r&&""===l?x("qm.table.config.summaryText"):_n(l)?dl(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l},$=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&&(sa(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,a&&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(wa,V,t.createElement(Cu,{defaultValue:z,onClose:()=>w(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:ja(e.columns)}),kn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:i=1,endIndex:a}=t,{tableFullData:l,selectionRows:s}=o.current;let c=[];if(p?("all"===r&&(c=yield F()),"custom"===r&&(c=yield F(a),c=c.slice(i-1))):("all"===r&&(c=l.slice(0)),"custom"===r&&(c=l.slice(i-1,a||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);sa(n,`${e}.xlsx`),H(`${e}.xlsx`)}if("csv"===n){const n=_(t,M(t,c));sa(n,`${e}.csv`),H(`${e}.csv`)}}))}})))}));wu.displayName="TableExport";const Su=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:a,prefixCls:l,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:ul(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:`${l}-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,l]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:p,fieldAuth:h}=i.current;m(!0);const f=l.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[l.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var i,a;const o=u[l.rowIndex-1+t],s=n[l.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===(a=h[s.dataIndex])||void 0===a?void 0:a.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(nl(o,s.dataIndex,e),p.addToUpdated(o))}}))})),a.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:a}=t.useContext(Pd),{t:l}=Ln(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.operationColumn].includes(e.dataIndex))))(a)),[a]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${i}-clipboard`]:!0},p={visible:o,title:l("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:l("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(st,null))),t.createElement(wa,p,t.createElement(Su,{columns:c,onClose:()=>s(!1)})))}));Nu.displayName="TableClipboard";const Tu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:a,selectionKeys:l,setSelectionKeysEffect:o}=t.useContext(Pd),{rowKey:s,rowSelection:c}=i.current.props,{t:d}=Ln(),u=t.useRef(null),p=ta(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=na((()=>{const e=u.current;y(e.offsetHeight-2*bo[a]-30)}),5);return sn((()=>{b()}),[p.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(Mp,{size:a,columns:m,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:l,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:a,getRowKey:l,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:p}=t.useContext(Pd),{rowSelection:h}=a.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)=>l(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(wa,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:a,prefixCls:l,$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=>a(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:ul(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,a=t.length;i<a;i++){const a=t[i];let l=!0;for(const t in e){const{type:n}=I.find((e=>e.dataIndex===t)).filter;let i=tl(a,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){l=!1;break}}l&&n.push(a)}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,l=x.current[C.current],o=a(l,l.index);let s=l.index;if(t&&f){const e=gl(r,o)[0];s=n.findIndex((t=>a(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:`${l}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"top"},t.createElement("div",{className:"container"},t.createElement(ba,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,v("qm.table.alert.total",{total:F}))},t.createElement(ba.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(ba.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=cl(),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:a}=t.useContext(Pd),{t:l}=Ln(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:l("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${bo[a]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:l("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(ut,null))),t.createElement(wa,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:a}=Ln(),[l,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:l,title:a("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:a("qm.table.pivotGrid.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(pt,null))),t.createElement(wa,c,t.createElement(_m,null)))}));ku.displayName="PivotGrid";const Lu=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:a,$size:l,pagination:o,fetchParams:s,isFetch:c}=t.useContext(Pd),{fetch:d}=a.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=ml(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&nl(t,r,tl(e[0],r))})),i.forEach((n=>{const r=n.summary!==Xd.groupSummary.total.value?n.summary:Xd.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&nl(t,r,e.length),"sum"===i&&nl(t,r,Oe(e,r)),"max"===i&&nl(t,r,ke(e,r)[r]),"min"===i&&nl(t,r,Le(e,r)[r]),"avg"===i&&nl(t,r,(Oe(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(a.current.tableFullData)),x=Object.assign(Object.assign({size:l,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:a,$size:l,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:ul(e.title),value:e.dataIndex}))),w=[Xd.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:ul(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:`${a}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(Mp,{ref:d,size:l,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:l,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:l,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=cl(),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[l]}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(wa,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:a}=Ln(),[l,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:l,title:a("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:a("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(mt,null))),t.createElement(wa,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:a,prefixCls:l,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=hl(h),S=t.useMemo((()=>!(w&&Ha(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:ul(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],a=null===(n=C.find((e=>e.dataIndex===i)))||void 0===n?void 0:n.filter.type,l=L(a);e.fieldType=a,e.expression=i?null===(r=l[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)),a=null==i?void 0:i.filter.type,l=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(a,R(e.expression)),editable:!0,items:l,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:`${l}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(Mp,{ref:p,size:a,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:a,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=cl(),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[a]}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:a}=Ln(),[l,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:l,title:a("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:a("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(ft,null))),t.createElement(wa,c,t.createElement(Du,{onClose:()=>o(!1)})))}));_u.displayName="SuperSearch";const Fu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:i,showReload:a,showPrint:l,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:a,print:l,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(au,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),a&&t.createElement(lu,{ref:N,open:!f||$.reload}),l&&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:a,prefixCls:l,$size:o}=t.useContext(Pd),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=a.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(qa(e).map((e=>e.dataIndex)),qa(r).map((e=>e.dataIndex))).length>0?Hu(r,(t=>{const n=Va(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=Va(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,l;a.current.columnsDefined&&!me(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,l=t,kn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:l})}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=Va(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(a.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 a=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===a)return t.push(n);t.push(...h.current[a].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:a,noFixed:l}=e;if(0===a)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=ul(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",l?"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",l?"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)),a=e.map((e=>e.dataIndex));me(i,a)||((e,t)=>{Va(r,t).children=e,null==u||u([...r])})(bl(t),n)}},e.map((e=>R(e,"sub"))))),k={[`${l}__popper`]:!0,"column-filter__popper":!0,[`${l}--lg`]:"large"===o,[`${l}--sm`]:"small"===o},L=[`${l}-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([...bl(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,...bl(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,...bl(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:a,setFilters:l,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(),l((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:ul(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:ul(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:ol(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]:sl(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,a=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}})))}},a.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,a=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}})))}},a.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,a=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:a,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,[`${a}--lg`]:"large"===i,[`${a}--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:a,resizable:l,columnsChange:o=Hn}=r.current.props,s=t.useMemo((()=>Wa(n)),[n]),c={resizable:!0,"is--line":l&&!i};return t.createElement("div",{className:_e(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:i}=r.current,l=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=Za(t,n.$table).left-i.current.scrollLeft+c;n.$table.classList.add("c--resize"),l.style.left=`${u}px`,l.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),l.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),l.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof h&&(Va(a,s.dataIndex).width=h,o([...a]))},!1}})},Ku=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:i,fetchParams:a,createTableList:l,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 a=n?l().filter((e=>!n(e))).map((e=>i(e,e.index))):l().map((e=>i(e,e.index)));return Ae(a,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(a);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=pe(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:a}=p;a&&(n=ge(n,l().filter((e=>a(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:a}=r.current.props,[l,o]=t.useState((null==a?void 0:a.defaultExpandAllRows)||!1);Li((()=>{const{allRowKeys:e,flattenRowKeys:t,isTreeTable:n}=r.current;i(l?e.filter((e=>!(n&&t.includes(e)))):[])}),[l]);const s={[`${Jn("expand")}--icon`]:!0,expanded:l,collapsed:!l};return t.createElement("span",{className:_e(s),title:"",onClick:e=>{e.stopPropagation(),o(!l)},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:a,flattenColumns:l,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 a,l,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!==(a=e.ellipsis)&&void 0!==a?a: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===(l=i[n+(null!=d?d:1)])||void 0===l?void 0:l.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:a,title:l,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"},l)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:ul(l)},r.current.isTreeTable&&n===h&&F?t.createElement(Vu,null):null,n===Xd.expandableColumn&&F?t.createElement(Vu,null):l)),s&&c.push(t.createElement(C,{key:1,placement:"top",title:s},t.createElement(bt,{className:"tip"}))),a&&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=l.find((e=>e.dataIndex===r)),a=t[r],o=tl(e,r),s=tl(n,r),c="function"!=typeof(null==i?void 0:i.sorter)?B(o,s):i.sorter(e,n);if(0!==c)return"ascend"===a?c:-c}return 0})).slice(0))(p?x(pl(t)):t,e);E(n)},G=()=>{_&&Y()},Y=()=>{const e=c.length?hl(c):hl(s),t=""!==e?p?x(Ma(pl(k),e,P)):Ma(k,e,P):k;E(t),W(!0)},X=Ya(n),{tableBodyWidth:Q}=a;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,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("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,a=null!==(r=n.initialDeps)&&void 0!==r?r:[];return()=>{var r,l,o,s;n.key&&(null===(r=n.debug)||void 0===r||r.call(n));const c=e();return c.length!==a.length||c.some(((e,t)=>a[t]!==e))?(a=c,n.key&&(null===(l=n.debug)||void 0===l||l.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 a=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 a.observe(n,{box:"border-box"}),()=>{a.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 a=e.options.useScrollendEvent&&tp?()=>{}:Xu(r,(()=>{t(i,!1)}),e.options.isScrollingResetDelay),l=r=>()=>{const{horizontal:l,isRtl:o}=e.options;i=l?n.scrollLeft*(o?-1:1):n.scrollTop,a(),t(i,r)},o=l(!0),s=l(!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,a;const l=e+t;null===(a=null===(i=r.scrollElement)||void 0===i?void 0:i.scrollTo)||void 0===a||a.call(i,{[r.options.horizontal?"left":"top"]:l,behavior:n})};class ap{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 a=r.get(t.lane);if(null==a||t.end>a.end?r.set(t.lane,t):t.end<a.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},a)=>{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 l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,l);for(let i=l;i<e;i++){const e=r(i),l=1===this.options.lanes?o[i-1]:this.getFurthestMeasurement(o,i),s=l?l.end+this.options.gap:t+n,c=a.get(e),d="number"==typeof c?c:this.options.estimateSize(i),u=s+d,p=l?l.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,a=lp(0,r,i,n);let l=a;for(;l<r&&e[l].end<n+t;)l++;return{startIndex:a,endIndex:l}}({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,a=this.elementsCache.get(i);a!==e&&(a&&this.observer.unobserve(a),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[lp(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",a=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-n;return Math.max(Math.min(a,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 a="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,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,a]=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,a));t=i,r=this.getScrollOffset(),Math.abs(t-r)<1||this.scrollToIndex(e,{align:a,behavior:n})}else this.scrollToIndex(e,{align:a,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 lp=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else{if(!(a>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 ap(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,a,l,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=l.findIndex((e=>e===v.key)),t=l[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&&a({dragNode:w,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?a({dragNode:w,dropNode:S,dropPosition:0})?E=0:N=!1:0===C?f>-1.5?a({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:a({dragNode:w,dropNode:S,dropPosition:0})?E=c?1:0:a({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:a({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:a,createTableFullData:l,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,a=0)=>{const l=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:a,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,a+1)),t[s]=c,l.push(c)})),l};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("-"),a=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===a?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));l(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),a(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:l,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)),a(t)}),800)),p.current.eventKey!==o||0!==l?T({dragOverNodeKey:E,dropPosition:r,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b}):I()):I()},onNodeDragOver:(e,t)=>{if(!p.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:a,dropContainerKey:l,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:m}=cp(e,p.current,t,C,h.current,u,c,g,i,!d);-1===x.indexOf(a)&&o&&(p.current.eventKey===a&&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&&a===S.dropTargetKey&&l===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&m===S.dragOverNodeKey||T({dropPosition:n,dropLevelOffset:r,dropTargetKey:a,dropContainerKey:l,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:a,dropAllowed:l,dragOverNodeKey:o}=S;if(!l)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(a),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 a=An(n),l=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{vp(e,t)&&(l.current.isPointerDown=!0)},o=e=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:n&&l.current.isPointerDown&&vp(e,t)&&gp(e,i)&&(l.current.isPointerDown=!1,a(e))},s=e=>{l.current.ignoreEmulatedMouseEvents=!0,n&&l.current.isPointerDown&&vp(e,t)&&gp(e,i)&&(l.current.isPointerDown=!1,a(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,a,l,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:a,className:l,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:a,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=a._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(l,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:a}=e,{tableRef:l,getAllChildRowKeys:o}=t.useContext(Pd),{rowSelection:s}=l.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(!l.current.isTreeTable||i)return!1;const a=Ua(l.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==a?void 0:a.children)&&void 0!==r?r:[]),n)};return"radio"===c?(()=>{const e=s.disabled,r=null==e?void 0:e(i),l=!r&&n[0]===a;return t.createElement(q,{checked:l,disabled:r})})():(()=>{const e=s.disabled,r=null==e?void 0:e(i),l=!!n.includes(a);return t.createElement(H,{checked:l,indeterminate:d(a),disabled:r})})()},Cp=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:a,rowExpandedKeys:l,setRowExpandedKeys:o}=t.useContext(Pd),{expandable:s={}}=a.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>l.includes(r)),[l,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?l.filter((e=>e!==r)):[...l,r];o(t)},style:i})},wp=t.forwardRef(((e,n)=>{const{size:r,defaultValue:i,value:a,min:l,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)<l&&(t=l.toString()),p>=0&&""!==t&&(t=new Vt(t).toFixed(p)),t},E=void 0!==a,[C,w]=t.useState(null!=i?i:""),S=v(E?a: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),l>=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,a,l,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===(a=S.state.required.find((({x:e,y:t})=>e===u&&t===p)))||void 0===a?void 0:a.text)||"",J=(null===(l=S.state.validate.find((({x:e,y:t})=>e===u&&t===p)))||void 0===l?void 0:l.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&&le()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;re&&e&&ae(e.map((e=>({[_.current.valueKey]:e.value,[_.current.textKey]:e.text}))))}),[]);const ie=()=>{v(),b()},ae=e=>{M.current=e},le=()=>{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:le,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:a,extra:l={},rules:o=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=tl(e,i),g=Object.assign({},{minRows:1,maxRows:4},l.autoSize),v=r?{rows:g.minRows,autoSize:g}:null,b=l.password?O.Password:r?O.TextArea:O;return t.createElement(b,Cn({ref:R,size:f,value:m,maxLength:l.maxLength,showCount:l.showCount},v,{autoComplete:l.password?"new-password":"off",placeholder:l.placeholder||C("qm.table.editable.inputPlaceholder"),allowClear:l.allowClear,readOnly:l.readOnly,disabled:l.disabled,suffix:l.suffix,onChange:t=>{var n;const r=null!==(n=t.target.value)&&void 0!==n?n:"";nl(e,i,r),y(o,r,u,p),w(),null==s||s({[Y]:r}),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:a,formatType:l}=n,{type:o,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:m,onBlur:g}=T,v=tl(e,i);let b,x;return"finance"===l&&(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"===l&&(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:a,stringMode:s.stringMode,prefix:s.prefix,suffix:null!==(r=s.suffix)&&void 0!==r?r:"percent"===l?"%":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=>{nl(e,i,t),y(c,t,u,p),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"===l&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),nl(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"===l&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),null==m||m({[Y]:r},e)}})},select:(e,n,r)=>{var i;const{dataIndex:a,dictItems:l=[]}=n,{type:o,extra:s={},rules:c=[],items:d,onChange:h,onEnter:m}=T,g=d||l,v=tl(e,a);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=>{nl(e,a,t),y(c,t,u,p),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:a}=n,{type:l,extra:o={},rules:s=[],onChange:c}=T,d=r||"exactdate",h=tl(e,a);return t.createElement(En,{size:f,popupClassName:Xd.popupClassName,value:null!==(i=ol(h,Rl[d]))&&void 0!==i?i:void 0,picker:Il[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 n=sl(t,Rl[d]);nl(e,a,n),y(s,n,u,p),ce(e,u,p),null==c||c({[Y]:n},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:a,extra:l={},rules:o=[],onChange:s}=T,c="HH:mm:ss",d=tl(e,i);return t.createElement(wn,{size:f,popupClassName:Xd.popupClassName,value:null!==(r=ol(d,c))&&void 0!==r?r:void 0,format:l.format||c,placeholder:l.placeholder,allowClear:l.allowClear,disabled:l.disabled,style:{width:"100%"},onChange:t=>{const n=sl(t,c);nl(e,i,n),y(o,n,u,p),ce(e,u,p),null==s||s({[Y]:n},e),ie()}})},checkbox:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:a={},rules:l=[],onChange:o}=T,{trueValue:s=Hd,falseValue:c=Md,disabled:d}=a,h=tl(e,r);return t.createElement(H,{checked:h===s,disabled:d,onChange:t=>{const n=t.target.checked?s:c;nl(e,r,n),y(l,n,u,p),ce(e,u,p),null==o||o({[Y]:n},e),ie()}})},switch:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:a={},rules:l=[],onChange:o}=T,{trueValue:s=Hd,falseValue:c=Md,disabled:d}=a,h=tl(e,r);return t.createElement(K,{checked:h===s,disabled:d,onChange:t=>{const n=t?s:c;nl(e,r,n),y(l,n,u,p),ce(e,u,p),null==o||o({[Y]:n},e),ie()}})},"search-helper":(e,n)=>{var r;const{dataIndex:i,precision:a}=n,{type:l,extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,v=rl(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)||[],a={[i]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(oe(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a},w=e=>{const{autoQueryAssign:t=!0}=c;t&&(D.current=E(e)),j(!0)},S=(t,r)=>{const{beforeOpen:i}=c,a=(null!=i?i:Mn)({[Y]:v},e,n);(null==a?void 0:a.then)?a.then((()=>{w(t),null==r||r()})).catch((()=>{})):!1!==a&&(w(t),null==r||r())},N=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=rl(e,r))}const n=x[i]?rl(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="",n)=>{var r;if(oe(n)&&Object.keys(n).length)for(const t in n){const i=n[t],a=g.find((e=>e.dataIndex===t));if(a){nl(e,t,i,a.precision);const n=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else nl(e,t,i)}ne&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return nl(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&nl(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),nl(e,i,t,a),y(s,t,u,p),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:a}=c;if(P.current&&!$)return n&&r&&(null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=c,{beforeFetch:r=Mn}=t.fetch;return new Promise(((i,a)=>kn(void 0,void 0,void 0,(function*(){var l;const o=ye({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(o))return a();V(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(l=pe(e.data,t.fetch.dataKey))&&void 0!==l?l:[];i(n)}else a()}catch(e){a(e)}finally{jn((()=>V(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>rl(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(wa,O,t.createElement($p,k)))},"search-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:a,items:l=[],extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=tl(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=>{nl(e,i,t),y(s,t,u,p),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;ae(be([...M.current.filter((e=>t.includes(e[r]))),...e],r));const i=M.current.map((e=>({text:e[n],value:e[r]}))),a=be([...i,...l],"value").filter((e=>t.includes(e.value)));W(a),S(a.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;ae(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(wa,N,t.createElement($p,I)))},"tree-helper":(e,n)=>{var r,i;const{dataIndex:a,precision:l}=n,{type:o,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:m}=T,v=rl(e,ne?d.combinedDataIndex:a),b=d.fieldAliasMap;b||Yn("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(a)||Yn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Yn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[a].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="",n)=>{var r;if(oe(n)&&Object.keys(n).length)for(const t in n){const i=n[t],a=g.find((e=>e.dataIndex===t));if(a){nl(e,t,i,a.precision);const n=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else nl(e,t,i)}nl(e,a,t,l),y(c,t,u,p),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!==a&&(t[n]=rl(e,r))}const n=x[a]?rl(e,x[a]):"";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(wa,N,t.createElement(zp,I)))},"tree-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:a,extra:l={},items:o=[],rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=tl(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=>{nl(e,i,t),y(s,t,u,p),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;ae(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:l.placeholder||C("qm.table.editable.selectPlaceholder"),allowClear:l.allowClear,maxTagCount:l.collapseTags?"responsive":void 0,maxTagTextLength:l.maxTagTextLength,disabled:l.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!$&&x()},onDoubleClick:()=>{l.disabled||x()},onChange:e=>{const{valueKey:t}=b;ae(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:l.disabled,icon:t.createElement(Ye,null),onClick:()=>{x()}})))),t.createElement(wa,N,t.createElement(zp,I)))},custom:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:a={},rules:l=[],render:o,onChange:s}=T;if(!o)return Yn("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const c=tl(e,r),d=t=>{nl(e,r,t),y(l,t,u,p),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:a.disabled,readOnly:a.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:a}=r,l=["cell--show",{"is-cell-bg":n&&a}];return t.createElement(t.Fragment,null,t.createElement("span",{className:_e(l),style:{color:n?i:""}},e.children),n&&a&&t.createElement("i",{className:"cell--bg",style:{background:a}}))})(),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:a}=e,{t:l}=Ln();return Tp(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=zt(n,r);null==a||a(n,c),c&&i&&R.success(l("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:a,rowIndex:l,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=tl(a,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,a,i,l,o):x(w,i,a);return[e,v?t.createElement(Np,{ref:r,column:i,record:a,rowKey:s,columnKey:m},e):null]}),[h,a,w,g,v],((e,t)=>{if(y){const[,n]=e,[,r]=t;return y(r,n,a)}return!((e,t,n=!1)=>{const r=new Set;return function e(t,i,a=1){if(r.has(t))return!1;if(t===i)return!0;if(n&&a>1)return!1;r.add(t);const l=a+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],l))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],l)))}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:a,rowKey:s});if(m===Xd.selectionColumn)return t.createElement(Ep,{selectionKeys:u,column:i,record:a,rowKey:s});if(N)return N;if(d.current.isTreeTable&&m===p)return t.createElement(t.Fragment,null,(e=a._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:a,rowKey:s,style:T(a)?{}:{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:a,tableFlatData:l,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=na(((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 a=r[i].querySelectorAll("td");for(let t=0;t<a.length;t++)if(!(a[t].offsetLeft>e||a[t].offsetLeft+a[t].offsetWidth<e)){n=a[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,a]=[g.rowKey,y.rowKey];let[s,c]=[0,0];for(let e=0;e<l.length;e++){const t=i(l[e],l[e].index);if(t==r&&(s=e),t==a){c=e;break}}const d=o.slice(Math.min(t,n),Math.max(t,n)+1);return l.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:tl(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:a}=N();w({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-r,startOffsetY:e.clientY-n,containerSizeX:i,containerSizeY:a}),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,a]=[e-r,t-n],{el:l,et:o,ew:s,eh:c}=q();return!(i<l||i>l+s||a<o||a>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],[a,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<l.length;e++){const t=l[e],a=i(t,t.index);if(a==n&&(p=a,d=e),a==r){u=e;break}}const h={rowKey:p,dataIndex:o[Math.min(a,c)].dataIndex,rowSpan:u-d+1,colSpan:Math.abs(c-a+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<l.length;t++){const n=l[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:a,l:l,t:o}=y;return i=l-n>0?l-n+i:Math.abs(l-n)+e,a=o-r>0?o-r+a:Math.abs(o-r)+t,l=l>n?n:l,o=o>r?r:o,{sl:n,st:r,sw:e,sh:t,el:l,et:o,ew:i,eh:a}};return t.createElement("div",{className:`${a}--area-select`},(()=>{if(!g||!y)return null;const{sl:e,st:n,sw:r,sh:i,el:a,et:l,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:a,top:l,width:o,height:s}})))})())}));Lp.displayName="AreaSelect";const Ap=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:a,tableFlatData:l,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:ae,onNodeDragOver:le,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:a}=r.current,l=()=>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:l,estimateSize:()=>a,indexAttribute:"data-row-index",overscan:1,enabled:r.current.scrollYLoad}),c=s.getVirtualItems(),d=sp({horizontal:!0,count:n.length,getScrollElement:l,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,a,l;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!==(l=null===(a=u[s])||void 0===a?void 0:a.start)&&void 0!==l?l: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)}}})(l,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,a={};return x&&Object.assign(a,{minHeight:"100px"}),D&&Object.assign(a,{minHeight:Ja(D)-e-n+"px"}),_&&Object.assign(a,{maxHeight:Ja(_)-e-n+"px"}),P||r||i?Object.assign(Object.assign({},a),{maxHeight:"",minHeight:"",height:`${t}px`}):a}),[P,_,D,x,h]),ke=An((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:i}=re.current,{scrollTop:a,scrollLeft:l}=e;if(l!==i){G&&(t.$header.scrollLeft=l),m&&(t.$footer.scrollLeft=l);const e=l>0,n=Math.ceil(l)+h.tableWidth<h.tableBodyWidth;y!==e&&I(e),b!==n&&R(n)}a!==n&&Math.ceil(a)+h.viewportHeight>=ee.current.parentNode.offsetHeight&&A({type:"scroll",target:e,preventDefault:Hn,stopPropagation:Hn}),re.current={prevST:a,prevSL:l}})),Le=An((e=>{var t,n,a,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!==(a=f[0])&&void 0!==a?a:v)&&void 0!==o?o:null,n=null!==(c=l.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=l.length;let n=l.findIndex((e=>i(e,e.index)===Te[0]));const r=38===p?(--n+t)%t:++n%t,a=l[r],o=i(a,a.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,a))||s||w([o]),!M||(null===(u=M.disabled)||void 0===u?void 0:u.call(M,a))||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 a=l.length,o=t,s=ee.current.querySelectorAll("tbody > tr"),c=l.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===a-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,a=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),l=o.slice(0,a).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[a].width||o[a].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?l<n.current.scrollLeft+p?n.current.SET_SCROLL_LEFT(l-p):t===i-1&&n.current.SET_SCROLL_LEFT(l-(h.tableWidth-u)+m):l+u>n.current.scrollLeft+(h.tableWidth-m)?n.current.SET_SCROLL_LEFT(l-(h.tableWidth-u)+m):0===t&&n.current.SET_SCROLL_LEFT(l-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 a;const{dataIndex:l}=n;if([Xd.expandableColumn,Xd.operationColumn].includes(l))return;const o=i(t,t.index);Ke([o,l]);const s=Me(o,l),{type:c,selectByClickRow:d=!0,disabled:u=Hn}=H||{};!c||u(t)||s||(d||l===Xd.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:i=!0,onSelect:a}=H||{};if("radio"===n&&w([e]),"checkbox"===n){const n=!f.includes(e),l=r.current.isTreeTable&&!i?ze(e,f,n):Ve(e,f,n);w(l),null==a||a(n,t,l)}})(o,t),[Xd.selectionColumn].includes(l)||(!M||(null===(a=M.disabled)||void 0===a?void 0:a.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:a}=H||{},{deriveRowKeys:l,recordsMap:o}=r.current,s=Ua(l,e);let c=[],d=L((null==s?void 0:s.children)||[]);a&&(d=d.filter((e=>!o.has(e)||!a(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(i=gl(l,e))||void 0===i?void 0:i.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ua(l,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=0)=>{const{scrollYLoad:a}=r.current,o=[],s=a?e:l;return s.forEach(((e,r)=>{const c=a?l[e.index]:e,d=a?e.index:r,u=i(c,c.index);if(o.push(Be(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)))))}if(!a&&(e=>Array.isArray(e.children))(c)){const e="function"!=typeof(null==$?void 0:$.rowExpandable)||$.rowExpandable(c);g.includes(u)&&e&&o.push(...We(c.children,n+1))}})),o},Be=(e,n,i,a=0)=>{const{scrollXLoad:l}=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=(l?ve:o).map(((t,r)=>Ue(l?o[t.index]:t,l?t.index:r,e,n,i,a)));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:ae,onNodeDragOver:le,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)},Ue=(e,n,r,i,a,l)=>{var o,s,u;const{dataIndex:h,fixed:m,align:f,className:g=""}=e,{rowSpan:v,colSpan:y}=Ge(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[`${a}-${h}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:a,depth:l,showTitle:b}))},Ge=(e,t,n,r)=>{var i;let a=1,o=1;const s=z;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:l});Array.isArray(c)?(a=c[0],o=c[1]):oe(c)&&(a=c.rowSpan,o=c.colSpan);const d=null!==(i=be()[0])&&void 0!==i?i:0;if(e===l[d]&&0===a)for(let e=d;e<l.length;e++){const n=s({row:l[e],column:t,rowIndex:e,columnIndex:r,tableData:l});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;a++}}if(u.length>0){const e=u.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,o=e.colSpan)}return{rowSpan:a,colSpan:o}};return t.createElement(t.Fragment,null,t.createElement(oa,{ref:r.current.scrollBarRef,wrapClassName:`${a}--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:`${a}--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:a}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${i||a}px`,minWidth:`${i||a}px`}})})))})(),t.createElement("tbody",null,We(ge)))),!!B&&t.createElement(Lp,{ref:ne})))}));Ap.displayName="TableBody";const Pp=()=>{const{tableRef:e,prefixCls:n,sorter:r,layout:i,flattenColumns:a,leftFixedColumns:l,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,a)=>{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=l[l.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):tl(i,`${p}_text`),x=0===a&&""===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(a,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}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("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},a.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,a;const{current:l,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===(a=null===(i=null==d?void 0:d.table)||void 0===i?void 0:i.pagination)||void 0===a?void 0:a.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(l,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:l,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=ln(_d,e),{rowKey:i,columns:a,loading:l,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:a}=e,l=t.useRef({props:e,uid:Bd(),tableManager:Gd,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!a,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,l.current.props=o;const s=(e,t,r="",i="",a=0)=>e.map((e=>{const l=n(e,e.index),o=r?`${r}#${l}`:`${l}`,c=i?`${i}.${e.index+1}`:`${e.index+1}`,d={level:a,rowKey:l,rowKeyPath:o,indexPath:c};return e.indexPath=c,e._level=a,Array.isArray(e.children)&&(d.children=s(e.children,l,o,c,a+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:l},l.current),{setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Ga(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{const t=l.current.tableFullData.some((e=>Array.isArray(e.children)));l.current.isTreeTable=t,l.current.deriveRowKeys=t?s(e,""):[],l.current.flattenRowKeys=t?c(l.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollXLoad:e=>{l.current.scrollXLoad=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.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:ae,setPagination:le,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,a,l,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===(l=null===(a=null==E?void 0:E.table)||void 0===a?void 0:a.pagination)||void 0===l?void 0:l.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:at,isGroupSubtotal:lt,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:ae,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,editableColumns:je,tableFullData:k,pagination:ae,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:lt,doLayout:bt,setTableFlatData:Z,setTableFullData:P,setTableOriginData:D,setAllTableData:_,setDeriveRowKeys:F,setPagination:le,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:a,expandable:l,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(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(p.length?[p[0],""]:[]),p.__prevent__||null==e||e(p,s.current.selectionRows),Qa(p)}),[p]),Li((()=>{if(!l)return;const{onChange:e}=l;h.__prevent__||null==e||e(h,h.map((e=>s.current.recordsMap.get(e)))),Qa(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(a.selectedRowKeys);me(e,p)||N(Xa(e))}),[null==a?void 0:a.selectedRowKeys]),Li((()=>{const e=P(l.expandedRowKeys);me(e,h)||I(Xa(e))}),[null==l?void 0:l.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:ae,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:ae,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:lt,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:le,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,ae,ct,se,de,pe,ze,ge,Pe,Te,Re,Xe,Qe,ke,ot,Ge,lt,De]);((e,n)=>{const{getRowKey:r,tableRef:i,toolBoxRef:a,tableBodyRef:l,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 a=t.includes(i);return a&&(null==n||n(e,i)),!a}));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)=>{l.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?Xa([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?Xa([...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=Va(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:a}=i.current,l=(Array.isArray(e)?e:[e]).filter((e=>oe(e)));if(!l.length)return;l.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn].includes(n)||nl(e,n,tl(e,n))})),n.addToInserted(e)}));const o="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=a;if(c)o?d.unshift(...l):d.push(...l);else{const e=vl(a,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}c&&N(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),y(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=i.current,a=(Array.isArray(e)?e:[e]).map((e=>oe(e)?r(e,e.index):e));if(!a.length)return;let l=!1;const o=K(n,a,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:i,editRender:a}=r,l=null==a?void 0:a(e,r);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:n,y:i}),t.removeFromValidate({x:n,y:i}),t.removeFromEdited({x:n,y:i}))})),l=!0}));l&&(N(Object.assign({},i.current.handleState,{remove:!0})),b(o),I(p.filter((e=>!a.includes(e)))),a.includes(m)&&_(),R(h.filter((e=>!a.includes(e)))),g(),jn((()=>{S(K(i.current.tableOriginData,a))})))},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:a,editRender:l}=i,o=null==l?void 0:l(n,i);if(!o)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(a))return;const{rules:c=[],disabled:d}=o;d||w(c,tl(n,a),s,a)}))}));const{required:n,validate:a}=P(),l=[...n,...a];return l.length&&C(l[0].rowKey),A(),{required:n,validate:a}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:$e,editableColumns:je,pagination:ae,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:ae.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:at,showToolBox:v,tableColumns:Me}),t.createElement(Mu,{ref:T,columns:a}))),t.createElement(Yi,{spinning:null!=l?l: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({},ae,{onChange:(e,t)=>$t({current:e,pageSize:t})}))))}));Mp.displayName="QmTable";const $p=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:a,selectionRows:l,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=ta(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,a)),[_,F]=t.useState([]),H=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*bo[h]-30)},M=na(H,5);sn((()=>{M()}),[y.width]),Li((()=>{me(s,O)||k(s)}),[s]),t.useEffect((()=>{$()}),[P]),t.useEffect((()=>{l&&v.current.SET_SELECTION_ROWS(l)}),[l]),t.useEffect((()=>{var e;a&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(a))}),[]);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:a,beforeFetch:l=Mn}=n;if(l(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,a))&&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:a,selectionRows:l,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=ta(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,a)),[$,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=na(q,5);sn((()=>{K()}),[b.width]),Li((()=>{me(s,P)||D(s)}),[s]),t.useEffect((()=>{V()}),[H]),t.useEffect((()=>{l&&y.current.SET_SELECTION_ROWS(l)}),[l]),t.useEffect((()=>{var e;a&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(a)),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:a,beforeFetch:l=Mn}=n;if(l(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,a))&&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:a="text"}=d.fetch;try{const l=yield t(n);if(200===l.code){const t=Array.isArray(l.data)?l.data:null!==(e=pe(l.data,r))&&void 0!==e?e:[],n=Ml(t,i,a);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:a,tree:l={},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=l.fetch)||void 0===n?void 0:n.params),g={[`${Jn("tree-helper")}--wrapper`]:!0},v=l.fetch?Object.assign(Object.assign({},zn(l.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:_e(g,s),style:c},t.createElement(Ad,{multiple:a,fetch:v,fieldsDefine:{valueKey:null===(r=l.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(i=l.fetch)||void 0===i?void 0:i.textKey},autoFocus:!0,asyncLoad:l.asyncLoad,checkStrictly:l.checkStrictly,checkStrategy:l.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:l.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:a=[],table:l={},onClose:o}=e,{$size:s}=Pn(e),{t:c}=Ln(),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=ta(d),[m,f]=t.useState(l),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[C,w]=t.useState(a),[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||(l.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=l.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=na(P,5);sn((()=>{D()}),[h.width]),Li((()=>{me(a,C)||w(a)}),[a]),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:a=Mn}=n;if(a(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[a,l]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;l(t||null)}));const[o,s]=t.useState(null),c=()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:i,bottom:a,left:l}=e.getBoundingClientRect();return r>=0&&l>=0&&i<=t&&a<=n})(a)&&n&&a.scrollIntoView(i);const{left:e,top:t,width:r,height:l}=a.getBoundingClientRect(),o={left:e,top:t,width:r,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[a,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]),a]}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:a,visibleFirst:l}=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:a,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:{},a={};switch(e){case"top":case"bottom":a.shiftX=2*t.arrowOffsetHorizontal+n,a.shiftY=!0,a.adjustY=!0;break;case"left":case"right":a.shiftY=2*t.arrowOffsetVertical+n,a.shiftX=!0,a.adjustX=!0}const l=Object.assign(Object.assign({},a),i);return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,u,t,n),l&&(d.htmlRegion="visibleFirst")})),s}const th={fill:"transparent",pointerEvents:"auto"},nh=e=>{const{prefixCls:n,rootClassName:r,pos:i,showMask:a,style:l={},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"},l)},a?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:a,onPlay:l}=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==a||a():null==l||l())};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,a=window.innerHeight,l=e.clientX-$i(t).x,o=e.clientY-$i(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>i-n-1&&(s=i-n-1),c<0&&(c=0),c>a-r-1&&(c=a-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:a,title:l,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(a)?t.createElement("div",{className:`${n}-cover`},a):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`},l)),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"))))))},ah=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(ih,e))},lh={left:"50%",top:"50%",width:1,height:1},oh=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:i,current:a,onChange:l,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:a,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==l||l(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 ae=()=>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,a]=[e+n/2,t+r/2],l=new MouseEvent(M,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:a}),o=document.elementFromPoint(i,a);o&&(o.dispatchEvent(l),yield $n(null!=$?$:320))})),le="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:le,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(ah,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 ae(),ne(T-1)})),onNext:()=>kn(void 0,void 0,void 0,(function*(){yield ae(),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||lh),{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 a=ch(e);t(a),n.current=a,null==i||i({current:a})},ph=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:i,timeout:l,initialEntered:s,mountOnEnter:c,unmountOnExit:d,onStateChange:h}=e||{},[m,f]=u((()=>ch(s?2:dh(c)))),g=a(m),v=a(),[y,b]=(e=>oe(e)?[e.enter,e.exit]:[e,e])(l),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 a=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((()=>a(e+1)),0)}},l=g.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&a(t?r?0:1:2):l&&a(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:a=!0,preExit:l}=e,[o,s]=ph({timeout:i,preEnter:a,preExit:l,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),a=e.match(/x64/i);if(!t&&!n&&a)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||a)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function 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:a}=t.useContext(en),{$$preview:l}=t.useContext(fh),{state:o,isWindowsPrinter:s,pageSize:c}=l,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,a=b+t+n,l=mh.previewWidth-a<=0?0:(mh.previewWidth-a)/2,s=Math.abs((1-E)*a/2);let c=0;return E>1&&(c=s>l?-1*l:-1*s),E<1&&(c=a-2*s>mh.previewWidth?0:l>0?s:(mh.previewWidth-(a-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==a?void 0:a.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",l=null!==(r=null===(n=null==a?void 0:a.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;">',l?`<img src="${l}" 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 a=[];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 l=p.current[n],o=h.current[n];t.fixedLogo||0!==n||(e+=mh.logoHeight),e+=o,e<=r?a.push(l):(m.current.push([N(),...t.fixedLogo?[S()]:[],...a]),a=[],e=0,n-=1),n===i-1&&a.length&&m.current.push([N(),...t.fixedLogo?[S()]:[],...a])}}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>');l.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),l.doPrint(k()),yield $n(0),l.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:an("qm.print.setPanel.printParameter")},{type:"SELECT",label:an("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:an("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:an("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:an("qm.print.setPanel.vertical"),value:"vertical"},{text:an("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:an("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:an("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:an("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:an("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("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:an("qm.print.setPanel.sizeUnit"),disright:an("qm.print.setPanel.sizeUnit"),distop:an("qm.print.setPanel.sizeUnit"),disbottom:an("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}},an("qm.dialog.close")),t.createElement(Xn,{type:"primary",onClick:()=>this.confirmHandle()},an("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:a,printerType:l,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(a),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"===l&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(an("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(an("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:an("qm.print.laserPrinter"),value:"laser"},{text:an("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=yh(),t=[{text:an("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:a,totalPage:l,printPage:o}=this.state,s=Jn("print-preview"),c={visible:r,title:an("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,an("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,an("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,an("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,an("qm.print.printPage.0"),t.createElement($,{value:o,min:1,max:l,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),an("qm.print.printPage.1")),t.createElement("span",null,t.createElement(Q,{size:"small",current:a,pageSize:1,total:l,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})},an("qm.print.setting"))),t.createElement("span",null,t.createElement(Xn,{type:"text",icon:t.createElement(Ve,null),className:"text-btn",onClick:()=>this.exportClickHandle()},an("qm.print.export"))),t.createElement("span",null,t.createElement(Xn,{icon:t.createElement(at,null),type:"primary",onClick:this.printClickHandle},an("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,an("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,an("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,an("qm.print.pageNumber"),":",an("qm.print.pagination",{currentPage:a,totalPage:l}))))),t.createElement(wa,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:a,closeAfterPrint:l}=this.props,o={visible:e,title:an("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:a,closeAfterPrint:l,onClose:()=>{this.setState({visible:!1})}};return a?t.createElement(wa,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:a,shape:l}=this.props,o={size:n||this.context.size||"",type:i,shape:l,icon:r,loading:e,disabled:a,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,a=!1;for(;i;){const e=Th(i);if(r.push(e),i=Nh(i),a)break;i&&Sh(i)===t&&(a=!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(!xl(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(at,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),a=5;let l;l=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+a:e.top+e.height+a:e.top-r<=t.top+t.height?e.top-r-a<t.top+a?t.top+a:e.top-r-a:t.top+t.height-r-a;let o=e.left+a;e.left<t.left&&(o=t.left+a);e.left+i>t.left+t.width&&(o=t.left+t.width-i-a);return l+="px",o+="px",{style:{top:l,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:a}=e,{t:l}=Ln();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},l("qm.table.config.emptyText")),t.createElement(Zn,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(Xn,{size:"small",onClick:()=>null==i?void 0:i()},l("qm.guideTracker.closeButton")),t.createElement(Xn,{size:"small",onClick:()=>null==r?void 0:r()},l("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(Xn,{size:"small",onClick:()=>null==a?void 0:a()},l("qm.guideTracker.finishButton"))))},Kh={left:"50%",top:"50%",width:1,height:1},Vh=t.forwardRef(((e,n)=>{const{open:r,current:i,defaultCurrent:a,steps:l=[],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(l.length),[S,N]=Zd(0,{value:i,defaultValue:a}),[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>=l.length?"add":"edit"),[S,l]),W=t.useMemo((()=>`${S+1} / ${l.length}`),[S,l]);t.useLayoutEffect((()=>{E.current=new $h({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:cl(),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=l.length}),[l]);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:()=>l.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Xt,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.id)),n=l.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(bl(e),i)}},l.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(l,n))}},e.title),t.createElement(w,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=l.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?[...l,{id:k.id,selector:k.path,title:"Guide Title"}]:[...l],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,a,l,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!==(a=f.fontStyle)&&void 0!==a?a:"normal",k=null!==(l=f.fontFamily)&&void 0!==l?l:"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),a=r*n,l=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(a/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,a,l),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,a=e.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};e.useLayoutEffect((()=>(l(),i&&t.current&&(a.current=new MutationObserver(n),a.current.observe(t.current,r)),()=>l())),[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:a,elements:l}=function(e){const t=Yh(e);let n=Wh.get(t);if(!n){const r=new Map;let i=[];const a=new IntersectionObserver((t=>{t.forEach((t=>{var n;const a=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=a),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(a,t)}))}))}),e);i=a.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:a,elements:r},Wh.set(t,n)}return n}(n),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),a.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),a.unobserve(e)),0===l.size&&(a.disconnect(),Wh.delete(i))}}const Qh=e=>{const{forceRender:n,height:r,placeholder:i=null,unmountIfInvisible:a,className:l,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:i,fallbackInView:a,trackVisibility:l,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:l,delay:s},a),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,i,o,l,a,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:!a}));t.useEffect((()=>{r||Yn("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[Jn("lazy-load")]:!0};return t.createElement("div",{ref:s,className:_e(u,l),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,a=t.x-n.x,l=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+i*i),p=Math.sqrt(a*a+l*l),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,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,a=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=a-e,i=l-t;n+=Math.sqrt(r*r+i*i)}e=a,t=l}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,a=i.length>0&&i[i.length-1],l=!!a&&n.distanceTo(a)<=this.minDistance,o=this._getPointGroupOptions(r);if(!a||!a||!l){const e=this._addPoint(n,o);t&&(a?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 a=n/i,l=a*a,o=l*a,s=1-a,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*a*e.control1.x,u+=3*s*l*e.control2.x,u+=o*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*a*e.control1.y,p+=3*s*l*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),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a},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)),a=Math.min(r,t),l=Math.min(i,n),o=.5*(Math.max(r,t)-a),s=.5*(Math.max(i,n)-l),c=a+o,d=l+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},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)),a=180*Math.atan2(n-i,t-r)/Math.PI,l=(a+25)*Math.PI/180,o=(a-25)*Math.PI/180,s=15*Math.cos(l),c=15*Math.sin(l),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,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,a=[];return a[0]=i[4*(n*r+t)],a[1]=i[4*(n*r+t)+1],a[2]=i[4*(n*r+t)+2],a[3]=i[4*(n*r+t)+3],a},this.setAxisColor=(e,t,n,r)=>{const i=e.width,a=e.data;a[4*(n*i+t)]=r[0],a[4*(n*i+t)+1]=r[1],a[4*(n*i+t)+2]=r[2],a[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,a=r.height,l=i/this.degreeOfBlur,o=a/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let i=0;i<this.degreeOfBlur;i++)for(let a=0;a<this.degreeOfBlur;a++)this.setAxisColor(r,t*this.degreeOfBlur+a,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,a=e.target.innerText,l=[];let o="";for(let e=0;e<a.length;e++){const t=o+a[e];this.ctx.measureText(t).width>i&&o.length>0?(l.push(o),o=a[e]):o=t}l.push(o),l.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,a=0,l=null;const o=()=>{a=Date.now(),l=null,n=e.apply(r,i),l||(r=null,i=[])};return function(...s){const c=Date.now(),d=t-(c-a);return r=this,i=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),a=c,n=e.apply(r,i),l||(r=null,i=[])):l||(l=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}em.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),i=r.length,a=new Uint8Array(i);for(let e=0;e<i;++e)a[e]=r.charCodeAt(e);return new Blob([a],{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"})),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:"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"})),lm=t.forwardRef(((e,n)=>{const{open:r,width:i,height:a,imageName:l,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!=a?a: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,l]=[null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=a?a: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),l&&l!==s&&(y.current.height=l,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=l?l.slice(0,l.lastIndexOf(".")>0?l.lastIndexOf("."):void 0):h().format(qd);sa(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(am,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))))))}));lm.displayName="QmSignature";const om=t.createContext(void 0),sm=e=>{const{prefixCls:n,flatColumns:r,tableData:i}=e,[a,l]=t.useState({prefixCls:n,viewMode:"table",size:"middle",columns:r,gridData:i,originGridData:i,groupGridData:[],groupList:[],filterList:[],sorterList:[],expandedKeys:[]}),o=e=>{l((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const a=i;Object.is(t[a],e[a])||(n[a]=e[a],r=!0)})),r?n:t}))},s=e=>{o({columns:e})},c=e=>{o({gridData:e})},d=e=>{o({groupGridData:e})},u=e=>{o({groupList:e})},p=e=>{o({filterList:e})},h=e=>{o({sorterList:e})},m=e=>{o({expandedKeys:e})},f=t.useMemo((()=>Object.assign(Object.assign({},a),{setContext:o,setColumns:s,setGridData:c,setGroupGridData:d,setGroupList:u,setFilterList:p,setSorterList:h,setExpandedKeys:m})),[a]);return t.createElement(om.Provider,{value:f},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:a,renderWidth:l}=e[r];if(i===t)break;n+=a||l||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 a=mm(e[r],i);return n.concat(a)}),[]),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=()=>{const{prefixCls:e,groupList:n,columns:r,gridData:i,setGroupList:a,setExpandedKeys:l,setGroupGridData:o}=cm(),{t:s}=Ln(),c=t.useRef([]),d=t.useRef([]),u=t.useMemo((()=>n.filter((e=>e.fieldName&&e.order))),[n]),p=t.useMemo((()=>r.map((e=>({label:e.title,value:e.dataIndex,disabled:n.some((t=>t.fieldName===e.dataIndex))})))),[n,r]),h=t.useMemo((()=>{const e=u.map((e=>({[e.fieldName]:e.order})));return me(e,c.current)?c.current:(c.current=e,e)}),[u]),m=[{label:"选项顺序",value:"ascend"},{label:"选项倒叙",value:"descend"}];Li((()=>{l(d.current)}),[u.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,a=Object.keys(t[0])[0],l=t.slice(1),o=Object.groupBy(e,(e=>n(e,a))),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],l)})),c};return r(e,t)})(i,h,((e,t)=>{var n,i,a;const{dictItems:l,precision:o}=r.find((e=>e.dataIndex===t))||{},s=tl(e,t);let c=null!==(a=null!==(i=null===(n=null==l?void 0:l.find((e=>e.value==s)))||void 0===n?void 0:n.text)&&void 0!==i?i:s)&&void 0!==a?a:"";return Array.isArray(s)&&(c=s.map((e=>{var t,n;return null!==(n=null===(t=null==l?void 0:l.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),o>=0&&""!==c&&(c=il(c)?new Vt(c).toFixed(o):c),c||"(内容为空)"}));var t;o(e),t=mm(e),d.current=t}),[h,i]);const f=()=>{a([...n,{fieldName:"",order:"ascend"}])},g=(e,t,r)=>{Object.assign(t,{[e]:r}),a([...n])},v=e=>t.createElement(t.Fragment,null,t.createElement(Ge,{className:"icon handle"}),t.createElement(F,{value:e.fieldName||null,placeholder:s("qm.table.editable.selectPlaceholder"),options:p,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(F,{value:e.order,options:m,placeholder:s("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{a(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,"设置分组条件"),!!u.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>l([])},"折叠所有"),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>l(d.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)||a(e)}},n.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(ht,{className:"icon"}),"添加条件"))),className:_e("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Rt,{className:"icon"}),"分组",u.length?`(${u.length})`:null))},vm=()=>{const{prefixCls:e,originGridData:n,columns:r,filterList:i,setFilterList:a,setGridData:l}=cm(),{t:o}=Ln(),s=t.useMemo((()=>i.filter((e=>e.fieldName&&e.expression))),[i]),c=t.useMemo((()=>r.filter((e=>!!e.filter)).map((e=>({label:e.title,value:e.dataIndex})))),[r]),[d,u]=t.useState("and");Li((()=>{a(i.map((e=>Object.assign(Object.assign({},e),{logic:d}))))}),[d]);const p=()=>{const e=hl(s.map((e=>Object.assign(Object.assign({},zn(e,["value"])),{condition:e.value}))));l(e?Ma(n,e):n)},h=[{label:"满足所有条件",value:"and"},{label:"满足任一条件",value:"or"}],m=e=>{let t=[];if(!e)return[];switch(e){case"date":case"number":t=[{value:">",label:o("qm.table.highSearch.gtText")},{value:"<",label:o("qm.table.highSearch.ltText")},{value:">=",label:o("qm.table.highSearch.gteText")},{value:"<=",label:o("qm.table.highSearch.lteText")},{value:"==",label:o("qm.table.highSearch.eqText")},{value:"!=",label:o("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:o("qm.table.highSearch.inText")},{value:"nin",label:o("qm.table.highSearch.ninText")},{value:"==",label:o("qm.table.highSearch.eqText")},{value:"!=",label:o("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:o("qm.table.highSearch.likeText")},{value:"==",label:o("qm.table.highSearch.eqText")},{value:"!=",label:o("qm.table.highSearch.neqText")}]}return t},f=()=>{a([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:d}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),"fieldName"===e&&Object.assign(t,{type:r.find((e=>e.dataIndex===n)).filter.type,expression:"",value:""}),a([...i])},v=e=>t.createElement(t.Fragment,null,t.createElement(F,{value:e.fieldName||null,options:c,placeholder:o("qm.table.editable.selectPlaceholder"),style:{width:160},onChange:t=>g("fieldName",e,t)}),t.createElement(F,{value:e.expression||null,placeholder:o("qm.table.editable.selectPlaceholder"),options:m(e.type),style:{width:100,margin:"0 10px"},onChange:t=>g("expression",e,t)}),y(e),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)})),y=e=>{var n,i;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{g("value",e,Kn(t)?"":t)}});case"date":return t.createElement(En,{popupClassName:Xd.popupClassName,defaultValue:null!==(n=ol(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{g("value",e,sl(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:o("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{g("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=>{g("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,"设置筛选条件"),!!s.length&&t.createElement(F,{value:d,options:h,style:{width:130},onChange:e=>u(e)})),t.createElement("div",{className:"list"},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(ht,{className:"icon"}),"添加条件"),t.createElement(Xn,{type:"primary",size:"small",onClick:p},"确定"))),className:_e("action-btn",{active:!!s.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Ot,{className:"icon"}),"筛选",s.length?`(${s.length})`:null))},ym=()=>{const{prefixCls:e,columns:n,gridData:r,sorterList:i,setSorterList:a,setGridData:l}=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;l((e=s,r.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:i}=r,a=tl(t,e),l=tl(n,e),o=u(a,l);if(0!==o)return"ascend"===i?o:-o}return 0})).slice(0)))},h=()=>{a([...i,{fieldName:"",order:"ascend"}])},m=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...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=>{a(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)||a(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))},bm=()=>{const{prefixCls:e,gridData:n}=cm(),[r,i]=t.useState(!1),a=e=>{e.target.value.trim();for(let e=0;e<n.length;e++);};return t.createElement(M,{open:r,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:()=>i(!1)},t.createElement(Xe,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(O,{autoFocus:!0,style:{width:280},suffix:t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon"},t.createElement(It,null)),t.createElement("span",{className:"num"},"1 / 8"),t.createElement("button",{className:"button-icon"},t.createElement(Tt,null))),onChange:a}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>i(!r)},t.createElement(ut,{className:"icon"}),"查找"))},xm=()=>{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]),a=()=>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:()=>a(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(ot,{className:"icon"}),"字段管理"))},Em=()=>{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"}),"行高"))},Cm=()=>t.createElement("div",{className:"top-bar"},t.createElement(Zn,{size:4},t.createElement(dm,null),t.createElement(ee,{type:"vertical"}),t.createElement(xm,null),t.createElement(gm,null),t.createElement(vm,null),t.createElement(ym,null),t.createElement(ee,{type:"vertical"}),t.createElement(Em,null),t.createElement(bm,null))),wm=t.createContext(void 0),Sm=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(Sm)):0,Nm=e=>{const{scrollbar:n}=e,{groupGridData:r}=cm(),[i,a]=t.useState({scrollbarRef:n,selectionKeys:[],countMethod:{},summationData:{}}),l=t.useMemo((()=>{const e=Sm(r);return Math.max(0,e-1)}),[r]),o=e=>{a((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const a=i;Object.is(t[a],e[a])||(n[a]=e[a],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:l,setContext:o,setSelectionKeys:s,setCountMethod:c,setSummationData:d})),[i,l]);return t.createElement(wm.Provider,{value:u},e.children)},Tm=()=>t.useContext(wm),Im=e=>{var n;const{column:r}=e,{columns:i,setColumns:a}=cm(),{scrollbarRef:l}=Tm(),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=()=>{l.current.container.style.cursor="",r.width=u.current.columnWidth,a([...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(),l.current.container.style.cursor="col-resize";const t=Za(e.target,l.current.container).left-l.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=l.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},Rm=()=>{const{tableRef:e}=t.useContext(Pd),{columns:n}=cm(),{indentDepth:r,selectionKeys:i,setSelectionKeys:a}=Tm(),{allRowKeys:l}=e.current,{selectionColumn:o}=Xd,{indentWidth:s}=um,c=t.useMemo((()=>pm(n)),[n]),d=t.useMemo((()=>i.length===l.length),[i]),u=t.useMemo((()=>i.length>0&&i.length<l.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:a,renderWidth:l}=e,o=(a||l)+(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 a(t?l:[]);var t}}),i!==o&&t.createElement(Im,{column:e}))}))))))},Om=e=>{const{records:n}=e,{getRowKey:r}=t.useContext(Pd),{columns:i}=cm(),{indentDepth:a,selectionKeys:l,setSelectionKeys:o}=Tm(),{renderText:s,getTitleFromCellNode:c}=ou(),{selectionColumn:d}=Xd,u=t.useMemo((()=>pm(i)),[i]),p=(e,n,r,i,p)=>{const{dataIndex:h,width:m,renderWidth:f,align:g,fixed:v,render:y}=e,b=tl(r,h),x=y?y(b,r,e,i,n):s(b,e,r),E=c(x),C=l.includes(p),w={"selection-column":h===d,"col--center":"center"===g,"col--right":"right"===g,"col--fix-left":"left"===v},S={width:`${m||f}px`,minWidth:`${m||f}px`,left:"left"===v?`${hm(u,h)+a*(um.indentWidth+1)}px`:""};return t.createElement("div",{key:h,"data-col-index":n,title:E,className:_e("table-cell",w),style:S},h!==d?t.createElement("span",{className:"cell"},x):t.createElement(t.Fragment,null,t.createElement("span",{className:"order"},i+1),t.createElement(H,{className:"checkbox",checked:C,onChange:e=>{return t=e.target.checked,n=p,void o(t?[...l,n]:l.filter((e=>e!==n)));var t,n}})))};return t.createElement("div",{className:"grid-list"},n.map(((e,n)=>{const i=r(e,e.index),a={"row--selection":l.includes(i)};return t.createElement("li",{key:i,"data-row-key":i,className:_e("table-row",a)},u.map(((t,r)=>p(t,r,e,n,i))))})))},km=e=>{const{column:n,keyPath:r,type:i}=e,{prefixCls:a}=cm(),{summationData:l,countMethod:o,setCountMethod:s}=Tm(),{dataIndex:c}=n,[d,u]=t.useState(!1),p=t.useMemo((()=>[{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}]),[]),h=t.useMemo((()=>{var e,t,n;const a=o[c];if(!a)return"统计";return`${p.find((e=>e.value===a)).text} ${null!==(n=null===(t=null===(s=l,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}),[l,o]);return t.createElement(M,{open:d,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},p.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}),u(!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:`${a}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>u(e)},t.createElement("span",null,h," ",t.createElement(He,{className:"icon"})))},Lm=e=>{const{dataKey:n,dataKeyPath:r,depth:i,className:a,style:l}=e,{columns:o,expandedKeys:s,setExpandedKeys:c}=cm(),{indentDepth:d}=Tm(),{selectionColumn:u}=Xd,p=t.useMemo((()=>pm(o)),[o]),h=t.useMemo((()=>s.includes(r)),[s,r]),m=(e,a)=>{const{dataIndex:l,width:o,renderWidth:m,fixed:f}=e,g=(o||m)+(1===a?(d-i)*(um.indentWidth+1):0),v={"expandable-column":l===u,"col--fix-left":"left"===f},y={width:`${g}px`,minWidth:`${g}px`,left:"left"===f?`${hm(p,l)+i*(um.indentWidth+1)}px`:""};return t.createElement("div",{key:l,className:_e("label-cell",v),style:y},l!==u?t.createElement(t.Fragment,null,1===a&&t.createElement("span",{className:"title"},n.slice(1)),t.createElement(km,{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,a),style:l},t.createElement("li",{className:"label-row"},p.map(((e,t)=>m(e,t)))),t.createElement("div",{style:{display:h?"block":"none"}},e.children))},Am=()=>{const{groupGridData:e}=cm(),n=(e,r="",i=0)=>{const a=oe(e)&&!Array.isArray(e);return t.createElement(t.Fragment,null,a?Object.keys(e).map((a=>{const l=r?`${r}.${a}`:a;return t.createElement(Lm,{key:a,dataKey:a,dataKeyPath:l,depth:i},Array.isArray(e[a])?t.createElement(Om,{records:e[a]}):n(e[a],l,i+1))})):t.createElement(Om,{records:e}))};return t.createElement("div",{className:"body"},n(e))},Pm=()=>{const{columns:e,groupGridData:n}=cm(),{indentDepth:r,countMethod:i,setSummationData:a}=Tm(),{selectionColumn:l}=Xd,{indentWidth:o}=um,s=t.useMemo((()=>pm(e)),[e]);Li((()=>{a(((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 a={},l={};Object.keys(t).forEach((e=>{l[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>Vn(e,n)||0));e[n]=t[n](r),l[n].push(...r)}a[r]={subtotal:e}}else{const e=i(o);a[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&l[n].push(t)}}}if(0===n.length)return a;const o={};for(const e in t)o[e]=t[e](l[e]);return a.subtotal=o,a},a=Array.isArray(e)?{total:r(e)}:i(e);return n.length>0&&(a.total=r(n)),delete a.subtotal,a})(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:a,renderWidth:l}=e,c=(a||l)+(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:a}=e,c={"selection-column":i===l,"col--right":!0,"col--fix-left":"left"===a},d={left:"left"===a?`${hm(s,i)+(n>1?r*(o+1):0)}px`:""};return t.createElement("td",{key:i,className:_e("table-cell",c),style:d},i!==l?t.createElement(km,{column:e,keyPath:"",type:"total"}):null)}))))))},Dm=()=>{const{prefixCls:e,size:n}=cm(),r=t.useRef(null);return t.createElement(Nm,{scrollbar:r},t.createElement(oa,{ref:r,className:_e(`${e}__layout`,n)},t.createElement(Rm,null),t.createElement(Am,null),t.createElement(Pm,null)))},_m=()=>{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)),[]),a=Jn("pivot-grid");return t.createElement("div",{className:`${a}__main`},t.createElement(sm,{prefixCls:a,flatColumns:i,tableData:r},t.createElement(Cm,null),t.createElement("div",{className:"wrapper"},t.createElement(Dm,null))))};_m.displayName="PivotGrid";const Fm=t.forwardRef(((e,n)=>{const{dataIndex:r,className:i,style:a}=e;return t.createElement("li",{ref:n,"data-index":r,className:_e("list-item",i),style:a},e.children)}));Fm.displayName="ListItem";const Hm=t.forwardRef(((e,n)=>{var r,i;const{dataSource:a=[],height:l,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,p=t.useRef(null),h=sp({count:a.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(oa,{ref:p,className:_e(f,u),style:Object.assign(Object.assign({},e.style),{height:l,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(Fm,{ref:h.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(a[e.index],e.index)))))))}));Hm.displayName="VirtualList";const Mm="1.11.4";export{xn as Calendar,En as DatePicker,va as DcpAnchor,Xn as DcpButton,Oi as DcpCollapse,In as DcpConfigProvider,Ip as DcpCopyToClipboard,Ui as DcpCountup,Ed as DcpCropper,er as DcpDivider,ha as DcpDownload,xa as DcpDrawer,Gi as DcpEmpty,rd as DcpForm,Vh as DcpGuideTracker,Qh as DcpLazyLoad,wa as DcpModal,_m as DcpPivotGrid,wh as DcpPrint,Up as DcpRangeTableHelper,oa as DcpScrollbar,$p as DcpSearchHelper,Ad as DcpSearchTree,lm as DcpSignature,Zn as DcpSpace,Yi as DcpSpin,Bi as DcpSplit,Mp as DcpTable,ba as DcpTabs,xd as DcpTinymce,oh as DcpTour,hh as DcpTransition,zp as DcpTreeHelper,Vp as DcpTreeTableHelper,pa as DcpUploadFile,wd as DcpUploadImg,Hm as DcpVirtualList,zh as DcpWatermark,va as QmAnchor,Xn as QmButton,Oi as QmCollapse,In as QmConfigProvider,Ip as QmCopyToClipboard,Ui as QmCountup,Ed as QmCropper,er as QmDivider,ha as QmDownload,xa as QmDrawer,Gi as QmEmpty,rd as QmForm,Vh as QmGuideTracker,Qh as QmLazyLoad,wa as QmModal,_m as QmPivotGrid,wh as QmPrint,Up as QmRangeTableHelper,oa as QmScrollbar,$p as QmSearchHelper,Ad as QmSearchTree,lm as QmSignature,Zn as QmSpace,Yi as QmSpin,Bi as QmSplit,Mp as QmTable,ba as QmTabs,xd as QmTinymce,oh as QmTour,hh as QmTransition,zp as QmTreeHelper,Vp as QmTreeTableHelper,pa as QmUploadFile,wd as QmUploadImg,Hm as QmVirtualList,zh as QmWatermark,wn as TimePicker,to as pinyin,Mm as version};
1
+ import*as e from"react";import t,{createContext as n,version as r,isValidElement as i,useRef as a,useLayoutEffect as l,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 ae from"antd/es/locale/en_GB";import{isArray as le,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 at,ImportOutlined as lt,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,CreditCardOutlined 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 an=(...e)=>{const[t,n]=e;let r;const i=t.split(".");let a=nn;for(let e=0,t=i.length;e<t;e++){if(r=a[i[e]],e===t-1)return rn(r,n);if(!r)return"";a=r}return""},ln=(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 a=n[i],l=t;if(a.includes("wo")||a.includes("Wo")){for(var o=l.split("-")[0],s=l.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(l,a).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:ae},[tn.name]:{qm:tn,antd:ie}},In=e=>{const n=ln({locale:"zh-cn",size:"middle"},e),{locale:r,size:i,global:a}=n;t.useMemo((()=>{return e=Object.assign({},Tn,null==a?void 0:a.langPackage)[r].qm,nn=e||nn,void(nn.name&&h.locale(nn.name));var e}),[r]);const l=t.useMemo((()=>Object.assign({},Tn,null==a?void 0:a.langPackage)),[a]),[o,s]=t.useState({locale:r,size:i,global:a});return sn((()=>{s((e=>Object.assign({},e,{locale:r,size:i})))}),[i,r]),t.createElement(en.Provider,{value:o},t.createElement(x,{locale:l[o.locale].antd,componentSize:o.size,autoInsertSpaceInButton:null==a?void 0:a.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,a=arguments.length,l=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(l=(a<3?i(l):a>3?i(t,n,l):i(t,n))||l);return a>3&&l&&Object.defineProperty(t,n,l),l}function kn(e,t,n,r){return new(n||(n=Promise))((function(i,a){function l(e){try{s(r.next(e))}catch(e){a(e)}}function o(e){try{s(r.throw(e))}catch(e){a(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(l,o)}s((r=r.apply(e,t||[])).next())}))}function Ln(){const{locale:t}=e.useContext(en);return{t:an,$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||le(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)||le(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const i=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(i||e,((n,a)=>{i&&(a=n),r[a]=Wn(e[a],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:a,confirm:l}=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"),a=n.includes("ctrl"),l=n.includes("shift"),o=n[n.length-1];i&&!e.altKey||a&&!e.ctrlKey||l&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),h.disabled||null===(t=h.onClick)||void 0===t||t.call(h,e))})),p=ce(a)?{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 l?t.createElement(w,{title:l.title||o("qm.button.confirmTitle"),disabled:h.disabled,onConfirm:e=>{var t,n;null===(t=l.onConfirm)||void 0===t||t.call(l),null===(n=h.onClick)||void 0===n||n.call(h,e)},onCancel:e=>{var t;null===(t=l.onCancel)||void 0===t||t.call(l,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:a=!0,disabled:l,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=Pn(e),{t:p}=Ln(),h=Jn("divider"),m={[h]:!0,[`${h}-borderless`]:!a,[`${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:l,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 ar(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 lr(e,t,n){return(t=ar(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){lr(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,a,l,o=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.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&&(l=n.return(),Object(l)!==l))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"),a=Symbol.for("react.profiler"),l=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 a: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 l:return g;default:return m}}case n:return m}}}e=Symbol.for("react.module.reference");var g=o,v=l,y=t,b=c,x=r,E=h,C=p,w=n,S=a,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)===l},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)===a},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===a||t===i||t===d||t===u||t===m||"object"==typeof t&&null!==t&&(t.$$typeof===h||t.$$typeof===p||t.$$typeof===l||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={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[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,ar(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],a=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[i,function(e,t){t&&n.current||a(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 a=n[i];if(Object.prototype.hasOwnProperty.call(t,a)&&a in Ur)return Yr[e]=t[a],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=a(),r=a(t);r.current=t;var i=e.useCallback((function(e){r.current(e)}),[]);function l(e){e&&(e.removeEventListener(ti,i),e.removeEventListener(ei,i))}return e.useEffect((function(){return function(){l(n.current)}}),[]),[function(e){n.current&&n.current!==e&&l(n.current),e&&e!==n.current&&(e.addEventListener(ti,i),e.addEventListener(ei,i),n.current=e)},l]},ii=qr()?l:o,ai=function(e){return+setTimeout(e,16)},li=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(ai=function(e){return window.requestAnimationFrame(e)},li=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=ai((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),li(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),a=i[0],l=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 a=di((function(){i<=1?r({isCanceled:function(){return a!==t.current}}):e(r,i-1)}));t.current=a},n]}(),s=dr(o,2),c=s[0],d=s[1];var u=n?pi:ui;return ii((function(){if(a!==_r&&a!==$r){var e=u.indexOf(a),t=u[e+1],n=r(a);n===hi?l(t,!0):t&&c((function(e){function r(){e.isCanceled()||l(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,a]),e.useEffect((function(){return function(){d()}}),[]),[function(){l(Fr,!0)},a]};var vi=function(t){var n=t;"object"===ir(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var i=t.visible,l=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=a(),v=a();var y=function(t,n,r,i){var l=i.motionEnter,s=void 0===l||l,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=a(!1),M=a(null);function $(){return r()}var j=a(!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 lr(t={},Fr,f),lr(t,Hr,y),lr(t,Mr,E),t;case Pr:return lr(n={},Fr,g),lr(n,Hr,b),lr(n,Mr,C),n;case Dr:return lr(r={},Fr,v),lr(r,Hr,x),lr(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,l,(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:l});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={},lr(R,k,k&&O),lr(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),a=0;a<t;a++)n[a]=arguments[a];return lr(Ir(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),lr(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,a=i.component,l=i.children,o=i.onVisibleChanged,s=i.onAllRemoved,c=br(i,Ni),d=a||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,a=br(r,Ti),c=i===bi||i===xi;return e.createElement(n,yi({},u,{key:a.key,visible:c,eventProps:a,onVisibleChanged:function(e){(null==o||o(e,{key:a.key}),e)||0===t.removeKey(a.key)&&s&&s()}}),l)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,i=Si(n),a=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,a=Si(e),l=Si(t);a.forEach((function(e){for(var t=!1,a=r;a<i;a+=1){var o=l[a];if(o.key===e.key){r<a&&(n=n.concat(l.slice(r,a).map((function(e){return sr(sr({},e),{},{status:bi})}))),r=a),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(l.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:a.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}();lr(r,"defaultProps",{component:"div"})}(Jr);const Ri=t.forwardRef(((e,n)=>{const{forceRender:r,className:i,style:a,boxStyle:l,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:a},t.createElement("div",{className:`${d}-content-box`,style:l},e.children))}));Ri.displayName="PanelContent";const Oi=e=>{const{defaultActive:n,label:r,extra:i,className:a,style:l,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},a);return t.createElement("div",{className:g,style:l},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:a,direction:l}=t.useContext(ki),{t:o}=Ln(),s=t.useRef(Dn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===l),[l]),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 a=u.current[`firstElementSize${d}`]+t;a=Math.max(r[0],a),a=Math.min(r[1],a),i(a)},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"===l,horizontal:"horizontal"===l};return t.createElement("div",{className:_e(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=a.current,n=t.children[0];p({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),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:a}=e,{direction:l,dragging:o}=t.useContext(ki),s="vertical"===l?"height":"width",c={[Jn("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===l,vertical:"vertical"===l,[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),a)},e.children)}));Wi.displayName="SplitPane";const Bi=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:i,className:a,style:l,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,a),style:l},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),a=Jn("countup"),l={[a]:!0,[`${a}--lg`]:"large"===i,[`${a}--sm`]:"small"===i};return t.createElement(Pt,Cn({},e,{className:_e(l,n),style:r}),e.children)};Ui.displayName="QmCountup";const Gi=e=>{const{className:n}=e,{$size:r}=Pn(e),i=Jn("empty"),a=Object.assign(Object.assign({},e),{image:N.PRESENTED_IMAGE_SIMPLE}),l={[i]:!0,[`${i}--lg`]:"large"===r,[`${i}--sm`]:"small"===r};return t.createElement(N,Cn({},a,{className:_e(l,n)}))};Gi.displayName="QmEmpty";const Yi=e=>{const n=ln({tip:"Loading..."},e),{fullHeight:r,className:i,style:a}=n,l=Jn("spin"),o={[l]:!0,[`${l}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:_e(o,i)},zn(n,["fullHeight"])),{style:Object.assign(Object.assign({},a),{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 ea(e,t){Qi.has(e)&&(Qi.get(e).delete(t),Qi.get(e).size||(Zi.unobserve(e),Qi.delete(e)))}function ta(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&&ea(e,n)}}),[t]),n}function na(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 ra=6,ia={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"}},aa=e=>{const{thumb:n,always:r,className:i,barSize:a=ra,direction:l="vertical",onDrag:o=Hn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(Xi),u=ia[l],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"===l,"is-horizontal":"horizontal"===l},R={[u.reverse]:a},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])})}})))},la=20,oa=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:i,innerStyle:a,barWidth:l,always:o,native:s,showTopScrollbar:c,minSize:d=la,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=ta(p),C=ta(m);sn((()=>{!s&&w()}),[C.width,C.height,E.width,E.height]);const w=na((()=>{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),a=Math.max(r,d),l=n/(e-n)/(i/(e-i)),o=r/(t-r)/(a/(t-a)),s=i+4<e?i:0,c=a+4<t?a:0,u=100*h.current.scrollTop/e*l,p=100*h.current.scrollLeft/t*o;g(Object.assign({},f,{size:c,ratio:o,offset:p})),y(Object.assign({},v,{size:s,ratio:l,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,a=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollTop=r+(t-r)*Vi(l),i(a)):e.scrollTop=t};i(a)})(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,a=()=>{const l=(Date.now()-n)/500;l<1?(e.scrollLeft=r+(t-r)*Vi(l),i(a)):e.scrollLeft=t};i(a)})(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:a},e.children)),!s&&t.createElement(Xi.Provider,{value:I},c&&t.createElement(aa,{className:"top",direction:"horizontal",thumb:f,barSize:l,always:o,onDrag:S}),t.createElement(aa,{direction:"horizontal",thumb:f,barSize:l,always:o,onDrag:S}),t.createElement(aa,{direction:"vertical",thumb:v,barSize:l,always:o,onDrag:S})))}));oa.displayName="QmScrollbar";const sa=(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}},ca=(e,{fileName:t,headers:n,params:r})=>kn(void 0,void 0,void 0,(function*(){const i=r?new URLSearchParams(r).toString():"",a=i?e.includes("?")?"&":"?":"",l=yield fetch(e+`${a+i}`,{method:"GET",headers:n});if(!l.ok)throw new Error(an("qm.download.error"));const o=yield l.blob(),s=l.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));sa(o,c)})),da=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},ua=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},pa=e=>{var n,r;const i=ln({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:a=[],fileDirection:l="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=[...a],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:a[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 ca(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"===l};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:a=[],fileSize:l,maxCount:o,fileList:s=[],beforeUpload:c}=i,d=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!l||e.size/1024/1024<l,p=!(o>1)||s.length<o,h=d&&u&&p;if(d||R.warning(b("qm.upload.tooltip",{type:a.join(",")})),u||R.warning(b("qm.upload.sizeLimit",{size:l})),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,l)=>((e,n)=>{const{iconRender:r}=i,{uid:l,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[l]?t.createElement(O,{size:"small",autoFocus:!0,defaultValue:da(o),onBlur:t=>{const{value:n}=t.target;if(n!==da(o)){const t=Object.assign({},e,{name:`${n}.${ua(o)}`}),r=a.map((e=>e.uid!==l?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}k(l,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?T||k(l,!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(l)},S[l]?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,l)}),t.createElement("span",{className:"inner",ref:C},i.children||u&&a.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&&!!a.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(a);else for(const e of a)yield P(e)}))},b("qm.upload.batchDownload"))))};pa.displayName="QmUploadFile";const ha=e=>{const n=ln({icon:t.createElement(Ve,null),withCredentials:!1},e),{$size:r}=Pn(n),{t:i}=Ln(),[a,l]=t.useState(!1),o=zn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(E,Cn({},o,{size:r,loading:a,onClick:()=>kn(void 0,void 0,void 0,(function*(){var e;l(!0);try{const{action:e,fileName:t,headers:r,params:a,beforeDownload:l=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(!l(s))return;yield ca(s,{fileName:t,headers:r,params:a}),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"))}l(!1)}))}),n.children||i("qm.download.text"))};function ma(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])}ha.displayName="QmDownload";const fa=e=>{const{activeKey:n,labels:r,onTabClick:i}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const a={item:!0,actived:r===n};return t.createElement("div",{key:r,className:_e(a),onClick:e=>i(r,e)},t.createElement("span",null,e))})))},ga=e=>{const{label:n,showDivider:r,className:i,style:a}=e,l={[Jn("anchor-item")]:!0};return t.createElement("div",{className:_e(l,i),style:a},r&&t.createElement(er,{label:n,style:{marginBottom:10}}),e.children)};ga.displayName="AnchorItem";const va=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:i,labelWidth:a,tabPosition:l="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 a=-1;for(let e=0;e<n.length;e++){const r=n[e],i=n[e+1]||1e4;t>=r-1&&t<i&&(a=e)}return a},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=ma((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"===l,[`${w}-top`]:"top"===l,[`${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:a?Bn(a):""}},t.createElement(fa,{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))}));va.displayName="QmAnchor",va.Item=ga;const ya=e=>t.createElement(k.TabPane,e,e.children);ya.displayName="TabPane";const ba=e=>{const n=ln({tabPosition:"top"},e),{items:r,tabPosition:i,tabBarGutter:a,className:l,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!=a?a:["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:a}=r||{};i?a&&(n.disabled=!0):(h.splice(t,1),t--)}}return t.createElement(k,Cn({},u,{items:h,className:_e(d,l)}))};ba.displayName="QmTabs",ba.TabPane=ya;const xa=t.forwardRef(((e,n)=>{var r;const i=ln({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:a,open:l,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!=l?l:a)&&(!p&&x.current||ue(s)&&S(!0))}),[null!=l?l:a]),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!=l?l:a,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")}))}));xa.displayName="QmDrawer";const Ea="10vh";var Ca;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Ca||(Ca={}));const wa=t.forwardRef(((e,n)=>{var r;const i=ln({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Ea}},e),{visible:a,open:l,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 - ${Ea} - ${Ea} - ${Ca[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!=l?l:a){if(!f&&w.current||ue(d)&&R(!0),!f&&w.current)return;setTimeout((()=>{w.current=!0,ue(d)&&R(!1)}),400)}}),[null!=l?l:a]),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:Ea}),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 - ${Ca[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!=l?l:a,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")}))}));wa.displayName="QmModal";const Sa=n(void 0),Na=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"];var Ta={operations:function(e){const t=e.split(" "),n=[];let r=0;n[r]=[];for(let e=0;e<t.length;e++)Na.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 Ia=["==","<",">","<=",">=","!=","like","likes","in","nin"];var Ra=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},Oa=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++)Ia.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),Ia.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const ka=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,La=["string","number","boolean","symbol"],Aa=e=>La.includes(typeof e),Pa=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Da=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(ka,"\\$1"),"i");window.__query__=(...e)=>((e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Da(n));break;case"likes":r=n.split(/,|,/).some((t=>null!==e.toString().match(Da(t))));break;case"in":Aa(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?n.every((t=>e.includes(t))):n.includes(e));break;case"nin":Aa(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?n.some((t=>e.includes(t))):n.includes(e)));break;case"!=":case"<>":r=(Pa(e)?e.slice(0,10):e)!=n;break;case"<":r=(Pa(e)?e.slice(0,10):e)<n;break;case"<=":r=(Pa(e)?e.slice(0,10):e)<=n;break;case">":r=(Pa(e)?e.slice(0,10):e)>n;break;case">=":r=(Pa(e)?e.slice(0,10):e)>=n;break;default:r=(Pa(e)?e.slice(0,10):e)==n}return r})(e[0],e[1],e[2]);const _a=Ta.stringify,Fa=Ta.array_format,Ha=Ra,Ma=(e,t,n)=>{let r=[];t=Ta.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Oa(t,"record")};`);r=yl(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Oa(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},$a=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...$a(e.children)):t.push(e)})),t},ja=e=>e.filter((e=>(e.children&&(e.children=ja(e.children)),!e.hidden&&!e.noAuth))),qa=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...qa(e.children))})),t},Ka=(e,t)=>e.map((e=>(e.children&&(e.children=Ka(e.children,t)),null==t||t(e),e))),Va=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=Va(n.children,t);if(e)return e}}return null},za=e=>{const t=e.children;return t?t[0].children?za(t[0]):t[0]:e},Wa=e=>{const t=e.children;return t?t[t.length-1].children?Wa(t[t.length-1]):t[t.length-1]:e},Ba=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Ua=(e,t)=>{for(const n of e){if(n.rowKey===t)return n;if(n.children){const e=Ua(n.children,t);if(e)return e}}return null},Ga=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Ga(e.children))})),t},Ya=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 qa(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},Xa=e=>Object.assign(e,{__prevent__:!0}),Qa=e=>{delete e.__prevent__},Za=(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 Za(e.offsetParent,t,n)}return n},Ja=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,el=(e,t)=>he(e,((e,n,r)=>{me(n,t[r])||(e[r]=oe(n)&&oe(t[r])?el(n,t[r]):n)})),tl=(e,t)=>{var n;return null!==(n=pe(e,t))&&void 0!==n?n:""},nl=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),fe(e,t,null!=n?n:"")},rl=(e,t)=>{if(!t.includes("|"))return tl(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(tl(e,t))})),n.every((e=>!e))?"":n.join(" | ")},il=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),al=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]}`:""}`},ll=(e,t)=>{const n=e.toString();if(!il(n)||0===t)return e;const r=Number.parseFloat(n).toString(),i=r.indexOf(".");if(-1===i)return r+"."+"0".repeat(t);const a=Math.max(0,t-(r.length-i-1));return r+"0".repeat(a)},ol=(e,t)=>e?h(e,t):null,sl=(e,t)=>e?h(e).format(t):"",cl=(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)}))},dl=e=>{const n=[];if(t.isValidElement(e)){const{children:r}=e.props;t.Children.forEach(r,(e=>{n.push(...dl(e))}))}else n.push(e);return n},ul=e=>dl(e).join(""),pl=e=>e.filter((e=>!e._group)),hl=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let i=0,a=e.length;i<a;i++){const a=e[i];if(!a.fieldName)continue;const l=Array.isArray(a.condition)?Fa(a.condition):_a(a.condition,"^");n+=`${a.bracketLeft} ${t?`${a.fieldName}|${a.fieldType}`:a.fieldName} ${a.expression} ${l} ${a.bracketRight} ${a.logic} `,r=a.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[i,a]=r.includes("|")?r.split("|"):[r,""],l=e[r];for(const e in l){n+=`${t?`${i}|${a}`:i} ${e} ${Array.isArray(l[e])?Fa(l[e]):_a(l[e],"^")} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},ml=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(tl(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},fl=(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=fl(e[n].children,t);if(r)return[e[n],r].flat()}}},gl=(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=gl(e[n].children,t);if(r)return[e[n].rowKey,r].flat()}}},vl=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=vl(n.children,t);if(e)return e}if(t(n))return n}return null},yl=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&yl(e.children,t),t(e)||e.children&&e.children.length))),bl=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),xl=e=>["","small","middle","large"].includes(e),El=80,Cl="1",wl="0",Sl=400,Nl=["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"],Tl={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 Il,Rl,Ol;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Il||(Il={})),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"}(Rl||(Rl={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Ol||(Ol={}));const kl={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(!xl(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},Ll={layout:"horizontal",labelWidth:El,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},Al=(e,t)=>{if(!e)return null;if(t===Rl.week){const t=e.match(/^(\d{4})-(\d+)/);return t?h().year(Number(t[1])).week(Number(t[2])):null}if(t===Rl.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)},Pl=(e,t)=>e?h(e).format(t):"",Dl=e=>""===e||null==e,_l=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let i="";for(let t=0,a=r.length;t<a;t++){i+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===a-1?"":" | ")}return i},Fl=(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("|"),a=n[r].split("|");i.forEach(((t,n)=>e[t]=e[a[n]]))}else e[t[r]]=e[n[r]]},Hl=(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("|"),a=n[r].split("|");i.forEach(((t,n)=>e[t]=e[a[n]]))}else e[t[r]]=e[n[r]]},Ml=(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=Ml(e.children,t,n)),r})),$l=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=$l(n.children,t);if(e)return e}}return null},jl=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...jl(e.children,t,n+1))})),r},ql=e=>_n(e)||"string"==typeof e,Kl=e=>_n(e)?dl(e).join(""):null!=e?e:"",Vl=(e,t,n,r)=>{var i;const a={};return a.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})))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:n(e.echoSetting.api),formatter:t=>{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&&(a.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:n(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{var t;const n={};return null===(t=e.treeSetting.relativeTable)||void 0===t||t.forEach((e=>n[e.tableField]=e.treeField)),n}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a};var zl={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 Wl="阿",Bl="鿿",Ul=1,Gl=2,Yl=3;let Xl,Ql=null;function Zl(e){return e||null===Ql?("object"==typeof Intl&&Intl.Collator?(Xl=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Ql=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Ql=!1,Ql):Ql}function Jl(e){const t=zl.UNIHANS,n=zl.PINYINS,r=zl.EXCEPTIONS,i={source:e};if(e in r)return i.type=Gl,i.target=r[e],i;let a,l=-1;if(e.charCodeAt(0)<256)return i.type=Ul,i.target=e,i;if(a=Xl.compare(e,Wl),a<0)return i.type=Yl,i.target=e,i;if(0===a)i.type=Gl,l=0;else{if(a=Xl.compare(e,Bl),a>0)return i.type=Yl,i.target=e,i;0===a&&(i.type=Gl,l=t.length-1)}if(i.type=Gl,l<0){let n=0,r=t.length-1;for(;n<=r;){l=~~((n+r)/2);const i=t[l];if(a=Xl.compare(e,i),0===a)break;a>0?n=l+1:r=l-1}}return a<0&&l--,i.target=n[l],i.target||(i.type=Yl,i.target=i.source),i}function eo(e){return"string"==typeof e&&Zl()?e.split("").map((e=>Jl(e))):e}var to={isSupported:Zl,parse:eo,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(zl)})))},genToken:Jl,convertToPinyin:(e,t,n)=>eo(e).map((e=>t&&e.type===Gl?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,ao=e=>{const{$$form:n}=t.useContext(Sa),{value:r,items:i,multiple:a,loading:l,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=Sl,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=>a?(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:a?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:h,style:p,loading:l,bordered:m,allowClear:f,disabled:v,showSearch:x,listHeight:E,maxTagCount:C?"responsive":void 0,maxTagTextLength:w},a?{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 lo 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:a="value",textKey:l="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[a],text:e[l]})));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:a,tooltip:l,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(a),className:_e(u),tooltip:l,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(a)}},t.createElement(ao,{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||El)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}lo.contextType=Sa;const oo=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:p=wl,trueValue:h=Cl}=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),a(e,f(e))})(t?h:p)}},u?l:null)};class so extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}so.contextType=Sa;const co=e=>{const{uniqueKey:n,items:r,fieldsChange:i}=e,{global:a}=t.useContext(en),{$$form:l}=t.useContext(Sa),{$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==a?void 0:a.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==a?void 0:a.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==a?void 0:a.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)})(l.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;l.setExpandHandle(!0);const i=bl(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"},l.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(Sa),{value:i,onChange:a,onValuesChange:l}=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==a||a(e),l(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:a,invisible:l,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:l,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(r)}},t.createElement(uo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(a,t)}}))),u&&t.createElement(_,null,e.renderFormItemButton(a,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}po.contextType=Sa;const ho=e=>{const{$$form:n}=t.useContext(Sa),{value:r=[],onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{options:o={},placeholder:s=l("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),a(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:a,invisible:l,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:l,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:a,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(a,n)}}))),c&&t.createElement(_,{flex:Bn(c.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},c)))))}}mo.contextType=Sa;const fo=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Sa),{value:i,onChange:a,onValuesChange:l}=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=Dl(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==a||a(e),l(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:a,invisible:l,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:l,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(r)}},t.createElement(fo,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{m(t),e.setViewValue(a,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(a,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}go.contextType=Sa;const vo=e=>{const{$$form:n}=t.useContext(Sa),{value:r=[],onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{options:o={},placeholder:s=l("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),a(t,w(t))},w=e=>Dl(e)?"":e.map((e=>Dl(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:a,invisible:l,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:l,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:a,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(a,n)}}))),c&&t.createElement(_,{flex:Bn(c.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},c)))))}}var bo;yo.contextType=Sa,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:a,triggeredChange:l,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&&Fl(e,this.alias,c),d&&Hl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=_l(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==a||a([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)||[],a={[t]:r};return(Array.isArray(i)?i:[i]).forEach((e=>{if(oe(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](r):r;else a[e]=r})),a},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=Mn,formatter:i=(e=>e)}=t.fetch;return new Promise(((a,l)=>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 l();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:[];a(n)}else l()}catch(e){l(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=_l(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=_l(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=_l(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]:_l(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:_l(e,this.extras[n])});const r=_l(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:a}=this.props,{type:l,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=an("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:an("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:a,bordered:p}):t.createElement(t.Fragment,null,t.createElement(xo,{ref:e=>this[`${l}_Ref`]=e,value:a,title:a,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:a}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?i?(null===(t=null==a?void 0:a.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(wa,b,t.createElement($p,x)))}}Eo.contextType=Sa;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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Co.contextType=Sa;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,a=null==t?void 0:t.target,l=!i||!a,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(i))||(null===(r=this.$el)||void 0===r?void 0:r.contains(a)),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(a);let u;u=!(l||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,l=a(),s=a();d(t,(function(){return{}}));var c=a(!1);return!c.current&&qr()&&(s.current=r(),l.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==l.current&&l.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,a=t.mask,l=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!a)return null;var c={};return(l||s||o)&&(c=sr({motionAppear:!0},Oo({motion:l,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,a=i.body,l=i&&i.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=l.clientLeft||a.clientLeft||0,top:r-=l.clientTop||a.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 as(e,t,n){"static"===Wo(e,"position")&&(e.style.position="relative");var r=-999,i=-999,a=rs("left",n),l=rs("top",n),o=is(a),s=is(l);"left"!==a&&(r=999),"top"!==l&&(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[a]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[l]="".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 ls(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,a=r.match(Ko);a?((i=(a=a[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="",a=Qo(e);return(r=r||a.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],a=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]=a}return""===n?"auto":n});var cs=["margin","border","padding"],ds=-1,us=2,ps=1;function hs(e,t,n){var r,i,a,l=0;for(i=0;i<t.length;i++)if(r=t[i])for(a=0;a<n.length;a++){var o=void 0;o="border"===r?"".concat(r).concat(n[a],"Width"):r+n[a],l+=parseFloat(qo(e,o))||0}return l}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"],a="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),l=ss(e),o=0;(null==a||a<=0)&&(a=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=l?ps:ds);var s=void 0!==a||l,c=a||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,a=r.documentElement[n];return"CSS1Compat"===r.compatMode&&a||i&&i[n]||a}}));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={},a=e.style;for(r in t)t.hasOwnProperty(r)&&(i[r]=a[r],a[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(a[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),a=r.top.toFixed(0),l=t.left.toFixed(0),o=t.top.toFixed(0);if(i===l&&a===o)return}n.useCssRight||n.useCssBottom?as(e,t,n):n.useCssTransform&&Mo()in document.body.style?ls(e,t):as(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),a=i.defaultView||i.parentWindow,l=i.body,o=i.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===l||r===o||"visible"===bs.css(r,"overflow")){if(r===l||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(a),u=bs.getWindowScrollTop(a),p=bs.viewportWidth(a),h=bs.viewportHeight(a),m=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(l);if("hidden"===g.overflowX&&(m=a.innerWidth),"hidden"===g.overflowY&&(f=a.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,a=e.height,l=e.left,o=e.top;return"c"===n?o+=a/2:"b"===n&&(o+=a),"c"===r?l+=i/2:"r"===r&&(l+=i),{left:l,top:o}}function Ts(e,t,n,r,i){var a=Ns(t,n[1]),l=Ns(e,n[0]),o=[l.left-a.left,l.top-a.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,a=n.offset||[0,0],l=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;a=[].concat(a),l=[].concat(l);var c={},d=0,u=ws(s,!(!(o=o||{})||!o.alwaysByViewport)),p=Ss(s);As(a,p),As(l,t);var h=Ts(p,t,i,a,l),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(a,0),v=ks(l,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,a=g,l=v)}if(o.adjustY&&Rs(h,p,u)){var y=Os(i,/[tb]/gi,{t:"b",b:"t"}),b=ks(a,1),x=ks(l,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,a=b,l=x)}d&&(h=Ts(p,t,i,a,l),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,a=n.offset||[0,0],l=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),a={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+a.width>n.right&&(a.width-=i.left+a.width-n.right),r.adjustX&&i.left+a.width>n.right&&(i.left=Math.max(n.right-a.width,n.left)),r.adjustY&&i.top<n.top&&(i.top=n.top),r.resizeHeight&&i.top>=n.top&&i.top+a.height>n.bottom&&(a.height-=i.top+a.height-n.bottom),r.adjustY&&i.top+a.height>n.bottom&&(i.top=Math.max(n.bottom-a.height,n.top)),bs.mix(i,a)}(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:a,targetOffset:l,overflow:c}}function Ds(e,t,n){var r=n.target||t,i=Ss(r),a=!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,a)}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 a=i.getBoundingClientRect(),l=a.width,o=a.height,s=Math.floor(l),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,a=e.target,l=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=a,m.current.align=l,m.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),i=t.useRef(null);function a(){window.clearTimeout(i.current)}return[function t(l){if(a(),r.current&&!0!==l)i.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(l))return;r.current=!0,i.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,a()}]}((function(){var e=m.current,t=e.disabled,n=e.target,r=e.align,i=e.onAlign,a=p.current;if(!t&&n&&a){var l,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(),a=i.width,l=i.height;if(a||l)return!0}}return!1}(o)?l=Ds(a,o,r):s&&(l=function(e,t,n){var r,i,a=bs.getDocument(e),l=a.defaultView||a.parentWindow,o=bs.getWindowScrollLeft(l),s=bs.getWindowScrollTop(l),c=bs.viewportWidth(l),d=bs.viewportHeight(l),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)}(a,s,r)),function(e,t){e!==document.activeElement&&So(t,e)&&"function"==typeof e.focus&&e.focus()}(c,a),i&&l&&i(a,l),!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(a)),S($s(a))})),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 a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,l=r.has(t);if(mn(!l,"Warning: There may be circular references"),l)return!1;if(t===i)return!0;if(n&&a>1)return!1;r.add(t);var o=a+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,l)||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:{},a=i.iterator||"@@iterator",l=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 a=t&&t.prototype instanceof p?t:p,l=Object.create(a.prototype),o=new N(i||[]);return r(l,"_invoke",{value:E(e,n,o)}),l}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,a,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,a)&&(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,a,l,o){var s=d(e[r],e,a);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,l,o)}),(function(e){i("throw",e,l,o)})):t.resolve(u).then((function(e){c.value=e,l(c)}),(function(e){return i("throw",e,l,o)}))}o(s.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return I()}for(n.method=i,n.arg=a;;){var l=n.delegate;if(l){var o=C(l,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 a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(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[a];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,l,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var l=new x(c(t,n,r,i),a);return e.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},b(y),s(y,o,"Generator"),s(y,a,(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 l.type="throw",l.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 a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(o&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(l)},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,a,l){try{var o=e[a](l),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 a=e.apply(t,n);function l(e){Vs(a,r,i,l,o,"next",e)}function o(e){Vs(a,r,i,l,o,"throw",e)}l(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,l=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=a(),T=a(),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(),a=r.width,l=r.height;Math.abs(t-a)<1&&Math.abs(n-l)<1&&(t=a,n=l),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],l=a();function s(e){i(e,!0)}function c(){di.cancel(l.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(l.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(),l.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=a();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,a=t.style,o=_e(i,l,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({},a),B)},G))}))}));Bs.displayName="PopupInner";var Us=e.forwardRef((function(t,n){var r=t.prefixCls,i=t.visible,a=t.zIndex,l=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:a},c),g=l;return e.Children.count(l)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},l)),p&&(g=p(g)),e.createElement(vi,yi({visible:i,ref:m,removeOnLeave:!0},u),(function(t,n){var i=t.className,a=t.style,l=_e(r,s,i);return e.createElement("div",{ref:n,className:l,onClick:h,style:sr(sr({},a),f)},g)}))}));Us.displayName="MobilePopupInner";var Gs=["visible","mobile"],Ys=e.forwardRef((function(t,n){var r=t.visible,i=t.mobile,a=br(t,Gs),l=dr(u(r),2),s=l[0],c=l[1],d=dr(u(!1),2),p=d[0],h=d[1],m=sr(sr({},a),{},{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,a;return Er(this,i),lr(Ir(n=r.call(this,t)),"popupRef",e.createRef()),lr(Ir(n),"triggerRef",e.createRef()),lr(Ir(n),"portalContainer",void 0),lr(Ir(n),"attachId",void 0),lr(Ir(n),"clickOutsideHandler",void 0),lr(Ir(n),"touchOutsideHandler",void 0),lr(Ir(n),"contextMenuOutsideHandler1",void 0),lr(Ir(n),"contextMenuOutsideHandler2",void 0),lr(Ir(n),"mouseDownTimeout",void 0),lr(Ir(n),"focusTime",void 0),lr(Ir(n),"preClickTime",void 0),lr(Ir(n),"preTouchTime",void 0),lr(Ir(n),"delayTimer",void 0),lr(Ir(n),"hasPopupMouseDown",void 0),lr(Ir(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),lr(Ir(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),lr(Ir(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),lr(Ir(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),lr(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)})),lr(Ir(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),lr(Ir(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),lr(Ir(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),lr(Ir(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),lr(Ir(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),lr(Ir(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),lr(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)})),lr(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)})),lr(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()}})),lr(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))})),lr(Ir(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,i=r.popupPlacement,a=r.builtinPlacements,l=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return i&&a&&t.push(function(e,t,n,r){for(var i=n.points,a=Object.keys(e),l=0;l<a.length;l+=1){var o=a[l];if(Io(e[o].points,i,r))return"".concat(t,"-placement-").concat(o)}return""}(a,l,e,o)),s&&t.push(s(e)),t.join(" ")})),lr(Ir(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,i=t.destroyPopupOnHide,a=t.popupClassName,l=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:a,align:N,onAlign:l,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)})),lr(Ir(n),"attachParent",(function(e){di.cancel(n.attachId);var t,r=n.props,i=r.getPopupContainer,a=r.getDocument,l=n.getRootDomNode();i?(l||0===i.length)&&(t=i(l)):t=a(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=di((function(){n.attachParent(e)}))})),lr(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})),lr(Ir(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),lr(Ir(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),lr(Ir(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),a="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:a,popupVisible:a},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 a=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,a),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,a=r.forceRender,l=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,l&&(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||a)&&(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 lr(n,"contextType",Xs),lr(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:a={},formatter:l=(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(l(Object.assign(Object.assign({},a),{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 a=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(a),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:a,visible2:l,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=an("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:a,title:an("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"},an("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&&l,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Tl,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(wa,C,t.createElement($p,w)))}};nc.contextType=Sa,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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}rc.contextType=Sa;const{Search:ic}=O;class ac 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:a,triggeredChange:l,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&&Fl(e,this.alias,c),d&&Hl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=_l(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==a||a([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=_l(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]:_l(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]:_l(e,this.alias[r])});for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:_l(e,this.extras[n])});const r=_l(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:a=""}=this.props,{type:l,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=an("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:an("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:a,bordered:p}):t.createElement(t.Fragment,null,t.createElement(ic,{ref:e=>this[`${l}_Ref`]=e,value:a,title:a,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(wa,b,t.createElement(Vp,x)))}}ac.contextType=Sa;class lc 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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,noStyle:!0,rules:m,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(ac,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(l,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}lc.contextType=Sa;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:a={},formatter:l=(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(l(Object.assign(Object.assign({},a),{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 a=i.map((e=>({value:e[r],text:e[n]})));this.setRecords(i),this.setItemList(a),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:a,visible2:l,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:p={},style:h={},placeholder:m=an("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,C={visible:a,title:an("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"},an("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&&l,popup:N,popupClassName:_e(O),popupStyle:{minWidth:T},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Tl,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(wa,C,t.createElement(Vp,w)))}};oc.contextType=Sa,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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,n)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}sc.contextType=Sa;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(((a,l)=>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 l();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 a(n)}}catch(e){this.setState({loading:!1})}l()}))))},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 a,l;return null!==(l=null===(a=r[i].find((e=>e.value===n[t])))||void 0===a?void 0:a.text)&&void 0!==l?l:""}));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:a=(e=>e),dataKey:l,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(a(Object.assign(Object.assign({},i),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=pe(o.data,l))&&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:a}=this.state,{fieldName:l,options:o={},searchHelper:s={},placeholder:c=an("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:p}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,m=a.every((e=>Dl(e)))?"":a.join(" - "),f={visible:r,title:an("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${l}`,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}_${l}`:"",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:a[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?a.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(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,a[1]]))}}),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:a[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?a.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(a).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):a.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([a[0],t]))},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t.createElement(wa,f,t.createElement(Up,g)))}}dc.contextType=Sa;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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,n)}}))),u&&t.createElement(_,null,e.renderFormItemButton(l,u)),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},d)))))}}uc.contextType=Sa;const pc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,items:i,onChange:a,onValuesChange:l}=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==a||a(e),l(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:a="value",textKey:l="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[a],text:e[l]})));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:a,fieldName:l,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:a,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:l,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(l,n)}}))),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}hc.contextType=Sa;const mc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:p=5,tooltips:h}=l,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),a(e,m(e))})(e)}})};class fc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}fc.contextType=Sa;const gc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,items:i,onChange:a,onValuesChange:l}=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==a||a(e),l(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:a="value",textKey:l="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[a],text:e[l]})));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:a,fieldName:l,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:a,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:l,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(l,n)}}))),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}vc.contextType=Sa;const yc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:p=wl,trueValue:h=Cl}=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),a(e,m(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:p)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class bc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}bc.contextType=Sa;const xc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{options:o={},style:s={},placeholder:c=l("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),a(e)})(t)}})};class Ec extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(xc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Ec.contextType=Sa;const Cc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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),a(e,S(e))},S=e=>Dl(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Pl(h().subtract(e,"day"),Rl[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:Il[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)},l("qm.form.datePickers")[0]),t.createElement(V,{color:"processing",onClick:()=>N(1)},l("qm.form.datePickers")[1]),t.createElement(V,{color:"processing",onClick:()=>N(7)},l("qm.form.datePickers")[2]),t.createElement(V,{color:"processing",onClick:()=>N(30)},l("qm.form.datePickers")[3])):void 0,value:Al(r,Rl[g]),onChange:(e,t)=>{w(Pl(e,Rl[g]))}})};class wc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}wc.contextType=Sa;const Sc=e=>[h().subtract(e,"day"),h()],Nc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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={[l("qm.form.dateRangePickers")[0]]:Sc(7),[l("qm.form.dateRangePickers")[1]]:Sc(30),[l("qm.form.dateRangePickers")[2]]:Sc(90),[l("qm.form.dateRangePickers")[3]]:Sc(180)},N=e=>Dl(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:Il[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:[Al(null==r?void 0:r[0],Rl[g]),Al(null==r?void 0:r[1],Rl[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),a(e,N(e))})([Pl(null==e?void 0:e[0],Rl[g]),Pl(null==e?void 0:e[1],Rl[g])])}})};class Tc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Tc.contextType=Sa;const Ic=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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:Ol[f],value:Al(r,Ol[f]),onChange:(e,t)=>{(e=>{const t=Pl(e,Ol[f]);null==i||i(t),a(t)})(e)}})};class Rc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ic,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Rc.contextType=Sa;const Oc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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=>Dl(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:Ol[f],value:Kn(r)?null:[Al(null==r?void 0:r[0],Ol[f]),Al(null==r?void 0:r[1],Ol[f])],onChange:(e,t)=>{(e=>{const t=[Pl(null==e?void 0:e[0],Ol[f]),Pl(null==e?void 0:e[1],Ol[f])];null==i||i(t),a(t,E(t))})(e)}})};class kc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}kc.contextType=Sa;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:a}=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` 值"),a&&!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:a,triggeredChange:l,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&&Fl(e,this.alias,c),d&&Hl(e,this.extras,d),this._record=e,this.setFieldsValue(e),this._prevValue=u,l){const t=_l(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==a||a([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=_l(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]:_l(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]:_l(e,this.alias[t])});for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:_l(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const i=_l(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,a,l,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===(a=null===(i=this.props.option.searchHelper)||void 0===i?void 0:i.request)||void 0===a?void 0:a.params)||(null===(l=this.props.option.request)||void 0===l?void 0:l.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:a=(e=>e),dataKey:l}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(a(Object.assign(Object.assign({},i),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=pe(o.data,l))&&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:a}=this.state,{value:l}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=an("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:p=!0,readOnly:h,disabled:m}=this.props.option,{listHeight:f=Sl}=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:l,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:Tl,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!=a?a:l,title:l,onFocus:()=>{!i.length&&this.fetchHandle(l)},onBlur:e=>{v&&!this._clicking&&a!==l&&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=Sa;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:a}=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:l}=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=Vl(Object.assign({},n.data,a),l,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:a,fieldName:l,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:a,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:l,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(l,t)}}))),p&&t.createElement(_,null,e.renderFormItemButton(l,p)),u&&t.createElement(_,{flex:Bn(u.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:l},u)))))}}Ac.contextType=Sa;class Pc extends s{render(){var e;const{$$form:n}=this.context,{type:r,label:i,fieldName:a,className:l,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===a)))&&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}:`:"",a=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==a&&h.push(Object.assign(Object.assign({},e),{text:`${i}${a}`}))}))}return t.createElement(P.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(er,{id:a,label:i,className:l,extra:h.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[a],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[a]:e})}))),p(e)}}))}}Pc.contextType=Sa;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(Sa),{value:r,items:i,multiple:a,loading:l,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=Sl,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=$l(O,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},P=e=>a?(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:a,treeCheckable:a,treeCheckStrictly:C,showCheckedStrategy:z[w],popupClassName:`form-popper__${d}`,dropdownStyle:I,placeholder:h,listHeight:E,style:p,loading:l,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:a,textKey:l="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,a))&&void 0!==n?n:[],i=Dc(O,e,o,Ml(r,o,l));k(i),null==s||s(r)}}catch(e){}})):void 0,treeData:O},a?{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:a="value",textKey:l="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=Ml(n,a,l);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:a,tooltip:l,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(a),className:_e(u),tooltip:l,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(a)}},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||El)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Fc.contextType=Sa;const Hc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,multiple:i,items:a}=e,{t:l}=Ln(),{fieldName:o,options:s={},style:c={},placeholder:d=l("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)?a:g),N=t.useRef(w);Li((()=>{const e=Kn(g)?a:g;h?me(e,N.current)||(S(e),N.current=e):S(e)}),[g,a]);const T=e=>jl(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:a,textKey:l="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,a))&&void 0!==t?t:[],i=Dc(w,n.value,o,Ml(r,o,l));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:a="value",textKey:l="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=Ml(n,a,l);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:a,tooltip:l,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(a),className:_e(u),tooltip:l,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(a)}},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||El)},e.renderFormItemExtra(Object.assign({fieldName:o},p)))))}}Mc.contextType=Sa;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"},an("qm.form.citySelectType.0")),t.createElement(q.Button,{value:"1"},an("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:an("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:a={},style:l={},placeholder:o=an("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({},l)},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 a={[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(a,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Tl,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%"},l),value:m,title:m,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}Bc.contextType=Sa;class Uc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Uc.contextType=Sa;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=$l(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:a,valueKey:l="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,a))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[l]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var i;const a=(null===(i=n.find((t=>t.value===e[r])))||void 0===i?void 0:i.text)||`${an("qm.form.selectPlaceholder").replace("...","")}(${an("qm.form.regionSelectLabel")[r]})`;return t.createElement(ba.TabPane,{key:r.toString(),tab:a},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(ba,{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:a={},style:l={},placeholder:o=an("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 a={[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(a,`form-popper__${i}`),popupStyle:{minWidth:h},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Tl,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%"},l),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&jn((()=>this.initial()))}})))}))}}Yc.contextType=Sa;class Xc extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,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(a,n)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Xc.contextType=Sa;const Qc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},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}=l,{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(pa,{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))&&a(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:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Qc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Zc.contextType=Sa;const Jc=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},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}=l,{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))&&a(t)})(e)},onRemove:y,onSortChange:b})};class ed extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Jc,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,"")}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}ed.contextType=Sa;const td=e=>{const{$$form:n}=t.useContext(Sa),{value:r,onChange:i,onValuesChange:a}=e,{options:l={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:p,onResizeEditor:h}=l;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),a(e)})(e)}})};class nd extends s{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:i,fieldName:a,invisible:l,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:l,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:a,noStyle:!0,rules:p,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(td,{option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(a,t)}}))),d&&t.createElement(_,{flex:Bn(d.labelWidth||El)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}nd.contextType=Sa;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:an("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(){ea(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,Nl.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:wl),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,a;if(ql(e))return Kl(e);if(oe(e)){const{fieldName:l,label:o,options:s={}}=e;if(ql(o))return Kl(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([l])[l])&&void 0!==n?n:this._initialValues[l])&&void 0!==r?r:null===(i=c[0])||void 0===i?void 0:i.value;return(null===(a=c.find((e=>e.value===d)))||void 0===a?void 0:a.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,a=i.length;e<a;e++){const a=i[e],l=this.dividers.find((e=>e.fieldName===a[0].fieldName)),o=null!==(r=null===(n=null==l?void 0:l.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:a.length-1;for(let e=1;e<a.length;e++){if(a[e].fieldName===t&&e>o)return this.state.expand[a[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const i=e[r];if(Dl(i)&&(e[r]=""),Array.isArray(i)&&i.forEach(((t,n)=>{Dl(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(i)){const[a,l]=r.split("|");e[a]=null!==(t=i[0])&&void 0!==t?t:"",e[l]=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:a}=r.fetch;try{const r=yield t(n);200===r.code&&(i=null!==(e=a?pe(r.data,a):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:a,secretName:l}=n;i||(e.noAuth=!0,r.noAuth=!0),a&&(e.disabled=!0,r.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},r.options=Object.assign({},r.options,{secretType:l})),this.setFieldAuth(t,{visible:i,disabled:a,secretName:l})}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(lc,{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(lo,{option:e})}MULTIPLE_SELECT(e){return t.createElement(lo,{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(ql(e)||!oe(e))return e;const{type:n,fieldName:r,label:i,options:a={},onChange:l=Hn}=e,{itemList:o=[]}=a;return"SELECT"===n?t.createElement(P.Item,{name:r,noStyle:!0},t.createElement(ao,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>l(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=>l(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:i={},render:a}=e,{extra:l}=this.state;if(r)return t.createElement(C,{className:"extra-tooltip",title:l[n]},t.createElement(Qe,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:a?"":l[n],style:i},t.createElement("span",{className:"extra-overflow-cut"},a?a(o,this):l[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:a,className:l,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:a,hidden:i,className:_e(l),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,a=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)a.push({});a.push(e);for(let e=0;e<n;e++)a.push({})}));const l=24/e,o=[],s=a.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=a.map(((n,r)=>{let{selfCol:i=1}=n;const{type:a,fieldName:s}=n;i=i>=24||"DIVIDER"===a||"TINYMCE"===a?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*l,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:p?"block":"none"}},a?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:a,isFieldsDefine:l=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=i||1,c=n-e%n-s;return a?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()},an("qm.form.search")),t.createElement(Xn,{size:this.$size,icon:t.createElement(Ze,null),onClick:()=>this.RESET_FORM()},an("qm.form.reset")),l?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(Fe,null):t.createElement(He,null)," ",an(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()},an("qm.form.save")),t.createElement(Xn,{size:this.$size,onClick:()=>this.RESET_FORM()},an("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:[an("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,a=r.find((t=>t.fieldName===e));if(!a)return Yn("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!oe(t))return Yn("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(a.noAuth)return Yn("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||fe(a,n,t[n]));n&&(i?i([...r]):Yn("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:n,layout:r,disabled:i,labelWidth:a,labelAlign:l,labelWrap:o,customClass:s}=this.props,c=Jn("form"),d={required:"${label}"+an("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:l,labelWrap:o,colon:!1,disabled:i,labelCol:{flex:this.verticalLayout?"initial":Bn(a)},validateMessages:d,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Sa.Provider,{value:this.provide},t.createElement(D,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}rd.contextType=en,rd.propTypes=kl,rd.defaultProps=Ll;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},ad=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),ld=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,a,l)=>{const o=Object.keys(i).filter(od),s=Object.keys(a).filter(od),c=o.filter((e=>void 0===a[e])),d=s.filter((e=>void 0===i[e]));c.forEach((e=>{const t=sd(e),r=l[t];n(t,r),delete l[t]})),d.forEach((n=>{const i=r(e,n),a=sd(n);l[a]=i,t(a,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,a,l)=>{const o=()=>((e,t,n,r,i,a)=>{const l=t.createElement("script");l.referrerPolicy="origin",l.type="application/javascript",l.id=e,l.src=n,l.async=r,l.defer=i;const o=()=>{l.removeEventListener("load",o),a()};l.addEventListener("load",o),t.head&&t.head.appendChild(l)})(e.scriptId,t,n,r,i,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,a>0?setTimeout(o,a):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 a=vd(this.view);if(!a)throw new Error("tinymce should have been loaded into global scope");const l=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&&ld(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&&ld(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()),a.init(l)},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,a;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!==(a=null===(i=this.props.scriptLoading)||void 0===i?void 0:i.delay)&&void 0!==a?a: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=ad,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:a={},upload:l={},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:a.height||v,plugins:a.plugins||y,toolbar:a.toolbar||x,menubar:a.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(a,["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}=l,a=`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 a=yield e.json();if(200===a.code){const e=i?pe(a.data,i):a.data;t(e)}}catch(e){R.error(g("qm.uploadCropper.uploadError"))}else t(a)})))),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=ln({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:a,src:l,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:a},t.createElement("img",{ref:d,src:l,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));Ed.displayName="Cropper";const Cd=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:i,quality:a,beforeCrop:l,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,a=Rn(r,["beforeUpload"]);return d.current=i,t.createElement(n.type,Object.assign(Object.assign({},a),{beforeUpload:(e,t)=>new Promise(((n,r)=>kn(void 0,void 0,void 0,(function*(){const r=()=>n(I.LIST_IGNORE);if(l&&!(yield l(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 a=new File([i],t,{type:e});if(Object.assign(a,{uid:r}),n.length&&!n.includes(a.name.slice(a.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(a);const l=d.current(a,[a]);if("boolean"==typeof l||l){if(!0===l)return p.current(a);if(!1===l)return h.current("not upload");if(l&&"function"==typeof l.then)try{const e=yield l,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),p.current(a)}catch(e){h.current(e)}}else Yn("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,a),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=ln({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:i=!0,fixedSize:a,quality:l=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:a=[],fileSize:l,beforeUpload:o}=n,s=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!l||e.size/1024/1024<l,d=s&&c;if(s||R.warning(y("qm.upload.tooltip",{type:a.join(",")})),c||R.warning(y("qm.upload.sizeLimit",{size:l})),!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:a}=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(),l=Date.now(),o=new File([e],`screenshot-${l}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${l}`});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),l=yield fetch(n,{method:"POST",body:e,headers:a});if(!l.ok)throw new Error(y("qm.upload.uploadError"));const s=yield l.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:a,quality:l,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 a=e[i];if(a.children)if(a.children.some((e=>e[n]===t)))r=a[n];else{const e=Sd(a.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:a=!0,multiple:l,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),_=ta(P),[F,H]=t.useState(v),[M,$]=t.useState(!1),j=na((()=>{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(le())}),[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(l)return y;const t=Td(e,(e=>y.includes(e[A])));return 1===t.length?[t[0][L]]:[]},ae=e=>{var t;return(null===(t=kd(q,e,L))||void 0===t?void 0:t.slice(0,-1))||[]},le=()=>{if(x)return ne.current;const e=[];return W.forEach((t=>{if(l){if("SHOW_ALL"===h&&!ne.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const n=$l(q,t);if(n){const r=ae(t),i=Ld(n,L);e.push(...r,...[t,...i].filter((e=>ne.current.includes(e))))}}}else e.push(...ae(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:a}=c;try{$(!0);const l=yield t(n);if(200===l.code){let t=Array.isArray(l.data)?l.data:null!==(e=pe(l.data,r))&&void 0!==e?e:[];t="function"==typeof i?yield i(t):t,re(t),B(ie(t)),z({}),null==a||a(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(!a)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):le())})(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:l,draggable:o,blockNode:o,checkable:l,selectable:!l,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:a,formatter:l=(e=>e),afterFetch:o}=c;try{const t=yield r(l(Object.assign(Object.assign({},i),{[L]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=pe(t.data,a))&&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]),a=(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&&a(e[r].children,t,n)}},l=[...q];let o;if(a(l,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===i)a(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];a(l,t,((t,r,i)=>{n=i,e=r})),-1===i?n.splice(e,0,o):n.splice(e+1,0,o)}else a(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(l)},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(l?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(l?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:a,postState:l}=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=l?l(c):c,u=An(a),[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:a,rowSelection:l,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 a=e[i];"left"===a.fixed?t.push(a):"right"===a.fixed?n.push(a):r.push(a)}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}})(l),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),ja(t)},_=(e,t,n,r,i)=>{const a=`${t},${n}`;e.has(a)||e.set(a,{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((()=>$a(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 a=0;a<e.colSpan;a++)0===i&&0===a||_(t,n+i,r+a,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((()=>Ya(j).length>1),[j]),Q=t.useMemo((()=>a||X),[a,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==l?void 0:l.type)),[v,l]),ie=t.useMemo((()=>!!p&&J),[p,J]),ae=t.useMemo((()=>!F&&!!h&&J),[F,h,J]),le=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:a}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=a,c=se?pl(x.current.tableFullData):x.current.tableFullData,d=!k.length&&!!o;let u=(!l||d?c:k).reduce(((e,t)=>{if(null==t?void 0:t[Xd.summaryIgnore])return e;const r=tl(t,n);return il(r)?e.plus(r):e}),new Vt(0));!Object.keys(L).includes(n)||l&&!d||(u=new Vt(tl(L,n))),nl(e,n,u.toNumber());let p=r>=0?u.toFixed(r):u.toString();i>=0&&""!==p&&(p=ll(p,i)),p=al(p),nl(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("|"),a=e[t];Object.keys(a).forEach((e=>{n.push({type:i,bracketLeft:"",fieldName:r,expression:e,value:a[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,a=n.length?{[Xd.filterFieldName]:n}:null,l=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),a),l),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:ae,isPivotGrid:le,isGroupSummary:oe,isGroupSubtotal:se,isTableEmpty:ce,summationRows:de,fetchParams:pe}},tu=(e,n)=>{const{rowKey:r,height:i,dataSource:a,summation:l,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,editableColumns:R,tableFullData:O,pagination:k,layout:L,filters:A,sorter:P,superFilters:D,fetchParams:_,selectionKeys:F,rowExpandedKeys:H,highlightKey:M,summationColumns:$,isFetch:j,isWebPagination:q,isScrollPagination:K,isServiceSummation:V,isGroupSubtotal:z,doLayout:W,setTableFullData:B,setTableOriginData:U,setTableFlatData:G,setAllTableData:Y,setDeriveRowKeys:X,setPagination:Q,setPingRight:Z,setPingLeft:J,setSpinning:ee,setSorter:te,setFilters:ne,setSuperFilters:re,setSelectionKeys:ie,setRowExpandedKeys:ae,setHighlightKey:le,setSelectionRows:oe,setScrollXLoad:se,setScrollYLoad:ce,setFieldAuth:de,setResizeState:ue,setSummaries:he,setPermission:me,setRecordsMap:fe,resetTableScroll:ge,clearElementStore:ve,clearRecordsMap:ye}=n,{t:be}=Ln(),{store:xe}=C.current,Ce=t.useRef(Object.assign({},_)),we=t.useRef(new Map),Se=t.useRef(!1),Ne=ta(w);sn((()=>{Le(),W()}),[T]),sn((()=>{Te()}),[Ne,N,i,L.tableAutoHeight]),Li((()=>{dt(),ut(),pt(),j||(q&&tt(),Ye(a)),s&&te(s),c&&ne(c)}),[a,null==o?void 0:o.params]),Li((()=>{const e=ze(_,Ce.current);e||j&&(null==d?void 0:d.clearableAfterFetched)&&ht(),!e&&_[Xd.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?tt():j&&Ue(),Ce.current=_}),[_]),Li((()=>{q&&lt(),K||ge(),qe()}),[k.current,k.pageSize]),Li((()=>{j||Re(O.length),W()}),[O]),Li((()=>{C.current.isTreeTable&&(nt(),lt())}),[H]);const Te=()=>{const{scrollBarRef:e,resizeState:t}=C.current,{width:n,height:r}=Ne;W(),L.tableBodyWidth>n&&Z(!0),e.current.scrollLeft>0&&J(!0),ue(Object.assign({},t,{width:n,height:r}))},Ie=()=>{M&&S.current.setClickedValues([M,""]),"radio"===(null==d?void 0:d.type)&&F.length&&S.current.setClickedValues([F[0],""])},Re=e=>{e!==k.total&&Q((t=>Object.assign({},t,{total:e})))},Oe=e=>{Se.current=e},ke=na((e=>{Ze(),null==b||b(e)})),Le=()=>{se(I.length>Xd.virtualScrollX)},Ae=(e=[])=>{let t=e.length>Xd.virtualScrollY;C.current.isTreeTable&&(t=!0),(null==p?void 0:p.virtual)&&(t=!0),ce(t)},Pe=e=>z?De(_e(e,0)):e,De=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...De(e.children)),delete e.children,t.push(e)})),t},_e=(e,t)=>{var n;const i=null===(n=l.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 ml(e,[i.dataIndex]).map((e=>{const n={children:_e(e,t+1),_group:i.dataIndex};return"function"!=typeof r&&nl(n,r.toString(),cl()),i.titleIndex&&nl(n,i.titleIndex,tl(e[0],i.titleIndex)),nl(n,i.dataIndex,tl(e[0],i.dataIndex)),$.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(tl(t,r));return Number.isNaN(n)?e:e+n}),0);nl(n,r,i)})),n}))},Fe=e=>{ie(e),oe((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,a=e.length;t<a;t++){const a=r.get(e[t])||n.get(e[t]);a&&i.push(a)}return i})(e))},He=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:F;let i=[];return C.current.isTreeTable&&!n&&r.forEach((e=>{i.push(...((e,t)=>{var n;const{disabled:r}=d||{},{deriveRowKeys:i,recordsMap:a}=C.current,l=Ua(i,e);let o=[];if(!l)return o;let s=$e((null==l?void 0:l.children)||[]);return r&&(s=s.filter((e=>!a.has(e)||!r(a.get(e))))),o=[...new Set([...t,...s])],((null===(n=gl(i,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ua(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},Me=e=>{const{isTreeTable:t,allRowKeys:n,flattenRowKeys:r,deriveRowKeys:i,recordsMap:a}=C.current,{defaultExpandAllRows:l,rowExpandable:o,expandedRowRender:s}=u||{};let c=Array.isArray(e)?e:H;if(t){s&&Yn("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...F];M&&e.unshift(M),e.forEach((e=>{const t=gl(i,e)||[];c.push(...t.length>1?t.slice(0,-1).reverse():t)}))}return c=l?n.slice(0):[...new Set(c)],t&&(c=c.filter((e=>!r.includes(e)))),o&&c.filter((e=>{const t=a.get(e);return!!t&&o(t)})),c},$e=e=>{const t=[];for(let n=0;n<e.length;n++)Array.isArray(e[n].children)&&t.push(...$e(e[n].children)),t.push(e[n].rowKey);return t},je=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...je(e.children,t)),e.rowKey===t&&e.parentRowKey&&n.push(e.parentRowKey)})),n.length&&n.push(...je(e,n[n.length-1])),n},qe=na((()=>{null==g||g(k,Ve(A),Ke(P),D,{currentDataSource:at()})})),Ke=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Ve=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,i]=n.split("|");t[`${r}|${i}`]=e[n]}return t},ze=(e,t)=>{const n=Object.keys(el(e,t));return 1===n.length&&(n.includes(Xd.currentPageName)||n.includes(Xd.pageSizeName))},We=()=>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 a=yield e(r);200===a.code&&(n=null!==(t=i?pe(a.data,i):a.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;me((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=Ka(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:i,secretName:a}=r,l=Va(C.current.originColumns,t);de(t,{visible:n,disabled:i,secretName:a}),n||(e.noAuth=!0,l.noAuth=!0),a&&(e.formatType=`secret-${a}`,l.formatType=`secret-${a}`)}}));null==f||f(t)}})),Be=()=>kn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:i=Mn,afterFetch:a,callback:s}=o;if(!i(_))return;const c=!!(null===(e=null==l?void 0:l.fetch)||void 0===e?void 0:e.api);ee(!0);try{const[e,i]=c?yield Promise.all([o.api(r(_)),l.fetch.api(r(_))]):[yield o.api(r(_))];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 l=null!==(n=pe(e.data,r))&&void 0!==n?n:[];l="function"==typeof a?yield a(l):l;const c=pe(e.data,r.replace(/[^.]+$/,Xd.totalKey))||l.length||0,d=Math.max(Math.ceil(c/k.pageSize),1);if(_[Xd.currentPageName]>d)return Je(Object.assign(Object.assign({},k),{current:d}));Ye(Se.current?C.current.tableFullData.concat(l):l),Re(c),Xe((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),ee(!1),Oe(!1)})),Ue=na(Be),Ge=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Ge(e.children)),e.index=t,m||(e.pageIndex=(e=>{const{current:t,pageSize:n}=k;return!j||K?e:(t-1)*n+e})(t)),e))),Ye=e=>{const t=Pe(Ge(e));ot(t),st(t),Fe(He()),ae(Me()),Qe(),null==y||y(t)},Xe=e=>{var t,n,r;if(!V)return;const i=null!==(n=null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:Xd.summationKey,a=null!==(r=i?pe(e,i):e)&&void 0!==r?r:{},o={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{nl(o,e.dataIndex,Number(tl(a,e.summation.dataKey)))})),he(o)},Qe=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=at();if(e.length){const t=E(e[0],e[0].index);Fe([t])}else Fe([])}},Ze=()=>{if(!K)return;const e=et();Se.current||k.current>=e||(Oe(!0),Je(Object.assign(Object.assign({},k),{current:k.current+1})))},Je=({current:e,pageSize:t})=>{Q((n=>Object.assign({},n,{current:e,pageSize:t})))},et=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},tt=()=>{Je(Object.assign({},k,{current:1}))},nt=()=>{const{isTreeTable:e,deriveRowKeys:t}=C.current;if(!e)return;const n=rt(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?H.filter((e=>!r.includes(e))):H})());we.current.clear(),n.forEach(((e,t)=>we.current.set(e,t)))},rt=(e,t)=>{const n=[];return e.forEach((e=>{if(e.children&&n.push(...rt(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},it=()=>{const{current:e,pageSize:t}=k;return C.current.tableFullData.slice((e-1)*t,e*t)},at=()=>q?it():C.current.tableFullData,lt=()=>{const{allTableData:e,isTreeTable:t}=C.current,n=q?Ga(it()):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);we.current.has(i)&&n.push(t.get(i))}return n})(n):n;Ae(r),G(r)},ot=e=>{B(e),Y(e),X(e),ct(),nt(),lt()},st=e=>{U(e)},ct=()=>{ye(),C.current.allTableData.forEach((e=>fe(E(e,e.index),e)))},dt=()=>{te({})},ut=()=>{ne({})},pt=()=>{re([])},ht=()=>{Fe([])};return{initialTable:()=>{We(),Ie(),Le(),Ae(),j?Be():Ye(a)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Yn("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:ot,getTableData:Be,createTableList:at,createTableData:Ye,createGroupData:Pe,createSelectionKeys:He,createRowExpandedKeys:Me,setSelectionKeysEffect:Fe,findParentRowKeys:je,getAllChildRowKeys:$e,doFieldValidate:(e,t,n,r)=>{if(!Array.isArray(e))return Yn("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(xe.removeFromRequired({x:n,y:r}),xe.removeFromValidate({x:n,y:r}),e.forEach((e=>{var i;e.required&&Kn(t)&&xe.addToRequired({x:n,y:r,text:e.message||R.find((({dataIndex:e})=>e===r)).title+be("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(i=e.validator)||void 0===i?void 0:i.call(e,t))||xe.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:i}=xe.state,a=Ee(n,i),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:n.filter((e=>!a.includes(e))),updated:r.filter((e=>![...Ee(r,n),...Ee(r,i)].includes(e))),removed:i.filter((e=>!a.includes(e)))}},dataChange:()=>{null==v||v(C.current.tableFullData)},tableChange:qe,toLastPage:()=>{const e=et();k.current!==e&&Je(Object.assign({},k,{current:e}))},toFirstPage:tt,getPageCount:et,pagerChangeHandle:Je,scrollBottomDebouncer:ke,clearTableSorter:dt,clearTableFilter:ut,clearSuperFilters:pt,clearRowSelection:ht,clearRowHighlight:()=>{le("")},clearTableLog:()=>{xe.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;ve(),xe.destroy(),e.deregister(t)}}},nu=(e,n)=>{const{height:r,minHeight:i,maxHeight:a,ellipsis:l,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:`${Ja(i)}px`}),a&&Object.assign(n,{maxHeight:`${Ja(a)}px`}),w?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${Ja(r)}px`:`${t}px`}):n}),[r,a,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 a=1,l=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:i});Array.isArray(o)?(a=o[0],l=o[1]):oe(o)&&(a=o.rowSpan,l=o.colSpan)}if(y.length>0){const e=y.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,l=e.colSpan)}return{rowSpan:a,colSpan:l}},getStickyLeft:e=>{if(g.findIndex((t=>t.dataIndex===e))<0){const t=Va(f,e);e=t?za(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=Va(f,e);e=t?Wa(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),a=g.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(a-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 a=0;if(g.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,a+=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 a=Math.floor((t.minWidth||r)*e);n+=a,t.renderWidth=(t.minWidth||r)+a})),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 a=g.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),S((e=>Object.assign(Object.assign({},e),{tableBodyWidth:a})));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,a=E?e.$footer.offsetHeight:x.footerHeight,l=r-i-a,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:a,viewportHeight:l,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function ru({handler:t,delay:n=0}){const r=ma(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:a,isHeadSorter:l,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&&!!(l||o||m||f)),[b,l,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(a.length-v.length,0)})}`:""),C&&t.createElement("em",{onClick:()=>{c(),d(),u(),p(),jn((()=>s()))}},x("qm.table.alert.clear"))):null},au=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:i=!0}=e,{prefixCls:a,setFullScreen:l}=t.useContext(Pd),{t:o}=Ln(),s=()=>{l(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),i?t.createElement("span",{className:`${a}-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}));au.displayName="FullScreen";const lu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:i,getTableData:a}=t.useContext(Pd),{t:l}=Ln(),o=()=>{a()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${i}-reload`,title:l("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ze,null))):null}));lu.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=>il(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>al(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,a,l,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!==(l=null===(a=h.find((e=>e.value==t)))||void 0===a?void 0:a.text)&&void 0!==l?l: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=il(m)?new Vt(m).toFixed(c):m),d>=0&&""!==m&&(m=ll(m,d)),u){const t=e[`${qn(u)}Format`];t?m=t(m):Yn("Table","字段的格式化类型 `formatType` 配置不正确")}return m},n=e=>_n(e)?dl(e).join(""):null!=e?e:"";return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,i,a)=>{const l=tl(e,r.dataIndex),o=r.render?r.render(l,e,r,i,a):t(l,r,e);return n(o)}}},su=t.forwardRef(((e,n)=>{var r,i,a,l;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!==(l=null===(a=null==c?void 0:c.print)||void 0===a?void 0:a.rightLogo)&&void 0!==l?l:"",C=!(!x&&!E),w=t.useMemo((()=>Wn(Ba(o,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn]))),[o]),S=t.useMemo((()=>Wn(Ba(p,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn]))),[p]),N=t.useMemo((()=>Wn(o.filter((e=>e.printFixed)))),[o]),T=e=>{const t=Object.assign({},fl(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(Ya(n))})),t},O=()=>{const e=(e=>{const t=[];let n=[],r=0,i=0;for(;i<e.length;){const a=e[i];r+=a.width||a.renderWidth||a.minWidth||Xd.defaultColumnWidth,r<=Xd.printWidth?(n.push(a),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):(a.width=Xd.printWidth,n.push(a),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}">${ul(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(i+=`<tbody>${Ga(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:i,colSpan:a}=f(e,t,e.index,r,n);if(!i||!a)return null;return`<td rowspan="${i}" colspan="${a}">${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:a}=t,l=(null==a?void 0:a.render)?a.render(n):tl(e,`${i}_text`);return`<td>${0===r&&""===l?y("qm.table.config.summaryText"):_n(l)?dl(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},L=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:i}=e,a=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!i)return Promise.resolve({type:r,content:t,blob:e});sa(e,a)}})({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(at,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:a,showHeader:l}=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=$a(u),f=Ya(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]=ul(e.title),y.push({key:t,width:(n||i||r||Xd.defaultColumnWidth)/8})})),l&&(i?f.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:i}=e,a=fu(e),l=m.findIndex((({dataIndex:e})=>e===a.dataIndex));n[a.dataIndex]=ul(e.title),0!==r&&(r>1||i>1)&&b.push({s:{r:t,c:l},e:{r:t+i-1,c:l+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=Ga(s).map(((e,t)=>{const r={};return m.forEach(((i,l)=>{if("function"==typeof a){const{rowSpan:r,colSpan:a}=n(e,i,t,l,s);(a>1||r>1)&&b.push({s:{r:t+x,c:l},e:{r:t+x+r-1,c:l+a-1}})}const o=["percent","finance"].includes(i.formatType);r[i.dataIndex]=o?tl(e,i.dataIndex):d(e,t,i,l)})),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:a}=t,l=(null==a?void 0:a.render)?a.render(s):tl(e,i);n[i]=0===r&&""===l?o("qm.table.config.summaryText"):_n(l)?dl(l).join(""):l})),v.push(n)}));const{sheetName:w,useStyle:S}=t,N=new Zt.Workbook,T=N.addWorksheet(w);T.columns=y,l&&T.addRows(g).forEach((e=>{S&&pu(e,h),e.eachCell((e=>{const t=T.getColumn(e.col),n=Va(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=Va(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=Va(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,a,l="";for(t=0;t<e.rows.length;t+=1){for(i=e.rows[t],r=0;r<i.cells.length;r+=1)a=i.cells[r],l=l+(r?",":"")+n(a.textContent.trim());l+="\r\n"}return l})((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 a;for(a=0;a<r.length;a+=n){const e=r.slice(a,a+n),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);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=$a(n),a=new FileReader;a.onerror=()=>{R.error(o("qm.table.import.error"))},a.onload=e=>{const n=i.map((e=>ul(e.title))),r=new Zt.Workbook,a=e.target;a?r.xlsx.load(a.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),a=e.findIndex((e=>e&&e.length>0)),l=e[a],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,l);if(c){const r=e.slice(a+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=sl(i,jd)),(null==i?void 0:i.formula)&&(i=null!==(r=i.result)&&void 0!==r?r:i.value),t[l[n]]=i}));const r={};return n.forEach(((e,n)=>{var a;const{dataIndex:l,dictItems:o}=i[n];Array.isArray(o)&&((null===(a=t[e])||void 0===a?void 0:a.toString().includes(","))?t[e]=t[e].split(",").map((e=>s(o,e))).filter((e=>""!==e)):t[e]=s(o,t[e])),nl(r,l,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"))},a.readAsArrayBuffer(r)}}},yu=e=>{const{fileType:n,onChange:r}=e,{prefixCls:i}=t.useContext(Pd),{t:a}=Ln();let l,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 l||(l=document.createElement("form"),o=document.createElement("input"),l.className=`${i}--file-form`,o.name="file",o.type="file",l.appendChild(o),document.body.appendChild(l)),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(a("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(l),l=null,o=null},l.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(Xn,{onClick:()=>c()},a("qm.upload.text"))},bu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,prefixCls:a,createTableData:l,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:`${a}-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:a}=i.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&l(e),"add"===t.importType&&l([...n,...e]),"insert"===t.importType){const r=t.posIndex,i=n.slice(0,r).concat(e).concat(n.slice(r));l(i)}e.forEach((e=>{a.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:a}=t.useContext(Pd),{t:l}=Ln(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${a}-import`]:!0},u={visible:o,title:l("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:l("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(lt,null))),t.createElement(wa,u,t.createElement(bu,{columns:r,onClose:()=>s(!1)})))}));xu.displayName="TableImport";const Eu=e=>{const{columns:n,onChange:r}=e,{prefixCls:i,$size:a}=t.useContext(Pd),{t:l}=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"===a,[`${i}--sm`]:"small"===a},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(bl(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:l("qm.table.columnFilter.draggable")},t.createElement(Ge,null)),t.createElement("span",{className:"text"},ul(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:l("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(ot,null)),t.createElement("span",null,l("qm.table.columnFilter.text"))))},Cu=e=>{const{defaultValue:n,onClose:r,onOk:i}=e,{tableRef:a,prefixCls:l,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(Pd),{rowSelection:d}=a.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:`${l}-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:a=!0}=e,{global:l}=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((()=>Ba(i,[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn])),[i]),k=t.useMemo((()=>Ba(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}),a=t?`${t}.${i.index+1}`:`${i.index+1}`;return i.indexPath=a,i._level=n,Array.isArray(e.children)&&(i.children=L(e.children,a,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&nl(i,t,tl(i,t))})),i})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,i=(m?pl(t):t).reduce(((e,t)=>{if(null==t?void 0:t[Xd.summaryIgnore])return e;const n=Number(tl(t,r));return Number.isNaN(n)?e:e+n}),0);nl(n,r,i)})),[n]},P=(e,t,n,r)=>{const{precision:i,formatType:a}=n;let l=E(e,n,t,r);return i>=0&&!a&&""!==l&&(l=Number(l)),l},{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:a}=y;let l=[];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,a))&&void 0!==t?t:[];e="function"==typeof i?yield i(e):e,l=L(e)}}catch(e){}return N(!1),l})),H=e=>{var t;const n=null===(t=null==l?void 0:l.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=Ya(n),a=$a(n);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${a.map((({width:e,minWidth:t,renderWidth:n})=>`<col style="width:${e||n||t||Xd.defaultColumnWidth}px">`)).join("")}</colgroup>`,b&&(l+=["<thead>",i.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${ul(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${Ga(t).map((e=>`<tr>${a.map(((n,r)=>{const{rowSpan:i,colSpan:a}=g(e,n,e.index,r,t);return i&&a?`<td rowspan="${i}" colspan="${a}">${P(e,e.index,n,r)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),f&&r&&(l+=["<tfoot>",A(a,t).map((e=>`<tr>${a.map(((n,r)=>{const{dataIndex:i,summation:a}=n,l=(null==a?void 0:a.render)?a.render(t):tl(e,i);return`<td>${0===r&&""===l?x("qm.table.config.summaryText"):_n(l)?dl(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l},$=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&&(sa(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,a&&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(wa,V,t.createElement(Cu,{defaultValue:z,onClose:()=>w(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:ja(e.columns)}),kn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:i=1,endIndex:a}=t,{tableFullData:l,selectionRows:s}=o.current;let c=[];if(p?("all"===r&&(c=yield F()),"custom"===r&&(c=yield F(a),c=c.slice(i-1))):("all"===r&&(c=l.slice(0)),"custom"===r&&(c=l.slice(i-1,a||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);sa(n,`${e}.xlsx`),H(`${e}.xlsx`)}if("csv"===n){const n=_(t,M(t,c));sa(n,`${e}.csv`),H(`${e}.csv`)}}))}})))}));wu.displayName="TableExport";const Su=e=>{const{columns:n,onClose:r}=e,{tableRef:i,tableBodyRef:a,prefixCls:l,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:ul(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:`${l}-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,l]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:p,fieldAuth:h}=i.current;m(!0);const f=l.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[l.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var i,a;const o=u[l.rowIndex-1+t],s=n[l.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===(a=h[s.dataIndex])||void 0===a?void 0:a.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(nl(o,s.dataIndex,e),p.addToUpdated(o))}}))})),a.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:a}=t.useContext(Pd),{t:l}=Ln(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![Xd.expandableColumn,Xd.selectionColumn,"index","pageIndex",Xd.operationColumn].includes(e.dataIndex))))(a)),[a]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${i}-clipboard`]:!0},p={visible:o,title:l("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:l("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(st,null))),t.createElement(wa,p,t.createElement(Su,{columns:c,onClose:()=>s(!1)})))}));Nu.displayName="TableClipboard";const Tu=e=>{const{columns:n,onClose:r}=e,{tableRef:i,$size:a,selectionKeys:l,setSelectionKeysEffect:o}=t.useContext(Pd),{rowKey:s,rowSelection:c}=i.current.props,{t:d}=Ln(),u=t.useRef(null),p=ta(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=na((()=>{const e=u.current;y(e.offsetHeight-2*bo[a]-30)}),5);return sn((()=>{b()}),[p.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(Mp,{size:a,columns:m,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:l,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:a,getRowKey:l,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:p}=t.useContext(Pd),{rowSelection:h}=a.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)=>l(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(wa,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:a,prefixCls:l,$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=>a(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:ul(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,a=t.length;i<a;i++){const a=t[i];let l=!0;for(const t in e){const{type:n}=I.find((e=>e.dataIndex===t)).filter;let i=tl(a,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){l=!1;break}}l&&n.push(a)}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,l=x.current[C.current],o=a(l,l.index);let s=l.index;if(t&&f){const e=gl(r,o)[0];s=n.findIndex((t=>a(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:`${l}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"top"},t.createElement("div",{className:"container"},t.createElement(ba,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t.createElement("span",null,v("qm.table.alert.total",{total:F}))},t.createElement(ba.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(ba.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=cl(),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:a}=t.useContext(Pd),{t:l}=Ln(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:l("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${bo[a]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-super-search`,title:l("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(ut,null))),t.createElement(wa,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:a}=Ln(),[l,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:l,title:a("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:a("qm.table.pivotGrid.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(pt,null))),t.createElement(wa,c,t.createElement(_m,null)))}));ku.displayName="PivotGrid";const Lu=e=>{const{columns:n,group:r,summary:i}=e,{tableRef:a,$size:l,pagination:o,fetchParams:s,isFetch:c}=t.useContext(Pd),{fetch:d}=a.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=ml(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&nl(t,r,tl(e[0],r))})),i.forEach((n=>{const r=n.summary!==Xd.groupSummary.total.value?n.summary:Xd.groupSummary.recordTotalIndex,i=n.formula;"count"===i&&nl(t,r,e.length),"sum"===i&&nl(t,r,Oe(e,r)),"max"===i&&nl(t,r,ke(e,r)[r]),"min"===i&&nl(t,r,Le(e,r)[r]),"avg"===i&&nl(t,r,(Oe(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(a.current.tableFullData)),x=Object.assign(Object.assign({size:l,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:a,$size:l,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:ul(e.title),value:e.dataIndex}))),w=[Xd.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:ul(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:`${a}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(Mp,{ref:d,size:l,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:l,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:l,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=cl(),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[l]}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(wa,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:a}=Ln(),[l,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:l,title:a("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:a("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(mt,null))),t.createElement(wa,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:a,prefixCls:l,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=hl(h),S=t.useMemo((()=>!(w&&Ha(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:ul(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],a=null===(n=C.find((e=>e.dataIndex===i)))||void 0===n?void 0:n.filter.type,l=L(a);e.fieldType=a,e.expression=i?null===(r=l[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)),a=null==i?void 0:i.filter.type,l=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(a,R(e.expression)),editable:!0,items:l,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:`${l}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(Mp,{ref:p,size:a,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:a,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=cl(),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[a]}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:a}=Ln(),[l,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:l,title:a("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:a("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(ft,null))),t.createElement(wa,c,t.createElement(Du,{onClose:()=>o(!1)})))}));_u.displayName="SuperSearch";const Fu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:i,showReload:a,showPrint:l,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:a,print:l,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(au,{ref:S,isFullScreen:x,open:!f||$.fullScreen}),a&&t.createElement(lu,{ref:N,open:!f||$.reload}),l&&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:a,prefixCls:l,$size:o}=t.useContext(Pd),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=a.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(qa(e).map((e=>e.dataIndex)),qa(r).map((e=>e.dataIndex))).length>0?Hu(r,(t=>{const n=Va(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=Va(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,l;a.current.columnsDefined&&!me(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,l=t,kn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:l})}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=Va(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(a.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 a=h.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(i)));if(-1===a)return t.push(n);t.push(...h.current[a].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:a,noFixed:l}=e;if(0===a)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=ul(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",l?"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",l?"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)),a=e.map((e=>e.dataIndex));me(i,a)||((e,t)=>{Va(r,t).children=e,null==u||u([...r])})(bl(t),n)}},e.map((e=>R(e,"sub"))))),k={[`${l}__popper`]:!0,"column-filter__popper":!0,[`${l}--lg`]:"large"===o,[`${l}--sm`]:"small"===o},L=[`${l}-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([...bl(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,...bl(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,...bl(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:a,setFilters:l,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(),l((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:ul(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:ul(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:ol(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]:sl(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,a=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}})))}},a.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,a=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}})))}},a.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,a=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:a,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,[`${a}--lg`]:"large"===i,[`${a}--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:a,resizable:l,columnsChange:o=Hn}=r.current.props,s=t.useMemo((()=>Wa(n)),[n]),c={resizable:!0,"is--line":l&&!i};return t.createElement("div",{className:_e(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:i}=r.current,l=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=Za(t,n.$table).left-i.current.scrollLeft+c;n.$table.classList.add("c--resize"),l.style.left=`${u}px`,l.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),l.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),l.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof h&&(Va(a,s.dataIndex).width=h,o([...a]))},!1}})},Ku=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:i,fetchParams:a,createTableList:l,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 a=n?l().filter((e=>!n(e))).map((e=>i(e,e.index))):l().map((e=>i(e,e.index)));return Ae(a,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(a);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=pe(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:a}=p;a&&(n=ge(n,l().filter((e=>a(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:a}=r.current.props,[l,o]=t.useState((null==a?void 0:a.defaultExpandAllRows)||!1);Li((()=>{const{allRowKeys:e,flattenRowKeys:t,isTreeTable:n}=r.current;i(l?e.filter((e=>!(n&&t.includes(e)))):[])}),[l]);const s={[`${Jn("expand")}--icon`]:!0,expanded:l,collapsed:!l};return t.createElement("span",{className:_e(s),title:"",onClick:e=>{e.stopPropagation(),o(!l)},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:a,flattenColumns:l,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 a,l,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!==(a=e.ellipsis)&&void 0!==a?a: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===(l=i[n+(null!=d?d:1)])||void 0===l?void 0:l.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:a,title:l,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"},l)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:ul(l)},r.current.isTreeTable&&n===h&&F?t.createElement(Vu,null):null,n===Xd.expandableColumn&&F?t.createElement(Vu,null):l)),s&&c.push(t.createElement(C,{key:1,placement:"top",title:s},t.createElement(bt,{className:"tip"}))),a&&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=l.find((e=>e.dataIndex===r)),a=t[r],o=tl(e,r),s=tl(n,r),c="function"!=typeof(null==i?void 0:i.sorter)?B(o,s):i.sorter(e,n);if(0!==c)return"ascend"===a?c:-c}return 0})).slice(0))(p?x(pl(t)):t,e);E(n)},G=()=>{_&&Y()},Y=()=>{const e=c.length?hl(c):hl(s),t=""!==e?p?x(Ma(pl(k),e,P)):Ma(k,e,P):k;E(t),W(!0)},X=Ya(n),{tableBodyWidth:Q}=a;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,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("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,a=null!==(r=n.initialDeps)&&void 0!==r?r:[];return()=>{var r,l,o,s;n.key&&(null===(r=n.debug)||void 0===r||r.call(n));const c=e();return c.length!==a.length||c.some(((e,t)=>a[t]!==e))?(a=c,n.key&&(null===(l=n.debug)||void 0===l||l.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 a=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 a.observe(n,{box:"border-box"}),()=>{a.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 a=e.options.useScrollendEvent&&tp?()=>{}:Xu(r,(()=>{t(i,!1)}),e.options.isScrollingResetDelay),l=r=>()=>{const{horizontal:l,isRtl:o}=e.options;i=l?n.scrollLeft*(o?-1:1):n.scrollTop,a(),t(i,r)},o=l(!0),s=l(!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,a;const l=e+t;null===(a=null===(i=r.scrollElement)||void 0===i?void 0:i.scrollTo)||void 0===a||a.call(i,{[r.options.horizontal?"left":"top"]:l,behavior:n})};class ap{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 a=r.get(t.lane);if(null==a||t.end>a.end?r.set(t.lane,t):t.end<a.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},a)=>{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 l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,l);for(let i=l;i<e;i++){const e=r(i),l=1===this.options.lanes?o[i-1]:this.getFurthestMeasurement(o,i),s=l?l.end+this.options.gap:t+n,c=a.get(e),d="number"==typeof c?c:this.options.estimateSize(i),u=s+d,p=l?l.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,a=lp(0,r,i,n);let l=a;for(;l<r&&e[l].end<n+t;)l++;return{startIndex:a,endIndex:l}}({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,a=this.elementsCache.get(i);a!==e&&(a&&this.observer.unobserve(a),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[lp(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",a=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-n;return Math.max(Math.min(a,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 a="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,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,a]=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,a));t=i,r=this.getScrollOffset(),Math.abs(t-r)<1||this.scrollToIndex(e,{align:a,behavior:n})}else this.scrollToIndex(e,{align:a,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 lp=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else{if(!(a>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 ap(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,a,l,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=l.findIndex((e=>e===v.key)),t=l[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&&a({dragNode:w,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?a({dragNode:w,dropNode:S,dropPosition:0})?E=0:N=!1:0===C?f>-1.5?a({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:a({dragNode:w,dropNode:S,dropPosition:0})?E=c?1:0:a({dragNode:w,dropNode:S,dropPosition:1})?E=1:N=!1:a({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:a,createTableFullData:l,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,a=0)=>{const l=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:a,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,a+1)),t[s]=c,l.push(c)})),l};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("-"),a=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===a?n.splice(e,0,u):n.splice(e+1,0,u)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(u)}));l(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),a(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:l,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)),a(t)}),800)),p.current.eventKey!==o||0!==l?T({dragOverNodeKey:E,dropPosition:r,dropLevelOffset:l,dropTargetKey:o,dropContainerKey:s,dropTargetPos:v,dropAllowed:b}):I()):I()},onNodeDragOver:(e,t)=>{if(!p.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:a,dropContainerKey:l,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:m}=cp(e,p.current,t,C,h.current,u,c,g,i,!d);-1===x.indexOf(a)&&o&&(p.current.eventKey===a&&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&&a===S.dropTargetKey&&l===S.dropContainerKey&&s===S.dropTargetPos&&o===S.dropAllowed&&m===S.dragOverNodeKey||T({dropPosition:n,dropLevelOffset:r,dropTargetKey:a,dropContainerKey:l,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:a,dropAllowed:l,dragOverNodeKey:o}=S;if(!l)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(a),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 a=An(n),l=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{vp(e,t)&&(l.current.isPointerDown=!0)},o=e=>{l.current.ignoreEmulatedMouseEvents?l.current.ignoreEmulatedMouseEvents=!1:n&&l.current.isPointerDown&&vp(e,t)&&gp(e,i)&&(l.current.isPointerDown=!1,a(e))},s=e=>{l.current.ignoreEmulatedMouseEvents=!0,n&&l.current.isPointerDown&&vp(e,t)&&gp(e,i)&&(l.current.isPointerDown=!1,a(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,a,l,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:a,className:l,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:a,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=a._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(l,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:a}=e,{tableRef:l,getAllChildRowKeys:o}=t.useContext(Pd),{rowSelection:s}=l.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(!l.current.isTreeTable||i)return!1;const a=Ua(l.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==a?void 0:a.children)&&void 0!==r?r:[]),n)};return"radio"===c?(()=>{const e=s.disabled,r=null==e?void 0:e(i),l=!r&&n[0]===a;return t.createElement(q,{checked:l,disabled:r})})():(()=>{const e=s.disabled,r=null==e?void 0:e(i),l=!!n.includes(a);return t.createElement(H,{checked:l,indeterminate:d(a),disabled:r})})()},Cp=e=>{const{record:n,rowKey:r,style:i}=e,{tableRef:a,rowExpandedKeys:l,setRowExpandedKeys:o}=t.useContext(Pd),{expandable:s={}}=a.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>l.includes(r)),[l,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?l.filter((e=>e!==r)):[...l,r];o(t)},style:i})},wp=t.forwardRef(((e,n)=>{const{size:r,defaultValue:i,value:a,min:l,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)<l&&(t=l.toString()),p>=0&&""!==t&&(t=new Vt(t).toFixed(p)),t},E=void 0!==a,[C,w]=t.useState(null!=i?i:""),S=v(E?a: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),l>=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,a,l,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===(a=S.state.required.find((({x:e,y:t})=>e===u&&t===p)))||void 0===a?void 0:a.text)||"",J=(null===(l=S.state.validate.find((({x:e,y:t})=>e===u&&t===p)))||void 0===l?void 0:l.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&&le()}),[x]),t.useLayoutEffect((()=>{const{items:e}=T;re&&e&&ae(e.map((e=>({[_.current.valueKey]:e.value,[_.current.textKey]:e.text}))))}),[]);const ie=()=>{v(),b()},ae=e=>{M.current=e},le=()=>{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:le,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:a,extra:l={},rules:o=[],onInput:s,onChange:c,onEnter:d,onBlur:h}=T,m=tl(e,i),g=Object.assign({},{minRows:1,maxRows:4},l.autoSize),v=r?{rows:g.minRows,autoSize:g}:null,b=l.password?O.Password:r?O.TextArea:O;return t.createElement(b,Cn({ref:R,size:f,value:m,maxLength:l.maxLength,showCount:l.showCount},v,{autoComplete:l.password?"new-password":"off",placeholder:l.placeholder||C("qm.table.editable.inputPlaceholder"),allowClear:l.allowClear,readOnly:l.readOnly,disabled:l.disabled,suffix:l.suffix,onChange:t=>{var n;const r=null!==(n=t.target.value)&&void 0!==n?n:"";nl(e,i,r),y(o,r,u,p),w(),null==s||s({[Y]:r}),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:a,formatType:l}=n,{type:o,extra:s={},rules:c=[],onInput:d,onChange:h,onEnter:m,onBlur:g}=T,v=tl(e,i);let b,x;return"finance"===l&&(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"===l&&(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:a,stringMode:s.stringMode,prefix:s.prefix,suffix:null!==(r=s.suffix)&&void 0!==r?r:"percent"===l?"%":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=>{nl(e,i,t),y(c,t,u,p),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"===l&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),nl(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"===l&&"."===n.charAt(n.length-1)&&(r=Number(t)/100),null==m||m({[Y]:r},e)}})},select:(e,n,r)=>{var i;const{dataIndex:a,dictItems:l=[]}=n,{type:o,extra:s={},rules:c=[],items:d,onChange:h,onEnter:m}=T,g=d||l,v=tl(e,a);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=>{nl(e,a,t),y(c,t,u,p),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:a}=n,{type:l,extra:o={},rules:s=[],onChange:c}=T,d=r||"exactdate",h=tl(e,a);return t.createElement(En,{size:f,popupClassName:Xd.popupClassName,value:null!==(i=ol(h,Rl[d]))&&void 0!==i?i:void 0,picker:Il[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 n=sl(t,Rl[d]);nl(e,a,n),y(s,n,u,p),ce(e,u,p),null==c||c({[Y]:n},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:a,extra:l={},rules:o=[],onChange:s}=T,c="HH:mm:ss",d=tl(e,i);return t.createElement(wn,{size:f,popupClassName:Xd.popupClassName,value:null!==(r=ol(d,c))&&void 0!==r?r:void 0,format:l.format||c,placeholder:l.placeholder,allowClear:l.allowClear,disabled:l.disabled,style:{width:"100%"},onChange:t=>{const n=sl(t,c);nl(e,i,n),y(o,n,u,p),ce(e,u,p),null==s||s({[Y]:n},e),ie()}})},checkbox:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:a={},rules:l=[],onChange:o}=T,{trueValue:s=Hd,falseValue:c=Md,disabled:d}=a,h=tl(e,r);return t.createElement(H,{checked:h===s,disabled:d,onChange:t=>{const n=t.target.checked?s:c;nl(e,r,n),y(l,n,u,p),ce(e,u,p),null==o||o({[Y]:n},e),ie()}})},switch:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:a={},rules:l=[],onChange:o}=T,{trueValue:s=Hd,falseValue:c=Md,disabled:d}=a,h=tl(e,r);return t.createElement(K,{checked:h===s,disabled:d,onChange:t=>{const n=t?s:c;nl(e,r,n),y(l,n,u,p),ce(e,u,p),null==o||o({[Y]:n},e),ie()}})},"search-helper":(e,n)=>{var r;const{dataIndex:i,precision:a}=n,{type:l,extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,v=rl(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)||[],a={[i]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(oe(e))for(const t in e)a[t]="function"==typeof e[t]?e[t](n):n;else a[e]=n})),a},w=e=>{const{autoQueryAssign:t=!0}=c;t&&(D.current=E(e)),j(!0)},S=(t,r)=>{const{beforeOpen:i}=c,a=(null!=i?i:Mn)({[Y]:v},e,n);(null==a?void 0:a.then)?a.then((()=>{w(t),null==r||r()})).catch((()=>{})):!1!==a&&(w(t),null==r||r())},N=e=>{const t={};for(const n in x){const r=x[n];n!==i&&(t[n]=rl(e,r))}const n=x[i]?rl(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="",n)=>{var r;if(oe(n)&&Object.keys(n).length)for(const t in n){const i=n[t],a=g.find((e=>e.dataIndex===t));if(a){nl(e,t,i,a.precision);const n=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else nl(e,t,i)}ne&&!t&&((e,t,n,r)=>{if(!t.includes("|"))return nl(e,t,n,r);const i=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&nl(e,t,null===(r=i[n])||void 0===r?void 0:r.trim())}))})(e,c.combinedDataIndex,""),nl(e,i,t,a),y(s,t,u,p),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:a}=c;if(P.current&&!$)return n&&r&&(null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=c,{beforeFetch:r=Mn}=t.fetch;return new Promise(((i,a)=>kn(void 0,void 0,void 0,(function*(){var l;const o=ye({},t.fetch.params,Object.assign(Object.assign({},n),E(e)),{currentPage:1,pageSize:500});if(!r(o))return a();V(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(l=pe(e.data,t.fetch.dataKey))&&void 0!==l?l:[];i(n)}else a()}catch(e){a(e)}finally{jn((()=>V(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>rl(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(wa,O,t.createElement($p,k)))},"search-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:a,items:l=[],extra:o={},rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=tl(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=>{nl(e,i,t),y(s,t,u,p),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;ae(be([...M.current.filter((e=>t.includes(e[r]))),...e],r));const i=M.current.map((e=>({text:e[n],value:e[r]}))),a=be([...i,...l],"value").filter((e=>t.includes(e.value)));W(a),S(a.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;ae(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(wa,N,t.createElement($p,I)))},"tree-helper":(e,n)=>{var r,i;const{dataIndex:a,precision:l}=n,{type:o,extra:s={},rules:c=[],helper:d={},onChange:h,onEnter:m}=T,v=rl(e,ne?d.combinedDataIndex:a),b=d.fieldAliasMap;b||Yn("Table","helper 需要配置 `fieldAliasMap` 选项");const x="function"==typeof b?b():b||{};Object.keys(x).includes(a)||Yn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),ne&&(d.combinedDataIndex.split("|").every((e=>Object.keys(x).includes(e)))||Yn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),x[a].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="",n)=>{var r;if(oe(n)&&Object.keys(n).length)for(const t in n){const i=n[t],a=g.find((e=>e.dataIndex===t));if(a){nl(e,t,i,a.precision);const n=null===(r=a.editRender)||void 0===r?void 0:r.call(a,e,a);n&&Array.isArray(n.rules)&&y(n.rules,i,u,t)}else nl(e,t,i)}nl(e,a,t,l),y(c,t,u,p),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!==a&&(t[n]=rl(e,r))}const n=x[a]?rl(e,x[a]):"";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(wa,N,t.createElement(zp,I)))},"tree-helper-multiple":(e,n)=>{var r;const{dataIndex:i}=n,{type:a,extra:l={},items:o=[],rules:s=[],helper:c={},onInput:d,onChange:h,onEnter:m}=T,g=tl(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=>{nl(e,i,t),y(s,t,u,p),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;ae(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:l.placeholder||C("qm.table.editable.selectPlaceholder"),allowClear:l.allowClear,maxTagCount:l.collapseTags?"responsive":void 0,maxTagTextLength:l.maxTagTextLength,disabled:l.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!$&&x()},onDoubleClick:()=>{l.disabled||x()},onChange:e=>{const{valueKey:t}=b;ae(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:l.disabled,icon:t.createElement(Ye,null),onClick:()=>{x()}})))),t.createElement(wa,N,t.createElement(zp,I)))},custom:(e,n)=>{const{dataIndex:r}=n,{type:i,extra:a={},rules:l=[],render:o,onChange:s}=T;if(!o)return Yn("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const c=tl(e,r),d=t=>{nl(e,r,t),y(l,t,u,p),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:a.disabled,readOnly:a.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:a}=r,l=["cell--show",{"is-cell-bg":n&&a}];return t.createElement(t.Fragment,null,t.createElement("span",{className:_e(l),style:{color:n?i:""}},e.children),n&&a&&t.createElement("i",{className:"cell--bg",style:{background:a}}))})(),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:a}=e,{t:l}=Ln();return Tp(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=zt(n,r);null==a||a(n,c),c&&i&&R.success(l("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:a,rowIndex:l,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=tl(a,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,a,i,l,o):x(w,i,a);return[e,v?t.createElement(Np,{ref:r,column:i,record:a,rowKey:s,columnKey:m},e):null]}),[h,a,w,g,v],((e,t)=>{if(y){const[,n]=e,[,r]=t;return y(r,n,a)}return!((e,t,n=!1)=>{const r=new Set;return function e(t,i,a=1){if(r.has(t))return!1;if(t===i)return!0;if(n&&a>1)return!1;r.add(t);const l=a+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],l))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],l)))}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:a,rowKey:s});if(m===Xd.selectionColumn)return t.createElement(Ep,{selectionKeys:u,column:i,record:a,rowKey:s});if(N)return N;if(d.current.isTreeTable&&m===p)return t.createElement(t.Fragment,null,(e=a._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:a,rowKey:s,style:T(a)?{}:{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:a,tableFlatData:l,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=na(((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 a=r[i].querySelectorAll("td");for(let t=0;t<a.length;t++)if(!(a[t].offsetLeft>e||a[t].offsetLeft+a[t].offsetWidth<e)){n=a[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,a]=[g.rowKey,y.rowKey];let[s,c]=[0,0];for(let e=0;e<l.length;e++){const t=i(l[e],l[e].index);if(t==r&&(s=e),t==a){c=e;break}}const d=o.slice(Math.min(t,n),Math.max(t,n)+1);return l.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:tl(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:a}=N();w({startX:e.clientX,startY:e.clientY,startOffsetX:e.clientX-r,startOffsetY:e.clientY-n,containerSizeX:i,containerSizeY:a}),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,a]=[e-r,t-n],{el:l,et:o,ew:s,eh:c}=q();return!(i<l||i>l+s||a<o||a>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],[a,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<l.length;e++){const t=l[e],a=i(t,t.index);if(a==n&&(p=a,d=e),a==r){u=e;break}}const h={rowKey:p,dataIndex:o[Math.min(a,c)].dataIndex,rowSpan:u-d+1,colSpan:Math.abs(c-a+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<l.length;t++){const n=l[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:a,l:l,t:o}=y;return i=l-n>0?l-n+i:Math.abs(l-n)+e,a=o-r>0?o-r+a:Math.abs(o-r)+t,l=l>n?n:l,o=o>r?r:o,{sl:n,st:r,sw:e,sh:t,el:l,et:o,ew:i,eh:a}};return t.createElement("div",{className:`${a}--area-select`},(()=>{if(!g||!y)return null;const{sl:e,st:n,sw:r,sh:i,el:a,et:l,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:a,top:l,width:o,height:s}})))})())}));Lp.displayName="AreaSelect";const Ap=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:i,prefixCls:a,tableFlatData:l,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:ae,onNodeDragOver:le,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:a}=r.current,l=()=>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:l,estimateSize:()=>a,indexAttribute:"data-row-index",overscan:1,enabled:r.current.scrollYLoad}),c=s.getVirtualItems(),d=sp({horizontal:!0,count:n.length,getScrollElement:l,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,a,l;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!==(l=null===(a=u[s])||void 0===a?void 0:a.start)&&void 0!==l?l: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)}}})(l,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,a={};return x&&Object.assign(a,{minHeight:"100px"}),D&&Object.assign(a,{minHeight:Ja(D)-e-n+"px"}),_&&Object.assign(a,{maxHeight:Ja(_)-e-n+"px"}),P||r||i?Object.assign(Object.assign({},a),{maxHeight:"",minHeight:"",height:`${t}px`}):a}),[P,_,D,x,h]),ke=An((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:i}=re.current,{scrollTop:a,scrollLeft:l}=e;if(l!==i){G&&(t.$header.scrollLeft=l),m&&(t.$footer.scrollLeft=l);const e=l>0,n=Math.ceil(l)+h.tableWidth<h.tableBodyWidth;y!==e&&I(e),b!==n&&R(n)}a!==n&&Math.ceil(a)+h.viewportHeight>=ee.current.parentNode.offsetHeight&&A({type:"scroll",target:e,preventDefault:Hn,stopPropagation:Hn}),re.current={prevST:a,prevSL:l}})),Le=An((e=>{var t,n,a,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!==(a=f[0])&&void 0!==a?a:v)&&void 0!==o?o:null,n=null!==(c=l.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=l.length;let n=l.findIndex((e=>i(e,e.index)===Te[0]));const r=38===p?(--n+t)%t:++n%t,a=l[r],o=i(a,a.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,a))||s||w([o]),!M||(null===(u=M.disabled)||void 0===u?void 0:u.call(M,a))||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 a=l.length,o=t,s=ee.current.querySelectorAll("tbody > tr"),c=l.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===a-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,a=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),l=o.slice(0,a).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[a].width||o[a].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?l<n.current.scrollLeft+p?n.current.SET_SCROLL_LEFT(l-p):t===i-1&&n.current.SET_SCROLL_LEFT(l-(h.tableWidth-u)+m):l+u>n.current.scrollLeft+(h.tableWidth-m)?n.current.SET_SCROLL_LEFT(l-(h.tableWidth-u)+m):0===t&&n.current.SET_SCROLL_LEFT(l-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 a;const{dataIndex:l}=n;if([Xd.expandableColumn,Xd.operationColumn].includes(l))return;const o=i(t,t.index);Ke([o,l]);const s=Me(o,l),{type:c,selectByClickRow:d=!0,disabled:u=Hn}=H||{};!c||u(t)||s||(d||l===Xd.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:i=!0,onSelect:a}=H||{};if("radio"===n&&w([e]),"checkbox"===n){const n=!f.includes(e),l=r.current.isTreeTable&&!i?ze(e,f,n):Ve(e,f,n);w(l),null==a||a(n,t,l)}})(o,t),[Xd.selectionColumn].includes(l)||(!M||(null===(a=M.disabled)||void 0===a?void 0:a.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:a}=H||{},{deriveRowKeys:l,recordsMap:o}=r.current,s=Ua(l,e);let c=[],d=L((null==s?void 0:s.children)||[]);a&&(d=d.filter((e=>!o.has(e)||!a(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(i=gl(l,e))||void 0===i?void 0:i.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Ua(l,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,a=0)=>{const{scrollXLoad:l}=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=(l?ve:o).map(((t,r)=>Be(l?o[t.index]:t,l?t.index:r,e,n,i,a)));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:ae,onNodeDragOver:le,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,a,l)=>{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[`${a}-${h}`]=e,row:r,column:e,rowIndex:i,columnIndex:n,rowKey:a,depth:l,showTitle:b}))},Ue=(e,t,n,r)=>{var i;let a=1,o=1;const s=z;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:l});Array.isArray(c)?(a=c[0],o=c[1]):oe(c)&&(a=c.rowSpan,o=c.colSpan);const d=null!==(i=be()[0])&&void 0!==i?i:0;if(e===l[d]&&0===a)for(let e=d;e<l.length;e++){const n=s({row:l[e],column:t,rowIndex:e,columnIndex:r,tableData:l});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;a++}}if(u.length>0){const e=u.find((e=>e.row===n&&e.col===r));e&&(a=e.rowSpan,o=e.colSpan)}return{rowSpan:a,colSpan:o}};return t.createElement(t.Fragment,null,t.createElement(oa,{ref:r.current.scrollBarRef,wrapClassName:`${a}--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:`${a}--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:a}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${i||a}px`,minWidth:`${i||a}px`}})})))})(),t.createElement("tbody",null,((e,n=0)=>{const{scrollYLoad:a}=r.current,o=[],s=a?e:l;return s.forEach(((e,r)=>{const c=a?l[e.index]:e,d=a?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:a,leftFixedColumns:l,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,a)=>{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=l[l.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):tl(i,`${p}_text`),x=0===a&&""===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(a,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}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("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},a.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,a;const{current:l,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===(a=null===(i=null==d?void 0:d.table)||void 0===i?void 0:i.pagination)||void 0===a?void 0:a.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(l,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:l,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=ln(_d,e),{rowKey:i,columns:a,loading:l,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:a}=e,l=t.useRef({props:e,uid:Bd(),tableManager:Gd,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!a,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,l.current.props=o;const s=(e,t,r="",i="",a=0)=>e.map((e=>{const l=n(e,e.index),o=r?`${r}#${l}`:`${l}`,c=i?`${i}.${e.index+1}`:`${e.index+1}`,d={level:a,rowKey:l,rowKeyPath:o,indexPath:c};return e.indexPath=c,e._level=a,Array.isArray(e.children)&&(d.children=s(e.children,l,o,c,a+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:l},l.current),{setElementStore:(e,t)=>{l.current.elementStore[e]=t},setOriginColumns:e=>{l.current.originColumns=e},setTableFullData:e=>{l.current.tableFullData=e},setTableOriginData:e=>{l.current.tableOriginData=e},setAllTableData:e=>{const t=Ga(e);l.current.allTableData=t,l.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{const t=l.current.tableFullData.some((e=>Array.isArray(e.children)));l.current.isTreeTable=t,l.current.deriveRowKeys=t?s(e,""):[],l.current.flattenRowKeys=t?c(l.current.deriveRowKeys):[]},setInvalidRowKeys:e=>{l.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{l.current.fieldAuth[e]=t},setColumnsDefined:e=>{l.current.columnsDefined=e},setResizeState:e=>{l.current.resizeState=e},setHandleState:e=>{l.current.handleState=e},setSummaries:e=>{l.current.summaries=e},setScrollXLoad:e=>{l.current.scrollXLoad=e},setScrollYLoad:e=>{l.current.scrollYLoad=e},setShouldToTop:e=>{l.current.shouldToTop=e},setSelectionRows:e=>{l.current.selectionRows=e},setRecordsMap:(e,t)=>{l.current.recordsMap.set(e,t)},setUnMounted:e=>{l.current.unMounted=e},clearElementStore:()=>{for(const e in l.current.elementStore)l.current.elementStore[e]=null},clearRecordsMap:()=>{l.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:ae,setPagination:le,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,a,l,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===(l=null===(a=null==E?void 0:E.table)||void 0===a?void 0:a.pagination)||void 0===l?void 0:l.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:at,isGroupSubtotal:lt,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:ae,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,editableColumns:je,tableFullData:k,pagination:ae,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:lt,doLayout:bt,setTableFlatData:Z,setTableFullData:P,setTableOriginData:D,setAllTableData:_,setDeriveRowKeys:F,setPagination:le,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:a,expandable:l,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(!a)return;const{onChange:e}=a;"radio"===a.type&&c.current.setClickedValues(p.length?[p[0],""]:[]),p.__prevent__||null==e||e(p,s.current.selectionRows),Qa(p)}),[p]),Li((()=>{if(!l)return;const{onChange:e}=l;h.__prevent__||null==e||e(h,h.map((e=>s.current.recordsMap.get(e)))),Qa(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(a.selectedRowKeys);me(e,p)||N(Xa(e))}),[null==a?void 0:a.selectedRowKeys]),Li((()=>{const e=P(l.expandedRowKeys);me(e,h)||I(Xa(e))}),[null==l?void 0:l.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:ae,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:ae,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:lt,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:le,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,ae,ct,se,de,pe,ze,ge,Pe,Te,Re,Xe,Qe,ke,ot,Ge,lt,De]);((e,n)=>{const{getRowKey:r,tableRef:i,toolBoxRef:a,tableBodyRef:l,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 a=t.includes(i);return a&&(null==n||n(e,i)),!a}));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)=>{l.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{a.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{E(e)},SET_SELECTION:(e,t)=>{I(t?Xa([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?Xa([...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=Va(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:a}=i.current,l=(Array.isArray(e)?e:[e]).filter((e=>oe(e)));if(!l.length)return;l.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[Xd.expandableColumn,Xd.selectionColumn,Xd.operationColumn].includes(n)||nl(e,n,tl(e,n))})),n.addToInserted(e)}));const o="before"===(null==t?void 0:t.mode),c=void 0===(null==t?void 0:t.parentRowKey),d=a;if(c)o?d.unshift(...l):d.push(...l);else{const e=vl(a,(e=>t.parentRowKey===r(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}c&&N(Object.assign({},i.current.handleState,{insert:o?"before":"after"})),y(d),g()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n}=i.current,a=(Array.isArray(e)?e:[e]).map((e=>oe(e)?r(e,e.index):e));if(!a.length)return;let l=!1;const o=K(n,a,((e,n)=>{t.addToRemoved(e),c.forEach((r=>{const{dataIndex:i,editRender:a}=r,l=null==a?void 0:a(e,r);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:n,y:i}),t.removeFromValidate({x:n,y:i}),t.removeFromEdited({x:n,y:i}))})),l=!0}));l&&(N(Object.assign({},i.current.handleState,{remove:!0})),b(o),I(p.filter((e=>!a.includes(e)))),a.includes(m)&&_(),R(h.filter((e=>!a.includes(e)))),g(),jn((()=>{S(K(i.current.tableOriginData,a))})))},VALIDATE_FIELDS:(e,t)=>{i.current.allTableData.forEach((n=>{c.forEach((i=>{const{dataIndex:a,editRender:l}=i,o=null==l?void 0:l(n,i);if(!o)return;const s=r(n,n.index);if(e&&!e.includes(s))return;if(t&&!t.includes(a))return;const{rules:c=[],disabled:d}=o;d||w(c,tl(n,a),s,a)}))}));const{required:n,validate:a}=P(),l=[...n,...a];return l.length&&C(l[0].rowKey),A(),{required:n,validate:a}}})))})(n,{getRowKey:R,tableRef:O,toolBoxRef:N,tableBodyRef:S,columnFilterRef:T,flattenColumns:$e,editableColumns:je,pagination:ae,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:ae.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:at,showToolBox:v,tableColumns:Me}),t.createElement(Mu,{ref:T,columns:a}))),t.createElement(Yi,{spinning:null!=l?l: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({},ae,{onChange:(e,t)=>$t({current:e,pageSize:t})}))))}));Mp.displayName="QmTable";const $p=e=>{var n;const{uniqueKey:r,multiple:i,initialValue:a,selectionRows:l,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=ta(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,a)),[_,F]=t.useState([]),H=()=>{const e=f.current,t=e.querySelector(".form-wrap");R(e.offsetHeight-t.offsetHeight-2*bo[h]-30)},M=na(H,5);sn((()=>{M()}),[y.width]),Li((()=>{me(s,O)||k(s)}),[s]),t.useEffect((()=>{$()}),[P]),t.useEffect((()=>{l&&v.current.SET_SELECTION_ROWS(l)}),[l]),t.useEffect((()=>{var e;a&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(a))}),[]);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:a,beforeFetch:l=Mn}=n;if(l(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,a))&&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:a,selectionRows:l,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=ta(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,a)),[$,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=na(q,5);sn((()=>{K()}),[b.width]),Li((()=>{me(s,P)||D(s)}),[s]),t.useEffect((()=>{V()}),[H]),t.useEffect((()=>{l&&y.current.SET_SELECTION_ROWS(l)}),[l]),t.useEffect((()=>{var e;a&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(a)),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:a,beforeFetch:l=Mn}=n;if(l(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,a))&&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:a="text"}=d.fetch;try{const l=yield t(n);if(200===l.code){const t=Array.isArray(l.data)?l.data:null!==(e=pe(l.data,r))&&void 0!==e?e:[],n=Ml(t,i,a);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:a,tree:l={},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=l.fetch)||void 0===n?void 0:n.params),g={[`${Jn("tree-helper")}--wrapper`]:!0},v=l.fetch?Object.assign(Object.assign({},zn(l.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:_e(g,s),style:c},t.createElement(Ad,{multiple:a,fetch:v,fieldsDefine:{valueKey:null===(r=l.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(i=l.fetch)||void 0===i?void 0:i.textKey},autoFocus:!0,asyncLoad:l.asyncLoad,checkStrictly:l.checkStrictly,checkStrategy:l.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:l.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:a=[],table:l={},onClose:o}=e,{$size:s}=Pn(e),{t:c}=Ln(),d=t.useRef(null),u=t.useRef(null),p=t.useRef(null),h=ta(d),[m,f]=t.useState(l),[g,v]=t.useState(!1),[y,b]=t.useState([]),[x,E]=t.useState(300),[C,w]=t.useState(a),[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||(l.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=l.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=na(P,5);sn((()=>{D()}),[h.width]),Li((()=>{me(a,C)||w(a)}),[a]),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:a=Mn}=n;if(a(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[a,l]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;l(t||null)}));const[o,s]=t.useState(null),c=()=>{if(a){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:i,bottom:a,left:l}=e.getBoundingClientRect();return r>=0&&l>=0&&i<=t&&a<=n})(a)&&n&&a.scrollIntoView(i);const{left:e,top:t,width:r,height:l}=a.getBoundingClientRect(),o={left:e,top:t,width:r,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[a,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]),a]}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:a,visibleFirst:l}=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:a,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:{},a={};switch(e){case"top":case"bottom":a.shiftX=2*t.arrowOffsetHorizontal+n,a.shiftY=!0,a.adjustY=!0;break;case"left":case"right":a.shiftY=2*t.arrowOffsetVertical+n,a.shiftX=!0,a.adjustX=!0}const l=Object.assign(Object.assign({},a),i);return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,u,t,n),l&&(d.htmlRegion="visibleFirst")})),s}const th={fill:"transparent",pointerEvents:"auto"},nh=e=>{const{prefixCls:n,rootClassName:r,pos:i,showMask:a,style:l={},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"},l)},a?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:a,onPlay:l}=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==a||a():null==l||l())};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,a=window.innerHeight,l=e.clientX-$i(t).x,o=e.clientY-$i(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>i-n-1&&(s=i-n-1),c<0&&(c=0),c>a-r-1&&(c=a-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:a,title:l,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(a)?t.createElement("div",{className:`${n}-cover`},a):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`},l)),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"))))))},ah=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(ih,e))},lh={left:"50%",top:"50%",width:1,height:1},oh=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:i,current:a,onChange:l,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:a,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==l||l(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 ae=()=>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,a]=[e+n/2,t+r/2],l=new MouseEvent(M,{bubbles:!0,cancelable:!0,button:0,clientX:i,clientY:a}),o=document.elementFromPoint(i,a);o&&(o.dispatchEvent(l),yield $n(null!=$?$:320))})),le="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:le,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(ah,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 ae(),ne(T-1)})),onNext:()=>kn(void 0,void 0,void 0,(function*(){yield ae(),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||lh),{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 a=ch(e);t(a),n.current=a,null==i||i({current:a})},ph=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:i,timeout:l,initialEntered:s,mountOnEnter:c,unmountOnExit:d,onStateChange:h}=e||{},[m,f]=u((()=>ch(s?2:dh(c)))),g=a(m),v=a(),[y,b]=(e=>oe(e)?[e.enter,e.exit]:[e,e])(l),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 a=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((()=>a(e+1)),0)}},l=g.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&a(t?r?0:1:2):l&&a(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:a=!0,preExit:l}=e,[o,s]=ph({timeout:i,preEnter:a,preExit:l,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),a=e.match(/x64/i);if(!t&&!n&&a)return!0;if(i){if((i=i[0].match(/\d+/))[0]>=41||a)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function 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:a}=t.useContext(en),{$$preview:l}=t.useContext(fh),{state:o,isWindowsPrinter:s,pageSize:c}=l,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,a=b+t+n,l=mh.previewWidth-a<=0?0:(mh.previewWidth-a)/2,s=Math.abs((1-E)*a/2);let c=0;return E>1&&(c=s>l?-1*l:-1*s),E<1&&(c=a-2*s>mh.previewWidth?0:l>0?s:(mh.previewWidth-(a-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==a?void 0:a.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",l=null!==(r=null===(n=null==a?void 0:a.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;">',l?`<img src="${l}" 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 a=[];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 l=p.current[n],o=h.current[n];t.fixedLogo||0!==n||(e+=mh.logoHeight),e+=o,e<=r?a.push(l):(m.current.push([N(),...t.fixedLogo?[S()]:[],...a]),a=[],e=0,n-=1),n===i-1&&a.length&&m.current.push([N(),...t.fixedLogo?[S()]:[],...a])}}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>');l.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),l.doPrint(k()),yield $n(0),l.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:an("qm.print.setPanel.printParameter")},{type:"SELECT",label:an("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:an("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:an("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:an("qm.print.setPanel.vertical"),value:"vertical"},{text:an("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:an("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:an("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:an("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:an("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:an("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:mh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:an("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:an("qm.print.setPanel.sizeUnit"),disright:an("qm.print.setPanel.sizeUnit"),distop:an("qm.print.setPanel.sizeUnit"),disbottom:an("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}},an("qm.dialog.close")),t.createElement(Xn,{type:"primary",onClick:()=>this.confirmHandle()},an("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:a,printerType:l,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(a),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"===l&&("vertical"===i.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===i.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(p-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():R.error(an("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(an("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:an("qm.print.laserPrinter"),value:"laser"},{text:an("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=yh(),t=[{text:an("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:a,totalPage:l,printPage:o}=this.state,s=Jn("print-preview"),c={visible:r,title:an("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,an("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,an("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,an("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,an("qm.print.printPage.0"),t.createElement($,{value:o,min:1,max:l,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),an("qm.print.printPage.1")),t.createElement("span",null,t.createElement(Q,{size:"small",current:a,pageSize:1,total:l,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})},an("qm.print.setting"))),t.createElement("span",null,t.createElement(Xn,{type:"text",icon:t.createElement(Ve,null),className:"text-btn",onClick:()=>this.exportClickHandle()},an("qm.print.export"))),t.createElement("span",null,t.createElement(Xn,{icon:t.createElement(at,null),type:"primary",onClick:this.printClickHandle},an("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,an("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,an("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,an("qm.print.pageNumber"),":",an("qm.print.pagination",{currentPage:a,totalPage:l}))))),t.createElement(wa,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:a,closeAfterPrint:l}=this.props,o={visible:e,title:an("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:a,closeAfterPrint:l,onClose:()=>{this.setState({visible:!1})}};return a?t.createElement(wa,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:a,shape:l}=this.props,o={size:n||this.context.size||"",type:i,shape:l,icon:r,loading:e,disabled:a,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,a=!1;for(;i;){const e=Th(i);if(r.push(e),i=Nh(i),a)break;i&&Sh(i)===t&&(a=!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(!xl(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(at,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),a=5;let l;l=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+a:e.top+e.height+a:e.top-r<=t.top+t.height?e.top-r-a<t.top+a?t.top+a:e.top-r-a:t.top+t.height-r-a;let o=e.left+a;e.left<t.left&&(o=t.left+a);e.left+i>t.left+t.width&&(o=t.left+t.width-i-a);return l+="px",o+="px",{style:{top:l,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:a}=e,{t:l}=Ln();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},l("qm.table.config.emptyText")),t.createElement(Zn,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(Xn,{size:"small",onClick:()=>null==i?void 0:i()},l("qm.guideTracker.closeButton")),t.createElement(Xn,{size:"small",onClick:()=>null==r?void 0:r()},l("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(Xn,{size:"small",onClick:()=>null==a?void 0:a()},l("qm.guideTracker.finishButton"))))},Kh={left:"50%",top:"50%",width:1,height:1},Vh=t.forwardRef(((e,n)=>{const{open:r,current:i,defaultCurrent:a,steps:l=[],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(l.length),[S,N]=Zd(0,{value:i,defaultValue:a}),[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>=l.length?"add":"edit"),[S,l]),W=t.useMemo((()=>`${S+1} / ${l.length}`),[S,l]);t.useLayoutEffect((()=>{E.current=new $h({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:cl(),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=l.length}),[l]);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:()=>l.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Xt,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.id)),n=l.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(bl(e),i)}},l.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(l,n))}},e.title),t.createElement(w,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=l.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?[...l,{id:k.id,selector:k.path,title:"Guide Title"}]:[...l],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,a,l,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!==(a=f.fontStyle)&&void 0!==a?a:"normal",k=null!==(l=f.fontFamily)&&void 0!==l?l:"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),a=r*n,l=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(a/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,a,l),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,a=e.useRef(),l=()=>{a.current&&(a.current.disconnect(),a.current=void 0)};e.useLayoutEffect((()=>(l(),i&&t.current&&(a.current=new MutationObserver(n),a.current.observe(t.current,r)),()=>l())),[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:a,elements:l}=function(e){const t=Yh(e);let n=Wh.get(t);if(!n){const r=new Map;let i=[];const a=new IntersectionObserver((t=>{t.forEach((t=>{var n;const a=t.isIntersecting&&i.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=a),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(a,t)}))}))}),e);i=a.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:a,elements:r},Wh.set(t,n)}return n}(n),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),a.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),a.unobserve(e)),0===l.size&&(a.disconnect(),Wh.delete(i))}}const Qh=e=>{const{forceRender:n,height:r,placeholder:i=null,unmountIfInvisible:a,className:l,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:i,fallbackInView:a,trackVisibility:l,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:l,delay:s},a),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,i,o,l,a,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:!a}));t.useEffect((()=>{r||Yn("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[Jn("lazy-load")]:!0};return t.createElement("div",{ref:s,className:_e(u,l),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,a=t.x-n.x,l=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+i*i),p=Math.sqrt(a*a+l*l),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,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,a=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),l=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=a-e,i=l-t;n+=Math.sqrt(r*r+i*i)}e=a,t=l}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,a=i.length>0&&i[i.length-1],l=!!a&&n.distanceTo(a)<=this.minDistance,o=this._getPointGroupOptions(r);if(!a||!a||!l){const e=this._addPoint(n,o);t&&(a?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 a=n/i,l=a*a,o=l*a,s=1-a,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*a*e.control1.x,u+=3*s*l*e.control2.x,u+=o*e.endPoint.x;let p=d*e.startPoint.y;p+=3*c*a*e.control1.y,p+=3*s*l*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),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a},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)),a=Math.min(r,t),l=Math.min(i,n),o=.5*(Math.max(r,t)-a),s=.5*(Math.max(i,n)-l),c=a+o,d=l+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},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)),a=180*Math.atan2(n-i,t-r)/Math.PI,l=(a+25)*Math.PI/180,o=(a-25)*Math.PI/180,s=15*Math.cos(l),c=15*Math.sin(l),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,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,a=[];return a[0]=i[4*(n*r+t)],a[1]=i[4*(n*r+t)+1],a[2]=i[4*(n*r+t)+2],a[3]=i[4*(n*r+t)+3],a},this.setAxisColor=(e,t,n,r)=>{const i=e.width,a=e.data;a[4*(n*i+t)]=r[0],a[4*(n*i+t)+1]=r[1],a[4*(n*i+t)+2]=r[2],a[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,a=r.height,l=i/this.degreeOfBlur,o=a/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<l;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let i=0;i<this.degreeOfBlur;i++)for(let a=0;a<this.degreeOfBlur;a++)this.setAxisColor(r,t*this.degreeOfBlur+a,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,a=e.target.innerText,l=[];let o="";for(let e=0;e<a.length;e++){const t=o+a[e];this.ctx.measureText(t).width>i&&o.length>0?(l.push(o),o=a[e]):o=t}l.push(o),l.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,a=0,l=null;const o=()=>{a=Date.now(),l=null,n=e.apply(r,i),l||(r=null,i=[])};return function(...s){const c=Date.now(),d=t-(c-a);return r=this,i=s,d<=0||d>t?(l&&(clearTimeout(l),l=null),a=c,n=e.apply(r,i),l||(r=null,i=[])):l||(l=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}em.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),i=r.length,a=new Uint8Array(i);for(let e=0;e<i;++e)a[e]=r.charCodeAt(e);return new Blob([a],{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"})),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:"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"})),lm=t.forwardRef(((e,n)=>{const{open:r,width:i,height:a,imageName:l,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!=a?a: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,l]=[null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=a?a: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),l&&l!==s&&(y.current.height=l,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=l?l.slice(0,l.lastIndexOf(".")>0?l.lastIndexOf("."):void 0):h().format(qd);sa(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(am,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))))))}));lm.displayName="QmSignature";const om=t.createContext(void 0),sm=e=>{const{prefixCls:n,flatColumns:r,tableData:i}=e,[a,l]=t.useState({prefixCls:n,viewMode:"table",size:"middle",columns:r,gridData:i,originGridData:i,groupGridData:[],groupList:[],filterList:[],sorterList:[],expandedKeys:[],searchResults:[],switchIndex:0}),o=e=>{l((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const a=i;Object.is(t[a],e[a])||(n[a]=e[a],r=!0)})),r?n:t}))},s=e=>{o({columns:e})},c=e=>{o({gridData:e})},d=e=>{o({groupGridData:e})},u=e=>{o({groupList:e})},p=e=>{o({filterList:e})},h=e=>{o({sorterList:e})},m=e=>{o({expandedKeys:e})},f=e=>{o({searchResults:e})},g=e=>{o({switchIndex:e})},v=t.useMemo((()=>Object.assign(Object.assign({},a),{setContext:o,setColumns:s,setGridData:c,setGroupGridData:d,setGroupList:u,setFilterList:p,setSorterList:h,setExpandedKeys:m,setSearchResults:f,setSwitchIndex:g})),[a]);return t.createElement(om.Provider,{value:v},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:a,renderWidth:l}=e[r];if(i===t)break;n+=a||l||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 a=mm(e[r],i);return n.concat(a)}),[]),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=()=>{const{prefixCls:e,groupList:n,columns:r,gridData:i,setGroupList:a,setExpandedKeys:l,setGroupGridData:o}=cm(),{t:s}=Ln(),c=t.useRef([]),d=t.useRef([]),u=t.useMemo((()=>n.filter((e=>e.fieldName&&e.order))),[n]),p=t.useMemo((()=>r.map((e=>({label:e.title,value:e.dataIndex,disabled:n.some((t=>t.fieldName===e.dataIndex))})))),[n,r]),h=t.useMemo((()=>{const e=u.map((e=>({[e.fieldName]:e.order})));return me(e,c.current)?c.current:(c.current=e,e)}),[u]),m=[{label:"选项顺序",value:"ascend"},{label:"选项倒叙",value:"descend"}];Li((()=>{l(d.current)}),[u.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,a=Object.keys(t[0])[0],l=t.slice(1),o=Object.groupBy(e,(e=>n(e,a))),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],l)})),c};return r(e,t)})(i,h,((e,t)=>{var n,i,a;const{dictItems:l,precision:o}=r.find((e=>e.dataIndex===t))||{},s=tl(e,t);let c=null!==(a=null!==(i=null===(n=null==l?void 0:l.find((e=>e.value==s)))||void 0===n?void 0:n.text)&&void 0!==i?i:s)&&void 0!==a?a:"";return Array.isArray(s)&&(c=s.map((e=>{var t,n;return null!==(n=null===(t=null==l?void 0:l.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),o>=0&&""!==c&&(c=il(c)?new Vt(c).toFixed(o):c),c||"(内容为空)"}));var t;o(e),t=mm(e),d.current=t}),[h,i]);const f=()=>{a([...n,{fieldName:"",order:"ascend"}])},g=(e,t,r)=>{Object.assign(t,{[e]:r}),a([...n])},v=e=>t.createElement(t.Fragment,null,t.createElement(Ge,{className:"icon handle"}),t.createElement(F,{value:e.fieldName||null,placeholder:s("qm.table.editable.selectPlaceholder"),options:p,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(F,{value:e.order,options:m,placeholder:s("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{a(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,"设置分组条件"),!!u.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>l([])},"折叠所有"),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>l(d.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)||a(e)}},n.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(ht,{className:"icon"}),"添加条件"))),className:_e("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Rt,{className:"icon"}),"分组",u.length?`(${u.length})`:null))},vm=()=>{const{prefixCls:e,originGridData:n,columns:r,filterList:i,setFilterList:a,setGridData:l}=cm(),{t:o}=Ln(),s=t.useMemo((()=>i.filter((e=>e.fieldName&&e.expression))),[i]),c=t.useMemo((()=>r.filter((e=>!!e.filter)).map((e=>({label:e.title,value:e.dataIndex})))),[r]),[d,u]=t.useState("and");Li((()=>{a(i.map((e=>Object.assign(Object.assign({},e),{logic:d}))))}),[d]);const p=()=>{const e=hl(s.map((e=>Object.assign(Object.assign({},zn(e,["value"])),{condition:e.value}))));l(e?Ma(n,e):n)},h=[{label:"满足所有条件",value:"and"},{label:"满足任一条件",value:"or"}],m=e=>{let t=[];if(!e)return[];switch(e){case"date":case"number":t=[{value:">",label:o("qm.table.highSearch.gtText")},{value:"<",label:o("qm.table.highSearch.ltText")},{value:">=",label:o("qm.table.highSearch.gteText")},{value:"<=",label:o("qm.table.highSearch.lteText")},{value:"==",label:o("qm.table.highSearch.eqText")},{value:"!=",label:o("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:o("qm.table.highSearch.inText")},{value:"nin",label:o("qm.table.highSearch.ninText")},{value:"==",label:o("qm.table.highSearch.eqText")},{value:"!=",label:o("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",label:o("qm.table.highSearch.likeText")},{value:"==",label:o("qm.table.highSearch.eqText")},{value:"!=",label:o("qm.table.highSearch.neqText")}]}return t},f=()=>{a([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:d}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),"fieldName"===e&&Object.assign(t,{type:r.find((e=>e.dataIndex===n)).filter.type,expression:"",value:""}),a([...i])},v=e=>t.createElement(t.Fragment,null,t.createElement(F,{value:e.fieldName||null,options:c,placeholder:o("qm.table.editable.selectPlaceholder"),style:{width:160},onChange:t=>g("fieldName",e,t)}),t.createElement(F,{value:e.expression||null,placeholder:o("qm.table.editable.selectPlaceholder"),options:m(e.type),style:{width:100,margin:"0 10px"},onChange:t=>g("expression",e,t)}),y(e),t.createElement(Xe,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)})),y=e=>{var n,i;switch(e.type){case"number":return t.createElement($,{defaultValue:e.value,style:{width:150},onChange:t=>{g("value",e,Kn(t)?"":t)}});case"date":return t.createElement(En,{popupClassName:Xd.popupClassName,defaultValue:null!==(n=ol(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{g("value",e,sl(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:o("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{g("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=>{g("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,"设置筛选条件"),!!s.length&&t.createElement(F,{value:d,options:h,style:{width:130},onChange:e=>u(e)})),t.createElement("div",{className:"list"},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},v(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:f},t.createElement(ht,{className:"icon"}),"添加条件"),t.createElement(Xn,{type:"primary",size:"small",onClick:p},"确定"))),className:_e("action-btn",{active:!!s.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(Ot,{className:"icon"}),"筛选",s.length?`(${s.length})`:null))},ym=()=>{const{prefixCls:e,columns:n,gridData:r,sorterList:i,setSorterList:a,setGridData:l}=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;l((e=s,r.sort(((t,n)=>{for(const r of e){const{fieldName:e,order:i}=r,a=tl(t,e),l=tl(n,e),o=u(a,l);if(0!==o)return"ascend"===i?o:-o}return 0})).slice(0)))},h=()=>{a([...i,{fieldName:"",order:"ascend"}])},m=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...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=>{a(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)||a(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))},bm=()=>{const{getRowKey:e}=t.useContext(Pd),{prefixCls:n,gridData:r,columns:i,searchResults:a,switchIndex:l,setSearchResults:o,setSwitchIndex:s}=cm(),[c,d]=t.useState(!1),u=t.useMemo((()=>a.length),[a]),p=(t,n)=>{const r=[];return t.forEach((t=>{Array.isArray(t.children)&&r.push(...p(t.children,n)),i.forEach((i=>{var a,l,o;const{dataIndex:s,dictItems:c,precision:d}=i,u=tl(t,s);let p=null!==(o=null!==(l=null===(a=null==c?void 0:c.find((e=>e.value==u)))||void 0===a?void 0:a.text)&&void 0!==l?l: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=il(p)?new Vt(p).toFixed(d):p),p+="",p.includes(n)&&r.push({value:p,rowKey:e(t,t.index),dataIndex:s})}))})),r},h=na((e=>{const t=e.target.value.trim();if(s(0),!t)return o([]);o(p(r,t))}),200);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:t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>{s((l-1+u)%u)}},t.createElement(It,null)),t.createElement("span",{className:"num"},u>0?l+1:l," / ",u),t.createElement("button",{className:"button-icon",onClick:()=>{s((l+1)%u)}},t.createElement(Tt,null))),onChange:h}))),className:"action-btn",overlayClassName:`${n}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>d(!c)},t.createElement(ut,{className:"icon"}),"查找"))},xm=()=>{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]),a=()=>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:()=>a(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(ot,{className:"icon"}),"字段管理"))},Em=()=>{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"}),"行高"))},Cm=()=>t.createElement("div",{className:"top-bar"},t.createElement(Zn,{size:4},t.createElement(dm,null),t.createElement(ee,{type:"vertical"}),t.createElement(xm,null),t.createElement(gm,null),t.createElement(vm,null),t.createElement(ym,null),t.createElement(ee,{type:"vertical"}),t.createElement(Em,null),t.createElement(bm,null))),wm=t.createContext(void 0),Sm=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(Sm)):0,Nm=e=>{const{scrollbar:n}=e,{groupGridData:r}=cm(),[i,a]=t.useState({scrollbarRef:n,selectionKeys:[],countMethod:{},summationData:{}}),l=t.useMemo((()=>{const e=Sm(r);return Math.max(0,e-1)}),[r]),o=e=>{a((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((i=>{const a=i;Object.is(t[a],e[a])||(n[a]=e[a],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:l,setContext:o,setSelectionKeys:s,setCountMethod:c,setSummationData:d})),[i,l]);return t.createElement(wm.Provider,{value:u},e.children)},Tm=()=>t.useContext(wm),Im=e=>{var n;const{column:r}=e,{columns:i,setColumns:a}=cm(),{scrollbarRef:l}=Tm(),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=()=>{l.current.container.style.cursor="",r.width=u.current.columnWidth,a([...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(),l.current.container.style.cursor="col-resize";const t=Za(e.target,l.current.container).left-l.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=l.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:o,className:"resize-line"})))},Rm=()=>{const{tableRef:e}=t.useContext(Pd),{columns:n}=cm(),{indentDepth:r,selectionKeys:i,setSelectionKeys:a}=Tm(),{allRowKeys:l}=e.current,{selectionColumn:o}=Xd,{indentWidth:s}=um,c=t.useMemo((()=>pm(n)),[n]),d=t.useMemo((()=>i.length===l.length),[i]),u=t.useMemo((()=>i.length>0&&i.length<l.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:a,renderWidth:l}=e,o=(a||l)+(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 a(t?l:[]);var t}}),i!==o&&t.createElement(Im,{column:e}))}))))))},Om=e=>{const{records:n}=e,{getRowKey:r}=t.useContext(Pd),{columns:i,searchResults:a,switchIndex:l}=cm(),{indentDepth:o,selectionKeys:s,setSelectionKeys:c}=Tm(),{renderText:d,getTitleFromCellNode:u}=ou(),{selectionColumn:p}=Xd,h=t.useMemo((()=>pm(i)),[i]),m=(e,t)=>{var n,r;return(null===(n=a[l])||void 0===n?void 0:n.rowKey)===e&&(null===(r=a[l])||void 0===r?void 0:r.dataIndex)===t},f=(e,n,r,i,a)=>{const{dataIndex:l,width:f,renderWidth:g,align:v,fixed:y,render:b}=e,x=tl(r,l),E=b?b(x,r,e,i,n):d(x,e,r),C=u(E),w=s.includes(a),S={"selection-column":l===p,"col--center":"center"===v,"col--right":"right"===v,"col--fix-left":"left"===y,active:m(a,l)},N={width:`${f||g}px`,minWidth:`${f||g}px`,left:"left"===y?`${hm(h,l)+o*(um.indentWidth+1)}px`:""};return t.createElement("div",{key:l,"data-col-index":n,title:C,className:_e("table-cell",S),style:N},l!==p?t.createElement("span",{className:"cell"},E):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=a,void c(t?[...s,n]:s.filter((e=>e!==n)));var t,n}})))};return t.createElement("div",{className:"grid-list"},n.map(((e,n)=>{const i=r(e,e.index),a={"row--selection":s.includes(i)};return t.createElement("li",{key:i,"data-row-key":i,className:_e("table-row",a)},h.map(((t,r)=>f(t,r,e,n,i))))})))},km=e=>{const{column:n,keyPath:r,type:i}=e,{prefixCls:a}=cm(),{summationData:l,countMethod:o,setCountMethod:s}=Tm(),{dataIndex:c}=n,[d,u]=t.useState(!1),p=t.useMemo((()=>[{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}]),[]),h=t.useMemo((()=>{var e,t,n;const a=o[c];if(!a)return"统计";return`${p.find((e=>e.value===a)).text} ${null!==(n=null===(t=null===(s=l,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}),[l,o]);return t.createElement(M,{open:d,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:_e("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},p.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}),u(!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:`${a}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>u(e)},t.createElement("span",null,h," ",t.createElement(He,{className:"icon"})))},Lm=e=>{const{dataKey:n,dataKeyPath:r,depth:i,className:a,style:l}=e,{columns:o,expandedKeys:s,setExpandedKeys:c}=cm(),{indentDepth:d}=Tm(),{selectionColumn:u}=Xd,p=t.useMemo((()=>pm(o)),[o]),h=t.useMemo((()=>s.includes(r)),[s,r]),m=(e,a)=>{const{dataIndex:l,width:o,renderWidth:m,fixed:f}=e,g=(o||m)+(1===a?(d-i)*(um.indentWidth+1):0),v={"expandable-column":l===u,"col--fix-left":"left"===f},y={width:`${g}px`,minWidth:`${g}px`,left:"left"===f?`${hm(p,l)+i*(um.indentWidth+1)}px`:""};return t.createElement("div",{key:l,className:_e("label-cell",v),style:y},l!==u?t.createElement(t.Fragment,null,1===a&&t.createElement("span",{className:"title"},n.slice(1)),t.createElement(km,{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,a),style:l},t.createElement("li",{className:"label-row"},p.map(((e,t)=>m(e,t)))),t.createElement("div",{style:{display:h?"block":"none"}},e.children))},Am=()=>{const{groupGridData:e}=cm(),n=(e,r="",i=0)=>{const a=oe(e)&&!Array.isArray(e);return t.createElement(t.Fragment,null,a?Object.keys(e).map((a=>{const l=r?`${r}.${a}`:a;return t.createElement(Lm,{key:a,dataKey:a,dataKeyPath:l,depth:i},Array.isArray(e[a])?t.createElement(Om,{records:e[a]}):n(e[a],l,i+1))})):t.createElement(Om,{records:e}))};return t.createElement("div",{className:"body"},n(e))},Pm=()=>{const{columns:e,groupGridData:n}=cm(),{indentDepth:r,countMethod:i,setSummationData:a}=Tm(),{selectionColumn:l}=Xd,{indentWidth:o}=um,s=t.useMemo((()=>pm(e)),[e]);Li((()=>{a(((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 a={},l={};Object.keys(t).forEach((e=>{l[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>Vn(e,n)||0));e[n]=t[n](r),l[n].push(...r)}a[r]={subtotal:e}}else{const e=i(o);a[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&l[n].push(t)}}}if(0===n.length)return a;const o={};for(const e in t)o[e]=t[e](l[e]);return a.subtotal=o,a},a=Array.isArray(e)?{total:r(e)}:i(e);return n.length>0&&(a.total=r(n)),delete a.subtotal,a})(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:a,renderWidth:l}=e,c=(a||l)+(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:a}=e,c={"selection-column":i===l,"col--right":!0,"col--fix-left":"left"===a},d={left:"left"===a?`${hm(s,i)+(n>1?r*(o+1):0)}px`:""};return t.createElement("td",{key:i,className:_e("table-cell",c),style:d},i!==l?t.createElement(km,{column:e,keyPath:"",type:"total"}):null)}))))))},Dm=()=>{const{prefixCls:e,size:n}=cm(),r=t.useRef(null);return t.createElement(Nm,{scrollbar:r},t.createElement(oa,{ref:r,className:_e(`${e}__layout`,n)},t.createElement(Rm,null),t.createElement(Am,null),t.createElement(Pm,null)))},_m=()=>{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)),[]),a=Jn("pivot-grid");return t.createElement("div",{className:`${a}__main`},t.createElement(sm,{prefixCls:a,flatColumns:i,tableData:r},t.createElement(Cm,null),t.createElement("div",{className:"wrapper"},t.createElement(Dm,null))))};_m.displayName="PivotGrid";const Fm=t.forwardRef(((e,n)=>{const{dataIndex:r,className:i,style:a}=e;return t.createElement("li",{ref:n,"data-index":r,className:_e("list-item",i),style:a},e.children)}));Fm.displayName="ListItem";const Hm=t.forwardRef(((e,n)=>{var r,i;const{dataSource:a=[],height:l,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,p=t.useRef(null),h=sp({count:a.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(oa,{ref:p,className:_e(f,u),style:Object.assign(Object.assign({},e.style),{height:l,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(Fm,{ref:h.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(a[e.index],e.index)))))))}));Hm.displayName="VirtualList";const Mm="1.11.5";export{xn as Calendar,En as DatePicker,va as DcpAnchor,Xn as DcpButton,Oi as DcpCollapse,In as DcpConfigProvider,Ip as DcpCopyToClipboard,Ui as DcpCountup,Ed as DcpCropper,er as DcpDivider,ha as DcpDownload,xa as DcpDrawer,Gi as DcpEmpty,rd as DcpForm,Vh as DcpGuideTracker,Qh as DcpLazyLoad,wa as DcpModal,_m as DcpPivotGrid,wh as DcpPrint,Up as DcpRangeTableHelper,oa as DcpScrollbar,$p as DcpSearchHelper,Ad as DcpSearchTree,lm as DcpSignature,Zn as DcpSpace,Yi as DcpSpin,Bi as DcpSplit,Mp as DcpTable,ba as DcpTabs,xd as DcpTinymce,oh as DcpTour,hh as DcpTransition,zp as DcpTreeHelper,Vp as DcpTreeTableHelper,pa as DcpUploadFile,wd as DcpUploadImg,Hm as DcpVirtualList,zh as DcpWatermark,va as QmAnchor,Xn as QmButton,Oi as QmCollapse,In as QmConfigProvider,Ip as QmCopyToClipboard,Ui as QmCountup,Ed as QmCropper,er as QmDivider,ha as QmDownload,xa as QmDrawer,Gi as QmEmpty,rd as QmForm,Vh as QmGuideTracker,Qh as QmLazyLoad,wa as QmModal,_m as QmPivotGrid,wh as QmPrint,Up as QmRangeTableHelper,oa as QmScrollbar,$p as QmSearchHelper,Ad as QmSearchTree,lm as QmSignature,Zn as QmSpace,Yi as QmSpin,Bi as QmSplit,Mp as QmTable,ba as QmTabs,xd as QmTinymce,oh as QmTour,hh as QmTransition,zp as QmTreeHelper,Vp as QmTreeTableHelper,pa as QmUploadFile,wd as QmUploadImg,Hm as QmVirtualList,zh as QmWatermark,wn as TimePicker,to as pinyin,Mm as version};