dcp-design-react 1.12.14 → 1.12.16

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 l,useRef as i,useLayoutEffect as a,useEffect as o,useState as s,useCallback as c,Component as d,forwardRef as u,useImperativeHandle as m}from"react";import p from"dayjs";import{isArray as h,isPlainObject as f,isNumber as g,isFunction as v,isString as y,isUndefined as b,get as x,set as E,transform as w,isEqual as C,xor as S,isRegExp as N,intersection as T,map as I,groupBy as R,flatten as O,spread as k,mergeWith as L,isDate as A,sumBy as P,maxBy as _,minBy as F,merge as D,union as M,uniqBy as H,debounce as $,throttle as q}from"lodash-es";import K from"dayjs/plugin/localeData";import j from"dayjs/plugin/advancedFormat";import V from"dayjs/plugin/customParseFormat";import z from"dayjs/plugin/quarterOfYear";import W from"dayjs/plugin/weekOfYear";import B from"dayjs/plugin/weekday";import{ConfigProvider as U,Button as G,Tooltip as Y,Popconfirm as X,Space as Q,Empty as Z,Spin as J,Upload as ee,message as te,Input as ne,Tabs as re,Drawer as le,Modal as ie,Form as ae,Row as oe,Col as se,Select as ce,Checkbox as de,Dropdown as ue,InputNumber as me,Divider as pe,Radio as he,Menu as fe,Popover as ge,Tree as ve,Switch as ye,Pagination as be,Rate as xe,Tag as Ee,TreeSelect as we,Cascader as Ce,Image as Se,notification as Ne,Slider as Te}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 Ie from"dayjs/plugin/weekYear";import Re from"antd/es/calendar/generateCalendar";import Oe from"antd/es/date-picker/generatePicker";import ke from"antd/es/locale/zh_CN";import Le from"antd/es/locale/en_GB";import"dayjs/locale/zh-cn";import"dayjs/locale/en";import Ae from"classnames";import{UpOutlined as Pe,DownOutlined as _e,UploadOutlined as Fe,LinkOutlined as De,EditOutlined as Me,CheckOutlined as He,EyeOutlined as $e,DownloadOutlined as qe,DeleteOutlined as Ke,FullscreenExitOutlined as je,FullscreenOutlined as Ve,UnorderedListOutlined as ze,HolderOutlined as We,InfoCircleFilled as Be,ReloadOutlined as Ue,PrinterOutlined as Ge,ImportOutlined as Ye,SettingOutlined as Xe,CopyOutlined as Qe,CheckSquareOutlined as Ze,CloseCircleOutlined as Je,MonitorOutlined as et,FolderOpenOutlined as tt,PlusOutlined as nt,CloseOutlined as rt,FilterOutlined as lt,SortAscendingOutlined as it,LeftOutlined as at,RightOutlined as ot,EyeInvisibleOutlined as st,ColumnHeightOutlined as ct,FolderOutlined as dt,BarsOutlined as ut,SaveOutlined as mt,InfoCircleOutlined as pt,BgColorsOutlined as ht,CaretDownOutlined as ft,ExpandAltOutlined as gt,CaretRightOutlined as vt,LineChartOutlined as yt,PieChartOutlined as bt,FunnelPlotOutlined as xt,AppstoreAddOutlined as Et,StepBackwardOutlined as wt,StepForwardOutlined as Ct,SearchOutlined as St,ClearOutlined as Nt,ZoomInOutlined as Tt,ZoomOutOutlined as It,RotateRightOutlined as Rt,RotateLeftOutlined as Ot,InboxOutlined as kt,ExclamationCircleOutlined as Lt,PauseOutlined as At,QuestionCircleOutlined as Pt,MenuOutlined as _t,BorderOutlined as Ft}from"@ant-design/icons";import Dt,{flushSync as Mt}from"react-dom";import Ht from"react-countup";import $t from"resize-observer-polyfill";import qt from"sortablejs";import Kt from"add-dom-event-listener";import jt from"scroll-into-view-if-needed";import Vt from"react-draggable";import zt from"memoize-one";import*as Wt from"prop-types";import Bt from"prop-types";import{ReactSortable as Ut}from"react-sortablejs";import Gt from"big.js";import Yt from"exceljs";import Xt from"localforage";import Qt from"@rc-component/trigger";import Zt,{ColorBlock as Jt}from"@rc-component/color-picker";import en from"@rc-component/portal";export{default as DcpPortal,default as QmPortal}from"@rc-component/portal";import tn from"copy-to-clipboard";import nn from"china-area-data";import rn from"cropperjs";import ln from"html2canvas";const an=n({});var on={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},用逗号隔开",text:"筛选",selectAll:"全选",invert:"反选",onlyItem:"仅此项",keywordSearch:"关键词搜索"},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:"不包含",nullText:"空值",notNullText:"非空值",startsWithText:"开头是",endsWithText:"结尾是",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",matchCase:"大小写匹配",matchFullchar:"全字符匹配",queryLabel:"查找内容",queryPrev:"查找上一个",queryNext:"查找下一个",queryAll:"查找全部",findTotal:"查找到 {total} 个单元格",cellText:"单元格",valText:"值"},pivotGrid:{text:"多维表",settingTitle:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行",col:"整列"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}}}};let sn=on;function cn(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const dn=(...e)=>{const[t,n]=e;let r;const l=t.split(".");let i=sn;for(let e=0,t=l.length;e<t;e++){if(r=i[l[e]],e===t-1)return cn(r,n);if(!r)return"";i=r}return""};function un(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 l=0;for(r=Object.getOwnPropertySymbols(e);l<r.length;l++)t.indexOf(r[l])<0&&Object.prototype.propertyIsEnumerable.call(e,r[l])&&(n[r[l]]=e[r[l]])}return n}function mn(e,t,n,r){var l,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(l=e[o])&&(a=(i<3?l(a):i>3?l(t,n,a):l(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function pn(e,t,n,r){return new(n||(n=Promise))((function(l,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}s((r=r.apply(e,t||[])).next())}))}var hn="undefined"==typeof window;const fn=e=>t.isValidElement(e),gn=e=>fn(e)&&e.type===t.Fragment,vn=()=>{},yn=()=>!0,bn=e=>pn(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),xn=e=>{Promise.resolve().then(e)},En=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),wn=e=>!!(!e&&0!==e||h(e)&&!e.length||f(e)&&!Object.keys(e).length),Cn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),Sn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Nn=(e,t=new WeakMap)=>{if(f(e)||h(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const l=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(l||e,((n,i)=>{l&&(i=n),r[i]=Nn(e[i],t)})),r}return e},Tn=e=>g(e)?`${e}px`:e.toString(),In=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{}));p.extend(K),p.extend(j),p.extend(V),p.extend(z),p.extend(W),p.extend(B);var Rn={},On=[];function kn(e,t){if(!e&&void 0!==console){var n=On.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function Ln(e,t){if(!e&&void 0!==console){var n=On.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function An(e,t,n){t||Rn[n]||(e(!1,n),Rn[n]=!0)}function Pn(e,t){An(kn,e,t)}function _n(e,t){An(Ln,e,t)}Pn.preMessage=function(e){On.push(e)},Pn.resetWarned=function(){Rn={}},Pn.noteOnce=_n,p.extend(V),p.extend(j),p.extend(B),p.extend(K),p.extend(W),p.extend(Ie),p.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 Fn={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"},Dn=function(e){return Fn[e]||e.split("_")[0]},Mn=function(){_n(!1,"Not match any format. Please help to fire a issue about this.")},Hn={getNow:function(){return p()},getFixedDate:function(e){return p(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 p().locale(Dn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(Dn(e)).weekday(0)},getWeek:function(e,t){return t.locale(Dn(e)).week()},getShortWeekDays:function(e){return p().locale(Dn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return p().locale(Dn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(Dn(e)).format(n)},parse:function(e,t,n){for(var r=Dn(e),l=0;l<n.length;l+=1){var i=n[l],a=t;if(i.includes("wo")||i.includes("Wo")){for(var o=a.split("-")[0],s=a.split("-")[1],c=p(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 Mn(),null}var m=p(a,i).locale(r);if(m.isValid())return m}return t&&Mn(),null}}};const $n=Re(Hn),qn=Oe(Hn);function Kn(){return Kn=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},Kn.apply(null,arguments)}const jn=e.forwardRef(((t,n)=>e.createElement(qn,Kn({},t,{picker:"time",mode:void 0,ref:n}))));jn.displayName="TimePicker";const Vn=e.forwardRef(((t,n)=>e.createElement(qn.RangePicker,Kn({},t,{picker:"time",mode:void 0,ref:n}))));Vn.displayName="RangePicker",jn.RangePicker=Vn;var zn={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:"Filter {text}",searchAreaText:"Filter {text}, separated by commas",text:"Filter",selectAll:"Select all",invert:"Invert",onlyItem:"Only item",keywordSearch:"Keyword Search"},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",nullText:"null value",notNullText:"not null value",startsWithText:"beginning is",endsWithText:"ending is",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?",matchCase:"Case matching",matchFullchar:"Full character matching",queryLabel:"Find content",queryPrev:"Find previous",queryNext:"Find next",queryAll:"Find all",findTotal:"Found {total} cells",cellText:"Cell",valText:"Value"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row",col:"Col"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}}}};const Wn={[zn.name]:{qm:zn,antd:Le},[on.name]:{qm:on,antd:ke}},Bn=e=>{const n="zh-cn",r=In({locale:n,size:"middle"},e),{locale:l,size:i,global:a}=r,o=t.useMemo((()=>Object.assign({},Wn,null==a?void 0:a.langPackage)),[a]),s=t.useMemo((()=>a?Sn(a,["langPackage"]):a),[a]),c=(e,t)=>{const r=e.split("-")[0],l=o[e]?e:o[r]?r:n;return o[l][t]};t.useMemo((()=>{return e=c(l,"qm"),sn=e||sn,void(sn.name&&p.locale(sn.name));var e}),[l]);const d=t.useMemo((()=>({locale:l,size:i,global:s})),[l,i]);return t.createElement(an.Provider,{value:d},t.createElement(U,{locale:c(l,"antd"),componentSize:i,autoInsertSpaceInButton:null==s?void 0:s.autoInsertSpaceInButton},r.children))};function Un(){const{locale:t}=e.useContext(an);return{t:dn,$locale:t}}function Gn(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 Yn(t){const{size:n}=e.useContext(an);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])}}Bn.displayName="QmConfigProvider";class Xn extends Error{constructor(e){super(e),this.name="QmDesignError"}}function Qn(e,t){throw new Xn(`[${e}] ${t}`)}function Zn(e,t){console.warn(new Xn(`[${e}] ${t}`))}const Jn=e=>{const{loading:n,shortcutKey:r,authConfig:l,click:i,confirm:a}=e,{t:o}=Un(),{$size:s}=Yn(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=Gn((e=>{var t;const n=r.split("+").map((e=>e.trim().toLowerCase())),l=n.includes("alt"),i=n.includes("ctrl"),a=n.includes("shift"),o=n[n.length-1];l&&!e.altKey||i&&!e.ctrlKey||a&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),p.disabled||null===(t=p.onClick)||void 0===t||t.call(p,e))})),m=v(i)?{onClick:t=>pn(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){Zn("Button","`click`方法执行出错")}d(!1)}))}:null,p=Object.assign(Object.assign(Object.assign({},Sn(e,["shortcutKey","authConfig","click","confirm"])),{size:s,loading:c||n||!1}),m);if(l){const{visible:e=1,disabled:t}=l||{};if(!e)return null;t&&(p.disabled=!0)}const h=t.createElement(G,p,e.children);return a?t.createElement(X,{title:a.title||o("qm.button.confirmTitle"),disabled:p.disabled,onConfirm:e=>{var t,n;null===(t=a.onConfirm)||void 0===t||t.call(a),null===(n=p.onClick)||void 0===n||n.call(p,e)},onCancel:e=>{var t;null===(t=a.onCancel)||void 0===t||t.call(a,e)}},t.createElement(G,Kn({},p,{onClick:vn}),e.children)):!r||p.disabled?h:t.createElement(Y,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},h)};var er;Jn.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(er||(er={}));const tr=e=>{const{$size:n}=Yn(e),r=g(e.size)?e.size:er[n||"default"],l=Object.assign(Object.assign({},Sn(e,["size"])),{size:r});return t.createElement(Q,l,e.children)};tr.displayName="QmSpace";const nr=e=>`qm-${e}`,rr=e=>{const{label:n,extra:r,collapse:l,bordered:i=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=Yn(e),{t:m}=Un(),p=nr("divider"),h={[p]:!0,[`${p}-borderless`]:!i,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return t.createElement("div",{id:o,className:Ae(h,s),style:c},t.createElement("span",{className:`${p}__title`},n),t.createElement("div",{className:`${p}__extra`},r),void 0!==l&&t.createElement(G,{type:"link",className:`${p}__collapse`,disabled:a,onClick:()=>{null==d||d(!l)}},m(l?"qm.divider.collect":"qm.divider.spread"),l?t.createElement(Pe,null):t.createElement(_e,null)))};rr.displayName="QmDivider";const lr=()=>({height:0,opacity:0}),ir=e=>({height:e.scrollHeight,opacity:1}),ar=e=>({height:e?e.offsetHeight:0}),or=(e,t)=>!0===(null==t?void 0:t.deadline)||"height"===t.propertyName;function sr(e){return sr="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},sr(e)}function cr(e){var t=function(e,t){if("object"!==sr(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==sr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===sr(t)?t:String(t)}function dr(e,t,n){return(t=cr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ur(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 mr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ur(Object(n),!0).forEach((function(t){dr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ur(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pr(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 hr(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,l,i,a,o=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){c=!0,l=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw l}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pr(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)?pr(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 fr(e){return e instanceof HTMLElement||e instanceof SVGElement}function gr(e){var n,r=function(e){return e&&"object"===sr(e)&&fr(e.nativeElement)?e.nativeElement:fr(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Dt.findDOMNode)||void 0===n?void 0:n.call(Dt,e):null)}var vr,yr={exports:{}},br={};yr.exports=(vr||(vr=1,function(){var e,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:var f=e.type;switch(f){case r:case i:case l:case d:case u:return f;default:var g=f&&f.$$typeof;switch(g){case s:case o:case c:case p:case m:case a:return g;default:return h}}case n:return h}}}e=Symbol.for("react.module.reference");var g=o,v=a,y=t,b=c,x=r,E=p,w=m,C=n,S=i,N=l,T=d,I=u,R=!1,O=!1;br.ContextConsumer=g,br.ContextProvider=v,br.Element=y,br.ForwardRef=b,br.Fragment=x,br.Lazy=E,br.Memo=w,br.Portal=C,br.Profiler=S,br.StrictMode=N,br.Suspense=T,br.SuspenseList=I,br.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},br.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},br.isContextConsumer=function(e){return f(e)===o},br.isContextProvider=function(e){return f(e)===a},br.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},br.isForwardRef=function(e){return f(e)===c},br.isFragment=function(e){return f(e)===r},br.isLazy=function(e){return f(e)===p},br.isMemo=function(e){return f(e)===m},br.isPortal=function(e){return f(e)===n},br.isProfiler=function(e){return f(e)===i},br.isStrictMode=function(e){return f(e)===l},br.isSuspense=function(e){return f(e)===d},br.isSuspenseList=function(e){return f(e)===u},br.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===i||t===l||t===d||t===u||t===h||"object"==typeof t&&null!==t&&(t.$$typeof===p||t.$$typeof===m||t.$$typeof===a||t.$$typeof===o||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},br.typeOf=f}()),br);var xr=function(e,t){"function"==typeof e?e(t):"object"===sr(e)&&e&&"current"in e&&(e.current=t)},Er=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){xr(t,e)}))}},wr=function(e){var t,n,r=yr.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===yr.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===yr.exports.ForwardRef)};function Cr(e,t){if(null==e)return{};var n,r,l=function(e,t){if(null==e)return{};var n,r,l={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}Number(r.split(".")[0]);var Sr=e.createContext({});function Nr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tr(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,cr(r.key),r)}}function Ir(e,t,n){return t&&Tr(e.prototype,t),n&&Tr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rr(e,t){return Rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Rr(e,t)}function Or(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&&Rr(e,t)}function kr(e){return kr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kr(e)}function Lr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ar(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=kr(e);if(t){var l=kr(this).constructor;n=Reflect.construct(r,arguments,l)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===sr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Lr(e)}(this,n)}}var Pr=function(t){Or(r,e.Component);var n=Ar(r);function r(){return Nr(this,r),n.apply(this,arguments)}return Ir(r,[{key:"render",value:function(){return this.props.children}}]),r}();function _r(t){var n=e.useRef(!1),r=hr(e.useState(t),2),l=r[0],i=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[l,function(e,t){t&&n.current||i(e)}]}var Fr="none",Dr="appear",Mr="enter",Hr="leave",$r="none",qr="prepare",Kr="start",jr="active",Vr="end",zr="prepared";function Wr(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Br(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 Ur,Gr,Yr,Xr=(Ur=Wr(),Gr="undefined"!=typeof window?window:{},Yr={animationend:Br("Animation","AnimationEnd"),transitionend:Br("Transition","TransitionEnd")},Ur&&("AnimationEvent"in Gr||delete Yr.animationend.animation,"TransitionEvent"in Gr||delete Yr.transitionend.transition),Yr),Qr={};if(Wr()){var Zr=document.createElement("div");Qr=Zr.style}var Jr={};function el(e){if(Jr[e])return Jr[e];var t=Xr[e];if(t)for(var n=Object.keys(t),r=n.length,l=0;l<r;l+=1){var i=n[l];if(Object.prototype.hasOwnProperty.call(t,i)&&i in Qr)return Jr[e]=t[i],Jr[e]}return""}var tl=el("animationend"),nl=el("transitionend"),rl=!(!tl||!nl),ll=tl||"animationend",il=nl||"transitionend";function al(e,t){return e?"object"===sr(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var ol=function(t){var n=i(),r=i(t);r.current=t;var l=e.useCallback((function(e){r.current(e)}),[]);function a(e){e&&(e.removeEventListener(il,l),e.removeEventListener(ll,l))}return e.useEffect((function(){return function(){a(n.current)}}),[]),[function(e){n.current&&n.current!==e&&a(n.current),e&&e!==n.current&&(e.addEventListener(il,l),e.addEventListener(ll,l),n.current=e)},a]},sl=Wr()?a:o,cl=function(e){return+setTimeout(e,16)},dl=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(cl=function(e){return window.requestAnimationFrame(e)},dl=function(e){return window.cancelAnimationFrame(e)});var ul=0,ml=new Map;function pl(e){ml.delete(e)}var hl=function(e){var t=ul+=1;return function n(r){if(0===r)pl(t),e();else{var l=cl((function(){n(r-1)}));ml.set(t,l)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};hl.cancel=function(e){var t=ml.get(e);return pl(e),dl(t)},hl.ids=function(){return ml};var fl=[qr,Kr,jr,Vr],gl=[qr,zr],vl=!1,yl=!0;function bl(e){return e===jr||e===Vr}var xl=function(t,n,r){var l=hr(_r($r),2),i=l[0],a=l[1],o=function(){var t=e.useRef(null);function n(){hl.cancel(t.current)}return e.useEffect((function(){return function(){n()}}),[]),[function e(r){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;n();var i=hl((function(){l<=1?r({isCanceled:function(){return i!==t.current}}):e(r,l-1)}));t.current=i},n]}(),s=hr(o,2),c=s[0],d=s[1];var u=n?gl:fl;return sl((function(){if(i!==$r&&i!==Vr){var e=u.indexOf(i),t=u[e+1],n=r(i);n===vl?a(t,!0):t&&c((function(e){function r(){e.isCanceled()||a(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,i]),e.useEffect((function(){return function(){d()}}),[]),[function(){a(qr,!0)},i]};var El=function(t){var n=t;"object"===sr(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var l=t.visible,a=void 0===l||l,s=t.removeOnLeave,c=void 0===s||s,d=t.forceRender,u=t.children,m=t.motionName,p=t.leavedClassName,h=t.eventProps,f=function(e,t){return!(!e.motionName||!n||!1===t)}(t,e.useContext(Sr).motion),g=i(),v=i();var y=function(t,n,r,l){var a=l.motionEnter,s=void 0===a||a,c=l.motionAppear,d=void 0===c||c,u=l.motionLeave,m=void 0===u||u,p=l.motionDeadline,h=l.motionLeaveImmediately,f=l.onAppearPrepare,g=l.onEnterPrepare,v=l.onLeavePrepare,y=l.onAppearStart,b=l.onEnterStart,x=l.onLeaveStart,E=l.onAppearActive,w=l.onEnterActive,C=l.onLeaveActive,S=l.onAppearEnd,N=l.onEnterEnd,T=l.onLeaveEnd,I=l.onVisibleChanged,R=hr(_r(),2),O=R[0],k=R[1],L=hr(_r(Fr),2),A=L[0],P=L[1],_=hr(_r(null),2),F=_[0],D=_[1],M=i(!1),H=i(null);function $(){return r()}var q=i(!1);function K(){P(Fr,!0),D(null,!0)}function j(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=q.current;A===Dr&&r?n=null==S?void 0:S(t,e):A===Mr&&r?n=null==N?void 0:N(t,e):A===Hr&&r&&(n=null==T?void 0:T(t,e)),A!==Fr&&r&&!1!==n&&K()}}var V=hr(ol(j),1)[0],z=function(e){var t,n,r;switch(e){case Dr:return dr(t={},qr,f),dr(t,Kr,y),dr(t,jr,E),t;case Mr:return dr(n={},qr,g),dr(n,Kr,b),dr(n,jr,w),n;case Hr:return dr(r={},qr,v),dr(r,Kr,x),dr(r,jr,C),r;default:return{}}},W=e.useMemo((function(){return z(A)}),[A]),B=hr(xl(A,!t,(function(e){if(e===qr){var t=W[qr];return t?t($()):vl}var n;return G in W&&D((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===jr&&(V($()),p>0&&(clearTimeout(H.current),H.current=setTimeout((function(){j({deadline:!0})}),p))),G===zr&&K(),yl})),2),U=B[0],G=B[1],Y=bl(G);q.current=Y,sl((function(){k(n);var e,r=M.current;M.current=!0,!r&&n&&d&&(e=Dr),r&&n&&s&&(e=Mr),(r&&!n&&m||!r&&h&&!n&&m)&&(e=Hr);var l=z(e);e&&(t||l[qr])?(P(e),U()):P(Fr)}),[n]),o((function(){(A===Dr&&!d||A===Mr&&!s||A===Hr&&!m)&&P(Fr)}),[d,s,m]),o((function(){return function(){M.current=!1,clearTimeout(H.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===Fr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=F;return W[qr]&&G===Kr&&(Q=mr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:gr(v.current)}catch(e){return null}}),t),b=hr(y,4),x=b[0],E=b[1],w=b[2],C=b[3],S=e.useRef(C);C&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,xr(r,e)}),[r]),I=mr(mr({},h),{},{visible:a});if(u)if(x===Fr)N=C?u(mr({},I),T):!c&&S.current&&p?u(mr(mr({},I),{},{className:p}),T):d||!c&&!p?u(mr(mr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===qr?O="prepare":bl(E)?O="active":E===Kr&&(O="start");var k=al(m,"".concat(x,"-").concat(O));N=u(mr(mr({},I),{},{className:Ae(al(m,x),(R={},dr(R,k,k&&O),dr(R,m,"string"==typeof m),R)),style:w}),T)}else N=null;e.isValidElement(N)&&wr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(Pr,{ref:v},N)}));return r.displayName="CSSMotion",r}(rl);function wl(){return wl=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},wl.apply(this,arguments)}var Cl="add",Sl="keep",Nl="remove",Tl="removed";function Il(e){var t;return mr(mr({},t=e&&"object"===sr(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Rl(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(Il)}var Ol=["component","children","onVisibleChanged","onAllRemoved"],kl=["status"],Ll=["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]:El,r=function(t){Or(l,e.Component);var r=Ar(l);function l(){var e;Nr(this,l);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return dr(Lr(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),dr(Lr(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:mr(mr({},e),{},{status:Tl})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==Tl})).length})),e}return Ir(l,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,l=this.props,i=l.component,a=l.children,o=l.onVisibleChanged,s=l.onAllRemoved,c=Cr(l,Ol),d=i||e.Fragment,u={};return Ll.forEach((function(e){u[e]=c[e],delete c[e]})),delete c.keys,e.createElement(d,c,r.map((function(r){var l=r.status,i=Cr(r,kl),c=l===Cl||l===Sl;return e.createElement(n,wl({},u,{key:i.key,visible:c,eventProps:i,onVisibleChanged:function(e){(null==o||o(e,{key:i.key}),e)||0===t.removeKey(i.key)&&s&&s()}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,l=Rl(n),i=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,l=t.length,i=Rl(e),a=Rl(t);i.forEach((function(e){for(var t=!1,i=r;i<l;i+=1){var o=a[i];if(o.key===e.key){r<i&&(n=n.concat(a.slice(r,i).map((function(e){return mr(mr({},e),{},{status:Cl})}))),r=i),n.push(mr(mr({},o),{},{status:Sl})),r+=1,t=!0;break}}t||n.push(mr(mr({},e),{},{status:Nl}))})),r<l&&(n=n.concat(a.slice(r).map((function(e){return mr(mr({},e),{},{status:Cl})}))));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!==Nl}))).forEach((function(t){t.key===e&&(t.status=Sl)}))})),n}(r,l);return{keyEntities:i.filter((function(e){var t=r.find((function(t){var n=t.key;return e.key===n}));return!t||t.status!==Tl||e.status!==Nl}))}}}]),l}();dr(r,"defaultProps",{component:"div"})}(rl);const Al=t.forwardRef(((e,n)=>{const{forceRender:r,className:l,style:i,boxStyle:a,isActive:o}=e,[s,c]=t.useState(o||r);if(t.useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=nr("collapse");return t.createElement("div",{ref:n,className:Ae(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},l),style:i},t.createElement("div",{className:`${d}-content-box`,style:a},e.children))}));Al.displayName="PanelContent";const Pl=e=>{const{defaultActive:n,label:r,extra:l,className:i,style:a,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=t.useState(!!n),f=nr("collapse"),g=Ae({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},i);return t.createElement("div",{className:g,style:a},t.createElement(rr,{label:r,extra:l,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),null==m||m(e)}}),t.createElement(El,Kn({visible:p},((e=nr("motion-collapse"))=>({motionName:e,onAppearStart:lr,onEnterStart:lr,onAppearActive:ir,onEnterActive:ir,onLeaveStart:ar,onLeaveActive:lr,onAppearEnd:or,onEnterEnd:or,onLeaveEnd:or,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:n,style:r},l)=>t.createElement(Al,{ref:l,prefixCls:f,className:n,style:r,boxStyle:o,isActive:p,forceRender:d},e.children))))};Pl.displayName="QmCollapse";const _l=t.createContext(void 0);function Fl(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 Dl=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},Ml=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},Hl=e=>e.preventDefault(),$l=(e,t)=>{if(hn||!e||!t)return null;"float"===(t=En(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]}},ql=(e,t,n)=>{!hn&&e&&t&&(f(t)?Object.keys(t).forEach((n=>{ql(e,n,t[n])})):(t=En(t),e.style[t]=n))},Kl=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},jl=(e,t)=>Math.abs(Kl(e)-Kl(t)),Vl=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}},zl=(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},Wl=(e,t)=>{if(hn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Bl=e=>Math.pow(e,3),Ul=e=>e<.5?Bl(2*e)/2:1-Bl(2*(1-e))/2,Gl=e=>{const{minValues:n,onDragChange:r,onDragging:l}=e,{splitRef:i,direction:a}=t.useContext(_l),{t:o}=Un(),s=t.useRef(hn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===a),[a]),d=t.useMemo((()=>c?"X":"Y"),[c]),u=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const t=e[`page${d}`]-u.current[`start${d}`],r=[n[0],u.current[`containerSize${d}`]-n[1]];let i=u.current[`firstElementSize${d}`]+t;i=Math.max(r[0],i),i=Math.min(r[1],i),l(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),Ml(document,"mousemove",p),Ml(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${nr("split")}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return t.createElement("div",{className:Ae(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=i.current,n=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),Dl(document,"mousemove",p),Dl(document,"mouseup",h),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Gl.displayName="ResizeBar";const Yl=t.forwardRef(((e,n)=>{const{offset:r,className:l,style:i}=e,{direction:a,dragging:o}=t.useContext(_l),s="vertical"===a?"height":"width",c={[nr("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[l]:!!l},d=void 0!==r?{[s]:Tn(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:Ae(c),style:Object.assign(Object.assign({},d),i)},e.children)}));Yl.displayName="SplitPane";const Xl=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:l,className:i,style:a,onDragStart:o,onDrag:s=vn,onDragEnd:c}=e,{global:d}=t.useContext(an),u=t.useRef(null),m=t.useRef(null),p=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,h=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((()=>l?`split_${l}`:""),[l]),[v,y]=t.useState(!1),[b,x]=t.useState(p(r));Fl((()=>{v?null==o||o(h(b)):(null==c||c(h(b)),localStorage.setItem(g,b),C(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(p(e)):w(g).then((e=>{localStorage.setItem(g,p(e||r)),E()})).catch((()=>{}))},w=e=>pn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),C=(e,t)=>pn(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;fn(e)&&!gn(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={[nr("split")]:!0,vertical:"vertical"===n};return t.createElement(_l.Provider,{value:S},t.createElement("div",{ref:u,className:Ae(O,i),style:a},t.createElement(Yl,Kn({},T.props,{ref:m,offset:b})),t.createElement(Gl,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Yl,I.props)))};Xl.displayName="QmSplit",Xl.Pane=Yl;const Ql=e=>{const{className:n,style:r}=e,{$size:l}=Yn(e),i=nr("countup"),a={[i]:!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l};return t.createElement(Ht,Kn({},e,{className:Ae(a,n),style:r}),e.children)};Ql.displayName="QmCountup";const Zl=e=>{const{className:n}=e,{$size:r}=Yn(e),l=nr("empty"),i=Object.assign(Object.assign({},e),{image:Z.PRESENTED_IMAGE_SIMPLE}),a={[l]:!0,[`${l}--lg`]:"large"===r,[`${l}--sm`]:"small"===r};return t.createElement(Z,Kn({},i,{className:Ae(a,n)}))};Zl.displayName="QmEmpty";const Jl=e=>{const n=In({tip:"Loading..."},e),{fullHeight:r,className:l,style:i}=n,a=nr("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:Ae(o,l)},Sn(n,["fullHeight"])),{style:Object.assign(Object.assign({},i),{maxHeight:"none"})});return t.createElement(J,s,n.children)};Jl.displayName="QmSpin";const ei=t.createContext(void 0),ti=new Map;const ni=new $t((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=ti.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function ri(e,t){ti.has(e)||(ti.set(e,new Set),ni.observe(e)),ti.get(e).add(t)}function li(e,t){ti.has(e)&&(ti.get(e).delete(t),ti.get(e).size||(ni.unobserve(e),ti.delete(e)))}function ii(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&&ri(e,n),()=>{e&&li(e,n)}}),[t]),n}const ai=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function oi(e,t){ai((t=>{if(!t)return e()}),t)}function si(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 ci=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,di=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ui=e=>({_s:e,status:di[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),mi=e=>e?6:5,pi=(e,t,n,r,l)=>{clearTimeout(r.current);const i=ui(e);t(i),n.current=i,null==l||l({current:i})},hi=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:l,timeout:a,initialEntered:d,mountOnEnter:u,unmountOnExit:m,onStateChange:p}=e||{},[h,g]=s((()=>ui(d?2:mi(u)))),v=i(h),y=i(),[b,x]=(e=>f(e)?[e.enter,e.exit]:[e,e])(a),E=c((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return mi(t)}})(v.current._s,m);e&&pi(e,g,v,y,p)}),[p,m]),w=c((e=>{const i=e=>{switch(pi(e,g,v,y,p),e){case 1:b>=0&&(y.current=setTimeout(E,b));break;case 4:x>=0&&(y.current=setTimeout(E,x));break;case 0:case 3:y.current=setTimeout((()=>i(e+1)),0)}},a=v.current.isEnter;"boolean"!=typeof e&&(e=!a),e?!a&&i(t?r?0:1:2):a&&i(n?l?3:4:mi(m))}),[E,p,t,n,r,l,b,x,m]);return o((()=>()=>clearTimeout(y.current)),[]),[h,w,E]},fi=e=>{const{name:n,in:r,timeout:l,preEnter:i=!0,preExit:a}=e,[o,s]=hi({timeout:l,preEnter:i,preExit:a,initialEntered:r});return oi((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?ci(e,{className:Ae(e.props.className,n,o.status)}):e)))},gi=6,vi={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"}},yi=e=>{const{thumb:n,always:r,className:l,barSize:i=gi,direction:a="vertical",onDrag:o=vn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(ei),u=vi[a],m=t.useRef(null),p=t.useRef(null),h=t.useRef({}),f=t.useRef(!1),g=t.useRef(!1),v=t.useRef(hn?null:document.onselectstart),[y,b]=t.useState(!1);t.useEffect((()=>{const e=c.current;return Dl(e,"mousemove",C),Dl(e,"mouseleave",S),()=>{w(),Ml(document,"mouseup",E),Ml(e,"mousemove",C),Ml(e,"mouseleave",S)}}),[]);const x=e=>{if(!m.current||!p.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const n=100*(-1*(m.current.getBoundingClientRect()[u.direction]-e[u.client])-(p.current[u.offset]-t))/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},Ml(document,"mousemove",x),Ml(document,"mouseup",E),w(),g.current&&b(!1),o(!1)},w=()=>{document.onselectstart!==v.current&&(document.onselectstart=v.current)},C=Gn((()=>{g.current=!1,b(!!n.size)})),S=Gn((()=>{g.current=!0,b(f.current)})),N=nr("scrollbar"),T={[`${N}__bar`]:!0,"is-vertical":"vertical"===a,"is-horizontal":"horizontal"===a},I={[u.reverse]:i},R={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(fi,{name:"fade",in:r||s||y,timeout:300},t.createElement("div",{ref:m,className:Ae(T,l),style:I,onMouseDown:e=>{const t=e.target;if(!t)return;const n=100*(Math.abs(t.getBoundingClientRect()[u.direction]-e[u.client])-p.current[u.offset]/2)/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100}},t.createElement("div",{ref:p,className:`${N}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Dl(document,"mousemove",x),Dl(document,"mouseup",E),f.current=!0,v.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},bi=20,xi=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:l,innerStyle:i,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=bi,onScroll:u,onReachedEnd:m}=e,p=t.useRef(null),h=t.useRef(null),f=t.useRef(null),v=t.useRef({prevTop:0,prevLeft:0}),[y,b]=t.useState({size:0,offset:0,ratio:1}),[x,E]=t.useState({size:0,offset:0,ratio:1}),[w,C]=t.useState(!1),S=ii(p),N=ii(f);oi((()=>{!s&&T()}),[N.width,N.height,S.width,S.height]);const T=si((()=>{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,l=Math.max(n,d),i=Math.max(r,d),a=n/(e-n)/(l/(e-l)),o=r/(t-r)/(i/(t-i)),s=l+4<e?l:0,c=i+4<t?i:0,u=100*h.current.scrollTop/e*a,m=100*h.current.scrollLeft/t*o;b(Object.assign({},y,{size:c,ratio:o,offset:m})),E(Object.assign({},x,{size:s,ratio:a,offset:u}))}),5),I=e=>{C(e)},R=(e,t)=>{g(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,l=window.requestAnimationFrame,i=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollTop=r+(t-r)*Ul(a),l(i)):e.scrollTop=t};l(i)})(h.current,e):h.current.scrollTop=e:Zn("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},O=(e,t)=>{g(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,l=window.requestAnimationFrame,i=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollLeft=r+(t-r)*Ul(a),l(i)):e.scrollLeft=t};l(i)})(h.current,e):h.current.scrollLeft=e:Zn("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:p.current,scrollElement:h.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:R,SET_SCROLL_LEFT:O}}));const k=t.useMemo((()=>({dragging:w,scrollbarElement:p,wrapElement:h})),[w]),L=nr("scrollbar"),A={[`${L}__wrap`]:!0,[`${L}__wrap--hidden`]:!s};return t.createElement("div",{ref:p,className:Ae(L,e.className),style:e.style},t.createElement("div",{ref:h,className:Ae(A,r),style:l,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(({scrollTop:e,scrollLeft:t})=>{if(!h.current)return;const n=h.current.offsetHeight-4,r=h.current.offsetWidth-4,l=100*e/n*x.ratio,i=100*t/r*y.ratio;b(Object.assign({},y,{offset:i})),E(Object.assign({},x,{offset:l}))})({scrollTop:t,scrollLeft:n}),null==u||u({scrollTop:t,scrollLeft:n});const{prevTop:r,prevLeft:l}=v.current,i={bottom:t+h.current.clientHeight>=h.current.scrollHeight,top:t<=0&&0!==r,right:n+h.current.clientWidth>=h.current.scrollWidth&&l!==n,left:n<=0&&0!==l};let a;var o;r!==t&&(a=t>r?"bottom":"top"),l!==n&&(a=n>l?"right":"left"),a&&i[a]&&(null==m||m(a,{scrollTop:t,scrollLeft:n})),o={prevTop:t,prevLeft:n},v.current=o}},t.createElement("div",{ref:f,className:`${L}__view`,style:i},e.children)),!s&&t.createElement(ei.Provider,{value:k},c&&t.createElement(yi,{className:"top",direction:"horizontal",thumb:y,barSize:a,always:o,onDrag:I}),t.createElement(yi,{direction:"horizontal",thumb:y,barSize:a,always:o,onDrag:I}),t.createElement(yi,{direction:"vertical",thumb:x,barSize:a,always:o,onDrag:I})))}));xi.displayName="QmScrollbar";const Ei=(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}},wi=(e,{fileName:t,headers:n,params:r})=>pn(void 0,void 0,void 0,(function*(){const l=r?new URLSearchParams(r).toString():"",i=l?e.includes("?")?"&":"?":"",a=yield fetch(e+`${i+l}`,{method:"GET",headers:n});if(!a.ok)throw new Error(dn("qm.download.error"));const o=yield a.blob(),s=a.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Ei(o,c)})),Ci=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Si=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Ni=e=>{var n,r;const l=In({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:i=[],fileDirection:a="vertical",batchDownload:o,draggable:s,editable:c,disabled:d,readOnly:u,button:m={},className:p,onPreview:h,onSortChange:f,onEditChange:g,onDownload:v,onChange:y}=l,{t:b}=Un(),{$size:x}=Yn(l),E=t.useRef(null),w=t.useRef(null),[C,S]=t.useState({}),N=t.useMemo((()=>d||u),[d,u]);t.useEffect((()=>(R(),()=>{var e;return null===(e=w.current)||void 0===e?void 0:e.destroy()})),[]);const T=(e,t)=>{S((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},I=Gn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...i],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:i[t],fileList:e})}})),R=()=>{s&&(w.current=qt.create(zl(E.current,nr("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:I}))},O=e=>pn(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=l;try{e.url&&(yield wi(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){te.error(b("qm.download.error"))}})),k=nr("upload-file"),L={[k]:!0,[`${k}--lg`]:"large"===x,[`${k}--sm`]:"small"===x,[`${k}--horizontal`]:"horizontal"===a};return t.createElement(ee,Kn({className:Ae(L,p)},Sn(l,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>pn(void 0,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:a,maxCount:o,fileList:s=[],beforeUpload:c}=l,d=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!a||e.size/1024/1024<a,m=!(o>1)||s.length<o,p=d&&u&&m;if(d||te.warning(b("qm.upload.tooltip",{type:i.join(",")})),u||te.warning(b("qm.upload.sizeLimit",{size:a})),m||te.warning(b("qm.upload.countLimit",{count:o})),!p)return ee.LIST_IGNORE;if(c){const l=c(e,t);if(!0===l)return n(e);if(!1===l)return r("not upload");if(l&&"function"==typeof l.then)try{const e=yield l;n(e)}catch(e){r(e)}}else n(e)})))),disabled:N,onChange:y,onPreview:e=>pn(void 0,void 0,void 0,(function*(){if("function"==typeof h)return h(e,(t=>O(t||e)));d||(yield O(e))})),onDownload:e=>pn(void 0,void 0,void 0,(function*(){yield O(e)})),itemRender:(e,n,r,a)=>((e,n)=>{const{iconRender:r}=l,{uid:a,name:o,url:u,status:m="done"}=e,p="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return t.createElement("div",{className:Ae("ant-upload-list-item",`ant-upload-list-item-${m}`,"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(De,null)),t.createElement("div",{className:"ant-upload-list-item-name"},C[a]?t.createElement(ne,{size:"small",autoFocus:!0,defaultValue:Ci(o),onBlur:t=>{const{value:n}=t.target;if(n!==Ci(o)){const t=Object.assign({},e,{name:`${n}.${Si(o)}`}),r=i.map((e=>e.uid!==a?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}T(a,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?N||T(a,!0):n.preview()}},o)),t.createElement("span",{className:"ant-upload-list-item-card-actions"},c&&!N&&t.createElement("button",{type:"button",className:p,onClick:()=>T(a)},C[a]?t.createElement(He,null):t.createElement(Me,null)),c&&t.createElement("button",{type:"button",className:Ae(p,"preview"),onClick:()=>n.preview()},t.createElement($e,null)),t.createElement("button",{type:"button",className:Ae(p,"download"),disabled:d,onClick:()=>n.download()},t.createElement(qe,null)),t.createElement("button",{type:"button",className:Ae(p,"delete"),disabled:N,onClick:()=>n.remove()},t.createElement(Ke,null))))))})(n,a)}),t.createElement("span",{className:"inner",ref:E},l.children||u&&i.length?l.children:t.createElement(G,{type:null!==(n=m.type)&&void 0!==n?n:"default",icon:null!==(r=m.icon)&&void 0!==r?r:t.createElement(Fe,null),disabled:N},m.text||b("qm.upload.text")),o&&!!i.length&&t.createElement(G,{disabled:d,style:{marginLeft:8},onClick:e=>pn(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),"function"==typeof o)yield o(i);else for(const e of i)yield O(e)}))},b("qm.upload.batchDownload"))))};Ni.displayName="QmUploadFile";const Ti=e=>{const n=In({icon:t.createElement(qe,null),withCredentials:!1},e),{$size:r}=Yn(n),{t:l}=Un(),[i,a]=t.useState(!1),o=Sn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(G,Kn({},o,{size:r,loading:i,onClick:()=>pn(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:i,beforeDownload:a=yn,onSuccess:o}=n,s=y(e)?e:yield pn(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 Zn("Download","参数 `action` 有误!");if(!a(s))return;yield wi(s,{fileName:t,headers:r,params:i}),yield bn(100),null==o||o(),te.success(l("qm.download.success"))}catch(t){null===(e=n.onError)||void 0===e||e.call(n,t),te.error(l("qm.download.error"))}a(!1)}))}),n.children||l("qm.download.text"))};function Ii(t,n){const r=e.useRef(null),l=e.useRef(0);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{const r=Date.now();(!l.current||r-l.current>n)&&(t.apply(this,e),l.current=r)}),[t,n])}Ti.displayName="QmDownload";const Ri=e=>{const{activeKey:n,labels:r,onTabClick:l}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const i={item:!0,actived:r===n};return t.createElement("div",{key:r,className:Ae(i),onClick:e=>l(r,e)},t.createElement("span",null,e))})))},Oi=e=>{const{label:n,showDivider:r,className:l,style:i}=e,a={[nr("anchor-item")]:!0};return t.createElement("div",{className:Ae(a,l),style:i},r&&t.createElement(rr,{label:n,style:{marginBottom:10}}),e.children)};Oi.displayName="AnchorItem";const ki=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:l,labelWidth:i,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=Yn(e),u=t.useRef(null),m=t.useRef(),p=t.useRef("ready"),h=t.useRef(0),[f,g]=t.useState(l||0),v=t.useMemo((()=>!!(null==r?void 0:r.length)),[r]);t.useEffect((()=>{y();const e=Kt(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=jl(x(f),u.current))},b=e=>{const t=Math.abs(e),n=(v?r.map((e=>document.getElementById(e.id))):Array.from((null===(l=u.current)||void 0===l?void 0:l.children)||[])).map((e=>jl(e,u.current)));var l;let i=-1;for(let e=0;e<n.length;e++){const r=n[e],l=n[e+1]||1e4;t>=r-1&&t<l&&(i=e)}return i},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=Ii((e=>{if("ready"!==p.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),w=e=>{const t=x(e);t&&(g(e),p.current="stop",m.current&&clearTimeout(m.current),jt(t,{block:"start",behavior:"smooth",boundary:u.current}),m.current=setTimeout((()=>p.current="ready"),500))};t.useImperativeHandle(n,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>h.current?h.current:e,w(e)}})));const C=nr("anchor"),S={[C]:!0,[`${C}-left`]:"left"===a,[`${C}-top`]:"top"===a,[`${C}--lg`]:"large"===d,[`${C}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;fn(e)&&!gn(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 h.current=T.length,t.createElement("div",{className:Ae(S,s),style:c},t.createElement("div",{className:Ae("anchor-nav"),style:{width:i?Tn(i):""}},t.createElement(Ri,{activeKey:f,labels:T,onTabClick:(e,t)=>{w(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:Ae("anchor-container")},v?e.children:N))}));ki.displayName="QmAnchor",ki.Item=Oi;const Li=e=>t.createElement(re.TabPane,e,e.children);Li.displayName="TabPane";const Ai=e=>{const n=In({tabPosition:"top"},e),{items:r,tabPosition:l,tabBarGutter:i,className:a,authConfig:o}=n,{$size:s}=Yn(n),c=nr("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},Sn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=i?i:["top","bottom"].includes(l)?30:0}),m=[];t.Children.map(n.children,(e=>{var t;fn(e)&&!gn(e)&&"TabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&m.push(e)}));const p=r?[...r]:m.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<p.length;t++){const n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:l=1,disabled:i}=r||{};l?i&&(n.disabled=!0):(p.splice(t,1),t--)}}return t.createElement(re,Kn({},u,{items:p,className:Ae(d,a)}))};Ai.displayName="QmTabs",Ai.TabPane=Li;const Pi=t.forwardRef(((e,n)=>{var r;const l=In({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:i,open:a,className:o,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:h,onFullChange:f}=l,{global:g}=t.useContext(an),{$size:v}=Yn(l),y=t.useRef(null),x=t.useRef(null),E=t.useRef(!1),[w,C]=t.useState(!1),[S,N]=t.useState(!1),[T,I]=t.useState(!1);Fl((()=>{(null!=a?a:i)&&(!m&&E.current||b(s)&&N(!0))}),[null!=a?a:i]),Fl((()=>{x.current&&ql(x.current,w?{width:"100%"}:{width:Tn(l.width||"72%")})}),[w]);const R=()=>{x.current=zl(y.current,"ant-drawer-content-wrapper"),C(!w),null==f||f(!w)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>I(!0),STOP_LOADING:()=>I(!1)})));const O=nr("drawer"),k={[O]:!0,"no-header":!c,[`${O}--lg`]:"large"===v,[`${O}--sm`]:"small"===v};return t.createElement(le,Kn({},Sn(l,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=a?a:i,maskClosable:null!==(r=null!=u?u:null==g?void 0:g.maskClosable)&&void 0!==r&&r,className:Ae(k,o),title:t.createElement(t.Fragment,null,t.createElement("span",{ref:y,className:"text"},c&&l.title),d&&t.createElement("button",{type:"button",className:"full-screen",onClick:R},t.createElement(w?je:Ve))),footer:null,afterOpenChange:e=>{e?(E.current=!0,b(s)&&setTimeout((()=>N(!1)),100)):(C(!1),null==h||h())},onClose:p}),l.children,(s||T||S)&&t.createElement(Jl,{spinning:!0,className:Ae("spinning")}))}));Pi.displayName="QmDrawer";const _i="10vh";var Fi;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Fi||(Fi={}));const Di=t.forwardRef(((e,n)=>{var r;const l=In({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:_i}},e),{visible:i,open:a,width:o,height:s,className:c,loading:d,draggable:u,showHeader:m,showFullScreen:p,maskClosable:h,destroyOnClose:f,bodyStyle:g,onFullChange:v,onClose:y,onClosed:x}=l,{global:E}=t.useContext(an),{$size:w}=Yn(l),C=t.createRef(),S=t.useRef(!1),N=t.useMemo((()=>`calc(100vh - ${_i} - ${_i} - ${Fi[m?w:"none"]}px)`),[w,m]),[T,I]=t.useState(!1),[R,O]=t.useState(!1),[k,L]=t.useState(!1),[A,P]=t.useState(!0),[_,F]=t.useState({left:0,top:0,bottom:0,right:0}),[D,M]=t.useState();Fl((()=>{if(null!=a?a:i){if(!f&&S.current||b(d)&&O(!0),!f&&S.current)return;setTimeout((()=>{S.current=!0,b(d)&&O(!1)}),400)}}),[null!=a?a:i]),Fl((()=>{M(T?{x:0,y:0}:void 0)}),[T]);const H=e=>{const t=zl(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");T?(ql(t,{width:Tn(o||"60%"),height:"auto",top:_i}),ql(n,{height:s?Tn(s):N,maxHeight:"auto"===s?N:""})):(ql(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),ql(n,{height:`calc(100vh - ${Fi[m?w:"none"]}px)`,maxHeight:""})),I(!T),null==v||v(!T)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>L(!0),STOP_LOADING:()=>L(!1)})));const $=nr("modal"),q={height:s?Tn(s):N,maxHeight:"auto"===s?N:"",overflow:"auto"},K={[$]:!0,"no-header":!m,[`${$}--lg`]:"large"===w,[`${$}--sm`]:"small"===w};return t.createElement(ie,Kn({},Sn(l,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:null!=a?a:i,maskClosable:null!==(r=null!=h?h:null==E?void 0:E.maskClosable)&&void 0!==r&&r,className:Ae(K,c),title:t.createElement("div",{onMouseOver:()=>{A&&P(!1)},onMouseOut:()=>{P(!0)}},t.createElement("span",{className:"text"},m&&l.title),p&&t.createElement("button",{type:"button",className:"full-screen",onClick:H},t.createElement(T?je:Ve))),footer:null,bodyStyle:Object.assign({},q,g),onCancel:y,afterClose:()=>{null==x||x(),I(!1)},modalRender:e=>t.createElement(Vt,{nodeRef:C,bounds:_,position:D,disabled:!u||A||T,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,l=C.current.getBoundingClientRect();l&&F({left:-l.left+t.x,right:n-(l.right-t.x)-1,top:-l.top+t.y,bottom:r-(l.bottom-t.y)-1})})(0,t)},t.createElement("div",{ref:C},e))}),l.children,(d||k||R)&&t.createElement(Jl,{spinning:!0,className:Ae("spinning")}))}));Di.displayName="QmModal";const Mi=n(void 0);var Hi={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," <> "," != ")}};const $i=["==","<",">","<=",">=","!=","like","nlike","likes","in","nin","^=","=$","nil","nnil"];var qi=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},Ki=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++)$i.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),$i.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const ji=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,Vi=["string","number","boolean","symbol"],zi=e=>Vi.includes(typeof e),Wi=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Bi=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(new RegExp(Ia,"g")," ").toString().replace(ji,"\\$1"),"i"),Ui=(e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Bi(n));break;case"nlike":r=null===e.toString().match(Bi(n));break;case"likes":r=n.split(/,|,/).some((t=>Ui(e,"like",t)));break;case"in":zi(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?e.every((e=>n.includes(e))):n.includes(e));break;case"nin":zi(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?e.some((e=>n.includes(e))):n.includes(e)));break;case"^=":r=e.toString().startsWith(n);break;case"=$":r=e.toString().endsWith(n);break;case"nil":r=""===e||null==e;break;case"nnil":r=!Ui(e,"nil",null);break;case"!=":case"<>":r=(Wi(e)?e.slice(0,10):e)!=n;break;case"<":r=(Wi(e)?e.slice(0,10):e)<n;break;case"<=":r=(Wi(e)?e.slice(0,10):e)<=n;break;case">":r=(Wi(e)?e.slice(0,10):e)>n;break;case">=":r=(Wi(e)?e.slice(0,10):e)>=n;break;default:r=(Wi(e)?e.slice(0,10):e)==n}return r};window.__query__=(...e)=>Ui(e[0],e[1],e[2]);const Gi=Hi.stringify,Yi=Hi.array_format,Xi=qi,Qi=(e,t,n)=>{if(!t)return e;let r=[];t=Hi.replace_symbols(t);try{if(n){const n=new Function("record",`return ${Ki(t,"record")};`);r=Pa(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${Ki(t,"array[i]")};`);for(let t=0,l=e.length;t<l;t++)n(e,t)&&r.push(e[t])}}catch(t){Zn("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Zi=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Zi(e.children)):t.push(e)})),t},Ji=e=>e.filter((e=>(e.children&&(e.children=Ji(e.children)),!e.hidden&&!e.noAuth))),ea=e=>e.map((e=>{const t={dataIndex:e.dataIndex};return Array.isArray(e.children)&&(t.children=ea(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),t})),ta=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...ta(e.children))})),t},na=(e,t)=>e.map((e=>(e.children&&(e.children=na(e.children,t)),null==t||t(e),e))),ra=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=ra(n.children,t);if(e)return e}}return null},la=e=>{const t=e.children;return t?t[0].children?la(t[0]):t[0]:e},ia=e=>{const t=e.children;return t?t[t.length-1].children?ia(t[t.length-1]):t[t.length-1]:e},aa=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),oa=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...oa(e.children))})),t},sa=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...sa(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},ca=(e,t)=>{const n=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&n.push(...ca(e[r].children,t)),n.push(t(e[r]));return n},da=e=>{let t=1;const n=(e,r)=>{var l;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!==(l=e.colSpan)&&void 0!==l?l:1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return ta(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},ua=e=>Object.assign(e,{__prevent__:!0}),ma=e=>e.__prevent__,pa=e=>{delete e.__prevent__},ha=(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 ha(e.offsetParent,t,n)}return n},fa=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,ga=(e,t)=>w(e,((e,n,r)=>{C(n,t[r])||(e[r]=f(n)&&f(t[r])?ga(n,t[r]):n)})),va=(e,t)=>{var n;return null!==(n=x(e,t))&&void 0!==n?n:""},ya=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),E(e,t,null!=n?n:"")},ba=(e,t)=>{if(!t.includes("|"))return va(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(va(e,t))})),n.every((e=>!e))?"":n.join(" | ")},xa=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),Ea=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],l="";for(;r.length>3;)l=`,${r.slice(-3)}${l}`,r=r.slice(0,r.length-3);return r&&(l=r+l),`${n}${l}${t[1]?`.${t[1]}`:""}`},wa=(e,t)=>{const n=e.toString();if(!xa(n)||0===t)return e;const r=Number.parseFloat(n).toString(),l=r.indexOf(".");if(-1===l)return r+"."+"0".repeat(t);const i=Math.max(0,t-(r.length-l-1));return r+"0".repeat(i)},Ca=(e,t)=>e?p(e,t):null,Sa=(e,t)=>e?p(e).format(t):"",Na=(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)}))},Ta=e=>(e=>{const n=[];return function e(r){null!=r&&"boolean"!=typeof r&&("string"!=typeof r&&"number"!=typeof r?Array.isArray(r)?r.forEach(e):t.isValidElement(r)&&e(r.props.children):n.push(r))}(e),n})(e).join(""),Ia="",Ra=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let l=0,i=e.length;l<i;l++){const i=e[l];if(!i.fieldName)continue;const a=Array.isArray(i.condition)?Yi(i.condition):Gi(i.condition,Ia);n+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${a} ${i.bracketRight} ${i.logic} `,r=i.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[l,i]=r.includes("|")?r.split("|"):[r,""],a=e[r];for(const e in a){n+=`${t?`${l}|${i}`:l} ${e} ${Array.isArray(a[e])?Yi(a[e]):Gi(a[e],Ia)} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},Oa=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(va(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},ka=(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=ka(e[n].children,t);if(r)return[e[n],r].flat()}}},La=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=La(n.children,t);if(e)return e}if(t(n))return n}return null},Aa=(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=Aa(e[n].children,t);if(r)return[e[n]._rowKey,r].flat()}}},Pa=(e,t)=>e.reduce(((e,n)=>{const r=Object.assign({},n);return Array.isArray(n.children)&&(r.children=Pa(n.children,t)),(t(r)||r.children&&r.children.length>0)&&e.push(r),e}),[]),_a=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Fa=(e,t,n=!1)=>{const r=new Set;return function e(t,l,i=1){if(r.has(t))return!1;if(t===l)return!0;if(n&&i>1)return!1;r.add(t);const a=i+1;if(Array.isArray(t)){if(!Array.isArray(l)||t.length!==l.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],l[n],a))return!1;return!0}if(t&&l&&"object"==typeof t&&"object"==typeof l){const n=Object.keys(t);return n.length===Object.keys(l).length&&n.every((n=>e(t[n],l[n],a)))}return!1}(e,t)},Da=(e,t)=>e===t,Ma=e=>["nil","nnil"].includes(e);function Ha(e,t){for(const n in t){const r=t[n],l=va(e,n);if(r)if(Array.isArray(l)){if(!l.some((e=>r.includes(e))))return!1}else if(!r.includes(l))return!1}return!0}const $a=(e,t,n)=>Object.keys(t).length&&e.length?n?Pa(e,(e=>Ha(e,t))):e.filter((e=>Ha(e,t))):e,qa=e=>["","small","middle","large"].includes(e),Ka=80,ja="1",Va="0",za=400,Wa=["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"],Ba={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 Ua,Ga,Ya;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Ua||(Ua={})),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"}(Ga||(Ga={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Ya||(Ya={}));const Xa={items:Bt.arrayOf(Bt.shape({type:Bt.string.isRequired,fieldName:Bt.string.isRequired})),initialValues:Bt.object,initialExtras:Bt.object,layout:Bt.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!qa(e[t]||""))return Qn("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Bt.number,className:Bt.string,style:Bt.object,compactMode:Bt.bool,labelWidth:Bt.oneOfType([Bt.number,Bt.string]),labelAlign:Bt.oneOf(["left","right"]),labelWrap:Bt.bool,formType:Bt.oneOf(["default","search","onlyShow"]),disabled:Bt.bool,uniqueKey:Bt.string,defaultRows:Bt.number,defaultExpand:Bt.bool,searchButtonCols:Bt.number,scrollToFirstError:Bt.bool,authConfig:Bt.object,isAutoFocus:Bt.bool,isCollapse:Bt.bool,isFieldsDefine:Bt.bool,isSearchBtn:Bt.bool,isSubmitBtn:Bt.bool,fieldsChange:Bt.func,onValuesChange:Bt.func,onFieldsChange:Bt.func,onFinish:Bt.func,onFinishFailed:Bt.func,onReset:Bt.func,onCollapse:Bt.func},Qa={layout:"horizontal",labelWidth:Ka,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:vn,onFieldsChange:vn,onFinish:vn,onFinishFailed:vn,onReset:vn,onCollapse:vn},Za=(e,t)=>{if(!e)return null;if(t===Ga.week){const t=e.match(/^(\d{4})-(\d+)/);return t?p().year(Number(t[1])).week(Number(t[2])):null}if(t===Ga.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?p().year(Number(t[1])).quarter(Number(t[2])):null}return p(e,t)},Ja=(e,t)=>e?p(e).format(t):"",eo=e=>""===e||null==e,to=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let l="";for(let t=0,i=r.length;t<i;t++){l+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===i-1?"":" | ")}return l},no=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const l=t[r].split("|"),i=n[r].split("|");l.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},ro=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const l=t[r].split("|"),i=n[r].split("|");l.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},lo=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),b(e.isLeaf)||(r.isLeaf=!!e.isLeaf),b(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=lo(e.children,t,n)),r})),io=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=io(n.children,t);if(e)return e}}return null},ao=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...ao(e.children,t,n+1))})),r},oo=e=>fn(e)||"string"==typeof e,so=(e,t,n,r)=>{var l;const i={};return i.filters=(null===(l=e.filters)||void 0===l?void 0:l.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})))||[],i.table={columns:e.columns||[],rowKey:e.valueName},i.fieldsDefine={valueKey:e.valueKey||e.valueName},i.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(i.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(i.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&&(i.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(i.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&&(i.columns=e.emmediateSetting.columns,i.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),i};var co={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 uo="阿",mo="鿿",po=1,ho=2,fo=3;let go,vo=null;function yo(e){return e||null===vo?("object"==typeof Intl&&Intl.Collator?(go=new Intl.Collator(["zh-Hans-CN","zh-CN"]),vo=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):vo=!1,vo):vo}function bo(e){const t=co.UNIHANS,n=co.PINYINS,r=co.EXCEPTIONS,l={source:e};if(e in r)return l.type=ho,l.target=r[e],l;let i,a=-1;if(e.charCodeAt(0)<256)return l.type=po,l.target=e,l;if(i=go.compare(e,uo),i<0)return l.type=fo,l.target=e,l;if(0===i)l.type=ho,a=0;else{if(i=go.compare(e,mo),i>0)return l.type=fo,l.target=e,l;0===i&&(l.type=ho,a=t.length-1)}if(l.type=ho,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const l=t[a];if(i=go.compare(e,l),0===i)break;i>0?n=a+1:r=a-1}}return i<0&&a--,l.target=n[a],l.target||(l.type=fo,l.target=l.source),l}function xo(e){return"string"==typeof e&&yo()?e.split("").map((e=>bo(e))):e}var Eo={isSupported:yo,parse:xo,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(co)})))},genToken:bo,convertToPinyin:(e,t,n)=>xo(e).map((e=>t&&e.type===ho?e.target.toLowerCase():e.target)).join(n||"")};var wo={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)}};Eo.isSupported()&&wo.shouldPatch(Eo.genToken)&&Eo.patchDict(wo);const Co=e=>{const{value:n,bordered:r}=e;return t.createElement(ne,{value:n,title:n,bordered:r,readOnly:!0})};Co.displayName="FormItemView";const{Option:So}=ce,No=e=>{const{$$form:n}=t.useContext(Mi),{value:r,items:l,multiple:i,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Un(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:v,onClear:y}=e.option,{itemList:b=[],filterable:x=!0,listHeight:E=za,collapseTags:w,maxTagTextLength:C,dropdownStyle:S,openPyt:N=!0}=u,T=wn(b)?l: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=>i?(null==e?void 0:e.map((e=>I(e))).join(","))||"":I(e);return n.isOnlyShow?t.createElement(Co,{value:R(r),bordered:h}):t.createElement(ce,Kn({value:r,mode:i?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:S,placeholder:p,style:m,loading:a,bordered:h,allowClear:f,disabled:v,showSearch:x,listHeight:E,maxTagCount:w?"responsive":void 0,maxTagTextLength:C},i?{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())||"",l=Eo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${l}`: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(So,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class To extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>pn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,buttonAfter:p,validateTrigger:h,rules:f=[],onChange:g=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(i),className:Ae(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Tn(d)},required:e.getFormItemRequired(f)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(No,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(se,null,e.renderFormItemButton(o,p)),m&&t.createElement(se,{flex:Tn(m.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}To.contextType=Mi;const Io=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=Va,trueValue:p=ja}=o,{t:h}=Un(),f=e=>h(e===p?"am.form.trueText":"am.form.falseText");return t.createElement(de,{checked:r===p,style:s,disabled:d||n.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==l||l(e),i(e,f(e))})(t?p:m)}},u?a:null)};class Ro extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option,{labelToCheckbox:h}=o;return t.createElement(ae.Item,{label:h?" ":e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Io,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Ro.contextType=Mi;const Oo=e=>{const{uniqueKey:n,items:r,fieldsChange:l}=e,{global:i}=t.useContext(an),{$$form:a}=t.useContext(Mi),{$size:o}=Yn(e),{t:s}=Un(),c=t.useRef(null),[d,u]=t.useState(!1),m=t.useMemo((()=>n?`form_${n}`:""),[n]);t.useLayoutEffect((()=>{f()}),[]);const p=()=>{if(!m)return;const e=JSON.parse(localStorage.getItem(m));var t;if(e||(t=m,pn(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(m,JSON.stringify(e)),f()):(null==i?void 0:i.getComponentConfigApi)&&h(r)})).catch((()=>{})),!e)return;return S(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?(b(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)}))},h=e=>{if(!m)return;const t=e.map((e=>{const t={};return b(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(m));var r,l;C(t,n)||(localStorage.setItem(m,JSON.stringify(t)),r=m,l=t,pn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:l})}catch(e){}})))},f=()=>{const e=p();e&&g(e)},g=e=>{null==l||l([...e])},v=()=>t.createElement("div",{className:Ae("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(Jn,{type:"text",size:"small",onClick:()=>(e=>{const t=e.filter((e=>r.find((t=>t.fieldName===e.fieldName)))).map((e=>{const t=r.find((t=>t.fieldName===e.fieldName));return Object.assign({},t,{hidden:e.hidden})}));g(t),h(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(Ut,{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(C(t,n))return;a.setExpandHandle(!0);const l=_a(e);g(l),h(l)}},r.map((e=>{var n;return t.createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},t.createElement(de,{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),h(r)}}),t.createElement(We,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=nr("form-fields-filter"),x={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(ue,{open:d,trigger:["click"],dropdownRender:()=>v(),overlayClassName:Ae(x),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>c.current,onOpenChange:e=>{u(e)}},t.createElement("a",{ref:c,style:{padding:"5px 0"}},t.createElement(ze,null)))};Oo.displayName="FieldsFilter";const ko=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Mi),{value:l,onChange:i,onValuesChange:a}=e,{t:o}=Un(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h,onFocus:f,onBlur:g,onEnter:v,onClear:y}=e.option,{prefix:b,suffix:x,password:E,maxLength:w,pattern:C,toUpper:S,toTrim:T,autoFocus:I,autoComplete:R,secretType:O}=s,k=O&&(p||h),L=t.useRef(),A=t.useRef(!1);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 m&&n&&n.addEventListener("click",t),()=>{null==n||n.removeEventListener("click",t)}}),[]);const P=e=>{null==i||i(e),a(e)},_=E?ne.Password:ne,F=k?((e="",t)=>(e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e))(l,O):l;return r.isOnlyShow?t.createElement(Co,{value:(e=>e&&E?new Array(e.length).fill("*").join(""):e)(F),bordered:u}):t.createElement(_,{ref:e=>{L.current=e,"function"==typeof n&&n(e)},value:F,autoComplete:E?"new-password":R,autoFocus:I,placeholder:d,style:c,title:E?"":F,prefix:b,suffix:x,maxLength:w,bordered:u,allowClear:m,readOnly:p,disabled:h,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(T){const e=r.trim();r!==e&&(r=e,P(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())}},onCompositionStart:()=>{A.current=!0},onCompositionEnd:()=>{A.current=!1},onChange:e=>{let t=e.target.value;N(C)&&(t=C.test(t)?t:null!=l?l:""),S&&!A.current&&(t=t.toUpperCase()),P(t)}})}));ko.displayName="VInput";class Lo extends d{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:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(p)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ko,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),u&&t.createElement(se,null,e.renderFormItemButton(i,u)),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Lo.contextType=Mi;const Ao=e=>{const{$$form:n}=t.useContext(Mi),{value:r=[],onChange:l,onValuesChange:i}=e,{t:a}=Un(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{prefix:p,suffix:h,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;null==l||l(t),i(t,v(t))},v=e=>e.join(" - ");return n.isOnlyShow?t.createElement(Co,{value:v(r),bordered:c}):t.createElement(ne.Group,null,t.createElement(ne,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:p,suffix:h,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),t.createElement(ne,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement(ne,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:p,suffix:h,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class Po extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(s),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(o)},required:e.getFormItemRequired(u)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ao,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(i,n)}}))),c&&t.createElement(se,{flex:Tn(c.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},c)))))}}Po.contextType=Mi;const _o=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Mi),{value:l,onChange:i,onValuesChange:a}=e,{t:o}=Un(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:v}=e.option,{step:y=1,min:b,max:x,precision:E,autoFocus:w,stringMode:C,textAlign:S="left",controls:N=!0,formatter:T,parser:I}=s,R=t.useRef(),O=t.useRef(l),k=e=>{const t=eo(e)?"":g(e)?e.toFixed(E):new Gt(e).toFixed(E);return"function"==typeof T?T(t):t},L={[S]:!0,controls:N};return r.isOnlyShow?t.createElement(Co,{value:k(l),bordered:u}):t.createElement(me,{ref:e=>{R.current=e,"function"==typeof n&&n(e)},value:l,className:Ae(L),placeholder:d,style:Object.assign({width:"100%"},c),step:y,min:b,max:x,controls:N,precision:E,autoFocus:w,stringMode:C,formatter:T,parser:I,bordered:u,readOnly:m,disabled:p,onFocus:e=>{null==h||h(e.target.value,e)},onBlur:t=>{xn((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(O.current),null==f||f(O.current,t)}))},onKeyUp:e=>{var t;13===e.keyCode&&(null==v||v(l,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=R.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=>{O.current=e,null==i||i(e),a(e,k(e))})(t)}})}));_o.displayName="VInputNumber";class Fo extends d{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:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(p)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(_o,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&t.createElement(se,null,e.renderFormItemButton(i,u)),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Fo.contextType=Mi;const Do=e=>{const{$$form:n}=t.useContext(Mi),{value:r=[],onChange:l,onValuesChange:i}=e,{t:a}=Un(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{step:p=1,min:h=0,max:f,textAlign:g="left",controls:v=!0,precision:y,formatter:b,parser:x}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];null==l||l(t),i(t,C(t))},C=e=>eo(e)?"":e.map((e=>eo(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(Co,{value:C(r),bordered:c}):t.createElement(ne.Group,null,t.createElement(me,{value:r[0],className:Ae("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:p,min:h,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([e,r[1]])},onBlur:()=>{E(r)}}),t.createElement(ne,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement(me,{value:r[1],className:Ae("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:p,min:h,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([r[0],e])},onBlur:()=>{E(r)}}))};class Mo extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(s),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(o)},required:e.getFormItemRequired(u)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Do,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(i,n)}}))),c&&t.createElement(se,{flex:Tn(c.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},c)))))}}var Ho;Mo.contextType=Mi,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(Ho||(Ho={}));const $o=n(void 0),qo={dataIndex:Bt.string.isRequired,title:Bt.string.isRequired,description:Bt.string,colSpan:Bt.number,width:Bt.number,minWidth:Bt.number,fixed:Bt.oneOf(["left","right"]),align:Bt.oneOf(["left","center","right"]),theadAlign:Bt.oneOf(["left","center","right"]),theadWrap:Bt.bool,printFixed:Bt.bool,hidden:Bt.bool,noAuth:Bt.bool,noFixed:Bt.bool,ellipsis:Bt.bool,className:Bt.string,theadClassName:Bt.string,children:Bt.array,sorter:Bt.oneOfType([Bt.bool,Bt.func]),filter:Bt.shape({type:Bt.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Bt.arrayOf(Bt.shape({text:Bt.string,value:Bt.oneOfType([Bt.string,Bt.number])})),style:Bt.object,openFilterList:Bt.bool}),precision:Bt.number,displayPrecision:Bt.number,formatType:Bt.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Bt.bool,canCopy:Bt.bool,editRender:Bt.func,dictItems:Bt.arrayOf(Bt.shape({text:Bt.string,value:Bt.oneOfType([Bt.string,Bt.number])})),summation:Bt.shape({sumBySelection:Bt.bool,displayWhenNotSelect:Bt.bool,dataKey:Bt.string,unit:Bt.string,render:Bt.func}),groupSummary:Bt.shape({dataKey:Bt.string,unit:Bt.string,render:Bt.func}),shouldCellUpdate:Bt.func,headRender:Bt.func,render:Bt.func,outputRender:Bt.func};Bt.arrayOf(Bt.shape(qo)).isRequired,Bt.func,Bt.array,Bt.oneOfType([Bt.string,Bt.func]).isRequired,Bt.number,Bt.bool,Bt.bool,Bt.shape({api:Bt.func.isRequired,params:Bt.object.isRequired,formatter:Bt.func,beforeFetch:Bt.func,afterFetch:Bt.func,stopToFirst:Bt.bool,dataKey:Bt.string,callback:Bt.func}),Bt.bool,Bt.bool,Bt.string,Bt.string,Bt.object,Bt.bool,Bt.bool,Bt.bool,Bt.oneOfType([Bt.object,Bt.func]),Bt.oneOfType([Bt.object,Bt.func]),Bt.array,Bt.func,Bt.bool,Bt.func,Bt.object,Bt.object,Bt.shape({type:Bt.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Bt.array,selectedRowKeys:Bt.array,hideSelectAll:Bt.bool,checkStrictly:Bt.bool,filterable:Bt.bool,selectByClickRow:Bt.bool,selectFirstRowOnChange:Bt.bool,clearableAfterFetched:Bt.bool,selectAllOnCurrentPage:Bt.bool,fetchSelectedRows:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),fetchAllRowKeys:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),disabled:Bt.func,onChange:Bt.func,onSelect:Bt.func,onSelectAll:Bt.func}),Bt.shape({currentRowKey:Bt.oneOfType([Bt.number,Bt.string]),disabled:Bt.func,onChange:Bt.func}),Bt.shape({virtual:Bt.bool,overscan:Bt.number,doubleXScrollbar:Bt.bool,expandIconColumn:Bt.string}),Bt.shape({defaultExpandAllRows:Bt.bool,defaultExpandedRowKeys:Bt.array,expandedRowKeys:Bt.array,hideExpandAll:Bt.bool,rowExpandable:Bt.func,expandedRowClassName:Bt.string,expandedRowRender:Bt.func,onExpand:Bt.func,onChange:Bt.func}),Bt.shape({cellMerge:Bt.bool,onCellMerge:Bt.func,onSelectChange:Bt.func}),Bt.shape({groupItems:Bt.arrayOf(Bt.shape({dataIndex:Bt.string.isRequired,titleIndex:Bt.string,color:Bt.string,backgroundColor:Bt.string})),fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),onChange:Bt.func}),Bt.func,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.shape({current:Bt.number,pageSize:Bt.number,pageSizeOptions:Bt.array,showSizeChanger:Bt.bool,showQuickJumper:Bt.bool}),Bt.shape({fileName:Bt.string,fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object}),beforeExport:Bt.func,cellStyle:Bt.bool,hideIcon:Bt.bool}),Bt.shape({showLogo:Bt.bool}),Bt.shape({fetch:Bt.shape({api:Bt.func.isRequired,params:Bt.object,dataKey:Bt.string}),fieldList:Bt.arrayOf(Bt.object)}),Bt.shape({position:Bt.oneOf(["top","bottom"]),hideAlert:Bt.bool,hideClearButton:Bt.bool}),Bt.oneOf(["left","right"]),Bt.func,Bt.func,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.bool,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func,Bt.func;const Ko={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},jo=10,Vo="1",zo="0",Wo="YYYY-MM-DD",Bo="YYYY-MM-DD HH:mm:ss",Uo="YYYYMMDDHHmmss",Go={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 Yo;!function(e){e.left="flex-start",e.right="flex-end"}(Yo||(Yo={}));const Xo=Object.assign({},e).useId;let Qo=0;var Zo=Xo?function(e){const t=Xo();return e||t}:function(t){const[n]=e.useState(`qm_unique_${Qo}`);return e.useEffect((()=>{Qo+=1}),[]),t||n};let Jo=[];const es={_getInstance:function(e){var t;return null!==(t=Jo.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=Jo[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==Jo.findIndex((e=>e===t))&&(this.deregister(e),Jo=[t,...Jo])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),Jo=[{id:e,vm:t},...Jo])},deregister:function(e){e&&(Jo=Jo.filter((t=>t.id!==e)))}};class ts{constructor(e){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=>{const t=this.state.updated.findIndex((t=>t===e||this.getRowKey(t,t.index)===this.getRowKey(e,e.index)));-1===t?this.state.updated.push(e):this.state.updated.splice(t,1,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=[]},this.getRowKey=e.getRowKey}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}function ns(e){return void 0!==e}function rs(t,n){const{defaultValue:r,value:l,onChange:i,postState:a}=n||{},[o,s]=e.useState((()=>ns(l)?l:ns(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=ns(l)?l:o,d=a?a(c):c,u=Gn(i),[m,p]=e.useState([c]);oi((()=>{const e=m[0];o!==e&&u(o,e)}),[m]),oi((()=>{ns(l)||s(l)}),[l]);return[d,Gn((e=>{s(e),p([c])}))]}const ls={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"},is=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=is(t.children)),t})),as=(e,n)=>{const{fetch:r,columns:l,border:i,rowHeight:a,rowSelection:o,summation:s,expandable:c,treeConfig:d,tableConfig:u,webPagination:m,scrollPagination:p,showSuperSearch:h,showFastSearch:f,showGroupSummary:g,showTableImport:v,showClipboard:y,showSelectCollection:b,showPivotGrid:x,footRender:E}=e,{tableRef:w,getRowKey:C,$size:S,tableFullData:N,tableFlatData:T,updateMark:I,selectionKeys:R,sorter:O,filters:k,superFilters:L,pagination:A,mergedTdCells:P}=n,{selectionRows:_,summaries:F}=w.current,{expandIconColumn:D=""}=Object.assign({},d,u),{t:M}=Un(),H=e=>{const t=(e=>{const t=[],n=[],r=[];for(let l=0;l<e.length;l++){const i=e[l];"left"===i.fixed?t.push(i):"right"===i.fixed?n.push(i):r.push(i)}return[...t,...r,...n]})(is(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:ls.selectionColumn,title:"radio"===t?M("qm.table.config.selectionText"):"",width:ls.selectionColumnWidth,fixed:"left",type:t}})(o),r=(null==(l=c)?void 0:l.expandedRowRender)?{dataIndex:ls.expandableColumn,title:"",width:ls.selectionColumnWidth,fixed:"left",type:"expand"}:null;var l;return n&&t.unshift(n),r&&t.unshift(r),Ji(t)},$=(e,t,n,r,l)=>{const i=`${t},${n}`;e.has(i)||e.set(i,{row:t,col:n,rowSpan:r,colSpan:l})},q=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),K=t.useMemo((()=>!q&&!!m),[q,m]),j=t.useMemo((()=>q&&!!p),[q,p]),V=t.useMemo((()=>(q||K)&&!j),[q,K,j]),z=t.useMemo((()=>H(l)),[l]),W=t.useMemo((()=>Zi(z)),[z]),B=t.useMemo((()=>W.filter((e=>"function"==typeof e.editRender))),[W]),U=t.useMemo((()=>W.filter((e=>!!e.summation))),[W]),G=t.useMemo((()=>W.filter((e=>"left"===e.fixed))),[W]),Y=t.useMemo((()=>W.filter((e=>"right"===e.fixed))),[W]),X=t.useMemo((()=>a||ls.rowHeightMaps[S]),[a,S]),Q=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=T.findIndex((t=>C(t,t.index)===e.rowKey)),r=W.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){$(t,n,r,e.rowSpan,e.colSpan);for(let l=0;l<e.rowSpan;l++)for(let i=0;i<e.colSpan;i++)0===l&&0===i||$(t,n+l,r+i,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(P)),[P,W,N]),Z=t.useMemo((()=>{var e,t;const n=W.filter((e=>![ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(e.dataIndex)));return D&&n.some((e=>e.dataIndex===D))?D:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[W,D]),J=t.useMemo((()=>U.length>0),[U]),ee=t.useMemo((()=>!!E||J),[E,J]),te=t.useMemo((()=>da(z).length>1),[z]),ne=t.useMemo((()=>i||te),[i,te]),re=t.useMemo((()=>W.some((e=>e.sorter))),[W]),le=t.useMemo((()=>W.some((e=>e.filter))),[W]),ie=t.useMemo((()=>U.some((e=>!!e.summation.dataKey))),[U]),ae=t.useMemo((()=>!q&&!!v),[q,v]),oe=t.useMemo((()=>!!y&&B.length>0),[y,B]),se=t.useMemo((()=>!!b&&"checkbox"===(null==o?void 0:o.type)),[b,o]),ce=t.useMemo((()=>!!h&&le),[h,le]),de=t.useMemo((()=>!q&&!!f),[q,f]),ue=t.useMemo((()=>!q&&!!x),[q,x]),me=t.useMemo((()=>!!g&&W.some((e=>!!e.groupSummary))),[W]),pe=t.useMemo((()=>{var e;return!!(null===(e=null==s?void 0:s.groupItems)||void 0===e?void 0:e.length)}),[s]),he=t.useMemo((()=>!T.length),[T]),fe=t.useMemo((()=>(()=>{const e={};return U.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:l,summation:i}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=i,c=!_.length&&!!o;let d=(!a||c?w.current.tableFullData:_).reduce(((e,t)=>{if(null==t?void 0:t[ls.summaryIgnore])return e;const r=va(t,n);return xa(r)?e.plus(r):e}),new Gt(0));!Object.keys(F).includes(n)||a&&!c||(d=new Gt(va(F,n))),ya(e,n,d.toNumber());let u=r>=0?d.toFixed(r):d.toString();l>=0&&""!==u&&(u=wa(u,l)),u=Ea(u),ya(e,`${n}_text`,s?`${u} ${s}`:u)})),[e]})()),[T,I,R,F]),ge=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(U)),[U]),ve=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(",")})(O),n=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,l]=t.split("|"),i=e[t];Object.keys(i).forEach((e=>{n.push({type:["radio","tree"].includes(l)?"checkbox":l,bracketLeft:"",fieldName:r,expression:e,value:Ma(e)?null:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{const t=e.fieldType;n.push({type:["radio","tree"].includes(t)?"checkbox":t,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:Ma(e.expression)?null:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(k,L),l=t?{[ls.sorterFieldName]:t}:null,i=n.length?{[ls.filterFieldName]:n}:null,a=ge?{[ls.groupSummary.summaryFieldName]:ge,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[ls.currentPageName]:A.current,[ls.pageSizeName]:A.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),i),a),o),s)}),[null==r?void 0:r.params,A.current,A.pageSize,O,k,L,ge]);return{isFetch:q,isWebPagination:K,isScrollPagination:j,showPagination:V,tableColumns:z,flattenColumns:W,editableColumns:B,summationColumns:U,leftFixedColumns:G,rightFixedColumns:Y,tableRowHeight:X,derivedMergeCells:Q,treeExpandIndex:Z,showSummary:J,showFooter:ee,isHeadGroup:te,bordered:ne,isHeadSorter:re,isHeadFilter:le,isServiceSummation:ie,isSelectCollection:se,isTableImport:ae,isTableClipboard:oe,isSuperSearch:ce,isFastSearch:de,isPivotGrid:ue,isGroupSummary:me,isGroupSubtotal:pe,isTableEmpty:he,summationRows:fe,fetchParams:ve}},os=(e,n)=>{const{rowKey:r,height:l,dataSource:i,summation:a,fetch:o,initialSorter:s,initialFilter:c,rowSelection:d,expandable:u,tableConfig:m,authConfig:p,ignorePageIndex:h,columnsChange:f,onChange:g,onDataChange:v,onDataLoad:y,onScrollEnd:b,onFetchError:E}=e,{getRowKey:w,tableRef:C,tableElementRef:S,$size:N,tableColumns:I,flattenColumns:R,tableFullData:O,pagination:k,layout:L,filters:A,sorter:P,superFilters:_,pagerFilter:F,fetchParams:D,selectionKeys:M,rowExpandedKeys:H,highlightKey:$,summationColumns:q,isFetch:K,isWebPagination:j,isScrollPagination:V,isServiceSummation:z,isGroupSubtotal:W,doLayout:B,setTableFullData:U,setTableOriginData:G,setTableFlatData:Y,setTableDataMaps:X,setPagination:Q,setPingRight:Z,setPingLeft:J,setSpinning:ee,setSorter:te,setFilters:ne,setSuperFilters:re,setPagerFilter:le,setSelectionKeys:ie,setRowExpandedKeys:ae,setHighlightKey:oe,setSelectionRows:se,setScrollXLoad:ce,setScrollYLoad:de,setFieldAuth:ue,setResizeState:me,setSummaries:pe,setPermission:he,resetTableScroll:fe,createTableFocus:ge,clearElementStore:ve}=n,{t:ye}=Un(),{store:be}=C.current,xe=t.useRef(D),Ee=t.useRef(!1),we=e=>Ee.current=e,Ce=ii(S);oi((()=>{Le(),B()}),[I]),oi((()=>{Se()}),[Ce.width,Ce.height,N,l,L.tableAutoHeight]),Fl((()=>{nt(),rt(),lt(),it(),K||(j&&Re(),Ye(i)),c&&ne(c),s&&te(s)}),[i,null==o?void 0:o.params]),Fl((()=>{const e=Oe(D,xe.current);var t;e||K&&(null==d?void 0:d.clearableAfterFetched)&&at(),!e&&D[ls.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?Re():K&&ze(),t=D,xe.current=t}),[D]),Fl((()=>{j&&(et(),Be()),V||fe(),$e()}),[k.current,k.pageSize]),Fl((()=>{K||Ne(O.length),C.current.isTreeTable&&!K&&Qe(),B()}),[O]),Fl((()=>{C.current.isTreeTable&&et()}),[H]);const Se=()=>{const{scrollBarRef:e,resizeState:t}=C.current,{width:n,height:r}=Ce;B(),L.tableBodyWidth>n&&Z(!0),e.current.scrollLeft>0&&J(!0),me(Object.assign({},t,{width:n,height:r}))},Ne=e=>{e!==k.total&&Q((t=>Object.assign({},t,{total:e})))},Te=({current:e,pageSize:t})=>{Q((n=>Object.assign({},n,{current:e,pageSize:t})))},Ie=()=>{const{pageSize:e,total:t}=k;return Math.ceil(t/e)||1},Re=()=>{Te(Object.assign({},k,{current:1}))},Oe=(e,t)=>{const n=Object.keys(ga(e,t));return 1===n.length&&(n.includes(ls.currentPageName)||n.includes(ls.pageSizeName))},ke=si((e=>{Ue(),null==b||b(e)})),Le=()=>{ce(R.length>ls.virtualScrollX)},Ae=(e=[])=>{var t;let n=e.length>ls.virtualScrollY;C.current.isTreeTable&&(n=!0),de(null!==(t=null==m?void 0:m.virtual)&&void 0!==t?t:n)},Pe=e=>W?_e(Fe(e)):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=0)=>{var n;const l=null===(n=a.groupItems)||void 0===n?void 0:n[t];if(!l)return e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e;return Oa(e,[l.dataIndex]).map((e=>{const n={children:Fe(e,t+1),_group:l.dataIndex};return"function"!=typeof r&&ya(n,r.toString(),Na()),l.titleIndex&&ya(n,l.titleIndex,va(e[0],l.titleIndex)),ya(n,l.dataIndex,va(e[0],l.dataIndex)),q.forEach((e=>{var t;const{dataIndex:r}=e,l=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[ls.summaryIgnore])return e;const n=Number(va(t,r));return Number.isNaN(n)?e:e+n}),0);ya(n,r,l)})),n}))},De=e=>{ie(e),se((e=>{const{selectionRows:t,recordsMap:n}=C.current,r=new Map;t.forEach((e=>r.set(w(e,e.index),e)));const l=[];for(let t=0,i=e.length;t<i;t++){const i=r.get(e[t])||n.get(e[t]);i&&l.push(i)}return l})(e))},Me=e=>{const{type:t,checkStrictly:n=!0}=d||{},r=Array.isArray(e)?e:M;let l=[];return C.current.isTreeTable&&!n&&r.forEach((e=>{l.push(...((e,t)=>{var n;const{disabled:r}=d||{},{tableFullData:l,recordsMap:i}=C.current,a=La(l,(t=>t._rowKey===e));let o=[];if(!a)return o;let s=ca((null==a?void 0:a.children)||[],(e=>e._rowKey));return r&&(s=s.filter((e=>!i.has(e)||!r(i.get(e))))),o=[...new Set([...t,...s])],((null===(n=Aa(l,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=La(l,(t=>t._rowKey===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))})),l="radio"===t?r.slice(0,1):[...new Set([...r,...l])],l},He=()=>{const{isTreeTable:e,tableFullData:t,recordsMap:n}=C.current;return e?sa(t,(e=>e._rowKey)):Array.from(n.keys())},$e=si((()=>{null==g||g(k,Ke(A),qe(P),_,{currentDataSource:Je()})})),qe=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Ke=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,l]=n.split("|");t[`${r}|${l}`]=e[n]}return t},je=()=>pn(void 0,void 0,void 0,(function*(){var t;if(!p)return;let n=Sn(p,["fetch"]);if(p.fetch){const{api:e,params:r,dataKey:l}=p.fetch;try{const i=yield e(r);200===i.code&&(n=null!==(t=l?x(i.data,l):i.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;he((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=na(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:l,secretName:i}=r,a=ra(C.current.originColumns,t);ue(t,{visible:n,disabled:l,secretName:i}),n||(e.noAuth=!0,a.noAuth=!0),i&&(e.formatType=`secret-${i}`,a.formatType=`secret-${i}`)}}));null==f||f(t)}})),Ve=Gn((()=>pn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:l=yn,afterFetch:i,callback:s}=o;if(!l(D))return;const c=!!(null===(e=null==a?void 0:a.fetch)||void 0===e?void 0:e.api);ee(!0);try{const[e,l]=c?yield Promise.all([o.api(r(D)),a.fetch.api(r(D))]):[yield o.api(r(D))];if(C.current.unMounted)return;if(c?200===e.code&&200===l.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:ls.dataKey;let a=null!==(n=x(e.data,r))&&void 0!==n?n:[];a="function"==typeof i?yield i(a):a;const c=x(e.data,r.replace(/[^.]+$/,ls.totalKey))||a.length||0,d=Math.max(Math.ceil(c/k.pageSize),1);if(D[ls.currentPageName]>d)return Te(Object.assign(Object.assign({},k),{current:d}));Ye(Ee.current?C.current.tableFullData.concat(a):a),Ne(c),We((null==l?void 0:l.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),ee(!1),we(!1)})))),ze=si(Ve),We=e=>{var t,n,r;if(!z)return;const l=null!==(n=null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:ls.summationKey,i=null!==(r=l?x(e,l):e)&&void 0!==r?r:{},o={};q.filter((e=>!!e.summation.dataKey)).forEach((e=>{ya(o,e.dataIndex,Number(va(i,e.summation.dataKey)))})),pe(o)},Be=()=>{const{type:e,selectFirstRowOnChange:t}=d||{};if("radio"===e&&t){const e=Je();if(e.length){const t=w(e[0],e[0].index);De([t])}else De([])}},Ue=()=>{if(!V)return;const e=Ie();Ee.current||k.current>=e||(we(!0),Te(Object.assign(Object.assign({},k),{current:k.current+1})))},Ge=e=>e.map(((e,t)=>(Array.isArray(e.children)&&(e.children=Ge(e.children)),e.index=t,h||(e.pageIndex=(e=>{const{current:t,pageSize:n}=k;return!K||V?e:(t-1)*n+e})(t)),e))),Ye=e=>{const t=Xe(e,(e=>$a(e,F,C.current.isOriginTree)));De(Me()),ae((e=>{const{isTreeTable:t,tableFullData:n,recordsMap:r}=C.current,{defaultExpandAllRows:l,rowExpandable:i,expandedRowRender:a}=u||{};let o=Array.isArray(e)?e:[...H];if(l)o=He();else if(t){a&&Zn("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...M];$&&e.unshift($),e.forEach((e=>{const t=Aa(n,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=[...new Set(o)]}return i&&o.filter((e=>{const t=r.get(e);return!!t&&i(t)})),o})()),Be(),null==y||y(t)},Xe=(e,t)=>{const n=Ge(e);return G(n),tt((null==t?void 0:t(n))||n),n},Qe=()=>{const{updated:e}=be.state;e.length&&function t(n){n.forEach((n=>{n.children&&t(n.children);const r=e.find((e=>e._rowKey===w(n,n.index)));r&&Object.assign(n,Sn(r,["children"]))}))}(C.current.tableOriginData)},Ze=()=>{const{current:e,pageSize:t}=k;return C.current.tableFullData.slice((e-1)*t,e*t)},Je=()=>j?Ze():C.current.tableFullData,et=()=>{const{recordsMap:e,isTreeTable:t}=C.current;let n=j?oa(Ze()):Array.from(e.values());n=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=w(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);H.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(n):Pe(n),Ae(n),Y(n)},tt=e=>{U(e),X(e),et()},nt=()=>{te({})},rt=()=>{ne({})},lt=()=>{re([])},it=()=>{le({})},at=()=>{De([])};return{initialTable:()=>{je(),ge(),Le(),Ae(),K?Ve():Ye(i)},checkDataIndex:()=>{const e=R.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Zn("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:tt,createWebPageData:Ze,getTableData:Ve,createTableData:Xe,createGroupData:Pe,createAllExpandedKeys:He,setSelectionKeysEffect:De,doFieldValidate:(e,t,n,r,l)=>{if(!Array.isArray(e))return Zn("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(be.removeFromRequired({x:n,y:r}),be.removeFromValidate({x:n,y:r}),e.forEach((e=>{var i;e.required&&wn(t)&&be.addToRequired({x:n,y:r,text:e.message||l+ye("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(i=e.validator)||void 0===i?void 0:i.call(e,t))||be.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:l}=be.state,i=T(n,l),a=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:a(e),validate:a(t),inserted:n.filter((e=>!i.includes(e))),updated:r.filter((e=>![...T(r,n),...T(r,l)].includes(e))),removed:l.filter((e=>!i.includes(e)))}},dataChange:()=>{null==v||v(C.current.tableFullData)},tableChange:$e,toLastPage:()=>{const e=Ie();k.current!==e&&Te(Object.assign({},k,{current:e}))},toFirstPage:Re,getPageCount:Ie,pagerChangeHandle:Te,scrollBottomDebouncer:ke,clearTableSorter:nt,clearTableFilter:rt,clearSuperFilters:lt,clearPagerFilter:it,clearRowSelection:at,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{be.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=C.current;ve(),be.destroy(),e.deregister(t)}}},ss=(e,n)=>{const{height:r,minHeight:l,maxHeight:i,ellipsis:a,showHeader:o,spanMethod:s,rowSelection:c}=e,{getRowKey:d,tableRef:u,topElementRef:m,tableElementRef:p,tableBodyRef:h,$size:g,tableColumns:v,flattenColumns:y,leftFixedColumns:b,derivedMergeCells:x,tableFlatData:E,selectionKeys:w,highlightKey:C,layout:S,tableRowHeight:N,showFooter:T,showPagination:I,isFullScreen:R,setLayout:O,setElementStore:k}=n,L=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=S,n={};return l&&Object.assign(n,{minHeight:`${fa(l)}px`}),i&&Object.assign(n,{maxHeight:`${fa(i)}px`}),R?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${fa(r)}px`:`${t}px`}):n}),[r,i,l,R,S]),A=(e,t)=>{const{scrollBarRef:n,scrollYLoad:r}=u.current;if(void 0!==t&&t>=0)if(t<E.length)if(r)h.current.scrollToYIndex(t);else{const e=P(d(E[t],E[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*N);else if(r){const t=E.findIndex((t=>e===d(t,t.index)));t>=0&&h.current.scrollToYIndex(t)}else{const t=P(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},P=e=>u.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{k("$toper",m.current),k("$table",p.current)},tableStyles:L,getSpan:(e,t,n,r,l)=>{let i=1,a=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:l});Array.isArray(o)?(i=o[0],a=o[1]):f(o)&&(i=o.rowSpan,a=o.colSpan)}if(x.length>0){const e=x.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,a=e.colSpan)}return{rowSpan:i,colSpan:a}},getStickyLeft:e=>{if(y.findIndex((t=>t.dataIndex===e))<0){const t=ra(v,e);e=t?la(t).dataIndex:""}let t=0;for(let n=0;n<y.length;n++){const r=y[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(y.findIndex((t=>t.dataIndex===e))<0){const t=ra(v,e);e=t?ia(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()})(y):y;let r=0;for(let t=n.length-1;t>=0;t--){const l=n[t];if(l.dataIndex===e)break;r+=l.width||l.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?y.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=u.current,l=b.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=y.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-l)},scrollYToRecord:A,calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=u.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(I?Ho["small"!==g?"middle":g]+jo:0)-jo;O((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{A("",0)},createTableFocus:()=>{C&&h.current.setClickedValues([C,""]),"radio"===(null==c?void 0:c.type)&&w.length&&h.current.setClickedValues([w[0],""])},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=u.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=ls,l=[];let i=0;if(y.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,l.push(e))})),l.length>0){const e=y.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===l.length)l[0].renderWidth=(l[0].minWidth||r)+t;else{const e=t/l.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;l.forEach(((t,l)=>{if(0===l)return;const i=Math.floor((t.minWidth||r)*e);n+=i,t.renderWidth=(t.minWidth||r)+i})),l[0].renderWidth=(l[0].minWidth||r)+t-n}}else l.forEach((e=>{e.renderWidth=e.minWidth||r}));O((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else i=y.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),O((e=>Object.assign(Object.assign({},e),{tableBodyWidth:i})));O((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&h.current.resetItemXSize(y)})(),xn((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=u.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,l=o?e.$header.offsetHeight:S.headerHeight,i=T?e.$footer.offsetHeight:S.footerHeight,a=r-l-i,s=e.$tableBody.offsetHeight;let c=0;if(R){const t=e.$toper?e.$toper.offsetHeight+jo:0,r=e.$pager?e.$pager.offsetHeight+jo:0;c=n.winHeight-t-r-20}O((e=>Object.assign({},e,{headerHeight:l,footerHeight:i,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function cs({handler:t,delay:n=0}){const r=Ii(t,n),l=Gn(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",l),()=>window.removeEventListener("resize",l))),[l])}const ds=e=>{const{total:n}=e,{tableRef:r,prefixCls:l,selectionKeys:i,isHeadSorter:a,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearPagerFilter:u,clearRowSelection:m,clearRowHighlight:p,setActivedCell:h}=t.useContext($o),{infoBarConfig:f,rowSelection:g,rowHighlight:v}=r.current.props,{isTreeTable:y,recordsMap:b,invalidRowKeys:x}=r.current,{hideAlert:E,hideClearButton:w}=f||{},{t:C}=Un(),[S,N]=t.useState(i.length-x.length);t.useEffect((()=>{xn((()=>N(i.length-x.length)))}),[i,x]);const T=t.useMemo((()=>!E),[E]),I=t.useMemo((()=>!w&&!!(a||o||g||v)),[w,a,o,g,v]),R={[`${l}__alert`]:!0};return T?t.createElement("div",{className:Ae(R)},t.createElement("i",{className:"svgicon icon"},t.createElement(Be,null)),t.createElement("span",null,C("qm.table.alert.total",{total:y?b.size:n}),g?`,${C("qm.table.alert.selected",{total:Math.max(S,0)})}`:""),I&&t.createElement("em",{onClick:()=>{c(),d(),u(),s(),m(),p(),h({})}},C("qm.table.alert.clear"))):null},us=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:l=!0}=e,{prefixCls:i,setFullScreen:a}=t.useContext($o),{t:o}=Un(),s=()=>{a(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),l?t.createElement("span",{className:`${i}-full-screen`,title:o(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(je,null):t.createElement(Ve,null))):null}));us.displayName="FullScreen";const ms=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,getTableData:i}=t.useContext($o),{t:a}=Un(),o=()=>{i()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${l}-reload`,title:a("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ue,null))):null}));ms.displayName="Reload";const ps=()=>{const e={dateFormat:e=>{const t=e?p(e).format(Wo):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?p(e).format(Bo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?p(e).format(Bo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>xa(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>Ea(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 l,i,a,o;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:m}=n,p=s||(null===(l=null==m?void 0:m(r,n))||void 0===l?void 0:l.items)||[];let h=null!==(o=null!==(a=null===(i=p.find((e=>e.value==t)))||void 0===i?void 0:i.text)&&void 0!==a?a:t)&&void 0!==o?o:"";if(Array.isArray(t)&&(h=t.map((e=>{var t,n;return null!==(n=null===(t=p.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),c>=0&&""!==h&&(h=xa(h)?new Gt(h).toFixed(c):h),d>=0&&""!==h&&(h=wa(h,d)),u){const t=e[`${En(u)}Format`];t?h=t(h):Zn("Table","字段的格式化类型 `formatType` 配置不正确")}return h},n=e=>Ta(e);return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,l,i)=>{const a=va(e,r.dataIndex),o=r.render?r.render(a,e,r,l,i):t(a,r,e);return n(o)}}},hs=t.forwardRef(((e,n)=>{var r,l,i,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(an),{tableRef:d,prefixCls:u,flattenColumns:m,summationRows:p,showSummary:h,createGroupData:f,getSpan:g}=t.useContext($o),{tablePrint:v,showHeader:y}=d.current.props,{t:b}=Un(),{getTitleFromCellValue:x}=ps(),E=null!==(l=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==l?l:"",w=null!==(a=null===(i=null==c?void 0:c.print)||void 0===i?void 0:i.rightLogo)&&void 0!==a?a:"",C=!(!E&&!w),S=t.useMemo((()=>Nn(aa(o,[ls.expandableColumn,ls.selectionColumn,ls.operationColumn]))),[o]),N=t.useMemo((()=>Nn(aa(m,[ls.expandableColumn,ls.selectionColumn,ls.operationColumn]))),[m]),T=t.useMemo((()=>Nn(o.filter((e=>e.printFixed)))),[o]),A=e=>{const t=Object.assign({},ka(S,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?A(t):t},P=(e,t)=>I(R(O(e),t),k(((...e)=>L(...e,((e,n)=>{if(Array.isArray(e))return P(e.concat(n),t)}))))),_=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(A(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]:P(n,"dataIndex")[0]})))(n),t.push(da(n))})),t},F=()=>{const e=(e=>{const t=[];let n=[],r=0,l=0;for(;l<e.length;){const i=e[l],a=m.find((e=>e.dataIndex===i.dataIndex));i.width=a.width||a.renderWidth||ls.defaultColumnWidth,r+=i.width||i.renderWidth,r<=ls.printWidth?(n.push(i),l===e.length-1&&t.push(n),l++):l>0?(e.splice(0,l),T.length&&e.unshift(...T),t.push(n),n=[],r=0,l=0):(i.width=ls.printWidth,n.push(i),t.push(n),l++)}return t})([...N]),t=_(e);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n </style>","</head>","<body>"].join("");const{isTreeTable:r,tableFullData:l}=d.current;for(let i=0;i<e.length;i++)n+=D(t[i],e[i],r?l:f(l)),n+='<div class="page-break"></div>';return n+"</body></html>"},D=(e,t,n)=>{const{showLogo:r=!0}=v;let l='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,y&&(l+=["<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">',E?`<img src="${E}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',w?`<img src="${w}" 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}">${Ta(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(l+=`<tbody>${oa(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:l,colSpan:i}=g(e,t,e.index,r,n);if(!l||!i)return null;const{dataIndex:a,outputRender:o}=t;return`<td rowspan="${l}" colspan="${i}">${0===r&&e._level?`<span style="padding-left:${e._level*ls.treeTable.textIndent}px"></span>`:""}${o?o(va(e,a),e,t,e.index,r):x(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),h&&p.length&&(l+=["<tfoot>",p.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:l,summation:i}=t,a=(null==i?void 0:i.render)?i.render(n):va(e,`${l}_text`);return`<td>${0===r&&""===a?b("qm.table.config.summaryText"):fn(a)?Ta(a):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l},M=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:l}=e,i=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!l)return Promise.resolve({type:r,content:t,blob:e});Ei(e,i)}})({filename:"print",type:"html",isDownload:!1},F()))||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:M}))),s?t.createElement("span",{className:`${u}-print`,title:b("qm.table.print.text"),onClick:()=>M()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ge,null))):null}));hs.displayName="TablePrint";const fs="606060",gs="thin",vs="d4d4d4",ys=(e,t)=>{t&&(e.height=Math.floor(.75*t))},bs=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},xs=()=>({top:{style:gs,color:{argb:vs}},left:{style:gs,color:{argb:vs}},bottom:{style:gs,color:{argb:vs}},right:{style:gs,color:{argb:vs}}}),Es=e=>{const{children:t}=e;return t&&t.length?Es(t[0]):e},ws=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},Cs=()=>{const{tableRef:e,tableRowHeight:n,getSpan:r,showSummary:l,isHeadGroup:i}=t.useContext($o),{spanMethod:a,showHeader:o}=e.current.props,{t:s}=Un(),c=(e,t)=>{var n,r,l;return null!==(l=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==l?l:""};return{exportXLSX:(e,t,c,d)=>pn(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:m}=e,p=Zi(u),h=da(u),f=[],g=[],v=[],y=[];let b=0;const x={};p.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;x[t]=Ta(e.title),v.push({key:t,width:(n||r||ls.defaultColumnWidth)/8})})),o&&(i?h.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:l}=e,i=Es(e),a=p.findIndex((({dataIndex:e})=>e===i.dataIndex));n[i.dataIndex]=Ta(e.title),0!==r&&(r>1||l>1)&&y.push({s:{r:t,c:a},e:{r:t+l-1,c:a+r-1}})})),f.push(n)})):(p.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&y.push({s:{r:b,c:t},e:{r:b+r-1,c:t+n-1}})})),f.push(x)),b+=f.length);const E=oa(t).map(((e,n)=>{const l={};return p.forEach(((i,o)=>{if("function"==typeof a){const{rowSpan:l,colSpan:a}=r(e,i,n,o,t);(a>1||l>1)&&y.push({s:{r:n+b,c:o},e:{r:n+b+l-1,c:o+a-1}})}const s=["percent","finance"].includes(i.formatType);l[i.dataIndex]=s?va(e,i.dataIndex):d(e,n,i,o)})),l._level=e._level,l}));b+=E.length,l&&m&&c(p,t).forEach(((e,n)=>{const r={};p.forEach(((n,l)=>{const{dataIndex:i,summation:a}=n,o=(null==a?void 0:a.render)?a.render(t):va(e,i);r[i]=0===l&&""===o?s("qm.table.config.summaryText"):fn(o)?Ta(o):o})),g.push(r)}));const{sheetName:w,useStyle:C}=e,S=new Yt.Workbook,N=S.addWorksheet(w);N.columns=v,o&&N.addRows(f).forEach((e=>{C&&ys(e,n),e.eachCell((e=>{const t=N.getColumn(e.col),n=ra(u,t.key),{align:r,theadAlign:l}=n;bs(e,l||r),C&&Object.assign(e,{font:{bold:!0,color:{argb:fs}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:xs()})}))})),N.addRows(E).forEach(((e,t)=>{const{_level:r}=E[t];C&&ys(e,n),e.eachCell((e=>{const t=N.getColumn(e.col),n=ra(u,t.key),{align:l}=n;bs(e,l),Object.assign(e,ws(n)),C&&Object.assign(e,{font:{color:{argb:fs}},border:xs()}),1===Number(e.col)&&r&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:r}))}))})),l&&m&&N.addRows(g).forEach((e=>{C&&ys(e,n),e.eachCell((e=>{const t=N.getColumn(e.col),n=ra(u,t.key),{align:r}=n;bs(e,r),Object.assign(e,ws(n)),C&&Object.assign(e,{font:{color:{argb:fs}},border:xs()})}))})),y.forEach((({s:e,e:t})=>{N.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const T=yield S.xlsx.writeBuffer();return new Blob([T],{type:"application/octet-stream"})})),exportCSV:(e,t)=>{const n="\ufeff"+(e=>Array.from(e.rows).map((e=>Array.from(e.cells).map((e=>{var t,n;return((e,t)=>{const n=e.replace(/"/g,'""');return"string"===t?`"=""${n}"""`:"number"===t?n:n.includes(",")||n.includes("\r")||n.includes("\n")?`"${n}"`:n})(null!==(n=null===(t=e.textContent)||void 0===t?void 0:t.trim())&&void 0!==n?n:"",e.getAttribute("data-type"))})).join(","))).join("\r\n"))((e=>{const t=document.createElement("div");t.innerHTML=e.trim();const n=t.querySelector("table");if(!n)throw new Error("Invalid table HTML input.");return n})(t));return new Blob([n],{type:"text/csv;charset=utf-8"})},importXLSX:(e,t)=>{const{columns:n,file:r}=e,l=Zi(n),i=new FileReader;i.onerror=()=>{te.error(s("qm.table.import.error"))},i.onload=e=>{const n=l.map((e=>Ta(e.title))),r=new Yt.Workbook,i=e.target;i?r.xlsx.load(i.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),a=e[i],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,a);if(o){const r=e.slice(i+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let l=e;Array.isArray(null==l?void 0:l.richText)&&(l=l.richText.map((e=>e.text)).join("")),f(l)&&"text"in l&&(l=l.text),A(l)&&(l=Sa(l,Bo)),(null==l?void 0:l.formula)&&(l=null!==(r=l.result)&&void 0!==r?r:l.value),t[a[n]]=l}));const r={};return n.forEach(((e,n)=>{var i;const{dataIndex:a,dictItems:o}=l[n];Array.isArray(o)&&((null===(i=t[e])||void 0===i?void 0:i.toString().includes(","))?t[e]=t[e].split(",").map((e=>c(o,e))).filter((e=>""!==e)):t[e]=c(o,t[e])),ya(r,a,t[e])})),r}));null==t||t(r)}else te.error(s("qm.table.import.error"))}else te.error(s("qm.table.import.error"))})):te.error(s("qm.table.import.error"))},i.readAsArrayBuffer(r)}}},Ss=e=>{const{fileType:n,onChange:r}=e,{prefixCls:l}=t.useContext($o),{t:i}=Un();let a,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}},c=()=>pn(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),o=document.createElement("input"),a.className=`${l}--file-form`,o.name="file",o.type="file",a.appendChild(o),document.body.appendChild(a)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(te.warning(i("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(a),a=null,o=null},a.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(Jn,{onClick:()=>c()},i("qm.upload.text"))},Ns=e=>{const{columns:n,onClose:r}=e,{tableRef:l,prefixCls:i,createTableData:a,dataChange:o}=t.useContext($o),{beforeTableImport:s}=l.current.props,{t:c}=Un(),{importXLSX:d}=Cs(),u=t.useRef(null),[m,p]=t.useState(!1),[h,f]=t.useState(!0),g=e=>e.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.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(Ss,{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:l.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:`${i}-import__setting`},t.createElement(Kh,{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(Jn,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(Jn,{type:"primary",loading:m,disabled:h,onClick:()=>pn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||(p(!0),d({columns:g(n),file:t.file},(e=>pn(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:i}=l.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&a(e),"add"===t.importType&&a([...n,...e]),"insert"===t.importType){const r=t.posIndex,l=n.slice(0,r).concat(e).concat(n.slice(r));a(l)}e.forEach((e=>{i.addToInserted(e)})),o(),te.success(c("qm.table.import.success",{total:e.length})),p(!1),r()})))))}))},c("qm.table.import.text"))))},Ts=t.forwardRef(((e,n)=>{const{tableColumns:r,open:l=!0}=e,{prefixCls:i}=t.useContext($o),{t:a}=Un(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${i}-import`]:!0},u={visible:o,title:a("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:Ae(d),title:a("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ye,null))),t.createElement(Di,u,t.createElement(Ns,{columns:r,onClose:()=>s(!1)})))}));function Is(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 Rs(e,t,n,r){var l=Dt.unstable_batchedUpdates?function(e){Dt.unstable_batchedUpdates(n,e)}:n;return null!=e&&e.addEventListener&&e.addEventListener(t,l,r),{remove:function(){null!=e&&e.removeEventListener&&e.removeEventListener(t,l,r)}}}Ts.displayName="TableImport";var Os=u((function(e,t){var n=e.didUpdate,r=e.getContainer,l=e.children,a=i(),s=i();m(t,(function(){return{}}));var c=i(!1);return!c.current&&Wr()&&(s.current=r(),a.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==a.current&&a.current.appendChild(s.current),function(){var e;null===(e=s.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(s.current)}}),[]),s.current?Dt.createPortal(l,s.current):null}));function ks(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var Ls;function As(e){var t=e.prefixCls,n=e.motion,r=e.animation,l=e.transitionName;return n||(r?{motionName:"".concat(t,"-").concat(r)}:l?{motionName:l}:null)}function Ps(t){var n=t.prefixCls,r=t.visible,l=t.zIndex,i=t.mask,a=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!i)return null;var c={};return(a||s||o)&&(c=mr({motionAppear:!0},As({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(El,wl({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:l},className:Ae("".concat(n,"-mask"),r)})}))}function _s(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 Fs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_s(Object(n),!0).forEach((function(t){Ms(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ds(e){return Ds="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},Ds(e)}function Ms(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Hs={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function $s(){if(void 0!==Ls)return Ls;Ls="";var e=document.createElement("p").style;for(var t in Hs)t+"Transform"in e&&(Ls=t);return Ls}function qs(){return $s()?"".concat($s(),"TransitionProperty"):"transitionProperty"}function Ks(){return $s()?"".concat($s(),"Transform"):"transform"}function js(e,t){var n=qs();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function Vs(e,t){var n=Ks();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var zs,Ws=/matrix\((.*)\)/,Bs=/matrix3d\((.*)\)/;function Us(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Gs(e,t,n){var r=n;if("object"!==Ds(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):zs(e,t);for(var l in t)t.hasOwnProperty(l)&&Gs(e,l,t[l])}function Ys(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var l=e.document;"number"!=typeof(n=l.documentElement[r])&&(n=l.body[r])}return n}function Xs(e){return Ys(e)}function Qs(e){return Ys(e,!0)}function Zs(e){var t=function(e){var t,n,r,l=e.ownerDocument,i=l.body,a=l&&l.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=a.clientLeft||i.clientLeft||0,top:r-=a.clientTop||i.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=Xs(r),t.top+=Qs(r),t}function Js(e){return null!=e&&e==e.window}function ec(e){return Js(e)?e.document:9===e.nodeType?e:e.ownerDocument}var tc=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),nc=/^(top|right|bottom|left)$/,rc="currentStyle",lc="runtimeStyle",ic="left";function ac(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function oc(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function sc(e,t,n){"static"===Gs(e,"position")&&(e.style.position="relative");var r=-999,l=-999,i=ac("left",n),a=ac("top",n),o=oc(i),s=oc(a);"left"!==i&&(r=999),"top"!==a&&(l=999);var c,d="",u=Zs(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[qs()]||"",js(e,"none")),"left"in t&&(e.style[o]="",e.style[i]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[a]="".concat(l,"px")),Us(e);var m=Zs(e),p={};for(var h in t)if(t.hasOwnProperty(h)){var f=ac(h,n),g="left"===h?r:l,v=u[h]-m[h];p[f]=f===h?g+v:g-v}Gs(e,p),Us(e),("left"in t||"top"in t)&&js(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=ac(b,n),E=t[b]-u[b];y[x]=b===x?p[x]+E:p[x]-E}Gs(e,y)}function cc(e,t){var n=Zs(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(Ks());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),l={x:r.x,y:r.y};"left"in t&&(l.x=r.x+t.left-n.left),"top"in t&&(l.y=r.y+t.top-n.top),function(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(Ks());if(r&&"none"!==r){var l,i=r.match(Ws);i?((l=(i=i[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,l[5]=t.y,Vs(e,"matrix(".concat(l.join(","),")"))):((l=r.match(Bs)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,l[13]=t.y,Vs(e,"matrix3d(".concat(l.join(","),")")))}else Vs(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,l)}function dc(e,t){for(var n=0;n<e.length;n++)t(e[n])}function uc(e){return"border-box"===zs(e,"boxSizing")}"undefined"!=typeof window&&(zs=window.getComputedStyle?function(e,t,n){var r=n,l="",i=ec(e);return(r=r||i.defaultView.getComputedStyle(e,null))&&(l=r.getPropertyValue(t)||r[t]),l}:function(e,t){var n=e[rc]&&e[rc][t];if(tc.test(n)&&!nc.test(t)){var r=e.style,l=r[ic],i=e[lc][ic];e[lc][ic]=e[rc][ic],r[ic]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[ic]=l,e[lc][ic]=i}return""===n?"auto":n});var mc=["margin","border","padding"],pc=-1,hc=2,fc=1;function gc(e,t,n){var r,l,i,a=0;for(l=0;l<t.length;l++)if(r=t[l])for(i=0;i<n.length;i++){var o=void 0;o="border"===r?"".concat(r).concat(n[i],"Width"):r+n[i],a+=parseFloat(zs(e,o))||0}return a}var vc={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 yc(e,t,n){var r=n;if(Js(e))return"width"===t?vc.viewportWidth(e):vc.viewportHeight(e);if(9===e.nodeType)return"width"===t?vc.docWidth(e):vc.docHeight(e);var l="width"===t?["Left","Right"]:["Top","Bottom"],i="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=uc(e),o=0;(null==i||i<=0)&&(i=void 0,(null==(o=zs(e,t))||Number(o)<0)&&(o=e.style[t]||0),o=Math.floor(parseFloat(o))||0),void 0===r&&(r=a?fc:pc);var s=void 0!==i||a,c=i||o;return r===pc?s?c-gc(e,["border","padding"],l):o:s?r===fc?c:c+(r===hc?-gc(e,["border"],l):gc(e,["margin"],l)):o+gc(e,mc.slice(r),l)}dc(["Width","Height"],(function(e){vc["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],vc["viewport".concat(e)](n))},vc["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,l=r.body,i=r.documentElement[n];return"CSS1Compat"===r.compatMode&&i||l&&l[n]||i}}));var bc={position:"absolute",visibility:"hidden",display:"block"};function xc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,l=t[0];return 0!==l.offsetWidth?r=yc.apply(void 0,t):function(e,t,n){var r,l={},i=e.style;for(r in t)t.hasOwnProperty(r)&&(l[r]=i[r],i[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(i[r]=l[r])}(l,bc,(function(){r=yc.apply(void 0,t)})),r}function Ec(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}dc(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);vc["outer".concat(t)]=function(t,n){return t&&xc(t,e,n?0:fc)};var n="width"===e?["Left","Right"]:["Top","Bottom"];vc[e]=function(t,r){var l=r;return void 0!==l?t?(uc(t)&&(l+=gc(t,["padding","border"],n)),Gs(t,e,l)):void 0:t&&xc(t,e,pc)}}));var wc={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:ec,offset:function(e,t,n){if(void 0===t)return Zs(e);!function(e,t,n){if(n.ignoreShake){var r=Zs(e),l=r.left.toFixed(0),i=r.top.toFixed(0),a=t.left.toFixed(0),o=t.top.toFixed(0);if(l===a&&i===o)return}n.useCssRight||n.useCssBottom?sc(e,t,n):n.useCssTransform&&Ks()in document.body.style?cc(e,t):sc(e,t,n)}(e,t,n||{})},isWindow:Js,each:dc,css:Gs,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:Ec,getWindowScrollLeft:function(e){return Xs(e)},getWindowScrollTop:function(e){return Qs(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)wc.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Ec(wc,vc);var Cc=wc.getParent;function Sc(e){if(wc.isWindow(e)||9===e.nodeType)return null;var t,n=wc.getDocument(e).body,r=wc.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:Cc(e);for(t=Cc(e);t&&t!==n&&9!==t.nodeType;t=Cc(t))if("static"!==(r=wc.css(t,"position")))return t;return null}var Nc=wc.getParent;function Tc(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Sc(e),l=wc.getDocument(e),i=l.defaultView||l.parentWindow,a=l.body,o=l.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===a||r===o||"visible"===wc.css(r,"overflow")){if(r===a||r===o)break}else{var s=wc.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=Sc(r)}var c=null;wc.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===wc.css(e,"position")&&(e.style.position="fixed"));var d=wc.getWindowScrollLeft(i),u=wc.getWindowScrollTop(i),m=wc.viewportWidth(i),p=wc.viewportHeight(i),h=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(a);if("hidden"===g.overflowX&&(h=i.innerWidth),"hidden"===g.overflowY&&(f=i.innerHeight),e.style&&(e.style.position=c),t||function(e){if(wc.isWindow(e)||9===e.nodeType)return!1;var t=wc.getDocument(e),n=t.body,r=null;for(r=Nc(e);r&&r!==n&&r!==t;r=Nc(r))if("fixed"===wc.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+m),n.bottom=Math.min(n.bottom,u+p);else{var v=Math.max(h,d+m);n.right=Math.min(n.right,v);var y=Math.max(f,u+p);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 Ic(e){var t,n,r;if(wc.isWindow(e)||9===e.nodeType){var l=wc.getWindow(e);t={left:wc.getWindowScrollLeft(l),top:wc.getWindowScrollTop(l)},n=wc.viewportWidth(l),r=wc.viewportHeight(l)}else t=wc.offset(e),n=wc.outerWidth(e),r=wc.outerHeight(e);return t.width=n,t.height=r,t}function Rc(e,t){var n=t.charAt(0),r=t.charAt(1),l=e.width,i=e.height,a=e.left,o=e.top;return"c"===n?o+=i/2:"b"===n&&(o+=i),"c"===r?a+=l/2:"r"===r&&(a+=l),{left:a,top:o}}function Oc(e,t,n,r,l){var i=Rc(t,n[1]),a=Rc(e,n[0]),o=[a.left-i.left,a.top-i.top];return{left:Math.round(e.left-o[0]+r[0]-l[0]),top:Math.round(e.top-o[1]+r[1]-l[1])}}function kc(e,t,n){return e.left<n.left||e.left+t.width>n.right}function Lc(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function Ac(e,t,n){var r=[];return wc.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function Pc(e,t){return e[t]=-e[t],e}function _c(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function Fc(e,t){e[0]=_c(e[0],t.width),e[1]=_c(e[1],t.height)}function Dc(e,t,n,r){var l=n.points,i=n.offset||[0,0],a=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;i=[].concat(i),a=[].concat(a);var c={},d=0,u=Tc(s,!(!(o=o||{})||!o.alwaysByViewport)),m=Ic(s);Fc(i,m),Fc(a,t);var p=Oc(m,t,l,i,a),h=wc.merge(m,p);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&kc(p,m,u)){var f=Ac(l,/[lr]/gi,{l:"r",r:"l"}),g=Pc(i,0),v=Pc(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Oc(m,t,f,g,v),m,u)||(d=1,l=f,i=g,a=v)}if(o.adjustY&&Lc(p,m,u)){var y=Ac(l,/[tb]/gi,{t:"b",b:"t"}),b=Pc(i,1),x=Pc(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Oc(m,t,y,b,x),m,u)||(d=1,l=y,i=b,a=x)}d&&(p=Oc(m,t,l,i,a),wc.mix(h,p));var E=kc(p,m,u),w=Lc(p,m,u);if(E||w){var C=l;E&&(C=Ac(l,/[lr]/gi,{l:"r",r:"l"})),w&&(C=Ac(l,/[tb]/gi,{t:"b",b:"t"})),l=C,i=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&w,(c.adjustX||c.adjustY)&&(h=function(e,t,n,r){var l=wc.clone(e),i={width:t.width,height:t.height};return r.adjustX&&l.left<n.left&&(l.left=n.left),r.resizeWidth&&l.left>=n.left&&l.left+i.width>n.right&&(i.width-=l.left+i.width-n.right),r.adjustX&&l.left+i.width>n.right&&(l.left=Math.max(n.right-i.width,n.left)),r.adjustY&&l.top<n.top&&(l.top=n.top),r.resizeHeight&&l.top>=n.top&&l.top+i.height>n.bottom&&(i.height-=l.top+i.height-n.bottom),r.adjustY&&l.top+i.height>n.bottom&&(l.top=Math.max(n.bottom-i.height,n.top)),wc.mix(l,i)}(p,m,u,c))}return h.width!==m.width&&wc.css(s,"width",wc.width(s)+h.width-m.width),h.height!==m.height&&wc.css(s,"height",wc.height(s)+h.height-m.height),wc.offset(s,{left:h.left,top:h.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:l,offset:i,targetOffset:a,overflow:c}}function Mc(e,t,n){var r=n.target||t,l=Ic(r),i=!function(e,t){var n=Tc(e,t),r=Ic(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 Dc(e,l,n,i)}Mc.__getOffsetParent=Sc,Mc.__getVisibleRectForElement=Tc;var Hc=Wr()?e.useLayoutEffect:e.useEffect,$c=function(t,n){var r=e.useRef(!0);Hc((function(){return t(r.current)}),n),Hc((function(){return r.current=!1,function(){r.current=!0}}),[])};function qc(e,t){var n=null,r=null;var l=new $t((function(e){var l=hr(e,1)[0].target;if(document.documentElement.contains(l)){var i=l.getBoundingClientRect(),a=i.width,o=i.height,s=Math.floor(a),c=Math.floor(o);n===s&&r===c||Promise.resolve().then((function(){t({width:s,height:c})})),n=s,r=c}}));return e&&l.observe(e),function(){l.disconnect()}}function Kc(e){return"function"!=typeof e?null:e()}function jc(e){return"object"===sr(e)&&e?e:null}var Vc=function(e,n){var r=e.children,l=e.disabled,i=e.target,a=e.align,o=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),m=t.useRef(),p=t.Children.only(r),h=t.useRef({});h.current.disabled=l,h.current.target=i,h.current.align=a,h.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),l=t.useRef(null);function i(){window.clearTimeout(l.current)}return[function t(a){if(i(),r.current&&!0!==a)l.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(a))return;r.current=!0,l.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,i()}]}((function(){var e=h.current,t=e.disabled,n=e.target,r=e.align,l=e.onAlign,i=m.current;if(!t&&n&&i){var a,o=Kc(n),s=jc(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 l=e.getBoundingClientRect(),i=l.width,a=l.height;if(i||a)return!0}}return!1}(o)?a=Mc(i,o,r):s&&(a=function(e,t,n){var r,l,i=wc.getDocument(e),a=i.defaultView||i.parentWindow,o=wc.getWindowScrollLeft(a),s=wc.getWindowScrollTop(a),c=wc.viewportWidth(a),d=wc.viewportHeight(a),u={left:r="pageX"in t?t.pageX:o+t.clientX,top:l="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},m=r>=0&&r<=o+c&&l>=0&&l<=s+d,p=[n.points[0],"cc"];return Dc(e,u,Fs(Fs({},n),{},{points:p}),m)}(i,s,r)),function(e,t){e!==document.activeElement&&Is(t,e)&&"function"==typeof e.focus&&e.focus()}(c,i),l&&a&&l(i,a),!0}return!1}),d),g=hr(f,2),v=g[0],y=g[1],b=hr(t.useState(),2),x=b[0],E=b[1],w=hr(t.useState(),2),C=w[0],S=w[1];return $c((function(){E(Kc(i)),S(jc(i))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=C)||e&&t&&("pageX"in t&&"pageY"in t?e.pageX===t.pageX&&e.pageY===t.pageY:"clientX"in t&&"clientY"in t&&e.clientX===t.clientX&&e.clientY===t.clientY))&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new Set;return function e(t,l){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=r.has(t);if(Pn(!a,"Warning: There may be circular references"),a)return!1;if(t===l)return!0;if(n&&i>1)return!1;r.add(t);var o=i+1;if(Array.isArray(t)){if(!Array.isArray(l)||t.length!==l.length)return!1;for(var s=0;s<t.length;s++)if(!e(t[s],l[s],o))return!1;return!0}if(t&&l&&"object"===sr(t)&&"object"===sr(l)){var c=Object.keys(t);return c.length===Object.keys(l).length&&c.every((function(n){return e(t[n],l[n],o)}))}return!1}(e,t)}(u.current.align,a)||v()})),t.useEffect((function(){return qc(m.current,v)}),[m.current]),t.useEffect((function(){return qc(x,v)}),[x]),t.useEffect((function(){l?y():v()}),[l]),t.useEffect((function(){if(s)return Rs(window,"resize",v).remove}),[s]),t.useEffect((function(){return function(){y()}}),[]),t.useImperativeHandle(n,(function(){return{forceAlign:function(){return v(!0)}}})),t.isValidElement(p)&&(p=t.cloneElement(p,{ref:Er(p.ref,m)})),p},zc=t.forwardRef(Vc);function Wc(){Wc=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},i=l.iterator||"@@iterator",a=l.asyncIterator||"@@asyncIterator",o=l.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,l){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),o=new N(l||[]);return r(a,"_invoke",{value:E(e,n,o)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function m(){}function p(){}function h(){}var f={};s(f,i,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,i)&&(f=v);var y=h.prototype=m.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 l(r,i,a,o){var s=d(e[r],e,i);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==sr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){l("next",e,a,o)}),(function(e){l("throw",e,a,o)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return l("throw",e,a,o)}))}o(s.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){l(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(l,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===l)throw i;return I()}for(n.method=l,n.arg=i;;){var a=n.delegate;if(a){var o=w(a,n);if(o){if(o===u)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var l=d(r,e.iterator,t.arg);if("throw"===l.type)return t.method="throw",t.arg=l.arg,t.delegate=null,u;var i=l.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,l=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 l.next=l}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=h,r(y,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:p,configurable:!0}),p.displayName=s(h,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,l,i){void 0===i&&(i=Promise);var a=new x(c(t,n,r,l),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),s(y,o,"Generator"),s(y,i,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var l=this.tryEntries.length-1;l>=0;--l){var i=this.tryEntries[l],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var l=this.tryEntries[r];if(l.tryLoc<=this.prev&&n.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var i=l;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var l=r.arg;S(n)}return l}}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 Bc(e,t,n,r,l,i,a){try{var o=e[i](a),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,l)}function Uc(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var i=e.apply(t,n);function a(e){Bc(i,r,l,a,o,"next",e)}function o(e){Bc(i,r,l,a,o,"throw",e)}a(void 0)}))}}zc.displayName="Align";var Gc=["measure","alignPre","align",null,"motion"],Yc=e.forwardRef((function(t,n){var r=t.visible,l=t.prefixCls,a=t.className,c=t.style,d=t.children,u=t.zIndex,m=t.stretch,p=t.destroyPopupOnHide,h=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,w=t.onMouseDown,C=t.onTouchStart,S=t.onClick,N=i(),T=i(),I=hr(s(),2),R=I[0],O=I[1],k=function(t){var n=hr(e.useState({width:0,height:0}),2),r=n[0],l=n[1];return[e.useMemo((function(){var e={};if(t){var n=r.width,l=r.height;-1!==t.indexOf("height")&&l?e.height=l:-1!==t.indexOf("minHeight")&&l&&(e.minHeight=l),-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(),i=r.width,a=r.height;Math.abs(t-i)<1&&Math.abs(n-a)<1&&(t=i,n=a),l({width:t,height:n})}]}(m),L=hr(k,2),A=L[0],P=L[1];var _=function(e,t){var n=hr(_r(null),2),r=n[0],l=n[1],a=i();function s(e){l(e,!0)}function c(){hl.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=hl(Uc(Wc().mark((function e(){var t,n;return Wc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Gc.indexOf(r),(n=Gc[t+1])&&-1!==t&&s(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),o((function(){return function(){c()}}),[]),[r,function(e){c(),a.current=hl((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){m&&P(v())})),F=hr(_,2),D=F[0],M=F[1],H=hr(s(0),2),$=H[0],q=H[1],K=i();function j(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function V(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===D&&(null==b||b(e,t))}$c((function(){"alignPre"===D&&q(0)}),[D]),$c((function(){"align"===D&&($<3?j():M((function(){var e;null===(e=K.current)||void 0===e||e.call(K)})))}),[$]);var z=mr({},As(t));function W(){return new Promise((function(e){K.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=z[e];z[e]=function(e,n){return M(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==D||M()}),[z.motionName,D]),e.useImperativeHandle(n,(function(){return{forceAlign:j,getElement:function(){return T.current}}}));var B=mr(mr({},A),{},{zIndex:u,opacity:"motion"!==D&&"stable"!==D&&r?0:void 0,pointerEvents:r||"stable"===D?void 0:"none"},c),U=!0;null==f||!f.points||"align"!==D&&"stable"!==D||(U=!1);var G=d;return e.Children.count(d)>1&&(G=e.createElement("div",{className:"".concat(l,"-content")},d)),e.createElement(El,wl({visible:r,ref:T,leavedClassName:"".concat(l,"-hidden")},z,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:p,forceRender:h}),(function(t,n){var r=t.className,i=t.style,o=Ae(l,a,R,r);return e.createElement(zc,{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:w,onTouchStartCapture:C,onClick:S,style:mr(mr({},i),B)},G))}))}));Yc.displayName="PopupInner";var Xc=e.forwardRef((function(t,n){var r=t.prefixCls,l=t.visible,i=t.zIndex,a=t.children,o=t.mobile,s=(o=void 0===o?{}:o).popupClassName,c=o.popupStyle,d=o.popupMotion,u=void 0===d?{}:d,m=o.popupRender,p=t.onClick,h=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return h.current}}}));var f=mr({zIndex:i},c),g=a;return e.Children.count(a)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},a)),m&&(g=m(g)),e.createElement(El,wl({visible:l,ref:h,removeOnLeave:!0},u),(function(t,n){var l=t.className,i=t.style,a=Ae(r,s,l);return e.createElement("div",{ref:n,className:a,onClick:p,style:mr(mr({},i),f)},g)}))}));Xc.displayName="MobilePopupInner";var Qc=["visible","mobile"],Zc=e.forwardRef((function(t,n){var r=t.visible,l=t.mobile,i=Cr(t,Qc),a=hr(s(r),2),c=a[0],d=a[1],u=hr(s(!1),2),m=u[0],p=u[1],h=mr(mr({},i),{},{visible:c});o((function(){d(r),r&&l&&p(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,l]);var f=m?e.createElement(Xc,wl({},h,{mobile:l,ref:n})):e.createElement(Yc,wl({},h,{ref:n}));return e.createElement("div",null,e.createElement(Ps,h),f)}));Zc.displayName="Popup";var Jc=e.createContext(null);function ed(){}function td(){return""}function nd(e){return e?e.ownerDocument:window.document}var rd=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var ld=function(t){var n=function(n){Or(l,e.Component);var r=Ar(l);function l(t){var n,i;return Nr(this,l),dr(Lr(n=r.call(this,t)),"popupRef",e.createRef()),dr(Lr(n),"triggerRef",e.createRef()),dr(Lr(n),"portalContainer",void 0),dr(Lr(n),"attachId",void 0),dr(Lr(n),"clickOutsideHandler",void 0),dr(Lr(n),"touchOutsideHandler",void 0),dr(Lr(n),"contextMenuOutsideHandler1",void 0),dr(Lr(n),"contextMenuOutsideHandler2",void 0),dr(Lr(n),"mouseDownTimeout",void 0),dr(Lr(n),"focusTime",void 0),dr(Lr(n),"preClickTime",void 0),dr(Lr(n),"preTouchTime",void 0),dr(Lr(n),"delayTimer",void 0),dr(Lr(n),"hasPopupMouseDown",void 0),dr(Lr(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),dr(Lr(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),dr(Lr(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),dr(Lr(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),dr(Lr(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&Is(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),dr(Lr(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),dr(Lr(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),dr(Lr(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),dr(Lr(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),dr(Lr(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),dr(Lr(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),dr(Lr(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)})),dr(Lr(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)})),dr(Lr(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),l=n.getPopupDomNode();Is(r,t)&&!n.isContextMenuOnly()||Is(l,t)||n.hasPopupMouseDown||n.close()}})),dr(Lr(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=gr(n.triggerRef.current);if(t)return t}catch(e){}return Dt.findDOMNode(Lr(n))})),dr(Lr(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,l=r.popupPlacement,i=r.builtinPlacements,a=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return l&&i&&t.push(function(e,t,n,r){for(var l=n.points,i=Object.keys(e),a=0;a<i.length;a+=1){var o=i[a];if(ks(e[o].points,l,r))return"".concat(t,"-placement-").concat(o)}return""}(i,a,e,o)),s&&t.push(s(e)),t.join(" ")})),dr(Lr(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,l=t.destroyPopupOnHide,i=t.popupClassName,a=t.onPopupAlign,o=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,m=t.maskAnimation,p=t.maskTransitionName,h=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,w=n.state,C=w.popupVisible,S=w.point,N=n.getPopupAlign(),T={};return n.isMouseEnterToShow()&&(T.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(T.onMouseLeave=n.onPopupMouseLeave),T.onMouseDown=n.onPopupMouseDown,T.onTouchStart=n.onPopupMouseDown,e.createElement(Zc,wl({prefixCls:r,destroyPopupOnHide:l,visible:C,point:y&&S,className:i,align:N,onAlign:a,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},T,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:m,maskTransitionName:p,maskMotion:h,ref:n.popupRef,motion:o,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),dr(Lr(n),"attachParent",(function(e){hl.cancel(n.attachId);var t,r=n.props,l=r.getPopupContainer,i=r.getDocument,a=n.getRootDomNode();l?(a||0===l.length)&&(t=l(a)):t=i(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=hl((function(){n.attachParent(e)}))})),dr(Lr(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})),dr(Lr(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),dr(Lr(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),dr(Lr(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),i="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:i,popupVisible:i},rd.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return Ir(l,[{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=Rs(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Rs(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Rs(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Rs(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),hl.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 mr(mr({},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,l=1e3*t;if(this.clearDelayTimer(),l){var i=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,i),r.clearDelayTimer()}),l)}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,l=r.children,i=r.forceRender,a=r.alignPoint,o=r.className,s=r.autoDestroy,c=e.Children.only(l),d={key:"trigger"};this.isContextMenuToShow()?d.onContextMenu=this.onContextMenu:d.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(d.onClick=this.onClick,d.onMouseDown=this.onMouseDown,d.onTouchStart=this.onTouchStart):(d.onClick=this.createTwoChains("onClick"),d.onMouseDown=this.createTwoChains("onMouseDown"),d.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(d.onMouseEnter=this.onMouseEnter,a&&(d.onMouseMove=this.onMouseMove)):d.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?d.onMouseLeave=this.onMouseLeave:d.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(d.onFocus=this.onFocus,d.onBlur=this.onBlur):(d.onFocus=this.createTwoChains("onFocus"),d.onBlur=this.createTwoChains("onBlur"));var u=Ae(c&&c.props&&c.props.className,o);u&&(d.className=u);var m=mr({},d);wr(c)&&(m.ref=Er(this.triggerRef,c.ref));var p,h=e.cloneElement(c,m);return(n||this.popupRef.current||i)&&(p=e.createElement(t,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!n&&s&&(p=null),e.createElement(Jc.Provider,{value:this.triggerContextValue},h,p)}}],[{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}}]),l}();return dr(n,"contextType",Jc),dr(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:td,getDocument:nd,onPopupVisibleChange:ed,afterPopupVisibleChange:ed,onPopupAlign:ed,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}(Os);const id=e=>{const{columns:n,onChange:r}=e,{prefixCls:l,$size:i}=t.useContext($o),{t:a}=Un(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);Fl((()=>{p()}),[d]),t.useEffect((()=>{m()}),[n]);const m=()=>{const e=[];n.forEach(((t,r)=>{const l=t.colSpan;l>1&&n.slice(r+1,r+l).every((({colSpan:e})=>0===e))&&e.push(n.slice(r,r+l))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const l=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===l)return e.push(t);e.push(...o.current[l].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)},h={[`${l}__popper`]:!0,"column-filter__popper":!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i},f=[`${l}-column-filter`,{selected:s}];return t.createElement(ld,{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(Ut,{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));C(t,n)||u(_a(e))}},d.map((e=>((e,n)=>{const{colSpan:r}=e;if(0===r)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const l=["svgicon","handle",`${n}-handle`];return t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(de,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),t.createElement("i",{className:Ae(l),title:a("qm.table.columnFilter.draggable")},t.createElement(We,null)),t.createElement("span",{className:"text"},Ta(e.title)))})(e,"main")))))),popupClassName:Ae(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Go,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Ae(f),title:a("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(Xe,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},ad=e=>{const{defaultValue:n,onClose:r,onOk:l}=e,{tableRef:i,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext($o),{rowSelection:d}=i.current.props,{t:u}=Un(),m=t.useRef(null),[h,f]=t.useState(!1),g=t.useMemo((()=>Object.assign({},{fileName:`${p().format(Uo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:c?1:0,useStyle:0},n,{columns:Nn(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(id,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:u("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:u("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return t.createElement("div",{className:`${a}-export__setting`},t.createElement(Kh,{ref:m,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(Jn,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(Jn,{type:"primary",loading:h,onClick:()=>pn(void 0,void 0,void 0,(function*(){const[e,t]=yield m.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);l(t),yield bn(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},od=t.forwardRef(((e,n)=>{var r;const{tableColumns:l,open:i=!0}=e,{global:a}=t.useContext(an),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:m,showSummary:h,getSpan:f}=t.useContext($o),{exportExcel:g,columns:v,fetch:y,showHeader:b}=o.current.props,{t:E}=Un(),{getTitleFromCellValue:w}=ps(),[C,S]=t.useState(!1),[N,T]=t.useState(!1),I=t.useMemo((()=>{var e;return!!(null===(e=null==g?void 0:g.fetch)||void 0===e?void 0:e.api)}),[g]),R=t.useMemo((()=>!d.total||N),[d.total,N]),O=t.useMemo((()=>{const e=aa(v.filter((e=>!e.noAuth)),[ls.expandableColumn,ls.selectionColumn,ls.operationColumn]),t=[],n=[],r=[];return e.forEach((e=>{const i=l.find((t=>t.dataIndex===e.dataIndex));"left"===e.fixed?t.push(i||e):"right"===e.fixed?n.push(i||e):r.push(i||e)})),[...t,...r,...n]}),[l]),k=t.useMemo((()=>aa(c,[ls.expandableColumn,ls.selectionColumn,ls.operationColumn])),[c]),L=(e,t="",n=0)=>e.map(((e,r)=>{const l=Object.assign(Object.assign({},e),{index:r,pageIndex:r}),i=t?`${t}.${l.index+1}`:`${l.index+1}`;return l.indexPath=i,l._level=n,Array.isArray(e.children)&&(l.children=L(e.children,i,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&ya(l,t,va(l,t))})),l})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,l=t.reduce(((e,t)=>{if(null==t?void 0:t[ls.summaryIgnore])return e;const n=Number(va(t,r));return Number.isNaN(n)?e:e+n}),0);ya(n,r,l)})),[n]},P=(e,t,n,r)=>{const{dataIndex:l,precision:i,formatType:a,outputRender:o}=n;if(o)return o(va(e,l),e,n,t,r);let s=w(e,n,t,r);return i>=0&&!a&&""!==s&&(s=Number(s)),s},{exportXLSX:_,exportCSV:F}=Cs(),D=e=>pn(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:l,dataKey:i}=y;let a=[];try{T(!0);const o={[ls.currentPageName]:1,[ls.pageSizeName]:null!=e?e:d.total},s=yield n(Object.assign(Object.assign({},r(Object.assign(Object.assign({},u),o))),o));if(200===s.code){let e=Array.isArray(s.data)?s.data:null!==(t=x(s.data,i))&&void 0!==t?t:[];e="function"==typeof l?yield l(e):e,a=L(e)}}catch(e){}return T(!1),a})),M=e=>{var t;const n=null===(t=null==a?void 0:a.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},H=(e,t)=>{const{columns:n,footSummation:r}=e,l=Zi(n);let i='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${l.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,b&&(i+=["<thead>","<tr>",l.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Ta(e.title)}</th>`})).join(""),"</tr>","</thead>"].join("")),t.length&&(i+=`<tbody>${oa(t).map((e=>`<tr>${l.map(((n,r)=>{var l;const{rowSpan:i,colSpan:a}=f(e,n,e.index,r,t);if(!i||!a)return null;const o=P(e,e.index,n,r);return`<td rowspan="${i}" colspan="${a}" data-type="${$(o,null===(l=n.filter)||void 0===l?void 0:l.type)}">${o}</td>`})).join("")}</tr>`)).join("")}</tbody>`),h&&r&&(i+=["<tfoot>",A(l,t).map((e=>`<tr>${l.map(((n,r)=>{const{dataIndex:l,summation:i}=n,a=(null==i?void 0:i.render)?i.render(t):va(e,l);return`<td>${0===r&&""===a?E("qm.table.config.summaryText"):fn(a)?Ta(a):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},$=(e,t)=>{const n={text:"string",textarea:"string",number:"number",date:"date"};return t&&n[t]?n[t]:typeof e},q=null!==(r=null==g?void 0:g.fileName)&&void 0!==r?r:`${p().format(Uo)}.xlsx`,K=q.slice(q.lastIndexOf(".")+1).toLowerCase(),j=()=>{if(R)return te.warning(E("qm.table.export.warnText"));var e;I?(e=q,pn(void 0,void 0,void 0,(function*(){T(!0);try{const{api:t,params:n}=g.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:l}=e.filter||{};return{title:t,dataIndex:n,type:l,hidden:r}}))},u),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[ls.currentPageName]:void 0,[ls.pageSizeName]:void 0}));r.data&&(Ei(r.data,e),M(e))}catch(e){}T(!1)}))):S(!0)};t.useImperativeHandle(n,(()=>({clickHandle:j})));const V={[`${s}-export`]:!0},z={visible:C,title:E("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},W={fileName:q.slice(0,q.lastIndexOf(".")),fileType:K,columns:O,useStyle:(null==g?void 0:g.cellStyle)?1:0};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:Ae(V),title:E("qm.table.export.textNoSpace"),onClick:()=>j()},t.createElement("i",{className:"svgicon icon"},t.createElement(qe,null))),t.createElement(Di,z,t.createElement(ad,{defaultValue:W,onClose:()=>S(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:Ji(e.columns)}),pn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:l=1,endIndex:i}=t,{tableFullData:a,selectionRows:s}=o.current;let c=[];if(m?("all"===r&&(c=yield D()),"custom"===r&&(c=yield D(i),c=c.slice(l-1))):("all"===r&&(c=a.slice(0)),"custom"===r&&(c=a.slice(l-1,i||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==g?void 0:g.beforeExport))try{c=null==g?void 0:g.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield _(t,c,A,P);Ei(n,`${e}.xlsx`),M(`${e}.xlsx`)}if("csv"===n){const n=F(t,H(t,c));Ei(n,`${e}.csv`),M(`${e}.csv`)}}))}})))}));od.displayName="TableExport";const sd=e=>{const{columns:n,onClose:r}=e,{tableRef:l,tableBodyRef:i,prefixCls:a,dataChange:o}=t.useContext($o),{beforeClipboard:s}=l.current.props,{t:c}=Un(),d=t.useRef(null),[u,m]=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:Ta(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:c("qm.table.clipboard.content"),fieldName:"content",placeholder:c("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[p,h]=t.useState(!1);return t.createElement("div",{className:`${a}-clipboard__setting`},t.createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),t.createElement(Kh,{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(Jn,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(Jn,{type:"primary",loading:p,onClick:()=>pn(void 0,void 0,void 0,(function*(){var e;const[t,a]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:m,fieldAuth:p}=l.current;h(!0);const f=a.content.trim().replace(/(\r|\n)$/,"");let g=f.replace(/"[^"]+"/g,"^");((null===(e=f.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{g=g.replace(/\^/,e)}));let v=g.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{v=yield s(v,v[0].map(((e,t)=>n[a.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var l,i;const o=u[a.rowIndex-1+t],s=n[a.colIndex+r];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||(null===(l=e.extra)||void 0===l?void 0:l.disabled)||(null===(i=p[s.dataIndex])||void 0===i?void 0:i.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(ya(o,s.dataIndex,e),m.addToUpdated(o))}}))})),i.current.forceUpdate(),o(),te.success(c("qm.table.clipboard.success",{total:v.length})),h(!1),r()}))},c("qm.table.clipboard.text"))))},cd=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,flattenColumns:i}=t.useContext($o),{t:a}=Un(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex))))(i)),[i]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${l}-clipboard`]:!0},m={visible:o,title:a("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:Ae(u),title:a("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null))),t.createElement(Di,m,t.createElement(sd,{columns:c,onClose:()=>s(!1)})))}));cd.displayName="TableClipboard";const dd=e=>{const{columns:n,onClose:r}=e,{tableRef:l,$size:i,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext($o),{rowKey:s,rowSelection:c}=l.current.props,{t:d}=Un(),u=t.useRef(null),m=ii(u),p=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=p(e.children)),n})),[h,f]=t.useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(n.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex))))]),[g]=t.useState((()=>{const{disabled:e}=c||{},t=l.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=si((()=>{const e=u.current;y(e.offsetHeight-2*Ho[i]-30)}),5);return oi((()=>{b()}),[m.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(op,{size:i,columns:h,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t.createElement("div",{style:{height:10}}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(Jn,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},ud=t.forwardRef(((e,n)=>{const{columns:r,open:l=!0}=e,{tableRef:i,getRowKey:a,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=t.useContext($o),{rowSelection:p}=i.current.props,{t:h}=Un(),[f,g]=t.useState(!1),v=t.useRef(!1);Fl((()=>{!v.current&&y()}),[d]);const y=()=>pn(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=p;if(c&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:s},t.params));if(200===r.code){let l=Array.isArray(r.data)?r.data:null!==(e=x(r.data,t.dataKey))&&void 0!==e?e:[];l=l.filter((e=>!n(e))),u(l.map(((e,t)=>a(e,t)))),m(l),v.current=!0}}catch(e){}})),b=()=>{g(!0)};t.useImperativeHandle(n,(()=>({clickHandle:b})));const E={visible:f,title:h("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:`${o}-select-collection`,title:h("qm.table.selectCollection.text"),onClick:()=>b()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ze,null))),t.createElement(Di,E,t.createElement(dd,{columns:r,onClose:()=>g(!1)})))}));ud.displayName="SelectCollection";const md=e=>{const{onClose:n}=e,{global:r}=t.useContext(an),{tableRef:l,getRowKey:i,prefixCls:a,$size:o,tableFlatData:s,flattenColumns:c,setActivedCell:d,scrollXToColumn:u,scrollYToRecord:m}=t.useContext($o),{uniqueKey:p}=l.current.props,{t:h}=Un(),{getTitleFromCellValue:f}=ps(),g=t.useRef(""),[v,y]=t.useState(""),[b,x]=t.useState([]),[E,w]=t.useState(0),[C,S]=t.useState(!1),[N,T]=t.useState({case:0,fullchar:0}),I=t.useMemo((()=>`${b.length>0?E+1:E}/${b.length}`),[E,b]);Fl((()=>{A(b[E])}),[E,b]);const R=e=>{T(Object.assign({},N,e))},O=(e,t,n)=>new Promise(((r,l)=>{ie.confirm({title:h("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),k=Gn((e=>pn(void 0,void 0,void 0,(function*(){if(!v)return g.current=v,L();const t=((e,t)=>{const n=new RegExp(N.fullchar?`^${t}$`:t,N.case?"":"i"),r=[];return e.forEach(((e,t)=>{c.forEach(((l,a)=>{const{dataIndex:o}=l;if([ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(o))return;const s=f(e,l,e.index,a);n.test(s)&&r.push({value:s,rowKey:i(e,e.index),dataIndex:o,rowIndex:t,colIndex:a})}))})),r})(s,v);if(!t.length)return ie.warning({title:h("qm.button.confirmPrompt"),content:h("qm.table.fastSearch.notMatch")});if(x(t),"all"===e&&S(!0),v!==g.current)return g.current=v,w(0);if("next"===e){const e=E+1;e>t.length-1?yield O(h("qm.table.fastSearch.toTheEnd"),(()=>w(0)),(()=>{})):w(e)}if("prev"===e){const e=E-1;e<0?yield O(h("qm.table.fastSearch.toStart"),(()=>w(t.length-1)),(()=>{})):w(e)}})))),L=()=>{w(0),x([]),d({})},A=e=>{e&&(m(e.rowKey),u(e.dataIndex),d(e))},P=t.useMemo((()=>p?`fastSearch_${p}`:""),[p]),[_,F]=t.useState([]),[D,M]=t.useState(""),[H,$]=t.useState("");Fl((()=>{if(H){const{input:e,config:t}=_.find((e=>e.value===H)).condition;y(e),T(t),setTimeout((()=>k()))}}),[H]),t.useEffect((()=>{q()}),[]);const q=()=>pn(void 0,void 0,void 0,(function*(){if(!P)return;let e=yield Xt.getItem(P);e||(e=yield K(P),Array.isArray(e)&&(yield Xt.setItem(P,e))),Array.isArray(e)&&e.length&&F(e)})),K=e=>pn(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)=>pn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement("div",{className:"search-box"},t.createElement("span",{className:"label"},h("qm.table.fastSearch.queryLabel"),":"),t.createElement(ne,{value:v,placeholder:h("qm.table.fastSearch.queryCondition"),allowClear:!0,style:{flex:"auto",width:"auto"},onChange:e=>y(e.target.value)})),t.createElement("div",{className:"condition"},t.createElement(de,{checked:!!N.case,onChange:e=>R({case:e.target.checked})},h("qm.table.fastSearch.matchCase")),t.createElement(de,{checked:!!N.fullchar,onChange:e=>R({fullchar:e.target.checked})},h("qm.table.fastSearch.matchFullchar"))),t.createElement("div",{className:"all-list"},C&&t.createElement("table",{className:"rtable",tabIndex:-1,cellSpacing:"0",cellPadding:"0"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",{style:{width:40,minWidth:40}},"#"),t.createElement("th",{style:{width:130,minWidth:130}},h("qm.table.fastSearch.cellText")),t.createElement("th",null,h("qm.table.fastSearch.valText")))),t.createElement("tbody",null,b.map(((e,n)=>t.createElement("tr",{key:n,className:Ae({active:E===n}),onClick:()=>w(n)},t.createElement("td",null,n+1),t.createElement("td",null,"Row:",e.rowIndex+1,", Col:",e.colIndex+1),t.createElement("td",null,e.value)))))))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(ne,{size:o,value:D,placeholder:h("qm.table.highSearch.configText"),disabled:!v,onChange:e=>{const{value:t}=e.target;M(t)}}),t.createElement(Jn,{type:"primary",disabled:!D||!v,style:{marginLeft:"10px"},onClick:()=>pn(void 0,void 0,void 0,(function*(){if(!P)return Zn("Table","必须设置组件参数 `uniqueKey` 才能保存");if(!v)return;const e=Na(),t=[..._,{text:D,value:e,condition:{input:v,config:N}}];F(t),M(""),yield Xt.setItem(P,t),yield j(P,t)}))},h("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${ls.rowHeightMaps[o]}px`}},t.createElement("span",null,h("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,_.map((e=>t.createElement("li",{key:e.value,className:Ae({selected:e.value===H}),title:e.text,onClick:()=>{return t=e.value,void $(t!==H?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:h("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,pn(void 0,void 0,void 0,(function*(){if(!n)return;const e=_.filter((e=>e.value!==n));F(e),yield Xt.setItem(P,e),yield j(P,e)}))}},t.createElement(Je,null))))),!_.length&&t.createElement("div",{style:{padding:jo}},t.createElement(Zl,null)))))),t.createElement("div",{className:"bottom-bar",style:{position:"absolute",left:0,bottom:0,right:0,height:`${Ho[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",boxSizing:"border-box"}},t.createElement("div",null,h("qm.table.fastSearch.findTotal",{total:I})),t.createElement("div",null,t.createElement(Jn,{onClick:()=>k("all"),style:{marginRight:8}},h("qm.table.fastSearch.queryAll")),t.createElement(Jn,{type:"primary",onClick:()=>k("prev"),style:{marginRight:8}},h("qm.table.fastSearch.queryPrev")),t.createElement(Jn,{type:"primary",onClick:()=>k("next"),style:{marginRight:8}},h("qm.table.fastSearch.queryNext")),t.createElement(Jn,{onClick:()=>n()},h("qm.table.fastSearch.closeButton")))))},pd=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,$size:i}=t.useContext($o),{t:a}=Un(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:a("qm.table.fastSearch.settingTitle"),width:650,loading:!1,bodyStyle:{paddingBottom:`${Ho[i]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-super-search`,title:a("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(et,null))),t.createElement(Di,d,t.createElement(md,{onClose:()=>s(!1)})))}));pd.displayName="FastSearch";var hd={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:60,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"};const fd=e=>[hd.selectionColumnDefine,...e].filter((e=>!e.hidden)),gd=e=>e.some((e=>Array.isArray(e.children))),vd=e=>void 0!==e._groupLevel,yd=(e,t)=>t.split(hd.separator).reduce(((e,t)=>null==e?void 0:e[t]),e),bd=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(bd)):0,xd=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const l=t?`${t}${hd.separator}${r}`:r;if(n.push(l),Array.isArray(e[r]))return n;const i=xd(e[r],l);return n.concat(i)}),[]),Ed=(e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:l}]=t,i=Object.keys(t[0])[0],a=t.slice(1),o=Object.groupBy(e,(e=>n(e,i))),s=Object.keys(o).sort(((e,t)=>{const n=(r=e,i=t,Number.isNaN(r-i)?r.toString().localeCompare(i.toString()):r-i);var r,i;return"ascend"===l?n:-n})),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],a)})),c};return r(e,t)},wd={sum:e=>e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0),avg:e=>e.length?(e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0)/e.length).toFixed(2):"",max:e=>e.length?Math.max(...e):"",min:e=>e.length?Math.min(...e):"",count:e=>e.length,unique:e=>new Set(e).size,empty:e=>e.filter((e=>wn(e))).length,notEmpty:e=>e.filter((e=>!wn(e))).length},Cd=t.createContext(void 0),Sd=e=>{const{prefixCls:n,pivotProps:r,size:l,getRowKey:i,flatColumns:a,tableData:o}=e,{initialGroup:s,initialCount:c,initialFilter:d,initialSorter:u}=r,m=e=>{const t=new Map;return oa(e).forEach((e=>t.set(i(e,e.index),e))),t},p=t.useRef({props:r,originGridData:o,flatGroupData:[],isTree:gd(o),keyRecordMap:m(o)}),[h,f]=t.useState({pivotRef:p,prefixCls:n,size:l,viewMode:"table",columns:a,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=a.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:d?(e=>{const t=[],n=a.map((e=>e.dataIndex));for(const r in e){const[l,i]=r.split("|");if(n.includes(l)&&i){const n=e[r]||{};Object.keys(n).forEach((e=>{t.push({type:i,bracketLeft:"",fieldName:l,expression:e,value:Ma(e)?null:n[e],bracketRight:"",logic:"and"})}))}}return t})(d):[],sorterList:u?(e=>{const t=[],n=a.map((e=>e.dataIndex));for(const r in e)n.includes(r)&&["ascend","descend"].includes(e[r])&&t.push({fieldName:r,order:e[r]});return t})(u):[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=a.map((e=>e.dataIndex)),r={};for(const l in e)n.includes(l)&&t.includes(e[l])&&(r[l]=e[l]);return r})(c):{},summationData:{}}),g=e=>{f((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((l=>{const i=l;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};oi((()=>{b(o),v("originGridData",o),v("isTree",gd(o)),v("keyRecordMap",m(o))}),[o]),oi((()=>{y(a)}),[a]),oi((()=>{g({size:l})}),[l]);const v=(e,t)=>{h.pivotRef.current[e]=t};v("props",r);const y=e=>{g({columns:e})},b=e=>{g({gridData:e})},x=e=>{g({groupGridData:e})},E=e=>{g({groupList:e})},w=e=>{g({filterList:e})},C=e=>{g({sorterList:e})},S=e=>{g({colorList:e})},N=e=>{g({expandedKeys:e})},T=e=>{g({searchResults:e})},I=e=>{g({switchIndex:e})},R=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),g({fillColorCells:t})},O=e=>{var t;g({countMethod:(t=Object.assign({},h.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},k=e=>{g({summationData:e})},L=t.useMemo((()=>Object.assign(Object.assign({},h),{setContext:g,getRowKey:i,setPivotGridRef:v,setColumns:y,setGridData:b,setGroupGridData:x,setGroupList:E,setFilterList:w,setSorterList:C,setColorList:S,setExpandedKeys:N,setSearchResults:T,setSwitchIndex:I,setFillColor:R,setCountMethod:O,setSummationData:k})),[h]);return t.createElement(Cd.Provider,{value:L},e.children)},Nd=()=>t.useContext(Cd),Td=()=>{const{prefixCls:e,pivotRef:n,groupList:r,columns:l,gridData:i,setGroupList:a,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=Nd(),{originGridData:d}=n.current,{onGroupChange:u,onDataChange:m}=n.current.props,{t:p}=Un(),h=t.useRef([]),g=t.useRef([]),v=t.useMemo((()=>r.filter((e=>e.fieldName&&e.order))),[r]),y=t.useMemo((()=>l.map((e=>({label:Ta(e.title),value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,l]),b=t.useMemo((()=>{const e=v.map((e=>({[e.fieldName]:e.order})));return C(e,h.current)?h.current:(h.current=e,e)}),[v]),x=[{label:p("qm.pivotGrid.group.ascend"),value:"ascend"},{label:p("qm.pivotGrid.group.descend"),value:"descend"}];t.useEffect((()=>{o(g.current)}),[b,d]),t.useLayoutEffect((()=>{const e=Ed(i,b,((e,t)=>{let n=va(e,t);return f(n)&&(n=Object.values(n)),Array.isArray(n)&&(n=n.join(",")),wn(n)?p("qm.pivotGrid.group.empty"):n}));var t;s(e),t=xd(e),g.current=t,c("flatGroupData",((e,t=[])=>{const n=[];return function e(r,l,i=""){if(Array.isArray(r))r.forEach(((e,t)=>{e._varIndex=t,i?e._parentRowKey=i:delete e._parentRowKey})),n.push(...oa(r));else for(const a in r){const o=i?`${i}${hd.separator}${a}`:a,s=Object.keys(t[l])[0];n.push({id:o,_fieldName:s,_groupLevel:l}),e(r[a],l+1,o)}}(e,0),n})(e,b))}),[b,i]),Fl((()=>{null==u||u(v)}),[b]),Fl((()=>{null==m||m(i)}),[i]);const E=()=>{a([...r,{fieldName:"",order:"ascend"}])},w=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...r])},S=e=>t.createElement(t.Fragment,null,t.createElement(We,{className:"icon handle"}),t.createElement(ce,{value:e.fieldName||void 0,placeholder:p("qm.table.editable.selectPlaceholder"),options:y,style:{width:160,margin:"0 10px"},onChange:t=>w("fieldName",e,t)}),t.createElement(ce,{value:e.order,options:x,placeholder:p("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>w("order",e,t)}),t.createElement(rt,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(e)}));return t.createElement(ue,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,p("qm.pivotGrid.group.title")),!!v.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},p("qm.pivotGrid.group.foldAll")),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(g.current)},p("qm.pivotGrid.group.unfoldAll")))),t.createElement("div",{className:"list"},t.createElement(Ut,{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));C(t,n)||a(e)}},r.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},S(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:E},t.createElement(nt,{className:"icon"}),p("qm.pivotGrid.fillColor.add")))),className:Ae("action-btn",{active:!!v.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(tt,{className:"icon"}),p("qm.pivotGrid.group.text"),v.length?`(${v.length})`:null))},Id=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:l,setFilterList:i,setGridData:a}=Nd(),{originGridData:o,isTree:s}=n.current,{onFilterChange:c}=n.current.props,{t:d}=Un(),u=t.useRef([]),m=t.useMemo((()=>l.filter((e=>e.fieldName&&(Ma(e.expression)||!wn(e.value))))),[l]),p=t.useMemo((()=>r.map((e=>({label:Ta(e.title),value:e.dataIndex})))),[r]),[h,f]=t.useState("and"),g=t.useMemo((()=>{const e=m.map((e=>{var t;return`${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}));return C(e,u.current)?u.current:(u.current=e,e)}),[m]);Fl((()=>{i(l.map((e=>Object.assign(Object.assign({},e),{logic:h}))))}),[h]),Fl((()=>{y(),null==c||c(m)}),[g]),t.useEffect((()=>{m.length&&v()}),[]);const v=()=>{const e=Ra(m.map((e=>Object.assign(Object.assign({},Sn(e,["value"])),{condition:e.value}))));a(e?Qi(o,e,s):o)},y=si(v,200),b=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],x=()=>{i([...l,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:h}])},E=(e,t,n)=>{var a;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(a=r.find((e=>e.dataIndex===n)).filter)||void 0===a?void 0:a.type)||"text";Object.assign(t,{type:e,expression:S(e)[0].value,value:""})}"expression"===e&&Ma(n)&&Object.assign(t,{value:""}),i([...l])},w=e=>t.createElement(t.Fragment,null,t.createElement(ce,{value:e.fieldName||void 0,options:p,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>E("fieldName",e,t)}),t.createElement(ce,{value:e.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:S(e.type),style:{width:100,margin:"0 10px"},onChange:t=>E("expression",e,t)}),N(e),t.createElement(rt,{className:"icon close",onClick:()=>(e=>{i(l.filter((t=>t!==e)))})(e)})),S=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.inText")},{value:"nlike",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"^=",label:d("qm.table.highSearch.startsWithText")},{value:"=$",label:d("qm.table.highSearch.endsWithText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}]}return t},N=e=>{var n,l;switch(e.type){case"number":return t.createElement(me,{defaultValue:e.value,style:{width:150},onChange:t=>{E("value",e,wn(t)?"":t)}});case"date":return t.createElement(qn,{popupClassName:ls.popupClassName,defaultValue:null!==(n=Ca(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{E("value",e,Sa(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(l=r.find((t=>t.dataIndex===e.fieldName)))||void 0===l?void 0:l.dictItems)||[];return t.createElement(ce,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{E("value",e,t)}},n.map((e=>t.createElement(ce.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(ne,{value:e.value,style:{width:150},disabled:Ma(e.expression),onChange:t=>{E("value",e,t.target.value)}})}};return t.createElement(ue,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&t.createElement(ce,{value:h,options:b,style:{width:130},onChange:e=>f(e)})),t.createElement("div",{className:"list"},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},w(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:x},t.createElement(nt,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:Ae("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(lt,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},Rd=()=>{const{prefixCls:e,pivotRef:n,columns:r,gridData:l,sorterList:i,setSorterList:a,setGridData:o}=Nd(),{onSorterChange:s}=n.current.props,{t:c}=Un(),d=t.useMemo((()=>i.filter((e=>e.fieldName&&e.order))),[i]),u=t.useMemo((()=>r.map((e=>({label:Ta(e.title),value:e.dataIndex,disabled:i.some((t=>t.fieldName===e.dataIndex))})))),[i,r]);Fl((()=>{h(),null==s||s(d)}),[t.useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]),t.useLayoutEffect((()=>{d.length&&h()}),[]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],p=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,h=()=>{var e,t;o((e=l,(t=d).length||(t=[{fieldName:"index",order:"ascend"}]),e.sort(((e,n)=>{for(const r of t){const{fieldName:t,order:l}=r,i=va(e,t),a=va(n,t),o=p(i,a);if(0!==o)return"ascend"===l?o:-o}return 0})).slice(0)))},f=()=>{a([...i,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...i])},v=e=>t.createElement(t.Fragment,null,t.createElement(We,{className:"icon handle"}),t.createElement(ce,{value:e.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(ce,{value:e.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(rt,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)}));return t.createElement(ue,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.sorter.title"))),t.createElement("div",{className:"list"},t.createElement(Ut,{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));C(t,n)||a(e)}},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(nt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Ae("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(it,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},Od=()=>{const{prefixCls:e,getRowKey:n,gridData:r,columns:l,searchResults:i,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=Nd(),{t:c}=Un(),{getTitleFromCellValue:d}=ps(),[u,m]=t.useState(!1),p=t.useMemo((()=>i.length),[i]);Fl((()=>{u||setTimeout((()=>{s(0),o([])}),200)}),[u]);const h=(e,t)=>{const r=[];return e.forEach(((e,i)=>{l.forEach(((l,a)=>{const o=d(e,l,i,a)+"";o.includes(t)&&r.push({value:o,rowKey:n(e,e.index),dataIndex:l.dataIndex})})),Array.isArray(e.children)&&r.push(...h(e.children,t))})),r},f=si((e=>{const t=e.target.value.trim();s(0),o(t?h(r,t):[])}),200),g=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&v()},v=()=>{if(!p)return;s((a+1)%p)},y=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!p)return;s((a-1+p)%p)})()},t.createElement(at,null)),t.createElement("span",{className:"num"},p>0?a+1:a,"/",p),t.createElement("button",{className:"button-icon",onClick:()=>v()},t.createElement(ot,null)));return t.createElement(ue,{open:u,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.search.title")),t.createElement("button",{className:"button-icon",onClick:()=>m(!1)},t.createElement(rt,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(ne,{autoFocus:!0,style:{width:280},suffix:y(),onChange:f,onKeyUp:g}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>m(!u)},t.createElement(et,{className:"icon"}),c("qm.pivotGrid.search.text")))},kd=(e,t)=>e.map((e=>(e.children&&(e.children=kd(e.children,t)),t(e)))),Ld=()=>{const{prefixCls:e,pivotRef:n,columns:r,setColumns:l}=Nd(),{uniqueKey:i,onColumnsChange:a}=n.current.props,{t:o}=Un(),s=t.useMemo((()=>i?`grid_field_${i}`:""),[i]);t.useLayoutEffect((()=>{c()}),[]),Fl((()=>{u(r)}),[r]);const c=()=>{const e=m();e&&(null==a||a(e))},d=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=d(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),Object.assign({dataIndex:e.dataIndex},t)})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));C(t,n)||localStorage.setItem(s,JSON.stringify(t))},m=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));if(!e)return;return S(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?kd(r,(t=>{const n=e.find((e=>e.dataIndex===t.dataIndex));return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):kd(e,(e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},p=t.useMemo((()=>{let e=0;for(let t=0;t<r.length-1&&("left"!==r[t].fixed||r[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let n=0;n<r.length;n++)n===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(r[n]);return t}),[r]),h=()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,o("qm.pivotGrid.field.title"))),t.createElement("div",{className:"list"},t.createElement(Ut,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:p,setList:e=>{const t=e.map((e=>e.dataIndex)),n=p.map((e=>e.dataIndex));C(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const l=e[r];r<t?l.fixed="left":delete l.fixed,r!==t&&n.push(l)}a?a(n):l(n)})(_a(e))}},p.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(We,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},Ta(e.title)),t.createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...r];a?a(t):l(t)})(e)},e.hidden?t.createElement(st,null):t.createElement($e,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(ue,{trigger:["click"],dropdownRender:()=>h(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(Xe,{className:"icon"}),o("qm.pivotGrid.field.text")))},Ad=()=>{const{prefixCls:e,size:n,setContext:r}=Nd(),{t:l}=Un(),i=[{label:l("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:l("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:l("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return t.createElement(ue,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},i.map((e=>t.createElement("li",{key:e.value,className:Ae("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(He,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},t.createElement("span",null,t.createElement(ct,{className:"icon"}),l("qm.pivotGrid.lineHeight.text")))},Pd="606060",_d="thin",Fd="d4d4d4",Dd=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Md=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Hd=()=>({top:{style:_d,color:{argb:Fd}},left:{style:_d,color:{argb:Fd}},bottom:{style:_d,color:{argb:Fd}},right:{style:_d,color:{argb:Fd}}}),$d=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},qd=()=>{const{prefixCls:e,pivotRef:n,columns:r,countMethod:l,summationData:i}=Nd(),{t:a}=Un(),{exportXLSX:o}=(()=>{const{size:e}=Nd(),{t:t}=Un(),{rowHeightMaps:n}=ls,r=(e,t)=>{var n,r,l;return null!==(l=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==l?l:""};return{exportXLSX:(r,l,i,a)=>pn(void 0,void 0,void 0,(function*(){const{columns:o,footSummation:s}=r,c=n[e],d=Zi(o),u=[],m=[],p=[];let h=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=Ta(e.title),p.push({key:t,width:(n||r)/8})})),u.push(f),h+=u.length;const g=l.map(((e,t)=>{const n={};return d.forEach(((r,l)=>{const i=["percent","finance"].includes(r.formatType);n[r.dataIndex]=i?va(e,r.dataIndex):a(e,t,r,l)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));h+=g.length,s&&i(d,l).forEach(((e,n)=>{const r={};d.forEach(((n,i)=>{const{dataIndex:a,summation:o}=n,s=(null==o?void 0:o.render)?o.render(l):va(e,a);r[a]=0===i&&""===s?t("qm.table.config.summaryText"):fn(s)?Ta(s):s})),m.push(r)}));const{sheetName:v,useStyle:y}=r,b=new Yt.Workbook,x=b.addWorksheet(v);x.columns=p,x.addRows(u).forEach((e=>{y&&Dd(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=ra(o,t.key),{align:r,theadAlign:l}=n;Md(e,l||r),y&&Object.assign(e,{font:{bold:!0,color:{argb:Pd}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Hd()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];y&&Dd(e,c),e.eachCell(((e,t)=>{const l=x.getColumn(e.col),i=ra(o,l.key),{align:a}=i;Md(e,1===t||void 0===r?a:"right"),Object.assign(e,$d(i)),y&&Object.assign(e,{font:{color:{argb:Pd}},border:Hd()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),s&&x.addRows(m).forEach((e=>{y&&Dd(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=ra(o,n.key),{align:l}=r;Md(e,1===t?l:"right"),Object.assign(e,$d(r)),y&&Object.assign(e,{font:{color:{argb:Pd}},border:Hd()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=yield b.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})})),importXLSX:(e,n)=>{const{columns:l,file:i}=e,a=Zi(l),o=new FileReader;o.onerror=()=>{te.error(t("qm.table.import.error"))},o.onload=e=>{const l=a.map((e=>Ta(e.title))),i=new Yt.Workbook,o=e.target;o?i.xlsx.load(o.result).then((e=>{const i=e.worksheets[0];if(i){const e=i.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(l,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let l=e;Array.isArray(null==l?void 0:l.richText)&&(l=l.richText.map((e=>e.text)).join("")),f(l)&&"text"in l&&(l=l.text),A(l)&&(l=Sa(l,Bo)),(null==l?void 0:l.formula)&&(l=null!==(r=l.result)&&void 0!==r?r:l.value),t[s[n]]=l}));const n={};return l.forEach(((e,l)=>{var i;const{dataIndex:o,dictItems:s}=a[l];Array.isArray(s)&&((null===(i=t[e])||void 0===i?void 0:i.toString().includes(","))?t[e]=t[e].split(",").map((e=>r(s,e))).filter((e=>""!==e)):t[e]=r(s,t[e])),ya(n,o,t[e])})),n}));null==n||n(t)}else te.error(t("qm.table.import.error"))}else te.error(t("qm.table.import.error"))})):te.error(t("qm.table.import.error"))},o.readAsArrayBuffer(i)}}})(),{getTitleFromCellValue:s}=ps(),c=[{text:a("qm.pivotGrid.count.records"),value:"count"},{text:a("qm.pivotGrid.count.unique"),value:"unique"},{text:a("qm.pivotGrid.count.empty"),value:"empty"},{text:a("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:a("qm.pivotGrid.count.sum"),value:"sum"},{text:a("qm.pivotGrid.count.max"),value:"max"},{text:a("qm.pivotGrid.count.min"),value:"min"},{text:a("qm.pivotGrid.count.avg"),value:"avg"}],d={columns:Ji(r),fileName:p().format(Uo),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},u=(e,t,n,r)=>{const{dataIndex:l,precision:i,formatType:a,outputRender:o}=n;if(vd(e))return va(e,l);if(o)return o(va(e,l),e,n,t,r);let c=s(e,n,t,r);return i>=0&&!a&&""!==c&&(c=Number(c)),c},m=()=>{if(!l||!Object.keys(l).length)return[];const e={};return d.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";(null==l?void 0:l[t])&&(n=c.find((e=>e.value===l[t])).text+" "+i.total[t]),ya(e,t,n)}})),[e]},h=e=>pn(void 0,void 0,void 0,(function*(){const t=yield o(Object.assign(Object.assign({},d),{footSummation:!!Object.keys(l).length}),e,m,u);Ei(t,`${p().format(Uo)}.xlsx`)})),g=[{key:"1",label:t.createElement(t.Fragment,null,t.createElement(dt,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.group")),onClick:()=>{h((()=>{const e=[];let t=0;return n.current.flatGroupData.forEach((n=>{const a=Object.assign({},n);vd(n)?(a._level=n._groupLevel,d.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(0===t){const t=r.find((e=>e.dataIndex===n._fieldName)),l=t.outputRender?t.outputRender(va(n._record,t.dataIndex),n._record,t,0,0):s(n._record,t,0,0);ya(a,e,l)}else{let t="";(null==l?void 0:l[e])&&(t=c.find((t=>t.value===l[e])).text+" "+yd(i,n.id).subtotal[e]),ya(a,e,t)}})),t=n._groupLevel):t>0&&(a._level=n._level+t+1),e.push(a)})),e})())}},{key:"2",label:t.createElement(t.Fragment,null,t.createElement(ut,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.list")),onClick:()=>{h(Array.from(n.current.keyRecordMap.values()))}}];return t.createElement(ue,{trigger:["click"],menu:{items:g},className:Ae("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},t.createElement("span",null,t.createElement(qe,{className:"icon"}),a("qm.pivotGrid.export.text")))},Kd=()=>{const{prefixCls:e,pivotRef:n,groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o,setContext:s}=Nd(),{uniqueKey:c}=n.current.props,{t:d}=Un(),u=t.useMemo((()=>c?`grid_conf_${c}`:""),[c]),m=t.useRef({}),[h,f]=t.useState([]),[g,v]=t.useState({}),[y,b]=t.useState(""),x=(e,t)=>{v((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))};t.useLayoutEffect((()=>{E()}),[]),Fl((()=>{w()}),[h]);const E=()=>pn(void 0,void 0,void 0,(function*(){try{if(!u)return;const e=yield Xt.getItem(u);Array.isArray(e)&&(f(e),v(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}})),w=()=>pn(void 0,void 0,void 0,(function*(){try{if(!u)return;yield Xt.setItem(u,h)}catch(e){}})),C=()=>{const e=Na();f([{id:e,label:p().format(Uo),value:{groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o}},...h]),xn((()=>x(e,!0)))},S=()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,d("qm.pivotGrid.saved.title"))),t.createElement("div",{className:"list"},t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.id,className:Ae("ant-dropdown-menu-item sort-item",{active:e.id===y}),onClick:()=>(e=>{if(g[e.id])return;const t=y!==e.id,n=t?e.value:m.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),b(t?e.id:"")})(e)},t.createElement("div",{className:"label",style:{width:200}},g[e.id]?t.createElement(ne,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,f([...h])),x(e.id,!1)}}):t.createElement("span",null,e.label)),t.createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?t.createElement(He,null):t.createElement(Me,null)),t.createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(h.filter((e=>e.id!==n)))}},t.createElement(rt,null))))))),t.createElement("div",{className:"add-record",style:{padding:10}},t.createElement("span",{className:"insert",onClick:C},t.createElement(nt,{className:"icon"}),d("qm.pivotGrid.saved.add"))));return t.createElement(ue,{trigger:["click"],dropdownRender:()=>S(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o}:{},m.current=t}},t.createElement("span",null,t.createElement(mt,{className:"icon"}),d("qm.pivotGrid.saved.text")))},jd=()=>{const{gridData:e}=Nd(),{t:n}=Un();return t.createElement("div",{className:"alert-info"},t.createElement(pt,{className:"icon"}),n("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},Vd=8;const zd={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"]}},Wd={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"]}},Bd=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Ud(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:l,borderRadius:i,visibleFirst:a}=e,o=t/2,s={};return Object.keys(zd).forEach((e=>{const c=r&&Wd[e]||zd[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,Bd.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-o-l;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=o+l;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-o-l;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=o+l}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?Vd:r}}({contentRadius:i,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":d.offset[1]=2*-u.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":d.offset[1]=2*u.arrowOffsetHorizontal-o}d.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const l=r&&"object"==typeof r?r:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+n,i.shiftX=!0,i.adjustX=!0}const a=Object.assign(Object.assign({},i),l);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,u,t,n),a&&(d.htmlRegion="visibleFirst")})),s}const Gd=e=>{const{value:n,defaultValue:r,disabled:l,disabledAlpha:i,className:a,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=rs("",{value:n,defaultValue:r}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),p=Ud({offset:0,arrowWidth:16,borderRadius:6}),h=nr("color-picker");return t.createElement(Qt,{action:["click"],prefixCls:h,popupPlacement:"bottomLeft",builtinPlacements:p,popup:()=>t.createElement(Zt,{prefixCls:h,value:d,disabled:l,disabledAlpha:i,onChange:(e,t)=>{u(e.toRgbString()),null==s||s(m(e),t)},onChangeComplete:(e,t)=>{null==c||c(m(e),t)}})},t.createElement("div",{className:Ae(`${h}-btn`,a),style:o},t.createElement(Jt,{color:d,prefixCls:h})))};Gd.displayName="ColorPicker";const Yd=()=>{const{prefixCls:e,pivotRef:n,getRowKey:r,columns:l,colorList:i,setColorList:a,setFillColor:o}=Nd(),{flatGroupData:s}=n.current,{t:c}=Un(),d=t.useRef([]),u=t.useMemo((()=>i.filter((e=>e.fieldName&&e.color&&(Ma(e.expression)||!wn(e.value)||"col"===e.mode)))),[i]),m=t.useMemo((()=>l.map((e=>({label:Ta(e.title),value:e.dataIndex})))),[l]),p=t.useMemo((()=>fd(l)),[l]),h=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"},{label:c("qm.pivotGrid.fillColor.col"),value:"col"}];Fl((()=>{f()}),[t.useMemo((()=>{const e=u.map((e=>{var t;return{[e.color]:`${e.mode},${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}}));return C(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=si((()=>{const e=[];u.forEach((t=>{const n=Ra([Object.assign(Object.assign({},Sn(t,["value"])),{condition:t.value})]),l=Qi(s.filter((e=>!vd(e))),"col"!==t.mode?n:"");if("cell"===t.mode||"col"===t.mode)for(let n=0;n<l.length;n++)e.push({color:t.color,rowKey:r(l[n],l[n].index),dataIndex:t.fieldName});if("row"===t.mode)for(let n=0;n<l.length;n++){const i=r(l[n],l[n].index);for(let n=0;n<p.length;n++)e.push({color:t.color,rowKey:i,dataIndex:p[n].dataIndex})}})),o(e)}),200),g=()=>{a([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},v=(e,t,n)=>{var r;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(r=l.find((e=>e.dataIndex===n)).filter)||void 0===r?void 0:r.type)||"text";Object.assign(t,{type:e,expression:y(e)[0].value,value:""})}"expression"===e&&Ma(n)&&Object.assign(t,{value:""}),a([...i])},y=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.inText")},{value:"nlike",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"^=",label:c("qm.table.highSearch.startsWithText")},{value:"=$",label:c("qm.table.highSearch.endsWithText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}]}return t},b=e=>t.createElement(t.Fragment,null,t.createElement(We,{className:"icon handle"}),t.createElement(Gd,{defaultValue:e.color,style:{marginLeft:5},onChangeComplete:t=>v("color",e,t.hex)}),t.createElement(ce,{value:e.mode,options:h,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:t=>v("mode",e,t)}),t.createElement(ce,{value:e.fieldName||void 0,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>v("fieldName",e,t)}),"col"!==e.mode&&t.createElement(ce,{value:e.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:y(e.type),style:{width:100,margin:"0 10px"},onChange:t=>v("expression",e,t)}),"col"!==e.mode&&(e=>{var n,r;switch(e.type){case"number":return t.createElement(me,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,wn(t)?"":t)}});case"date":return t.createElement(qn,{popupClassName:ls.popupClassName,defaultValue:null!==(n=Ca(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{v("value",e,Sa(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(r=l.find((t=>t.dataIndex===e.fieldName)))||void 0===r?void 0:r.dictItems)||[];return t.createElement(ce,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{v("value",e,t)}},n.map((e=>t.createElement(ce.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(ne,{value:e.value,style:{width:150},disabled:Ma(e.expression),onChange:t=>{v("value",e,t.target.value)}})}})(e),t.createElement(rt,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)}));return t.createElement(ue,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.fillColor.title"))),t.createElement("div",{className:"list"},t.createElement(Ut,{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));C(t,n)||a(e)}},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},b(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(nt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Ae("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(ht,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Xd=()=>t.createElement("div",{className:"top-bar"},t.createElement(tr,{size:4},t.createElement(jd,null),t.createElement(pe,{type:"vertical"}),t.createElement(Ld,null),t.createElement(Td,null),t.createElement(Id,null),t.createElement(Rd,null),t.createElement(pe,{type:"vertical"}),t.createElement(Yd,null),t.createElement(Ad,null),t.createElement(Od,null),t.createElement(pe,{type:"vertical"}),t.createElement(qd,null)),t.createElement(tr,{size:4},t.createElement(Kd,null))),Qd=t.createContext(void 0),Zd=e=>{var n,r;const{scrollbar:l}=e,{pivotRef:i,getRowKey:a,columns:o,groupGridData:s,setPivotGridRef:c}=Nd(),{rowSelection:d,treeExpandable:u,rowHighlight:m}=i.current.props,p=null===(n=null==u?void 0:u.defaultExpandAllRows)||void 0===n||n,h=t.useRef({bodyEl:null,rowVirtualizer:null}),[f,g]=t.useState({gridRef:h,scrollbarRef:l,selectionKeys:null!==(r=null==d?void 0:d.defaultSelectedRowKeys)&&void 0!==r?r:[],treeExpandKeys:p?sa(i.current.originGridData,(e=>a(e,e.index))):[],highlightKey:"",checkedColumnKey:"",clicked:[],isPingLeft:!1}),v=t.useMemo((()=>Math.max(0,bd(s)-1)),[s]),y=t.useMemo((()=>fd(o)),[o]),b=t.useMemo((()=>y.filter((e=>"left"===e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0)+v*hd.indentWidth),[v,y]),x=e=>{g((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((l=>{const i=l;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))},E=(e,t)=>{f.gridRef.current[e]=t};t.useLayoutEffect((()=>{R()}),[o]),t.useLayoutEffect((()=>{(null==d?void 0:d.selectedRowKeys)&&x({selectionKeys:d.selectedRowKeys})}),[null==d?void 0:d.selectedRowKeys]),t.useLayoutEffect((()=>{void 0!==(null==m?void 0:m.currentRowKey)&&x({highlightKey:m.currentRowKey})}),[null==m?void 0:m.currentRowKey]);const w=e=>{Array.isArray(null==d?void 0:d.selectedRowKeys)||x({selectionKeys:e})},C=e=>{x({treeExpandKeys:e})},S=e=>{void 0===(null==m?void 0:m.currentRowKey)&&x({highlightKey:e})},N=e=>{x({checkedColumnKey:e})},T=e=>{Fa(e,f.clicked,!0)||x({clicked:e})},I=e=>{x({isPingLeft:e})},R=()=>{const e=l.current.container.clientWidth,{defaultColumnWidth:t}=ls,n=[];let r=0;if(o.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,r+=e.width):(e.renderWidth=void 0,n.push(e))})),n.length>0){const r=o.reduce(((e,n)=>e+(n.width||n.minWidth||t)),0);if(r<=e){const l=e-r;if(1===n.length)n[0].renderWidth=(n[0].minWidth||t)+l;else{const e=l/n.reduce(((e,n)=>e+(n.minWidth||t)),0);let r=0;n.forEach(((n,l)=>{if(0===l)return;const i=Math.floor((n.minWidth||t)*e);r+=i,n.renderWidth=(n.minWidth||t)+i})),n[0].renderWidth=(n[0].minWidth||t)+l-r}}else n.forEach((e=>{e.renderWidth=e.minWidth||t}))}else r=o.reduce(((e,n)=>e+(n.renderWidth=n.width||n.minWidth||t)),0)},O=t.useMemo((()=>Object.assign(Object.assign({},f),{indentDepth:v,fixedWidth:b,gridColumns:y,setContext:x,setGridLayoutRef:E,setSelectionKeys:w,setTreeExpandKeys:C,setHighlightKey:S,setCheckColumnKey:N,setClicked:T,setPingLeft:I,updateColumnsWidth:R})),[f,v,y]);return t.createElement(Qd.Provider,{value:O},e.children)},Jd=()=>t.useContext(Qd),eu=e=>{var n;const{column:r}=e,{pivotRef:l,columns:i,setColumns:a}=Nd(),{scrollbarRef:o}=Jd(),{onColumnsChange:s}=l.current.props,c=t.useRef(null),[d,u]=t.useState(!1),m=t.useRef(document.onselectstart),p=t.useRef({startX:0,originSizeX:0,columnWidth:0}),h=e=>{p.current=Object.assign({},p.current,e)},f=e=>{if(1!==e.buttons)return g();const t=e.clientX-p.current.startX,n=(r.width||r.renderWidth)+t;n<(r.minWidth||ls.defaultColumnWidth)||(h({columnWidth:n}),c.current.style.left=`${p.current.originSizeX+t}px`)},g=()=>{o.current.container.classList.remove("col-resize"),r.width=p.current.columnWidth;const e=[...i];s?s(e):a(e),xn((()=>u(!1))),Ml(document,"mousemove",f),Ml(document,"mouseup",g),h({startX:0,originSizeX:0,columnWidth:0}),v()},v=()=>{document.onselectstart!==m.current&&(document.onselectstart=m.current)};return t.createElement(t.Fragment,null,t.createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),o.current.container.classList.add("col-resize");const t=ha(e.target,o.current.container).left-o.current.scrollLeft+3;h({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),Dl(document,"mousemove",f),Dl(document,"mouseup",g),u(!0),xn((()=>c.current.style.left=`${t}px`)),m.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(en,{open:d,getContainer:null===(n=o.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:c,className:"resize-line"})))},tu=e=>{var n;const{left:r}=e,{pivotRef:l,columns:i,setColumns:a}=Nd(),{scrollbarRef:o,gridColumns:s,indentDepth:c,isPingLeft:d,setPingLeft:u}=Jd(),{onColumnsChange:m}=l.current.props,{indentWidth:p}=hd,h=t.useRef(document.onselectstart),f=t.useRef({startX:0,originSizeX:0}),g=e=>{f.current=Object.assign({},f.current,e)},v=()=>{E(r),O(r)},[y,b]=t.useState(0),[x,E]=t.useState(r),[w,C]=t.useState(r),S=t.useRef(!1),N=e=>S.current=e;Fl((()=>{S.current||v()}),[r]);const T=e=>e.width||e.renderWidth||0,I=e=>s.slice(0,e).reduce(((e,t)=>e+T(t)),0)+c*p,R=e=>{let t=-1;for(let n=1;n<s.length;n++){const r=I(n-1)+T(s[n-1])/2,l=I(n)+T(s[n])/2;if(e>r&&e<l){I(n)<o.current.container.offsetWidth&&(t=n);break}}return t},O=Ii((e=>{const t=R(e);t<0||C(I(t))}),60);t.useEffect((()=>{const e=e=>u(e.target.scrollLeft>1),t=o.current.scrollElement;return t.addEventListener("scroll",e),Dl(t,"scroll",e),()=>Ml(t,"scroll",e)}),[]);const k=Gn((e=>{if(1!==e.buttons)return L();const t=e.clientX-f.current.startX,n=f.current.originSizeX+t;E(n),O(n)})),L=Gn((()=>{o.current.container.classList.remove("col-resize"),N(!1),(e=>{const t=R(e);if(t<0)return v();i.forEach(((e,n)=>{n<t-1?e.fixed="left":delete e.fixed})),E(I(t)),O(e),m?m([...i]):a([...i])})(x),Ml(document,"mousemove",k),Ml(document,"mouseup",L),g({startX:0,originSizeX:0}),A()})),A=()=>{document.onselectstart!==h.current&&(document.onselectstart=h.current)};return t.createElement(en,{open:!0,getContainer:null===(n=o.current)||void 0===n?void 0:n.container},t.createElement("div",{className:Ae("fixed-line",{leave:d}),style:{left:r}}),t.createElement("div",{className:Ae("fixed-bar",{active:S.current}),style:{left:x},onMouseMove:e=>{const{top:t,height:n}=e.target.getBoundingClientRect(),r=e.clientY-t;let l=Math.max(0,r-16);l=Math.min(l,n-32),b(l)},onMouseDown:e=>{e.preventDefault(),o.current.container.classList.add("col-resize"),o.current.SET_SCROLL_LEFT(0),N(!0),g({startX:e.clientX,originSizeX:e.target.offsetLeft}),Dl(document,"mousemove",k),Dl(document,"mouseup",L),h.current=document.onselectstart,document.onselectstart=()=>!1}},t.createElement("span",{className:"thumb",style:{top:y}})),S.current&&t.createElement("div",{className:"fixed-line active",style:{left:w}}))},nu=()=>{const{pivotRef:e}=Nd(),{indentDepth:n,fixedWidth:r,gridColumns:l,checkedColumnKey:i,selectionKeys:a,setSelectionKeys:o,setCheckColumnKey:s}=Jd(),{rowSelection:c}=e.current.props,{selectionColumn:d}=ls,{indentWidth:u,selectionColumnDefine:m}=hd,p=t.useMemo((()=>l.filter((e=>"left"===e.fixed))),[l]),h=t.useMemo((()=>l.filter((e=>"left"!==e.fixed))),[l]),f=t.useMemo((()=>"radio"!==(null==c?void 0:c.type)),[c]),g=t.useMemo((()=>a.length>0&&a.length===e.current.keyRecordMap.size),[a]),v=t.useMemo((()=>a.length>0&&a.length<e.current.keyRecordMap.size),[a]),y=(l,a)=>t.createElement("div",{className:Ae(a?"fixed-left":"no-fixed"),style:{width:a?r:""}},l.map(((r,p)=>{const{dataIndex:h,title:y,align:b,width:x,renderWidth:E}=r,w={"selection-column":h===d,"col--center":"center"===b,"col--right":"right"===b,"col--checked":i===h},C=p===(a?l.length>1?1:0:l.length-1)?n*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return t.createElement("div",{key:h,className:Ae("table-cell",w),title:Ta(y),style:S,onClick:()=>{return e=h,void([m.dataIndex,ls.operationColumn].includes(e)||s(i!==e?e:""));var e}},h!==d?t.createElement("span",{className:"cell"},y):c&&f?t.createElement(de,{checked:g,indeterminate:v,onChange:t=>(t=>{var n;const r=t?Array.from(e.current.keyRecordMap.keys()):[];o(r),null===(n=null==c?void 0:c.onChange)||void 0===n||n.call(c,r,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",h!==d&&t.createElement(eu,{column:r}))})));return t.createElement("div",{className:"header"},y(p,!0),y(h),t.createElement(tu,{left:r}))};function ru(e,t,n){var r;let l,i=null!==(r=n.initialDeps)&&void 0!==r?r:[];function a(){var r,a,o,s,c;let d;n.key&&(null===(r=n.debug)||void 0===r?void 0:r.call(n))&&(d=Date.now());const u=e(),m=u.length!==i.length||u.some(((e,t)=>i[t]!==e));if(!(null===(a=n.noCache)||void 0===a?void 0:a.call(n))&&!m)return l;let p;if(i=u,n.key&&(null===(o=n.debug)||void 0===o?void 0:o.call(n))&&(p=Date.now()),l=t(...u),n.key&&(null===(s=n.debug)||void 0===s?void 0:s.call(n))){const e=Math.round(100*(Date.now()-d))/100,t=Math.round(100*(Date.now()-p))/100,r=t/16,l=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${l(t,5)} /${l(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return null===(c=null==n?void 0:n.onChange)||void 0===c||c.call(n,l),l}return a.updateDeps=e=>{i=e},a}function lu(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const iu=(e,t,n)=>{let r;return function(...l){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,l)),n)}},au=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},ou=e=>e,su=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},cu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const l=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(l(au(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver((t=>{const r=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void l({width:t.inlineSize,height:t.blockSize})}l(au(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()}));return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},du={passive:!0},uu="undefined"==typeof window||"onscrollend"in window,mu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let l=0;const i=e.options.useScrollendEvent&&uu?()=>{}:iu(r,(()=>{t(l,!1)}),e.options.isScrollingResetDelay),a=r=>()=>{const{horizontal:a,isRtl:o}=e.options;l=a?n.scrollLeft*(o?-1:1):n.scrollTop,i(),t(l,r)},o=a(!0),s=a(!1);s(),n.addEventListener("scroll",o,du);const c=e.options.useScrollendEvent&&uu;return c&&n.addEventListener("scrollend",s,du),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",s)}},pu=(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 e[n.options.horizontal?"offsetWidth":"offsetHeight"]},hu=(e,{adjustments:t=0,behavior:n},r)=>{var l,i;const a=e+t;null===(i=null===(l=r.scrollElement)||void 0===l?void 0:l.scrollTo)||void 0===i||i.call(l,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class fu{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,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=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()}))})):null);return{disconnect:()=>{var n;null===(n=t())||void 0===n||n.disconnect(),e=null},observe:e=>{var n;return null===(n=t())||void 0===n?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null===(n=t())||void 0===n?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options=Object.assign({debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ou,rangeExtractor:su,onChange:()=>{},measureElement:pu,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1},e)},this.notify=e=>{var t,n;null===(n=(t=this.options).onChange)||void 0===n||n.call(t,this,e)},this.maybeNotify=ru((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e,t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n)return void this.maybeNotify();this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=null!==(t=null===(e=this.scrollElement)||void 0===e?void 0:e.window)&&void 0!==t?t:null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}},this.getSize=()=>{var e;return this.options.enabled?(this.scrollRect=null!==(e=this.scrollRect)&&void 0!==e?e:this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=null!==(e=this.scrollOffset)&&void 0!==e?e:"function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let l=t-1;l>=0;l--){const t=e[l];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0},this.getMeasurementOptions=ru((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,l)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:l})),{key:!1}),this.getMeasurements=ru((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:l},i)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,a);for(let l=a;l<e;l++){const e=r(l),a=1===this.options.lanes?o[l-1]:this.getFurthestMeasurement(o,l),s=a?a.end+this.options.gap:t+n,c=i.get(e),d="number"==typeof c?c:this.options.estimateSize(l),u=s+d,m=a?a.lane:l%this.options.lanes;o[l]={index:l,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=ru((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const l=e.length-1,i=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:l};let a=gu(0,l,i,n),o=a;if(1===r)for(;o<l&&e[o].end<n+t;)o++;else if(r>1){const i=Array(r).fill(0);for(;o<l&&i.some((e=>e<n+t));){const t=e[o];i[t.lane]=t.end,o++}const s=Array(r).fill(n+t);for(;a>=0&&s.some((e=>e>=n));){const t=e[a];s[t.lane]=t.start,a--}a=Math.max(0,a-a%r),o=Math.min(l,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null),{key:"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=ru((()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]}),((e,t,n,r,l)=>null===r||null===l?[]:e({startIndex:r,endIndex:l,overscan:t,count:n,offset:this.getScrollOffset()})),{key:"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const l=r.key,i=this.elementsCache.get(l);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(l,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 l=t-(null!==(n=this.itemSizeCache.get(r.key))&&void 0!==n?n:r.size);0!==l&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,l,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(this.options.debug&&console.info("correction",l),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,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=ru((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,l=e.length;r<l;r++){const l=t[e[r]];n.push(l)}return n}),{key:"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return lu(t[gu(0,t.length-1,(e=>lu(t[e]).start),e)])},this.getOffsetForAlignment=(e,t,n=0)=>{const r=this.getSize(),l=this.getScrollOffset();"auto"===t&&(t=e>=l+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const i=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(i,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(),l=this.getScrollOffset();if("auto"===t)if(n.end>=l+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=l+this.options.scrollPaddingStart))return[l,t];t="start"}const i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:t="start",behavior:n}={})=>{"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}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const l=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[l,a]=r;this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame((()=>{const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,a);var r,l;n?(r=n[0],l=t,Math.abs(r-l)<1.01||i(a)):console.warn("Failed to get offset for index:",e)}))},i=t=>{this.targetWindow&&(r++,r<10?(this.options.debug&&console.info("Schedule retry",r,10),this.targetWindow.requestAnimationFrame((()=>l(t)))):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};l(t)},this.scrollBy=(e,{behavior:t}={})=>{"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;if(0===n.length)r=this.options.paddingStart;else if(1===this.options.lanes)r=null!==(t=null===(e=n[n.length-1])||void 0===e?void 0:e.end)&&void 0!==t?t:0;else{const e=Array(this.options.lanes).fill(null);let t=n.length-1;for(;t>=0&&e.some((e=>null===e));){const r=n[t];null===e[r.lane]&&(e[r.lane]=r.end),t--}r=Math.max(...e.filter((e=>null!==e)))}return 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 gu=(e,t,n,r)=>{for(;e<=t;){const l=(e+t)/2|0,i=n(l);if(i<r)e=l+1;else{if(!(i>r))return l;t=l-1}}return e>0?e-1:0};const vu="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function yu(t){return function(t){const n=e.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},t),{onChange:(e,r)=>{var l;r?Mt(n):n(),null===(l=t.onChange)||void 0===l||l.call(t,e,r)}}),[l]=e.useState((()=>new fu(r)));return l.setOptions(r),vu((()=>l._didMount()),[]),vu((()=>l._willUpdate())),l}(Object.assign({observeElementRect:cu,observeElementOffset:mu,scrollToFn:hu},t))}const bu=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,xu=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Eu=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!bu(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function wu({ref:t,handler:n,enabled:r=!0,omitClassNames:l=[]}){const i=Gn(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{Eu(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&Eu(e,t)&&xu(e,l)&&(a.current.isPointerDown=!1,i(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&Eu(e,t)&&xu(e,l)&&(a.current.isPointerDown=!1,i(e))},c=bu(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,i,a,r])}const Cu=e=>{const{pivotRef:n,getRowKey:r,size:l}=Nd(),{scrollbarRef:i,clicked:a,setHighlightKey:o,setClicked:s}=Jd(),{flatGroupData:c}=n.current,{rowHighlight:d}=n.current.props,u=t.useMemo((()=>2*ls.rowHeightMaps[l]),[l]),m=t.useMemo((()=>c.filter((e=>!vd(e)))),[c]),p=Gn((t=>{var n,l;const{keyCode:c}=t;if(!wn(a)&&(27===c&&(o(""),s([])),38===c||40===c)){Hl(t);const p=m.length;let h=m.findIndex((e=>r(e,e.index)===a[0]));const f=38===c?(--h+p)%p:++h%p,g=m[f],v=r(g,g.index);d&&!(null===(n=d.disabled)||void 0===n?void 0:n.call(d,g))&&(o(v),null===(l=d.onChange)||void 0===l||l.call(d,v,g)),((t,n,r)=>{const l=m.length,a=e.find((e=>e.key===r)),o=i.current.scrollTop,s=i.current.container.offsetHeight,c=a.top,d=a.height;"top"===t?c<o?i.current.SET_SCROLL_TOP(c):n===l-1&&i.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?i.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&i.current.SET_SCROLL_TOP(c)})(38===c?"top":"bottom",f,v),s([v,a[1]])}}));t.useLayoutEffect((()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p))),[])},Su=()=>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"})),Nu=()=>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"})),Tu=()=>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"})),Iu=()=>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"})),Ru=()=>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"})),Ou=()=>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:"M512 680.20451555l354.04003555-354.04003556a48.54556445 48.54556445 0 0 1 68.64213334 68.64213334L546.32220445 783.16999111a48.54556445 48.54556445 0 0 1-68.64213334 0L89.31555555 394.80775111a48.54556445 48.54556445 0 0 1 68.64327112-68.64327112L512 680.20451555z"})),ku=e=>{const{column:n,keyPath:r,type:l}=e,{prefixCls:i,countMethod:a,summationData:o,setCountMethod:s}=Nd(),{t:c}=Un(),{dataIndex:d,filter:u}=n,[m,p]=t.useState(!1),h=t.useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:wd.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:wd.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:wd.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:wd.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:wd.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:wd.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:wd.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:wd.avg}];return"number"===(null==u?void 0:u.type)?e:e.slice(0,-4)}),[]),f=t.useMemo((()=>{var e,t,n;const i=a[d];if(!i)return c("qm.pivotGrid.count.statistic");const s=h.find((e=>e.value===i)).text,u=null!==(n=null===(t=null===(e=((e,t)=>t?yd(e,t):e)(o,r))||void 0===e?void 0:e[l])||void 0===t?void 0:t[d])&&void 0!==n?n:"";return s+" "+Ea(u)}),[o,a]);return t.createElement(ue,{open:m,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Ae("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},h.map((e=>{const n=e.value===a[d];return t.createElement("li",{key:e.value,className:Ae("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[d]:n?void 0:e.value}),p(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement(He,null)))})))),className:Ae("count-select",{show:!!a[d]}),overlayClassName:`${i}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},t.createElement("span",null,f," ",t.createElement(ft,{className:"icon"})))},Lu=(e,n)=>{const{pivotRef:r,columns:l,expandedKeys:i,searchResults:a,switchIndex:o,fillColorCells:s,setExpandedKeys:c}=Nd(),{gridRef:d,indentDepth:u,highlightKey:m,checkedColumnKey:p,selectionKeys:h,treeExpandKeys:f,setSelectionKeys:g,setTreeExpandKeys:v,setHighlightKey:y,setClicked:b}=Jd(),{keyRecordMap:x,isTree:E}=r.current,{bodyEl:w,rowVirtualizer:C}=d.current,{rowSelection:S,treeExpandable:N,rowHighlight:T,openRowDraggable:I,onRowEdit:R,onRowClick:O}=r.current.props,{t:k}=Un(),{renderText:L,getTitleFromCellNode:A}=ps(),{selectionColumn:P,operationColumn:_,treeTable:F}=ls,{indentWidth:D}=hd,M=t.useMemo((()=>n?0:fd(l).length-e.length),[l,e]),H=t.useMemo((()=>"radio"!==(null==S?void 0:S.type)),[S]),$=(e,t)=>{var n,r;null==S||S.checkStrictly;const l=H?e?[...h,t]:h.filter((e=>e!==t)):[t];g(l),null===(n=null==S?void 0:S.onSelect)||void 0===n||n.call(S,e,x.get(t)),null===(r=null==S?void 0:S.onChange)||void 0===r||r.call(S,l,q(l))},q=e=>{const t=[];return e.forEach((e=>t.push(x.get(e)))),t},K=(e,t)=>{var n,r;return(null===(n=a[o])||void 0===n?void 0:n.rowKey)===e&&(null===(r=a[o])||void 0===r?void 0:r.dataIndex)===t},j=(e,t)=>{const n=w.querySelectorAll(`li.table-row[data-row-key='${e}']`);Array.from(n).forEach((e=>{e.classList[t&&!(null==C?void 0:C.isScrolling)?"add":"remove"]("row--hover")}))},V=e=>t.createElement("button",{className:Ae("button-icon",{expand:i.includes(e.id)}),onClick:()=>{return t=e.id,void c(i.includes(t)?i.filter((e=>e!==t)):[...i,t]);var t}},t.createElement(vt,null)),z=(r,i,a,o)=>{const{dataIndex:s,width:c,renderWidth:d}=r,m={"expandable-column":s===P},p=i===(n?e.length>1?1:0:-1)?(u-a._groupLevel)*D:0,h={width:`${(c||d||0)+p}px`,minWidth:`${(c||d||0)+p}px`};return t.createElement("div",{key:s,className:Ae("label-cell",m),style:h},s!==P?t.createElement(t.Fragment,null,1===i&&t.createElement("span",{className:"title"},(e=>{const{_record:n,_fieldName:r}=e,i=va(n,r),a=l.find((e=>e.dataIndex===r));return wn(i)||!a?t.createElement("span",{className:"empty"},k("qm.pivotGrid.group.empty")):a.render?a.render(i,n,a,0,0):L(i,a,n)})(a)),s!==_&&t.createElement(ku,{column:r,keyPath:a.id,type:"subtotal"})):V(a))},W=(e,n)=>{var r,l;const i=null===(r=null==N?void 0:N.rowExpandable)||void 0===r?void 0:r.call(N,e);return(null===(l=e.children)||void 0===l?void 0:l.length)?t.createElement("span",{className:Ae("cell--expand",{fold:!f.includes(n),disabled:i}),onClick:()=>{i||(e=>{var t,n;const r=f.includes(e),l=r?f.filter((t=>t!==e)):[...f,e];v(l),null===(t=null==N?void 0:N.onExpand)||void 0===t||t.call(N,!r,x.get(e)),null===(n=null==N?void 0:N.onChange)||void 0===n||n.call(N,l)})(n)}},t.createElement("span",{className:"anticon icon"},t.createElement(Ou,null))):t.createElement("span",{className:"cell--indent",style:{marginTop:-1,width:F.textIndent}})},B=(e,n,r,l,i)=>{var a,o;const{dataIndex:c,width:d,renderWidth:u,align:m,render:f}=e,g=va(r,c),v=f?f(g,r,e,r.index,n):L(g,e,r),x=A(v),w=h.includes(i),C={"selection-column":c===P,"col--center":"center"===m,"col--right":"right"===m,"col--checked":p===c,active:K(i,c)},N={width:`${d||u||0}px`,minWidth:`${d||u||0}px`,backgroundColor:s.get(`${i}|${c}`)};return t.createElement("div",{key:c,"data-col-index":n,title:x,className:Ae("table-cell",C),style:N,onClick:t=>{var n,l;[P,_].includes(c)||(b([i,c]),T&&!(null===(n=T.disabled)||void 0===n?void 0:n.call(T,r))&&(y(i),null===(l=T.onChange)||void 0===l||l.call(T,i,r)),null==O||O(r,e,t))}},c!==P?t.createElement(t.Fragment,null,E&&1===n&&t.createElement(t.Fragment,null,(k=r._level)?t.createElement("span",{key:k,className:`cell--indent indent-level-${k}`,style:{marginTop:-1,width:k*F.textIndent}},new Array(k).fill(null).map(((e,n)=>t.createElement("i",{key:n,className:"line"})))):null,W(r,i)),t.createElement("span",{className:"cell"},v)):t.createElement("div",{className:"action"},I?t.createElement("span",{className:"drag-icon"},t.createElement(We,null)):t.createElement("span",{style:{width:20}}),t.createElement("div",{className:"middle"},t.createElement("span",{className:"order"},((e,t)=>E?0===e._level?e._varIndex+1:null:t+1)(r,l)),S&&t.createElement(t.Fragment,null,H?t.createElement(de,{className:"checkbox",checked:w,disabled:null===(a=null==S?void 0:S.disabled)||void 0===a?void 0:a.call(S,r),onChange:e=>$(e.target.checked,i)}):t.createElement(he,{className:"checkbox",checked:w,disabled:null===(o=null==S?void 0:S.disabled)||void 0===o?void 0:o.call(S,r),onChange:e=>$(e.target.checked,i)}))),R?t.createElement("span",{className:"expand-icon",onClick:()=>R(r,l)},t.createElement(gt,null)):t.createElement("span",{style:{width:20}})));var k};return{renderGroupRow:(n,r)=>t.createElement("div",{className:"label-row"},e.map(((e,t)=>z(e,M+t,n)))),renderRow:(n,r,l)=>{const i={"row--selection":h.includes(l),"row--highlight":m===l};return t.createElement("li",{key:l,"data-row-key":l,className:Ae("table-row",i),onMouseEnter:()=>j(l,!0),onMouseLeave:()=>j(l)},e.map(((e,t)=>B(e,M+t,n,r,l))))}}},Au=e=>{const{layout:n,displayList:r,virtualRows:l,notGroup:i}=e,{fixedWidth:a,gridColumns:o}=Jd(),s=t.useMemo((()=>o.filter((e=>"left"===e.fixed))),[o]),{renderGroupRow:c,renderRow:d}=Lu(s,!0);return t.createElement("div",{className:"left-panel",style:{width:a}},t.createElement("div",{className:Ae("container",{"no-group":i})},l.map((e=>{const l=e.index,i=n[l],a=r[l];if(vd(a))return t.createElement("div",{key:a.id,className:Ae("group-label",`level${a._groupLevel}`),style:{top:i.top,left:i.left,right:0,height:i.height}},c(a,i.key));const o=l===n.length-1||vd(r[l+1]);return t.createElement("div",{key:i.key,className:Ae("row-item",{"is-leaf":a._level,last:o}),style:{top:i.top,left:i.left,right:0,height:i.height}},d(a,a._varIndex,i.key))}))))},Pu=e=>{const{layout:n,displayList:r,virtualRows:l,notGroup:i}=e;Nd();const{gridColumns:a}=Jd(),o=t.useMemo((()=>a.filter((e=>"left"!==e.fixed))),[a]),{renderGroupRow:s,renderRow:c}=Lu(o);return t.createElement("div",{className:"main-panel"},t.createElement("div",{className:Ae("container",{"no-group":i})},l.map((e=>{const l=e.index,i=n[l],a=r[l];if(vd(a))return t.createElement("div",{key:a.id,className:Ae("group-label",`level${a._groupLevel}`),style:{top:i.top,left:0,right:i.right,height:i.height}},s(a,i.key));const o=l===n.length-1||vd(r[l+1]);return t.createElement("div",{key:i.key,className:Ae("row-item",{last:o}),style:{top:i.top,left:0,right:i.right,height:i.height}},c(a,a._varIndex,i.key))}))))},_u=()=>{const{pivotRef:e,getRowKey:n,prefixCls:r,size:l,groupGridData:i,expandedKeys:a,searchResults:o,switchIndex:s}=Nd(),{scrollbarRef:c,gridColumns:d,treeExpandKeys:u,setGridLayoutRef:m}=Jd(),{flatGroupData:p}=e.current,{contextMenues:h}=e.current.props,{groupMargin:f}=hd,{rowHeightMaps:g}=ls,v=t.useRef(null),y=t.useMemo((()=>Array.isArray(i)),[i]),{contextMenu:b,closeMenu:x}=(({ref:e,popup:n,getTriggerContainer:r,prevent:l,prefixCls:i="",enabled:a=!0})=>{const o=t.useRef(null),s=t.useRef(null),c=e=>{s.current=e},[d,u]=t.useState(!1),[m,p]=t.useState(null),h={width:150,height:200,zIndex:9999};wu({ref:o,handler:()=>f()});const f=()=>{u(!1),p(null),c(null)},g=Gn((e=>{if(e.preventDefault(),null==l?void 0:l(e.target))return f();c(e),u(!0),xn((()=>{var t;const{width:n,height:r}=(null===(t=o.current)||void 0===t?void 0:t.getBoundingClientRect())||h,l=n,i=r,a=window.innerWidth,s=window.innerHeight;let c=e.clientX,d=e.clientY;c+l>a&&(c=Math.max(c-l,0)),d+i>s&&(d=Math.max(d-i,0)),p({x:c,y:d})}))}));t.useEffect((()=>{const t=(null==r?void 0:r(e.current))||e.current;return a&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const v={position:"fixed",top:`${(null==m?void 0:m.y)||0}px`,left:`${(null==m?void 0:m.x)||0}px`,zIndex:h.zIndex};return{contextMenu:t.createElement(en,{open:d},t.createElement("div",{ref:o,className:`${i}__context-menu`,style:v},s.current?n(s.current):null)),closeMenu:f}})({ref:v,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:r,enabled:!!h,popup:e=>{var r;const l=zl(e.target,"table-cell"),i=(null===(r=null==l?void 0:l.parentNode)||void 0===r?void 0:r.getAttribute("data-row-key"))||"",a=p.find((e=>n(e,e.index)==i)),o=Number((null==l?void 0:l.getAttribute("data-col-index"))||-1),s=d[o];return t.createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},h.map((e=>{var n;const r=(null===(n=e.disabled)||void 0===n?void 0:n.call(e,a,s))||!1;return t.createElement("li",{key:e.key,className:Ae("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":r}),onClick:()=>{var t;r||(xn((()=>x())),null===(t=e.onClick)||void 0===t||t.call(e,a,s))}},e.prefix&&t.createElement("span",{className:"prefix"},e.prefix),t.createElement("span",{className:"label"},e.label),e.suffix&&t.createElement("span",{className:"suffix"},e.suffix))})))}}),E=e=>{var t;const n=p[e];for(let r=e+1;r<p.length;r++)if(null===(t=p[r]._parentRowKey)||void 0===t?void 0:t.startsWith(n.id)){Object.assign(n,{_record:p[r]});break}},w=t.useMemo((()=>{const e=new Map,t=[];return p.forEach(((r,l)=>{if(vd(r)){if(0===r._groupLevel)return e.set(r.id,a.includes(r.id)),E(l),void t.push(r);const n=r.id.slice(0,r.id.lastIndexOf(hd.separator));return void(a.includes(n)&&e.get(n)&&(e.set(r.id,a.includes(r.id)),E(l),t.push(r)))}const i=n(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(i,u.includes(i)),t.push(r))})),e.clear(),t}),[i,a,u]),C=t.useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],l=[],i=n,a=hd.indentWidth,o=hd.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;l.length>0&&l[l.length-1]._level>=e._groupLevel;){const e=l.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,l.length>0){const t=l[l.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}l[l.length-1];const t={key:e.id,top:s,left:a*e._groupLevel,right:a*e._groupLevel,height:i,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),l.push(t),s+=i}else{const n=l[l.length-1]||{left:0,right:0},a={key:t(e,e.index),top:s,left:n.left,right:n.right,height:i};r.push(a),s+=i,l.length>0&&(n._childHeight+=i)}}));l.length>0;){const e=l.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,l.length>0){const t=l[l.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(w,{getRowKey:n,rowHeight:g[l]})),[w,l]);Cu(C);const S=t.useMemo((()=>!w.length),[w]),N=t.useMemo((()=>{if(S)return 106;if(y)return C.reduce(((e,t)=>e+t.height),0)+2*f;const e=C.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*f+2*f}),[S,y,C]),{rowVirtualizer:T,virtualRows:I}=(e=>{const{layout:n,isGroup:r}=e,{size:l}=Nd(),{scrollbarRef:i}=Jd(),{rowHeightMaps:a}=ls,o=t.useMemo((()=>{var e;return(null===(e=i.current)||void 0===e?void 0:e.scrollElement)||null}),[i.current]),s=yu({count:n.length,getScrollElement:()=>o,estimateSize:e=>n[e].height,overscan:1,noCache:r,rangeExtractor:e=>{if(!r)return su(e);const t=e.offset,i=s.scrollElement.offsetHeight,o=[];for(let r=0;r<e.count;r++){const e=n[r];t>e.top+e.height+a[l]||t+i+a[l]<e.top||o.push(r)}return o}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:C,isGroup:!y});Fl((()=>{const e=p.findIndex((e=>{var t;return n(e,e.index)===(null===(t=o[s])||void 0===t?void 0:t.rowKey)}));e>=0&&c.current.SET_SCROLL_TOP(e*g[l]);const t=d.findIndex((e=>{var t;return e.dataIndex===(null===(t=o[s])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=d.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]),t.useLayoutEffect((()=>{m("bodyEl",v.current),m("rowVirtualizer",T)}),[]);const R={layout:C,displayList:w,virtualRows:I,notGroup:y};return t.createElement("div",{ref:v,className:"body",style:{height:N}},S?t.createElement(Zl,{className:"content-empty"}):t.createElement(t.Fragment,null,t.createElement(Au,R),t.createElement(Pu,R),b))},Fu=()=>{const{groupGridData:e,countMethod:n,setSummationData:r}=Nd(),{indentDepth:l,fixedWidth:i,gridColumns:a}=Jd(),{selectionColumn:o}=ls,{indentWidth:s}=hd,c=t.useMemo((()=>a.filter((e=>"left"===e.fixed))),[a]),d=t.useMemo((()=>a.filter((e=>"left"!==e.fixed))),[a]);Fl((()=>{r(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const l=e.map((e=>Cn(e,r)));n[r]=t[r](l)}return n},l=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const i={},a={};Object.keys(t).forEach((e=>{a[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>Cn(e,n)));e[n]=t[n](r),a[n].push(...r)}i[r]={subtotal:e}}else{const e=l(o);i[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&a[n].push(t)}}}if(0===n.length)return i;const o={};for(const e in t)o[e]=t[e](a[e]);return i.subtotal=o,i},i=Array.isArray(e)?{total:r(e)}:l(e);return n.length>0&&(i.total=r(n)),delete i.subtotal,i})(e,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:wd[e[n]]});return t})(n)))}),[n,e]);const u=(e,n)=>t.createElement("div",{className:Ae(n?"fixed-left":"no-fixed"),style:{width:n?i:""}},e.map(((r,i)=>{const{dataIndex:a,width:c,renderWidth:d}=r,u={"selection-column":a===o,"col--right":!0},m=i===(n?e.length>1?1:0:e.length-1)?l*s:0,p={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return t.createElement("div",{key:a,className:Ae("table-cell",u),style:p},a!==o?t.createElement(ku,{column:r,keyPath:"",type:"total"}):null)})));return t.createElement("div",{className:"footer"},u(c,!0),u(d))},Du=()=>{const{prefixCls:e,size:n}=Nd(),r=t.useRef(null);return t.createElement(Zd,{scrollbar:r},t.createElement(xi,{ref:r,wrapStyle:{height:"100%",maxHeight:"inherit"},className:Ae(`${e}__layout`,n)},t.createElement(nu,null),t.createElement(_u,null),t.createElement(Fu,null)))},Mu=()=>t.createElement("div",{className:"wrapper"},t.createElement(Du,null)),Hu={rowKey:"id",columns:[],dataSource:[]},$u=e=>{const n=In(Hu,e),{rowKey:r,fromTable:l,columns:i,dataSource:a,height:o,maxHeight:s,className:c,style:d}=n,{$size:u}=Yn(n),m=Gn(((e,t)=>{const n="function"==typeof r?r(e,t):null==e?void 0:e[r];return void 0===n?(Zn("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),p=(e,t="",n=0)=>e.map(((e,r)=>{const l=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=p(e.children,l,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),h=e=>{let t=(e=>e.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex"].includes(e.dataIndex))))(e).map((e=>Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0})));return l&&(t=t.filter((e=>![ls.operationColumn].includes(e.dataIndex)))),t},f=t.useMemo((()=>h(i)),[i]),g=t.useMemo((()=>p(a)),[a]),v=nr("pivot-grid"),y={[v]:!0,"is-from-table":l},b={height:o,maxHeight:s},x={prefixCls:v,size:u,getRowKey:m,flatColumns:f,tableData:g,pivotProps:Sn(n,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return t.createElement("div",{className:Ae(y,c),style:Object.assign(Object.assign({},d),b)},t.createElement(Sd,x,t.createElement(Xd,null),t.createElement(Mu,null)))};$u.displayName="PivotGrid";const qu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{tableRef:l,prefixCls:i,flattenColumns:a}=t.useContext($o),{rowKey:o,uniqueKey:s}=l.current.props,{t:c}=Un(),{tableFullData:d}=l.current,[u,m]=t.useState(!1),p=()=>{m(!0)};t.useImperativeHandle(n,(()=>({clickHandle:p})));const h={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>p()},t.createElement("i",{className:"svgicon icon"},t.createElement(yt,null))),t.createElement(Di,h,t.createElement($u,{fromTable:!0,rowKey:o,uniqueKey:s,columns:a,dataSource:d})))}));qu.displayName="PivotGrid";const Ku=e=>{const{columns:n,group:r,summary:l}=e,{tableRef:i,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext($o),{fetch:d}=i.current.props,{t:u}=Un(),m=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:[]}},h=r.map((e=>Object.assign({dataIndex:e.group},m(e.group)))),f=l.map((e=>e.summary===ls.groupSummary.total.value?{dataIndex:e.summary,title:ls.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},m(e.summary)),{formula:e.formula}))),g=t.useMemo((()=>Object.assign({},s,{[ls.sorterFieldName]:void 0,[ls.groupSummary.summaryFieldName]:l.map((e=>`${e.formula}|${e.summary}`)).join(","),[ls.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[ls.currentPageName]:1})),[s,r,l]),[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 l=r?{summation:r}:null;return e.dataIndex===ls.groupSummary.total.value&&(l={dataIndex:ls.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?l:null)}))])(h,f)),[b]=t.useState(c?[]:(e=>{const t=Oa(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&ya(t,r,va(e[0],r))})),l.forEach((n=>{const r=n.summary!==ls.groupSummary.total.value?n.summary:ls.groupSummary.recordTotalIndex,l=n.formula;"count"===l&&ya(t,r,e.length),"sum"===l&&ya(t,r,P(e,r)),"max"===l&&ya(t,r,_(e,r)[r]),"min"===l&&ya(t,r,F(e,r)[r]),"avg"===l&&ya(t,r,(P(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(i.current.tableFullData)),x=Object.assign(Object.assign({size:a,height:400},c?{fetch:{api:d.api,params:g,dataKey:null==d?void 0:d.dataKey}}:{dataSource:b}),{columns:v,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${p().format(Uo)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)});return t.createElement(op,x)},ju=e=>{const{onClose:n}=e,{global:r}=t.useContext(an),{tableRef:l,prefixCls:i,$size:a,flattenColumns:o}=t.useContext($o),{uniqueKey:s}=l.current.props,{t:c}=Un(),d=t.useRef(null),u=t.useRef(null),[m,p]=t.useState(!1),[h,f]=t.useState([]),[g,v]=t.useState(""),[y,b]=t.useState("");Fl((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;T(e),k(t)}else{const e=F();T((null==e?void 0:e.group)||[]),k((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{D()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![ls.expandableColumn,ls.selectionColumn,"index","pageIndex",ls.operationColumn].includes(e.dataIndex)))),[o]),w=E.filter((e=>!e.groupSummary)).map((e=>({text:Ta(e.title),value:e.dataIndex}))),C=[ls.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:Ta(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(Jn,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:c("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>Object.assign(Object.assign({},e),{disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[O,k]=t.useState([]),[L,A]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(Jn,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:c("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>Object.assign(Object.assign({},e),{disabled:O.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:c("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===ls.groupSummary.total.value?S.slice(S.length-1):S})}]),P=t.useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=O.length&&O.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,O]),_=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}))},F=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},D=()=>pn(void 0,void 0,void 0,(function*(){if(!x)return;const e=F();if(e){const{group:t,summary:n}=e;T(t),k(n)}let t=yield Xt.getItem(x);t||(t=yield M(x),Array.isArray(t)&&(yield Xt.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),M=e=>pn(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){}})),H=(e,t)=>pn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),$={visible:m,title:c("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>p(!1)};return t.createElement("div",{className:`${i}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(op,{ref:d,size:a,columns:I,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>R(e),onDataChange:e=>{T(e)}},t.createElement(Jn,{type:"primary",icon:t.createElement(nt,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(op,{ref:u,size:a,columns:L,dataSource:O,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>A(e),onDataChange:e=>{k(e)}},t.createElement(Jn,{type:"primary",icon:t.createElement(nt,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(ne,{size:a,value:g,placeholder:c("qm.table.groupSummary.configText"),disabled:P,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(Jn,{type:"primary",disabled:!g||P,style:{marginLeft:"10px"},onClick:()=>pn(void 0,void 0,void 0,(function*(){if(!x)return Zn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Na(),t=[...h,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}}];f(t),b(e),v(""),yield Xt.setItem(x,t),yield H(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${ls.rowHeightMaps[a]}px`}},t.createElement("span",null,c("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.value,className:Ae({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,pn(void 0,void 0,void 0,(function*(){if(!n)return;const e=h.filter((e=>e.value!==n));f(e),n===y&&b(""),yield Xt.setItem(x,e),yield H(x,e)}))}},t.createElement(Je,null))))),!h.length&&t.createElement("div",{style:{padding:jo}},t.createElement(Zl,null)))))),t.createElement(Di,$,t.createElement(Ku,{columns:E,group:N,summary:O})),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(Jn,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(Jn,{type:"primary",disabled:P,onClick:()=>(_(),void p(!0))},c("qm.table.groupSummary.confirmButton"))))},Vu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l}=t.useContext($o),{t:i}=Un(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:i("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:`${l}-group-summary`,title:i("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(bt,null))),t.createElement(Di,c,t.createElement(ju,{onClose:()=>o(!1)})))}));Vu.displayName="GroupSummary";const zu=e=>{const{onClose:n}=e,{global:r}=t.useContext(an),{tableRef:l,$size:i,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c,clearPagerFilter:d}=t.useContext($o),{uniqueKey:u}=l.current.props,{t:m}=Un(),p=t.useRef(null),[h,f]=t.useState([]),[g,v]=t.useState([]),[y,b]=t.useState(""),[x,E]=t.useState("");Fl((()=>{f(x?g.find((e=>e.value===x)).list:D()||[])}),[x]),t.useEffect((()=>{M()}),[]);const w=t.useMemo((()=>u?`superSearch_${u}`:""),[u]),C=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),S=Ra(h),N=t.useMemo((()=>!(S&&Xi(S))),[S]),T=t.useMemo((()=>!!h.length&&N),[h,N]),I=[{value:"and",text:m("qm.table.highSearch.andText")},{value:"or",text:m("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Ta(e.title)}))),O=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:m("qm.table.highSearch.gtText")},{value:"<",text:m("qm.table.highSearch.ltText")},{value:">=",text:m("qm.table.highSearch.gteText")},{value:"<=",text:m("qm.table.highSearch.lteText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",text:m("qm.table.highSearch.inText")},{value:"nin",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",text:m("qm.table.highSearch.inText")},{value:"nlike",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"^=",text:m("qm.table.highSearch.startsWithText")},{value:"=$",text:m("qm.table.highSearch.endsWithText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}]}return t},[A,P]=t.useState([{title:m("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(Jn,{type:"text",onClick:()=>{p.current.REMOVE_RECORDS(n)}},m("qm.table.highSearch.removeText")))},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:R,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:m("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const l=Object.values(t)[0],i=null===(n=C.find((e=>e.dataIndex===l)))||void 0===n?void 0:n.filter.type,a=L(i);e.fieldType=i,e.expression=l?null===(r=a[0])||void 0===r?void 0:r.value:"",e.condition=O(e.expression)?[]:"",l||(e.bracketLeft=e.bracketRight="")}})},{title:m("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:m("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{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=O(e.expression)?[]:""}}}},{title:m("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const l=C.find((t=>t.dataIndex===e.fieldName)),i=null==l?void 0:l.filter.type,a=null!==(r=null!==(n=null===(t=null==l?void 0:l.filter)||void 0===t?void 0:t.items)&&void 0!==n?n:null==l?void 0:l.dictItems)&&void 0!==r?r:[];return{type:k(i,O(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName||Ma(e.expression),cornerSign:!1}}}},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{c(),d(),s(h.map((e=>Sn(e,["index","pageIndex"])))),F(),n()},F=()=>{w&&sessionStorage.setItem(w,JSON.stringify(h.filter((e=>!!e.fieldName))))},D=()=>{if(!w)return;const e=sessionStorage.getItem(w);return e?JSON.parse(e):null},M=()=>pn(void 0,void 0,void 0,(function*(){if(!w)return;const e=D();e&&f(e);let t=yield Xt.getItem(w);t||(t=yield H(w),Array.isArray(t)&&(yield Xt.setItem(w,t))),Array.isArray(t)&&t.length&&(v(t),!e&&E(t[0].value))})),H=e=>pn(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)=>pn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(op,{ref:p,size:i,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]?"":")"),f([...h]))},onDataChange:e=>{f(e)}},t.createElement(Jn,{type:"primary",icon:t.createElement(nt,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),ls.highSearch.showSQL&&S&&t.createElement("code",{className:"lang-js"},S)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(ne,{size:i,value:y,placeholder:m("qm.table.highSearch.configText"),disabled:N,onChange:e=>{const{value:t}=e.target;b(t)}}),t.createElement(Jn,{type:"primary",disabled:!y||N,style:{marginLeft:"10px"},onClick:()=>pn(void 0,void 0,void 0,(function*(){if(!w)return Zn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Na(),t=[...g,{text:y,value:e,list:h.filter((e=>!!e.fieldName))}];v(t),E(e),b(""),yield Xt.setItem(w,t),yield $(w,t)}))},m("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${ls.rowHeightMaps[i]}px`}},t.createElement("span",null,m("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,g.map((e=>t.createElement("li",{key:e.value,className:Ae({selected:e.value===x}),title:e.text,onClick:()=>{return t=e.value,void E(t!==x?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:m("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,pn(void 0,void 0,void 0,(function*(){if(!n)return;const e=g.filter((e=>e.value!==n));v(e),n===x&&E(""),yield Xt.setItem(w,e),yield $(w,e)}))}},t.createElement(Je,null))))),!g.length&&t.createElement("div",{style:{padding:jo}},t.createElement(Zl,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(Jn,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.highSearch.closeButton")),t.createElement(Jn,{type:"primary",disabled:T,onClick:()=>_()},m("qm.table.highSearch.searchButton"))))},Wu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l}=t.useContext($o),{t:i}=Un(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:i("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:`${l}-super-search`,title:i("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(xt,null))),t.createElement(Di,c,t.createElement(zu,{onClose:()=>o(!1)})))}));Wu.displayName="SuperSearch";const Bu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:l,showReload:i,showPrint:a,showImport:o,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:m,showPivotGrid:p,showGroupSummary:h,showToolBox:f}=e,{global:g}=t.useContext(an),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext($o),{uniqueKey:E,exportExcel:w}=v.current.props,{t:C}=Un(),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(null),_=t.useRef(null),F=t.useRef(!1),D=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[M,H]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),$={fullScreen:l,reload:i,print:a,import:o,export:s&&!(null==w?void 0:w.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:m,pivotGrid:p,groupSummary:h},[q,K]=t.useState(!1);Fl((()=>{F.current&&(V(),F.current=!1)}),[M]),t.useEffect((()=>{j()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return Zn("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const j=()=>{if(!D||!f)return;const e=JSON.parse(localStorage.getItem(D));e||z(D).then((e=>{e&&(H(Object.assign({},M,e)),localStorage.setItem(D,JSON.stringify(e)))})).catch((()=>{})),e&&H(Object.assign({},M,e))},V=()=>{if(!D||!f)return;const e={};for(const t in M)M[t]&&(e[t]=M[t]);localStorage.setItem(D,JSON.stringify(e)),W(D,e)},z=e=>pn(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){}})),W=(e,t)=>pn(void 0,void 0,void 0,(function*(){const n=null==g?void 0:g.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),B=e=>pn(void 0,void 0,void 0,(function*(){K(!1),yield bn(100),e.current.clickHandle()})),U=(e,t)=>{F.current=!0,H(Object.assign({},M,{[t]:e}))},G={"top-toolbox__popper":!0,[`${b}--lg`]:"large"===y,[`${b}--sm`]:"small"===y};return t.createElement(t.Fragment,null,l&&t.createElement(us,{ref:S,isFullScreen:x,open:!f||M.fullScreen}),i&&t.createElement(ms,{ref:N,open:!f||M.reload}),a&&t.createElement(hs,{ref:T,tableColumns:r,open:!f||M.print}),o&&t.createElement(Ts,{ref:I,tableColumns:r,open:!f||M.import}),s&&t.createElement(od,{ref:R,tableColumns:r,open:(!f||M.export)&&!(null==w?void 0:w.hideIcon)}),c&&t.createElement(cd,{ref:O,open:!f||M.clipboard}),d&&t.createElement(ud,{ref:k,columns:r,open:!f||M.collection}),u&&t.createElement(pd,{ref:L,open:!f||M.fastSearch}),p&&t.createElement(qu,{ref:A,open:!f||M.pivotGrid}),h&&t.createElement(Vu,{ref:P,open:!f||M.groupSummary}),m&&t.createElement(Wu,{ref:_,open:!f||M.superSearch}),f&&t.createElement(ue,{open:q,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.fullScreen,style:{marginRight:6},onChange:e=>U(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.screen.full"))),onClick:()=>B(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.reload,style:{marginRight:6},onChange:e=>U(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.refresh.text"))),onClick:()=>B(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.print,style:{marginRight:6},onChange:e=>U(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.print.text"))),onClick:()=>B(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.import,style:{marginRight:6},onChange:e=>U(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.import.textNoSpace"))),onClick:()=>B(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.export,style:{marginRight:6},onChange:e=>U(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.export.textNoSpace"))),onClick:()=>B(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.clipboard,style:{marginRight:6},onChange:e=>U(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.clipboard.textNoSpace"))),onClick:()=>B(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.collection,style:{marginRight:6},onChange:e=>U(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.selectCollection.text"))),onClick:()=>B(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.fastSearch,style:{marginRight:6},onChange:e=>U(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.fastSearch.text"))),onClick:()=>B(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.pivotGrid,style:{marginRight:6},onChange:e=>U(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.pivotGrid.text"))),onClick:()=>B(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.groupSummary,style:{marginRight:6},onChange:e=>U(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.groupSummary.text"))),onClick:()=>B(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(de,{checked:M.superSearch,style:{marginRight:6},onChange:e=>U(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.highSearch.text"))),onClick:()=>B(_)}];return t.createElement(fe,{items:e.filter((e=>$[e.key]))})})(),overlayClassName:Ae(G),overlayStyle:{minWidth:120},onOpenChange:e=>{K(e)}},t.createElement("span",{className:`${b}-toolbox`,title:C("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(Et,null)))))}));Bu.displayName="ToolBox";const Uu=(e,t)=>e.map((e=>(e.children&&(e.children=Uu(e.children,t)),t(e)))),Gu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:l}=t.useContext(an),{tableRef:i,prefixCls:a,$size:o}=t.useContext($o),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=i.current.props,{t:m}=Un(),p=t.useRef([]),[h,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]);Fl((()=>{E(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,pn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.getComponentConfigApi;if(e)try{const n=yield e({key:t});if(200===n.code)return n.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(b,JSON.stringify(e)),w()):(null==l?void 0:l.getComponentConfigApi)&&E(r)})).catch((()=>{})),!e)return;return S(ta(e).map((e=>e.dataIndex)),ta(r).map((e=>e.dataIndex))).length>0?Uu(r,(t=>{const n=ra(e,t.dataIndex);return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Uu(e,(e=>{const t=ra(r,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},E=e=>{if(!b)return;const t=ea(e),n=JSON.parse(localStorage.getItem(b));var r,a;i.current.columnsDefined&&!C(t,n)&&(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,pn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},w=()=>{const e=x();var t;e&&(t=N(e),p.current=t,null==u||u(e))},N=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const l=n.colSpan;l>1&&e.slice(r+1,r+l).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+l))})),t},T=()=>{const e=ta(r),t=n=>n.filter((t=>e.find((e=>e.dataIndex===t.dataIndex)))).map((n=>{const r=e.find((e=>e.dataIndex===n.dataIndex)),l=Object.assign({},r,n);return delete l.renderWidth,void 0===n.hidden&&delete l.hidden,void 0===n.fixed&&delete l.fixed,void 0===n.width&&delete l.width,n.children&&(l.children=t(n.children)),l}));null==u||u(t(i.current.originColumns))},I=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:l}=n;if(0===r)return;if(1===r)return t.push(n);const i=p.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(l)));if(-1===i)return t.push(n);t.push(...p.current[i].map((({dataIndex:t},r)=>{const l=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(l.hidden=n.hidden),void 0!==n.fixed?l.fixed=n.fixed:l.fixed&&delete l.fixed),l})))})),r.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),null==u||u(t)},R=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,I(r))},O=(e,n)=>{var l;const{colSpan:i,noFixed:a}=e;if(0===i)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=Ta(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(de,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,I(r)}}),t.createElement("i",{className:Ae(s),title:m("qm.table.columnFilter.draggable")},t.createElement(We,null)),t.createElement("span",{className:"text",title:o},o),"main"===n?t.createElement("span",{className:Ae("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedLeft"),onClick:()=>R(e,"left")},t.createElement(wt,null)),t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedRight"),onClick:()=>R(e,"right")},t.createElement(Ct,null))):"sub"!==n?t.createElement("span",{className:Ae("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.cancelFixed"),onClick:()=>R(e)},t.createElement(Je,null))):null);return!e.hidden&&(null===(l=e.children)||void 0===l?void 0:l.length)?t.createElement(ge,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:k(e.children,e.dataIndex)},c):c},k=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement(Ut,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const l=t.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));C(l,i)||((e,t)=>{ra(r,t).children=e,null==u||u([...r])})(_a(t),n)}},e.map((e=>O(e,"sub"))))),L={[`${a}__popper`]:!0,"column-filter__popper":!0,[`${a}--lg`]:"large"===o,[`${a}--sm`]:"small"===o},A=[`${a}-column-filter`,{selected:h}];return s?t.createElement(ld,{action:["click"],popupVisible:h,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(Jn,{type:"text",size:"small",onClick:T},m("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(Ut,{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));C(t,n)||I([..._a(e),...y,...v])}},g.map((e=>O(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(Ut,{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));C(t,n)||I([...g,..._a(e),...v])}},y.map((e=>O(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(Ut,{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));C(t,n)||I([...g,...y,..._a(e)])}},v.map((e=>O(e,"right")))))),popupClassName:Ae(L),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Go,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Ae(A),title:d?m("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(Xe,null)),!d&&t.createElement("span",null,m("qm.table.columnFilter.text")))):null}));Gu.displayName="ColumnFilter";const Yu=t.createContext({}),Xu=()=>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"})),Qu=t.forwardRef(((e,n)=>{const{dataIndex:r,className:l,style:i}=e;return t.createElement("li",{ref:n,"data-index":r,className:Ae("list-item",l),style:i},e.children)}));Qu.displayName="ListItem";const Zu=t.forwardRef(((e,n)=>{var r,l;const{dataSource:i=[],height:a,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,m=t.useRef(null),p=yu({count:i.length,getScrollElement:()=>{var e;return(null===(e=m.current)||void 0===e?void 0:e.scrollElement)||null},estimateSize:()=>s||40,overscan:3,onChange:(e,t)=>null==d?void 0:d(e,t)}),h=p.getVirtualItems();t.useImperativeHandle(n,(()=>({SCROLL_TO_INDEX:e=>p.scrollToIndex(e),SCROLL_TO_OFFSET:e=>p.scrollToOffset(e)})));const f=nr("virtual-list");return t.createElement(xi,{ref:m,wrapStyle:{height:a,maxHeight:o},className:Ae(f,u),style:e.style},t.createElement("div",{className:"container",style:{height:p.getTotalSize()}},t.createElement("ul",{style:{transform:`translateY(${null!==(l=null===(r=h[0])||void 0===r?void 0:r.start)&&void 0!==l?l:0}px)`}},h.map((e=>t.createElement(Qu,{ref:p.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(i[e.index],e.index)))))))}));Zu.displayName="VirtualList";const Ju=e=>{const{column:n,isEnum:r,style:l,onChange:i}=e,{tableRef:a,$size:o,flattenColumns:s,isFetch:c,filters:d,superFilters:u,pagerFilter:m,setPagerFilter:p}=t.useContext($o),{dataKey:h,filterValue:f={}}=t.useContext(Yu),{t:g}=Un(),{getTitleFromCellValue:v}=ps(),y=h.split("|")[0],{recordsMap:b,tableOriginData:x,isOriginTree:E}=a.current,w=m,S=y;w[S];const N=un(w,["symbol"==typeof S?S:S+""]),T=t.useRef(!1),I=t.useMemo((()=>s.indexOf(n)),[s,n]),R=t.useRef(0),O=e=>{let t=oa((()=>{if(!(c||wn(d)&&wn(u))){const e=u.length?Ra(u):Ra(d);return Qi(x,e,E)}return x})());var r;e||(t=((e,t,n)=>{if(!Object.keys(t).length||!e.length)return e;if(!n)return e.filter((e=>Ha(e,t)));const r=new Map,l=new Set;for(const n of e)if(r.set(n._rowKey,n),Ha(n,t)){let e=n;for(;e&&!l.has(e._rowKey);)l.add(e._rowKey),e=r.get(e._parentRowKey)}return e.filter((e=>l.has(e._rowKey)))})(t,N,E),r=t.length,R.current=r);const l=new Map;return t.forEach((e=>{const t=va(e,y);l.has(t)||l.set(t,v(e,n,e.index,I))})),l},k=e=>r?[{text:g("qm.table.highSearch.nullText"),value:""},...n.filter.items||n.dictItems||[]]:Array.from(O(e).entries()).map((([e,t])=>({text:t,value:e}))),L=t.useMemo((()=>k()),[]),A=t.useMemo((()=>wn(N)?L:k(!0)),[]),[P,_]=t.useState(L),F=t.useMemo((()=>new Map(P.map((e=>[e.value,null])))),[P]),[D,M]=t.useState(""),[H,$]=t.useReducer(((e,t)=>{const n=t(e),r=[...new Set(n)];return C(e,r)?e:r}),(r?f.in:m[y])||A.map((e=>e.value))),q=t.useMemo((()=>Array.from(F.keys()).every((e=>H.includes(e)))),[H,F]),K=t.useMemo((()=>{const e=Array.from(F.keys()).filter((e=>H.includes(e)));return e.length>0&&e.length<P.length}),[H,P,F]),j=t.useMemo((()=>H.length===A.length),[H]);Fl((()=>{null==i||i(H,j)}),[H]),Fl((()=>{const e=j?null:H;if(!C(e,m[y]))return e?void p(Object.assign(Object.assign({},m),{[y]:e})):p(N)}),[P,H]);const V=si((e=>{const t=L.filter((t=>t.text.includes(e))),n=t.map((e=>e.value));_(t),$((e=>[...n,...e.filter((e=>!F.has(e)))]))}),200),z=e=>{M(e),T.current||V(e)};return t.createElement("div",{className:"list-panel",style:l},t.createElement(ne,{value:D,size:o,style:{width:200},placeholder:g("qm.table.filter.keywordSearch"),suffix:t.createElement(St,null),autoFocus:!0,allowClear:!0,onCompositionStart:()=>{T.current=!0},onCompositionEnd:e=>{T.current=!1,z(e.target.value)},onChange:e=>z(e.target.value)}),t.createElement("div",{className:"select-all"},t.createElement("div",{className:"action"},t.createElement(de,{checked:q,indeterminate:K,disabled:!P.length,onChange:e=>{$((t=>e.target.checked?[...t,...Array.from(F.keys())]:t.filter((e=>!F.has(e)))))}},g("qm.table.filter.selectAll")),t.createElement("i",{className:"divider"},"|"),t.createElement("button",{className:"btn invert",disabled:!P.length,onClick:()=>{$((e=>[...Array.from(F.keys()).filter((t=>!e.includes(t))),...e.filter((e=>!F.has(e)))]))}},g("qm.table.filter.invert"))),t.createElement("div",{className:"total"},r?null:`${b.size}/${R.current}`)),t.createElement(Zu,{className:"select-list",maxHeight:180,itemHeight:26,dataSource:P,renderItem:(e,n)=>t.createElement(t.Fragment,null,t.createElement(de,{key:n,checked:H.includes(e.value),onChange:t=>{$((n=>t.target.checked?[...n,e.value]:n.filter((t=>t!==e.value))))}},e.text),t.createElement("button",{className:"btn right",onClick:()=>{$((t=>{const n=[e.value,...t.filter((e=>!F.has(e)))];return C(t,n)?t:n}))}},g("qm.table.filter.onlyItem")))}))},em=t.forwardRef(((e,n)=>{const{value:r,style:l}=e,{$size:i,filters:a,pagerFilter:o,setPagerFilter:s}=t.useContext($o),{dataKey:c,onChange:d}=t.useContext(Yu),{t:u}=Un(),m=c.split("|")[0],p=e=>{if(!e){const e=a,t=c;e[t];return un(e,["symbol"==typeof t?t:t+""])}const t=Object.assign({},e);for(const e in t)(""===(n=t[e])||null==n)&&delete t[e];var n;return Object.keys(t).length?Object.assign({},a,{[c]:t}):p()},h=(e,t)=>{d(p(null!=e?e:r),null==t||t)};return t.useImperativeHandle(n,(()=>({doFinish:h}))),t.createElement(Q,{className:"footer",style:Object.assign(Object.assign({},l),{justifyContent:"flex-end"})},t.createElement(Jn,{size:i,onClick:()=>(()=>{if(o[m]){const e=o,t=m;e[t];const n=un(e,["symbol"==typeof t?t:t+""]);s(n)}d(p(),!0)})()},u("qm.table.filter.reset")),t.createElement(Jn,{type:"primary",size:i,onClick:()=>h()},u("qm.table.filter.search")))}));em.displayName="FooterPanel";const tm=e=>{const{column:n}=e,{$size:r}=t.useContext($o),{filterValue:l={}}=t.useContext(Yu),{t:i}=Un(),a=t.useRef(null),{openFilterList:o=!0}=n.filter,[s,c]=t.useState(Object.keys(l)[0]||"like"),[d,u]=t.useState(l[s]&&!Ma(s)?l[s]:""),m=t.useMemo((()=>d?{[s]:d}:Ma(s)?{[s]:1}:null),[s,d]),p=[{value:"like",label:i("qm.table.highSearch.inText")},{value:"nlike",label:i("qm.table.highSearch.ninText")},{value:"==",label:i("qm.table.highSearch.eqText")},{value:"!=",label:i("qm.table.highSearch.neqText")},{value:"^=",label:i("qm.table.highSearch.startsWithText")},{value:"=$",label:i("qm.table.highSearch.endsWithText")},{value:"nil",label:i("qm.table.highSearch.nullText")},{value:"nnil",label:i("qm.table.highSearch.notNullText")}];return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(ce,{value:s,options:p,size:r,className:"condition",style:{width:70,marginRight:6},onChange:e=>{c(e),Ma(e)&&u("")}}),t.createElement(ne,{value:d,size:r,autoFocus:!0,style:{width:124,paddingLeft:6,paddingRight:2},placeholder:i("qm.table.filter.searchText",{text:Ta(n.title)}),disabled:Ma(s),onChange:e=>{u(e.target.value)},onKeyDown:e=>{13===e.keyCode&&a.current.doFinish()}})),o&&t.createElement(Ju,{column:n,style:{marginTop:6}}),t.createElement(em,{ref:a,value:m}))},nm=e=>{var n,r;const{onChange:l}=e,{filterValue:i={}}=t.useContext(Yu),{t:a}=Un(),[o,s]=t.useState({nil:null!==(n=i.nil)&&void 0!==n?n:0,nnil:null!==(r=i.nnil)&&void 0!==r?r:0});return Fl((()=>{const e={};for(const t in o)o[t]&&(e[t]=1);l(e)}),[o]),t.createElement("div",{style:e.style},t.createElement(de,{checked:!!o.nil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nnil:0}:null,{nil:t})))}},a("qm.table.highSearch.nullText")),t.createElement(de,{checked:!!o.nnil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nil:0}:null,{nnil:t})))}},a("qm.table.highSearch.notNullText")))},rm=e=>{var n;const{column:r}=e,{$size:l}=t.useContext($o),{filterValue:i={}}=t.useContext(Yu),{t:a}=Un(),o=t.useRef(null),{openFilterList:s=!0}=r.filter,c="likes",[d,u]=t.useState(null!==(n=i[c])&&void 0!==n?n:""),[m,p]=t.useState({}),h=t.useMemo((()=>Object.keys(m).length?m:d?{[c]:d}:null),[d,m]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(ne.TextArea,{value:d,size:l,autoFocus:!0,placeholder:a("qm.table.filter.searchAreaText",{text:Ta(r.title)}),style:{width:200},disabled:!!Object.keys(m).length,onChange:e=>{u(e.target.value)},onKeyDown:e=>{13===e.keyCode&&o.current.doFinish()}})),t.createElement(nm,{style:{marginTop:6},onChange:e=>{Object.keys(e).length&&u(""),p(e)}}),s&&t.createElement(Ju,{column:r,style:{marginTop:6}}),t.createElement(em,{ref:o,value:h}))},lm=e=>{const{$size:n}=t.useContext($o),{filterValue:r={}}=t.useContext(Yu),{t:l}=Un(),i=t.useRef(null),[a,o]=t.useState(r),s=e=>({value:a[e],size:n,disabled:Object.keys(a).some((e=>Ma(e))),onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o((n=>Object.assign({},n,{[e]:t})))},onKeyDown:e=>{13===e.keyCode&&i.current.doFinish()}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement(me,Kn({},s(">"),{placeholder:l("qm.table.highSearch.gtText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement(me,Kn({},s("<"),{placeholder:l("qm.table.highSearch.ltText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement(me,Kn({},s("=="),{placeholder:l("qm.table.highSearch.eqText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement(me,Kn({},s("!="),{placeholder:l("qm.table.highSearch.neqText"),style:{width:150}}))))),t.createElement(nm,{style:{paddingLeft:20},onChange:e=>o(e)}),t.createElement(em,{ref:i,value:a}))},im=e=>{const{$size:n}=t.useContext($o),{filterValue:r={}}=t.useContext(Yu),{t:l}=Un(),[i,a]=t.useState(r),o=e=>({value:Ca(i[e],Wo),format:Wo,size:n,disabled:Object.keys(i).some((e=>Ma(e))),onChange:t=>{a((n=>Object.assign({},n,{[e]:Sa(t,Wo)})))}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement(qn,Kn({},o(">"),{placeholder:l("qm.table.highSearch.gtText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement(qn,Kn({},o("<"),{placeholder:l("qm.table.highSearch.ltText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement(qn,Kn({},o("=="),{placeholder:l("qm.table.highSearch.eqText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement(qn,Kn({},o("!="),{placeholder:l("qm.table.highSearch.neqText"),style:{width:"150px"}}))))),t.createElement(nm,{style:{paddingLeft:20},onChange:e=>a(e)}),t.createElement(em,{value:i}))},am=e=>{const{column:n}=e,r=t.useRef(null);return t.createElement(t.Fragment,null,t.createElement(Ju,{column:n,isEnum:!0,onChange:(e,t)=>{r.current.doFinish(t?null:{in:e},!1)}}),t.createElement(em,{ref:r,style:{display:"none"}}))},om=(e,t,n)=>{let r;for(let l=0;l<e.length;l++){const i=e[l];if(i.children)if(i.children.some((e=>e[n]===t)))r=i[n];else{const e=om(i.children,t,n);e&&(r=e)}}return r},sm=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&sm(e.children,t),t(e)||e.children&&e.children.length))),cm=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...cm(e.children,t)),t(e)&&n.push(e)})),n},dm=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=dm(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},um=(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:um(e.children,t,n,r)}):e)),mm=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...mm(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},pm=(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 l=pm(e[r].children,t,n);if(l)return[e[r][n],l].flat()}}},hm=(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(...hm(e,t)))),r},fm=t.forwardRef(((e,n)=>{const{className:r,style:l,filterable:i=!0,multiple:a,draggable:o,beforeDrop:s,dataSource:c,fetch:d,autoFocus:u,asyncLoad:m,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:f,fieldsDefine:g,value:v,height:y,defaultSelectedKeys:b=[],defaultExpandedKeys:E=[],defaultExpandAll:w=!0,showSearchBar:C=!0,showCollapse:S=!0,onSelectChange:N,onCheckChange:T,onDragStart:I,onDragChange:R,onExpand:O}=e,{$size:k}=Yn(e),{t:L}=Un(),A=(null==g?void 0:g.valueKey)||"value",P=(null==g?void 0:g.textKey)||"text";null==g||g.children;const _=t.useRef(null),F=t.useRef(null),M=ii(_),[H,$]=rs(y,{value:y}),[q,K]=t.useState(!1),j=si((()=>{$(_.current.offsetHeight-te.current.offsetHeight-10)}),5);oi((()=>{y||j()}),[M.height]);const[V,z]=t.useState([]),[W,B]=t.useState({}),[U,G]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),[J,ee]=t.useState(w),te=t.useRef(null),re=t.useRef([]),le=t.useRef([]);t.useEffect((()=>{Array.isArray(c)&&(ie(c),G(ae(c)),B({}))}),[c]),t.useEffect((()=>{var e;ce(),u&&(null===(e=F.current)||void 0===e||e.focus())}),[]),Fl((()=>{ce()}),[null==d?void 0:d.params]),Fl((()=>{X(se())}),[W]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=dm(V,(t=>e===t[A]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],ie([...V]))},REMOVE_RECORD:e=>{var t;const n=om(V,e,A);if(void 0===n&&V.find((t=>t[A]===e)))ie(V.filter((t=>t[A]!==e)));else{const r=dm(V,(e=>n===e[A]));if(!r)return;const l=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[A]));l>=0&&(r.children.splice(l,1),ie([...V]))}},UPDATE_RECORD:(e,t)=>{const n=dm(V,(t=>e===t[A]));n&&(D(n,t),ie([...V]))}})));const ie=e=>{z(e),re.current=e,le.current=mm(e,A)},ae=e=>{if(a)return b;const t=cm(e,(e=>b.includes(e[P])));return 1===t.length?[t[0][A]]:[]},oe=e=>{var t;return(null===(t=pm(V,e,A))||void 0===t?void 0:t.slice(0,-1))||[]},se=()=>{if(w)return le.current;const e=[];return U.forEach((t=>{if(a){if("SHOW_ALL"===h&&!le.current.includes(t)&&e.push(...oe(t)),"SHOW_CHILD"===h&&e.push(...oe(t)),"SHOW_PARENT"===h){const n=io(V,t);if(n){const r=oe(t),l=hm(n,A);e.push(...r,...[t,...l].filter((e=>le.current.includes(e))))}}}else e.push(...oe(t))})),[...new Set([...E,...e])]},ce=()=>pn(void 0,void 0,void 0,(function*(){var e;if(!d)return;const{api:t,params:n,dataKey:r,afterFetch:l,callback:i}=d;try{K(!0);const a=yield t(n);if(200===a.code){let t=Array.isArray(a.data)?a.data:null!==(e=x(a.data,r))&&void 0!==e?e:[];t="function"==typeof l?yield l(t):t,ie(t),G(ae(t)),B({}),null==i||i(t)}}catch(e){}K(!1)})),de=e=>`${e}|${Eo.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ue=nr("search-tree"),me={[ue]:!0,[`${ue}--lg`]:"large"===k,[`${ue}--sm`]:"small"===k};return t.createElement("div",{ref:_,className:Ae(me,r),style:l},t.createElement("div",{ref:te,className:"topper",style:{display:C||S?"":"none"}},C&&t.createElement(ne,{ref:F,value:Q,size:k,placeholder:f||L("qm.form.inputPlaceholder"),suffix:t.createElement(St,null),allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=sm(re.current,(t=>{if(!e)return!0;const n=t[P]||"";return-1!==de(n).indexOf(e)}));Z(e),z(t),X(w||e?mm(t,A):se())})(e.target.value)}),S&&t.createElement("a",{className:"trigger",onClick:()=>{ee(!J),X(J?[]:le.current)}},J?t.createElement(Pe,null):t.createElement(_e,null)," ",L(J?"qm.form.collect":"qm.form.spread"))),t.createElement(Jl,{spinning:q},t.createElement(ve,{fieldNames:{title:P,key:A,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:H,disabled:e.disabled,checkStrictly:p,selectedKeys:null!=v?v:U,checkedKeys:null!=v?v:U,expandedKeys:Y,treeData:V,loadData:m?({key:e,children:t})=>pn(void 0,void 0,void 0,(function*(){var n;if(!d||t)return;const{api:r,params:l,dataKey:i,formatter:a=(e=>e),afterFetch:o}=d;try{const t=yield r(a(Object.assign(Object.assign({},l),{[A]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=x(t.data,i))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const l=um(re.current,e,A,r);ie(l)}}catch(e){}})):void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!Q)return!1;const t=e[P]||"";return-1!==de(t).indexOf(Q)},onDragStart:I,onDragEnter:e=>{X(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),l=e.dropPosition-Number(r[r.length-1]);if(s){if(!1===s(e,V))return}const i=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][A]===t)return n(e[r],r,e);e[r].children&&i(e[r].children,t,n)}},a=[...V];let o;if(i(a,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===l)i(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];i(a,t,((t,r,l)=>{n=l,e=r})),-1===l?n.splice(e,0,o):n.splice(e+1,0,o)}else i(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));ie(a)},onDragEnd:e=>{null==R||R(e,V)},onExpand:(e,t)=>{wn(e)&&ee(!1),le.current.every((t=>e.includes(t)))&&ee(!0),X(e),null==O||O(e,t)},onSelect:e=>{G(e);const t=cm(re.current,(t=>e.includes(x(t,A))));null==N||N(a?t:t[0])},onCheck:e=>{p&&(e=e.checked),G(e),p||("SHOW_CHILD"===h&&(e=e.filter((e=>!le.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,n)=>!n.includes(om(V,e,A))))));const t=cm(re.current,(t=>e.includes(x(t,A))));null==T||T(a?t:t[0])}})))}));fm.displayName="QmSearchTree";const gm=e=>{var n;const{column:r}=e,{$size:l}=t.useContext($o),{filterValue:i={}}=t.useContext(Yu),a=t.useMemo((()=>r.filter.items||r.dictItems||[]),[]),o=t.useMemo((()=>{const e=[];return function t(n){n.forEach((n=>{Array.isArray(n.children)?t(n.children):e.push(n.value)}))}(a),e}),[a]),[s,c]=t.useState(null!==(n=i.in)&&void 0!==n?n:o),[d,u]=t.useState({}),m=t.useMemo((()=>Object.keys(d).length?d:s.length===o.length?null:{in:s}),[s,d]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"tree-panel",style:r.filter.style},t.createElement(fm,{multiple:!0,value:s,dataSource:a,disabled:!!Object.keys(d).length,size:l,style:{height:238},onCheckChange:e=>{c(e.map((e=>e.value)))}})),t.createElement(nm,{style:{marginLeft:-10,marginRight:-10,padding:"6px 0 0 20px",borderTop:"1px solid #e8e8e8"},onChange:e=>{Object.keys(e).length&&c([]),u(e)}}),t.createElement(em,{value:m}))},vm=e=>{const{column:n,filters:r}=e,{$size:l,prefixCls:i,pagerFilter:a,setFilters:o,clearSuperFilters:s}=t.useContext($o),{t:c}=Un(),[d,u]=t.useState(!1),m=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),p=t.useMemo((()=>!!Object.keys(r[m]||{}).length||!!a[n.dataIndex]),[r,a]),h=(e,t)=>{s(),o(e),t&&u(!1)},f=t.useMemo((()=>({dataKey:m,filterValue:r[m],onChange:h})),[r]);t.useEffect((()=>{"radio"===n.filter.type&&Zn("Table","表头筛选类型 `radio` 即将被弃用,请使用 `checkbox` 替代")}),[]);const g={text:e=>t.createElement(tm,{column:e}),textarea:e=>t.createElement(rm,{column:e}),number:e=>t.createElement(lm,{column:e}),date:e=>t.createElement(im,{column:e}),radio:e=>g.checkbox(e),checkbox:e=>t.createElement(am,{column:e}),tree:e=>t.createElement(gm,{column:e})},v={"head-filter__popper":!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l},y=["cell--filter",{selected:d,actived:p}];return t.createElement(ld,{action:["click"],popupVisible:d,popup:(()=>{const e=g[n.filter.type];return e?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement(Yu.Provider,{value:f},e(n))):(Zn("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Ae(v),popupStyle:{minWidth:150},onPopupVisibleChange:e=>u(e),builtinPlacements:Go,destroyPopupOnHide:!0,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:Ae(y),title:c("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(Xu,null))))},ym=e=>{const{column:n}=e,{tableRef:r,bordered:l}=t.useContext($o),{columns:i,resizable:a,columnsChange:o=vn}=r.current.props,s=t.useMemo((()=>ia(n)),[n]),c={resizable:!0,"is--line":a&&!l};return t.createElement("div",{className:Ae(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:l}=r.current,a=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=ha(t,n.$table).left-l.current.scrollLeft+c;n.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const m=s.width||s.renderWidth;let p=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||ls.defaultColumnWidth)||(p=Math.floor(n),a.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(ra(i,s.dataIndex).width=p,o([...i]))},!1}})},bm=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:l,fetchParams:i,setSelectionKeysEffect:a,setInvalidRowKeys:o,setSpinning:s,pagination:c,isFetch:d,isWebPagination:u,createWebPageData:m}=t.useContext($o),{t:p}=Un(),{selectionRows:h,recordsMap:f}=r.current,{rowSelection:g}=r.current.props,{fetchAllRowKeys:v,selectAllOnCurrentPage:y,filterable:b,onSelectAll:E}=g,w=t.useRef([]),C=t.useMemo((()=>d&&!!v),[d,v]),N=t.useMemo((()=>!C&&!!y),[C,y]),T=t.useMemo((()=>(null==b||b)&&!N),[b,N]),I=()=>{const{disabled:e}=g;return(e?h.filter((t=>!e(t))):h).map((e=>l(e,e.index)))},R=()=>u?oa(m()):Array.from(f.values()),O=t.useMemo((()=>(()=>{const{disabled:e}=g;if(C)return w.current.length?w.current:M(Array.from(f.keys()),I());if(!N)return e?Array.from(f.keys()).filter((t=>!e(f.get(t)))):Array.from(f.keys());const t=e?R().filter((t=>!e(t))).map((e=>l(e,e.index))):R().map((e=>l(e,e.index)));return M(t,I())})()),[f,w,h,c]),k=n.filter((e=>!O.includes(e))),L=n.length-k.length,A=L>0&&L<O.length,P=!!L&&L===O.length;o(k);const _=()=>pn(void 0,void 0,void 0,(function*(){var e;const t=v;let n=[];s(!0);try{const r=yield t.api(i);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=x(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:i}=g;i&&(n=S(n,R().filter((e=>i(e))).map((e=>l(e,e.index))))),w.current=n}}catch(e){}return s(!1),n})),F=e=>pn(void 0,void 0,void 0,(function*(){let t=[];t=C?e?yield _():[]:e?O.slice(0):[],t=[...new Set([...t,...k])],a(t),null==E||E(e,t)})),D=()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{F(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>pn(void 0,void 0,void 0,(function*(){let e=[];e=S(n,C?yield _():O),e=[...new Set([...e,...k])],a(e)}))},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{F(!1)}}];return t.createElement(fe,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(de,{checked:P,indeterminate:A,disabled:!O.length,onChange:e=>F(e.target.checked)}),T&&t.createElement(ue,{overlayClassName:"all-selection__popper",dropdownRender:()=>D()},t.createElement(_e,{className:"svgicon icon"})),N&&t.createElement(Y,{placement:"top",title:p("qm.table.selection.currentPage")},t.createElement(pt,{className:"info"})))},xm=e=>{const{style:n}=e,{tableRef:r,rowExpandedKeys:l,setRowExpandedKeys:i,createAllExpandedKeys:a,filters:o,pagerFilter:s,superFilters:c}=t.useContext($o),{expandable:d}=r.current.props,[u,m]=t.useState((null==d?void 0:d.defaultExpandAllRows)||!1);Fl((()=>{p(l)!==u&&m(!u)}),[l]),Fl((()=>{r.current.isTreeTable&&(wn(o)&&wn(s)&&wn(c)||xn((()=>!p(l)&&i(a()))))}),[o,s,c]);const p=e=>a().every((t=>e.includes(t))),h={[`${nr("expand")}--icon`]:!0,expanded:u,collapsed:!u};return t.createElement("span",{className:Ae(h),title:"",onClick:e=>{e.stopPropagation(),m(!u),i(u?[]:a())},style:n})},Em=()=>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"})),wm=()=>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"})),Cm=e=>{const{tableColumns:n}=e,{global:r}=t.useContext(an),{tableRef:l,prefixCls:i,layout:a,flattenColumns:o,sorter:s,filters:c,superFilters:d,pagerFilter:u,selectionKeys:m,isFetch:p,treeExpandIndex:h,tableChange:f,setSorter:g,setElementStore:v,resetTableScroll:y,getStickyLeft:b,getStickyRight:x,createTableFullData:E}=t.useContext($o),{ellipsis:w,resizable:C,multipleSort:S,rowSelection:N,expandable:T}=l.current.props,[I,R]=ls.sortDirections,{t:O}=Un(),k=t.useRef(null),L=t.useMemo((()=>!p),[p]),A=t.useMemo((()=>!(null==T?void 0:T.hideExpandAll)),[T]),P=t.useMemo((()=>!!N&&(p?!(!N.selectAllOnCurrentPage&&!N.fetchAllRowKeys):!N.hideSelectAll)),[p,N]),_=t.useMemo((()=>Object.fromEntries(Object.entries(s).filter((([e,t])=>null!==t)))),[s]);Fl((()=>{W(),j(!0),f(),y()}),[c,d]),Fl((()=>{U(),j(!0),f(),y()}),[u]),Fl((()=>{K(),f(),y()}),[s]),t.useEffect((()=>{!wn(c)&&xn((()=>W())),!wn(s)&&xn((()=>K()))}),[]),t.useLayoutEffect((()=>{F()}),[]);const F=()=>{v("$header",k.current)},D=(e,n,i)=>{var a,o;const{dataIndex:c,colSpan:d,rowSpan:u,fixed:m,align:p,theadAlign:h,theadWrap:f=(null==r?void 0:r.labelWrap),theadClassName:g="",sorter:v,filter:y,required:E,headRender:S}=e;if(0===d)return null;const N=h||p,T=["header--column",{"col--ellipsis":!f&&w,"col--center":"center"===N,"col--right":"right"===N,"column--required":!!E,"column-has-sorter":v,"column-has-filter":y,"column--sort":!!s[c],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&!(null===(a=i[n+(null!=d?d:1)])||void 0===a?void 0:a.fixed),"cell-fix-right-first":"right"===m&&!(null===(o=i[n-1])||void 0===o?void 0:o.fixed),[g]:!!g}],I={left:"left"===m?`${b(c)}px`:"",right:"right"===m?`${x(c,"thead")}px`:""},R=C&&![ls.expandableColumn,ls.selectionColumn].includes(c);return t.createElement("th",{key:c,className:Ae(T),colSpan:d,rowSpan:u,style:Object.assign({},I),onClick:t=>q(t,e)},t.createElement("div",{className:"cell--wrapper"},S?t.createElement("div",{className:"cell--text cell"},S(e,l.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},M(e)),y?$(e):null)),R&&t.createElement(ym,{column:e}))},M=e=>{const{dataIndex:n,type:r,sorter:i,title:a,description:o}=e;if(n===ls.selectionColumn&&"checkbox"===r){if("checkbox"===r)return t.createElement("div",{className:"cell"},P?t.createElement(bm,{selectionKeys:m}):O("qm.table.config.selectionText"));if("radio"===r)return t.createElement("div",{className:"cell"},a)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:Ta(a)},l.current.isTreeTable&&n===h&&A?t.createElement(xm,null):null,n===ls.expandableColumn&&A?t.createElement(xm,null):a)),o&&c.push(t.createElement(Y,{key:1,placement:"top",title:o},t.createElement(pt,{className:"tip"}))),i&&c.push(H(s[n])),c},H=e=>{const n=["svgicon cell--sorter__asc",{actived:e===I}],r=["svgicon cell--sorter__desc",{actived:e===R}];return t.createElement("div",{key:2,className:"cell--sorter",title:O("qm.table.sorter.text")},t.createElement("span",{className:Ae(n)},t.createElement(Em,null)),t.createElement("span",{className:Ae(r)},t.createElement(wm,null)))},$=e=>t.createElement(vm,{column:e,filters:c}),q=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=s[r],t=e?e===R?null:R:I;S?(delete s[r],g(Object.assign({},s,{[r]:t}))):g(Object.assign({},{[r]:t}))}},K=()=>{L&&j()},j=e=>{const t=Object.keys(_).length>0;e?t&&z(_):z(t?_:{index:I})},V=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,z=e=>{const t=((e,t)=>e.sort(((e,n)=>{for(const r in t){const l=o.find((e=>e.dataIndex===r)),i=t[r],a=va(e,r),s=va(n,r),c="function"!=typeof(null==l?void 0:l.sorter)?V(a,s):l.sorter(e,n);if(0!==c)return"ascend"===i?c:-c}return 0})).slice(0))(l.current.tableFullData,e);E(t)},W=()=>{L&&B()},B=()=>{const{tableOriginData:e,isOriginTree:t}=l.current,n=d.length?Ra(d):Ra(c);let r=Qi(e,L?n:"",t);r=$a(r,u,t),E(r)},U=()=>{B()},G=da(n),{tableBodyWidth:X}=a;return t.createElement("div",{ref:k,className:`${i}--header-wrapper`},t.createElement("table",{className:`${i}--header`,cellSpacing:"0",cellPadding:"0",style:{width:X?`${X}px`:""}},t.createElement("colgroup",null,o.map((e=>{const{dataIndex:n,width:r,renderWidth:l}=e;return t.createElement("col",{key:n,style:{width:`${r||l}px`,minWidth:`${r||l}px`}})}))),t.createElement("thead",null,(e=>e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>D(t,n,e)))))))(G))))},Sm=t.createContext([]),Nm=(e,t,n,r,l,i,a,o,s,c)=>{var d;const{clientX:u,clientY:m}=e,{top:p,height:h}=e.target.getBoundingClientRect(),f=(((null==l?void 0:l.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=Tm(o,n.eventKey);if(m<p+h/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=Tm(o,t)}const y=v.key,b=v,x=v.key;let E=0,w=0;if(!g.includes(y))for(let e=0;e<f&&Rm(v);e+=1)v=v.parent,w+=1;const C=t.data,S=v.node;let N=!0;return Om(v)&&0===v.level&&m<p+h/2&&i({dragNode:C,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?i({dragNode:C,dropNode:S,dropPosition:0})?E=0:N=!1:0===w?f>-1.5?i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:i({dragNode:C,dropNode:S,dropPosition:0})?E=c?1:0:i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:w,dropTargetKey:v.key,dropTargetPos:v.pos,dragOverNodeKey:x,dropContainerKey:0===E?null:(null===(d=v.parent)||void 0===d?void 0:d.key)||null,dropAllowed:N}},Tm=(e,t)=>e[t],Im=e=>e.split("-"),Rm=e=>{if(e.parent){const t=Im(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Om=e=>{const t=Im(e.pos);return 0===Number(t[t.length-1])},km=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:l,setRowExpandedKeys:i,createTableData:a,dataChange:o}=t.useContext($o),{tableFullData:s,recordsMap:c,isTreeTable:d}=n.current,{beforeRowDrop:u}=n.current.props,m=yn,p=t.useRef(null),h=t.useRef(null),f=t.useRef(null),g=t.useRef(),[v,y]=t.useState({}),[b,x]=t.useState(null),[E,w]=t.useState([]),[C,S]=t.useState(0),[N,T]=t.useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),I=e=>{T((t=>Object.assign({},t,e)))};t.useLayoutEffect((()=>{e&&y((e=>{const t={},n=(e,l=null,i=0)=>{const a=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:i,node:e,parent:l,pos:(d=(null==l?void 0:l.pos)||"0",u=o,`${d}-${u}`),nodes:[...(null==l?void 0:l.nodes)||[],e]};var d,u;Array.isArray(e.children)&&(c.children=n(e.children,c,i+1)),t[s]=c,a.push(c)})),a};return n(e),t})(s))}),[s]),t.useEffect((()=>()=>{window.removeEventListener("dragend",k)}),[]);const R=()=>{I({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},O=()=>{null!==b&&(x(null),I({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),h.current=null,f.current=null},k=e=>{L(),window.removeEventListener("dragend",k)},L=(e,t,n)=>{I({dragOverNodeKey:null}),O(),p.current=null,window.removeEventListener("dragend",k)},A=e=>{const t=e.node.eventKey,n=e.dragNode.eventKey,l=e.node.pos.split("-"),i=e.dropPosition-Number(l[l.length-1]);if(u){if(!1===u({dragNode:e.dragNode.data,dropPosition:e.dropPosition,dropToGap:e.dropToGap,dragNodesKeys:e.dragNodesKeys,node:e.node.data,event:e.event},s))return}const c=(e,t,n)=>{for(let l=0;l<e.length;l++){if(r(e[l],e[l].index)===t)return n(e[l],l,e);e[l].children&&c(e[l].children,t,n)}},d=[...s];let m;if(c(d,n,((e,t,n)=>{n.splice(t,1),m=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,l)=>{n=l,e=r})),-1===i?n.splice(e,0,m):n.splice(e+1,0,m)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(m)}));a(d),o()};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;p.current=t,h.current={x:e.clientX,y:e.clientY};const r=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(l,n);x(n),w(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Tm(t,e).children),n})(n,v)),S(2*ls.treeTable.textIndent),i(r),window.addEventListener("dragend",k)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(f.current!==n&&(f.current=n),!p.current)return void R();const{dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:u,dropAllowed:y,dragOverNodeKey:x}=Nm(e,p.current,t,C,h.current,m,Array.from(c.keys()),v,l,!d);-1===E.indexOf(o)&&y?(g.current||(g.current={}),Object.keys(g.current).forEach((e=>{clearTimeout(g.current[e])})),p.current.eventKey!==n&&(e.persist(),g.current[n]=window.setTimeout((()=>{var e;if(null===b)return;let t=[...l];const r=Tm(v,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})(l,n)),i(t)}),800)),p.current.eventKey!==o||0!==a?I({dragOverNodeKey:x,dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:u,dropAllowed:y}):R()):R()},onNodeDragOver:(e,t)=>{if(!p.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:i,dropContainerKey:a,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:u}=Nm(e,p.current,t,C,h.current,m,Array.from(c.keys()),v,l,!d);-1===E.indexOf(i)&&o&&(p.current.eventKey===i&&0===r?null===N.dropPosition&&null===N.dropLevelOffset&&null===N.dropTargetKey&&null===N.dropContainerKey&&null===N.dropTargetPos&&!1===N.dropAllowed&&null===N.dragOverNodeKey||R():n===N.dropPosition&&r===N.dropLevelOffset&&i===N.dropTargetKey&&a===N.dropContainerKey&&s===N.dropTargetPos&&o===N.dropAllowed&&u===N.dragOverNodeKey||I({dropPosition:n,dropLevelOffset:r,dropTargetKey:i,dropContainerKey:a,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:u}))},onNodeDragLeave:(e,t)=>{f.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(R(),f.current=null)},onNodeDragEnd:L,onNodeDrop:(e,t,n=!1)=>{const{dropPosition:r,dropTargetKey:l,dropTargetPos:i,dropAllowed:a,dragOverNodeKey:o}=N;if(!a)return;if(I({dragOverNodeKey:null}),O(),null===l)return;const s=Object.assign(Object.assign({},((e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const l=Tm(r,e);return{eventKey:e,pos:l?l.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}})(l,{dropPosition:r,dragOverNodeKey:o,keyEntities:v})),{data:Tm(v,l).node});-1!==E.indexOf(l)&&Zn("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=Im(i),d={event:e,node:s,dragNode:p.current,dragNodesKeys:[p.current.eventKey].concat(E),dropToGap:0!==r,dropPosition:r+Number(c[c.length-1])};n||A(d),p.current=null},indent:C,dropOptions:N}};function Lm(){const[,t]=e.useReducer((e=>e+1),0);return t}const Am=t.forwardRef(((e,n)=>{const{rowKey:r,rowIndex:l,row:i,className:a,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:p,onNodeDragLeave:h,onNodeDragEnd:f,onNodeDrop:g}=e,v=t.useRef({eventKey:r,data:i,props:e}),y=t.useRef(!1),[b,x]=t.useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===r&&0===E,I=C===r&&-1===E,R=C===r&&1===E,O=i._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const L={"body--row-draggable":!0,"body--row-dragging":b,"drop-target":S===r,"drop-container":N===r,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return t.createElement("tr",{ref:n,"data-row-key":r,"data-row-index":l,className:Ae(a,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),y.current=t)},onDragStart:e=>{if(e.stopPropagation(),y.current)return e.preventDefault();x(!0),u(e,v.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,v.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),p(e,v.current)},onDragLeave:e=>{e.stopPropagation(),h(e,v.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,v.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,v.current)}},e.children,C===r&&null!==E&&null!==w&&t.createElement("td",{className:"drop-indicator",style:k}))}));Am.displayName="DraggableTr";const Pm=e=>{const{selectionKeys:n,column:r,record:l,rowKey:i}=e,{tableRef:a}=t.useContext($o),{rowSelection:o}=a.current.props,s=t.useMemo((()=>r.type||""),[r.type]),c=e=>{var t,r;const{isTreeTable:l,tableFullData:i}=a.current,s=null===(t=o.checkStrictly)||void 0===t||t;if(!l||s)return!1;const c=La(i,(t=>t._rowKey===e));return((e,t)=>{const n=new Set(t);let r=!1,l=!1;for(const t of e)if(n.has(t)?r=!0:l=!0,r&&l)break;return r&&l})(ca(null!==(r=null==c?void 0:c.children)&&void 0!==r?r:[],(e=>e._rowKey)),n)};return"radio"===s?(()=>{const e=o.disabled,r=null==e?void 0:e(l),a=!r&&n[0]===i;return t.createElement(he,{checked:a,disabled:r})})():(()=>{const e=o.disabled,r=null==e?void 0:e(l),a=!!n.includes(i);return t.createElement(de,{checked:a,indeterminate:c(i),disabled:r})})()},_m=e=>{const{record:n,rowKey:r,style:l}=e,{tableRef:i,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext($o),{expandable:s={}}=i.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);Fl((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${nr("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:Ae(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];o(t)},style:l})},Fm=t.createContext({}),Dm=t.forwardRef(((e,n)=>{var r;const{$size:l,doFieldValidate:i}=t.useContext($o),{dataKey:a,doFieldUpdate:o,cellValueChange:s}=t.useContext(Fm),{column:c,row:d,rowKey:u,columnKey:m,options:p,isTextArea:h}=e,{t:f}=Un(),g=Lm(),v=t.useRef(!1),{dataIndex:y}=c,{type:b,extra:x={},rules:E=[],onInput:w,onChange:C,onEnter:S,onBlur:N}=p,T=va(d,y),I=Object.assign({},{minRows:1,maxRows:4},x.autoSize),R=h?{rows:I.minRows,autoSize:I}:null,O=x.password?ne.Password:h?ne.TextArea:ne;return t.createElement(O,Kn({ref:n,size:l,value:T,maxLength:x.maxLength,showCount:x.showCount},R,{autoComplete:x.password?"new-password":"off",placeholder:null!==(r=x.placeholder)&&void 0!==r?r:f("qm.table.editable.inputPlaceholder"),allowClear:x.allowClear,readOnly:x.readOnly,disabled:x.disabled,suffix:x.suffix,onChange:e=>{var t;const n=null!==(t=e.target.value)&&void 0!==t?t:"";ya(d,y,n),i(E,n,u,m,Ta(c.title)),g(),null==w||w({[a]:n}),v.current=!0},onBlur:e=>{var t;const n=null!==(t=e.target.value)&&void 0!==t?t:"";v.current&&(v.current=!1,o(d,u,m),null==C||C({[a]:n},d),null==N||N({[a]:n},d),s())},onKeyUp:e=>{var t;if(13===e.keyCode&&!e.shiftKey){const n=null!==(t=e.target.value)&&void 0!==t?t:"";null==S||S({[a]:n},d)}},onKeyDown:e=>{h&&13===e.keyCode&&!e.shiftKey&&S&&e.preventDefault()}}))}));Dm.displayName="TextCell";const Mm=t.forwardRef(((e,n)=>{const{size:r,defaultValue:l,value:i,min:a,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:m,stringMode:p,allowClear:h,readOnly:f,disabled:g,formatter:v=(e=>e.toString()),parser:y=(e=>e),onFocus:b}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<a&&(t=a.toString()),m>=0&&""!==t&&(t=new Gt(t).toFixed(m)),t},E=void 0!==i,[w,C]=t.useState(null!=l?l:""),S=v(E?i:w),N=y(S);Fl((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[w]);return t.createElement(ne,{ref:n,size:r,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,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===m&&n.includes(".")&&(r=!1),a>=0&&n.startsWith("-")&&(r=!1),r){if(!p&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{var n;E?null===(n=e.onChange)||void 0===n||n.call(e,t):C(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(N);null===(t=e.onBlur)||void 0===t||t.call(e,n,N)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(N),N))}})}));Mm.displayName="InputNumber";const Hm=t.forwardRef(((e,n)=>{var r,l;const{$size:i,doFieldValidate:a}=t.useContext($o),{dataKey:o,doFieldUpdate:s,cellValueChange:c}=t.useContext(Fm),{column:d,row:u,rowKey:m,columnKey:p,options:h}=e,{t:f}=Un(),g=Lm(),v=t.useRef(!1),{dataIndex:y,precision:b,formatType:x}=d,{type:E,extra:w={},rules:C=[],onInput:S,onChange:N,onEnter:T,onBlur:I}=h,R=va(u,y);let O,k;"finance"===x&&(O=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},k=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===x&&(O=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Gt(e).times(100).toNumber()}`,k=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Gt(e).times(.01).toString());const L=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"";return t.createElement(Mm,{ref:n,size:i,value:R,min:w.min,max:w.max,precision:b,stringMode:w.stringMode,prefix:w.prefix,suffix:null!==(r=w.suffix)&&void 0!==r?r:"percent"===x?"%":void 0,placeholder:null!==(l=w.placeholder)&&void 0!==l?l:f("qm.table.editable.inputPlaceholder"),maxLength:w.maxLength,allowClear:w.allowClear,readOnly:w.readOnly,disabled:w.disabled,formatter:O,parser:k,onChange:e=>{ya(u,y,e),a(C,e,m,p,Ta(d.title)),g(),null==S||S({[o]:e}),v.current=!0},onBlur:(e,t)=>{if(!v.current)return;v.current=!1;let n=w.stringMode?e:L(e);"percent"===x&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),ya(u,y,n),s(u,m,p),null==N||N({[o]:n},u),null==I||I({[o]:n},u),c()},onEnter:(e,t)=>{let n=w.stringMode?e:L(e);"percent"===x&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),null==T||T({[o]:n},u)}})}));Hm.displayName="NumberCell";const $m=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext($o),{dataKey:a,doFieldUpdate:o,cellValueChange:s}=t.useContext(Fm),{column:c,row:d,rowKey:u,columnKey:m,options:p,isMultiple:h}=e,{t:f}=Un();Lm();const{dataIndex:g,dictItems:v=[]}=c,{type:y,extra:b={},rules:x=[],items:E,onChange:w,onEnter:C}=p,S=E||v,N=va(d,g);let T=N;return t.createElement(ce,{mode:h?"multiple":void 0,size:l,popupClassName:ls.popupClassName,value:N||void 0,placeholder:null!==(n=b.placeholder)&&void 0!==n?n:f("qm.table.editable.selectPlaceholder"),allowClear:b.allowClear,listHeight:b.listHeight,maxTagCount:b.collapseTags?"responsive":void 0,maxTagTextLength:b.maxTagTextLength,disabled:b.disabled,style:{width:"100%"},showSearch:null===(r=b.filterable)||void 0===r||r,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${Eo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{ya(d,g,e),i(x,e,u,m,Ta(c.title)),o(d,u,m),null==w||w({[a]:e},d),s()},onSelect:e=>{T=e},onInputKeyDown:e=>{13===e.keyCode&&xn((()=>null==C?void 0:C({[a]:T},d)))}},S.map((e=>t.createElement(ce.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},qm=e=>{var n;const{$size:r,doFieldValidate:l}=t.useContext($o),{dataKey:i,doFieldUpdate:a,cellValueChange:o}=t.useContext(Fm),{column:s,row:c,rowKey:d,columnKey:u,options:m,dateType:p}=e;Un(),Lm();const{dataIndex:h}=s,{type:f,extra:g={},rules:v=[],onChange:y}=m,b=va(c,h);return t.createElement(qn,{size:r,popupClassName:ls.popupClassName,value:null!==(n=Ca(b,Ga[p]))&&void 0!==n?n:void 0,picker:Ua[p],format:g.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=g;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:g.placeholder,allowClear:g.allowClear,disabled:g.disabled,style:{width:"100%"},onChange:e=>{const t=Sa(e,Ga[p]);ya(c,h,t),l(v,t,d,u,Ta(s.title)),a(c,d,u),null==y||y({[i]:t},c),o()}})},Km=e=>{var n;const{$size:r,doFieldValidate:l}=t.useContext($o),{dataKey:i,doFieldUpdate:a,cellValueChange:o}=t.useContext(Fm),{column:s,row:c,rowKey:d,columnKey:u,options:m}=e;Un(),Lm();const{dataIndex:p}=s,{type:h,extra:f={},rules:g=[],onChange:v}=m,y="HH:mm:ss",b=va(c,p);return t.createElement(jn,{size:r,popupClassName:ls.popupClassName,value:null!==(n=Ca(b,y))&&void 0!==n?n:void 0,format:f.format||y,placeholder:f.placeholder,allowClear:f.allowClear,disabled:f.disabled,style:{width:"100%"},onChange:e=>{const t=Sa(e,y);ya(c,p,t),l(g,t,d,u,Ta(s.title)),a(c,d,u),null==v||v({[i]:t},c),o()}})},jm=e=>{const{$size:n,doFieldValidate:r}=t.useContext($o),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Fm),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e;Un(),Lm();const{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],onChange:g}=u,{trueValue:v=Vo,falseValue:y=zo,disabled:b}=h,x=va(s,m);return t.createElement(de,{checked:x===v,disabled:b,onChange:e=>{const t=e.target.checked?v:y;ya(s,m,t),r(f,t,c,d,Ta(o.title)),i(s,c,d),null==g||g({[l]:t},s),a()}})},Vm=e=>{const{$size:n,doFieldValidate:r}=t.useContext($o),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Fm),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e;Un(),Lm();const{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],onChange:g}=u,{trueValue:v=Vo,falseValue:y=zo,disabled:b}=h,x=va(s,m);return t.createElement(ye,{checked:x===v,disabled:b,onChange:e=>{const t=e?v:y;ya(s,m,t),r(f,t,c,d,Ta(o.title)),i(s,c,d),null==g||g({[l]:t},s),a()}})},zm=e=>{const{$size:n,doFieldValidate:r}=t.useContext($o),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Fm),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],render:g,onChange:v}=u;if(!g)return Zn("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const y=va(s,m),b=e=>{ya(s,m,e),r(f,e,c,d,Ta(o.title)),i(s,c,d),null==v||v({[l]:e},s),a()},x=g(s,o,b);return t.isValidElement(x)?t.cloneElement(x,{value:y,disabled:h.disabled,readOnly:h.readOnly,popupClassName:ls.popupClassName,onChange:b}):null},Wm=e=>{var n,r,l;const{multiple:i,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=Yn(e),{t:m}=Un(),[p,h]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${nr("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},Sn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:Ae(g,s),style:c},t.createElement(fm,{multiple:i,fetch:v,fieldsDefine:{valueKey:null===(r=a.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(l=a.fetch)||void 0===l?void 0:l.textKey},autoFocus:!0,asyncLoad:a.asyncLoad,checkStrictly:a.checkStrictly,checkStrategy:a.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:a.defaultExpandAll,onSelectChange:e=>h(e),onCheckChange:e=>h(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ho[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Jn,{onClick:()=>d(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(Jn,{type:"primary",disabled:!p,onClick:()=>d(p)},m("qm.dialog.confirm"))))};Wm.displayName="TreeHelper";const Bm=t.forwardRef(((e,n)=>{var r,l,i,a;const{$size:o,flattenColumns:s,doFieldValidate:c}=t.useContext($o),{dataKey:d,visible:u,setVisible:m,doFieldUpdate:p,cellValueChange:h}=t.useContext(Fm),{column:g,row:v,rowKey:y,columnKey:b,options:x}=e,{t:E}=Un();Lm();const w=!!(null===(r=x.helper)||void 0===r?void 0:r.combinedDataIndex),{dataIndex:C,precision:S}=g,{type:N,extra:T={},rules:I=[],helper:R={},onChange:O,onEnter:k}=x,L=ba(v,w?R.combinedDataIndex:C),A=R.fieldAliasMap;A||Zn("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof A?A():A||{};Object.keys(P).includes(C)||Zn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),w&&(R.combinedDataIndex.split("|").every((e=>Object.keys(P).includes(e)))||Zn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),P[C].includes("|")&&Zn("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const _=e=>{const{beforeOpen:t}=R,n=(null!=t?t:yn)({[d]:L},v,g);(null==n?void 0:n.then)?n.then((()=>{m(!0),null==e||e()})).catch((()=>{})):!1!==n&&(m(!0),null==e||e())},F=()=>{m(!1)},D=(e="",t)=>{var n;if(f(t)&&Object.keys(t).length)for(const e in t){const r=t[e],l=s.find((t=>t.dataIndex===e));if(l){ya(v,e,r,l.precision);const t=null===(n=l.editRender)||void 0===n?void 0:n.call(l,v,l);t&&Array.isArray(t.rules)&&c(t.rules,r,y,e,Ta(l.title))}else ya(v,e,r)}ya(v,C,e,S),c(I,e,y,b,Ta(g.title)),p(v,y,b),null==O||O({[d]:e},v),h()},M={visible:u,title:E("qm.searchHelper.text"),width:null!==(l=R.width)&&void 0!==l?l:"40%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${Ho[o]+20}px`},onClose:()=>{F()}},H=Object.assign(Object.assign({},R),{defaultSelectedKeys:[L],size:o,onClose:e=>{e?(e=>{const t={};for(const n in P){const r=P[n];n!==C&&(t[n]=ba(e,r))}const n=P[C]?ba(e,P[C]):"";D(n,t);const{closed:r}=R;m(!1),null==r||r(e)})(e):F()}});return t.createElement(t.Fragment,null,t.createElement(ne.Search,{ref:n,value:L,allowClear:null===(i=T.allowClear)||void 0===i||i,readOnly:T.readOnly,disabled:T.disabled,placeholder:null!==(a=T.placeholder)&&void 0!==a?a:E("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!u&&_())},onDoubleClick:()=>{_()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?_():D(""))}}),t.createElement(Di,M,t.createElement(Wm,H)))}));Bm.displayName="TreeHelperCell";const Um=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext($o),{dataKey:a,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=t.useContext(Fm),{column:u,row:m,rowKey:p,columnKey:h,options:f}=e,{t:g}=Un();Lm(),t.useLayoutEffect((()=>{f.items&&E(f.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const[v,y]=t.useState(f.items||[]),b=t.useRef({}),x=t.useRef([]),E=e=>x.current=e,{dataIndex:w}=u,{type:C,extra:S={},items:N=[],rules:T=[],helper:I={},onInput:R,onChange:O,onEnter:k}=f,L=va(m,w),A=I.fieldAliasMap;A||Zn("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof A?A():A||{};Object.keys(P).includes("valueKey")&&Object.keys(P).includes("textKey")||Zn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=P;const _=e=>{const{beforeOpen:t}=I,n=(null!=t?t:yn)({[a]:L},m,u);(null==n?void 0:n.then)?n.then((()=>{s(!0),null==e||e()})).catch((()=>{})):!1!==n&&(s(!0),null==e||e())},F=()=>{s(!1)},M=e=>{ya(m,w,e),i(T,e,p,h,Ta(u.title)),c(m,p,h),null==O||O({[a]:e},m,x.current),d()},H={visible:o,title:g("qm.searchHelper.text"),width:null!==(n=I.width)&&void 0!==n?n:"40%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${Ho[l]+20}px`},onClose:()=>{F()}},$=Object.assign(Object.assign({},I),{size:l,multiple:!0,initialValue:D({},I.initialValue),defaultSelectedKeys:L,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=P;E(e);const r=x.current.map((e=>({text:e[t],value:e[n]})));y(r),M(r.map((e=>e.value)));const{closed:l}=I;s(!1),null==l||l(x.current)})(e):F()}});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(ce,{mode:"multiple",open:!1,value:L,placeholder:null!==(r=S.placeholder)&&void 0!==r?r:g("qm.table.editable.selectPlaceholder"),allowClear:S.allowClear,maxTagCount:S.collapseTags?"responsive":void 0,maxTagTextLength:S.maxTagTextLength,disabled:S.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!o&&_()},onDoubleClick:()=>{S.disabled||_()},onChange:e=>{const{valueKey:t}=P;E(x.current.filter((n=>e.includes(n[t])))),M(e)}},v.map((e=>t.createElement(ce.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(G,{className:"ant-input-search-button",disabled:S.disabled,icon:t.createElement(St,null),onClick:()=>{_()}})))),t.createElement(Di,H,t.createElement(Wm,$)))},Gm=t.forwardRef(((e,n)=>{var r,l,i;const{$size:a,flattenColumns:o,doFieldValidate:s}=t.useContext($o),{dataKey:c,visible:d,setVisible:u,setMatching:m,doFieldUpdate:p,cellValueChange:h}=t.useContext(Fm),{column:g,row:v,rowKey:y,columnKey:b,options:E}=e,{t:w}=Un();Lm();const C=!!(null===(r=E.helper)||void 0===r?void 0:r.combinedDataIndex),S=t.useRef(!1),N=t.useRef({}),[T,I]=t.useState(),{dataIndex:R,precision:O}=g,{type:k,extra:L={},rules:A=[],helper:P={},onInput:_,onChange:F,onEnter:M}=E,H=ba(v,C?P.combinedDataIndex:R),$=P.fieldAliasMap;$||Zn("Table","helper 需要配置 `fieldAliasMap` 选项");const q="function"==typeof $?$():$||{};Object.keys(q).includes(R)||Zn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),C&&(P.combinedDataIndex.split("|").every((e=>Object.keys(q).includes(e)))||Zn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),q[R].includes("|")&&Zn("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const K=e=>{const{filterAliasMap:t}=P,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],l={[R]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(f(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},j=e=>{const{autoQueryAssign:t=!0}=P;t&&(N.current=K(e)),u(!0)},V=(e,t)=>{const{beforeOpen:n}=P,r=(null!=n?n:yn)({[c]:H},v,g);(null==r?void 0:r.then)?r.then((()=>{j(e),null==t||t()})).catch((()=>{})):!1!==r&&(j(e),null==t||t())},z=e=>{const t={};for(const n in q){const r=q[n];n!==R&&(t[n]=ba(e,r))}const n=q[R]?ba(e,q[R]):"";B(n,t);const{closed:r}=P;u(!1),null==r||r(e)},W=()=>{const{onlySelect:e=!0}=P;S.current&&B(e?"":H),u(!1)},B=(e="",t)=>{var n;if(f(t)&&Object.keys(t).length)for(const e in t){const r=t[e],l=o.find((t=>t.dataIndex===e));if(l){ya(v,e,r,l.precision);const t=null===(n=l.editRender)||void 0===n?void 0:n.call(l,v,l);t&&Array.isArray(t.rules)&&s(t.rules,r,y,e,Ta(l.title))}else ya(v,e,r)}C&&!e&&((e,t,n,r)=>{if(!t.includes("|"))return ya(e,t,n,r);const l=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&ya(e,t,null===(r=l[n])||void 0===r?void 0:r.trim())}))})(v,P.combinedDataIndex,""),ya(v,R,e,O),s(A,e,y,b,Ta(g.title)),p(v,y,b),null==F||F({[c]:e},v),h(),N.current={},S.current=!1,I(void 0)},U={visible:d,title:w("qm.searchHelper.text"),width:null!==(l=P.width)&&void 0!==l?l:"60%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${Ho[a]+20}px`},onClose:()=>{W()}},G=Object.assign(Object.assign({},P),{size:a,initialValue:Object.assign({},N.current,P.initialValue),onClose:e=>{e?z(e):W()}});return t.createElement(t.Fragment,null,t.createElement(ne.Search,{ref:n,value:null!=T?T:H,placeholder:null!==(i=L.placeholder)&&void 0!==i?i:w("qm.table.editable.selectPlaceholder"),allowClear:L.allowClear,readOnly:L.readOnly,disabled:L.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:l}=P;if(S.current&&!d)return n&&r&&(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=P,{beforeFetch:r=yn}=t.fetch;return new Promise(((l,i)=>pn(void 0,void 0,void 0,(function*(){var a;const o=D({},t.fetch.params,Object.assign(Object.assign({},n),K(e)),{currentPage:1,pageSize:500});if(!r(o))return i();m(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=x(e.data,t.fetch.dataKey))&&void 0!==a?a:[];l(n)}else i()}catch(e){i(e)}finally{xn((()=>m(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>ba(e,q[R]).toString().includes(t)));if(1===n.length)return z(n[0]);V(t)})(e,n))).catch((()=>B(""))):void B(n)},onChange:e=>{const{value:t}=e.target;null==_||_({[c]:t}),S.current=!0,I(t)},onKeyDown:e=>{var t;if(13===e.keyCode){const n=null!==(t=e.target.value)&&void 0!==t?t:"";!d&&V(n)}},onDoubleClick:e=>{const{value:t}=e.target;V(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&V(e)}}),t.createElement(Di,U,t.createElement(sp,G)))}));Gm.displayName="SearchHelperCell";const Ym=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext($o),{dataKey:a,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=t.useContext(Fm),{column:u,row:m,rowKey:p,columnKey:h,options:f}=e,{t:g}=Un();Lm();const[v,y]=t.useState(f.items||[]),b=t.useRef({}),x=t.useRef([]),E=e=>x.current=e;t.useLayoutEffect((()=>{f.items&&E(f.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const{dataIndex:w}=u,{type:C,items:S=[],extra:N={},rules:T=[],helper:I={},onInput:R,onChange:O,onEnter:k}=f,L=va(m,w),A=I.fieldAliasMap;A||Zn("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof A?A():A||{};Object.keys(P).includes("valueKey")&&Object.keys(P).includes("textKey")||Zn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=P;const _=e=>{const{beforeOpen:t}=I,n=(null!=t?t:yn)({[a]:L},m,u);(null==n?void 0:n.then)?n.then((()=>{s(!0),null==e||e()})).catch((()=>{})):!1!==n&&(s(!0),null==e||e())},F=()=>{s(!1)},M=e=>{ya(m,w,e),i(T,e,p,h,Ta(u.title)),c(m,p,h),null==O||O({[a]:e},m,x.current),d()},$={visible:o,title:g("qm.searchHelper.text"),width:null!==(n=I.width)&&void 0!==n?n:"60%",loading:!1,wrapClassName:ls.popupClassName,bodyStyle:{paddingBottom:`${Ho[l]+20}px`},onClose:()=>{F()}},q=Object.assign(Object.assign({},I),{size:l,multiple:!0,initialValue:D({},I.initialValue),defaultSelectedKeys:L,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=P;E(H([...x.current.filter((e=>t.includes(e[r]))),...e],r));const l=x.current.map((e=>({text:e[n],value:e[r]}))),i=H([...l,...S],"value").filter((e=>t.includes(e.value)));y(i),M(i.map((e=>e.value)));const{closed:a}=I;s(!1),null==a||a(x.current)})(e,t):F()}});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(ce,{mode:"multiple",open:!1,value:L,placeholder:null!==(r=N.placeholder)&&void 0!==r?r:g("qm.table.editable.selectPlaceholder"),allowClear:N.allowClear,maxTagCount:N.collapseTags?"responsive":void 0,maxTagTextLength:N.maxTagTextLength,disabled:N.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!o&&_()},onDoubleClick:()=>{N.disabled||_()},onChange:e=>{const{valueKey:t}=P;E(x.current.filter((n=>e.includes(n[t])))),M(e)}},v.map((e=>t.createElement(ce.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(G,{className:"ant-input-search-button",disabled:N.disabled,icon:t.createElement(St,null),onClick:()=>{_()}})))),t.createElement(Di,$,t.createElement(sp,q)))},Xm=t.forwardRef(((e,n)=>{var r,l,i,a;const{column:o,record:s,rowKey:c,columnKey:d}=e,{tableRef:u,updateTableFlatData:m,dataChange:p}=t.useContext($o),h=t.useContext(Sm),{store:f,fieldAuth:g}=u.current,v=(null===(r=o.editRender)||void 0===r?void 0:r.call(o,s,o))||{},y=t.useRef(null),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),[w,C]=t.useState(!1),[S,N]=t.useState(!1),T=`${c}|${d}`,I=2===h.length?`${h[0]}|${h[1]}`:"",R=(v.editable||Fa(h,[c,d],!0))&&!v.disabled&&!(null===(l=g[d])||void 0===l?void 0:l.disabled),O=![...f.state.required,...f.state.validate].some((({x:e,y:t})=>e===c&&t===d)),k=(null===(i=f.state.required.find((({x:e,y:t})=>e===c&&t===d)))||void 0===i?void 0:i.text)||"",L=(null===(a=f.state.validate.find((({x:e,y:t})=>e===c&&t===d)))||void 0===a?void 0:a.text)||"",A=f.state.edited.some((({x:e,y:t})=>e===c&&t===d)),P=R||!O||w||S;t.useEffect((()=>{P&&I===T&&_()}),[h]);const _=()=>{var e,t,n,r;const{type:l}=v;switch(l){case"text":null===(e=y.current)||void 0===e||e.focus();break;case"number":null===(t=b.current)||void 0===t||t.select();break;case"search-helper":null===(n=x.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=E.current)||void 0===r||r.focus()}},F=()=>{var e,t,n,r;const{type:l}=v;switch(l){case"text":null===(e=y.current)||void 0===e||e.blur();break;case"number":null===(t=b.current)||void 0===t||t.blur();break;case"search-helper":null===(n=x.current)||void 0===n||n.blur();break;case"tree-helper":null===(r=E.current)||void 0===r||r.blur()}},D=Gn((()=>{m(),p()})),M=(e,t,n)=>{const{cornerSign:r=!0}=v.extra||{};f.addToUpdated(e),r&&f.addToEdited({x:t,y:n})};t.useImperativeHandle(n,(()=>({focus:_,blur:F,isEditable:()=>!v.disabled,isOpening:()=>w})));const H=t.useMemo((()=>({dataKey:T,visible:w,matching:S,setVisible:C,setMatching:N,doFieldUpdate:M,cellValueChange:D})),[w,S]),$={text:()=>t.createElement(Dm,{ref:y,column:o,row:s,rowKey:c,columnKey:d,options:v}),textarea:()=>t.createElement(Dm,{ref:y,column:o,row:s,rowKey:c,columnKey:d,options:v,isTextArea:!0}),number:()=>t.createElement(Hm,{ref:b,column:o,row:s,rowKey:c,columnKey:d,options:v}),select:()=>t.createElement($m,{column:o,row:s,rowKey:c,columnKey:d,options:v}),"select-multiple":()=>t.createElement($m,{column:o,row:s,rowKey:c,columnKey:d,options:v,isMultiple:!0}),date:()=>t.createElement(qm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"exactdate"}),datetime:()=>t.createElement(qm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"datetime"}),month:()=>t.createElement(qm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"month"}),year:()=>t.createElement(qm,{column:o,row:s,rowKey:c,columnKey:d,options:v,dateType:"year"}),time:()=>t.createElement(Km,{column:o,row:s,rowKey:c,columnKey:d,options:v}),checkbox:()=>t.createElement(jm,{column:o,row:s,rowKey:c,columnKey:d,options:v}),switch:()=>t.createElement(Vm,{column:o,row:s,rowKey:c,columnKey:d,options:v}),"search-helper":()=>t.createElement(Gm,{ref:x,column:o,row:s,rowKey:c,columnKey:d,options:v}),"search-helper-multiple":()=>t.createElement(Ym,{column:o,row:s,rowKey:c,columnKey:d,options:v}),"tree-helper":()=>t.createElement(Bm,{ref:E,column:o,row:s,rowKey:c,columnKey:d,options:v}),"tree-helper-multiple":()=>t.createElement(Um,{column:o,row:s,rowKey:c,columnKey:d,options:v}),custom:()=>t.createElement(zm,{column:o,row:s,rowKey:c,columnKey:d,options:v})};return t.createElement(t.Fragment,null,P?(()=>{const{type:e}=v,n=$[e];if(!n)return Zn("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!O}];return t.createElement("div",{className:Ae(r)},t.createElement(Fm.Provider,{value:H},n()),!O&&t.createElement("div",{className:"cell-error"},k||L))})():(()=>{const{disabled:n,extra:r={}}=v,{disabledColor:l,disabledBgColor:i}=r,a=["cell--show",{"is-cell-bg":n&&i}];return t.createElement(t.Fragment,null,t.createElement("span",{className:Ae(a),style:{color:n?l:""}},e.children),n&&i&&t.createElement("i",{className:"cell--bg",style:{background:i}}))})(),A&&t.createElement("i",{className:"cell--sign"}))}));Xm.displayName="CellEdit";const Qm=e=>{const{text:n,options:r,showMessage:l=!0,onCopy:i}=e,{t:a}=Un();return ci(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=tn(n,r);null==i||i(n,c),c&&l&&te.success(a("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Qm.displayName="QmCopyToClipboard";const Zm=t.forwardRef(((n,r)=>{const{column:l,row:i,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c,onUnmount:d}=n,{tableRef:u,selectionKeys:m,treeExpandIndex:p,updateMark:h}=t.useContext($o),{dataIndex:f,canCopy:g,render:v,editRender:y,shouldCellUpdate:b}=l,{t:x}=Un(),{renderText:E,getTitleFromCellNode:w}=ps(),C=t.useRef(null),S=va(i,f),[N,T]=function(t,n,r){const l=e.useRef({});return"value"in l.current&&!r(l.current.condition,n)||(l.current.value=t(),l.current.condition=n),l.current.value}((()=>{const e=v?v(S,i,l,a,o):E(S,l,i);return[e,y?t.createElement(Xm,{ref:r,column:l,record:i,rowKey:s,columnKey:f},e):null]}),[h,i,S,v,y],((e,t)=>{if(b){const[,n]=e,[,r]=t;return b(r,n,i)}return!Fa(e,t,!0)}));t.useEffect((()=>()=>null==d?void 0:d()),[]),t.useEffect((()=>{if([ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(f))return;const e=C.current.parentNode;c?e.title=w(N):e.removeAttribute("title")}),[c,N]);const I=e=>Array.isArray(e.children);return t.createElement("div",{ref:C,className:"cell"},(()=>{if(f===ls.expandableColumn)return t.createElement(_m,{record:i,rowKey:s});if(f===ls.selectionColumn)return t.createElement(Pm,{selectionKeys:m,column:l,record:i,rowKey:s});if(T)return T;if(u.current.isTreeTable&&f===p)return t.createElement(t.Fragment,null,(e=i._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*ls.treeTable.textIndent+"px"}}):null,t.createElement(_m,{key:"expand",record:i,rowKey:s,style:I(i)?{}:{visibility:"hidden"}}),N);var e;if(g){const e=w(N);return t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},N),e&&t.createElement(Qm,{text:e},t.createElement(Qe,{className:"icon",title:x("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return N})())}));Zm.displayName="Cell";const Jm={open:!1,offsetX:0,offsetY:0},ep=t.forwardRef(((e,n)=>{const{rowVirtualize:r}=e,{tableRef:l,getRowKey:i,prefixCls:a,tableFlatData:o,flattenColumns:s,tableRowHeight:c,mergedTdCells:d,setMergedCells:u}=t.useContext($o),{areaSelection:m={}}=l.current.props,{elementStore:p,scrollYLoad:h}=l.current,{t:f}=Un(),g=t.useRef(document.onselectstart),v=t.useRef(null),y=t.useRef(null),b=t.useRef(null),x=e=>{b.current=e},[E,w]=t.useState(null),[C,S]=t.useState(null),[N,T]=t.useState(null),I=e=>{if(!e)return T(null);let t=!1;for(const n in e)if((null==N?void 0:N[n])!==e[n]){t=!0;break}t&&T(Object.assign({},N,e))};wu({ref:v,handler:()=>V()}),t.useEffect((()=>{const e=Kt(p.$tableBody,"mousedown",M),t=Kt(p.$tableBody,"contextmenu",F),n=Kt(document,"keydown",D);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const R=()=>{w(null),I(null),x(null),S(null)};t.useImperativeHandle(n,(()=>({blur:R})));const O=e=>{let t=e;for(;t;){if(!p.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},k=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),L=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),A=e=>{let[t,n,r,l]=[1/0,-1/0,1/0,-1/0];for(const i of e)t=Math.min(t,i.rowStart),n=Math.max(n,i.rowEnd),r=Math.min(r,i.colStart),l=Math.max(l,i.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:l}},P=si((e=>{let t=A([L(e),b.current]);d.forEach((e=>{const n=o.findIndex((t=>i(t,t.index)===e.rowKey)),r=s.findIndex((t=>t.dataIndex===e.dataIndex)),l={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+e.colSpan};var a,c;c=l,(a=t).rowEnd<=c.rowStart||a.rowStart>=c.rowEnd||a.colEnd<=c.colStart||a.colStart>=c.colEnd||(t=A([t,l]))})),I(t)}),5),_=e=>{var t;u(e),null===(t=m.onCellMerge)||void 0===t||t.call(m,e),xn((()=>R()))},F=Gn((e=>{m.cellMerge&&E&&K(e.clientX,e.clientY)?(e.preventDefault(),j(e)):(null==C?void 0:C.open)&&V()})),D=Gn((e=>{27===e.keyCode&&R()})),M=Gn((e=>{e.stopPropagation();const t=O(e.target);if(1!==e.buttons||!t)return;V();const n=k(t);w(n);const r=L(n);x(r),I(r),document.addEventListener("mousemove",H),document.addEventListener("mouseup",$),g.current=document.onselectstart,document.onselectstart=()=>!1})),H=Gn((e=>{const t=O(e.target);t&&P(k(t))})),$=Gn((()=>{var e;null===(e=m.onSelectChange)||void 0===e||e.call(m,(()=>{const e=[];if(!E||!N)return e;for(let t=N.rowStart;t<N.rowEnd;t++)for(let n=N.colStart;n<N.colEnd;n++)e.push({rowKey:i(o[t],o[t].index),dataIndex:s[n].dataIndex,cellValue:va(o[t],s[n].dataIndex)});return e})()),document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",$),q()})),q=()=>{document.onselectstart!==g.current&&(document.onselectstart=g.current)},K=(e,t)=>{const{top:n,left:r}=p.$tableBody.parentNode.getBoundingClientRect(),[l,i]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=G();return!(l<a||l>a+s||i<o||i>o+c)},j=e=>{const{top:t,left:n,height:r}=y.current.getBoundingClientRect();S({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},V=()=>{S((e=>Object.assign(Object.assign({},e),{open:!1})))},z=e=>({rowIndex:o.findIndex((t=>i(t,t.index)===e.rowKey)),colIndex:s.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),W=()=>{if(!E||!N||(t=N,(e=E).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return R();var e,t;const n={rowKey:i(o[N.rowStart],o[N.rowStart].index),dataIndex:s[N.colStart].dataIndex,rowSpan:N.rowEnd-N.rowStart,colSpan:N.colEnd-N.colStart};_([...d.filter((e=>!((e,t)=>{const n=z(e),r=z(t),[l,i,a,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return l<=s&&i<=c&&a>=d&&o>=u||s<=l&&c<=i&&d>=a&&u>=o})(e,n))),n])},B=()=>{const e=i(o[N.rowStart],o[N.rowStart].index),t=s[N.colStart].dataIndex;_(d.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},U=e=>{if(h){return r.measurementsCache.slice(0,e).map((e=>e.size)).reduce(((e,t)=>e+t),0)}if(e>=o.length)return p.$tableBody.parentNode.offsetHeight;const t=i(o[e],o[e].index),n=p.$tableBody.querySelector(`tbody > tr[data-row-key="${t}"]`);return n?n.offsetTop:c*e},G=()=>{const{w:e,h:t,l:n,t:r}=E,l=s.slice(0,N.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=U(N.rowStart);return{sl:n,st:r,sw:e,sh:t,el:l,et:i,ew:s.slice(0,N.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-l,eh:U(N.rowEnd)-i}};return t.createElement("div",{className:`${a}--area-select`},(()=>{if(!E||!N)return null;const{sl:e,st:n,sw:r,sh:l,el:i,et:a,ew:o,eh:s}=G(),{open:c,offsetX:d,offsetY:u}=C||Jm,m=t.createElement("ul",{ref:v,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:W},f("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:B},f("qm.table.areaSelect.cancelMerge")));return t.createElement(t.Fragment,null,t.createElement("div",{className:"active-area",style:{left:e,top:n,width:r,height:l}}),t.createElement(ld,{popupVisible:c,popup:m,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:ls.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},t.createElement("div",{ref:y,className:"checked-area",style:{left:i,top:a,width:o,height:s}})))})())}));ep.displayName="AreaSelect";const tp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:l,prefixCls:i,tableFlatData:a,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,tableRowHeight:m,sorter:p,layout:h,showFooter:g,selectionKeys:v,rowExpandedKeys:y,highlightKey:b,activedCell:x,isPingLeft:E,isPingRight:w,isTableEmpty:S,isGroupSubtotal:N,setElementStore:T,setSelectionKeysEffect:I,setHighlightKey:R,setActivedCell:O,getStickyLeft:k,getStickyRight:L,setPingLeft:A,setPingRight:P,setFullScreen:_,scrollBottomDebouncer:F}=t.useContext($o),{height:D,minHeight:M,maxHeight:H,rowSelection:$,rowHighlight:q,expandable:K,stripe:j,summation:V,rowHeight:z,rowStyle:W,cellStyle:B,spanMethod:U,tableConfig:G,areaSelection:Y,ellipsis:X,showHeader:Q,rowDraggable:Z,onRowClick:J,onRowDblclick:ee,onRowContextmenu:te,onRowEnter:ne}=r.current.props,re=t.useRef(null),le=t.useRef(new Map),ie=t.useRef(null),ae=t.useRef({prevST:0,prevSL:0}),{onNodeDragStart:oe,onNodeDragEnter:se,onNodeDragOver:ce,onNodeDragLeave:de,onNodeDragEnd:ue,onNodeDrop:me,indent:pe,dropOptions:he}=km({openDragSort:Z}),{rowVirtualizer:fe,columnVirtualizer:ge,virtualRows:ve,virtualColumns:ye,resetItemXSize:be,getYIndexes:xe,virtualTranslateY:Ee,virtualTranslateX:we,calcVirtualYSize:Ce,calcVirtualXSize:Se,scrollToYIndex:Ne}=((e,n)=>{var r;const{tableRef:l,tableRowHeight:i}=t.useContext($o),{props:a,scrollBarRef:o}=l.current,s=(null===(r=a.tableConfig)||void 0===r?void 0:r.overscan)||1,c=t.useMemo((()=>{var e;return(null===(e=o.current)||void 0===e?void 0:e.scrollElement)||null}),[o.current]),d=t.useMemo((()=>{const e=[],t=[];return n.forEach(((n,r)=>{"left"===n.fixed&&e.push(r),"right"===n.fixed&&t.push(r)})),[e,t]}),[n]),u=yu({count:e.length,getScrollElement:()=>c,estimateSize:()=>i,indexAttribute:"data-row-index",overscan:s,enabled:l.current.scrollYLoad}),m=u.getVirtualItems(),p=yu({horizontal:!0,count:n.length,getScrollElement:()=>c,estimateSize:e=>n[e].width||n[e].renderWidth||0,indexAttribute:"data-col-index",overscan:s,enabled:l.current.scrollXLoad,rangeExtractor:e=>[...new Set([...d[0],...su(e),...d[1]])]}),h=p.getVirtualItems();return{rowVirtualizer:u,columnVirtualizer:p,virtualRows:m,virtualColumns:h,resetItemXSize:e=>{e.forEach(((e,t)=>{p.resizeItem(t,e.width||e.renderWidth||ls.defaultColumnWidth)}))},getYIndexes:()=>u.getVirtualIndexes()||[],getXIndexes:()=>p.getVirtualIndexes()||[],virtualTranslateY:()=>{var e;return(null===(e=m[0])||void 0===e?void 0:e.start)||0},virtualTranslateX:()=>{var e,t,n,r;const l=d[0].length;return l?(null===(t=h[l])||void 0===t?void 0:t.index)===l?(null===(n=h[0])||void 0===n?void 0:n.start)||0:((null===(r=h[l])||void 0===r?void 0:r.start)||0)-h.slice(0,l).reduce(((e,t)=>e+t.size),0):(null===(e=h[0])||void 0===e?void 0:e.start)||0},calcVirtualYSize:()=>u.getTotalSize()||"",calcVirtualXSize:()=>p.getTotalSize()||"",scrollToYIndex:e=>{u.scrollToIndex(e)},scrollToXIndex:e=>{p.scrollToIndex(e)}}})(a,o),Te=xe(),Ie=e=>{if(e&&!X)return fe.measureElement(e)},Re=t.useMemo((()=>u.length&&r.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:l,colSpan:i})=>{const a=e+l-1,o=[];for(let t=e;t<=a;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:i});for(let l=t;l<t+i;l++)0===r&&l===t||n.push({row:e,col:l,rowSpan:0,colSpan:0})}))})),n})(u,Te):u),[u,Te.join(",")]),[Oe,ke]=t.useState([]),Le=Lm();wu({ref:re,omitClassNames:[`.${ls.popupClassName}`],handler:()=>{var e;Ue([]),null===(e=ie.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:Ue,createFocus:Ke,forceUpdate:Le,resetItemXSize:be,scrollToYIndex:Ne}))),Fl((()=>{Oe.length&&r.current.tableManager.focus(r.current.uid)}),[Oe]),t.useLayoutEffect((()=>{qe();const e=Kt(document,"keydown",Fe);return()=>e.remove()}),[]);const Pe=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:l}=h,i={};return S&&Object.assign(i,{minHeight:"100px"}),M&&Object.assign(i,{minHeight:fa(M)-e-n+"px"}),H&&Object.assign(i,{maxHeight:fa(H)-e-n+"px"}),D||r||l?Object.assign(Object.assign({},i),{maxHeight:"",minHeight:"",height:`${t}px`}):i}),[D,H,M,S,h]),_e=Gn((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:l}=ae.current,{scrollTop:i,scrollLeft:a}=e;if(a!==l){Q&&(t.$header.scrollLeft=a),g&&(t.$footer.scrollLeft=a);const e=a>0,n=Math.ceil(a+h.tableWidth)<h.tableBodyWidth;E!==e&&A(e),w!==n&&P(n)}ae.current={prevST:i,prevSL:a}})),Fe=Gn((e=>{var t,n,i,o,s;if(r.current.uid!==(null===(t=r.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id))return;const{keyCode:c}=e;if(27===c&&(Ue([]),R(""),O({}),_(!1)),Oe.length&&(Wl(document.activeElement,re.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName))){if(13===c&&("radio"===(null==$?void 0:$.type)||q)){const t=null!==(o=null!==(i=v[0])&&void 0!==i?i:b)&&void 0!==o?o:null,n=null!==(s=a.find((e=>l(e,e.index)===t)))&&void 0!==s?s:null;n&&(null==ne||ne(n,e))}ze(Oe[0],Oe[1])||(38!==c&&40!==c||(Hl(e),De(e)),(9===c||e.shiftKey&&9===c)&&(Hl(e),Me(e)))}})),De=Ii((e=>{var t,n;if(!Oe.length)return;const r=a.length;let i=a.findIndex((e=>l(e,e.index)===Oe[0]));const o=38===e.keyCode?(--i+r)%r:++i%r,s=a[o],c=l(s,s.index),d=Ve(c,Oe[1]);"radio"!==(null==$?void 0:$.type)||(null===(t=$.disabled)||void 0===t?void 0:t.call($,s))||d||I([c]),!q||(null===(n=q.disabled)||void 0===n?void 0:n.call(q,s))||d||R(c),He(38===e.keyCode?"top":"bottom",o),je(...Oe),Ue([c,Oe[1]])}),100),Me=Ii((e=>{if(!Oe.length)return;if(!s.length)return Ue([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Oe[1]));const r=e.shiftKey&&9===e.keyCode?(--n+t)%t:++n%t;je(...Oe),$e(e.shiftKey&&9===e.keyCode?"left":"right",r),Ue([Oe[0],s[r].dataIndex])}),100),He=(e,t)=>{const{scrollBarRef:n,scrollYLoad:l}=r.current;if(l)return fe.scrollToIndex(t);const i=a.length,o=t,s=re.current.querySelectorAll("tbody > tr"),c=a.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<n.current.scrollTop?n.current.SET_SCROLL_TOP(c):t===i-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)},$e=(e,t)=>{const{scrollBarRef:n}=r.current,l=s.length,i=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),a=o.slice(0,i).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[i].width||o[i].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),p=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?a<n.current.scrollLeft+m?n.current.SET_SCROLL_LEFT(a-m):t===l-1&&n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+p):a+u>n.current.scrollLeft+(h.tableWidth-p)?n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+p):0===t&&n.current.SET_SCROLL_LEFT(a-m)},qe=()=>{T("$tableBody",re.current)},Ke=(e,t)=>{var n;null===(n=le.current.get(`${e}-${t}`))||void 0===n||n.focus()},je=(e,t)=>{var n;null===(n=le.current.get(`${e}-${t}`))||void 0===n||n.blur()},Ve=(e,t)=>{var n,r;return null!==(r=null===(n=le.current.get(`${e}-${t}`))||void 0===n?void 0:n.isEditable())&&void 0!==r&&r},ze=(e,t)=>{var n,r;return null!==(r=null===(n=le.current.get(`${e}-${t}`))||void 0===n?void 0:n.isOpening())&&void 0!==r&&r},We=e=>{const t=V.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Be=(e,t,n)=>{var i;const{dataIndex:a}=n;if([ls.expandableColumn,ls.operationColumn].includes(a))return;const o=l(t,t.index);Ue([o,a]);const s=Ve(o,a),{type:c,selectByClickRow:d=!0,disabled:u=vn}=$||{};!c||u(t)||s||(d||a===ls.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:l=!0,onSelect:i}=$||{};if("radio"===n&&I([e]),"checkbox"===n){const n=!v.includes(e),a=r.current.isTreeTable&&!l?Ye(e,v,n):Ge(e,v,n);I(a),null==i||i(n,t,a)}})(o,t),[ls.selectionColumn].includes(a)||(!q||(null===(i=q.disabled)||void 0===i?void 0:i.call(q,t))||s||R(o),null==J||J(t,n,e))},Ue=e=>{C(e,Oe)||ke(e)},Ge=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Ye=(e,t,n)=>{var l;const{disabled:i}=$||{},{tableFullData:a,recordsMap:o}=r.current,s=La(a,(t=>t._rowKey===e));let c=[],d=ca((null==s?void 0:s.children)||[],(e=>e._rowKey));i&&(d=d.filter((e=>!o.has(e)||!i(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(l=Aa(a,e))||void 0===l?void 0:l.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=La(a,(t=>t._rowKey===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},Xe=(e,n,l)=>{const{scrollXLoad:i}=r.current,{disabled:a}=$||{},s=["body--row",Object.assign({"body--row-striped":j&&n%2!=0,"body--row-selected":v.includes(l)&&!(null==a?void 0:a(e)),"body--row-current":b===l},N?We(e._group):null)],c=(i?ye:o).map(((t,r)=>Qe(i?o[t.index]:t,i?t.index:r,e,n,l)));return Z?t.createElement(Am,{key:l,ref:Ie,className:Ae(s),rowKey:l,rowIndex:n,row:e,indent:pe,filter:".cell--edit input",dropOption:he,onNodeDragStart:oe,onNodeDragEnter:se,onNodeDragOver:ce,onNodeDragLeave:de,onNodeDragEnd:ue,onNodeDrop:me},c):t.createElement("tr",{key:l,ref:Ie,"data-row-key":l,"data-row-index":n,className:Ae(s)},c)},Qe=(e,n,r,l,i)=>{var a,o,s;const{dataIndex:u,fixed:h,align:f,className:g=""}=e,{rowSpan:v,colSpan:y}=Ze(r,e,l,n);if(!v||!y)return null;const b=null!==(a=e.ellipsis)&&void 0!==a?a:X,E=["body--column",{"col--ellipsis":b,"col--center":"center"===f,"col--right":"right"===f,"col-active":x.rowKey===i&&x.dataIndex===u,"column--sort":!!p[u],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(o=c[c.length-y])||void 0===o?void 0:o.dataIndex)===u,"cell-fix-right-first":"right"===h&&(null===(s=d[0])||void 0===s?void 0:s.dataIndex)===u,[g]:!!g}],w={left:"left"===h?`${k(u)}px`:"",right:"right"===h?`${L(u)}px`:""},C=W?"function"==typeof W?W(r,l):W:null,S=B?"function"==typeof B?B(r,e,l,n):B:null,T=N?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=V.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,I=Object.assign({},w,{height:z?m:""},T,C,S);return t.createElement("td",{key:u,"data-col-index":n,rowSpan:v>1?v:void 0,colSpan:y>1?y:void 0,className:Ae(E),style:I,onClick:t=>Be(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(r)||null==ee||ee(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(r)||null==te||te(t,n,e)})(t,r,e)},t.createElement(Zm,{ref:e=>{e&&le.current.set(`${i}-${u}`,e)},row:r,column:e,rowIndex:l,columnIndex:n,rowKey:i,showTitle:b,onUnmount:()=>le.current.delete(`${i}-${u}`)}))},Ze=(e,t,n,r)=>{var l;let i=1,o=1;const s=U;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(c)?(i=c[0],o=c[1]):f(c)&&(i=c.rowSpan,o=c.colSpan);const d=null!==(l=Te[0])&&void 0!==l?l:0;if(e===a[d]&&0===i)for(let e=d;e<a.length;e++){const n=s({row:a[e],column:t,rowIndex:e,columnIndex:r,tableData:a});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;i++}}if(Re.length>0){const e=Re.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,o=e.colSpan)}return{rowSpan:i,colSpan:o}};return t.createElement(xi,{ref:r.current.scrollBarRef,wrapClassName:`${i}--body-wrapper`,wrapStyle:Pe,innerStyle:{height:Ce(),width:Se()},showTopScrollbar:null==G?void 0:G.doubleXScrollbar,onScroll:_e,onReachedEnd:(e,t)=>{"bottom"===e&&F({type:"scroll",target:t,preventDefault:vn,stopPropagation:vn})}},t.createElement(Sm.Provider,{value:Oe},t.createElement("table",{ref:re,style:{width:0,marginTop:Ee(),marginLeft:we()},className:Ae(`${i}--body`,{"virtual-container":r.current.scrollYLoad||r.current.scrollXLoad}),tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=r.current;return t.createElement("colgroup",null,(e?ye:o).map((n=>{const{dataIndex:r,width:l,renderWidth:i}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${l||i}px`,minWidth:`${l||i}px`}})})))})(),t.createElement("tbody",null,(e=>{const{scrollYLoad:n,scrollXLoad:i}=r.current,s=[];return(n?e:a).forEach(((e,r)=>{const c=n?a[e.index]:e,d=n?e.index:r,u=l(c,c.index);if(s.push(Xe(c,d,u)),null==K?void 0:K.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=yn}=K;y.includes(u)&&n(c)&&s.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:(i?ye:o).length,className:"body--column",style:{paddingLeft:$?2*ls.selectionColumnWidth:ls.selectionColumnWidth}},t.createElement("div",{className:Ae("cell",e)},K.expandedRowRender(c,d)))))}})),s})(ve)))),!!Y&&t.createElement(ep,{ref:ie,rowVirtualize:fe}))}));tp.displayName="TableBody";const np=()=>{const{tableRef:e,prefixCls:n,sorter:r,layout:l,flattenColumns:i,leftFixedColumns:a,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=t.useContext($o),{footRender:m}=e.current.props,{t:p}=Un(),h=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",h.current)},g=(n,l,i)=>{var s,c;const{dataIndex:m,fixed:h,align:f,summation:g}=n,v=["footer--column","col--ellipsis",{"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!r[m],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(s=a[a.length-1])||void 0===s?void 0:s.dataIndex)===m,"cell-fix-right-first":"right"===h&&(null===(c=o[0])||void 0===c?void 0:c.dataIndex)===m}],y={left:"left"===h?`${d(m)}px`:"",right:"right"===h?`${u(m)}px`:""},b=(null==g?void 0:g.render)?g.render(e.current.tableFullData):va(l,`${m}_text`),x=0===i&&""===b?p("qm.table.config.summaryText"):b;return t.createElement("td",{key:m,title:x,className:Ae(v),style:Object.assign({},y)},t.createElement("div",{className:"cell"},x))},{tableBodyWidth:v}=l;return t.createElement("div",{ref:h,className:`${n}--footer-wrapper`},m?m(i,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}px`:""}},t.createElement("colgroup",null,i.map((e=>{const{dataIndex:n,width:r,renderWidth:l}=e;return t.createElement("col",{key:n,style:{width:`${r||l}px`,minWidth:`${r||l}px`}})}))),t.createElement("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},i.map(((t,n)=>g(t,e,n)))))))))};var rp;!function(e){e.small="small",e.middle="default",e.large="default"}(rp||(rp={}));const lp=e=>{var n,r,l,i;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(an),{tableRef:u,prefixCls:m,$size:p,setElementStore:h}=t.useContext($o),{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=()=>{h("$pager",y.current)},E=null!==(n=null==g?void 0:g.showSizeChanger)&&void 0!==n?n:ls.pagination.showSizeChanger,w=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:ls.pagination.showQuickJumper,C=(null==g?void 0:g.pageSizeOptions)||(null===(i=null===(l=null==d?void 0:d.table)||void 0===l?void 0:l.pagination)||void 0===i?void 0:i.pageSizeOptions)||ls.pagination.pageSizeOptions,S=()=>pn(void 0,void 0,void 0,(function*(){if(!b)return;const e=yield N(b);e&&e!==o&&(c(a,e),localStorage.setItem(b,e.toString()))})),N=e=>pn(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)=>pn(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={[`${m}-pager`]:!0};return t.createElement("div",{ref:y,className:Ae(I)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==v?void 0:v.position)&&t.createElement(ds,{total:s})),t.createElement(be,{size:rp[p],showSizeChanger:E,showQuickJumper:w,pageSizeOptions:C,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},ip=()=>{const{prefixCls:e,layout:n}=t.useContext($o),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(Zl,null))},ap=()=>{const{prefixCls:e,setElementStore:n}=t.useContext($o),r=t.useRef(null);t.useLayoutEffect((()=>{l()}),[]);const l=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},op=t.forwardRef(((e,n)=>{const r=In(Ko,e),{rowKey:l,columns:i,loading:a,resizable:o,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:m,topSpaceAlign:p,showTableInfo:h,showFullScreen:g,showRefresh:v,showToolBox:y,showHeader:b,className:x,style:w}=r,{$size:S}=Yn(r),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=nr("table"),L=Gn(((e,t)=>{const n="function"==typeof l?l(e,t):null==e?void 0:e[l];return void 0===n?(Zn("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:A,tableFullData:P,setElementStore:_,setOriginColumns:F,setTableFullData:D,setTableOriginData:M,setTableDataMaps:H,setInvalidRowKeys:$,setFieldAuth:q,setColumnsDefined:K,setScrollXLoad:j,setScrollYLoad:V,setResizeState:z,setHandleState:W,setSummaries:B,setSelectionRows:U,setUnMounted:G,clearElementStore:Y}=((e,{getRowKey:n})=>{const r=t.useRef({props:e,uid:Zo(),tableManager:es,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!e.dynamicThead,scrollBarRef:t.createRef(),store:new ts({getRowKey:n}),resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!1,isOriginTree:!1,scrollXLoad:!1,scrollYLoad:!1,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!hn&&/MSIE|Trident/.test(navigator.userAgent)});var l;l=e,r.current.props=l;const i=(e,t,r="",l=0)=>{e.forEach((e=>{const a=n(e,e.index),o=r?`${r}.${e.index+1}`:`${e.index+1}`;e.indexPath=o,e._level=l,e._rowKey=a,e._parentRowKey=l?t:null,Array.isArray(e.children)&&i(e.children,a,o,l+1),e.children&&e.children.length||(e._isLeaf=1)}))};return Object.assign(Object.assign({tableRef:r},r.current),{setElementStore:(e,t)=>{r.current.elementStore[e]=t},setOriginColumns:e=>{r.current.originColumns=e},setTableFullData:e=>{r.current.tableFullData=e;const t=e.some((e=>Array.isArray(e.children)));r.current.isTreeTable=t,t&&i(e,"")},setTableOriginData:e=>{r.current.tableOriginData=e,r.current.isOriginTree=e.some((e=>Array.isArray(e.children)))},setTableDataMaps:e=>{const t=oa(e);r.current.recordsMap=new Map(t.map(((e,r)=>[n(e,e.index),t[r]])))},setInvalidRowKeys:e=>{r.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{r.current.fieldAuth[e]=t},setColumnsDefined:e=>{r.current.columnsDefined=e},setResizeState:e=>{r.current.resizeState=e},setHandleState:e=>{r.current.handleState=e},setSummaries:e=>{r.current.summaries=e},setScrollXLoad:e=>{r.current.scrollXLoad=e},setScrollYLoad:e=>{r.current.scrollYLoad=e},setSelectionRows:e=>{r.current.selectionRows=e},setUnMounted:e=>{r.current.unMounted=e},clearElementStore:()=>{for(const e in r.current.elementStore)r.current.elementStore[e]=null}})})(r,{getRowKey:L}),{tableFlatData:X,setTableFlatData:Q,filters:Z,setFilters:J,sorter:ee,setSorter:te,superFilters:ne,setSuperFilters:re,pagerFilter:le,setPagerFilter:ie,pagination:ae,setPagination:oe,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:me,setHighlightKey:pe,updateMark:he,forceUpdate:fe,activedCell:ge,setActivedCell:ve,mergedTdCells:ye,setMergedCells:be,layout:xe,setLayout:Ee,permission:we,setPermission:Ce,spinning:Se,setSpinning:Ne,isPingLeft:Te,setPingLeft:Ie,isPingRight:Re,setPingRight:Oe,isFullScreen:ke,setFullScreen:Le,updateTableFlatData:Pe}=(e=>{var n,r,l,i,a,o,s,c,d,u,m;const{uniqueKey:p,initialSorter:h={},initialFilter:f={},paginationConfig:g,rowSelection:v,expandable:y,rowHighlight:b,mergedCells:x}=e,{global:E}=t.useContext(an),w={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:ls.pagination.current,pageSize:null!==(o=null!==(l=null!==(r=(()=>{if(p)return Number(localStorage.getItem(`tablePager_${p}`))||void 0})())&&void 0!==r?r:null==g?void 0:g.pageSize)&&void 0!==l?l:null===(a=null===(i=null==E?void 0:E.table)||void 0===i?void 0:i.pagination)||void 0===a?void 0:a.pageSize)&&void 0!==o?o:ls.pagination.pageSize,total:0},S=null!==(c=null!==(s=null==v?void 0:v.selectedRowKeys)&&void 0!==s?s:null==v?void 0:v.defaultSelectedRowKeys)&&void 0!==c?c:[],N=null!==(u=null!==(d=null==y?void 0:y.expandedRowKeys)&&void 0!==d?d:null==y?void 0:y.defaultExpandedRowKeys)&&void 0!==u?u:[],[T,I]=t.useState([]),[R,O]=t.useReducer(((e,t)=>C(e,t)?e:t),f),[k,L]=t.useReducer(((e,t)=>C(e,t)?e:t),h),[A,P]=t.useReducer(((e,t)=>C(e,t)?e:t),[]),[_,F]=t.useReducer(((e,t)=>C(e,t)?e:t),{}),[D,M]=t.useState(w),[H,$]=t.useReducer(((e,t)=>C(e,t)?e:t),S),[q,K]=t.useReducer(((e,t)=>C(e,t)?e:t),N),[j,V]=t.useState(null!==(m=null==b?void 0:b.currentRowKey)&&void 0!==m?m:""),[z,W]=t.useReducer((e=>e+1),0),[B,U]=t.useReducer(((e,t)=>C(e,t)?e:t),{}),[G,Y]=rs([],{value:x}),[X,Q]=t.useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[Z,J]=t.useState({export:!0,import:!0,print:!0}),[ee,te]=t.useState(!1),[ne,re]=t.useState(!1),[le,ie]=t.useState(!1),[ae,oe]=t.useState(!1);return{tableFlatData:T,setTableFlatData:I,filters:R,setFilters:O,sorter:k,setSorter:L,superFilters:A,setSuperFilters:P,pagerFilter:_,setPagerFilter:F,pagination:D,setPagination:M,selectionKeys:H,setSelectionKeys:$,rowExpandedKeys:q,setRowExpandedKeys:K,highlightKey:j,setHighlightKey:V,updateMark:z,forceUpdate:W,activedCell:B,setActivedCell:U,mergedTdCells:G,setMergedCells:Y,layout:X,permission:Z,setPermission:J,setLayout:Q,spinning:ee,setSpinning:te,isPingLeft:ne,setPingLeft:re,isPingRight:le,setPingRight:ie,isFullScreen:ae,setFullScreen:oe,updateTableFlatData:()=>I([...T])}})(r),{isFetch:_e,isWebPagination:Fe,isScrollPagination:De,showPagination:Me,tableColumns:He,flattenColumns:$e,editableColumns:qe,summationColumns:Ke,leftFixedColumns:je,rightFixedColumns:Ve,tableRowHeight:ze,derivedMergeCells:We,treeExpandIndex:Be,showSummary:Ue,showFooter:Ge,isHeadGroup:Ye,bordered:Xe,isHeadSorter:Qe,isHeadFilter:Ze,isServiceSummation:Je,isSelectCollection:et,isTableImport:tt,isTableClipboard:nt,isSuperSearch:rt,isFastSearch:lt,isPivotGrid:it,isGroupSummary:at,isGroupSubtotal:ot,isTableEmpty:st,summationRows:ct,fetchParams:dt}=as(r,{getRowKey:L,tableRef:A,$size:S,tableFullData:P,tableFlatData:X,updateMark:he,sorter:ee,filters:Z,superFilters:ne,selectionKeys:se,pagination:ae,mergedTdCells:ye}),{createElementStore:ut,tableStyles:mt,getSpan:pt,getStickyLeft:ht,getStickyRight:ft,scrollXToColumn:gt,scrollYToRecord:vt,calcTableHeight:yt,resetTableScroll:bt,createTableFocus:xt,doLayout:Et}=ss(r,{getRowKey:L,tableRef:A,topElementRef:N,tableElementRef:T,tableBodyRef:I,$size:S,tableColumns:He,flattenColumns:$e,leftFixedColumns:je,derivedMergeCells:We,tableFlatData:X,selectionKeys:se,highlightKey:me,tableRowHeight:ze,layout:xe,showFooter:Ge,showPagination:Me,isFullScreen:ke,setLayout:Ee,setElementStore:_}),{initialTable:wt,checkDataIndex:Ct,createTableFullData:St,createWebPageData:Nt,getTableData:Tt,createTableData:It,createGroupData:Rt,createAllExpandedKeys:Ot,setSelectionKeysEffect:kt,doFieldValidate:Lt,getTableLog:At,dataChange:Pt,tableChange:_t,toLastPage:Ft,toFirstPage:Dt,getPageCount:Mt,pagerChangeHandle:Ht,scrollBottomDebouncer:$t,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:jt,clearPagerFilter:Vt,clearRowSelection:zt,clearRowHighlight:Wt,clearTableLog:Bt,destroy:Ut}=os(r,{getRowKey:L,tableRef:A,tableElementRef:T,$size:S,tableColumns:He,flattenColumns:$e,tableFullData:P,pagination:ae,layout:xe,filters:Z,sorter:ee,superFilters:ne,pagerFilter:le,fetchParams:dt,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,summationColumns:Ke,isFetch:_e,isWebPagination:Fe,isScrollPagination:De,isServiceSummation:Je,isGroupSubtotal:ot,doLayout:Et,setTableFlatData:Q,setTableFullData:D,setTableOriginData:M,setTableDataMaps:H,setPagination:oe,setPingRight:Oe,setPingLeft:Ie,setSpinning:Ne,setSorter:te,setFilters:J,setSuperFilters:re,setPagerFilter:ie,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:pe,setSelectionRows:U,setScrollXLoad:j,setScrollYLoad:V,setFieldAuth:q,setResizeState:z,setSummaries:B,setPermission:Ce,resetTableScroll:bt,createTableFocus:xt,clearElementStore:Y});((e,n)=>{const{columns:r,summation:l,rowSelection:i,expandable:a,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,summationRows:f,showSummary:g,isWebPagination:v,isScrollPagination:y,checkDataIndex:b,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:S,scrollYToRecord:N,setSelectionKeysEffect:T,setOriginColumns:I,setRowExpandedKeys:R,setHighlightKey:O,setResizeState:k,setUnMounted:L,calcTableHeight:A,initialTable:P,destroy:_}=n,F=t.useRef(f);Fl((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),ma(m)||null==e||e(m,s.current.selectionRows),pa(m)}),[m]),Fl((()=>{if(!a)return;const{onChange:e}=a;ma(p)||null==e||e(p,p.map((e=>s.current.recordsMap.get(e)))),pa(p)}),[p]),Fl((()=>{var e,t;o&&(c.current.setClickedValues(h?[h,""]:[]),null===(e=o.onChange)||void 0===e||e.call(o,h,null!==(t=s.current.recordsMap.get(h))&&void 0!==t?t:null))}),[h]),Fl((()=>{var e;C(f,F.current)||(F.current=f,g&&l&&(null===(e=l.onChange)||void 0===e||e.call(l,f)))}),[f]),Fl((()=>{const e=i.selectedRowKeys||[];C(e,m)||T(ua(e))}),[null==i?void 0:i.selectedRowKeys]),Fl((()=>{const e=a.expandedRowKeys||[];C(e,p)||R(ua(e))}),[null==a?void 0:a.expandedRowKeys]),Fl((()=>{const{currentRowKey:e}=o;e!==h&&O(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),Fl((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),N("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&S({insert:null,remove:!1})}),[u.total]),Fl((()=>{A()}),[d]),Fl((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||Zn("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),cs({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(k(Object.assign({},e,{winHeight:n})),A())},delay:16}),t.useEffect((()=>(I(ea(r)),P(),b(),xn((()=>A())),()=>{_(),L(!0)})),[])})(r,{tableRef:A,tableBodyRef:I,$size:S,pagination:ae,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,showSummary:Ue,summationRows:ct,isWebPagination:Fe,isScrollPagination:De,checkDataIndex:Ct,toLastPage:Ft,toFirstPage:Dt,getPageCount:Mt,setHandleState:W,scrollYToRecord:vt,setOriginColumns:F,setSelectionKeysEffect:kt,setRowExpandedKeys:ue,setHighlightKey:pe,setResizeState:z,setUnMounted:G,calcTableHeight:yt,initialTable:wt,destroy:Ut});const Gt=t.useMemo((()=>({getRowKey:L,tableRef:A,tableBodyRef:I,prefixCls:k,$size:S,tableFlatData:X,flattenColumns:$e,editableColumns:qe,leftFixedColumns:je,rightFixedColumns:Ve,treeExpandIndex:Be,sorter:ee,filters:Z,superFilters:ne,pagerFilter:le,layout:xe,bordered:Xe,showFooter:Ge,showSummary:Ue,summationRows:ct,tableRowHeight:ze,pagination:ae,fetchParams:dt,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,activedCell:ge,mergedTdCells:ye,derivedMergeCells:We,updateMark:he,isFetch:_e,isPingLeft:Te,isPingRight:Re,isHeadSorter:Qe,isHeadFilter:Ze,isFullScreen:ke,isTableEmpty:st,isHeadGroup:Ye,isGroupSubtotal:ot,isWebPagination:Fe,dataChange:Pt,tableChange:_t,getTableData:Tt,setElementStore:_,createTableFullData:St,createWebPageData:Nt,createGroupData:Rt,createAllExpandedKeys:Ot,updateTableFlatData:Pe,setSorter:te,setFilters:J,setSuperFilters:re,setPagerFilter:ie,setHighlightKey:pe,setRowExpandedKeys:ue,setSelectionRows:U,setSelectionKeysEffect:kt,setInvalidRowKeys:$,setActivedCell:ve,setMergedCells:be,getSpan:pt,getStickyLeft:ht,getStickyRight:ft,scrollXToColumn:gt,scrollYToRecord:vt,setPagination:oe,setPingLeft:Ie,setPingRight:Oe,setSpinning:Ne,setFullScreen:Le,doFieldValidate:Lt,createTableData:It,scrollBottomDebouncer:$t,resetTableScroll:bt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:jt,clearPagerFilter:Vt,clearRowSelection:zt,clearRowHighlight:Wt})),[S,X,$e,ee,Z,ne,le,xe,Xe,Ge,Ue,ct,ze,ae,dt,se,de,me,ge,We,he,_e,Te,Re,Qe,Ze,ke,st,Ye,ot,Fe]);((e,n)=>{const{getRowKey:r,tableRef:l,toolBoxRef:i,tableBodyRef:a,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,isFetch:g,dataChange:v,getTableData:y,createTableData:b,calcTableHeight:x,scrollXToColumn:w,scrollYToRecord:C,doFieldValidate:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:_,clearRowHighlight:F,clearTableSorter:D,clearTableFilter:M,clearSuperFilters:H,clearPagerFilter:$,clearTableLog:q}=n,{columns:K,columnsChange:j}=l.current.props,V=(e,t,n,l=0)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=V(e.children,t,n,l+1));const a=t.includes(i);return a&&n(e,i,l),!a}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:e=>pn(void 0,void 0,void 0,(function*(){g&&(yield bn(0),yield y(),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:()=>{g||(M(),H(),$(),D(),_(),F(),q(),b([]))},CLEAR_LOG:()=>{q(),A()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{w(e)},SET_SELECTION:(e,t)=>{I(t?ua([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?ua([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{L(ea(e)),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,n)=>{const r=ra(K,e);if(!r)return Zn("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!f(t))return Zn("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return Zn("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&E(r,e,t[e]);n&&(j?j([...K]):Zn("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:i,tableOriginData:a}=l.current,o=(Array.isArray(e)?e:[e]).filter((e=>f(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[ls.expandableColumn,ls.selectionColumn,ls.operationColumn].includes(n)||ya(e,n,va(e,n))})),n.addToInserted(e)}));const c="before"===(null==t?void 0:t.mode),d=void 0===(null==t?void 0:t.parentRowKey),u=[...i];if(d)c?u.unshift(...o):u.push(...o),c?a.unshift(...o):a.push(...o);else{const e=La(u,(e=>t.parentRowKey===r(e,e.index)));if(e){const n=La(a,(e=>t.parentRowKey===r(e,e.index))),l=Da(e,n);Array.isArray(e.children)?(c?e.children.unshift(...o):e.children.push(...o),!l&&n&&(c?n.children.unshift(...o):n.children.push(...o))):(e.children=o,!l&&n&&(n.children=o))}}d&&N(Object.assign({},l.current.handleState,{insert:c?"before":"after"})),b(a,(()=>u)),v()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n,tableOriginData:i}=l.current,a=(Array.isArray(e)?e:[e]).map((e=>f(e)?r(e,e.index):e));if(!a.length)return;let o=!1;const s=V([...n],a,((e,n,l)=>{if(t.addToRemoved(e),c.forEach((r=>{const{dataIndex:l,editRender:i}=r,a=null==i?void 0:i(e,r);if(!a)return;const{rules:o=[],disabled:s}=a;!s&&o.length&&(t.removeFromRequired({x:n,y:l}),t.removeFromValidate({x:n,y:l}),t.removeFromEdited({x:n,y:l}))})),l<=0){const e=i.findIndex((e=>r(e,e.index)===n));i.splice(e,1)}else if(!Da(e,La(i,(e=>r(e,e.index)===n)))){const t=La(i,(t=>r(t,t.index)===e._parentRowKey));t&&(t.children=t.children.filter((e=>r(e,e.index)!==n)))}o=!0}));o&&(N(Object.assign({},l.current.handleState,{remove:!0})),I(m.filter((e=>!a.includes(e)))),a.includes(h)&&F(),R(p.filter((e=>!a.includes(e)))),b(i,(()=>s)),v())},VALIDATE_FIELDS:(e,t)=>{Array.from(l.current.recordsMap.values()).forEach((n=>{c.forEach((l=>{const{dataIndex:i,title:a,editRender:o}=l,s=null==o?void 0:o(n,l);if(!s)return;const c=r(n,n.index);if(e&&!e.includes(c))return;if(t&&!t.includes(i))return;const{rules:d=[],disabled:u}=s;u||S(d,va(n,i),c,i,Ta(a))}))}));const{required:n,validate:i}=P(),a=[...n,...i];return a.length&&C(a[0].rowKey),A(),{required:n,validate:i}}})))})(n,{getRowKey:L,tableRef:A,toolBoxRef:R,tableBodyRef:I,columnFilterRef:O,flattenColumns:$e,editableColumns:qe,pagination:ae,fetchParams:dt,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,isFetch:_e,dataChange:Pt,getTableData:Tt,createTableData:It,calcTableHeight:yt,scrollXToColumn:gt,scrollYToRecord:vt,doFieldValidate:Lt,setHandleState:W,setColumnsDefined:K,setSelectionKeysEffect:kt,setRowExpandedKeys:ue,setHighlightKey:pe,setSelectionRows:U,setOriginColumns:F,forceUpdate:fe,getTableLog:At,clearRowSelection:zt,clearRowHighlight:Wt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:jt,clearPagerFilter:Vt,clearTableLog:Bt}),t.useLayoutEffect((()=>{ut(),A.current.tableManager.register(A.current.uid,null!=n?n:{current:null})}),[]);const Yt={[`${k}--wrapper`]:!0,[`${k}--lg`]:"large"===S,[`${k}--sm`]:"small"===S,[`${k}--maximize`]:ke,[s]:!!s},Xt={[k]:!0,"is--border":Xe,"is--fixed":je.length||Ve.length,"is--sortable":Qe,"is--filterable":Ze,"is--head-group":Ye,"is--area-select":!!c,"is--ping-left":Te,"is--ping-right":Re};return t.createElement($o.Provider,{value:Gt},t.createElement("div",{className:Ae(Yt,x),style:w},h&&t.createElement("div",{ref:N,className:`${k}-top`},t.createElement("div",{className:`${k}-top__space`},"bottom"!==(null==m?void 0:m.position)&&t.createElement(ds,{total:ae.total}),t.createElement("div",{className:`${k}-top__space-slot`,style:{justifyContent:Yo[p]}},r.children)),t.createElement("div",{className:`${k}-top__actions`},t.createElement(Bu,{ref:R,showFullScreen:g,showReload:v&&_e,showPrint:we.print&&!!d,showImport:we.import&&tt,showExport:we.export&&!!u,showClipboard:nt,showCollection:et,showFastSearch:lt,showSuperSearch:rt,showPivotGrid:it,showGroupSummary:at,showToolBox:y,tableColumns:He}),t.createElement(Gu,{ref:O,columns:i}))),t.createElement(Jl,{spinning:null!=a?a:Se},t.createElement("div",{ref:T,className:Ae(Xt),style:mt},t.createElement("div",{className:`${k}--main-wrapper`},b&&t.createElement(Cm,{tableColumns:He}),t.createElement(tp,{ref:I}),Ge&&t.createElement(np,null)),Xe&&t.createElement("div",{className:`${k}--border-line`}),st&&t.createElement(ip,null),o&&t.createElement(ap,null))),Me&&t.createElement(lp,Kn({},ae,{onChange:(e,t)=>Ht({current:e,pageSize:t})}))))}));op.displayName="QmTable";const sp=e=>{var n;const{uniqueKey:r,multiple:l,initialValue:i,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:m}=e,{$size:p}=Yn(e),{t:h}=Un(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=ii(f),[b,E]=t.useState(c),[w,S]=t.useState(),[N,T]=t.useState(o),[I,R]=t.useState(!1),[O,k]=t.useState(300),[L,A]=t.useState(s),[P,_]=t.useState((e=>[{title:h("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[F,M]=t.useState(D({},null===(n=c.fetch)||void 0===n?void 0:n.params,i)),[H,$]=t.useState([]),q=()=>{const e=f.current,t=e.querySelector(".form-wrap");k(e.offsetHeight-t.offsetHeight-2*Ho[p]-30)},K=si(q,5);oi((()=>{K()}),[y.width]),Fl((()=>{C(s,L)||A(s)}),[s]),t.useEffect((()=>{j()}),[F]),t.useEffect((()=>{a&&v.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;i&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(i))}),[]);const j=()=>pn(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:i,beforeFetch:a=yn,afterFetch:o}=n;if(a(F)){R(!0);try{const t=yield r(F);if(200===t.code){let n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,i))&&void 0!==e?e:[];n="function"==typeof o?yield o(n):n,l||(T([]),yield bn(0)),$(n)}}catch(e){}R(!1)}})),V=e=>{l||(S(e),m(e))},z=e=>{M(Object.assign({},F,e))},W={[`${nr("search-helper")}--wrapper`]:!0},B=b.webPagination?{dataSource:H,loading:I,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:F})};return t.createElement("div",{ref:f,className:Ae(W,d),style:u},t.createElement("div",{className:"form-wrap"},L.length?t.createElement(Kh,{ref:g,items:L,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>q(),onFinish:e=>z(e),onReset:()=>pn(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||z(t)}))}):null),t.createElement("div",null,t.createElement(op,Kn({ref:v,uniqueKey:r,height:O,columns:P,rowKey:b.rowKey||"pageIndex"},B,{rowSelection:{type:l?"checkbox":"radio",clearableAfterFetched:!l,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:N,onChange:(e,t)=>{T(e),S(l?t:t[0])}},topSpaceAlign:"left",paginationConfig:b.paginationConfig,columnsChange:e=>_(e),onRowDblclick:V,onRowEnter:V}),b.topBarExtra)),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ho[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Jn,{onClick:()=>m(null),style:{marginRight:8}},h("qm.dialog.cancel")),t.createElement(Jn,{type:"primary",disabled:!w,onClick:()=>m(w,l?N:void 0)},h("qm.dialog.confirm"))))};sp.displayName="QmSearchHelper";const{Search:cp}=ne;class dp extends d{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=zt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>pn(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||Zn("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)||Zn("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Zn("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>pn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!wn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=x(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&no(e,this.alias,c),d&&ro(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=to(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==i||i([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,l=("function"==typeof n?n():n)||[],i={[t]:r};return(Array.isArray(l)?l:[l]).forEach((e=>{if(f(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=yn,formatter:l=(e=>e)}=t.fetch;return new Promise(((i,a)=>pn(this,void 0,void 0,(function*(){var o;const s=D({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),l(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return a();this.setState({loading:!0});try{const e=yield t.fetch.api(s);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=x(e.data,t.fetch.dataKey))&&void 0!==o?o:[];i(n)}else a()}catch(e){a(e)}finally{xn((()=>this.setState({loading:!1})))}}))))},this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const l=to(e,this.alias[r]);void 0!==l&&(t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l))}for(const n in this.extras){const r=to(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>pn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=to(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)=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,l=(null!=r?r:yn)(n.state.formData);(null==l?void 0:l.then)?l.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==l&&(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){if(r===n)continue;const l=to(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:to(e,this.extras[n])});const r=to(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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}),n===this.valueKey&&(this._prevValue=null));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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:l}=this.state,{value:i}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=dn("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:dn("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ho[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(Co,{value:i,bordered:m}):t.createElement(t.Fragment,null,t.createElement(cp,{ref:e=>this[`${a}_Ref`]=e,value:i,title:i,loading:l,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:m,allowClear:p,readOnly:h,disabled:f,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:l=!0,table:i}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?l?(null===(t=null==i?void 0:i.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):xn((()=>this.clearSearchHelperValue())))}}),t.createElement(Di,b,t.createElement(sp,x)))}}dp.contextType=Mi;class up extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>pn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Qn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Zn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>pn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=so(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[]}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(c)},required:e.getFormItemRequired(h)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(dp,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),m&&t.createElement(se,null,e.renderFormItemButton(a,m)),u&&t.createElement(se,{flex:Tn(u.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}up.contextType=Mi;const mp=e=>{class n extends d{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 l=e.target,i=null==t?void 0:t.target,a=!l||!i,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(l))||(null===(r=this.$el)||void 0===r?void 0:r.contains(i)),s=this.$el===l,c=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),d=c.some((e=>null==e?void 0:e.contains(l)))||c.includes(i);let u;u=!(a||o||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=(e=[])=>{this.omitClassNames=e}}componentDidMount(){this.event1=Kt(document,"mousedown",this.mousedownHandler),this.event2=Kt(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,Kn({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,Kn({},e,{forwardedRef:r}))))};let pp=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=zt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Zn("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Zn("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=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:yn)(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(H([...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:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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:l}=this.props;C(n,r)||C(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),l&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:l,params:i={},formatter:a=(e=>e),dataKey:o,callback:s,fieldAliasMap:c}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},d="function"==typeof c?c():c||{},{value:u}=this.props;if(l){if(wn(u))return this.setRecords([]);this.setState({loading:!0});try{const e=yield l(a(Object.assign(Object.assign({},i),{keys:u})));if(200===e.code){let l=Array.isArray(e.data)?e.data:null!==(t=x(e.data,o))&&void 0!==t?t:[];l.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])})),l=l.filter((e=>u.includes(e[r])));const i=l.map((e=>({value:e[r],text:e[n]})));this.setRecords(l),this.setItemList(i),this.setViewValue(u),null==s||s(l)}}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:l}=this.context,{visible:i,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:p={},placeholder:h=dn("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:i,title:dn("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Ho[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:D({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),C=s.filter((e=>null==c?void 0:c.includes(e.value))),S=t.createElement("ul",{className:"ant-dropdown-menu"},C.length?C.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},dn("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,T=nr("form-multiple-search-helper"),{size:I}=l.context,R={[T]:!0,[`${T}--lg`]:"large"===I,[`${T}--sm`]:"small"===I};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${T}`]);const O=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t.createElement(Co,{value:O,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(ld,{popupVisible:!y&&a,popup:S,popupClassName:Ae(R),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ba,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(ce,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:h,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},p),title:O,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(ce.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(G,{className:"ant-input-search-button",disabled:y,icon:t.createElement(St,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Di,E,t.createElement(sp,w)))}};pp.contextType=Mi,pp=mn([mp],pp);class hp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>pn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Qn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Zn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>pn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=so(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(c)},required:e.getFormItemRequired(h)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(pp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(se,null,e.renderFormItemButton(a,m)),u&&t.createElement(se,{flex:Tn(u.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}hp.contextType=Mi;const fp=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...fp(e.children)),e.children&&t.push(e.value)})),t},gp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=gp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},vp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&vp(e.children,t),t(e)||e.children&&e.children.length))),yp=e=>{var n;const{uniqueKey:r,multiple:l,initialValue:i,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:m,onClose:p}=e,{$size:h}=Yn(e),{t:f}=Un(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=ii(g),[E,w]=t.useState(c),[S,N]=t.useState(),[T,I]=t.useState(o),[R,O]=t.useState(!1),[k,L]=t.useState(300),[A,P]=t.useState(300),[_,F]=t.useState(s),[M,H]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[$,q]=t.useState(D({},null===(n=c.fetch)||void 0===n?void 0:n.params,i)),[K,j]=t.useState([]),V=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");L(e.offsetHeight-n.offsetHeight-10),P(e.offsetHeight-t.offsetHeight-2*Ho[h]-30)},z=si(V,5);oi((()=>{z()}),[b.width]),Fl((()=>{C(s,_)||F(s)}),[s]),t.useEffect((()=>{W()}),[$]),t.useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;i&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(i)),re()}),[]);const W=()=>pn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=E;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:a=yn}=n;if(a($)){O(!0);try{const t=yield r($);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,i))&&void 0!==e?e:[];l||(I([]),yield bn(0)),j(n)}}catch(e){}O(!1)}})),B=e=>{l||(N(e),p(e))},U=e=>{q(Object.assign({},$,e))},[G,Y]=t.useState([]),[X,Q]=t.useState([]),[Z,J]=t.useState(""),ee=t.useRef(G),te=t.useRef([]);Fl((()=>{Q(fp(G))}),[G]);const re=()=>pn(void 0,void 0,void 0,(function*(){var e;if(!d.fetch)return;const{api:t,params:n,dataKey:r,valueKey:l="value",textKey:i="text"}=d.fetch;try{const a=yield t(n);if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=x(a.data,r))&&void 0!==e?e:[],n=lo(t,l,i);Y(n),ee.current=n,te.current=t}}catch(e){}})),le=e=>`${e}|${Eo.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie={[`${nr("tree-table-helper")}--wrapper`]:!0},ae=E.webPagination?{dataSource:K,loading:R,webPagination:!0}:{fetch:Object.assign(Object.assign({},E.fetch),{params:$})};return t.createElement("div",{ref:g,className:Ae(ie,u),style:m},t.createElement(Xl,{defaultValue:200,style:{height:"100%"}},t.createElement(Xl.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(ne,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),suffix:t.createElement(St,null),allowClear:!0,onChange:e=>(e=>{const t=vp(ee.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==le(n).indexOf(e)}));J(e),Y(t)})(e.target.value)}),t.createElement(ve,{fieldNames:{title:"text",key:"value",children:"children"},height:k,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==le(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return Zn("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=x(e,t[r]);U(n)})(gp(te.current,(n=>x(n,t)===e[0]))||{})}})),t.createElement(Xl.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},_.length?t.createElement(Kh,{ref:v,items:_,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>F(e),onCollapse:()=>V(),onFinish:e=>U(e),onReset:()=>pn(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||U(t)}))}):null),t.createElement("div",null,t.createElement(op,Kn({ref:y,uniqueKey:r,height:A,columns:M,rowKey:E.rowKey||"pageIndex"},ae,{rowSelection:{type:l?"checkbox":"radio",clearableAfterFetched:!l,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:T,onChange:(e,t)=>{I(e),N(l?t:t[0])}},topSpaceAlign:"left",paginationConfig:E.paginationConfig,columnsChange:e=>H(e),onRowDblclick:B,onRowEnter:B}),E.topBarExtra)))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ho[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Jn,{onClick:()=>p(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(Jn,{type:"primary",disabled:!S,onClick:()=>p(S,l?T:void 0)},f("qm.dialog.confirm"))))};yp.displayName="TreeTableHelper";const{Search:bp}=ne;class xp extends d{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=zt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>pn(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||Zn("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)||Zn("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Zn("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>pn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!wn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=x(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&no(e,this.alias,c),d&&ro(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=to(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==i||i([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 l=to(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:to(e,this.extras[n])})},this.openSearchHelper=e=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:yn)(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){if(r===n)continue;const l=to(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:to(e,this.extras[n])});const r=to(e,this.alias[n]);this.triggerChange(r);const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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}),n===this.valueKey&&(this._prevValue=null));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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:l}=this.state,{value:i=""}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=dn("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:p=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:v,maxLength:y}=s,b={visible:r,title:dn("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${Ho[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:D({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}});return n.isOnlyShow?t.createElement(Co,{value:i,bordered:m}):t.createElement(t.Fragment,null,t.createElement(bp,{ref:e=>this[`${a}_Ref`]=e,value:i,title:i,loading:l,placeholder:u,style:d,prefix:g,suffix:v,maxLength:y,bordered:m,allowClear:p,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t.createElement(Di,b,t.createElement(yp,x)))}}xp.contextType=Mi;class Ep extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>pn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Qn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Zn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>pn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=so(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(c)},required:e.getFormItemRequired(h)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(xp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(se,null,e.renderFormItemButton(a,m)),u&&t.createElement(se,{flex:Tn(u.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Ep.contextType=Mi;let wp=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=zt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Zn("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Zn("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=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:yn)(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(H([...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:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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:l}=this.props;C(n,r)||C(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),l&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:l,params:i={},formatter:a=(e=>e),dataKey:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(l){if(wn(d))return this.setRecords([]);this.setState({loading:!0});try{const e=yield l(a(Object.assign(Object.assign({},i),{keys:d})));if(200===e.code){let l=Array.isArray(e.data)?e.data:null!==(t=x(e.data,o))&&void 0!==t?t:[];l.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])})),l=l.filter((e=>d.includes(e[r])));const i=l.map((e=>({value:e[r],text:e[n]})));this.setRecords(l),this.setItemList(i),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:l}=this.context,{visible:i,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:p={},placeholder:h=dn("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:i,title:dn("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${Ho[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:D({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),C=s.filter((e=>null==c?void 0:c.includes(e.value))),S=t.createElement("ul",{className:"ant-dropdown-menu"},C.length?C.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},dn("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,T=nr("form-multiple-tree-table-helper"),{size:I}=l.context,R={[T]:!0,[`${T}--lg`]:"large"===I,[`${T}--sm`]:"small"===I};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${T}`]);const O=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t.createElement(Co,{value:O,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(ld,{popupVisible:!y&&a,popup:S,popupClassName:Ae(R),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ba,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(ce,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:h,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},p),title:O,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(ce.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(G,{className:"ant-input-search-button",disabled:y,icon:t.createElement(St,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Di,E,t.createElement(yp,w)))}};wp.contextType=Mi,wp=mn([mp],wp);class Cp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>pn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Qn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Zn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>pn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=so(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(c)},required:e.getFormItemRequired(h)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(wp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(se,null,e.renderFormItemButton(a,m)),u&&t.createElement(se,{flex:Tn(u.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Cp.contextType=Mi;const Sp="_startSign",Np="_endSign",Tp=e=>{var n;const{uniqueKey:r,initialValue:l,filters:i=[],table:a={},onClose:o}=e,{$size:s}=Yn(e),{t:c}=Un(),d=t.useRef(null),u=t.useRef(null),m=t.useRef(null),p=ii(d),[h,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[E,w]=t.useState(300),[S,N]=t.useState(i),[T,I]=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:Sp,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:Np,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[R,O]=t.useState(D({},null===(n=a.fetch)||void 0===n?void 0:n.params,l)),[k,L]=t.useState([]),A=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),P=t.useMemo((()=>2===A.length&&A.every((e=>void 0!==e))),[A]),_=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");w(e.offsetHeight-t.offsetHeight-2*Ho[s]-30)},F=si(_,5);oi((()=>{F()}),[p.width]),Fl((()=>{C(i,S)||N(i)}),[i]),t.useEffect((()=>{M()}),[R]);const M=()=>pn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=h;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:i=yn}=n;if(i(R)){v(!0);try{const t=yield r(R);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[];L(n)}}catch(e){}v(!1)}})),H=(e,t)=>{delete e[t]},$=()=>{y.forEach((e=>{e&&(H(e,Sp),H(e,Np))})),b([])},q=e=>{$(),O(Object.assign({},R,e))},K=nr("range-helper"),j=h.webPagination?{dataSource:k,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},h.fetch),{params:R})};return t.createElement("div",{ref:d,className:`${K}--wrapper`},t.createElement("div",{className:"form-wrap"},S.length?t.createElement(Kh,{ref:u,items:S,initialValues:l,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>N(e),onCollapse:()=>_(),onFinish:e=>q(e),onReset:()=>pn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||q(t)}))}):null),t.createElement("div",null,t.createElement(op,Kn({ref:m,height:E,columns:T,rowKey:h.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=A[0]&&e.pageIndex<=A[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>I(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[Sp,Np].includes(n)&&(n===Sp&&(e[n]?(H(e,n),b([void 0,y[1]])):e.pageIndex>A[1]?te.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&H(y[0],n),e[n]="[",b([e,y[1]]))),n===Np&&(e[n]?(H(e,n),b([y[0],void 0])):e.pageIndex<A[0]?te.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&H(y[1],n),e[n]="]",b([y[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===A[0]&&(e[Sp]="["),e.pageIndex===A[1]&&(e[Np]="]")}))}}),t.createElement(Jn,{type:"primary",icon:t.createElement(Nt,null),title:c("qm.table.alert.clear"),onClick:()=>$()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${Ho[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(Jn,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(Jn,{type:"primary",disabled:!P,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[Sp,Np].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};Tp.displayName="RangeTableHelper";const Ip=new Array(2).fill("");class Rp extends d{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:Ip},this.getSearchHelper=zt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Zn("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Zn("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(Ip),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:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(this._records)),200)}))},this.openSearchHelper=e=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:yn)(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]:wn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=yn,formatter:l=(e=>e)}=t.fetch;return new Promise(((i,a)=>pn(this,void 0,void 0,(function*(){var o;const s=D({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),l(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return a();this.setState({loading:!0});const e=yield t.fetch.api(s);if(xn((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=x(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return i(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>pn(this,void 0,void 0,(function*(){const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{var r;const l=null===(r=e[n])||void 0===r?void 0:r.toString().toLowerCase();return t.some((e=>null==l?void 0:l.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;C(t,n)||C(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:l}=this.props.option;if(!C(r[l],this._ceho_data)&&(this._ceho_data=r[l],this.setItemList(r[l]),n.length)){const e=Ip.map(((e,t)=>{var i,a;return null!==(a=null===(i=r[l].find((e=>e.value===n[t])))||void 0===i?void 0:i.text)&&void 0!==a?a:""}));this.setTextValue(e)}}getItemList(){var e;return pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:t,valueKey:n}=this.alias,{fetchApi:r,params:l={},formatter:i=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(wn(c))return this.setRecords([]);this.setState({loading:!0});try{const o=yield r(i(Object.assign(Object.assign({},l),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=x(o.data,a))&&void 0!==e?e:[];r.forEach((e=>{(null==s?void 0:s.valueKey)&&s.valueKey!==n&&(e[n]=e[s.valueKey]),(null==s?void 0:s.textKey)&&s.textKey!==t&&(e[t]=e[s.textKey])})),r=r.filter((e=>c.includes(e[n]))).slice(0,2);const l=r.map((e=>({value:e[n],text:e[t]})));this.setRecords(r),this.setItemList(l),this.setTextValue(l.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:l,textValue:i}=this.state,{fieldName:a,options:o={},searchHelper:s={},placeholder:c=dn("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:p=!0}=this.searchHelper||s,h=i.every((e=>eo(e)))?"":i.join(" - "),f={visible:r,title:dn("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${Ho[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:D({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(Co,{value:h,bordered:d}):t.createElement(t.Fragment,null,t.createElement(ne.Group,null,t.createElement(ne,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:l}=e.target;this._is_change&&!r&&(l?i.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(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;p||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),t.createElement(ne,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),t.createElement(ne.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:l,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:l}=e.target;this._is_change&&!r&&(l?i.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(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:p||(this._is_change=!0,this.setTextValue([i[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(Di,f,t.createElement(Tp,g)))}}Rp.contextType=Mi;class Op extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>pn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Qn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Zn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>pn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=so(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(p)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Rp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{h(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(se,null,e.renderFormItemButton(a,u)),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Op.contextType=Mi;const kp=e=>{const{$$form:n}=t.useContext(Mi),{value:r,items:l,onChange:i,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=wn(m)?l:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(Co,{value:h(r),bordered:c}):t.createElement(de.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==i||i(e),a(e,h(e))})(e)}},p.map((e=>t.createElement(de,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Lp extends d{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,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}getItemList(){var e;return pn(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(c)},required:e.getFormItemRequired(p)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(kp,{option:this.props.option,items:n,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&t.createElement(se,{flex:Tn(u.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Lp.contextType=Mi;const Ap=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:m=5,tooltips:p}=a,h=e=>p?p[Math.ceil(e)-1]:e.toString();return t.createElement(xe,{value:r,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==l||l(e),i(e,h(e))})(e)}})};class Pp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ap,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Pp.contextType=Mi;const _p=e=>{const{$$form:n}=t.useContext(Mi),{value:r,items:l,onChange:i,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:m=[]}=o,p=wn(m)?l:m,h=e=>{var t,n;return null!==(n=null===(t=p.find((t=>t.value===e)))||void 0===t?void 0:t.text)&&void 0!==n?n:""};return n.isOnlyShow?t.createElement(Co,{value:h(r),bordered:c}):t.createElement(he.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u||n.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),a(e,h(e))})(t)}},p.map((e=>t.createElement(he,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Fp extends d{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>pn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(c)},required:e.getFormItemRequired(p)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(_p,{option:this.props.option,items:n,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&t.createElement(se,{flex:Tn(u.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Fp.contextType=Mi;const Dp=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=Va,trueValue:p=ja}=o,{t:h}=Un();return t.createElement(t.Fragment,null,t.createElement(ye,{checked:r===p,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement(He,null),unCheckedChildren:t.createElement(rt,null),onChange:e=>{(e=>{null==l||l(e),i(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(e?p:m)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class Mp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option,{labelToSwitch:h}=o;return t.createElement(ae.Item,{label:h?" ":e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Dp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Mp.contextType=Mi;const Hp=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Un(),{options:o={},style:s={},placeholder:c=a("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:g}=e.option,{showCount:v,maxLength:y,autoSize:b}=o,x=Object.assign({},{minRows:1,maxRows:3},b);return t.createElement(ne.TextArea,{value:r,placeholder:c,style:s,maxLength:y,showCount:v,autoSize:x,bordered:d,allowClear:u,readOnly:m||n.isOnlyShow,disabled:p,onFocus:e=>{null==h||h(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==l||l(e),i(e)})(t)}})};class $p extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Hp,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}$p.contextType=Mi;const qp=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Un(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.datePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:v,disabledDate:y,minDateTime:b,maxDateTime:x,shortCuts:E=!0}=s,w=t.createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==l||l(e),i(e,S(e))},S=e=>eo(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Ja(p().subtract(e,"day"),Ga[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return n.isOnlyShow?t.createElement(Co,{value:S(r),bordered:u}):t.createElement(qn,{ref:w,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ua[g],format:v,bordered:u,showToday:!1,showTime:"datetime"===g&&{defaultValue:p("00:00:00","HH:mm:ss")},allowClear:m,disabled:f,inputReadOnly:h,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(Ee,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(Ee,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(Ee,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(Ee,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:Za(r,Ga[g]),onChange:(e,t)=>{C(Ja(e,Ga[g]))}})};class Kp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(qp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Kp.contextType=Mi;const jp=e=>[p().subtract(e,"day"),p()],Vp=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Un(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f=n.isFormDisabled}=e.option,{dateType:g="date",format:v,disableds:y=[!1,!1],allowEmpty:b,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:C=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:jp(7),[a("qm.form.dateRangePickers")[1]]:jp(30),[a("qm.form.dateRangePickers")[2]]:jp(90),[a("qm.form.dateRangePickers")[3]]:jp(180)},N=e=>eo(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(Co,{value:N(r),bordered:u}):t.createElement(qn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ua[g],format:v,bordered:u,showTime:"datetime"===g&&{defaultValue:[p("00:00:00","HH:mm:ss"),p("23:59:59","HH:mm:ss")]},allowClear:m,allowEmpty:b,disabled:f?[!0,!0]:y,inputReadOnly:h,disabledDate:null!=x?x:e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w]),ranges:C&&g.includes("date")?S:void 0,value:wn(r)?null:[Za(null==r?void 0:r[0],Ga[g]),Za(null==r?void 0:r[1],Ga[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==l||l(e),i(e,N(e))})([Ja(null==e?void 0:e[0],Ga[g]),Ja(null==e?void 0:e[1],Ga[g])])}})};class zp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Vp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}zp.contextType=Mi;const Wp=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Un(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:v=1,secondStep:y=1}=s;return n.isOnlyShow?t.createElement(Co,{value:r,bordered:u}):t.createElement(jn,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:v,secondStep:y,allowClear:m,disabled:h,inputReadOnly:p,format:Ya[f],value:Za(r,Ya[f]),onChange:(e,t)=>{(e=>{const t=Ja(e,Ya[f]);null==l||l(t),i(t)})(e)}})};class Bp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Wp,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Bp.contextType=Mi;const Up=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Un(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h=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=>eo(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(Co,{value:E(r),bordered:u}):t.createElement(jn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:y,minuteStep:b,secondStep:x,allowClear:m,allowEmpty:v,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Ya[f],value:wn(r)?null:[Za(null==r?void 0:r[0],Ya[f]),Za(null==r?void 0:r[1],Ya[f])],onChange:(e,t)=>{(e=>{const t=[Ja(null==e?void 0:e[0],Ya[f]),Ja(null==e?void 0:e[1],Ya[f])];null==l||l(t),i(t,E(t))})(e)}})};class Gp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Up,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Gp.contextType=Mi;class Yp extends d{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=zt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.paramsChangeHandler=(e,t)=>pn(this,void 0,void 0,(function*(){yield this.props.waiting(),C(e,t)||this.getItemList()})),this.echoSearchHelper=()=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.initialHandle=()=>pn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:l,echoRequest:i}=this.searchHelper;if(r||Zn("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),l){const e=["valueKey","displayKey","extraKey"];for(const t in l)e.includes(t)&&(this[t]=l[t])}Object.keys(this.alias).includes(e)||Zn("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&Zn("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&Zn("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getItemText=()=>pn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!wn(u))try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=x(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&no(e,this.alias,c),d&&ro(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=to(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==i||i([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 l=to(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:to(e,this.extras[n])})},this.fetchHandle=$(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){if(t===r)continue;const l=to(e,this.alias[t]);n.SET_FIELDS_VALUE({[t]:l}),t===this.valueKey&&(this._prevValue=e?l:null)}for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:to(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const l=to(e,this.alias[r]);this.triggerChange(l),this.setState({inputText:void 0}),t&&t()},this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(e){var t,n,r,l,i,a;const o=(null===(n=null===(t=e.option.searchHelper)||void 0===t?void 0:t.request)||void 0===n?void 0:n.params)||(null===(r=e.option.request)||void 0===r?void 0:r.params),s=(null===(i=null===(l=this.props.option.searchHelper)||void 0===l?void 0:l.request)||void 0===i?void 0:i.params)||(null===(a=this.props.option.request)||void 0===a?void 0:a.params);this.paramsChangeHandler(s,o),this.echoSearchHelper()}getItemList(e){var t;return pn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:l={},formatter:i=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(i(Object.assign(Object.assign({},l),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=x(o.data,a))&&void 0!==t?t:[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}))}render(){const{$$form:e}=this.context,{visible:n,loading:r,itemList:l,inputText:i}=this.state,{value:a}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=dn("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=this.props.option,{listHeight:f=za}=s,{hideHeader:g,onlySelect:v=!0}=this.searchHelper||s,y=this.searchHelper.columns||[],b=nr("form-immediate"),E=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,w=t.createElement(J,{spinning:r},l.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:Ae("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,l.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},x(e,n.dataIndex))))))))):t.createElement(Zl,null));return t.createElement(an.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(Co,{value:a,bordered:u}):t.createElement(ld,{action:h?[]:["click"],popupVisible:!h&&n,popup:w,popupClassName:Ae(s,`form-popper__${o}`),popupStyle:{minWidth:E,maxHeight:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ba,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(ne,{ref:this.searchRef,placeholder:d,allowClear:m,bordered:u,readOnly:p,disabled:h,style:Object.assign({width:"100%"},c),value:null!=i?i:a,title:a,onFocus:()=>{!l.length&&this.fetchHandle(a)},onBlur:e=>{v&&!this._clicking&&i!==a&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(l[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%l.length:(--t+l.length)%l.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)}})))}))}}Yp.contextType=Mi;class Xp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>pn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Qn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Zn("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>pn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=so(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(l),className:Ae(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":Tn(c)},required:e.getFormItemRequired(h)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Yp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(se,null,e.renderFormItemButton(a,m)),u&&t.createElement(se,{flex:Tn(u.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Xp.contextType=Mi;class Qp extends d{render(){var e;const{$$form:n}=this.context,{type:r,label:l,fieldName:i,className:a,style:o={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:m=vn}=s,p=[];if(u.length){const t=null!==(e=n.getBlockDerivedItems().find((e=>e[0].fieldName===i)))&&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 l=r.showLabel?`${e.label}:`:"",i=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==i&&p.push(Object.assign(Object.assign({},e),{text:`${l}${i}`}))}))}return t.createElement(ae.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(rr,{id:i,label:l,className:a,extra:p.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[i],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[i]:e})}))),m(e)}}))}}Qp.contextType=Mi;const Zp=(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:Zp(e.children,t,n,r)}):e)),Jp=e=>{var n;const{$$form:r}=t.useContext(Mi),{value:l,items:i,multiple:a,loading:o,onChange:s,onValuesChange:c}=e,{t:d}=Un(),{fieldName:u,options:m={},style:p={},placeholder:h=d("qm.form.selectPlaceholder"),bordered:g=!0,allowClear:v=!0,asyncLoad:y,readOnly:b,disabled:E}=e.option,{itemList:w,filterable:S=!0,listHeight:N=za,checkStrictly:T,checkStrategy:I="SHOW_CHILD",collapseTags:R,echoRequest:O,defaultExpandAll:k=!y,defaultExpandedKeys:L,dropdownStyle:A,openPyt:P=!0}=m,[_,F]=t.useState(wn(w)?i:w),[D,M]=t.useState([]),[H,$]=t.useState(!1),[q,K]=t.useState(!1),j=t.useRef(null),V=t.useRef(null),z=t.useRef(_),W=t.useRef(q),B=t.useRef(null),U=e=>{K(e),W.current=e};wu({ref:V,handler:()=>U(!1)}),t.useEffect((()=>{l!==B.current&&(X(),B.current=l),(()=>{var e;V.current=(null===(e=j.current)||void 0===e?void 0:e.querySelector(".ant-select-selection-overflow-item-rest"))||null})()}),[l]),Fl((()=>{const e=wn(w)?i:w;y?C(e,z.current)||(F((t=>[...e,...t.filter((e=>!!e.style))])),z.current=e):F(e)}),[w,i]),Fl((()=>{F((e=>[...e,...D.filter((t=>!e.some((e=>e.value===t.value))))]))}),[D]);const G=e=>{var t;return(null===(t=io(_,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},Y=e=>(T&&Array.isArray(l)&&l.every((e=>f(e)))&&(e=e.map((e=>e.value))),a?(null==e?void 0:e.map((e=>G(e))).join(","))||"":G(e)),X=()=>pn(void 0,void 0,void 0,(function*(){var e;if(!O)return;if(!y)return Zn("Form","TREE_SELECT 的 echoRequest 选项必须组合 `asyncLoad` 一起使用");const{fetchApi:t,params:n,dataKey:r,callback:i,formatter:a=(e=>e)}=O||{},{textKey:o="text",valueKey:s="value"}=y;if(t&&!wn(l))try{const c=yield t(a(Object.assign(Object.assign({},n),{[s]:l})));if(200===c.code){const t=Array.isArray(c.data)?c.data:null!==(e=x(c.data,r))&&void 0!==e?e:[];if(t.length){const e=lo(t,s,o);M(e.map((e=>Object.assign(Object.assign({},e),{style:{display:"none"}})))),null==i||i(t)}}}catch(e){}}));return r.isOnlyShow?t.createElement(Co,{value:Y(l),bordered:g}):t.createElement(ld,{popupVisible:!E&&q,popup:(()=>{if(!a)return null;const e=(null==l?void 0:l.map((e=>G(e))))||[];return t.createElement("ul",{className:"ant-dropdown-menu"},e.length?e.map(((e,n)=>t.createElement("li",{key:`${e}-${n}`,className:"ant-dropdown-menu-item"},e))):t.createElement("li",{className:"ant-dropdown-menu-item"},d("qm.table.config.emptyText")))})(),popupStyle:{minWidth:null===(n=j.current)||void 0===n?void 0:n.offsetWidth},onPopupVisibleChange:e=>U(e),builtinPlacements:Ba,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",{ref:j,style:{width:"100%"}},t.createElement(we,Kn({open:H,fieldNames:{label:"text",value:"value",children:"children"},value:l,multiple:a,treeCheckable:a,treeCheckStrictly:T,showCheckedStrategy:we[I],popupClassName:`form-popper__${u}`,dropdownStyle:A,placeholder:h,listHeight:N,style:p,loading:o,bordered:g,allowClear:v,disabled:E,treeDefaultExpandAll:k,treeDefaultExpandedKeys:L,showSearch:S,maxTagCount:R?"responsive":void 0,loadData:y?({key:e,children:t})=>pn(void 0,void 0,void 0,(function*(){var n;if(!y||t)return;const{fetchApi:r,params:l,dataKey:i,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=y;if(r)try{const t=yield r(c(Object.assign(Object.assign({},l),{[o]:e})));if(200===t.code){const r=Array.isArray(t.data)?t.data:null!==(n=x(t.data,i))&&void 0!==n?n:[],l=Zp(_,e,o,lo(r,o,a));F(l),null==s||s(r)}}catch(e){}})):void 0,treeData:_},a?{title:Y(l)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",l=Eo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(P?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onMouseDown:e=>{e.target.classList.contains("ant-select-selection-overflow-item-rest")&&(U(!0),$(!1))},onDropdownVisibleChange:e=>{if(!e)return $(e);xn((()=>{W.current||$(e)}))},onChange:e=>{(e=>{null==s||s(e),c(e,Y(e),_)})(e),B.current=e}}))))};class eh extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>pn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=lo(n,i,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(i),className:Ae(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Tn(d)},required:e.getFormItemRequired(h)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Jp,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(se,{flex:Tn(m.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}eh.contextType=Mi;const th=e=>{const{$$form:n}=t.useContext(Mi),{value:r,multiple:l,items:i}=e,{t:a}=Un(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,asyncLoad:p,readOnly:h,disabled:f}=e.option,{itemList:g,changeOnSelect:v,checkStrictly:y,checkStrategy:b="SHOW_PARENT",filterable:E=!0,dropdownStyle:w,openPyt:S=!0}=s,[N,T]=t.useState(wn(g)?i:g),I=t.useRef(N);Fl((()=>{const e=wn(g)?i:g;p?C(e,I.current)||(T(e),I.current=e):T(e)}),[g,i]);const R=e=>ao(N,null!=e?e:"").map((e=>e.text)).join("/"),O=e=>l?(null==e?void 0:e.map((e=>R(e))).join(","))||"":R(e);return n.isOnlyShow?t.createElement(Co,{value:O(r),bordered:u}):t.createElement(Ce,Kn({value:(e=>wn(e)?[]:l?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:N,multiple:l,maxTagCount:"responsive",changeOnSelect:v||y,showCheckedStrategy:Ce[b],popupClassName:`form-popper__${o}`,dropdownStyle:w,placeholder:d,style:c,bordered:u,allowClear:m,disabled:f,showSearch:E&&!p&&{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())||"",l=Eo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(S?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?e=>pn(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!p||n.children)return;const{fetchApi:r,params:l,dataKey:i,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=p;if(r)try{const e=yield r(c(Object.assign(Object.assign({},l),{[o]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=x(e.data,i))&&void 0!==t?t:[],l=Zp(N,n.value,o,lo(r,o,a));T(l),null==s||s(r)}}catch(e){}})):void 0},l?{title:O(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,O(t),N)})(((e=[])=>l?e.map((e=>e.join(","))):e.join(","))(t))}}))};class nh extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>pn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=lo(n,i,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(i),className:Ae(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":Tn(d)},required:e.getFormItemRequired(h)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(th,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(se,{flex:Tn(m.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}nh.contextType=Mi;const rh=["110000","120000","310000","500000"],lh=["810000","820000"],ih=[{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"}],ah=[{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"}],oh=e=>Eo.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),sh=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...rh,...lh].includes(e))):Object.keys(e[t])).map((r=>({l:oh(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:sh(e,r,n+1)})))},ch=(e,t)=>t.map((t=>({l:oh(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class dh extends d{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}),jt(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:ch(nn,rh)},{l:"Z2",n:"港澳",c:"",p:"",children:ch(nn,lh)}]}createProvince(){var e;return(null!==(e=sh(nn,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return ah.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...rh,...lh].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(he.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(he.Button,{value:"0"},dn("qm.form.citySelectType.0")),t.createElement(he.Button,{value:"1"},dn("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?ih:ah).map((n=>t.createElement("li",{key:n.value,className:Ae({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement(ce,{size:"small",placeholder:dn("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(ce.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 l;return t.createElement("div",{key:r},t.createElement("dt",{ref:e=>this[`${n.l}Ref`]=e},n.n,":"),t.createElement("dd",null,null===(l=n.children)||void 0===l?void 0:l.map((n=>t.createElement("li",{key:n.c,className:Ae({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:l,options:i={},style:a={},placeholder:o=dn("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=nr("form-city-select"),p=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,h=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},a)},t.createElement("div",{className:"city-drop"},t.createElement("div",{className:"city-drop-toper"},t.createElement("div",{className:"city-drop-toper__type"},this.renderType()),t.createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t.createElement("div",{className:"city-drop-letter"},this.renderLetter()),t.createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t.createElement("dl",null,this.renderCity(r)))));return t.createElement(an.Consumer,null,(r=>{const i={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(Co,{value:h,bordered:s}):t.createElement(ld,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:Ae(i,`form-popper__${l}`),popupStyle:{minWidth:p},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ba,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(ne,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},a),value:h,title:h,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}dh.contextType=Mi;class uh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(dh,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}uh.contextType=Mi;const mh=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:mh(e,n)})))};class ph extends d{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=mh(nn,"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 l=io(e,t[r]);if(l&&wn(l.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(null==l?void 0:l.children)&&(n[r+1]=null==l?void 0:l.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}getStreetList(e){var t;return pn(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:l=(e=>e),dataKey:i,valueKey:a="value",textKey:o="text"}=n;if(r)try{const n=yield r(l({code:e}));if(200===n.code){const e=Array.isArray(n.data)?n.data:null!==(t=x(n.data,i))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var l;const i=(null===(l=n.find((t=>t.value===e[r])))||void 0===l?void 0:l.text)||`${dn("qm.form.selectPlaceholder").replace("...","")}(${dn("qm.form.regionSelectLabel")[r]})`;return t.createElement(Ai.TabPane,{key:r.toString(),tab:i},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:Ae({"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(Ai,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(Zl,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:l,options:i={},style:a={},placeholder:o=dn("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=nr("form-region-select"),p=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,h=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(an.Consumer,null,(r=>{const i={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(Co,{value:f,bordered:s}):t.createElement(ld,{action:u?[]:["click"],popupVisible:!u&&n,popup:h,popupClassName:Ae(i,`form-popper__${l}`),popupStyle:{minWidth:p},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ba,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(ne,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:Object.assign({width:"100%"},a),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&xn((()=>this.initial()))}})))}))}}ph.contextType=Mi;class hh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(ph,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(i,n)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}hh.contextType=Mi;const fh=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:v,onPreview:y,onDownload:b,onRemove:E,onSortChange:w,onEditChange:C}=a,{action:S,headers:N,params:T,withCredentials:I=!1,dataKey:R="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:A}=o,P="function"==typeof k?k():k||{},{t:_}=Un();return t.createElement(Ni,{name:"file",action:S,multiple:d,headers:N,data:T,withCredentials:I,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:v,disabled:s||n.props.disabled,readOnly:n.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(qe,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const l in P)r[l]=e[l]||(null===(t=n.data)||void 0===t?void 0:t[P[l]])||"";return e.response&&200!==n.code&&te.error(n.message||_("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(R?x(n.data,R):n.data)||"",status:e.status})}));null==l||l(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(e)},onPreview:y,onDownload:b,onRemove:E,onSortChange:w,onEditChange:C})};class gh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(fh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,"")}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}gh.contextType=Mi;const vh=t.forwardRef(((e,n)=>{const r=In({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:l,style:i,src:a,alt:o,imgStyle:s}=r,c=un(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 rn(d.current,e),()=>{y(),u.current=null}}),[]);const m=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.reset()},p=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},h=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.crop()},f=(e,t=!1)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.replace(e,t)},g=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.enable()},v=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.disable()},y=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.destroy()},b=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.move(e,t)},x=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.moveTo(e,t)},E=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoom(e)},w=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},C=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotate(e)},S=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotateTo(e)},N=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleX(e)},T=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleY(e)},I=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.scale(e,t)},R=(e=!1)=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getData(e)},O=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setData(e)},k=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getContainerData()},L=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getImageData()},A=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCanvasData()},P=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCanvasData(e)},_=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},F=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},D=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},M=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},H=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setDragMode(e)};t.useImperativeHandle(n,(()=>({reset:m,clear:p,initCrop:h,replace:f,enable:g,disable:v,destroy:y,move:b,moveTo:x,relativeZoom:E,zoomTo:w,rotate:C,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:_,setCropBoxData:F,getCroppedCanvas:D,setAspectRatio:M,setDragMode:H})));const $={[nr("cropper")]:!0};return t.createElement("div",{className:Ae($,l),style:i},t.createElement("img",{ref:d,src:a,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));vh.displayName="Cropper";const yh=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:l,quality:i,beforeCrop:a,className:o}=e,{t:s}=Un(),c=t.useRef(null),d=t.useRef(),u=t.useRef(),m=t.useRef(),p=t.useRef(),[h,f]=t.useState(""),g=e=>{c.current.relativeZoom(e)},v=e=>{c.current.rotate(e)},y=()=>{f("")},b=nr("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:l}=r,i=un(r,["beforeUpload"]);return d.current=l,t.createElement(n.type,Object.assign(Object.assign({},i),{beforeUpload:(e,t)=>new Promise(((n,r)=>pn(void 0,void 0,void 0,(function*(){const r=()=>n(ee.LIST_IGNORE);if(a&&!(yield a(e,t)))return void r();u.current=e,m.current=n,p.current=r;const l=new FileReader;l.onload=()=>{f(l.result),l.onload=null},l.readAsDataURL(e)}))))}))})(),h&&t.createElement(ie,{open:!0,wrapClassName:Ae(b,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{pn(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((l=>pn(void 0,void 0,void 0,(function*(){let i=new File([l],t,{type:e});if(Object.assign(i,{uid:r}),n.length&&!n.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return te.warning(s("qm.upload.tooltip",{type:n.join(",")})),p.current("file type is error");if("function"!=typeof d.current)return m.current(i);const a=d.current(i,[i]);if("boolean"==typeof a||a){if(!0===a)return m.current(i);if(!1===a)return p.current("not upload");if(a&&"function"==typeof a.then)try{const e=yield a,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),m.current(i)}catch(e){p.current(e)}}else Zn("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,i),yield bn(100),y()}))},onCancel:y,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:l?`calc(380px * ${l[1]/l[0]})`:"auto"};return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(vh,{ref:c,aspectRatio:l?l[0]/l[1]:l,src:h,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(Q,{size:"small"},t.createElement(G,{type:"primary",size:"middle",icon:t.createElement(Tt,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(G,{type:"primary",size:"middle",icon:t.createElement(It,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(G,{type:"primary",size:"middle",icon:t.createElement(Rt,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(G,{type:"primary",size:"middle",icon:t.createElement(Ot,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},bh=e=>{const n=In({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:l=!0,fixedSize:i,quality:a=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:m,className:p,popupClassName:h,beforeCrop:f,onSortChange:g,onChange:v}=n,{t:y}=Un(),{$size:b}=Yn(n),x=t.useRef(null),E=t.useRef(null),w=t.useRef(!1),[C,S]=t.useState(!1),[N,T]=t.useState(0),I=t.useMemo((()=>u||m),[u,m]),R=t.useMemo((()=>!c||r.length<c),[r,c]);t.useEffect((()=>(k(),document.addEventListener("paste",A),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",A)})),[]),Fl((()=>{R||(w.current=!1)}),[r]);const O=Gn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[l]=e.splice(t,1);e.splice(n,0,l),null==g||g(e),null==v||v({file:r[t],fileList:e})}})),k=()=>{d&&(E.current=qt.create(zl(x.current,nr("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:O}))},L=(e,t)=>new Promise(((r,l)=>pn(void 0,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:a,beforeUpload:o}=n,s=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!a||e.size/1024/1024<a,d=s&&c;if(s||te.warning(y("qm.upload.tooltip",{type:i.join(",")})),c||te.warning(y("qm.upload.sizeLimit",{size:a})),!d)return ee.LIST_IGNORE;if(o){const n=o(e,t);if(!0===n)return r(e);if(!1===n)return l("not upload");if(n&&"function"==typeof n.then)try{const e=yield n;r(e)}catch(e){l(e)}}else r(e)})))),A=Gn((e=>pn(void 0,void 0,void 0,(function*(){const{action:t,data:l,headers:i}=n;if(w.current&&R&&t)for(const n of e.clipboardData.items)if("file"===n.kind&&n.type.startsWith("image/")){const e=n.getAsFile(),a=Date.now(),o=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${a}`});try{yield L(o,[...r,o]);const e=new FormData;if(e.append("file",o),l)for(const t in l)e.append(t,l[t]);const n="string"==typeof t?t:yield t(o),a=yield fetch(n,{method:"POST",body:e,headers:i});if(!a.ok)throw new Error(y("qm.upload.uploadError"));const s=yield a.json();null==v||v({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})))),P=nr("upload-img"),_={[P]:!0,[`${P}--lg`]:"large"===b,[`${P}--sm`]:"small"===b},F=t.createElement(ee,Kn({className:Ae(_,p)},Sn(n,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:L,disabled:I,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,l)=>t.createElement("div",{className:Ae("upload-item",{handle:d})},e,!I&&t.createElement(rt,{title:y("qm.upload.remove"),className:"icon",onClick:()=>l.remove()}))}),t.createElement("span",{className:"inner",ref:x},R&&!(m&&r.length)&&t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(kt,null)),t.createElement("p",{className:"ant-upload-text"},y("qm.uploadCropper.dragableText")),t.createElement("button",{className:Ae("ant-upload-button",{disabled:I}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,l?t.createElement(yh,{className:h,fixedSize:i,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},F):F,t.createElement("div",{style:{display:"none"}},t.createElement(Se.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:C,current:N,rootClassName:h,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(Se,{key:e.uid||n,src:e.url,alt:""}))))))};bh.displayName="QmUploadImg";const xh=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:v,onRemove:y,onSortChange:b}=a,{action:E,headers:w,params:C,withCredentials:S=!1,dataKey:N="",popupClassName:T,fieldAliasMap:I,beforeUpload:R}=o,O="function"==typeof I?I():I||{},{t:k}=Un();return t.createElement(bh,{name:"file",action:E,multiple:d,headers:w,data:C,withCredentials:S,popupClassName:T,beforeUpload:R,maxCount:u,fixedSize:m,quality:p,openCropper:h,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 l in O)r[l]=e[l]||(null===(t=n.data)||void 0===t?void 0:t[O[l]])||"";return e.response&&200!==n.code&&te.error(n.message||k("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(N?x(n.data,N):n.data)||"",status:e.status})}));null==l||l(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(e)},onRemove:y,onSortChange:b})};class Eh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(xh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,"")}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Eh.contextType=Mi;const wh={onActivate:Wt.func,onAddUndo:Wt.func,onBeforeAddUndo:Wt.func,onBeforeExecCommand:Wt.func,onBeforeGetContent:Wt.func,onBeforeRenderUI:Wt.func,onBeforeSetContent:Wt.func,onBeforePaste:Wt.func,onBlur:Wt.func,onChange:Wt.func,onClearUndos:Wt.func,onClick:Wt.func,onContextMenu:Wt.func,onCommentChange:Wt.func,onCopy:Wt.func,onCut:Wt.func,onDblclick:Wt.func,onDeactivate:Wt.func,onDirty:Wt.func,onDrag:Wt.func,onDragDrop:Wt.func,onDragEnd:Wt.func,onDragGesture:Wt.func,onDragOver:Wt.func,onDrop:Wt.func,onExecCommand:Wt.func,onFocus:Wt.func,onFocusIn:Wt.func,onFocusOut:Wt.func,onGetContent:Wt.func,onHide:Wt.func,onInit:Wt.func,onKeyDown:Wt.func,onKeyPress:Wt.func,onKeyUp:Wt.func,onLoadContent:Wt.func,onMouseDown:Wt.func,onMouseEnter:Wt.func,onMouseLeave:Wt.func,onMouseMove:Wt.func,onMouseOut:Wt.func,onMouseOver:Wt.func,onMouseUp:Wt.func,onNodeChange:Wt.func,onObjectResizeStart:Wt.func,onObjectResized:Wt.func,onObjectSelected:Wt.func,onPaste:Wt.func,onPostProcess:Wt.func,onPostRender:Wt.func,onPreProcess:Wt.func,onProgressState:Wt.func,onRedo:Wt.func,onRemove:Wt.func,onReset:Wt.func,onSaveContent:Wt.func,onSelectionChange:Wt.func,onSetAttrib:Wt.func,onSetContent:Wt.func,onShow:Wt.func,onSubmit:Wt.func,onUndo:Wt.func,onVisualAid:Wt.func,onSkinLoadError:Wt.func,onThemeLoadError:Wt.func,onModelLoadError:Wt.func,onPluginLoadError:Wt.func,onIconsLoadError:Wt.func,onLanguageLoadError:Wt.func},Ch=Object.assign({apiKey:Wt.string,id:Wt.string,inline:Wt.bool,init:Wt.object,initialValue:Wt.string,onEditorChange:Wt.func,value:Wt.string,tagName:Wt.string,cloudChannel:Wt.string,plugins:Wt.oneOfType([Wt.string,Wt.array]),toolbar:Wt.oneOfType([Wt.string,Wt.array]),disabled:Wt.bool,textareaName:Wt.string,tinymceScriptSrc:Wt.string,rollback:Wt.oneOfType([Wt.number,Wt.oneOf([!1])]),scriptLoading:Wt.shape({async:Wt.bool,defer:Wt.bool,delay:Wt.number})},wh),Sh=e=>"function"==typeof e,Nh=e=>e in wh,Th=e=>e.substr(2),Ih=(e,t,n,r,l)=>((e,t,n,r,l,i,a)=>{const o=Object.keys(l).filter(Nh),s=Object.keys(i).filter(Nh),c=o.filter((e=>void 0===i[e])),d=s.filter((e=>void 0===l[e]));c.forEach((e=>{const t=Th(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const l=r(e,n),i=Th(n);a[i]=l,t(i,l)}))})(l,e.on.bind(e),e.off.bind(e),((t,n)=>r=>{var l;return null===(l=t(n))||void 0===l?void 0:l(r,e)}),t,n,r);let Rh=0;const Oh=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return Rh++,e+"_"+n+Rh+String(t)},kh=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Lh=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Ah=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Ph=()=>({listeners:[],scriptId:Oh("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),_h=(()=>{let e=Ph();return{load:(t,n,r,l,i,a)=>{const o=()=>((e,t,n,r,l,i)=>{const a=t.createElement("script");a.referrerPolicy="origin",a.type="application/javascript",a.id=e,a.src=n,a.async=r,a.defer=l;const o=()=>{a.removeEventListener("load",o),i()};a.addEventListener("load",o),t.head&&t.head.appendChild(a)})(e.scriptId,t,n,r,l,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?a():(e.listeners.push(a),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Ph()}}})(),Fh=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Dh extends e.Component{constructor(t){var n,r,l;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 l=this.elementRef.current;if(!l)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})(l)){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 i=Fh(this.view);if(!i)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},this.props.init),{selector:void 0,target:l,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,Lh(o).concat(Lh(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&&!kh(l)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&Sh(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 l=null!==(n=this.props.disabled)&&void 0!==n&&n;Ah(this.editor,l?"readonly":"design"),this.props.init&&Sh(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(l.style.visibility=""),kh(l)&&(l.value=this.getInitialValue()),i.init(a)},this.id=this.props.id||Oh("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(l=null!==(n=this.props.inline)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.inline)&&void 0!==l&&l,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;Ah(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,l,i;null!==Fh(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&_h.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!==(i=null===(l=this.props.scriptLoading)||void 0===l?void 0:l.delay)&&void 0!==i?i: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=Fh(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){Ih(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 Mh;Dh.propTypes=Ch,Dh.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}(Mh||(Mh={}));const Hh=e=>{var n;const{className:r,style:l,tinymce:i={},upload:a={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:m}=e,{global:p}=t.useContext(an),{$size:h}=Yn(e),{$locale:f,t:g}=Un(),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",E="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",w=Object.assign(Object.assign({height:i.height||v,plugins:i.plugins||y,toolbar:i.toolbar||E,menubar:i.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:Mh[f],skin:"tinymce-5"},Sn(i,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>{const{action:t,headers:n,dataKey:r,customHandler:l}=a;return l?l(e):new Promise(((l,i)=>pn(void 0,void 0,void 0,(function*(){const a=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(t&&c/1024/1024>o)try{const e=yield fetch(t,{method:"POST",body:s,headers:n});if(!e.ok)throw i(""),new Error(g("qm.upload.uploadError"));const a=yield e.json();if(200===a.code){const e=r?x(a.data,r):a.data;l(e)}}catch(e){te.error(g("qm.uploadCropper.uploadError"))}else l(a)}))))},setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),C=nr("tinymce"),S={[C]:!0,[`${C}--lg`]:"large"===h,[`${C}--sm`]:"small"===h},N={init:w,value:d,disabled:c,tinymceScriptSrc:s||(null===(n=null==p?void 0:p.tinymce)||void 0===n?void 0:n.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==m||m(t.getContent(),t)}};return t.createElement("div",{className:Ae(S,r),style:l},t.createElement(Dh,N))};Hh.displayName="QmTinymce";const $h=e=>{const{$$form:n}=t.useContext(Mi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:m,onResizeEditor:p}=a;return t.createElement(Hh,{value:r,tinymce:u,upload:o,thresholdSize:m,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{null==l||l(e),i(e)})(e)}})};class qh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=vn}=this.props.option;return t.createElement(ae.Item,{label:e.renderFormLabel(r),className:Ae(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":Tn(s)},required:e.getFormItemRequired(m)},t.createElement(oe,{wrap:!1,gutter:4},t.createElement(se,{flex:"auto"},t.createElement(ae.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement($h,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(se,{flex:Tn(d.labelWidth||Ka)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}qh.contextType=Mi;class Kh extends d{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=$(this.resizeObserveHandler,10),this.getFormItems=zt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=zt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{f(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(","),"]")})));Ne.error({message:dn("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&jt(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,t;return null!==(e=this.props.compactMode)&&void 0!==e?e:"small"===this.$size&&!!(null===(t=this.context.global)||void 0===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(){ri(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){li(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&&Zn("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=>f(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=>f(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:l}=e;return t=null!=t?t:void 0,Wa.includes(r)&&(t=null!=t?t:[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=null!==(n=null!=t?t:null==l?void 0:l.falseValue)&&void 0!==n?n:Va),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=this.props.items.map((e=>({fieldName:e.fieldName,hidden:e.hidden})))}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){e!==this.state.collapse&&this.setState({collapse:e},(()=>{xn((()=>{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,l,i;if(oo(e))return Ta(e);if(f(e)){const{fieldName:a,label:o,options:s={}}=e;if(oo(o))return Ta(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([a])[a])&&void 0!==n?n:this._initialValues[a])&&void 0!==r?r:null===(l=c[0])||void 0===l?void 0:l.value;return(null===(i=c.find((e=>e.value===d)))||void 0===i?void 0:i.text)||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){var n,r;if("DIVIDER"===e)return!0;const l=this.getBlockDerivedItems();for(let e=0,i=l.length;e<i;e++){const i=l[e],a=this.dividers.find((e=>e.fieldName===i[0].fieldName)),o=null!==(r=null===(n=null==a?void 0:a.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:i.length-1;for(let e=1;e<i.length;e++){if(i[e].fieldName===t&&e>o)return this.state.expand[i[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const l=e[r];if(eo(l)&&(e[r]=""),Array.isArray(l)&&l.forEach(((t,n)=>{eo(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(l)){const[i,a]=r.split("|");e[i]=null!==(t=l[0])&&void 0!==t?t:"",e[a]=null!==(n=l[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)wn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return pn(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let l=Sn(r,["fetch"]);if(r.fetch){const{api:t,params:n,dataKey:i}=r.fetch;try{const r=yield t(n);200===r.code&&(l=null!==(e=i?x(r.data,i):r.data)&&void 0!==e?e:{})}catch(e){}}if(Array.isArray(l.fieldList)){const e=this.props.items.map((e=>{const{fieldName:t}=e,n=l.fieldList.find((e=>e.dataIndex===t));if(n){const r=this.originItems.find((e=>e.fieldName===t)),{visible:l=1,disabled:i,secretName:a}=n;l||(e.noAuth=!0,r.noAuth=!0),i&&(e.disabled=!0,r.disabled=!0),a&&(e.options?e.options.secretType=a:e.options={secretType:a},r.options=Object.assign({},r.options,{secretType:a})),this.setFieldAuth(t,{visible:l,disabled:i,secretName:a})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(Lo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(Po,{option:e})}INPUT_NUMBER(e){return t.createElement(Fo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement(Mo,{option:e})}SEARCH_HELPER(e){return t.createElement(up,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(hp,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(Ep,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(Cp,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(Op,{option:e})}CHECKBOX(e){return t.createElement(Ro,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(Lp,{option:e})}RATE(e){return t.createElement(Pp,{option:e})}RADIO(e){return t.createElement(Fp,{option:e})}SWITCH(e){return t.createElement(Mp,{option:e})}TEXT_AREA(e){return t.createElement($p,{option:e})}DATE(e){return t.createElement(Kp,{option:e})}RANGE_DATE(e){return t.createElement(zp,{option:e})}TIME(e){return t.createElement(Bp,{option:e})}RANGE_TIME(e){return t.createElement(Gp,{option:e})}SELECT(e){return t.createElement(To,{option:e})}MULTIPLE_SELECT(e){return t.createElement(To,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(Xp,{option:e})}DIVIDER(e){return t.createElement(Qp,{option:e})}TREE_SELECT(e){return t.createElement(eh,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(eh,{option:e,multiple:!0})}CASCADER(e){return t.createElement(nh,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(nh,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(uh,{option:e})}REGION_SELECT(e){return t.createElement(hh,{option:e})}UPLOAD_FILE(e){return t.createElement(gh,{option:e})}UPLOAD_IMG(e){return t.createElement(Eh,{option:e})}TINYMCE(e){return t.createElement(qh,{option:e})}renderFormLabel(e){if(oo(e)||!f(e))return t.createElement("span",{className:"text",title:Ta(e)},e);const{type:n,fieldName:r,label:l,options:i={},onChange:a=vn}=e,{itemList:o=[]}=i;return"SELECT"===n?t.createElement(ae.Item,{name:r,noStyle:!0},t.createElement(No,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{className:"text",style:{paddingRight:5}},l),t.createElement(ae.Item,{name:r,noStyle:!0},t.createElement(Io,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:l={},render:i}=e,{extra:a}=this.state;if(r)return t.createElement(Y,{className:"extra-tooltip",title:a[n]},t.createElement(Lt,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n));return t.createElement("div",{className:"extra-text",title:i?"":a[n],style:l},t.createElement("span",{className:"extra-overflow-cut"},i?i(o,this):a[n]))}renderFormItemButton(e,t){const n=this.formItems.find((t=>t.fieldName===e)),r="function"==typeof t?t(n):t;return this.isOnlyShow?null:r}renderFormItem(e){const{label:n,fieldName:r,invisible:l,tooltip:i,className:a,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return t.createElement(ae.Item,{label:this.renderFormLabel(n),name:r,rules:c,tooltip:i,hidden:l,className:Ae(a),style:Object.assign({width:"100%"},d),labelCol:{flex:this.verticalLayout?"initial":Tn(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):t.createElement(t.Fragment,null))}createFormItem(e){return v(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(Zn("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:r,isFieldsDefine:l}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<n;e++)i.push({})}));const a=24/e,o=[],s=i.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=i.map(((n,r)=>{let{selfCol:l=1}=n;const{type:i,fieldName:s}=n;l=l>=24||"DIVIDER"===i||"TINYMCE"===i?e:l;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(o[r]),t.createElement(se,{key:null!=s?s:r,className:s,span:l*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},i?this.createFormItem(Nn(n)):null)}));return l&&"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:l,isSearchBtn:i,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=l||1,c=n-e%n-s;return i?t.createElement(se,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(Q,{style:{marginBottom:12}},t.createElement(Jn,{type:"primary",size:this.$size,icon:t.createElement(St,null),onClick:()=>this.SUBMIT_FORM()},dn("qm.form.search")),t.createElement(Jn,{size:this.$size,icon:t.createElement(Ue,null),onClick:()=>this.RESET_FORM()},dn("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(Pe,null):t.createElement(_e,null)," ",dn(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 l=24/e;return r&&"default"===n?t.createElement(oe,{gutter:0},t.createElement(se,{key:"-",span:l},t.createElement(ae.Item,null,t.createElement(Q,{style:{marginBottom:12}},t.createElement(Jn,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},dn("qm.form.save")),t.createElement(Jn,{size:this.$size,onClick:()=>this.RESET_FORM()},dn("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(Oo,{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)=>pn(this,void 0,void 0,(function*(){const[n,r]=yield this.VALIDATE_FIELDS(),l=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:[dn("qm.form.searchHelperTips")],warnings:[]})));n||l.length?t((n||[]).concat(l)):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 pn(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 pn(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 pn(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))),l={};return r.forEach((e=>l[e]=void 0)),{other:Object.assign({},this._initialOthers,l)}})),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){Zn("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:l}=this.props,i=r.find((t=>t.fieldName===e));if(!i)return Zn("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!f(t))return Zn("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return Zn("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||E(i,n,t[n]));n&&(l?l([...r]):Zn("Form","需要设置 `fieldsChange` 参数"))}render(){var e,n;const{className:r,style:l,layout:i,disabled:a,labelWidth:o,labelAlign:s,labelWrap:c,customClass:d}=this.props,u=nr("form"),m={required:"${label}"+dn("qm.form.requiredTips")},p={[u]:!0,[`${u}--lg`]:"large"===this.$size,[`${u}--sm`]:"small"===this.$size,[`${u}__only-show`]:this.isOnlyShow,[`${u}__compact`]:this.isCompactMode,[d]:!!d};return t.createElement("div",{ref:this.wrapperRef,className:Ae(p,r),style:l},t.createElement(ae,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:i,labelAlign:s,labelWrap:null!==(n=null!=c?c:null===(e=this.context.global)||void 0===e?void 0:e.labelWrap)&&void 0!==n&&n,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":Tn(o)},validateMessages:m,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Mi.Provider,{value:this.provide},t.createElement(oe,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Kh.contextType=an,Kh.propTypes=Xa,Kh.defaultProps=Qa;const jh=e=>null!=e;function Vh(e,n,r,l){const[i,a]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[o,s]=t.useState(null),c=()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:l,bottom:i,left:a}=e.getBoundingClientRect();return r>=0&&a>=0&&l<=t&&i<=n})(i)&&n&&i.scrollIntoView(l);const{left:e,top:t,width:r,height:a}=i.getBoundingClientRect(),o={left:e,top:t,width:r,height:a,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[i,n]),cs({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]),i]}const zh={fill:"transparent",pointerEvents:"auto"},Wh=e=>{const{prefixCls:n,rootClassName:r,pos:l,showMask:i,style:a={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${Zo()}`,m="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(en,{open:s,autoLock:!0},t.createElement("div",{className:Ae(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},a)},i?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"}),l&&t.createElement("rect",{x:l.left,y:l.top,rx:l.radius,width:l.width,height:l.height,fill:"black",className:m?`${n}-placeholder-animated`:""}))),t.createElement("rect",Kn({},l?null:zh,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),l&&t.createElement(t.Fragment,null,t.createElement("rect",Kn({},zh,{x:"0",y:"0",width:"100%",height:`${l.top}px`})),t.createElement("rect",Kn({},zh,{x:"0",y:"0",width:l.left,height:"100%"})),t.createElement("rect",Kn({},zh,{x:"0",y:l.top+l.height,width:"100%",height:`calc(100vh - ${l.top+l.height}px)`})),t.createElement("rect",Kn({},zh,{x:l.left+l.width,y:"0",width:`calc(100vw - ${l.left+l.width}px)`,height:"100%"})))):null))},Bh=e=>{const{prefixCls:n,zIndex:r,open:l,onPause:i,onPlay:a}=e,[o,s]=rs(void 0,{value:l,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=Gn((e=>{m(e),e.shiftKey&&32===e.keyCode&&p()}));t.useEffect((()=>{const e=Kt(document,"keyup",u);return()=>e.remove()}),[]);const m=e=>{e.stopPropagation(),e.preventDefault()},p=()=>{d.current?d.current=!1:(s(!o),o?null==i||i():null==a||a())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,l=window.innerWidth,i=window.innerHeight,a=e.clientX-Vl(t).x,o=e.clientY-Vl(t).y;return document.onmousemove=e=>{let s=e.clientX-a,c=e.clientY-o;s<0&&(s=0),s>l-n-1&&(s=l-n-1),c<0&&(c=0),c>i-r-1&&(c=i-r-1),ql(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>p()},o?t.createElement(At,null):t.createElement(vt,null))},Uh=e=>{const{prefixCls:n,current:r,total:l=0,cover:i,title:a,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:m,onNext:p,onFinish:h,className:f,indicatorsRender:g}=e,{t:v}=Un(),y="primary"!==c?"primary":"default",b=Gn((e=>{C(e),40===e.keyCode&&(r<l-1?null==p||p():null==h||h()),38===e.keyCode&&r>0&&(null==m||m())}));t.useEffect((()=>{const e=Kt(document,"keyup",b);return()=>e.remove()}),[]);const x=jh(i)?t.createElement("div",{className:`${n}-cover`},i):null,E=jh(o)?t.createElement("div",{className:`${n}-description`},o):null;let w;w=g?g(r,l):[...Array.from({length:l}).keys()].map(((e,l)=>t.createElement("span",{key:e,className:Ae(l===r&&`${n}-indicator-active`,`${n}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:Ae(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(rt,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(ge,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(Pt,{className:Ae(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},a)),E,t.createElement("div",{className:`${n}-footer`},l>1&&t.createElement("div",{className:`${n}-indicators`},w),t.createElement(tr,{className:`${n}-buttons`},0!==r?t.createElement(Jn,{className:`${n}-prev-btn`,size:"small",onMouseDown:C,onClick:m},v("qm.tour.prevStep")):null,r===l-1?t.createElement(Jn,{className:`${n}-finish-btn`,type:y,size:"small",onClick:h},v("qm.tour.finish")):t.createElement(Jn,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:p},v("qm.tour.nextStep"))))))},Gh=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(Uh,e))},Yh={left:"50%",top:"50%",width:1,height:1},Xh=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:l,current:i,onChange:a,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:m=!0,control:p=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:w=!0,scrollIntoViewOptions:C=!0}=e,S=un(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]=rs(0,{value:i,defaultValue:l}),[R,O]=rs(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=rs(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),_=t.useRef(R);t.useLayoutEffect((()=>{R&&!_.current&&I(0),_.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:F,type:D,placement:M,trigger:H,delay:$,style:q,arrow:K,className:j,mask:V,scrollIntoViewOptions:z,zIndex:W,action:B}=r[T]||{},U=W||k,G=D||d,Y=R&&(null!=V?V:u),X=null!=z?z:C,[Q,Z]=Vh(F,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Z,g,M),ee=!!Z&&(void 0===K?m:K),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),Fl((()=>{R&&(le(),null==B||B(Z,T))}),[R,Z]);const ne=e=>{I(e),null==a||a(e)},re=()=>{O(!1),null==o||o(T)},le=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===$l(r=n,"display")||"hidden"===$l(r,"visibility")||"0"===$l(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 ie=()=>pn(void 0,void 0,void 0,(function*(){if(!H||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[l,i]=[e+n/2,t+r/2],a=new MouseEvent(H,{bubbles:!0,cancelable:!0,button:0,clientX:l,clientY:i}),o=document.elementFromPoint(l,i);o&&(o.dispatchEvent(a),yield bn(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=nr("tour"),de=[{[`${ce}-primary`]:"primary"===G},h,j],ue=Ud({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Wh,{zIndex:U,prefixCls:ce,pos:Q,showMask:ae,style:null==oe?void 0:oe.style,fill:null==oe?void 0:oe.color,open:A,animated:w,rootClassName:h}),t.createElement(en,{open:A,autoLock:!0},t.createElement(Qt,Kn({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:Ae(de),prefixCls:ce,popup:()=>t.createElement(Gh,Kn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>pn(void 0,void 0,void 0,(function*(){yield ie(),ne(T-1)})),onNext:()=>pn(void 0,void 0,void 0,(function*(){yield ie(),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:Ae(h,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Q||Yh),{position:"fixed",pointerEvents:"none"})}))),p&&t.createElement(en,{open:R},t.createElement(Bh,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));Xh.displayName="QmTour";var Qh={previewWidth:1100,defaultDistance:.45,logoHeight:60};const Zh=n(void 0);var Jh=null;function ef(){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),l=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!n&&i)return!0;if(l){if((l=l[0].match(/\d+/))[0]>=41||i)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var a=e.match(/Chrome\D?\d+/i);if(a&&(a=a[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function tf(e,t){var n;try{var r=navigator.userAgent,l=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(ef()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void te.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else{l&&r.match(/x64/i);if(e||t?n=l?e:t:Jh?n=Jh:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),l?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),Jh=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&ef(),n}catch(e){te.error("getLodop 出错:"+e)}}ef();const nf=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)},rf=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:l}=e,{global:i}=t.useContext(an),{$$preview:a}=t.useContext(Zh),{state:o,isWindowsPrinter:s,pageSize:c}=a,d=t.useRef(null),u=t.useRef({}),m=t.useRef([]),p=t.useRef([]),h=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:L,createPrintHtml:k,SHOW_PREVIEW:A,DIRECT_PRINT:P}))),Fl((()=>{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*Qh.defaultDistance+10*Qh.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*Qh.defaultDistance+10*Qh.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return nf(v-10*(e.left-Qh.defaultDistance)-10*(e.right-Qh.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return nf(y-10*(e.top-Qh.defaultDistance)-10*(e.bottom-Qh.defaultDistance))}),[o,y]),E=o.form.scale,w=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:nf(10*e.left),right:nf(10*e.right),top:nf(10*e.top),bottom:nf(10*e.bottom)}}),[o]),C=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:l}=w,i=b+t+n,a=Qh.previewWidth-i<=0?0:(Qh.previewWidth-i)/2,s=Math.abs((1-E)*i/2);let c=0;return E>1&&(c=s>a?-1*a:-1*s),E<1&&(c=i-2*s>Qh.previewWidth?0:a>0?s:(Qh.previewWidth-(i-2*s))/2),{width:`${b}px`,height:""+("stylus"===e?"auto":x+"px"),paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${l}px`,transform:`translateX(${c}px) scale(${E})`,opacity:f?0:1}}),[o,f,w,E,x,b]);m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const S=()=>{var e,t,n,r;const l=null!==(t=null===(e=null==i?void 0:i.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",a=null!==(r=null===(n=null==i?void 0:i.print)||void 0===n?void 0:n.rightLogo)&&void 0!==r?r:"";return[`<tr style="height: ${Qh.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',l?`<img src="${l}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',a?`<img src="${a}" border="0" height="46" />`:"","</td>","</tr>"].join("")},N=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},T=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=u.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},I=()=>{const e=u.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const l=e[r].clientHeight;e[r].style.height=l+"px",n.push(l),t.push(e[r].outerHTML)}p.current=n,m.current=t},R=()=>{var e;if(!m.current.length)return;const{form:{setting:t,printerType:n}}=o;if(l)return h.current.push([N(),S(),...m.current]);const r=t.fixedLogo?x-Qh.logoHeight:x;let i=[];if(h.current=[],"stylus"===n)h.current.push([N(),...t.fixedLogo?[S()]:[],...m.current]);else{let e=0;for(let n=0,l=p.current.length;n<l;n++){const a=m.current[n],o=p.current[n];t.fixedLogo||0!==n||(e+=Qh.logoHeight),e+=o,e<=r?i.push(a):(h.current.push([N(),...t.fixedLogo?[S()]:[],...i]),i=[],e=0,n-=1),n===l-1&&i.length&&h.current.push([N(),...t.fixedLogo?[S()]:[],...i])}}t.fixedLogo||null===(e=h.current[0])||void 0===e||e.splice(1,0,S());for(let e=0,t=h.current.length;e<t&&e!==t-1;e++)h.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:h.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=h.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+=[...h.current[e-1]].join("")}else for(let e=0;e<h.current.length;e++)t+=h.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+S()+N()+e.join("")+"</table>"},A=()=>pn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();u.current.previewEl.innerHTML||(T(),yield bn(0),I(),R(),g(!1))})),P=()=>pn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();T(),yield bn(0),I(),R(),g(!1),a.doPrint(k()),yield bn(0),a.doClose()})),_=()=>{Zn("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},F={[nr("print-container")]:!0,"no-visible":l};return t.createElement("div",{ref:d,className:Ae(F)},t.createElement(Jl,{wrapperClassName:"spin",spinning:f,tip:"Loading..."},t.createElement("div",{className:"preview"},t.createElement("div",{className:"origin-template",style:{width:`${b}px`,marginLeft:`-${Math.floor(b/2)}px`}},null==r?void 0:r()),t.createElement("div",{className:"workspace",style:C}))))}));rf.displayName="Container";class lf extends d{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:dn("qm.print.setPanel.printParameter")},{type:"SELECT",label:dn("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:dn("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:dn("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:dn("qm.print.setPanel.vertical"),value:"vertical"},{text:dn("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:dn("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:dn("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:dn("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:dn("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:dn("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Qh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:dn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:dn("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Qh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:dn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:dn("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Qh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:dn("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:dn("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Qh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:dn("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:dn("qm.print.setPanel.sizeUnit"),disright:dn("qm.print.setPanel.sizeUnit"),distop:dn("qm.print.setPanel.sizeUnit"),disbottom:dn("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>pn(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(Kh,{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(Jn,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},dn("qm.dialog.close")),t.createElement(Jn,{type:"primary",onClick:()=>this.confirmHandle()},dn("qm.dialog.confirm"))))}}lf.contextType=an;class af extends d{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:Qh.defaultDistance,right:Qh.defaultDistance,top:Qh.defaultDistance,bottom:Qh.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=()=>pn(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 Xt.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=>pn(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)=>pn(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=tf();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:l,printerName:i,printerType:a,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Qh,{left:d,right:u,top:m,bottom:p}=l.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),l.doubleSide&&("auto"===l.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===a&&("vertical"===l.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===l.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===a&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*p*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==a?10*(p-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():te.error(dn("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=tf();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:l}}=this.state;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():te.error(dn("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===l.direction?1:2),t.SAVE_TO_FILE(`${p().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:dn("qm.print.laserPrinter"),value:"laser"},{text:dn("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=tf(),t=[{text:dn("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){Zn("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 pn(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield Xt.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),f(n)&&(yield Xt.setItem(this.printerKey,n))),f(n)&&Object.keys(n).length&&D(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:l,currentPage:i,totalPage:a,printPage:o}=this.state,s=nr("print-preview"),c={visible:r,title:dn("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:Ae(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,dn("qm.print.printer"),":",t.createElement(ce,{value:l.printerName,onChange:e=>{this.setState((t=>D({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(ce.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,dn("qm.print.type"),":",t.createElement(ce,{value:l.printerType,onChange:e=>{this.setState((t=>D({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(ce.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,dn("qm.print.copies"),":",t.createElement(me,{value:l.copies,min:1,precision:0,onChange:e=>{this.setState((t=>D({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,dn("qm.print.printPage.0"),t.createElement(me,{value:o,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),dn("qm.print.printPage.1")),t.createElement("span",null,t.createElement(be,{size:"small",current:i,pageSize:1,total:a,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(Jn,{type:"text",icon:t.createElement(Xe,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},dn("qm.print.setting"))),t.createElement("span",null,t.createElement(Jn,{type:"text",icon:t.createElement(qe,null),className:"text-btn",onClick:()=>this.exportClickHandle()},dn("qm.print.export"))),t.createElement("span",null,t.createElement(Jn,{icon:t.createElement(Ge,null),type:"primary",onClick:this.printClickHandle},dn("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(Zh.Provider,{value:this.provide},t.createElement(rf,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,dn("qm.print.scale"),":",t.createElement(Te,{value:l.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>D({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*l.scale)}%`)),t.createElement("span",null,dn("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,dn("qm.print.pageNumber"),":",dn("qm.print.pagination",{currentPage:i,totalPage:a}))))),t.createElement(Di,c,t.createElement(lf,{setting:l.setting,onChange:e=>{this.setState((t=>D({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(Zh.Provider,{value:this.provide},t.createElement(rf,{ref:this.containRef,templateRender:n,directPrint:!0}))}}af.contextType=an;class of extends d{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>pn(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:l,preview:i,closeAfterPrint:a}=this.props,o={visible:e,title:dn("qm.print.preview"),width:`${Qh.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:l,preview:i,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return i?t.createElement(Di,o,t.createElement(af,s)):e?t.createElement(af,s):null},this.DO_PRINT=()=>pn(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield bn(0),this.setState({visible:!0}),yield bn(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:n,icon:r,type:l,disabled:i,shape:a}=this.props,o={size:n||this.context.size||"",type:l,shape:a,icon:r,loading:e,disabled:i,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(Jn,o,this.props.children),this.createRender())}}function sf(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function cf(e){const t=sf(e);return t?t.frameElement:null}function df(e){const t=pf(e);return uf([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function uf(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 mf(e,t){const n=cf(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let l=n,i=!1;for(;l;){const e=df(l);if(r.push(e),l=cf(l),i)break;l&&sf(l)===t&&(i=!0)}return uf(r)}return e.getBoundingClientRect()}function pf(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)}}of.propTypes={size:(e,t,n)=>{if(!qa(e[t]||""))return Qn("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Bt.elementType},of.defaultProps={preview:!0,type:"primary",icon:t.createElement(Ge,null)},of.contextType=an;const hf=Object.assign;class ff{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=bf.border,this.padding.style.borderColor=bf.padding,this.content.style.backgroundColor=bf.background,hf(this.node.style,{borderColor:bf.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){yf(t,"margin",this.node),yf(t,"border",this.border),yf(t,"padding",this.padding),hf(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"}),hf(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class gf{constructor(e,t){this.tip=e.createElement("div"),hf(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),hf(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),hf(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),l=Math.max(n.width,60),i=5;let a;a=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+i:e.top+e.height+i:e.top-r<=t.top+t.height?e.top-r-i<t.top+i?t.top+i:e.top-r-i:t.top+t.height-r-i;let o=e.left+i;e.left<t.left&&(o=t.left+i);e.left+l>t.left+t.width&&(o=t.left+t.width-l-i);return a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:n.width,height:n.height});hf(this.tip.style,r.style)}}class vf{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 gf(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 ff(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=mf(e,this.window),l=pf(e);r.top=Math.min(r.top,n.top-l.marginTop),r.right=Math.max(r.right,n.left+n.width+l.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+l.marginBottom),r.left=Math.min(r.left,n.left-l.marginLeft);this.rects[t].update(n,l)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const l=mf(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:l.top+this.tipBoundsWindow.scrollY,left:l.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function yf(e,t,n){hf(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 bf={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 xf=null,Ef=null;function wf(){null!=window.document&&(xf=null,null!==Ef&&(Ef.remove(),Ef=null))}class Cf{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=>Wl(t,window.document.querySelector(e)))))return this._selectIgnore=!0,wf();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,l;n=[t],r=null,l=!1,null!=window.document?(null!==xf&&clearTimeout(xf),null!=n&&(null===Ef&&(Ef=new vf),Ef.inspect(n,r),l&&(xf=setTimeout((()=>wf()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=q((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(){wf(),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 Sf(e){return document.querySelector(e)}const Nf=e=>{const{action:n,onConfirm:r,onCancel:l,onFinish:i}=e,{t:a}=Un();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(tr,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(Jn,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.closeButton")),t.createElement(Jn,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(Jn,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.finishButton"))))},Tf={left:"50%",top:"50%",width:1,height:1},If=t.forwardRef(((e,n)=>{const{open:r,current:l,defaultCurrent:i,steps:a=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:m,zIndex:p,helper:h={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=Un(),E=t.useRef(),w=t.useRef(a.length),[S,N]=rs(0,{value:l,defaultValue:i}),[T,I]=rs(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=rs(1051,{value:p,defaultValue:p}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[_,F]=t.useState(T),[D,M]=t.useState(!1),[H,$]=Vh(k.node,!!r),[q,K]=t.useState(22),j=t.useRef(!1),V=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),z=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new Cf({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:Na(),node:e,path:t}),N(w.current),P(!0),B(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?W():B(),T?setTimeout((()=>F(!0)),16):F(!1),()=>{B()})),[T]),t.useEffect((()=>{w.current=a.length}),[a]);const W=()=>{E.current.startHandle()},B=()=>{E.current.stopHandle()},U=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:S,selector:k.path})})));const G=nr("guide-tracker"),Y=[{[`${G}-primary`]:!0}],Q=Ud({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(en,{open:T&&A,autoLock:!0},t.createElement(Qt,{zIndex:R,builtinPlacements:Q,popupPlacement:o,popupVisible:T&&A,popupClassName:Ae(Y,c),popupStyle:d,prefixCls:G,popup:()=>{const e=()=>{P(!1),W()};return t.createElement("div",{className:`${G}-content`},t.createElement("div",{className:`${G}-inner`},t.createElement(rt,{className:`${G}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(ue,{open:D,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Ut,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),n=a.map((e=>e.id));if(C(t,n))return;const r=t.findIndex((e=>e===k.id)),l=-1!==r?r:S;N(l),null==v||v(_a(e),l)}},a.map(((e,n)=>t.createElement("li",{key:n,className:Ae("item",{actived:e.id===k.id})},t.createElement(We,{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:Sf(e.selector),path:e.selector}),N(n),K(22===q?q+1:q-1),null==v||v(a,n))}},e.title),t.createElement(X,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=a.filter((t=>t.id!==e.id)),r=n===S;let l=n<=S?S-1:S;if(l=l<0?0:l,l=l>t.length?t.length:l,r&&t[l]){const{id:e,selector:n}=t[l];L({id:e,node:Sf(n),path:n})}N(l),null==v||v(t,l)}},t.createElement(rt,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${G}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>M(e)},t.createElement(_t,{className:Ae(`${G}-close`,"menu-icon"),style:{width:q}})),h.content&&t.createElement(ge,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:h.content,title:h.title},t.createElement(Pt,{className:Ae(`${G}-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"),z)),m?m({id:k.id,selector:k.path,actionStatus:V,DO_CLOSE:e},S):t.createElement(Nf,{action:V,onConfirm:()=>{null==v||v("add"===V?[...a,{id:k.id,selector:k.path,title:"Guide Title"}]:[...a],S),e()},onCancel:()=>{null==y||y(S),e()},onFinish:()=>{e(),null==y||y(S),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:Ae(`${G}-target-placeholder`),style:Object.assign(Object.assign({},H||Tf),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:U,onClick:U}))),s&&t.createElement(en,{open:_},t.createElement(Bh,{zIndex:R,prefixCls:G,onPause:()=>{j.current=A,P(!1),B()},onPlay:()=>{j.current?P(!0):W()}})))}));If.displayName="QmGuideTracker";const Rf=n=>{var r,l,i,a,o,s,c,d;const{content:u,image:m,width:p,height:h,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:w,className:C,style:S}=n,N=t.useRef(null),T=t.useRef(new Map),I=null!==(r=f.fontSize)&&void 0!==r?r:16,R=null!==(l=f.fontWeight)&&void 0!==l?l:"normal",O=null!==(i=f.fontStyle)&&void 0!==i?i:"normal",k=null!==(a=f.fontFamily)&&void 0!==a?a:"sans-serif",L=null!==(o=f.color)&&void 0!==o?o:"rgba(0, 0, 0, 0.15)",A=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],_=g[0],F=g[1],D=_/2,M=F/2,H=null!==(c=v[0])&&void 0!==c?c:D,$=null!==(d=v[1])&&void 0!==d?d:M,q=t.useMemo((()=>{const e=H-D,t=$-M;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:b}}),[D,M,H,$,b]),K=(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 l=document.createElement("div");l.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=N.current)||void 0===n||n.append(l),T.current.set(N.current,l)}},j=()=>{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,l]=(e=>{let t=120,n=64;if(!m&&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!=p?p:t,null!=h?h:n]})(t),i=r*n,a=l*n,o=(_+r)*n,s=(F+l)*n,c=_/2*n,d=F/2*n,u=o/2,f=s/2,g=2*(_+r);e.width=2*o,e.height=2*s,t.globalAlpha=x,t.save(),t.translate(u,f),t.rotate(Math.PI/180*y),t.translate(-u,-f);const v=()=>{t.restore(),t.drawImage(e,0,0,o,s,o,s,o,s),w&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),K(e.toDataURL(),g)},b=()=>{const e=Number(I)*n;t.font=`${O} normal ${R} ${e}px/${l}px ${k}`,t.fillStyle=L,t.textAlign=A,t.textBaseline="top",t.translate(i/2,0),P.forEach(((r,l)=>{t.fillText(null!=r?r:"",c,d+l*(e+3*n))})),v()};if(m){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,i,a),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=m}else b()},V=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{j()}),[u,m,p,h,f,g,v,y,b,x,E,w]),function(t,n,r={}){const l=window&&"MutationObserver"in window,i=e.useRef(),a=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};e.useLayoutEffect((()=>(a(),l&&t.current&&(i.current=new MutationObserver(n),i.current.observe(t.current,r)),()=>a())),[t])}(N,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>V(e))),n="attributes"===t.type&&V(t.target);if(e||n){j();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=nr("watermark");return t.createElement("div",{ref:N,className:Ae(z,C),style:Object.assign({position:"relative"},S)},n.children)},Of=new Map,kf=new WeakMap;let Lf,Af=0;function Pf(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(kf.has(n)||(Af+=1,kf.set(n,Af.toString())),kf.get(n)):"0"):e[t]}`;var n})).toString()}function _f(e,t,n={},r=Lf){if(void 0===window.IntersectionObserver&&void 0!==r){const l=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:l,observer:i,elements:a}=function(e){const t=Pf(e);let n=Of.get(t);if(!n){const r=new Map;let l=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{var n;const i=t.isIntersecting&&l.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=i),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(i,t)}))}))}),e);l=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:r},Of.set(t,n)}return n}(n),o=a.get(e)||[];return a.has(e)||a.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(a.delete(e),i.unobserve(e)),0===a.size&&(i.disconnect(),Of.delete(l))}}const Ff=e=>{const{forceRender:n,height:r,placeholder:l=null,unmountIfInvisible:i,className:a,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:l,fallbackInView:i,trackVisibility:a,skip:o,delay:s,onChange:c}={})=>{var d;const[u,m]=t.useState(null),[p,h]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(o||!u)return;let t;return t=_f(u,((e,n)=>{var r;h({inView:e,entry:n}),null===(r=f.current)||void 0===r||r.call(f,e,n),n.isIntersecting&&l&&t&&(t(),t=void 0)}),{root:e,rootMargin:n,threshold:r,trackVisibility:a,delay:s},i),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,l,o,a,i,s]);const g=null===(d=p.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||l||o||v.current===g||(v.current=g,h({inView:!1,entry:void 0}));const y=[m,p.inView,p.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!i}));t.useEffect((()=>{r||Zn("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[nr("lazy-load")]:!0};return t.createElement("div",{ref:s,className:Ae(u,a),style:o},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},l))};class Df{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 Mf{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 Mf(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,l=e.y-t.y,i=t.x-n.x,a=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+l*l),m=Math.sqrt(i*i+a*a),p=m/(u+m),h=c+(o-c)*p,f=d+(s-d)*p,g=t.x-h,v=t.y-f;return{c1:new Df(o+g,s+v),c2:new Df(c+g,d+v)}}constructor(e,t,n,r,l,i){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=l,this.endWidth=i}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const l=r/10,i=this.point(l,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this.point(l,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=i-e,l=a-t;n+=Math.sqrt(r*r+l*l)}e=i,t=a}return n}point(e,t,n,r,l){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+l*e*e*e}}class Hf{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],l=r.points,i=l.length>0&&l[l.length-1],a=!!i&&n.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(r);if(!i||!i||!a){const e=this._addPoint(n,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(n,o)),l.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,l=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<l;n+=1){const i=n/l,a=i*i,o=a*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*a*e.control2.x,u+=o*e.endPoint.x;let m=d*e.startPoint.y;m+=3*c*i*e.control1.y,m+=3*s*a*e.control2.y,m+=o*e.endPoint.y;const p=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,m,p)}n.closePath(),n.fill()},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 Df(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=Mf.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,l=this._strokeWidth(r,n),i={end:l,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=l,i},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:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,l-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:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(r,t),a=Math.min(l,n),o=.5*(Math.max(r,t)-i),s=.5*(Math.max(l,n)-a),c=i+o,d=a+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},this.drawArrow=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(n-l,t-r)/Math.PI,a=(i+25)*Math.PI/180,o=(i-25)*Math.PI/180,s=15*Math.cos(a),c=15*Math.sin(a),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,l),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,l);const m=r+s,p=l+c;this.ctx.lineTo(m,p);const h=r+d,f=l+u;this.ctx.lineTo(h,f),this.ctx.lineTo(r,l),this.ctx.fill(),this.ctx.restore()},this.getAxisColor=(e,t,n)=>{const r=e.width,l=e.data,i=[];return i[0]=l[4*(n*r+t)],i[1]=l[4*(n*r+t)+1],i[2]=l[4*(n*r+t)+2],i[3]=l[4*(n*r+t)+3],i},this.setAxisColor=(e,t,n,r)=>{const l=e.width,i=e.data;i[4*(n*l+t)]=r[0],i[4*(n*l+t)+1]=r[1],i[4*(n*l+t)+2]=r[2],i[4*(n*l+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),l=r.width,i=r.height,a=l/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<a;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let l=0;l<this.degreeOfBlur;l++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(r,t*this.degreeOfBlur+i,e*this.degreeOfBlur+l,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,l=this.width-t,i=e.target.innerText,a=[];let o="";for(let e=0;e<i.length;e++){const t=o+i[e];this.ctx.measureText(t).width>l&&o.length>0?(a.push(o),o=i[e]):o=t}a.push(o),a.forEach(((e,l)=>{this.ctx.fillText(e,t+1,n+l*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,1!==this.ratio&&t.scale(this.ratio,this.ratio),this.backgroundColor&&(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)),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.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this.backgroundColor=this.openSmooth&&t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,l,i=0,a=null;const o=()=>{i=Date.now(),a=null,n=e.apply(r,l),a||(r=null,l=[])};return function(...s){const c=Date.now(),d=t-(c-i);return r=this,l=s,d<=0||d>t?(a&&(clearTimeout(a),a=null),i=c,n=e.apply(r,l),a||(r=null,l=[])):a||(a=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}Hf.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),l=r.length,i=new Uint8Array(l);for(let e=0;e<l;++e)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})},Hf.canvasToDataURL=e=>e.toDataURL("image/png",1),Hf.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const $f=t.forwardRef(((e,n)=>{const{open:r,width:l,height:i,imageName:a,penColor:o,penMode:s,minWidth:c,maxWidth:d,backgroundColor:u,className:m,style:h,onOk:f,onCancel:g}=e,{t:v}=Un(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=rs(void 0,{value:r,postState:e=>null!=e&&e}),I=t.useMemo((()=>!!e.children),[e.children]),[R,O]=t.useState(s||(I?"square":"line")),[k,L]=t.useState(w[0]),[A,P]=t.useState(I?S[0]:S[4]),[_,F]=t.useState(C[1]),[D,M]=t.useState("bottomLeft"),[H,$]=t.useState(!1),[q,K]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=l?l:null===(e=x.current)||void 0===e?void 0:e.offsetWidth,height:null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetHeight,maxWidth:k,mode:R,penColor:A,fontSize:_,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new Hf(b.current,n),()=>y.current.destroy()}),[]);const j=e=>{var t,n;const[r,a]=[null!=l?l:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=i?i:null===(n=x.current)||void 0===n?void 0:n.offsetHeight],{width:o,height:s}=y.current;let c=!1;r&&r!==o&&(y.current.width=r,c=!0),a&&a!==s&&(y.current.height=a,c=!0),(c||e)&&y.current.update()};Fl((()=>{I&&N&&j()}),[N,I]),Fl((()=>{y.current.setDrawMode(R)}),[R]),Fl((()=>{y.current.setLineWidth(k)}),[k]),Fl((()=>{y.current.setPenColor(A)}),[A]),Fl((()=>{y.current.setFontSize(_)}),[_]);const V=()=>pn(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield ln(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return Hf.canvasToDataURL(t)}catch(e){Zn("Signature","生成合成图片失败!")}})),z=()=>{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:j,GET_DATE_URL:V})));const W=e=>{e&&M((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},B=e=>t.createElement("div",{className:Ae("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},w.map((e=>t.createElement("span",{key:e,className:Ae("dot",`s${e}`,{active:e===k}),onClick:()=>L(e)})))):t.createElement("div",{className:"fontSize"},t.createElement(ce,{size:"small",value:_,options:C.map((e=>({value:e,label:e.toString()}))),onChange:e=>F(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},S.map((e=>t.createElement("span",{key:e,className:Ae("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>P(e)},t.createElement(He,{className:"icon"})))))),U=nr("signature"),G={[U]:!0,"is-annotation":I},Y=l?Object.assign(Object.assign({},h),{width:l}):h;return t.createElement("div",{className:Ae(G,m),style:Y},I&&t.createElement(t.Fragment,null,t.createElement("div",{ref:x,className:"content"},e.children),q&&t.createElement(Jl,{spinning:!0,className:"spinning"})),t.createElement("div",{className:Ae("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:Ae("actions",{hidden:H})},t.createElement(ue,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(Ft,null))),t.createElement(ue,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(Su,null))),t.createElement(ue,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(Tu,null))),t.createElement(ue,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement(Me,null))),t.createElement(ue,{dropdownRender:()=>B("text"),overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(Nu,null))),t.createElement("button",{className:"btn",onClick:()=>pn(void 0,void 0,void 0,(function*(){yield pn(void 0,void 0,void 0,(function*(){K(!0);const e=yield V();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):p().format(Uo);Ei(Hf.dataURLToBlob(e),`${t}.png`)}K(!1)})),z()}))},t.createElement(qe,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement(Iu,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(Ru,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(Nt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(rt,null)),t.createElement("button",{className:"btn",onClick:()=>pn(void 0,void 0,void 0,(function*(){K(!0),yield bn(10);const e=yield V();K(!1),z(),null==f||f(e)}))},t.createElement(He,null))),t.createElement("button",{className:"btn btn-fold",title:v(H?"qm.divider.spread":"qm.divider.collect"),onClick:()=>$(!H)},H?t.createElement(at,null):t.createElement(ot,null))))))}));$f.displayName="QmSignature";const qf="1.12.14";export{$n as Calendar,qn as DatePicker,ki as DcpAnchor,Jn as DcpButton,Pl as DcpCollapse,Gd as DcpColorPicker,Bn as DcpConfigProvider,Qm as DcpCopyToClipboard,Ql as DcpCountup,vh as DcpCropper,rr as DcpDivider,Ti as DcpDownload,Pi as DcpDrawer,Zl as DcpEmpty,Kh as DcpForm,If as DcpGuideTracker,Ff as DcpLazyLoad,Di as DcpModal,$u as DcpPivotGrid,of as DcpPrint,Tp as DcpRangeTableHelper,xi as DcpScrollbar,sp as DcpSearchHelper,fm as DcpSearchTree,$f as DcpSignature,tr as DcpSpace,Jl as DcpSpin,Xl as DcpSplit,op as DcpTable,Ai as DcpTabs,Hh as DcpTinymce,Xh as DcpTour,fi as DcpTransition,Wm as DcpTreeHelper,yp as DcpTreeTableHelper,Ni as DcpUploadFile,bh as DcpUploadImg,Zu as DcpVirtualList,Rf as DcpWatermark,ki as QmAnchor,Jn as QmButton,Pl as QmCollapse,Gd as QmColorPicker,Bn as QmConfigProvider,Qm as QmCopyToClipboard,Ql as QmCountup,vh as QmCropper,rr as QmDivider,Ti as QmDownload,Pi as QmDrawer,Zl as QmEmpty,Kh as QmForm,If as QmGuideTracker,Ff as QmLazyLoad,Di as QmModal,$u as QmPivotGrid,of as QmPrint,Tp as QmRangeTableHelper,xi as QmScrollbar,sp as QmSearchHelper,fm as QmSearchTree,$f as QmSignature,tr as QmSpace,Jl as QmSpin,Xl as QmSplit,op as QmTable,Ai as QmTabs,Hh as QmTinymce,Xh as QmTour,fi as QmTransition,Wm as QmTreeHelper,yp as QmTreeTableHelper,Ni as QmUploadFile,bh as QmUploadImg,Zu as QmVirtualList,Rf as QmWatermark,jn as TimePicker,Eo as pinyin,qf as version};
1
+ import*as e from"react";import t,{createContext as n,version as r,isValidElement as l,useRef as i,useLayoutEffect as a,useEffect as o,useState as s,useCallback as c,Component as d,forwardRef as u,useImperativeHandle as m}from"react";import p from"dayjs";import{isArray as h,isPlainObject as f,isNumber as g,isFunction as v,isString as y,isUndefined as b,get as x,set as E,transform as w,isEqual as C,xor as S,isRegExp as N,intersection as T,map as I,groupBy as R,flatten as O,spread as k,mergeWith as L,isDate as A,sumBy as P,maxBy as _,minBy as F,merge as D,union as M,uniqBy as H,pick as $,debounce as q,throttle as K}from"lodash-es";import j from"dayjs/plugin/localeData";import V from"dayjs/plugin/advancedFormat";import z from"dayjs/plugin/customParseFormat";import W from"dayjs/plugin/quarterOfYear";import B from"dayjs/plugin/weekOfYear";import U from"dayjs/plugin/weekday";import{ConfigProvider as G,Button as Y,Tooltip as X,Popconfirm as Q,Space as Z,Empty as J,Spin as ee,Upload as te,message as ne,Input as re,Tabs as le,Drawer as ie,Modal as ae,Form as oe,Row as se,Col as ce,Select as de,Checkbox as ue,Dropdown as me,InputNumber as pe,Divider as he,Radio as fe,Menu as ge,Popover as ve,Tree as ye,Switch as be,Pagination as xe,Rate as Ee,Tag as we,TreeSelect as Ce,Cascader as Se,Image as Ne,notification as Te,Slider as Ie}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 Re from"dayjs/plugin/weekYear";import Oe from"antd/es/calendar/generateCalendar";import ke from"antd/es/date-picker/generatePicker";import Le from"antd/es/locale/zh_CN";import Ae from"antd/es/locale/en_GB";import"dayjs/locale/zh-cn";import"dayjs/locale/en";import Pe from"classnames";import{UpOutlined as _e,DownOutlined as Fe,UploadOutlined as De,LinkOutlined as Me,EditOutlined as He,CheckOutlined as $e,EyeOutlined as qe,DownloadOutlined as Ke,DeleteOutlined as je,FullscreenExitOutlined as Ve,FullscreenOutlined as ze,UnorderedListOutlined as We,HolderOutlined as Be,InfoCircleFilled as Ue,ReloadOutlined as Ge,PrinterOutlined as Ye,ImportOutlined as Xe,SettingOutlined as Qe,CopyOutlined as Ze,CheckSquareOutlined as Je,CloseCircleOutlined as et,MonitorOutlined as tt,FolderOpenOutlined as nt,PlusOutlined as rt,CloseOutlined as lt,FilterOutlined as it,SortAscendingOutlined as at,LeftOutlined as ot,RightOutlined as st,EyeInvisibleOutlined as ct,ColumnHeightOutlined as dt,FolderOutlined as ut,BarsOutlined as mt,SaveOutlined as pt,InfoCircleOutlined as ht,BgColorsOutlined as ft,CaretDownOutlined as gt,ExpandAltOutlined as vt,CaretRightOutlined as yt,LineChartOutlined as bt,PieChartOutlined as xt,FunnelPlotOutlined as Et,AppstoreAddOutlined as wt,StepBackwardOutlined as Ct,StepForwardOutlined as St,SearchOutlined as Nt,ClearOutlined as Tt,ZoomInOutlined as It,ZoomOutOutlined as Rt,RotateRightOutlined as Ot,RotateLeftOutlined as kt,InboxOutlined as Lt,ExclamationCircleOutlined as At,PauseOutlined as Pt,QuestionCircleOutlined as _t,MenuOutlined as Ft,BorderOutlined as Dt}from"@ant-design/icons";import Mt,{flushSync as Ht}from"react-dom";import $t from"react-countup";import qt from"resize-observer-polyfill";import Kt from"sortablejs";import jt from"add-dom-event-listener";import Vt from"scroll-into-view-if-needed";import zt from"react-draggable";import Wt from"memoize-one";import*as Bt from"prop-types";import Ut from"prop-types";import Gt from"@rc-component/portal";export{default as DcpPortal,default as QmPortal}from"@rc-component/portal";import{ReactSortable as Yt}from"react-sortablejs";import Xt from"big.js";import Qt from"exceljs";import Zt from"localforage";import Jt from"@rc-component/trigger";import en,{ColorBlock as tn}from"@rc-component/color-picker";import nn from"copy-to-clipboard";import rn from"china-area-data";import ln from"cropperjs";import an from"html2canvas";const on=n({});var sn={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},用逗号隔开",text:"筛选",selectAll:"全选",invert:"反选",onlyItem:"仅此项",keywordSearch:"关键词搜索"},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:"不包含",nullText:"空值",notNullText:"非空值",startsWithText:"开头是",endsWithText:"结尾是",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",matchCase:"大小写匹配",matchFullchar:"全字符匹配",queryLabel:"查找内容",queryPrev:"查找上一个",queryNext:"查找下一个",queryAll:"查找全部",findTotal:"查找到 {total} 个单元格",cellText:"单元格",valText:"值"},pivotGrid:{text:"多维表",settingTitle:"多维表看板"}},pivotGrid:{saved:{text:"配置",add:"添加配置项",title:"已保存的配置信息"},export:{text:"导出",group:"导出分组",list:"导出列表"},count:{statistic:"统计",records:"记录数",unique:"唯一值",empty:"空值",notEmpty:"非空值",sum:"合计值",max:"最大值",min:"最小值",avg:"平均值"},field:{text:"字段管理",title:"字段自定义设置"},fillColor:{text:"填色",add:"添加条件",title:"设置填色条件",cell:"单元格",row:"整行",col:"整列"},filter:{text:"筛选",title:"设置筛选条件",matchAll:"满足所有条件",matchAny:"满足任一条件"},group:{text:"分组",title:"设置分组条件",foldAll:"折叠所有",unfoldAll:"展开所有",empty:"(内容为空)",ascend:"选项顺序",descend:"选项倒序"},lineHeight:{text:"行高",size:["常规","中等","高"]},search:{text:"查找",title:"设置查找条件"},sorter:{text:"排序",title:"设置排序条件",ascend:"字段升序",descend:"字段降序"},viewMode:{table:"表格视图",gantt:"甘特视图",card:"看板视图"}},translate:{sourceText:"原文",targetText:"翻译",translating:"翻译中"}}};let cn=sn;function dn(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,n)=>t[n])):e}const un=(...e)=>{const[t,n]=e;let r;const l=t.split(".");let i=cn;for(let e=0,t=l.length;e<t;e++){if(r=i[l[e]],e===t-1)return dn(r,n);if(!r)return"";i=r}return""};function mn(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 l=0;for(r=Object.getOwnPropertySymbols(e);l<r.length;l++)t.indexOf(r[l])<0&&Object.prototype.propertyIsEnumerable.call(e,r[l])&&(n[r[l]]=e[r[l]])}return n}function pn(e,t,n,r){var l,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(l=e[o])&&(a=(i<3?l(a):i>3?l(t,n,a):l(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function hn(e,t,n,r){return new(n||(n=Promise))((function(l,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}s((r=r.apply(e,t||[])).next())}))}var fn="undefined"==typeof window;const gn=e=>t.isValidElement(e),vn=e=>gn(e)&&e.type===t.Fragment,yn=()=>{},bn=()=>!0,xn=e=>hn(void 0,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))})),En=e=>{Promise.resolve().then(e)},wn=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),Cn=e=>!!(!e&&0!==e||h(e)&&!e.length||f(e)&&!Object.keys(e).length),Sn=(e,t)=>t.split(".").reduce(((e,t)=>null==e?void 0:e[t]),e),Nn=(e,t)=>{const n=Object.assign({},e);for(const e of t)delete n[e];return n};const Tn=(e,t=new WeakMap)=>{if(f(e)||h(e)){const n=Array.isArray(e),r=n?[]:{};if(t.get(e))return e;t.set(e,r);const l=n?void 0:Object.keys(e);return function(e,t){let n=-1;const r=e.length;for(;++n<r;)t(e[n],n)}(l||e,((n,i)=>{l&&(i=n),r[i]=Tn(e[i],t)})),r}return e},In=e=>g(e)?`${e}px`:e.toString(),Rn=(e,t)=>Object.assign(Object.assign({},e),Object.keys(t).reduce(((n,r)=>(n[r]=void 0!==t[r]?t[r]:e[r],n)),{}));p.extend(j),p.extend(V),p.extend(z),p.extend(W),p.extend(B),p.extend(U);var On={},kn=[];function Ln(e,t){if(!e&&void 0!==console){var n=kn.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function An(e,t){if(!e&&void 0!==console){var n=kn.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function Pn(e,t,n){t||On[n]||(e(!1,n),On[n]=!0)}function _n(e,t){Pn(Ln,e,t)}function Fn(e,t){Pn(An,e,t)}_n.preMessage=function(e){kn.push(e)},_n.resetWarned=function(){On={}},_n.noteOnce=Fn,p.extend(z),p.extend(V),p.extend(U),p.extend(j),p.extend(B),p.extend(Re),p.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 Dn={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"},Mn=function(e){return Dn[e]||e.split("_")[0]},Hn=function(){Fn(!1,"Not match any format. Please help to fire a issue about this.")},$n={getNow:function(){return p()},getFixedDate:function(e){return p(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 p().locale(Mn(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,t){return t.locale(Mn(e)).weekday(0)},getWeek:function(e,t){return t.locale(Mn(e)).week()},getShortWeekDays:function(e){return p().locale(Mn(e)).localeData().weekdaysMin()},getShortMonths:function(e){return p().locale(Mn(e)).localeData().monthsShort()},format:function(e,t,n){return t.locale(Mn(e)).format(n)},parse:function(e,t,n){for(var r=Mn(e),l=0;l<n.length;l+=1){var i=n[l],a=t;if(i.includes("wo")||i.includes("Wo")){for(var o=a.split("-")[0],s=a.split("-")[1],c=p(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 Hn(),null}var m=p(a,i).locale(r);if(m.isValid())return m}return t&&Hn(),null}}};const qn=Oe($n),Kn=ke($n);function jn(){return jn=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},jn.apply(null,arguments)}const Vn=e.forwardRef(((t,n)=>e.createElement(Kn,jn({},t,{picker:"time",mode:void 0,ref:n}))));Vn.displayName="TimePicker";const zn=e.forwardRef(((t,n)=>e.createElement(Kn.RangePicker,jn({},t,{picker:"time",mode:void 0,ref:n}))));zn.displayName="RangePicker",Vn.RangePicker=zn;var Wn={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:"Filter {text}",searchAreaText:"Filter {text}, separated by commas",text:"Filter",selectAll:"Select all",invert:"Invert",onlyItem:"Only item",keywordSearch:"Keyword Search"},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",nullText:"null value",notNullText:"not null value",startsWithText:"beginning is",endsWithText:"ending is",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?",matchCase:"Case matching",matchFullchar:"Full character matching",queryLabel:"Find content",queryPrev:"Find previous",queryNext:"Find next",queryAll:"Find all",findTotal:"Found {total} cells",cellText:"Cell",valText:"Value"},pivotGrid:{text:"Pivot Grid",settingTitle:"Pivot Grid Dashboard"}},pivotGrid:{saved:{text:"Config",add:"Add configuration",title:"Saved configuration list"},export:{text:"Export",group:"Export group",list:"Export list"},count:{statistic:"Statistics",records:"count",unique:"unique",empty:"empty",notEmpty:"not empty",sum:"sum value",max:"max value",min:"min value",avg:"avg value"},field:{text:"Field manage",title:"Field customization settings"},fillColor:{text:"Fill color",add:"Add condition",title:"Set fill color conditions",cell:"Cell",row:"Row",col:"Col"},filter:{text:"Filter",title:"Set filter conditions",matchAll:"Meet all conditions",matchAny:"Meet any conditions"},group:{text:"Group",title:"Set group conditions",foldAll:"Fold all",unfoldAll:"unfold all",empty:"(Empty content)",ascend:"Order ascend",descend:"Order descend"},lineHeight:{text:"Line height",size:["Common size","Middle size","Large size"]},search:{text:"Search",title:"Set search conditions"},sorter:{text:"Sorter",title:"Set sorter conditions",ascend:"Field ascend",descend:"Field descend"},viewMode:{table:"Table view",gantt:"Gantt view",card:"Card view"}},translate:{sourceText:"Source Text",targetText:"Target Text",translating:"Translating"}}};const Bn={[Wn.name]:{qm:Wn,antd:Ae},[sn.name]:{qm:sn,antd:Le}},Un=e=>{const n="zh-cn",r=Rn({locale:n,size:"middle"},e),{locale:l,size:i,global:a}=r,o=t.useMemo((()=>Object.assign({},Bn,null==a?void 0:a.langPackage)),[a]),s=t.useMemo((()=>a?Nn(a,["langPackage"]):a),[a]),c=(e,t)=>{const r=e.split("-")[0],l=o[e]?e:o[r]?r:n;return o[l][t]};t.useMemo((()=>{return e=c(l,"qm"),cn=e||cn,void(cn.name&&p.locale(cn.name));var e}),[l]);const d=t.useMemo((()=>({locale:l,size:i,global:s})),[l,i]);return t.createElement(on.Provider,{value:d},t.createElement(G,{locale:c(l,"antd"),componentSize:i,autoInsertSpaceInButton:null==s?void 0:s.autoInsertSpaceInButton},r.children))};function Gn(){const{locale:t}=e.useContext(on);return{t:un,$locale:t}}function Yn(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 Xn(t){const{size:n}=e.useContext(on);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])}}Un.displayName="QmConfigProvider";class Qn extends Error{constructor(e){super(e),this.name="QmDesignError"}}function Zn(e,t){throw new Qn(`[${e}] ${t}`)}function Jn(e,t){console.warn(new Qn(`[${e}] ${t}`))}const er=e=>{const{loading:n,shortcutKey:r,authConfig:l,click:i,confirm:a}=e,{t:o}=Gn(),{$size:s}=Xn(e);t.useEffect((()=>(r&&document.addEventListener("keyup",u),()=>document.removeEventListener("keyup",u))),[]);const[c,d]=t.useState(!1),u=Yn((e=>{var t;const n=r.split("+").map((e=>e.trim().toLowerCase())),l=n.includes("alt"),i=n.includes("ctrl"),a=n.includes("shift"),o=n[n.length-1];l&&!e.altKey||i&&!e.ctrlKey||a&&!e.shiftKey||e.key.toLowerCase()!==o||(e.preventDefault(),p.disabled||null===(t=p.onClick)||void 0===t||t.call(p,e))})),m=v(i)?{onClick:t=>hn(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){Jn("Button","`click`方法执行出错")}d(!1)}))}:null,p=Object.assign(Object.assign(Object.assign({},Nn(e,["shortcutKey","authConfig","click","confirm"])),{size:s,loading:c||n||!1}),m);if(l){const{visible:e=1,disabled:t}=l||{};if(!e)return null;t&&(p.disabled=!0)}const h=t.createElement(Y,p,e.children);return a?t.createElement(Q,{title:a.title||o("qm.button.confirmTitle"),disabled:p.disabled,onConfirm:e=>{var t,n;null===(t=a.onConfirm)||void 0===t||t.call(a),null===(n=p.onClick)||void 0===n||n.call(p,e)},onCancel:e=>{var t;null===(t=a.onCancel)||void 0===t||t.call(a,e)}},t.createElement(Y,jn({},p,{onClick:yn}),e.children)):!r||p.disabled?h:t.createElement(X,{placement:"top",title:`${o("qm.button.shortcutKey")}: ${r}`},h)};var tr;er.displayName="QmButton",function(e){e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small"}(tr||(tr={}));const nr=e=>{const{$size:n}=Xn(e),r=g(e.size)?e.size:tr[n||"default"],l=Object.assign(Object.assign({},Nn(e,["size"])),{size:r});return t.createElement(Z,l,e.children)};nr.displayName="QmSpace";const rr=e=>`qm-${e}`,lr=e=>{const{label:n,extra:r,collapse:l,bordered:i=!0,disabled:a,id:o,className:s,style:c,onCollapseChange:d}=e,{$size:u}=Xn(e),{t:m}=Gn(),p=rr("divider"),h={[p]:!0,[`${p}-borderless`]:!i,[`${p}--lg`]:"large"===u,[`${p}--sm`]:"small"===u};return t.createElement("div",{id:o,className:Pe(h,s),style:c},t.createElement("span",{className:`${p}__title`},n),t.createElement("div",{className:`${p}__extra`},r),void 0!==l&&t.createElement(Y,{type:"link",className:`${p}__collapse`,disabled:a,onClick:()=>{null==d||d(!l)}},m(l?"qm.divider.collect":"qm.divider.spread"),l?t.createElement(_e,null):t.createElement(Fe,null)))};lr.displayName="QmDivider";const ir=()=>({height:0,opacity:0}),ar=e=>({height:e.scrollHeight,opacity:1}),or=e=>({height:e?e.offsetHeight:0}),sr=(e,t)=>!0===(null==t?void 0:t.deadline)||"height"===t.propertyName;function cr(e){return cr="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},cr(e)}function dr(e){var t=function(e,t){if("object"!==cr(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==cr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===cr(t)?t:String(t)}function ur(e,t,n){return(t=dr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mr(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 pr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mr(Object(n),!0).forEach((function(t){ur(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hr(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 fr(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,l,i,a,o=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){c=!0,l=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw l}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hr(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)?hr(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 gr(e){return e instanceof HTMLElement||e instanceof SVGElement}function vr(e){var n,r=function(e){return e&&"object"===cr(e)&&gr(e.nativeElement)?e.nativeElement:gr(e)?e:null}(e);return r||(e instanceof t.Component?null===(n=Mt.findDOMNode)||void 0===n?void 0:n.call(Mt,e):null)}var yr,br={exports:{}},xr={};br.exports=(yr||(yr=1,function(){var e,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen");function f(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:var f=e.type;switch(f){case r:case i:case l:case d:case u:return f;default:var g=f&&f.$$typeof;switch(g){case s:case o:case c:case p:case m:case a:return g;default:return h}}case n:return h}}}e=Symbol.for("react.module.reference");var g=o,v=a,y=t,b=c,x=r,E=p,w=m,C=n,S=i,N=l,T=d,I=u,R=!1,O=!1;xr.ContextConsumer=g,xr.ContextProvider=v,xr.Element=y,xr.ForwardRef=b,xr.Fragment=x,xr.Lazy=E,xr.Memo=w,xr.Portal=C,xr.Profiler=S,xr.StrictMode=N,xr.Suspense=T,xr.SuspenseList=I,xr.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},xr.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},xr.isContextConsumer=function(e){return f(e)===o},xr.isContextProvider=function(e){return f(e)===a},xr.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},xr.isForwardRef=function(e){return f(e)===c},xr.isFragment=function(e){return f(e)===r},xr.isLazy=function(e){return f(e)===p},xr.isMemo=function(e){return f(e)===m},xr.isPortal=function(e){return f(e)===n},xr.isProfiler=function(e){return f(e)===i},xr.isStrictMode=function(e){return f(e)===l},xr.isSuspense=function(e){return f(e)===d},xr.isSuspenseList=function(e){return f(e)===u},xr.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===i||t===l||t===d||t===u||t===h||"object"==typeof t&&null!==t&&(t.$$typeof===p||t.$$typeof===m||t.$$typeof===a||t.$$typeof===o||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)},xr.typeOf=f}()),xr);var Er=function(e,t){"function"==typeof e?e(t):"object"===cr(e)&&e&&"current"in e&&(e.current=t)},wr=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){Er(t,e)}))}},Cr=function(e){var t,n,r=br.exports.isMemo(e)?e.type.type:e.type;return!!("function"!=typeof r||null!==(t=r.prototype)&&void 0!==t&&t.render||r.$$typeof===br.exports.ForwardRef)&&!!("function"!=typeof e||null!==(n=e.prototype)&&void 0!==n&&n.render||e.$$typeof===br.exports.ForwardRef)};function Sr(e,t){if(null==e)return{};var n,r,l=function(e,t){if(null==e)return{};var n,r,l={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}Number(r.split(".")[0]);var Nr=e.createContext({});function Tr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ir(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,dr(r.key),r)}}function Rr(e,t,n){return t&&Ir(e.prototype,t),n&&Ir(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Or(e,t){return Or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Or(e,t)}function kr(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&&Or(e,t)}function Lr(e){return Lr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Lr(e)}function Ar(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(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=Lr(e);if(t){var l=Lr(this).constructor;n=Reflect.construct(r,arguments,l)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===cr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ar(e)}(this,n)}}var _r=function(t){kr(r,e.Component);var n=Pr(r);function r(){return Tr(this,r),n.apply(this,arguments)}return Rr(r,[{key:"render",value:function(){return this.props.children}}]),r}();function Fr(t){var n=e.useRef(!1),r=fr(e.useState(t),2),l=r[0],i=r[1];return e.useEffect((function(){return n.current=!1,function(){n.current=!0}}),[]),[l,function(e,t){t&&n.current||i(e)}]}var Dr="none",Mr="appear",Hr="enter",$r="leave",qr="none",Kr="prepare",jr="start",Vr="active",zr="end",Wr="prepared";function Br(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Ur(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 Gr,Yr,Xr,Qr=(Gr=Br(),Yr="undefined"!=typeof window?window:{},Xr={animationend:Ur("Animation","AnimationEnd"),transitionend:Ur("Transition","TransitionEnd")},Gr&&("AnimationEvent"in Yr||delete Xr.animationend.animation,"TransitionEvent"in Yr||delete Xr.transitionend.transition),Xr),Zr={};if(Br()){var Jr=document.createElement("div");Zr=Jr.style}var el={};function tl(e){if(el[e])return el[e];var t=Qr[e];if(t)for(var n=Object.keys(t),r=n.length,l=0;l<r;l+=1){var i=n[l];if(Object.prototype.hasOwnProperty.call(t,i)&&i in Zr)return el[e]=t[i],el[e]}return""}var nl=tl("animationend"),rl=tl("transitionend"),ll=!(!nl||!rl),il=nl||"animationend",al=rl||"transitionend";function ol(e,t){return e?"object"===cr(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}var sl=function(t){var n=i(),r=i(t);r.current=t;var l=e.useCallback((function(e){r.current(e)}),[]);function a(e){e&&(e.removeEventListener(al,l),e.removeEventListener(il,l))}return e.useEffect((function(){return function(){a(n.current)}}),[]),[function(e){n.current&&n.current!==e&&a(n.current),e&&e!==n.current&&(e.addEventListener(al,l),e.addEventListener(il,l),n.current=e)},a]},cl=Br()?a:o,dl=function(e){return+setTimeout(e,16)},ul=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(dl=function(e){return window.requestAnimationFrame(e)},ul=function(e){return window.cancelAnimationFrame(e)});var ml=0,pl=new Map;function hl(e){pl.delete(e)}var fl=function(e){var t=ml+=1;return function n(r){if(0===r)hl(t),e();else{var l=dl((function(){n(r-1)}));pl.set(t,l)}}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),t};fl.cancel=function(e){var t=pl.get(e);return hl(e),ul(t)},fl.ids=function(){return pl};var gl=[Kr,jr,Vr,zr],vl=[Kr,Wr],yl=!1,bl=!0;function xl(e){return e===Vr||e===zr}var El=function(t,n,r){var l=fr(Fr(qr),2),i=l[0],a=l[1],o=function(){var t=e.useRef(null);function n(){fl.cancel(t.current)}return e.useEffect((function(){return function(){n()}}),[]),[function e(r){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;n();var i=fl((function(){l<=1?r({isCanceled:function(){return i!==t.current}}):e(r,l-1)}));t.current=i},n]}(),s=fr(o,2),c=s[0],d=s[1];var u=n?vl:gl;return cl((function(){if(i!==qr&&i!==zr){var e=u.indexOf(i),t=u[e+1],n=r(i);n===yl?a(t,!0):t&&c((function(e){function r(){e.isCanceled()||a(t,!0)}!0===n?r():Promise.resolve(n).then(r)}))}}),[t,i]),e.useEffect((function(){return function(){d()}}),[]),[function(){a(Kr,!0)},i]};var wl=function(t){var n=t;"object"===cr(t)&&(n=t.transitionSupport);var r=e.forwardRef((function(t,r){var l=t.visible,a=void 0===l||l,s=t.removeOnLeave,c=void 0===s||s,d=t.forceRender,u=t.children,m=t.motionName,p=t.leavedClassName,h=t.eventProps,f=function(e,t){return!(!e.motionName||!n||!1===t)}(t,e.useContext(Nr).motion),g=i(),v=i();var y=function(t,n,r,l){var a=l.motionEnter,s=void 0===a||a,c=l.motionAppear,d=void 0===c||c,u=l.motionLeave,m=void 0===u||u,p=l.motionDeadline,h=l.motionLeaveImmediately,f=l.onAppearPrepare,g=l.onEnterPrepare,v=l.onLeavePrepare,y=l.onAppearStart,b=l.onEnterStart,x=l.onLeaveStart,E=l.onAppearActive,w=l.onEnterActive,C=l.onLeaveActive,S=l.onAppearEnd,N=l.onEnterEnd,T=l.onLeaveEnd,I=l.onVisibleChanged,R=fr(Fr(),2),O=R[0],k=R[1],L=fr(Fr(Dr),2),A=L[0],P=L[1],_=fr(Fr(null),2),F=_[0],D=_[1],M=i(!1),H=i(null);function $(){return r()}var q=i(!1);function K(){P(Dr,!0),D(null,!0)}function j(e){var t=$();if(!e||e.deadline||e.target===t){var n,r=q.current;A===Mr&&r?n=null==S?void 0:S(t,e):A===Hr&&r?n=null==N?void 0:N(t,e):A===$r&&r&&(n=null==T?void 0:T(t,e)),A!==Dr&&r&&!1!==n&&K()}}var V=fr(sl(j),1)[0],z=function(e){var t,n,r;switch(e){case Mr:return ur(t={},Kr,f),ur(t,jr,y),ur(t,Vr,E),t;case Hr:return ur(n={},Kr,g),ur(n,jr,b),ur(n,Vr,w),n;case $r:return ur(r={},Kr,v),ur(r,jr,x),ur(r,Vr,C),r;default:return{}}},W=e.useMemo((function(){return z(A)}),[A]),B=fr(El(A,!t,(function(e){if(e===Kr){var t=W[Kr];return t?t($()):yl}var n;return G in W&&D((null===(n=W[G])||void 0===n?void 0:n.call(W,$(),null))||null),G===Vr&&(V($()),p>0&&(clearTimeout(H.current),H.current=setTimeout((function(){j({deadline:!0})}),p))),G===Wr&&K(),bl})),2),U=B[0],G=B[1],Y=xl(G);q.current=Y,cl((function(){k(n);var e,r=M.current;M.current=!0,!r&&n&&d&&(e=Mr),r&&n&&s&&(e=Hr),(r&&!n&&m||!r&&h&&!n&&m)&&(e=$r);var l=z(e);e&&(t||l[Kr])?(P(e),U()):P(Dr)}),[n]),o((function(){(A===Mr&&!d||A===Hr&&!s||A===$r&&!m)&&P(Dr)}),[d,s,m]),o((function(){return function(){M.current=!1,clearTimeout(H.current)}}),[]);var X=e.useRef(!1);o((function(){O&&(X.current=!0),void 0!==O&&A===Dr&&((X.current||O)&&(null==I||I(O)),X.current=!0)}),[O,A]);var Q=F;return W[Kr]&&G===jr&&(Q=pr({transition:"none"},Q)),[A,G,Q,null!=O?O:n]}(f,a,(function(){try{return g.current instanceof HTMLElement?g.current:vr(v.current)}catch(e){return null}}),t),b=fr(y,4),x=b[0],E=b[1],w=b[2],C=b[3],S=e.useRef(C);C&&(S.current=!0);var N,T=e.useCallback((function(e){g.current=e,Er(r,e)}),[r]),I=pr(pr({},h),{},{visible:a});if(u)if(x===Dr)N=C?u(pr({},I),T):!c&&S.current&&p?u(pr(pr({},I),{},{className:p}),T):d||!c&&!p?u(pr(pr({},I),{},{style:{display:"none"}}),T):null;else{var R,O;E===Kr?O="prepare":xl(E)?O="active":E===jr&&(O="start");var k=ol(m,"".concat(x,"-").concat(O));N=u(pr(pr({},I),{},{className:Pe(ol(m,x),(R={},ur(R,k,k&&O),ur(R,m,"string"==typeof m),R)),style:w}),T)}else N=null;e.isValidElement(N)&&Cr(N)&&(N.ref||(N=e.cloneElement(N,{ref:T})));return e.createElement(_r,{ref:v},N)}));return r.displayName="CSSMotion",r}(ll);function Cl(){return Cl=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},Cl.apply(this,arguments)}var Sl="add",Nl="keep",Tl="remove",Il="removed";function Rl(e){var t;return pr(pr({},t=e&&"object"===cr(e)&&"key"in e?e:{key:e}),{},{key:String(t.key)})}function Ol(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(Rl)}var kl=["component","children","onVisibleChanged","onAllRemoved"],Ll=["status"],Al=["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]:wl,r=function(t){kr(l,e.Component);var r=Pr(l);function l(){var e;Tr(this,l);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return ur(Ar(e=r.call.apply(r,[this].concat(n))),"state",{keyEntities:[]}),ur(Ar(e),"removeKey",(function(t){var n=e.state.keyEntities.map((function(e){return e.key!==t?e:pr(pr({},e),{},{status:Il})}));return e.setState({keyEntities:n}),n.filter((function(e){return e.status!==Il})).length})),e}return Rr(l,[{key:"render",value:function(){var t=this,r=this.state.keyEntities,l=this.props,i=l.component,a=l.children,o=l.onVisibleChanged,s=l.onAllRemoved,c=Sr(l,kl),d=i||e.Fragment,u={};return Al.forEach((function(e){u[e]=c[e],delete c[e]})),delete c.keys,e.createElement(d,c,r.map((function(r){var l=r.status,i=Sr(r,Ll),c=l===Sl||l===Nl;return e.createElement(n,Cl({},u,{key:i.key,visible:c,eventProps:i,onVisibleChanged:function(e){(null==o||o(e,{key:i.key}),e)||0===t.removeKey(i.key)&&s&&s()}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,r=t.keyEntities,l=Ol(n),i=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,l=t.length,i=Ol(e),a=Ol(t);i.forEach((function(e){for(var t=!1,i=r;i<l;i+=1){var o=a[i];if(o.key===e.key){r<i&&(n=n.concat(a.slice(r,i).map((function(e){return pr(pr({},e),{},{status:Sl})}))),r=i),n.push(pr(pr({},o),{},{status:Nl})),r+=1,t=!0;break}}t||n.push(pr(pr({},e),{},{status:Tl}))})),r<l&&(n=n.concat(a.slice(r).map((function(e){return pr(pr({},e),{},{status:Sl})}))));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!==Tl}))).forEach((function(t){t.key===e&&(t.status=Nl)}))})),n}(r,l);return{keyEntities:i.filter((function(e){var t=r.find((function(t){var n=t.key;return e.key===n}));return!t||t.status!==Il||e.status!==Tl}))}}}]),l}();ur(r,"defaultProps",{component:"div"})}(ll);const Pl=t.forwardRef(((e,n)=>{const{forceRender:r,className:l,style:i,boxStyle:a,isActive:o}=e,[s,c]=t.useState(o||r);if(t.useEffect((()=>{(r||o)&&c(!0)}),[r,o]),!s)return null;const d=rr("collapse");return t.createElement("div",{ref:n,className:Pe(`${d}-content`,{[`${d}-content-active`]:o,[`${d}-content-inactive`]:!o},l),style:i},t.createElement("div",{className:`${d}-content-box`,style:a},e.children))}));Pl.displayName="PanelContent";const _l=e=>{const{defaultActive:n,label:r,extra:l,className:i,style:a,containerStyle:o,bordered:s,disabled:c,forceRender:d,destroyOnClose:u=!1,onChange:m}=e,[p,h]=t.useState(!!n),f=rr("collapse"),g=Pe({[`${f}`]:!0,[`${f}-active`]:p,[`${f}-disabled`]:c},i);return t.createElement("div",{className:g,style:a},t.createElement(lr,{label:r,extra:l,collapse:p,bordered:s,disabled:c,onCollapseChange:e=>{h(e),null==m||m(e)}}),t.createElement(wl,jn({visible:p},((e=rr("motion-collapse"))=>({motionName:e,onAppearStart:ir,onEnterStart:ir,onAppearActive:ar,onEnterActive:ar,onLeaveStart:or,onLeaveActive:ir,onAppearEnd:sr,onEnterEnd:sr,onLeaveEnd:sr,motionDeadline:500}))(),{forceRender:d,removeOnLeave:u}),(({className:n,style:r},l)=>t.createElement(Pl,{ref:l,prefixCls:f,className:n,style:r,boxStyle:o,isActive:p,forceRender:d},e.children))))};_l.displayName="QmCollapse";const Fl=t.createContext(void 0);function Dl(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 Ml=(e,t,n)=>{e&&t&&n&&e.addEventListener(t,n,!1)},Hl=(e,t,n)=>{e&&t&&n&&e.removeEventListener(t,n,!1)},$l=e=>e.preventDefault(),ql=(e,t)=>{if(fn||!e||!t)return null;"float"===(t=wn(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]}},Kl=(e,t,n)=>{!fn&&e&&t&&(f(t)?Object.keys(t).forEach((n=>{Kl(e,n,t[n])})):(t=wn(t),e.style[t]=n))},jl=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},Vl=(e,t)=>Math.abs(jl(e)-jl(t)),zl=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}},Wl=(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},Bl=(e,t)=>{if(fn||!e||!t)return!1;let n=e;for(;n;){if(n===t)return!0;n=n.parentNode}return!1},Ul=e=>Math.pow(e,3),Gl=e=>e<.5?Ul(2*e)/2:1-Ul(2*(1-e))/2,Yl=e=>{const{minValues:n,onDragChange:r,onDragging:l}=e,{splitRef:i,direction:a}=t.useContext(Fl),{t:o}=Gn(),s=t.useRef(fn?null:document.onselectstart),c=t.useMemo((()=>"horizontal"===a),[a]),d=t.useMemo((()=>c?"X":"Y"),[c]),u=t.useRef({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),m=e=>{u.current=Object.assign({},u.current,e)},p=e=>{if(1!==e.buttons)return h();const t=e[`page${d}`]-u.current[`start${d}`],r=[n[0],u.current[`containerSize${d}`]-n[1]];let i=u.current[`firstElementSize${d}`]+t;i=Math.max(r[0],i),i=Math.min(r[1],i),l(i)},h=()=>{m({startX:0,startY:0,firstElementSizeX:0,firstElementSizeY:0,containerSizeX:0,containerSizeY:0}),r(!1),Hl(document,"mousemove",p),Hl(document,"mouseup",h),f()},f=()=>{document.onselectstart!==s.current&&(document.onselectstart=s.current)},g={[`${rr("split")}__resize-bar`]:!0,vertical:"vertical"===a,horizontal:"horizontal"===a};return t.createElement("div",{className:Pe(g),title:o("qm.split.resize"),onMouseDown:e=>{e.stopPropagation();const t=i.current,n=t.children[0];m({startX:e.pageX,startY:e.pageY,firstElementSizeX:n.offsetWidth,firstElementSizeY:n.offsetHeight,containerSizeX:t.offsetWidth,containerSizeY:t.offsetHeight}),Ml(document,"mousemove",p),Ml(document,"mouseup",h),r(!0),s.current=document.onselectstart,document.onselectstart=()=>!1}})};Yl.displayName="ResizeBar";const Xl=t.forwardRef(((e,n)=>{const{offset:r,className:l,style:i}=e,{direction:a,dragging:o}=t.useContext(Fl),s="vertical"===a?"height":"width",c={[rr("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===a,vertical:"vertical"===a,[l]:!!l},d=void 0!==r?{[s]:In(r)}:{flex:1,[s]:0};return t.createElement("div",{ref:n,className:Pe(c),style:Object.assign(Object.assign({},d),i)},e.children)}));Xl.displayName="SplitPane";const Ql=e=>{const{direction:n="horizontal",defaultValue:r="50%",uniqueKey:l,className:i,style:a,onDragStart:o,onDrag:s=yn,onDragEnd:c}=e,{global:d}=t.useContext(on),u=t.useRef(null),m=t.useRef(null),p=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,h=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((()=>l?`split_${l}`:""),[l]),[v,y]=t.useState(!1),[b,x]=t.useState(p(r));Dl((()=>{v?null==o||o(h(b)):(null==c||c(h(b)),localStorage.setItem(g,b),C(g,b))}),[v]),t.useEffect((()=>{E()}),[]);const E=()=>{if(!g)return;const e=localStorage.getItem(g);e?x(p(e)):w(g).then((e=>{localStorage.setItem(g,p(e||r)),E()})).catch((()=>{}))},w=e=>hn(void 0,void 0,void 0,(function*(){const t=null==d?void 0:d.getComponentConfigApi;if(t)try{const n=yield t({key:e});if(200===n.code)return n.data}catch(e){}})),C=(e,t)=>hn(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;gn(e)&&!vn(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={[rr("split")]:!0,vertical:"vertical"===n};return t.createElement(Fl.Provider,{value:S},t.createElement("div",{ref:u,className:Pe(O,i),style:a},t.createElement(Xl,jn({},T.props,{ref:m,offset:b})),t.createElement(Yl,{minValues:R,onDragChange:e=>y(e),onDragging:e=>{x(`${e}px`),s(e)}}),t.createElement(Xl,I.props)))};Ql.displayName="QmSplit",Ql.Pane=Xl;const Zl=e=>{const{className:n,style:r}=e,{$size:l}=Xn(e),i=rr("countup"),a={[i]:!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l};return t.createElement($t,jn({},e,{className:Pe(a,n),style:r}),e.children)};Zl.displayName="QmCountup";const Jl=e=>{const{className:n}=e,{$size:r}=Xn(e),l=rr("empty"),i=Object.assign(Object.assign({},e),{image:J.PRESENTED_IMAGE_SIMPLE}),a={[l]:!0,[`${l}--lg`]:"large"===r,[`${l}--sm`]:"small"===r};return t.createElement(J,jn({},i,{className:Pe(a,n)}))};Jl.displayName="QmEmpty";const ei=e=>{const n=Rn({tip:"Loading..."},e),{fullHeight:r,className:l,style:i}=n,a=rr("spin"),o={[a]:!0,[`${a}-fullHeight`]:!!r},s=Object.assign(Object.assign({wrapperClassName:Pe(o,l)},Nn(n,["fullHeight"])),{style:Object.assign(Object.assign({},i),{maxHeight:"none"})});return t.createElement(ee,s,n.children)};ei.displayName="QmSpin";const ti=t.createContext(void 0),ni=new Map;const ri=new qt((function(e){e.forEach((e=>{var t;const{target:n}=e;null===(t=ni.get(n))||void 0===t||t.forEach((e=>e(n)))}))}));function li(e,t){ni.has(e)||(ni.set(e,new Set),ri.observe(e)),ni.get(e).add(t)}function ii(e,t){ni.has(e)&&(ni.get(e).delete(t),ni.get(e).size||(ri.unobserve(e),ni.delete(e)))}function ai(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&&li(e,n),()=>{e&&ii(e,n)}}),[t]),n}const oi=(t,n)=>{const r=e.useRef(!0);e.useLayoutEffect((()=>t(r.current)),n),e.useLayoutEffect((()=>(r.current=!1,()=>{r.current=!0})),[])};function si(e,t){oi((t=>{if(!t)return e()}),t)}function ci(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 di=(e,...n)=>t.isValidElement(e)?t.cloneElement(e,...n):null,ui=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],mi=e=>({_s:e,status:ui[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),pi=e=>e?6:5,hi=(e,t,n,r,l)=>{clearTimeout(r.current);const i=mi(e);t(i),n.current=i,null==l||l({current:i})},fi=(e={})=>{const{enter:t=!0,exit:n=!0,preEnter:r,preExit:l,timeout:a,initialEntered:d,mountOnEnter:u,unmountOnExit:m,onStateChange:p}=e||{},[h,g]=s((()=>mi(d?2:pi(u)))),v=i(h),y=i(),[b,x]=(e=>f(e)?[e.enter,e.exit]:[e,e])(a),E=c((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return pi(t)}})(v.current._s,m);e&&hi(e,g,v,y,p)}),[p,m]),w=c((e=>{const i=e=>{switch(hi(e,g,v,y,p),e){case 1:b>=0&&(y.current=setTimeout(E,b));break;case 4:x>=0&&(y.current=setTimeout(E,x));break;case 0:case 3:y.current=setTimeout((()=>i(e+1)),0)}},a=v.current.isEnter;"boolean"!=typeof e&&(e=!a),e?!a&&i(t?r?0:1:2):a&&i(n?l?3:4:pi(m))}),[E,p,t,n,r,l,b,x,m]);return o((()=>()=>clearTimeout(y.current)),[]),[h,w,E]},gi=e=>{const{name:n,in:r,timeout:l,preEnter:i=!0,preExit:a}=e,[o,s]=fi({timeout:l,preEnter:i,preExit:a,initialEntered:r});return si((()=>{s()}),[r]),t.createElement(t.Fragment,null,t.Children.map(e.children,(e=>t.isValidElement(e)?di(e,{className:Pe(e.props.className,n,o.status)}):e)))},vi=6,yi={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"}},bi=e=>{const{thumb:n,always:r,className:l,barSize:i=vi,direction:a="vertical",onDrag:o=yn}=e,{dragging:s,scrollbarElement:c,wrapElement:d}=t.useContext(ti),u=yi[a],m=t.useRef(null),p=t.useRef(null),h=t.useRef({}),f=t.useRef(!1),g=t.useRef(!1),v=t.useRef(fn?null:document.onselectstart),[y,b]=t.useState(!1);t.useEffect((()=>{const e=c.current;return Ml(e,"mousemove",C),Ml(e,"mouseleave",S),()=>{w(),Hl(document,"mouseup",E),Hl(e,"mousemove",C),Hl(e,"mouseleave",S)}}),[]);const x=e=>{if(!m.current||!p.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const n=100*(-1*(m.current.getBoundingClientRect()[u.direction]-e[u.client])-(p.current[u.offset]-t))/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100,o(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},Hl(document,"mousemove",x),Hl(document,"mouseup",E),w(),g.current&&b(!1),o(!1)},w=()=>{document.onselectstart!==v.current&&(document.onselectstart=v.current)},C=Yn((()=>{g.current=!1,b(!!n.size)})),S=Yn((()=>{g.current=!0,b(f.current)})),N=rr("scrollbar"),T={[`${N}__bar`]:!0,"is-vertical":"vertical"===a,"is-horizontal":"horizontal"===a},I={[u.reverse]:i},R={[u.size]:n.size,transform:`translate${u.axis}(${n.offset}%)`};return t.createElement(gi,{name:"fade",in:r||s||y,timeout:300},t.createElement("div",{ref:m,className:Pe(T,l),style:I,onMouseDown:e=>{const t=e.target;if(!t)return;const n=100*(Math.abs(t.getBoundingClientRect()[u.direction]-e[u.client])-p.current[u.offset]/2)/m.current[u.offset];d.current[u.scroll]=n*d.current[u.scrollSize]/100}},t.createElement("div",{ref:p,className:`${N}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Ml(document,"mousemove",x),Ml(document,"mouseup",E),f.current=!0,v.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},xi=20,Ei=t.forwardRef(((e,n)=>{const{wrapClassName:r,wrapStyle:l,innerStyle:i,barWidth:a,always:o,native:s,showTopScrollbar:c,minSize:d=xi,onScroll:u,onReachedEnd:m}=e,p=t.useRef(null),h=t.useRef(null),f=t.useRef(null),v=t.useRef({prevTop:0,prevLeft:0}),[y,b]=t.useState({size:0,offset:0,ratio:1}),[x,E]=t.useState({size:0,offset:0,ratio:1}),[w,C]=t.useState(!1),S=ai(p),N=ai(f);si((()=>{!s&&T()}),[N.width,N.height,S.width,S.height]);const T=ci((()=>{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,l=Math.max(n,d),i=Math.max(r,d),a=n/(e-n)/(l/(e-l)),o=r/(t-r)/(i/(t-i)),s=l+4<e?l:0,c=i+4<t?i:0,u=100*h.current.scrollTop/e*a,m=100*h.current.scrollLeft/t*o;b(Object.assign({},y,{size:c,ratio:o,offset:m})),E(Object.assign({},x,{size:s,ratio:a,offset:u}))}),5),I=e=>{C(e)},R=(e,t)=>{g(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollTop,l=window.requestAnimationFrame,i=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollTop=r+(t-r)*Gl(a),l(i)):e.scrollTop=t};l(i)})(h.current,e):h.current.scrollTop=e:Jn("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},O=(e,t)=>{g(e)?t?((e,t)=>{const n=Date.now(),r=e.scrollLeft,l=window.requestAnimationFrame,i=()=>{const a=(Date.now()-n)/500;a<1?(e.scrollLeft=r+(t-r)*Gl(a),l(i)):e.scrollLeft=t};l(i)})(h.current,e):h.current.scrollLeft=e:Jn("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t.useImperativeHandle(n,(()=>{var e,t;return{container:p.current,scrollElement:h.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:R,SET_SCROLL_LEFT:O}}));const k=t.useMemo((()=>({dragging:w,scrollbarElement:p,wrapElement:h})),[w]),L=rr("scrollbar"),A={[`${L}__wrap`]:!0,[`${L}__wrap--hidden`]:!s};return t.createElement("div",{ref:p,className:Pe(L,e.className),style:e.style},t.createElement("div",{ref:h,className:Pe(A,r),style:l,onScroll:e=>{const{scrollTop:t,scrollLeft:n}=e.target;!s&&(({scrollTop:e,scrollLeft:t})=>{if(!h.current)return;const n=h.current.offsetHeight-4,r=h.current.offsetWidth-4,l=100*e/n*x.ratio,i=100*t/r*y.ratio;b(Object.assign({},y,{offset:i})),E(Object.assign({},x,{offset:l}))})({scrollTop:t,scrollLeft:n}),null==u||u({scrollTop:t,scrollLeft:n});const{prevTop:r,prevLeft:l}=v.current,i={bottom:t+h.current.clientHeight>=h.current.scrollHeight,top:t<=0&&0!==r,right:n+h.current.clientWidth>=h.current.scrollWidth&&l!==n,left:n<=0&&0!==l};let a;var o;r!==t&&(a=t>r?"bottom":"top"),l!==n&&(a=n>l?"right":"left"),a&&i[a]&&(null==m||m(a,{scrollTop:t,scrollLeft:n})),o={prevTop:t,prevLeft:n},v.current=o}},t.createElement("div",{ref:f,className:`${L}__view`,style:i},e.children)),!s&&t.createElement(ti.Provider,{value:k},c&&t.createElement(bi,{className:"top",direction:"horizontal",thumb:y,barSize:a,always:o,onDrag:I}),t.createElement(bi,{direction:"horizontal",thumb:y,barSize:a,always:o,onDrag:I}),t.createElement(bi,{direction:"vertical",thumb:x,barSize:a,always:o,onDrag:I})))}));Ei.displayName="QmScrollbar";const wi=(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}},Ci=(e,{fileName:t,headers:n,params:r})=>hn(void 0,void 0,void 0,(function*(){const l=r?new URLSearchParams(r).toString():"",i=l?e.includes("?")?"&":"?":"",a=yield fetch(e+`${i+l}`,{method:"GET",headers:n});if(!a.ok)throw new Error(un("qm.download.error"));const o=yield a.blob(),s=a.headers.get("content-disposition"),c=t||(s?s.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));wi(o,c)})),Si=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e},Ni=e=>{const t=e.lastIndexOf(".");return-1!==t?e.substring(t+1):""},Ti=e=>{var n,r;const l=Rn({name:"file",multiple:!0,showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}},e),{fileList:i=[],fileDirection:a="vertical",batchDownload:o,draggable:s,editable:c,disabled:d,readOnly:u,button:m={},className:p,onPreview:h,onSortChange:f,onEditChange:g,onDownload:v,onChange:y}=l,{t:b}=Gn(),{$size:x}=Xn(l),E=t.useRef(null),w=t.useRef(null),[C,S]=t.useState({}),N=t.useMemo((()=>d||u||!1),[d,u]);t.useEffect((()=>(R(),()=>{var e;return null===(e=w.current)||void 0===e?void 0:e.destroy()})),[]);const T=(e,t)=>{S((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))},I=Yn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...i],[r]=e.splice(t,1);e.splice(n,0,r),null==f||f(e),null==y||y({file:i[t],fileList:e})}})),R=()=>{s&&(w.current=Kt.create(Wl(E.current,rr("upload-file")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-text-container",onEnd:I}))},O=e=>hn(void 0,void 0,void 0,(function*(){if(v)return void(yield v(e));const{downloadWithHeaders:t,headers:n}=l;try{e.url&&(yield Ci(e.url,Object.assign({fileName:e.name},t?{headers:n}:null)))}catch(e){ne.error(b("qm.download.error"))}})),k=rr("upload-file"),L={[k]:!0,[`${k}--lg`]:"large"===x,[`${k}--sm`]:"small"===x,[`${k}--horizontal`]:"horizontal"===a};return t.createElement(te,jn({className:Pe(L,p)},Nn(l,["fileTypes","fileSize","fileDirection","batchDownload","draggable","editable","button"]),{beforeUpload:(e,t)=>new Promise(((n,r)=>hn(void 0,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:a,maxCount:o,fileList:s=[],beforeUpload:c}=l,d=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!a||e.size/1024/1024<a,m=!(o>1)||s.length<o,p=d&&u&&m;if(d||ne.warning(b("qm.upload.tooltip",{type:i.join(",")})),u||ne.warning(b("qm.upload.sizeLimit",{size:a})),m||ne.warning(b("qm.upload.countLimit",{count:o})),!p)return te.LIST_IGNORE;if(c){const l=c(e,t);if(!0===l)return n(e);if(!1===l)return r("not upload");if(l&&"function"==typeof l.then)try{const e=yield l;n(e)}catch(e){r(e)}}else n(e)})))),disabled:N,onChange:y,onPreview:e=>hn(void 0,void 0,void 0,(function*(){if("function"==typeof h)return h(e,(t=>O(t||e)));d||(yield O(e))})),onDownload:e=>hn(void 0,void 0,void 0,(function*(){yield O(e)})),itemRender:(e,n,r,a)=>((e,n)=>{const{iconRender:r}=l,{uid:a,name:o,url:u,status:m="done"}=e,p="ant-btn ant-btn-text ant-btn-sm ant-btn-icon-only ant-upload-list-item-card-actions-btn";return t.createElement("div",{className:Pe("ant-upload-list-item",`ant-upload-list-item-${m}`,"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(Me,null)),t.createElement("div",{className:"ant-upload-list-item-name"},C[a]?t.createElement(re,{size:"small",autoFocus:!0,defaultValue:Si(o),onBlur:t=>{const{value:n}=t.target;if(n!==Si(o)){const t=Object.assign({},e,{name:`${n}.${Ni(o)}`}),r=i.map((e=>e.uid!==a?e:t));null==g||g(t,r),null==y||y({file:t,fileList:r})}T(a,!1)}}):t.createElement("a",{rel:"noreferrer",target:"_blank",title:o,href:u,onClick:e=>{e.preventDefault(),c?N||T(a,!0):n.preview()}},o)),t.createElement("span",{className:"ant-upload-list-item-card-actions"},c&&!N&&t.createElement("button",{type:"button",className:p,onClick:()=>T(a)},C[a]?t.createElement($e,null):t.createElement(He,null)),c&&t.createElement("button",{type:"button",className:Pe(p,"preview"),onClick:()=>n.preview()},t.createElement(qe,null)),t.createElement("button",{type:"button",className:Pe(p,"download"),disabled:d,onClick:()=>n.download()},t.createElement(Ke,null)),t.createElement("button",{type:"button",className:Pe(p,"delete"),disabled:N,onClick:()=>n.remove()},t.createElement(je,null))))))})(n,a)}),t.createElement("span",{className:"inner",ref:E},l.children||u&&i.length?l.children:t.createElement(Y,{type:null!==(n=m.type)&&void 0!==n?n:"default",icon:null!==(r=m.icon)&&void 0!==r?r:t.createElement(De,null),disabled:N},m.text||b("qm.upload.text")),o&&!!i.length&&t.createElement(Y,{disabled:d,style:{marginLeft:8},onClick:e=>hn(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),"function"==typeof o)yield o(i);else for(const e of i)yield O(e)}))},b("qm.upload.batchDownload"))))};Ti.displayName="QmUploadFile";const Ii=e=>{const n=Rn({icon:t.createElement(Ke,null),withCredentials:!1},e),{$size:r}=Xn(n),{t:l}=Gn(),[i,a]=t.useState(!1),o=Nn(n,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t.createElement(Y,jn({},o,{size:r,loading:i,onClick:()=>hn(void 0,void 0,void 0,(function*(){var e;a(!0);try{const{action:e,fileName:t,headers:r,params:i,beforeDownload:a=bn,onSuccess:o}=n,s=y(e)?e:yield hn(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 Jn("Download","参数 `action` 有误!");if(!a(s))return;yield Ci(s,{fileName:t,headers:r,params:i}),yield xn(100),null==o||o(),ne.success(l("qm.download.success"))}catch(t){null===(e=n.onError)||void 0===e||e.call(n,t),ne.error(l("qm.download.error"))}a(!1)}))}),n.children||l("qm.download.text"))};function Ri(t,n){const r=e.useRef(null),l=e.useRef(0);e.useEffect((()=>()=>{clearTimeout(r.current),r.current=null}),[]);return e.useCallback(((...e)=>{const r=Date.now();(!l.current||r-l.current>n)&&(t.apply(this,e),l.current=r)}),[t,n])}Ii.displayName="QmDownload";const Oi=e=>{const{activeKey:n,labels:r,onTabClick:l}=e;return t.createElement(t.Fragment,null,r.map(((e,r)=>{const i={item:!0,actived:r===n};return t.createElement("div",{key:r,className:Pe(i),onClick:e=>l(r,e)},t.createElement("span",null,e))})))},ki=e=>{const{label:n,showDivider:r,className:l,style:i}=e,a={[rr("anchor-item")]:!0};return t.createElement("div",{className:Pe(a,l),style:i},r&&t.createElement(lr,{label:n,style:{marginBottom:10}}),e.children)};ki.displayName="AnchorItem";const Li=t.forwardRef(((e,n)=>{const{labelList:r=[],defaultActiveIndex:l,labelWidth:i,tabPosition:a="left",onTabClick:o,className:s,style:c}=e,{$size:d}=Xn(e),u=t.useRef(null),m=t.useRef(),p=t.useRef("ready"),h=t.useRef(0),[f,g]=t.useState(l||0),v=t.useMemo((()=>!!(null==r?void 0:r.length)),[r]);t.useEffect((()=>{y();const e=jt(u.current,"scroll",E);return()=>{e.remove()}}),[]);const y=()=>{f>0&&(u.current.scrollTop=Vl(x(f),u.current))},b=e=>{const t=Math.abs(e),n=(v?r.map((e=>document.getElementById(e.id))):Array.from((null===(l=u.current)||void 0===l?void 0:l.children)||[])).map((e=>Vl(e,u.current)));var l;let i=-1;for(let e=0;e<n.length;e++){const r=n[e],l=n[e+1]||1e4;t>=r-1&&t<l&&(i=e)}return i},x=e=>v?document.getElementById(r[e].id):u.current.children[e],E=Ri((e=>{if("ready"!==p.current)return;const t=b(e.target.scrollTop);-1!==t&&g(t)}),60),w=e=>{const t=x(e);t&&(g(e),p.current="stop",m.current&&clearTimeout(m.current),Vt(t,{block:"start",behavior:"smooth",boundary:u.current}),m.current=setTimeout((()=>p.current="ready"),500))};t.useImperativeHandle(n,(()=>({SCROLL_TO_ITEM:e=>{e=(e=e<0?0:e)>h.current?h.current:e,w(e)}})));const C=rr("anchor"),S={[C]:!0,[`${C}-left`]:"left"===a,[`${C}-top`]:"top"===a,[`${C}--lg`]:"large"===d,[`${C}--sm`]:"small"===d},N=[];t.Children.map(e.children,(e=>{var t;gn(e)&&!vn(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 h.current=T.length,t.createElement("div",{className:Pe(S,s),style:c},t.createElement("div",{className:Pe("anchor-nav"),style:{width:i?In(i):""}},t.createElement(Oi,{activeKey:f,labels:T,onTabClick:(e,t)=>{w(e),null==o||o({label:T[e],id:I[e]},t)}})),t.createElement("div",{ref:u,className:Pe("anchor-container")},v?e.children:N))}));Li.displayName="QmAnchor",Li.Item=ki;const Ai=e=>t.createElement(le.TabPane,e,e.children);Ai.displayName="TabPane";const Pi=e=>{const n=Rn({tabPosition:"top"},e),{items:r,tabPosition:l,tabBarGutter:i,className:a,authConfig:o}=n,{$size:s}=Xn(n),c=rr("tabs"),d={[c]:!0,[`${c}--lg`]:"large"===s,[`${c}--sm`]:"small"===s},u=Object.assign(Object.assign({},Nn(n,["items","authConfig"])),{size:s,tabBarGutter:null!=i?i:["top","bottom"].includes(l)?30:0}),m=[];t.Children.map(n.children,(e=>{var t;gn(e)&&!vn(e)&&"TabPane"===(null===(t=e.type)||void 0===t?void 0:t.displayName)&&m.push(e)}));const p=r?[...r]:m.map((({key:e,props:t})=>({key:e,label:t.tab,disabled:t.disabled,closable:t.closable,forceRender:t.forceRender,children:t.children})));if(o){const{fieldList:e=[]}=o||{};for(let t=0;t<p.length;t++){const n=p[t],r=e.find((e=>e.dataIndex===n.key)),{visible:l=1,disabled:i}=r||{};l?i&&(n.disabled=!0):(p.splice(t,1),t--)}}return t.createElement(le,jn({},u,{items:p,className:Pe(d,a)}))};Pi.displayName="QmTabs",Pi.TabPane=Ai;const _i=t.forwardRef(((e,n)=>{var r;const l=Rn({width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null},e),{visible:i,open:a,className:o,loading:s,showHeader:c,showFullScreen:d,maskClosable:u,destroyOnClose:m,onClose:p,onClosed:h,onFullChange:f}=l,{global:g}=t.useContext(on),{$size:v}=Xn(l),y=t.useRef(null),x=t.useRef(null),E=t.useRef(!1),[w,C]=t.useState(!1),[S,N]=t.useState(!1),[T,I]=t.useState(!1);Dl((()=>{(null!=a?a:i)&&(!m&&E.current||b(s)&&N(!0))}),[null!=a?a:i]),Dl((()=>{x.current&&Kl(x.current,w?{width:"100%"}:{width:In(l.width||"72%")})}),[w]);const R=()=>{x.current=Wl(y.current,"ant-drawer-content-wrapper"),C(!w),null==f||f(!w)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>I(!0),STOP_LOADING:()=>I(!1)})));const O=rr("drawer"),k={[O]:!0,"no-header":!c,[`${O}--lg`]:"large"===v,[`${O}--sm`]:"small"===v};return t.createElement(ie,jn({},Nn(l,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:null!=a?a:i,maskClosable:null!==(r=null!=u?u:null==g?void 0:g.maskClosable)&&void 0!==r&&r,className:Pe(k,o),title:t.createElement(t.Fragment,null,t.createElement("span",{ref:y,className:"text"},c&&l.title),d&&t.createElement("button",{type:"button",className:"full-screen",onClick:R},t.createElement(w?Ve:ze))),footer:null,afterOpenChange:e=>{e?(E.current=!0,b(s)&&setTimeout((()=>N(!1)),100)):(C(!1),null==h||h())},onClose:p}),l.children,(s||T||S)&&t.createElement(ei,{spinning:!0,className:Pe("spinning")}))}));_i.displayName="QmDrawer";const Fi="10vh";var Di;!function(e){e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none"}(Di||(Di={}));const Mi=t.forwardRef(((e,n)=>{var r;const l=Rn({width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:Fi}},e),{visible:i,open:a,width:o,height:s,className:c,loading:d,draggable:u,showHeader:m,showFullScreen:p,maskClosable:h,destroyOnClose:f,bodyStyle:g,onFullChange:v,onClose:y,onClosed:x}=l,{global:E}=t.useContext(on),{$size:w}=Xn(l),C=t.createRef(),S=t.useRef(!1),N=t.useMemo((()=>`calc(100vh - ${Fi} - ${Fi} - ${Di[m?w:"none"]}px)`),[w,m]),[T,I]=t.useState(!1),[R,O]=t.useState(!1),[k,L]=t.useState(!1),[A,P]=t.useState(!0),[_,F]=t.useState({left:0,top:0,bottom:0,right:0}),[D,M]=t.useState();Dl((()=>{if(null!=a?a:i){if(!f&&S.current||b(d)&&O(!0),!f&&S.current)return;setTimeout((()=>{S.current=!0,b(d)&&O(!1)}),400)}}),[null!=a?a:i]),Dl((()=>{M(T?{x:0,y:0}:void 0)}),[T]);const H=e=>{const t=Wl(e.target,"ant-modal");if(!t)return;const n=t.querySelector(".ant-modal-body");T?(Kl(t,{width:In(o||"60%"),height:"auto",top:Fi}),Kl(n,{height:s?In(s):N,maxHeight:"auto"===s?N:""})):(Kl(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Kl(n,{height:`calc(100vh - ${Di[m?w:"none"]}px)`,maxHeight:""})),I(!T),null==v||v(!T)};t.useImperativeHandle(n,(()=>({START_LOADING:()=>L(!0),STOP_LOADING:()=>L(!1)})));const $=rr("modal"),q={height:s?In(s):N,maxHeight:"auto"===s?N:"",overflow:"auto"},K={[$]:!0,"no-header":!m,[`${$}--lg`]:"large"===w,[`${$}--sm`]:"small"===w};return t.createElement(ae,jn({},Nn(l,["visible","loading","showFullScreen","maskClosable","onClose","onClosed"]),{open:null!=a?a:i,maskClosable:null!==(r=null!=h?h:null==E?void 0:E.maskClosable)&&void 0!==r&&r,className:Pe(K,c),title:t.createElement("div",{onMouseOver:()=>{A&&P(!1)},onMouseOut:()=>{P(!0)}},t.createElement("span",{className:"text"},m&&l.title),p&&t.createElement("button",{type:"button",className:"full-screen",onClick:H},t.createElement(T?Ve:ze))),footer:null,bodyStyle:Object.assign({},q,g),onCancel:y,afterClose:()=>{null==x||x(),I(!1)},modalRender:e=>t.createElement(zt,{nodeRef:C,bounds:_,position:D,disabled:!u||A||T,onStart:(e,t)=>((e,t)=>{const{clientWidth:n,clientHeight:r}=window.document.documentElement,l=C.current.getBoundingClientRect();l&&F({left:-l.left+t.x,right:n-(l.right-t.x)-1,top:-l.top+t.y,bottom:r-(l.bottom-t.y)-1})})(0,t)},t.createElement("div",{ref:C},e))}),l.children,(d||k||R)&&t.createElement(ei,{spinning:!0,className:Pe("spinning")}))}));Mi.displayName="QmModal";const Hi=n(void 0);var $i={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," <> "," != ")}};const qi=["==","<",">","<=",">=","!=","like","nlike","likes","in","nin","^=","=$","nil","nnil"];var Ki=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},ji=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++)qi.includes(r[e])&&("this"!=r[e-1]?r[e-1]=t+"."+r[e-1]:r[e-1]=t),qi.includes(r[e])&&(r.splice(e-1,3,`__query__(${r[e-1]}, '${r[e]}', ${r[e+1]})`),e-=2);return e=r.join(" ")};const Vi=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,zi=["string","number","boolean","symbol"],Wi=e=>zi.includes(typeof e),Bi=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),Ui=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(new RegExp(Ra,"g")," ").toString().replace(Vi,"\\$1"),"i"),Gi=(e,t,n)=>{e=null!=e?e:"";let r=!0;switch(t){case"like":r=null!==e.toString().match(Ui(n));break;case"nlike":r=null===e.toString().match(Ui(n));break;case"likes":r=n.split(/,|,/).some((t=>Gi(e,"like",t)));break;case"in":Wi(n)&&(n=[n]),Array.isArray(n)&&(r=Array.isArray(e)?e.every((e=>n.includes(e))):n.includes(e));break;case"nin":Wi(n)&&(n=[n]),Array.isArray(n)&&(r=!(Array.isArray(e)?e.some((e=>n.includes(e))):n.includes(e)));break;case"^=":r=e.toString().startsWith(n);break;case"=$":r=e.toString().endsWith(n);break;case"nil":r=""===e||null==e;break;case"nnil":r=!Gi(e,"nil",null);break;case"!=":case"<>":r=(Bi(e)?e.slice(0,10):e)!=n;break;case"<":r=(Bi(e)?e.slice(0,10):e)<n;break;case"<=":r=(Bi(e)?e.slice(0,10):e)<=n;break;case">":r=(Bi(e)?e.slice(0,10):e)>n;break;case">=":r=(Bi(e)?e.slice(0,10):e)>=n;break;default:r=(Bi(e)?e.slice(0,10):e)==n}return r};window.__query__=(...e)=>Gi(e[0],e[1],e[2]);const Yi=$i.stringify,Xi=$i.array_format,Qi=Ki,Zi=(e,t,n)=>{if(!t)return[...e];let r=[];t=$i.replace_symbols(t);try{if(n){const n=new Function("record",`return ${ji(t,"record")};`);r=_a(e,(e=>n(e)))}else{const n=new Function("array","i",`return ${ji(t,"array[i]")};`);for(let t=0,l=e.length;t<l;t++)n(e,t)&&r.push(e[t])}}catch(t){Jn("Table","组件 `initialFilter` 参数有误!"),r=e}return r},Ji=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...Ji(e.children)):t.push(e)})),t},ea=e=>e.filter((e=>(e.children&&(e.children=ea(e.children)),!e.hidden&&!e.noAuth))),ta=e=>e.map((e=>{const t={dataIndex:e.dataIndex};return Array.isArray(e.children)&&(t.children=ta(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),t})),na=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...na(e.children))})),t},ra=(e,t)=>e.map((e=>(e.children&&(e.children=ra(e.children,t)),null==t||t(e),e))),la=(e,t)=>{for(const n of e){if(n.dataIndex===t)return n;if(n.children){const e=la(n.children,t);if(e)return e}}return null},ia=e=>{const t=e.children;return t?t[0].children?ia(t[0]):t[0]:e},aa=e=>{const t=e.children;return t?t[t.length-1].children?aa(t[t.length-1]):t[t.length-1]:e},oa=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),sa=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...sa(e.children))})),t},ca=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...ca(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(t(e))})),n},da=(e,t)=>{const n=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&n.push(...da(e[r].children,t)),n.push(t(e[r]));return n},ua=e=>{let t=1;const n=(e,r)=>{var l;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!==(l=e.colSpan)&&void 0!==l?l:1};e.forEach((e=>{e.level=1,n(e,null)}));const r=[];for(let e=0;e<t;e++)r.push([]);return na(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,r[e.level-1].push(e)})),r},ma=e=>Object.assign(e,{__prevent__:!0}),pa=e=>e.__prevent__,ha=e=>{delete e.__prevent__},fa=(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 fa(e.offsetParent,t,n)}return n},ga=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,va=(e,t)=>w(e,((e,n,r)=>{C(n,t[r])||(e[r]=f(n)&&f(t[r])?va(n,t[r]):n)})),ya=(e,t)=>{var n;return null!==(n=x(e,t))&&void 0!==n?n:""},ba=(e,t,n,r)=>{r>=0&&null!=n&&(n=Number(n).toFixed(r)),E(e,t,null!=n?n:"")},xa=(e,t)=>{if(!t.includes("|"))return ya(e,t);const n=[];return t.split("|").forEach((t=>{t&&n.push(ya(e,t))})),n.every((e=>!e))?"":n.join(" | ")},Ea=e=>/^-?\d+(\.\d+)?$/.test(e.toString()),wa=e=>{const t=(e=e.toString()).split("."),n="-"===t[0].charAt(0)?"-":"";let r=n?t[0].slice(1):t[0],l="";for(;r.length>3;)l=`,${r.slice(-3)}${l}`,r=r.slice(0,r.length-3);return r&&(l=r+l),`${n}${l}${t[1]?`.${t[1]}`:""}`},Ca=(e,t)=>{const n=e.toString();if(!Ea(n)||0===t)return e;const r=Number.parseFloat(n).toString(),l=r.indexOf(".");if(-1===l)return r+"."+"0".repeat(t);const i=Math.max(0,t-(r.length-l-1));return r+"0".repeat(i)},Sa=(e,t)=>e?p(e,t):null,Na=(e,t)=>e?p(e).format(t):"",Ta=(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)}))},Ia=e=>(e=>{const n=[];return function e(r){null!=r&&"boolean"!=typeof r&&("string"!=typeof r&&"number"!=typeof r?Array.isArray(r)?r.forEach(e):t.isValidElement(r)&&e(r.props.children):n.push(r))}(e),n})(e).join(""),Ra="",Oa=(e,t=!1)=>{let n="";if(Array.isArray(e)){let r=0;for(let l=0,i=e.length;l<i;l++){const i=e[l];if(!i.fieldName)continue;const a=Array.isArray(i.condition)?Xi(i.condition):Yi(i.condition,Ra);n+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${a} ${i.bracketRight} ${i.logic} `,r=i.logic.length}n=n.slice(0,-1*r-2)}else{const r=5;for(const r in e){const[l,i]=r.includes("|")?r.split("|"):[r,""],a=e[r];for(const e in a){n+=`${t?`${l}|${i}`:l} ${e} ${Array.isArray(a[e])?Xi(a[e]):Yi(a[e],Ra)} and `}}n=n.slice(0,-1*r)}return n.replace(/\s+/g," ").trim()},ka=(e=[],t=[])=>{const n={};return e.forEach((e=>{const r=JSON.stringify((e=>{const n=[];return t.forEach((t=>n.push(ya(e,t)))),n})(e));n[r]=n[r]||[],n[r].push(e)})),Object.keys(n).map((e=>n[e]))},La=(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=La(e[n].children,t);if(r)return[e[n],r].flat()}}},Aa=(e,t)=>{for(const n of e){if(Array.isArray(n.children)){const e=Aa(n.children,t);if(e)return e}if(t(n))return n}return null},Pa=(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=Pa(e[n].children,t);if(r)return[e[n]._rowKey,r].flat()}}},_a=(e,t)=>e.reduce(((e,n)=>{const r=Object.assign({},n);return Array.isArray(n.children)&&(r.children=_a(n.children,t)),(t(r)||r.children&&r.children.length>0)&&e.push(r),e}),[]),Fa=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Da=(e,t,n=!1)=>{const r=new Set;return function e(t,l,i=1){if(r.has(t))return!1;if(t===l)return!0;if(n&&i>1)return!1;r.add(t);const a=i+1;if(Array.isArray(t)){if(!Array.isArray(l)||t.length!==l.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],l[n],a))return!1;return!0}if(t&&l&&"object"==typeof t&&"object"==typeof l){const n=Object.keys(t);return n.length===Object.keys(l).length&&n.every((n=>e(t[n],l[n],a)))}return!1}(e,t)},Ma=(e,t)=>e===t,Ha=e=>["nil","nnil"].includes(e);function $a(e,t){for(const n in t){const r=t[n],l=ya(e,n);if(r)if(Array.isArray(l)){if(!l.some((e=>r.includes(e))))return!1}else if(!r.includes(l))return!1}return!0}const qa=(e,t,n)=>Object.keys(t).length&&e.length?n?_a(e,(e=>$a(e,t))):e.filter((e=>$a(e,t))):e,Ka=e=>["","small","middle","large"].includes(e),ja=80,Va="1",za="0",Wa=400,Ba=["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"],Ua={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 Ga,Ya,Xa;!function(e){e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year"}(Ga||(Ga={})),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"}(Ya||(Ya={})),function(e){e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss"}(Xa||(Xa={}));const Qa={items:Ut.arrayOf(Ut.shape({type:Ut.string.isRequired,fieldName:Ut.string.isRequired})),initialValues:Ut.object,initialExtras:Ut.object,layout:Ut.oneOf(["horizontal","vertical"]),size:(e,t,n)=>{if(!Ka(e[t]||""))return Zn("Form","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},cols:Ut.number,className:Ut.string,style:Ut.object,component:Ut.oneOfType([Ut.string,Ut.bool]),compactMode:Ut.bool,labelWidth:Ut.oneOfType([Ut.number,Ut.string]),labelAlign:Ut.oneOf(["left","right"]),labelWrap:Ut.bool,formType:Ut.oneOf(["default","search","onlyShow"]),disabled:Ut.bool,uniqueKey:Ut.string,defaultRows:Ut.number,defaultExpand:Ut.bool,searchButtonCols:Ut.number,scrollToFirstError:Ut.bool,authConfig:Ut.object,isAutoFocus:Ut.bool,isCollapse:Ut.bool,isFieldsDefine:Ut.bool,isSearchBtn:Ut.bool,isSubmitBtn:Ut.bool,fieldsChange:Ut.func,onValuesChange:Ut.func,onFieldsChange:Ut.func,onFinish:Ut.func,onFinishFailed:Ut.func,onReset:Ut.func,onCollapse:Ut.func},Za={layout:"horizontal",labelWidth:ja,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:yn,onFieldsChange:yn,onFinish:yn,onFinishFailed:yn,onReset:yn,onCollapse:yn},Ja=(e,t)=>{if(!e)return null;if(t===Ya.week){const t=e.match(/^(\d{4})-(\d+)/);return t?p().year(Number(t[1])).week(Number(t[2])):null}if(t===Ya.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?p().year(Number(t[1])).quarter(Number(t[2])):null}return p(e,t)},eo=(e,t)=>e?p(e).format(t):"",to=e=>""===e||null==e,no=(e,t)=>{var n;if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let l="";for(let t=0,i=r.length;t<i;t++){l+=(null!==(n=e[r[t].trim()])&&void 0!==n?n:"")+(t===i-1?"":" | ")}return l},ro=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const l=t[r].split("|"),i=n[r].split("|");l.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},lo=(e,t,n)=>{for(const r in n)if(Object.keys(t).includes(r)&&t[r]!==n[r])if(t[r].includes("|")){const l=t[r].split("|"),i=n[r].split("|");l.forEach(((t,n)=>e[t]=e[i[n]]))}else e[t[r]]=e[n[r]]},io=(e,t,n)=>e.map((e=>{const r={value:e[t],text:e[n]};return e.disabled&&(r.disabled=!0),b(e.isLeaf)||(r.isLeaf=!!e.isLeaf),b(e.selectable)||(r.selectable=!!e.selectable),Array.isArray(e.children)&&(r.children=io(e.children,t,n)),r})),ao=(e,t)=>{for(const n of e){if(n.value===t)return n;if(Array.isArray(n.children)){const e=ao(n.children,t);if(e)return e}}return null},oo=(e,t,n=0)=>{const r=[];return e.forEach((e=>{e.value==t.split(",")[n]&&r.push(e),Array.isArray(e.children)&&r.push(...oo(e.children,t,n+1))})),r},so=e=>gn(e)||"string"==typeof e,co=(e,t,n,r)=>{var l;const i={};return i.filters=(null===(l=e.filters)||void 0===l?void 0:l.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})))||[],i.table={columns:e.columns||[],rowKey:e.valueName},i.fieldsDefine={valueKey:e.valueKey||e.valueName},i.fieldAliasMap={[r?"textKey":t]:e.displayName[0],[r?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(i.table.fetch={api:n(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(i.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&&(i.echoRequest.fieldAliasMap={[r?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(i.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&&(i.columns=e.emmediateSetting.columns,i.request={fetchApi:n(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),i};var uo={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 mo="阿",po="鿿",ho=1,fo=2,go=3;let vo,yo=null;function bo(e){return e||null===yo?("object"==typeof Intl&&Intl.Collator?(vo=new Intl.Collator(["zh-Hans-CN","zh-CN"]),yo=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):yo=!1,yo):yo}function xo(e){const t=uo.UNIHANS,n=uo.PINYINS,r=uo.EXCEPTIONS,l={source:e};if(e in r)return l.type=fo,l.target=r[e],l;let i,a=-1;if(e.charCodeAt(0)<256)return l.type=ho,l.target=e,l;if(i=vo.compare(e,mo),i<0)return l.type=go,l.target=e,l;if(0===i)l.type=fo,a=0;else{if(i=vo.compare(e,po),i>0)return l.type=go,l.target=e,l;0===i&&(l.type=fo,a=t.length-1)}if(l.type=fo,a<0){let n=0,r=t.length-1;for(;n<=r;){a=~~((n+r)/2);const l=t[a];if(i=vo.compare(e,l),0===i)break;i>0?n=a+1:r=a-1}}return i<0&&a--,l.target=n[a],l.target||(l.type=go,l.target=l.source),l}function Eo(e){return"string"==typeof e&&bo()?e.split("").map((e=>xo(e))):e}var wo={isSupported:bo,parse:Eo,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(uo)})))},genToken:xo,convertToPinyin:(e,t,n)=>Eo(e).map((e=>t&&e.type===fo?e.target.toLowerCase():e.target)).join(n||"")};var Co={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)}};wo.isSupported()&&Co.shouldPatch(wo.genToken)&&wo.patchDict(Co);const So=e=>{const{value:n,bordered:r}=e;return t.createElement(re,{value:n,title:n,bordered:r,readOnly:!0})};So.displayName="FormItemView";const No=t.forwardRef(((e,n)=>{const{text:r="",tag:l="div",enabled:i=!0,copy:a,fetch:o,className:s,style:c,title:d}=e,{global:u}=t.useContext(on),m=rr("translate"),p=r?r.trim():"",h=i&&!!p,f=o||(null==u?void 0:u.translateFetch);t.useMemo((()=>{(null==f?void 0:f.api)||Jn("Translate","设置 `fetch` 参数,或通过 [ConfigProvider] 配置 `translateFetch` 全局参数")}),[f]);const{translate:g}=(e=>{const[n,r]=t.useState(new Map);return{translate:Yn((t=>hn(void 0,void 0,void 0,(function*(){var l;if(!t||!e)return null;if(n.has(t))return n.get(t);try{const{params:n,dataKey:i,formatter:a=(e=>e),afterFetch:o}=e,s=yield e.api(a(Object.assign({text:t},n)));if(200===s.code){let e=y(s.data)?s.data:null!==(l=x(s.data,i))&&void 0!==l?l:"";return e="function"==typeof o?yield o(e):e,r((n=>new Map(n).set(t,e))),e}return""}catch(e){return console.error("[Translate] 翻译失败:",e),null}}))))}})(f),[v,b,E,w]=(({prefixCls:e,text:n,enabled:r,translate:l})=>{const i=t.useRef(null),{t:a}=Gn(),[o,s]=t.useState(!1),[c,d]=t.useState(null),[u,m]=t.useState(!1),[p,h]=t.useState(""),f={width:150,height:100,zIndex:9999};Dl((()=>{o&&n&&(m(!0),l(n).then((e=>{e&&h(e)})).finally((()=>{m(!1)}))),!n&&o&&y()}),[o,n]);const g=e=>{var t;const{width:n,height:r}=(null===(t=i.current)||void 0===t?void 0:t.getBoundingClientRect())||f,l=n,a=r,o=window.innerWidth,s=window.innerHeight;let c=e.clientX,u=e.clientY;c+l>o?c=Math.max(c-l-5,0):c+=10,u+a>s?u=Math.max(u-a-5,0):u+=10,d({x:c,y:u})},v=Yn((e=>{r&&e.ctrlKey&&(s(!0),En((()=>g(e))))})),y=()=>{o&&(s(!1),En((()=>d(null))))},b=Yn((e=>{r&&e.ctrlKey&&(o?g(e):(s(!0),En((()=>g(e)))))})),x={position:"fixed",top:(null==c?void 0:c.y)||0,left:(null==c?void 0:c.x)||0,zIndex:f.zIndex};return[t.createElement(Gt,{open:o},t.createElement("div",{ref:i,className:Pe("ant-dropdown-menu",`${e}__tooltip`),style:x},t.createElement("div",{className:"label"},a("qm.translate.sourceText"),":"),t.createElement("div",{className:"text"},n),t.createElement("div",{className:"label"},a("qm.translate.targetText"),":"),t.createElement("div",{className:"text primary"},u?`${a("qm.translate.translating")}...`:p))),v,y,b]})({prefixCls:m,text:p,enabled:h,translate:g}),C=e.children||p;if(!C)return null;const S={[m]:!0,"help-cursor":h};return t.createElement(t.Fragment,null,t.createElement(l,{ref:n,className:Pe(S,s),style:c,title:d,onMouseEnter:b,onMouseLeave:E,onMouseMove:w},C),v)}));No.displayName="Translate";const{Option:To}=de,Io=e=>{const{$$form:n}=t.useContext(Hi),{value:r,items:l,multiple:i,loading:a,onChange:o,onValuesChange:s}=e,{t:c}=Gn(),{fieldName:d,options:u={},style:m={},placeholder:p=c("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,translate:g,readOnly:v,disabled:y,onClear:b}=e.option,{itemList:x=[],filterable:E=!0,listHeight:w=Wa,collapseTags:C,maxTagTextLength:S,dropdownStyle:N,openPyt:T=!0}=u,I=Cn(x)?l:x,R=e=>{var t;return(null===(t=I.find((t=>t.value===e)))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},O=e=>i?(null==e?void 0:e.map((e=>R(e))).join(","))||"":R(e),k=n.isOnlyShow?t.createElement(So,{value:O(r),bordered:h}):t.createElement(de,jn({value:r,mode:i?"multiple":void 0,popupClassName:`form-popper__${d}`,dropdownStyle:N,placeholder:p,style:m,loading:a,bordered:h,allowClear:f,disabled:y,showSearch:E,listHeight:w,maxTagCount:C?"responsive":void 0,maxTagTextLength:S},i?{title:O(r)}:null,{filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"",l=wo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(T?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{null==o||o(e),s(e,O(e),I)})(e)},onClear:b}),I.map((e=>t.createElement(To,{key:e.value,value:e.value,disabled:e.disabled},e.text))));return g?t.createElement(No,{text:O(r)},k):k};class Ro extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>hn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,buttonAfter:p,validateTrigger:h,rules:f=[],onChange:g=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(i),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":In(d)},required:e.getFormItemRequired(f)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(Io,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{g(t,n,r),e.setViewValue(o,n)}}))),p&&t.createElement(ce,null,e.renderFormItemButton(o,p)),m&&t.createElement(ce,{flex:In(m.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}Ro.contextType=Hi;const Oo=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToCheckbox:u,falseValue:m=za,trueValue:p=Va}=o,{t:h}=Gn(),f=e=>h(e===p?"am.form.trueText":"am.form.falseText");return t.createElement(ue,{checked:r===p,style:s,disabled:d||n.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{null==l||l(e),i(e,f(e))})(t?p:m)}},u?a:null)};class ko extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option,{labelToCheckbox:h}=o;return t.createElement(oe.Item,{label:h?" ":e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Oo,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}ko.contextType=Hi;const Lo=e=>{const{uniqueKey:n,items:r,fieldsChange:l}=e,{global:i}=t.useContext(on),{$$form:a}=t.useContext(Hi),{$size:o}=Xn(e),{t:s}=Gn(),c=t.useRef(null),[d,u]=t.useState(!1),m=t.useMemo((()=>n?`form_${n}`:""),[n]);t.useLayoutEffect((()=>{f()}),[]);const p=()=>{if(!m)return;const e=JSON.parse(localStorage.getItem(m));var t;if(e||(t=m,hn(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(m,JSON.stringify(e)),f()):(null==i?void 0:i.getComponentConfigApi)&&h(r)})).catch((()=>{})),!e)return;return S(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?(b(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)}))},h=e=>{if(!m)return;const t=e.map((e=>{const t={};return b(e.hidden)||(t.hidden=e.hidden),Object.assign({fieldName:e.fieldName},t)})),n=JSON.parse(localStorage.getItem(m));var r,l;C(t,n)||(localStorage.setItem(m,JSON.stringify(t)),r=m,l=t,hn(void 0,void 0,void 0,(function*(){const e=null==i?void 0:i.saveComponentConfigApi;if(e)try{yield e({[r]:l})}catch(e){}})))},f=()=>{const e=p();e&&g(e)},g=e=>{null==l||l([...e])},v=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","fields-list")},t.createElement("div",{className:"reset"},t.createElement(er,{type:"text",size:"small",onClick:()=>(e=>{const t=e.filter((e=>r.find((t=>t.fieldName===e.fieldName)))).map((e=>{const t=r.find((t=>t.fieldName===e.fieldName));return Object.assign({},t,{hidden:e.hidden})}));g(t),h(t)})(a.getOriginItems())},s("qm.table.columnFilter.reset"))),t.createElement(Yt,{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(C(t,n))return;a.setExpandHandle(!0);const l=Fa(e);g(l),h(l)}},r.map((e=>{var n;return t.createElement("li",{key:e.fieldName,className:"item",style:e.noAuth?{display:"none"}:void 0},t.createElement(ue,{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),h(r)}}),t.createElement(Be,{className:"handle",title:s("qm.form.draggable")}),t.createElement("span",{className:"title"},a.getFormItemLabel(e.label)))})))),y=rr("form-fields-filter"),x={[y]:!0,[`${y}--lg`]:"large"===o,[`${y}--sm`]:"small"===o};return t.createElement(me,{open:d,trigger:["click"],dropdownRender:()=>v(),overlayClassName:Pe(x),placement:"bottomRight",overlayStyle:{minWidth:160},getPopupContainer:()=>c.current,onOpenChange:e=>{u(e)}},t.createElement("a",{ref:c,style:{padding:"5px 0"}},t.createElement(We,null)))};Lo.displayName="FieldsFilter";const Ao=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Hi),{value:l,onChange:i,onValuesChange:a}=e,{t:o}=Gn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,translate:p,readOnly:h,disabled:f,onFocus:g,onBlur:v,onEnter:y,onClear:b}=e.option,{prefix:x,suffix:E,password:w,maxLength:C,pattern:S,toUpper:T,toTrim:I,autoFocus:R,autoComplete:O,secretType:k}=s,L=k&&(h||f),A=t.useRef(),P=t.useRef(!1);t.useEffect((()=>{var e;const t=()=>null==b?void 0:b(),n=null===(e=A.current)||void 0===e?void 0:e.input.parentNode.querySelector("span[class*='clear-icon']");return m&&n&&n.addEventListener("click",t),()=>{null==n||n.removeEventListener("click",t)}}),[]);const _=e=>{null==i||i(e),a(e)},F=w?re.Password:re,D=L?((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))(l,k):l,M=r.isOnlyShow?t.createElement(So,{value:(e=>e&&w?new Array(e.length).fill("*").join(""):e)(D),bordered:u}):t.createElement(F,{ref:e=>{A.current=e,"function"==typeof n&&n(e)},value:D,autoComplete:w?"new-password":O,autoFocus:R,placeholder:d,style:c,title:w?"":D,prefix:x,suffix:E,maxLength:C,bordered:u,allowClear:m,readOnly:h,disabled:f,onFocus:e=>{null==g||g(e.target.value,e)},onBlur:t=>{var n;let r=null!==(n=t.target.value)&&void 0!==n?n:"";if(I){const e=r.trim();r!==e&&(r=e,_(r))}(t=>{const{onBlur:n}=e;null==n||n(t)})(r),null==v||v(r,t)},onKeyUp:e=>{var t;if(13===e.keyCode){const{value:n}=e.target;null==y||y(n,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=A.current)||void 0===t||t.blur())}},onCompositionStart:()=>{P.current=!0},onCompositionEnd:()=>{P.current=!1},onChange:e=>{let t=e.target.value;N(S)&&(t=S.test(t)?t:null!=l?l:""),T&&!P.current&&(t=t.toUpperCase()),_(t)}});return p?t.createElement(No,{text:D,enabled:!w},M):M}));Ao.displayName="VInput";class Po extends d{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:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(p)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ao,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),u&&t.createElement(ce,null,e.renderFormItemButton(i,u)),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Po.contextType=Hi;const _o=e=>{const{$$form:n}=t.useContext(Hi),{value:r=[],onChange:l,onValuesChange:i}=e,{t:a}=Gn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{prefix:p,suffix:h,maxLength:f}=o,g=e=>{const t=e.every((e=>!e))?[]:e;null==l||l(t),i(t,v(t))},v=e=>e.join(" - ");return n.isOnlyShow?t.createElement(So,{value:v(r),bordered:c}):t.createElement(re.Group,null,t.createElement(re,{value:r[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:s[0],prefix:p,suffix:h,maxLength:f,allowClear:d,bordered:c,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([t,r[1]])}}),t.createElement(re,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement(re,{value:r[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:s[1],prefix:p,suffix:h,maxLength:f,bordered:c,allowClear:d,readOnly:u,disabled:m,onChange:e=>{const{value:t}=e.target;g([r[0],t])}}))};class Fo extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(s),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(o)},required:e.getFormItemRequired(u)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(_o,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(i,n)}}))),c&&t.createElement(ce,{flex:In(c.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},c)))))}}Fo.contextType=Hi;const Do=t.forwardRef(((e,n)=>{const{$$form:r}=t.useContext(Hi),{value:l,onChange:i,onValuesChange:a}=e,{t:o}=Gn(),{options:s={},style:c={},placeholder:d=o("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:m,disabled:p,onFocus:h,onBlur:f,onEnter:v}=e.option,{step:y=1,min:b,max:x,precision:E,autoFocus:w,stringMode:C,textAlign:S="left",controls:N=!0,formatter:T,parser:I}=s,R=t.useRef(),O=t.useRef(l),k=e=>{const t=to(e)?"":g(e)?e.toFixed(E):new Xt(e).toFixed(E);return"function"==typeof T?T(t):t},L={[S]:!0,controls:N};return r.isOnlyShow?t.createElement(So,{value:k(l),bordered:u}):t.createElement(pe,{ref:e=>{R.current=e,"function"==typeof n&&n(e)},value:l,className:Pe(L),placeholder:d,style:Object.assign({width:"100%"},c),step:y,min:b,max:x,controls:N,precision:E,autoFocus:w,stringMode:C,formatter:T,parser:I,bordered:u,readOnly:m,disabled:p,onFocus:e=>{null==h||h(e.target.value,e)},onBlur:t=>{En((()=>{(t=>{const{onBlur:n}=e;null==n||n(t)})(O.current),null==f||f(O.current,t)}))},onKeyUp:e=>{var t;13===e.keyCode&&(null==v||v(l,e),r.isFilterType&&(r.SUBMIT_FORM(),null===(t=R.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=>{O.current=e,null==i||i(e),a(e,k(e))})(t)}})}));Do.displayName="VInputNumber";class Mo extends d{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:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(p)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Do,{ref:e=>this[n]=e,option:this.props.option,onValuesChange:(t,n)=>{h(t),e.setViewValue(i,n)}}))),u&&t.createElement(ce,null,e.renderFormItemButton(i,u)),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Mo.contextType=Hi;const Ho=e=>{const{$$form:n}=t.useContext(Hi),{value:r=[],onChange:l,onValuesChange:i}=e,{t:a}=Gn(),{options:o={},placeholder:s=a("qm.form.rangeInputNumberPlaceholder"),bordered:c=!0,allowClear:d,readOnly:u,disabled:m}=e.option,{step:p=1,min:h=0,max:f,textAlign:g="left",controls:v=!0,precision:y,formatter:b,parser:x}=o,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),w(e)},w=e=>{const t=e.every((e=>null===e))?[]:[...e];null==l||l(t),i(t,C(t))},C=e=>to(e)?"":e.map((e=>to(e)?"":Number(e).toFixed(y))),S={[g]:!0,controls:v};return n.isOnlyShow?t.createElement(So,{value:C(r),bordered:c}):t.createElement(re.Group,null,t.createElement(pe,{value:r[0],className:Pe("site-input-left",S),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:s[0],step:p,min:h,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([e,r[1]])},onBlur:()=>{E(r)}}),t.createElement(re,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:c,disabled:m,readOnly:!0}),t.createElement(pe,{value:r[1],className:Pe("site-input-right",S),style:{width:"calc(50% - 5px)"},placeholder:s[1],step:p,min:h,max:f,controls:v,precision:y,formatter:b,parser:x,bordered:c,readOnly:u,disabled:m,onChange:e=>{w([r[0],e])},onBlur:()=>{E(r)}}))};class $o extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:d,rules:u=[],onChange:m=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(s),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(o)},required:e.getFormItemRequired(u)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:u,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Ho,{option:this.props.option,onValuesChange:(t=[],n)=>{m(t),e.setViewValue(i,n)}}))),c&&t.createElement(ce,{flex:In(c.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},c)))))}}var qo;$o.contextType=Hi,function(e){e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small"}(qo||(qo={}));const Ko=n(void 0),jo={dataIndex:Ut.string.isRequired,title:Ut.string.isRequired,description:Ut.string,colSpan:Ut.number,width:Ut.number,minWidth:Ut.number,fixed:Ut.oneOf(["left","right"]),align:Ut.oneOf(["left","center","right"]),theadAlign:Ut.oneOf(["left","center","right"]),theadWrap:Ut.bool,printFixed:Ut.bool,hidden:Ut.bool,noAuth:Ut.bool,noFixed:Ut.bool,ellipsis:Ut.bool,className:Ut.string,theadClassName:Ut.string,children:Ut.array,sorter:Ut.oneOfType([Ut.bool,Ut.func]),filter:Ut.shape({type:Ut.oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:Ut.arrayOf(Ut.shape({text:Ut.string,value:Ut.oneOfType([Ut.string,Ut.number])})),style:Ut.object,openFilterList:Ut.bool}),precision:Ut.number,displayPrecision:Ut.number,formatType:Ut.oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:Ut.bool,canCopy:Ut.bool,translate:Ut.bool,editRender:Ut.func,dictItems:Ut.arrayOf(Ut.shape({text:Ut.string,value:Ut.oneOfType([Ut.string,Ut.number])})),summation:Ut.shape({sumBySelection:Ut.bool,displayWhenNotSelect:Ut.bool,dataKey:Ut.string,unit:Ut.string,render:Ut.func}),groupSummary:Ut.shape({dataKey:Ut.string,unit:Ut.string,render:Ut.func}),shouldCellUpdate:Ut.func,headRender:Ut.func,render:Ut.func,outputRender:Ut.func};Ut.arrayOf(Ut.shape(jo)).isRequired,Ut.func,Ut.array,Ut.oneOfType([Ut.string,Ut.func]).isRequired,Ut.number,Ut.bool,Ut.bool,Ut.shape({api:Ut.func.isRequired,params:Ut.object.isRequired,formatter:Ut.func,beforeFetch:Ut.func,afterFetch:Ut.func,stopToFirst:Ut.bool,dataKey:Ut.string,callback:Ut.func}),Ut.bool,Ut.bool,Ut.string,Ut.string,Ut.object,Ut.bool,Ut.bool,Ut.bool,Ut.oneOfType([Ut.object,Ut.func]),Ut.oneOfType([Ut.object,Ut.func]),Ut.array,Ut.func,Ut.bool,Ut.func,Ut.object,Ut.object,Ut.shape({type:Ut.oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:Ut.array,selectedRowKeys:Ut.array,hideSelectAll:Ut.bool,checkStrictly:Ut.bool,filterable:Ut.bool,selectByClickRow:Ut.bool,selectFirstRowOnChange:Ut.bool,clearableAfterFetched:Ut.bool,selectAllOnCurrentPage:Ut.bool,fetchSelectedRows:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),fetchAllRowKeys:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),disabled:Ut.func,onChange:Ut.func,onSelect:Ut.func,onSelectAll:Ut.func}),Ut.shape({currentRowKey:Ut.oneOfType([Ut.number,Ut.string]),disabled:Ut.func,onChange:Ut.func}),Ut.shape({virtual:Ut.bool,overscan:Ut.number,doubleXScrollbar:Ut.bool,expandIconColumn:Ut.string}),Ut.shape({defaultExpandAllRows:Ut.bool,defaultExpandedRowKeys:Ut.array,expandedRowKeys:Ut.array,hideExpandAll:Ut.bool,rowExpandable:Ut.func,expandedRowClassName:Ut.string,expandedRowRender:Ut.func,onExpand:Ut.func,onChange:Ut.func}),Ut.shape({cellMerge:Ut.bool,onCellMerge:Ut.func,onSelectChange:Ut.func}),Ut.shape({groupItems:Ut.arrayOf(Ut.shape({dataIndex:Ut.string.isRequired,titleIndex:Ut.string,color:Ut.string,backgroundColor:Ut.string})),fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),onChange:Ut.func}),Ut.func,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.shape({current:Ut.number,pageSize:Ut.number,pageSizeOptions:Ut.array,showSizeChanger:Ut.bool,showQuickJumper:Ut.bool}),Ut.shape({fileName:Ut.string,fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object}),beforeExport:Ut.func,cellStyle:Ut.bool,hideIcon:Ut.bool}),Ut.shape({showLogo:Ut.bool}),Ut.shape({fetch:Ut.shape({api:Ut.func.isRequired,params:Ut.object,dataKey:Ut.string}),fieldList:Ut.arrayOf(Ut.object)}),Ut.shape({position:Ut.oneOf(["top","bottom"]),hideAlert:Ut.bool,hideClearButton:Ut.bool}),Ut.oneOf(["left","right"]),Ut.func,Ut.func,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.bool,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func,Ut.func;const Vo={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},zo=10,Wo="1",Bo="0",Uo="YYYY-MM-DD",Go="YYYY-MM-DD HH:mm:ss",Yo="YYYYMMDDHHmmss",Xo={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 Qo;!function(e){e.left="flex-start",e.right="flex-end"}(Qo||(Qo={}));const Zo=Object.assign({},e).useId;let Jo=0;var es=Zo?function(e){const t=Zo();return e||t}:function(t){const[n]=e.useState(`qm_unique_${Jo}`);return e.useEffect((()=>{Jo+=1}),[]),t||n};let ts=[];const ns={_getInstance:function(e){var t;return null!==(t=ts.find((t=>t.id===e)))&&void 0!==t?t:null},getFocusInstance:function(){var e;return null!==(e=ts[0])&&void 0!==e?e:null},focus:function(e){const t=this._getInstance(e);t&&0!==ts.findIndex((e=>e===t))&&(this.deregister(e),ts=[t,...ts])},register:function(e,t){e&&t&&(null!==this._getInstance(e)&&this.deregister(e),ts=[{id:e,vm:t},...ts])},deregister:function(e){e&&(ts=ts.filter((t=>t.id!==e)))}};class rs{constructor(e){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=>{const t=this.state.updated.findIndex((t=>t===e||this.getRowKey(t,t.index)===this.getRowKey(e,e.index)));-1===t?this.state.updated.push(e):this.state.updated.splice(t,1,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=[]},this.getRowKey=e.getRowKey}destroy(){for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}function ls(e){return void 0!==e}function is(t,n){const{defaultValue:r,value:l,onChange:i,postState:a}=n||{},[o,s]=e.useState((()=>ls(l)?l:ls(r)?"function"==typeof r?r():r:"function"==typeof t?t():t)),c=ls(l)?l:o,d=a?a(c):c,u=Yn(i),[m,p]=e.useState([c]);si((()=>{const e=m[0];o!==e&&u(o,e)}),[m]),si((()=>{ls(l)||s(l)}),[l]);return[d,Yn((e=>{s(e),p([c])}))]}const as={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"},os=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=os(t.children)),t})),ss=(e,n)=>{const{fetch:r,columns:l,border:i,rowHeight:a,rowSelection:o,summation:s,expandable:c,treeConfig:d,tableConfig:u,webPagination:m,scrollPagination:p,showSuperSearch:h,showFastSearch:f,showGroupSummary:g,showTableImport:v,showClipboard:y,showSelectCollection:b,showPivotGrid:x,footRender:E}=e,{tableRef:w,getRowKey:C,$size:S,tableFullData:N,tableFlatData:T,updateMark:I,selectionKeys:R,sorter:O,filters:k,superFilters:L,pagination:A,mergedTdCells:P}=n,{selectionRows:_,summaries:F}=w.current,{expandIconColumn:D=""}=Object.assign({},d,u),{t:M}=Gn(),H=e=>{const t=(e=>{const t=[],n=[],r=[];for(let l=0;l<e.length;l++){const i=e[l];"left"===i.fixed?t.push(i):"right"===i.fixed?n.push(i):r.push(i)}return[...t,...r,...n]})(os(e)),n=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:as.selectionColumn,title:"radio"===t?M("qm.table.config.selectionText"):"",width:as.selectionColumnWidth,fixed:"left",type:t}})(o),r=(null==(l=c)?void 0:l.expandedRowRender)?{dataIndex:as.expandableColumn,title:"",width:as.selectionColumnWidth,fixed:"left",type:"expand"}:null;var l;return n&&t.unshift(n),r&&t.unshift(r),ea(t)},$=(e,t,n,r,l)=>{const i=`${t},${n}`;e.has(i)||e.set(i,{row:t,col:n,rowSpan:r,colSpan:l})},q=t.useMemo((()=>!!(null==r?void 0:r.api)),[null==r?void 0:r.api]),K=t.useMemo((()=>!q&&!!m),[q,m]),j=t.useMemo((()=>q&&!!p),[q,p]),V=t.useMemo((()=>(q||K)&&!j),[q,K,j]),z=t.useMemo((()=>H(l)),[l]),W=t.useMemo((()=>Ji(z)),[z]),B=t.useMemo((()=>W.filter((e=>"function"==typeof e.editRender))),[W]),U=t.useMemo((()=>W.filter((e=>!!e.summation))),[W]),G=t.useMemo((()=>W.filter((e=>"left"===e.fixed))),[W]),Y=t.useMemo((()=>W.filter((e=>"right"===e.fixed))),[W]),X=t.useMemo((()=>a||as.rowHeightMaps[S]),[a,S]),Q=t.useMemo((()=>(e=>{const t=new Map;return e.forEach((e=>{const n=T.findIndex((t=>C(t,t.index)===e.rowKey)),r=W.findIndex((t=>t.dataIndex===e.dataIndex));if(!(n<0||r<0)){$(t,n,r,e.rowSpan,e.colSpan);for(let l=0;l<e.rowSpan;l++)for(let i=0;i<e.colSpan;i++)0===l&&0===i||$(t,n+l,r+i,0,0)}})),Array.from(t.values()).sort(((e,t)=>e.row-t.row||e.col-t.col))})(P)),[P,W,N]),Z=t.useMemo((()=>{var e,t;const n=W.filter((e=>![as.expandableColumn,as.selectionColumn,as.operationColumn].includes(e.dataIndex)));return D&&n.some((e=>e.dataIndex===D))?D:null!==(t=null===(e=n[0])||void 0===e?void 0:e.dataIndex)&&void 0!==t?t:""}),[W,D]),J=t.useMemo((()=>U.length>0),[U]),ee=t.useMemo((()=>!!E||J),[E,J]),te=t.useMemo((()=>ua(z).length>1),[z]),ne=t.useMemo((()=>i||te),[i,te]),re=t.useMemo((()=>W.some((e=>e.sorter))),[W]),le=t.useMemo((()=>W.some((e=>e.filter))),[W]),ie=t.useMemo((()=>U.some((e=>!!e.summation.dataKey))),[U]),ae=t.useMemo((()=>!q&&!!v),[q,v]),oe=t.useMemo((()=>!!y&&B.length>0),[y,B]),se=t.useMemo((()=>!!b&&"checkbox"===(null==o?void 0:o.type)),[b,o]),ce=t.useMemo((()=>!!h&&le),[h,le]),de=t.useMemo((()=>!q&&!!f),[q,f]),ue=t.useMemo((()=>!q&&!!x),[q,x]),me=t.useMemo((()=>!!g&&W.some((e=>!!e.groupSummary))),[W]),pe=t.useMemo((()=>{var e;return!!(null===(e=null==s?void 0:s.groupItems)||void 0===e?void 0:e.length)}),[s]),he=t.useMemo((()=>!T.length),[T]),fe=t.useMemo((()=>(()=>{const e={};return U.forEach((t=>{const{dataIndex:n,precision:r,displayPrecision:l,summation:i}=t,{sumBySelection:a,displayWhenNotSelect:o,unit:s}=i,c=!_.length&&!!o;let d=(!a||c?w.current.tableFullData:_).reduce(((e,t)=>{if(null==t?void 0:t[as.summaryIgnore])return e;const r=ya(t,n);return Ea(r)?e.plus(r):e}),new Xt(0));!Object.keys(F).includes(n)||a&&!c||(d=new Xt(ya(F,n))),ba(e,n,d.toNumber());let u=r>=0?d.toFixed(r):d.toString();l>=0&&""!==u&&(u=Ca(u,l)),u=wa(u),ba(e,`${n}_text`,s?`${u} ${s}`:u)})),[e]})()),[T,I,R,F]),ge=t.useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(U)),[U]),ve=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(",")})(O),n=((e,t)=>{const n=[];if(Object.keys(e).length)for(const t in e){const[r,l]=t.split("|"),i=e[t];Object.keys(i).forEach((e=>{n.push({type:["radio","tree"].includes(l)?"checkbox":l,bracketLeft:"",fieldName:r,expression:e,value:Ha(e)?null:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{const t=e.fieldType;n.push({type:["radio","tree"].includes(t)?"checkbox":t,bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:Ha(e.expression)?null:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),n.length&&(n[n.length-1].logic=""),n})(k,L),l=t?{[as.sorterFieldName]:t}:null,i=n.length?{[as.filterFieldName]:n}:null,a=ge?{[as.groupSummary.summaryFieldName]:ge,usedJH:1}:null,o=null!==(e=null==r?void 0:r.params)&&void 0!==e?e:null,s={[as.currentPageName]:A.current,[as.pageSizeName]:A.pageSize};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),i),a),o),s)}),[null==r?void 0:r.params,A.current,A.pageSize,O,k,L,ge]);return{isFetch:q,isWebPagination:K,isScrollPagination:j,showPagination:V,tableColumns:z,flattenColumns:W,editableColumns:B,summationColumns:U,leftFixedColumns:G,rightFixedColumns:Y,tableRowHeight:X,derivedMergeCells:Q,treeExpandIndex:Z,showSummary:J,showFooter:ee,isHeadGroup:te,bordered:ne,isHeadSorter:re,isHeadFilter:le,isServiceSummation:ie,isSelectCollection:se,isTableImport:ae,isTableClipboard:oe,isSuperSearch:ce,isFastSearch:de,isPivotGrid:ue,isGroupSummary:me,isGroupSubtotal:pe,isTableEmpty:he,summationRows:fe,fetchParams:ve}},cs=(e,n)=>{const{rowKey:r,height:l,dataSource:i,summation:a,fetch:o,rowSelection:s,expandable:c,tableConfig:d,authConfig:u,ignorePageIndex:m,keepScrollOnDataChange:p,columnsChange:h,onChange:f,onDataChange:g,onDataLoad:v,onScrollEnd:y,onFetchError:b}=e,{getRowKey:E,tableRef:w,tableElementRef:C,$size:S,tableColumns:N,flattenColumns:I,tableFullData:R,pagination:O,layout:k,filters:L,sorter:A,superFilters:P,pagerFilter:_,fetchParams:F,selectionKeys:D,rowExpandedKeys:M,highlightKey:H,summationColumns:$,isFetch:q,isWebPagination:K,isScrollPagination:j,isServiceSummation:V,isGroupSubtotal:z,doLayout:W,setTableFullData:B,setTableOriginData:U,setTableFlatData:G,setTableDataMaps:Y,setPagination:X,setPingRight:Q,setPingLeft:Z,setSpinning:J,setSorter:ee,setFilters:te,setSuperFilters:ne,setPagerFilter:re,setActivedCell:le,setSelectionKeys:ie,setRowExpandedKeys:ae,setHighlightKey:oe,setSelectionRows:se,setScrollXLoad:ce,setScrollYLoad:de,setFieldAuth:ue,setResizeState:me,setSummaries:pe,setPermission:he,resetTableScroll:fe,createTableFocus:ge,clearElementStore:ve}=n,{t:ye}=Gn(),{store:be}=w.current,xe=t.useRef(F),Ee=t.useRef(!1),we=e=>Ee.current=e,Ce=ai(C);si((()=>{Le(),W()}),[N]),si((()=>{Se()}),[Ce.width,Ce.height,S,l,k.tableAutoHeight]),si((()=>{q||Ne(R.length),W()}),[R]),si((()=>{tt(),nt(),rt(),q||(!Cn(L)&&te({payload:Object.assign({},L),forceUpdate:!0}),!Cn(A)&&ee({payload:Object.assign({},A),forceUpdate:!0}),Ye(i),K&&Re(),!p&&fe())}),[i,null==o?void 0:o.params]),si((()=>{const e=Oe(F,xe.current);var t;e||q&&(null==s?void 0:s.clearableAfterFetched)&&lt(),!e&&F[as.currentPageName]>1&&!(null==o?void 0:o.stopToFirst)?Re():q&&ze(),t=F,xe.current=t}),[F]),si((()=>{w.current.isTreeTable&&Je()}),[M]),Dl((()=>{K&&(Je(),Be()),j||fe(),$e()}),[O.current,O.pageSize]);const Se=()=>{const{scrollBarRef:e,resizeState:t}=w.current,{width:n,height:r}=Ce;W(),k.tableBodyWidth>n&&Q(!0),e.current.scrollLeft>0&&Z(!0),me(Object.assign({},t,{width:n,height:r}))},Ne=e=>{e!==O.total&&X((t=>Object.assign({},t,{total:e})))},Te=({current:e,pageSize:t})=>{X((n=>Object.assign({},n,{current:e,pageSize:t})))},Ie=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Re=()=>{Te(Object.assign({},O,{current:1}))},Oe=(e,t)=>{const n=Object.keys(va(e,t));return 1===n.length&&(n.includes(as.currentPageName)||n.includes(as.pageSizeName))},ke=ci((e=>{Ue(),null==y||y(e)})),Le=()=>{ce(I.length>as.virtualScrollX)},Ae=(e=[])=>{var t;let n=e.length>as.virtualScrollY;w.current.isTreeTable&&(n=!0),de(null!==(t=null==d?void 0:d.virtual)&&void 0!==t?t:n)},Pe=e=>z?_e(Fe(e)):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=0)=>{var n;const l=null===(n=a.groupItems)||void 0===n?void 0:n[t];if(!l)return e.forEach(((t,n)=>{t._rowSpan=0===n?e.length:0,t._colSpan=1})),e;return ka(e,[l.dataIndex]).map((e=>{const n={children:Fe(e,t+1),_group:l.dataIndex};return"function"!=typeof r&&ba(n,r.toString(),Ta()),l.titleIndex&&ba(n,l.titleIndex,ya(e[0],l.titleIndex)),ba(n,l.dataIndex,ya(e[0],l.dataIndex)),$.forEach((e=>{var t;const{dataIndex:r}=e,l=null===(t=n.children)||void 0===t?void 0:t.reduce(((e,t)=>{if(t[as.summaryIgnore])return e;const n=Number(ya(t,r));return Number.isNaN(n)?e:e+n}),0);ba(n,r,l)})),n}))},De=e=>{ie(e),se((e=>{const{selectionRows:t,recordsMap:n}=w.current,r=new Map;t.forEach((e=>r.set(E(e,e.index),e)));const l=[];for(let t=0,i=e.length;t<i;t++){const i=r.get(e[t])||n.get(e[t]);i&&l.push(i)}return l})(e))},Me=e=>{const{type:t,checkStrictly:n=!0}=s||{},r=Array.isArray(e)?e:D;let l=[];return w.current.isTreeTable&&!n&&r.forEach((e=>{l.push(...((e,t)=>{var n;const{disabled:r}=s||{},{tableFullData:l,recordsMap:i}=w.current,a=Aa(l,(t=>t._rowKey===e));let o=[];if(!a)return o;let c=da((null==a?void 0:a.children)||[],(e=>e._rowKey));return r&&(c=c.filter((e=>!i.has(e)||!r(i.get(e))))),o=[...new Set([...t,...c])],((null===(n=Pa(l,e))||void 0===n?void 0:n.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Aa(l,(t=>t._rowKey===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))})),l="radio"===t?r.slice(0,1):[...new Set([...r,...l])],l},He=()=>{const{isTreeTable:e,tableFullData:t,recordsMap:n}=w.current;return e?ca(t,(e=>e._rowKey)):Array.from(n.keys())},$e=ci((()=>{null==f||f(O,Ke(L),qe(A),P,{currentDataSource:Ze()})})),qe=e=>{const t={};for(const n in e)null!==e[n]&&(t[n]=e[n]);return t},Ke=e=>{const t={};for(const n in e){if(!n.includes("|"))continue;const[r,l]=n.split("|");t[`${r}|${l}`]=e[n]}return t},je=()=>hn(void 0,void 0,void 0,(function*(){var t;if(!u)return;let n=Nn(u,["fetch"]);if(u.fetch){const{api:e,params:r,dataKey:l}=u.fetch;try{const i=yield e(r);200===i.code&&(n=null!==(t=l?x(i.data,l):i.data)&&void 0!==t?t:{})}catch(e){}}if(Object.keys(n).length){const{isExport:e=1,isImport:t=1,isPrint:r=1}=n;he((n=>Object.assign({},n,{export:!!e,import:!!t,print:!!r})))}if(Array.isArray(n.fieldList)){const t=ra(e.columns,(e=>{const{dataIndex:t}=e,r=n.fieldList.find((e=>e.dataIndex===t));if(r){const{visible:n=1,disabled:l,secretName:i}=r,a=la(w.current.originColumns,t);ue(t,{visible:n,disabled:l,secretName:i}),n||(e.noAuth=!0,a.noAuth=!0),i&&(e.formatType=`secret-${i}`,a.formatType=`secret-${i}`)}}));null==h||h(t)}})),Ve=Yn((()=>hn(void 0,void 0,void 0,(function*(){var e,t,n;if(!o)return;const{formatter:r=(e=>e),beforeFetch:l=bn,afterFetch:i,callback:s}=o;if(!l(F))return;const c=!!(null===(e=null==a?void 0:a.fetch)||void 0===e?void 0:e.api);J(!0);try{const[e,l]=c?yield Promise.all([o.api(r(F)),a.fetch.api(r(F))]):[yield o.api(r(F))];if(w.current.unMounted)return;if(c?200===e.code&&200===l.code:200===e.code){const r=null!==(t=o.dataKey)&&void 0!==t?t:as.dataKey;let a=null!==(n=x(e.data,r))&&void 0!==n?n:[];a="function"==typeof i?yield i(a):a;const c=x(e.data,r.replace(/[^.]+$/,as.totalKey))||a.length||0,d=Math.max(Math.ceil(c/O.pageSize),1);if(F[as.currentPageName]>d)return Te(Object.assign(Object.assign({},O),{current:d}));Ye(Ee.current?w.current.tableFullData.concat(a):a),Ne(c),We((null==l?void 0:l.data)||e.data),null==s||s(e.data,e)}}catch(e){null==b||b(e)}var d,u;d=o,u="stopToFirst",Object.prototype.hasOwnProperty.call(d,u)&&(o.stopToFirst=!1),J(!1),we(!1)})))),ze=ci(Ve),We=e=>{var t,n,r;if(!V)return;const l=null!==(n=null===(t=null==a?void 0:a.fetch)||void 0===t?void 0:t.dataKey)&&void 0!==n?n:as.summationKey,i=null!==(r=l?x(e,l):e)&&void 0!==r?r:{},o={};$.filter((e=>!!e.summation.dataKey)).forEach((e=>{ba(o,e.dataIndex,Number(ya(i,e.summation.dataKey)))})),pe(o)},Be=()=>{const{type:e,selectFirstRowOnChange:t}=s||{};if("radio"===e&&t){const e=Ze();if(e.length){const t=E(e[0],e[0].index);De([t])}else De([])}},Ue=()=>{if(!j)return;const e=Ie();Ee.current||O.current>=e||(we(!0),Te(Object.assign(Object.assign({},O),{current:O.current+1})))},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}=O;return!q||j?e:(t-1)*n+e})(t)),e))),Ye=e=>{const t=Xe(e,(e=>qa(e,_,w.current.isOriginTree)));De(Me()),ae((e=>{const{isTreeTable:t,tableFullData:n,recordsMap:r}=w.current,{defaultExpandAllRows:l,rowExpandable:i,expandedRowRender:a}=c||{};let o=Array.isArray(e)?e:[...M];if(l)o=He();else if(t){a&&Jn("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...D];H&&e.unshift(H),e.forEach((e=>{const t=Pa(n,e)||[];o.push(...t.length>1?t.slice(0,-1).reverse():t)})),o=[...new Set(o)]}return i&&o.filter((e=>{const t=r.get(e);return!!t&&i(t)})),o})()),Be(),null==v||v(t)},Xe=(e,t)=>{const n=Ge(e);return U(n),et((null==t?void 0:t(n))||n),n},Qe=()=>{const{current:e,pageSize:t}=O;return w.current.tableFullData.slice((e-1)*t,e*t)},Ze=()=>K?Qe():w.current.tableFullData,Je=()=>{const{recordsMap:e,isTreeTable:t}=w.current;let n=K?sa(Qe()):Array.from(e.values());n=t?(e=>{const t=new Map,n=[];return e.forEach((e=>{const r=E(e,e.index);if(!e._parentRowKey)return n.push(e),t.set(r,!0);M.includes(e._parentRowKey)&&t.get(e._parentRowKey)&&(n.push(e),t.set(r,!0))})),t.clear(),n})(n):Pe(n),Ae(n),G(n)},et=e=>{B(e),Y(e),Je()},tt=()=>{ne([])},nt=()=>{re({})},rt=()=>{le({})},lt=()=>{De([])};return{initialTable:()=>{je(),ge(),Le(),Ae(),q?Ve():Ye(i)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&Jn("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:et,createWebPageData:Qe,getTableData:Ve,createTableData:Xe,createGroupData:Pe,createAllExpandedKeys:He,setSelectionKeysEffect:De,doFieldValidate:(e,t,n,r,l)=>{if(!Array.isArray(e))return Jn("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(be.removeFromRequired({x:n,y:r}),be.removeFromValidate({x:n,y:r}),e.forEach((e=>{var i;e.required&&Cn(t)&&be.addToRequired({x:n,y:r,text:e.message||l+ye("qm.form.requiredTips")}),"function"!=typeof e.validator||(null===(i=e.validator)||void 0===i?void 0:i.call(e,t))||be.addToValidate({x:n,y:r,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:n,updated:r,removed:l}=be.state,i=T(n,l),a=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:a(e),validate:a(t),inserted:n.filter((e=>!i.includes(e))),updated:r.filter((e=>![...T(r,n),...T(r,l)].includes(e))),removed:l.filter((e=>!i.includes(e)))}},dataChange:()=>{null==g||g(w.current.tableFullData)},tableChange:$e,toLastPage:()=>{const e=Ie();O.current!==e&&Te(Object.assign({},O,{current:e}))},toFirstPage:Re,getPageCount:Ie,pagerChangeHandle:Te,scrollBottomDebouncer:ke,clearTableSorter:()=>{ee({payload:{}})},clearTableFilter:()=>{te({payload:{}})},clearSuperFilters:tt,clearPagerFilter:nt,clearActivedCell:rt,clearRowSelection:lt,clearRowHighlight:()=>{oe("")},clearTableLog:()=>{be.clearAllLog()},destroy:()=>{const{tableManager:e,uid:t}=w.current;ve(),be.destroy(),e.deregister(t)}}},ds=(e,n)=>{const{height:r,minHeight:l,maxHeight:i,ellipsis:a,showHeader:o,spanMethod:s,rowSelection:c}=e,{getRowKey:d,tableRef:u,topElementRef:m,tableElementRef:p,tableBodyRef:h,$size:g,tableColumns:v,flattenColumns:y,leftFixedColumns:b,derivedMergeCells:x,tableFlatData:E,selectionKeys:w,highlightKey:C,layout:S,tableRowHeight:N,showFooter:T,showPagination:I,isFullScreen:R,setLayout:O,setElementStore:k}=n,L=t.useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=S,n={};return l&&Object.assign(n,{minHeight:`${ga(l)}px`}),i&&Object.assign(n,{maxHeight:`${ga(i)}px`}),R?Object.assign(Object.assign({},n),{maxHeight:"",minHeight:"",height:`${e}px`}):r?Object.assign(Object.assign({},n),{height:"auto"!==r?`${ga(r)}px`:`${t}px`}):n}),[r,i,l,R,S]),A=e=>u.current.elementStore.$tableBody.querySelector(`tbody > tr[data-row-key="${e}"]`);return{createElementStore:()=>{k("$toper",m.current),k("$table",p.current)},tableStyles:L,getSpan:(e,t,n,r,l)=>{let i=1,a=1;if("function"==typeof s){const o=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:l});Array.isArray(o)?(i=o[0],a=o[1]):f(o)&&(i=o.rowSpan,a=o.colSpan)}if(x.length>0){const e=x.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,a=e.colSpan)}return{rowSpan:i,colSpan:a}},getStickyLeft:e=>{if(y.findIndex((t=>t.dataIndex===e))<0){const t=la(v,e);e=t?ia(t).dataIndex:""}let t=0;for(let n=0;n<y.length;n++){const r=y[n];if(r.dataIndex===e)break;t+=r.width||r.renderWidth||0}return t},getStickyRight:(e,t)=>{if(y.findIndex((t=>t.dataIndex===e))<0){const t=la(v,e);e=t?aa(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()})(y):y;let r=0;for(let t=n.length-1;t>=0;t--){const l=n[t];if(l.dataIndex===e)break;r+=l.width||l.renderWidth||0}return r},scrollXToColumn:(e,t)=>{const n=void 0===t?y.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const{scrollBarRef:r}=u.current,l=b.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=y.slice(0,n).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);r.current.SET_SCROLL_LEFT(i-l)},scrollYToRecord:(e,t)=>{const{scrollBarRef:n,scrollYLoad:r}=u.current;if(void 0!==t&&t>=0)if(t<E.length)if(r)h.current.scrollToYIndex(t);else{const e=A(d(E[t],E[t].index));e&&n.current.SET_SCROLL_TOP(e.offsetTop)}else n.current.SET_SCROLL_TOP(t*N);else if(r){const t=E.findIndex((t=>e===d(t,t.index)));t>=0&&h.current.scrollToYIndex(t)}else{const t=A(e);t&&n.current.SET_SCROLL_TOP(t.offsetTop)}},calcTableHeight:()=>{if("auto"!==r)return;const{elementStore:e,resizeState:t}=u.current;try{const n=t.winHeight-e.$table.getBoundingClientRect().top-(I?qo["small"!==g?"middle":g]+zo:0)-zo;O((e=>Object.assign({},e,{tableAutoHeight:n})))}catch(e){}},resetTableScroll:()=>{var e;const{scrollBarRef:t}=u.current;null===(e=t.current)||void 0===e||e.SET_SCROLL_TOP(0)},createTableFocus:()=>{C&&h.current.setClickedValues([C,""]),"radio"===(null==c?void 0:c.type)&&w.length&&h.current.setClickedValues([w[0],""])},doLayout:()=>{(()=>{const{elementStore:e,scrollXLoad:t}=u.current,n=e.$table.clientWidth,{defaultColumnWidth:r}=as,l=[];let i=0;if(y.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,i+=e.width):(e.renderWidth=void 0,l.push(e))})),l.length>0){const e=y.reduce(((e,t)=>e+(t.width||t.minWidth||r)),0);if(e<=n){const t=n-e;if(1===l.length)l[0].renderWidth=(l[0].minWidth||r)+t;else{const e=t/l.reduce(((e,t)=>e+(t.minWidth||r)),0);let n=0;l.forEach(((t,l)=>{if(0===l)return;const i=Math.floor((t.minWidth||r)*e);n+=i,t.renderWidth=(t.minWidth||r)+i})),l[0].renderWidth=(l[0].minWidth||r)+t-n}}else l.forEach((e=>{e.renderWidth=e.minWidth||r}));O((t=>Object.assign(Object.assign({},t),{tableBodyWidth:Math.max(e,n)})))}else i=y.reduce(((e,t)=>e+(t.renderWidth=t.width||t.minWidth||r)),0),O((e=>Object.assign(Object.assign({},e),{tableBodyWidth:i})));O((e=>Object.assign(Object.assign({},e),{tableWidth:n}))),t&&h.current.resetItemXSize(y)})(),En((()=>(()=>{const{elementStore:e,scrollYLoad:t,resizeState:n}=u.current;if(!e.$table.offsetParent)return;const r=e.$table.offsetHeight,l=o?e.$header.offsetHeight:0,i=T?e.$footer.offsetHeight:0,a=r-l-i,s=e.$tableBody.offsetHeight;let c=0;if(R){const t=e.$toper?e.$toper.offsetHeight+zo:0,r=e.$pager?e.$pager.offsetHeight+zo:0;c=n.winHeight-t-r-20}O((e=>Object.assign({},e,{headerHeight:l,footerHeight:i,viewportHeight:a,tableBodyHeight:s,tableFullHeight:c})))})()))}}};function us({handler:t,delay:n=0}){const r=Ri(t,n),l=Yn(n>0?r:t);e.useEffect((()=>(window.addEventListener("resize",l),()=>window.removeEventListener("resize",l))),[l])}const ms=e=>{const{total:n}=e,{tableRef:r,prefixCls:l,selectionKeys:i,isHeadSorter:a,isHeadFilter:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:d,clearPagerFilter:u,clearActivedCell:m,clearRowSelection:p,clearRowHighlight:h}=t.useContext(Ko),{infoBarConfig:f,rowSelection:g,rowHighlight:v}=r.current.props,{isTreeTable:y,recordsMap:b,invalidRowKeys:x}=r.current,{hideAlert:E,hideClearButton:w}=f||{},{t:C}=Gn(),[S,N]=t.useState(i.length-x.length);t.useEffect((()=>{En((()=>N(i.length-x.length)))}),[i,x]);const T=t.useMemo((()=>!E),[E]),I=t.useMemo((()=>!w&&!!(a||o||g||v)),[w,a,o,g,v]),R={[`${l}__alert`]:!0};return T?t.createElement("div",{className:Pe(R)},t.createElement("i",{className:"svgicon icon"},t.createElement(Ue,null)),t.createElement("span",null,C("qm.table.alert.total",{total:y?b.size:n}),g?`,${C("qm.table.alert.selected",{total:Math.max(S,0)})}`:""),I&&t.createElement("em",{onClick:()=>{c(),d(),u(),s(),m(),p(),h()}},C("qm.table.alert.clear"))):null},ps=t.forwardRef(((e,n)=>{const{isFullScreen:r,open:l=!0}=e,{prefixCls:i,setFullScreen:a}=t.useContext(Ko),{t:o}=Gn(),s=()=>{a(!r)};return t.useImperativeHandle(n,(()=>({clickHandle:s}))),l?t.createElement("span",{className:`${i}-full-screen`,title:o(r?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},r?t.createElement(Ve,null):t.createElement(ze,null))):null}));ps.displayName="FullScreen";const hs=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,getTableData:i}=t.useContext(Ko),{t:a}=Gn(),o=()=>{i()};return t.useImperativeHandle(n,(()=>({clickHandle:o}))),r?t.createElement("span",{className:`${l}-reload`,title:a("qm.table.refresh.text"),onClick:()=>o()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ge,null))):null}));hs.displayName="Reload";const fs=()=>{const e={dateFormat:e=>{const t=e?p(e).format(Uo):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?p(e).format(Go):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?p(e).format(Go.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Ea(e)?(100*Number(e)).toFixed(2)+"%":e,financeFormat:e=>wa(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 l,i,a,o;const{dictItems:s,precision:c,displayPrecision:d,formatType:u,editRender:m}=n,p=s||(null===(l=null==m?void 0:m(r,n))||void 0===l?void 0:l.items)||[];let h=null!==(o=null!==(a=null===(i=p.find((e=>e.value==t)))||void 0===i?void 0:i.text)&&void 0!==a?a:t)&&void 0!==o?o:"";if(Array.isArray(t)&&(h=t.map((e=>{var t,n;return null!==(n=null===(t=p.find((t=>t.value==e)))||void 0===t?void 0:t.text)&&void 0!==n?n:e})).join(",")),c>=0&&""!==h&&(h=Ea(h)?new Xt(h).toFixed(c):h),d>=0&&""!==h&&(h=Ca(h,d)),u){const t=e[`${wn(u)}Format`];t?h=t(h):Jn("Table","字段的格式化类型 `formatType` 配置不正确")}return h},n=e=>Ia(e);return{renderText:t,getTitleFromCellNode:n,getTitleFromCellValue:(e,r,l,i)=>{const a=ya(e,r.dataIndex),o=r.render?r.render(a,e,r,l,i):t(a,r,e);return n(o)}}},gs=t.forwardRef(((e,n)=>{var r,l,i,a;const{tableColumns:o,open:s=!0}=e,{global:c}=t.useContext(on),{tableRef:d,prefixCls:u,flattenColumns:m,summationRows:p,showSummary:h,createGroupData:f,getSpan:g}=t.useContext(Ko),{tablePrint:v,showHeader:y}=d.current.props,{t:b}=Gn(),{getTitleFromCellValue:x}=fs(),E=null!==(l=null===(r=null==c?void 0:c.print)||void 0===r?void 0:r.leftLogo)&&void 0!==l?l:"",w=null!==(a=null===(i=null==c?void 0:c.print)||void 0===i?void 0:i.rightLogo)&&void 0!==a?a:"",C=!(!E&&!w),S=t.useMemo((()=>Tn(oa(o,[as.expandableColumn,as.selectionColumn,as.operationColumn]))),[o]),N=t.useMemo((()=>Tn(oa(m,[as.expandableColumn,as.selectionColumn,as.operationColumn]))),[m]),T=t.useMemo((()=>Tn(o.filter((e=>e.printFixed)))),[o]),A=e=>{const t=Object.assign({},La(S,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?A(t):t},P=(e,t)=>I(R(O(e),t),k(((...e)=>L(...e,((e,n)=>{if(Array.isArray(e))return P(e.concat(n),t)}))))),_=e=>{const t=[];return e.forEach((e=>{let n=[];e.forEach((e=>{1===e.level?n.push(e):n.push(A(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]:P(n,"dataIndex")[0]})))(n),t.push(ua(n))})),t},F=()=>{const e=(e=>{const t=[];let n=[],r=0,l=0;for(;l<e.length;){const i=e[l],a=m.find((e=>e.dataIndex===i.dataIndex));i.width=a.width||a.renderWidth||as.defaultColumnWidth,r+=i.width||i.renderWidth,r<=as.printWidth?(n.push(i),l===e.length-1&&t.push(n),l++):l>0?(e.splice(0,l),T.length&&e.unshift(...T),t.push(n),n=[],r=0,l=0):(i.width=as.printWidth,n.push(i),t.push(n),l++)}return t})([...N]),t=_(e);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n </style>","</head>","<body>"].join("");const{isTreeTable:r,tableFullData:l}=d.current;for(let i=0;i<e.length;i++)n+=D(t[i],e[i],r?l:f(l)),n+='<div class="page-break"></div>';return n+"</body></html>"},D=(e,t,n)=>{const{showLogo:r=!0}=v;let l='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${t.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,y&&(l+=["<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">',E?`<img src="${E}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',w?`<img src="${w}" 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}">${Ia(e.title)}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),n.length&&(l+=`<tbody>${sa(n).map((e=>`<tr>${t.map(((t,r)=>{const{rowSpan:l,colSpan:i}=g(e,t,e.index,r,n);if(!l||!i)return null;const{dataIndex:a,outputRender:o}=t;return`<td rowspan="${l}" colspan="${i}">${0===r&&e._level?`<span style="padding-left:${e._level*as.treeTable.textIndent}px"></span>`:""}${o?o(ya(e,a),e,t,e.index,r):x(e,t,e.index,r)}</td>`})).join("")}</tr>`)).join("")}</tbody>`),h&&p.length&&(l+=["<tfoot>",p.map((e=>`<tr>${t.map(((t,r)=>{const{dataIndex:l,summation:i}=t,a=(null==i?void 0:i.render)?i.render(n):ya(e,`${l}_text`);return`<td>${0===r&&""===a?b("qm.table.config.summaryText"):gn(a)?Ia(a):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l},M=()=>{var e;null===(e=((e,t)=>{const{filename:n,type:r,isDownload:l}=e,i=`${n}.${r}`;if(window.Blob){const e=new Blob([t],{type:`text/${r}`});if(!l)return Promise.resolve({type:r,content:t,blob:e});wi(e,i)}})({filename:"print",type:"html",isDownload:!1},F()))||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:M}))),s?t.createElement("span",{className:`${u}-print`,title:b("qm.table.print.text"),onClick:()=>M()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ye,null))):null}));gs.displayName="TablePrint";const vs="606060",ys="thin",bs="d4d4d4",xs=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Es=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},ws=()=>({top:{style:ys,color:{argb:bs}},left:{style:ys,color:{argb:bs}},bottom:{style:ys,color:{argb:bs}},right:{style:ys,color:{argb:bs}}}),Cs=e=>{const{children:t}=e;return t&&t.length?Cs(t[0]):e},Ss=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},Ns=()=>{const{tableRef:e,tableRowHeight:n,getSpan:r,showSummary:l,isHeadGroup:i}=t.useContext(Ko),{spanMethod:a,showHeader:o}=e.current.props,{t:s}=Gn(),c=(e,t)=>{var n,r,l;return null!==(l=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==l?l:""};return{exportXLSX:(e,t,c,d)=>hn(void 0,void 0,void 0,(function*(){const{columns:u,footSummation:m}=e,p=Ji(u),h=ua(u),f=[],g=[],v=[],y=[];let b=0;const x={};p.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;x[t]=Ia(e.title),v.push({key:t,width:(n||r||as.defaultColumnWidth)/8})})),o&&(i?h.forEach(((e,t)=>{const n={};e.forEach((e=>{const{colSpan:r,rowSpan:l}=e,i=Cs(e),a=p.findIndex((({dataIndex:e})=>e===i.dataIndex));n[i.dataIndex]=Ia(e.title),0!==r&&(r>1||l>1)&&y.push({s:{r:t,c:a},e:{r:t+l-1,c:a+r-1}})})),f.push(n)})):(p.forEach(((e,t)=>{const{colSpan:n,rowSpan:r}=e;(n>1||r>1)&&y.push({s:{r:b,c:t},e:{r:b+r-1,c:t+n-1}})})),f.push(x)),b+=f.length);const E=sa(t).map(((e,n)=>{const l={};return p.forEach(((i,o)=>{if("function"==typeof a){const{rowSpan:l,colSpan:a}=r(e,i,n,o,t);(a>1||l>1)&&y.push({s:{r:n+b,c:o},e:{r:n+b+l-1,c:o+a-1}})}const s=["percent","finance"].includes(i.formatType);l[i.dataIndex]=s?ya(e,i.dataIndex):d(e,n,i,o)})),l._level=e._level,l}));b+=E.length,l&&m&&c(p,t).forEach(((e,n)=>{const r={};p.forEach(((n,l)=>{const{dataIndex:i,summation:a}=n,o=(null==a?void 0:a.render)?a.render(t):ya(e,i);r[i]=0===l&&""===o?s("qm.table.config.summaryText"):gn(o)?Ia(o):o})),g.push(r)}));const{sheetName:w,useStyle:C}=e,S=new Qt.Workbook,N=S.addWorksheet(w);N.columns=v,o&&N.addRows(f).forEach((e=>{C&&xs(e,n),e.eachCell((e=>{const t=N.getColumn(e.col),n=la(u,t.key),{align:r,theadAlign:l}=n;Es(e,l||r),C&&Object.assign(e,{font:{bold:!0,color:{argb:vs}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:ws()})}))})),N.addRows(E).forEach(((e,t)=>{const{_level:r}=E[t];C&&xs(e,n),e.eachCell((e=>{const t=N.getColumn(e.col),n=la(u,t.key),{align:l}=n;Es(e,l),Object.assign(e,Ss(n)),C&&Object.assign(e,{font:{color:{argb:vs}},border:ws()}),1===Number(e.col)&&r&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:r}))}))})),l&&m&&N.addRows(g).forEach((e=>{C&&xs(e,n),e.eachCell((e=>{const t=N.getColumn(e.col),n=la(u,t.key),{align:r}=n;Es(e,r),Object.assign(e,Ss(n)),C&&Object.assign(e,{font:{color:{argb:vs}},border:ws()})}))})),y.forEach((({s:e,e:t})=>{N.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const T=yield S.xlsx.writeBuffer();return new Blob([T],{type:"application/octet-stream"})})),exportCSV:(e,t)=>{const n="\ufeff"+(e=>Array.from(e.rows).map((e=>Array.from(e.cells).map((e=>{var t,n;return((e,t)=>{const n=e.replace(/"/g,'""');return"string"===t?`"=""${n}"""`:"number"===t?n:n.includes(",")||n.includes("\r")||n.includes("\n")?`"${n}"`:n})(null!==(n=null===(t=e.textContent)||void 0===t?void 0:t.trim())&&void 0!==n?n:"",e.getAttribute("data-type"))})).join(","))).join("\r\n"))((e=>{const t=document.createElement("div");t.innerHTML=e.trim();const n=t.querySelector("table");if(!n)throw new Error("Invalid table HTML input.");return n})(t));return new Blob([n],{type:"text/csv;charset=utf-8"})},importXLSX:(e,t)=>{const{columns:n,file:r}=e,l=Ji(n),i=new FileReader;i.onerror=()=>{ne.error(s("qm.table.import.error"))},i.onload=e=>{const n=l.map((e=>Ia(e.title))),r=new Qt.Workbook,i=e.target;i?r.xlsx.load(i.result).then((e=>{const r=e.worksheets[0];if(r){const e=r.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),a=e[i],o=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(n,a);if(o){const r=e.slice(i+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let l=e;Array.isArray(null==l?void 0:l.richText)&&(l=l.richText.map((e=>e.text)).join("")),f(l)&&"text"in l&&(l=l.text),A(l)&&(l=Na(l,Go)),(null==l?void 0:l.formula)&&(l=null!==(r=l.result)&&void 0!==r?r:l.value),t[a[n]]=l}));const r={};return n.forEach(((e,n)=>{var i;const{dataIndex:a,dictItems:o}=l[n];Array.isArray(o)&&((null===(i=t[e])||void 0===i?void 0:i.toString().includes(","))?t[e]=t[e].split(",").map((e=>c(o,e))).filter((e=>""!==e)):t[e]=c(o,t[e])),ba(r,a,t[e])})),r}));null==t||t(r)}else ne.error(s("qm.table.import.error"))}else ne.error(s("qm.table.import.error"))})):ne.error(s("qm.table.import.error"))},i.readAsArrayBuffer(r)}}},Ts=e=>{const{fileType:n,onChange:r}=e,{prefixCls:l}=t.useContext(Ko),{t:i}=Gn();let a,o;const s=e=>{const t=e.name,n=t.lastIndexOf("."),r=t.substring(n+1,t.length);return{filename:t.substring(0,n),type:r}},c=()=>hn(void 0,void 0,void 0,(function*(){try{const e=yield(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),o=document.createElement("input"),a.className=`${l}--file-form`,o.name="file",o.type="file",a.appendChild(o),document.body.appendChild(a)),new Promise(((e,n)=>{const r=!t.type;o.multiple=!!t.multiple,o.accept=r?"":`.${t.type}`,o.onchange=l=>{const{files:c}=l.target,d=c[0];let u="";if(!r)for(let e=0;e<c.length;e++){const{type:n}=s(c[e]);if(t.type!==n){u=n;break}}u?(ne.warning(i("qm.upload.notType",{type:u})),n()):e(d),document.body.removeChild(a),a=null,o=null},a.reset(),o.click()}))})({type:n});null==r||r(e.name,e)}catch(e){}}));return t.createElement(er,{onClick:()=>c()},i("qm.upload.text"))},Is=e=>{const{columns:n,onClose:r}=e,{tableRef:l,prefixCls:i,createTableData:a,dataChange:o}=t.useContext(Ko),{beforeTableImport:s}=l.current.props,{t:c}=Gn(),{importXLSX:d}=Ns(),u=t.useRef(null),[m,p]=t.useState(!1),[h,f]=t.useState(!0),g=e=>e.filter((e=>![as.expandableColumn,as.selectionColumn,"index","pageIndex",as.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(Ts,{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:l.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:`${i}-import__setting`},t.createElement(Vh,{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(er,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(er,{type:"primary",loading:m,disabled:h,onClick:()=>hn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||(p(!0),d({columns:g(n),file:t.file},(e=>hn(void 0,void 0,void 0,(function*(){const{tableFullData:n,store:i}=l.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof s)try{e=yield s(e)}catch(e){}if("fill"===t.importType&&a(e),"add"===t.importType&&a([...n,...e]),"insert"===t.importType){const r=t.posIndex,l=n.slice(0,r).concat(e).concat(n.slice(r));a(l)}e.forEach((e=>{i.addToInserted(e)})),o(),ne.success(c("qm.table.import.success",{total:e.length})),p(!1),r()})))))}))},c("qm.table.import.text"))))},Rs=t.forwardRef(((e,n)=>{const{tableColumns:r,open:l=!0}=e,{prefixCls:i}=t.useContext(Ko),{t:a}=Gn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={[`${i}-import`]:!0},u={visible:o,title:a("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:Pe(d),title:a("qm.table.import.textNoSpace"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(Xe,null))),t.createElement(Mi,u,t.createElement(Is,{columns:r,onClose:()=>s(!1)})))}));function Os(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 ks(e,t,n,r){var l=Mt.unstable_batchedUpdates?function(e){Mt.unstable_batchedUpdates(n,e)}:n;return null!=e&&e.addEventListener&&e.addEventListener(t,l,r),{remove:function(){null!=e&&e.removeEventListener&&e.removeEventListener(t,l,r)}}}Rs.displayName="TableImport";var Ls=u((function(e,t){var n=e.didUpdate,r=e.getContainer,l=e.children,a=i(),s=i();m(t,(function(){return{}}));var c=i(!1);return!c.current&&Br()&&(s.current=r(),a.current=s.current.parentNode,c.current=!0),o((function(){null==n||n(e)})),o((function(){return null===s.current.parentNode&&null!==a.current&&a.current.appendChild(s.current),function(){var e;null===(e=s.current)||void 0===e||null===(e=e.parentNode)||void 0===e||e.removeChild(s.current)}}),[]),s.current?Mt.createPortal(l,s.current):null}));function As(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var Ps;function _s(e){var t=e.prefixCls,n=e.motion,r=e.animation,l=e.transitionName;return n||(r?{motionName:"".concat(t,"-").concat(r)}:l?{motionName:l}:null)}function Fs(t){var n=t.prefixCls,r=t.visible,l=t.zIndex,i=t.mask,a=t.maskMotion,o=t.maskAnimation,s=t.maskTransitionName;if(!i)return null;var c={};return(a||s||o)&&(c=pr({motionAppear:!0},_s({motion:a,prefixCls:n,transitionName:s,animation:o}))),e.createElement(wl,Cl({},c,{visible:r,removeOnLeave:!0}),(function(t){var r=t.className;return e.createElement("div",{style:{zIndex:l},className:Pe("".concat(n,"-mask"),r)})}))}function Ds(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 Ms(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ds(Object(n),!0).forEach((function(t){$s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ds(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hs(e){return Hs="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},Hs(e)}function $s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qs={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function Ks(){if(void 0!==Ps)return Ps;Ps="";var e=document.createElement("p").style;for(var t in qs)t+"Transform"in e&&(Ps=t);return Ps}function js(){return Ks()?"".concat(Ks(),"TransitionProperty"):"transitionProperty"}function Vs(){return Ks()?"".concat(Ks(),"Transform"):"transform"}function zs(e,t){var n=js();n&&(e.style[n]=t,"transitionProperty"!==n&&(e.style.transitionProperty=t))}function Ws(e,t){var n=Vs();n&&(e.style[n]=t,"transform"!==n&&(e.style.transform=t))}var Bs,Us=/matrix\((.*)\)/,Gs=/matrix3d\((.*)\)/;function Ys(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function Xs(e,t,n){var r=n;if("object"!==Hs(t))return void 0!==r?("number"==typeof r&&(r="".concat(r,"px")),void(e.style[t]=r)):Bs(e,t);for(var l in t)t.hasOwnProperty(l)&&Xs(e,l,t[l])}function Qs(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!=typeof n){var l=e.document;"number"!=typeof(n=l.documentElement[r])&&(n=l.body[r])}return n}function Zs(e){return Qs(e)}function Js(e){return Qs(e,!0)}function ec(e){var t=function(e){var t,n,r,l=e.ownerDocument,i=l.body,a=l&&l.documentElement;return t=e.getBoundingClientRect(),n=Math.floor(t.left),r=Math.floor(t.top),{left:n-=a.clientLeft||i.clientLeft||0,top:r-=a.clientTop||i.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=Zs(r),t.top+=Js(r),t}function tc(e){return null!=e&&e==e.window}function nc(e){return tc(e)?e.document:9===e.nodeType?e:e.ownerDocument}var rc=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),lc=/^(top|right|bottom|left)$/,ic="currentStyle",ac="runtimeStyle",oc="left";function sc(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function cc(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function dc(e,t,n){"static"===Xs(e,"position")&&(e.style.position="relative");var r=-999,l=-999,i=sc("left",n),a=sc("top",n),o=cc(i),s=cc(a);"left"!==i&&(r=999),"top"!==a&&(l=999);var c,d="",u=ec(e);("left"in t||"top"in t)&&(d=(c=e).style.transitionProperty||c.style[js()]||"",zs(e,"none")),"left"in t&&(e.style[o]="",e.style[i]="".concat(r,"px")),"top"in t&&(e.style[s]="",e.style[a]="".concat(l,"px")),Ys(e);var m=ec(e),p={};for(var h in t)if(t.hasOwnProperty(h)){var f=sc(h,n),g="left"===h?r:l,v=u[h]-m[h];p[f]=f===h?g+v:g-v}Xs(e,p),Ys(e),("left"in t||"top"in t)&&zs(e,d);var y={};for(var b in t)if(t.hasOwnProperty(b)){var x=sc(b,n),E=t[b]-u[b];y[x]=b===x?p[x]+E:p[x]-E}Xs(e,y)}function uc(e,t){var n=ec(e),r=function(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("transform")||t.getPropertyValue(Vs());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),l={x:r.x,y:r.y};"left"in t&&(l.x=r.x+t.left-n.left),"top"in t&&(l.y=r.y+t.top-n.top),function(e,t){var n=window.getComputedStyle(e,null),r=n.getPropertyValue("transform")||n.getPropertyValue(Vs());if(r&&"none"!==r){var l,i=r.match(Us);i?((l=(i=i[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,l[5]=t.y,Ws(e,"matrix(".concat(l.join(","),")"))):((l=r.match(Gs)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,l[13]=t.y,Ws(e,"matrix3d(".concat(l.join(","),")")))}else Ws(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,l)}function mc(e,t){for(var n=0;n<e.length;n++)t(e[n])}function pc(e){return"border-box"===Bs(e,"boxSizing")}"undefined"!=typeof window&&(Bs=window.getComputedStyle?function(e,t,n){var r=n,l="",i=nc(e);return(r=r||i.defaultView.getComputedStyle(e,null))&&(l=r.getPropertyValue(t)||r[t]),l}:function(e,t){var n=e[ic]&&e[ic][t];if(rc.test(n)&&!lc.test(t)){var r=e.style,l=r[oc],i=e[ac][oc];e[ac][oc]=e[ic][oc],r[oc]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[oc]=l,e[ac][oc]=i}return""===n?"auto":n});var hc=["margin","border","padding"],fc=-1,gc=2,vc=1;function yc(e,t,n){var r,l,i,a=0;for(l=0;l<t.length;l++)if(r=t[l])for(i=0;i<n.length;i++){var o=void 0;o="border"===r?"".concat(r).concat(n[i],"Width"):r+n[i],a+=parseFloat(Bs(e,o))||0}return a}var bc={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 xc(e,t,n){var r=n;if(tc(e))return"width"===t?bc.viewportWidth(e):bc.viewportHeight(e);if(9===e.nodeType)return"width"===t?bc.docWidth(e):bc.docHeight(e);var l="width"===t?["Left","Right"]:["Top","Bottom"],i="width"===t?Math.floor(e.getBoundingClientRect().width):Math.floor(e.getBoundingClientRect().height),a=pc(e),o=0;(null==i||i<=0)&&(i=void 0,(null==(o=Bs(e,t))||Number(o)<0)&&(o=e.style[t]||0),o=Math.floor(parseFloat(o))||0),void 0===r&&(r=a?vc:fc);var s=void 0!==i||a,c=i||o;return r===fc?s?c-yc(e,["border","padding"],l):o:s?r===vc?c:c+(r===gc?-yc(e,["border"],l):yc(e,["margin"],l)):o+yc(e,hc.slice(r),l)}mc(["Width","Height"],(function(e){bc["doc".concat(e)]=function(t){var n=t.document;return Math.max(n.documentElement["scroll".concat(e)],n.body["scroll".concat(e)],bc["viewport".concat(e)](n))},bc["viewport".concat(e)]=function(t){var n="client".concat(e),r=t.document,l=r.body,i=r.documentElement[n];return"CSS1Compat"===r.compatMode&&i||l&&l[n]||i}}));var Ec={position:"absolute",visibility:"hidden",display:"block"};function wc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,l=t[0];return 0!==l.offsetWidth?r=xc.apply(void 0,t):function(e,t,n){var r,l={},i=e.style;for(r in t)t.hasOwnProperty(r)&&(l[r]=i[r],i[r]=t[r]);for(r in n.call(e),t)t.hasOwnProperty(r)&&(i[r]=l[r])}(l,Ec,(function(){r=xc.apply(void 0,t)})),r}function Cc(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}mc(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);bc["outer".concat(t)]=function(t,n){return t&&wc(t,e,n?0:vc)};var n="width"===e?["Left","Right"]:["Top","Bottom"];bc[e]=function(t,r){var l=r;return void 0!==l?t?(pc(t)&&(l+=yc(t,["padding","border"],n)),Xs(t,e,l)):void 0:t&&wc(t,e,fc)}}));var Sc={getWindow:function(e){if(e&&e.document&&e.setTimeout)return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},getDocument:nc,offset:function(e,t,n){if(void 0===t)return ec(e);!function(e,t,n){if(n.ignoreShake){var r=ec(e),l=r.left.toFixed(0),i=r.top.toFixed(0),a=t.left.toFixed(0),o=t.top.toFixed(0);if(l===a&&i===o)return}n.useCssRight||n.useCssBottom?dc(e,t,n):n.useCssTransform&&Vs()in document.body.style?uc(e,t):dc(e,t,n)}(e,t,n||{})},isWindow:tc,each:mc,css:Xs,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:Cc,getWindowScrollLeft:function(e){return Zs(e)},getWindowScrollTop:function(e){return Js(e)},merge:function(){for(var e={},t=0;t<arguments.length;t++)Sc.mix(e,t<0||arguments.length<=t?void 0:arguments[t]);return e},viewportWidth:0,viewportHeight:0};Cc(Sc,bc);var Nc=Sc.getParent;function Tc(e){if(Sc.isWindow(e)||9===e.nodeType)return null;var t,n=Sc.getDocument(e).body,r=Sc.css(e,"position");if(!("fixed"===r||"absolute"===r))return"html"===e.nodeName.toLowerCase()?null:Nc(e);for(t=Nc(e);t&&t!==n&&9!==t.nodeType;t=Nc(t))if("static"!==(r=Sc.css(t,"position")))return t;return null}var Ic=Sc.getParent;function Rc(e,t){for(var n={left:0,right:1/0,top:0,bottom:1/0},r=Tc(e),l=Sc.getDocument(e),i=l.defaultView||l.parentWindow,a=l.body,o=l.documentElement;r;){if(-1!==navigator.userAgent.indexOf("MSIE")&&0===r.clientWidth||r===a||r===o||"visible"===Sc.css(r,"overflow")){if(r===a||r===o)break}else{var s=Sc.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=Tc(r)}var c=null;Sc.isWindow(e)||9===e.nodeType||(c=e.style.position,"absolute"===Sc.css(e,"position")&&(e.style.position="fixed"));var d=Sc.getWindowScrollLeft(i),u=Sc.getWindowScrollTop(i),m=Sc.viewportWidth(i),p=Sc.viewportHeight(i),h=o.scrollWidth,f=o.scrollHeight,g=window.getComputedStyle(a);if("hidden"===g.overflowX&&(h=i.innerWidth),"hidden"===g.overflowY&&(f=i.innerHeight),e.style&&(e.style.position=c),t||function(e){if(Sc.isWindow(e)||9===e.nodeType)return!1;var t=Sc.getDocument(e),n=t.body,r=null;for(r=Ic(e);r&&r!==n&&r!==t;r=Ic(r))if("fixed"===Sc.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+m),n.bottom=Math.min(n.bottom,u+p);else{var v=Math.max(h,d+m);n.right=Math.min(n.right,v);var y=Math.max(f,u+p);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 Oc(e){var t,n,r;if(Sc.isWindow(e)||9===e.nodeType){var l=Sc.getWindow(e);t={left:Sc.getWindowScrollLeft(l),top:Sc.getWindowScrollTop(l)},n=Sc.viewportWidth(l),r=Sc.viewportHeight(l)}else t=Sc.offset(e),n=Sc.outerWidth(e),r=Sc.outerHeight(e);return t.width=n,t.height=r,t}function kc(e,t){var n=t.charAt(0),r=t.charAt(1),l=e.width,i=e.height,a=e.left,o=e.top;return"c"===n?o+=i/2:"b"===n&&(o+=i),"c"===r?a+=l/2:"r"===r&&(a+=l),{left:a,top:o}}function Lc(e,t,n,r,l){var i=kc(t,n[1]),a=kc(e,n[0]),o=[a.left-i.left,a.top-i.top];return{left:Math.round(e.left-o[0]+r[0]-l[0]),top:Math.round(e.top-o[1]+r[1]-l[1])}}function Ac(e,t,n){return e.left<n.left||e.left+t.width>n.right}function Pc(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function _c(e,t,n){var r=[];return Sc.each(e,(function(e){r.push(e.replace(t,(function(e){return n[e]})))})),r}function Fc(e,t){return e[t]=-e[t],e}function Dc(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function Mc(e,t){e[0]=Dc(e[0],t.width),e[1]=Dc(e[1],t.height)}function Hc(e,t,n,r){var l=n.points,i=n.offset||[0,0],a=n.targetOffset||[0,0],o=n.overflow,s=n.source||e;i=[].concat(i),a=[].concat(a);var c={},d=0,u=Rc(s,!(!(o=o||{})||!o.alwaysByViewport)),m=Oc(s);Mc(i,m),Mc(a,t);var p=Lc(m,t,l,i,a),h=Sc.merge(m,p);if(u&&(o.adjustX||o.adjustY)&&r){if(o.adjustX&&Ac(p,m,u)){var f=_c(l,/[lr]/gi,{l:"r",r:"l"}),g=Fc(i,0),v=Fc(a,0);(function(e,t,n){return e.left>n.right||e.left+t.width<n.left})(Lc(m,t,f,g,v),m,u)||(d=1,l=f,i=g,a=v)}if(o.adjustY&&Pc(p,m,u)){var y=_c(l,/[tb]/gi,{t:"b",b:"t"}),b=Fc(i,1),x=Fc(a,1);(function(e,t,n){return e.top>n.bottom||e.top+t.height<n.top})(Lc(m,t,y,b,x),m,u)||(d=1,l=y,i=b,a=x)}d&&(p=Lc(m,t,l,i,a),Sc.mix(h,p));var E=Ac(p,m,u),w=Pc(p,m,u);if(E||w){var C=l;E&&(C=_c(l,/[lr]/gi,{l:"r",r:"l"})),w&&(C=_c(l,/[tb]/gi,{t:"b",b:"t"})),l=C,i=n.offset||[0,0],a=n.targetOffset||[0,0]}c.adjustX=o.adjustX&&E,c.adjustY=o.adjustY&&w,(c.adjustX||c.adjustY)&&(h=function(e,t,n,r){var l=Sc.clone(e),i={width:t.width,height:t.height};return r.adjustX&&l.left<n.left&&(l.left=n.left),r.resizeWidth&&l.left>=n.left&&l.left+i.width>n.right&&(i.width-=l.left+i.width-n.right),r.adjustX&&l.left+i.width>n.right&&(l.left=Math.max(n.right-i.width,n.left)),r.adjustY&&l.top<n.top&&(l.top=n.top),r.resizeHeight&&l.top>=n.top&&l.top+i.height>n.bottom&&(i.height-=l.top+i.height-n.bottom),r.adjustY&&l.top+i.height>n.bottom&&(l.top=Math.max(n.bottom-i.height,n.top)),Sc.mix(l,i)}(p,m,u,c))}return h.width!==m.width&&Sc.css(s,"width",Sc.width(s)+h.width-m.width),h.height!==m.height&&Sc.css(s,"height",Sc.height(s)+h.height-m.height),Sc.offset(s,{left:h.left,top:h.top},{useCssRight:n.useCssRight,useCssBottom:n.useCssBottom,useCssTransform:n.useCssTransform,ignoreShake:n.ignoreShake}),{points:l,offset:i,targetOffset:a,overflow:c}}function $c(e,t,n){var r=n.target||t,l=Oc(r),i=!function(e,t){var n=Rc(e,t),r=Oc(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 Hc(e,l,n,i)}$c.__getOffsetParent=Tc,$c.__getVisibleRectForElement=Rc;var qc=Br()?e.useLayoutEffect:e.useEffect,Kc=function(t,n){var r=e.useRef(!0);qc((function(){return t(r.current)}),n),qc((function(){return r.current=!1,function(){r.current=!0}}),[])};function jc(e,t){var n=null,r=null;var l=new qt((function(e){var l=fr(e,1)[0].target;if(document.documentElement.contains(l)){var i=l.getBoundingClientRect(),a=i.width,o=i.height,s=Math.floor(a),c=Math.floor(o);n===s&&r===c||Promise.resolve().then((function(){t({width:s,height:c})})),n=s,r=c}}));return e&&l.observe(e),function(){l.disconnect()}}function Vc(e){return"function"!=typeof e?null:e()}function zc(e){return"object"===cr(e)&&e?e:null}var Wc=function(e,n){var r=e.children,l=e.disabled,i=e.target,a=e.align,o=e.onAlign,s=e.monitorWindowResize,c=e.monitorBufferTime,d=void 0===c?0:c,u=t.useRef({}),m=t.useRef(),p=t.Children.only(r),h=t.useRef({});h.current.disabled=l,h.current.target=i,h.current.align=a,h.current.onAlign=o;var f=function(e,n){var r=t.useRef(!1),l=t.useRef(null);function i(){window.clearTimeout(l.current)}return[function t(a){if(i(),r.current&&!0!==a)l.current=window.setTimeout((function(){r.current=!1,t()}),n);else{if(!1===e(a))return;r.current=!0,l.current=window.setTimeout((function(){r.current=!1}),n)}},function(){r.current=!1,i()}]}((function(){var e=h.current,t=e.disabled,n=e.target,r=e.align,l=e.onAlign,i=m.current;if(!t&&n&&i){var a,o=Vc(n),s=zc(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 l=e.getBoundingClientRect(),i=l.width,a=l.height;if(i||a)return!0}}return!1}(o)?a=$c(i,o,r):s&&(a=function(e,t,n){var r,l,i=Sc.getDocument(e),a=i.defaultView||i.parentWindow,o=Sc.getWindowScrollLeft(a),s=Sc.getWindowScrollTop(a),c=Sc.viewportWidth(a),d=Sc.viewportHeight(a),u={left:r="pageX"in t?t.pageX:o+t.clientX,top:l="pageY"in t?t.pageY:s+t.clientY,width:0,height:0},m=r>=0&&r<=o+c&&l>=0&&l<=s+d,p=[n.points[0],"cc"];return Hc(e,u,Ms(Ms({},n),{},{points:p}),m)}(i,s,r)),function(e,t){e!==document.activeElement&&Os(t,e)&&"function"==typeof e.focus&&e.focus()}(c,i),l&&a&&l(i,a),!0}return!1}),d),g=fr(f,2),v=g[0],y=g[1],b=fr(t.useState(),2),x=b[0],E=b[1],w=fr(t.useState(),2),C=w[0],S=w[1];return Kc((function(){E(Vc(i)),S(zc(i))})),t.useEffect((function(){var e,t;u.current.element===x&&((e=u.current.point)===(t=C)||e&&t&&("pageX"in t&&"pageY"in t?e.pageX===t.pageX&&e.pageY===t.pageY:"clientX"in t&&"clientY"in t&&e.clientX===t.clientX&&e.clientY===t.clientY))&&function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new Set;return function e(t,l){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=r.has(t);if(_n(!a,"Warning: There may be circular references"),a)return!1;if(t===l)return!0;if(n&&i>1)return!1;r.add(t);var o=i+1;if(Array.isArray(t)){if(!Array.isArray(l)||t.length!==l.length)return!1;for(var s=0;s<t.length;s++)if(!e(t[s],l[s],o))return!1;return!0}if(t&&l&&"object"===cr(t)&&"object"===cr(l)){var c=Object.keys(t);return c.length===Object.keys(l).length&&c.every((function(n){return e(t[n],l[n],o)}))}return!1}(e,t)}(u.current.align,a)||v()})),t.useEffect((function(){return jc(m.current,v)}),[m.current]),t.useEffect((function(){return jc(x,v)}),[x]),t.useEffect((function(){l?y():v()}),[l]),t.useEffect((function(){if(s)return ks(window,"resize",v).remove}),[s]),t.useEffect((function(){return function(){y()}}),[]),t.useImperativeHandle(n,(function(){return{forceAlign:function(){return v(!0)}}})),t.isValidElement(p)&&(p=t.cloneElement(p,{ref:wr(p.ref,m)})),p},Bc=t.forwardRef(Wc);function Uc(){Uc=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},i=l.iterator||"@@iterator",a=l.asyncIterator||"@@asyncIterator",o=l.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,l){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),o=new N(l||[]);return r(a,"_invoke",{value:E(e,n,o)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function m(){}function p(){}function h(){}var f={};s(f,i,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&n.call(v,i)&&(f=v);var y=h.prototype=m.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 l(r,i,a,o){var s=d(e[r],e,i);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==cr(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){l("next",e,a,o)}),(function(e){l("throw",e,a,o)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return l("throw",e,a,o)}))}o(s.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){l(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(l,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===l)throw i;return I()}for(n.method=l,n.arg=i;;){var a=n.delegate;if(a){var o=w(a,n);if(o){if(o===u)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),u;var l=d(r,e.iterator,t.arg);if("throw"===l.type)return t.method="throw",t.arg=l.arg,t.delegate=null,u;var i=l.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,l=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 l.next=l}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=h,r(y,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:p,configurable:!0}),p.displayName=s(h,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,l,i){void 0===i&&(i=Promise);var a=new x(c(t,n,r,l),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(y),s(y,o,"Generator"),s(y,i,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var l=this.tryEntries.length-1;l>=0;--l){var i=this.tryEntries[l],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var l=this.tryEntries[r];if(l.tryLoc<=this.prev&&n.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var i=l;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var l=r.arg;S(n)}return l}}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 Gc(e,t,n,r,l,i,a){try{var o=e[i](a),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,l)}function Yc(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var i=e.apply(t,n);function a(e){Gc(i,r,l,a,o,"next",e)}function o(e){Gc(i,r,l,a,o,"throw",e)}a(void 0)}))}}Bc.displayName="Align";var Xc=["measure","alignPre","align",null,"motion"],Qc=e.forwardRef((function(t,n){var r=t.visible,l=t.prefixCls,a=t.className,c=t.style,d=t.children,u=t.zIndex,m=t.stretch,p=t.destroyPopupOnHide,h=t.forceRender,f=t.align,g=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,E=t.onMouseLeave,w=t.onMouseDown,C=t.onTouchStart,S=t.onClick,N=i(),T=i(),I=fr(s(),2),R=I[0],O=I[1],k=function(t){var n=fr(e.useState({width:0,height:0}),2),r=n[0],l=n[1];return[e.useMemo((function(){var e={};if(t){var n=r.width,l=r.height;-1!==t.indexOf("height")&&l?e.height=l:-1!==t.indexOf("minHeight")&&l&&(e.minHeight=l),-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(),i=r.width,a=r.height;Math.abs(t-i)<1&&Math.abs(n-a)<1&&(t=i,n=a),l({width:t,height:n})}]}(m),L=fr(k,2),A=L[0],P=L[1];var _=function(e,t){var n=fr(Fr(null),2),r=n[0],l=n[1],a=i();function s(e){l(e,!0)}function c(){fl.cancel(a.current)}return o((function(){s("measure")}),[e]),o((function(){"measure"===r&&t(),r&&(a.current=fl(Yc(Uc().mark((function e(){var t,n;return Uc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Xc.indexOf(r),(n=Xc[t+1])&&-1!==t&&s(n);case 3:case"end":return e.stop()}}),e)})))))}),[r]),o((function(){return function(){c()}}),[]),[r,function(e){c(),a.current=fl((function(){s((function(e){switch(r){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(r,(function(){m&&P(v())})),F=fr(_,2),D=F[0],M=F[1],H=fr(s(0),2),$=H[0],q=H[1],K=i();function j(){var e;null===(e=N.current)||void 0===e||e.forceAlign()}function V(e,t){var n=y(t);R!==n&&O(n),q((function(e){return e+1})),"align"===D&&(null==b||b(e,t))}Kc((function(){"alignPre"===D&&q(0)}),[D]),Kc((function(){"align"===D&&($<3?j():M((function(){var e;null===(e=K.current)||void 0===e||e.call(K)})))}),[$]);var z=pr({},_s(t));function W(){return new Promise((function(e){K.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=z[e];z[e]=function(e,n){return M(),null==t?void 0:t(e,n)}})),e.useEffect((function(){z.motionName||"motion"!==D||M()}),[z.motionName,D]),e.useImperativeHandle(n,(function(){return{forceAlign:j,getElement:function(){return T.current}}}));var B=pr(pr({},A),{},{zIndex:u,opacity:"motion"!==D&&"stable"!==D&&r?0:void 0,pointerEvents:r||"stable"===D?void 0:"none"},c),U=!0;null==f||!f.points||"align"!==D&&"stable"!==D||(U=!1);var G=d;return e.Children.count(d)>1&&(G=e.createElement("div",{className:"".concat(l,"-content")},d)),e.createElement(wl,Cl({visible:r,ref:T,leavedClassName:"".concat(l,"-hidden")},z,{onAppearPrepare:W,onEnterPrepare:W,removeOnLeave:p,forceRender:h}),(function(t,n){var r=t.className,i=t.style,o=Pe(l,a,R,r);return e.createElement(Bc,{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:w,onTouchStartCapture:C,onClick:S,style:pr(pr({},i),B)},G))}))}));Qc.displayName="PopupInner";var Zc=e.forwardRef((function(t,n){var r=t.prefixCls,l=t.visible,i=t.zIndex,a=t.children,o=t.mobile,s=(o=void 0===o?{}:o).popupClassName,c=o.popupStyle,d=o.popupMotion,u=void 0===d?{}:d,m=o.popupRender,p=t.onClick,h=e.useRef();e.useImperativeHandle(n,(function(){return{forceAlign:function(){},getElement:function(){return h.current}}}));var f=pr({zIndex:i},c),g=a;return e.Children.count(a)>1&&(g=e.createElement("div",{className:"".concat(r,"-content")},a)),m&&(g=m(g)),e.createElement(wl,Cl({visible:l,ref:h,removeOnLeave:!0},u),(function(t,n){var l=t.className,i=t.style,a=Pe(r,s,l);return e.createElement("div",{ref:n,className:a,onClick:p,style:pr(pr({},i),f)},g)}))}));Zc.displayName="MobilePopupInner";var Jc=["visible","mobile"],ed=e.forwardRef((function(t,n){var r=t.visible,l=t.mobile,i=Sr(t,Jc),a=fr(s(r),2),c=a[0],d=a[1],u=fr(s(!1),2),m=u[0],p=u[1],h=pr(pr({},i),{},{visible:c});o((function(){d(r),r&&l&&p(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,l]);var f=m?e.createElement(Zc,Cl({},h,{mobile:l,ref:n})):e.createElement(Qc,Cl({},h,{ref:n}));return e.createElement("div",null,e.createElement(Fs,h),f)}));ed.displayName="Popup";var td=e.createContext(null);function nd(){}function rd(){return""}function ld(e){return e?e.ownerDocument:window.document}var id=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var ad=function(t){var n=function(n){kr(l,e.Component);var r=Pr(l);function l(t){var n,i;return Tr(this,l),ur(Ar(n=r.call(this,t)),"popupRef",e.createRef()),ur(Ar(n),"triggerRef",e.createRef()),ur(Ar(n),"portalContainer",void 0),ur(Ar(n),"attachId",void 0),ur(Ar(n),"clickOutsideHandler",void 0),ur(Ar(n),"touchOutsideHandler",void 0),ur(Ar(n),"contextMenuOutsideHandler1",void 0),ur(Ar(n),"contextMenuOutsideHandler2",void 0),ur(Ar(n),"mouseDownTimeout",void 0),ur(Ar(n),"focusTime",void 0),ur(Ar(n),"preClickTime",void 0),ur(Ar(n),"preTouchTime",void 0),ur(Ar(n),"delayTimer",void 0),ur(Ar(n),"hasPopupMouseDown",void 0),ur(Ar(n),"onMouseEnter",(function(e){var t=n.props.mouseEnterDelay;n.fireEvents("onMouseEnter",e),n.delaySetPopupVisible(!0,t,t?null:e)})),ur(Ar(n),"onMouseMove",(function(e){n.fireEvents("onMouseMove",e),n.setPoint(e)})),ur(Ar(n),"onMouseLeave",(function(e){n.fireEvents("onMouseLeave",e),n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),ur(Ar(n),"onPopupMouseEnter",(function(){n.clearDelayTimer()})),ur(Ar(n),"onPopupMouseLeave",(function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&Os(null===(t=n.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||n.delaySetPopupVisible(!1,n.props.mouseLeaveDelay)})),ur(Ar(n),"onFocus",(function(e){n.fireEvents("onFocus",e),n.clearDelayTimer(),n.isFocusToShow()&&(n.focusTime=Date.now(),n.delaySetPopupVisible(!0,n.props.focusDelay))})),ur(Ar(n),"onMouseDown",(function(e){n.fireEvents("onMouseDown",e),n.preClickTime=Date.now()})),ur(Ar(n),"onTouchStart",(function(e){n.fireEvents("onTouchStart",e),n.preTouchTime=Date.now()})),ur(Ar(n),"onBlur",(function(e){n.fireEvents("onBlur",e),n.clearDelayTimer(),n.isBlurToHide()&&n.delaySetPopupVisible(!1,n.props.blurDelay)})),ur(Ar(n),"onContextMenu",(function(e){e.preventDefault(),n.fireEvents("onContextMenu",e),n.setPopupVisible(!0,e)})),ur(Ar(n),"onContextMenuClose",(function(){n.isContextMenuToShow()&&n.close()})),ur(Ar(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)})),ur(Ar(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)})),ur(Ar(n),"onDocumentClick",(function(e){if(!n.props.mask||n.props.maskClosable){var t=e.target,r=n.getRootDomNode(),l=n.getPopupDomNode();Os(r,t)&&!n.isContextMenuOnly()||Os(l,t)||n.hasPopupMouseDown||n.close()}})),ur(Ar(n),"getRootDomNode",(function(){var e=n.props.getTriggerDOMNode;if(e)return e(n.triggerRef.current);try{var t=vr(n.triggerRef.current);if(t)return t}catch(e){}return Mt.findDOMNode(Ar(n))})),ur(Ar(n),"getPopupClassNameFromAlign",(function(e){var t=[],r=n.props,l=r.popupPlacement,i=r.builtinPlacements,a=r.prefixCls,o=r.alignPoint,s=r.getPopupClassNameFromAlign;return l&&i&&t.push(function(e,t,n,r){for(var l=n.points,i=Object.keys(e),a=0;a<i.length;a+=1){var o=i[a];if(As(e[o].points,l,r))return"".concat(t,"-placement-").concat(o)}return""}(i,a,e,o)),s&&t.push(s(e)),t.join(" ")})),ur(Ar(n),"getComponent",(function(){var t=n.props,r=t.prefixCls,l=t.destroyPopupOnHide,i=t.popupClassName,a=t.onPopupAlign,o=t.popupMotion,s=t.popupAnimation,c=t.popupTransitionName,d=t.popupStyle,u=t.mask,m=t.maskAnimation,p=t.maskTransitionName,h=t.maskMotion,f=t.zIndex,g=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,E=t.onPopupClick,w=n.state,C=w.popupVisible,S=w.point,N=n.getPopupAlign(),T={};return n.isMouseEnterToShow()&&(T.onMouseEnter=n.onPopupMouseEnter),n.isMouseLeaveToHide()&&(T.onMouseLeave=n.onPopupMouseLeave),T.onMouseDown=n.onPopupMouseDown,T.onTouchStart=n.onPopupMouseDown,e.createElement(ed,Cl({prefixCls:r,destroyPopupOnHide:l,visible:C,point:y&&S,className:i,align:N,onAlign:a,animation:s,getClassNameFromAlign:n.getPopupClassNameFromAlign},T,{stretch:v,getRootDomNode:n.getRootDomNode,style:d,mask:u,zIndex:f,transitionName:c,maskAnimation:m,maskTransitionName:p,maskMotion:h,ref:n.popupRef,motion:o,mobile:b,forceRender:x,onClick:E}),"function"==typeof g?g():g)})),ur(Ar(n),"attachParent",(function(e){fl.cancel(n.attachId);var t,r=n.props,l=r.getPopupContainer,i=r.getDocument,a=n.getRootDomNode();l?(a||0===l.length)&&(t=l(a)):t=i(n.getRootDomNode()).body,t?t.appendChild(e):n.attachId=fl((function(){n.attachParent(e)}))})),ur(Ar(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})),ur(Ar(n),"setPoint",(function(e){n.props.alignPoint&&e&&n.setState({point:{pageX:e.pageX,pageY:e.pageY}})})),ur(Ar(n),"handlePortalUpdate",(function(){n.state.prevPopupVisible!==n.state.popupVisible&&n.props.afterPopupVisibleChange(n.state.popupVisible)})),ur(Ar(n),"triggerContextValue",{onPopupMouseDown:n.onPopupMouseDown}),i="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,n.state={prevPopupVisible:i,popupVisible:i},id.forEach((function(e){n["fire".concat(e)]=function(t){n.fireEvents(e,t)}})),n}return Rr(l,[{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=ks(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=ks(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=ks(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=ks(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),fl.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 pr(pr({},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,l=1e3*t;if(this.clearDelayTimer(),l){var i=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(e,i),r.clearDelayTimer()}),l)}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,l=r.children,i=r.forceRender,a=r.alignPoint,o=r.className,s=r.autoDestroy,c=e.Children.only(l),d={key:"trigger"};this.isContextMenuToShow()?d.onContextMenu=this.onContextMenu:d.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(d.onClick=this.onClick,d.onMouseDown=this.onMouseDown,d.onTouchStart=this.onTouchStart):(d.onClick=this.createTwoChains("onClick"),d.onMouseDown=this.createTwoChains("onMouseDown"),d.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(d.onMouseEnter=this.onMouseEnter,a&&(d.onMouseMove=this.onMouseMove)):d.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?d.onMouseLeave=this.onMouseLeave:d.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(d.onFocus=this.onFocus,d.onBlur=this.onBlur):(d.onFocus=this.createTwoChains("onFocus"),d.onBlur=this.createTwoChains("onBlur"));var u=Pe(c&&c.props&&c.props.className,o);u&&(d.className=u);var m=pr({},d);Cr(c)&&(m.ref=wr(this.triggerRef,c.ref));var p,h=e.cloneElement(c,m);return(n||this.popupRef.current||i)&&(p=e.createElement(t,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!n&&s&&(p=null),e.createElement(td.Provider,{value:this.triggerContextValue},h,p)}}],[{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}}]),l}();return ur(n,"contextType",td),ur(n,"defaultProps",{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:rd,getDocument:ld,onPopupVisibleChange:nd,afterPopupVisibleChange:nd,onPopupAlign:nd,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}(Ls);const od=e=>{const{columns:n,onChange:r}=e,{prefixCls:l,$size:i}=t.useContext(Ko),{t:a}=Gn(),o=t.useRef([]),[s,c]=t.useState(!1),[d,u]=t.useState(n);Dl((()=>{p()}),[d]),t.useEffect((()=>{m()}),[n]);const m=()=>{const e=[];n.forEach(((t,r)=>{const l=t.colSpan;l>1&&n.slice(r+1,r+l).every((({colSpan:e})=>0===e))&&e.push(n.slice(r,r+l))})),o.current=e},p=()=>{const e=[];d.forEach((t=>{const{colSpan:n,dataIndex:r}=t;if(0===n)return;if(1===n)return e.push(t);const l=o.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(r)));if(-1===l)return e.push(t);e.push(...o.current[l].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)},h={[`${l}__popper`]:!0,"column-filter__popper":!0,[`${l}--lg`]:"large"===i,[`${l}--sm`]:"small"===i},f=[`${l}-column-filter`,{selected:s}];return t.createElement(ad,{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(Yt,{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));C(t,n)||u(Fa(e))}},d.map((e=>((e,n)=>{const{colSpan:r}=e;if(0===r)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const l=["svgicon","handle",`${n}-handle`];return t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(ue,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,u([...d])}}),t.createElement("i",{className:Pe(l),title:a("qm.table.columnFilter.draggable")},t.createElement(Be,null)),t.createElement("span",{className:"text"},Ia(e.title)))})(e,"main")))))),popupClassName:Pe(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{c(e)},builtinPlacements:Xo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Pe(f),title:a("qm.table.columnFilter.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null)),t.createElement("span",null,a("qm.table.columnFilter.text"))))},sd=e=>{const{defaultValue:n,onClose:r,onOk:l}=e,{tableRef:i,prefixCls:a,selectionKeys:o,pagination:s,showSummary:c}=t.useContext(Ko),{rowSelection:d}=i.current.props,{t:u}=Gn(),m=t.useRef(null),[h,f]=t.useState(!1),g=t.useMemo((()=>Object.assign({},{fileName:`${p().format(Yo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:o.length?"selected":"all","startIndex|endIndex":[1,s.total],footSummation:c?1:0,useStyle:0},n,{columns:Tn(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(od,{columns:n.state.formData.columns,onChange:e=>{n.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:u("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:u("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]);return t.createElement("div",{className:`${a}-export__setting`},t.createElement(Vh,{ref:m,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(er,{onClick:()=>r(),style:{marginRight:8}},u("qm.table.export.closeButton")),t.createElement(er,{type:"primary",loading:h,onClick:()=>hn(void 0,void 0,void 0,(function*(){const[e,t]=yield m.current.GET_FORM_DATA();if(!e){f(!0);for(const e in t)"footSummation"!==e&&"useStyle"!==e||(t[e]=!!t[e]);l(t),yield xn(1e3),f(!1),r()}}))},u("qm.table.export.text"))))},cd=t.forwardRef(((e,n)=>{var r;const{tableColumns:l,open:i=!0}=e,{global:a}=t.useContext(on),{tableRef:o,prefixCls:s,flattenColumns:c,pagination:d,fetchParams:u,isFetch:m,showSummary:h,getSpan:f}=t.useContext(Ko),{exportExcel:g,columns:v,fetch:y,showHeader:b}=o.current.props,{t:E}=Gn(),{getTitleFromCellValue:w}=fs(),[C,S]=t.useState(!1),[N,T]=t.useState(!1),I=t.useMemo((()=>{var e;return!!(null===(e=null==g?void 0:g.fetch)||void 0===e?void 0:e.api)}),[g]),R=t.useMemo((()=>!d.total||N),[d.total,N]),O=t.useMemo((()=>{const e=oa(v.filter((e=>!e.noAuth)),[as.expandableColumn,as.selectionColumn,as.operationColumn]),t=[],n=[],r=[];return e.forEach((e=>{const i=l.find((t=>t.dataIndex===e.dataIndex));"left"===e.fixed?t.push(i||e):"right"===e.fixed?n.push(i||e):r.push(i||e)})),[...t,...r,...n]}),[l]),k=t.useMemo((()=>oa(c,[as.expandableColumn,as.selectionColumn,as.operationColumn])),[c]),L=(e,t="",n=0)=>e.map(((e,r)=>{const l=Object.assign(Object.assign({},e),{index:r,pageIndex:r}),i=t?`${t}.${l.index+1}`:`${l.index+1}`;return l.indexPath=i,l._level=n,Array.isArray(e.children)&&(l.children=L(e.children,i,n+1)),k.forEach((e=>{const{dataIndex:t}=e;"index"!==t&&"pageIndex"!==t&&"indexPath"!==t&&ba(l,t,ya(l,t))})),l})),A=(e,t)=>{const n={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:r}=e,l=t.reduce(((e,t)=>{if(null==t?void 0:t[as.summaryIgnore])return e;const n=Number(ya(t,r));return Number.isNaN(n)?e:e+n}),0);ba(n,r,l)})),[n]},P=(e,t,n,r)=>{const{dataIndex:l,precision:i,formatType:a,outputRender:o}=n;if(o)return o(ya(e,l),e,n,t,r);let s=w(e,n,t,r);return i>=0&&!a&&""!==s&&(s=Number(s)),s},{exportXLSX:_,exportCSV:F}=Ns(),D=e=>hn(void 0,void 0,void 0,(function*(){var t;const{api:n,formatter:r=(e=>e),afterFetch:l,dataKey:i}=y;let a=[];try{T(!0);const o={[as.currentPageName]:1,[as.pageSizeName]:null!=e?e:d.total},s=yield n(Object.assign(Object.assign({},r(Object.assign(Object.assign({},u),o))),o));if(200===s.code){let e=Array.isArray(s.data)?s.data:null!==(t=x(s.data,i))&&void 0!==t?t:[];e="function"==typeof l?yield l(e):e,a=L(e)}}catch(e){}return T(!1),a})),M=e=>{var t;const n=null===(t=null==a?void 0:a.table)||void 0===t?void 0:t.recordExportLog;try{null==n||n({fileName:e})}catch(e){}},H=(e,t)=>{const{columns:n,footSummation:r}=e,l=Ji(n);let i='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return i+=`<colgroup>${l.map((({width:e,renderWidth:t})=>`<col style="width:${e||t}px">`)).join("")}</colgroup>`,b&&(i+=["<thead>","<tr>",l.map((e=>{const{rowSpan:t,colSpan:n}=e;return 0===n?null:`<th colspan="${n}" rowspan="${t}">${Ia(e.title)}</th>`})).join(""),"</tr>","</thead>"].join("")),t.length&&(i+=`<tbody>${sa(t).map((e=>`<tr>${l.map(((n,r)=>{var l;const{rowSpan:i,colSpan:a}=f(e,n,e.index,r,t);if(!i||!a)return null;const o=P(e,e.index,n,r);return`<td rowspan="${i}" colspan="${a}" data-type="${$(o,null===(l=n.filter)||void 0===l?void 0:l.type)}">${o}</td>`})).join("")}</tr>`)).join("")}</tbody>`),h&&r&&(i+=["<tfoot>",A(l,t).map((e=>`<tr>${l.map(((n,r)=>{const{dataIndex:l,summation:i}=n,a=(null==i?void 0:i.render)?i.render(t):ya(e,l);return`<td>${0===r&&""===a?E("qm.table.config.summaryText"):gn(a)?Ia(a):a}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),i+="</table>",i},$=(e,t)=>{const n={text:"string",textarea:"string",number:"number",date:"date"};return t&&n[t]?n[t]:typeof e},q=null!==(r=null==g?void 0:g.fileName)&&void 0!==r?r:`${p().format(Yo)}.xlsx`,K=q.slice(q.lastIndexOf(".")+1).toLowerCase(),j=()=>{if(R)return ne.warning(E("qm.table.export.warnText"));var e;I?(e=q,hn(void 0,void 0,void 0,(function*(){T(!0);try{const{api:t,params:n}=g.fetch,r=yield t(Object.assign(Object.assign(Object.assign({columns:k.map((e=>{const{title:t,dataIndex:n,hidden:r}=e,{type:l}=e.filter||{};return{title:t,dataIndex:n,type:l,hidden:r}}))},u),n),{tsortby:void 0,tsummary:void 0,tgroupby:void 0,[as.currentPageName]:void 0,[as.pageSizeName]:void 0}));r.data&&(wi(r.data,e),M(e))}catch(e){}T(!1)}))):S(!0)};t.useImperativeHandle(n,(()=>({clickHandle:j})));const V={[`${s}-export`]:!0},z={visible:C,title:E("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>S(!1)},W={fileName:q.slice(0,q.lastIndexOf(".")),fileType:K,columns:O,useStyle:(null==g?void 0:g.cellStyle)?1:0};return t.createElement(t.Fragment,null,i&&t.createElement("span",{className:Pe(V),title:E("qm.table.export.textNoSpace"),onClick:()=>j()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ke,null))),t.createElement(Mi,z,t.createElement(sd,{defaultValue:W,onClose:()=>S(!1),onOk:e=>{var t;t=Object.assign({},e,{columns:ea(e.columns)}),hn(void 0,void 0,void 0,(function*(){const{fileName:e,fileType:n,exportType:r,startIndex:l=1,endIndex:i}=t,{tableFullData:a,selectionRows:s}=o.current;let c=[];if(m?("all"===r&&(c=yield D()),"custom"===r&&(c=yield D(i),c=c.slice(l-1))):("all"===r&&(c=a.slice(0)),"custom"===r&&(c=a.slice(l-1,i||void 0))),"selected"===r&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof(null==g?void 0:g.beforeExport))try{c=null==g?void 0:g.beforeExport(c)}catch(e){}if("xlsx"===n){const n=yield _(t,c,A,P);wi(n,`${e}.xlsx`),M(`${e}.xlsx`)}if("csv"===n){const n=F(t,H(t,c));wi(n,`${e}.csv`),M(`${e}.csv`)}}))}})))}));cd.displayName="TableExport";const dd=e=>{const{columns:n,onClose:r}=e,{tableRef:l,tableBodyRef:i,prefixCls:a,dataChange:o}=t.useContext(Ko),{beforeClipboard:s}=l.current.props,{t:c}=Gn(),d=t.useRef(null),[u,m]=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:Ia(e.title)})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:c("qm.table.clipboard.content"),fieldName:"content",placeholder:c("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[p,h]=t.useState(!1);return t.createElement("div",{className:`${a}-clipboard__setting`},t.createElement("h3",{className:"info"},c("qm.table.clipboard.supportText")),t.createElement(Vh,{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(er,{onClick:()=>r(),style:{marginRight:8}},c("qm.table.export.closeButton")),t.createElement(er,{type:"primary",loading:p,onClick:()=>hn(void 0,void 0,void 0,(function*(){var e;const[t,a]=yield d.current.GET_FORM_DATA();if(t)return;const{tableFullData:u,store:m,fieldAuth:p}=l.current;h(!0);const f=a.content.trim().replace(/(\r|\n)$/,"");let g=f.replace(/"[^"]+"/g,"^");((null===(e=f.match(/"[^"]+"/g))||void 0===e?void 0:e.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," "))))||[]).forEach((e=>{g=g.replace(/\^/,e)}));let v=g.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof s)try{v=yield s(v,v[0].map(((e,t)=>n[a.colIndex+t].dataIndex)))}catch(t){}v.forEach(((e,t)=>{e.forEach(((e,r)=>{var l,i;const o=u[a.rowIndex-1+t],s=n[a.colIndex+r];if(o&&s){let t=!1;if(s.editRender){const e=s.editRender(o,s);t=!(e.disabled||(null===(l=e.extra)||void 0===l?void 0:l.disabled)||(null===(i=p[s.dataIndex])||void 0===i?void 0:i.disabled))}t&&s.dictItems&&(t=s.dictItems.some((t=>t.value==e))),t&&(ba(o,s.dataIndex,e),m.addToUpdated(o))}}))})),i.current.forceUpdate(),o(),ne.success(c("qm.table.clipboard.success",{total:v.length})),h(!1),r()}))},c("qm.table.clipboard.text"))))},ud=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,flattenColumns:i}=t.useContext(Ko),{t:a}=Gn(),[o,s]=t.useState(!1),c=t.useMemo((()=>(e=>e.filter((e=>![as.expandableColumn,as.selectionColumn,"index","pageIndex",as.operationColumn].includes(e.dataIndex))))(i)),[i]),d=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:d})));const u={[`${l}-clipboard`]:!0},m={visible:o,title:a("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:Pe(u),title:a("qm.table.clipboard.textNoSpace"),onClick:()=>d()},t.createElement("i",{className:"svgicon icon"},t.createElement(Ze,null))),t.createElement(Mi,m,t.createElement(dd,{columns:c,onClose:()=>s(!1)})))}));ud.displayName="TableClipboard";const md=e=>{const{columns:n,onClose:r}=e,{tableRef:l,$size:i,selectionKeys:a,setSelectionKeysEffect:o}=t.useContext(Ko),{rowKey:s,rowSelection:c}=l.current.props,{t:d}=Gn(),u=t.useRef(null),m=ai(u),p=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=p(e.children)),n})),[h,f]=t.useState([{title:d("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...p(n.filter((e=>![as.expandableColumn,as.selectionColumn,"index","pageIndex",as.operationColumn].includes(e.dataIndex))))]),[g]=t.useState((()=>{const{disabled:e}=c||{},t=l.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=ci((()=>{const e=u.current;y(e.offsetHeight-2*qo[i]-30)}),5);return si((()=>{b()}),[m.width]),t.createElement("div",{ref:u,style:{height:"100%"}},t.createElement(cp,{size:i,columns:h,dataSource:g,rowKey:s,height:v,rowSelection:{type:"checkbox",selectedRowKeys:a,onChange:e=>o(e)},webPagination:!0,ignorePageIndex:!0,showFastSearch:!1,showTableImport:!1,showSelectCollection:!1,showClipboard:!1,showFullScreen:!1,showColumnDefine:!1,columnsChange:e=>f(e)}),t.createElement("div",{style:{height:10}}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t.createElement(er,{onClick:()=>r()},d("qm.table.selectCollection.closeButton"))))},pd=t.forwardRef(((e,n)=>{const{columns:r,open:l=!0}=e,{tableRef:i,getRowKey:a,prefixCls:o,selectionKeys:s,isFetch:c,isTableEmpty:d,setSelectionKeysEffect:u,setSelectionRows:m}=t.useContext(Ko),{rowSelection:p}=i.current.props,{t:h}=Gn(),[f,g]=t.useState(!1),v=t.useRef(!1);Dl((()=>{!v.current&&y()}),[d]);const y=()=>hn(void 0,void 0,void 0,(function*(){var e;const{fetchSelectedRows:t,disabled:n=(e=>!1)}=p;if(c&&t)try{const r=yield t.api(Object.assign({},{selectedKeys:s},t.params));if(200===r.code){let l=Array.isArray(r.data)?r.data:null!==(e=x(r.data,t.dataKey))&&void 0!==e?e:[];l=l.filter((e=>!n(e))),u(l.map(((e,t)=>a(e,t)))),m(l),v.current=!0}}catch(e){}})),b=()=>{g(!0)};t.useImperativeHandle(n,(()=>({clickHandle:b})));const E={visible:f,title:h("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>g(!1)};return t.createElement(t.Fragment,null,l&&t.createElement("span",{className:`${o}-select-collection`,title:h("qm.table.selectCollection.text"),onClick:()=>b()},t.createElement("i",{className:"svgicon icon"},t.createElement(Je,null))),t.createElement(Mi,E,t.createElement(md,{columns:r,onClose:()=>g(!1)})))}));pd.displayName="SelectCollection";const hd=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:l,getRowKey:i,prefixCls:a,$size:o,tableFlatData:s,flattenColumns:c,setActivedCell:d,scrollXToColumn:u,scrollYToRecord:m}=t.useContext(Ko),{uniqueKey:p}=l.current.props,{t:h}=Gn(),{getTitleFromCellValue:f}=fs(),g=t.useRef(""),[v,y]=t.useState(""),[b,x]=t.useState([]),[E,w]=t.useState(0),[C,S]=t.useState(!1),[N,T]=t.useState({case:0,fullchar:0}),I=t.useMemo((()=>`${b.length>0?E+1:E}/${b.length}`),[E,b]);Dl((()=>{A(b[E])}),[E,b]);const R=e=>{T(Object.assign({},N,e))},O=(e,t,n)=>new Promise(((r,l)=>{ae.confirm({title:h("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),r()},onCancel:()=>{n(),r()}})})),k=Yn((e=>hn(void 0,void 0,void 0,(function*(){if(!v)return g.current=v,L();const t=((e,t)=>{const n=new RegExp(N.fullchar?`^${t}$`:t,N.case?"":"i"),r=[];return e.forEach(((e,t)=>{c.forEach(((l,a)=>{const{dataIndex:o}=l;if([as.expandableColumn,as.selectionColumn,"index","pageIndex",as.operationColumn].includes(o))return;const s=f(e,l,e.index,a);n.test(s)&&r.push({value:s,rowKey:i(e,e.index),dataIndex:o,rowIndex:t,colIndex:a})}))})),r})(s,v);if(!t.length)return ae.warning({title:h("qm.button.confirmPrompt"),content:h("qm.table.fastSearch.notMatch")});if(x(t),"all"===e&&S(!0),v!==g.current)return g.current=v,w(0);if("next"===e){const e=E+1;e>t.length-1?yield O(h("qm.table.fastSearch.toTheEnd"),(()=>w(0)),(()=>{})):w(e)}if("prev"===e){const e=E-1;e<0?yield O(h("qm.table.fastSearch.toStart"),(()=>w(t.length-1)),(()=>{})):w(e)}})))),L=()=>{w(0),x([]),d({})},A=e=>{e&&(m(e.rowKey),u(e.dataIndex),d(e))},P=t.useMemo((()=>p?`fastSearch_${p}`:""),[p]),[_,F]=t.useState([]),[D,M]=t.useState(""),[H,$]=t.useState("");Dl((()=>{if(H){const{input:e,config:t}=_.find((e=>e.value===H)).condition;y(e),T(t),setTimeout((()=>k()))}}),[H]),t.useEffect((()=>{q()}),[]);const q=()=>hn(void 0,void 0,void 0,(function*(){if(!P)return;let e=yield Zt.getItem(P);e||(e=yield K(P),Array.isArray(e)&&(yield Zt.setItem(P,e))),Array.isArray(e)&&e.length&&F(e)})),K=e=>hn(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)=>hn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-fast-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement("div",{className:"search-box"},t.createElement("span",{className:"label"},h("qm.table.fastSearch.queryLabel"),":"),t.createElement(re,{value:v,placeholder:h("qm.table.fastSearch.queryCondition"),allowClear:!0,style:{flex:"auto",width:"auto"},onChange:e=>y(e.target.value)})),t.createElement("div",{className:"condition"},t.createElement(ue,{checked:!!N.case,onChange:e=>R({case:e.target.checked})},h("qm.table.fastSearch.matchCase")),t.createElement(ue,{checked:!!N.fullchar,onChange:e=>R({fullchar:e.target.checked})},h("qm.table.fastSearch.matchFullchar"))),t.createElement("div",{className:"all-list"},C&&t.createElement("table",{className:"rtable",tabIndex:-1,cellSpacing:"0",cellPadding:"0"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",{style:{width:40,minWidth:40}},"#"),t.createElement("th",{style:{width:130,minWidth:130}},h("qm.table.fastSearch.cellText")),t.createElement("th",null,h("qm.table.fastSearch.valText")))),t.createElement("tbody",null,b.map(((e,n)=>t.createElement("tr",{key:n,className:Pe({active:E===n}),onClick:()=>w(n)},t.createElement("td",null,n+1),t.createElement("td",null,"Row:",e.rowIndex+1,", Col:",e.colIndex+1),t.createElement("td",null,e.value)))))))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(re,{size:o,value:D,placeholder:h("qm.table.highSearch.configText"),disabled:!v,onChange:e=>{const{value:t}=e.target;M(t)}}),t.createElement(er,{type:"primary",disabled:!D||!v,style:{marginLeft:"10px"},onClick:()=>hn(void 0,void 0,void 0,(function*(){if(!P)return Jn("Table","必须设置组件参数 `uniqueKey` 才能保存");if(!v)return;const e=Ta(),t=[..._,{text:D,value:e,condition:{input:v,config:N}}];F(t),M(""),yield Zt.setItem(P,t),yield j(P,t)}))},h("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${as.rowHeightMaps[o]}px`}},t.createElement("span",null,h("qm.table.fastSearch.savedSetting"))),t.createElement("ul",null,_.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===H}),title:e.text,onClick:()=>{return t=e.value,void $(t!==H?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:h("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,hn(void 0,void 0,void 0,(function*(){if(!n)return;const e=_.filter((e=>e.value!==n));F(e),yield Zt.setItem(P,e),yield j(P,e)}))}},t.createElement(et,null))))),!_.length&&t.createElement("div",{style:{padding:zo}},t.createElement(Jl,null)))))),t.createElement("div",{className:"bottom-bar",style:{position:"absolute",left:0,bottom:0,right:0,height:`${qo[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",boxSizing:"border-box"}},t.createElement("div",null,h("qm.table.fastSearch.findTotal",{total:I})),t.createElement("div",null,t.createElement(er,{onClick:()=>k("all"),style:{marginRight:8}},h("qm.table.fastSearch.queryAll")),t.createElement(er,{type:"primary",onClick:()=>k("prev"),style:{marginRight:8}},h("qm.table.fastSearch.queryPrev")),t.createElement(er,{type:"primary",onClick:()=>k("next"),style:{marginRight:8}},h("qm.table.fastSearch.queryNext")),t.createElement(er,{onClick:()=>n()},h("qm.table.fastSearch.closeButton")))))},fd=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l,$size:i}=t.useContext(Ko),{t:a}=Gn(),[o,s]=t.useState(!1),c=()=>{s(!0)};t.useImperativeHandle(n,(()=>({clickHandle:c})));const d={visible:o,title:a("qm.table.fastSearch.settingTitle"),width:650,loading:!1,bodyStyle:{paddingBottom:`${qo[i]+20}px`},onClose:()=>s(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${l}-super-search`,title:a("qm.table.fastSearch.text"),onClick:()=>c()},t.createElement("i",{className:"svgicon icon"},t.createElement(tt,null))),t.createElement(Mi,d,t.createElement(hd,{onClose:()=>s(!1)})))}));fd.displayName="FastSearch";var gd={selectionColumnDefine:{title:"",dataIndex:"__selection__",width:60,fixed:"left"},indentWidth:16,groupMargin:15,separator:"^"};const vd=e=>[gd.selectionColumnDefine,...e].filter((e=>!e.hidden)),yd=e=>e.some((e=>Array.isArray(e.children))),bd=e=>void 0!==e._groupLevel,xd=(e,t)=>t.split(gd.separator).reduce(((e,t)=>null==e?void 0:e[t]),e),Ed=e=>Array.isArray(e)?0:"object"==typeof e&&null!==e?1+Math.max(0,...Object.values(e).map(Ed)):0,wd=(e,t="")=>Array.isArray(e)?[]:Object.keys(e).reduce(((n,r)=>{const l=t?`${t}${gd.separator}${r}`:r;if(n.push(l),Array.isArray(e[r]))return n;const i=wd(e[r],l);return n.concat(i)}),[]),Cd=(e,t=[],n)=>{const r=(e,t)=>{if(0===t.length)return e;const[{[Object.keys(t[0])[0]]:l}]=t,i=Object.keys(t[0])[0],a=t.slice(1),o=Object.groupBy(e,(e=>n(e,i))),s=Object.keys(o).sort(((e,t)=>{const n=(r=e,i=t,Number.isNaN(r-i)?r.toString().localeCompare(i.toString()):r-i);var r,i;return"ascend"===l?n:-n})),c={};return s.forEach((e=>{c[`#${e}`]=r(o[e],a)})),c};return r(e,t)},Sd={sum:e=>e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0),avg:e=>e.length?(e.reduce(((e,t)=>isNaN(Number(t))?e:e+Number(t)),0)/e.length).toFixed(2):"",max:e=>e.length?Math.max(...e):"",min:e=>e.length?Math.min(...e):"",count:e=>e.length,unique:e=>new Set(e).size,empty:e=>e.filter((e=>Cn(e))).length,notEmpty:e=>e.filter((e=>!Cn(e))).length},Nd=t.createContext(void 0),Td=e=>{const{prefixCls:n,pivotProps:r,size:l,getRowKey:i,flatColumns:a,tableData:o}=e,{initialGroup:s,initialCount:c,initialFilter:d,initialSorter:u}=r,m=e=>{const t=new Map;return sa(e).forEach((e=>t.set(i(e,e.index),e))),t},p=t.useRef({props:r,originGridData:o,flatGroupData:[],isTree:yd(o),keyRecordMap:m(o)}),[h,f]=t.useState({pivotRef:p,prefixCls:n,size:l,viewMode:"table",columns:a,gridData:o,groupGridData:[],groupList:s?(e=>{const t=[],n=a.map((e=>e.dataIndex));return e.forEach((e=>{n.includes(e.fieldName)&&["ascend","descend"].includes(e.order)&&t.push(e)})),t})(s):[],filterList:d?(e=>{const t=[],n=a.map((e=>e.dataIndex));for(const r in e){const[l,i]=r.split("|");if(n.includes(l)&&i){const n=e[r]||{};Object.keys(n).forEach((e=>{t.push({type:i,bracketLeft:"",fieldName:l,expression:e,value:Ha(e)?null:n[e],bracketRight:"",logic:"and"})}))}}return t})(d):[],sorterList:u?(e=>{const t=[],n=a.map((e=>e.dataIndex));for(const r in e)n.includes(r)&&["ascend","descend"].includes(e[r])&&t.push({fieldName:r,order:e[r]});return t})(u):[],colorList:[],expandedKeys:[],searchResults:[],switchIndex:0,fillColorCells:new Map,countMethod:c?(e=>{const t=["count","unique","empty","notEmpty","sum","max","min","avg"],n=a.map((e=>e.dataIndex)),r={};for(const l in e)n.includes(l)&&t.includes(e[l])&&(r[l]=e[l]);return r})(c):{},summationData:{}}),g=e=>{f((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((l=>{const i=l;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))};si((()=>{b(o),v("originGridData",o),v("isTree",yd(o)),v("keyRecordMap",m(o))}),[o]),si((()=>{y(a)}),[a]),si((()=>{g({size:l})}),[l]);const v=(e,t)=>{h.pivotRef.current[e]=t};v("props",r);const y=e=>{g({columns:e})},b=e=>{g({gridData:e})},x=e=>{g({groupGridData:e})},E=e=>{g({groupList:e})},w=e=>{g({filterList:e})},C=e=>{g({sorterList:e})},S=e=>{g({colorList:e})},N=e=>{g({expandedKeys:e})},T=e=>{g({searchResults:e})},I=e=>{g({switchIndex:e})},R=e=>{const t=new Map;e.forEach((e=>t.set(`${e.rowKey}|${e.dataIndex}`,e.color))),g({fillColorCells:t})},O=e=>{var t;g({countMethod:(t=Object.assign({},h.countMethod,e),Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t))))})},k=e=>{g({summationData:e})},L=t.useMemo((()=>Object.assign(Object.assign({},h),{setContext:g,getRowKey:i,setPivotGridRef:v,setColumns:y,setGridData:b,setGroupGridData:x,setGroupList:E,setFilterList:w,setSorterList:C,setColorList:S,setExpandedKeys:N,setSearchResults:T,setSwitchIndex:I,setFillColor:R,setCountMethod:O,setSummationData:k})),[h]);return t.createElement(Nd.Provider,{value:L},e.children)},Id=()=>t.useContext(Nd),Rd=()=>{const{prefixCls:e,pivotRef:n,groupList:r,columns:l,gridData:i,setGroupList:a,setExpandedKeys:o,setGroupGridData:s,setPivotGridRef:c}=Id(),{originGridData:d}=n.current,{onGroupChange:u,onDataChange:m}=n.current.props,{t:p}=Gn(),h=t.useRef([]),g=t.useRef([]),v=t.useMemo((()=>r.filter((e=>e.fieldName&&e.order))),[r]),y=t.useMemo((()=>l.filter((e=>![as.operationColumn].includes(e.dataIndex))).map((e=>({label:Ia(e.title),value:e.dataIndex,disabled:r.some((t=>t.fieldName===e.dataIndex))})))),[r,l]),b=t.useMemo((()=>{const e=v.map((e=>({[e.fieldName]:e.order})));return C(e,h.current)?h.current:(h.current=e,e)}),[v]),x=[{label:p("qm.pivotGrid.group.ascend"),value:"ascend"},{label:p("qm.pivotGrid.group.descend"),value:"descend"}];t.useEffect((()=>{o(g.current)}),[b,d]),t.useLayoutEffect((()=>{const e=Cd(i,b,((e,t)=>{let n=ya(e,t);return f(n)&&(n=Object.values(n)),Array.isArray(n)&&(n=n.join(",")),Cn(n)?p("qm.pivotGrid.group.empty"):n}));var t;s(e),t=wd(e),g.current=t,c("flatGroupData",((e,t=[])=>{const n=[];return function e(r,l,i=""){if(Array.isArray(r))r.forEach(((e,t)=>{e._varIndex=t,i?e._parentRowKey=i:delete e._parentRowKey})),n.push(...sa(r));else for(const a in r){const o=i?`${i}${gd.separator}${a}`:a,s=Object.keys(t[l])[0];n.push({id:o,_fieldName:s,_groupLevel:l}),e(r[a],l+1,o)}}(e,0),n})(e,b))}),[b,i]),Dl((()=>{null==u||u(v)}),[b]),Dl((()=>{null==m||m(i)}),[i]);const E=()=>{a([...r,{fieldName:"",order:"ascend"}])},w=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...r])},S=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(de,{value:e.fieldName||void 0,placeholder:p("qm.table.editable.selectPlaceholder"),options:y,style:{width:160,margin:"0 10px"},onChange:t=>w("fieldName",e,t)}),t.createElement(de,{value:e.order,options:x,placeholder:p("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>w("order",e,t)}),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{a(r.filter((t=>t!==e)))})(e)}));return t.createElement(me,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,p("qm.pivotGrid.group.title")),!!v.length&&t.createElement("div",null,t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o([])},p("qm.pivotGrid.group.foldAll")),t.createElement("button",{className:"button-icon no-hover-bg",onClick:()=>o(g.current)},p("qm.pivotGrid.group.unfoldAll")))),t.createElement("div",{className:"list"},t.createElement(Yt,{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));C(t,n)||a(e)}},r.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},S(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:E},t.createElement(rt,{className:"icon"}),p("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!v.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(nt,{className:"icon"}),p("qm.pivotGrid.group.text"),v.length?`(${v.length})`:null))},Od=()=>{const{prefixCls:e,pivotRef:n,columns:r,filterList:l,setFilterList:i,setGridData:a}=Id(),{originGridData:o,isTree:s}=n.current,{onFilterChange:c}=n.current.props,{t:d}=Gn(),u=t.useRef([]),m=t.useMemo((()=>l.filter((e=>e.fieldName&&(Ha(e.expression)||!Cn(e.value))))),[l]),p=t.useMemo((()=>r.filter((e=>![as.operationColumn].includes(e.dataIndex))).map((e=>({label:Ia(e.title),value:e.dataIndex})))),[r]),[h,f]=t.useState("and"),g=t.useMemo((()=>{const e=m.map((e=>{var t;return`${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}));return C(e,u.current)?u.current:(u.current=e,e)}),[m]);Dl((()=>{i(l.map((e=>Object.assign(Object.assign({},e),{logic:h}))))}),[h]),Dl((()=>{y(),null==c||c(m)}),[g]),t.useEffect((()=>{m.length&&v()}),[]);const v=()=>{const e=Oa(m.map((e=>Object.assign(Object.assign({},Nn(e,["value"])),{condition:e.value}))));a(e?Zi(o,e,s):o)},y=ci(v,200),b=[{label:d("qm.pivotGrid.filter.matchAll"),value:"and"},{label:d("qm.pivotGrid.filter.matchAny"),value:"or"}],x=()=>{i([...l,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:h}])},E=(e,t,n)=>{var a;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(a=r.find((e=>e.dataIndex===n)).filter)||void 0===a?void 0:a.type)||"text";Object.assign(t,{type:e,expression:S(e)[0].value,value:""})}"expression"===e&&Ha(n)&&Object.assign(t,{value:""}),i([...l])},w=e=>t.createElement(t.Fragment,null,t.createElement(de,{value:e.fieldName||void 0,options:p,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>E("fieldName",e,t)}),t.createElement(de,{value:e.expression||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),options:S(e.type),style:{width:100,margin:"0 10px"},onChange:t=>E("expression",e,t)}),N(e),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{i(l.filter((t=>t!==e)))})(e)})),S=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:d("qm.table.highSearch.gtText")},{value:"<",label:d("qm.table.highSearch.ltText")},{value:">=",label:d("qm.table.highSearch.gteText")},{value:"<=",label:d("qm.table.highSearch.lteText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:d("qm.table.highSearch.inText")},{value:"nin",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:d("qm.table.highSearch.inText")},{value:"nlike",label:d("qm.table.highSearch.ninText")},{value:"==",label:d("qm.table.highSearch.eqText")},{value:"!=",label:d("qm.table.highSearch.neqText")},{value:"^=",label:d("qm.table.highSearch.startsWithText")},{value:"=$",label:d("qm.table.highSearch.endsWithText")},{value:"nil",label:d("qm.table.highSearch.nullText")},{value:"nnil",label:d("qm.table.highSearch.notNullText")}]}return t},N=e=>{var n,l;switch(e.type){case"number":return t.createElement(pe,{defaultValue:e.value,style:{width:150},onChange:t=>{E("value",e,Cn(t)?"":t)}});case"date":return t.createElement(Kn,{popupClassName:as.popupClassName,defaultValue:null!==(n=Sa(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{E("value",e,Na(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(l=r.find((t=>t.dataIndex===e.fieldName)))||void 0===l?void 0:l.dictItems)||[];return t.createElement(de,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:d("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{E("value",e,t)}},n.map((e=>t.createElement(de.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(re,{value:e.value,style:{width:150},disabled:Ha(e.expression),onChange:t=>{E("value",e,t.target.value)}})}};return t.createElement(me,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,d("qm.pivotGrid.filter.title")),!!m.length&&t.createElement(de,{value:h,options:b,style:{width:130},onChange:e=>f(e)})),t.createElement("div",{className:"list"},l.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},w(e))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:x},t.createElement(rt,{className:"icon"}),d("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!m.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(it,{className:"icon"}),d("qm.pivotGrid.filter.text"),m.length?`(${m.length})`:null))},kd=()=>{const{prefixCls:e,pivotRef:n,columns:r,gridData:l,sorterList:i,setSorterList:a,setGridData:o}=Id(),{onSorterChange:s}=n.current.props,{t:c}=Gn(),d=t.useMemo((()=>i.filter((e=>e.fieldName&&e.order))),[i]),u=t.useMemo((()=>r.filter((e=>![as.operationColumn].includes(e.dataIndex))).map((e=>({label:Ia(e.title),value:e.dataIndex,disabled:i.some((t=>t.fieldName===e.dataIndex))})))),[i,r]);Dl((()=>{h(),null==s||s(d)}),[t.useMemo((()=>d.map((e=>Object.values(e).join(":"))).join(",")),[d])]),t.useLayoutEffect((()=>{d.length&&h()}),[]);const m=[{label:c("qm.pivotGrid.sorter.ascend"),value:"ascend"},{label:c("qm.pivotGrid.sorter.descend"),value:"descend"}],p=(e,t)=>"number"==typeof e&&"number"==typeof t?e-t:"string"==typeof e&&"string"==typeof t?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():0,h=()=>{var e,t;o((e=l,(t=d).length||(t=[{fieldName:"index",order:"ascend"}]),e.sort(((e,n)=>{for(const r of t){const{fieldName:t,order:l}=r,i=ya(e,t),a=ya(n,t),o=p(i,a);if(0!==o)return"ascend"===l?o:-o}return 0})).slice(0)))},f=()=>{a([...i,{fieldName:"",order:"ascend"}])},g=(e,t,n)=>{Object.assign(t,{[e]:n}),a([...i])},v=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(de,{value:e.fieldName||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:u,style:{width:160,margin:"0 10px"},onChange:t=>g("fieldName",e,t)}),t.createElement(de,{value:e.order,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:100},onChange:t=>g("order",e,t)}),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)}));return t.createElement(me,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.sorter.title"))),t.createElement("div",{className:"list"},t.createElement(Yt,{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));C(t,n)||a(e)}},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(rt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!d.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(at,{className:"icon"}),c("qm.pivotGrid.sorter.text"),d.length?`(${d.length})`:null))},Ld=()=>{const{prefixCls:e,getRowKey:n,gridData:r,columns:l,searchResults:i,switchIndex:a,setSearchResults:o,setSwitchIndex:s}=Id(),{t:c}=Gn(),{getTitleFromCellValue:d}=fs(),[u,m]=t.useState(!1),p=t.useMemo((()=>i.length),[i]);Dl((()=>{u||setTimeout((()=>{s(0),o([])}),200)}),[u]);const h=(e,t)=>{const r=[];return e.forEach(((e,i)=>{l.forEach(((l,a)=>{const o=d(e,l,i,a)+"";o.includes(t)&&r.push({value:o,rowKey:n(e,e.index),dataIndex:l.dataIndex})})),Array.isArray(e.children)&&r.push(...h(e.children,t))})),r},f=ci((e=>{const t=e.target.value.trim();s(0),o(t?h(r,t):[])}),200),g=e=>{const{keyCode:t}=e;e.preventDefault(),13===t&&v()},v=()=>{if(!p)return;s((a+1)%p)},y=()=>t.createElement("div",{className:"search-switch"},t.createElement("button",{className:"button-icon",onClick:()=>(()=>{if(!p)return;s((a-1+p)%p)})()},t.createElement(ot,null)),t.createElement("span",{className:"num"},p>0?a+1:a,"/",p),t.createElement("button",{className:"button-icon",onClick:()=>v()},t.createElement(st,null)));return t.createElement(me,{open:u,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.search.title")),t.createElement("button",{className:"button-icon",onClick:()=>m(!1)},t.createElement(lt,null))),t.createElement("div",{className:"list search",style:{margin:"10px 0"}},t.createElement(re,{autoFocus:!0,style:{width:280},suffix:y(),onChange:f,onKeyUp:g}))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300},destroyPopupOnHide:!0},t.createElement("span",{onClick:()=>m(!u)},t.createElement(tt,{className:"icon"}),c("qm.pivotGrid.search.text")))},Ad=(e,t)=>e.map((e=>(e.children&&(e.children=Ad(e.children,t)),t(e)))),Pd=()=>{const{prefixCls:e,pivotRef:n,columns:r,setColumns:l}=Id(),{uniqueKey:i,onColumnsChange:a}=n.current.props,{t:o}=Gn(),s=t.useMemo((()=>i?`grid_field_${i}`:""),[i]);t.useLayoutEffect((()=>{c()}),[]),Dl((()=>{u(r)}),[r]);const c=()=>{const e=m();e&&(null==a||a(e))},d=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=d(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),Object.assign({dataIndex:e.dataIndex},t)})),u=e=>{if(!s)return;const t=d(e),n=JSON.parse(localStorage.getItem(s));C(t,n)||localStorage.setItem(s,JSON.stringify(t))},m=()=>{if(!s)return;const e=JSON.parse(localStorage.getItem(s));if(!e)return;return S(e.map((e=>e.dataIndex)),r.map((e=>e.dataIndex))).length>0?Ad(r,(t=>{const n=e.find((e=>e.dataIndex===t.dataIndex));return n&&(void 0!==n.hidden&&(t.hidden=n.hidden),void 0!==n.fixed&&(t.fixed=n.fixed),void 0!==n.width&&(t.width=n.width),void 0!==n.renderWidth&&(t.renderWidth=n.renderWidth)),t})):Ad(e,(e=>{const t=r.find((t=>t.dataIndex===e.dataIndex));return t&&void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)}))},p=t.useMemo((()=>{let e=0;for(let t=0;t<r.length-1&&("left"!==r[t].fixed||r[t+1].fixed||(e=t+1),!(e>0));t++);const t=[];for(let n=0;n<r.length;n++)n===e&&t.push({title:"",dataIndex:"__divider__"}),t.push(r[n]);return t}),[r]),h=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container","scroll-y"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,o("qm.pivotGrid.field.title"))),t.createElement("div",{className:"list"},t.createElement(Yt,{itemKey:"dataIndex",handle:".handle",tag:"ul",animation:200,list:p,setList:e=>{const t=e.map((e=>e.dataIndex)),n=p.map((e=>e.dataIndex));C(t,n)||(e=>{const t=e.findIndex((e=>"__divider__"===e.dataIndex)),n=[];for(let r=0;r<e.length;r++){const l=e[r];r<t?l.fixed="left":delete l.fixed,r!==t&&n.push(l)}a?a(n):l(n)})(Fa(e))}},p.map((e=>"__divider__"!==e.dataIndex?t.createElement("li",{key:e.dataIndex,className:"ant-dropdown-menu-item sort-item"},t.createElement(Be,{className:"handle"}),t.createElement("span",{className:"label"},t.createElement("span",{className:"title"},Ia(e.title)),t.createElement("button",{className:"button-icon",onClick:()=>(e=>{e.hidden=!e.hidden;const t=[...r];a?a(t):l(t)})(e)},e.hidden?t.createElement(ct,null):t.createElement(qe,null)))):t.createElement("li",{key:e.dataIndex,className:"divider"}))))));return t.createElement(me,{trigger:["click"],dropdownRender:()=>h(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:240}},t.createElement("span",null,t.createElement(Qe,{className:"icon"}),o("qm.pivotGrid.field.text")))},_d=()=>{const{prefixCls:e,size:n,setContext:r}=Id(),{t:l}=Gn(),i=[{label:l("qm.pivotGrid.lineHeight.size")[0],value:"small"},{label:l("qm.pivotGrid.lineHeight.size")[1],value:"middle"},{label:l("qm.pivotGrid.lineHeight.size")[2],value:"large"}];return t.createElement(me,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},i.map((e=>t.createElement("li",{key:e.value,className:Pe("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($e,null))))))),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:160}},t.createElement("span",null,t.createElement(dt,{className:"icon"}),l("qm.pivotGrid.lineHeight.text")))},Fd="606060",Dd="thin",Md="d4d4d4",Hd=(e,t)=>{t&&(e.height=Math.floor(.75*t))},$d=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},qd=()=>({top:{style:Dd,color:{argb:Md}},left:{style:Dd,color:{argb:Md}},bottom:{style:Dd,color:{argb:Md}},right:{style:Dd,color:{argb:Md}}}),Kd=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},jd=()=>{const{prefixCls:e,pivotRef:n,columns:r,countMethod:l,summationData:i}=Id(),{t:a}=Gn(),{exportXLSX:o}=(()=>{const{size:e}=Id(),{t:t}=Gn(),{rowHeightMaps:n}=as,r=(e,t)=>{var n,r,l;return null!==(l=null!==(r=null===(n=e.find((e=>e.text==t)))||void 0===n?void 0:n.value)&&void 0!==r?r:t)&&void 0!==l?l:""};return{exportXLSX:(r,l,i,a)=>hn(void 0,void 0,void 0,(function*(){const{columns:o,footSummation:s}=r,c=n[e],d=Ji(o),u=[],m=[],p=[];let h=0;const f={};d.forEach((e=>{const{dataIndex:t,width:n,renderWidth:r}=e;f[t]=Ia(e.title),p.push({key:t,width:(n||r)/8})})),u.push(f),h+=u.length;const g=l.map(((e,t)=>{const n={};return d.forEach(((r,l)=>{const i=["percent","finance"].includes(r.formatType);n[r.dataIndex]=i?ya(e,r.dataIndex):a(e,t,r,l)})),n._level=e._level,n._groupLevel=e._groupLevel,n}));h+=g.length,s&&i(d,l).forEach(((e,n)=>{const r={};d.forEach(((n,i)=>{const{dataIndex:a,summation:o}=n,s=(null==o?void 0:o.render)?o.render(l):ya(e,a);r[a]=0===i&&""===s?t("qm.table.config.summaryText"):gn(s)?Ia(s):s})),m.push(r)}));const{sheetName:v,useStyle:y}=r,b=new Qt.Workbook,x=b.addWorksheet(v);x.columns=p,x.addRows(u).forEach((e=>{y&&Hd(e,c),e.eachCell((e=>{const t=x.getColumn(e.col),n=la(o,t.key),{align:r,theadAlign:l}=n;$d(e,l||r),y&&Object.assign(e,{font:{bold:!0,color:{argb:Fd}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:qd()})}))})),x.addRows(g).forEach(((e,t)=>{const{_level:n,_groupLevel:r}=g[t];y&&Hd(e,c),e.eachCell(((e,t)=>{const l=x.getColumn(e.col),i=la(o,l.key),{align:a}=i;$d(e,1===t||void 0===r?a:"right"),Object.assign(e,Kd(i)),y&&Object.assign(e,{font:{color:{argb:Fd}},border:qd()}),1===Number(e.col)&&n&&(e.alignment=Object.assign(Object.assign({},e.alignment),{indent:n}))}))})),s&&x.addRows(m).forEach((e=>{y&&Hd(e,c),e.eachCell(((e,t)=>{const n=x.getColumn(e.col),r=la(o,n.key),{align:l}=r;$d(e,1===t?l:"right"),Object.assign(e,Kd(r)),y&&Object.assign(e,{font:{color:{argb:Fd}},border:qd()})}))})),[].forEach((({s:e,e:t})=>{x.mergeCells(e.r+1,e.c+1,t.r+1,t.c+1)}));const E=yield b.xlsx.writeBuffer();return new Blob([E],{type:"application/octet-stream"})})),importXLSX:(e,n)=>{const{columns:l,file:i}=e,a=Ji(l),o=new FileReader;o.onerror=()=>{ne.error(t("qm.table.import.error"))},o.onload=e=>{const l=a.map((e=>Ia(e.title))),i=new Qt.Workbook,o=e.target;o?i.xlsx.load(o.result).then((e=>{const i=e.worksheets[0];if(i){const e=i.getSheetValues(),o=e.findIndex((e=>e&&e.length>0)),s=e[o],c=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(l,s);if(c){const t=e.slice(o+1).map((e=>{const t={};e.forEach(((e,n)=>{var r;let l=e;Array.isArray(null==l?void 0:l.richText)&&(l=l.richText.map((e=>e.text)).join("")),f(l)&&"text"in l&&(l=l.text),A(l)&&(l=Na(l,Go)),(null==l?void 0:l.formula)&&(l=null!==(r=l.result)&&void 0!==r?r:l.value),t[s[n]]=l}));const n={};return l.forEach(((e,l)=>{var i;const{dataIndex:o,dictItems:s}=a[l];Array.isArray(s)&&((null===(i=t[e])||void 0===i?void 0:i.toString().includes(","))?t[e]=t[e].split(",").map((e=>r(s,e))).filter((e=>""!==e)):t[e]=r(s,t[e])),ba(n,o,t[e])})),n}));null==n||n(t)}else ne.error(t("qm.table.import.error"))}else ne.error(t("qm.table.import.error"))})):ne.error(t("qm.table.import.error"))},o.readAsArrayBuffer(i)}}})(),{getTitleFromCellValue:s}=fs(),c=[{text:a("qm.pivotGrid.count.records"),value:"count"},{text:a("qm.pivotGrid.count.unique"),value:"unique"},{text:a("qm.pivotGrid.count.empty"),value:"empty"},{text:a("qm.pivotGrid.count.notEmpty"),value:"notEmpty"},{text:a("qm.pivotGrid.count.sum"),value:"sum"},{text:a("qm.pivotGrid.count.max"),value:"max"},{text:a("qm.pivotGrid.count.min"),value:"min"},{text:a("qm.pivotGrid.count.avg"),value:"avg"}],d={columns:ea(r),fileName:p().format(Yo),fileType:"xlsx",sheetName:"sheet1",footSummation:!1,useStyle:!1},u=(e,t,n,r)=>{const{dataIndex:l,precision:i,formatType:a,outputRender:o}=n;if(bd(e))return ya(e,l);if(o)return o(ya(e,l),e,n,t,r);let c=s(e,n,t,r);return i>=0&&!a&&""!==c&&(c=Number(c)),c},m=()=>{if(!l||!Object.keys(l).length)return[];const e={};return d.columns.map((e=>e.dataIndex)).forEach(((t,n)=>{if(n>0){let n="";(null==l?void 0:l[t])&&(n=c.find((e=>e.value===l[t])).text+" "+i.total[t]),ba(e,t,n)}})),[e]},h=e=>hn(void 0,void 0,void 0,(function*(){const t=yield o(Object.assign(Object.assign({},d),{footSummation:!!Object.keys(l).length}),e,m,u);wi(t,`${p().format(Yo)}.xlsx`)})),g=[{key:"1",label:t.createElement(t.Fragment,null,t.createElement(ut,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.group")),onClick:()=>{h((()=>{const e=[];let t=0;return n.current.flatGroupData.forEach((n=>{const a=Object.assign({},n);bd(n)?(a._level=n._groupLevel,d.columns.map((e=>e.dataIndex)).forEach(((e,t)=>{if(0===t){const t=r.find((e=>e.dataIndex===n._fieldName)),l=t.outputRender?t.outputRender(ya(n._record,t.dataIndex),n._record,t,0,0):s(n._record,t,0,0);ba(a,e,l)}else{let t="";(null==l?void 0:l[e])&&(t=c.find((t=>t.value===l[e])).text+" "+xd(i,n.id).subtotal[e]),ba(a,e,t)}})),t=n._groupLevel):t>0&&(a._level=n._level+t+1),e.push(a)})),e})())}},{key:"2",label:t.createElement(t.Fragment,null,t.createElement(mt,{style:{marginRight:4}})," ",a("qm.pivotGrid.export.list")),onClick:()=>{h(Array.from(n.current.keyRecordMap.values()))}}];return t.createElement(me,{trigger:["click"],menu:{items:g},className:Pe("action-btn"),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:140}},t.createElement("span",null,t.createElement(Ke,{className:"icon"}),a("qm.pivotGrid.export.text")))},Vd=()=>{const{prefixCls:e,pivotRef:n,groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o,setContext:s}=Id(),{uniqueKey:c}=n.current.props,{t:d}=Gn(),u=t.useMemo((()=>c?`grid_conf_${c}`:""),[c]),m=t.useRef({}),[h,f]=t.useState([]),[g,v]=t.useState({}),[y,b]=t.useState(""),x=(e,t)=>{v((n=>Object.assign({},n,{[e]:null!=t?t:!n[e]})))};t.useLayoutEffect((()=>{E()}),[]),Dl((()=>{w()}),[h]);const E=()=>hn(void 0,void 0,void 0,(function*(){try{if(!u)return;const e=yield Zt.getItem(u);Array.isArray(e)&&(f(e),v(e.reduce(((e,t)=>(t.id&&(e[t.id]=!1),e)),{})))}catch(e){}})),w=()=>hn(void 0,void 0,void 0,(function*(){try{if(!u)return;yield Zt.setItem(u,h)}catch(e){}})),C=()=>{const e=Ta();f([{id:e,label:p().format(Yo),value:{groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o}},...h]),En((()=>x(e,!0)))},S=()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"label",style:{padding:"6px 15px 10px"}},t.createElement("span",null,d("qm.pivotGrid.saved.title"))),t.createElement("div",{className:"list"},t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.id,className:Pe("ant-dropdown-menu-item sort-item",{active:e.id===y}),onClick:()=>(e=>{if(g[e.id])return;const t=y!==e.id,n=t?e.value:m.current;s({groupList:n.groupList,filterList:n.filterList,sorterList:n.sorterList,colorList:n.colorList,countMethod:n.countMethod}),b(t?e.id:"")})(e)},t.createElement("div",{className:"label",style:{width:200}},g[e.id]?t.createElement(re,{size:"small",autoFocus:!0,defaultValue:e.label,style:{width:"100%",marginLeft:-8},onBlur:t=>{const{value:n}=t.target;n!==e.label&&(e.label=n,f([...h])),x(e.id,!1)}}):t.createElement("span",null,e.label)),t.createElement("button",{className:"button-icon",onClick:t=>{t.stopPropagation(),x(e.id)}},g[e.id]?t.createElement($e,null):t.createElement(He,null)),t.createElement("button",{className:"button-icon",style:{marginLeft:4},onClick:t=>{var n;t.stopPropagation(),n=e.id,f(h.filter((e=>e.id!==n)))}},t.createElement(lt,null))))))),t.createElement("div",{className:"add-record",style:{padding:10}},t.createElement("span",{className:"insert",onClick:C},t.createElement(rt,{className:"icon"}),d("qm.pivotGrid.saved.add"))));return t.createElement(me,{trigger:["click"],dropdownRender:()=>S(),className:"action-btn",overlayClassName:`${e}__popper`,placement:"bottomRight",overlayStyle:{minWidth:280},onOpenChange:e=>{var t;t=e?{groupList:r,filterList:l,sorterList:i,colorList:a,countMethod:o}:{},m.current=t}},t.createElement("span",null,t.createElement(pt,{className:"icon"}),d("qm.pivotGrid.saved.text")))},zd=()=>{const{gridData:e}=Id(),{t:n}=Gn();return t.createElement("div",{className:"alert-info"},t.createElement(ht,{className:"icon"}),n("qm.table.alert.total",{total:(()=>{let t=0;return function e(n){n.forEach((n=>{Array.isArray(n.children)&&e(n.children),t+=1}))}(e),t})()}))},Wd=8;const Bd={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},Ud={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"]}},Gd=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Yd(e){const{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:l,borderRadius:i,visibleFirst:a}=e,o=t/2,s={};return Object.keys(Bd).forEach((e=>{const c=r&&Ud[e]||Bd[e],d=Object.assign(Object.assign({},c),{offset:[0,0],dynamicInset:!0});switch(s[e]=d,Gd.has(e)&&(d.autoArrow=!1),e){case"top":case"topLeft":case"topRight":d.offset[1]=-o-l;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=o+l;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-o-l;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=o+l}const u=function(e){const{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?Wd:r}}({contentRadius:i,limitVerticalRadius:!0});if(r)switch(e){case"topLeft":case"bottomLeft":d.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":d.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":d.offset[1]=2*-u.arrowOffsetHorizontal+o;break;case"leftBottom":case"rightBottom":d.offset[1]=2*u.arrowOffsetHorizontal-o}d.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};const l=r&&"object"==typeof r?r:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+n,i.shiftX=!0,i.adjustX=!0}const a=Object.assign(Object.assign({},i),l);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,u,t,n),a&&(d.htmlRegion="visibleFirst")})),s}const Xd=e=>{const{value:n,defaultValue:r,disabled:l,disabledAlpha:i,className:a,style:o,onChange:s,onChangeComplete:c}=e,[d,u]=is("",{value:n,defaultValue:r}),m=e=>({hex:e.toHexString(),rgb:e.toRgbString(),hsb:e.toHsbString()}),p=Yd({offset:0,arrowWidth:16,borderRadius:6}),h=rr("color-picker");return t.createElement(Jt,{action:["click"],prefixCls:h,popupPlacement:"bottomLeft",builtinPlacements:p,popup:()=>t.createElement(en,{prefixCls:h,value:d,disabled:l,disabledAlpha:i,onChange:(e,t)=>{u(e.toRgbString()),null==s||s(m(e),t)},onChangeComplete:(e,t)=>{null==c||c(m(e),t)}})},t.createElement("div",{className:Pe(`${h}-btn`,a),style:o},t.createElement(tn,{color:d,prefixCls:h})))};Xd.displayName="ColorPicker";const Qd=()=>{const{prefixCls:e,pivotRef:n,getRowKey:r,columns:l,colorList:i,setColorList:a,setFillColor:o}=Id(),{flatGroupData:s}=n.current,{t:c}=Gn(),d=t.useRef([]),u=t.useMemo((()=>i.filter((e=>e.fieldName&&e.color&&(Ha(e.expression)||!Cn(e.value)||"col"===e.mode)))),[i]),m=t.useMemo((()=>l.filter((e=>![as.operationColumn].includes(e.dataIndex))).map((e=>({label:Ia(e.title),value:e.dataIndex})))),[l]),p=t.useMemo((()=>vd(l)),[l]),h=[{label:c("qm.pivotGrid.fillColor.cell"),value:"cell"},{label:c("qm.pivotGrid.fillColor.row"),value:"row"},{label:c("qm.pivotGrid.fillColor.col"),value:"col"}];Dl((()=>{f()}),[t.useMemo((()=>{const e=u.map((e=>{var t;return{[e.color]:`${e.mode},${e.fieldName},${e.expression},${null!==(t=e.value)&&void 0!==t?t:""}`}}));return C(e,d.current)?d.current:(d.current=e,e)}),[u])]);const f=ci((()=>{const e=[];u.forEach((t=>{const n=Oa([Object.assign(Object.assign({},Nn(t,["value"])),{condition:t.value})]),l=Zi(s.filter((e=>!bd(e))),"col"!==t.mode?n:"");if("cell"===t.mode||"col"===t.mode)for(let n=0;n<l.length;n++)e.push({color:t.color,rowKey:r(l[n],l[n].index),dataIndex:t.fieldName});if("row"===t.mode)for(let n=0;n<l.length;n++){const i=r(l[n],l[n].index);for(let n=0;n<p.length;n++)e.push({color:t.color,rowKey:i,dataIndex:p[n].dataIndex})}})),o(e)}),200),g=()=>{a([...i,{type:"",bracketLeft:"",fieldName:"",expression:"",value:null,bracketRight:"",logic:"and",color:"",mode:"cell"}])},v=(e,t,n)=>{var r;if(Object.assign(t,{[e]:n}),"fieldName"===e){const e=(null===(r=l.find((e=>e.dataIndex===n)).filter)||void 0===r?void 0:r.type)||"text";Object.assign(t,{type:e,expression:y(e)[0].value,value:""})}"expression"===e&&Ha(n)&&Object.assign(t,{value:""}),a([...i])},y=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",label:c("qm.table.highSearch.gtText")},{value:"<",label:c("qm.table.highSearch.ltText")},{value:">=",label:c("qm.table.highSearch.gteText")},{value:"<=",label:c("qm.table.highSearch.lteText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",label:c("qm.table.highSearch.inText")},{value:"nin",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",label:c("qm.table.highSearch.inText")},{value:"nlike",label:c("qm.table.highSearch.ninText")},{value:"==",label:c("qm.table.highSearch.eqText")},{value:"!=",label:c("qm.table.highSearch.neqText")},{value:"^=",label:c("qm.table.highSearch.startsWithText")},{value:"=$",label:c("qm.table.highSearch.endsWithText")},{value:"nil",label:c("qm.table.highSearch.nullText")},{value:"nnil",label:c("qm.table.highSearch.notNullText")}]}return t},b=e=>t.createElement(t.Fragment,null,t.createElement(Be,{className:"icon handle"}),t.createElement(Xd,{defaultValue:e.color,style:{marginLeft:5},onChangeComplete:t=>v("color",e,t.hex)}),t.createElement(de,{value:e.mode,options:h,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:90,marginLeft:10,marginRight:20},onChange:t=>v("mode",e,t)}),t.createElement(de,{value:e.fieldName||void 0,options:m,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>v("fieldName",e,t)}),"col"!==e.mode&&t.createElement(de,{value:e.expression||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),options:y(e.type),style:{width:100,margin:"0 10px"},onChange:t=>v("expression",e,t)}),"col"!==e.mode&&(e=>{var n,r;switch(e.type){case"number":return t.createElement(pe,{defaultValue:e.value,style:{width:150},onChange:t=>{v("value",e,Cn(t)?"":t)}});case"date":return t.createElement(Kn,{popupClassName:as.popupClassName,defaultValue:null!==(n=Sa(e.value,"YYYY-MM-DD"))&&void 0!==n?n:void 0,picker:"date",allowClear:!0,style:{width:150},onChange:t=>{v("value",e,Na(t,"YYYY-MM-DD"))}});case"checkbox":case"radio":{const n=(null===(r=l.find((t=>t.dataIndex===e.fieldName)))||void 0===r?void 0:r.dictItems)||[];return t.createElement(de,{mode:"checkbox"===e.type?"multiple":void 0,defaultValue:e.value||void 0,placeholder:c("qm.table.editable.selectPlaceholder"),style:{width:150},onChange:t=>{v("value",e,t)}},n.map((e=>t.createElement(de.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))}default:return t.createElement(re,{value:e.value,style:{width:150},disabled:Ha(e.expression),onChange:t=>{v("value",e,t.target.value)}})}})(e),t.createElement(lt,{className:"icon close",onClick:()=>(e=>{a(i.filter((t=>t!==e)))})(e)}));return t.createElement(me,{trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container")},t.createElement("div",{className:"label"},t.createElement("span",null,c("qm.pivotGrid.fillColor.title"))),t.createElement("div",{className:"list"},t.createElement(Yt,{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));C(t,n)||a(e)}},i.map(((e,n)=>t.createElement("li",{key:`${e.fieldName}-${n}`,className:"item"},b(e)))))),t.createElement("div",{className:"add-record"},t.createElement("span",{className:"insert",onClick:g},t.createElement(rt,{className:"icon"}),c("qm.pivotGrid.fillColor.add")))),className:Pe("action-btn",{active:!!u.length}),overlayClassName:`${e}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:300}},t.createElement("span",null,t.createElement(ft,{className:"icon"}),c("qm.pivotGrid.fillColor.text"),u.length?`(${u.length})`:null))},Zd=()=>t.createElement("div",{className:"top-bar"},t.createElement(nr,{size:4},t.createElement(zd,null),t.createElement(he,{type:"vertical"}),t.createElement(Pd,null),t.createElement(Rd,null),t.createElement(Od,null),t.createElement(kd,null),t.createElement(he,{type:"vertical"}),t.createElement(Qd,null),t.createElement(_d,null),t.createElement(Ld,null),t.createElement(he,{type:"vertical"}),t.createElement(jd,null)),t.createElement(nr,{size:4},t.createElement(Vd,null))),Jd=t.createContext(void 0),eu=e=>{var n,r;const{scrollbar:l}=e,{pivotRef:i,getRowKey:a,columns:o,groupGridData:s,setPivotGridRef:c}=Id(),{rowSelection:d,treeExpandable:u,rowHighlight:m}=i.current.props,p=null===(n=null==u?void 0:u.defaultExpandAllRows)||void 0===n||n,h=t.useRef({bodyEl:null,rowVirtualizer:null}),[f,g]=t.useState({gridRef:h,scrollbarRef:l,selectionKeys:null!==(r=null==d?void 0:d.defaultSelectedRowKeys)&&void 0!==r?r:[],treeExpandKeys:p?ca(i.current.originGridData,(e=>a(e,e.index))):[],highlightKey:"",checkedColumnKey:"",clicked:[],isPingLeft:!1}),v=t.useMemo((()=>Math.max(0,Ed(s)-1)),[s]),y=t.useMemo((()=>vd(o)),[o]),b=t.useMemo((()=>y.filter((e=>"left"===e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth||0)),0)+v*gd.indentWidth),[v,y]),x=e=>{g((t=>{const n=Object.assign({},t);let r=!1;return Object.keys(e).forEach((l=>{const i=l;Object.is(t[i],e[i])||(n[i]=e[i],r=!0)})),r?n:t}))},E=(e,t)=>{f.gridRef.current[e]=t};t.useLayoutEffect((()=>{R()}),[o]),t.useLayoutEffect((()=>{(null==d?void 0:d.selectedRowKeys)&&x({selectionKeys:d.selectedRowKeys})}),[null==d?void 0:d.selectedRowKeys]),t.useLayoutEffect((()=>{void 0!==(null==m?void 0:m.currentRowKey)&&x({highlightKey:m.currentRowKey})}),[null==m?void 0:m.currentRowKey]);const w=e=>{Array.isArray(null==d?void 0:d.selectedRowKeys)||x({selectionKeys:e})},C=e=>{x({treeExpandKeys:e})},S=e=>{void 0===(null==m?void 0:m.currentRowKey)&&x({highlightKey:e})},N=e=>{x({checkedColumnKey:e})},T=e=>{Da(e,f.clicked,!0)||x({clicked:e})},I=e=>{x({isPingLeft:e})},R=()=>{const e=l.current.container.clientWidth,{defaultColumnWidth:t}=as,n=[];let r=0;if(o.forEach((e=>{"number"==typeof e.width?(e.renderWidth=e.width,r+=e.width):(e.renderWidth=void 0,n.push(e))})),n.length>0){const r=o.reduce(((e,n)=>e+(n.width||n.minWidth||t)),0);if(r<=e){const l=e-r;if(1===n.length)n[0].renderWidth=(n[0].minWidth||t)+l;else{const e=l/n.reduce(((e,n)=>e+(n.minWidth||t)),0);let r=0;n.forEach(((n,l)=>{if(0===l)return;const i=Math.floor((n.minWidth||t)*e);r+=i,n.renderWidth=(n.minWidth||t)+i})),n[0].renderWidth=(n[0].minWidth||t)+l-r}}else n.forEach((e=>{e.renderWidth=e.minWidth||t}))}else r=o.reduce(((e,n)=>e+(n.renderWidth=n.width||n.minWidth||t)),0)},O=t.useMemo((()=>Object.assign(Object.assign({},f),{indentDepth:v,fixedWidth:b,gridColumns:y,setContext:x,setGridLayoutRef:E,setSelectionKeys:w,setTreeExpandKeys:C,setHighlightKey:S,setCheckColumnKey:N,setClicked:T,setPingLeft:I,updateColumnsWidth:R})),[f,v,y]);return t.createElement(Jd.Provider,{value:O},e.children)},tu=()=>t.useContext(Jd),nu=e=>{var n;const{column:r}=e,{pivotRef:l,columns:i,setColumns:a}=Id(),{scrollbarRef:o}=tu(),{onColumnsChange:s}=l.current.props,c=t.useRef(null),[d,u]=t.useState(!1),m=t.useRef(document.onselectstart),p=t.useRef({startX:0,originSizeX:0,columnWidth:0}),h=e=>{p.current=Object.assign({},p.current,e)},f=e=>{if(1!==e.buttons)return g();const t=e.clientX-p.current.startX,n=(r.width||r.renderWidth)+t;n<(r.minWidth||as.defaultColumnWidth)||(h({columnWidth:n}),c.current.style.left=`${p.current.originSizeX+t}px`)},g=()=>{o.current.container.classList.remove("col-resize"),r.width=p.current.columnWidth;const e=[...i];s?s(e):a(e),En((()=>u(!1))),Hl(document,"mousemove",f),Hl(document,"mouseup",g),h({startX:0,originSizeX:0,columnWidth:0}),v()},v=()=>{document.onselectstart!==m.current&&(document.onselectstart=m.current)};return t.createElement(t.Fragment,null,t.createElement("div",{className:"resize-bar",onMouseDown:e=>{e.preventDefault(),o.current.container.classList.add("col-resize");const t=fa(e.target,o.current.container).left-o.current.scrollLeft+3;h({startX:e.clientX,originSizeX:t,columnWidth:r.width||r.renderWidth||0}),Ml(document,"mousemove",f),Ml(document,"mouseup",g),u(!0),En((()=>c.current.style.left=`${t}px`)),m.current=document.onselectstart,document.onselectstart=()=>!1}}),t.createElement(Gt,{open:d,getContainer:null===(n=o.current)||void 0===n?void 0:n.container},t.createElement("div",{ref:c,className:"resize-line"})))},ru=e=>{var n;const{left:r}=e,{pivotRef:l,columns:i,setColumns:a}=Id(),{scrollbarRef:o,gridColumns:s,indentDepth:c,isPingLeft:d,setPingLeft:u}=tu(),{onColumnsChange:m}=l.current.props,{indentWidth:p}=gd,h=t.useRef(document.onselectstart),f=t.useRef({startX:0,originSizeX:0}),g=e=>{f.current=Object.assign({},f.current,e)},v=()=>{E(r),O(r)},[y,b]=t.useState(0),[x,E]=t.useState(r),[w,C]=t.useState(r),S=t.useRef(!1),N=e=>S.current=e;Dl((()=>{S.current||v()}),[r]);const T=e=>e.width||e.renderWidth||0,I=e=>s.slice(0,e).reduce(((e,t)=>e+T(t)),0)+c*p,R=e=>{let t=-1;for(let n=1;n<s.length;n++){const r=I(n-1)+T(s[n-1])/2,l=I(n)+T(s[n])/2;if(e>r&&e<l){I(n)<o.current.container.offsetWidth&&(t=n);break}}return t},O=Ri((e=>{const t=R(e);t<0||C(I(t))}),60);t.useEffect((()=>{const e=e=>u(e.target.scrollLeft>1),t=o.current.scrollElement;return t.addEventListener("scroll",e),Ml(t,"scroll",e),()=>Hl(t,"scroll",e)}),[]);const k=Yn((e=>{if(1!==e.buttons)return L();const t=e.clientX-f.current.startX,n=f.current.originSizeX+t;E(n),O(n)})),L=Yn((()=>{o.current.container.classList.remove("col-resize"),N(!1),(e=>{const t=R(e);if(t<0)return v();i.forEach(((e,n)=>{n<t-1?e.fixed="left":delete e.fixed})),E(I(t)),O(e),m?m([...i]):a([...i])})(x),Hl(document,"mousemove",k),Hl(document,"mouseup",L),g({startX:0,originSizeX:0}),A()})),A=()=>{document.onselectstart!==h.current&&(document.onselectstart=h.current)};return t.createElement(Gt,{open:!0,getContainer:null===(n=o.current)||void 0===n?void 0:n.container},t.createElement("div",{className:Pe("fixed-line",{leave:d}),style:{left:r}}),t.createElement("div",{className:Pe("fixed-bar",{active:S.current}),style:{left:x},onMouseMove:e=>{const{top:t,height:n}=e.target.getBoundingClientRect(),r=e.clientY-t;let l=Math.max(0,r-16);l=Math.min(l,n-32),b(l)},onMouseDown:e=>{e.preventDefault(),o.current.container.classList.add("col-resize"),o.current.SET_SCROLL_LEFT(0),N(!0),g({startX:e.clientX,originSizeX:e.target.offsetLeft}),Ml(document,"mousemove",k),Ml(document,"mouseup",L),h.current=document.onselectstart,document.onselectstart=()=>!1}},t.createElement("span",{className:"thumb",style:{top:y}})),S.current&&t.createElement("div",{className:"fixed-line active",style:{left:w}}))},lu=()=>{const{pivotRef:e}=Id(),{indentDepth:n,fixedWidth:r,gridColumns:l,checkedColumnKey:i,selectionKeys:a,setSelectionKeys:o,setCheckColumnKey:s}=tu(),{rowSelection:c}=e.current.props,{selectionColumn:d}=as,{indentWidth:u,selectionColumnDefine:m}=gd,p=t.useMemo((()=>l.filter((e=>"left"===e.fixed))),[l]),h=t.useMemo((()=>l.filter((e=>"left"!==e.fixed))),[l]),f=t.useMemo((()=>"radio"!==(null==c?void 0:c.type)),[c]),g=t.useMemo((()=>a.length>0&&a.length===e.current.keyRecordMap.size),[a]),v=t.useMemo((()=>a.length>0&&a.length<e.current.keyRecordMap.size),[a]),y=(l,a)=>t.createElement("div",{className:Pe(a?"fixed-left":"no-fixed"),style:{width:a?r:""}},l.map(((r,p)=>{const{dataIndex:h,title:y,align:b,width:x,renderWidth:E}=r,w={"selection-column":h===d,"col--center":"center"===b,"col--right":"right"===b,"col--checked":i===h},C=p===(a?l.length>1?1:0:l.length-1)?n*u:0,S={width:`${(x||E||0)+C}px`,minWidth:`${(x||E||0)+C}px`};return t.createElement("div",{key:h,className:Pe("table-cell",w),title:Ia(y),style:S,onClick:()=>{return e=h,void([m.dataIndex,as.operationColumn].includes(e)||s(i!==e?e:""));var e}},h!==d?t.createElement("span",{className:"cell"},y):c&&f?t.createElement(ue,{checked:g,indeterminate:v,onChange:t=>(t=>{var n;const r=t?Array.from(e.current.keyRecordMap.keys()):[];o(r),null===(n=null==c?void 0:c.onChange)||void 0===n||n.call(c,r,t?Array.from(e.current.keyRecordMap.values()):[])})(t.target.checked)}):"#",h!==d&&t.createElement(nu,{column:r}))})));return t.createElement("div",{className:"header"},y(p,!0),y(h),t.createElement(ru,{left:r}))};function iu(e,t,n){var r;let l,i=null!==(r=n.initialDeps)&&void 0!==r?r:[];function a(){var r,a,o,s,c;let d;n.key&&(null===(r=n.debug)||void 0===r?void 0:r.call(n))&&(d=Date.now());const u=e(),m=u.length!==i.length||u.some(((e,t)=>i[t]!==e));if(!(null===(a=n.noCache)||void 0===a?void 0:a.call(n))&&!m)return l;let p;if(i=u,n.key&&(null===(o=n.debug)||void 0===o?void 0:o.call(n))&&(p=Date.now()),l=t(...u),n.key&&(null===(s=n.debug)||void 0===s?void 0:s.call(n))){const e=Math.round(100*(Date.now()-d))/100,t=Math.round(100*(Date.now()-p))/100,r=t/16,l=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${l(t,5)} /${l(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return null===(c=null==n?void 0:n.onChange)||void 0===c||c.call(n,l),l}return a.updateDeps=e=>{i=e},a}function au(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const ou=(e,t,n)=>{let r;return function(...l){e.clearTimeout(r),r=e.setTimeout((()=>t.apply(this,l)),n)}},su=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},cu=e=>e,du=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},uu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const l=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(l(su(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver((t=>{const r=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void l({width:t.inlineSize,height:t.blockSize})}l(su(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()}));return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},mu={passive:!0},pu="undefined"==typeof window||"onscrollend"in window,hu=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let l=0;const i=e.options.useScrollendEvent&&pu?()=>{}:ou(r,(()=>{t(l,!1)}),e.options.isScrollingResetDelay),a=r=>()=>{const{horizontal:a,isRtl:o}=e.options;l=a?n.scrollLeft*(o?-1:1):n.scrollTop,i(),t(l,r)},o=a(!0),s=a(!1);s(),n.addEventListener("scroll",o,mu);const c=e.options.useScrollendEvent&&pu;return c&&n.addEventListener("scrollend",s,mu),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",s)}},fu=(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 e[n.options.horizontal?"offsetWidth":"offsetHeight"]},gu=(e,{adjustments:t=0,behavior:n},r)=>{var l,i;const a=e+t;null===(i=null===(l=r.scrollElement)||void 0===l?void 0:l.scrollTo)||void 0===i||i.call(l,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class vu{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,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=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()}))})):null);return{disconnect:()=>{var n;null===(n=t())||void 0===n||n.disconnect(),e=null},observe:e=>{var n;return null===(n=t())||void 0===n?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null===(n=t())||void 0===n?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach((([t,n])=>{void 0===n&&delete e[t]})),this.options=Object.assign({debug:!1,noCache:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:cu,rangeExtractor:du,onChange:()=>{},measureElement:fu,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1},e)},this.notify=e=>{var t,n;null===(n=(t=this.options).onChange)||void 0===n||n.call(t,this,e)},this.maybeNotify=iu((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(e=>{this.notify(e)}),{key:"maybeNotify",noCache:()=>this.options.noCache,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((e=>e())),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e,t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n)return void this.maybeNotify();this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=null!==(t=null===(e=this.scrollElement)||void 0===e?void 0:e.window)&&void 0!==t?t:null,this.elementsCache.forEach((e=>{this.observer.observe(e)})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,(e=>{this.scrollRect=e,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()})))}},this.getSize=()=>{var e;return this.options.enabled?(this.scrollRect=null!==(e=this.scrollRect)&&void 0!==e?e:this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=null!==(e=this.scrollOffset)&&void 0!==e?e:"function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let l=t-1;l>=0;l--){const t=e[l];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort(((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end))[0]:void 0},this.getMeasurementOptions=iu((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((e,t,n,r,l)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:l})),{key:!1}),this.getMeasurements=iu((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:l},i)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((e=>{this.itemSizeCache.set(e.key,e.size)})));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,a);for(let l=a;l<e;l++){const e=r(l),a=1===this.options.lanes?o[l-1]:this.getFurthestMeasurement(o,l),s=a?a.end+this.options.gap:t+n,c=i.get(e),d="number"==typeof c?c:this.options.estimateSize(l),u=s+d,m=a?a.lane:l%this.options.lanes;o[l]={index:l,start:s,size:d,end:u,key:e,lane:m}}return this.measurementsCache=o,o}),{key:"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=iu((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const l=e.length-1,i=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:l};let a=yu(0,l,i,n),o=a;if(1===r)for(;o<l&&e[o].end<n+t;)o++;else if(r>1){const i=Array(r).fill(0);for(;o<l&&i.some((e=>e<n+t));){const t=e[o];i[t.lane]=t.end,o++}const s=Array(r).fill(n+t);for(;a>=0&&s.some((e=>e>=n));){const t=e[a];s[t.lane]=t.start,a--}a=Math.max(0,a-a%r),o=Math.min(l,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null),{key:"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=iu((()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]}),((e,t,n,r,l)=>null===r||null===l?[]:e({startIndex:r,endIndex:l,overscan:t,count:n,offset:this.getScrollOffset()})),{key:"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const l=r.key,i=this.elementsCache.get(l);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(l,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 l=t-(null!==(n=this.itemSizeCache.get(r.key))&&void 0!==n?n:r.size);0!==l&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,l,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(this.options.debug&&console.info("correction",l),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,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=iu((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((e,t)=>{const n=[];for(let r=0,l=e.length;r<l;r++){const l=t[e[r]];n.push(l)}return n}),{key:"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return au(t[yu(0,t.length-1,(e=>au(t[e]).start),e)])},this.getOffsetForAlignment=(e,t,n=0)=>{const r=this.getSize(),l=this.getScrollOffset();"auto"===t&&(t=e>=l+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const i=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(i,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(),l=this.getScrollOffset();if("auto"===t)if(n.end>=l+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=l+this.options.scrollPaddingStart))return[l,t];t="start"}const i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:t="start",behavior:n}={})=>{"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}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const l=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[l,a]=r;this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame((()=>{const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,a);var r,l;n?(r=n[0],l=t,Math.abs(r-l)<1.01||i(a)):console.warn("Failed to get offset for index:",e)}))},i=t=>{this.targetWindow&&(r++,r<10?(this.options.debug&&console.info("Schedule retry",r,10),this.targetWindow.requestAnimationFrame((()=>l(t)))):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};l(t)},this.scrollBy=(e,{behavior:t}={})=>{"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;if(0===n.length)r=this.options.paddingStart;else if(1===this.options.lanes)r=null!==(t=null===(e=n[n.length-1])||void 0===e?void 0:e.end)&&void 0!==t?t:0;else{const e=Array(this.options.lanes).fill(null);let t=n.length-1;for(;t>=0&&e.some((e=>null===e));){const r=n[t];null===e[r.lane]&&(e[r.lane]=r.end),t--}r=Math.max(...e.filter((e=>null!==e)))}return 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 yu=(e,t,n,r)=>{for(;e<=t;){const l=(e+t)/2|0,i=n(l);if(i<r)e=l+1;else{if(!(i>r))return l;t=l-1}}return e>0?e-1:0};const bu="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function xu(t){return function(t){const n=e.useReducer((()=>({})),{})[1],r=Object.assign(Object.assign({},t),{onChange:(e,r)=>{var l;r?Ht(n):n(),null===(l=t.onChange)||void 0===l||l.call(t,e,r)}}),[l]=e.useState((()=>new vu(r)));return l.setOptions(r),bu((()=>l._didMount()),[]),bu((()=>l._willUpdate())),l}(Object.assign({observeElementRect:uu,observeElementOffset:hu,scrollToFn:gu},t))}const Eu=e=>(e=>null!=e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE)(e)?e.ownerDocument:document,wu=(e,t)=>!t.map((e=>Array.from(document.querySelectorAll(e)))).flat().some((t=>null==t?void 0:t.contains(e.target))),Cu=(e,t)=>{var n;const r=e.target;return!("button"in e&&e.button>0)&&(!(r&&!Eu(r).contains(r))&&!(null===(n=t.current)||void 0===n?void 0:n.contains(r)))};function Su({ref:t,handler:n,enabled:r=!0,omitClassNames:l=[]}){const i=Yn(n),a=e.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1});e.useEffect((()=>{if(!r)return;const e=e=>{Cu(e,t)&&(a.current.isPointerDown=!0)},o=e=>{a.current.ignoreEmulatedMouseEvents?a.current.ignoreEmulatedMouseEvents=!1:n&&a.current.isPointerDown&&Cu(e,t)&&wu(e,l)&&(a.current.isPointerDown=!1,i(e))},s=e=>{a.current.ignoreEmulatedMouseEvents=!0,n&&a.current.isPointerDown&&Cu(e,t)&&wu(e,l)&&(a.current.isPointerDown=!1,i(e))},c=Eu(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,i,a,r])}const Nu=e=>{const{pivotRef:n,getRowKey:r,size:l}=Id(),{scrollbarRef:i,clicked:a,setHighlightKey:o,setClicked:s}=tu(),{flatGroupData:c}=n.current,{rowHighlight:d}=n.current.props,u=t.useMemo((()=>2*as.rowHeightMaps[l]),[l]),m=t.useMemo((()=>c.filter((e=>!bd(e)))),[c]),p=Yn((t=>{var n,l;const{keyCode:c}=t;if(!Cn(a)&&(27===c&&(o(""),s([])),38===c||40===c)){$l(t);const p=m.length;let h=m.findIndex((e=>r(e,e.index)===a[0]));const f=38===c?(--h+p)%p:++h%p,g=m[f],v=r(g,g.index);d&&!(null===(n=d.disabled)||void 0===n?void 0:n.call(d,g))&&(o(v),null===(l=d.onChange)||void 0===l||l.call(d,v,g)),((t,n,r)=>{const l=m.length,a=e.find((e=>e.key===r)),o=i.current.scrollTop,s=i.current.container.offsetHeight,c=a.top,d=a.height;"top"===t?c<o?i.current.SET_SCROLL_TOP(c):n===l-1&&i.current.SET_SCROLL_TOP(c-(s-d)):c+d>o+(s-u)?i.current.SET_SCROLL_TOP(c-(s-u-d)):0===n&&i.current.SET_SCROLL_TOP(c)})(38===c?"top":"bottom",f,v),s([v,a[1]])}}));t.useLayoutEffect((()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p))),[])},Tu=()=>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"})),Iu=()=>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"})),Ru=()=>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"})),Ou=()=>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"})),ku=()=>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"})),Lu=()=>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:"M512 680.20451555l354.04003555-354.04003556a48.54556445 48.54556445 0 0 1 68.64213334 68.64213334L546.32220445 783.16999111a48.54556445 48.54556445 0 0 1-68.64213334 0L89.31555555 394.80775111a48.54556445 48.54556445 0 0 1 68.64327112-68.64327112L512 680.20451555z"})),Au=e=>{const{column:n,keyPath:r,type:l}=e,{prefixCls:i,countMethod:a,summationData:o,setCountMethod:s}=Id(),{t:c}=Gn(),{dataIndex:d,filter:u}=n,[m,p]=t.useState(!1),h=t.useMemo((()=>{const e=[{text:c("qm.pivotGrid.count.records"),value:"count",fn:Sd.count},{text:c("qm.pivotGrid.count.unique"),value:"unique",fn:Sd.unique},{text:c("qm.pivotGrid.count.empty"),value:"empty",fn:Sd.empty},{text:c("qm.pivotGrid.count.notEmpty"),value:"notEmpty",fn:Sd.notEmpty},{text:c("qm.pivotGrid.count.sum"),value:"sum",fn:Sd.sum},{text:c("qm.pivotGrid.count.max"),value:"max",fn:Sd.max},{text:c("qm.pivotGrid.count.min"),value:"min",fn:Sd.min},{text:c("qm.pivotGrid.count.avg"),value:"avg",fn:Sd.avg}];return"number"===(null==u?void 0:u.type)?e:e.slice(0,-4)}),[]),f=t.useMemo((()=>{var e,t,n;const i=a[d];if(!i)return c("qm.pivotGrid.count.statistic");const s=h.find((e=>e.value===i)).text,u=null!==(n=null===(t=null===(e=((e,t)=>t?xd(e,t):e)(o,r))||void 0===e?void 0:e[l])||void 0===t?void 0:t[d])&&void 0!==n?n:"";return s+" "+wa(u)}),[o,a]);return t.createElement(me,{open:m,trigger:["click"],dropdownRender:()=>t.createElement("div",{className:Pe("ant-dropdown-menu","container"),style:{padding:5}},t.createElement("div",{className:"list"},h.map((e=>{const n=e.value===a[d];return t.createElement("li",{key:e.value,className:Pe("ant-dropdown-menu-item check-item",{active:n}),onClick:()=>{s({[d]:n?void 0:e.value}),p(!1)}},t.createElement("span",{className:"label"},e.text),t.createElement("i",{className:"icon"},t.createElement($e,null)))})))),className:Pe("count-select",{show:!!a[d]}),overlayClassName:`${i}__popper`,placement:"bottomRight",overlayStyle:{minWidth:140},onOpenChange:e=>p(e)},t.createElement("span",null,f," ",t.createElement(gt,{className:"icon"})))},Pu=(e,n)=>{const{pivotRef:r,columns:l,expandedKeys:i,searchResults:a,switchIndex:o,fillColorCells:s,setExpandedKeys:c}=Id(),{gridRef:d,indentDepth:u,highlightKey:m,checkedColumnKey:p,selectionKeys:h,treeExpandKeys:f,setSelectionKeys:g,setTreeExpandKeys:v,setHighlightKey:y,setClicked:b}=tu(),{keyRecordMap:x,isTree:E}=r.current,{bodyEl:w,rowVirtualizer:C}=d.current,{rowSelection:S,treeExpandable:N,rowHighlight:T,openRowDraggable:I,onRowEdit:R,onRowClick:O}=r.current.props,{t:k}=Gn(),{renderText:L,getTitleFromCellNode:A}=fs(),{expandableColumn:P,selectionColumn:_,operationColumn:F,treeTable:D}=as,{indentWidth:M}=gd,H=t.useMemo((()=>n?0:vd(l).length-e.length),[l,e]),$=t.useMemo((()=>"radio"!==(null==S?void 0:S.type)),[S]),q=(e,t)=>{var n,r;null==S||S.checkStrictly;const l=$?e?[...h,t]:h.filter((e=>e!==t)):[t];g(l),null===(n=null==S?void 0:S.onSelect)||void 0===n||n.call(S,e,x.get(t)),null===(r=null==S?void 0:S.onChange)||void 0===r||r.call(S,l,K(l))},K=e=>{const t=[];return e.forEach((e=>t.push(x.get(e)))),t},j=(e,t)=>{var n,r;return(null===(n=a[o])||void 0===n?void 0:n.rowKey)===e&&(null===(r=a[o])||void 0===r?void 0:r.dataIndex)===t},V=(e,t)=>{const n=w.querySelectorAll(`li.table-row[data-row-key='${e}']`);Array.from(n).forEach((e=>{e.classList[t&&!(null==C?void 0:C.isScrolling)?"add":"remove"]("row--hover")}))},z=e=>t.createElement("button",{className:Pe("button-icon",{expand:i.includes(e.id)}),onClick:()=>{return t=e.id,void c(i.includes(t)?i.filter((e=>e!==t)):[...i,t]);var t}},t.createElement(yt,null)),W=(r,i,a,o)=>{const{dataIndex:s,width:c,renderWidth:d}=r,m={"expandable-column":s===_},p=i===(n?e.length>1?1:0:-1)?(u-a._groupLevel)*M:0,h={width:`${(c||d||0)+p}px`,minWidth:`${(c||d||0)+p}px`};return t.createElement("div",{key:s,className:Pe("label-cell",m),style:h},s!==_?t.createElement(t.Fragment,null,1===i&&(e=>{const{_record:n,_fieldName:r}=e,i=ya(n,r),a=l.find((e=>e.dataIndex===r));if(Cn(i)||!a)return t.createElement("span",{className:"title empty"},k("qm.pivotGrid.group.empty"));const o=a.render?a.render(i,n,a,0,0):L(i,a,n);return a.translate?t.createElement(No,{text:A(o),tag:"span",className:"title"},o):t.createElement("span",{className:"title"},o)})(a),s!==F&&t.createElement(Au,{column:r,keyPath:a.id,type:"subtotal"})):z(a))},B=(e,n)=>{var r,l;const i=null===(r=null==N?void 0:N.rowExpandable)||void 0===r?void 0:r.call(N,e);return(null===(l=e.children)||void 0===l?void 0:l.length)?t.createElement("span",{className:Pe("cell--expand",{fold:!f.includes(n),disabled:i}),onClick:()=>{i||(e=>{var t,n;const r=f.includes(e),l=r?f.filter((t=>t!==e)):[...f,e];v(l),null===(t=null==N?void 0:N.onExpand)||void 0===t||t.call(N,!r,x.get(e)),null===(n=null==N?void 0:N.onChange)||void 0===n||n.call(N,l)})(n)}},t.createElement("span",{className:"anticon icon"},t.createElement(Lu,null))):t.createElement("span",{className:"cell--indent",style:{marginTop:-1,width:D.textIndent}})},U=(e,n,r,l,i)=>{var a,o;const{dataIndex:c,width:d,renderWidth:u,align:m,translate:f,render:g}=e,v=ya(r,c),x=g?g(v,r,e,r.index,n):L(v,e,r),w=((e,t)=>[P,_,F].includes(t)?"":A(e))(x,c),C=h.includes(i),N={"selection-column":c===_,"col--center":"center"===m,"col--right":"right"===m,"col--checked":p===c,active:j(i,c)},k={width:`${d||u||0}px`,minWidth:`${d||u||0}px`,backgroundColor:s.get(`${i}|${c}`)};return t.createElement("div",{key:c,"data-col-index":n,title:w,className:Pe("table-cell",N),style:k,onClick:t=>{var n,l;[_,F].includes(c)||(b([i,c]),T&&!(null===(n=T.disabled)||void 0===n?void 0:n.call(T,r))&&(y(i),null===(l=T.onChange)||void 0===l||l.call(T,i,r)),null==O||O(r,e,t))}},c!==_?t.createElement(t.Fragment,null,E&&1===n&&t.createElement(t.Fragment,null,(M=r._level)?t.createElement("span",{key:M,className:`cell--indent indent-level-${M}`,style:{marginTop:-1,width:M*D.textIndent}},new Array(M).fill(null).map(((e,n)=>t.createElement("i",{key:n,className:"line"})))):null,B(r,i)),f?t.createElement(No,{text:w,tag:"span",className:"cell"},x):t.createElement("span",{className:"cell"},x)):t.createElement("div",{className:"action"},I?t.createElement("span",{className:"drag-icon"},t.createElement(Be,null)):t.createElement("span",{style:{width:20}}),t.createElement("div",{className:"middle"},t.createElement("span",{className:"order"},((e,t)=>E?0===e._level?e._varIndex+1:null:t+1)(r,l)),S&&t.createElement(t.Fragment,null,$?t.createElement(ue,{className:"checkbox",checked:C,disabled:null===(a=null==S?void 0:S.disabled)||void 0===a?void 0:a.call(S,r),onChange:e=>q(e.target.checked,i)}):t.createElement(fe,{className:"checkbox",checked:C,disabled:null===(o=null==S?void 0:S.disabled)||void 0===o?void 0:o.call(S,r),onChange:e=>q(e.target.checked,i)}))),R?t.createElement("span",{className:"expand-icon",onClick:()=>R(r,l)},t.createElement(vt,null)):t.createElement("span",{style:{width:20}})));var M};return{renderGroupRow:(n,r)=>t.createElement("div",{className:"label-row"},e.map(((e,t)=>W(e,H+t,n)))),renderRow:(n,r,l)=>{const i={"row--selection":h.includes(l),"row--highlight":m===l};return t.createElement("li",{key:l,"data-row-key":l,className:Pe("table-row",i),onMouseEnter:()=>V(l,!0),onMouseLeave:()=>V(l)},e.map(((e,t)=>U(e,H+t,n,r,l))))}}},_u=e=>{const{layout:n,displayList:r,virtualRows:l,notGroup:i}=e,{fixedWidth:a,gridColumns:o}=tu(),s=t.useMemo((()=>o.filter((e=>"left"===e.fixed))),[o]),{renderGroupRow:c,renderRow:d}=Pu(s,!0);return t.createElement("div",{className:"left-panel",style:{width:a}},t.createElement("div",{className:Pe("container",{"no-group":i})},l.map((e=>{const l=e.index,i=n[l],a=r[l];if(bd(a))return t.createElement("div",{key:a.id,className:Pe("group-label",`level${a._groupLevel}`),style:{top:i.top,left:i.left,right:0,height:i.height}},c(a,i.key));const o=l===n.length-1||bd(r[l+1]);return t.createElement("div",{key:i.key,className:Pe("row-item",{"is-leaf":a._level,last:o}),style:{top:i.top,left:i.left,right:0,height:i.height}},d(a,a._varIndex,i.key))}))))},Fu=e=>{const{layout:n,displayList:r,virtualRows:l,notGroup:i}=e;Id();const{gridColumns:a}=tu(),o=t.useMemo((()=>a.filter((e=>"left"!==e.fixed))),[a]),{renderGroupRow:s,renderRow:c}=Pu(o);return t.createElement("div",{className:"main-panel"},t.createElement("div",{className:Pe("container",{"no-group":i})},l.map((e=>{const l=e.index,i=n[l],a=r[l];if(bd(a))return t.createElement("div",{key:a.id,className:Pe("group-label",`level${a._groupLevel}`),style:{top:i.top,left:0,right:i.right,height:i.height}},s(a,i.key));const o=l===n.length-1||bd(r[l+1]);return t.createElement("div",{key:i.key,className:Pe("row-item",{last:o}),style:{top:i.top,left:0,right:i.right,height:i.height}},c(a,a._varIndex,i.key))}))))},Du=()=>{const{pivotRef:e,getRowKey:n,prefixCls:r,size:l,groupGridData:i,expandedKeys:a,searchResults:o,switchIndex:s}=Id(),{scrollbarRef:c,gridColumns:d,treeExpandKeys:u,setGridLayoutRef:m}=tu(),{flatGroupData:p}=e.current,{contextMenues:h}=e.current.props,{groupMargin:f}=gd,{rowHeightMaps:g}=as,v=t.useRef(null),y=t.useMemo((()=>Array.isArray(i)),[i]),{contextMenu:b,closeMenu:x}=(({ref:e,popup:n,getTriggerContainer:r,prevent:l,prefixCls:i="",enabled:a=!0})=>{const o=t.useRef(null),s=t.useRef(null),c=e=>{s.current=e},[d,u]=t.useState(!1),[m,p]=t.useState(null),h={width:150,height:200,zIndex:9999};Su({ref:o,handler:()=>f()});const f=()=>{u(!1),p(null),c(null)},g=Yn((e=>{if(e.preventDefault(),null==l?void 0:l(e.target))return f();c(e),u(!0),En((()=>{var t;const{width:n,height:r}=(null===(t=o.current)||void 0===t?void 0:t.getBoundingClientRect())||h,l=n,i=r,a=window.innerWidth,s=window.innerHeight;let c=e.clientX,d=e.clientY;c+l>a&&(c=Math.max(c-l,0)),d+i>s&&(d=Math.max(d-i,0)),p({x:c,y:d})}))}));t.useEffect((()=>{const t=(null==r?void 0:r(e.current))||e.current;return a&&t&&t.addEventListener("contextmenu",g),()=>{t&&t.removeEventListener("contextmenu",g)}}),[e]);const v={position:"fixed",top:`${(null==m?void 0:m.y)||0}px`,left:`${(null==m?void 0:m.x)||0}px`,zIndex:h.zIndex};return{contextMenu:t.createElement(Gt,{open:d},t.createElement("div",{ref:o,className:`${i}__context-menu`,style:v},s.current?n(s.current):null)),closeMenu:f}})({ref:v,prevent:e=>e.offsetParent.classList.contains("group-label"),prefixCls:r,enabled:!!h,popup:e=>{var r;const l=Wl(e.target,"table-cell"),i=(null===(r=null==l?void 0:l.parentNode)||void 0===r?void 0:r.getAttribute("data-row-key"))||"",a=p.find((e=>n(e,e.index)==i)),o=Number((null==l?void 0:l.getAttribute("data-col-index"))||-1),s=d[o];return t.createElement("ul",{className:"ant-dropdown-menu",style:{padding:5}},h.map((e=>{var n;const r=(null===(n=e.disabled)||void 0===n?void 0:n.call(e,a,s))||!1;return t.createElement("li",{key:e.key,className:Pe("ant-dropdown-menu-item",{"ant-dropdown-menu-item-disabled":r}),onClick:()=>{var t;r||(En((()=>x())),null===(t=e.onClick)||void 0===t||t.call(e,a,s))}},e.prefix&&t.createElement("span",{className:"prefix"},e.prefix),t.createElement("span",{className:"label"},e.label),e.suffix&&t.createElement("span",{className:"suffix"},e.suffix))})))}}),E=e=>{var t;const n=p[e];for(let r=e+1;r<p.length;r++)if(null===(t=p[r]._parentRowKey)||void 0===t?void 0:t.startsWith(n.id)){Object.assign(n,{_record:p[r]});break}},w=t.useMemo((()=>{const e=new Map,t=[];return p.forEach(((r,l)=>{if(bd(r)){if(0===r._groupLevel)return e.set(r.id,a.includes(r.id)),E(l),void t.push(r);const n=r.id.slice(0,r.id.lastIndexOf(gd.separator));return void(a.includes(n)&&e.get(n)&&(e.set(r.id,a.includes(r.id)),E(l),t.push(r)))}const i=n(r,r.index);r._parentRowKey&&!e.get(r._parentRowKey)||(e.set(i,u.includes(i)),t.push(r))})),e.clear(),t}),[i,a,u]),C=t.useMemo((()=>((e,{getRowKey:t,rowHeight:n})=>{const r=[],l=[],i=n,a=gd.indentWidth,o=gd.groupMargin;let s=o;for(e.forEach((e=>{if(void 0!==e._groupLevel){for(;l.length>0&&l[l.length-1]._level>=e._groupLevel;){const e=l.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,l.length>0){const t=l[l.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}l[l.length-1];const t={key:e.id,top:s,left:a*e._groupLevel,right:a*e._groupLevel,height:i,_childHeight:0,_subGroupCount:0,_index:r.length,_level:e._groupLevel};r.push(t),l.push(t),s+=i}else{const n=l[l.length-1]||{left:0,right:0},a={key:t(e,e.index),top:s,left:n.left,right:n.right,height:i};r.push(a),s+=i,l.length>0&&(n._childHeight+=i)}}));l.length>0;){const e=l.pop();if(e.height=e._childHeight+i,r[e._index].height=e.height,l.length>0){const t=l[l.length-1];t._childHeight+=e.height+o,t._subGroupCount+=1}s+=o}return r})(w,{getRowKey:n,rowHeight:g[l]})),[w,l]);Nu(C);const S=t.useMemo((()=>!w.length),[w]),N=t.useMemo((()=>{if(S)return 106;if(y)return C.reduce(((e,t)=>e+t.height),0)+2*f;const e=C.filter((e=>0===e._level));return e.reduce(((e,t)=>e+t.height),0)+(e.length-1)*f+2*f}),[S,y,C]),{rowVirtualizer:T,virtualRows:I}=(e=>{const{layout:n,isGroup:r}=e,{size:l}=Id(),{scrollbarRef:i}=tu(),{rowHeightMaps:a}=as,o=t.useMemo((()=>{var e;return(null===(e=i.current)||void 0===e?void 0:e.scrollElement)||null}),[i.current]),s=xu({count:n.length,getScrollElement:()=>o,estimateSize:e=>n[e].height,overscan:1,noCache:r,rangeExtractor:e=>{if(!r)return du(e);const t=e.offset,i=s.scrollElement.offsetHeight,o=[];for(let r=0;r<e.count;r++){const e=n[r];t>e.top+e.height+a[l]||t+i+a[l]<e.top||o.push(r)}return o}}),c=s.getVirtualItems();return{rowVirtualizer:s,virtualRows:c}})({layout:C,isGroup:!y});Dl((()=>{const e=p.findIndex((e=>{var t;return n(e,e.index)===(null===(t=o[s])||void 0===t?void 0:t.rowKey)}));e>=0&&c.current.SET_SCROLL_TOP(e*g[l]);const t=d.findIndex((e=>{var t;return e.dataIndex===(null===(t=o[s])||void 0===t?void 0:t.dataIndex)}));if(t>=0){const e=d.slice(0,t).filter((e=>"left"!==e.fixed)).reduce(((e,t)=>e+(t.width||t.renderWidth)),0);c.current.SET_SCROLL_LEFT(e)}}),[s,o]),t.useLayoutEffect((()=>{m("bodyEl",v.current),m("rowVirtualizer",T)}),[]);const R={layout:C,displayList:w,virtualRows:I,notGroup:y};return t.createElement("div",{ref:v,className:"body",style:{height:N}},S?t.createElement(Jl,{className:"content-empty"}):t.createElement(t.Fragment,null,t.createElement(_u,R),t.createElement(Fu,R),b))},Mu=()=>{const{groupGridData:e,countMethod:n,setSummationData:r}=Id(),{indentDepth:l,fixedWidth:i,gridColumns:a}=tu(),{selectionColumn:o}=as,{indentWidth:s}=gd,c=t.useMemo((()=>a.filter((e=>"left"===e.fixed))),[a]),d=t.useMemo((()=>a.filter((e=>"left"!==e.fixed))),[a]);Dl((()=>{r(((e,t)=>{const n=[],r=e=>{const n={};for(const r in t){const l=e.map((e=>Sn(e,r)));n[r]=t[r](l)}return n},l=e=>{if(Array.isArray(e))return n.push(...e),{total:r(e)};const i={},a={};Object.keys(t).forEach((e=>{a[e]=[]}));for(const r in e){const o=e[r];if(Array.isArray(o)){n.push(...o);const e={};for(const n in t){const r=o.map((e=>Sn(e,n)));e[n]=t[n](r),a[n].push(...r)}i[r]={subtotal:e}}else{const e=l(o);i[r]=e;for(const n in t){const t=e.subtotal[n];void 0!==t&&a[n].push(t)}}}if(0===n.length)return i;const o={};for(const e in t)o[e]=t[e](a[e]);return i.subtotal=o,i},i=Array.isArray(e)?{total:r(e)}:l(e);return n.length>0&&(i.total=r(n)),delete i.subtotal,i})(e,(e=>{const t={};for(const n in e)e[n]&&Object.assign(t,{[n]:Sd[e[n]]});return t})(n)))}),[n,e]);const u=(e,n)=>t.createElement("div",{className:Pe(n?"fixed-left":"no-fixed"),style:{width:n?i:""}},e.map(((r,i)=>{const{dataIndex:a,width:c,renderWidth:d}=r,u={"selection-column":a===o,"col--right":!0},m=i===(n?e.length>1?1:0:e.length-1)?l*s:0,p={width:`${(c||d||0)+m}px`,minWidth:`${(c||d||0)+m}px`};return t.createElement("div",{key:a,className:Pe("table-cell",u),style:p},a!==o?t.createElement(Au,{column:r,keyPath:"",type:"total"}):null)})));return t.createElement("div",{className:"footer"},u(c,!0),u(d))},Hu=()=>{const{prefixCls:e,size:n}=Id(),r=t.useRef(null);return t.createElement(eu,{scrollbar:r},t.createElement(Ei,{ref:r,wrapStyle:{height:"100%",maxHeight:"inherit"},className:Pe(`${e}__layout`,n)},t.createElement(lu,null),t.createElement(Du,null),t.createElement(Mu,null)))},$u=()=>t.createElement("div",{className:"wrapper"},t.createElement(Hu,null)),qu={rowKey:"id",columns:[],dataSource:[]},Ku=e=>{const n=Rn(qu,e),{rowKey:r,fromTable:l,columns:i,dataSource:a,height:o,maxHeight:s,className:c,style:d}=n,{$size:u}=Xn(n),m=Yn(((e,t)=>{const n="function"==typeof r?r(e,t):null==e?void 0:e[r];return void 0===n?(Jn("PivotGrid","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),p=(e,t="",n=0)=>e.map(((e,r)=>{const l=m(e,e.index);return e.index=r,e._level=n,Array.isArray(e.children)&&(e.children=p(e.children,l,n+1)),t?Object.assign(e,{_parentRowKey:t}):e})),h=e=>{let t=(e=>e.filter((e=>![as.expandableColumn,as.selectionColumn,"index","pageIndex"].includes(e.dataIndex))))(e).map((e=>Object.assign(Object.assign({},e),{fixed:"left"===e.fixed?"left":void 0,editRender:void 0})));return l&&(t=t.filter((e=>![as.operationColumn].includes(e.dataIndex)))),t},f=t.useMemo((()=>h(i)),[i]),g=t.useMemo((()=>p(a)),[a]),v=rr("pivot-grid"),y={[v]:!0,"is-from-table":l},b={height:o,maxHeight:s},x={prefixCls:v,size:u,getRowKey:m,flatColumns:f,tableData:g,pivotProps:Nn(n,["columns","dataSource","rowKey","size","height","maxHeight","className","style"])};return t.createElement("div",{className:Pe(y,c),style:Object.assign(Object.assign({},d),b)},t.createElement(Td,x,t.createElement(Zd,null),t.createElement($u,null)))};Ku.displayName="PivotGrid";const ju=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{tableRef:l,prefixCls:i,flattenColumns:a}=t.useContext(Ko),{rowKey:o,uniqueKey:s}=l.current.props,{t:c}=Gn(),{tableFullData:d}=l.current,[u,m]=t.useState(!1),p=()=>{m(!0)};t.useImperativeHandle(n,(()=>({clickHandle:p})));const h={visible:u,title:c("qm.table.pivotGrid.settingTitle"),width:"80vw",loading:!1,bodyStyle:{padding:0},onClose:()=>m(!1)};return t.createElement(t.Fragment,null,r&&t.createElement("span",{className:`${i}-pivot-grid`,title:c("qm.table.pivotGrid.text"),onClick:()=>p()},t.createElement("i",{className:"svgicon icon"},t.createElement(bt,null))),t.createElement(Mi,h,t.createElement(Ku,{fromTable:!0,rowKey:o,uniqueKey:s,columns:a,dataSource:d})))}));ju.displayName="PivotGrid";const Vu=e=>{const{columns:n,group:r,summary:l}=e,{tableRef:i,$size:a,pagination:o,fetchParams:s,isFetch:c}=t.useContext(Ko),{fetch:d}=i.current.props,{t:u}=Gn(),m=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:[]}},h=r.map((e=>Object.assign({dataIndex:e.group},m(e.group)))),f=l.map((e=>e.summary===as.groupSummary.total.value?{dataIndex:e.summary,title:as.groupSummary.total.text,formula:e.formula}:Object.assign(Object.assign({dataIndex:e.summary},m(e.summary)),{formula:e.formula}))),g=t.useMemo((()=>Object.assign({},s,{[as.sorterFieldName]:void 0,[as.groupSummary.summaryFieldName]:l.map((e=>`${e.formula}|${e.summary}`)).join(","),[as.groupSummary.groupbyFieldName]:r.map((e=>e.group)).join(","),usedJH:2,[as.currentPageName]:1})),[s,r,l]),[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 l=r?{summation:r}:null;return e.dataIndex===as.groupSummary.total.value&&(l={dataIndex:as.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),Object.assign(Object.assign({},e),"count"===e.formula||"sum"===e.formula?l:null)}))])(h,f)),[b]=t.useState(c?[]:(e=>{const t=ka(e,r.map((e=>e.group))),n=[];return t.forEach((e=>{const t={};v.forEach((n=>{const{dataIndex:r}=n;"index"!==r&&ba(t,r,ya(e[0],r))})),l.forEach((n=>{const r=n.summary!==as.groupSummary.total.value?n.summary:as.groupSummary.recordTotalIndex,l=n.formula;"count"===l&&ba(t,r,e.length),"sum"===l&&ba(t,r,P(e,r)),"max"===l&&ba(t,r,_(e,r)[r]),"min"===l&&ba(t,r,F(e,r)[r]),"avg"===l&&ba(t,r,(P(e,r)/e.length).toFixed(2))})),n.push(t)})),n})(i.current.tableFullData)),x=Object.assign(Object.assign({size:a,height:400},c?{fetch:{api:d.api,params:g,dataKey:null==d?void 0:d.dataKey}}:{dataSource:b}),{columns:v,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${p().format(Yo)}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)});return t.createElement(cp,x)},zu=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:l,prefixCls:i,$size:a,flattenColumns:o}=t.useContext(Ko),{uniqueKey:s}=l.current.props,{t:c}=Gn(),d=t.useRef(null),u=t.useRef(null),[m,p]=t.useState(!1),[h,f]=t.useState([]),[g,v]=t.useState(""),[y,b]=t.useState("");Dl((()=>{if(y){const{group:e,summary:t}=h.find((e=>e.value===y)).list;T(e),k(t)}else{const e=F();T((null==e?void 0:e.group)||[]),k((null==e?void 0:e.summary)||[])}}),[y]),t.useEffect((()=>{D()}),[]);const x=t.useMemo((()=>s?`summary_${s}`:""),[s]),E=t.useMemo((()=>o.filter((e=>![as.expandableColumn,as.selectionColumn,"index","pageIndex",as.operationColumn].includes(e.dataIndex)))),[o]),w=E.filter((e=>!e.groupSummary)).map((e=>({text:Ia(e.title),value:e.dataIndex}))),C=[as.groupSummary.total,...E.filter((e=>!!e.groupSummary)).map((e=>({text:Ia(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(er,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:c("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:w.map((e=>Object.assign(Object.assign({},e),{disabled:N.findIndex((t=>t.group===e.value))>-1})))})}]),[O,k]=t.useState([]),[L,A]=t.useState([{title:c("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(er,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(n)}},c("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:c("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:C.map((e=>Object.assign(Object.assign({},e),{disabled:O.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:c("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===as.groupSummary.total.value?S.slice(S.length-1):S})}]),P=t.useMemo((()=>{const e=N.length&&N.every((e=>Object.values(e).every((e=>""!==e)))),t=O.length&&O.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[N,O]),_=()=>{x&&sessionStorage.setItem(x,JSON.stringify({group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}))},F=()=>{if(!x)return;const e=sessionStorage.getItem(x);return e?JSON.parse(e):null},D=()=>hn(void 0,void 0,void 0,(function*(){if(!x)return;const e=F();if(e){const{group:t,summary:n}=e;T(t),k(n)}let t=yield Zt.getItem(x);t||(t=yield M(x),Array.isArray(t)&&(yield Zt.setItem(x,t))),Array.isArray(t)&&t.length&&(f(t),!e&&b(t[0].value))})),M=e=>hn(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){}})),H=(e,t)=>hn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),$={visible:m,title:c("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>p(!1)};return t.createElement("div",{className:`${i}-group-summary__setting`},t.createElement("div",{className:"main"},t.createElement("div",{style:{width:"30%"}},t.createElement(cp,{ref:d,size:a,columns:I,dataSource:N,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>R(e),onDataChange:e=>{T(e)}},t.createElement(er,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{d.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"container line"},t.createElement(cp,{ref:u,size:a,columns:L,dataSource:O,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>A(e),onDataChange:e=>{k(e)}},t.createElement(er,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(re,{size:a,value:g,placeholder:c("qm.table.groupSummary.configText"),disabled:P,onChange:e=>{const{value:t}=e.target;v(t)}}),t.createElement(er,{type:"primary",disabled:!g||P,style:{marginLeft:"10px"},onClick:()=>hn(void 0,void 0,void 0,(function*(){if(!x)return Jn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Ta(),t=[...h,{text:g,value:e,list:{group:N.filter((e=>!!e.group)),summary:O.filter((e=>!!e.summary))}}];f(t),b(e),v(""),yield Zt.setItem(x,t),yield H(x,t)}))},c("qm.table.groupSummary.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${as.rowHeightMaps[a]}px`}},t.createElement("span",null,c("qm.table.groupSummary.savedSetting"))),t.createElement("ul",null,h.map((e=>t.createElement("li",{key:e.value,className:Pe({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,hn(void 0,void 0,void 0,(function*(){if(!n)return;const e=h.filter((e=>e.value!==n));f(e),n===y&&b(""),yield Zt.setItem(x,e),yield H(x,e)}))}},t.createElement(et,null))))),!h.length&&t.createElement("div",{style:{padding:zo}},t.createElement(Jl,null)))))),t.createElement(Mi,$,t.createElement(Vu,{columns:E,group:N,summary:O})),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(er,{onClick:()=>n(),style:{marginRight:8}},c("qm.table.groupSummary.closeButton")),t.createElement(er,{type:"primary",disabled:P,onClick:()=>(_(),void p(!0))},c("qm.table.groupSummary.confirmButton"))))},Wu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l}=t.useContext(Ko),{t:i}=Gn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:i("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:`${l}-group-summary`,title:i("qm.table.groupSummary.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(xt,null))),t.createElement(Mi,c,t.createElement(zu,{onClose:()=>o(!1)})))}));Wu.displayName="GroupSummary";const Bu=e=>{const{onClose:n}=e,{global:r}=t.useContext(on),{tableRef:l,$size:i,prefixCls:a,flattenColumns:o,setSuperFilters:s,clearTableFilter:c,clearPagerFilter:d}=t.useContext(Ko),{uniqueKey:u}=l.current.props,{t:m}=Gn(),p=t.useRef(null),[h,f]=t.useState([]),[g,v]=t.useState([]),[y,b]=t.useState(""),[x,E]=t.useState("");Dl((()=>{f(x?g.find((e=>e.value===x)).list:D()||[])}),[x]),t.useEffect((()=>{M()}),[]);const w=t.useMemo((()=>u?`superSearch_${u}`:""),[u]),C=t.useMemo((()=>o.filter((e=>!!e.filter))),[o]),S=Oa(h),N=t.useMemo((()=>!(S&&Qi(S))),[S]),T=t.useMemo((()=>!!h.length&&N),[h,N]),I=[{value:"and",text:m("qm.table.highSearch.andText")},{value:"or",text:m("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:Ia(e.title)}))),O=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:m("qm.table.highSearch.gtText")},{value:"<",text:m("qm.table.highSearch.ltText")},{value:">=",text:m("qm.table.highSearch.gteText")},{value:"<=",text:m("qm.table.highSearch.lteText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;case"checkbox":case"radio":case"tree":t=[{value:"in",text:m("qm.table.highSearch.inText")},{value:"nin",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}];break;default:t=[{value:"like",text:m("qm.table.highSearch.inText")},{value:"nlike",text:m("qm.table.highSearch.ninText")},{value:"==",text:m("qm.table.highSearch.eqText")},{value:"!=",text:m("qm.table.highSearch.neqText")},{value:"^=",text:m("qm.table.highSearch.startsWithText")},{value:"=$",text:m("qm.table.highSearch.endsWithText")},{value:"nil",text:m("qm.table.highSearch.nullText")},{value:"nnil",text:m("qm.table.highSearch.notNullText")}]}return t},[A,P]=t.useState([{title:m("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,n)=>t.createElement("div",null,t.createElement(er,{type:"text",onClick:()=>{p.current.REMOVE_RECORDS(n)}},m("qm.table.highSearch.removeText")))},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,dictItems:R,editRender:e=>({type:"select",editable:!0,rules:[{required:!0,message:m("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{var n,r;const l=Object.values(t)[0],i=null===(n=C.find((e=>e.dataIndex===l)))||void 0===n?void 0:n.filter.type,a=L(i);e.fieldType=i,e.expression=l?null===(r=a[0])||void 0===r?void 0:r.value:"",e.condition=O(e.expression)?[]:"",l||(e.bracketLeft=e.bracketRight="")}})},{title:m("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:m("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{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=O(e.expression)?[]:""}}}},{title:m("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{var t,n,r;const l=C.find((t=>t.dataIndex===e.fieldName)),i=null==l?void 0:l.filter.type,a=null!==(r=null!==(n=null===(t=null==l?void 0:l.filter)||void 0===t?void 0:t.items)&&void 0!==n?n:null==l?void 0:l.dictItems)&&void 0!==r?r:[];return{type:k(i,O(e.expression)),editable:!0,items:a,extra:{disabled:!e.fieldName||Ha(e.expression),cornerSign:!1}}}},{title:m("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,n)=>t.createElement("span",{style:{fontSize:"20px"}},e)},{title:m("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,dictItems:I,editRender:e=>({type:"select",editable:!0,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),_=()=>{c(),d(),s(h.map((e=>Nn(e,["index","pageIndex"])))),F(),n()},F=()=>{w&&sessionStorage.setItem(w,JSON.stringify(h.filter((e=>!!e.fieldName))))},D=()=>{if(!w)return;const e=sessionStorage.getItem(w);return e?JSON.parse(e):null},M=()=>hn(void 0,void 0,void 0,(function*(){if(!w)return;const e=D();e&&f(e);let t=yield Zt.getItem(w);t||(t=yield H(w),Array.isArray(t)&&(yield Zt.setItem(w,t))),Array.isArray(t)&&t.length&&(v(t),!e&&E(t[0].value))})),H=e=>hn(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)=>hn(void 0,void 0,void 0,(function*(){const n=null==r?void 0:r.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}}));return t.createElement("div",{className:`${a}-super-search__setting`},t.createElement("div",{className:"main"},t.createElement("div",{className:"container"},t.createElement(cp,{ref:p,size:i,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]?"":")"),f([...h]))},onDataChange:e=>{f(e)}},t.createElement(er,{type:"primary",icon:t.createElement(rt,null),onClick:()=>{p.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),as.highSearch.showSQL&&S&&t.createElement("code",{className:"lang-js"},S)),t.createElement("div",{className:"saved line"},t.createElement("div",{className:"form-wrap"},t.createElement(re,{size:i,value:y,placeholder:m("qm.table.highSearch.configText"),disabled:N,onChange:e=>{const{value:t}=e.target;b(t)}}),t.createElement(er,{type:"primary",disabled:!y||N,style:{marginLeft:"10px"},onClick:()=>hn(void 0,void 0,void 0,(function*(){if(!w)return Jn("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Ta(),t=[...g,{text:y,value:e,list:h.filter((e=>!!e.fieldName))}];v(t),E(e),b(""),yield Zt.setItem(w,t),yield $(w,t)}))},m("qm.table.highSearch.saveButton"))),t.createElement("div",{className:"card-wrap"},t.createElement("h5",{style:{height:`${as.rowHeightMaps[i]}px`}},t.createElement("span",null,m("qm.table.highSearch.savedSetting"))),t.createElement("ul",null,g.map((e=>t.createElement("li",{key:e.value,className:Pe({selected:e.value===x}),title:e.text,onClick:()=>{return t=e.value,void E(t!==x?t:"");var t}},t.createElement("span",{className:"title"},e.text),t.createElement("i",{className:"svgicon close",title:m("qm.table.highSearch.removeText"),onClick:t=>{var n;t.stopPropagation(),n=e.value,hn(void 0,void 0,void 0,(function*(){if(!n)return;const e=g.filter((e=>e.value!==n));v(e),n===x&&E(""),yield Zt.setItem(w,e),yield $(w,e)}))}},t.createElement(et,null))))),!g.length&&t.createElement("div",{style:{padding:zo}},t.createElement(Jl,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(er,{onClick:()=>n(),style:{marginRight:8}},m("qm.table.highSearch.closeButton")),t.createElement(er,{type:"primary",disabled:T,onClick:()=>_()},m("qm.table.highSearch.searchButton"))))},Uu=t.forwardRef(((e,n)=>{const{open:r=!0}=e,{prefixCls:l}=t.useContext(Ko),{t:i}=Gn(),[a,o]=t.useState(!1),s=()=>{o(!0)};t.useImperativeHandle(n,(()=>({clickHandle:s})));const c={visible:a,title:i("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:`${l}-super-search`,title:i("qm.table.highSearch.text"),onClick:()=>s()},t.createElement("i",{className:"svgicon icon"},t.createElement(Et,null))),t.createElement(Mi,c,t.createElement(Bu,{onClose:()=>o(!1)})))}));Uu.displayName="SuperSearch";const Gu=t.forwardRef(((e,n)=>{const{tableColumns:r,showFullScreen:l,showReload:i,showPrint:a,showImport:o,showExport:s,showClipboard:c,showCollection:d,showFastSearch:u,showSuperSearch:m,showPivotGrid:p,showGroupSummary:h,showToolBox:f}=e,{global:g}=t.useContext(on),{tableRef:v,$size:y,prefixCls:b,isFullScreen:x}=t.useContext(Ko),{uniqueKey:E,exportExcel:w}=v.current.props,{t:C}=Gn(),S=t.useRef(null),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=t.useRef(null),L=t.useRef(null),A=t.useRef(null),P=t.useRef(null),_=t.useRef(null),F=t.useRef(!1),D=t.useMemo((()=>E?`toolBox_${E}`:""),[E]),[M,H]=t.useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,pivotGrid:!1,groupSummary:!1}),$={fullScreen:l,reload:i,print:a,import:o,export:s&&!(null==w?void 0:w.hideIcon),clipboard:c,collection:d,fastSearch:u,superSearch:m,pivotGrid:p,groupSummary:h},[q,K]=t.useState(!1);Dl((()=>{F.current&&(V(),F.current=!1)}),[M]),t.useLayoutEffect((()=>{j()}),[]),t.useImperativeHandle(n,(()=>({exportHandle:()=>{if(!R.current)return Jn("Table","执行导出需要配置 `exportExcel` 参数");R.current.clickHandle()}})));const j=()=>{if(!D||!f)return;const e=JSON.parse(localStorage.getItem(D));e||z(D).then((e=>{e&&(H(Object.assign({},M,e)),localStorage.setItem(D,JSON.stringify(e)))})).catch((()=>{})),e&&H(Object.assign({},M,e))},V=()=>{if(!D||!f)return;const e={};for(const t in M)M[t]&&(e[t]=M[t]);localStorage.setItem(D,JSON.stringify(e)),W(D,e)},z=e=>hn(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){}})),W=(e,t)=>hn(void 0,void 0,void 0,(function*(){const n=null==g?void 0:g.saveComponentConfigApi;if(n)try{yield n({[e]:t})}catch(e){}})),B=e=>hn(void 0,void 0,void 0,(function*(){K(!1),yield xn(100),e.current.clickHandle()})),U=(e,t)=>{F.current=!0,H(Object.assign({},M,{[t]:e}))},G={"top-toolbox__popper":!0,[`${b}--lg`]:"large"===y,[`${b}--sm`]:"small"===y};return t.createElement(t.Fragment,null,l&&t.createElement(ps,{ref:S,isFullScreen:x,open:!f||M.fullScreen}),i&&t.createElement(hs,{ref:N,open:!f||M.reload}),a&&t.createElement(gs,{ref:T,tableColumns:r,open:!f||M.print}),o&&t.createElement(Rs,{ref:I,tableColumns:r,open:!f||M.import}),s&&t.createElement(cd,{ref:R,tableColumns:r,open:(!f||M.export)&&!(null==w?void 0:w.hideIcon)}),c&&t.createElement(ud,{ref:O,open:!f||M.clipboard}),d&&t.createElement(pd,{ref:k,columns:r,open:!f||M.collection}),u&&t.createElement(fd,{ref:L,open:!f||M.fastSearch}),p&&t.createElement(ju,{ref:A,open:!f||M.pivotGrid}),h&&t.createElement(Wu,{ref:P,open:!f||M.groupSummary}),m&&t.createElement(Uu,{ref:_,open:!f||M.superSearch}),f&&t.createElement(me,{open:q,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.fullScreen,style:{marginRight:6},onChange:e=>U(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.screen.full"))),onClick:()=>B(S)},{key:"reload",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.reload,style:{marginRight:6},onChange:e=>U(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.refresh.text"))),onClick:()=>B(N)},{key:"print",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.print,style:{marginRight:6},onChange:e=>U(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.print.text"))),onClick:()=>B(T)},{key:"import",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.import,style:{marginRight:6},onChange:e=>U(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.import.textNoSpace"))),onClick:()=>B(I)},{key:"export",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.export,style:{marginRight:6},onChange:e=>U(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.export.textNoSpace"))),onClick:()=>B(R)},{key:"clipboard",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.clipboard,style:{marginRight:6},onChange:e=>U(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.clipboard.textNoSpace"))),onClick:()=>B(O)},{key:"collection",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.collection,style:{marginRight:6},onChange:e=>U(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.selectCollection.text"))),onClick:()=>B(k)},{key:"fastSearch",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.fastSearch,style:{marginRight:6},onChange:e=>U(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.fastSearch.text"))),onClick:()=>B(L)},{key:"pivotGrid",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.pivotGrid,style:{marginRight:6},onChange:e=>U(e.target.checked,"pivotGrid"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.pivotGrid.text"))),onClick:()=>B(A)},{key:"groupSummary",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.groupSummary,style:{marginRight:6},onChange:e=>U(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.groupSummary.text"))),onClick:()=>B(P)},{key:"superSearch",label:t.createElement(t.Fragment,null,t.createElement(ue,{checked:M.superSearch,style:{marginRight:6},onChange:e=>U(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t.createElement("span",null,C("qm.table.highSearch.text"))),onClick:()=>B(_)}];return t.createElement(ge,{items:e.filter((e=>$[e.key]))})})(),overlayClassName:Pe(G),overlayStyle:{minWidth:120},onOpenChange:e=>{K(e)}},t.createElement("span",{className:`${b}-toolbox`,title:C("qm.table.toolbox.text")},t.createElement("i",{className:"svgicon icon"},t.createElement(wt,null)))))}));Gu.displayName="ToolBox";const Yu=(e,t)=>e.map((e=>(e.children&&(e.children=Yu(e.children,t)),t(e)))),Xu=t.forwardRef(((e,n)=>{const{columns:r}=e,{global:l}=t.useContext(on),{tableRef:i,prefixCls:a,$size:o}=t.useContext(Ko),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:d,columnsChange:u}=i.current.props,{t:m}=Gn(),p=t.useRef([]),[h,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]);Dl((()=>{E(r)}),[r]),t.useLayoutEffect((()=>{w()}),[]),t.useImperativeHandle(n,(()=>({initialHandler:w})));const x=e=>{if(!b)return;const t=e||r,n=JSON.parse(localStorage.getItem(b));var i;if(n||(i=b,hn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.getComponentConfigApi;if(e)try{const t=yield e({key:i});if(200===t.code)return t.data}catch(e){}}))).then((e=>{e?(localStorage.setItem(b,JSON.stringify(e)),w()):(null==l?void 0:l.getComponentConfigApi)&&E(t)})).catch((()=>{})),!n)return;return S(na(n).map((e=>e.dataIndex)),na(t).map((e=>e.dataIndex))).length>0?Yu(t,(e=>{const t=la(n,e.dataIndex);return t&&(void 0!==t.hidden&&(e.hidden=t.hidden),void 0!==t.fixed&&(e.fixed=t.fixed),void 0!==t.width&&(e.width=t.width),void 0!==t.renderWidth&&(e.renderWidth=t.renderWidth)),e})):Yu(n,(e=>{const n=la(t,e.dataIndex);return void 0===e.fixed&&delete n.fixed,Object.assign({},n,e)}))},E=e=>{if(!b||!i.current.columnsDefined)return;const t=ta(e),n=JSON.parse(localStorage.getItem(b));var r,a;C(t,n)||(localStorage.setItem(b,JSON.stringify(t)),r=b,a=t,hn(void 0,void 0,void 0,(function*(){const e=null==l?void 0:l.saveComponentConfigApi;if(e)try{yield e({[r]:a})}catch(e){}})))},w=e=>{if(!i.current.columnsDefined)return;const t=x(e)||e;var n;t&&(n=N(t),p.current=n,null==u||u(t))},N=e=>{const t=[];return e.filter((e=>!e.noAuth)).forEach(((n,r)=>{const l=n.colSpan;l>1&&e.slice(r+1,r+l).every((({colSpan:e})=>0===e))&&t.push(e.slice(r,r+l))})),t},T=()=>{const e=na(r),t=n=>n.filter((t=>e.find((e=>e.dataIndex===t.dataIndex)))).map((n=>{const r=e.find((e=>e.dataIndex===n.dataIndex)),l=Object.assign({},r,n);return delete l.renderWidth,void 0===n.hidden&&delete l.hidden,void 0===n.fixed&&delete l.fixed,void 0===n.width&&delete l.width,n.children&&(l.children=t(n.children)),l}));null==u||u(t(i.current.originColumns))},I=e=>{const t=[];e.forEach((n=>{const{colSpan:r,dataIndex:l}=n;if(0===r)return;if(1===r)return t.push(n);const i=p.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(l)));if(-1===i)return t.push(n);t.push(...p.current[i].map((({dataIndex:t},r)=>{const l=e.find((e=>e.dataIndex===t));return r>0&&(void 0!==n.hidden&&(l.hidden=n.hidden),void 0!==n.fixed?l.fixed=n.fixed:l.fixed&&delete l.fixed),l})))})),r.forEach(((e,n)=>{e.noAuth&&t.findIndex((t=>t.dataIndex===e.dataIndex))<0&&t.splice(n,0,e)})),null==u||u(t)},R=(e,t)=>{e.noFixed||(t?e.fixed=t:delete e.fixed,I(r))},O=(e,n)=>{var l;const{colSpan:i,noFixed:a}=e;if(0===i)return t.createElement("li",{key:e.dataIndex,style:{display:"none"}});const o=Ia(e.title),s=["svgicon","handle",`${n}-handle`],c=t.createElement("li",{key:e.dataIndex,className:"item"},t.createElement(ue,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:n}=t.target;e.hidden=!n,I(r)}}),t.createElement("i",{className:Pe(s),title:m("qm.table.columnFilter.draggable")},t.createElement(Be,null)),t.createElement("span",{className:"text",title:o},o),"main"===n?t.createElement("span",{className:Pe("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedLeft"),onClick:()=>R(e,"left")},t.createElement(Ct,null)),t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.fixedRight"),onClick:()=>R(e,"right")},t.createElement(St,null))):"sub"!==n?t.createElement("span",{className:Pe("fixed",a?"disabled":"")},t.createElement("i",{className:"svgicon",title:m("qm.table.columnFilter.cancelFixed"),onClick:()=>R(e)},t.createElement(et,null))):null);return!e.hidden&&(null===(l=e.children)||void 0===l?void 0:l.length)?t.createElement(ve,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:k(e.children,e.dataIndex)},c):c},k=(e,n)=>t.createElement("div",{className:"column-filter--wrap"},t.createElement(Yt,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const l=t.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));C(l,i)||((e,t)=>{la(r,t).children=e,null==u||u([...r])})(Fa(t),n)}},e.map((e=>O(e,"sub"))))),L={[`${a}__popper`]:!0,"column-filter__popper":!0,[`${a}--lg`]:"large"===o,[`${a}--sm`]:"small"===o},A=[`${a}-column-filter`,{selected:h}];return s?t.createElement(ad,{action:["click"],popupVisible:h,popup:t.createElement("div",{className:"column-filter--wrap",style:{maxHeight:"calc(100vh - 10px)"}},t.createElement("div",{className:"reset"},t.createElement(er,{type:"text",size:"small",onClick:T},m("qm.table.columnFilter.reset"))),t.createElement("div",{className:"left"},t.createElement(Yt,{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));C(t,n)||I([...Fa(e),...y,...v])}},g.map((e=>O(e,"left"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"main"},t.createElement(Yt,{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));C(t,n)||I([...g,...Fa(e),...v])}},y.map((e=>O(e,"main"))))),t.createElement("div",{className:"divider"}),t.createElement("div",{className:"right"},t.createElement(Yt,{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));C(t,n)||I([...g,...y,...Fa(e)])}},v.map((e=>O(e,"right")))))),popupClassName:Pe(L),popupStyle:{minWidth:160},onPopupVisibleChange:e=>{f(e)},builtinPlacements:Xo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("span",{className:Pe(A),title:d?m("qm.table.columnFilter.text"):void 0},t.createElement("i",{className:"svgicon icon"},t.createElement(Qe,null)),!d&&t.createElement("span",null,m("qm.table.columnFilter.text")))):null}));Xu.displayName="ColumnFilter";const Qu=t.createContext({}),Zu=()=>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=t.forwardRef(((e,n)=>{const{dataIndex:r,className:l,style:i}=e;return t.createElement("li",{ref:n,"data-index":r,className:Pe("list-item",l),style:i},e.children)}));Ju.displayName="ListItem";const em=t.forwardRef(((e,n)=>{var r,l;const{dataSource:i=[],height:a,maxHeight:o,itemHeight:s,renderItem:c,onScroll:d,className:u}=e,m=t.useRef(null),p=xu({count:i.length,getScrollElement:()=>{var e;return(null===(e=m.current)||void 0===e?void 0:e.scrollElement)||null},estimateSize:()=>s||40,overscan:3,onChange:(e,t)=>null==d?void 0:d(e,t)}),h=p.getVirtualItems();t.useImperativeHandle(n,(()=>({SCROLL_TO_INDEX:e=>p.scrollToIndex(e),SCROLL_TO_OFFSET:e=>p.scrollToOffset(e)})));const f=rr("virtual-list");return t.createElement(Ei,{ref:m,wrapStyle:{height:a,maxHeight:o},className:Pe(f,u),style:e.style},t.createElement("div",{className:"container",style:{height:p.getTotalSize()}},t.createElement("ul",{style:{transform:`translateY(${null!==(l=null===(r=h[0])||void 0===r?void 0:r.start)&&void 0!==l?l:0}px)`}},h.map((e=>t.createElement(Ju,{ref:p.measureElement,key:e.index,dataIndex:e.index,style:{height:s}},null==c?void 0:c(i[e.index],e.index)))))))}));em.displayName="VirtualList";const tm=e=>{const{column:n,isEnum:r,style:l,onChange:i}=e,{tableRef:a,$size:o,flattenColumns:s,isFetch:c,filters:d,superFilters:u,pagerFilter:m,setPagerFilter:p}=t.useContext(Ko),{dataKey:h,filterValue:f={}}=t.useContext(Qu),{t:g}=Gn(),{getTitleFromCellValue:v}=fs(),y=h.split("|")[0],{recordsMap:b,tableOriginData:x,isOriginTree:E}=a.current,w=m,S=y;w[S];const N=mn(w,["symbol"==typeof S?S:S+""]),T=t.useRef(!1),I=t.useMemo((()=>s.indexOf(n)),[s,n]),R=t.useRef(0),O=e=>{let t=sa((()=>{if(!(c||Cn(d)&&Cn(u))){const e=u.length?Oa(u):Oa(d);return Zi(x,e,E)}return x})());var r;e||(t=((e,t,n)=>{if(!Object.keys(t).length||!e.length)return e;if(!n)return e.filter((e=>$a(e,t)));const r=new Map,l=new Set;for(const n of e)if(r.set(n._rowKey,n),$a(n,t)){let e=n;for(;e&&!l.has(e._rowKey);)l.add(e._rowKey),e=r.get(e._parentRowKey)}return e.filter((e=>l.has(e._rowKey)))})(t,N,E),r=t.length,R.current=r);const l=new Map;return t.forEach((e=>{const t=ya(e,y);l.has(t)||l.set(t,v(e,n,e.index,I))})),l},k=e=>r?[{text:g("qm.table.highSearch.nullText"),value:""},...n.filter.items||n.dictItems||[]]:Array.from(O(e).entries()).map((([e,t])=>({text:t,value:e}))),L=t.useMemo((()=>k()),[]),A=t.useMemo((()=>Cn(N)?L:k(!0)),[]),[P,_]=t.useState(L),F=t.useMemo((()=>new Map(P.map((e=>[e.value,null])))),[P]),[D,M]=t.useState(""),[H,$]=t.useReducer(((e,t)=>{const n=t(e),r=[...new Set(n)];return C(e,r)?e:r}),(r?f.in:m[y])||A.map((e=>e.value))),q=t.useMemo((()=>Array.from(F.keys()).every((e=>H.includes(e)))),[H,F]),K=t.useMemo((()=>{const e=Array.from(F.keys()).filter((e=>H.includes(e)));return e.length>0&&e.length<P.length}),[H,P,F]),j=t.useMemo((()=>H.length===A.length),[H]);Dl((()=>{null==i||i(H,j)}),[H]),Dl((()=>{const e=j?null:H;if(!C(e,m[y]))return e?void p(Object.assign(Object.assign({},m),{[y]:e})):p(N)}),[P,H]);const V=ci((e=>{const t=L.filter((t=>t.text.includes(e))),n=t.map((e=>e.value));_(t),$((e=>[...n,...e.filter((e=>!F.has(e)))]))}),200),z=e=>{M(e),T.current||V(e)};return t.createElement("div",{className:"list-panel",style:l},t.createElement(re,{value:D,size:o,style:{width:200},placeholder:g("qm.table.filter.keywordSearch"),suffix:t.createElement(Nt,null),autoFocus:!0,allowClear:!0,onCompositionStart:()=>{T.current=!0},onCompositionEnd:e=>{T.current=!1,z(e.target.value)},onChange:e=>z(e.target.value)}),t.createElement("div",{className:"select-all"},t.createElement("div",{className:"action"},t.createElement(ue,{checked:q,indeterminate:K,disabled:!P.length,onChange:e=>{$((t=>e.target.checked?[...t,...Array.from(F.keys())]:t.filter((e=>!F.has(e)))))}},g("qm.table.filter.selectAll")),t.createElement("i",{className:"divider"},"|"),t.createElement("button",{className:"btn invert",disabled:!P.length,onClick:()=>{$((e=>[...Array.from(F.keys()).filter((t=>!e.includes(t))),...e.filter((e=>!F.has(e)))]))}},g("qm.table.filter.invert"))),t.createElement("div",{className:"total"},r?null:`${b.size}/${R.current}`)),t.createElement(em,{className:"select-list",maxHeight:180,itemHeight:26,dataSource:P,renderItem:(e,n)=>t.createElement(t.Fragment,null,t.createElement(ue,{key:n,checked:H.includes(e.value),onChange:t=>{$((n=>t.target.checked?[...n,e.value]:n.filter((t=>t!==e.value))))}},e.text),t.createElement("button",{className:"btn right",onClick:()=>{$((t=>{const n=[e.value,...t.filter((e=>!F.has(e)))];return C(t,n)?t:n}))}},g("qm.table.filter.onlyItem")))}))},nm=t.forwardRef(((e,n)=>{const{value:r,style:l}=e,{$size:i,filters:a,pagerFilter:o,setPagerFilter:s}=t.useContext(Ko),{dataKey:c,onChange:d}=t.useContext(Qu),{t:u}=Gn(),m=c.split("|")[0],p=e=>{if(!e){const e=a,t=c;e[t];return mn(e,["symbol"==typeof t?t:t+""])}const t=Object.assign({},e);for(const e in t)(""===(n=t[e])||null==n)&&delete t[e];var n;return Object.keys(t).length?Object.assign({},a,{[c]:t}):p()},h=(e,t)=>{d(p(null!=e?e:r),null==t||t)};return t.useImperativeHandle(n,(()=>({doFinish:h}))),t.createElement(Z,{className:"footer",style:Object.assign(Object.assign({},l),{justifyContent:"flex-end"})},t.createElement(er,{size:i,onClick:()=>(()=>{if(o[m]){const e=o,t=m;e[t];const n=mn(e,["symbol"==typeof t?t:t+""]);s(n)}d(p(),!0)})()},u("qm.table.filter.reset")),t.createElement(er,{type:"primary",size:i,onClick:()=>h()},u("qm.table.filter.search")))}));nm.displayName="FooterPanel";const rm=e=>{const{column:n}=e,{$size:r}=t.useContext(Ko),{filterValue:l={}}=t.useContext(Qu),{t:i}=Gn(),a=t.useRef(null),{openFilterList:o=!0}=n.filter,[s,c]=t.useState(Object.keys(l)[0]||"like"),[d,u]=t.useState(l[s]&&!Ha(s)?l[s]:""),m=t.useMemo((()=>d?{[s]:d}:Ha(s)?{[s]:1}:null),[s,d]),p=[{value:"like",label:i("qm.table.highSearch.inText")},{value:"nlike",label:i("qm.table.highSearch.ninText")},{value:"==",label:i("qm.table.highSearch.eqText")},{value:"!=",label:i("qm.table.highSearch.neqText")},{value:"^=",label:i("qm.table.highSearch.startsWithText")},{value:"=$",label:i("qm.table.highSearch.endsWithText")},{value:"nil",label:i("qm.table.highSearch.nullText")},{value:"nnil",label:i("qm.table.highSearch.notNullText")}];return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(de,{value:s,options:p,size:r,className:"condition",style:{width:70,marginRight:6},onChange:e=>{c(e),Ha(e)&&u("")}}),t.createElement(re,{value:d,size:r,autoFocus:!0,style:{width:124,paddingLeft:6,paddingRight:2},placeholder:i("qm.table.filter.searchText",{text:Ia(n.title)}),disabled:Ha(s),onChange:e=>{u(e.target.value)},onKeyDown:e=>{13===e.keyCode&&a.current.doFinish()}})),o&&t.createElement(tm,{column:n,style:{marginTop:6}}),t.createElement(nm,{ref:a,value:m}))},lm=e=>{var n,r;const{onChange:l}=e,{filterValue:i={}}=t.useContext(Qu),{t:a}=Gn(),[o,s]=t.useState({nil:null!==(n=i.nil)&&void 0!==n?n:0,nnil:null!==(r=i.nnil)&&void 0!==r?r:0});return Dl((()=>{const e={};for(const t in o)o[t]&&(e[t]=1);l(e)}),[o]),t.createElement("div",{style:e.style},t.createElement(ue,{checked:!!o.nil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nnil:0}:null,{nil:t})))}},a("qm.table.highSearch.nullText")),t.createElement(ue,{checked:!!o.nnil,onChange:e=>{const t=e.target.checked?1:0;s((e=>Object.assign({},e,t?{nil:0}:null,{nnil:t})))}},a("qm.table.highSearch.notNullText")))},im=e=>{var n;const{column:r}=e,{$size:l}=t.useContext(Ko),{filterValue:i={}}=t.useContext(Qu),{t:a}=Gn(),o=t.useRef(null),{openFilterList:s=!0}=r.filter,c="likes",[d,u]=t.useState(null!==(n=i[c])&&void 0!==n?n:""),[m,p]=t.useState({}),h=t.useMemo((()=>Object.keys(m).length?m:d?{[c]:d}:null),[d,m]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-box"},t.createElement(re.TextArea,{value:d,size:l,autoFocus:!0,placeholder:a("qm.table.filter.searchAreaText",{text:Ia(r.title)}),style:{width:200},disabled:!!Object.keys(m).length,onChange:e=>{u(e.target.value)},onKeyDown:e=>{13===e.keyCode&&o.current.doFinish()}})),t.createElement(lm,{style:{marginTop:6},onChange:e=>{Object.keys(e).length&&u(""),p(e)}}),s&&t.createElement(tm,{column:r,style:{marginTop:6}}),t.createElement(nm,{ref:o,value:h}))},am=e=>{const{$size:n}=t.useContext(Ko),{filterValue:r={}}=t.useContext(Qu),{t:l}=Gn(),i=t.useRef(null),[a,o]=t.useState(r),s=e=>({value:a[e],size:n,disabled:Object.keys(a).some((e=>Ha(e))),onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o((n=>Object.assign({},n,{[e]:t})))},onKeyDown:e=>{13===e.keyCode&&i.current.doFinish()}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement(pe,jn({},s(">"),{placeholder:l("qm.table.highSearch.gtText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement(pe,jn({},s("<"),{placeholder:l("qm.table.highSearch.ltText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement(pe,jn({},s("=="),{placeholder:l("qm.table.highSearch.eqText"),style:{width:150}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement(pe,jn({},s("!="),{placeholder:l("qm.table.highSearch.neqText"),style:{width:150}}))))),t.createElement(lm,{style:{paddingLeft:20},onChange:e=>o(e)}),t.createElement(nm,{ref:i,value:a}))},om=e=>{const{$size:n}=t.useContext(Ko),{filterValue:r={}}=t.useContext(Qu),{t:l}=Gn(),[i,a]=t.useState(r),o=e=>({value:Sa(i[e],Uo),format:Uo,size:n,disabled:Object.keys(i).some((e=>Ha(e))),onChange:t=>{a((n=>Object.assign({},n,{[e]:Na(t,Uo)})))}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"filter-list"},t.createElement("ul",null,t.createElement("li",null,t.createElement("span",{className:"label"},"> "),t.createElement(Kn,jn({},o(">"),{placeholder:l("qm.table.highSearch.gtText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"< "),t.createElement(Kn,jn({},o("<"),{placeholder:l("qm.table.highSearch.ltText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"= "),t.createElement(Kn,jn({},o("=="),{placeholder:l("qm.table.highSearch.eqText"),style:{width:"150px"}}))),t.createElement("li",null,t.createElement("span",{className:"label"},"!="),t.createElement(Kn,jn({},o("!="),{placeholder:l("qm.table.highSearch.neqText"),style:{width:"150px"}}))))),t.createElement(lm,{style:{paddingLeft:20},onChange:e=>a(e)}),t.createElement(nm,{value:i}))},sm=e=>{const{column:n}=e,r=t.useRef(null);return t.createElement(t.Fragment,null,t.createElement(tm,{column:n,isEnum:!0,onChange:(e,t)=>{r.current.doFinish(t?null:{in:e},!1)}}),t.createElement(nm,{ref:r,style:{display:"none"}}))},cm=(e,t,n)=>{let r;for(let l=0;l<e.length;l++){const i=e[l];if(i.children)if(i.children.some((e=>e[n]===t)))r=i[n];else{const e=cm(i.children,t,n);e&&(r=e)}}return r},dm=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&dm(e.children,t),t(e)||e.children&&e.children.length))),um=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...um(e.children,t)),t(e)&&n.push(e)})),n},mm=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=mm(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},pm=(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:pm(e.children,t,n,r)}):e)),hm=(e,t)=>{const n=[];return e.forEach((e=>{e.children&&n.push(...hm(e.children,t)),Array.isArray(e.children)&&e.children.length&&n.push(e[t])})),n},fm=(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 l=fm(e[r].children,t,n);if(l)return[e[r][n],l].flat()}}},gm=(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(...gm(e,t)))),r},vm=t.forwardRef(((e,n)=>{const{className:r,style:l,filterable:i=!0,multiple:a,draggable:o,beforeDrop:s,dataSource:c,fetch:d,autoFocus:u,asyncLoad:m,checkStrictly:p,checkStrategy:h="SHOW_CHILD",placeholder:f,fieldsDefine:g,value:v,height:y,defaultSelectedKeys:b=[],defaultExpandedKeys:E=[],defaultExpandAll:w=!0,showSearchBar:C=!0,showCollapse:S=!0,onSelectChange:N,onCheckChange:T,onDragStart:I,onDragChange:R,onExpand:O}=e,{$size:k}=Xn(e),{t:L}=Gn(),A=(null==g?void 0:g.valueKey)||"value",P=(null==g?void 0:g.textKey)||"text";null==g||g.children;const _=t.useRef(null),F=t.useRef(null),M=ai(_),[H,$]=is(y,{value:y}),[q,K]=t.useState(!1),j=ci((()=>{$(_.current.offsetHeight-te.current.offsetHeight-10)}),5);si((()=>{y||j()}),[M.height]);const[V,z]=t.useState([]),[W,B]=t.useState({}),[U,G]=t.useState([]),[Y,X]=t.useState([]),[Q,Z]=t.useState(""),[J,ee]=t.useState(w),te=t.useRef(null),ne=t.useRef([]),le=t.useRef([]);t.useEffect((()=>{Array.isArray(c)&&(ie(c),G(ae(c)),B({}))}),[c]),t.useEffect((()=>{var e;ce(),u&&(null===(e=F.current)||void 0===e||e.focus())}),[]),Dl((()=>{ce()}),[null==d?void 0:d.params]),Dl((()=>{X(se())}),[W]),t.useImperativeHandle(n,(()=>({INSERT_RECORD:(e,t)=>{const n=Array.isArray(t)?t:[t],r=mm(V,(t=>e===t[A]));r&&(Array.isArray(r.children)?r.children.push(...n):r.children=[...n],ie([...V]))},REMOVE_RECORD:e=>{var t;const n=cm(V,e,A);if(void 0===n&&V.find((t=>t[A]===e)))ie(V.filter((t=>t[A]!==e)));else{const r=mm(V,(e=>n===e[A]));if(!r)return;const l=null===(t=r.children)||void 0===t?void 0:t.findIndex((t=>e===t[A]));l>=0&&(r.children.splice(l,1),ie([...V]))}},UPDATE_RECORD:(e,t)=>{const n=mm(V,(t=>e===t[A]));n&&(D(n,t),ie([...V]))}})));const ie=e=>{z(e),ne.current=e,le.current=hm(e,A)},ae=e=>{if(a)return b;const t=um(e,(e=>b.includes(e[P])));return 1===t.length?[t[0][A]]:[]},oe=e=>{var t;return(null===(t=fm(V,e,A))||void 0===t?void 0:t.slice(0,-1))||[]},se=()=>{if(w)return le.current;const e=[];return U.forEach((t=>{if(a){if("SHOW_ALL"===h&&!le.current.includes(t)&&e.push(...oe(t)),"SHOW_CHILD"===h&&e.push(...oe(t)),"SHOW_PARENT"===h){const n=ao(V,t);if(n){const r=oe(t),l=gm(n,A);e.push(...r,...[t,...l].filter((e=>le.current.includes(e))))}}}else e.push(...oe(t))})),[...new Set([...E,...e])]},ce=()=>hn(void 0,void 0,void 0,(function*(){var e;if(!d)return;const{api:t,params:n,dataKey:r,afterFetch:l,callback:i}=d;try{K(!0);const a=yield t(n);if(200===a.code){let t=Array.isArray(a.data)?a.data:null!==(e=x(a.data,r))&&void 0!==e?e:[];t="function"==typeof l?yield l(t):t,ie(t),G(ae(t)),B({}),null==i||i(t)}}catch(e){}K(!1)})),de=e=>`${e}|${wo.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ue=rr("search-tree"),me={[ue]:!0,[`${ue}--lg`]:"large"===k,[`${ue}--sm`]:"small"===k};return t.createElement("div",{ref:_,className:Pe(me,r),style:l},t.createElement("div",{ref:te,className:"topper",style:{display:C||S?"":"none"}},C&&t.createElement(re,{ref:F,value:Q,size:k,placeholder:f||L("qm.form.inputPlaceholder"),suffix:t.createElement(Nt,null),allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=dm(ne.current,(t=>{if(!e)return!0;const n=t[P]||"";return-1!==de(n).indexOf(e)}));Z(e),z(t),X(w||e?hm(t,A):se())})(e.target.value)}),S&&t.createElement("a",{className:"trigger",onClick:()=>{ee(!J),X(J?[]:le.current)}},J?t.createElement(_e,null):t.createElement(Fe,null)," ",L(J?"qm.form.collect":"qm.form.spread"))),t.createElement(ei,{spinning:q},t.createElement(ye,{fieldNames:{title:P,key:A,children:"children"},multiple:a,draggable:o,blockNode:o,checkable:a,selectable:!a,height:H,disabled:e.disabled,checkStrictly:p,selectedKeys:null!=v?v:U,checkedKeys:null!=v?v:U,expandedKeys:Y,treeData:V,loadData:m?({key:e,children:t})=>hn(void 0,void 0,void 0,(function*(){var n;if(!d||t)return;const{api:r,params:l,dataKey:i,formatter:a=(e=>e),afterFetch:o}=d;try{const t=yield r(a(Object.assign(Object.assign({},l),{[A]:e})));if(200===t.code){let r=Array.isArray(t.data)?t.data:null!==(n=x(t.data,i))&&void 0!==n?n:[];r="function"==typeof o?yield o(r):r;const l=pm(ne.current,e,A,r);ie(l)}}catch(e){}})):void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!Q)return!1;const t=e[P]||"";return-1!==de(t).indexOf(Q)},onDragStart:I,onDragEnter:e=>{X(e.expandedKeys)},onDrop:e=>{const t=e.node.key,n=e.dragNode.key,r=e.node.pos.split("-"),l=e.dropPosition-Number(r[r.length-1]);if(s){if(!1===s(e,V))return}const i=(e,t,n)=>{for(let r=0;r<e.length;r++){if(e[r][A]===t)return n(e[r],r,e);e[r].children&&i(e[r].children,t,n)}},a=[...V];let o;if(i(a,n,((e,t,n)=>{n.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===l)i(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,n=[];i(a,t,((t,r,l)=>{n=l,e=r})),-1===l?n.splice(e,0,o):n.splice(e+1,0,o)}else i(a,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));ie(a)},onDragEnd:e=>{null==R||R(e,V)},onExpand:(e,t)=>{Cn(e)&&ee(!1),le.current.every((t=>e.includes(t)))&&ee(!0),X(e),null==O||O(e,t)},onSelect:e=>{G(e);const t=um(ne.current,(t=>e.includes(x(t,A))));null==N||N(a?t:t[0])},onCheck:e=>{p&&(e=e.checked),G(e),p||("SHOW_CHILD"===h&&(e=e.filter((e=>!le.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,n)=>!n.includes(cm(V,e,A))))));const t=um(ne.current,(t=>e.includes(x(t,A))));null==T||T(a?t:t[0])}})))}));vm.displayName="QmSearchTree";const ym=e=>{var n;const{column:r}=e,{$size:l}=t.useContext(Ko),{filterValue:i={}}=t.useContext(Qu),a=t.useMemo((()=>r.filter.items||r.dictItems||[]),[]),o=t.useMemo((()=>{const e=[];return function t(n){n.forEach((n=>{Array.isArray(n.children)?t(n.children):e.push(n.value)}))}(a),e}),[a]),[s,c]=t.useState(null!==(n=i.in)&&void 0!==n?n:o),[d,u]=t.useState({}),m=t.useMemo((()=>Object.keys(d).length?d:s.length===o.length?null:{in:s}),[s,d]);return t.createElement(t.Fragment,null,t.createElement("div",{className:"tree-panel",style:r.filter.style},t.createElement(vm,{multiple:!0,value:s,dataSource:a,disabled:!!Object.keys(d).length,size:l,style:{height:238},onCheckChange:e=>{c(e.map((e=>e.value)))}})),t.createElement(lm,{style:{marginLeft:-10,marginRight:-10,padding:"6px 0 0 20px",borderTop:"1px solid #e8e8e8"},onChange:e=>{Object.keys(e).length&&c([]),u(e)}}),t.createElement(nm,{value:m}))},bm=e=>{const{column:n,filters:r}=e,{$size:l,prefixCls:i,pagerFilter:a,setFilters:o,clearSuperFilters:s}=t.useContext(Ko),{t:c}=Gn(),[d,u]=t.useState(!1),m=t.useMemo((()=>{const{dataIndex:e,filter:t}=n;return`${e}|${t.type}`}),[n]),p=t.useMemo((()=>!!Object.keys(r[m]||{}).length||!!a[n.dataIndex]),[r,a]),h=(e,t)=>{s(),o({payload:e}),t&&u(!1)},f=t.useMemo((()=>({dataKey:m,filterValue:r[m],onChange:h})),[r]);t.useEffect((()=>{"radio"===n.filter.type&&Jn("Table","表头筛选类型 `radio` 即将被弃用,请使用 `checkbox` 替代")}),[]);const g={text:e=>t.createElement(rm,{column:e}),textarea:e=>t.createElement(im,{column:e}),number:e=>t.createElement(am,{column:e}),date:e=>t.createElement(om,{column:e}),radio:e=>g.checkbox(e),checkbox:e=>t.createElement(sm,{column:e}),tree:e=>t.createElement(ym,{column:e})},v={"head-filter__popper":!0,[`${i}--lg`]:"large"===l,[`${i}--sm`]:"small"===l},y=["cell--filter",{selected:d,actived:p}];return t.createElement(ad,{action:["click"],popupVisible:d,popup:(()=>{const e=g[n.filter.type];return e?t.createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t.createElement(Qu.Provider,{value:f},e(n))):(Jn("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Pe(v),popupStyle:{minWidth:150},onPopupVisibleChange:e=>u(e),builtinPlacements:Xo,destroyPopupOnHide:!0,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t.createElement("div",{className:Pe(y),title:c("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t.createElement("span",{className:"svgicon icon"},t.createElement(Zu,null))))},xm=e=>{const{column:n}=e,{tableRef:r,bordered:l}=t.useContext(Ko),{columns:i,resizable:a,columnsChange:o=yn}=r.current.props,s=t.useMemo((()=>aa(n)),[n]),c={resizable:!0,"is--line":a&&!l};return t.createElement("div",{className:Pe(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:n,scrollBarRef:l}=r.current,a=n.$resizableBar,c=t.offsetWidth/2,d=e.clientX,u=fa(t,n.$table).left-l.current.scrollLeft+c;n.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const m=s.width||s.renderWidth;let p=m;return document.onmousemove=function(e){if("number"!=typeof m)return;const t=e.clientX-d,n=m+t;n<(s.minWidth||as.defaultColumnWidth)||(p=Math.floor(n),a.style.left=`${t+u}px`)},document.onmouseup=function(){n.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(la(i,s.dataIndex).width=p,o([...i]))},!1}})},Em=e=>{const{selectionKeys:n}=e,{tableRef:r,getRowKey:l,fetchParams:i,setSelectionKeysEffect:a,setInvalidRowKeys:o,setSpinning:s,pagination:c,isFetch:d,isWebPagination:u,createWebPageData:m}=t.useContext(Ko),{t:p}=Gn(),{selectionRows:h,recordsMap:f}=r.current,{rowSelection:g}=r.current.props,{fetchAllRowKeys:v,selectAllOnCurrentPage:y,filterable:b,onSelectAll:E}=g,w=t.useRef([]),C=t.useMemo((()=>d&&!!v),[d,v]),N=t.useMemo((()=>!C&&!!y),[C,y]),T=t.useMemo((()=>(null==b||b)&&!N),[b,N]),I=()=>{const{disabled:e}=g;return(e?h.filter((t=>!e(t))):h).map((e=>l(e,e.index)))},R=()=>u?sa(m()):Array.from(f.values()),O=t.useMemo((()=>(()=>{const{disabled:e}=g;if(C)return w.current.length?w.current:M(Array.from(f.keys()),I());if(!N)return e?Array.from(f.keys()).filter((t=>!e(f.get(t)))):Array.from(f.keys());const t=e?R().filter((t=>!e(t))).map((e=>l(e,e.index))):R().map((e=>l(e,e.index)));return M(t,I())})()),[f,w,h,c]),k=n.filter((e=>!O.includes(e))),L=n.length-k.length,A=L>0&&L<O.length,P=!!L&&L===O.length;o(k);const _=()=>hn(void 0,void 0,void 0,(function*(){var e;const t=v;let n=[];s(!0);try{const r=yield t.api(i);if(200===r.code){n=Array.isArray(r.data)?r.data:null!==(e=x(r.data,t.dataKey))&&void 0!==e?e:[];const{disabled:i}=g;i&&(n=S(n,R().filter((e=>i(e))).map((e=>l(e,e.index))))),w.current=n}}catch(e){}return s(!1),n})),F=e=>hn(void 0,void 0,void 0,(function*(){let t=[];t=C?e?yield _():[]:e?O.slice(0):[],t=[...new Set([...t,...k])],a(t),null==E||E(e,t)})),D=()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{F(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>hn(void 0,void 0,void 0,(function*(){let e=[];e=S(n,C?yield _():O),e=[...new Set([...e,...k])],a(e)}))},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{F(!1)}}];return t.createElement(ge,{items:e})};return t.createElement("div",{className:"cell--selection"},t.createElement(ue,{checked:P,indeterminate:A,disabled:!O.length,onChange:e=>F(e.target.checked)}),T&&t.createElement(me,{overlayClassName:"all-selection__popper",dropdownRender:()=>D()},t.createElement(Fe,{className:"svgicon icon"})),N&&t.createElement(X,{placement:"top",title:p("qm.table.selection.currentPage")},t.createElement(ht,{className:"info"})))},wm=e=>{const{style:n}=e,{tableRef:r,rowExpandedKeys:l,setRowExpandedKeys:i,createAllExpandedKeys:a,filters:o,pagerFilter:s,superFilters:c}=t.useContext(Ko),{expandable:d}=r.current.props,[u,m]=t.useState((null==d?void 0:d.defaultExpandAllRows)||!1);Dl((()=>{p(l)!==u&&m(!u)}),[l]),Dl((()=>{r.current.isTreeTable&&(Cn(o)&&Cn(s)&&Cn(c)||En((()=>!p(l)&&i(a()))))}),[o,s,c]);const p=e=>a().every((t=>e.includes(t))),h={[`${rr("expand")}--icon`]:!0,expanded:u,collapsed:!u};return t.createElement("span",{className:Pe(h),title:"",onClick:e=>{e.stopPropagation(),m(!u),i(u?[]:a())},style:n})},Cm=()=>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"})),Sm=()=>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"})),Nm=e=>{const{tableColumns:n}=e,{global:r}=t.useContext(on),{tableRef:l,prefixCls:i,layout:a,flattenColumns:o,sorter:s,filters:c,superFilters:d,pagerFilter:u,selectionKeys:m,isFetch:p,treeExpandIndex:h,tableChange:f,setSorter:g,setElementStore:v,resetTableScroll:y,getStickyLeft:b,getStickyRight:x,createTableFullData:E}=t.useContext(Ko),{ellipsis:w,resizable:C,multipleSort:S,rowSelection:N,expandable:T,keepScrollOnDataChange:I}=l.current.props,[R,O]=as.sortDirections,{t:k}=Gn(),L=t.useRef(null),A=t.useMemo((()=>!p),[p]),P=t.useMemo((()=>!(null==T?void 0:T.hideExpandAll)),[T]),_=t.useMemo((()=>!!N&&(p?!(!N.selectAllOnCurrentPage&&!N.fetchAllRowKeys):!N.hideSelectAll)),[p,N]),F=t.useMemo((()=>Object.fromEntries(Object.entries(s).filter((([e,t])=>null!==t)))),[s]);si((()=>{B(),V(!0),f(),!I&&En(y)}),[c,d]),si((()=>{G(),V(!0),f(),!I&&En(y)}),[u]),si((()=>{j(),f(),!I&&En(y)}),[s]),t.useEffect((()=>{!Cn(c)&&B(),!Cn(s)&&j()}),[]),t.useLayoutEffect((()=>{D()}),[]);const D=()=>{v("$header",L.current)},M=(e,n,i)=>{var a,o;const{dataIndex:c,colSpan:d,rowSpan:u,fixed:m,align:p,theadAlign:h,theadWrap:f=(null==r?void 0:r.labelWrap),theadClassName:g="",sorter:v,filter:y,required:E,headRender:S}=e;if(0===d)return null;const N=h||p,T=["header--column",{"col--ellipsis":!f&&w,"col--center":"center"===N,"col--right":"right"===N,"column--required":!!E,"column-has-sorter":v,"column-has-filter":y,"column--sort":!!s[c],"cell-fix-left":"left"===m,"cell-fix-right":"right"===m,"cell-fix-left-last":"left"===m&&!(null===(a=i[n+(null!=d?d:1)])||void 0===a?void 0:a.fixed),"cell-fix-right-first":"right"===m&&!(null===(o=i[n-1])||void 0===o?void 0:o.fixed),[g]:!!g}],I={left:"left"===m?`${b(c)}px`:"",right:"right"===m?`${x(c,"thead")}px`:""},R=C&&![as.expandableColumn,as.selectionColumn].includes(c);return t.createElement("th",{key:c,className:Pe(T),colSpan:d,rowSpan:u,style:Object.assign({},I),onClick:t=>K(t,e)},t.createElement("div",{className:"cell--wrapper"},S?t.createElement("div",{className:"cell--text cell"},S(e,l.current.tableFullData)):t.createElement(t.Fragment,null,t.createElement("div",{className:"cell--text"},H(e)),y?q(e):null)),R&&t.createElement(xm,{column:e}))},H=e=>{const{dataIndex:n,type:r,sorter:i,title:a,description:o}=e;if(n===as.selectionColumn&&"checkbox"===r){if("checkbox"===r)return t.createElement("div",{className:"cell"},_?t.createElement(Em,{selectionKeys:m}):k("qm.table.config.selectionText"));if("radio"===r)return t.createElement("div",{className:"cell"},a)}const c=[];return c.push(t.createElement("div",{key:0,className:"cell",title:Ia(a)},l.current.isTreeTable&&n===h&&P?t.createElement(wm,null):null,n===as.expandableColumn&&P?t.createElement(wm,null):a)),o&&c.push(t.createElement(X,{key:1,placement:"top",title:o},t.createElement(ht,{className:"tip"}))),i&&c.push($(s[n])),c},$=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:k("qm.table.sorter.text")},t.createElement("span",{className:Pe(n)},t.createElement(Cm,null)),t.createElement("span",{className:Pe(r)},t.createElement(Sm,null)))},q=e=>t.createElement(bm,{column:e,filters:c}),K=(e,t)=>{const{sorter:n,dataIndex:r}=t;if(n){const e=s[r],t=e?e===O?null:O:R;S?(delete s[r],g({payload:Object.assign({},s,{[r]:t})})):g({payload:Object.assign({},{[r]:t})})}},j=()=>{A&&V()},V=e=>{const t=Object.keys(F).length>0;e?t&&W(F):W(t?F:{index:R})},z=(e,t)=>Number.isNaN(e-t)?e.toString().localeCompare(t.toString()):e-t,W=e=>{const t=((e,t)=>e.sort(((e,n)=>{for(const r in t){const l=o.find((e=>e.dataIndex===r)),i=t[r],a=ya(e,r),s=ya(n,r),c="function"!=typeof(null==l?void 0:l.sorter)?z(a,s):l.sorter(e,n);if(0!==c)return"ascend"===i?c:-c}return 0})).slice(0))(l.current.tableFullData,e);E(t)},B=()=>{A&&U()},U=()=>{const{tableOriginData:e,isOriginTree:t}=l.current,n=d.length?Oa(d):Oa(c);let r=Zi(e,A?n:"",t);r=qa(r,u,t),E(r)},G=()=>{U()},Y=ua(n),{tableBodyWidth:Q}=a;return t.createElement("div",{ref:L,className:`${i}--header-wrapper`},t.createElement("table",{className:`${i}--header`,cellSpacing:"0",cellPadding:"0",style:{width:Q?`${Q}px`:""}},t.createElement("colgroup",null,o.map((e=>{const{dataIndex:n,width:r,renderWidth:l}=e;return t.createElement("col",{key:n,style:{width:`${r||l}px`,minWidth:`${r||l}px`}})}))),t.createElement("thead",null,(e=>e.map(((e,n)=>t.createElement("tr",{key:n,className:"header--row"},e.map(((t,n)=>M(t,n,e)))))))(Y))))},Tm=t.createContext([]),Im=(e,t,n,r,l,i,a,o,s,c)=>{var d;const{clientX:u,clientY:m}=e,{top:p,height:h}=e.target.getBoundingClientRect(),f=(((null==l?void 0:l.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=Rm(o,n.eventKey);if(m<p+h/2){const e=a.findIndex((e=>e===v.key)),t=a[e<=0?0:e-1];v=Rm(o,t)}const y=v.key,b=v,x=v.key;let E=0,w=0;if(!g.includes(y))for(let e=0;e<f&&km(v);e+=1)v=v.parent,w+=1;const C=t.data,S=v.node;let N=!0;return Lm(v)&&0===v.level&&m<p+h/2&&i({dragNode:C,dropNode:S,dropPosition:-1})&&v.key===n.eventKey?E=-1:(b.children||[]).length&&g.includes(x)?i({dragNode:C,dropNode:S,dropPosition:0})?E=0:N=!1:0===w?f>-1.5?i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:i({dragNode:C,dropNode:S,dropPosition:0})?E=c?1:0:i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1:i({dragNode:C,dropNode:S,dropPosition:1})?E=1:N=!1,{dropPosition:E,dropLevelOffset:w,dropTargetKey:v.key,dropTargetPos:v.pos,dragOverNodeKey:x,dropContainerKey:0===E?null:(null===(d=v.parent)||void 0===d?void 0:d.key)||null,dropAllowed:N}},Rm=(e,t)=>e[t],Om=e=>e.split("-"),km=e=>{if(e.parent){const t=Om(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1},Lm=e=>{const t=Om(e.pos);return 0===Number(t[t.length-1])},Am=({openDragSort:e})=>{const{tableRef:n,getRowKey:r,rowExpandedKeys:l,setRowExpandedKeys:i,createTableData:a,dataChange:o}=t.useContext(Ko),{tableFullData:s,recordsMap:c,isTreeTable:d}=n.current,{beforeRowDrop:u}=n.current.props,m=bn,p=t.useRef(null),h=t.useRef(null),f=t.useRef(null),g=t.useRef(),[v,y]=t.useState({}),[b,x]=t.useState(null),[E,w]=t.useState([]),[C,S]=t.useState(0),[N,T]=t.useState({dropPosition:null,dropLevelOffset:null,dropContainerKey:null,dropTargetKey:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),I=e=>{T((t=>Object.assign({},t,e)))};t.useLayoutEffect((()=>{e&&y((e=>{const t={},n=(e,l=null,i=0)=>{const a=[];return e.forEach(((e,o)=>{const s=r(e,e.index),c={index:o,key:s,level:i,node:e,parent:l,pos:(d=(null==l?void 0:l.pos)||"0",u=o,`${d}-${u}`),nodes:[...(null==l?void 0:l.nodes)||[],e]};var d,u;Array.isArray(e.children)&&(c.children=n(e.children,c,i+1)),t[s]=c,a.push(c)})),a};return n(e),t})(s))}),[s]),t.useEffect((()=>()=>{window.removeEventListener("dragend",k)}),[]);const R=()=>{I({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},O=()=>{null!==b&&(x(null),I({dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null})),h.current=null,f.current=null},k=e=>{L(),window.removeEventListener("dragend",k)},L=(e,t,n)=>{I({dragOverNodeKey:null}),O(),p.current=null,window.removeEventListener("dragend",k)},A=e=>{const t=e.node.eventKey,n=e.dragNode.eventKey,l=e.node.pos.split("-"),i=e.dropPosition-Number(l[l.length-1]);if(u){if(!1===u({dragNode:e.dragNode.data,dropPosition:e.dropPosition,dropToGap:e.dropToGap,dragNodesKeys:e.dragNodesKeys,node:e.node.data,event:e.event},s))return}const c=(e,t,n)=>{for(let l=0;l<e.length;l++){if(r(e[l],e[l].index)===t)return n(e[l],l,e);e[l].children&&c(e[l].children,t,n)}},d=[...s];let m;if(c(d,n,((e,t,n)=>{n.splice(t,1),m=e})),e.dropToGap){let e,n=[];c(d,t,((t,r,l)=>{n=l,e=r})),-1===i?n.splice(e,0,m):n.splice(e+1,0,m)}else c(d,t,(e=>{e.children=e.children||[],e.children.unshift(m)}));a(d),o()};return{onNodeDragStart:(e,t)=>{const{eventKey:n}=t;p.current=t,h.current={x:e.clientX,y:e.clientY};const r=((e,t)=>{if(!e)return[];const n=e.slice(),r=n.indexOf(t);return r>=0&&n.splice(r,1),n})(l,n);x(n),w(((e,t)=>{const n=[];return function e(t=[]){t.forEach((({key:t,children:r})=>{n.push(t),e(r)}))}(Rm(t,e).children),n})(n,v)),S(2*as.treeTable.textIndent),i(r),window.addEventListener("dragend",k)},onNodeDragEnter:(e,t)=>{const{eventKey:n}=t;if(f.current!==n&&(f.current=n),!p.current)return void R();const{dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:u,dropAllowed:y,dragOverNodeKey:x}=Im(e,p.current,t,C,h.current,m,Array.from(c.keys()),v,l,!d);-1===E.indexOf(o)&&y?(g.current||(g.current={}),Object.keys(g.current).forEach((e=>{clearTimeout(g.current[e])})),p.current.eventKey!==n&&(e.persist(),g.current[n]=window.setTimeout((()=>{var e;if(null===b)return;let t=[...l];const r=Rm(v,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})(l,n)),i(t)}),800)),p.current.eventKey!==o||0!==a?I({dragOverNodeKey:x,dropPosition:r,dropLevelOffset:a,dropTargetKey:o,dropContainerKey:s,dropTargetPos:u,dropAllowed:y}):R()):R()},onNodeDragOver:(e,t)=>{if(!p.current)return;const{dropPosition:n,dropLevelOffset:r,dropTargetKey:i,dropContainerKey:a,dropAllowed:o,dropTargetPos:s,dragOverNodeKey:u}=Im(e,p.current,t,C,h.current,m,Array.from(c.keys()),v,l,!d);-1===E.indexOf(i)&&o&&(p.current.eventKey===i&&0===r?null===N.dropPosition&&null===N.dropLevelOffset&&null===N.dropTargetKey&&null===N.dropContainerKey&&null===N.dropTargetPos&&!1===N.dropAllowed&&null===N.dragOverNodeKey||R():n===N.dropPosition&&r===N.dropLevelOffset&&i===N.dropTargetKey&&a===N.dropContainerKey&&s===N.dropTargetPos&&o===N.dropAllowed&&u===N.dragOverNodeKey||I({dropPosition:n,dropLevelOffset:r,dropTargetKey:i,dropContainerKey:a,dropTargetPos:s,dropAllowed:o,dragOverNodeKey:u}))},onNodeDragLeave:(e,t)=>{f.current!==t.eventKey||e.currentTarget.contains(e.relatedTarget)||(R(),f.current=null)},onNodeDragEnd:L,onNodeDrop:(e,t,n=!1)=>{const{dropPosition:r,dropTargetKey:l,dropTargetPos:i,dropAllowed:a,dragOverNodeKey:o}=N;if(!a)return;if(I({dragOverNodeKey:null}),O(),null===l)return;const s=Object.assign(Object.assign({},((e,{dragOverNodeKey:t,dropPosition:n,keyEntities:r})=>{const l=Rm(r,e);return{eventKey:e,pos:l?l.pos:"",dragOver:t===e&&0===n,dragOverGapTop:t===e&&-1===n,dragOverGapBottom:t===e&&1===n}})(l,{dropPosition:r,dragOverNodeKey:o,keyEntities:v})),{data:Rm(v,l).node});-1!==E.indexOf(l)&&Jn("Table Draggable","无法拖放到 `dragNode` 的子节点");const c=Om(i),d={event:e,node:s,dragNode:p.current,dragNodesKeys:[p.current.eventKey].concat(E),dropToGap:0!==r,dropPosition:r+Number(c[c.length-1])};n||A(d),p.current=null},indent:C,dropOptions:N}};function Pm(){const[,t]=e.useReducer((e=>e+1),0);return t}const _m=t.forwardRef(((e,n)=>{const{rowKey:r,rowIndex:l,row:i,className:a,style:o,indent:s,filter:c,dropOption:d,onNodeDragStart:u,onNodeDragEnter:m,onNodeDragOver:p,onNodeDragLeave:h,onNodeDragEnd:f,onNodeDrop:g}=e,v=t.useRef({eventKey:r,data:i,props:e}),y=t.useRef(!1),[b,x]=t.useState(!1),{dropPosition:E,dropLevelOffset:w,dragOverNodeKey:C,dropTargetKey:S,dropContainerKey:N}=d,T=C===r&&0===E,I=C===r&&-1===E,R=C===r&&1===E,O=i._level||0,k={};switch(E){case-1:Object.assign(k,{top:0,left:-w*s+O*s});break;case 1:Object.assign(k,{bottom:0,left:-w*s+O*s});break;case 0:Object.assign(k,{bottom:0,left:s+O*s})}const L={"body--row-draggable":!0,"body--row-dragging":b,"drop-target":S===r,"drop-container":N===r,"drag-over":T,"drag-over-gap-top":I,"drag-over-gap-bottom":R};return t.createElement("tr",{ref:n,"data-row-key":r,"data-row-index":l,className:Pe(a,L),style:o,draggable:!0,onMouseDown:e=>{var t;c&&(t=e.target.matches(c),y.current=t)},onDragStart:e=>{if(e.stopPropagation(),y.current)return e.preventDefault();x(!0),u(e,v.current);try{e.dataTransfer.setData("text/plain","")}catch(e){}},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),m(e,v.current)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),p(e,v.current)},onDragLeave:e=>{e.stopPropagation(),h(e,v.current)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),x(!1),g(e,v.current)},onDragEnd:e=>{e.stopPropagation(),x(!1),f(e,v.current)}},e.children,C===r&&null!==E&&null!==w&&t.createElement("td",{className:"drop-indicator",style:k}))}));_m.displayName="DraggableTr";const Fm=e=>{const{selectionKeys:n,column:r,record:l,rowKey:i}=e,{tableRef:a}=t.useContext(Ko),{rowSelection:o}=a.current.props,s=t.useMemo((()=>r.type||""),[r.type]),c=e=>{var t,r;const{isTreeTable:l,tableFullData:i}=a.current,s=null===(t=o.checkStrictly)||void 0===t||t;if(!l||s)return!1;const c=Aa(i,(t=>t._rowKey===e));return((e,t)=>{const n=new Set(t);let r=!1,l=!1;for(const t of e)if(n.has(t)?r=!0:l=!0,r&&l)break;return r&&l})(da(null!==(r=null==c?void 0:c.children)&&void 0!==r?r:[],(e=>e._rowKey)),n)};return"radio"===s?(()=>{var e;const r=o.disabled,a=null!==(e=null==r?void 0:r(l))&&void 0!==e&&e,s=!a&&n[0]===i;return t.createElement(fe,{checked:s,disabled:a})})():(()=>{var e;const r=o.disabled,a=null!==(e=null==r?void 0:r(l))&&void 0!==e&&e,s=!!n.includes(i);return t.createElement(ue,{checked:s,indeterminate:c(i),disabled:a})})()},Dm=e=>{const{record:n,rowKey:r,style:l}=e,{tableRef:i,rowExpandedKeys:a,setRowExpandedKeys:o}=t.useContext(Ko),{expandable:s={}}=i.current.props,[c]=t.useState("function"==typeof s.rowExpandable&&!s.rowExpandable(n)),d=t.useMemo((()=>a.includes(r)),[a,r]);Dl((()=>{var e;null===(e=s.onExpand)||void 0===e||e.call(s,d,n)}),[d]);const u={[`${rr("expand")}--icon`]:!0,expanded:d,collapsed:!d,disabled:c};return t.createElement("span",{className:Pe(u),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=d?a.filter((e=>e!==r)):[...a,r];o(t)},style:l})},Mm=t.createContext({}),Hm=t.forwardRef(((e,n)=>{var r;const{$size:l,doFieldValidate:i}=t.useContext(Ko),{dataKey:a,doFieldUpdate:o,cellValueChange:s}=t.useContext(Mm),{column:c,row:d,rowKey:u,columnKey:m,options:p,isTextArea:h}=e,{t:f}=Gn(),g=Pm(),v=t.useRef(!1),{dataIndex:y}=c,{type:b,extra:x={},rules:E=[],onInput:w,onChange:C,onEnter:S,onBlur:N}=p,T=ya(d,y),I=Object.assign({},{minRows:1,maxRows:4},x.autoSize),R=h?{rows:I.minRows,autoSize:I}:null,O=x.password?re.Password:h?re.TextArea:re;return t.createElement(O,jn({ref:n,size:l,value:T,maxLength:x.maxLength,showCount:x.showCount},R,{autoComplete:x.password?"new-password":"off",placeholder:null!==(r=x.placeholder)&&void 0!==r?r:f("qm.table.editable.inputPlaceholder"),allowClear:x.allowClear,readOnly:x.readOnly,disabled:x.disabled,suffix:x.suffix,onChange:e=>{var t;const n=null!==(t=e.target.value)&&void 0!==t?t:"";ba(d,y,n),i(E,n,u,m,Ia(c.title)),g(),null==w||w({[a]:n}),v.current=!0},onBlur:e=>{var t;const n=null!==(t=e.target.value)&&void 0!==t?t:"";v.current&&(v.current=!1,o(d,u,m),null==C||C({[a]:n},d),null==N||N({[a]:n},d),s())},onKeyUp:e=>{var t;if(13===e.keyCode&&!e.shiftKey){const n=null!==(t=e.target.value)&&void 0!==t?t:"";null==S||S({[a]:n},d)}},onKeyDown:e=>{h&&13===e.keyCode&&!e.shiftKey&&S&&e.preventDefault()}}))}));Hm.displayName="TextCell";const $m=t.forwardRef(((e,n)=>{const{size:r,defaultValue:l,value:i,min:a,max:o,prefix:s,suffix:c,placeholder:d,maxLength:u,precision:m,stringMode:p,allowClear:h,readOnly:f,disabled:g,formatter:v=(e=>e.toString()),parser:y=(e=>e),onFocus:b}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<a&&(t=a.toString()),m>=0&&""!==t&&(t=new Xt(t).toFixed(m)),t},E=void 0!==i,[w,C]=t.useState(null!=l?l:""),S=v(E?i:w),N=y(S);Dl((()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e,N)}),[w]);return t.createElement(re,{ref:n,size:r,value:S,maxLength:u,prefix:s,suffix:c,placeholder:d,allowClear:h,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===m&&n.includes(".")&&(r=!1),a>=0&&n.startsWith("-")&&(r=!1),r){if(!p&&(Number(n)>Number.MAX_SAFE_INTEGER||Number(n)<Number.MIN_SAFE_INTEGER))return;(t=>{var n;E?null===(n=e.onChange)||void 0===n||n.call(e,t):C(t)})(n)}},onFocus:b,onBlur:()=>{var t;const n=x(N);null===(t=e.onBlur)||void 0===t||t.call(e,n,N)},onKeyUp:t=>{var n;13===t.keyCode&&(null===(n=e.onEnter)||void 0===n||n.call(e,x(N),N))}})}));$m.displayName="InputNumber";const qm=t.forwardRef(((e,n)=>{var r,l;const{$size:i,doFieldValidate:a}=t.useContext(Ko),{dataKey:o,doFieldUpdate:s,cellValueChange:c}=t.useContext(Mm),{column:d,row:u,rowKey:m,columnKey:p,options:h}=e,{t:f}=Gn(),g=Pm(),v=t.useRef(!1),{dataIndex:y,precision:b,formatType:x}=d,{type:E,extra:w={},rules:C=[],onInput:S,onChange:N,onEnter:T,onBlur:I}=h,R=ya(u,y);let O,k;"finance"===x&&(O=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},k=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===x&&(O=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new Xt(e).times(100).toNumber()}`,k=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new Xt(e).times(.01).toString());const L=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"";return t.createElement($m,{ref:n,size:i,value:R,min:w.min,max:w.max,precision:b,stringMode:w.stringMode,prefix:w.prefix,suffix:null!==(r=w.suffix)&&void 0!==r?r:"percent"===x?"%":void 0,placeholder:null!==(l=w.placeholder)&&void 0!==l?l:f("qm.table.editable.inputPlaceholder"),maxLength:w.maxLength,allowClear:w.allowClear,readOnly:w.readOnly,disabled:w.disabled,formatter:O,parser:k,onChange:e=>{ba(u,y,e),a(C,e,m,p,Ia(d.title)),g(),null==S||S({[o]:e}),v.current=!0},onBlur:(e,t)=>{if(!v.current)return;v.current=!1;let n=w.stringMode?e:L(e);"percent"===x&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),ba(u,y,n),s(u,m,p),null==N||N({[o]:n},u),null==I||I({[o]:n},u),c()},onEnter:(e,t)=>{let n=w.stringMode?e:L(e);"percent"===x&&"."===t.charAt(t.length-1)&&(n=Number(e)/100),null==T||T({[o]:n},u)}})}));qm.displayName="NumberCell";const Km=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext(Ko),{dataKey:a,doFieldUpdate:o,cellValueChange:s}=t.useContext(Mm),{column:c,row:d,rowKey:u,columnKey:m,options:p,isMultiple:h}=e,{t:f}=Gn();Pm();const{dataIndex:g,dictItems:v=[]}=c,{type:y,extra:b={},rules:x=[],items:E,onChange:w,onEnter:C}=p,S=E||v,N=ya(d,g);let T=N;return t.createElement(de,{mode:h?"multiple":void 0,size:l,popupClassName:as.popupClassName,value:N||void 0,placeholder:null!==(n=b.placeholder)&&void 0!==n?n:f("qm.table.editable.selectPlaceholder"),allowClear:b.allowClear,listHeight:b.listHeight,maxTagCount:b.collapseTags?"responsive":void 0,maxTagTextLength:b.maxTagTextLength,disabled:b.disabled,style:{width:"100%"},showSearch:null===(r=b.filterable)||void 0===r||r,filterOption:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.children)||void 0===n?void 0:n.toString())||"";return`${r}|${wo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{ba(d,g,e),i(x,e,u,m,Ia(c.title)),o(d,u,m),null==w||w({[a]:e},d),s()},onSelect:e=>{T=e},onInputKeyDown:e=>{13===e.keyCode&&En((()=>null==C?void 0:C({[a]:T},d)))}},S.map((e=>t.createElement(de.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},jm=e=>{var n;const{$size:r,doFieldValidate:l}=t.useContext(Ko),{dataKey:i,doFieldUpdate:a,cellValueChange:o}=t.useContext(Mm),{column:s,row:c,rowKey:d,columnKey:u,options:m,dateType:p}=e;Gn(),Pm();const{dataIndex:h}=s,{type:f,extra:g={},rules:v=[],onChange:y}=m,b=ya(c,h);return t.createElement(Kn,{size:r,popupClassName:as.popupClassName,value:null!==(n=Sa(b,Ya[p]))&&void 0!==n?n:void 0,picker:Ga[p],format:g.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:n}=g;return t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day")})(e),placeholder:g.placeholder,allowClear:g.allowClear,disabled:g.disabled,style:{width:"100%"},onChange:e=>{const t=Na(e,Ya[p]);ba(c,h,t),l(v,t,d,u,Ia(s.title)),a(c,d,u),null==y||y({[i]:t},c),o()}})},Vm=e=>{var n;const{$size:r,doFieldValidate:l}=t.useContext(Ko),{dataKey:i,doFieldUpdate:a,cellValueChange:o}=t.useContext(Mm),{column:s,row:c,rowKey:d,columnKey:u,options:m}=e;Gn(),Pm();const{dataIndex:p}=s,{type:h,extra:f={},rules:g=[],onChange:v}=m,y="HH:mm:ss",b=ya(c,p);return t.createElement(Vn,{size:r,popupClassName:as.popupClassName,value:null!==(n=Sa(b,y))&&void 0!==n?n:void 0,format:f.format||y,placeholder:f.placeholder,allowClear:f.allowClear,disabled:f.disabled,style:{width:"100%"},onChange:e=>{const t=Na(e,y);ba(c,p,t),l(g,t,d,u,Ia(s.title)),a(c,d,u),null==v||v({[i]:t},c),o()}})},zm=e=>{const{$size:n,doFieldValidate:r}=t.useContext(Ko),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Mm),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e;Gn(),Pm();const{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],onChange:g}=u,{trueValue:v=Wo,falseValue:y=Bo,disabled:b}=h,x=ya(s,m);return t.createElement(ue,{checked:x===v,disabled:b,onChange:e=>{const t=e.target.checked?v:y;ba(s,m,t),r(f,t,c,d,Ia(o.title)),i(s,c,d),null==g||g({[l]:t},s),a()}})},Wm=e=>{const{$size:n,doFieldValidate:r}=t.useContext(Ko),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Mm),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e;Gn(),Pm();const{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],onChange:g}=u,{trueValue:v=Wo,falseValue:y=Bo,disabled:b}=h,x=ya(s,m);return t.createElement(be,{checked:x===v,disabled:b,onChange:e=>{const t=e?v:y;ba(s,m,t),r(f,t,c,d,Ia(o.title)),i(s,c,d),null==g||g({[l]:t},s),a()}})},Bm=e=>{const{$size:n,doFieldValidate:r}=t.useContext(Ko),{dataKey:l,doFieldUpdate:i,cellValueChange:a}=t.useContext(Mm),{column:o,row:s,rowKey:c,columnKey:d,options:u}=e,{dataIndex:m}=o,{type:p,extra:h={},rules:f=[],render:g,onChange:v}=u;if(!g)return Jn("Table","单元格编辑的自定义渲染,必须设置 `render` 参数"),null;const y=ya(s,m),b=e=>{ba(s,m,e),r(f,e,c,d,Ia(o.title)),i(s,c,d),null==v||v({[l]:e},s),a()},x=g(s,o,b);return t.isValidElement(x)?t.cloneElement(x,{value:y,disabled:h.disabled,readOnly:h.readOnly,popupClassName:as.popupClassName,onChange:b}):null},Um=e=>{var n,r,l;const{multiple:i,tree:a={},defaultSelectedKeys:o,className:s,style:c,onClose:d}=e,{$size:u}=Xn(e),{t:m}=Gn(),[p,h]=t.useState(),[f]=t.useState(null===(n=a.fetch)||void 0===n?void 0:n.params),g={[`${rr("tree-helper")}--wrapper`]:!0},v=a.fetch?Object.assign(Object.assign({},Nn(a.fetch,["params","valueKey","textKey"])),{params:f}):void 0;return t.createElement("div",{className:Pe(g,s),style:c},t.createElement(vm,{multiple:i,fetch:v,fieldsDefine:{valueKey:null===(r=a.fetch)||void 0===r?void 0:r.valueKey,textKey:null===(l=a.fetch)||void 0===l?void 0:l.textKey},autoFocus:!0,asyncLoad:a.asyncLoad,checkStrictly:a.checkStrictly,checkStrategy:a.checkStrategy,defaultSelectedKeys:o,defaultExpandAll:a.defaultExpandAll,onSelectChange:e=>h(e),onCheckChange:e=>h(e)}),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${qo[u]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(er,{onClick:()=>d(null),style:{marginRight:8}},m("qm.dialog.cancel")),t.createElement(er,{type:"primary",disabled:!p,onClick:()=>d(p)},m("qm.dialog.confirm"))))};Um.displayName="TreeHelper";const Gm=t.forwardRef(((e,n)=>{var r,l,i,a;const{$size:o,flattenColumns:s,doFieldValidate:c}=t.useContext(Ko),{dataKey:d,visible:u,setVisible:m,doFieldUpdate:p,cellValueChange:h}=t.useContext(Mm),{column:g,row:v,rowKey:y,columnKey:b,options:x}=e,{t:E}=Gn();Pm();const w=!!(null===(r=x.helper)||void 0===r?void 0:r.combinedDataIndex),{dataIndex:C,precision:S}=g,{type:N,extra:T={},rules:I=[],helper:R={},onChange:O,onEnter:k}=x,L=xa(v,w?R.combinedDataIndex:C),A=R.fieldAliasMap;A||Jn("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof A?A():A||{};Object.keys(P).includes(C)||Jn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),w&&(R.combinedDataIndex.split("|").every((e=>Object.keys(P).includes(e)))||Jn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),P[C].includes("|")&&Jn("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const _=e=>{const{beforeOpen:t}=R,n=(null!=t?t:bn)({[d]:L},v,g);(null==n?void 0:n.then)?n.then((()=>{m(!0),null==e||e()})).catch((()=>{})):!1!==n&&(m(!0),null==e||e())},F=()=>{m(!1)},D=(e="",t)=>{var n;if(f(t)&&Object.keys(t).length)for(const e in t){const r=t[e],l=s.find((t=>t.dataIndex===e));if(l){ba(v,e,r,l.precision);const t=null===(n=l.editRender)||void 0===n?void 0:n.call(l,v,l);t&&Array.isArray(t.rules)&&c(t.rules,r,y,e,Ia(l.title))}else ba(v,e,r)}ba(v,C,e,S),c(I,e,y,b,Ia(g.title)),p(v,y,b),null==O||O({[d]:e},v),h()},M={visible:u,title:E("qm.searchHelper.text"),width:null!==(l=R.width)&&void 0!==l?l:"40%",loading:!1,wrapClassName:as.popupClassName,bodyStyle:{paddingBottom:`${qo[o]+20}px`},onClose:()=>{F()}},H=Object.assign(Object.assign({},R),{defaultSelectedKeys:[L],size:o,onClose:e=>{e?(e=>{const t={};for(const n in P){const r=P[n];n!==C&&(t[n]=xa(e,r))}const n=P[C]?xa(e,P[C]):"";D(n,t);const{closed:r}=R;m(!1),null==r||r(e)})(e):F()}});return t.createElement(t.Fragment,null,t.createElement(re.Search,{ref:n,value:L,allowClear:null===(i=T.allowClear)||void 0===i||i,readOnly:T.readOnly,disabled:T.disabled,placeholder:null!==(a=T.placeholder)&&void 0!==a?a:E("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyDown:e=>{13===e.keyCode&&(e.target.value,!u&&_())},onDoubleClick:()=>{_()},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&("INPUT"!==t.target.tagName?_():D(""))}}),t.createElement(Mi,M,t.createElement(Um,H)))}));Gm.displayName="TreeHelperCell";const Ym=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext(Ko),{dataKey:a,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=t.useContext(Mm),{column:u,row:m,rowKey:p,columnKey:h,options:f}=e,{t:g}=Gn();Pm(),t.useLayoutEffect((()=>{f.items&&E(f.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const[v,y]=t.useState(f.items||[]),b=t.useRef({}),x=t.useRef([]),E=e=>x.current=e,{dataIndex:w}=u,{type:C,extra:S={},items:N=[],rules:T=[],helper:I={},onInput:R,onChange:O,onEnter:k}=f,L=ya(m,w),A=I.fieldAliasMap;A||Jn("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof A?A():A||{};Object.keys(P).includes("valueKey")&&Object.keys(P).includes("textKey")||Jn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=P;const _=e=>{const{beforeOpen:t}=I,n=(null!=t?t:bn)({[a]:L},m,u);(null==n?void 0:n.then)?n.then((()=>{s(!0),null==e||e()})).catch((()=>{})):!1!==n&&(s(!0),null==e||e())},F=()=>{s(!1)},M=e=>{ba(m,w,e),i(T,e,p,h,Ia(u.title)),c(m,p,h),null==O||O({[a]:e},m,x.current),d()},H={visible:o,title:g("qm.searchHelper.text"),width:null!==(n=I.width)&&void 0!==n?n:"40%",loading:!1,wrapClassName:as.popupClassName,bodyStyle:{paddingBottom:`${qo[l]+20}px`},onClose:()=>{F()}},$=Object.assign(Object.assign({},I),{size:l,multiple:!0,initialValue:D({},I.initialValue),defaultSelectedKeys:L,onClose:e=>{e?(e=>{const{textKey:t,valueKey:n}=P;E(e);const r=x.current.map((e=>({text:e[t],value:e[n]})));y(r),M(r.map((e=>e.value)));const{closed:l}=I;s(!1),null==l||l(x.current)})(e):F()}});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(de,{mode:"multiple",open:!1,value:L,placeholder:null!==(r=S.placeholder)&&void 0!==r?r:g("qm.table.editable.selectPlaceholder"),allowClear:S.allowClear,maxTagCount:S.collapseTags?"responsive":void 0,maxTagTextLength:S.maxTagTextLength,disabled:S.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!o&&_()},onDoubleClick:()=>{S.disabled||_()},onChange:e=>{const{valueKey:t}=P;E(x.current.filter((n=>e.includes(n[t])))),M(e)}},v.map((e=>t.createElement(de.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(Y,{className:"ant-input-search-button",disabled:S.disabled,icon:t.createElement(Nt,null),onClick:()=>{_()}})))),t.createElement(Mi,H,t.createElement(Um,$)))},Xm=t.forwardRef(((e,n)=>{var r,l,i;const{$size:a,flattenColumns:o,doFieldValidate:s}=t.useContext(Ko),{dataKey:c,visible:d,setVisible:u,setMatching:m,doFieldUpdate:p,cellValueChange:h}=t.useContext(Mm),{column:g,row:v,rowKey:y,columnKey:b,options:E}=e,{t:w}=Gn();Pm();const C=!!(null===(r=E.helper)||void 0===r?void 0:r.combinedDataIndex),S=t.useRef(!1),N=t.useRef({}),[T,I]=t.useState(),{dataIndex:R,precision:O}=g,{type:k,extra:L={},rules:A=[],helper:P={},onInput:_,onChange:F,onEnter:M}=E,H=xa(v,C?P.combinedDataIndex:R),$=P.fieldAliasMap;$||Jn("Table","helper 需要配置 `fieldAliasMap` 选项");const q="function"==typeof $?$():$||{};Object.keys(q).includes(R)||Jn("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),C&&(P.combinedDataIndex.split("|").every((e=>Object.keys(q).includes(e)))||Jn("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),q[R].includes("|")&&Jn("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const K=e=>{const{filterAliasMap:t}=P,n=""!==e?e:void 0,r=("function"==typeof t?t():t)||[],l={[R]:n};return(Array.isArray(r)?r:[r]).forEach((e=>{if(f(e))for(const t in e)l[t]="function"==typeof e[t]?e[t](n):n;else l[e]=n})),l},j=e=>{const{autoQueryAssign:t=!0}=P;t&&(N.current=K(e)),u(!0)},V=(e,t)=>{const{beforeOpen:n}=P,r=(null!=n?n:bn)({[c]:H},v,g);(null==r?void 0:r.then)?r.then((()=>{j(e),null==t||t()})).catch((()=>{})):!1!==r&&(j(e),null==t||t())},z=e=>{const t={};for(const n in q){const r=q[n];n!==R&&(t[n]=xa(e,r))}const n=q[R]?xa(e,q[R]):"";B(n,t);const{closed:r}=P;u(!1),null==r||r(e)},W=()=>{const{onlySelect:e=!0}=P;S.current&&B(e?"":H),u(!1)},B=(e="",t)=>{var n;if(f(t)&&Object.keys(t).length)for(const e in t){const r=t[e],l=o.find((t=>t.dataIndex===e));if(l){ba(v,e,r,l.precision);const t=null===(n=l.editRender)||void 0===n?void 0:n.call(l,v,l);t&&Array.isArray(t.rules)&&s(t.rules,r,y,e,Ia(l.title))}else ba(v,e,r)}C&&!e&&((e,t,n,r)=>{if(!t.includes("|"))return ba(e,t,n,r);const l=n.split("|")||[];t.split("|").forEach(((t,n)=>{var r;t&&ba(e,t,null===(r=l[n])||void 0===r?void 0:r.trim())}))})(v,P.combinedDataIndex,""),ba(v,R,e,O),s(A,e,y,b,Ia(g.title)),p(v,y,b),null==F||F({[c]:e},v),h(),N.current={},S.current=!1,I(void 0)},U={visible:d,title:w("qm.searchHelper.text"),width:null!==(l=P.width)&&void 0!==l?l:"60%",loading:!1,wrapClassName:as.popupClassName,bodyStyle:{paddingBottom:`${qo[a]+20}px`},onClose:()=>{W()}},G=Object.assign(Object.assign({},P),{size:a,initialValue:Object.assign({},N.current,P.initialValue),onClose:e=>{e?z(e):W()}});return t.createElement(t.Fragment,null,t.createElement(re.Search,{ref:n,value:null!=T?T:H,placeholder:null!==(i=L.placeholder)&&void 0!==i?i:w("qm.table.editable.selectPlaceholder"),allowClear:L.allowClear,readOnly:L.readOnly,disabled:L.disabled,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:r=!0,table:l}=P;if(S.current&&!d)return n&&r&&(null===(t=null==l?void 0:l.fetch)||void 0===t?void 0:t.api)?(e=>{const{table:t,initialValue:n={}}=P,{beforeFetch:r=bn}=t.fetch;return new Promise(((l,i)=>hn(void 0,void 0,void 0,(function*(){var a;const o=D({},t.fetch.params,Object.assign(Object.assign({},n),K(e)),{currentPage:1,pageSize:500});if(!r(o))return i();m(!0);try{const e=yield t.fetch.api(o);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(a=x(e.data,t.fetch.dataKey))&&void 0!==a?a:[];l(n)}else i()}catch(e){i(e)}finally{En((()=>m(!1)))}}))))})(n).then((e=>((e=[],t)=>{const n=e.filter((e=>xa(e,q[R]).toString().includes(t)));if(1===n.length)return z(n[0]);V(t)})(e,n))).catch((()=>B(""))):void B(n)},onChange:e=>{const{value:t}=e.target;null==_||_({[c]:t}),S.current=!0,I(t)},onKeyDown:e=>{var t;if(13===e.keyCode){const n=null!==(t=e.target.value)&&void 0!==t?t:"";!d&&V(n)}},onDoubleClick:e=>{const{value:t}=e.target;V(t)},onSearch:(e,t)=>{"click"===(null==t?void 0:t.type)&&"INPUT"!==t.target.tagName&&V(e)}}),t.createElement(Mi,U,t.createElement(dp,G)))}));Xm.displayName="SearchHelperCell";const Qm=e=>{var n,r;const{$size:l,doFieldValidate:i}=t.useContext(Ko),{dataKey:a,visible:o,setVisible:s,doFieldUpdate:c,cellValueChange:d}=t.useContext(Mm),{column:u,row:m,rowKey:p,columnKey:h,options:f}=e,{t:g}=Gn();Pm();const[v,y]=t.useState(f.items||[]),b=t.useRef({}),x=t.useRef([]),E=e=>x.current=e;t.useLayoutEffect((()=>{f.items&&E(f.items.map((e=>({[b.current.valueKey]:e.value,[b.current.textKey]:e.text}))))}),[]);const{dataIndex:w}=u,{type:C,items:S=[],extra:N={},rules:T=[],helper:I={},onInput:R,onChange:O,onEnter:k}=f,L=ya(m,w),A=I.fieldAliasMap;A||Jn("Table","helper 需要配置 `fieldAliasMap` 选项");const P="function"==typeof A?A():A||{};Object.keys(P).includes("valueKey")&&Object.keys(P).includes("textKey")||Jn("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),b.current=P;const _=e=>{const{beforeOpen:t}=I,n=(null!=t?t:bn)({[a]:L},m,u);(null==n?void 0:n.then)?n.then((()=>{s(!0),null==e||e()})).catch((()=>{})):!1!==n&&(s(!0),null==e||e())},F=()=>{s(!1)},M=e=>{ba(m,w,e),i(T,e,p,h,Ia(u.title)),c(m,p,h),null==O||O({[a]:e},m,x.current),d()},$={visible:o,title:g("qm.searchHelper.text"),width:null!==(n=I.width)&&void 0!==n?n:"60%",loading:!1,wrapClassName:as.popupClassName,bodyStyle:{paddingBottom:`${qo[l]+20}px`},onClose:()=>{F()}},q=Object.assign(Object.assign({},I),{size:l,multiple:!0,initialValue:D({},I.initialValue),defaultSelectedKeys:L,onClose:(e,t)=>{e?((e,t)=>{const{textKey:n,valueKey:r}=P;E(H([...x.current.filter((e=>t.includes(e[r]))),...e],r));const l=x.current.map((e=>({text:e[n],value:e[r]}))),i=H([...l,...S],"value").filter((e=>t.includes(e.value)));y(i),M(i.map((e=>e.value)));const{closed:a}=I;s(!1),null==a||a(x.current)})(e,t):F()}});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(de,{mode:"multiple",open:!1,value:L,placeholder:null!==(r=N.placeholder)&&void 0!==r?r:g("qm.table.editable.selectPlaceholder"),allowClear:N.allowClear,maxTagCount:N.collapseTags?"responsive":void 0,maxTagTextLength:N.maxTagTextLength,disabled:N.disabled,style:{width:"100%"},onKeyDown:e=>{13===e.keyCode&&!o&&_()},onDoubleClick:()=>{N.disabled||_()},onChange:e=>{const{valueKey:t}=P;E(x.current.filter((n=>e.includes(n[t])))),M(e)}},v.map((e=>t.createElement(de.Option,{key:e.value,value:e.value},e.text)))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(Y,{className:"ant-input-search-button",disabled:N.disabled,icon:t.createElement(Nt,null),onClick:()=>{_()}})))),t.createElement(Mi,$,t.createElement(dp,q)))},Zm=t.forwardRef(((e,n)=>{var r,l,i,a;const{column:o,record:s,rowKey:c,columnKey:d}=e,{tableRef:u,getRowKey:m,isFetch:p,updateTableFlatData:h,dataChange:f}=t.useContext(Ko),g=t.useContext(Tm),{store:v,fieldAuth:y}=u.current,b=(null===(r=o.editRender)||void 0===r?void 0:r.call(o,s,o))||{},x=t.useRef(null),E=t.useRef(null),w=t.useRef(null),C=t.useRef(null),[S,N]=t.useState(!1),[T,I]=t.useState(!1),R=`${c}|${d}`,O=2===g.length?`${g[0]}|${g[1]}`:"",k=(b.editable||Da(g,[c,d],!0))&&!b.disabled&&!(null===(l=y[d])||void 0===l?void 0:l.disabled),L=![...v.state.required,...v.state.validate].some((({x:e,y:t})=>e===c&&t===d)),A=(null===(i=v.state.required.find((({x:e,y:t})=>e===c&&t===d)))||void 0===i?void 0:i.text)||"",P=(null===(a=v.state.validate.find((({x:e,y:t})=>e===c&&t===d)))||void 0===a?void 0:a.text)||"",_=v.state.edited.some((({x:e,y:t})=>e===c&&t===d)),F=k||!L||S||T;t.useEffect((()=>{F&&O===R&&M()}),[g]);const M=()=>{var e,t,n,r;const{type:l}=b;switch(l){case"text":null===(e=x.current)||void 0===e||e.focus();break;case"number":null===(t=E.current)||void 0===t||t.select();break;case"search-helper":null===(n=w.current)||void 0===n||n.focus();break;case"tree-helper":null===(r=C.current)||void 0===r||r.focus()}},H=()=>{var e,t,n,r;const{type:l}=b;switch(l){case"text":null===(e=x.current)||void 0===e||e.blur();break;case"number":null===(t=E.current)||void 0===t||t.blur();break;case"search-helper":null===(n=w.current)||void 0===n||n.blur();break;case"tree-helper":null===(r=C.current)||void 0===r||r.blur()}},q=Yn((()=>{h(),f(),En((()=>j()))})),K=(e,t,n)=>{v.addToUpdated(e),v.addToEdited({x:t,y:n})},j=()=>{const{updated:e,edited:t}=v.state,{recordsMap:n,tableOriginData:r,isOriginTree:l}=u.current;l&&!p&&e.length&&function r(l){l.forEach((l=>{l.children&&r(l.children);const i=m(l,l.index),a=e.find((e=>e._rowKey===i)),o=t.filter((e=>e.x===i)).map((e=>e.y));a&&o.length&&l!==n.get(i)&&D(l,$(a,o))}))}(r)};t.useImperativeHandle(n,(()=>({focus:M,blur:H,isEditable:()=>!b.disabled,isOpening:()=>S})));const V=t.useMemo((()=>({dataKey:R,visible:S,matching:T,setVisible:N,setMatching:I,doFieldUpdate:K,cellValueChange:q})),[S,T]),z={text:()=>t.createElement(Hm,{ref:x,column:o,row:s,rowKey:c,columnKey:d,options:b}),textarea:()=>t.createElement(Hm,{ref:x,column:o,row:s,rowKey:c,columnKey:d,options:b,isTextArea:!0}),number:()=>t.createElement(qm,{ref:E,column:o,row:s,rowKey:c,columnKey:d,options:b}),select:()=>t.createElement(Km,{column:o,row:s,rowKey:c,columnKey:d,options:b}),"select-multiple":()=>t.createElement(Km,{column:o,row:s,rowKey:c,columnKey:d,options:b,isMultiple:!0}),date:()=>t.createElement(jm,{column:o,row:s,rowKey:c,columnKey:d,options:b,dateType:"exactdate"}),datetime:()=>t.createElement(jm,{column:o,row:s,rowKey:c,columnKey:d,options:b,dateType:"datetime"}),month:()=>t.createElement(jm,{column:o,row:s,rowKey:c,columnKey:d,options:b,dateType:"month"}),year:()=>t.createElement(jm,{column:o,row:s,rowKey:c,columnKey:d,options:b,dateType:"year"}),time:()=>t.createElement(Vm,{column:o,row:s,rowKey:c,columnKey:d,options:b}),checkbox:()=>t.createElement(zm,{column:o,row:s,rowKey:c,columnKey:d,options:b}),switch:()=>t.createElement(Wm,{column:o,row:s,rowKey:c,columnKey:d,options:b}),"search-helper":()=>t.createElement(Xm,{ref:w,column:o,row:s,rowKey:c,columnKey:d,options:b}),"search-helper-multiple":()=>t.createElement(Qm,{column:o,row:s,rowKey:c,columnKey:d,options:b}),"tree-helper":()=>t.createElement(Gm,{ref:C,column:o,row:s,rowKey:c,columnKey:d,options:b}),"tree-helper-multiple":()=>t.createElement(Ym,{column:o,row:s,rowKey:c,columnKey:d,options:b}),custom:()=>t.createElement(Bm,{column:o,row:s,rowKey:c,columnKey:d,options:b})};return t.createElement(t.Fragment,null,F?(()=>{const{type:e}=b,n=z[e];if(!n)return Jn("Table","单元格编辑的类型 `type` 配置不正确"),null;const r=["cell--edit",{"is-error":!L}];return t.createElement("div",{className:Pe(r)},t.createElement(Mm.Provider,{value:V},n()),!L&&t.createElement("div",{className:"cell-error"},A||P))})():(()=>{const{disabled:n}=b,{disabledColor:r,disabledBgColor:l}=b.extra||{},i=["cell--show",{"is-cell-bg":n&&l}];return t.createElement(t.Fragment,null,t.createElement("span",{className:Pe(i),style:{color:n?r:""}},e.children),n&&l&&t.createElement("i",{className:"cell--bg",style:{background:l}}))})(),_&&(()=>{const{cornerSign:e=!0}=b.extra||{};return e&&t.createElement("i",{className:"cell--sign"})})())}));Zm.displayName="CellEdit";const Jm=e=>{const{text:n,options:r,showMessage:l=!0,onCopy:i}=e,{t:a}=Gn();return di(e.children,{onClick:o=>{const s=t.Children.only(e.children),c=nn(n,r);null==i||i(n,c),c&&l&&ne.success(a("qm.clipboard.success")),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(o)}})};Jm.displayName="QmCopyToClipboard";const ep=t.forwardRef(((n,r)=>{const{column:l,row:i,rowIndex:a,columnIndex:o,rowKey:s,showTitle:c,onUnmount:d}=n,{tableRef:u,selectionKeys:m,treeExpandIndex:p,updateMark:h}=t.useContext(Ko),{dataIndex:f,translate:g,canCopy:v,render:y,editRender:b,shouldCellUpdate:x}=l,{t:E}=Gn(),{renderText:w,getTitleFromCellNode:C}=fs(),S=t.useRef(null),N=ya(i,f),[T,I]=function(t,n,r){const l=e.useRef({});return"value"in l.current&&!r(l.current.condition,n)||(l.current.value=t(),l.current.condition=n),l.current.value}((()=>{const e=y?y(N,i,l,a,o):w(N,l,i);return[e,b?t.createElement(Zm,{ref:r,column:l,record:i,rowKey:s,columnKey:f},e):null]}),[h,i,N,y,b],((e,t)=>{if(x){const[,n]=e,[,r]=t;return x(r,n,i)}return!Da(e,t,!0)})),R=t.useMemo((()=>[as.expandableColumn,as.selectionColumn,as.operationColumn].includes(f)?"":C(T)),[T]);t.useEffect((()=>()=>null==d?void 0:d()),[]),t.useEffect((()=>{c&&(S.current.parentNode.title=R)}),[c,T]);const O=e=>Array.isArray(e.children),k=()=>{return f===as.expandableColumn?t.createElement(Dm,{record:i,rowKey:s}):f===as.selectionColumn?t.createElement(Fm,{selectionKeys:m,column:l,record:i,rowKey:s}):I||(u.current.isTreeTable&&f===p?t.createElement(t.Fragment,null,(e=i._level)?t.createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*as.treeTable.textIndent+"px"}}):null,t.createElement(Dm,{key:"expand",record:i,rowKey:s,style:O(i)?{}:{visibility:"hidden"}}),T):v?t.createElement("div",{className:"cell--copy"},t.createElement("span",{className:"text"},T),R&&t.createElement(Jm,{text:R},t.createElement(Ze,{className:"icon",title:E("qm.table.config.copyText"),onClick:e=>e.stopPropagation()}))):T);var e};return g?t.createElement(No,{ref:S,text:R,className:"cell"},k()):t.createElement("div",{ref:S,className:"cell"},k())}));ep.displayName="Cell";const tp={open:!1,offsetX:0,offsetY:0},np=t.forwardRef(((e,n)=>{const{rowVirtualize:r}=e,{tableRef:l,getRowKey:i,prefixCls:a,tableFlatData:o,flattenColumns:s,tableRowHeight:c,mergedTdCells:d,setMergedCells:u}=t.useContext(Ko),{areaSelection:m={}}=l.current.props,{elementStore:p,scrollYLoad:h}=l.current,{t:f}=Gn(),g=t.useRef(document.onselectstart),v=t.useRef(null),y=t.useRef(null),b=t.useRef(null),x=e=>{b.current=e},[E,w]=t.useState(null),[C,S]=t.useState(null),[N,T]=t.useState(null),I=e=>{if(!e)return T(null);let t=!1;for(const n in e)if((null==N?void 0:N[n])!==e[n]){t=!0;break}t&&T(Object.assign({},N,e))};Su({ref:v,handler:()=>V()}),t.useEffect((()=>{const e=jt(p.$tableBody,"mousedown",M),t=jt(p.$tableBody,"contextmenu",F),n=jt(document,"keydown",D);return()=>{e.remove(),t.remove(),n.remove()}}),[]);const R=()=>{w(null),I(null),x(null),S(null)};t.useImperativeHandle(n,(()=>({blur:R})));const O=e=>{let t=e;for(;t;){if(!p.$tableBody.contains(t))return null;if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},k=e=>({rowIndex:parseInt(e.parentNode.getAttribute("data-row-index"),10),colIndex:parseInt(e.getAttribute("data-col-index"),10),rowspan:Number(e.getAttribute("rowspan")||1),colspan:Number(e.getAttribute("colspan")||1),l:e.offsetLeft,t:e.offsetTop,w:e.offsetWidth,h:e.offsetHeight}),L=e=>({colStart:e.colIndex,colEnd:e.colIndex+e.colspan,rowStart:e.rowIndex,rowEnd:e.rowIndex+e.rowspan}),A=e=>{let[t,n,r,l]=[1/0,-1/0,1/0,-1/0];for(const i of e)t=Math.min(t,i.rowStart),n=Math.max(n,i.rowEnd),r=Math.min(r,i.colStart),l=Math.max(l,i.colEnd);return{rowStart:t,rowEnd:n,colStart:r,colEnd:l}},P=ci((e=>{let t=A([L(e),b.current]);d.forEach((e=>{const n=o.findIndex((t=>i(t,t.index)===e.rowKey)),r=s.findIndex((t=>t.dataIndex===e.dataIndex)),l={rowStart:n,rowEnd:n+e.rowSpan,colStart:r,colEnd:r+e.colSpan};var a,c;c=l,(a=t).rowEnd<=c.rowStart||a.rowStart>=c.rowEnd||a.colEnd<=c.colStart||a.colStart>=c.colEnd||(t=A([t,l]))})),I(t)}),5),_=e=>{var t;u(e),null===(t=m.onCellMerge)||void 0===t||t.call(m,e),En((()=>R()))},F=Yn((e=>{m.cellMerge&&E&&K(e.clientX,e.clientY)?(e.preventDefault(),j(e)):(null==C?void 0:C.open)&&V()})),D=Yn((e=>{27===e.keyCode&&R()})),M=Yn((e=>{e.stopPropagation();const t=O(e.target);if(1!==e.buttons||!t)return;V();const n=k(t);w(n);const r=L(n);x(r),I(r),document.addEventListener("mousemove",H),document.addEventListener("mouseup",$),g.current=document.onselectstart,document.onselectstart=()=>!1})),H=Yn((e=>{const t=O(e.target);t&&P(k(t))})),$=Yn((()=>{var e;null===(e=m.onSelectChange)||void 0===e||e.call(m,(()=>{const e=[];if(!E||!N)return e;for(let t=N.rowStart;t<N.rowEnd;t++)for(let n=N.colStart;n<N.colEnd;n++)e.push({rowKey:i(o[t],o[t].index),dataIndex:s[n].dataIndex,cellValue:ya(o[t],s[n].dataIndex)});return e})()),document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",$),q()})),q=()=>{document.onselectstart!==g.current&&(document.onselectstart=g.current)},K=(e,t)=>{const{top:n,left:r}=p.$tableBody.parentNode.getBoundingClientRect(),[l,i]=[e-r,t-n],{el:a,et:o,ew:s,eh:c}=G();return!(l<a||l>a+s||i<o||i>o+c)},j=e=>{const{top:t,left:n,height:r}=y.current.getBoundingClientRect();S({open:!0,offsetX:e.clientX-n,offsetY:-1*(r-(e.clientY-t))})},V=()=>{S((e=>Object.assign(Object.assign({},e),{open:!1})))},z=e=>({rowIndex:o.findIndex((t=>i(t,t.index)===e.rowKey)),colIndex:s.findIndex((t=>t.dataIndex===e.dataIndex)),rowSpan:e.rowSpan,colSpan:e.colSpan}),W=()=>{if(!E||!N||(t=N,(e=E).rowIndex===t.rowStart&&e.colIndex===t.colStart&&e.rowspan===t.rowEnd-t.rowStart&&e.colspan===t.colEnd-t.colStart))return R();var e,t;const n={rowKey:i(o[N.rowStart],o[N.rowStart].index),dataIndex:s[N.colStart].dataIndex,rowSpan:N.rowEnd-N.rowStart,colSpan:N.colEnd-N.colStart};_([...d.filter((e=>!((e,t)=>{const n=z(e),r=z(t),[l,i,a,o]=[n.rowIndex,n.colIndex,n.rowIndex+n.rowSpan-1,n.colIndex+n.colSpan-1],[s,c,d,u]=[r.rowIndex,r.colIndex,r.rowIndex+r.rowSpan-1,r.colIndex+r.colSpan-1];return l<=s&&i<=c&&a>=d&&o>=u||s<=l&&c<=i&&d>=a&&u>=o})(e,n))),n])},B=()=>{const e=i(o[N.rowStart],o[N.rowStart].index),t=s[N.colStart].dataIndex;_(d.filter((n=>!(n.rowKey===e&&n.dataIndex===t))))},U=e=>{if(h){return r.measurementsCache.slice(0,e).map((e=>e.size)).reduce(((e,t)=>e+t),0)}if(e>=o.length)return p.$tableBody.parentNode.offsetHeight;const t=i(o[e],o[e].index),n=p.$tableBody.querySelector(`tbody > tr[data-row-key="${t}"]`);return n?n.offsetTop:c*e},G=()=>{const{w:e,h:t,l:n,t:r}=E,l=s.slice(0,N.colStart).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),i=U(N.rowStart);return{sl:n,st:r,sw:e,sh:t,el:l,et:i,ew:s.slice(0,N.colEnd).reduce(((e,t)=>e+(t.width||t.renderWidth)),0)-l,eh:U(N.rowEnd)-i}};return t.createElement("div",{className:`${a}--area-select`},(()=>{if(!E||!N)return null;const{sl:e,st:n,sw:r,sh:l,el:i,et:a,ew:o,eh:s}=G(),{open:c,offsetX:d,offsetY:u}=C||tp,m=t.createElement("ul",{ref:v,className:"ant-dropdown-menu"},t.createElement("li",{className:"ant-dropdown-menu-item",onClick:W},f("qm.table.areaSelect.mergeCell")),t.createElement("li",{className:"ant-dropdown-menu-item",onClick:B},f("qm.table.areaSelect.cancelMerge")));return t.createElement(t.Fragment,null,t.createElement("div",{className:"active-area",style:{left:e,top:n,width:r,height:l}}),t.createElement(ad,{popupVisible:c,popup:m,action:[],popupPlacement:"bottomLeft",prefixCls:"ant-dropdown",popupClassName:as.popupClassName,builtinPlacements:{bottomLeft:{points:["tl","bl"],offset:[d+4,u+4],overflow:{adjustX:1,adjustY:1}}}},t.createElement("div",{ref:y,className:"checked-area",style:{left:i,top:a,width:o,height:s}})))})())}));np.displayName="AreaSelect";const rp=t.forwardRef(((e,n)=>{const{tableRef:r,getRowKey:l,prefixCls:i,tableFlatData:a,flattenColumns:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:d,derivedMergeCells:u,tableRowHeight:m,sorter:p,layout:h,showFooter:g,selectionKeys:v,rowExpandedKeys:y,highlightKey:b,activedCell:x,isPingLeft:E,isPingRight:w,isTableEmpty:S,isGroupSubtotal:N,setElementStore:T,setSelectionKeysEffect:I,setHighlightKey:R,setActivedCell:O,getStickyLeft:k,getStickyRight:L,setPingLeft:A,setPingRight:P,setFullScreen:_,scrollBottomDebouncer:F}=t.useContext(Ko),{height:D,minHeight:M,maxHeight:H,rowSelection:$,rowHighlight:q,expandable:K,stripe:j,summation:V,rowHeight:z,rowStyle:W,cellStyle:B,spanMethod:U,tableConfig:G,areaSelection:Y,ellipsis:X,showHeader:Q,rowDraggable:Z,onRowClick:J,onRowDblclick:ee,onRowContextmenu:te,onRowEnter:ne}=r.current.props,re=t.useRef(null),le=t.useRef(new Map),ie=t.useRef(null),ae=t.useRef({prevST:0,prevSL:0}),{onNodeDragStart:oe,onNodeDragEnter:se,onNodeDragOver:ce,onNodeDragLeave:de,onNodeDragEnd:ue,onNodeDrop:me,indent:pe,dropOptions:he}=Am({openDragSort:Z}),{rowVirtualizer:fe,columnVirtualizer:ge,virtualRows:ve,virtualColumns:ye,resetItemXSize:be,getYIndexes:xe,virtualTranslateY:Ee,virtualTranslateX:we,calcVirtualYSize:Ce,calcVirtualXSize:Se,scrollToYIndex:Ne}=((e,n)=>{var r;const{tableRef:l,tableRowHeight:i}=t.useContext(Ko),{props:a,scrollBarRef:o}=l.current,s=(null===(r=a.tableConfig)||void 0===r?void 0:r.overscan)||1,c=t.useMemo((()=>{var e;return(null===(e=o.current)||void 0===e?void 0:e.scrollElement)||null}),[o.current]),d=t.useMemo((()=>{const e=[],t=[];return n.forEach(((n,r)=>{"left"===n.fixed&&e.push(r),"right"===n.fixed&&t.push(r)})),[e,t]}),[n]),u=xu({count:e.length,getScrollElement:()=>c,estimateSize:()=>i,indexAttribute:"data-row-index",overscan:s,enabled:l.current.scrollYLoad}),m=u.getVirtualItems(),p=xu({horizontal:!0,count:n.length,getScrollElement:()=>c,estimateSize:e=>n[e].width||n[e].renderWidth||0,indexAttribute:"data-col-index",overscan:s,enabled:l.current.scrollXLoad,rangeExtractor:e=>[...new Set([...d[0],...du(e),...d[1]])]}),h=p.getVirtualItems();return{rowVirtualizer:u,columnVirtualizer:p,virtualRows:m,virtualColumns:h,resetItemXSize:e=>{e.forEach(((e,t)=>{p.resizeItem(t,e.width||e.renderWidth||as.defaultColumnWidth)}))},getYIndexes:()=>u.getVirtualIndexes()||[],getXIndexes:()=>p.getVirtualIndexes()||[],virtualTranslateY:()=>{var e;return(null===(e=m[0])||void 0===e?void 0:e.start)||0},virtualTranslateX:()=>{var e,t,n,r;const l=d[0].length;return l?(null===(t=h[l])||void 0===t?void 0:t.index)===l?(null===(n=h[0])||void 0===n?void 0:n.start)||0:((null===(r=h[l])||void 0===r?void 0:r.start)||0)-h.slice(0,l).reduce(((e,t)=>e+t.size),0):(null===(e=h[0])||void 0===e?void 0:e.start)||0},calcVirtualYSize:()=>u.getTotalSize()||"",calcVirtualXSize:()=>p.getTotalSize()||"",scrollToYIndex:e=>{u.scrollToIndex(e)},scrollToXIndex:e=>{p.scrollToIndex(e)}}})(a,o),Te=xe(),Ie=e=>{if(e&&!X)return fe.measureElement(e)},Re=t.useMemo((()=>u.length&&r.current.scrollYLoad?((e,t)=>{const n=[],r=new Set(t);return e.forEach((({row:e,col:t,rowSpan:l,colSpan:i})=>{const a=e+l-1,o=[];for(let t=e;t<=a;t++)r.has(t)&&o.push(t);if(0===o.length)return;const s=o.length;o.forEach(((e,r)=>{0===r&&n.push({row:e,col:t,rowSpan:s,colSpan:i});for(let l=t;l<t+i;l++)0===r&&l===t||n.push({row:e,col:l,rowSpan:0,colSpan:0})}))})),n})(u,Te):u),[u,Te.join(",")]),[Oe,ke]=t.useState([]),Le=Pm();Su({ref:re,omitClassNames:[`.${as.popupClassName}`],handler:()=>{var e;Ue([]),null===(e=ie.current)||void 0===e||e.blur()}}),t.useImperativeHandle(n,(()=>({setClickedValues:Ue,createFocus:Ke,forceUpdate:Le,resetItemXSize:be,scrollToYIndex:Ne}))),Dl((()=>{Oe.length&&r.current.tableManager.focus(r.current.uid)}),[Oe]),t.useLayoutEffect((()=>{qe();const e=jt(document,"keydown",Fe);return()=>e.remove()}),[]);const Ae=t.useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:n,tableFullHeight:r,tableAutoHeight:l}=h,i={};return S&&Object.assign(i,{minHeight:"100px"}),M&&Object.assign(i,{minHeight:ga(M)-e-n+"px"}),H&&Object.assign(i,{maxHeight:ga(H)-e-n+"px"}),D||r||l?Object.assign(Object.assign({},i),{maxHeight:"",minHeight:"",height:`${t}px`}):i}),[D,H,M,S,h]),_e=Yn((e=>{const{elementStore:t}=r.current,{prevST:n,prevSL:l}=ae.current,{scrollTop:i,scrollLeft:a}=e;if(a!==l){Q&&(t.$header.scrollLeft=a),g&&(t.$footer.scrollLeft=a);const e=a>0,n=Math.ceil(a+h.tableWidth)<h.tableBodyWidth;E!==e&&A(e),w!==n&&P(n)}ae.current={prevST:i,prevSL:a}})),Fe=Yn((e=>{var t,n,i,o,s;if(r.current.uid!==(null===(t=r.current.tableManager.getFocusInstance())||void 0===t?void 0:t.id))return;const{keyCode:c}=e;if(27===c&&(Ue([]),R(""),O({}),_(!1)),Oe.length&&(Bl(document.activeElement,re.current)||"INPUT"!==(null===(n=document.activeElement)||void 0===n?void 0:n.tagName))){if(13===c&&("radio"===(null==$?void 0:$.type)||q)){const t=null!==(o=null!==(i=v[0])&&void 0!==i?i:b)&&void 0!==o?o:null,n=null!==(s=a.find((e=>l(e,e.index)===t)))&&void 0!==s?s:null;n&&(null==ne||ne(n,e))}ze(Oe[0],Oe[1])||(38!==c&&40!==c||($l(e),De(e)),(9===c||e.shiftKey&&9===c)&&($l(e),Me(e)))}})),De=Ri((e=>{var t,n;if(!Oe.length)return;const r=a.length;let i=a.findIndex((e=>l(e,e.index)===Oe[0]));const o=38===e.keyCode?(--i+r)%r:++i%r,s=a[o],c=l(s,s.index),d=Ve(c,Oe[1]);"radio"!==(null==$?void 0:$.type)||(null===(t=$.disabled)||void 0===t?void 0:t.call($,s))||d||I([c]),!q||(null===(n=q.disabled)||void 0===n?void 0:n.call(q,s))||d||R(c),He(38===e.keyCode?"top":"bottom",o),je(...Oe),Ue([c,Oe[1]])}),100),Me=Ri((e=>{if(!Oe.length)return;if(!s.length)return Ue([]);const t=s.length;let n=s.findIndex((e=>e.dataIndex===Oe[1]));const r=e.shiftKey&&9===e.keyCode?(--n+t)%t:++n%t;je(...Oe),$e(e.shiftKey&&9===e.keyCode?"left":"right",r),Ue([Oe[0],s[r].dataIndex])}),100),He=(e,t)=>{const{scrollBarRef:n,scrollYLoad:l}=r.current;if(l)return fe.scrollToIndex(t);const i=a.length,o=t,s=re.current.querySelectorAll("tbody > tr"),c=a.map(((e,t)=>t)).slice(0,o).reduce(((e,t)=>e+s[t].offsetHeight),0),d=s[o].offsetHeight;"top"===e?c<n.current.scrollTop?n.current.SET_SCROLL_TOP(c):t===i-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)},$e=(e,t)=>{const{scrollBarRef:n}=r.current,l=s.length,i=o.findIndex((e=>e.dataIndex===s[t].dataIndex)),a=o.slice(0,i).reduce(((e,t)=>e+(t.width||t.renderWidth)),0),u=o[i].width||o[i].renderWidth,m=c.reduce(((e,t)=>e+(t.width||t.renderWidth)),0),p=d.reduce(((e,t)=>e+(t.width||t.renderWidth)),0);"left"===e?a<n.current.scrollLeft+m?n.current.SET_SCROLL_LEFT(a-m):t===l-1&&n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+p):a+u>n.current.scrollLeft+(h.tableWidth-p)?n.current.SET_SCROLL_LEFT(a-(h.tableWidth-u)+p):0===t&&n.current.SET_SCROLL_LEFT(a-m)},qe=()=>{T("$tableBody",re.current)},Ke=(e,t)=>{var n;null===(n=le.current.get(`${e}-${t}`))||void 0===n||n.focus()},je=(e,t)=>{var n;null===(n=le.current.get(`${e}-${t}`))||void 0===n||n.blur()},Ve=(e,t)=>{var n,r;return null!==(r=null===(n=le.current.get(`${e}-${t}`))||void 0===n?void 0:n.isEditable())&&void 0!==r&&r},ze=(e,t)=>{var n,r;return null!==(r=null===(n=le.current.get(`${e}-${t}`))||void 0===n?void 0:n.isOpening())&&void 0!==r&&r},We=e=>{const t=V.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Be=(e,t,n)=>{var i;const{dataIndex:a}=n;if([as.expandableColumn,as.operationColumn].includes(a))return;const o=l(t,t.index);Ue([o,a]);const s=Ve(o,a),{type:c,selectByClickRow:d=!0,disabled:u=yn}=$||{};!c||u(t)||s||(d||a===as.selectionColumn)&&((e,t)=>{const{type:n,checkStrictly:l=!0,onSelect:i}=$||{};if("radio"===n&&I([e]),"checkbox"===n){const n=!v.includes(e),a=r.current.isTreeTable&&!l?Ye(e,v,n):Ge(e,v,n);I(a),null==i||i(n,t,a)}})(o,t),[as.selectionColumn].includes(a)||(!q||(null===(i=q.disabled)||void 0===i?void 0:i.call(q,t))||s||R(o),null==J||J(t,n,e))},Ue=e=>{C(e,Oe)||ke(e)},Ge=(e,t,n)=>n?[...t,e]:t.filter((t=>t!==e)),Ye=(e,t,n)=>{var l;const{disabled:i}=$||{},{tableFullData:a,recordsMap:o}=r.current,s=Aa(a,(t=>t._rowKey===e));let c=[],d=da((null==s?void 0:s.children)||[],(e=>e._rowKey));i&&(d=d.filter((e=>!o.has(e)||!i(o.get(e))))),c=n?[...new Set([...t,e,...d])]:t.filter((t=>![e,...d].includes(t)));return((null===(l=Pa(a,e))||void 0===l?void 0:l.slice(0,-1).reverse())||[]).forEach((e=>{var t;const n=Aa(a,(t=>t._rowKey===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},Xe=(e,n,l)=>{const{scrollXLoad:i}=r.current,{disabled:a}=$||{},s=["body--row",Object.assign({"body--row-striped":j&&n%2!=0,"body--row-selected":v.includes(l)&&!(null==a?void 0:a(e)),"body--row-current":b===l},N?We(e._group):null)],c=(i?ye:o).map(((t,r)=>Qe(i?o[t.index]:t,i?t.index:r,e,n,l)));return Z?t.createElement(_m,{key:l,ref:Ie,className:Pe(s),rowKey:l,rowIndex:n,row:e,indent:pe,filter:".cell--edit input",dropOption:he,onNodeDragStart:oe,onNodeDragEnter:se,onNodeDragOver:ce,onNodeDragLeave:de,onNodeDragEnd:ue,onNodeDrop:me},c):t.createElement("tr",{key:l,ref:Ie,"data-row-key":l,"data-row-index":n,className:Pe(s)},c)},Qe=(e,n,r,l,i)=>{var a,o,s;const{dataIndex:u,fixed:h,align:f,className:g=""}=e,{rowSpan:v,colSpan:y}=Ze(r,e,l,n);if(!v||!y)return null;const b=null!==(a=e.ellipsis)&&void 0!==a?a:X,E=["body--column",{"col--ellipsis":b,"col--center":"center"===f,"col--right":"right"===f,"col-active":x.rowKey===i&&x.dataIndex===u,"column--sort":!!p[u],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(o=c[c.length-y])||void 0===o?void 0:o.dataIndex)===u,"cell-fix-right-first":"right"===h&&(null===(s=d[0])||void 0===s?void 0:s.dataIndex)===u,[g]:!!g}],w={left:"left"===h?`${k(u)}px`:"",right:"right"===h?`${L(u)}px`:""},C=W?"function"==typeof W?W(r,l):W:null,S=B?"function"==typeof B?B(r,e,l,n):B:null,T=N?(e=>{var t;const{backgroundColor:n,color:r}=null!==(t=V.groupItems.find((t=>t.dataIndex===e)))&&void 0!==t?t:{};return{backgroundColor:n,color:r}})(r._group):null,I=Object.assign({},w,{height:z?m:""},T,C,S);return t.createElement("td",{key:u,"data-col-index":n,rowSpan:v>1?v:void 0,colSpan:y>1?y:void 0,className:Pe(E),style:I,onClick:t=>Be(t,r,e),onDoubleClick:t=>((e,t,n)=>{const{dataIndex:r}=n;[as.expandableColumn,as.selectionColumn,as.operationColumn].includes(r)||null==ee||ee(t,n,e)})(t,r,e),onContextMenu:t=>((e,t,n)=>{const{dataIndex:r}=n;[as.expandableColumn,as.selectionColumn,as.operationColumn].includes(r)||null==te||te(t,n,e)})(t,r,e)},t.createElement(ep,{ref:e=>{e&&le.current.set(`${i}-${u}`,e)},row:r,column:e,rowIndex:l,columnIndex:n,rowKey:i,showTitle:b,onUnmount:()=>le.current.delete(`${i}-${u}`)}))},Ze=(e,t,n,r)=>{var l;let i=1,o=1;const s=U;if("function"==typeof s){const c=s({row:e,column:t,rowIndex:n,columnIndex:r,tableData:a});Array.isArray(c)?(i=c[0],o=c[1]):f(c)&&(i=c.rowSpan,o=c.colSpan);const d=null!==(l=Te[0])&&void 0!==l?l:0;if(e===a[d]&&0===i)for(let e=d;e<a.length;e++){const n=s({row:a[e],column:t,rowIndex:e,columnIndex:r,tableData:a});if((Array.isArray(n)?n[0]:n.rowSpan)>0)break;i++}}if(Re.length>0){const e=Re.find((e=>e.row===n&&e.col===r));e&&(i=e.rowSpan,o=e.colSpan)}return{rowSpan:i,colSpan:o}};return t.createElement(Ei,{ref:r.current.scrollBarRef,wrapClassName:`${i}--body-wrapper`,wrapStyle:Ae,innerStyle:{height:Ce(),width:Se()},showTopScrollbar:null==G?void 0:G.doubleXScrollbar,onScroll:_e,onReachedEnd:(e,t)=>{"bottom"===e&&F({type:"scroll",target:t,preventDefault:yn,stopPropagation:yn})}},t.createElement(Tm.Provider,{value:Oe},t.createElement("table",{ref:re,style:{width:0,marginTop:Ee(),marginLeft:we()},className:Pe(`${i}--body`,{"virtual-container":r.current.scrollYLoad||r.current.scrollXLoad}),tabIndex:-1,cellSpacing:"0",cellPadding:"0"},(()=>{const{scrollXLoad:e}=r.current;return t.createElement("colgroup",null,(e?ye:o).map((n=>{const{dataIndex:r,width:l,renderWidth:i}=e?o[n.index]:n;return t.createElement("col",{key:r,style:{width:`${l||i}px`,minWidth:`${l||i}px`}})})))})(),t.createElement("tbody",null,(e=>{const{scrollYLoad:n,scrollXLoad:i}=r.current,s=[];return(n?e:a).forEach(((e,r)=>{const c=n?a[e.index]:e,d=n?e.index:r,u=l(c,c.index);if(s.push(Xe(c,d,u)),null==K?void 0:K.expandedRowRender){const{expandedRowClassName:e,rowExpandable:n=bn}=K;y.includes(u)&&n(c)&&s.push(t.createElement("tr",{key:`expand_${u}`,className:"body--row-expanded"},t.createElement("td",{colSpan:(i?ye:o).length,className:"body--column",style:{paddingLeft:$?2*as.selectionColumnWidth:as.selectionColumnWidth}},t.createElement("div",{className:Pe("cell",e)},K.expandedRowRender(c,d)))))}})),s})(ve)))),!!Y&&t.createElement(np,{ref:ie,rowVirtualize:fe}))}));rp.displayName="TableBody";const lp=()=>{const{tableRef:e,prefixCls:n,sorter:r,layout:l,flattenColumns:i,leftFixedColumns:a,rightFixedColumns:o,summationRows:s,setElementStore:c,getStickyLeft:d,getStickyRight:u}=t.useContext(Ko),{footRender:m}=e.current.props,{t:p}=Gn(),h=t.useRef(null);t.useLayoutEffect((()=>{f()}),[]);const f=()=>{c("$footer",h.current)},g=(n,l,i)=>{var s,c;const{dataIndex:m,fixed:h,align:f,summation:g}=n,v=["footer--column","col--ellipsis",{"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!r[m],"cell-fix-left":"left"===h,"cell-fix-right":"right"===h,"cell-fix-left-last":"left"===h&&(null===(s=a[a.length-1])||void 0===s?void 0:s.dataIndex)===m,"cell-fix-right-first":"right"===h&&(null===(c=o[0])||void 0===c?void 0:c.dataIndex)===m}],y={left:"left"===h?`${d(m)}px`:"",right:"right"===h?`${u(m)}px`:""},b=(null==g?void 0:g.render)?g.render(e.current.tableFullData):ya(l,`${m}_text`),x=0===i&&""===b?p("qm.table.config.summaryText"):b;return t.createElement("td",{key:m,title:x,className:Pe(v),style:Object.assign({},y)},t.createElement("div",{className:"cell"},x))},{tableBodyWidth:v}=l;return t.createElement("div",{ref:h,className:`${n}--footer-wrapper`},m?m(i,e.current.tableFullData):t.createElement("table",{className:`${n}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:v?`${v}px`:""}},t.createElement("colgroup",null,i.map((e=>{const{dataIndex:n,width:r,renderWidth:l}=e;return t.createElement("col",{key:n,style:{width:`${r||l}px`,minWidth:`${r||l}px`}})}))),t.createElement("tfoot",null,s.map(((e,n)=>t.createElement("tr",{key:n,className:"footer--row"},i.map(((t,n)=>g(t,e,n)))))))))};var ip;!function(e){e.small="small",e.middle="default",e.large="default"}(ip||(ip={}));const ap=e=>{var n,r,l,i;const{current:a,pageSize:o,total:s,onChange:c}=e,{global:d}=t.useContext(on),{tableRef:u,prefixCls:m,$size:p,setElementStore:h}=t.useContext(Ko),{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=()=>{h("$pager",y.current)},E=null!==(n=null==g?void 0:g.showSizeChanger)&&void 0!==n?n:as.pagination.showSizeChanger,w=null!==(r=null==g?void 0:g.showQuickJumper)&&void 0!==r?r:as.pagination.showQuickJumper,C=(null==g?void 0:g.pageSizeOptions)||(null===(i=null===(l=null==d?void 0:d.table)||void 0===l?void 0:l.pagination)||void 0===i?void 0:i.pageSizeOptions)||as.pagination.pageSizeOptions,S=()=>hn(void 0,void 0,void 0,(function*(){if(!b)return;const e=yield N(b);e&&e!==o&&(c(a,e),localStorage.setItem(b,e.toString()))})),N=e=>hn(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)=>hn(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={[`${m}-pager`]:!0};return t.createElement("div",{ref:y,className:Pe(I)},t.createElement("div",{className:"pager-alert"},"bottom"===(null==v?void 0:v.position)&&t.createElement(ms,{total:s})),t.createElement(xe,{size:ip[p],showSizeChanger:E,showQuickJumper:w,pageSizeOptions:C,current:a,pageSize:o,total:s,onChange:(e,t)=>{c(e,t)},onShowSizeChange:(e,t)=>{b&&(T(b,t),localStorage.setItem(b,`${t}`))}}))},op=()=>{const{prefixCls:e,layout:n}=t.useContext(Ko),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(Jl,null))},sp=()=>{const{prefixCls:e,setElementStore:n}=t.useContext(Ko),r=t.useRef(null);t.useLayoutEffect((()=>{l()}),[]);const l=()=>{n("$resizableBar",r.current)};return t.createElement("div",{ref:r,className:`${e}--resizable-bar`})},cp=t.forwardRef(((e,n)=>{const r=Rn(Vo,e),{rowKey:l,columns:i,loading:a,resizable:o,customClass:s,areaSelection:c,tablePrint:d,exportExcel:u,infoBarConfig:m,topSpaceAlign:p,showTableInfo:h,showFullScreen:g,showRefresh:v,showToolBox:y,showHeader:b,className:x,style:w}=r,{$size:S}=Xn(r),N=t.useRef(null),T=t.useRef(null),I=t.useRef(null),R=t.useRef(null),O=t.useRef(null),k=rr("table"),L=Yn(((e,t)=>{const n="function"==typeof l?l(e,t):null==e?void 0:e[l];return void 0===n?(Jn("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):n})),{tableRef:A,tableFullData:P,setElementStore:_,setOriginColumns:F,setTableFullData:D,setTableOriginData:M,setTableDataMaps:H,setInvalidRowKeys:$,setFieldAuth:q,setColumnsDefined:K,setScrollXLoad:j,setScrollYLoad:V,setResizeState:z,setHandleState:W,setSummaries:B,setSelectionRows:U,setUnMounted:G,clearElementStore:Y}=((e,{getRowKey:n})=>{const r=t.useRef({props:e,uid:es(),tableManager:ns,elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],invalidRowKeys:[],fieldAuth:{},columnsDefined:!e.dynamicThead,scrollBarRef:t.createRef(),store:new rs({getRowKey:n}),resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},isTreeTable:!1,isOriginTree:!1,scrollXLoad:!1,scrollYLoad:!1,selectionRows:[],recordsMap:new Map,unMounted:!1,isIE:!fn&&/MSIE|Trident/.test(navigator.userAgent)});var l;l=e,r.current.props=l;const i=(e,t,r="",l=0)=>{e.forEach((e=>{const a=n(e,e.index),o=r?`${r}.${e.index+1}`:`${e.index+1}`;e.indexPath=o,e._level=l,e._rowKey=a,e._parentRowKey=l?t:null,Array.isArray(e.children)&&i(e.children,a,o,l+1),e.children&&e.children.length||(e._isLeaf=1)}))};return Object.assign(Object.assign({tableRef:r},r.current),{setElementStore:(e,t)=>{r.current.elementStore[e]=t},setOriginColumns:e=>{r.current.originColumns=e},setTableFullData:e=>{r.current.tableFullData=e;const t=e.some((e=>Array.isArray(e.children)));r.current.isTreeTable=t,t&&i(e,"")},setTableOriginData:e=>{r.current.tableOriginData=e,r.current.isOriginTree=e.some((e=>Array.isArray(e.children)))},setTableDataMaps:e=>{const t=sa(e);r.current.recordsMap=new Map(t.map(((e,r)=>[n(e,e.index),t[r]])))},setInvalidRowKeys:e=>{r.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{r.current.fieldAuth[e]=t},setColumnsDefined:e=>{r.current.columnsDefined=e},setResizeState:e=>{r.current.resizeState=e},setHandleState:e=>{r.current.handleState=e},setSummaries:e=>{r.current.summaries=e},setScrollXLoad:e=>{r.current.scrollXLoad=e},setScrollYLoad:e=>{r.current.scrollYLoad=e},setSelectionRows:e=>{r.current.selectionRows=e},setUnMounted:e=>{r.current.unMounted=e},clearElementStore:()=>{for(const e in r.current.elementStore)r.current.elementStore[e]=null}})})(r,{getRowKey:L}),{tableFlatData:X,setTableFlatData:Q,filters:Z,setFilters:J,sorter:ee,setSorter:te,superFilters:ne,setSuperFilters:re,pagerFilter:le,setPagerFilter:ie,pagination:ae,setPagination:oe,selectionKeys:se,setSelectionKeys:ce,rowExpandedKeys:de,setRowExpandedKeys:ue,highlightKey:me,setHighlightKey:pe,updateMark:he,forceUpdate:fe,activedCell:ge,setActivedCell:ve,mergedTdCells:ye,setMergedCells:be,layout:xe,setLayout:Ee,permission:we,setPermission:Ce,spinning:Se,setSpinning:Ne,isPingLeft:Te,setPingLeft:Ie,isPingRight:Re,setPingRight:Oe,isFullScreen:ke,setFullScreen:Le,updateTableFlatData:Ae}=(e=>{var n,r,l,i,a,o,s,c,d,u,m;const{uniqueKey:p,initialSorter:h={},initialFilter:f={},paginationConfig:g,rowSelection:v,expandable:y,rowHighlight:b,mergedCells:x}=e,{global:E}=t.useContext(on),w={current:null!==(n=null==g?void 0:g.current)&&void 0!==n?n:as.pagination.current,pageSize:null!==(o=null!==(l=null!==(r=(()=>{if(p)return Number(localStorage.getItem(`tablePager_${p}`))||void 0})())&&void 0!==r?r:null==g?void 0:g.pageSize)&&void 0!==l?l:null===(a=null===(i=null==E?void 0:E.table)||void 0===i?void 0:i.pagination)||void 0===a?void 0:a.pageSize)&&void 0!==o?o:as.pagination.pageSize,total:0},S=null!==(c=null!==(s=null==v?void 0:v.selectedRowKeys)&&void 0!==s?s:null==v?void 0:v.defaultSelectedRowKeys)&&void 0!==c?c:[],N=null!==(u=null!==(d=null==y?void 0:y.expandedRowKeys)&&void 0!==d?d:null==y?void 0:y.defaultExpandedRowKeys)&&void 0!==u?u:[],[T,I]=t.useState([]),[R,O]=t.useReducer(((e,t)=>t.forceUpdate||!C(e,t.payload)?t.payload:e),f),[k,L]=t.useReducer(((e,t)=>t.forceUpdate||!C(e,t.payload)?t.payload:e),h),[A,P]=t.useReducer(((e,t)=>C(e,t)?e:t),[]),[_,F]=t.useReducer(((e,t)=>C(e,t)?e:t),{}),[D,M]=t.useState(w),[H,$]=t.useReducer(((e,t)=>C(e,t)?e:t),S),[q,K]=t.useReducer(((e,t)=>C(e,t)?e:t),N),[j,V]=t.useState(null!==(m=null==b?void 0:b.currentRowKey)&&void 0!==m?m:""),[z,W]=t.useReducer((e=>e+1),0),[B,U]=t.useReducer(((e,t)=>C(e,t)?e:t),{}),[G,Y]=is([],{value:x}),[X,Q]=t.useState({gutterWidth:0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[Z,J]=t.useState({export:!0,import:!0,print:!0}),[ee,te]=t.useState(!1),[ne,re]=t.useState(!1),[le,ie]=t.useState(!1),[ae,oe]=t.useState(!1);return{tableFlatData:T,setTableFlatData:I,filters:R,setFilters:O,sorter:k,setSorter:L,superFilters:A,setSuperFilters:P,pagerFilter:_,setPagerFilter:F,pagination:D,setPagination:M,selectionKeys:H,setSelectionKeys:$,rowExpandedKeys:q,setRowExpandedKeys:K,highlightKey:j,setHighlightKey:V,updateMark:z,forceUpdate:W,activedCell:B,setActivedCell:U,mergedTdCells:G,setMergedCells:Y,layout:X,permission:Z,setPermission:J,setLayout:Q,spinning:ee,setSpinning:te,isPingLeft:ne,setPingLeft:re,isPingRight:le,setPingRight:ie,isFullScreen:ae,setFullScreen:oe,updateTableFlatData:()=>I([...T])}})(r),{isFetch:_e,isWebPagination:Fe,isScrollPagination:De,showPagination:Me,tableColumns:He,flattenColumns:$e,editableColumns:qe,summationColumns:Ke,leftFixedColumns:je,rightFixedColumns:Ve,tableRowHeight:ze,derivedMergeCells:We,treeExpandIndex:Be,showSummary:Ue,showFooter:Ge,isHeadGroup:Ye,bordered:Xe,isHeadSorter:Qe,isHeadFilter:Ze,isServiceSummation:Je,isSelectCollection:et,isTableImport:tt,isTableClipboard:nt,isSuperSearch:rt,isFastSearch:lt,isPivotGrid:it,isGroupSummary:at,isGroupSubtotal:ot,isTableEmpty:st,summationRows:ct,fetchParams:dt}=ss(r,{getRowKey:L,tableRef:A,$size:S,tableFullData:P,tableFlatData:X,updateMark:he,sorter:ee,filters:Z,superFilters:ne,selectionKeys:se,pagination:ae,mergedTdCells:ye}),{createElementStore:ut,tableStyles:mt,getSpan:pt,getStickyLeft:ht,getStickyRight:ft,scrollXToColumn:gt,scrollYToRecord:vt,calcTableHeight:yt,resetTableScroll:bt,createTableFocus:xt,doLayout:Et}=ds(r,{getRowKey:L,tableRef:A,topElementRef:N,tableElementRef:T,tableBodyRef:I,$size:S,tableColumns:He,flattenColumns:$e,leftFixedColumns:je,derivedMergeCells:We,tableFlatData:X,selectionKeys:se,highlightKey:me,tableRowHeight:ze,layout:xe,showFooter:Ge,showPagination:Me,isFullScreen:ke,setLayout:Ee,setElementStore:_}),{initialTable:wt,checkDataIndex:Ct,createTableFullData:St,createWebPageData:Nt,getTableData:Tt,createTableData:It,createGroupData:Rt,createAllExpandedKeys:Ot,setSelectionKeysEffect:kt,doFieldValidate:Lt,getTableLog:At,dataChange:Pt,tableChange:_t,toLastPage:Ft,toFirstPage:Dt,getPageCount:Mt,pagerChangeHandle:Ht,scrollBottomDebouncer:$t,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:jt,clearPagerFilter:Vt,clearActivedCell:zt,clearRowSelection:Wt,clearRowHighlight:Bt,clearTableLog:Ut,destroy:Gt}=cs(r,{getRowKey:L,tableRef:A,tableElementRef:T,$size:S,tableColumns:He,flattenColumns:$e,tableFullData:P,pagination:ae,layout:xe,filters:Z,sorter:ee,superFilters:ne,pagerFilter:le,fetchParams:dt,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,summationColumns:Ke,isFetch:_e,isWebPagination:Fe,isScrollPagination:De,isServiceSummation:Je,isGroupSubtotal:ot,doLayout:Et,setTableFlatData:Q,setTableFullData:D,setTableOriginData:M,setTableDataMaps:H,setPagination:oe,setPingRight:Oe,setPingLeft:Ie,setSpinning:Ne,setSorter:te,setFilters:J,setSuperFilters:re,setPagerFilter:ie,setActivedCell:ve,setSelectionKeys:ce,setRowExpandedKeys:ue,setHighlightKey:pe,setSelectionRows:U,setScrollXLoad:j,setScrollYLoad:V,setFieldAuth:q,setResizeState:z,setSummaries:B,setPermission:Ce,resetTableScroll:bt,createTableFocus:xt,clearElementStore:Y});((e,n)=>{const{columns:r,summation:l,rowSelection:i,expandable:a,rowHighlight:o}=e,{tableRef:s,tableBodyRef:c,$size:d,pagination:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,summationRows:f,showSummary:g,isWebPagination:v,isScrollPagination:y,checkDataIndex:b,toLastPage:x,toFirstPage:E,getPageCount:w,setHandleState:S,scrollYToRecord:N,setSelectionKeysEffect:T,setOriginColumns:I,setRowExpandedKeys:R,setHighlightKey:O,setResizeState:k,setUnMounted:L,calcTableHeight:A,initialTable:P,destroy:_}=n,F=t.useRef(f);Dl((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&c.current.setClickedValues(m.length?[m[0],""]:[]),pa(m)||null==e||e(m,s.current.selectionRows),ha(m)}),[m]),Dl((()=>{if(!a)return;const{onChange:e}=a;pa(p)||null==e||e(p,p.map((e=>s.current.recordsMap.get(e)))),ha(p)}),[p]),Dl((()=>{var e,t;o&&(c.current.setClickedValues(h?[h,""]:[]),null===(e=o.onChange)||void 0===e||e.call(o,h,null!==(t=s.current.recordsMap.get(h))&&void 0!==t?t:null))}),[h]),Dl((()=>{var e;C(f,F.current)||(F.current=f,g&&l&&(null===(e=l.onChange)||void 0===e||e.call(l,f)))}),[f]),Dl((()=>{const e=i.selectedRowKeys||[];C(e,m)||T(ma(e))}),[null==i?void 0:i.selectedRowKeys]),Dl((()=>{const e=a.expandedRowKeys||[];C(e,p)||R(ma(e))}),[null==a?void 0:a.expandedRowKeys]),Dl((()=>{const{currentRowKey:e}=o;e!==h&&O(null!=e?e:"")}),[null==o?void 0:o.currentRowKey]),Dl((()=>{const{insert:e,remove:t}=s.current.handleState;e&&(v&&("after"===e?x():E()),N("","after"===e?1e5:0)),t&&u.current>w()&&x(),(e||t)&&S({insert:null,remove:!1})}),[u.total]),Dl((()=>{A()}),[d]),Dl((()=>{(s.current.scrollYLoad||y)&&(e.height||e.maxHeight||Jn("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[s.current.scrollYLoad,y]),us({handler:()=>{const{resizeState:e}=s.current,{winHeight:t}=e,n=window.innerHeight;n!==t&&(k(Object.assign({},e,{winHeight:n})),A())},delay:16}),t.useLayoutEffect((()=>(I(ta(r)),P(),b(),En((()=>A())),()=>{_(),L(!0)})),[])})(r,{tableRef:A,tableBodyRef:I,$size:S,pagination:ae,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,showSummary:Ue,summationRows:ct,isWebPagination:Fe,isScrollPagination:De,checkDataIndex:Ct,toLastPage:Ft,toFirstPage:Dt,getPageCount:Mt,setHandleState:W,scrollYToRecord:vt,setOriginColumns:F,setSelectionKeysEffect:kt,setRowExpandedKeys:ue,setHighlightKey:pe,setResizeState:z,setUnMounted:G,calcTableHeight:yt,initialTable:wt,destroy:Gt});const Yt=t.useMemo((()=>({getRowKey:L,tableRef:A,tableBodyRef:I,prefixCls:k,$size:S,tableFlatData:X,flattenColumns:$e,editableColumns:qe,leftFixedColumns:je,rightFixedColumns:Ve,treeExpandIndex:Be,sorter:ee,filters:Z,superFilters:ne,pagerFilter:le,layout:xe,bordered:Xe,showFooter:Ge,showSummary:Ue,summationRows:ct,tableRowHeight:ze,pagination:ae,fetchParams:dt,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,activedCell:ge,mergedTdCells:ye,derivedMergeCells:We,updateMark:he,isFetch:_e,isPingLeft:Te,isPingRight:Re,isHeadSorter:Qe,isHeadFilter:Ze,isFullScreen:ke,isTableEmpty:st,isHeadGroup:Ye,isGroupSubtotal:ot,isWebPagination:Fe,dataChange:Pt,tableChange:_t,getTableData:Tt,setElementStore:_,createTableFullData:St,createWebPageData:Nt,createGroupData:Rt,createAllExpandedKeys:Ot,updateTableFlatData:Ae,setSorter:te,setFilters:J,setSuperFilters:re,setPagerFilter:ie,setHighlightKey:pe,setRowExpandedKeys:ue,setSelectionRows:U,setSelectionKeysEffect:kt,setInvalidRowKeys:$,setActivedCell:ve,setMergedCells:be,getSpan:pt,getStickyLeft:ht,getStickyRight:ft,scrollXToColumn:gt,scrollYToRecord:vt,setPagination:oe,setPingLeft:Ie,setPingRight:Oe,setSpinning:Ne,setFullScreen:Le,doFieldValidate:Lt,createTableData:It,scrollBottomDebouncer:$t,resetTableScroll:bt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:jt,clearPagerFilter:Vt,clearActivedCell:zt,clearRowSelection:Wt,clearRowHighlight:Bt})),[S,X,$e,ee,Z,ne,le,xe,Xe,Ge,Ue,ct,ze,ae,dt,se,de,me,ge,We,he,_e,Te,Re,Qe,Ze,ke,st,Ye,ot,Fe]);((e,n)=>{const{getRowKey:r,tableRef:l,toolBoxRef:i,tableBodyRef:a,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:d,fetchParams:u,selectionKeys:m,rowExpandedKeys:p,highlightKey:h,isFetch:g,dataChange:v,getTableData:y,createTableData:b,calcTableHeight:x,scrollXToColumn:w,scrollYToRecord:C,doFieldValidate:S,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:k,setOriginColumns:L,forceUpdate:A,getTableLog:P,clearRowSelection:_,clearRowHighlight:F,clearTableSorter:D,clearTableFilter:M,clearSuperFilters:H,clearPagerFilter:$,clearActivedCell:q,clearTableLog:K}=n,{columns:j,columnsChange:V}=l.current.props,z=(e,t,n,l=0)=>e.filter((e=>{const i=r(e,e.index);e.children&&(e.children=z(e.children,t,n,l+1));const a=t.includes(i);return a&&n(e,i,l),!a}));t.useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{x()},DO_REFRESH:e=>hn(void 0,void 0,void 0,(function*(){g&&(yield xn(0),yield y(),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:()=>{g||(M(),H(),$(),D(),q(),_(),F(),K(),b([]))},CLEAR_LOG:()=>{K(),A()},CREATE_FOCUS:(e,t)=>{a.current.createFocus(e,t)},FORCE_UPDATE:()=>{A()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{w(e)},SET_SELECTION:(e,t)=>{I(t?ma([...e]):e)},SET_EXPANDABLE:(e,t)=>{R(t?ma([...e]):e)},SET_HIGHLIGHT:e=>{O(e)},SET_SELECTION_ROWS:e=>{k(e)},SET_TABLE_DATA:e=>{b(e)},DEFINE_INITIAL_COLUMNS:e=>{L(ta(e)),T(!0),o.current.initialHandler(e)},SET_TABLE_COLUMN:(e,t,n)=>{const r=la(j,e);if(!r)return Jn("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!f(t))return Jn("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(r.noAuth)return Jn("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&E(r,e,t[e]);n&&(V?V([...j]):Jn("Table","需要设置 `columnsChange` 参数"),A())},INSERT_RECORDS:(e,t)=>{const{store:n,tableFullData:i,tableOriginData:a}=l.current,o=(Array.isArray(e)?e:[e]).filter((e=>f(e)));if(!o.length)return;o.forEach((e=>{s.forEach((t=>{const{dataIndex:n}=t;[as.expandableColumn,as.selectionColumn,as.operationColumn].includes(n)||ba(e,n,ya(e,n))})),n.addToInserted(e)}));const c="before"===(null==t?void 0:t.mode),d=void 0===(null==t?void 0:t.parentRowKey),u=[...i];if(d)c?u.unshift(...o):u.push(...o),c?a.unshift(...o):a.push(...o);else{const e=Aa(u,(e=>t.parentRowKey===r(e,e.index)));if(e){const n=Aa(a,(e=>t.parentRowKey===r(e,e.index))),l=Ma(e,n);Array.isArray(e.children)?(c?e.children.unshift(...o):e.children.push(...o),!l&&n&&(c?n.children.unshift(...o):n.children.push(...o))):(e.children=o,!l&&n&&(n.children=o))}}d&&N(Object.assign({},l.current.handleState,{insert:c?"before":"after"})),b(a,(()=>u)),v()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:n,tableOriginData:i}=l.current,a=(Array.isArray(e)?e:[e]).map((e=>f(e)?r(e,e.index):e));if(!a.length)return;let o=!1;const s=z([...n],a,((e,n,l)=>{if(t.addToRemoved(e),c.forEach((r=>{const{dataIndex:l,editRender:i}=r,a=null==i?void 0:i(e,r);if(!a)return;const{rules:o=[],disabled:s}=a;!s&&o.length&&(t.removeFromRequired({x:n,y:l}),t.removeFromValidate({x:n,y:l}),t.removeFromEdited({x:n,y:l}))})),l<=0){const e=i.findIndex((e=>r(e,e.index)===n));i.splice(e,1)}else if(!Ma(e,Aa(i,(e=>r(e,e.index)===n)))){const t=Aa(i,(t=>r(t,t.index)===e._parentRowKey));t&&(t.children=t.children.filter((e=>r(e,e.index)!==n)))}o=!0}));o&&(N(Object.assign({},l.current.handleState,{remove:!0})),I(m.filter((e=>!a.includes(e)))),a.includes(h)&&F(),R(p.filter((e=>!a.includes(e)))),b(i,(()=>s)),v())},VALIDATE_FIELDS:(e,t)=>{Array.from(l.current.recordsMap.values()).forEach((n=>{c.forEach((l=>{const{dataIndex:i,title:a,editRender:o}=l,s=null==o?void 0:o(n,l);if(!s)return;const c=r(n,n.index);if(e&&!e.includes(c))return;if(t&&!t.includes(i))return;const{rules:d=[],disabled:u}=s;u||S(d,ya(n,i),c,i,Ia(a))}))}));const{required:n,validate:i}=P(),a=[...n,...i];return a.length&&C(a[0].rowKey),A(),{required:n,validate:i}}})))})(n,{getRowKey:L,tableRef:A,toolBoxRef:R,tableBodyRef:I,columnFilterRef:O,flattenColumns:$e,editableColumns:qe,pagination:ae,fetchParams:dt,selectionKeys:se,rowExpandedKeys:de,highlightKey:me,isFetch:_e,dataChange:Pt,getTableData:Tt,createTableData:It,calcTableHeight:yt,scrollXToColumn:gt,scrollYToRecord:vt,doFieldValidate:Lt,setHandleState:W,setColumnsDefined:K,setSelectionKeysEffect:kt,setRowExpandedKeys:ue,setHighlightKey:pe,setSelectionRows:U,setOriginColumns:F,forceUpdate:fe,getTableLog:At,clearRowSelection:Wt,clearRowHighlight:Bt,clearTableSorter:qt,clearTableFilter:Kt,clearSuperFilters:jt,clearPagerFilter:Vt,clearActivedCell:zt,clearTableLog:Ut}),t.useLayoutEffect((()=>{ut(),A.current.tableManager.register(A.current.uid,null!=n?n:{current:null})}),[]);const Xt={[`${k}--wrapper`]:!0,[`${k}--lg`]:"large"===S,[`${k}--sm`]:"small"===S,[`${k}--maximize`]:ke,[s]:!!s},Qt={[k]:!0,"is--border":Xe,"is--fixed":je.length||Ve.length,"is--sortable":Qe,"is--filterable":Ze,"is--head-group":Ye,"is--area-select":!!c,"is--ping-left":Te,"is--ping-right":Re};return t.createElement(Ko.Provider,{value:Yt},t.createElement("div",{className:Pe(Xt,x),style:w},h&&t.createElement("div",{ref:N,className:`${k}-top`},t.createElement("div",{className:`${k}-top__space`},"bottom"!==(null==m?void 0:m.position)&&t.createElement(ms,{total:ae.total}),t.createElement("div",{className:`${k}-top__space-slot`,style:{justifyContent:Qo[p]}},r.children)),t.createElement("div",{className:`${k}-top__actions`},t.createElement(Gu,{ref:R,showFullScreen:g,showReload:v&&_e,showPrint:we.print&&!!d,showImport:we.import&&tt,showExport:we.export&&!!u,showClipboard:nt,showCollection:et,showFastSearch:lt,showSuperSearch:rt,showPivotGrid:it,showGroupSummary:at,showToolBox:y,tableColumns:He}),t.createElement(Xu,{ref:O,columns:i}))),t.createElement(ei,{spinning:null!=a?a:Se},t.createElement("div",{ref:T,className:Pe(Qt),style:mt},t.createElement("div",{className:`${k}--main-wrapper`},b&&t.createElement(Nm,{tableColumns:He}),t.createElement(rp,{ref:I}),Ge&&t.createElement(lp,null)),Xe&&t.createElement("div",{className:`${k}--border-line`}),st&&t.createElement(op,null),o&&t.createElement(sp,null))),Me&&t.createElement(ap,jn({},ae,{onChange:(e,t)=>Ht({current:e,pageSize:t})}))))}));cp.displayName="QmTable";const dp=e=>{var n;const{uniqueKey:r,multiple:l,initialValue:i,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:d,style:u,onClose:m}=e,{$size:p}=Xn(e),{t:h}=Gn(),f=t.useRef(null),g=t.useRef(null),v=t.useRef(null),y=ai(f),[b,E]=t.useState(c),[w,S]=t.useState(),[N,T]=t.useState(o),[I,R]=t.useState(!1),[O,k]=t.useState(300),[L,A]=t.useState(s),[P,_]=t.useState((e=>[{title:h("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[F,M]=t.useState(D({},null===(n=c.fetch)||void 0===n?void 0:n.params,i)),[H,$]=t.useState([]),q=()=>{const e=f.current,t=e.querySelector(".form-wrap");k(e.offsetHeight-t.offsetHeight-2*qo[p]-30)},K=ci(q,5);si((()=>{K()}),[y.width]),Dl((()=>{C(s,L)||A(s)}),[s]),t.useEffect((()=>{j()}),[F]),t.useEffect((()=>{a&&v.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;i&&(null===(e=g.current)||void 0===e||e.SET_FIELDS_VALUE(i))}),[]);const j=()=>hn(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:i,beforeFetch:a=bn,afterFetch:o}=n;if(a(F)){R(!0);try{const t=yield r(F);if(200===t.code){let n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,i))&&void 0!==e?e:[];n="function"==typeof o?yield o(n):n,l||(T([]),yield xn(0)),$(n)}}catch(e){}R(!1)}})),V=e=>{l||(S(e),m(e))},z=e=>{M(Object.assign({},F,e))},W={[`${rr("search-helper")}--wrapper`]:!0},B=b.webPagination?{dataSource:H,loading:I,webPagination:!0}:{fetch:Object.assign(Object.assign({},b.fetch),{params:F})};return t.createElement("div",{ref:f,className:Pe(W,d),style:u},t.createElement("div",{className:"form-wrap"},L.length?t.createElement(Vh,{ref:g,items:L,uniqueKey:r,formType:"search",disabled:!1,isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>q(),onFinish:e=>z(e),onReset:()=>hn(void 0,void 0,void 0,(function*(){const[e,t]=yield g.current.GET_FORM_DATA();e||z(t)}))}):null),t.createElement("div",null,t.createElement(cp,jn({ref:v,uniqueKey:r,height:O,columns:P,rowKey:b.rowKey||"pageIndex"},B,{rowSelection:{type:l?"checkbox":"radio",clearableAfterFetched:!l,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:N,onChange:(e,t)=>{T(e),S(l?t:t[0])}},topSpaceAlign:"left",paginationConfig:b.paginationConfig,columnsChange:e=>_(e),onRowDblclick:V,onRowEnter:V}),b.topBarExtra)),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${qo[p]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(er,{onClick:()=>m(null),style:{marginRight:8}},h("qm.dialog.cancel")),t.createElement(er,{type:"primary",disabled:!w,onClick:()=>m(w,l?N:void 0)},h("qm.dialog.confirm"))))};dp.displayName="QmSearchHelper";const{Search:up}=re;class mp extends d{constructor(e){super(e),this._is_change=!1,this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>hn(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||Jn("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)||Jn("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Jn("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>hn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Cn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=x(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&ro(e,this.alias,c),d&&lo(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=no(e,this.alias[this.props.option.fieldName]);this.triggerChange(t),this.searchHelperChangeHandle(t)}null==i||i([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,l=("function"==typeof n?n():n)||[],i={[t]:r};return(Array.isArray(l)?l:[l]).forEach((e=>{if(f(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=bn,formatter:l=(e=>e)}=t.fetch;return new Promise(((i,a)=>hn(this,void 0,void 0,(function*(){var o;const s=D({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),l(this.createFilters(e))),{currentPage:1,pageSize:500});if(!r(s))return a();this.setState({loading:!0});try{const e=yield t.fetch.api(s);if(200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=x(e.data,t.fetch.dataKey))&&void 0!==o?o:[];i(n)}else a()}catch(e){a(e)}finally{En((()=>this.setState({loading:!1})))}}))))},this.setFieldsValue=e=>{const{$$form:t}=this.context,{fieldName:n}=this.props.option;for(const r in this.alias){const l=no(e,this.alias[r]);void 0!==l&&(t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l))}for(const n in this.extras){const r=no(e,this.extras[n]);void 0!==r&&t.SET_FIELDS_EXTRA({[n]:r})}},this.resetSearchHelperValue=(e=[],t)=>hn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,r=e.filter((e=>{var r;return null===(r=no(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)=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:n}=this.context,{beforeOpen:r}=this.searchHelper,l=(null!=r?r:bn)(n.state.formData);(null==l?void 0:l.then)?l.then((()=>{this.todoOpen(e),null==t||t()})).catch((()=>{})):!1!==l&&(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){if(r===n)continue;const l=no(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:no(e,this.extras[n])});const r=no(e,this.alias[n]);this.triggerChange(r),this.searchHelperChangeHandle(r);const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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}),n===this.valueKey&&(this._prevValue=null));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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:l}=this.state,{value:i}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=un("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:p=!0,translate:h,readOnly:f,disabled:g}=this.props.option,{prefix:v,suffix:y,maxLength:b}=s,x={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${qo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},E=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()}}),w=n.isOnlyShow?t.createElement(So,{value:i,bordered:m}):t.createElement(t.Fragment,null,t.createElement(up,{ref:e=>this[`${a}_Ref`]=e,value:i,title:i,loading:l,placeholder:u,style:d,prefix:v,suffix:y,maxLength:b,bordered:m,allowClear:p,readOnly:f,disabled:g,onBlur:e=>{var t;const{value:n}=e.target,{onlySelect:l=!0,table:i}=this.searchHelper;this.triggerBlur(n),this._is_change&&!r&&(n?l?(null===(t=null==i?void 0:i.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):En((()=>this.clearSearchHelperValue())))}}),t.createElement(Mi,x,t.createElement(dp,E)));return h?t.createElement(No,{text:i},w):w}}mp.contextType=Hi;class pp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>hn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Zn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Jn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>hn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=co(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[]}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(c)},required:e.getFormItemRequired(h)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(mp,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="")=>{e.setViewValue(a,t)}}))),m&&t.createElement(ce,null,e.renderFormItemButton(a,m)),u&&t.createElement(ce,{flex:In(u.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}pp.contextType=Hi;const hp=e=>{class n extends d{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 l=e.target,i=null==t?void 0:t.target,a=!l||!i,o=(null===(n=this.$el)||void 0===n?void 0:n.contains(l))||(null===(r=this.$el)||void 0===r?void 0:r.contains(i)),s=this.$el===l,c=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),d=c.some((e=>null==e?void 0:e.contains(l)))||c.includes(i);let u;u=!(a||o||s||d),this.setState({clickOutside:u})},this.setCurrentElement=e=>{e&&(this.$el=e)},this.setOmitClassNames=(e=[])=>{this.omitClassNames=e}}componentDidMount(){this.event1=jt(document,"mousedown",this.mousedownHandler),this.event2=jt(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){var e,t;null===(e=this.event1)||void 0===e||e.remove(),null===(t=this.event2)||void 0===t||t.remove()}render(){const{forwardedRef:n}=this.props,{clickOutside:r}=this.state;return t.createElement(e,jn({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,jn({},e,{forwardedRef:r}))))};let fp=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Jn("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Jn("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=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:bn)(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(H([...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:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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:l}=this.props;C(n,r)||C(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),l&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:l,params:i={},formatter:a=(e=>e),dataKey:o,callback:s,fieldAliasMap:c}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},d="function"==typeof c?c():c||{},{value:u}=this.props;if(l){if(Cn(u))return this.setRecords([]);this.setState({loading:!0});try{const e=yield l(a(Object.assign(Object.assign({},i),{keys:u})));if(200===e.code){let l=Array.isArray(e.data)?e.data:null!==(t=x(e.data,o))&&void 0!==t?t:[];l.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])})),l=l.filter((e=>u.includes(e[r])));const i=l.map((e=>({value:e[r],text:e[n]})));this.setRecords(l),this.setItemList(i),this.setViewValue(u),null==s||s(l)}}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:l}=this.context,{visible:i,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:p={},placeholder:h=un("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:i,title:un("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"60%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${qo[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:D({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),C=s.filter((e=>null==c?void 0:c.includes(e.value))),S=t.createElement("ul",{className:"ant-dropdown-menu"},C.length?C.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},un("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,T=rr("form-multiple-search-helper"),{size:I}=l.context,R={[T]:!0,[`${T}--lg`]:"large"===I,[`${T}--sm`]:"small"===I};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${T}`]);const O=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t.createElement(So,{value:O,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(ad,{popupVisible:!y&&a,popup:S,popupClassName:Pe(R),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ua,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(de,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:h,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},p),title:O,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(de.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(Y,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Nt,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Mi,E,t.createElement(dp,w)))}};fp.contextType=Hi,fp=pn([hp],fp);class gp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>hn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Zn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Jn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>hn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=co(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(c)},required:e.getFormItemRequired(h)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(fp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(ce,null,e.renderFormItemButton(a,m)),u&&t.createElement(ce,{flex:In(u.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}gp.contextType=Hi;const vp=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...vp(e.children)),e.children&&t.push(e.value)})),t},yp=(e,t)=>{let n=null;for(let r=0;r<e.length;r++){if(Array.isArray(e[r].children)&&(n=yp(e[r].children,t)),n)return n;if(t(e[r]))return e[r]}return n},bp=(e,t)=>e.map((e=>Object.assign({},e))).filter((e=>(e.children=e.children&&bp(e.children,t),t(e)||e.children&&e.children.length))),xp=e=>{var n;const{uniqueKey:r,multiple:l,initialValue:i,selectionRows:a,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:d={},className:u,style:m,onClose:p}=e,{$size:h}=Xn(e),{t:f}=Gn(),g=t.useRef(null),v=t.useRef(null),y=t.useRef(null),b=ai(g),[E,w]=t.useState(c),[S,N]=t.useState(),[T,I]=t.useState(o),[R,O]=t.useState(!1),[k,L]=t.useState(300),[A,P]=t.useState(300),[_,F]=t.useState(s),[M,H]=t.useState((e=>[{title:f("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t.createElement("span",null,e+1)},...e||(c.columns||[])])()),[$,q]=t.useState(D({},null===(n=c.fetch)||void 0===n?void 0:n.params,i)),[K,j]=t.useState([]),V=()=>{const e=g.current,t=e.querySelector(".form-wrap"),n=e.querySelector(".input-wrap");L(e.offsetHeight-n.offsetHeight-10),P(e.offsetHeight-t.offsetHeight-2*qo[h]-30)},z=ci(V,5);si((()=>{z()}),[b.width]),Dl((()=>{C(s,_)||F(s)}),[s]),t.useEffect((()=>{W()}),[$]),t.useEffect((()=>{a&&y.current.SET_SELECTION_ROWS(a)}),[a]),t.useEffect((()=>{var e;i&&(null===(e=v.current)||void 0===e||e.SET_FIELDS_VALUE(i)),ne()}),[]);const W=()=>hn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=E;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:i,beforeFetch:a=bn}=n;if(a($)){O(!0);try{const t=yield r($);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,i))&&void 0!==e?e:[];l||(I([]),yield xn(0)),j(n)}}catch(e){}O(!1)}})),B=e=>{l||(N(e),p(e))},U=e=>{q(Object.assign({},$,e))},[G,Y]=t.useState([]),[X,Q]=t.useState([]),[Z,J]=t.useState(""),ee=t.useRef(G),te=t.useRef([]);Dl((()=>{Q(vp(G))}),[G]);const ne=()=>hn(void 0,void 0,void 0,(function*(){var e;if(!d.fetch)return;const{api:t,params:n,dataKey:r,valueKey:l="value",textKey:i="text"}=d.fetch;try{const a=yield t(n);if(200===a.code){const t=Array.isArray(a.data)?a.data:null!==(e=x(a.data,r))&&void 0!==e?e:[],n=io(t,l,i);Y(n),ee.current=n,te.current=t}}catch(e){}})),le=e=>`${e}|${wo.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,ie={[`${rr("tree-table-helper")}--wrapper`]:!0},ae=E.webPagination?{dataSource:K,loading:R,webPagination:!0}:{fetch:Object.assign(Object.assign({},E.fetch),{params:$})};return t.createElement("div",{ref:g,className:Pe(ie,u),style:m},t.createElement(Ql,{defaultValue:200,style:{height:"100%"}},t.createElement(Ql.Pane,{min:100,style:{overflowY:"auto"}},t.createElement(re,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:f("qm.form.inputPlaceholder"),suffix:t.createElement(Nt,null),disabled:!1,allowClear:!0,onChange:e=>(e=>{const t=bp(ee.current,(t=>{if(!e)return!0;const n=t.text||"";return-1!==le(n).indexOf(e)}));J(e),Y(t)})(e.target.value)}),t.createElement(ye,{fieldNames:{title:"text",key:"value",children:"children"},height:k,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==le(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=d.fetch;(e=>{if(!d.tableParamsMap)return Jn("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof d.tableParamsMap?d.tableParamsMap():d.tableParamsMap,n={};for(const r in t)n[r]=x(e,t[r]);U(n)})(yp(te.current,(n=>x(n,t)===e[0]))||{})}})),t.createElement(Ql.Pane,{className:"split-pane"},t.createElement("div",{className:"form-wrap"},_.length?t.createElement(Vh,{ref:v,items:_,uniqueKey:r,formType:"search",disabled:!1,isAutoFocus:!1,fieldsChange:e=>F(e),onCollapse:()=>V(),onFinish:e=>U(e),onReset:()=>hn(void 0,void 0,void 0,(function*(){const[e,t]=yield v.current.GET_FORM_DATA();e||U(t)}))}):null),t.createElement("div",null,t.createElement(cp,jn({ref:y,uniqueKey:r,height:A,columns:M,rowKey:E.rowKey||"pageIndex"},ae,{rowSelection:{type:l?"checkbox":"radio",clearableAfterFetched:!l,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:T,onChange:(e,t)=>{I(e),N(l?t:t[0])}},topSpaceAlign:"left",paginationConfig:E.paginationConfig,columnsChange:e=>H(e),onRowDblclick:B,onRowEnter:B}),E.topBarExtra)))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${qo[h]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(er,{onClick:()=>p(null),style:{marginRight:8}},f("qm.dialog.cancel")),t.createElement(er,{type:"primary",disabled:!S,onClick:()=>p(S,l?T:void 0)},f("qm.dialog.confirm"))))};xp.displayName="TreeTableHelper";const{Search:Ep}=re;class wp extends d{constructor(e){super(e),this._prevValue=null,this.state={visible:!1,loading:!1},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.echoSearchHelper=()=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.setVisible=(e,t)=>{this.setState({visible:e},t)},this.initialHandle=()=>hn(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||Jn("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)||Jn("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),r&&!this.valueKey&&Jn("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getDerivedSearchHelper=()=>this.searchHelper,this.getItemText=()=>hn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Cn(u)){this.setState({loading:!0});try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=x(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&ro(e,this.alias,c),d&&lo(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=no(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==i||i([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 l=no(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:no(e,this.extras[n])})},this.openSearchHelper=e=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:bn)(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){if(r===n)continue;const l=no(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:no(e,this.extras[n])});const r=no(e,this.alias[n]);this.triggerChange(r);const{closed:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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}),n===this.valueKey&&(this._prevValue=null));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||{}}componentDidUpdate(){this.echoSearchHelper()}render(){var e;const{$$form:n}=this.context,{visible:r,loading:l}=this.state,{value:i=""}=this.props,{type:a,fieldName:o,options:s={},searchHelper:c={},style:d={},placeholder:u=un("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:p=!0,translate:h,readOnly:f,disabled:g}=this.props.option,{prefix:v,suffix:y,maxLength:b}=s,x={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=c.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${qo[n.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},E=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:D({},c.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}}),w=n.isOnlyShow?t.createElement(So,{value:i,bordered:m}):t.createElement(t.Fragment,null,t.createElement(Ep,{ref:e=>this[`${a}_Ref`]=e,value:i,title:i,loading:l,placeholder:u,style:d,prefix:v,suffix:y,maxLength:b,bordered:m,allowClear:p,readOnly:f,disabled:g,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(Mi,x,t.createElement(xp,E)));return h?t.createElement(No,{text:i},w):w}}wp.contextType=Hi;class Cp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>hn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Zn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Jn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>hn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=co(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(c)},required:e.getFormItemRequired(h)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(wp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(ce,null,e.renderFormItemButton(a,m)),u&&t.createElement(ce,{flex:In(u.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Cp.contextType=Hi;let Sp=class extends d{constructor(e){super(e),this.searchRef=t.createRef(),this._records=[],this.state={visible:!1,visible2:!1,loading:!1,itemList:[]},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Jn("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Jn("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=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:bn)(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(H([...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:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(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:l}=this.props;C(n,r)||C(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),l&&t.visible2&&this.setState({visible2:!1})}getItemList(){var e,t;return hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:n,valueKey:r}=this.alias,{fetchApi:l,params:i={},formatter:a=(e=>e),dataKey:o,fieldAliasMap:s}=this.searchHelper.echoRequest||(null===(e=this.props.option.searchHelper)||void 0===e?void 0:e.request)||{},c="function"==typeof s?s():s||{},{value:d}=this.props;if(l){if(Cn(d))return this.setRecords([]);this.setState({loading:!0});try{const e=yield l(a(Object.assign(Object.assign({},i),{keys:d})));if(200===e.code){let l=Array.isArray(e.data)?e.data:null!==(t=x(e.data,o))&&void 0!==t?t:[];l.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])})),l=l.filter((e=>d.includes(e[r])));const i=l.map((e=>({value:e[r],text:e[n]})));this.setRecords(l),this.setItemList(i),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:l}=this.context,{visible:i,visible2:a,loading:o,itemList:s}=this.state,{value:c}=this.props,{fieldName:d,options:u={},searchHelper:m={},style:p={},placeholder:h=un("qm.form.selectPlaceholder"),bordered:f=!0,allowClear:g=!0,readOnly:v,disabled:y}=this.props.option,{collapseTags:b,maxTagTextLength:x}=u,E={visible:i,title:un("qm.searchHelper.text"),width:null!==(e=m.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${d}`,loading:!1,bodyStyle:{paddingBottom:`${qo[l.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},w=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:l.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${d}`:"",initialValue:D({},m.initialValue),defaultSelectedKeys:c,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}}),C=s.filter((e=>null==c?void 0:c.includes(e.value))),S=t.createElement("ul",{className:"ant-dropdown-menu"},C.length?C.map((e=>t.createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t.createElement("li",{className:"ant-dropdown-menu-item"},un("qm.table.config.emptyText"))),N=this.searchRef.current?this.searchRef.current.offsetWidth:300,T=rr("form-multiple-tree-table-helper"),{size:I}=l.context,R={[T]:!0,[`${T}--lg`]:"large"===I,[`${T}--sm`]:"small"===I};null===(r=(n=this.props).setOmitClassNames)||void 0===r||r.call(n,[`.${T}`]);const O=s.filter((e=>null==c?void 0:c.includes(e.value))).map((e=>e.text)).join(",");return l.isOnlyShow?t.createElement(So,{value:O,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(ad,{popupVisible:!y&&a,popup:S,popupClassName:Pe(R),popupStyle:{minWidth:N},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:Ua,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement(de,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:x,open:!1,value:c,placeholder:h,loading:o,bordered:f,allowClear:g,disabled:y,style:Object.assign({width:"100%"},p),title:O,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(de.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",{className:"ant-input-group-addon"},t.createElement(Y,{className:"ant-input-search-button",disabled:y,icon:t.createElement(Nt,null),onClick:()=>{this.openSearchHelper()}})))),t.createElement(Mi,E,t.createElement(xp,w)))}};Sp.contextType=Hi,Sp=pn([hp],Sp);class Np extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>hn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Zn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Jn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>hn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=co(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(c)},required:e.getFormItemRequired(h)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Sp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{f(t,r),e.setViewValue(a,n)}}))),m&&t.createElement(ce,null,e.renderFormItemButton(a,m)),u&&t.createElement(ce,{flex:In(u.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Np.contextType=Hi;const Tp="_startSign",Ip="_endSign",Rp=e=>{var n;const{uniqueKey:r,initialValue:l,filters:i=[],table:a={},onClose:o}=e,{$size:s}=Xn(e),{t:c}=Gn(),d=t.useRef(null),u=t.useRef(null),m=t.useRef(null),p=ai(d),[h,f]=t.useState(a),[g,v]=t.useState(!1),[y,b]=t.useState([]),[E,w]=t.useState(300),[S,N]=t.useState(i),[T,I]=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:Tp,width:80,align:"right",render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)},...e||(a.columns||[]),{title:c("qm.form.rangeSearchHelper")[1],dataIndex:Ip,fixed:"right",width:80,render:(e,n)=>t.createElement("span",{className:"icon-sign"},e)}])()),[R,O]=t.useState(D({},null===(n=a.fetch)||void 0===n?void 0:n.params,l)),[k,L]=t.useState([]),A=t.useMemo((()=>y.map((e=>null==e?void 0:e.pageIndex))),[y]),P=t.useMemo((()=>2===A.length&&A.every((e=>void 0!==e))),[A]),_=()=>{const e=d.current.parentNode.children[0],t=e.querySelector(".form-wrap");w(e.offsetHeight-t.offsetHeight-2*qo[s]-30)},F=ci(_,5);si((()=>{F()}),[p.width]),Dl((()=>{C(i,S)||N(i)}),[i]),t.useEffect((()=>{M()}),[R]);const M=()=>hn(void 0,void 0,void 0,(function*(){var e;const{webPagination:t,fetch:n}=h;if(!t||!(null==n?void 0:n.api))return;const{api:r,dataKey:l,beforeFetch:i=bn}=n;if(i(R)){v(!0);try{const t=yield r(R);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[];L(n)}}catch(e){}v(!1)}})),H=(e,t)=>{delete e[t]},$=()=>{y.forEach((e=>{e&&(H(e,Tp),H(e,Ip))})),b([])},q=e=>{$(),O(Object.assign({},R,e))},K=rr("range-helper"),j=h.webPagination?{dataSource:k,loading:g,webPagination:!0}:{fetch:Object.assign(Object.assign({},h.fetch),{params:R})};return t.createElement("div",{ref:d,className:`${K}--wrapper`},t.createElement("div",{className:"form-wrap"},S.length?t.createElement(Vh,{ref:u,items:S,initialValues:l,uniqueKey:r,formType:"search",disabled:!1,isAutoFocus:!1,fieldsChange:e=>N(e),onCollapse:()=>_(),onFinish:e=>q(e),onReset:()=>hn(void 0,void 0,void 0,(function*(){const[e,t]=yield u.current.GET_FORM_DATA();e||q(t)}))}):null),t.createElement("div",null,t.createElement(cp,jn({ref:m,height:E,columns:T,rowKey:h.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=A[0]&&e.pageIndex<=A[1]?{backgroundColor:"#f5f5f5"}:{}},j,{columnsChange:e=>I(e),onRowClick:(e,t)=>{const{dataIndex:n}=t;[Tp,Ip].includes(n)&&(n===Tp&&(e[n]?(H(e,n),b([void 0,y[1]])):e.pageIndex>A[1]?ne.warning(c("qm.searchHelper.rangeStartTip")):(y[0]&&H(y[0],n),e[n]="[",b([e,y[1]]))),n===Ip&&(e[n]?(H(e,n),b([y[0],void 0])):e.pageIndex<A[0]?ne.warning(c("qm.searchHelper.rangeEndTip")):(y[1]&&H(y[1],n),e[n]="]",b([y[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===A[0]&&(e[Tp]="["),e.pageIndex===A[1]&&(e[Ip]="]")}))}}),t.createElement(er,{type:"primary",icon:t.createElement(Tt,null),title:c("qm.table.alert.clear"),onClick:()=>$()}))),t.createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${qo[s]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t.createElement(er,{onClick:()=>o(null),style:{marginRight:8}},c("qm.dialog.cancel")),t.createElement(er,{type:"primary",disabled:!P,onClick:()=>o(y.map((e=>(e=>{const t={};for(const n in e)[Tp,Ip].includes(n)||(t[n]=e[n]);return t})(e))))},c("qm.dialog.confirm"))))};Rp.displayName="RangeTableHelper";const Op=new Array(2).fill("");class kp extends d{constructor(e){super(e),this._is_change=!1,this._records=[],this._is_clear=!1,this.state={visible:!1,loading:!1,itemList:[],textValue:Op},this.getSearchHelper=Wt((e=>Object.assign({},this.props.helperConfig,e))),this.initialHandle=()=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();this.searchHelper.fieldAliasMap||Jn("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||Jn("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(Op),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:l}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>null==l?void 0:l(this._records)),200)}))},this.openSearchHelper=e=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{$$form:t}=this.context,{beforeOpen:n}=this.searchHelper,r=(null!=n?n:bn)(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]:Cn(e)?void 0:e}},this.getSearchHelperTableData=e=>{const{table:t,initialValue:n={}}=this.searchHelper,{beforeFetch:r=bn,formatter:l=(e=>e)}=t.fetch;return new Promise(((i,a)=>hn(this,void 0,void 0,(function*(){var o;const s=D({},this.searchHelper.table.fetch.params,Object.assign(Object.assign({},n),l(this.createFilters(e))),{currentPage:1,pageSize:500});try{if(!r(s))return a();this.setState({loading:!0});const e=yield t.fetch.api(s);if(En((()=>this.setState({loading:!1}))),200===e.code){const n=Array.isArray(e.data)?e.data:null!==(o=x(e.data,t.fetch.dataKey))&&void 0!==o?o:[];return i(n)}}catch(e){this.setState({loading:!1})}a()}))))},this.resetSearchHelperValue=(e=[])=>hn(this,void 0,void 0,(function*(){const{textValue:t}=this.state,{textKey:n}=this.alias,r=e.filter((e=>{var r;const l=null===(r=e[n])||void 0===r?void 0:r.toString().toLowerCase();return t.some((e=>null==l?void 0:l.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;C(t,n)||C(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:r}=this.context,{fieldName:l}=this.props.option;if(!C(r[l],this._ceho_data)&&(this._ceho_data=r[l],this.setItemList(r[l]),n.length)){const e=Op.map(((e,t)=>{var i,a;return null!==(a=null===(i=r[l].find((e=>e.value===n[t])))||void 0===i?void 0:i.text)&&void 0!==a?a:""}));this.setTextValue(e)}}getItemList(){var e;return hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{textKey:t,valueKey:n}=this.alias,{fetchApi:r,params:l={},formatter:i=(e=>e),dataKey:a,fieldAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r){if(Cn(c))return this.setRecords([]);this.setState({loading:!0});try{const o=yield r(i(Object.assign(Object.assign({},l),{keys:c})));if(200===o.code){let r=Array.isArray(o.data)?o.data:null!==(e=x(o.data,a))&&void 0!==e?e:[];r.forEach((e=>{(null==s?void 0:s.valueKey)&&s.valueKey!==n&&(e[n]=e[s.valueKey]),(null==s?void 0:s.textKey)&&s.textKey!==t&&(e[t]=e[s.textKey])})),r=r.filter((e=>c.includes(e[n]))).slice(0,2);const l=r.map((e=>({value:e[n],text:e[t]})));this.setRecords(r),this.setItemList(l),this.setTextValue(l.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:l,textValue:i}=this.state,{fieldName:a,options:o={},searchHelper:s={},placeholder:c=un("qm.form.rangeInputNumberPlaceholder"),bordered:d=!0,readOnly:u,disabled:m}=this.props.option,{onlySelect:p=!0}=this.searchHelper||s,h=i.every((e=>to(e)))?"":i.join(" - "),f={visible:r,title:un("qm.searchHelper.text"),width:null!==(e=s.width)&&void 0!==e?e:"65%",wrapClassName:`form-popper__${a}`,loading:!1,bodyStyle:{paddingBottom:`${qo[n.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g=Object.assign(Object.assign({},this.getDerivedSearchHelper()),{size:n.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${a}`:"",initialValue:D({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}});return n.isOnlyShow?t.createElement(So,{value:h,bordered:d}):t.createElement(t.Fragment,null,t.createElement(re.Group,null,t.createElement(re,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:d,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:l}=e.target;this._is_change&&!r&&(l?i.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(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;p||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),t.createElement(re,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:d,disabled:m,readOnly:!0}),t.createElement(re.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:l,bordered:d,allowClear:!0,readOnly:u,disabled:m,onBlur:e=>{var t,n;const{value:l}=e.target;this._is_change&&!r&&(l?i.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(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:p||(this._is_change=!0,this.setTextValue([i[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(Mi,f,t.createElement(Rp,g)))}}kp.contextType=Hi;class Lp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>hn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Zn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Jn("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>hn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=co(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi,!0);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:d,buttonAfter:u,validateTrigger:m,rules:p=[],onChange:h=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(p)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(kp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t,n,r)=>{h(t,r),e.setViewValue(a,n)}}))),u&&t.createElement(ce,null,e.renderFormItemButton(a,u)),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},d)))))}}Lp.contextType=Hi;const Ap=e=>{const{$$form:n}=t.useContext(Hi),{value:r,items:l,onChange:i,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u}=e.option,{itemList:m=[]}=o,p=Cn(m)?l:m,h=e=>p.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return n.isOnlyShow?t.createElement(So,{value:h(r),bordered:c}):t.createElement(ue.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u,onChange:e=>{(e=>{null==i||i(e),a(e,h(e))})(e)}},p.map((e=>t.createElement(ue,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Pp extends d{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,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}getItemList(){var e;return hn(this,void 0,void 0,(function*(){const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(c)},required:e.getFormItemRequired(p)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Ap,{option:this.props.option,items:n,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&t.createElement(ce,{flex:In(u.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Pp.contextType=Hi;const _p=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},style:o={},allowClear:s=!0,readOnly:c,disabled:d=n.isFormDisabled}=e.option,{allowHalf:u,count:m=5,tooltips:p}=a,h=e=>p?p[Math.ceil(e)-1]:e.toString();return t.createElement(Ee,{value:r,count:m,style:o,allowHalf:u,allowClear:s,tooltips:p,disabled:d||n.isOnlyShow,onChange:e=>{(e=>{null==l||l(e),i(e,h(e))})(e)}})};class Fp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(_p,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Fp.contextType=Hi;const Dp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,items:l,onChange:i,onValuesChange:a}=e,{options:o={},style:s={},bordered:c=!1,readOnly:d,disabled:u=n.isFormDisabled}=e.option,{itemList:m=[]}=o,p=Cn(m)?l:m,h=e=>{var t,n;return null!==(n=null===(t=p.find((t=>t.value===e)))||void 0===t?void 0:t.text)&&void 0!==n?n:""};return n.isOnlyShow?t.createElement(So,{value:h(r),bordered:c}):t.createElement(fe.Group,{value:r,style:Object.assign({width:"100%"},s),disabled:u||n.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{null==i||i(e),a(e,h(e))})(t)}},p.map((e=>t.createElement(fe,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Mp extends d{constructor(){super(...arguments),this.state={itemList:[]},this.getItemList=()=>hn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n)try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=n.map((e=>({value:e[i],text:e[a]})));this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,validateTrigger:m,rules:p=[],onChange:h=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(c)},required:e.getFormItemRequired(p)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:p,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Dp,{option:this.props.option,items:n,onValuesChange:(t,n)=>{h(t),e.setViewValue(a,n)}}))),u&&t.createElement(ce,{flex:In(u.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Mp.contextType=Hi;const Hp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{label:a,options:o={},style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{labelToSwitch:u,falseValue:m=za,trueValue:p=Va}=o,{t:h}=Gn();return t.createElement(t.Fragment,null,t.createElement(be,{checked:r===p,style:s,disabled:d||n.isOnlyShow,checkedChildren:t.createElement($e,null),unCheckedChildren:t.createElement(lt,null),onChange:e=>{(e=>{null==l||l(e),i(e,h(e===p?"am.form.trueText":"am.form.falseText"))})(e?p:m)}}),u?t.createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},a):null)};class $p extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option,{labelToSwitch:h}=o;return t.createElement(oe.Item,{label:h?" ":e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Hp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}$p.contextType=Hi;const qp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Gn(),{options:o={},style:s={},placeholder:c=a("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:u,translate:m,readOnly:p,disabled:h,onFocus:f,onBlur:g,onEnter:v}=e.option,{showCount:y,maxLength:b,autoSize:x}=o,E=Object.assign({},{minRows:1,maxRows:3},x),w=t.createElement(re.TextArea,{value:r,placeholder:c,style:s,maxLength:b,showCount:y,autoSize:E,bordered:d,allowClear:u,readOnly:p||n.isOnlyShow,disabled:h,onFocus:e=>{null==f||f(e.target.value,e)},onBlur:t=>{const{value:n}=t.target;(t=>{const{onBlur:n}=e;null==n||n(t)})(n),null==g||g(n,t)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;null==v||v(t,e)}},onChange:e=>{const{value:t}=e.target;(e=>{null==l||l(e),i(e)})(t)}});return m?t.createElement(No,{text:r},w):w};class Kp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(qp,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Kp.contextType=Hi;const jp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Gn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.datePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:v,disabledDate:y,minDateTime:b,maxDateTime:x,shortCuts:E=!0}=s,w=t.createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),null==l||l(e),i(e,S(e))},S=e=>to(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=eo(p().subtract(e,"day"),Ya[g]);"date"===g&&(t=t.slice(0,10)),C(t),w.current.blur(),w.current.focus()};return n.isOnlyShow?t.createElement(So,{value:S(r),bordered:u}):t.createElement(Kn,{ref:w,style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ga[g],format:v,bordered:u,showToday:!1,showTime:"datetime"===g&&{defaultValue:p("00:00:00","HH:mm:ss")},allowClear:m,disabled:f,inputReadOnly:h,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(we,{color:"processing",onClick:()=>N(0)},a("qm.form.datePickers")[0]),t.createElement(we,{color:"processing",onClick:()=>N(1)},a("qm.form.datePickers")[1]),t.createElement(we,{color:"processing",onClick:()=>N(7)},a("qm.form.datePickers")[2]),t.createElement(we,{color:"processing",onClick:()=>N(30)},a("qm.form.datePickers")[3])):void 0,value:Ja(r,Ya[g]),onChange:(e,t)=>{C(eo(e,Ya[g]))}})};class Vp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(jp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Vp.contextType=Hi;const zp=e=>[p().subtract(e,"day"),p()],Wp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Gn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.daterangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:h,disabled:f=n.isFormDisabled}=e.option,{dateType:g="date",format:v,disableds:y=[!1,!1],allowEmpty:b,disabledDate:x,minDateTime:E,maxDateTime:w,shortCuts:C=!0}=s,S={[a("qm.form.dateRangePickers")[0]]:zp(7),[a("qm.form.dateRangePickers")[1]]:zp(30),[a("qm.form.dateRangePickers")[2]]:zp(90),[a("qm.form.dateRangePickers")[3]]:zp(180)},N=e=>to(e)?"":e.map((e=>["date","exactdate"].includes(g)?null==e?void 0:e.slice(0,10):e)).join(" - ");return n.isOnlyShow?t.createElement(So,{value:N(r),bordered:u}):t.createElement(Kn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,picker:Ga[g],format:v,bordered:u,showTime:"datetime"===g&&{defaultValue:[p("00:00:00","HH:mm:ss"),p("23:59:59","HH:mm:ss")]},allowClear:m,allowEmpty:b,disabled:f?[!0,!0]:y,inputReadOnly:h,disabledDate:null!=x?x:e=>((e,[t,n])=>t&&n?e.isBefore(t,"day")||e.isAfter(n,"day"):t?e.isBefore(t,"day"):!!n&&e.isAfter(n,"day"))(e,[E,w]),ranges:C&&g.includes("date")?S:void 0,value:Cn(r)?null:[Ja(null==r?void 0:r[0],Ya[g]),Ja(null==r?void 0:r[1],Ya[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==l||l(e),i(e,N(e))})([eo(null==e?void 0:e[0],Ya[g]),eo(null==e?void 0:e[1],Ya[g])])}})};class Bp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Wp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Bp.contextType=Hi;const Up=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Gn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:v=1,secondStep:y=1}=s;return n.isOnlyShow?t.createElement(So,{value:r,bordered:u}):t.createElement(Vn,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!0,hourStep:g,minuteStep:v,secondStep:y,allowClear:m,disabled:h,inputReadOnly:p,format:Xa[f],value:Ja(r,Xa[f]),onChange:(e,t)=>{(e=>{const t=eo(e,Xa[f]);null==l||l(t),i(t)})(e)}})};class Gp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Up,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Gp.contextType=Hi;const Yp=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{t:a}=Gn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:m=!0,readOnly:p,disabled:h=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=>to(e)?"":e.join(" - ");return n.isOnlyShow?t.createElement(So,{value:E(r),bordered:u}):t.createElement(Vn.RangePicker,{style:Object.assign({width:"100%"},c),popupClassName:`form-popper__${o}`,bordered:u,showNow:!1,hourStep:y,minuteStep:b,secondStep:x,allowClear:m,allowEmpty:v,disabled:h?[!0,!0]:g,inputReadOnly:p,format:Xa[f],value:Cn(r)?null:[Ja(null==r?void 0:r[0],Xa[f]),Ja(null==r?void 0:r[1],Xa[f])],onChange:(e,t)=>{(e=>{const t=[eo(null==e?void 0:e[0],Xa[f]),eo(null==e?void 0:e[1],Xa[f])];null==l||l(t),i(t,E(t))})(e)}})};class Xp extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Yp,{option:this.props.option,onValuesChange:(t,n)=>{p(t),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Xp.contextType=Hi;class Qp extends d{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=Wt(((e,t)=>Object.assign({},this.props.helperConfig,e,t))),this.paramsChangeHandler=(e,t)=>hn(this,void 0,void 0,(function*(){yield this.props.waiting(),C(e,t)||this.getItemList()})),this.echoSearchHelper=()=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const e=this.getItemValue();e!==this._prevValue&&(this.getItemText(),this._prevValue=e)})),this.initialHandle=()=>hn(this,void 0,void 0,(function*(){yield this.props.waiting();const{fieldName:e,options:t,searchHelper:n}=this.props.option,{fieldAliasMap:r,fieldsDefine:l,echoRequest:i}=this.searchHelper;if(r||Jn("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),l){const e=["valueKey","displayKey","extraKey"];for(const t in l)e.includes(t)&&(this[t]=l[t])}Object.keys(this.alias).includes(e)||Jn("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&Jn("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!n&&Jn("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),this.getItemValue=()=>this.context.$$form.GET_FIELDS_VALUE([this.valueKey])[this.valueKey],this.getItemText=()=>hn(this,void 0,void 0,(function*(){var e;const{fetchApi:t,params:n={},formatter:r=(e=>e),dataKey:l,callback:i,triggeredChange:a,fieldAliasMap:o,extraAliasMap:s}=this.searchHelper.echoRequest||{},c="function"==typeof o?o():o||{},d="function"==typeof s?s():s||{},u=this.getItemValue();if(t&&!Cn(u))try{const o=yield t(r(Object.assign(Object.assign({},n),{key:u})));if(200===o.code){const t=Array.isArray(o.data)?o.data:null!==(e=x(o.data,l))&&void 0!==e?e:[];if(t[0]){const e=t[0];if(c&&ro(e,this.alias,c),d&&lo(e,this.extras,d),this._record=e,this.setFieldsValue(e),a){const t=no(e,this.alias[this.props.option.fieldName]);this.triggerChange(t)}null==i||i([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 l=no(e,this.alias[r]);t.SET_FIELDS_VALUE({[r]:l}),r===this.valueKey&&(this._prevValue=l),r===n&&t.setViewValue(n,l)}for(const n in this.extras)t.SET_FIELDS_EXTRA({[n]:no(e,this.extras[n])})},this.fetchHandle=q(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){if(t===r)continue;const l=no(e,this.alias[t]);n.SET_FIELDS_VALUE({[t]:l}),t===this.valueKey&&(this._prevValue=e?l:null)}for(const t in this.extras)n.SET_FIELDS_EXTRA({[t]:no(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const l=no(e,this.alias[r]);this.triggerChange(l),this.setState({inputText:void 0}),t&&t()},this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidUpdate(e){var t,n,r,l,i,a;const o=(null===(n=null===(t=e.option.searchHelper)||void 0===t?void 0:t.request)||void 0===n?void 0:n.params)||(null===(r=e.option.request)||void 0===r?void 0:r.params),s=(null===(i=null===(l=this.props.option.searchHelper)||void 0===l?void 0:l.request)||void 0===i?void 0:i.params)||(null===(a=this.props.option.request)||void 0===a?void 0:a.params);this.paramsChangeHandler(s,o),this.echoSearchHelper()}getItemList(e){var t;return hn(this,void 0,void 0,(function*(){const{fieldName:n}=this.props.option,{fetchApi:r,params:l={},formatter:i=(e=>e),dataKey:a}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const o=yield r(i(Object.assign(Object.assign({},l),{[n]:e})));if(200===o.code){const e=Array.isArray(o.data)?o.data:null!==(t=x(o.data,a))&&void 0!==t?t:[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}))}render(){const{$$form:e}=this.context,{visible:n,loading:r,itemList:l,inputText:i}=this.state,{value:a}=this.props,{fieldName:o,options:s={},style:c={},placeholder:d=un("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:m=!0,translate:p,readOnly:h,disabled:f}=this.props.option,{listHeight:g=Wa}=s,{hideHeader:v,onlySelect:y=!0}=this.searchHelper||s,b=this.searchHelper.columns||[],E=rr("form-immediate"),w=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=t.createElement(ee,{spinning:r},l.length?t.createElement("table",{cellSpacing:0,cellPadding:0,className:Pe("table")},!v&&t.createElement("thead",null,t.createElement("tr",null,b.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,l.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)))}},b.filter((e=>!e.hidden)).map((n=>t.createElement("td",{key:n.dataIndex},x(e,n.dataIndex))))))))):t.createElement(Jl,null)),S=t.createElement(on.Consumer,null,(r=>{const s={[E]:!0,[`${E}--lg`]:"large"===(null==r?void 0:r.size),[`${E}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(So,{value:a,bordered:u}):t.createElement(ad,{action:f?[]:["click"],popupVisible:!f&&n,popup:C,popupClassName:Pe(s,`form-popper__${o}`),popupStyle:{minWidth:w,maxHeight:g},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ua,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(re,{ref:this.searchRef,placeholder:d,allowClear:m,bordered:u,readOnly:h,disabled:f,style:Object.assign({width:"100%"},c),value:null!=i?i:a,title:a,onFocus:()=>{!l.length&&this.fetchHandle(a)},onBlur:e=>{y&&!this._clicking&&i!==a&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(l[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%l.length:(--t+l.length)%l.length;this.setState({activeIndex:n})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),y?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}})))}));return p?t.createElement(No,{text:a},S):S}}Qp.contextType=Hi;class Zp extends d{constructor(e,{$$form:t}){super(e),this.state={searchHelper:{}},this.waiting=()=>hn(this,void 0,void 0,(function*(){try{yield this.promiseRef}catch(e){Zn("Form","搜索帮助获取定义信息的接口出错")}})),this.getHelperConfig=e=>{var t,n;const{global:r}=e,{name:l,fieldsDefine:i}=this.props.option.searchHelper||{};if(!l)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 Jn("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise(((e,t)=>hn(this,void 0,void 0,(function*(){try{const n=yield r.searchHelper.getServerConfig({searchHelperId:l});if(200===n.code){const t=co(Object.assign({},n.data,i),a,r.searchHelper.createFetchApi);this.setState({searchHelper:t},(()=>e()))}else t()}catch(e){t()}}))))},this.getHelperConfig(t.context)}render(){const{$$form:e}=this.context,{searchHelper:n}=this.state,{type:r,label:l,tooltip:i,fieldName:a,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:d,extra:u,buttonAfter:m,validateTrigger:p,rules:h=[],onChange:f=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(l),className:Pe(d),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":In(c)},required:e.getFormItemRequired(h)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:a,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(l)}},t.createElement(Qp,{option:this.props.option,helperConfig:n,waiting:this.waiting,onValuesChange:(t="",n)=>{f(t,n),e.setViewValue(a,t)}}))),m&&t.createElement(ce,null,e.renderFormItemButton(a,m)),u&&t.createElement(ce,{flex:In(u.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:a},u)))))}}Zp.contextType=Hi;class Jp extends d{render(){var e;const{$$form:n}=this.context,{type:r,label:l,fieldName:i,className:a,style:o={},collapse:s={}}=this.props.option,{expand:c}=n.state,{showLimit:d,remarkItems:u=[],onCollapse:m=yn}=s,p=[];if(u.length){const t=null!==(e=n.getBlockDerivedItems().find((e=>e[0].fieldName===i)))&&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 l=r.showLabel?`${e.label}:`:"",i=null!==(t=n.getViewValue(e.fieldName))&&void 0!==t?t:"";""!==i&&p.push(Object.assign(Object.assign({},e),{text:`${l}${i}`}))}))}return t.createElement(oe.Item,{labelCol:{span:0},wrapperCol:{span:24}},t.createElement(lr,{id:i,label:l,className:a,extra:p.map((e=>e.text)).join(" | "),style:Object.assign({},o),collapse:c[i],onCollapseChange:e=>{n.setState((t=>({expand:Object.assign({},t.expand,{[i]:e})}))),m(e)}}))}}Jp.contextType=Hi;const eh=(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:eh(e.children,t,n,r)}):e)),th=e=>{var n;const{$$form:r}=t.useContext(Hi),{value:l,items:i,multiple:a,loading:o,onChange:s,onValuesChange:c}=e,{t:d}=Gn(),{fieldName:u,options:m={},style:p={},placeholder:h=d("qm.form.selectPlaceholder"),bordered:g=!0,allowClear:v=!0,asyncLoad:y,translate:b,readOnly:E,disabled:w}=e.option,{itemList:S,filterable:N=!0,listHeight:T=Wa,checkStrictly:I,checkStrategy:R="SHOW_CHILD",collapseTags:O,echoRequest:k,defaultExpandAll:L=!y,defaultExpandedKeys:A,dropdownStyle:P,openPyt:_=!0}=m,[F,D]=t.useState(Cn(S)?i:S),[M,H]=t.useState([]),[$,q]=t.useState(!1),[K,j]=t.useState(!1),V=t.useRef(null),z=t.useRef(null),W=t.useRef(F),B=t.useRef(K),U=t.useRef(null),G=e=>{j(e),B.current=e};Su({ref:z,handler:()=>G(!1)}),t.useEffect((()=>{l!==U.current&&(Q(),U.current=l),(()=>{var e;z.current=(null===(e=V.current)||void 0===e?void 0:e.querySelector(".ant-select-selection-overflow-item-rest"))||null})()}),[l]),Dl((()=>{const e=Cn(S)?i:S;y?C(e,W.current)||(D((t=>[...e,...t.filter((e=>!!e.style))])),W.current=e):D(e)}),[S,i]),Dl((()=>{D((e=>[...e,...M.filter((t=>!e.some((e=>e.value===t.value))))]))}),[M]);const Y=e=>{var t;return(null===(t=ao(F,e))||void 0===t?void 0:t.text)||(null==e?void 0:e.toString())||""},X=e=>(I&&Array.isArray(l)&&l.every((e=>f(e)))&&(e=e.map((e=>e.value))),a?(null==e?void 0:e.map((e=>Y(e))).join(","))||"":Y(e)),Q=()=>hn(void 0,void 0,void 0,(function*(){var e;if(!k)return;if(!y)return Jn("Form","TREE_SELECT 的 echoRequest 选项必须组合 `asyncLoad` 一起使用");const{fetchApi:t,params:n,dataKey:r,callback:i,formatter:a=(e=>e)}=k||{},{textKey:o="text",valueKey:s="value"}=y;if(t&&!Cn(l))try{const c=yield t(a(Object.assign(Object.assign({},n),{[s]:l})));if(200===c.code){const t=Array.isArray(c.data)?c.data:null!==(e=x(c.data,r))&&void 0!==e?e:[];if(t.length){const e=io(t,s,o);H(e.map((e=>Object.assign(Object.assign({},e),{style:{display:"none"}})))),null==i||i(t)}}}catch(e){}})),Z=r.isOnlyShow?t.createElement(So,{value:X(l),bordered:g}):t.createElement(ad,{popupVisible:!w&&K,popup:(()=>{if(!a)return null;const e=(null==l?void 0:l.map((e=>Y(e))))||[];return t.createElement("ul",{className:"ant-dropdown-menu"},e.length?e.map(((e,n)=>t.createElement("li",{key:`${e}-${n}`,className:"ant-dropdown-menu-item"},e))):t.createElement("li",{className:"ant-dropdown-menu-item"},d("qm.table.config.emptyText")))})(),popupStyle:{minWidth:null===(n=V.current)||void 0===n?void 0:n.offsetWidth},onPopupVisibleChange:e=>G(e),builtinPlacements:Ua,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",{ref:V},t.createElement(Ce,jn({open:$,fieldNames:{label:"text",value:"value",children:"children"},value:l,multiple:a,treeCheckable:a,treeCheckStrictly:I,showCheckedStrategy:Ce[R],popupClassName:`form-popper__${u}`,dropdownStyle:P,placeholder:h,listHeight:T,style:p,loading:o,bordered:g,allowClear:v,disabled:w,treeDefaultExpandAll:L,treeDefaultExpandedKeys:A,showSearch:N,maxTagCount:O?"responsive":void 0,loadData:y?({key:e,children:t})=>hn(void 0,void 0,void 0,(function*(){var n;if(!y||t)return;const{fetchApi:r,params:l,dataKey:i,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=y;if(r)try{const t=yield r(c(Object.assign(Object.assign({},l),{[o]:e})));if(200===t.code){const r=Array.isArray(t.data)?t.data:null!==(n=x(t.data,i))&&void 0!==n?n:[],l=eh(F,e,o,io(r,o,a));D(l),null==s||s(r)}}catch(e){}})):void 0,treeData:F},a?{title:X(l)}:null,{filterTreeNode:(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.text)||void 0===n?void 0:n.toString())||"",l=wo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(_?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onMouseDown:e=>{e.target.classList.contains("ant-select-selection-overflow-item-rest")&&(G(!0),q(!1))},onDropdownVisibleChange:e=>{if(!e)return q(e);En((()=>{B.current||q(e)}))},onChange:e=>{(e=>{null==s||s(e),c(e,X(e),F)})(e),U.current=e}}))));return b?t.createElement(No,{text:X(l)},Z):Z};class nh extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>hn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=io(n,i,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:n,loading:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(i),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":In(d)},required:e.getFormItemRequired(h)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(th,{option:this.props.option,items:n,loading:r,multiple:this.props.multiple,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(ce,{flex:In(m.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}nh.contextType=Hi;const rh=e=>{const{$$form:n}=t.useContext(Hi),{value:r,multiple:l,items:i}=e,{t:a}=Gn(),{fieldName:o,options:s={},style:c={},placeholder:d=a("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:m=!0,asyncLoad:p,translate:h,readOnly:f,disabled:g}=e.option,{itemList:v,changeOnSelect:y,checkStrictly:b,checkStrategy:E="SHOW_PARENT",filterable:w=!0,dropdownStyle:S,openPyt:N=!0}=s,[T,I]=t.useState(Cn(v)?i:v),R=t.useRef(T);Dl((()=>{const e=Cn(v)?i:v;p?C(e,R.current)||(I(e),R.current=e):I(e)}),[v,i]);const O=e=>oo(T,null!=e?e:"").map((e=>e.text)).join("/"),k=e=>l?(null==e?void 0:e.map((e=>O(e))).join(","))||"":O(e),L=n.isOnlyShow?t.createElement(So,{value:k(r),bordered:u}):t.createElement(Se,jn({value:(e=>Cn(e)?[]:l?e.map((e=>e.split(","))):e.split(","))(r),fieldNames:{label:"text",value:"value",children:"children"},options:T,multiple:l,maxTagCount:"responsive",changeOnSelect:y||b,showCheckedStrategy:Se[E],popupClassName:`form-popper__${o}`,dropdownMenuColumnStyle:S,placeholder:d,style:c,bordered:u,allowClear:m,disabled:g,showSearch:w&&!p&&{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())||"",l=wo.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${l}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))},loadData:p?e=>hn(void 0,void 0,void 0,(function*(){var t;const n=e[e.length-1];if(!p||n.children)return;const{fetchApi:r,params:l,dataKey:i,textKey:a="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=p;if(r)try{const e=yield r(c(Object.assign(Object.assign({},l),{[o]:n.value})));if(200===e.code){const r=Array.isArray(e.data)?e.data:null!==(t=x(e.data,i))&&void 0!==t?t:[],l=eh(T,n.value,o,io(r,o,a));I(l),null==s||s(r)}}catch(e){}})):void 0},l?{title:k(r)}:null,{onChange:t=>{(t=>{const{onChange:n,onValuesChange:r}=e;null==n||n(t),r(t,k(t),T)})(((e=[])=>l?e.map((e=>e.join(","))):e.join(","))(t))}}));return h?t.createElement(No,{text:k(r)},L):L};class lh extends d{constructor(){super(...arguments),this.state={itemList:[],loading:!1},this.getItemList=()=>hn(this,void 0,void 0,(function*(){var e;const{request:t={}}=this.props.option,{fetchApi:n,params:r={},dataKey:l,valueKey:i="value",textKey:a="text",callback:o}=t;if(n){this.setState({loading:!0});try{const t=yield n(r);if(200===t.code){const n=Array.isArray(t.data)?t.data:null!==(e=x(t.data,l))&&void 0!==e?e:[],r=io(n,i,a);this.setState({itemList:r},(()=>null==o?void 0:o(n)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){var t,n;const r=null===(t=e.option.request)||void 0===t?void 0:t.params,l=null===(n=this.props.option.request)||void 0===n?void 0:n.params;C(r,l)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:n}=this.props,{itemList:r}=this.state,{type:l,label:i,tooltip:a,fieldName:o,invisible:s,options:c={},labelWidth:d=e.props.labelWidth,className:u,extra:m,validateTrigger:p,rules:h=[],onChange:f=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(i),className:Pe(u),tooltip:a,hidden:s,labelCol:{flex:e.verticalLayout?"initial":In(d)},required:e.getFormItemRequired(h)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:o,noStyle:!0,rules:h,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(i)}},t.createElement(rh,{option:this.props.option,multiple:n,items:r,onValuesChange:(t,n,r)=>{f(t,n,r),e.setViewValue(o,n)}}))),m&&t.createElement(ce,{flex:In(m.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:o},m)))))}}lh.contextType=Hi;const ih=["110000","120000","310000","500000"],ah=["810000","820000"],oh=[{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"}],sh=[{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"}],ch=e=>wo.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),dh=(e,t,n=1)=>{if(n>2||!e[t])return;return("86"===t?Object.keys(e[t]).filter((e=>![...ih,...ah].includes(e))):Object.keys(e[t])).map((r=>({l:ch(e[t][r].slice(0,1)).toUpperCase(),n:e[t][r],c:r,p:t,children:dh(e,r,n+1)})))},uh=(e,t)=>t.map((t=>({l:ch(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class mh extends d{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}),Vt(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:uh(rn,ih)},{l:"Z2",n:"港澳",c:"",p:"",children:uh(rn,ah)}]}createProvince(){var e;return(null!==(e=dh(rn,"86"))&&void 0!==e?e:[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return sh.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...ih,...ah].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t.createElement(fe.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(fe.Button,{value:"0"},un("qm.form.citySelectType.0")),t.createElement(fe.Button,{value:"1"},un("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:n}=this.state;return("0"===n?oh:sh).map((n=>t.createElement("li",{key:n.value,className:Pe({tag:!0,actived:n.value===e}),onClick:()=>this.scrollHandle(n.value.toString())},n.text)))}renderSelect(){const{value:e}=this.props;return t.createElement(de,{size:"small",placeholder:un("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(de.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 l;return t.createElement("div",{key:r},t.createElement("dt",{ref:e=>this[`${n.l}Ref`]=e},n.n,":"),t.createElement("dd",null,null===(l=n.children)||void 0===l?void 0:l.map((n=>t.createElement("li",{key:n.c,className:Pe({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:l,options:i={},style:a={},placeholder:o=un("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=rr("form-city-select"),p=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,h=this.createTextValue(r),f=t.createElement("div",{className:"container",style:Object.assign({},a)},t.createElement("div",{className:"city-drop"},t.createElement("div",{className:"city-drop-toper"},t.createElement("div",{className:"city-drop-toper__type"},this.renderType()),t.createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t.createElement("div",{className:"city-drop-letter"},this.renderLetter()),t.createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t.createElement("dl",null,this.renderCity(r)))));return t.createElement(on.Consumer,null,(r=>{const i={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(So,{value:h,bordered:s}):t.createElement(ad,{action:u?[]:["click"],popupVisible:!u&&n,popup:f,popupClassName:Pe(i,`form-popper__${l}`),popupStyle:{minWidth:p},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ua,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(re,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,readOnly:d,disabled:u,style:Object.assign({width:"100%"},a),value:h,title:h,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}})))}))}}mh.contextType=Hi;class ph extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(mh,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}ph.contextType=Hi;const hh=(e,t)=>{if(e[t])return Object.keys(e[t]).map((n=>({text:e[t][n],value:n,children:hh(e,n)})))};class fh extends d{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=hh(rn,"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 l=ao(e,t[r]);if(l&&Cn(l.children)){this.isFetch&&this.getStreetList(t[r]);break}Array.isArray(null==l?void 0:l.children)&&(n[r+1]=null==l?void 0:l.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:n})}getStreetList(e){var t;return hn(this,void 0,void 0,(function*(){const{request:n={}}=this.props.option,{fetchApi:r,formatter:l=(e=>e),dataKey:i,valueKey:a="value",textKey:o="text"}=n;if(r)try{const n=yield r(l({code:e}));if(200===n.code){const e=Array.isArray(n.data)?n.data:null!==(t=x(n.data,i))&&void 0!==t?t:[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[o],value:e[a]})))]})))}}catch(e){}}))}renderTabs(){const{values:e}=this.state,n=this.state.tabs.map(((n,r)=>{var l;const i=(null===(l=n.find((t=>t.value===e[r])))||void 0===l?void 0:l.text)||`${un("qm.form.selectPlaceholder").replace("...","")}(${un("qm.form.regionSelectLabel")[r]})`;return t.createElement(Pi.TabPane,{key:r.toString(),tab:i},t.createElement("div",{className:"region-box"},n.map((n=>t.createElement("span",{key:n.value,className:Pe({"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(Pi,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},n):t.createElement(Jl,null)}render(){const{$$form:e}=this.context,{visible:n}=this.state,{value:r}=this.props,{fieldName:l,options:i={},style:a={},placeholder:o=un("qm.form.selectPlaceholder"),bordered:s=!0,allowClear:c=!0,readOnly:d,disabled:u}=this.props.option,m=rr("form-region-select"),p=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,h=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(on.Consumer,null,(r=>{const i={[m]:!0,[`${m}--lg`]:"large"===(null==r?void 0:r.size),[`${m}--sm`]:"small"===(null==r?void 0:r.size)};return e.isOnlyShow?t.createElement(So,{value:f,bordered:s}):t.createElement(ad,{action:u?[]:["click"],popupVisible:!u&&n,popup:h,popupClassName:Pe(i,`form-popper__${l}`),popupStyle:{minWidth:p},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:Ua,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t.createElement("div",null,t.createElement(re,{ref:this.searchRef,placeholder:o,allowClear:c,bordered:s,style:Object.assign({width:"100%"},a),readOnly:d,disabled:u,value:f,title:f,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&En((()=>this.initial()))}})))}))}}fh.contextType=Hi;class gh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(fh,{option:this.props.option,onValuesChange:(t,n)=>{p(t,n),e.setViewValue(i,n)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}gh.contextType=Hi;const vh=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:v,onPreview:y,onDownload:b,onRemove:E,onSortChange:w,onEditChange:C}=a,{action:S,headers:N,params:T,withCredentials:I=!1,dataKey:R="",downloadWithHeaders:O,fieldAliasMap:k,beforeUpload:L,button:A}=o,P="function"==typeof k?k():k||{},{t:_}=Gn();return t.createElement(Ti,{name:"file",action:S,multiple:d,headers:N,data:T,withCredentials:I,downloadWithHeaders:O,beforeUpload:L,maxCount:u,fileTypes:m,fileSize:p,draggable:h,editable:f,batchDownload:g,fileDirection:v,disabled:null!=s?s:n.props.disabled,readOnly:n.isOnlyShow||c,button:A,showUploadList:{showDownloadIcon:!0,downloadIcon:t.createElement(Ke,null)},fileList:r,onChange:({fileList:e})=>{(e=>{const t=e.map((e=>{var t;const n=e.response||{},r={};for(const l in P)r[l]=e[l]||(null===(t=n.data)||void 0===t?void 0:t[P[l]])||"";return e.response&&200!==n.code&&ne.error(n.message||_("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(R?x(n.data,R):n.data)||"",status:e.status})}));null==l||l(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(e)},onPreview:y,onDownload:b,onRemove:E,onSortChange:w,onEditChange:C})};class yh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(vh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,"")}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}yh.contextType=Hi;const bh=t.forwardRef(((e,n)=>{const r=Rn({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:l,style:i,src:a,alt:o,imgStyle:s}=r,c=mn(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 ln(d.current,e),()=>{y(),u.current=null}}),[]);const m=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.reset()},p=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.clear()},h=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.crop()},f=(e,t=!1)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.replace(e,t)},g=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.enable()},v=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.disable()},y=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.destroy()},b=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.move(e,t)},x=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.moveTo(e,t)},E=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoom(e)},w=(e,t)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.zoomTo(e,t)},C=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotate(e)},S=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.rotateTo(e)},N=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleX(e)},T=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.scaleY(e)},I=(e,t=e)=>{var n;return null===(n=u.current)||void 0===n?void 0:n.scale(e,t)},R=(e=!1)=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getData(e)},O=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setData(e)},k=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getContainerData()},L=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getImageData()},A=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCanvasData()},P=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCanvasData(e)},_=()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.getCropBoxData()},F=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setCropBoxData(e)},D=(e={})=>{var t;return null===(t=u.current)||void 0===t?void 0:t.getCroppedCanvas(e)},M=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setAspectRatio(e)},H=e=>{var t;return null===(t=u.current)||void 0===t?void 0:t.setDragMode(e)};t.useImperativeHandle(n,(()=>({reset:m,clear:p,initCrop:h,replace:f,enable:g,disable:v,destroy:y,move:b,moveTo:x,relativeZoom:E,zoomTo:w,rotate:C,rotateTo:S,scaleX:N,scaleY:T,scale:I,getData:R,setData:O,getContainerData:k,getImageData:L,getCanvasData:A,setCanvasData:P,getCropBoxData:_,setCropBoxData:F,getCroppedCanvas:D,setAspectRatio:M,setDragMode:H})));const $={[rr("cropper")]:!0};return t.createElement("div",{className:Pe($,l),style:i},t.createElement("img",{ref:d,src:a,alt:o,style:Object.assign({maxWidth:"100%"},s)}))}));bh.displayName="Cropper";const xh=e=>{const{fileTypes:n=[],fileSize:r,fixedSize:l,quality:i,beforeCrop:a,className:o}=e,{t:s}=Gn(),c=t.useRef(null),d=t.useRef(),u=t.useRef(),m=t.useRef(),p=t.useRef(),[h,f]=t.useState(""),g=e=>{c.current.relativeZoom(e)},v=e=>{c.current.rotate(e)},y=()=>{f("")},b=rr("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:l}=r,i=mn(r,["beforeUpload"]);return d.current=l,t.createElement(n.type,Object.assign(Object.assign({},i),{beforeUpload:(e,t)=>new Promise(((n,r)=>hn(void 0,void 0,void 0,(function*(){const r=()=>n(te.LIST_IGNORE);if(a&&!(yield a(e,t)))return void r();u.current=e,m.current=n,p.current=r;const l=new FileReader;l.onload=()=>{f(l.result),l.onload=null},l.readAsDataURL(e)}))))}))})(),h&&t.createElement(ae,{open:!0,wrapClassName:Pe(b,o),title:s("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:()=>{hn(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((l=>hn(void 0,void 0,void 0,(function*(){let i=new File([l],t,{type:e});if(Object.assign(i,{uid:r}),n.length&&!n.includes(i.name.slice(i.name.lastIndexOf(".")+1).toLowerCase()))return ne.warning(s("qm.upload.tooltip",{type:n.join(",")})),p.current("file type is error");if("function"!=typeof d.current)return m.current(i);const a=d.current(i,[i]);if("boolean"==typeof a||a){if(!0===a)return m.current(i);if(!1===a)return p.current("not upload");if(a&&"function"==typeof a.then)try{const e=yield a,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(i=e),m.current(i)}catch(e){p.current(e)}}else Jn("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}))),e,i),yield xn(100),y()}))},onCancel:y,maskClosable:!1,destroyOnClose:!0},(()=>{const e={width:"380px",height:l?`calc(380px * ${l[1]/l[0]})`:"auto"};return t.createElement("div",{className:"cropper-preview"},t.createElement("div",{className:"cropper-area"},t.createElement("div",{className:"img-cropper"},t.createElement(bh,{ref:c,aspectRatio:l?l[0]/l[1]:l,src:h,dragMode:"move",preview:".preview"})),t.createElement("div",{className:"actions"},t.createElement(Z,{size:"small"},t.createElement(Y,{type:"primary",size:"middle",icon:t.createElement(It,null),onClick:()=>g(.2)},s("qm.uploadCropper.zoomIn")),t.createElement(Y,{type:"primary",size:"middle",icon:t.createElement(Rt,null),onClick:()=>g(-.2)},s("qm.uploadCropper.zoomOut")),t.createElement(Y,{type:"primary",size:"middle",icon:t.createElement(Ot,null),onClick:()=>v(90)},s("qm.uploadCropper.rotatePlus")),t.createElement(Y,{type:"primary",size:"middle",icon:t.createElement(kt,null),onClick:()=>v(-90)},s("qm.uploadCropper.rotateSubtract"))))),t.createElement("div",{className:"preview-area"},t.createElement("div",{className:"preview",style:e})))})()))},Eh=e=>{const n=Rn({name:"file",multiple:!0,accept:"image/*",listType:"picture-card"},e),{fileList:r=[],openCropper:l=!0,fixedSize:i,quality:a=1,fileTypes:o,fileSize:s,maxCount:c,draggable:d,disabled:u,readOnly:m,className:p,popupClassName:h,beforeCrop:f,onSortChange:g,onChange:v}=n,{t:y}=Gn(),{$size:b}=Xn(n),x=t.useRef(null),E=t.useRef(null),w=t.useRef(!1),[C,S]=t.useState(!1),[N,T]=t.useState(0),I=t.useMemo((()=>u||m||!1),[u,m]),R=t.useMemo((()=>!c||r.length<c),[r,c]);t.useEffect((()=>(k(),document.addEventListener("paste",A),()=>{var e;null===(e=E.current)||void 0===e||e.destroy(),document.removeEventListener("paste",A)})),[]),Dl((()=>{R||(w.current=!1)}),[r]);const O=Yn((e=>{const{oldIndex:t,newIndex:n}=e;if(t!==n){const e=[...r],[l]=e.splice(t,1);e.splice(n,0,l),null==g||g(e),null==v||v({file:r[t],fileList:e})}})),k=()=>{d&&(E.current=Kt.create(Wl(x.current,rr("upload-img")).querySelector(".ant-upload-list"),{animation:150,handle:".handle",filter:".ignore",draggable:".ant-upload-list-picture-card-container",onEnd:O}))},L=(e,t)=>new Promise(((r,l)=>hn(void 0,void 0,void 0,(function*(){const{fileTypes:i=[],fileSize:a,beforeUpload:o}=n,s=!i.length||i.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),c=!a||e.size/1024/1024<a,d=s&&c;if(s||ne.warning(y("qm.upload.tooltip",{type:i.join(",")})),c||ne.warning(y("qm.upload.sizeLimit",{size:a})),!d)return te.LIST_IGNORE;if(o){const n=o(e,t);if(!0===n)return r(e);if(!1===n)return l("not upload");if(n&&"function"==typeof n.then)try{const e=yield n;r(e)}catch(e){l(e)}}else r(e)})))),A=Yn((e=>hn(void 0,void 0,void 0,(function*(){const{action:t,data:l,headers:i}=n;if(w.current&&R&&t)for(const n of e.clipboardData.items)if("file"===n.kind&&n.type.startsWith("image/")){const e=n.getAsFile(),a=Date.now(),o=new File([e],`screenshot-${a}.png`,{type:e.type});Object.assign(o,{uid:`rc-upload-${a}`});try{yield L(o,[...r,o]);const e=new FormData;if(e.append("file",o),l)for(const t in l)e.append(t,l[t]);const n="string"==typeof t?t:yield t(o),a=yield fetch(n,{method:"POST",body:e,headers:i});if(!a.ok)throw new Error(y("qm.upload.uploadError"));const s=yield a.json();null==v||v({file:o,fileList:[...r,{uid:o.uid,lastModified:o.lastModified,lastModifiedDate:o.lastModifiedDate,name:o.name,type:o.type,size:o.size,response:s,status:"done",percent:100,originFileObj:o}]})}catch(e){}}})))),P=rr("upload-img"),_={[P]:!0,[`${P}--lg`]:"large"===b,[`${P}--sm`]:"small"===b},F=t.createElement(te,jn({className:Pe(_,p)},Nn(n,["fileTypes","fileSize","fixedSize","quality","openCropper","draggable","popupClassName"]),{beforeUpload:L,disabled:I,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,l)=>t.createElement("div",{className:Pe("upload-item",{handle:d})},e,!I&&t.createElement(lt,{title:y("qm.upload.remove"),className:"icon",onClick:()=>l.remove()}))}),t.createElement("span",{className:"inner",ref:x},R&&!(m&&r.length)&&t.createElement(t.Fragment,null,t.createElement("p",{className:"ant-upload-drag-icon"},t.createElement(Lt,null)),t.createElement("p",{className:"ant-upload-text"},y("qm.uploadCropper.dragableText")),t.createElement("button",{className:Pe("ant-upload-button",{disabled:I}),onClick:e=>{e.stopPropagation(),e.preventDefault()},onFocus:()=>{w.current=!0},onBlur:()=>{w.current=!1}},y("qm.uploadCropper.pasteText")))));return t.createElement(t.Fragment,null,l?t.createElement(xh,{className:h,fixedSize:i,quality:a,fileTypes:o,fileSize:s,beforeCrop:f},F):F,t.createElement("div",{style:{display:"none"}},t.createElement(Ne.PreviewGroup,{key:r.map((e=>e.uid||"")).join(","),preview:{visible:C,current:N,rootClassName:h,onVisibleChange:e=>S(e)}},r.map(((e,n)=>t.createElement(Ne,{key:e.uid||n,src:e.url,alt:""}))))))};Eh.displayName="QmUploadImg";const wh=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o={},disabled:s,readOnly:c}=e.option,{multiple:d=!0,maxCount:u=1,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:v,onRemove:y,onSortChange:b}=a,{action:E,headers:w,params:C,withCredentials:S=!1,dataKey:N="",popupClassName:T,fieldAliasMap:I,beforeUpload:R}=o,O="function"==typeof I?I():I||{},{t:k}=Gn();return t.createElement(Eh,{name:"file",action:E,multiple:d,headers:w,data:C,withCredentials:S,popupClassName:T,beforeUpload:R,maxCount:u,fixedSize:m,quality:p,openCropper:h,fileTypes:f,fileSize:g,draggable:v,disabled:null!=s?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 l in O)r[l]=e[l]||(null===(t=n.data)||void 0===t?void 0:t[O[l]])||"";return e.response&&200!==n.code&&ne.error(n.message||k("qm.uploadCropper.uploadError")),Object.assign(Object.assign({uid:e.uid,name:e.name},r),{url:e.url||(N?x(n.data,N):n.data)||"",status:e.status})}));null==l||l(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(e)},onRemove:y,onSortChange:b})};class Ch extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(wh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,"")}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}Ch.contextType=Hi;const Sh={onActivate:Bt.func,onAddUndo:Bt.func,onBeforeAddUndo:Bt.func,onBeforeExecCommand:Bt.func,onBeforeGetContent:Bt.func,onBeforeRenderUI:Bt.func,onBeforeSetContent:Bt.func,onBeforePaste:Bt.func,onBlur:Bt.func,onChange:Bt.func,onClearUndos:Bt.func,onClick:Bt.func,onContextMenu:Bt.func,onCommentChange:Bt.func,onCopy:Bt.func,onCut:Bt.func,onDblclick:Bt.func,onDeactivate:Bt.func,onDirty:Bt.func,onDrag:Bt.func,onDragDrop:Bt.func,onDragEnd:Bt.func,onDragGesture:Bt.func,onDragOver:Bt.func,onDrop:Bt.func,onExecCommand:Bt.func,onFocus:Bt.func,onFocusIn:Bt.func,onFocusOut:Bt.func,onGetContent:Bt.func,onHide:Bt.func,onInit:Bt.func,onKeyDown:Bt.func,onKeyPress:Bt.func,onKeyUp:Bt.func,onLoadContent:Bt.func,onMouseDown:Bt.func,onMouseEnter:Bt.func,onMouseLeave:Bt.func,onMouseMove:Bt.func,onMouseOut:Bt.func,onMouseOver:Bt.func,onMouseUp:Bt.func,onNodeChange:Bt.func,onObjectResizeStart:Bt.func,onObjectResized:Bt.func,onObjectSelected:Bt.func,onPaste:Bt.func,onPostProcess:Bt.func,onPostRender:Bt.func,onPreProcess:Bt.func,onProgressState:Bt.func,onRedo:Bt.func,onRemove:Bt.func,onReset:Bt.func,onSaveContent:Bt.func,onSelectionChange:Bt.func,onSetAttrib:Bt.func,onSetContent:Bt.func,onShow:Bt.func,onSubmit:Bt.func,onUndo:Bt.func,onVisualAid:Bt.func,onSkinLoadError:Bt.func,onThemeLoadError:Bt.func,onModelLoadError:Bt.func,onPluginLoadError:Bt.func,onIconsLoadError:Bt.func,onLanguageLoadError:Bt.func},Nh=Object.assign({apiKey:Bt.string,id:Bt.string,inline:Bt.bool,init:Bt.object,initialValue:Bt.string,onEditorChange:Bt.func,value:Bt.string,tagName:Bt.string,cloudChannel:Bt.string,plugins:Bt.oneOfType([Bt.string,Bt.array]),toolbar:Bt.oneOfType([Bt.string,Bt.array]),disabled:Bt.bool,textareaName:Bt.string,tinymceScriptSrc:Bt.string,rollback:Bt.oneOfType([Bt.number,Bt.oneOf([!1])]),scriptLoading:Bt.shape({async:Bt.bool,defer:Bt.bool,delay:Bt.number})},Sh),Th=e=>"function"==typeof e,Ih=e=>e in Sh,Rh=e=>e.substr(2),Oh=(e,t,n,r,l)=>((e,t,n,r,l,i,a)=>{const o=Object.keys(l).filter(Ih),s=Object.keys(i).filter(Ih),c=o.filter((e=>void 0===i[e])),d=s.filter((e=>void 0===l[e]));c.forEach((e=>{const t=Rh(e),r=a[t];n(t,r),delete a[t]})),d.forEach((n=>{const l=r(e,n),i=Rh(n);a[i]=l,t(i,l)}))})(l,e.on.bind(e),e.off.bind(e),((t,n)=>r=>{var l;return null===(l=t(n))||void 0===l?void 0:l(r,e)}),t,n,r);let kh=0;const Lh=e=>{const t=Date.now(),n=Math.floor(1e9*Math.random());return kh++,e+"_"+n+kh+String(t)},Ah=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Ph=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),_h=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Fh=()=>({listeners:[],scriptId:Lh("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),Dh=(()=>{let e=Fh();return{load:(t,n,r,l,i,a)=>{const o=()=>((e,t,n,r,l,i)=>{const a=t.createElement("script");a.referrerPolicy="origin",a.type="application/javascript",a.id=e,a.src=n,a.async=r,a.defer=l;const o=()=>{a.removeEventListener("load",o),i()};a.addEventListener("load",o),t.head&&t.head.appendChild(a)})(e.scriptId,t,n,r,l,(()=>{e.listeners.forEach((e=>e())),e.scriptLoaded=!0}));e.scriptLoaded?a():(e.listeners.push(a),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Fh()}}})(),Mh=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};class Hh extends e.Component{constructor(t){var n,r,l;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 l=this.elementRef.current;if(!l)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})(l)){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 i=Mh(this.view);if(!i)throw new Error("tinymce should have been loaded into global scope");const a=Object.assign(Object.assign({},this.props.init),{selector:void 0,target:l,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,Ph(o).concat(Ph(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&&!Ah(l)&&e.once("PostRender",(t=>{e.setContent(this.getInitialValue(),{no_events:!0})})),this.props.init&&Th(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 l=null!==(n=this.props.disabled)&&void 0!==n&&n;_h(this.editor,l?"readonly":"design"),this.props.init&&Th(this.props.init.init_instance_callback)&&this.props.init.init_instance_callback(e)}});var o,s;this.inline||(l.style.visibility=""),Ah(l)&&(l.value=this.getInitialValue()),i.init(a)},this.id=this.props.id||Lh("tiny-react"),this.elementRef=e.createRef(),this.inline=null!==(l=null!==(n=this.props.inline)&&void 0!==n?n:null===(r=this.props.init)||void 0===r?void 0:r.inline)&&void 0!==l&&l,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;_h(this.editor,e?"readonly":"design")}}}componentDidMount(){var e,t,n,r,l,i;null!==Mh(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&Dh.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!==(i=null===(l=this.props.scriptLoading)||void 0===l?void 0:l.delay)&&void 0!==i?i: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=Mh(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){Oh(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 $h;Hh.propTypes=Nh,Hh.defaultProps={cloudChannel:"6"},function(e){e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en"}($h||($h={}));const qh=e=>{var n;const{className:r,style:l,tinymce:i={},upload:a={},thresholdSize:o=.5,tinymceScriptSrc:s,disabled:c,value:d,onResizeEditor:u,onChange:m}=e,{global:p}=t.useContext(on),{$size:h}=Xn(e),{$locale:f,t:g}=Gn(),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",E="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",w=Object.assign(Object.assign({height:i.height||v,plugins:i.plugins||y,toolbar:i.toolbar||E,menubar:i.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:$h[f],skin:"tinymce-5"},Nn(i,["height","plugins","toolbar","menubar"])),{images_upload_handler:e=>{const{action:t,headers:n,dataKey:r,customHandler:l}=a;return l?l(e):new Promise(((l,i)=>hn(void 0,void 0,void 0,(function*(){const a=`data:image/jpeg;base64,${e.base64()}`,s=new FormData;s.append("file",e.blob(),e.filename());const c=e.blob().size;if(t&&c/1024/1024>o)try{const e=yield fetch(t,{method:"POST",body:s,headers:n});if(!e.ok)throw i(""),new Error(g("qm.upload.uploadError"));const a=yield e.json();if(200===a.code){const e=r?x(a.data,r):a.data;l(e)}}catch(e){ne.error(g("qm.uploadCropper.uploadError"))}else l(a)}))))},setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:n,offsetHeight:r}=e.editorContainer;null==u||u({width:n,height:r},t)}))}}),C=rr("tinymce"),S={[C]:!0,[`${C}--lg`]:"large"===h,[`${C}--sm`]:"small"===h},N={init:w,value:d,disabled:c,tinymceScriptSrc:s||(null===(n=null==p?void 0:p.tinymce)||void 0===n?void 0:n.scriptSrc)||void 0,onEditorChange:(e,t)=>{null==m||m(t.getContent(),t)}};return t.createElement("div",{className:Pe(S,r),style:l},t.createElement(Hh,N))};qh.displayName="QmTinymce";const Kh=e=>{const{$$form:n}=t.useContext(Hi),{value:r,onChange:l,onValuesChange:i}=e,{options:a={},upload:o,style:s={},readOnly:c,disabled:d=n.isFormDisabled}=e.option,{tinymce:u,thresholdSize:m,onResizeEditor:p}=a;return t.createElement(qh,{value:r,tinymce:u,upload:o,thresholdSize:m,style:Object.assign({width:"100%"},s),disabled:d||c||n.isOnlyShow,onResizeEditor:p,onChange:e=>{(e=>{null==l||l(e),i(e)})(e)}})};class jh extends d{render(){const{$$form:e}=this.context,{type:n,label:r,tooltip:l,fieldName:i,invisible:a,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:d,validateTrigger:u,rules:m=[],onChange:p=yn}=this.props.option;return t.createElement(oe.Item,{label:e.renderFormLabel(r),className:Pe(c),tooltip:l,hidden:a,labelCol:{flex:e.verticalLayout?"initial":In(s)},required:e.getFormItemRequired(m)},t.createElement(se,{wrap:!1,gutter:4},t.createElement(ce,{flex:"auto"},t.createElement(oe.Item,{name:i,noStyle:!0,rules:m,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(r)}},t.createElement(Kh,{option:this.props.option,onValuesChange:t=>{p(t),e.setViewValue(i,t)}}))),d&&t.createElement(ce,{flex:In(d.labelWidth||ja)},e.renderFormItemExtra(Object.assign({fieldName:i},d)))))}}jh.contextType=Hi;class Vh extends d{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=q(this.resizeObserveHandler,10),this.getFormItems=Wt((e=>e.filter((e=>!e.noAuth&&!e.hidden)))),this.getFlattenItems=Wt((e=>{const t=[];return e.filter((e=>e.fieldName&&"DIVIDER"!==e.type)).forEach((e=>{f(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(","),"]")})));Te.error({message:un("qm.form.validatePrompt"),description:n,duration:10})},this.scrollToField=e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Vt(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})},this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){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,t;return null!==(e=this.props.compactMode)&&void 0!==e?e:"small"===this.$size&&!!(null===(t=this.context.global)||void 0===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(){li(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){ii(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&&Jn("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=>f(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=>f(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:l}=e;return t=null!=t?t:void 0,Ba.includes(r)&&(t=null!=t?t:[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=null!==(n=null!=t?t:null==l?void 0:l.falseValue)&&void 0!==n?n:za),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=this.props.items.map((e=>({fieldName:e.fieldName,hidden:e.hidden})))}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){e!==this.state.collapse&&this.setState({collapse:e},(()=>{En((()=>{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,l,i;if(so(e))return Ia(e);if(f(e)){const{fieldName:a,label:o,options:s={}}=e;if(so(o))return Ia(o);const{itemList:c=[]}=s,d=null!==(r=null!==(n=null===(t=this.formRef.current)||void 0===t?void 0:t.getFieldsValue([a])[a])&&void 0!==n?n:this._initialValues[a])&&void 0!==r?r:null===(l=c[0])||void 0===l?void 0:l.value;return(null===(i=c.find((e=>e.value===d)))||void 0===i?void 0:i.text)||""}return""}getBlockDerivedItems(){const e=[];for(let t=0,n=this.dividers.length;t<n;t++){const n=this.formItems.findIndex((e=>e===this.dividers[t]));let r=this.formItems.findIndex((e=>e===this.dividers[t+1]));r=r>-1?r:void 0,e.push(this.formItems.slice(n,r).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay({type:e,fieldName:t}){var n,r;if("DIVIDER"===e)return!0;const l=this.getBlockDerivedItems();for(let e=0,i=l.length;e<i;e++){const i=l[e],a=this.dividers.find((e=>e.fieldName===i[0].fieldName)),o=null!==(r=null===(n=null==a?void 0:a.collapse)||void 0===n?void 0:n.showLimit)&&void 0!==r?r:i.length-1;for(let e=1;e<i.length;e++){if(i[e].fieldName===t&&e>o)return this.state.expand[i[0].fieldName]}}return!0}formatFormValue(e){var t,n;for(const r in e){const l=e[r];if(to(l)&&(e[r]=""),Array.isArray(l)&&l.forEach(((t,n)=>{to(t)&&(e[r][n]="")})),r.includes("|")&&Array.isArray(l)){const[i,a]=r.split("|");e[i]=null!==(t=l[0])&&void 0!==t?t:"",e[a]=null!==(n=l[1])&&void 0!==n?n:""}}if(this.isFilterType)for(const t in e)Cn(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}createFormAuth(){var e,t,n;return hn(this,void 0,void 0,(function*(){const{authConfig:r}=this.props;if(!r)return;let l=Nn(r,["fetch"]);if(r.fetch){const{api:t,params:n,dataKey:i}=r.fetch;try{const r=yield t(n);200===r.code&&(l=null!==(e=i?x(r.data,i):r.data)&&void 0!==e?e:{})}catch(e){}}if(Array.isArray(l.fieldList)){const e=this.props.items.map((e=>{const{fieldName:t}=e,n=l.fieldList.find((e=>e.dataIndex===t));if(n){const r=this.originItems.find((e=>e.fieldName===t)),{visible:l=1,disabled:i,secretName:a}=n;l||(e.noAuth=!0,r.noAuth=!0),i&&(e.disabled=!0,r.disabled=!0),a&&(e.options?e.options.secretType=a:e.options={secretType:a},r.options=Object.assign({},r.options,{secretType:a})),this.setFieldAuth(t,{visible:l,disabled:i,secretName:a})}return e}));null===(n=(t=this.props).fieldsChange)||void 0===n||n.call(t,e)}}))}INPUT(e){return t.createElement(Po,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t.createElement(Fo,{option:e})}INPUT_NUMBER(e){return t.createElement(Mo,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t.createElement($o,{option:e})}SEARCH_HELPER(e){return t.createElement(pp,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t.createElement(gp,{option:e})}TREE_TABLE_HELPER(e){return t.createElement(Cp,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t.createElement(Np,{option:e})}RANGE_SEARCH_HELPER(e){return t.createElement(Lp,{option:e})}CHECKBOX(e){return t.createElement(ko,{option:e})}MULTIPLE_CHECKBOX(e){return t.createElement(Pp,{option:e})}RATE(e){return t.createElement(Fp,{option:e})}RADIO(e){return t.createElement(Mp,{option:e})}SWITCH(e){return t.createElement($p,{option:e})}TEXT_AREA(e){return t.createElement(Kp,{option:e})}DATE(e){return t.createElement(Vp,{option:e})}RANGE_DATE(e){return t.createElement(Bp,{option:e})}TIME(e){return t.createElement(Gp,{option:e})}RANGE_TIME(e){return t.createElement(Xp,{option:e})}SELECT(e){return t.createElement(Ro,{option:e})}MULTIPLE_SELECT(e){return t.createElement(Ro,{option:e,multiple:!0})}IMMEDIATE(e){return t.createElement(Zp,{option:e})}DIVIDER(e){return t.createElement(Jp,{option:e})}TREE_SELECT(e){return t.createElement(nh,{option:e})}MULTIPLE_TREE_SELECT(e){return t.createElement(nh,{option:e,multiple:!0})}CASCADER(e){return t.createElement(lh,{option:e})}MULTIPLE_CASCADER(e){return t.createElement(lh,{option:e,multiple:!0})}CITY_SELECT(e){return t.createElement(ph,{option:e})}REGION_SELECT(e){return t.createElement(gh,{option:e})}UPLOAD_FILE(e){return t.createElement(yh,{option:e})}UPLOAD_IMG(e){return t.createElement(Ch,{option:e})}TINYMCE(e){return t.createElement(jh,{option:e})}renderFormLabel(e){if(so(e)||!f(e))return t.createElement("span",{className:"text",title:Ia(e)},e);const{type:n,fieldName:r,label:l,options:i={},onChange:a=yn}=e,{itemList:o=[]}=i;return"SELECT"===n?t.createElement(oe.Item,{name:r,noStyle:!0},t.createElement(Io,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>a(e,t)})):"CHECKBOX"===n?t.createElement(t.Fragment,null,t.createElement("span",{className:"text",style:{paddingRight:5}},l),t.createElement(oe.Item,{name:r,noStyle:!0},t.createElement(Oo,{option:e,onValuesChange:e=>a(e)}))):null}renderFormItemExtra(e){const{fieldName:n,isTooltip:r,style:l,render:i}=e,{extra:a}=this.state;if(r)return t.createElement(X,{className:"extra-tooltip",title:a[n]},t.createElement(At,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===n)),{translate:s}=o,c=i?i(o,this):a[n],d=Ia(c);return s&&d?t.createElement(No,{text:d,className:"extra-text",title:d,style:l},c):t.createElement("div",{className:"extra-text",title:d,style:l},c)}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:l,tooltip:i,className:a,labelWidth:o=this.props.labelWidth,validateTrigger:s,rules:c=[],style:d={},render:u}=e;return t.createElement(oe.Item,{label:this.renderFormLabel(n),name:r,rules:c,tooltip:i,hidden:l,className:Pe(a),style:Object.assign({width:"100%"},d),labelCol:{flex:this.verticalLayout?"initial":In(o)},validateTrigger:s,messageVariables:{label:this.getFormItemLabel(n)}},this.formRef.current?u(e,this):t.createElement(t.Fragment,null))}createFormItem(e){return v(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(Jn("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:n,defaultRows:r,isFieldsDefine:l}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:n=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<n;e++)i.push({})}));const a=24/e,o=[],s=i.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=i.map(((n,r)=>{let{selfCol:l=1}=n;const{type:i,fieldName:s}=n;l=l>=24||"DIVIDER"===i||"TINYMCE"===i?e:l;const u=!(!this.state.collapse&&this.showFilterCollapse)||o[r]<c*e,m=!this.showDividerCollapse||this.getFormItemDisplay(n);return u&&d.push(o[r]),t.createElement(ce,{key:null!=s?s:r,className:s,span:l*a,style:this.isFilterType?{display:!this.showFilterCollapse||u?"block":"none"}:{display:m?"block":"none"}},i?this.createFormItem(Tn(n)):null)}));return l&&"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:l,isSearchBtn:i,isFieldsDefine:a=!0}=this.props;if(!this.isFilterType)return null;const o=24/n,s=l||1,c=n-e%n-s;return i?t.createElement(ce,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t.createElement(Z,{style:{marginBottom:12}},t.createElement(er,{type:"primary",size:this.$size,icon:t.createElement(Nt,null),onClick:()=>this.SUBMIT_FORM()},un("qm.form.search")),t.createElement(er,{size:this.$size,icon:t.createElement(Ge,null),onClick:()=>this.RESET_FORM()},un("qm.form.reset")),a?this.createFieldsDefine():null,this.showFilterCollapse&&t.createElement("a",{onClick:()=>this.setExpandHandle(!r)},r?t.createElement(_e,null):t.createElement(Fe,null)," ",un(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 l=24/e;return r&&"default"===n?t.createElement(se,{gutter:0},t.createElement(ce,{key:"-",span:l},t.createElement(oe.Item,null,t.createElement(Z,{style:{marginBottom:12}},t.createElement(er,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},un("qm.form.save")),t.createElement(er,{size:this.$size,onClick:()=>this.RESET_FORM()},un("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:n,fieldsChange:r}=this.props;return t.createElement(Lo,{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)=>hn(this,void 0,void 0,(function*(){const[n,r]=yield this.VALIDATE_FIELDS(),l=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:[un("qm.form.searchHelperTips")],warnings:[]})));n||l.length?t((n||[]).concat(l)):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 hn(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 hn(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 hn(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))),l={};return r.forEach((e=>l[e]=void 0)),{other:Object.assign({},this._initialOthers,l)}})),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){Jn("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,n){const{items:r,fieldsChange:l}=this.props,i=r.find((t=>t.fieldName===e));if(!i)return Jn("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!f(t))return Jn("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return Jn("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const n in t)n&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===n||E(i,n,t[n]));n&&(l?l([...r]):Jn("Form","需要设置 `fieldsChange` 参数"))}render(){var e,n;const{className:r,style:l,layout:i,disabled:a,labelWidth:o,labelAlign:s,labelWrap:c,component:d,customClass:u}=this.props,m=rr("form"),p=null!==(n=null!=c?c:null===(e=this.context.global)||void 0===e?void 0:e.labelWrap)&&void 0!==n&&n,h={required:"${label}"+un("qm.form.requiredTips")},f={[m]:!0,[`${m}--lg`]:"large"===this.$size,[`${m}--sm`]:"small"===this.$size,[`${m}__only-show`]:this.isOnlyShow,[`${m}__label-wrap`]:p,[`${m}__compact`]:this.isCompactMode,[u]:!!u};return t.createElement("div",{ref:this.wrapperRef,className:Pe(f,r),style:l},t.createElement(oe,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:i,labelAlign:s,labelWrap:p,component:d,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":In(o)},validateMessages:h,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t.createElement(Hi.Provider,{value:this.provide},t.createElement(se,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}Vh.contextType=on,Vh.propTypes=Qa,Vh.defaultProps=Za;const zh=e=>null!=e;function Wh(e,n,r,l){const[i,a]=t.useState(void 0);t.useLayoutEffect((()=>{const t="function"==typeof e?e():e;a(t||null)}));const[o,s]=t.useState(null),c=()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:r,right:l,bottom:i,left:a}=e.getBoundingClientRect();return r>=0&&a>=0&&l<=t&&i<=n})(i)&&n&&i.scrollIntoView(l);const{left:e,top:t,width:r,height:a}=i.getBoundingClientRect(),o={left:e,top:t,width:r,height:a,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)};t.useLayoutEffect((()=>{c()}),[i,n]),us({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]),i]}const Bh={fill:"transparent",pointerEvents:"auto"},Uh=e=>{const{prefixCls:n,rootClassName:r,pos:l,showMask:i,style:a={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:d}=e,u=`${n}-mask-${es()}`,m="object"==typeof c?null==c?void 0:c.placeholder:c;return t.createElement(Gt,{open:s,autoLock:!0},t.createElement("div",{className:Pe(`${n}-mask`,r),style:Object.assign({position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},a)},i?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"}),l&&t.createElement("rect",{x:l.left,y:l.top,rx:l.radius,width:l.width,height:l.height,fill:"black",className:m?`${n}-placeholder-animated`:""}))),t.createElement("rect",jn({},l?null:Bh,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${u})`})),l&&t.createElement(t.Fragment,null,t.createElement("rect",jn({},Bh,{x:"0",y:"0",width:"100%",height:`${l.top}px`})),t.createElement("rect",jn({},Bh,{x:"0",y:"0",width:l.left,height:"100%"})),t.createElement("rect",jn({},Bh,{x:"0",y:l.top+l.height,width:"100%",height:`calc(100vh - ${l.top+l.height}px)`})),t.createElement("rect",jn({},Bh,{x:l.left+l.width,y:"0",width:`calc(100vw - ${l.left+l.width}px)`,height:"100%"})))):null))},Gh=e=>{const{prefixCls:n,zIndex:r,open:l,onPause:i,onPlay:a}=e,[o,s]=is(void 0,{value:l,postState:e=>null==e||e}),c=t.useRef(null),d=t.useRef(!1),u=Yn((e=>{m(e),e.shiftKey&&32===e.keyCode&&p()}));t.useEffect((()=>{const e=jt(document,"keyup",u);return()=>e.remove()}),[]);const m=e=>{e.stopPropagation(),e.preventDefault()},p=()=>{d.current?d.current=!1:(s(!o),o?null==i||i():null==a||a())};return t.createElement("div",{ref:c,className:`${n}-control`,style:{zIndex:r+1},onMouseDown:e=>{m(e);const t=c.current,n=t.offsetWidth,r=t.offsetHeight,l=window.innerWidth,i=window.innerHeight,a=e.clientX-zl(t).x,o=e.clientY-zl(t).y;return document.onmousemove=e=>{let s=e.clientX-a,c=e.clientY-o;s<0&&(s=0),s>l-n-1&&(s=l-n-1),c<0&&(c=0),c>i-r-1&&(c=i-r-1),Kl(t,{left:`${s}px`,top:`${c}px`}),d.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>p()},o?t.createElement(Pt,null):t.createElement(yt,null))},Yh=e=>{const{prefixCls:n,current:r,total:l=0,cover:i,title:a,description:o,helper:s={},type:c,zIndex:d,onClose:u,onPrev:m,onNext:p,onFinish:h,className:f,indicatorsRender:g}=e,{t:v}=Gn(),y="primary"!==c?"primary":"default",b=Yn((e=>{C(e),40===e.keyCode&&(r<l-1?null==p||p():null==h||h()),38===e.keyCode&&r>0&&(null==m||m())}));t.useEffect((()=>{const e=jt(document,"keyup",b);return()=>e.remove()}),[]);const x=zh(i)?t.createElement("div",{className:`${n}-cover`},i):null,E=zh(o)?t.createElement("div",{className:`${n}-description`},o):null;let w;w=g?g(r,l):[...Array.from({length:l}).keys()].map(((e,l)=>t.createElement("span",{key:e,className:Pe(l===r&&`${n}-indicator-active`,`${n}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t.createElement("div",{className:Pe(`${n}-content`,f)},t.createElement("div",{className:`${n}-inner`},t.createElement(lt,{className:`${n}-close`,onClick:u}),s.content&&t.createElement(ve,{placement:"bottom",overlayStyle:{width:360,zIndex:d},content:s.content,title:s.title},t.createElement(_t,{className:Pe(`${n}-close`,"help-icon")})),x,t.createElement("div",{className:`${n}-header`},t.createElement("div",{className:`${n}-title`},a)),E,t.createElement("div",{className:`${n}-footer`},l>1&&t.createElement("div",{className:`${n}-indicators`},w),t.createElement(nr,{className:`${n}-buttons`},0!==r?t.createElement(er,{className:`${n}-prev-btn`,size:"small",onMouseDown:C,onClick:m},v("qm.tour.prevStep")):null,r===l-1?t.createElement(er,{className:`${n}-finish-btn`,type:y,size:"small",onClick:h},v("qm.tour.finish")):t.createElement(er,{className:`${n}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:p},v("qm.tour.nextStep"))))))},Xh=e=>{const{current:n,renderPanel:r}=e;return t.createElement(t.Fragment,null,"function"==typeof r?r(e,n):t.createElement(Yh,e))},Qh={left:"50%",top:"50%",width:1,height:1},Zh=t.forwardRef(((e,n)=>{const{steps:r=[],defaultCurrent:l,current:i,onChange:a,onClose:o,onFinish:s,open:c,type:d="default",mask:u=!0,arrow:m=!0,control:p=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:v,zIndex:y,renderPanel:b,indicatorsRender:x,gap:E,animated:w=!0,scrollIntoViewOptions:C=!0}=e,S=mn(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]=is(0,{value:i,defaultValue:l}),[R,O]=is(void 0,{value:c,postState:e=>!(T<0||T>=r.length)&&(null!=e&&e)}),[k,L]=is(1051,{value:y,defaultValue:y}),[A,P]=t.useState(),_=t.useRef(R);t.useLayoutEffect((()=>{R&&!_.current&&I(0),_.current=R,P(R)}),[R]),t.useImperativeHandle(n,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>L(e)})));const{target:F,type:D,placement:M,trigger:H,delay:$,style:q,arrow:K,className:j,mask:V,scrollIntoViewOptions:z,zIndex:W,action:B}=r[T]||{},U=W||k,G=D||d,Y=R&&(null!=V?V:u),X=null!=z?z:C,[Q,Z]=Wh(F,!!c,E,X),J=((e,t,n)=>{var r;return null!==(r=null!=n?n:t)&&void 0!==r?r:null===e?"center":"bottom"})(Z,g,M),ee=!!Z&&(void 0===K?m:K),te="object"==typeof ee&&ee.pointAtCenter;t.useLayoutEffect((()=>{var e;null===(e=N.current)||void 0===e||e.forceAlign()}),[te,T]),Dl((()=>{R&&(le(),null==B||B(Z,T))}),[R,Z]);const ne=e=>{I(e),null==a||a(e)},re=()=>{O(!1),null==o||o(T)},le=()=>{if(!Z)return;const e=[];!function t(n){if(1===n.nodeType){var r;"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName||("none"===ql(r=n,"display")||"hidden"===ql(r,"visibility")||"0"===ql(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 ie=()=>hn(void 0,void 0,void 0,(function*(){if(!H||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),n=Z.offsetWidth,r=Z.offsetHeight,[l,i]=[e+n/2,t+r/2],a=new MouseEvent(H,{bubbles:!0,cancelable:!0,button:0,clientX:l,clientY:i}),o=document.elementFromPoint(l,i);o&&(o.dispatchEvent(a),yield xn(null!=$?$:320))})),ae="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,q),ce=rr("tour"),de=[{[`${ce}-primary`]:"primary"===G},h,j],ue=Yd({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Uh,{zIndex:U,prefixCls:ce,pos:Q,showMask:ae,style:null==oe?void 0:oe.style,fill:null==oe?void 0:oe.color,open:A,animated:w,rootClassName:h}),t.createElement(Gt,{open:A,autoLock:!0},t.createElement(Jt,jn({ref:N},S,{zIndex:U,builtinPlacements:ue,popupStyle:se,popupPlacement:J,popupVisible:A,popupClassName:Pe(de),prefixCls:ce,popup:()=>t.createElement(Xh,jn({key:"content",arrow:ee,prefixCls:ce,total:r.length,helper:v,renderPanel:b,indicatorsRender:x,onPrev:()=>hn(void 0,void 0,void 0,(function*(){yield ie(),ne(T-1)})),onNext:()=>hn(void 0,void 0,void 0,(function*(){yield ie(),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:Pe(h,`${ce}-target-placeholder`),style:Object.assign(Object.assign({},Q||Qh),{position:"fixed",pointerEvents:"none"})}))),p&&t.createElement(Gt,{open:R},t.createElement(Gh,{zIndex:U,prefixCls:ce,onPause:()=>P(!1),onPlay:()=>P(!0)})))}));Zh.displayName="QmTour";var Jh={previewWidth:1100,defaultDistance:.45,logoHeight:60};const ef=n(void 0);var tf=null;function nf(){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),l=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!n&&i)return!0;if(l){if((l=l[0].match(/\d+/))[0]>=41||i)return!0}else if(r){if((r=r[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!n){var a=e.match(/Chrome\D?\d+/i);if(a&&(a=a[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function rf(e,t){var n;try{var r=navigator.userAgent,l=!!r.match(/MSIE/i)||!!r.match(/Trident/i);if(nf()){try{n=getCLodop()}catch(e){}if(!n&&"complete"!==document.readyState)return void ne.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!n)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else{l&&r.match(/x64/i);if(e||t?n=l?e:t:tf?n=tf:((n=document.createElement("object")).setAttribute("width",0),n.setAttribute("height",0),n.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),l?n.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):n.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(n),tf=n),!n||!n.VERSION)return r.indexOf("Chrome"),r.indexOf("Firefox"),n}return n.VERSION<"6.2.2.6"&&nf(),n}catch(e){ne.error("getLodop 出错:"+e)}}nf();const lf=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)},af=t.forwardRef(((e,n)=>{const{templateRender:r,directPrint:l}=e,{global:i}=t.useContext(on),{$$preview:a}=t.useContext(ef),{state:o,isWindowsPrinter:s,pageSize:c}=a,d=t.useRef(null),u=t.useRef({}),m=t.useRef([]),p=t.useRef([]),h=t.useRef([]),[f,g]=t.useState(!0);t.useImperativeHandle(n,(()=>({createPreviewDom:O,createExportHtml:L,createPrintHtml:k,SHOW_PREVIEW:A,DIRECT_PRINT:P}))),Dl((()=>{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*Jh.defaultDistance+10*Jh.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*Jh.defaultDistance+10*Jh.defaultDistance:0;return("vertical"===e?c[1]:c[0])-t}),[o,s,c]),b=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return lf(v-10*(e.left-Jh.defaultDistance)-10*(e.right-Jh.defaultDistance))}),[o,v]),x=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return lf(y-10*(e.top-Jh.defaultDistance)-10*(e.bottom-Jh.defaultDistance))}),[o,y]),E=o.form.scale,w=t.useMemo((()=>{const{form:{setting:{distance:e}}}=o;return{left:lf(10*e.left),right:lf(10*e.right),top:lf(10*e.top),bottom:lf(10*e.bottom)}}),[o]),C=t.useMemo((()=>{const{form:{printerType:e}}=o,{left:t,right:n,top:r,bottom:l}=w,i=b+t+n,a=Jh.previewWidth-i<=0?0:(Jh.previewWidth-i)/2,s=Math.abs((1-E)*i/2);let c=0;return E>1&&(c=s>a?-1*a:-1*s),E<1&&(c=i-2*s>Jh.previewWidth?0:a>0?s:(Jh.previewWidth-(i-2*s))/2),{width:`${b}px`,height:""+("stylus"===e?"auto":x+"px"),paddingLeft:`${t}px`,paddingRight:`${n}px`,paddingTop:`${r}px`,paddingBottom:`${l}px`,transform:`translateX(${c}px) scale(${E})`,opacity:f?0:1}}),[o,f,w,E,x,b]);m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e)));const S=()=>{var e,t,n,r;const l=null!==(t=null===(e=null==i?void 0:i.print)||void 0===e?void 0:e.leftLogo)&&void 0!==t?t:"",a=null!==(r=null===(n=null==i?void 0:i.print)||void 0===n?void 0:n.rightLogo)&&void 0!==r?r:"";return[`<tr style="height: ${Jh.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',l?`<img src="${l}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',a?`<img src="${a}" border="0" height="46" />`:"","</td>","</tr>"].join("")},N=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},T=()=>{let e=document.createElement("tr");var t,n;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=N().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(n=u.current.templateEl.children[0]).children[0]?n.insertBefore(t,n.children[0]):n.appendChild(t),e=null},I=()=>{const e=u.current.templateEl.children[0].children,t=[],n=[];for(let r=0;r<e.length;r++){if("template-cols"===e[r].getAttribute("type"))continue;const l=e[r].clientHeight;e[r].style.height=l+"px",n.push(l),t.push(e[r].outerHTML)}p.current=n,m.current=t},R=()=>{var e;if(!m.current.length)return;const{form:{setting:t,printerType:n}}=o;if(l)return h.current.push([N(),S(),...m.current]);const r=t.fixedLogo?x-Jh.logoHeight:x;let i=[];if(h.current=[],"stylus"===n)h.current.push([N(),...t.fixedLogo?[S()]:[],...m.current]);else{let e=0;for(let n=0,l=p.current.length;n<l;n++){const a=m.current[n],o=p.current[n];t.fixedLogo||0!==n||(e+=Jh.logoHeight),e+=o,e<=r?i.push(a):(h.current.push([N(),...t.fixedLogo?[S()]:[],...i]),i=[],e=0,n-=1),n===l-1&&i.length&&h.current.push([N(),...t.fixedLogo?[S()]:[],...i])}}t.fixedLogo||null===(e=h.current[0])||void 0===e||e.splice(1,0,S());for(let e=0,t=h.current.length;e<t&&e!==t-1;e++)h.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');a.setState({currentPage:1,totalPage:h.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=h.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+=[...h.current[e-1]].join("")}else for(let e=0;e<h.current.length;e++)t+=h.current[e].join("");return t+="</table>",t},L=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+S()+N()+e.join("")+"</table>"},A=()=>hn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();u.current.previewEl.innerHTML||(T(),yield xn(0),I(),R(),g(!1))})),P=()=>hn(void 0,void 0,void 0,(function*(){var e;if("TABLE"!==(null===(e=u.current.templateEl)||void 0===e?void 0:e.tagName))return _();T(),yield xn(0),I(),R(),g(!1),a.doPrint(k()),yield xn(0),a.doClose()})),_=()=>{Jn("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},F={[rr("print-container")]:!0,"no-visible":l};return t.createElement("div",{ref:d,className:Pe(F)},t.createElement(ei,{wrapperClassName:"spin",spinning:f,tip:"Loading..."},t.createElement("div",{className:"preview"},t.createElement("div",{className:"origin-template",style:{width:`${b}px`,marginLeft:`-${Math.floor(b/2)}px`}},null==r?void 0:r()),t.createElement("div",{className:"workspace",style:C}))))}));af.displayName="Container";class of extends d{constructor(){super(...arguments),this.formRef=t.createRef(),this.createFormList=()=>[{type:"DIVIDER",fieldName:"_1",label:un("qm.print.setPanel.printParameter")},{type:"SELECT",label:un("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:un("qm.print.setPanel.carbonPaper"),value:"241*280"}]}},{type:"RADIO",label:un("qm.print.setPanel.printDirection"),fieldName:"direction",options:{itemList:[{text:un("qm.print.setPanel.vertical"),value:"vertical"},{text:un("qm.print.setPanel.horizontal"),value:"horizontal"}]}},{type:"CHECKBOX",fieldName:"doubleSide",label:{type:"SELECT",fieldName:"doubleSideType",options:{itemList:[{text:un("qm.print.setPanel.autoDoublePrint"),value:"auto"},{text:un("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:un("qm.print.setPanel.fixedLogo"),fieldName:"fixedLogo",options:{trueValue:1,falseValue:0}},{type:"DIVIDER",fieldName:"_2",label:un("qm.print.setPanel.printMargin")},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.leftMargin"),fieldName:"disleft",options:{min:Jh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.rightMargin"),fieldName:"disright",options:{min:Jh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.topMargin"),fieldName:"distop",options:{min:Jh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("qm.print.setPanel.noEmpty")}]},{type:"INPUT_NUMBER",label:un("qm.print.setPanel.bottomMargin"),fieldName:"disbottom",options:{min:Jh.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:un("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:un("qm.print.setPanel.sizeUnit"),disright:un("qm.print.setPanel.sizeUnit"),distop:un("qm.print.setPanel.sizeUnit"),disbottom:un("qm.print.setPanel.sizeUnit")}),this.state={formList:this.createFormList()},this.confirmHandle=()=>hn(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(Vh,{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(er,{onClick:()=>this.cancelHandle(),style:{marginRight:8}},un("qm.dialog.close")),t.createElement(er,{type:"primary",onClick:()=>this.confirmHandle()},un("qm.dialog.confirm"))))}}of.contextType=on;class sf extends d{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:Jh.defaultDistance,right:Jh.defaultDistance,top:Jh.defaultDistance,bottom:Jh.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=()=>hn(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 Zt.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=>hn(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)=>hn(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=rf();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:l,printerName:i,printerType:a,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=Jh,{left:d,right:u,top:m,bottom:p}=l.distance;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),l.doubleSide&&("auto"===l.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===a&&("vertical"===l.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===l.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===a&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*p*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(d-c)+"mm",`RightMargin: ${10*(u-c)}mm`,`BottomMargin: ${"stylus"!==a?10*(p-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?r&&this.doClose():ne.error(un("qm.print.printError"))},t.PRINT()},this.doExport=e=>{const t=rf();if(!t)return;const{uniqueKey:n,closeAfterPrint:r}=this.props,{form:{setting:l}}=this.state;t.PRINT_INIT(null!=n?n:Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?r&&this.doClose():ne.error(un("qm.print.exportError"))},t.ADD_PRINT_TABLE(0,0,"RightMargin: 0","BottomMargin: 0",this.createStyle()+e),t.SET_SAVE_MODE("Orientation","vertical"===l.direction?1:2),t.SAVE_TO_FILE(`${p().format("YYYYMMDDHHmmss")}.xlsx`)}}get printerTypeItems(){return[{text:un("qm.print.laserPrinter"),value:"laser"},{text:un("qm.print.stylusPrinter"),value:"stylus"}]}get printerItems(){const e=rf(),t=[{text:un("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){Jn("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 hn(this,void 0,void 0,(function*(){if(this.props.uniqueKey)try{let n=yield Zt.getItem(this.printerKey);n||(n=yield this.getPrintConfig(this.printerKey),f(n)&&(yield Zt.setItem(this.printerKey,n))),f(n)&&Object.keys(n).length&&D(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:l,currentPage:i,totalPage:a,printPage:o}=this.state,s=rr("print-preview"),c={visible:r,title:un("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:Pe(d)},t.createElement("div",{className:"outer"},t.createElement("div",{className:"header"},t.createElement("span",null,un("qm.print.printer"),":",t.createElement(de,{value:l.printerName,onChange:e=>{this.setState((t=>D({},t,{form:{printerName:e}})))},style:{width:"120px"}},this.printerItems.map((e=>t.createElement(de.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,un("qm.print.type"),":",t.createElement(de,{value:l.printerType,onChange:e=>{this.setState((t=>D({},t,{form:{printerType:e,setting:{pageSize:"stylus"===e?"241*280":"210*297"}}})))},style:{width:"120px"}},this.printerTypeItems.map((e=>t.createElement(de.Option,{key:e.value,value:e.value},e.text))))),t.createElement("span",null,un("qm.print.copies"),":",t.createElement(pe,{value:l.copies,min:1,precision:0,onChange:e=>{this.setState((t=>D({},t,{form:{copies:null!=e?e:1}})))},style:{width:"50px"}})),t.createElement("span",null,un("qm.print.printPage.0"),t.createElement(pe,{value:o,min:1,max:a,precision:0,onChange:e=>{this.setState({printPage:null!=e?e:void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),un("qm.print.printPage.1")),t.createElement("span",null,t.createElement(xe,{size:"small",current:i,pageSize:1,total:a,onChange:this.pageChangeHandle})),t.createElement("span",null,t.createElement(er,{type:"text",icon:t.createElement(Qe,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},un("qm.print.setting"))),t.createElement("span",null,t.createElement(er,{type:"text",icon:t.createElement(Ke,null),className:"text-btn",onClick:()=>this.exportClickHandle()},un("qm.print.export"))),t.createElement("span",null,t.createElement(er,{icon:t.createElement(Ye,null),type:"primary",onClick:this.printClickHandle},un("qm.print.print")))),t.createElement("div",{className:"main"},t.createElement(ef.Provider,{value:this.provide},t.createElement(af,{ref:this.containRef,templateRender:n,directPrint:!1}))),t.createElement("div",{className:"footer"},t.createElement("span",null,un("qm.print.scale"),":",t.createElement(Ie,{value:l.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>D({},t,{form:{scale:e}})))}}),t.createElement("em",{className:"scale-text"},`${Math.floor(100*l.scale)}%`)),t.createElement("span",null,un("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t.createElement("span",null,un("qm.print.pageNumber"),":",un("qm.print.pagination",{currentPage:i,totalPage:a}))))),t.createElement(Mi,c,t.createElement(of,{setting:l.setting,onChange:e=>{this.setState((t=>D({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t.createElement(ef.Provider,{value:this.provide},t.createElement(af,{ref:this.containRef,templateRender:n,directPrint:!0}))}}sf.contextType=on;class cf extends d{constructor(){super(...arguments),this.previewRef=t.createRef(),this.state={visible:!1,loading:!1},this.clickHandle=()=>hn(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:l,preview:i,closeAfterPrint:a}=this.props,o={visible:e,title:un("qm.print.preview"),width:`${Jh.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:n,uniqueKey:r,defaultConfig:l,preview:i,closeAfterPrint:a,onClose:()=>{this.setState({visible:!1})}};return i?t.createElement(Mi,o,t.createElement(sf,s)):e?t.createElement(sf,s):null},this.DO_PRINT=()=>hn(this,void 0,void 0,(function*(){const{preview:e}=this.props;yield xn(0),this.setState({visible:!0}),yield xn(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:l,disabled:i,shape:a}=this.props,o={size:n||this.context.size||"",type:l,shape:a,icon:r,loading:e,disabled:i,click:this.clickHandle};return t.createElement(t.Fragment,null,this.props.children&&t.createElement(er,o,this.props.children),this.createRender())}}function df(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function uf(e){const t=df(e);return t?t.frameElement:null}function mf(e){const t=ff(e);return pf([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function pf(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 hf(e,t){const n=uf(e);if(n&&n!==t){const r=[e.getBoundingClientRect()];let l=n,i=!1;for(;l;){const e=mf(l);if(r.push(e),l=uf(l),i)break;l&&df(l)===t&&(i=!0)}return pf(r)}return e.getBoundingClientRect()}function ff(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)}}cf.propTypes={size:(e,t,n)=>{if(!Ka(e[t]||""))return Zn("Print","Invalid prop `"+t+"` supplied to `"+n+"`. Validation failed.")},templateRender:Ut.elementType},cf.defaultProps={preview:!0,type:"primary",icon:t.createElement(Ye,null)},cf.contextType=on;const gf=Object.assign;class vf{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=Ef.border,this.padding.style.borderColor=Ef.padding,this.content.style.backgroundColor=Ef.background,gf(this.node.style,{borderColor:Ef.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){xf(t,"margin",this.node),xf(t,"border",this.border),xf(t,"padding",this.padding),gf(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"}),gf(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class yf{constructor(e,t){this.tip=e.createElement("div"),gf(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),gf(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),gf(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),l=Math.max(n.width,60),i=5;let a;a=e.top+e.height+r<=t.top+t.height?e.top+e.height<t.top+0?t.top+i:e.top+e.height+i:e.top-r<=t.top+t.height?e.top-r-i<t.top+i?t.top+i:e.top-r-i:t.top+t.height-r-i;let o=e.left+i;e.left<t.left&&(o=t.left+i);e.left+l>t.left+t.width&&(o=t.left+t.width-l-i);return a+="px",o+="px",{style:{top:a,left:o}}}(e,t,{width:n.width,height:n.height});gf(this.tip.style,r.style)}}class bf{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 yf(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 vf(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=hf(e,this.window),l=ff(e);r.top=Math.min(r.top,n.top-l.marginTop),r.right=Math.max(r.right,n.left+n.width+l.marginRight),r.bottom=Math.max(r.bottom,n.top+n.height+l.marginBottom),r.left=Math.min(r.left,n.left-l.marginLeft);this.rects[t].update(n,l)})),t||(t=n[0].nodeName.toLowerCase(),n[0]),this.tip.updateText(t,r.right-r.left,r.bottom-r.top);const l=hf(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:l.top+this.tipBoundsWindow.scrollY,left:l.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function xf(e,t,n){gf(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 Ef={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 wf=null,Cf=null;function Sf(){null!=window.document&&(wf=null,null!==Cf&&(Cf.remove(),Cf=null))}class Nf{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=>Bl(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Sf();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,l;n=[t],r=null,l=!1,null!=window.document?(null!==wf&&clearTimeout(wf),null!=n&&(null===Cf&&(Cf=new bf),Cf.inspect(n,r),l&&(wf=setTimeout((()=>Sf()),2e3)))):null!=n&&null!=n[0]&&console.error("showNativeHighlight",n[0])}},this.onPointerUp=e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())},this.selectFiberForNode=K((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(){Sf(),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 Tf(e){return document.querySelector(e)}const If=e=>{const{action:n,onConfirm:r,onCancel:l,onFinish:i}=e,{t:a}=Gn();return t.createElement(t.Fragment,null,t.createElement("div",{style:{height:100}},a("qm.table.config.emptyText")),t.createElement(nr,{style:{width:"100%",justifyContent:"flex-end"}},t.createElement(er,{size:"small",onClick:()=>null==l?void 0:l()},a("qm.guideTracker.closeButton")),t.createElement(er,{size:"small",onClick:()=>null==r?void 0:r()},a("add"===n?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t.createElement(er,{size:"small",onClick:()=>null==i?void 0:i()},a("qm.guideTracker.finishButton"))))},Rf={left:"50%",top:"50%",width:1,height:1},Of=t.forwardRef(((e,n)=>{const{open:r,current:l,defaultCurrent:i,steps:a=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:d,destroyOnHide:u,contentRender:m,zIndex:p,helper:h={},selectFilter:f=(e=>e),onSelect:g,onChange:v,onClose:y,onFinish:b}=e,{t:x}=Gn(),E=t.useRef(),w=t.useRef(a.length),[S,N]=is(0,{value:l,defaultValue:i}),[T,I]=is(void 0,{value:r,postState:e=>null!=e&&e}),[R,O]=is(1051,{value:p,defaultValue:p}),[k,L]=t.useState({}),[A,P]=t.useState(!1),[_,F]=t.useState(T),[D,M]=t.useState(!1),[H,$]=Wh(k.node,!!r),[q,K]=t.useState(22),j=t.useRef(!1),V=t.useMemo((()=>S>=a.length?"add":"edit"),[S,a]),z=t.useMemo((()=>`${S+1} / ${a.length}`),[S,a]);t.useLayoutEffect((()=>{E.current=new Nf({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),L({id:Ta(),node:e,path:t}),N(w.current),P(!0),B(),null==g||g(t,e)}})}),[]),t.useEffect((()=>(T?W():B(),T?setTimeout((()=>F(!0)),16):F(!1),()=>{B()})),[T]),t.useEffect((()=>{w.current=a.length}),[a]);const W=()=>{E.current.startHandle()},B=()=>{E.current.stopHandle()},U=e=>{e.stopPropagation(),e.preventDefault()};t.useImperativeHandle(n,(()=>({OPEN:()=>I(!0),CLOSE:()=>I(!1),GET_CURRENT_STEP:()=>({current:S,selector:k.path})})));const G=rr("guide-tracker"),Y=[{[`${G}-primary`]:!0}],X=Yd({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t.createElement(t.Fragment,null,t.createElement(Gt,{open:T&&A,autoLock:!0},t.createElement(Jt,{zIndex:R,builtinPlacements:X,popupPlacement:o,popupVisible:T&&A,popupClassName:Pe(Y,c),popupStyle:d,prefixCls:G,popup:()=>{const e=()=>{P(!1),W()};return t.createElement("div",{className:`${G}-content`},t.createElement("div",{className:`${G}-inner`},t.createElement(lt,{className:`${G}-close`,onClick:()=>{null==y||y(S),e()}}),t.createElement(me,{open:D,trigger:["click"],dropdownRender:()=>a.length?t.createElement("div",{className:"ant-dropdown-menu step-list"},t.createElement(Yt,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:a,setList:e=>{const t=e.map((e=>e.id)),n=a.map((e=>e.id));if(C(t,n))return;const r=t.findIndex((e=>e===k.id)),l=-1!==r?r:S;N(l),null==v||v(Fa(e),l)}},a.map(((e,n)=>t.createElement("li",{key:n,className:Pe("item",{actived:e.id===k.id})},t.createElement(Be,{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:Tf(e.selector),path:e.selector}),N(n),K(22===q?q+1:q-1),null==v||v(a,n))}},e.title),t.createElement(Q,{title:x("qm.button.confirmTitle"),zIndex:R+1,onConfirm:()=>{const t=a.filter((t=>t.id!==e.id)),r=n===S;let l=n<=S?S-1:S;if(l=l<0?0:l,l=l>t.length?t.length:l,r&&t[l]){const{id:e,selector:n}=t[l];L({id:e,node:Tf(n),path:n})}N(l),null==v||v(t,l)}},t.createElement(lt,{className:"close-icon"})))))))):t.createElement(t.Fragment,null),overlayClassName:`${G}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:R},onOpenChange:e=>M(e)},t.createElement(Ft,{className:Pe(`${G}-close`,"menu-icon"),style:{width:q}})),h.content&&t.createElement(ve,{placement:"bottom",overlayStyle:{width:360,zIndex:R},content:h.content,title:h.title},t.createElement(_t,{className:Pe(`${G}-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"),z)),m?m({id:k.id,selector:k.path,actionStatus:V,DO_CLOSE:e},S):t.createElement(If,{action:V,onConfirm:()=>{null==v||v("add"===V?[...a,{id:k.id,selector:k.path,title:"Guide Title"}]:[...a],S),e()},onCancel:()=>{null==y||y(S),e()},onFinish:()=>{e(),null==y||y(S),null==b||b()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:u},t.createElement("div",{className:Pe(`${G}-target-placeholder`),style:Object.assign(Object.assign({},H||Rf),{position:"fixed",zIndex:R-1,backgroundColor:"rgba(120, 170, 210, 0.7)"}),onMouseDown:U,onClick:U}))),s&&t.createElement(Gt,{open:_},t.createElement(Gh,{zIndex:R,prefixCls:G,onPause:()=>{j.current=A,P(!1),B()},onPlay:()=>{j.current?P(!0):W()}})))}));Of.displayName="QmGuideTracker";const kf=n=>{var r,l,i,a,o,s,c,d;const{content:u,image:m,width:p,height:h,font:f={},gap:g=[100,100],offset:v=[50,50],rotate:y=-22,zIndex:b=9,alpha:x=1,antiTamper:E=!0,grayscale:w,className:C,style:S}=n,N=t.useRef(null),T=t.useRef(new Map),I=null!==(r=f.fontSize)&&void 0!==r?r:16,R=null!==(l=f.fontWeight)&&void 0!==l?l:"normal",O=null!==(i=f.fontStyle)&&void 0!==i?i:"normal",k=null!==(a=f.fontFamily)&&void 0!==a?a:"sans-serif",L=null!==(o=f.color)&&void 0!==o?o:"rgba(0, 0, 0, 0.15)",A=null!==(s=f.textAlign)&&void 0!==s?s:"center",P=Array.isArray(u)?u:[u],_=g[0],F=g[1],D=_/2,M=F/2,H=null!==(c=v[0])&&void 0!==c?c:D,$=null!==(d=v[1])&&void 0!==d?d:M,q=t.useMemo((()=>{const e=H-D,t=$-M;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:b}}),[D,M,H,$,b]),K=(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 l=document.createElement("div");l.setAttribute("style",(e=>Object.entries(e).map((([e,t])=>{return`${n=e,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${t}`;var n})).join(";"))(Object.assign(Object.assign({},q),{backgroundImage:`url('${e}')`,backgroundSize:`${t}px`}))),null===(n=N.current)||void 0===n||n.append(l),T.current.set(N.current,l)}},j=()=>{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,l]=(e=>{let t=120,n=64;if(!m&&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!=p?p:t,null!=h?h:n]})(t),i=r*n,a=l*n,o=(_+r)*n,s=(F+l)*n,c=_/2*n,d=F/2*n,u=o/2,f=s/2,g=2*(_+r);e.width=2*o,e.height=2*s,t.globalAlpha=x,t.save(),t.translate(u,f),t.rotate(Math.PI/180*y),t.translate(-u,-f);const v=()=>{t.restore(),t.drawImage(e,0,0,o,s,o,s,o,s),w&&(e=>{const t=e.getContext("2d");if(!t)return;const n=t.getImageData(0,0,e.width,e.height),{data:r}=n;for(let e=0;e<r.length;e+=4){const t=(r[e]+r[e+1]+r[e+2])/3;r[e]=t,r[e+1]=t,r[e+2]=t}t.putImageData(n,0,0)})(e),K(e.toDataURL(),g)},b=()=>{const e=Number(I)*n;t.font=`${O} normal ${R} ${e}px/${l}px ${k}`,t.fillStyle=L,t.textAlign=A,t.textBaseline="top",t.translate(i/2,0),P.forEach(((r,l)=>{t.fillText(null!=r?r:"",c,d+l*(e+3*n))})),v()};if(m){const e=new Image;e.onload=()=>{t.drawImage(e,c,d,i,a),v()},e.onerror=()=>{b()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=m}else b()},V=e=>Array.from(T.current.values()).includes(e);t.useEffect((()=>{j()}),[u,m,p,h,f,g,v,y,b,x,E,w]),function(t,n,r={}){const l=window&&"MutationObserver"in window,i=e.useRef(),a=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};e.useLayoutEffect((()=>(a(),l&&t.current&&(i.current=new MutationObserver(n),i.current.observe(t.current,r)),()=>a())),[t])}(N,(e=>{if(E)for(const t of e){const e=Array.from(t.removedNodes).some((e=>V(e))),n="attributes"===t.type&&V(t.target);if(e||n){j();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const z=rr("watermark");return t.createElement("div",{ref:N,className:Pe(z,C),style:Object.assign({position:"relative"},S)},n.children)},Lf=new Map,Af=new WeakMap;let Pf,_f=0;function Ff(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(n=e.root,n?(Af.has(n)||(_f+=1,Af.set(n,_f.toString())),Af.get(n)):"0"):e[t]}`;var n})).toString()}function Df(e,t,n={},r=Pf){if(void 0===window.IntersectionObserver&&void 0!==r){const l=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:l,observer:i,elements:a}=function(e){const t=Ff(e);let n=Lf.get(t);if(!n){const r=new Map;let l=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{var n;const i=t.isIntersecting&&l.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=i),null===(n=r.get(t.target))||void 0===n||n.forEach((e=>{e(i,t)}))}))}),e);l=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:r},Lf.set(t,n)}return n}(n),o=a.get(e)||[];return a.has(e)||a.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(a.delete(e),i.unobserve(e)),0===a.size&&(i.disconnect(),Lf.delete(l))}}const Mf=e=>{const{forceRender:n,height:r,placeholder:l=null,unmountIfInvisible:i,className:a,style:o}=e,{ref:s,inView:c,entry:d}=(({root:e,rootMargin:n,threshold:r,triggerOnce:l,fallbackInView:i,trackVisibility:a,skip:o,delay:s,onChange:c}={})=>{var d;const[u,m]=t.useState(null),[p,h]=t.useState({inView:!1,entry:void 0}),f=t.useRef(c);t.useEffect((()=>{if(o||!u)return;let t;return t=Df(u,((e,n)=>{var r;h({inView:e,entry:n}),null===(r=f.current)||void 0===r||r.call(f,e,n),n.isIntersecting&&l&&t&&(t(),t=void 0)}),{root:e,rootMargin:n,threshold:r,trackVisibility:a,delay:s},i),()=>{t&&t()}}),[Array.isArray(r)?r.toString():r,u,e,n,l,o,a,i,s]);const g=null===(d=p.entry)||void 0===d?void 0:d.target,v=t.useRef();u||!g||l||o||v.current===g||(v.current=g,h({inView:!1,entry:void 0}));const y=[m,p.inView,p.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y})(Object.assign({},e,{triggerOnce:!i}));t.useEffect((()=>{r||Jn("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const u={[rr("lazy-load")]:!0};return t.createElement("div",{ref:s,className:Pe(u,a),style:o},n||c?e.children:t.createElement("div",{className:"placeholder",style:{height:r}},l))};class Hf{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 $f{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 $f(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,l=e.y-t.y,i=t.x-n.x,a=t.y-n.y,o=(e.x+t.x)/2,s=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+l*l),m=Math.sqrt(i*i+a*a),p=m/(u+m),h=c+(o-c)*p,f=d+(s-d)*p,g=t.x-h,v=t.y-f;return{c1:new Hf(o+g,s+v),c2:new Hf(c+g,d+v)}}constructor(e,t,n,r,l,i){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=l,this.endWidth=i}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const l=r/10,i=this.point(l,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this.point(l,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=i-e,l=a-t;n+=Math.sqrt(r*r+l*l)}e=i,t=a}return n}point(e,t,n,r,l){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+l*e*e*e}}class qf{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],l=r.points,i=l.length>0&&l[l.length-1],a=!!i&&n.distanceTo(i)<=this.minDistance,o=this._getPointGroupOptions(r);if(!i||!i||!a){const e=this._addPoint(n,o);t&&(i?e&&this._drawCurve(e,o):this._drawDot(n,o)),l.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,l=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<l;n+=1){const i=n/l,a=i*i,o=a*i,s=1-i,c=s*s,d=c*s;let u=d*e.startPoint.x;u+=3*c*i*e.control1.x,u+=3*s*a*e.control2.x,u+=o*e.endPoint.x;let m=d*e.startPoint.y;m+=3*c*i*e.control1.y,m+=3*s*a*e.control2.y,m+=o*e.endPoint.y;const p=Math.min(e.startWidth+o*r,t.maxWidth);this._drawCurveSegment(u,m,p)}n.closePath(),n.fill()},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 Hf(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=$f.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,l=this._strokeWidth(r,n),i={end:l,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=l,i},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:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e));this.setLastHistory(),this.ctx.beginPath(),this.ctx.rect(t,n,r-t,l-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:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=Math.min(r,t),a=Math.min(l,n),o=.5*(Math.max(r,t)-i),s=.5*(Math.max(l,n)-a),c=i+o,d=a+s;this.setLastHistory(),this.ctx.beginPath(),this.ctx.ellipse(c,d,o,s,0,0,2*Math.PI),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},this.drawArrow=e=>{if(!this._lastPoints.length)return;const{x:t,y:n}=this._lastPoints[0],{x:r,y:l}=this._createPointByEvent(this._pointerEventToSignatureEvent(e)),i=180*Math.atan2(n-l,t-r)/Math.PI,a=(i+25)*Math.PI/180,o=(i-25)*Math.PI/180,s=15*Math.cos(a),c=15*Math.sin(a),d=15*Math.cos(o),u=15*Math.sin(o);this.setLastHistory(),this.ctx.beginPath(),this.ctx.moveTo(t,n),this.ctx.lineTo(r,l),this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(r,l);const m=r+s,p=l+c;this.ctx.lineTo(m,p);const h=r+d,f=l+u;this.ctx.lineTo(h,f),this.ctx.lineTo(r,l),this.ctx.fill(),this.ctx.restore()},this.getAxisColor=(e,t,n)=>{const r=e.width,l=e.data,i=[];return i[0]=l[4*(n*r+t)],i[1]=l[4*(n*r+t)+1],i[2]=l[4*(n*r+t)+2],i[3]=l[4*(n*r+t)+3],i},this.setAxisColor=(e,t,n,r)=>{const l=e.width,i=e.data;i[4*(n*l+t)]=r[0],i[4*(n*l+t)+1]=r[1],i[4*(n*l+t)+2]=r[2],i[4*(n*l+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),l=r.width,i=r.height,a=l/this.degreeOfBlur,o=i/this.degreeOfBlur;for(let e=0;e<o;e++)for(let t=0;t<a;t++){const n=this.getAxisColor(r,t*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur),e*this.degreeOfBlur+Math.floor(Math.random()*this.degreeOfBlur));for(let l=0;l<this.degreeOfBlur;l++)for(let i=0;i<this.degreeOfBlur;i++)this.setAxisColor(r,t*this.degreeOfBlur+i,e*this.degreeOfBlur+l,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,l=this.width-t,i=e.target.innerText,a=[];let o="";for(let e=0;e<i.length;e++){const t=o+i[e];this.ctx.measureText(t).width>l&&o.length>0?(a.push(o),o=i[e]):o=t}a.push(o),a.forEach(((e,l)=>{this.ctx.fillText(e,t+1,n+l*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,1!==this.ratio&&t.scale(this.ratio,this.ratio),this.backgroundColor&&(t.fillStyle=this.backgroundColor,t.fillRect(0,0,e.width,e.height)),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.openSmooth=void 0===t.openSmooth?this.openSmooth:!!t.openSmooth,this.backgroundColor=this.openSmooth&&t.backgroundColor||this.backgroundColor,this.mode=t.mode||this.mode,this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,l,i=0,a=null;const o=()=>{i=Date.now(),a=null,n=e.apply(r,l),a||(r=null,l=[])};return function(...s){const c=Date.now(),d=t-(c-i);return r=this,l=s,d<=0||d>t?(a&&(clearTimeout(a),a=null),i=c,n=e.apply(r,l),a||(r=null,l=[])):a||(a=window.setTimeout(o,d)),n}}(this._strokeUpdate,this.throttle):this._strokeUpdate,this.minWidth=t.minWidth||this.minWidth,this.maxWidth=t.maxWidth||this.maxWidth,this.onStart=t.onStart,this.onEnd=t.onEnd,this.setCanvasSize(),this.setTextInput(),this.drawBgColor(),this.addListener())}update(){this.setCanvasSize(),this.clear()}destroy(){this.removeListener();for(const e in this)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=null)}}qf.dataURLToBlob=e=>{const t=e.split(";base64,"),n=t[0].split(":")[1],r=window.atob(t[1]),l=r.length,i=new Uint8Array(l);for(let e=0;e<l;++e)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})},qf.canvasToDataURL=e=>e.toDataURL("image/png",1),qf.canvasToBlob=e=>new Promise(((t,n)=>{e.toBlob((e=>e?t(e):n(null)),"image/png",1)}));const Kf=t.forwardRef(((e,n)=>{const{open:r,width:l,height:i,imageName:a,penColor:o,penMode:s,minWidth:c,maxWidth:d,backgroundColor:u,className:m,style:h,onOk:f,onCancel:g}=e,{t:v}=Gn(),y=t.useRef(),b=t.useRef(null),x=t.useRef(null),E=t.useRef(null),w=[2,4,6],C=[14,16,18,20,24,28],S=["#ff0000","#29cc29","#00bfff","#fe6151","#000000","#666666"],[N,T]=is(void 0,{value:r,postState:e=>null!=e&&e}),I=t.useMemo((()=>!!e.children),[e.children]),[R,O]=t.useState(s||(I?"square":"line")),[k,L]=t.useState(w[0]),[A,P]=t.useState(I?S[0]:S[4]),[_,F]=t.useState(C[1]),[D,M]=t.useState("bottomLeft"),[H,$]=t.useState(!1),[q,K]=t.useState(!1);t.useEffect((()=>{var e,t;const n={width:null!=l?l:null===(e=x.current)||void 0===e?void 0:e.offsetWidth,height:null!=i?i:null===(t=x.current)||void 0===t?void 0:t.offsetHeight,maxWidth:k,mode:R,penColor:A,fontSize:_,backgroundColor:u,openSmooth:!I};return n.openSmooth&&Object.assign(n,{penColor:o,minWidth:c,maxWidth:d}),y.current=new qf(b.current,n),()=>y.current.destroy()}),[]);const j=e=>{var t,n;const[r,a]=[null!=l?l:null===(t=x.current)||void 0===t?void 0:t.offsetWidth,null!=i?i:null===(n=x.current)||void 0===n?void 0:n.offsetHeight],{width:o,height:s}=y.current;let c=!1;r&&r!==o&&(y.current.width=r,c=!0),a&&a!==s&&(y.current.height=a,c=!0),(c||e)&&y.current.update()};Dl((()=>{I&&N&&j()}),[N,I]),Dl((()=>{y.current.setDrawMode(R)}),[R]),Dl((()=>{y.current.setLineWidth(k)}),[k]),Dl((()=>{y.current.setPenColor(A)}),[A]),Dl((()=>{y.current.setFontSize(_)}),[_]);const V=()=>hn(void 0,void 0,void 0,(function*(){const e=I?x.current.parentNode:b.current;if(e)try{const t=yield an(e,{useCORS:!0,logging:!1,ignoreElements:e=>e===E.current||e.classList.contains("spinning")});return qf.canvasToDataURL(t)}catch(e){Jn("Signature","生成合成图片失败!")}})),z=()=>{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:j,GET_DATE_URL:V})));const W=e=>{e&&M((()=>{const e=E.current.getBoundingClientRect();return e.top+e.height>=window.innerHeight})()?"topLeft":"bottomLeft")},B=e=>t.createElement("div",{className:Pe("ant-dropdown-menu","content")},"text"!==e?t.createElement("div",{className:"lineWidth"},w.map((e=>t.createElement("span",{key:e,className:Pe("dot",`s${e}`,{active:e===k}),onClick:()=>L(e)})))):t.createElement("div",{className:"fontSize"},t.createElement(de,{size:"small",value:_,options:C.map((e=>({value:e,label:e.toString()}))),onChange:e=>F(e)})),t.createElement("span",{className:"divider"}),t.createElement("div",{className:"penColor"},S.map((e=>t.createElement("span",{key:e,className:Pe("dot",{active:e===A}),style:{backgroundColor:e},onClick:()=>P(e)},t.createElement($e,{className:"icon"})))))),U=rr("signature"),G={[U]:!0,"is-annotation":I},Y=l?Object.assign(Object.assign({},h),{width:l}):h;return t.createElement("div",{className:Pe(G,m),style:Y},I&&t.createElement(t.Fragment,null,t.createElement("div",{ref:x,className:"content"},e.children),q&&t.createElement(ei,{spinning:!0,className:"spinning"})),t.createElement("div",{className:Pe("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:Pe("actions",{hidden:H})},t.createElement(me,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("square")},t.createElement(Dt,null))),t.createElement(me,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("round")},t.createElement(Tu,null))),t.createElement(me,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("arrow")},t.createElement(Ru,null))),t.createElement(me,{dropdownRender:B,overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("line")},t.createElement(He,null))),t.createElement(me,{dropdownRender:()=>B("text"),overlayClassName:`${U}__popper`,placement:D,trigger:["click"],onOpenChange:W},t.createElement("button",{className:"btn",onClick:()=>O("text")},t.createElement(Iu,null))),t.createElement("button",{className:"btn",onClick:()=>hn(void 0,void 0,void 0,(function*(){yield hn(void 0,void 0,void 0,(function*(){K(!0);const e=yield V();if(e){const t=a?a.slice(0,a.lastIndexOf(".")>0?a.lastIndexOf("."):void 0):p().format(Yo);wi(qf.dataURLToBlob(e),`${t}.png`)}K(!1)})),z()}))},t.createElement(Ke,null)),t.createElement("button",{className:"btn",onClick:()=>O("eraser")},t.createElement(Ou,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.undo()},t.createElement(ku,null)),t.createElement("button",{className:"btn",onClick:()=>y.current.clear()},t.createElement(Tt,null)),t.createElement("span",{className:"divider"}),t.createElement("button",{className:"btn",onClick:()=>null==g?void 0:g()},t.createElement(lt,null)),t.createElement("button",{className:"btn",onClick:()=>hn(void 0,void 0,void 0,(function*(){K(!0),yield xn(10);const e=yield V();K(!1),z(),null==f||f(e)}))},t.createElement($e,null))),t.createElement("button",{className:"btn btn-fold",title:v(H?"qm.divider.spread":"qm.divider.collect"),onClick:()=>$(!H)},H?t.createElement(ot,null):t.createElement(st,null))))))}));Kf.displayName="QmSignature";const jf="1.12.16";export{qn as Calendar,Kn as DatePicker,Li as DcpAnchor,er as DcpButton,_l as DcpCollapse,Xd as DcpColorPicker,Un as DcpConfigProvider,Jm as DcpCopyToClipboard,Zl as DcpCountup,bh as DcpCropper,lr as DcpDivider,Ii as DcpDownload,_i as DcpDrawer,Jl as DcpEmpty,Vh as DcpForm,Of as DcpGuideTracker,Mf as DcpLazyLoad,Mi as DcpModal,Ku as DcpPivotGrid,cf as DcpPrint,Rp as DcpRangeTableHelper,Ei as DcpScrollbar,dp as DcpSearchHelper,vm as DcpSearchTree,Kf as DcpSignature,nr as DcpSpace,ei as DcpSpin,Ql as DcpSplit,cp as DcpTable,Pi as DcpTabs,qh as DcpTinymce,Zh as DcpTour,gi as DcpTransition,No as DcpTranslate,Um as DcpTreeHelper,xp as DcpTreeTableHelper,Ti as DcpUploadFile,Eh as DcpUploadImg,em as DcpVirtualList,kf as DcpWatermark,Li as QmAnchor,er as QmButton,_l as QmCollapse,Xd as QmColorPicker,Un as QmConfigProvider,Jm as QmCopyToClipboard,Zl as QmCountup,bh as QmCropper,lr as QmDivider,Ii as QmDownload,_i as QmDrawer,Jl as QmEmpty,Vh as QmForm,Of as QmGuideTracker,Mf as QmLazyLoad,Mi as QmModal,Ku as QmPivotGrid,cf as QmPrint,Rp as QmRangeTableHelper,Ei as QmScrollbar,dp as QmSearchHelper,vm as QmSearchTree,Kf as QmSignature,nr as QmSpace,ei as QmSpin,Ql as QmSplit,cp as QmTable,Pi as QmTabs,qh as QmTinymce,Zh as QmTour,gi as QmTransition,No as QmTranslate,Um as QmTreeHelper,xp as QmTreeTableHelper,Ti as QmUploadFile,Eh as QmUploadImg,em as QmVirtualList,kf as QmWatermark,Vn as TimePicker,wo as pinyin,jf as version};